locadex 0.1.13-alpha.2 → 0.1.14-alpha.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # locadex
2
2
 
3
+ ## 0.1.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [#396](https://github.com/generaltranslation/gt/pull/396) [`4f41851`](https://github.com/generaltranslation/gt/commit/4f41851a124df2f855db616a618f3e28b5a94455) Thanks [@andrewherndon](https://github.com/andrewherndon)! - added local translations as param to start command
8
+
9
+ - [#409](https://github.com/generaltranslation/gt/pull/409) [`557f74d`](https://github.com/generaltranslation/gt/commit/557f74da58ebd84ca50c1961fc6dfecd63bb7797) Thanks [@brian-lou](https://github.com/brian-lou)! - Make locadex more reliable + improve validation
10
+
11
+ - Updated dependencies [[`557f74d`](https://github.com/generaltranslation/gt/commit/557f74da58ebd84ca50c1961fc6dfecd63bb7797)]:
12
+ - gtx-cli@1.2.30
13
+
3
14
  ## 0.1.12
4
15
 
5
16
  ### Patch Changes
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1bff4bd9-c351-539d-a8af-f167c50673b1")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="15f1fb30-7169-5be5-bee8-2abef6571d8e")}catch(e){}}();
4
4
  import dotenv from 'dotenv';
5
5
  dotenv.config({ path: '.env' });
6
6
  dotenv.config({ path: '.env.local', override: true });
@@ -27,13 +27,14 @@ program
27
27
  .option('-b, --batch-size <number>', 'File batch size')
28
28
  .option('-t, --timeout <number>', 'Timeout for each file in a batch')
29
29
  .option('-c, --concurrency <number>', 'Max number of concurrent agents')
30
- .option('-m, --match-files <pattern>', 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.')
30
+ .option('-m, --match-files <patterns...>', 'Space-separated list of glob patterns to match source files. Should be relative to root directory.')
31
31
  .option('--package-manager <manager>', 'Package manager to use. (npm, pnpm, yarn_v1, yarn_v2, bun, deno)')
32
32
  .option('-y, --bypass-prompts', 'Bypass interactive prompts')
33
33
  .option('--no-telemetry', 'Disable telemetry')
34
34
  .option('--no-translate', 'Disable translation step')
35
35
  .option('-f, --format-cmd <cmd>', 'Command to format modified files')
36
36
  .option('--app-dir <dir>', 'Relative path to the application directory', '.')
37
+ .option('--local-translations', 'Enable local translations with loadTranslations.js file and GT config')
37
38
  .action(setupCommand);
38
39
  program
39
40
  .command('auto')
@@ -43,7 +44,7 @@ program
43
44
  .option('-b, --batch-size <number>', 'File batch size')
44
45
  .option('-t, --timeout <number>', 'Timeout for each file in a batch')
45
46
  .option('-c, --concurrency <number>', 'Max number of concurrent agents')
46
- .option('-m, --match-files <pattern>', 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.')
47
+ .option('-m, --match-files <patterns...>', 'Space-separated list of glob patterns to match source files. Should be relative to root directory.')
47
48
  .option('--package-manager <manager>', 'Package manager to use. (npm, pnpm, yarn_v1, yarn_v2, bun, deno)')
48
49
  .option('--no-telemetry', 'Disable telemetry')
49
50
  .option('--no-translate', 'Disable translation step')
@@ -58,7 +59,7 @@ program
58
59
  .option('-b, --batch-size <number>', 'File batch size')
59
60
  .option('-t, --timeout <number>', 'Timeout for each file in a batch')
60
61
  .option('-c, --concurrency <number>', 'Max number of concurrent agents')
61
- .option('-m, --match-files <pattern>', 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.')
62
+ .option('-m, --match-files <patterns...>', 'Space-separated list of glob patterns to match source files. Should be relative to root directory.')
62
63
  .option('--no-telemetry', 'Disable telemetry')
63
64
  .option('--no-translate', 'Disable translation step')
64
65
  .option('-f, --format-cmd <cmd>', 'Command to format modified files')
@@ -67,4 +68,4 @@ program
67
68
  main(program);
68
69
  program.parse();
69
70
  //# sourceMappingURL=cli.js.map
70
- //# debugId=1bff4bd9-c351-539d-a8af-f167c50673b1
71
+ //# debugId=15f1fb30-7169-5be5-bee8-2abef6571d8e
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":["cli.ts"],"sourceRoot":"/","sourcesContent":["#!/usr/bin/env node\n\nimport dotenv from 'dotenv';\n\ndotenv.config({ path: '.env' });\ndotenv.config({ path: '.env.local', override: true });\ndotenv.config({ path: '.env.production', override: true });\n\nimport './telemetry.js';\nimport './utils/shutdown.js';\nimport { Command } from 'commander';\nimport { readFileSync } from 'node:fs';\nimport { fromPackageRoot } from './utils/getPaths.js';\nimport { autoSetupCommand, setupCommand } from './commands/setup.js';\nimport { i18nCommand } from './commands/i18n.js';\nimport { main } from 'gtx-cli/index';\n\nconst packageJson = JSON.parse(\n readFileSync(fromPackageRoot('package.json'), 'utf8')\n);\n\nconst program = new Command();\n\nprogram\n .name('locadex')\n .description('AI agent for internationalization')\n .version(packageJson.version);\n\nprogram\n .command('start')\n .description('Run Locadex on your project')\n .option('-v, --verbose', 'Verbose output')\n .option('-d, --debug', 'Debug output')\n .option('-b, --batch-size <number>', 'File batch size')\n .option('-t, --timeout <number>', 'Timeout for each file in a batch')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents')\n .option(\n '-m, --match-files <pattern>',\n 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.'\n )\n .option(\n '--package-manager <manager>',\n 'Package manager to use. (npm, pnpm, yarn_v1, yarn_v2, bun, deno)'\n )\n .option('-y, --bypass-prompts', 'Bypass interactive prompts')\n .option('--no-telemetry', 'Disable telemetry')\n .option('--no-translate', 'Disable translation step')\n .option('-f, --format-cmd <cmd>', 'Command to format modified files')\n .option('--app-dir <dir>', 'Relative path to the application directory', '.')\n .action(setupCommand);\n\nprogram\n .command('auto')\n .description('Run Locadex with auto-setup on your project')\n .option('-v, --verbose', 'Verbose output')\n .option('-d, --debug', 'Debug output')\n .option('-b, --batch-size <number>', 'File batch size')\n .option('-t, --timeout <number>', 'Timeout for each file in a batch')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents')\n .option(\n '-m, --match-files <pattern>',\n 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.'\n )\n .option(\n '--package-manager <manager>',\n 'Package manager to use. (npm, pnpm, yarn_v1, yarn_v2, bun, deno)'\n )\n .option('--no-telemetry', 'Disable telemetry')\n .option('--no-translate', 'Disable translation step')\n .option('-f, --format-cmd <cmd>', 'Command to format modified files')\n .option('--app-dir <dir>', 'Relative path to the application directory', '.')\n .action(autoSetupCommand);\n\nprogram\n .command('i18n')\n .description('Run Locadex i18n on your project')\n .option('-v, --verbose', 'Verbose output')\n .option('-d, --debug', 'Debug output')\n .option('-b, --batch-size <number>', 'File batch size')\n .option('-t, --timeout <number>', 'Timeout for each file in a batch')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents')\n .option(\n '-m, --match-files <pattern>',\n 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.'\n )\n .option('--no-telemetry', 'Disable telemetry')\n .option('--no-translate', 'Disable translation step')\n .option('-f, --format-cmd <cmd>', 'Command to format modified files')\n .option('--app-dir <dir>', 'Relative path to the application directory', '.')\n .action(i18nCommand);\n\nmain(program);\n\nprogram.parse();\n"],"names":[],"mappings":";;;AAEA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,E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AAC;KACpD,MAAM,CAAC,wBAAwB,EAAE,kCAAkC,CAAC;KACpE,MAAM,CAAC,iBAAiB,EAAE,4CAA4C,EAAE,GAAG,CAAC;KAC5E,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,IAAI,CAAC,OAAO,CAAC,CAAC;AAEd,OAAO,CAAC,KAAK,EAAE,CAAC","debug_id":"1bff4bd9-c351-539d-a8af-f167c50673b1"}
1
+ {"version":3,"file":"cli.js","sources":["cli.ts"],"sourceRoot":"/","sourcesContent":["#!/usr/bin/env node\n\nimport dotenv from 'dotenv';\n\ndotenv.config({ path: '.env' });\ndotenv.config({ path: '.env.local', override: true });\ndotenv.config({ path: '.env.production', override: true });\n\nimport './telemetry.js';\nimport './utils/shutdown.js';\nimport { Command } from 'commander';\nimport { readFileSync } from 'node:fs';\nimport { fromPackageRoot } from './utils/getPaths.js';\nimport { autoSetupCommand, setupCommand } from './commands/setup.js';\nimport { i18nCommand } from './commands/i18n.js';\nimport { main } from 'gtx-cli/index';\n\nconst packageJson = JSON.parse(\n readFileSync(fromPackageRoot('package.json'), 'utf8')\n);\n\nconst program = new Command();\n\nprogram\n .name('locadex')\n .description('AI agent for internationalization')\n .version(packageJson.version);\n\nprogram\n .command('start')\n .description('Run Locadex on your project')\n .option('-v, --verbose', 'Verbose output')\n .option('-d, --debug', 'Debug output')\n .option('-b, --batch-size <number>', 'File batch size')\n .option('-t, --timeout <number>', 'Timeout for each file in a batch')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents')\n .option(\n '-m, --match-files <patterns...>',\n 'Space-separated list of glob patterns to match source files. Should be relative to root directory.'\n )\n .option(\n '--package-manager <manager>',\n 'Package manager to use. (npm, pnpm, yarn_v1, yarn_v2, bun, deno)'\n )\n .option('-y, --bypass-prompts', 'Bypass interactive prompts')\n .option('--no-telemetry', 'Disable telemetry')\n .option('--no-translate', 'Disable translation step')\n .option('-f, --format-cmd <cmd>', 'Command to format modified files')\n .option('--app-dir <dir>', 'Relative path to the application directory', '.')\n .option(\n '--local-translations',\n 'Enable local translations with loadTranslations.js file and GT config'\n )\n .action(setupCommand);\n\nprogram\n .command('auto')\n .description('Run Locadex with auto-setup on your project')\n .option('-v, --verbose', 'Verbose output')\n .option('-d, --debug', 'Debug output')\n .option('-b, --batch-size <number>', 'File batch size')\n .option('-t, --timeout <number>', 'Timeout for each file in a batch')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents')\n .option(\n '-m, --match-files <patterns...>',\n 'Space-separated list of glob patterns to match source files. Should be relative to root directory.'\n )\n .option(\n '--package-manager <manager>',\n 'Package manager to use. (npm, pnpm, yarn_v1, yarn_v2, bun, deno)'\n )\n .option('--no-telemetry', 'Disable telemetry')\n .option('--no-translate', 'Disable translation step')\n .option('-f, --format-cmd <cmd>', 'Command to format modified files')\n .option('--app-dir <dir>', 'Relative path to the application directory', '.')\n .action(autoSetupCommand);\n\nprogram\n .command('i18n')\n .description('Run Locadex i18n on your project')\n .option('-v, --verbose', 'Verbose output')\n .option('-d, --debug', 'Debug output')\n .option('-b, --batch-size <number>', 'File batch size')\n .option('-t, --timeout <number>', 'Timeout for each file in a batch')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents')\n .option(\n '-m, --match-files <patterns...>',\n 'Space-separated list of glob patterns to match source files. Should be relative to root directory.'\n )\n .option('--no-telemetry', 'Disable telemetry')\n .option('--no-translate', 'Disable translation step')\n .option('-f, --format-cmd <cmd>', 'Command to format modified files')\n .option('--app-dir <dir>', 'Relative path to the application directory', '.')\n .action(i18nCommand);\n\nmain(program);\n\nprogram.parse();\n"],"names":[],"mappings":";;;AAEA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,CAAC,EAAE,I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AC;KAC7C,MAAM,CAAC,gBAAgB,EAAE,0BAA0B,CAAC;KACpD,MAAM,CAAC,wBAAwB,EAAE,kCAAkC,CAAC;KACpE,MAAM,CAAC,iBAAiB,EAAE,4CAA4C,EAAE,GAAG,CAAC;KAC5E,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,IAAI,CAAC,OAAO,CAAC,CAAC;AAEd,OAAO,CAAC,KAAK,EAAE,CAAC","debug_id":"15f1fb30-7169-5be5-bee8-2abef6571d8e"}
@@ -1 +1 @@
1
- {"version":3,"file":"fixErrors.d.ts","sourceRoot":"/","sources":["commands/fixErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ7C,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,iBAqC3E"}
1
+ {"version":3,"file":"fixErrors.d.ts","sourceRoot":"/","sources":["commands/fixErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ7C,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,iBAmC3E"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d6a0db9b-aeb1-5960-bd4f-45fd295ef67d")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8eb1ad14-1562-5e9c-bfaf-5450907faede")}catch(e){}}();
3
3
  import { withTelemetry } from '../telemetry.js';
4
4
  import { LocadexManager } from '../utils/locadexManager.js';
5
5
  import { displayHeader } from '../logging/console.js';
@@ -22,9 +22,7 @@ export async function fixErrorsCommand(options, command) {
22
22
  cliOptions: allOptions,
23
23
  options: {
24
24
  ...(allOptions.matchingFiles && {
25
- matchingFiles: allOptions.matchingFiles
26
- .split(',')
27
- .map((file) => file.trim()),
25
+ matchingFiles: allOptions.matchingFiles,
28
26
  }),
29
27
  ...(allOptions.concurrency && {
30
28
  maxConcurrency: Number(allOptions.concurrency),
@@ -41,4 +39,4 @@ export async function fixErrorsCommand(options, command) {
41
39
  });
42
40
  }
43
41
  //# sourceMappingURL=fixErrors.js.map
44
- //# debugId=d6a0db9b-aeb1-5960-bd4f-45fd295ef67d
42
+ //# debugId=8eb1ad14-1562-5e9c-bfaf-5450907faede
@@ -1 +1 @@
1
- {"version":3,"file":"fixErrors.js","sources":["commands/fixErrors.ts"],"sourceRoot":"/","sourcesContent":["import { Command } from 'commander';\nimport { CliOptions } from '../types/cli.js';\nimport { withTelemetry } from '../telemetry.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { displayHeader } from '../logging/console.js';\nimport path from 'node:path';\nimport { validateConfig } from '../utils/config.js';\nimport { fixErrorsTask } from '../tasks/fixErrors.js';\n\nexport async function fixErrorsCommand(options: CliOptions, command: Command) {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n const telemetryEnabled = !allOptions.noTelemetry;\n withTelemetry(\n { enabled: telemetryEnabled, options: allOptions },\n async () => {\n await validateConfig(allOptions);\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n rootDirectory: process.cwd(),\n appDirectory: path.resolve(process.cwd(), allOptions.appDir),\n mcpTransport: 'stdio',\n apiKey: process.env.ANTHROPIC_API_KEY || '',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles\n .split(',')\n .map((file) => file.trim()),\n }),\n ...(allOptions.concurrency && {\n maxConcurrency: Number(allOptions.concurrency),\n }),\n ...(allOptions.batchSize && {\n batchSize: Number(allOptions.batchSize),\n }),\n ...(allOptions.timeout && {\n timeout: Number(allOptions.timeout),\n }),\n },\n });\n await fixErrorsTask();\n }\n );\n}\n"],"names":[],"mappings":";;AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAmB,EAAE,OAAgB;IAC1E,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,MAAM,gBAAgB,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC;IACjD,aAAa,CACX,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,EAClD,KAAK,IAAI,EAAE;QACT,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;QAEjC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QAChC,cAAc,CAAC,UAAU,CAAC;YACxB,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE;YAC5B,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC;YAC5D,YAAY,EAAE,OAAO;YACrB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;YAC3C,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE;gBACP,GAAG,CAAC,UAAU,CAAC,aAAa,IAAI;oBAC9B,aAAa,EAAE,UAAU,CAAC,aAAa;yBACpC,KAAK,CAAC,GAAG,CAAC;yBACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBAC9B,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,WAAW,IAAI;oBAC5B,cAAc,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC;iBAC/C,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,SAAS,IAAI;oBAC1B,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;iBACxC,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,OAAO,IAAI;oBACxB,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;iBACpC,CAAC;aACH;SACF,CAAC,CAAC;QACH,MAAM,aAAa,EAAE,CAAC;IACxB,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"d6a0db9b-aeb1-5960-bd4f-45fd295ef67d"}
1
+ {"version":3,"file":"fixErrors.js","sources":["commands/fixErrors.ts"],"sourceRoot":"/","sourcesContent":["import { Command } from 'commander';\nimport { CliOptions } from '../types/cli.js';\nimport { withTelemetry } from '../telemetry.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { displayHeader } from '../logging/console.js';\nimport path from 'node:path';\nimport { validateConfig } from '../utils/config.js';\nimport { fixErrorsTask } from '../tasks/fixErrors.js';\n\nexport async function fixErrorsCommand(options: CliOptions, command: Command) {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n const telemetryEnabled = !allOptions.noTelemetry;\n withTelemetry(\n { enabled: telemetryEnabled, options: allOptions },\n async () => {\n await validateConfig(allOptions);\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n rootDirectory: process.cwd(),\n appDirectory: path.resolve(process.cwd(), allOptions.appDir),\n mcpTransport: 'stdio',\n apiKey: process.env.ANTHROPIC_API_KEY || '',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles,\n }),\n ...(allOptions.concurrency && {\n maxConcurrency: Number(allOptions.concurrency),\n }),\n ...(allOptions.batchSize && {\n batchSize: Number(allOptions.batchSize),\n }),\n ...(allOptions.timeout && {\n timeout: Number(allOptions.timeout),\n }),\n },\n });\n await fixErrorsTask();\n }\n );\n}\n"],"names":[],"mappings":";;AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAmB,EAAE,OAAgB;IAC1E,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,MAAM,gBAAgB,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC;IACjD,aAAa,CACX,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,EAClD,KAAK,IAAI,EAAE;QACT,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;QAEjC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QAChC,cAAc,CAAC,UAAU,CAAC;YACxB,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE;YAC5B,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC;YAC5D,YAAY,EAAE,OAAO;YACrB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;YAC3C,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE;gBACP,GAAG,CAAC,UAAU,CAAC,aAAa,IAAI;oBAC9B,aAAa,EAAE,UAAU,CAAC,aAAa;iBACxC,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,WAAW,IAAI;oBAC5B,cAAc,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC;iBAC/C,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,SAAS,IAAI;oBAC1B,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;iBACxC,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,OAAO,IAAI;oBACxB,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;iBACpC,CAAC;aACH;SACF,CAAC,CAAC;QACH,MAAM,aAAa,EAAE,CAAC;IACxB,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"8eb1ad14-1562-5e9c-bfaf-5450907faede"}
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["commands/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAO7C,wBAAsB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,iBAqCtE"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["commands/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAO7C,wBAAsB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,iBAmCtE"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d714a128-e108-586c-906f-4efb76e0eafe")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00d0bcb6-c083-5c43-bf0f-8862d65c25b5")}catch(e){}}();
3
3
  import { i18nTask } from '../tasks/i18n.js';
4
4
  import { withTelemetry } from '../telemetry.js';
5
5
  import { LocadexManager } from '../utils/locadexManager.js';
@@ -22,9 +22,7 @@ export async function i18nCommand(options, command) {
22
22
  cliOptions: allOptions,
23
23
  options: {
24
24
  ...(allOptions.matchingFiles && {
25
- matchingFiles: allOptions.matchingFiles
26
- .split(',')
27
- .map((file) => file.trim()),
25
+ matchingFiles: allOptions.matchingFiles,
28
26
  }),
29
27
  ...(allOptions.concurrency && {
30
28
  maxConcurrency: Number(allOptions.concurrency),
@@ -41,4 +39,4 @@ export async function i18nCommand(options, command) {
41
39
  });
42
40
  }
43
41
  //# sourceMappingURL=i18n.js.map
44
- //# debugId=d714a128-e108-586c-906f-4efb76e0eafe
42
+ //# debugId=00d0bcb6-c083-5c43-bf0f-8862d65c25b5
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sources":["commands/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { Command } from 'commander';\nimport { i18nTask } from '../tasks/i18n.js';\nimport { CliOptions } from '../types/cli.js';\nimport { withTelemetry } from '../telemetry.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { displayHeader } from '../logging/console.js';\nimport path from 'node:path';\nimport { validateConfig } from '../utils/config.js';\n\nexport async function i18nCommand(options: CliOptions, command: Command) {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n const telemetryEnabled = !allOptions.noTelemetry;\n withTelemetry(\n { enabled: telemetryEnabled, options: allOptions },\n async () => {\n await validateConfig(allOptions);\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n rootDirectory: process.cwd(),\n appDirectory: path.resolve(process.cwd(), allOptions.appDir),\n mcpTransport: 'stdio',\n apiKey: process.env.ANTHROPIC_API_KEY || '',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles\n .split(',')\n .map((file) => file.trim()),\n }),\n ...(allOptions.concurrency && {\n maxConcurrency: Number(allOptions.concurrency),\n }),\n ...(allOptions.batchSize && {\n batchSize: Number(allOptions.batchSize),\n }),\n ...(allOptions.timeout && {\n timeout: Number(allOptions.timeout),\n }),\n },\n });\n await i18nTask(allOptions);\n }\n );\n}\n"],"names":[],"mappings":";;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAmB,EAAE,OAAgB;IACrE,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,MAAM,gBAAgB,GAAG,CAAC,UAAU,CA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18n.ts"],"sourceRoot":"/","sourcesContent":["import { Command } from 'commander';\nimport { i18nTask } from '../tasks/i18n.js';\nimport { CliOptions } from '../types/cli.js';\nimport { withTelemetry } from '../telemetry.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { displayHeader } from '../logging/console.js';\nimport path from 'node:path';\nimport { validateConfig } from '../utils/config.js';\n\nexport async function i18nCommand(options: CliOptions, command: Command) {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n const telemetryEnabled = !allOptions.noTelemetry;\n withTelemetry(\n { enabled: telemetryEnabled, options: allOptions },\n async () => {\n await validateConfig(allOptions);\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n rootDirectory: process.cwd(),\n appDirectory: path.resolve(process.cwd(), allOptions.appDir),\n mcpTransport: 'stdio',\n apiKey: process.env.ANTHROPIC_API_KEY || '',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles,\n }),\n ...(allOptions.concurrency && {\n maxConcurrency: Number(allOptions.concurrency),\n }),\n ...(allOptions.batchSize && {\n batchSize: Number(allOptions.batchSize),\n }),\n ...(allOptions.timeout && {\n timeout: Number(allOptions.timeout),\n }),\n },\n });\n await i18nTask(allOptions);\n }\n );\n}\n"],"names":[],"mappings":";;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAmB,EAAE,OAAgB;IACrE,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,I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"}
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"/","sources":["commands/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAO7C,wBAAsB,YAAY,CAChC,OAAO,EAAE,UAAU,GAAG;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,OAAO,EAAE,OAAO,iBA2CjB;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,UAAU,GAAG;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,OAAO,EAAE,OAAO,iBA2CjB"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"/","sources":["commands/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAO7C,wBAAsB,YAAY,CAChC,OAAO,EAAE,UAAU,GAAG;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,OAAO,EAAE,OAAO,iBAyCjB;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,UAAU,GAAG;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,OAAO,EAAE,OAAO,iBAyCjB"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ed9f70b4-d985-572c-a2d0-be175bfc18ad")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="36afaec7-c98c-53e1-86f3-ef52dcd0e926")}catch(e){}}();
3
3
  import { setupTask } from '../tasks/setup.js';
4
4
  import { withTelemetry } from '../telemetry.js';
5
5
  import { LocadexManager } from '../utils/locadexManager.js';
@@ -22,9 +22,7 @@ export async function setupCommand(options, command) {
22
22
  cliOptions: allOptions,
23
23
  options: {
24
24
  ...(allOptions.matchingFiles && {
25
- matchingFiles: allOptions.matchingFiles
26
- .split(',')
27
- .map((file) => file.trim()),
25
+ matchingFiles: allOptions.matchingFiles,
28
26
  }),
29
27
  ...(allOptions.concurrency && {
30
28
  maxConcurrency: Number(allOptions.concurrency),
@@ -56,9 +54,7 @@ export async function autoSetupCommand(options, command) {
56
54
  cliOptions: allOptions,
57
55
  options: {
58
56
  ...(allOptions.matchingFiles && {
59
- matchingFiles: allOptions.matchingFiles
60
- .split(',')
61
- .map((file) => file.trim()),
57
+ matchingFiles: allOptions.matchingFiles,
62
58
  }),
63
59
  ...(allOptions.concurrency && {
64
60
  maxConcurrency: Number(allOptions.concurrency),
@@ -75,4 +71,4 @@ export async function autoSetupCommand(options, command) {
75
71
  });
76
72
  }
77
73
  //# sourceMappingURL=setup.js.map
78
- //# debugId=ed9f70b4-d985-572c-a2d0-be175bfc18ad
74
+ //# debugId=36afaec7-c98c-53e1-86f3-ef52dcd0e926
@@ -1 +1 @@
1
- {"version":3,"file":"setup.js","sources":["commands/setup.ts"],"sourceRoot":"/","sourcesContent":["import { Command } from 'commander';\nimport { setupTask } from '../tasks/setup.js';\nimport { CliOptions } from '../types/cli.js';\nimport { withTelemetry } from '../telemetry.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { displayHeader } from '../logging/console.js';\nimport path from 'node:path';\nimport { validateConfig } from '../utils/config.js';\n\nexport async function setupCommand(\n options: CliOptions & {\n packageManager?: string;\n bypassPrompts?: boolean;\n },\n command: Command\n) {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n const telemetryEnabled = !allOptions.noTelemetry;\n withTelemetry(\n { enabled: telemetryEnabled, options: allOptions },\n async () => {\n await validateConfig(allOptions);\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n rootDirectory: process.cwd(),\n appDirectory: path.resolve(process.cwd(), allOptions.appDir),\n mcpTransport: 'stdio',\n apiKey: process.env.ANTHROPIC_API_KEY || '',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles\n .split(',')\n .map((file) => file.trim()),\n }),\n ...(allOptions.concurrency && {\n maxConcurrency: Number(allOptions.concurrency),\n }),\n ...(allOptions.batchSize && {\n batchSize: Number(allOptions.batchSize),\n }),\n ...(allOptions.timeout && {\n timeout: Number(allOptions.timeout),\n }),\n },\n });\n await setupTask(\n allOptions,\n false,\n !!allOptions.bypassPrompts,\n allOptions.packageManager\n );\n }\n );\n}\n\nexport async function autoSetupCommand(\n options: CliOptions & {\n packageManager?: string;\n bypassPrompts?: boolean;\n },\n command: Command\n) {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n const telemetryEnabled = !allOptions.noTelemetry;\n withTelemetry(\n { enabled: telemetryEnabled, options: allOptions },\n async () => {\n await validateConfig(allOptions);\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n rootDirectory: process.cwd(),\n appDirectory: path.resolve(process.cwd(), allOptions.appDir),\n mcpTransport: 'stdio',\n apiKey: process.env.ANTHROPIC_API_KEY || '',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles\n .split(',')\n .map((file) => file.trim()),\n }),\n ...(allOptions.concurrency && {\n maxConcurrency: Number(allOptions.concurrency),\n }),\n ...(allOptions.batchSize && {\n batchSize: Number(allOptions.batchSize),\n }),\n ...(allOptions.timeout && {\n timeout: Number(allOptions.timeout),\n }),\n },\n });\n await setupTask(\n allOptions,\n true,\n !!allOptions.bypassPrompts,\n allOptions.packageManager\n );\n }\n );\n}\n"],"names":[],"mappings":";;AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAGC,EACD,OAAgB;IAEhB,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,MAAM,gBAAgB,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC;IACjD,aAAa,CACX,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,EAClD,KAAK,IAAI,EAAE;QACT,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;QAEjC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QAChC,cAAc,CAAC,UAAU,CAAC;YACxB,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE;YAC5B,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC;YAC5D,YAAY,EAAE,OAAO;YACrB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;YAC3C,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,UAAU;Y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,GAAG,EAAE;YAC5B,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC;YAC5D,YAAY,EAAE,OAAO;YACrB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;YAC3C,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE;gBACP,GAAG,CAAC,UAAU,CAAC,aAAa,IAAI;oBAC9B,aAAa,EAAE,UAAU,CAAC,aAAa;yBACpC,KAAK,CAAC,GAAG,CAAC;yBACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBAC9B,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,WAAW,IAAI;oBAC5B,cAAc,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC;iBAC/C,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,SAAS,IAAI;oBAC1B,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;iBACxC,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,OAAO,IAAI;oBACxB,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;iBACpC,CAAC;aACH;SACF,CAAC,CAAC;QACH,MAAM,SAAS,CACb,UAAU,EACV,IAAI,EACJ,CAAC,CAAC,UAAU,CAAC,aAAa,EAC1B,UAAU,CAAC,cAAc,CAC1B,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"ed9f70b4-d985-572c-a2d0-be175bfc18ad"}
1
+ {"version":3,"file":"setup.js","sources":["commands/setup.ts"],"sourceRoot":"/","sourcesContent":["import { Command } from 'commander';\nimport { setupTask } from '../tasks/setup.js';\nimport { CliOptions } from '../types/cli.js';\nimport { withTelemetry } from '../telemetry.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { displayHeader } from '../logging/console.js';\nimport path from 'node:path';\nimport { validateConfig } from '../utils/config.js';\n\nexport async function setupCommand(\n options: CliOptions & {\n packageManager?: string;\n bypassPrompts?: boolean;\n },\n command: Command\n) {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n const telemetryEnabled = !allOptions.noTelemetry;\n withTelemetry(\n { enabled: telemetryEnabled, options: allOptions },\n async () => {\n await validateConfig(allOptions);\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n rootDirectory: process.cwd(),\n appDirectory: path.resolve(process.cwd(), allOptions.appDir),\n mcpTransport: 'stdio',\n apiKey: process.env.ANTHROPIC_API_KEY || '',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles,\n }),\n ...(allOptions.concurrency && {\n maxConcurrency: Number(allOptions.concurrency),\n }),\n ...(allOptions.batchSize && {\n batchSize: Number(allOptions.batchSize),\n }),\n ...(allOptions.timeout && {\n timeout: Number(allOptions.timeout),\n }),\n },\n });\n await setupTask(\n allOptions,\n false,\n !!allOptions.bypassPrompts,\n allOptions.packageManager\n );\n }\n );\n}\n\nexport async function autoSetupCommand(\n options: CliOptions & {\n packageManager?: string;\n bypassPrompts?: boolean;\n },\n command: Command\n) {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n const telemetryEnabled = !allOptions.noTelemetry;\n withTelemetry(\n { enabled: telemetryEnabled, options: allOptions },\n async () => {\n await validateConfig(allOptions);\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n rootDirectory: process.cwd(),\n appDirectory: path.resolve(process.cwd(), allOptions.appDir),\n mcpTransport: 'stdio',\n apiKey: process.env.ANTHROPIC_API_KEY || '',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles,\n }),\n ...(allOptions.concurrency && {\n maxConcurrency: Number(allOptions.concurrency),\n }),\n ...(allOptions.batchSize && {\n batchSize: Number(allOptions.batchSize),\n }),\n ...(allOptions.timeout && {\n timeout: Number(allOptions.timeout),\n }),\n },\n });\n await setupTask(\n allOptions,\n true,\n !!allOptions.bypassPrompts,\n allOptions.packageManager\n );\n }\n );\n}\n"],"names":[],"mappings":";;AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAGC,EACD,OAAgB;IAEhB,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,MAAM,gBAAgB,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC;IACjD,aAAa,CACX,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,EAClD,KAAK,IAAI,EAAE;QACT,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;QAEjC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QAChC,cAAc,CAAC,UAAU,CAAC;YACxB,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE;YAC5B,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC;YAC5D,YAAY,EAAE,OAAO;YACrB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;YAC3C,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,UAAU;YACtB,OAAO,EAA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AAE,OAAO;YACrB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;YAC3C,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE;gBACP,GAAG,CAAC,UAAU,CAAC,aAAa,IAAI;oBAC9B,aAAa,EAAE,UAAU,CAAC,aAAa;iBACxC,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,WAAW,IAAI;oBAC5B,cAAc,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC;iBAC/C,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,SAAS,IAAI;oBAC1B,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;iBACxC,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,OAAO,IAAI;oBACxB,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;iBACpC,CAAC;aACH;SACF,CAAC,CAAC;QACH,MAAM,SAAS,CACb,UAAU,EACV,IAAI,EACJ,CAAC,CAAC,UAAU,CAAC,aAAa,EAC1B,UAAU,CAAC,cAAc,CAC1B,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"36afaec7-c98c-53e1-86f3-ef52dcd0e926"}
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["tasks/i18n.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,UAAU,EAAE,UAAU,iBAyOpD"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["tasks/i18n.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,UAAU,EAAE,UAAU,iBA0OpD"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d655e317-abac-5345-8a2c-ea1e6a0ca6f0")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="df3bc234-b1c6-5f38-aaaa-898e579b1814")}catch(e){}}();
3
3
  import { createSpinner } from '../logging/console.js';
4
4
  import { allMcpPrompt } from '../prompts/system.js';
5
5
  import { exit } from '../utils/shutdown.js';
@@ -12,7 +12,7 @@ import chalk from 'chalk';
12
12
  import { appendFileSync } from 'node:fs';
13
13
  import { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';
14
14
  import path from 'node:path';
15
- import { updateLockfile, cleanupLockfile } from '../utils/lockfile.js';
15
+ import { updateLockfile } from '../utils/lockfile.js';
16
16
  import { extractFiles } from '../utils/dag/extractFiles.js';
17
17
  import { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';
18
18
  import { deleteAddedFiles } from '../utils/fs/git.js';
@@ -128,6 +128,7 @@ ${reports.join('\n')}`;
128
128
  logger.step(`Saved summary of changes to: ${summaryFilePath}`);
129
129
  // cleanup
130
130
  if (cliOptions.formatCmd) {
131
+ logger.verboseMessage(`Running ${cliOptions.formatCmd}...`);
131
132
  const { stderr, code } = await execFunction(cliOptions.formatCmd, [], false, manager.appDirectory, manager.getAgentAbortController());
132
133
  if (code !== 0) {
133
134
  logger.error(`Error running '${cliOptions.formatCmd}': ${stderr}`);
@@ -137,6 +138,7 @@ ${reports.join('\n')}`;
137
138
  }
138
139
  }
139
140
  else {
141
+ logger.verboseMessage(`Running formatter...`);
140
142
  const formatter = await detectFormatter();
141
143
  if (formatter && files.length > 0) {
142
144
  await formatFiles(files, formatter);
@@ -144,12 +146,12 @@ ${reports.join('\n')}`;
144
146
  }
145
147
  }
146
148
  const lockfilePath = manager.getLockFilePath();
149
+ logger.verboseMessage(`Deleting extra files...`);
147
150
  // Delete any files the AI may have arbitrarily created
148
- deleteAddedFiles([path.relative(manager.rootDirectory, manager.locadexDirectory)], ['dictionary.json', 'gt.config.json', 'locadex.yml']);
151
+ deleteAddedFiles([path.relative(manager.rootDirectory, manager.locadexDirectory)], ['dictionary.json', 'gt.config.json', 'locadex.yml', 'loadTranslations.js']);
152
+ logger.verboseMessage(`Updating lockfile...`);
149
153
  // Update lockfile with processed files
150
154
  updateLockfile(files, lockfilePath, manager.rootDirectory);
151
- // Clean up stale entries from lockfile
152
- cleanupLockfile(lockfilePath, manager.rootDirectory);
153
155
  logger.message(chalk.dim(`Updated lockfile with ${files.length} files`));
154
156
  cleanupOnExit();
155
157
  // Run translate cmd
@@ -256,4 +258,4 @@ ${allMcpPrompt}
256
258
  return prompt;
257
259
  }
258
260
  //# sourceMappingURL=i18n.js.map
259
- //# debugId=d655e317-abac-5345-8a2c-ea1e6a0ca6f0
261
+ //# debugId=df3bc234-b1c6-5f38-aaaa-898e579b1814
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sources":["tasks/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { createSpinner } from '../logging/console.js';\nimport { allMcpPrompt } from '../prompts/system.js';\nimport { exit } from '../utils/shutdown.js';\nimport { logger } from '../logging/logger.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport {\n addFilesToManager,\n markFileAsEdited,\n markFileAsInProgress,\n} from '../utils/dag/getFiles.js';\nimport { runParallelProcessing, TaskProcessor } from './concurrency.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { appendFileSync } from 'node:fs';\nimport { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';\nimport path from 'node:path';\nimport { updateLockfile, cleanupLockfile } from '../utils/lockfile.js';\nimport { extractFiles } from '../utils/dag/extractFiles.js';\nimport { Dag } from '../utils/dag/createDag.js';\nimport { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';\nimport { deleteAddedFiles } from '../utils/fs/git.js';\nimport { CLAUDE_CODE_VERSION } from '../utils/shared.js';\nimport { installGlobalPackage } from '../utils/packages/installPackage.js';\nimport { fixErrorsTask } from './fixErrors.js';\nimport { getLocadexVersion } from '../utils/getPaths.js';\nimport { execFunction } from '../utils/exec.js';\nimport { isGTAuthConfigured } from '../utils/config.js';\nimport { CliOptions } from '../types/cli.js';\n\n/**\n * Run Locadex i18n on the project\n * This task requires no human intervention and is safe to run in CI/CD pipelines.\n */\nexport async function i18nTask(cliOptions: CliOptions) {\n const manager = LocadexManager.getInstance();\n // have to use the package.json from the appDir\n const packageJson = await getPackageJson(manager.appDirectory);\n const isUsingGTNext = packageJson\n ? isPackageInstalled('gt-next', packageJson)\n : false;\n if (!isUsingGTNext) {\n logger.error(\n `gt-next not detected in ${manager.appDirectory}. Please specify the correct app directory with the --app-dir flag, or ensure that gt-next is correctly installed in the project.`\n );\n await exit(1);\n }\n\n // Install claude-code if not installed\n await installGlobalPackage('@anthropic-ai/claude-code', CLAUDE_CODE_VERSION);\n // Install locadex if not installed\n await installGlobalPackage('locadex', getLocadexVersion());\n\n logger.debugMessage('App directory: ' + manager.appDirectory);\n logger.debugMessage('Root directory: ' + manager.rootDirectory);\n\n // Init message\n const spinner = createSpinner();\n spinner.start('Initializing Locadex...');\n\n const { files, dag } = extractFiles(manager);\n\n if (files.length === 0) {\n spinner.stop('No files have changed since last run');\n outro(chalk.green('✅ Locadex i18n complete - no changes detected!'));\n await exit(0);\n }\n\n const filesStateFilePath = manager.getFilesStateFilePath();\n const concurrency = manager.getMaxConcurrency();\n const batchSize = manager.getBatchSize();\n\n // Create the list of files (aka tasks) to process\n const taskQueue = Array.from(files);\n\n // Add files to manager\n const stateFilePath = addFilesToManager(filesStateFilePath, taskQueue);\n spinner.stop('Locadex initialized');\n\n logger.verboseMessage(`Processing ${files.length} modified files`);\n logger.debugMessage(`Track progress here: ${stateFilePath}`);\n logger.debugMessage(`Order:\\n${taskQueue.join('\\n')}`);\n\n logger.message(`Using ${concurrency} concurrent agents`);\n logger.initializeProgressBar(taskQueue.length);\n\n const fileProcessingStartTime = Date.now();\n logger.progressBar.start(`Processing ${taskQueue.length} files...`);\n\n // Shared reports array for collecting results\n const reports: string[] = [];\n\n // Create i18n task processor\n const i18nProcessor: TaskProcessor<\n string,\n {\n dag: Dag;\n files: string[];\n filesStateFilePath: string;\n }\n > = {\n preProcess: async (files, context) => {\n const { dag, filesStateFilePath } = context;\n logger.debugMessage(`Files: ${files.join(', ')}`);\n // Mark tasks as in progress\n await Promise.all(\n files.map((file) => markFileAsInProgress(file, filesStateFilePath))\n );\n\n // Construct prompt\n const dependencies = Object.fromEntries(\n files.map((file) => [\n file,\n Array.from(new Set(dag.getDependencies(file))).map(String),\n ])\n );\n const dependents = Object.fromEntries(\n files.map((file) => [\n file,\n Array.from(new Set(dag.getDependents(file))).map(String),\n ])\n );\n\n return getPrompt({\n targetFile: files,\n dependencyFiles: dependencies,\n dependentFiles: dependents,\n });\n },\n postProcess: async (processedFiles, context, agentReport) => {\n const { filesStateFilePath } = context;\n\n // Mark tasks as complete\n await Promise.all(\n processedFiles.map((file) => markFileAsEdited(file, filesStateFilePath))\n );\n\n // Add agent report\n reports.push(agentReport);\n\n // Update stats\n manager.stats.updateStats({\n newProcessedFiles: processedFiles.length,\n });\n\n // Update progress bar\n logger.progressBar.advance(\n processedFiles.length,\n `Processed ${Number((manager.stats.getStats().processedFiles / files.length) * 100).toFixed(2)}% of files`\n );\n },\n };\n\n // Run parallel processing\n await runParallelProcessing(\n Array.from(taskQueue),\n i18nProcessor,\n { dag, files, filesStateFilePath },\n {\n concurrency,\n batchSize,\n },\n 3\n );\n\n if (manager.isAborted()) {\n cleanupOnExit();\n await exit(1);\n return;\n }\n\n logger.progressBar.stop(\n `Processed ${files.length} files [${Math.round(\n (Date.now() - fileProcessingStartTime) / 1000\n )}s]`\n );\n\n const cleanupReports = await fixErrorsTask();\n if (cleanupReports) {\n reports.push(...cleanupReports);\n }\n\n // Generate report\n const reportSummary = `# Summary of locadex i18n changes\n${reports.join('\\n')}`;\n const summaryFilePath = path.join(\n manager.getLogDirectory(),\n 'locadex-report.md'\n );\n appendFileSync(summaryFilePath, reportSummary);\n logger.step(`Saved summary of changes to: ${summaryFilePath}`);\n\n // cleanup\n if (cliOptions.formatCmd) {\n const { stderr, code } = await execFunction(\n cliOptions.formatCmd,\n [],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n if (code !== 0) {\n logger.error(`Error running '${cliOptions.formatCmd}': ${stderr}`);\n } else {\n logger.step(\n `Formatted ${files.length} files with ${cliOptions.formatCmd}`\n );\n }\n } else {\n const formatter = await detectFormatter();\n if (formatter && files.length > 0) {\n await formatFiles(files, formatter);\n logger.log(`Formatted ${files.length} files with ${formatter}`);\n }\n }\n\n const lockfilePath = manager.getLockFilePath();\n\n // Delete any files the AI may have arbitrarily created\n deleteAddedFiles(\n [path.relative(manager.rootDirectory, manager.locadexDirectory)],\n ['dictionary.json', 'gt.config.json', 'locadex.yml']\n );\n\n // Update lockfile with processed files\n updateLockfile(files, lockfilePath, manager.rootDirectory);\n\n // Clean up stale entries from lockfile\n cleanupLockfile(lockfilePath, manager.rootDirectory);\n\n logger.message(chalk.dim(`Updated lockfile with ${files.length} files`));\n\n cleanupOnExit();\n\n // Run translate cmd\n if (isGTAuthConfigured(manager.appDirectory) && !cliOptions.noTranslate) {\n try {\n logger.initializeSpinner();\n logger.spinner.start('Running locadex translate...');\n const { stderr, code } = await execFunction(\n 'locadex',\n ['translate'],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n if (code !== 0) {\n logger.spinner.stop('Translations failed!');\n logger.error(`Error running 'locadex translate': ${stderr}`);\n } else {\n logger.spinner.stop('Translations generated!');\n logger.log(`Translations generated with 'locadex translate'`);\n }\n } catch (error) {\n logger.spinner.stop('Translations failed!');\n logger.error(\n `Error running 'locadex translate': ${(error as Error).message}`\n );\n }\n } else {\n logger.step(\n `No GT_API_KEY or GT_PROJECT_ID found. Skipping translation step...`\n );\n }\n\n outro(chalk.green('✅ Locadex i18n complete!'));\n await exit(0);\n}\n\nfunction cleanupOnExit() {\n const manager = LocadexManager.getInstance();\n logger.info(\n chalk.dim(\n `Locadex Cost: $${manager.stats.getStats().totalCost.toFixed(2)}\nLocadex wall time: ${Math.round(\n (Date.now() - manager.stats.getStats().startTime) / 1000\n )}s\nLocadex files processed: ${manager.stats.getStats().processedFiles}`\n )\n );\n\n const finalStats = manager.stats.getStats();\n\n // Record telemetry for final stats\n manager.stats.recordTelemetry(true);\n\n logger.verboseMessage(\n `Locadex input tokens: ${finalStats.inputTokens}\nLocadex cached input tokens: ${finalStats.cachedInputTokens}\nLocadex output tokens: ${finalStats.outputTokens}\nLocadex turns: ${finalStats.turns}`\n );\n}\n\nfunction getPrompt({\n targetFile,\n dependencyFiles,\n dependentFiles,\n}: {\n targetFile: string[];\n dependencyFiles: Record<string, string[]>;\n dependentFiles: Record<string, string[]>;\n}) {\n const prompt = `# Task: Internationalize the target file(s) using gt-next.\n\n## INSTRUCTIONS\n\n- You are given a list of target files and their corresponding dependency/dependent files.\n- The project is already setup for internationalization. Do not try to setup the project again for i18n.\n\n## Workflow:\n1. **Gather context** Read the target files closely \n - You do not have to read the dependency/dependent files for each target file. They are provided for convenience.\n2. **Evaluate if i18n is necessary** Evaluate if the target files need to be internationalized using gt-next \n - If the target files have no relevant content, are already internationalized, or contain build-time code (e.g. nextjs plugins) they should never be internationalized.\n**IMPORTANT**: IF NONE OF THE TARGET FILES NEED TO BE INTERNATIONALIZED, YOUR TASK IS COMPLETE AND YOU MAY RETURN.\n3. **Identify the tools to use** Given the contents of the files, ask yourself which tools and guides you need to use to get the necessary knowledge to internationalize the target files. Here are some helpful questions to evaluate for tool selection:\n - 3.a. Is the content that needs to be i18ned being used in this same file, or is it being used in another file?\n - 3.b. Is there any string interpolation that needs to be i18ned?\n - 3.c. Is there any conditional logic or rendering that needs to be i18ned?\n - 3.d. Is the content that needs to be i18ned HTML/JSX or a string?\n4. **Internationalize** You now have the necessary knowledge. Internationalize the files using the information from the tools provided to you.\n - 4.a. Do not run validation checks such as tsc. We will do that later.\n\n## RULES:\n- ALWAYS use the <T> component to internationalize HTML/JSX content.\n- ALWAYS use useGT() or useTranslations() to internationalize string content (strings created with '', \"\", or \\`\\`).\n - When possible, avoid using useTranslations(); useGT() is always preferred.\n- DO NOT internationalize non-user facing content or content that is functional, such as ids, class names, error strings, logical strings, etc.\n- Do not add i18n middleware to the app.\n- ALWAYS adhere to the guides provided via the 'mcp__locadex__*' tools.\n - These guides provide additional knowledge about how to internationalize the content.\n- Minimize the footprint of your changes.\n- Focus on internationalizing all user facing content in the target files. \n- NEVER move content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR DELETE ANY FILES (especially .bak files)\n- NEVER EDIT FILES THAT ARE NOT GIVEN TO YOU.\n\n## TARGET FILE INFORMATION\n${targetFile.map(\n (file, index) => `\nTARGET FILE ${index + 1}:\n${file}\n\nDEPENDENCY FILES (files imported by target file ${index + 1}):\n${dependencyFiles[file].length > 0 ? ` ${dependencyFiles[file].join(', ')}` : 'none'}\n\nDEPENDENT FILES (files that import target file ${index + 1}):\n${dependentFiles[file].length > 0 ? ` ${dependentFiles[file].join(', ')}` : 'none'}\n`\n)}\n\n---\n\n## MCP TOOLS\n\n${allMcpPrompt}\n\n## Final output\n- When you are done, please return a brief summary of the files you modified, following this format.\n- **DO NOT** include any other text in your response. \n- If there were issues with some files, please include the issues in the list of changes for that file.\n\n[file 1 path]\n- List of changes to file 1\n`;\n\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IA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,CAAC;AAChB,CAAC","debug_id":"d655e317-abac-5345-8a2c-ea1e6a0ca6f0"}
1
+ {"version":3,"file":"i18n.js","sources":["tasks/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { createSpinner } from '../logging/console.js';\nimport { allMcpPrompt } from '../prompts/system.js';\nimport { exit } from '../utils/shutdown.js';\nimport { logger } from '../logging/logger.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport {\n addFilesToManager,\n markFileAsEdited,\n markFileAsInProgress,\n} from '../utils/dag/getFiles.js';\nimport { runParallelProcessing, TaskProcessor } from './concurrency.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { appendFileSync } from 'node:fs';\nimport { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';\nimport path from 'node:path';\nimport { updateLockfile } from '../utils/lockfile.js';\nimport { extractFiles } from '../utils/dag/extractFiles.js';\nimport { Dag } from '../utils/dag/createDag.js';\nimport { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';\nimport { deleteAddedFiles } from '../utils/fs/git.js';\nimport { CLAUDE_CODE_VERSION } from '../utils/shared.js';\nimport { installGlobalPackage } from '../utils/packages/installPackage.js';\nimport { fixErrorsTask } from './fixErrors.js';\nimport { getLocadexVersion } from '../utils/getPaths.js';\nimport { execFunction } from '../utils/exec.js';\nimport { isGTAuthConfigured } from '../utils/config.js';\nimport { CliOptions } from '../types/cli.js';\n\n/**\n * Run Locadex i18n on the project\n * This task requires no human intervention and is safe to run in CI/CD pipelines.\n */\nexport async function i18nTask(cliOptions: CliOptions) {\n const manager = LocadexManager.getInstance();\n // have to use the package.json from the appDir\n const packageJson = await getPackageJson(manager.appDirectory);\n const isUsingGTNext = packageJson\n ? isPackageInstalled('gt-next', packageJson)\n : false;\n if (!isUsingGTNext) {\n logger.error(\n `gt-next not detected in ${manager.appDirectory}. Please specify the correct app directory with the --app-dir flag, or ensure that gt-next is correctly installed in the project.`\n );\n await exit(1);\n }\n\n // Install claude-code if not installed\n await installGlobalPackage('@anthropic-ai/claude-code', CLAUDE_CODE_VERSION);\n // Install locadex if not installed\n await installGlobalPackage('locadex', getLocadexVersion());\n\n logger.debugMessage('App directory: ' + manager.appDirectory);\n logger.debugMessage('Root directory: ' + manager.rootDirectory);\n\n // Init message\n const spinner = createSpinner();\n spinner.start('Initializing Locadex...');\n\n const { files, dag } = extractFiles(manager);\n\n if (files.length === 0) {\n spinner.stop('No files have changed since last run');\n outro(chalk.green('✅ Locadex i18n complete - no changes detected!'));\n await exit(0);\n }\n\n const filesStateFilePath = manager.getFilesStateFilePath();\n const concurrency = manager.getMaxConcurrency();\n const batchSize = manager.getBatchSize();\n\n // Create the list of files (aka tasks) to process\n const taskQueue = Array.from(files);\n\n // Add files to manager\n const stateFilePath = addFilesToManager(filesStateFilePath, taskQueue);\n spinner.stop('Locadex initialized');\n\n logger.verboseMessage(`Processing ${files.length} modified files`);\n logger.debugMessage(`Track progress here: ${stateFilePath}`);\n logger.debugMessage(`Order:\\n${taskQueue.join('\\n')}`);\n\n logger.message(`Using ${concurrency} concurrent agents`);\n logger.initializeProgressBar(taskQueue.length);\n\n const fileProcessingStartTime = Date.now();\n logger.progressBar.start(`Processing ${taskQueue.length} files...`);\n\n // Shared reports array for collecting results\n const reports: string[] = [];\n\n // Create i18n task processor\n const i18nProcessor: TaskProcessor<\n string,\n {\n dag: Dag;\n files: string[];\n filesStateFilePath: string;\n }\n > = {\n preProcess: async (files, context) => {\n const { dag, filesStateFilePath } = context;\n logger.debugMessage(`Files: ${files.join(', ')}`);\n // Mark tasks as in progress\n await Promise.all(\n files.map((file) => markFileAsInProgress(file, filesStateFilePath))\n );\n\n // Construct prompt\n const dependencies = Object.fromEntries(\n files.map((file) => [\n file,\n Array.from(new Set(dag.getDependencies(file))).map(String),\n ])\n );\n const dependents = Object.fromEntries(\n files.map((file) => [\n file,\n Array.from(new Set(dag.getDependents(file))).map(String),\n ])\n );\n\n return getPrompt({\n targetFile: files,\n dependencyFiles: dependencies,\n dependentFiles: dependents,\n });\n },\n postProcess: async (processedFiles, context, agentReport) => {\n const { filesStateFilePath } = context;\n\n // Mark tasks as complete\n await Promise.all(\n processedFiles.map((file) => markFileAsEdited(file, filesStateFilePath))\n );\n\n // Add agent report\n reports.push(agentReport);\n\n // Update stats\n manager.stats.updateStats({\n newProcessedFiles: processedFiles.length,\n });\n\n // Update progress bar\n logger.progressBar.advance(\n processedFiles.length,\n `Processed ${Number((manager.stats.getStats().processedFiles / files.length) * 100).toFixed(2)}% of files`\n );\n },\n };\n\n // Run parallel processing\n await runParallelProcessing(\n Array.from(taskQueue),\n i18nProcessor,\n { dag, files, filesStateFilePath },\n {\n concurrency,\n batchSize,\n },\n 3\n );\n\n if (manager.isAborted()) {\n cleanupOnExit();\n await exit(1);\n return;\n }\n\n logger.progressBar.stop(\n `Processed ${files.length} files [${Math.round(\n (Date.now() - fileProcessingStartTime) / 1000\n )}s]`\n );\n\n const cleanupReports = await fixErrorsTask();\n if (cleanupReports) {\n reports.push(...cleanupReports);\n }\n\n // Generate report\n const reportSummary = `# Summary of locadex i18n changes\n${reports.join('\\n')}`;\n const summaryFilePath = path.join(\n manager.getLogDirectory(),\n 'locadex-report.md'\n );\n appendFileSync(summaryFilePath, reportSummary);\n logger.step(`Saved summary of changes to: ${summaryFilePath}`);\n\n // cleanup\n if (cliOptions.formatCmd) {\n logger.verboseMessage(`Running ${cliOptions.formatCmd}...`);\n const { stderr, code } = await execFunction(\n cliOptions.formatCmd,\n [],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n if (code !== 0) {\n logger.error(`Error running '${cliOptions.formatCmd}': ${stderr}`);\n } else {\n logger.step(\n `Formatted ${files.length} files with ${cliOptions.formatCmd}`\n );\n }\n } else {\n logger.verboseMessage(`Running formatter...`);\n const formatter = await detectFormatter();\n if (formatter && files.length > 0) {\n await formatFiles(files, formatter);\n logger.log(`Formatted ${files.length} files with ${formatter}`);\n }\n }\n\n const lockfilePath = manager.getLockFilePath();\n\n logger.verboseMessage(`Deleting extra files...`);\n // Delete any files the AI may have arbitrarily created\n deleteAddedFiles(\n [path.relative(manager.rootDirectory, manager.locadexDirectory)],\n ['dictionary.json', 'gt.config.json', 'locadex.yml', 'loadTranslations.js']\n );\n\n logger.verboseMessage(`Updating lockfile...`);\n // Update lockfile with processed files\n updateLockfile(files, lockfilePath, manager.rootDirectory);\n\n logger.message(chalk.dim(`Updated lockfile with ${files.length} files`));\n\n cleanupOnExit();\n\n // Run translate cmd\n if (isGTAuthConfigured(manager.appDirectory) && !cliOptions.noTranslate) {\n try {\n logger.initializeSpinner();\n logger.spinner.start('Running locadex translate...');\n const { stderr, code } = await execFunction(\n 'locadex',\n ['translate'],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n if (code !== 0) {\n logger.spinner.stop('Translations failed!');\n logger.error(`Error running 'locadex translate': ${stderr}`);\n } else {\n logger.spinner.stop('Translations generated!');\n logger.log(`Translations generated with 'locadex translate'`);\n }\n } catch (error) {\n logger.spinner.stop('Translations failed!');\n logger.error(\n `Error running 'locadex translate': ${(error as Error).message}`\n );\n }\n } else {\n logger.step(\n `No GT_API_KEY or GT_PROJECT_ID found. Skipping translation step...`\n );\n }\n\n outro(chalk.green('✅ Locadex i18n complete!'));\n await exit(0);\n}\n\nfunction cleanupOnExit() {\n const manager = LocadexManager.getInstance();\n logger.info(\n chalk.dim(\n `Locadex Cost: $${manager.stats.getStats().totalCost.toFixed(2)}\nLocadex wall time: ${Math.round(\n (Date.now() - manager.stats.getStats().startTime) / 1000\n )}s\nLocadex files processed: ${manager.stats.getStats().processedFiles}`\n )\n );\n\n const finalStats = manager.stats.getStats();\n\n // Record telemetry for final stats\n manager.stats.recordTelemetry(true);\n\n logger.verboseMessage(\n `Locadex input tokens: ${finalStats.inputTokens}\nLocadex cached input tokens: ${finalStats.cachedInputTokens}\nLocadex output tokens: ${finalStats.outputTokens}\nLocadex turns: ${finalStats.turns}`\n );\n}\n\nfunction getPrompt({\n targetFile,\n dependencyFiles,\n dependentFiles,\n}: {\n targetFile: string[];\n dependencyFiles: Record<string, string[]>;\n dependentFiles: Record<string, string[]>;\n}) {\n const prompt = `# Task: Internationalize the target file(s) using gt-next.\n\n## INSTRUCTIONS\n\n- You are given a list of target files and their corresponding dependency/dependent files.\n- The project is already setup for internationalization. Do not try to setup the project again for i18n.\n\n## Workflow:\n1. **Gather context** Read the target files closely \n - You do not have to read the dependency/dependent files for each target file. They are provided for convenience.\n2. **Evaluate if i18n is necessary** Evaluate if the target files need to be internationalized using gt-next \n - If the target files have no relevant content, are already internationalized, or contain build-time code (e.g. nextjs plugins) they should never be internationalized.\n**IMPORTANT**: IF NONE OF THE TARGET FILES NEED TO BE INTERNATIONALIZED, YOUR TASK IS COMPLETE AND YOU MAY RETURN.\n3. **Identify the tools to use** Given the contents of the files, ask yourself which tools and guides you need to use to get the necessary knowledge to internationalize the target files. Here are some helpful questions to evaluate for tool selection:\n - 3.a. Is the content that needs to be i18ned being used in this same file, or is it being used in another file?\n - 3.b. Is there any string interpolation that needs to be i18ned?\n - 3.c. Is there any conditional logic or rendering that needs to be i18ned?\n - 3.d. Is the content that needs to be i18ned HTML/JSX or a string?\n4. **Internationalize** You now have the necessary knowledge. Internationalize the files using the information from the tools provided to you.\n - 4.a. Do not run validation checks such as tsc. We will do that later.\n\n## RULES:\n- ALWAYS use the <T> component to internationalize HTML/JSX content.\n- ALWAYS use useGT() or useTranslations() to internationalize string content (strings created with '', \"\", or \\`\\`).\n - When possible, avoid using useTranslations(); useGT() is always preferred.\n- DO NOT internationalize non-user facing content or content that is functional, such as ids, class names, error strings, logical strings, etc.\n- Do not add i18n middleware to the app.\n- ALWAYS adhere to the guides provided via the 'mcp__locadex__*' tools.\n - These guides provide additional knowledge about how to internationalize the content.\n- Minimize the footprint of your changes.\n- Focus on internationalizing all user facing content in the target files. \n- NEVER move content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR DELETE ANY FILES (especially .bak files)\n- NEVER EDIT FILES THAT ARE NOT GIVEN TO YOU.\n\n## TARGET FILE INFORMATION\n${targetFile.map(\n (file, index) => `\nTARGET FILE ${index + 1}:\n${file}\n\nDEPENDENCY FILES (files imported by target file ${index + 1}):\n${dependencyFiles[file].length > 0 ? ` ${dependencyFiles[file].join(', ')}` : 'none'}\n\nDEPENDENT FILES (files that import target file ${index + 1}):\n${dependentFiles[file].length > 0 ? ` ${dependentFiles[file].join(', ')}` : 'none'}\n`\n)}\n\n---\n\n## MCP TOOLS\n\n${allMcpPrompt}\n\n## Final output\n- When you are done, please return a brief summary of the files you modified, following this format.\n- **DO NOT** include any other text in your response. \n- If there were issues with some files, please include the issues in the list of changes for that file.\n\n[file 1 path]\n- List of changes to file 1\n`;\n\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAiB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,cAAc,EA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AAU,CAAC,YAAY;iBAC/B,UAAU,CAAC,KAAK,EAAE,CAChC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,EACjB,UAAU,EACV,eAAe,EACf,cAAc,GAKf;IACC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCf,UAAU,CAAC,GAAG,CACd,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;cACL,KAAK,GAAG,CAAC;EACrB,IAAI;;kDAE4C,KAAK,GAAG,CAAC;EACzD,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;;iDAEnC,KAAK,GAAG,CAAC;EACxD,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;CACjF,CACA;;;;;;EAMC,YAAY;;;;;;;;;CASb,CAAC;IAEA,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"df3bc234-b1c6-5f38-aaaa-898e579b1814"}
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"/","sources":["tasks/setup.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,OAAO,EAClB,aAAa,EAAE,OAAO,EACtB,uBAAuB,CAAC,EAAE,MAAM,iBA2JjC"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"/","sources":["tasks/setup.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,OAAO,EAClB,aAAa,EAAE,OAAO,EACtB,uBAAuB,CAAC,EAAE,MAAM,iBA2KjC"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="da80142d-3899-5af8-abcc-7e9163fff826")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="11a37d3b-ec14-5152-a7c4-b08312f083e5")}catch(e){}}();
3
3
  import { createSpinner, promptConfirm } from '../logging/console.js';
4
4
  import { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';
5
5
  import { getPackageManager, } from 'gtx-cli/utils/packageManager';
@@ -91,12 +91,25 @@ export async function setupTask(cliOptions, autoSetup, bypassPrompts, specifiedP
91
91
  await handleInitGT(nextConfigPath, errors, warnings, filesUpdated);
92
92
  logger.step(`Added withGTConfig() to your ${nextConfigPath} file.`);
93
93
  // Create gt.config.json
94
- await createOrUpdateConfig(path.resolve(manager.appDirectory, 'gt.config.json'), {
94
+ const gtConfig = {
95
95
  defaultLocale: 'en',
96
96
  locales: ['es', 'fr', 'de', 'ja', 'zh'],
97
97
  framework: 'next-app',
98
- });
98
+ };
99
+ // Add local translations config if flag is set
100
+ if (manager.getCliOptions().localTranslations) {
101
+ gtConfig.files = {
102
+ gt: {
103
+ output: 'public/_gt/[locale].json',
104
+ },
105
+ };
106
+ }
107
+ await createOrUpdateConfig(path.resolve(manager.appDirectory, 'gt.config.json'), gtConfig);
99
108
  logger.success(`Feel free to edit ${chalk.cyan('gt.config.json')} to customize your translation setup. Docs: https://generaltranslation.com/docs/cli/reference/config`);
109
+ // Create loadTranslations file if local translations flag is set
110
+ if (manager.getCliOptions().localTranslations) {
111
+ await createLoadTranslationsFile(manager.appDirectory);
112
+ }
100
113
  // Add translate to scripts
101
114
  // Re-get the package.json to make sure it's updated
102
115
  appPackageJson = await getPackageJson(manager.appDirectory);
@@ -205,6 +218,33 @@ ${report}`;
205
218
  agent.aggregateStats();
206
219
  logger.spinner.stop('Locale selector setup complete');
207
220
  }
221
+ async function createLoadTranslationsFile(appDirectory) {
222
+ const usingSrcDirectory = existsSync(path.join(appDirectory, 'src'));
223
+ const publicPath = usingSrcDirectory ? '../public/_gt/' : './public/_gt/';
224
+ const filePath = usingSrcDirectory
225
+ ? path.join(appDirectory, 'src', 'loadTranslations.js')
226
+ : path.join(appDirectory, 'loadTranslations.js');
227
+ if (!existsSync(filePath)) {
228
+ const loadTranslationsContent = `
229
+ export default async function loadTranslations(locale) {
230
+ try {
231
+ // Load translations from public/_gt directory
232
+ // This matches the GT config files.gt.output path
233
+ const t = await import(\`${publicPath}\${locale}.json\`);
234
+ return t.default;
235
+ } catch (error) {
236
+ console.warn(\`Failed to load translations for locale \${locale}:\`, error);
237
+ return {};
238
+ }
239
+ }
240
+ `;
241
+ writeFileSync(filePath, loadTranslationsContent);
242
+ logger.step(`Created ${chalk.cyan('loadTranslations.js')} file at ${chalk.cyan(filePath)}.`);
243
+ }
244
+ else {
245
+ logger.step(`Found ${chalk.cyan('loadTranslations.js')} file at ${chalk.cyan(filePath)}. Skipping creation...`);
246
+ }
247
+ }
208
248
  function getLocaleSelectorPrompt(appDirectory) {
209
249
  const prompt = `# Task: Add a locale selector to the app
210
250
 
@@ -241,4 +281,4 @@ function MyComponent() {
241
281
  return prompt;
242
282
  }
243
283
  //# sourceMappingURL=setup.js.map
244
- //# debugId=da80142d-3899-5af8-abcc-7e9163fff826
284
+ //# debugId=11a37d3b-ec14-5152-a7c4-b08312f083e5
@@ -1 +1 @@
1
- {"version":3,"file":"setup.js","sources":["tasks/setup.ts"],"sourceRoot":"/","sourcesContent":["import { createSpinner, promptConfirm } from '../logging/console.js';\nimport { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';\nimport {\n getPackageManager,\n PackageManager,\n} from 'gtx-cli/utils/packageManager';\nimport { installPackage } from 'gtx-cli/utils/installPackage';\nimport chalk from 'chalk';\nimport { logger } from '../logging/logger.js';\nimport { findFilepaths } from '../utils/fs/findConfigs.js';\nimport { wrapContentNext } from 'gtx-cli/next/parse/wrapContent';\nimport { handleInitGT } from 'gtx-cli/next/parse/handleInitGT';\nimport { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';\nimport { createOrUpdateConfig } from 'gtx-cli/fs/config/setupConfig';\nimport { i18nTask } from '../tasks/i18n.js';\nimport { getNextDirectories } from '../utils/fs/getFiles.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { outro } from '@clack/prompts';\nimport { appendFileSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport path from 'node:path';\nimport { exit } from '../utils/shutdown.js';\nimport {\n addTranslateScript,\n installGlobalPackage,\n} from '../utils/packages/installPackage.js';\nimport { CLAUDE_CODE_VERSION } from '../utils/shared.js';\nimport { getLocadexVersion } from '../utils/getPaths.js';\nimport { getResource } from '../resources/getResource.js';\nimport { generateSettings } from 'gtx-cli/config/generateSettings';\nimport { setCredentials } from 'gtx-cli/utils/credentials';\nimport { retrieveCredentials } from 'gtx-cli/utils/credentials';\nimport { isGTAuthConfigured } from '../utils/config.js';\nimport { CliOptions } from '../types/cli.js';\nimport { execFunction } from '../utils/exec.js';\n\n/**\n * Run Locadex setup on the project\n * If autoSetup is true, the task will run without human intervention.\n * If autoSetup is false, the task may prompt the user for confirmation.\n */\nexport async function setupTask(\n cliOptions: CliOptions,\n autoSetup: boolean,\n bypassPrompts: boolean,\n specifiedPackageManager?: string\n) {\n if (!bypassPrompts && !autoSetup) {\n await promptConfirm({\n message: chalk.yellow(\n `Locadex will modify files! Make sure you have committed or stashed any changes. Do you want to continue?`\n ),\n defaultValue: true,\n cancelMessage: 'Operation cancelled.',\n });\n }\n\n const manager = LocadexManager.getInstance();\n\n // Setup API keys\n if (!autoSetup && !isGTAuthConfigured(manager.appDirectory)) {\n const shouldGenerateApiKeys = await promptConfirm({\n message: `Would you like locadex to automatically generate a General Translation API key and project ID for you?`,\n defaultValue: true,\n });\n if (shouldGenerateApiKeys) {\n await setupApiKeys('production', manager);\n }\n }\n\n const packageManager = await getPackageManager(\n manager.rootDirectory,\n specifiedPackageManager,\n autoSetup\n );\n let appPackageJson = await getPackageJson(manager.appDirectory);\n\n if (appPackageJson) {\n if (!isPackageInstalled('gt-next', appPackageJson)) {\n const spinner = createSpinner('timer');\n spinner.start(`Installing gt-next with ${packageManager.name}...`);\n await installPackage(\n 'gt-next',\n packageManager,\n false,\n manager.appDirectory\n );\n spinner.stop('Automatically installed gt-next.');\n }\n }\n\n const nextConfigPath = findFilepaths(\n [\n './next.config.js',\n './next.config.ts',\n './next.config.mjs',\n './next.config.mts',\n ],\n manager.appDirectory\n )[0];\n\n if (!nextConfigPath) {\n logger.error('No next.config.[js|ts|mjs|mts] file found.');\n await exit(1);\n }\n\n const errors: string[] = [];\n const warnings: string[] = [];\n let filesUpdated: string[] = [];\n\n const babel = createSpinner();\n\n babel.start('Wrapping <GTProvider> tags...');\n\n // Wrap all JSX elements in the src directory with a <T> tag, with unique ids\n const { filesUpdated: filesUpdatedNext } = await wrapContentNext(\n {\n src: getNextDirectories(manager.appDirectory),\n config: nextConfigPath,\n disableIds: true,\n disableFormatting: true,\n skipTs: true,\n addGTProvider: true,\n },\n 'gt-next',\n errors,\n warnings\n );\n filesUpdated = [...filesUpdated, ...filesUpdatedNext];\n\n babel.stop(`Modified ${filesUpdated.length} files.`);\n\n // Add the withGTConfig() function to the next.config.js file\n await handleInitGT(nextConfigPath, errors, warnings, filesUpdated);\n logger.step(`Added withGTConfig() to your ${nextConfigPath} file.`);\n\n // Create gt.config.json\n await createOrUpdateConfig(\n path.resolve(manager.appDirectory, 'gt.config.json'),\n {\n defaultLocale: 'en',\n locales: ['es', 'fr', 'de', 'ja', 'zh'],\n framework: 'next-app',\n }\n );\n\n logger.success(\n `Feel free to edit ${chalk.cyan(\n 'gt.config.json'\n )} to customize your translation setup. Docs: https://generaltranslation.com/docs/cli/reference/config`\n );\n\n // Add translate to scripts\n // Re-get the package.json to make sure it's updated\n appPackageJson = await getPackageJson(manager.appDirectory);\n if (appPackageJson) {\n await addTranslateScript(manager, appPackageJson, packageManager);\n }\n\n // Install claude-code if not installed\n await installGlobalPackage('@anthropic-ai/claude-code', CLAUDE_CODE_VERSION);\n\n // Install locadex if not installed\n await installGlobalPackage('locadex', getLocadexVersion());\n\n // Set up locale selector\n await setupLocaleSelector();\n\n // Create dictionary.json file if not exists\n // commented out because this trips up the AI\n // setupDictionary(manager);\n\n // Add locadex github action if not exists\n setupGithubAction(manager, packageManager);\n\n if (cliOptions.formatCmd) {\n const { stderr, code } = await execFunction(\n cliOptions.formatCmd,\n [],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n if (code !== 0) {\n logger.error(`Error running '${cliOptions.formatCmd}': ${stderr}`);\n } else {\n logger.step(\n `Formatted ${filesUpdated.length} files with ${cliOptions.formatCmd}`\n );\n }\n } else {\n const formatter = await detectFormatter();\n if (formatter && filesUpdated.length > 0) {\n await formatFiles(filesUpdated, formatter);\n logger.log(`Formatted ${filesUpdated.length} files with ${formatter}`);\n }\n }\n\n // Run i18n command\n await i18nTask(cliOptions);\n}\n\nfunction setupDictionary(manager: LocadexManager) {\n const usingSrcDirectory = existsSync(path.join(manager.appDirectory, 'src'));\n const dictionaryPath = usingSrcDirectory\n ? path.join(manager.appDirectory, 'src', 'dictionary.json')\n : path.join(manager.appDirectory, 'dictionary.json');\n if (!existsSync(dictionaryPath)) {\n writeFileSync(dictionaryPath, '{}');\n logger.step(\n `Created ${chalk.cyan(\n 'dictionary.json'\n )} file at ${chalk.cyan(dictionaryPath)}.`\n );\n } else {\n logger.step(\n `Found ${chalk.cyan('dictionary.json')} file at ${chalk.cyan(\n dictionaryPath\n )}. Skipping creation...`\n );\n }\n}\n\nfunction setupGithubAction(\n manager: LocadexManager,\n packageManager: PackageManager\n) {\n const githubActionPath = path.join(\n manager.rootDirectory,\n '.github',\n 'workflows',\n 'locadex.yml'\n );\n if (!existsSync(githubActionPath)) {\n mkdirSync(path.join(manager.rootDirectory, '.github', 'workflows'), {\n recursive: true,\n });\n const resource = getResource('ghaYaml.yml');\n if (resource.content) {\n const content = resource.content.replace(\n '[packageManager install command]',\n packageManager.installAllCommand\n );\n writeFileSync(githubActionPath, content);\n logger.step(\n `Created ${chalk.cyan(\n 'locadex.yml'\n )} Github Action at ${chalk.cyan(githubActionPath)}. You can edit this file to customize the Github Action. Make sure to add the corresponding secrets to your repo settings!`\n );\n } else {\n logger.error(`Error reading resource ghaYaml.yml: ${resource.error}`);\n }\n } else {\n logger.step(\n `Found ${chalk.cyan('locadex.yml')} Github Action at ${chalk.cyan(\n githubActionPath\n )}. Skipping creation...`\n );\n }\n}\n\nasync function setupApiKeys(\n keyType: 'development' | 'production',\n manager: LocadexManager\n) {\n const settings = await generateSettings({}, manager.appDirectory);\n const credentials = await retrieveCredentials(settings, keyType);\n await setCredentials(\n credentials,\n keyType,\n settings.framework,\n manager.appDirectory\n );\n}\n\nasync function setupLocaleSelector() {\n logger.initializeSpinner();\n logger.spinner.start('Creating locale selector...');\n\n // Create agent\n const manager = LocadexManager.getInstance();\n\n const agent = manager.createSingleAgent('claude_setup_agent', {});\n\n // Fix prompt\n const localeSelectorPrompt = getLocaleSelectorPrompt(manager.appDirectory);\n try {\n await agent.run(\n localeSelectorPrompt,\n {\n maxTurns: 50,\n timeoutSec: 120,\n maxRetries: 1,\n },\n {}\n );\n\n // Generate report\n const report = agent.generateReport();\n const reportSummary = `# Summary of locadex setup changes\n${report}`;\n const summaryFilePath = path.join(\n manager.getLogDirectory(),\n 'locadex-report.md'\n );\n appendFileSync(summaryFilePath, reportSummary);\n } catch (error) {\n agent.aggregateStats();\n // Check if this is an abort\n if (manager.getAgentAbortController().signal.aborted) {\n return;\n }\n logger.debugMessage(`[setup] Adding locale selector failed: ${error}`);\n outro(chalk.red('❌ Locadex setup failed!'));\n await exit(1);\n }\n agent.aggregateStats();\n\n logger.spinner.stop('Locale selector setup complete');\n}\n\nfunction getLocaleSelectorPrompt(appDirectory: string) {\n const prompt = `# Task: Add a locale selector to the app\n\n## Instructions\n- The locale selector should be a dropdown that allows the user to select the locale.\n- The app root is: \"${appDirectory}\"\n\n## LOCALE SELECTOR USAGE\n(1) Import the locale selector component from 'gt-next'\n(2) Add the locale selector to the app\n\nFor example:\nimport { LocaleSelector } from 'gt-next';\n\nfunction MyComponent() {\n return (\n <div>\n <LocaleSelector />\n <p>Hello, world!</p>\n </div>\n );\n}\n\n## RULES\n- The locale selector should be added to a header or footer or some other very obvious place in the app.\n- Scan across files to find the best place to add the locale selector.\n- **DO NOT** create new files. You may only modify existing files.\n- You do not need to mark the component containing the LocaleSelector with 'use client'. The LocaleSelector component is already internally marked with 'use client'.\n\n## Final output\n- When you are done, please return a **brief summary** of the files you modified.\n- **DO NOT** include any other text in your response.\n`;\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EACL,iBAAiB,GAElB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,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;sBAIK,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BjC,CAAC;IACA,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"da80142d-3899-5af8-abcc-7e9163fff826"}
1
+ {"version":3,"file":"setup.js","sources":["tasks/setup.ts"],"sourceRoot":"/","sourcesContent":["import { createSpinner, promptConfirm } from '../logging/console.js';\nimport { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';\nimport {\n getPackageManager,\n PackageManager,\n} from 'gtx-cli/utils/packageManager';\nimport { installPackage } from 'gtx-cli/utils/installPackage';\nimport chalk from 'chalk';\nimport { logger } from '../logging/logger.js';\nimport { findFilepaths } from '../utils/fs/findConfigs.js';\nimport { wrapContentNext } from 'gtx-cli/next/parse/wrapContent';\nimport { handleInitGT } from 'gtx-cli/next/parse/handleInitGT';\nimport { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';\nimport { createOrUpdateConfig } from 'gtx-cli/fs/config/setupConfig';\nimport { i18nTask } from '../tasks/i18n.js';\nimport { getNextDirectories } from '../utils/fs/getFiles.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { outro } from '@clack/prompts';\nimport { appendFileSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport path from 'node:path';\nimport { exit } from '../utils/shutdown.js';\nimport {\n addTranslateScript,\n installGlobalPackage,\n} from '../utils/packages/installPackage.js';\nimport { CLAUDE_CODE_VERSION } from '../utils/shared.js';\nimport { getLocadexVersion } from '../utils/getPaths.js';\nimport { getResource } from '../resources/getResource.js';\nimport { generateSettings } from 'gtx-cli/config/generateSettings';\nimport { setCredentials } from 'gtx-cli/utils/credentials';\nimport { retrieveCredentials } from 'gtx-cli/utils/credentials';\nimport { isGTAuthConfigured } from '../utils/config.js';\nimport { CliOptions } from '../types/cli.js';\nimport { execFunction } from '../utils/exec.js';\n\n/**\n * Run Locadex setup on the project\n * If autoSetup is true, the task will run without human intervention.\n * If autoSetup is false, the task may prompt the user for confirmation.\n */\nexport async function setupTask(\n cliOptions: CliOptions,\n autoSetup: boolean,\n bypassPrompts: boolean,\n specifiedPackageManager?: string\n) {\n if (!bypassPrompts && !autoSetup) {\n await promptConfirm({\n message: chalk.yellow(\n `Locadex will modify files! Make sure you have committed or stashed any changes. Do you want to continue?`\n ),\n defaultValue: true,\n cancelMessage: 'Operation cancelled.',\n });\n }\n\n const manager = LocadexManager.getInstance();\n\n // Setup API keys\n if (!autoSetup && !isGTAuthConfigured(manager.appDirectory)) {\n const shouldGenerateApiKeys = await promptConfirm({\n message: `Would you like locadex to automatically generate a General Translation API key and project ID for you?`,\n defaultValue: true,\n });\n if (shouldGenerateApiKeys) {\n await setupApiKeys('production', manager);\n }\n }\n\n const packageManager = await getPackageManager(\n manager.rootDirectory,\n specifiedPackageManager,\n autoSetup\n );\n let appPackageJson = await getPackageJson(manager.appDirectory);\n\n if (appPackageJson) {\n if (!isPackageInstalled('gt-next', appPackageJson)) {\n const spinner = createSpinner('timer');\n spinner.start(`Installing gt-next with ${packageManager.name}...`);\n await installPackage(\n 'gt-next',\n packageManager,\n false,\n manager.appDirectory\n );\n spinner.stop('Automatically installed gt-next.');\n }\n }\n\n const nextConfigPath = findFilepaths(\n [\n './next.config.js',\n './next.config.ts',\n './next.config.mjs',\n './next.config.mts',\n ],\n manager.appDirectory\n )[0];\n\n if (!nextConfigPath) {\n logger.error('No next.config.[js|ts|mjs|mts] file found.');\n await exit(1);\n }\n\n const errors: string[] = [];\n const warnings: string[] = [];\n let filesUpdated: string[] = [];\n\n const babel = createSpinner();\n\n babel.start('Wrapping <GTProvider> tags...');\n\n // Wrap all JSX elements in the src directory with a <T> tag, with unique ids\n const { filesUpdated: filesUpdatedNext } = await wrapContentNext(\n {\n src: getNextDirectories(manager.appDirectory),\n config: nextConfigPath,\n disableIds: true,\n disableFormatting: true,\n skipTs: true,\n addGTProvider: true,\n },\n 'gt-next',\n errors,\n warnings\n );\n filesUpdated = [...filesUpdated, ...filesUpdatedNext];\n\n babel.stop(`Modified ${filesUpdated.length} files.`);\n\n // Add the withGTConfig() function to the next.config.js file\n await handleInitGT(nextConfigPath, errors, warnings, filesUpdated);\n logger.step(`Added withGTConfig() to your ${nextConfigPath} file.`);\n\n // Create gt.config.json\n const gtConfig: any = {\n defaultLocale: 'en',\n locales: ['es', 'fr', 'de', 'ja', 'zh'],\n framework: 'next-app',\n };\n\n // Add local translations config if flag is set\n if (manager.getCliOptions().localTranslations) {\n gtConfig.files = {\n gt: {\n output: 'public/_gt/[locale].json',\n },\n };\n }\n\n await createOrUpdateConfig(\n path.resolve(manager.appDirectory, 'gt.config.json'),\n gtConfig\n );\n\n logger.success(\n `Feel free to edit ${chalk.cyan(\n 'gt.config.json'\n )} to customize your translation setup. Docs: https://generaltranslation.com/docs/cli/reference/config`\n );\n\n // Create loadTranslations file if local translations flag is set\n if (manager.getCliOptions().localTranslations) {\n await createLoadTranslationsFile(manager.appDirectory);\n }\n\n // Add translate to scripts\n // Re-get the package.json to make sure it's updated\n appPackageJson = await getPackageJson(manager.appDirectory);\n if (appPackageJson) {\n await addTranslateScript(manager, appPackageJson, packageManager);\n }\n\n // Install claude-code if not installed\n await installGlobalPackage('@anthropic-ai/claude-code', CLAUDE_CODE_VERSION);\n\n // Install locadex if not installed\n await installGlobalPackage('locadex', getLocadexVersion());\n\n // Set up locale selector\n await setupLocaleSelector();\n\n // Create dictionary.json file if not exists\n // commented out because this trips up the AI\n // setupDictionary(manager);\n\n // Add locadex github action if not exists\n setupGithubAction(manager, packageManager);\n\n if (cliOptions.formatCmd) {\n const { stderr, code } = await execFunction(\n cliOptions.formatCmd,\n [],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n if (code !== 0) {\n logger.error(`Error running '${cliOptions.formatCmd}': ${stderr}`);\n } else {\n logger.step(\n `Formatted ${filesUpdated.length} files with ${cliOptions.formatCmd}`\n );\n }\n } else {\n const formatter = await detectFormatter();\n if (formatter && filesUpdated.length > 0) {\n await formatFiles(filesUpdated, formatter);\n logger.log(`Formatted ${filesUpdated.length} files with ${formatter}`);\n }\n }\n\n // Run i18n command\n await i18nTask(cliOptions);\n}\n\nfunction setupDictionary(manager: LocadexManager) {\n const usingSrcDirectory = existsSync(path.join(manager.appDirectory, 'src'));\n const dictionaryPath = usingSrcDirectory\n ? path.join(manager.appDirectory, 'src', 'dictionary.json')\n : path.join(manager.appDirectory, 'dictionary.json');\n if (!existsSync(dictionaryPath)) {\n writeFileSync(dictionaryPath, '{}');\n logger.step(\n `Created ${chalk.cyan(\n 'dictionary.json'\n )} file at ${chalk.cyan(dictionaryPath)}.`\n );\n } else {\n logger.step(\n `Found ${chalk.cyan('dictionary.json')} file at ${chalk.cyan(\n dictionaryPath\n )}. Skipping creation...`\n );\n }\n}\n\nfunction setupGithubAction(\n manager: LocadexManager,\n packageManager: PackageManager\n) {\n const githubActionPath = path.join(\n manager.rootDirectory,\n '.github',\n 'workflows',\n 'locadex.yml'\n );\n if (!existsSync(githubActionPath)) {\n mkdirSync(path.join(manager.rootDirectory, '.github', 'workflows'), {\n recursive: true,\n });\n const resource = getResource('ghaYaml.yml');\n if (resource.content) {\n const content = resource.content.replace(\n '[packageManager install command]',\n packageManager.installAllCommand\n );\n writeFileSync(githubActionPath, content);\n logger.step(\n `Created ${chalk.cyan(\n 'locadex.yml'\n )} Github Action at ${chalk.cyan(githubActionPath)}. You can edit this file to customize the Github Action. Make sure to add the corresponding secrets to your repo settings!`\n );\n } else {\n logger.error(`Error reading resource ghaYaml.yml: ${resource.error}`);\n }\n } else {\n logger.step(\n `Found ${chalk.cyan('locadex.yml')} Github Action at ${chalk.cyan(\n githubActionPath\n )}. Skipping creation...`\n );\n }\n}\n\nasync function setupApiKeys(\n keyType: 'development' | 'production',\n manager: LocadexManager\n) {\n const settings = await generateSettings({}, manager.appDirectory);\n const credentials = await retrieveCredentials(settings, keyType);\n await setCredentials(\n credentials,\n keyType,\n settings.framework,\n manager.appDirectory\n );\n}\n\nasync function setupLocaleSelector() {\n logger.initializeSpinner();\n logger.spinner.start('Creating locale selector...');\n\n // Create agent\n const manager = LocadexManager.getInstance();\n\n const agent = manager.createSingleAgent('claude_setup_agent', {});\n\n // Fix prompt\n const localeSelectorPrompt = getLocaleSelectorPrompt(manager.appDirectory);\n try {\n await agent.run(\n localeSelectorPrompt,\n {\n maxTurns: 50,\n timeoutSec: 120,\n maxRetries: 1,\n },\n {}\n );\n\n // Generate report\n const report = agent.generateReport();\n const reportSummary = `# Summary of locadex setup changes\n${report}`;\n const summaryFilePath = path.join(\n manager.getLogDirectory(),\n 'locadex-report.md'\n );\n appendFileSync(summaryFilePath, reportSummary);\n } catch (error) {\n agent.aggregateStats();\n // Check if this is an abort\n if (manager.getAgentAbortController().signal.aborted) {\n return;\n }\n logger.debugMessage(`[setup] Adding locale selector failed: ${error}`);\n outro(chalk.red('❌ Locadex setup failed!'));\n await exit(1);\n }\n agent.aggregateStats();\n\n logger.spinner.stop('Locale selector setup complete');\n}\n\nasync function createLoadTranslationsFile(appDirectory: string) {\n const usingSrcDirectory = existsSync(path.join(appDirectory, 'src'));\n const publicPath = usingSrcDirectory ? '../public/_gt/' : './public/_gt/';\n const filePath = usingSrcDirectory\n ? path.join(appDirectory, 'src', 'loadTranslations.js')\n : path.join(appDirectory, 'loadTranslations.js');\n\n if (!existsSync(filePath)) {\n const loadTranslationsContent = `\nexport default async function loadTranslations(locale) {\n try {\n // Load translations from public/_gt directory\n // This matches the GT config files.gt.output path\n const t = await import(\\`${publicPath}\\${locale}.json\\`);\n return t.default;\n } catch (error) {\n console.warn(\\`Failed to load translations for locale \\${locale}:\\`, error);\n return {};\n }\n}\n`;\n writeFileSync(filePath, loadTranslationsContent);\n logger.step(\n `Created ${chalk.cyan(\n 'loadTranslations.js'\n )} file at ${chalk.cyan(filePath)}.`\n );\n } else {\n logger.step(\n `Found ${chalk.cyan('loadTranslations.js')} file at ${chalk.cyan(\n filePath\n )}. Skipping creation...`\n );\n }\n}\n\nfunction getLocaleSelectorPrompt(appDirectory: string) {\n const prompt = `# Task: Add a locale selector to the app\n\n## Instructions\n- The locale selector should be a dropdown that allows the user to select the locale.\n- The app root is: \"${appDirectory}\"\n\n## LOCALE SELECTOR USAGE\n(1) Import the locale selector component from 'gt-next'\n(2) Add the locale selector to the app\n\nFor example:\nimport { LocaleSelector } from 'gt-next';\n\nfunction MyComponent() {\n return (\n <div>\n <LocaleSelector />\n <p>Hello, world!</p>\n </div>\n );\n}\n\n## RULES\n- The locale selector should be added to a header or footer or some other very obvious place in the app.\n- Scan across files to find the best place to add the locale selector.\n- **DO NOT** create new files. You may only modify existing files.\n- You do not need to mark the component containing the LocaleSelector with 'use client'. The LocaleSelector component is already internally marked with 'use client'.\n\n## Final output\n- When you are done, please return a **brief summary** of the files you modified.\n- **DO NOT** include any other text in your response.\n`;\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EACL,iBAAiB,GAElB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,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ACxD,CAAC;AAED,KAAK,UAAU,0BAA0B,CAAC,YAAoB;IAC5D,MAAM,iBAAiB,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;IACrE,MAAM,UAAU,GAAG,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,CAAC;IAC1E,MAAM,QAAQ,GAAG,iBAAiB;QAChC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,qBAAqB,CAAC;QACvD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,qBAAqB,CAAC,CAAC;IAEnD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,MAAM,uBAAuB,GAAG;;;;;+BAKL,UAAU;;;;;;;CAOxC,CAAC;QACE,aAAa,CAAC,QAAQ,EAAE,uBAAuB,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CACT,WAAW,KAAK,CAAC,IAAI,CACnB,qBAAqB,CACtB,YAAY,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CACrC,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CACT,SAAS,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,YAAY,KAAK,CAAC,IAAI,CAC9D,QAAQ,CACT,wBAAwB,CAC1B,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,YAAoB;IACnD,MAAM,MAAM,GAAG;;;;sBAIK,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BjC,CAAC;IACA,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"11a37d3b-ec14-5152-a7c4-b08312f083e5"}
package/dist/telemetry.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bf55c1ef-1335-56c7-8592-1fca656dd8bc")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6c6358a1-36bb-5c80-9086-829cde2b0dcd")}catch(e){}}();
3
3
  import { exit, gracefulShutdown } from './utils/shutdown.js';
4
4
  import * as Sentry from '@sentry/node';
5
5
  import { PostHog } from 'posthog-node';
@@ -69,7 +69,7 @@ export async function withTelemetry(params, callback) {
69
69
  Sentry.setTag('args.noTelemetry', !!options.noTelemetry);
70
70
  Sentry.setTag('args.batchSize', options.batchSize);
71
71
  Sentry.setTag('args.concurrency', options.concurrency);
72
- Sentry.setTag('args.matchingFiles', options.matchingFiles);
72
+ Sentry.setTag('args.matchingFiles', options.matchingFiles?.join(', '));
73
73
  try {
74
74
  return await Sentry.startSpan({
75
75
  name: 'locadex-execution',
@@ -102,4 +102,4 @@ gracefulShutdown.addHandler({
102
102
  });
103
103
  export { posthog };
104
104
  //# sourceMappingURL=telemetry.js.map
105
- //# debugId=bf55c1ef-1335-56c7-8592-1fca656dd8bc
105
+ //# debugId=6c6358a1-36bb-5c80-9086-829cde2b0dcd
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.js","sources":["telemetry.ts"],"sourceRoot":"/","sourcesContent":["import { exit, gracefulShutdown } from './utils/shutdown.js';\nimport * as Sentry from '@sentry/node';\nimport { PostHog } from 'posthog-node';\nimport { getLocadexVersion } from './utils/getPaths.js';\nimport { CliOptions } from './types/cli.js';\nimport { getSessionId } from './utils/session.js';\n\nlet _posthog: PostHog | null = null;\nlet sentryInitialized = false;\nlet telemetryEnabled = false;\n\n// Create a PostHog proxy that behaves like PostHog but does nothing when disabled\nconst posthog = new Proxy({} as PostHog, {\n get(target, prop) {\n if (!telemetryEnabled || !_posthog) {\n // Return no-op functions for all PostHog methods\n if (\n typeof prop === 'string' &&\n ['capture', 'identify', 'alias', 'shutdown'].includes(prop)\n ) {\n return () => {};\n }\n return undefined;\n }\n return _posthog[prop as keyof PostHog];\n },\n});\n\nfunction initializeTelemetry(enabled: boolean) {\n telemetryEnabled = enabled;\n\n if (!sentryInitialized) {\n Sentry.init({\n dsn: 'https://f542d2155ab069c9de0fcd913ed3ce3b@o4508407294853120.ingest.us.sentry.io/4509441836843008',\n release: getLocadexVersion(),\n enabled,\n tracesSampleRate: 1.0,\n beforeSend: (event) => {\n event.exception?.values?.forEach((exception) => {\n delete exception.stacktrace;\n });\n delete event.server_name;\n return event;\n },\n beforeSendTransaction: (event) => {\n delete event.server_name;\n return event;\n },\n });\n sentryInitialized = true;\n }\n\n if (!_posthog && enabled) {\n _posthog = new PostHog('phc_LJRRBlhH8kgjiydp2bKjC7QPMguDoNd1b4QHQArxtha', {\n host: 'https://us.i.posthog.com',\n disableGeoip: true,\n });\n }\n}\n\nfunction updateProgress(status: string) {\n posthog.capture({\n distinctId: getSessionId(),\n event: 'locadex_progress',\n properties: { status },\n });\n}\n\nexport async function withTelemetry<F>(\n params: {\n enabled: boolean;\n options: CliOptions;\n },\n callback: () => F | Promise<F>\n): Promise<F> {\n const { enabled, options } = params;\n initializeTelemetry(enabled);\n\n if (!enabled) {\n return await callback();\n }\n\n Sentry.setTag('args.verbose', !!options.verbose);\n Sentry.setTag('args.debug', !!options.debug);\n Sentry.setTag('args.noTelemetry', !!options.noTelemetry);\n Sentry.setTag('args.batchSize', options.batchSize);\n Sentry.setTag('args.concurrency', options.concurrency);\n Sentry.setTag('args.matchingFiles', options.matchingFiles);\n\n try {\n return await Sentry.startSpan(\n {\n name: 'locadex-execution',\n op: 'locadex.exec',\n },\n async () => {\n updateProgress('start');\n const res = await callback();\n updateProgress('finished');\n return res;\n }\n );\n } catch (e) {\n Sentry.captureException(e);\n throw e;\n } finally {\n await exit(0);\n }\n}\n\n// Register telemetry cleanup with graceful shutdown\ngracefulShutdown.addHandler({\n name: 'telemetry-cleanup',\n handler: async () => {\n if (_posthog) {\n await _posthog.shutdown();\n }\n await Sentry.flush(3000).then(null, () => {});\n },\n timeout: 3000,\n});\n\nexport { posthog };\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,IAAI,QAAQ,GAAmB,IAAI,CAAC;AACpC,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAE7B,kFAAkF;AAClF,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,EAAa,EAAE;IACvC,GAAG,CAAC,MAAM,EAAE,IAAI;QACd,IAAI,CAAC,gBAAgB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnC,iDAAiD;YACjD,IACE,OAAO,IAAI,KAAK,QAAQ;gBACxB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC3D,CAAC;gBACD,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;YAClB,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,QAAQ,CAAC,IAAqB,CAAC,CAAC;IACzC,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,mBAAmB,CAAC,OAAgB;IAC3C,gBAAgB,GAAG,OAAO,CAAC;IAE3B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,EAAE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IAAI;CACd,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC","debug_id":"bf55c1ef-1335-56c7-8592-1fca656dd8bc"}
1
+ {"version":3,"file":"telemetry.js","sources":["telemetry.ts"],"sourceRoot":"/","sourcesContent":["import { exit, gracefulShutdown } from './utils/shutdown.js';\nimport * as Sentry from '@sentry/node';\nimport { PostHog } from 'posthog-node';\nimport { getLocadexVersion } from './utils/getPaths.js';\nimport { CliOptions } from './types/cli.js';\nimport { getSessionId } from './utils/session.js';\n\nlet _posthog: PostHog | null = null;\nlet sentryInitialized = false;\nlet telemetryEnabled = false;\n\n// Create a PostHog proxy that behaves like PostHog but does nothing when disabled\nconst posthog = new Proxy({} as PostHog, {\n get(target, prop) {\n if (!telemetryEnabled || !_posthog) {\n // Return no-op functions for all PostHog methods\n if (\n typeof prop === 'string' &&\n ['capture', 'identify', 'alias', 'shutdown'].includes(prop)\n ) {\n return () => {};\n }\n return undefined;\n }\n return _posthog[prop as keyof PostHog];\n },\n});\n\nfunction initializeTelemetry(enabled: boolean) {\n telemetryEnabled = enabled;\n\n if (!sentryInitialized) {\n Sentry.init({\n dsn: 'https://f542d2155ab069c9de0fcd913ed3ce3b@o4508407294853120.ingest.us.sentry.io/4509441836843008',\n release: getLocadexVersion(),\n enabled,\n tracesSampleRate: 1.0,\n beforeSend: (event) => {\n event.exception?.values?.forEach((exception) => {\n delete exception.stacktrace;\n });\n delete event.server_name;\n return event;\n },\n beforeSendTransaction: (event) => {\n delete event.server_name;\n return event;\n },\n });\n sentryInitialized = true;\n }\n\n if (!_posthog && enabled) {\n _posthog = new PostHog('phc_LJRRBlhH8kgjiydp2bKjC7QPMguDoNd1b4QHQArxtha', {\n host: 'https://us.i.posthog.com',\n disableGeoip: true,\n });\n }\n}\n\nfunction updateProgress(status: string) {\n posthog.capture({\n distinctId: getSessionId(),\n event: 'locadex_progress',\n properties: { status },\n });\n}\n\nexport async function withTelemetry<F>(\n params: {\n enabled: boolean;\n options: CliOptions;\n },\n callback: () => F | Promise<F>\n): Promise<F> {\n const { enabled, options } = params;\n initializeTelemetry(enabled);\n\n if (!enabled) {\n return await callback();\n }\n\n Sentry.setTag('args.verbose', !!options.verbose);\n Sentry.setTag('args.debug', !!options.debug);\n Sentry.setTag('args.noTelemetry', !!options.noTelemetry);\n Sentry.setTag('args.batchSize', options.batchSize);\n Sentry.setTag('args.concurrency', options.concurrency);\n Sentry.setTag('args.matchingFiles', options.matchingFiles?.join(', '));\n\n try {\n return await Sentry.startSpan(\n {\n name: 'locadex-execution',\n op: 'locadex.exec',\n },\n async () => {\n updateProgress('start');\n const res = await callback();\n updateProgress('finished');\n return res;\n }\n );\n } catch (e) {\n Sentry.captureException(e);\n throw e;\n } finally {\n await exit(0);\n }\n}\n\n// Register telemetry cleanup with graceful shutdown\ngracefulShutdown.addHandler({\n name: 'telemetry-cleanup',\n handler: async () => {\n if (_posthog) {\n await _posthog.shutdown();\n }\n await Sentry.flush(3000).then(null, () => {});\n },\n timeout: 3000,\n});\n\nexport { posthog };\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,IAAI,QAAQ,GAAmB,IAAI,CAAC;AACpC,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAE7B,kFAAkF;AAClF,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,EAAa,EAAE;IACvC,GAAG,CAAC,MAAM,EAAE,IAAI;QACd,IAAI,CAAC,gBAAgB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnC,iDAAiD;YACjD,IACE,OAAO,IAA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C,CAAC,CAAC;QAC3B,MAAM,CAAC,CAAC;IACV,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC;AACH,CAAC;AAED,oDAAoD;AACpD,gBAAgB,CAAC,UAAU,CAAC;IAC1B,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC5B,CAAC;QACD,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC","debug_id":"6c6358a1-36bb-5c80-9086-829cde2b0dcd"}
@@ -4,9 +4,10 @@ export type CliOptions = {
4
4
  noTelemetry?: boolean;
5
5
  batchSize?: string;
6
6
  concurrency?: string;
7
- matchingFiles?: string;
7
+ matchingFiles?: string[];
8
8
  appDir: string;
9
9
  timeout?: string;
10
+ localTranslations?: boolean;
10
11
  noTranslate?: boolean;
11
12
  formatCmd?: string;
12
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"/","sources":["types/cli.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"/","sources":["types/cli.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
package/dist/types/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1b2653eb-7b19-5ccb-ba9a-023b0ad28e52")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="801957f6-dfae-55db-b81b-3bb41529f229")}catch(e){}}();
3
3
  export {};
4
4
  //# sourceMappingURL=cli.js.map
5
- //# debugId=1b2653eb-7b19-5ccb-ba9a-023b0ad28e52
5
+ //# debugId=801957f6-dfae-55db-b81b-3bb41529f229
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":["types/cli.ts"],"sourceRoot":"/","sourcesContent":["export type CliOptions = {\n verbose?: boolean;\n debug?: boolean;\n noTelemetry?: boolean;\n batchSize?: string;\n concurrency?: string;\n matchingFiles?: string;\n appDir: string;\n timeout?: string;\n noTranslate?: boolean;\n formatCmd?: string;\n};\n\nexport type LocadexConfig = {\n batchSize: number;\n maxConcurrency: number;\n matchingFiles: string[];\n timeout: number;\n};\n"],"names":[],"mappings":"","debug_id":"1b2653eb-7b19-5ccb-ba9a-023b0ad28e52"}
1
+ {"version":3,"file":"cli.js","sources":["types/cli.ts"],"sourceRoot":"/","sourcesContent":["export type CliOptions = {\n verbose?: boolean;\n debug?: boolean;\n noTelemetry?: boolean;\n batchSize?: string;\n concurrency?: string;\n matchingFiles?: string[];\n appDir: string;\n timeout?: string;\n localTranslations?: boolean;\n noTranslate?: boolean;\n formatCmd?: string;\n};\n\nexport type LocadexConfig = {\n batchSize: number;\n maxConcurrency: number;\n matchingFiles: string[];\n timeout: number;\n};\n"],"names":[],"mappings":"","debug_id":"801957f6-dfae-55db-b81b-3bb41529f229"}
@@ -39,6 +39,7 @@ export declare class LocadexManager {
39
39
  private aborted;
40
40
  private agentMutex;
41
41
  private config;
42
+ private cliOptions;
42
43
  stats: AgentStats;
43
44
  logFile: string;
44
45
  private constructor();
@@ -73,6 +74,7 @@ export declare class LocadexManager {
73
74
  getBatchSize(): number;
74
75
  getTimeoutFactor(): number;
75
76
  getConfig(): LocadexConfig;
77
+ getCliOptions(): CliOptions;
76
78
  getLockFilePath(): string;
77
79
  cleanup(): void;
78
80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;KACzB,GAAG,IAAI,CAAC;IAkBT,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAOpC,YAAY,IAAI,GAAG,CACjB,MAAM,EACN;QAAE,KAAK,EAAE,gBAAgB,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAC/D;IAID,aAAa,IAAI,IAAI;IAerB,qBAAqB,IAAI,MAAM;IAG/B,mBAAmB,IAAI,MAAM;IAG7B,iBAAiB,IAAI,MAAM;IAG3B,YAAY,IAAI,MAAM;IAGtB,gBAAgB,IAAI,MAAM;IAG1B,SAAS,IAAI,aAAa;IAI1B,aAAa,IAAI,UAAU;IAI3B,eAAe,IAAI,MAAM;IAIzB,OAAO,IAAI,IAAI;IAuBf,eAAe,IAAI,MAAM;IAIzB,uBAAuB,IAAI,eAAe;IAI1C,SAAS,IAAI,OAAO;CAGrB"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="296ce3f2-a653-57ed-bf35-3025c26b9798")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f344147d-f05d-5384-b98f-6eb22b65f559")}catch(e){}}();
3
3
  import { ClaudeCodeRunner } from './claudeCode.js';
4
4
  import { fromPackageRoot } from './getPaths.js';
5
5
  import fs from 'node:fs';
@@ -58,6 +58,7 @@ export class LocadexManager {
58
58
  // State
59
59
  agentMutex = Promise.resolve();
60
60
  config;
61
+ cliOptions;
61
62
  stats;
62
63
  logFile;
63
64
  constructor(params) {
@@ -65,6 +66,7 @@ export class LocadexManager {
65
66
  this.agentPool = new Map();
66
67
  this.stats = new AgentStats();
67
68
  this.mcpTransport = params.mcpTransport;
69
+ this.cliOptions = params.cliOptions;
68
70
  this.agentAbortController = new AbortController();
69
71
  this.mcpAbortController = new AbortController();
70
72
  // appDirectory is the absolute path to the app directory
@@ -260,6 +262,9 @@ export class LocadexManager {
260
262
  getConfig() {
261
263
  return this.config;
262
264
  }
265
+ getCliOptions() {
266
+ return this.cliOptions;
267
+ }
263
268
  getLockFilePath() {
264
269
  return this.lockFilePath;
265
270
  }
@@ -294,4 +299,4 @@ export class LocadexManager {
294
299
  }
295
300
  }
296
301
  //# sourceMappingURL=locadexManager.js.map
297
- //# debugId=296ce3f2-a653-57ed-bf35-3025c26b9798
302
+ //# debugId=f344147d-f05d-5384-b98f-6eb22b65f559
@@ -1 +1 @@
1
- {"version":3,"file":"locadexManager.js","sources":["utils/locadexManager.ts"],"sourceRoot":"/","sourcesContent":["import { ClaudeCodeRunner, ClaudeRunnerOptions } from './claudeCode.js';\nimport { fromPackageRoot } from './getPaths.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { FileEntry } from './dag/getFiles.js';\nimport { logger } from '../logging/logger.js';\nimport { addToGitIgnore } from './fs/writeFiles.js';\nimport { spawn } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { setTimeout } from 'node:timers';\nimport { AgentStats } from './stats.js';\nimport { CliOptions, LocadexConfig } from '../types/cli.js';\nimport { findAvailablePort } from '../mcp/getPort.js';\nimport { createConfig, getConfig } from './config.js';\nimport { gracefulShutdown, exit } from './shutdown.js';\nimport { LOCKFILE_NAME } from './lockfile.js';\n\nexport interface LocadexRunMetadata {\n createdAt: string;\n locadexVersion: string;\n workingDirectory: string;\n projectName: string;\n transport: 'sse' | 'stdio';\n tempDirectory: string;\n nodeVersion: string;\n platform: string;\n arch: string;\n logFile: string;\n batchSize: number;\n maxConcurrency: number;\n [key: string]: any;\n}\n\nconst mcpSseConfig = {\n mcpServers: {\n locadex: {\n type: 'sse',\n url: 'http://localhost:8888/sse',\n },\n },\n};\nconst mcpStdioConfig = {\n mcpServers: {\n locadex: {\n command: 'locadex-mcp',\n args: [],\n env: {},\n },\n },\n};\n\nexport class LocadexManager {\n private static instance: LocadexManager | undefined;\n private mcpProcess: ChildProcess | undefined;\n private mcpTransport: 'sse' | 'stdio';\n\n // Paths\n private mcpConfigPath: string;\n private filesStateFilePath: string;\n private metadataFilePath: string;\n private lockFilePath: string;\n private currentRunDir: string;\n public locadexDirectory: string;\n public appDirectory: string;\n public rootDirectory: string;\n\n // Config\n private apiKey: string;\n private maxConcurrency: number;\n private batchSize: number;\n private timeout: number;\n private defaultSoftTurnLimit: number = 100;\n\n // Agent pool\n private agentPool: Map<string, { agent: ClaudeCodeRunner; busy: boolean }>;\n\n // Abort controllers\n private agentAbortController: AbortController;\n private mcpAbortController: AbortController;\n private aborted: boolean = false;\n\n // State\n private agentMutex = Promise.resolve();\n private config: LocadexConfig;\n public stats: AgentStats;\n public logFile: string;\n\n private constructor(params: {\n rootDirectory: string;\n appDirectory: string;\n mcpTransport: 'sse' | 'stdio';\n apiKey: string;\n metadata: Partial<LocadexRunMetadata>;\n options: Partial<LocadexConfig>;\n }) {\n this.apiKey = params.apiKey;\n this.agentPool = new Map();\n this.stats = new AgentStats();\n this.mcpTransport = params.mcpTransport;\n this.agentAbortController = new AbortController();\n this.mcpAbortController = new AbortController();\n\n // appDirectory is the absolute path to the app directory\n this.appDirectory = params.appDirectory;\n this.rootDirectory = params.rootDirectory;\n\n this.locadexDirectory = path.resolve(this.rootDirectory, '.locadex');\n this.currentRunDir = path.resolve(\n this.locadexDirectory,\n 'runs',\n Date.now().toString()\n );\n fs.mkdirSync(this.currentRunDir, { recursive: true });\n\n this.config = getConfig(\n this.locadexDirectory,\n this.rootDirectory,\n this.appDirectory,\n params.options\n );\n logger.debugMessage(\n `Locadex loaded with config: ${JSON.stringify(this.config, null, 2)}`\n );\n\n createConfig(this.locadexDirectory, {\n batchSize: this.config.batchSize,\n maxConcurrency: this.config.maxConcurrency,\n matchingFiles: this.config.matchingFiles,\n timeout: this.config.timeout,\n });\n\n addToGitIgnore(this.rootDirectory, '.locadex/runs');\n\n this.maxConcurrency = this.config.maxConcurrency;\n this.batchSize = this.config.batchSize;\n this.timeout = this.config.timeout;\n this.mcpConfigPath = path.resolve(this.currentRunDir, 'mcp.json');\n this.filesStateFilePath = path.resolve(\n this.currentRunDir,\n 'files-state.json'\n );\n this.metadataFilePath = path.resolve(this.currentRunDir, 'metadata.json');\n this.logFile = path.resolve(this.currentRunDir, 'log.txt');\n this.lockFilePath = path.resolve(this.locadexDirectory, LOCKFILE_NAME);\n\n // Create files-state.json\n const filesState: FileEntry[] = [];\n fs.writeFileSync(\n this.filesStateFilePath,\n JSON.stringify(filesState, null, 2)\n );\n\n // Create metadata.json\n const metadata: LocadexRunMetadata = {\n createdAt: new Date().toISOString(),\n locadexVersion: JSON.parse(\n fs.readFileSync(fromPackageRoot('package.json'), 'utf8')\n ).version,\n workingDirectory: this.appDirectory,\n projectName: path.basename(this.appDirectory),\n transport: params.mcpTransport,\n tempDirectory: this.currentRunDir,\n nodeVersion: process.version,\n platform: process.platform,\n arch: process.arch,\n logFile: this.logFile,\n batchSize: this.config.batchSize,\n maxConcurrency: this.config.maxConcurrency,\n ...params.metadata,\n };\n fs.writeFileSync(this.metadataFilePath, JSON.stringify(metadata, null, 2));\n\n // Register cleanup with graceful shutdown\n gracefulShutdown.addHandler({\n name: 'locadex-manager-cleanup',\n handler: () => this.cleanup(),\n timeout: 3000,\n });\n }\n\n async startMcpServer() {\n const env = {\n LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,\n LOCADEX_LOG_FILE_PATH: this.logFile,\n LOCADEX_VERBOSE: logger.verbose ? 'true' : 'false',\n LOCADEX_DEBUG: logger.debug ? 'true' : 'false',\n APP_DIRECTORY: this.appDirectory,\n };\n if (this.mcpTransport === 'stdio') {\n mcpStdioConfig.mcpServers.locadex.env = env;\n fs.writeFileSync(\n this.mcpConfigPath,\n JSON.stringify(mcpStdioConfig, null, 2)\n );\n logger.debugMessage(\n `Starting MCP server on stdio with config: ${JSON.stringify(\n mcpStdioConfig,\n null,\n 2\n )}`\n );\n } else {\n // First, search for an available port\n const port = await findAvailablePort(8888);\n mcpSseConfig.mcpServers.locadex.url = `http://localhost:${port}/sse`;\n fs.writeFileSync(\n this.mcpConfigPath,\n JSON.stringify(mcpSseConfig, null, 2)\n );\n\n logger.debugMessage(\n `Starting MCP server on port ${port} with config: ${JSON.stringify(\n mcpSseConfig,\n null,\n 2\n )}`\n );\n\n this.mcpProcess = spawn('node', [fromPackageRoot('dist/mcp-sse.js')], {\n env: {\n ...process.env,\n ...env,\n PORT: port.toString(),\n },\n stdio: ['ignore', 'inherit', 'inherit'],\n signal: this.mcpAbortController.signal,\n });\n\n this.mcpProcess.on('error', async (error) => {\n if (error.name === 'AbortError') {\n logger.debugMessage('MCP server was closed');\n } else {\n logger.error(`MCP server failed to start: ${error.message}`);\n await exit(1);\n }\n });\n\n this.mcpProcess.on('exit', async (code, signal) => {\n if (code !== 0 && code !== null) {\n logger.error(`MCP server exited with code ${code}`);\n await exit(code as 0 | 1);\n }\n if (signal) {\n logger.error(`MCP server was killed with signal ${signal}`);\n await exit(0);\n }\n });\n }\n }\n\n static getInstance(): LocadexManager {\n if (!LocadexManager.instance) {\n throw new Error('LocadexManager not initialized');\n }\n return LocadexManager.instance;\n }\n\n static initialize(params: {\n rootDirectory: string;\n appDirectory: string;\n mcpTransport: 'sse' | 'stdio';\n apiKey: string;\n metadata: Partial<LocadexRunMetadata>;\n cliOptions: CliOptions;\n options: Partial<LocadexConfig>;\n }): void {\n if (!LocadexManager.instance) {\n LocadexManager.instance = new LocadexManager(params);\n logger.initialize(params.cliOptions, LocadexManager.instance.logFile);\n\n logger.debugMessage(\n `Locadex loaded with config: ${JSON.stringify(\n LocadexManager.instance.config,\n null,\n 2\n )}`\n );\n LocadexManager.instance.startMcpServer();\n }\n }\n\n static reset(): void {\n if (LocadexManager.instance) {\n LocadexManager.instance.cleanup();\n LocadexManager.instance = undefined;\n }\n }\n\n createSingleAgent(\n id: string,\n options: ClaudeRunnerOptions\n ): ClaudeCodeRunner {\n return new ClaudeCodeRunner(this, this.agentAbortController, {\n apiKey: this.apiKey,\n mcpConfig: this.mcpConfigPath,\n softTurnLimit: options.softTurnLimit ?? this.defaultSoftTurnLimit,\n id,\n });\n }\n\n createAgentPool(options: ClaudeRunnerOptions): void {\n if (this.agentPool.size === 0) {\n for (let i = 0; i < this.maxConcurrency; i++) {\n const agentId = `claude_task_agent_${i + 1}`;\n this.agentPool.set(agentId, {\n agent: this.createSingleAgent(agentId, options),\n busy: false,\n });\n }\n }\n }\n\n async getAvailableAgent(): Promise<{\n id: string;\n agent: ClaudeCodeRunner;\n } | null> {\n return new Promise((resolve) => {\n this.agentMutex = this.agentMutex.then(() => {\n for (const [id, agentData] of this.agentPool) {\n if (!agentData.busy) {\n agentData.busy = true;\n resolve({\n id,\n agent: agentData.agent,\n });\n return;\n }\n }\n resolve(null);\n });\n });\n }\n\n markAgentFree(agentId: string): void {\n const agentData = this.agentPool.get(agentId);\n if (agentData) {\n agentData.busy = false;\n }\n }\n\n getAgentPool(): Map<\n string,\n { agent: ClaudeCodeRunner; sessionId?: string; busy: boolean }\n > {\n return this.agentPool;\n }\n\n cleanupAgents(): void {\n logger.debugMessage('Cleaning up all Claude Code agents and processes');\n\n // Abort all active processes\n this.agentAbortController.abort();\n\n // Mark agents as free\n for (const agentData of this.agentPool.values()) {\n agentData.busy = false;\n }\n\n // Clear the agent pool\n this.agentPool.clear();\n }\n\n getFilesStateFilePath(): string {\n return this.filesStateFilePath;\n }\n getMetadataFilePath(): string {\n return this.metadataFilePath;\n }\n getMaxConcurrency(): number {\n return this.maxConcurrency;\n }\n getBatchSize(): number {\n return this.batchSize;\n }\n getTimeoutFactor(): number {\n return this.timeout;\n }\n getConfig(): LocadexConfig {\n return this.config;\n }\n\n getLockFilePath(): string {\n return this.lockFilePath;\n }\n\n cleanup(): void {\n if (this.aborted) {\n return;\n }\n this.aborted = true;\n // Clean up agents first (if not already done)\n this.cleanupAgents();\n\n // Clean up MCP process using abort controller\n if (this.mcpProcess && !this.mcpProcess.killed) {\n logger.debugMessage('Terminating MCP process via abort controller');\n this.mcpAbortController.abort();\n\n // Give the process a moment to handle the abort signal gracefully\n setTimeout(() => {\n if (this.mcpProcess && !this.mcpProcess.killed) {\n logger.debugMessage('Force killing MCP process as fallback');\n this.mcpProcess.kill('SIGTERM');\n }\n }, 1000);\n }\n }\n\n getLogDirectory(): string {\n return this.currentRunDir;\n }\n\n getAgentAbortController(): AbortController {\n return this.agentAbortController;\n }\n\n isAborted(): boolean {\n return this.aborted;\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,gBAAgB,EAAuB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAkB9C,MAAM,YAAY,GAAG;IACnB,UAAU,EAAE;QACV,OAAO,EAAE;YACP,IAAI,EAAE,KAAK;YACX,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AAC,MAAM,EAAE,CAAC;YAC/C,MAAM,CAAC,YAAY,CAAC,8CAA8C,CAAC,CAAC;YACpE,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;YAEhC,kEAAkE;YAClE,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;oBAC/C,MAAM,CAAC,YAAY,CAAC,uCAAuC,CAAC,CAAC;oBAC7D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,uBAAuB;QACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF","debug_id":"296ce3f2-a653-57ed-bf35-3025c26b9798"}
1
+ {"version":3,"file":"locadexManager.js","sources":["utils/locadexManager.ts"],"sourceRoot":"/","sourcesContent":["import { ClaudeCodeRunner, ClaudeRunnerOptions } from './claudeCode.js';\nimport { fromPackageRoot } from './getPaths.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { FileEntry } from './dag/getFiles.js';\nimport { logger } from '../logging/logger.js';\nimport { addToGitIgnore } from './fs/writeFiles.js';\nimport { spawn } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { setTimeout } from 'node:timers';\nimport { AgentStats } from './stats.js';\nimport { CliOptions, LocadexConfig } from '../types/cli.js';\nimport { findAvailablePort } from '../mcp/getPort.js';\nimport { createConfig, getConfig } from './config.js';\nimport { gracefulShutdown, exit } from './shutdown.js';\nimport { LOCKFILE_NAME } from './lockfile.js';\n\nexport interface LocadexRunMetadata {\n createdAt: string;\n locadexVersion: string;\n workingDirectory: string;\n projectName: string;\n transport: 'sse' | 'stdio';\n tempDirectory: string;\n nodeVersion: string;\n platform: string;\n arch: string;\n logFile: string;\n batchSize: number;\n maxConcurrency: number;\n [key: string]: any;\n}\n\nconst mcpSseConfig = {\n mcpServers: {\n locadex: {\n type: 'sse',\n url: 'http://localhost:8888/sse',\n },\n },\n};\nconst mcpStdioConfig = {\n mcpServers: {\n locadex: {\n command: 'locadex-mcp',\n args: [],\n env: {},\n },\n },\n};\n\nexport class LocadexManager {\n private static instance: LocadexManager | undefined;\n private mcpProcess: ChildProcess | undefined;\n private mcpTransport: 'sse' | 'stdio';\n\n // Paths\n private mcpConfigPath: string;\n private filesStateFilePath: string;\n private metadataFilePath: string;\n private lockFilePath: string;\n private currentRunDir: string;\n public locadexDirectory: string;\n public appDirectory: string;\n public rootDirectory: string;\n\n // Config\n private apiKey: string;\n private maxConcurrency: number;\n private batchSize: number;\n private timeout: number;\n private defaultSoftTurnLimit: number = 100;\n\n // Agent pool\n private agentPool: Map<string, { agent: ClaudeCodeRunner; busy: boolean }>;\n\n // Abort controllers\n private agentAbortController: AbortController;\n private mcpAbortController: AbortController;\n private aborted: boolean = false;\n\n // State\n private agentMutex = Promise.resolve();\n private config: LocadexConfig;\n private cliOptions: CliOptions;\n public stats: AgentStats;\n public logFile: string;\n\n private constructor(params: {\n rootDirectory: string;\n appDirectory: string;\n mcpTransport: 'sse' | 'stdio';\n apiKey: string;\n metadata: Partial<LocadexRunMetadata>;\n cliOptions: CliOptions;\n options: Partial<LocadexConfig>;\n }) {\n this.apiKey = params.apiKey;\n this.agentPool = new Map();\n this.stats = new AgentStats();\n this.mcpTransport = params.mcpTransport;\n this.cliOptions = params.cliOptions;\n this.agentAbortController = new AbortController();\n this.mcpAbortController = new AbortController();\n\n // appDirectory is the absolute path to the app directory\n this.appDirectory = params.appDirectory;\n this.rootDirectory = params.rootDirectory;\n\n this.locadexDirectory = path.resolve(this.rootDirectory, '.locadex');\n this.currentRunDir = path.resolve(\n this.locadexDirectory,\n 'runs',\n Date.now().toString()\n );\n fs.mkdirSync(this.currentRunDir, { recursive: true });\n\n this.config = getConfig(\n this.locadexDirectory,\n this.rootDirectory,\n this.appDirectory,\n params.options\n );\n logger.debugMessage(\n `Locadex loaded with config: ${JSON.stringify(this.config, null, 2)}`\n );\n\n createConfig(this.locadexDirectory, {\n batchSize: this.config.batchSize,\n maxConcurrency: this.config.maxConcurrency,\n matchingFiles: this.config.matchingFiles,\n timeout: this.config.timeout,\n });\n\n addToGitIgnore(this.rootDirectory, '.locadex/runs');\n\n this.maxConcurrency = this.config.maxConcurrency;\n this.batchSize = this.config.batchSize;\n this.timeout = this.config.timeout;\n this.mcpConfigPath = path.resolve(this.currentRunDir, 'mcp.json');\n this.filesStateFilePath = path.resolve(\n this.currentRunDir,\n 'files-state.json'\n );\n this.metadataFilePath = path.resolve(this.currentRunDir, 'metadata.json');\n this.logFile = path.resolve(this.currentRunDir, 'log.txt');\n this.lockFilePath = path.resolve(this.locadexDirectory, LOCKFILE_NAME);\n\n // Create files-state.json\n const filesState: FileEntry[] = [];\n fs.writeFileSync(\n this.filesStateFilePath,\n JSON.stringify(filesState, null, 2)\n );\n\n // Create metadata.json\n const metadata: LocadexRunMetadata = {\n createdAt: new Date().toISOString(),\n locadexVersion: JSON.parse(\n fs.readFileSync(fromPackageRoot('package.json'), 'utf8')\n ).version,\n workingDirectory: this.appDirectory,\n projectName: path.basename(this.appDirectory),\n transport: params.mcpTransport,\n tempDirectory: this.currentRunDir,\n nodeVersion: process.version,\n platform: process.platform,\n arch: process.arch,\n logFile: this.logFile,\n batchSize: this.config.batchSize,\n maxConcurrency: this.config.maxConcurrency,\n ...params.metadata,\n };\n fs.writeFileSync(this.metadataFilePath, JSON.stringify(metadata, null, 2));\n\n // Register cleanup with graceful shutdown\n gracefulShutdown.addHandler({\n name: 'locadex-manager-cleanup',\n handler: () => this.cleanup(),\n timeout: 3000,\n });\n }\n\n async startMcpServer() {\n const env = {\n LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,\n LOCADEX_LOG_FILE_PATH: this.logFile,\n LOCADEX_VERBOSE: logger.verbose ? 'true' : 'false',\n LOCADEX_DEBUG: logger.debug ? 'true' : 'false',\n APP_DIRECTORY: this.appDirectory,\n };\n if (this.mcpTransport === 'stdio') {\n mcpStdioConfig.mcpServers.locadex.env = env;\n fs.writeFileSync(\n this.mcpConfigPath,\n JSON.stringify(mcpStdioConfig, null, 2)\n );\n logger.debugMessage(\n `Starting MCP server on stdio with config: ${JSON.stringify(\n mcpStdioConfig,\n null,\n 2\n )}`\n );\n } else {\n // First, search for an available port\n const port = await findAvailablePort(8888);\n mcpSseConfig.mcpServers.locadex.url = `http://localhost:${port}/sse`;\n fs.writeFileSync(\n this.mcpConfigPath,\n JSON.stringify(mcpSseConfig, null, 2)\n );\n\n logger.debugMessage(\n `Starting MCP server on port ${port} with config: ${JSON.stringify(\n mcpSseConfig,\n null,\n 2\n )}`\n );\n\n this.mcpProcess = spawn('node', [fromPackageRoot('dist/mcp-sse.js')], {\n env: {\n ...process.env,\n ...env,\n PORT: port.toString(),\n },\n stdio: ['ignore', 'inherit', 'inherit'],\n signal: this.mcpAbortController.signal,\n });\n\n this.mcpProcess.on('error', async (error) => {\n if (error.name === 'AbortError') {\n logger.debugMessage('MCP server was closed');\n } else {\n logger.error(`MCP server failed to start: ${error.message}`);\n await exit(1);\n }\n });\n\n this.mcpProcess.on('exit', async (code, signal) => {\n if (code !== 0 && code !== null) {\n logger.error(`MCP server exited with code ${code}`);\n await exit(code as 0 | 1);\n }\n if (signal) {\n logger.error(`MCP server was killed with signal ${signal}`);\n await exit(0);\n }\n });\n }\n }\n\n static getInstance(): LocadexManager {\n if (!LocadexManager.instance) {\n throw new Error('LocadexManager not initialized');\n }\n return LocadexManager.instance;\n }\n\n static initialize(params: {\n rootDirectory: string;\n appDirectory: string;\n mcpTransport: 'sse' | 'stdio';\n apiKey: string;\n metadata: Partial<LocadexRunMetadata>;\n cliOptions: CliOptions;\n options: Partial<LocadexConfig>;\n }): void {\n if (!LocadexManager.instance) {\n LocadexManager.instance = new LocadexManager(params);\n logger.initialize(params.cliOptions, LocadexManager.instance.logFile);\n\n logger.debugMessage(\n `Locadex loaded with config: ${JSON.stringify(\n LocadexManager.instance.config,\n null,\n 2\n )}`\n );\n LocadexManager.instance.startMcpServer();\n }\n }\n\n static reset(): void {\n if (LocadexManager.instance) {\n LocadexManager.instance.cleanup();\n LocadexManager.instance = undefined;\n }\n }\n\n createSingleAgent(\n id: string,\n options: ClaudeRunnerOptions\n ): ClaudeCodeRunner {\n return new ClaudeCodeRunner(this, this.agentAbortController, {\n apiKey: this.apiKey,\n mcpConfig: this.mcpConfigPath,\n softTurnLimit: options.softTurnLimit ?? this.defaultSoftTurnLimit,\n id,\n });\n }\n\n createAgentPool(options: ClaudeRunnerOptions): void {\n if (this.agentPool.size === 0) {\n for (let i = 0; i < this.maxConcurrency; i++) {\n const agentId = `claude_task_agent_${i + 1}`;\n this.agentPool.set(agentId, {\n agent: this.createSingleAgent(agentId, options),\n busy: false,\n });\n }\n }\n }\n\n async getAvailableAgent(): Promise<{\n id: string;\n agent: ClaudeCodeRunner;\n } | null> {\n return new Promise((resolve) => {\n this.agentMutex = this.agentMutex.then(() => {\n for (const [id, agentData] of this.agentPool) {\n if (!agentData.busy) {\n agentData.busy = true;\n resolve({\n id,\n agent: agentData.agent,\n });\n return;\n }\n }\n resolve(null);\n });\n });\n }\n\n markAgentFree(agentId: string): void {\n const agentData = this.agentPool.get(agentId);\n if (agentData) {\n agentData.busy = false;\n }\n }\n\n getAgentPool(): Map<\n string,\n { agent: ClaudeCodeRunner; sessionId?: string; busy: boolean }\n > {\n return this.agentPool;\n }\n\n cleanupAgents(): void {\n logger.debugMessage('Cleaning up all Claude Code agents and processes');\n\n // Abort all active processes\n this.agentAbortController.abort();\n\n // Mark agents as free\n for (const agentData of this.agentPool.values()) {\n agentData.busy = false;\n }\n\n // Clear the agent pool\n this.agentPool.clear();\n }\n\n getFilesStateFilePath(): string {\n return this.filesStateFilePath;\n }\n getMetadataFilePath(): string {\n return this.metadataFilePath;\n }\n getMaxConcurrency(): number {\n return this.maxConcurrency;\n }\n getBatchSize(): number {\n return this.batchSize;\n }\n getTimeoutFactor(): number {\n return this.timeout;\n }\n getConfig(): LocadexConfig {\n return this.config;\n }\n\n getCliOptions(): CliOptions {\n return this.cliOptions;\n }\n\n getLockFilePath(): string {\n return this.lockFilePath;\n }\n\n cleanup(): void {\n if (this.aborted) {\n return;\n }\n this.aborted = true;\n // Clean up agents first (if not already done)\n this.cleanupAgents();\n\n // Clean up MCP process using abort controller\n if (this.mcpProcess && !this.mcpProcess.killed) {\n logger.debugMessage('Terminating MCP process via abort controller');\n this.mcpAbortController.abort();\n\n // Give the process a moment to handle the abort signal gracefully\n setTimeout(() => {\n if (this.mcpProcess && !this.mcpProcess.killed) {\n logger.debugMessage('Force killing MCP process as fallback');\n this.mcpProcess.kill('SIGTERM');\n }\n }, 1000);\n }\n }\n\n getLogDirectory(): string {\n return this.currentRunDir;\n }\n\n getAgentAbortController(): AbortController {\n return this.agentAbortController;\n }\n\n isAborted(): boolean {\n return this.aborted;\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,gBAAgB,EAAuB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAA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;IACrB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,8CAA8C;QAC9C,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,8CAA8C;QAC9C,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC/C,MAAM,CAAC,YAAY,CAAC,8CAA8C,CAAC,CAAC;YACpE,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;YAEhC,kEAAkE;YAClE,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;oBAC/C,MAAM,CAAC,YAAY,CAAC,uCAAuC,CAAC,CAAC;oBAC7D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,uBAAuB;QACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF","debug_id":"f344147d-f05d-5384-b98f-6eb22b65f559"}
@@ -13,5 +13,4 @@ export declare function loadLockfile(lockfilePath: string): Lockfile;
13
13
  export declare function saveLockfile(lockfilePath: string, lockfile: Lockfile): void;
14
14
  export declare function getChangedFiles(files: string[], lockfilePath: string): string[];
15
15
  export declare function updateLockfile(files: string[], lockfilePath: string, rootDirectory: string): void;
16
- export declare function cleanupLockfile(lockfilePath: string, rootDirectory: string): void;
17
16
  //# sourceMappingURL=lockfile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lockfile.d.ts","sourceRoot":"/","sources":["utils/lockfile.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAoB3D;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAO3E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,EAAE,CA2BV;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,IAAI,CAkCN;AAED,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,IAAI,CAqBN"}
1
+ {"version":3,"file":"lockfile.d.ts","sourceRoot":"/","sources":["utils/lockfile.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAoB3D;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAO3E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,MAAM,GACnB,MAAM,EAAE,CA2BV;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,IAAI,CAiDN"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b91b67a0-0fbf-5a3b-9b53-378f29a5fc7b")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c0f5da92-0092-53a4-a8ad-d257765ab6f6")}catch(e){}}();
3
3
  import crypto from 'node:crypto';
4
4
  import fs from 'node:fs';
5
5
  import path from 'node:path';
@@ -73,6 +73,7 @@ export function updateLockfile(files, lockfilePath, rootDirectory) {
73
73
  for (const [hash, entry] of Object.entries(lockfile.checksums)) {
74
74
  pathToHashMap.set(entry.path, hash);
75
75
  }
76
+ // Update lockfile with new files
76
77
  for (const filePath of files) {
77
78
  const relativePath = path.relative(rootDirectory, filePath);
78
79
  const currentHash = calculateFileHash(filePath);
@@ -91,12 +92,7 @@ export function updateLockfile(files, lockfilePath, rootDirectory) {
91
92
  // Update the path-to-hash mapping
92
93
  pathToHashMap.set(relativePath, currentHash);
93
94
  }
94
- saveLockfile(lockfilePath, lockfile);
95
- logger.debugMessage(`Updated lockfile with ${files.length} files`);
96
- }
97
- export function cleanupLockfile(lockfilePath, rootDirectory) {
98
- const lockfile = loadLockfile(lockfilePath);
99
- // Remove entries for files that no longer exist
95
+ // Cleanup stale entries for files that no longer exist
100
96
  let removedCount = 0;
101
97
  for (const hash in lockfile.checksums) {
102
98
  const entry = lockfile.checksums[hash];
@@ -106,10 +102,8 @@ export function cleanupLockfile(lockfilePath, rootDirectory) {
106
102
  removedCount++;
107
103
  }
108
104
  }
109
- if (removedCount > 0) {
110
- saveLockfile(lockfilePath, lockfile);
111
- logger.debugMessage(`Cleaned up ${removedCount} stale entries from lockfile`);
112
- }
105
+ saveLockfile(lockfilePath, lockfile);
106
+ logger.debugMessage(`Updated lockfile with ${files.length} files${removedCount > 0 ? ` and cleaned up ${removedCount} stale entries` : ''}`);
113
107
  }
114
108
  //# sourceMappingURL=lockfile.js.map
115
- //# debugId=b91b67a0-0fbf-5a3b-9b53-378f29a5fc7b
109
+ //# debugId=c0f5da92-0092-53a4-a8ad-d257765ab6f6
@@ -1 +1 @@
1
- {"version":3,"file":"lockfile.js","sources":["utils/lockfile.ts"],"sourceRoot":"/","sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { logger } from '../logging/logger.js';\n\nexport const LOCKFILE_VERSION = '1.0.0';\nexport const LOCKFILE_NAME = 'locadex-lock.json';\n\nexport interface LockfileEntry {\n path: string;\n}\n\nexport interface Lockfile {\n checksums: Record<string, LockfileEntry>; // checksum -> entry mapping\n version: string;\n updatedAt: string;\n}\n\nexport function calculateFileHash(filePath: string): string {\n try {\n const content = fs.readFileSync(filePath, 'utf8');\n return crypto.createHash('md5').update(content).digest('hex');\n } catch (error) {\n logger.debugMessage(`Failed to calculate hash for ${filePath}: ${error}`);\n return '';\n }\n}\n\nexport function loadLockfile(lockfilePath: string): Lockfile {\n try {\n if (!fs.existsSync(lockfilePath)) {\n return {\n checksums: {},\n version: '1.0.0',\n updatedAt: new Date().toISOString(),\n };\n }\n\n const content = fs.readFileSync(lockfilePath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n logger.debugMessage(`Failed to load lockfile ${lockfilePath}: ${error}`);\n return {\n checksums: {},\n version: '1.0.0',\n updatedAt: new Date().toISOString(),\n };\n }\n}\n\nexport function saveLockfile(lockfilePath: string, lockfile: Lockfile): void {\n try {\n lockfile.updatedAt = new Date().toISOString();\n fs.writeFileSync(lockfilePath, JSON.stringify(lockfile, null, 2));\n } catch (error) {\n logger.debugMessage(`Failed to save lockfile ${lockfilePath}: ${error}`);\n }\n}\n\nexport function getChangedFiles(\n files: string[],\n lockfilePath: string\n): string[] {\n const lockfile = loadLockfile(lockfilePath);\n const changedFiles: string[] = [];\n\n for (const filePath of files) {\n const currentHash = calculateFileHash(filePath);\n\n if (!currentHash) {\n // Skip files that can't be hashed (likely don't exist or can't be read)\n continue;\n }\n\n // Check if this content hash exists in the lockfile\n const lockfileEntry = lockfile.checksums[currentHash];\n\n if (!lockfileEntry) {\n // Content hash not found, this is new or changed content\n changedFiles.push(filePath);\n }\n // If hash exists, content hasn't changed regardless of file path\n }\n\n logger.debugMessage(\n `Found ${changedFiles.length} changed files out of ${files.length} total files`\n );\n\n return changedFiles;\n}\n\nexport function updateLockfile(\n files: string[],\n lockfilePath: string,\n rootDirectory: string\n): void {\n const lockfile = loadLockfile(lockfilePath);\n\n // Build a map of paths to hashes for efficient lookup\n const pathToHashMap = new Map<string, string>();\n for (const [hash, entry] of Object.entries(lockfile.checksums)) {\n pathToHashMap.set(entry.path, hash);\n }\n\n for (const filePath of files) {\n const relativePath = path.relative(rootDirectory, filePath);\n const currentHash = calculateFileHash(filePath);\n\n if (!currentHash) {\n continue;\n }\n\n // Remove old hash entry for this file path (O(1) lookup and deletion)\n const oldHash = pathToHashMap.get(relativePath);\n if (oldHash) {\n delete lockfile.checksums[oldHash];\n }\n\n // Use hash as key, store current path and metadata\n lockfile.checksums[currentHash] = {\n path: relativePath,\n };\n\n // Update the path-to-hash mapping\n pathToHashMap.set(relativePath, currentHash);\n }\n\n saveLockfile(lockfilePath, lockfile);\n logger.debugMessage(`Updated lockfile with ${files.length} files`);\n}\n\nexport function cleanupLockfile(\n lockfilePath: string,\n rootDirectory: string\n): void {\n const lockfile = loadLockfile(lockfilePath);\n\n // Remove entries for files that no longer exist\n let removedCount = 0;\n for (const hash in lockfile.checksums) {\n const entry = lockfile.checksums[hash];\n const absolutePath = path.resolve(rootDirectory, entry.path);\n\n if (!fs.existsSync(absolutePath)) {\n delete lockfile.checksums[hash];\n removedCount++;\n }\n }\n\n if (removedCount > 0) {\n saveLockfile(lockfilePath, lockfile);\n logger.debugMessage(\n `Cleaned up ${removedCount} stale entries from lockfile`\n );\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAYjD,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAClD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,C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id":"b91b67a0-0fbf-5a3b-9b53-378f29a5fc7b"}
1
+ {"version":3,"file":"lockfile.js","sources":["utils/lockfile.ts"],"sourceRoot":"/","sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { logger } from '../logging/logger.js';\n\nexport const LOCKFILE_VERSION = '1.0.0';\nexport const LOCKFILE_NAME = 'locadex-lock.json';\n\nexport interface LockfileEntry {\n path: string;\n}\n\nexport interface Lockfile {\n checksums: Record<string, LockfileEntry>; // checksum -> entry mapping\n version: string;\n updatedAt: string;\n}\n\nexport function calculateFileHash(filePath: string): string {\n try {\n const content = fs.readFileSync(filePath, 'utf8');\n return crypto.createHash('md5').update(content).digest('hex');\n } catch (error) {\n logger.debugMessage(`Failed to calculate hash for ${filePath}: ${error}`);\n return '';\n }\n}\n\nexport function loadLockfile(lockfilePath: string): Lockfile {\n try {\n if (!fs.existsSync(lockfilePath)) {\n return {\n checksums: {},\n version: '1.0.0',\n updatedAt: new Date().toISOString(),\n };\n }\n\n const content = fs.readFileSync(lockfilePath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n logger.debugMessage(`Failed to load lockfile ${lockfilePath}: ${error}`);\n return {\n checksums: {},\n version: '1.0.0',\n updatedAt: new Date().toISOString(),\n };\n }\n}\n\nexport function saveLockfile(lockfilePath: string, lockfile: Lockfile): void {\n try {\n lockfile.updatedAt = new Date().toISOString();\n fs.writeFileSync(lockfilePath, JSON.stringify(lockfile, null, 2));\n } catch (error) {\n logger.debugMessage(`Failed to save lockfile ${lockfilePath}: ${error}`);\n }\n}\n\nexport function getChangedFiles(\n files: string[],\n lockfilePath: string\n): string[] {\n const lockfile = loadLockfile(lockfilePath);\n const changedFiles: string[] = [];\n\n for (const filePath of files) {\n const currentHash = calculateFileHash(filePath);\n\n if (!currentHash) {\n // Skip files that can't be hashed (likely don't exist or can't be read)\n continue;\n }\n\n // Check if this content hash exists in the lockfile\n const lockfileEntry = lockfile.checksums[currentHash];\n\n if (!lockfileEntry) {\n // Content hash not found, this is new or changed content\n changedFiles.push(filePath);\n }\n // If hash exists, content hasn't changed regardless of file path\n }\n\n logger.debugMessage(\n `Found ${changedFiles.length} changed files out of ${files.length} total files`\n );\n\n return changedFiles;\n}\n\nexport function updateLockfile(\n files: string[],\n lockfilePath: string,\n rootDirectory: string\n): void {\n const lockfile = loadLockfile(lockfilePath);\n\n // Build a map of paths to hashes for efficient lookup\n const pathToHashMap = new Map<string, string>();\n for (const [hash, entry] of Object.entries(lockfile.checksums)) {\n pathToHashMap.set(entry.path, hash);\n }\n\n // Update lockfile with new files\n for (const filePath of files) {\n const relativePath = path.relative(rootDirectory, filePath);\n const currentHash = calculateFileHash(filePath);\n\n if (!currentHash) {\n continue;\n }\n\n // Remove old hash entry for this file path (O(1) lookup and deletion)\n const oldHash = pathToHashMap.get(relativePath);\n if (oldHash) {\n delete lockfile.checksums[oldHash];\n }\n\n // Use hash as key, store current path and metadata\n lockfile.checksums[currentHash] = {\n path: relativePath,\n };\n\n // Update the path-to-hash mapping\n pathToHashMap.set(relativePath, currentHash);\n }\n\n // Cleanup stale entries for files that no longer exist\n let removedCount = 0;\n for (const hash in lockfile.checksums) {\n const entry = lockfile.checksums[hash];\n const absolutePath = path.resolve(rootDirectory, entry.path);\n\n if (!fs.existsSync(absolutePath)) {\n delete lockfile.checksums[hash];\n removedCount++;\n }\n }\n\n saveLockfile(lockfilePath, lockfile);\n logger.debugMessage(\n `Updated lockfile with ${files.length} files${removedCount > 0 ? ` and cleaned up ${removedCount} stale entries` : ''}`\n );\n}\n"],"names":[],"mappings":";;AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,m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K,CAAC,MAAM,SAAS,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,YAAY,gBAAgB,CAAC,CAAC,CAAC,EAAE,EAAE,CACxH,CAAC;AACJ,CAAC","debug_id":"c0f5da92-0092-53a4-a8ad-d257765ab6f6"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locadex",
3
- "version": "0.1.13-alpha.2",
3
+ "version": "0.1.14-alpha.1",
4
4
  "description": "An AI agent for internationalization",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  "dependency-tree": "^11.1.1",
25
25
  "dotenv": "^16.4.5",
26
26
  "express": "^5.1.0",
27
- "gtx-cli": "^1.2.30-alpha.1",
27
+ "gtx-cli": "^1.2.30",
28
28
  "micromatch": "^4.0.8",
29
29
  "posthog-node": "^4.18.0"
30
30
  },