@vocoder/cli 0.8.0 → 0.10.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/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,13 @@ 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;
70
+ /** Feature area inferred from file path. e.g. "checkout", "auth", "settings" */
71
+ featureArea?: string;
40
72
  }
41
73
  declare class StringExtractor {
42
74
  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
75
  }
49
76
 
50
77
  interface LocaleInfo {
@@ -135,6 +162,8 @@ interface LocalDetectionResult {
135
162
  hasConfig: boolean;
136
163
  hasUiPackage: boolean;
137
164
  sourceLocale: string | null;
165
+ /** True when a tsconfig.json is present or TypeScript is listed as a dependency. */
166
+ isTypeScript: boolean;
138
167
  }
139
168
  /**
140
169
  * Detect the local project's ecosystem, framework, and package manager
package/dist/lib.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  getPackagesToInstall,
7
7
  getSetupSnippets,
8
8
  loadVocoderConfig
9
- } from "./chunk-7LFRSUPU.mjs";
9
+ } from "./chunk-73U4VZYP.mjs";
10
10
 
11
11
  // ../config/src/index.ts
12
12
  function defineConfig(config) {
package/dist/lib.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../config/src/index.ts"],"sourcesContent":["export 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}\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":";;;;;;;;;;;AAkBO,SAAS,aAAa,QAAsC;AAClE,SAAO;AACR;","names":[]}
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.8.0",
3
+ "version": "0.10.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/extractor": "0.8.0",
55
- "@vocoder/config": "0.8.0"
54
+ "@vocoder/config": "0.10.0",
55
+ "@vocoder/extractor": "0.10.0"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=18"