@vocoder/cli 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +165 -885
- package/dist/bin.mjs.map +1 -1
- package/dist/{chunk-IZN5HVYD.mjs → chunk-XF3KGGYQ.mjs} +1024 -220
- package/dist/chunk-XF3KGGYQ.mjs.map +1 -0
- package/dist/lib.d.mts +339 -6
- package/dist/lib.mjs +13 -3
- package/dist/lib.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-IZN5HVYD.mjs.map +0 -1
package/dist/lib.d.mts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported app industry classifications.
|
|
3
|
+
* Set once in vocoder.config.ts; synced to ProjectApp at extraction time.
|
|
4
|
+
* Cannot be edited from the dashboard — config file is the source of truth.
|
|
5
|
+
*
|
|
6
|
+
* Keep in sync with APP_INDUSTRIES in
|
|
7
|
+
* vocoder-app/lib/vocoder/translation/context-constants.ts.
|
|
8
|
+
*/
|
|
9
|
+
type AppIndustry = "ecommerce" | "saas" | "healthcare" | "fintech" | "gaming" | "education" | "media" | "productivity";
|
|
10
|
+
/**
|
|
11
|
+
* Translation formality level.
|
|
12
|
+
* Can be set project-wide in vocoder.config.ts or overridden per-string
|
|
13
|
+
* via <T formality="formal"> (requires allowAiTranslations plan).
|
|
14
|
+
*/
|
|
15
|
+
type Formality = "formal" | "informal" | "neutral";
|
|
1
16
|
interface VocoderConfig {
|
|
2
17
|
/** Glob patterns for files to extract strings from. */
|
|
3
18
|
include?: string[];
|
|
@@ -13,6 +28,19 @@ interface VocoderConfig {
|
|
|
13
28
|
* If set, `vocoder sync` writes {locale}.json files to this path.
|
|
14
29
|
*/
|
|
15
30
|
localesPath?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The industry or domain of this application.
|
|
33
|
+
* Used to improve translation quality for domain-specific terminology
|
|
34
|
+
* and to isolate cache entries by industry in the global translation cache.
|
|
35
|
+
* Synced to ProjectApp at extraction time.
|
|
36
|
+
*/
|
|
37
|
+
appIndustry?: AppIndustry;
|
|
38
|
+
/**
|
|
39
|
+
* Project-wide default formality level for translations.
|
|
40
|
+
* Can be overridden per-string via <T formality="..."> on the AI plan.
|
|
41
|
+
* Synced to ProjectApp at extraction time.
|
|
42
|
+
*/
|
|
43
|
+
formality?: Formality;
|
|
16
44
|
}
|
|
17
45
|
/** Type helper for vocoder.config.ts — provides autocomplete and type checking. */
|
|
18
46
|
declare function defineConfig(config: VocoderConfig): VocoderConfig;
|
|
@@ -37,14 +65,11 @@ interface ExtractedString {
|
|
|
37
65
|
line: number;
|
|
38
66
|
context?: string;
|
|
39
67
|
formality?: "formal" | "informal" | "neutral" | "auto";
|
|
68
|
+
/** Detected UI role from JSX parent element or prop. e.g. "button_label", "heading", "input_placeholder" */
|
|
69
|
+
uiRole?: string;
|
|
40
70
|
}
|
|
41
71
|
declare class StringExtractor {
|
|
42
72
|
extractFromProject(pattern: string | string[], projectRoot?: string, excludePattern?: string | string[]): Promise<ExtractedString[]>;
|
|
43
|
-
private extractFromFile;
|
|
44
|
-
private extractPluralSelectICU;
|
|
45
|
-
private extractTemplateText;
|
|
46
|
-
private getStringAttribute;
|
|
47
|
-
private deduplicateStrings;
|
|
48
73
|
}
|
|
49
74
|
|
|
50
75
|
interface LocaleInfo {
|
|
@@ -53,12 +78,22 @@ interface LocaleInfo {
|
|
|
53
78
|
}
|
|
54
79
|
type LocalesMap = Record<string, LocaleInfo>;
|
|
55
80
|
type EffectiveSyncMode = "required" | "best-effort";
|
|
81
|
+
type RequestedSyncMode = "auto" | EffectiveSyncMode;
|
|
56
82
|
interface SyncPolicyConfig {
|
|
57
83
|
blockingBranches: string[];
|
|
58
84
|
blockingMode: EffectiveSyncMode;
|
|
59
85
|
nonBlockingMode: EffectiveSyncMode;
|
|
60
86
|
defaultMaxWaitMs: number;
|
|
61
87
|
}
|
|
88
|
+
interface RepoIdentityPayload {
|
|
89
|
+
repoCanonical?: string;
|
|
90
|
+
repoAppDir?: string;
|
|
91
|
+
commitSha?: string;
|
|
92
|
+
}
|
|
93
|
+
interface LocalConfig {
|
|
94
|
+
apiKey: string;
|
|
95
|
+
apiUrl: string;
|
|
96
|
+
}
|
|
62
97
|
interface APIProjectConfig {
|
|
63
98
|
projectName: string;
|
|
64
99
|
organizationName: string;
|
|
@@ -69,6 +104,13 @@ interface APIProjectConfig {
|
|
|
69
104
|
primaryBranch?: string;
|
|
70
105
|
syncPolicy: SyncPolicyConfig;
|
|
71
106
|
}
|
|
107
|
+
interface TranslationStringEntry {
|
|
108
|
+
key: string;
|
|
109
|
+
text: string;
|
|
110
|
+
context?: string;
|
|
111
|
+
formality?: "formal" | "informal" | "neutral" | "auto";
|
|
112
|
+
uiRole?: string;
|
|
113
|
+
}
|
|
72
114
|
interface TranslationBatchResponse {
|
|
73
115
|
batchId: string;
|
|
74
116
|
newStrings: number;
|
|
@@ -121,6 +163,38 @@ interface SyncPolicyErrorResponse {
|
|
|
121
163
|
boundRepoLabel?: string | null;
|
|
122
164
|
boundScopePath?: string | null;
|
|
123
165
|
}
|
|
166
|
+
interface InitStartResponse {
|
|
167
|
+
sessionId: string;
|
|
168
|
+
deviceCode: string;
|
|
169
|
+
verificationUrl: string;
|
|
170
|
+
expiresAt: string;
|
|
171
|
+
poll: {
|
|
172
|
+
token: string;
|
|
173
|
+
intervalSeconds: number;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
type InitStatusResponse = {
|
|
177
|
+
status: "pending";
|
|
178
|
+
pollIntervalSeconds: number;
|
|
179
|
+
expiresAt: string;
|
|
180
|
+
message?: string;
|
|
181
|
+
} | {
|
|
182
|
+
status: "failed";
|
|
183
|
+
message: string;
|
|
184
|
+
} | {
|
|
185
|
+
status: "completed";
|
|
186
|
+
credentials: {
|
|
187
|
+
apiKey: string;
|
|
188
|
+
apiUrl: string;
|
|
189
|
+
organizationId: string;
|
|
190
|
+
organizationName: string;
|
|
191
|
+
projectId: string;
|
|
192
|
+
projectName: string;
|
|
193
|
+
sourceLocale: string;
|
|
194
|
+
targetLocales: string[];
|
|
195
|
+
targetBranches?: string[];
|
|
196
|
+
};
|
|
197
|
+
};
|
|
124
198
|
|
|
125
199
|
type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
|
|
126
200
|
type DetectedFramework = "nextjs" | "vite" | "remix" | "nuxt" | "sveltekit" | "gatsby" | "angular" | null;
|
|
@@ -158,6 +232,265 @@ declare function getPackagesToInstall(detection: LocalDetectionResult): {
|
|
|
158
232
|
runtimePackages: string[];
|
|
159
233
|
};
|
|
160
234
|
|
|
235
|
+
declare class VocoderAPIError extends Error {
|
|
236
|
+
readonly status: number;
|
|
237
|
+
readonly payload: unknown;
|
|
238
|
+
readonly limitError: LimitErrorResponse | null;
|
|
239
|
+
readonly syncPolicyError: SyncPolicyErrorResponse | null;
|
|
240
|
+
constructor(params: {
|
|
241
|
+
message: string;
|
|
242
|
+
status: number;
|
|
243
|
+
payload: unknown;
|
|
244
|
+
limitError?: LimitErrorResponse | null;
|
|
245
|
+
syncPolicyError?: SyncPolicyErrorResponse | null;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
declare class VocoderAPI {
|
|
249
|
+
private apiUrl;
|
|
250
|
+
private apiKey;
|
|
251
|
+
constructor(config: LocalConfig);
|
|
252
|
+
private request;
|
|
253
|
+
/**
|
|
254
|
+
* Fetch project configuration from API
|
|
255
|
+
* Project is determined from the API key
|
|
256
|
+
*/
|
|
257
|
+
getProjectConfig(): Promise<APIProjectConfig>;
|
|
258
|
+
/**
|
|
259
|
+
* Submit strings for translation
|
|
260
|
+
* Project is determined from the API key
|
|
261
|
+
*/
|
|
262
|
+
private stableTextKey;
|
|
263
|
+
private normalizeStringEntries;
|
|
264
|
+
submitTranslation(branch: string, entries: string[] | TranslationStringEntry[], targetLocales: string[], options?: {
|
|
265
|
+
requestedMode?: RequestedSyncMode;
|
|
266
|
+
requestedMaxWaitMs?: number;
|
|
267
|
+
clientRunId?: string;
|
|
268
|
+
force?: boolean;
|
|
269
|
+
/** From vocoder.config.ts — synced to ProjectApp on every push */
|
|
270
|
+
appIndustry?: string;
|
|
271
|
+
}, repoIdentity?: RepoIdentityPayload): Promise<TranslationBatchResponse>;
|
|
272
|
+
/**
|
|
273
|
+
* Check translation status
|
|
274
|
+
*/
|
|
275
|
+
getTranslationStatus(batchId: string): Promise<TranslationStatusResponse>;
|
|
276
|
+
getTranslationSnapshot(params: {
|
|
277
|
+
branch: string;
|
|
278
|
+
targetLocales: string[];
|
|
279
|
+
}): Promise<TranslationSnapshotResponse>;
|
|
280
|
+
/**
|
|
281
|
+
* Wait for translation to complete with polling
|
|
282
|
+
*/
|
|
283
|
+
waitForCompletion(batchId: string, timeout?: number, onProgress?: (progress: number) => void): Promise<{
|
|
284
|
+
translations: Record<string, Record<string, string>>;
|
|
285
|
+
localeMetadata?: Record<string, {
|
|
286
|
+
nativeName: string;
|
|
287
|
+
dir?: "rtl";
|
|
288
|
+
}>;
|
|
289
|
+
}>;
|
|
290
|
+
startInitSession(input: {
|
|
291
|
+
projectName?: string;
|
|
292
|
+
sourceLocale?: string;
|
|
293
|
+
targetLocales?: string[];
|
|
294
|
+
repoCanonical?: string;
|
|
295
|
+
repoAppDir?: string;
|
|
296
|
+
}): Promise<InitStartResponse>;
|
|
297
|
+
getInitSessionStatus(params: {
|
|
298
|
+
sessionId: string;
|
|
299
|
+
pollToken: string;
|
|
300
|
+
}): Promise<InitStatusResponse>;
|
|
301
|
+
/**
|
|
302
|
+
* Start a CLI auth session. Returns `{ sessionId, verificationUrl, expiresAt }`.
|
|
303
|
+
* `sessionId` is the raw poll token — keep it secret, used for polling.
|
|
304
|
+
*/
|
|
305
|
+
startCliAuthSession(callbackPort?: number, repoCanonical?: string): Promise<{
|
|
306
|
+
sessionId: string;
|
|
307
|
+
verificationUrl: string;
|
|
308
|
+
installUrl?: string;
|
|
309
|
+
expiresAt: string;
|
|
310
|
+
}>;
|
|
311
|
+
/**
|
|
312
|
+
* Poll for CLI auth session completion.
|
|
313
|
+
* Returns `{ token }` on success, throws on failure/expiry.
|
|
314
|
+
* The server returns HTTP 202 while still pending.
|
|
315
|
+
*/
|
|
316
|
+
pollCliAuthSession(pollToken: string): Promise<{
|
|
317
|
+
status: "pending";
|
|
318
|
+
} | {
|
|
319
|
+
status: "complete";
|
|
320
|
+
token: string;
|
|
321
|
+
organizationId?: string;
|
|
322
|
+
} | {
|
|
323
|
+
status: "failed";
|
|
324
|
+
reason: string;
|
|
325
|
+
}>;
|
|
326
|
+
/**
|
|
327
|
+
* Validate a CLI user token and return the authenticated user's info.
|
|
328
|
+
* Used by the CLI to verify stored credentials on startup.
|
|
329
|
+
*/
|
|
330
|
+
getCliUserInfo(userToken: string): Promise<{
|
|
331
|
+
userId: string;
|
|
332
|
+
email: string;
|
|
333
|
+
name: string | null;
|
|
334
|
+
}>;
|
|
335
|
+
/**
|
|
336
|
+
* Revoke the given CLI user token server-side.
|
|
337
|
+
*/
|
|
338
|
+
revokeCliToken(userToken: string): Promise<void>;
|
|
339
|
+
listWorkspaces(userToken: string, params?: {
|
|
340
|
+
repo?: string;
|
|
341
|
+
}): Promise<{
|
|
342
|
+
workspaces: Array<{
|
|
343
|
+
id: string;
|
|
344
|
+
name: string;
|
|
345
|
+
planId: string;
|
|
346
|
+
maxProjects: number;
|
|
347
|
+
projectCount: number;
|
|
348
|
+
hasGitHubConnection: boolean;
|
|
349
|
+
connectionLabel: string | null;
|
|
350
|
+
/** null when no `repo` param was provided */
|
|
351
|
+
coversRepo: boolean | null;
|
|
352
|
+
installationConfigureUrl: string | null;
|
|
353
|
+
}>;
|
|
354
|
+
canCreateWorkspace: boolean;
|
|
355
|
+
}>;
|
|
356
|
+
listProjects(userToken: string, organizationId: string): Promise<Array<{
|
|
357
|
+
id: string;
|
|
358
|
+
name: string;
|
|
359
|
+
sourceLocale: string;
|
|
360
|
+
targetLocales: string[];
|
|
361
|
+
targetBranches: string[];
|
|
362
|
+
}>>;
|
|
363
|
+
regenerateProjectApiKey(userToken: string, projectId: string): Promise<{
|
|
364
|
+
apiKey: string;
|
|
365
|
+
}>;
|
|
366
|
+
startCliGitHubInstall(userToken: string, params: {
|
|
367
|
+
organizationId?: string;
|
|
368
|
+
callbackPort?: number;
|
|
369
|
+
}): Promise<{
|
|
370
|
+
installUrl: string;
|
|
371
|
+
}>;
|
|
372
|
+
/**
|
|
373
|
+
* Start the "link existing installation" discovery flow.
|
|
374
|
+
* Unlike startCliGitHubOAuth, this requires no bearer token — the Vocoder
|
|
375
|
+
* account is created from the OAuth code in the callback.
|
|
376
|
+
*/
|
|
377
|
+
startCliGitHubLinkSession(sessionId: string, callbackPort?: number): Promise<{
|
|
378
|
+
oauthUrl: string;
|
|
379
|
+
}>;
|
|
380
|
+
startCliGitHubOAuth(userToken: string, params: {
|
|
381
|
+
organizationId?: string;
|
|
382
|
+
callbackPort?: number;
|
|
383
|
+
}): Promise<{
|
|
384
|
+
oauthUrl: string;
|
|
385
|
+
}>;
|
|
386
|
+
getCliGitHubDiscovery(userToken: string): Promise<{
|
|
387
|
+
installations: Array<{
|
|
388
|
+
installationId: number;
|
|
389
|
+
accountLogin: string;
|
|
390
|
+
accountType: string;
|
|
391
|
+
isSuspended: boolean;
|
|
392
|
+
conflictLabel: string | null;
|
|
393
|
+
}>;
|
|
394
|
+
}>;
|
|
395
|
+
claimCliGitHubInstallation(userToken: string, params: {
|
|
396
|
+
installationId: string;
|
|
397
|
+
organizationId: string | null;
|
|
398
|
+
}): Promise<{
|
|
399
|
+
organizationId: string;
|
|
400
|
+
organizationName: string;
|
|
401
|
+
connectionLabel: string;
|
|
402
|
+
repoCount: number;
|
|
403
|
+
}>;
|
|
404
|
+
listLocales(userToken: string): Promise<{
|
|
405
|
+
sourceLocales: Array<{
|
|
406
|
+
code: string;
|
|
407
|
+
name: string;
|
|
408
|
+
nativeName?: string;
|
|
409
|
+
}>;
|
|
410
|
+
targetLocales: Array<{
|
|
411
|
+
code: string;
|
|
412
|
+
name: string;
|
|
413
|
+
nativeName?: string;
|
|
414
|
+
}>;
|
|
415
|
+
}>;
|
|
416
|
+
listCompatibleLocales(userToken: string, sourceLocale: string): Promise<Array<{
|
|
417
|
+
code: string;
|
|
418
|
+
name: string;
|
|
419
|
+
nativeName?: string;
|
|
420
|
+
}>>;
|
|
421
|
+
createProject(userToken: string, params: {
|
|
422
|
+
organizationId: string;
|
|
423
|
+
name: string;
|
|
424
|
+
sourceLocale: string;
|
|
425
|
+
targetLocales: string[];
|
|
426
|
+
targetBranches: string[];
|
|
427
|
+
appDirs: string[];
|
|
428
|
+
repoCanonical?: string;
|
|
429
|
+
}): Promise<{
|
|
430
|
+
projectId: string;
|
|
431
|
+
projectName: string;
|
|
432
|
+
apiKey: string;
|
|
433
|
+
sourceLocale: string;
|
|
434
|
+
targetLocales: string[];
|
|
435
|
+
targetBranches: string[];
|
|
436
|
+
repositoryBound: boolean;
|
|
437
|
+
configureUrl?: string;
|
|
438
|
+
}>;
|
|
439
|
+
/**
|
|
440
|
+
* Look up all project apps for a given repo. Returns info about exact matches,
|
|
441
|
+
* existing apps in other scopes, and whether a whole-repo app exists.
|
|
442
|
+
* No auth required.
|
|
443
|
+
*/
|
|
444
|
+
lookupProjectByRepo(params: {
|
|
445
|
+
repoCanonical: string;
|
|
446
|
+
appDir: string;
|
|
447
|
+
}): Promise<{
|
|
448
|
+
exactMatch: {
|
|
449
|
+
projectId: string;
|
|
450
|
+
projectName: string;
|
|
451
|
+
organizationName: string;
|
|
452
|
+
sourceLocale?: string;
|
|
453
|
+
targetBranches?: string[];
|
|
454
|
+
} | null;
|
|
455
|
+
existingApps: Array<{
|
|
456
|
+
appDir: string;
|
|
457
|
+
projectId: string;
|
|
458
|
+
projectName: string;
|
|
459
|
+
organizationName: string;
|
|
460
|
+
}>;
|
|
461
|
+
hasWholeRepoApp: boolean;
|
|
462
|
+
}>;
|
|
463
|
+
/**
|
|
464
|
+
* Add a new ProjectApp to an existing project (monorepo: new app directory).
|
|
465
|
+
* Does not check plan limits — no new project is created.
|
|
466
|
+
*/
|
|
467
|
+
createProjectApp(userToken: string, params: {
|
|
468
|
+
projectId: string;
|
|
469
|
+
appDir: string;
|
|
470
|
+
sourceLocale: string;
|
|
471
|
+
targetLocales: string[];
|
|
472
|
+
targetBranches: string[];
|
|
473
|
+
repoCanonical: string;
|
|
474
|
+
}): Promise<{
|
|
475
|
+
appId: string;
|
|
476
|
+
projectId: string;
|
|
477
|
+
projectName: string;
|
|
478
|
+
apiKey: string;
|
|
479
|
+
appDir: string;
|
|
480
|
+
}>;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
interface AuthData {
|
|
484
|
+
token: string;
|
|
485
|
+
userId: string;
|
|
486
|
+
email: string;
|
|
487
|
+
name: string | null;
|
|
488
|
+
createdAt: string;
|
|
489
|
+
}
|
|
490
|
+
declare function readAuthData(): AuthData | null;
|
|
491
|
+
declare function writeAuthData(data: AuthData): void;
|
|
492
|
+
declare function clearAuthData(): void;
|
|
493
|
+
|
|
161
494
|
interface SetupSnippets {
|
|
162
495
|
pluginStep: {
|
|
163
496
|
file: string;
|
|
@@ -182,4 +515,4 @@ declare function getSetupSnippets(params: {
|
|
|
182
515
|
targetBranches: string[];
|
|
183
516
|
}): SetupSnippets;
|
|
184
517
|
|
|
185
|
-
export { type APIProjectConfig, type DetectedEcosystem, type DetectedFramework, type ExtractedString, type LimitErrorResponse, type LocalDetectionResult, type LocaleInfo, type LocalesMap, type PackageManager, type SetupSnippets, StringExtractor, type SyncPolicyConfig, type SyncPolicyErrorResponse, type TranslationBatchResponse, type TranslationSnapshotResponse, type TranslationStatusResponse, type VocoderConfig, buildInstallCommand, defineConfig, detectLocalEcosystem, getPackagesToInstall, getSetupSnippets, loadVocoderConfig };
|
|
518
|
+
export { type APIProjectConfig, type AuthData, type DetectedEcosystem, type DetectedFramework, type ExtractedString, type LimitErrorResponse, type LocalDetectionResult, type LocaleInfo, type LocalesMap, type PackageManager, type SetupSnippets, StringExtractor, type SyncPolicyConfig, type SyncPolicyErrorResponse, type TranslationBatchResponse, type TranslationSnapshotResponse, type TranslationStatusResponse, VocoderAPI, VocoderAPIError, type VocoderConfig, buildInstallCommand, clearAuthData, defineConfig, detectLocalEcosystem, getPackagesToInstall, getSetupSnippets, loadVocoderConfig, readAuthData, writeAuthData };
|
package/dist/lib.mjs
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
StringExtractor,
|
|
4
|
+
VocoderAPI,
|
|
5
|
+
VocoderAPIError,
|
|
4
6
|
buildInstallCommand,
|
|
7
|
+
clearAuthData,
|
|
5
8
|
detectLocalEcosystem,
|
|
6
9
|
getPackagesToInstall,
|
|
7
10
|
getSetupSnippets,
|
|
8
|
-
loadVocoderConfig
|
|
9
|
-
|
|
11
|
+
loadVocoderConfig,
|
|
12
|
+
readAuthData,
|
|
13
|
+
writeAuthData
|
|
14
|
+
} from "./chunk-XF3KGGYQ.mjs";
|
|
10
15
|
|
|
11
16
|
// ../config/src/index.ts
|
|
12
17
|
function defineConfig(config) {
|
|
@@ -14,11 +19,16 @@ function defineConfig(config) {
|
|
|
14
19
|
}
|
|
15
20
|
export {
|
|
16
21
|
StringExtractor,
|
|
22
|
+
VocoderAPI,
|
|
23
|
+
VocoderAPIError,
|
|
17
24
|
buildInstallCommand,
|
|
25
|
+
clearAuthData,
|
|
18
26
|
defineConfig,
|
|
19
27
|
detectLocalEcosystem,
|
|
20
28
|
getPackagesToInstall,
|
|
21
29
|
getSetupSnippets,
|
|
22
|
-
loadVocoderConfig
|
|
30
|
+
loadVocoderConfig,
|
|
31
|
+
readAuthData,
|
|
32
|
+
writeAuthData
|
|
23
33
|
};
|
|
24
34
|
//# sourceMappingURL=lib.mjs.map
|
package/dist/lib.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../config/src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../config/src/index.ts"],"sourcesContent":["/**\n * Supported app industry classifications.\n * Set once in vocoder.config.ts; synced to ProjectApp at extraction time.\n * Cannot be edited from the dashboard — config file is the source of truth.\n *\n * Keep in sync with APP_INDUSTRIES in\n * vocoder-app/lib/vocoder/translation/context-constants.ts.\n */\nexport type AppIndustry =\n\t| \"ecommerce\"\n\t| \"saas\"\n\t| \"healthcare\"\n\t| \"fintech\"\n\t| \"gaming\"\n\t| \"education\"\n\t| \"media\"\n\t| \"productivity\";\n\n/**\n * Translation formality level.\n * Can be set project-wide in vocoder.config.ts or overridden per-string\n * via <T formality=\"formal\"> (requires allowAiTranslations plan).\n */\nexport type Formality = \"formal\" | \"informal\" | \"neutral\";\n\nexport interface VocoderConfig {\n\t/** Glob patterns for files to extract strings from. */\n\tinclude?: string[];\n\t/** Glob patterns to exclude. */\n\texclude?: string[];\n\t/**\n\t * Git branches that trigger string extraction and translation.\n\t * Synced to the Vocoder dashboard on each push — change here to update.\n\t */\n\ttargetBranches?: string[];\n\t/**\n\t * Directory to write translated locale files after sync (optional).\n\t * If set, `vocoder sync` writes {locale}.json files to this path.\n\t */\n\tlocalesPath?: string;\n\t/**\n\t * The industry or domain of this application.\n\t * Used to improve translation quality for domain-specific terminology\n\t * and to isolate cache entries by industry in the global translation cache.\n\t * Synced to ProjectApp at extraction time.\n\t */\n\tappIndustry?: AppIndustry;\n\t/**\n\t * Project-wide default formality level for translations.\n\t * Can be overridden per-string via <T formality=\"...\"> on the AI plan.\n\t * Synced to ProjectApp at extraction time.\n\t */\n\tformality?: Formality;\n}\n\n/** Type helper for vocoder.config.ts — provides autocomplete and type checking. */\nexport function defineConfig(config: VocoderConfig): VocoderConfig {\n\treturn config;\n}\n\n/**\n * Canonical translation bundle format shared by the build plugin and CLI.\n * Both read and write this shape — keeps cache files identical regardless of\n * which tool produced them.\n *\n * translations: locale → sourceKey (hash) → translated text\n * config.locales: locale metadata snapshot for the runtime\n */\nexport interface VocoderTranslationData {\n\tconfig: {\n\t\tsourceLocale: string;\n\t\ttargetLocales: string[];\n\t\tlocales: Record<string, {\n\t\t\tnativeName: string;\n\t\t\tdir?: \"rtl\";\n\t\t\tcurrencyCode?: string;\n\t\t\tordinalForms?: { type: \"suffix\"; suffixes: { zero?: string; one?: string; two?: string; few?: string; many?: string; other: string } } | { type: \"word\"; words: Record<string, Record<number, string>> };\n\t\t}>;\n\t};\n\ttranslations: Record<string, Record<string, string>>;\n\tupdatedAt: string | null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwDO,SAAS,aAAa,QAAsC;AAClE,SAAO;AACR;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vocoder/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "CLI tool for Vocoder translation workflow",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"tsup": "^8.0.0",
|
|
52
52
|
"typescript": "^5.4.0",
|
|
53
53
|
"vitest": "^1.0.0",
|
|
54
|
-
"@vocoder/
|
|
55
|
-
"@vocoder/
|
|
54
|
+
"@vocoder/extractor": "0.11.0",
|
|
55
|
+
"@vocoder/config": "0.11.0"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=18"
|