Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat: the api reports each request to an extension, god mode takes groups of sections, names are transliterated (#598)

Croff92e8fe16252d
diff --git a/apps/api/AGENTS.md b/apps/api/AGENTS.md
index 302bbd58..ac6b3cf3 100644
--- a/apps/api/AGENTS.md
+++ b/apps/api/AGENTS.md
@@ -298,6 +298,10 @@ undoes one.
answer. A reason fails the run without a retry, and answers the chat with 403.
- `onProjectEvent` (`modules/webhooks/emit.ts`): every issue and comment event the
webhooks get, inside the request that caused it.
+- `setRequestTracker` (`shared/request-tracker.ts`): every request, with its declared
+ route, params and body, before the guards run; a request it follows gets its status,
+ its account and the handler's value back after the handler, before the answer is sent,
+ or the status of the error a guard or the handler refused or failed it with.
Functions with no setter, for the routes such a build adds:
diff --git a/apps/api/package.json b/apps/api/package.json
index 6b509a27..8388adc3 100644
--- a/apps/api/package.json
+++ b/apps/api/package.json
@@ -42,6 +42,7 @@
"elysia": "^1.4.30",
"exceljs": "^4.4.0",
"mammoth": "^1.13.0",
+ "transliteration": "^2.6.1",
"zod": "^4.6.7"
},
"devDependencies": {
diff --git a/apps/api/src/app.ts b/apps/api/src/app.ts
index 4052ea63..f48ae596 100644
--- a/apps/api/src/app.ts
+++ b/apps/api/src/app.ts
@@ -22,6 +22,7 @@ import { scimRoutes } from './modules/scim';
import { currentUserRoutes } from './modules/current-user';
import { syncOidcGroupsAfterCallback } from './modules/scim/oidc-sync';
import { normalizeOpenApiResponse } from './openapi';
+import { requestTracking } from './shared/request-tracker';
import pkg from '../../../package.json';
const apiUrl = (process.env.API_URL ?? 'http://localhost:3000').replace(/\/+$/, '');
@@ -63,6 +64,8 @@ export const app = new Elysia()
allowedHeaders: ['Content-Type', 'Authorization', 'x-api-key'],
}),
)
+ // Before the routes: a hook applies only to the routes registered after it.
+ .use(requestTracking)
.onAfterHandle({ as: 'global' }, ({ request, response }) =>
normalizeOpenApiResponse(request, response),
)
diff --git a/apps/api/src/modules/agents/skills/__tests__/integration/agent-skills.test.ts b/apps/api/src/modules/agents/skills/__tests__/integration/agent-skills.test.ts
index cd114700..2a18c102 100644
--- a/apps/api/src/modules/agents/skills/__tests__/integration/agent-skills.test.ts
+++ b/apps/api/src/modules/agents/skills/__tests__/integration/agent-skills.test.ts
@@ -113,6 +113,14 @@ describe('agent skills', () => {
)({ skillId }).references.content.get({ query: { path } });
expect(content.status).toBe(200);
expect(content.data?.content).toBe('# Checklist\n\nItem one');
+
+ const transliterated = await skills(
+ asOwner,
+ teamId,
+ )({ skillId }).references.post({
+ file: new File(['Пункт'], 'Чек-лист релиза.md', { type: 'text/markdown' }),
+ });
+ expect(transliterated.data?.files.map((one) => one.path)).toContain('refs/Chek-list_reliza.md');
});
it("overwrites a reference file's content and updates its size", async () => {
diff --git a/apps/api/src/modules/agents/skills/service.ts b/apps/api/src/modules/agents/skills/service.ts
index 95cfb16a..5de4acdd 100644
--- a/apps/api/src/modules/agents/skills/service.ts
+++ b/apps/api/src/modules/agents/skills/service.ts
@@ -1,5 +1,6 @@
import { db, agentSkill, agentSkillLink } from '@repo/db';
import { and, eq, inArray, sql } from 'drizzle-orm';
+import { transliterate } from 'transliteration';
import { iso, rethrowDuplicate, HttpError } from '#shared/lib';
import { putObject, getObjectText, deleteObjects } from '@repo/storage';
import { parseFrontmatter, isDisallowedRef } from './skill-format';
@@ -261,7 +262,8 @@ export async function updateSkill(
}
// Adds a reference file to a skill. Rejects executable files (no scripts in a
-// skill). The path is the sanitized file name under refs/.
+// skill). The path is the file name under refs/, transliterated so a name in another
+// script does not turn into underscores only.
export async function addReference(
id: number,
teamId: number,
@@ -269,7 +271,7 @@ export async function addReference(
bytes: Buffer,
contentType: string,
): Promise<SkillRow | null> {
- const safeName = filename.replace(/[^A-Za-z0-9._-]/g, '_');
+ const safeName = transliterate(filename).replace(/[^A-Za-z0-9._-]/g, '_');
if (!safeName || isDisallowedRef(safeName)) {
throw new HttpError(400, 'This file type is not allowed as a skill reference');
}
diff --git a/apps/api/src/planner.ts b/apps/api/src/planner.ts
index 8203823d..dc631fe5 100644
--- a/apps/api/src/planner.ts
+++ b/apps/api/src/planner.ts
@@ -1,5 +1,5 @@
import { Elysia } from 'elysia';
-import { HttpError, pgErrorCode } from './shared/lib';
+import { errorAnswer } from './shared/lib';
import { authContext } from './shared/auth-context';
import { projectRoutes } from './modules/projects';
import { teamRoutes } from './modules/teams';
@@ -63,30 +63,10 @@ import { linkPreviewRoutes } from './modules/link-previews';
export const planner = new Elysia({ name: 'planner' })
.use(authContext)
.onError({ as: 'global' }, ({ code, error, set }) => {
- if (error instanceof HttpError) {
- set.status = error.status;
- return error.code ? { error: error.message, code: error.code } : { error: error.message };
- }
- if (code === 'VALIDATION') {
- set.status = 400;
- // The validator's first message is enough for the UI; the full report is
- // large JSON that the client would just show verbatim.
- const first = (error as { all?: { summary?: string }[] }).all?.[0]?.summary;
- return { error: first ?? 'Invalid request body' };
- }
- if (code === 'NOT_FOUND') {
- set.status = 404;
- return { error: 'Not found' };
- }
- if (pgErrorCode(error) === '23505') {
- set.status = 409;
- return { error: 'A record with this name already exists.' };
- }
- // The message stays in the log only. drizzle puts the failed statement and its
- // parameters in it, and the public routes would hand that to anyone.
- console.error('[planner] unhandled error:', error);
- set.status = 500;
- return { error: 'Internal server error' };
+ const answer = errorAnswer(code, error);
+ if (answer.status === 500) console.error('[planner] unhandled error:', error);
+ set.status = answer.status;
+ return answer.body;
})
.use(projectRoutes)
.use(teamRoutes)
diff --git a/apps/api/src/shared/__tests__/integration/request-tracker.test.ts b/apps/api/src/shared/__tests__/integration/request-tracker.test.ts
new file mode 100644
index 00000000..d42e5742
--- /dev/null
+++ b/apps/api/src/shared/__tests__/integration/request-tracker.test.ts
@@ -0,0 +1,97 @@
+import { describe, it, expect, beforeEach, afterEach } from 'bun:test';
+import { app, authedApi } from '../../../__tests__/helpers/app';
+import { signUpTestUser } from '../../../__tests__/helpers/auth';
+import { resetDb } from '../../../__tests__/helpers/db';
+import { setRequestTracker, type TrackedAnswer, type TrackedRequest } from '../../request-tracker';
+
+interface Seen {
+ request: Omit<TrackedRequest, 'request'> & { method: string };
+ answer?: Omit<TrackedAnswer, 'user'> & { userId: string | null };
+}
+
+// Follows every request to a team route and records what the tracker was handed.
+function trackTeams(): Seen[] {
+ const seen: Seen[] = [];
+ setRequestTracker(async ({ request, route, params, body }) => {
+ if (!route.startsWith('/teams')) return undefined;
+ const entry: Seen = { request: { method: request.method, route, params, body } };
+ seen.push(entry);
+ return async ({ status, user, value }) => {
+ entry.answer = { status, value, userId: user?.id ?? null };
+ };
+ });
+ return seen;
+}
+
+describe('request tracker', () => {
+ beforeEach(resetDb);
+ afterEach(() => setRequestTracker());
+
+ it('hands over the route, its params and body, then the answer and who asked', async () => {
+ const owner = await signUpTestUser();
+ const seen = trackTeams();
+ const created = await authedApi(owner.cookie).teams.post({
+ name: 'Marketing',
+ slug: 'marketing',
+ workspaceId: owner.workspaceId!,
+ });
+ expect(created.status).toBe(201);
+ const teamId = created.data!.id;
+ await authedApi(owner.cookie).teams({ teamId }).delete();
+
+ expect(seen).toMatchObject([
+ {
+ request: { method: 'POST', route: '/teams', body: { name: 'Marketing' } },
+ answer: { status: 201, userId: owner.userId, value: { id: teamId, name: 'Marketing' } },
+ },
+ {
+ request: { method: 'DELETE', route: '/teams/:teamId', params: { teamId } },
+ answer: { status: 204, userId: owner.userId, value: undefined },
+ },
+ ]);
+ });
+
+ it('hands over the status of a request a guard refuses, and who asked', async () => {
+ const owner = await signUpTestUser();
+ const stranger = await signUpTestUser();
+ const teamId = (await authedApi(owner.cookie).teams.get()).data![0].id;
+ const seen = trackTeams();
+ const res = await authedApi(stranger.cookie).teams({ teamId }).delete();
+ expect(res.status).toBe(404);
+ expect(res.error?.value).toEqual({ error: 'Team not found' });
+ expect(seen).toMatchObject([
+ { answer: { status: 404, userId: stranger.userId, value: undefined } },
+ ]);
+ });
+
+ it('does not fail the request when the tracker throws', async () => {
+ const owner = await signUpTestUser();
+ const teamId = (await authedApi(owner.cookie).teams.get()).data![0].id;
+ setRequestTracker(async () => async () => {
+ throw new Error('tracker failed');
+ });
+ const res = await authedApi(owner.cookie)
+ .teams({ teamId })
+ .patch({ name: 'Renamed', slug: 'renamed' });
+ expect(res.status).toBe(200);
+ expect(res.data?.name).toBe('Renamed');
+ });
+
+ it('leaves the body to a route that reads the raw request', async () => {
+ const owner = await signUpTestUser({ password: 'test-password-123' });
+ let body: unknown = 'not handed over';
+ setRequestTracker(async (request) => {
+ if (request.route === '/api/auth/*') body = request.body;
+ return undefined;
+ });
+ const res = await app.handle(
+ new Request('http://localhost/api/auth/sign-in/email', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ email: owner.email, password: 'test-password-123' }),
+ }),
+ );
+ expect(res.status).toBe(200);
+ expect(body).toBeUndefined();
+ });
+});
diff --git a/apps/api/src/shared/lib.ts b/apps/api/src/shared/lib.ts
index 909dc69f..5aca5aad 100644
--- a/apps/api/src/shared/lib.ts
+++ b/apps/api/src/shared/lib.ts
@@ -66,6 +66,31 @@ export function rethrowDuplicate(err: unknown, what: string): never {
throw err;
}
+// The status and the { error } body the planner answers an error with. `code` is the
+// one Elysia hands to onError.
+export function errorAnswer(
+ code: unknown,
+ error: unknown,
+): { status: number; body: { error: string; code?: string } } {
+ if (error instanceof HttpError) {
+ const body = error.code ? { error: error.message, code: error.code } : { error: error.message };
+ return { status: error.status, body };
+ }
+ if (code === 'VALIDATION') {
+ // The validator's first message is enough for the UI; the full report is
+ // large JSON that the client would just show verbatim.
+ const first = (error as { all?: { summary?: string }[] }).all?.[0]?.summary;
+ return { status: 400, body: { error: first ?? 'Invalid request body' } };
+ }
+ if (code === 'NOT_FOUND') return { status: 404, body: { error: 'Not found' } };
+ if (pgErrorCode(error) === '23505') {
+ return { status: 409, body: { error: 'A record with this name already exists.' } };
+ }
+ // drizzle puts the failed statement and its parameters in the message, and the public
+ // routes would hand that to anyone.
+ return { status: 500, body: { error: 'Internal server error' } };
+}
+
// Reads a positive integer from an environment variable, falling back to the default
// when unset, empty, or not a positive finite number.
export function intEnv(name: string, fallback: number): number {
diff --git a/apps/api/src/shared/request-tracker.ts b/apps/api/src/shared/request-tracker.ts
new file mode 100644
index 00000000..0b050d85
--- /dev/null
+++ b/apps/api/src/shared/request-tracker.ts
@@ -0,0 +1,99 @@
+import { Elysia, ElysiaCustomStatusResponse } from 'elysia';
+import type { SessionUser } from './auth-context';
+import { errorAnswer } from './lib';
+
+// A request handed to an extension of the api before its handler runs, after it is
+// validated and before the session and the access guards are resolved.
+export interface TrackedRequest {
+ request: Request;
+ // The matched route as declared, with its parameters unfilled: `/teams/:teamId`.
+ route: string;
+ params: Record<string, unknown>;
+ // The parsed body of a route that reads one; undefined where the handler reads the raw
+ // request.
+ body: unknown;
+}
+
+// The answer of a tracked request: what its handler returned, or the status of the error
+// that refused or failed it.
+export interface TrackedAnswer {
+ status: number;
+ // The account the session or credential belongs to, null on a route that reads none or
+ // where the request failed before it was read.
+ user: SessionUser | null;
+ // The handler's value; undefined when it returned a raw Response or failed.
+ value: unknown;
+}
+
+type FinishTracking = (answer: TrackedAnswer) => Promise<void>;
+
+// Called for every request. It returns undefined for a request it does not follow, or
+// the call that takes the request's answer, so it can read what the request is about to
+// change while it is still there.
+type RequestTracker = (request: TrackedRequest) => Promise<FinishTracking | undefined> | undefined;
+
+let tracker: RequestTracker | undefined;
+
+export function setRequestTracker(next?: RequestTracker): void {
+ tracker = next;
+}
+
+const pending = new WeakMap<Request, FinishTracking>();
+
+// Elysia reads a request's body only for the routes whose handler or hooks name `body`,
+// and a hook on every route that named it would read the body of each one, which leaves
+// nothing for a route that reads the raw request: better-auth, the git webhooks. Read by
+// a computed key, the body is what the route parsed for itself, or undefined.
+const BODY = ['bo', 'dy'].join('');
+
+function answerOf(value: unknown, status: unknown): Omit<TrackedAnswer, 'user'> {
+ if (value instanceof Response) return { status: value.status, value: undefined };
+ if (value instanceof ElysiaCustomStatusResponse) {
+ return { status: Number(value.code), value: value.response };
+ }
+ return { status: typeof status === 'number' ? status : 200, value };
+}
+
+async function finishTracking(
+ request: Request,
+ user: SessionUser | null | undefined,
+ answer: Omit<TrackedAnswer, 'user'>,
+): Promise<void> {
+ const finish = pending.get(request);
+ if (!finish) return;
+ pending.delete(request);
+ try {
+ await finish({ ...answer, user: user ?? null });
+ } catch (error) {
+ console.error('[request-tracker] with the answer:', error);
+ }
+}
+
+// The answer is handed over before it is sent, so the request ends after the tracker is
+// done with it. An error is handed over before the planner's onError turns it into the
+// response, since this is registered first, and is left to it.
+export const requestTracking = new Elysia({ name: 'request-tracking' })
+ .onBeforeHandle({ as: 'global' }, async (ctx) => {
+ if (!tracker) return;
+ try {
+ const { request, route } = ctx;
+ const body = (ctx as Record<string, unknown>)[BODY];
+ const finish = await tracker({ request, route, params: ctx.params ?? {}, body });
+ if (finish) pending.set(request, finish);
+ } catch (error) {
+ console.error('[request-tracker] before the handler:', error);
+ }
+ })
+ .onAfterHandle({ as: 'global' }, (ctx) =>
+ finishTracking(
+ ctx.request,
+ (ctx as { user?: SessionUser | null }).user,
+ answerOf(ctx.responseValue, ctx.set.status),
+ ),
+ )
+ .onError({ as: 'global' }, (ctx) =>
+ finishTracking(ctx.request, (ctx as { user?: SessionUser | null }).user, {
+ status: errorAnswer(ctx.code, ctx.error).status,
+ value: undefined,
+ }),
+ );
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 174ea714..103f094e 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -31,7 +31,9 @@ Next.js App Router, SSR (not SPA). Tailwind v4 + shadcn/ui. See root `AGENTS.md`
the app shell, god mode and the teams pages; here it shows nothing, while the hosted
build shows notices about the instance there. `godSections(core)` returns the god mode
sections: here the core's as they are, while the hosted build adds, replaces or drops
- some. One it adds carries in `Component` the page `/god/<slug>` opens. The instance's
+ some. One it adds carries in `Component` the page `/god/<slug>` opens, and may sit in a
+ group of its own: the sidebar lists the groups in the order their first section comes,
+ each named in `sections.godGroups`. The instance's
SCIM is set up in god mode; the hosted build that also sets it up per workspace adds
`WorkspaceScimSection` through `useWorkspaceSections`. `SignInExtras` sits among the sign-in methods, after the
instance's own provider; here it adds nothing, while the hosted build offers a sign-in
diff --git a/apps/web/package.json b/apps/web/package.json
index 4cabd163..d733274d 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -77,7 +77,8 @@
"react-grid-layout": "^2.3.0",
"recharts": "3.10.1",
"sonner": "^2.0.8",
- "tiptap-markdown": "^0.9.0"
+ "tiptap-markdown": "^0.9.0",
+ "transliteration": "^2.6.1"
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
diff --git a/apps/web/src/features/documents/utils/documentExport.test.ts b/apps/web/src/features/documents/utils/documentExport.test.ts
index aac6bd70..4c8730c8 100644
--- a/apps/web/src/features/documents/utils/documentExport.test.ts
+++ b/apps/web/src/features/documents/utils/documentExport.test.ts
@@ -29,6 +29,9 @@ describe('document export', () => {
'release-notes-2026.md',
);
assert.equal(documentExportFilename('', 'html'), 'untitled.html');
+ assert.equal(documentExportFilename('Заметки к релизу', 'markdown'), 'zametki-k-relizu.md');
+ assert.equal(documentExportFilename('Café São Paulo', 'html'), 'cafe-sao-paulo.html');
+ assert.equal(documentExportFilename('★', 'html'), 'untitled.html');
assert.equal(documentExportArchiveFilename('Release notes 2026'), 'release-notes-2026.zip');
});
diff --git a/apps/web/src/features/documents/utils/documentExport.ts b/apps/web/src/features/documents/utils/documentExport.ts
index 35c51854..a1d2b1cb 100644
--- a/apps/web/src/features/documents/utils/documentExport.ts
+++ b/apps/web/src/features/documents/utils/documentExport.ts
@@ -1,6 +1,7 @@
import { marked } from 'marked';
import DOMPurify from 'isomorphic-dompurify';
import JSZip from 'jszip';
+import { transliterate } from '@/utils/transliterate';
export type DocumentExportFormat = 'markdown' | 'html';
@@ -59,11 +60,9 @@ function escapeHtml(value: string): string {
}
export function documentExportFilename(title: string, extension: DocumentExportFormat): string {
- const base = title
- .trim()
+ const base = transliterate(title)
.toLowerCase()
- .normalize('NFKD')
- .replace(/[^\p{Letter}\p{Number}]+/gu, '-')
+ .replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '')
.slice(0, 80);
return `${base || 'untitled'}.${extension === 'markdown' ? 'md' : 'html'}`;
diff --git a/apps/web/src/features/issue/utils/issuePrompt.test.ts b/apps/web/src/features/issue/utils/issuePrompt.test.ts
index dd808c6c..4587f246 100644
--- a/apps/web/src/features/issue/utils/issuePrompt.test.ts
+++ b/apps/web/src/features/issue/utils/issuePrompt.test.ts
@@ -13,13 +13,24 @@ describe('buildIssueBranchName', () => {
);
});
- it('falls back to an identifier-only branch for a non-latin title', () => {
+ it('transliterates a title in another script', () => {
assert.equal(
buildIssueBranchName(
{ identifier: 'ENG-7', title: 'Проверить пилот' },
{ email: '[email protected]' },
),
- 'alexsmith/eng-7',
+ 'alexsmith/eng-7-proverit-pilot',
+ );
+ assert.equal(
+ buildIssueBranchName({ identifier: 'ENG-8', title: '修复登录' }, { name: 'Анна' }),
+ 'anna/eng-8-xiu-fu-deng-lu',
+ );
+ });
+
+ it('falls back to an identifier-only branch for a title with no letters', () => {
+ assert.equal(
+ buildIssueBranchName({ identifier: 'ENG-9', title: '🚀 !!!' }, { email: '[email protected]' }),
+ 'a/eng-9',
);
});
});
diff --git a/apps/web/src/features/issue/utils/issuePrompt.ts b/apps/web/src/features/issue/utils/issuePrompt.ts
index 44743dce..382267db 100644
--- a/apps/web/src/features/issue/utils/issuePrompt.ts
+++ b/apps/web/src/features/issue/utils/issuePrompt.ts
@@ -1,19 +1,19 @@
import type { ProjectDetail } from '@/lib/api/endpoints/projects';
import type { Issue } from '@/lib/api/endpoints/issues';
import { issuePath } from '@/utils/paths';
+import { transliterate } from '@/utils/transliterate';
-// A git-branch-safe handle from the current user: the email local part (or name)
-// with everything but letters and digits removed. "[email protected]" ->
+// A git-branch-safe handle from the current user: "[email protected]" ->
// "poluosmaka". Empty when there is no user, which drops the branch prefix.
function userHandle(name: string | null | undefined, email: string | null | undefined): string {
const base = email ? email.split('@')[0] : (name ?? '');
- return base.toLowerCase().replace(/[^a-z0-9]+/g, '');
+ return transliterate(base)
+ .toLowerCase()
+ .replace(/[^a-z0-9]+/g, '');
}
-// A kebab slug from the issue title for the branch name: lowercase, non-alphanumeric
-// runs collapsed to a single dash, trimmed, capped so the branch stays short.
function titleSlug(title: string): string {
- return title
+ return transliterate(title)
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '')
diff --git a/apps/web/src/features/teams/utils/agentForm.ts b/apps/web/src/features/teams/utils/agentForm.ts
index 924167bc..6dacc6ad 100644
--- a/apps/web/src/features/teams/utils/agentForm.ts
+++ b/apps/web/src/features/teams/utils/agentForm.ts
@@ -5,7 +5,7 @@ import type {
AiAgentPatch,
ReasoningEffort,
} from '@/lib/api/endpoints/agents';
-import { transliterate } from '@/utils/projectKey';
+import { transliterate } from '@/utils/transliterate';
import { delaySecFromMinutes } from '@/utils/runDelay';
// The editable shape of an agent form. temperature/maxSteps are kept as strings so
diff --git a/apps/web/src/features/teams/utils/teamSlug.test.ts b/apps/web/src/features/teams/utils/teamSlug.test.ts
index 3fe4f623..37692982 100644
--- a/apps/web/src/features/teams/utils/teamSlug.test.ts
+++ b/apps/web/src/features/teams/utils/teamSlug.test.ts
@@ -7,6 +7,10 @@ describe('suggestTeamSlug', () => {
assert.equal(suggestTeamSlug('Acme Design'), 'acme-design');
assert.equal(suggestTeamSlug(' 42 -- Ops! '), 'ops');
assert.equal(suggestTeamSlug('Команда'), 'komanda');
+ assert.equal(suggestTeamSlug('Хлеб и Ґанок'), 'khleb-i-ganok');
+ assert.equal(suggestTeamSlug('Ομάδα πωλήσεων'), 'omada-poliseon');
+ assert.equal(suggestTeamSlug('北京团队'), 'bei-jing-tuan-dui');
+ assert.equal(suggestTeamSlug('Қазақ'), 'kazak');
const long = suggestTeamSlug(`a${'-b'.repeat(30)}`);
assert.ok(TEAM_SLUG_PATTERN.test(long), long);
});
diff --git a/apps/web/src/features/teams/utils/teamSlug.ts b/apps/web/src/features/teams/utils/teamSlug.ts
index 36a4cd40..89b12d9c 100644
--- a/apps/web/src/features/teams/utils/teamSlug.ts
+++ b/apps/web/src/features/teams/utils/teamSlug.ts
@@ -1,4 +1,4 @@
-import { transliterate } from '@/utils/projectKey';
+import { transliterate } from '@/utils/transliterate';
// Mirrors the API's rule for a slug.
export const TEAM_SLUG_PATTERN = /^[a-z][a-z0-9-]{0,38}[a-z0-9]$/;
diff --git a/apps/web/src/hooks/useSectionLabels.ts b/apps/web/src/hooks/useSectionLabels.ts
index d5823288..5c76c84d 100644
--- a/apps/web/src/hooks/useSectionLabels.ts
+++ b/apps/web/src/hooks/useSectionLabels.ts
@@ -1,7 +1,6 @@
'use client';
import { useTranslations } from 'next-intl';
-import type { GodGroup } from '@/utils/godSections';
import { byKey } from '@/utils/messageKey';
// The names and blurbs of the navigable sections — project settings, god mode and
@@ -24,7 +23,7 @@ export function useGodSectionText() {
const tGroup = useTranslations('sections.godGroups');
return {
section: (slug: string) => sectionText(t, slug),
- group: (group: GodGroup) => tGroup(group),
+ group: (group: string) => byKey(tGroup)(group),
};
}
diff --git a/apps/web/src/utils/godSections.ts b/apps/web/src/utils/godSections.ts
index ebde619c..7eb31975 100644
--- a/apps/web/src/utils/godSections.ts
+++ b/apps/web/src/utils/godSections.ts
@@ -17,20 +17,19 @@ import { godSections } from '@/cloud';
// The god mode sections, in sidebar order. God mode is instance administration,
// open only to the owner account; the sections mirror the project settings pattern
// (one slug per page under /god/<slug>), so adding one is an entry here plus a page.
-// `group` is the sidebar heading a section sits under; GOD_GROUPS gives the order.
+// `group` is the sidebar heading a section sits under; the groups come in the order
+// their first section has in the list.
// A section with `integration: true` is not listed under its group directly: it sits
// inside the "Integrations" item at the end of the group. The name and the blurb of
-// a section, and the name of a group, are messages under `sections.god`. The hosted
-// build gets the list through `godSections` in `@/cloud` and may add, replace or drop
-// sections; one it adds carries its page in `Component`, opened at /god/<slug>, and its
-// messages come with the hosted build's.
-
-export const GOD_GROUPS = ['management', 'instance'] as const;
-export type GodGroup = (typeof GOD_GROUPS)[number];
+// a section are messages under `sections.god`, the name of a group under
+// `sections.godGroups`. The hosted build gets the list through `godSections` in `@/cloud`
+// and may add, replace or drop sections; one it adds carries its page in `Component`,
+// opened at /god/<slug>, may open a group of its own, and its messages come with the
+// hosted build's.
export interface GodSection {
slug: string;
- group: GodGroup;
+ group: string;
icon: LucideIcon;
integration?: true;
Component?: ComponentType;
@@ -98,16 +97,18 @@ export const GOD_SECTIONS: GodSection[] = godSections([
},
]);
+export const GOD_GROUPS = [...new Set(GOD_SECTIONS.map((s) => s.group))];
+
export function godSection(slug: string): GodSection {
const section = GOD_SECTIONS.find((s) => s.slug === slug);
if (!section) throw new Error(`Unknown god section: ${slug}`);
return section;
}
-export function godSectionsIn(group: GodGroup): GodSection[] {
+export function godSectionsIn(group: string): GodSection[] {
return GOD_SECTIONS.filter((s) => s.group === group && !s.integration);
}
-export function godIntegrationsIn(group: GodGroup): GodSection[] {
+export function godIntegrationsIn(group: string): GodSection[] {
return GOD_SECTIONS.filter((s) => s.group === group && s.integration);
}
diff --git a/apps/web/src/utils/projectKey.ts b/apps/web/src/utils/projectKey.ts
index e9703d1b..1c9f6e2d 100644
--- a/apps/web/src/utils/projectKey.ts
+++ b/apps/web/src/utils/projectKey.ts
@@ -1,51 +1,6 @@
-export const KEY_MAX_LENGTH = 10;
-
-// Cyrillic → Latin transliteration so a Russian/Ukrainian name still yields a
-// Latin key (keys appear in issue identifiers like "IAP-14"). Multi-letter
-// mappings must be applied before the regex that keeps only [A-Z0-9].
-const TRANSLIT: Record<string, string> = {
- А: 'A',
- Б: 'B',
- В: 'V',
- Г: 'G',
- Ґ: 'G',
- Д: 'D',
- Е: 'E',
- Ё: 'E',
- Є: 'E',
- Ж: 'ZH',
- З: 'Z',
- И: 'I',
- І: 'I',
- Ї: 'I',
- Й: 'Y',
- К: 'K',
- Л: 'L',
- М: 'M',
- Н: 'N',
- О: 'O',
- П: 'P',
- Р: 'R',
- С: 'S',
- Т: 'T',
- У: 'U',
- Ф: 'F',
- Х: 'KH',
- Ц: 'TS',
- Ч: 'CH',
- Ш: 'SH',
- Щ: 'SCH',
- Ъ: '',
- Ы: 'Y',
- Ь: '',
- Э: 'E',
- Ю: 'YU',
- Я: 'YA',
-};
+import { transliterate } from '@/utils/transliterate';
-export function transliterate(input: string): string {
- return input.replace(/[а-яёіїєґ]/gi, (ch) => TRANSLIT[ch.toUpperCase()] ?? ch);
-}
+export const KEY_MAX_LENGTH = 10;
// Suggests a short project key from the name, in the style of Jira/Linear:
// several words become their initials (e.g. "Marketing Team" → "MT"), a single
diff --git a/apps/web/src/utils/transliterate.ts b/apps/web/src/utils/transliterate.ts
new file mode 100644
index 00000000..6af5dd7e
--- /dev/null
+++ b/apps/web/src/utils/transliterate.ts
@@ -0,0 +1,51 @@
+import { transliterate as toLatin } from 'transliteration';
+
+// Russian and Ukrainian go by this table, the way passports write them (Х → KH, Ц → TS),
+// which the library does not. The keys are upper case; the callers set the case.
+const TRANSLIT: Record<string, string> = {
+ А: 'A',
+ Б: 'B',
+ В: 'V',
+ Г: 'G',
+ Ґ: 'G',
+ Д: 'D',
+ Е: 'E',
+ Ё: 'E',
+ Є: 'E',
+ Ж: 'ZH',
+ З: 'Z',
+ И: 'I',
+ І: 'I',
+ Ї: 'I',
+ Й: 'Y',
+ К: 'K',
+ Л: 'L',
+ М: 'M',
+ Н: 'N',
+ О: 'O',
+ П: 'P',
+ Р: 'R',
+ С: 'S',
+ Т: 'T',
+ У: 'U',
+ Ф: 'F',
+ Х: 'KH',
+ Ц: 'TS',
+ Ч: 'CH',
+ Ш: 'SH',
+ Щ: 'SCH',
+ Ъ: '',
+ Ы: 'Y',
+ Ь: '',
+ Э: 'E',
+ Ю: 'YU',
+ Я: 'YA',
+};
+
+// Every other script goes through the library ("北京" → "Bei Jing"). It marks some letters
+// with an apostrophe (Kazakh Қ → K'), which would split a slug inside a word, so
+// apostrophes are dropped.
+export function transliterate(input: string): string {
+ const cyrillic = input.replace(/[а-яёіїєґ]/gi, (ch) => TRANSLIT[ch.toUpperCase()] ?? ch);
+ return toLatin(cyrillic).replace(/['`ʼ’]/g, '');
+}
diff --git a/bun.lock b/bun.lock
index 4267f88c..b2f5a682 100644
--- a/bun.lock
+++ b/bun.lock
@@ -44,6 +44,7 @@
"elysia": "^1.4.30",
"exceljs": "^4.4.0",
"mammoth": "^1.13.0",
+ "transliteration": "^2.6.1",
"zod": "^4.6.7",
},
"devDependencies": {
@@ -139,6 +140,7 @@
"recharts": "3.10.1",
"sonner": "^2.0.8",
"tiptap-markdown": "^0.9.0",
+ "transliteration": "^2.6.1",
},
"devDependencies": {
"@repo/eslint-config": "workspace:*",
@@ -2771,6 +2773,8 @@
"tr46": ["[email protected]", "", { "dependencies": { "punycode": "^2.3.1" } }, "sha512-BcDSDW+SIGWVOns1Zm6Yg91q9AEj7eaID0QDY9oIqJD1A8dscNwMcl9Sms2DeuWCNov1X0/oXanHGYQBSLwZsg=="],
+ "transliteration": ["[email protected]", "", { "bin": { "transliterate": "dist/bin/transliterate", "slugify": "dist/bin/slugify" } }, "sha512-hJ9BhrQAOnNTbpOr1MxsNjZISkn7ppvF5TKUeFmTE1mG4ZPD/XVxF0L0LUoIUCWmQyxH0gJpVtfYLAWf298U9w=="],
+
"traverse": ["[email protected]", "", {}, "sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ=="],
"trim-lines": ["[email protected]", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="],
@@ -3145,20 +3149,8 @@
"pretty-format/ansi-styles": ["[email protected]", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="],
-
-
-
"prosemirror-markdown/@types/markdown-it": ["@types/[email protected]", "", { "dependencies": { "@types/linkify-it": "^5", "@types/mdurl": "^2" } }, "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog=="],
-
-
-
-
-
-
-
-
-
"radix-vue/@vueuse/core": ["@vueuse/[email protected]", "", { "dependencies": { "@types/web-bluetooth": "^0.0.20", "@vueuse/metadata": "10.11.1", "@vueuse/shared": "10.11.1", "vue-demi": ">=0.14.8" } }, "sha512-guoy26JQktXPcz+0n3GukWIy/JDNKti9v6VEMu6kV2sYBsWuGiTU8OWdg+ADfUbHg3/3DlqySDe7JmdHrktiww=="],
"radix-vue/@vueuse/shared": ["@vueuse/[email protected]", "", { "dependencies": { "vue-demi": ">=0.14.8" } }, "sha512-LHpC8711VFZlDaYUXEBbFBCQ7GS3dVU9mjOhhMhXP6txTV4EhYQg/KGnQuvt/sPAtoUKq7VVUnL6mVtFoL42sA=="],
@@ -3317,8 +3309,6 @@
"pretty-format/ansi-styles/color-convert": ["[email protected]", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="],
-
-
"prosemirror-markdown/@types/markdown-it/@types/linkify-it": ["@types/[email protected]", "", {}, "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q=="],
"prosemirror-markdown/@types/markdown-it/@types/mdurl": ["@types/[email protected]", "", {}, "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg=="],