locadex 0.0.2-alpha.7 → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +7 -76
- package/dist/cli.js.map +1 -1
- package/dist/commands/i18n.d.ts +3 -1
- package/dist/commands/i18n.d.ts.map +1 -1
- package/dist/commands/i18n.js +40 -4
- package/dist/commands/i18n.js.map +1 -1
- package/dist/commands/setup.d.ts +6 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +40 -4
- package/dist/commands/setup.js.map +1 -1
- package/dist/logging/console.d.ts +1 -1
- package/dist/logging/console.d.ts.map +1 -1
- package/dist/logging/console.js +6 -7
- package/dist/logging/console.js.map +1 -1
- package/dist/tasks/i18n.d.ts.map +1 -1
- package/dist/tasks/i18n.js +23 -4
- package/dist/tasks/i18n.js.map +1 -1
- package/dist/tasks/setup.d.ts.map +1 -1
- package/dist/tasks/setup.js +6 -16
- package/dist/tasks/setup.js.map +1 -1
- package/dist/utils/config.js +3 -3
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/dag/getFiles.d.ts.map +1 -0
- package/dist/utils/{getFiles.js → dag/getFiles.js} +3 -3
- package/dist/utils/dag/getFiles.js.map +1 -0
- package/dist/utils/locadexManager.d.ts +2 -0
- package/dist/utils/locadexManager.d.ts.map +1 -1
- package/dist/utils/locadexManager.js +8 -2
- package/dist/utils/locadexManager.js.map +1 -1
- package/dist/utils/lockfile.d.ts +18 -0
- package/dist/utils/lockfile.d.ts.map +1 -0
- package/dist/utils/lockfile.js +111 -0
- package/dist/utils/lockfile.js.map +1 -0
- package/dist/utils/packages/installPackage.d.ts +2 -0
- package/dist/utils/packages/installPackage.d.ts.map +1 -0
- package/dist/utils/packages/installPackage.js +22 -0
- package/dist/utils/packages/installPackage.js.map +1 -0
- package/package.json +3 -3
- package/dist/utils/getFiles.d.ts.map +0 -1
- package/dist/utils/getFiles.js.map +0 -1
- /package/dist/utils/{getFiles.d.ts → dag/getFiles.d.ts} +0 -0
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]="
|
|
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]="8a32894c-2fdc-5cbf-b3ca-9766816204df")}catch(e){}}();
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
5
|
dotenv.config({ path: '.env' });
|
|
6
6
|
dotenv.config({ path: '.env.local', override: true });
|
|
@@ -10,13 +10,8 @@ import { Command } from 'commander';
|
|
|
10
10
|
import { readFileSync } from 'node:fs';
|
|
11
11
|
import { fromPackageRoot } from './utils/getPaths.js';
|
|
12
12
|
import { setupCommand } from './commands/setup.js';
|
|
13
|
-
import { withTelemetry } from './telemetry.js';
|
|
14
13
|
import { i18nCommand } from './commands/i18n.js';
|
|
15
|
-
import { displayHeader } from './logging/console.js';
|
|
16
14
|
import { main } from 'gtx-cli/index';
|
|
17
|
-
import { LocadexManager } from './utils/locadexManager.js';
|
|
18
|
-
import { logger } from './logging/logger.js';
|
|
19
|
-
import { exit } from './utils/shutdown.js';
|
|
20
15
|
const packageJson = JSON.parse(readFileSync(fromPackageRoot('package.json'), 'utf8'));
|
|
21
16
|
const program = new Command();
|
|
22
17
|
program
|
|
@@ -30,44 +25,12 @@ program
|
|
|
30
25
|
.option('-d, --debug', 'Debug output')
|
|
31
26
|
.option('-b, --batch-size <number>', 'File batch size', '10')
|
|
32
27
|
.option('-c, --concurrency <number>', 'Max number of concurrent agents', '1')
|
|
33
|
-
.option('-f, --files <pattern>', 'Comma-separated list of glob patterns to match source files')
|
|
28
|
+
.option('-f, --match-files <pattern>', 'Comma-separated list of glob patterns to match source files')
|
|
34
29
|
.option('-e, --extensions <extensions>', 'Comma-separated list of file extensions to match')
|
|
35
30
|
.option('--package-manager <manager>', 'Package manager to use. (npm, pnpm, yarn_v1, yarn_v2, bun, deno)')
|
|
36
31
|
.option('-y, --bypass-prompts', 'Bypass interactive prompts')
|
|
37
32
|
.option('--no-telemetry', 'Disable telemetry')
|
|
38
|
-
.action(
|
|
39
|
-
const parentOptions = command.parent?.opts() || {};
|
|
40
|
-
const allOptions = { ...parentOptions, ...options };
|
|
41
|
-
withTelemetry({ enabled: !allOptions.noTelemetry, options: allOptions }, async () => {
|
|
42
|
-
const batchSize = Number(allOptions.batchSize) || 1;
|
|
43
|
-
const concurrency = Number(allOptions.concurrency) || 1;
|
|
44
|
-
if (concurrency < 1 || batchSize < 1) {
|
|
45
|
-
logger.error('Batch size and concurrency must be greater than 0');
|
|
46
|
-
await exit(1);
|
|
47
|
-
}
|
|
48
|
-
displayHeader();
|
|
49
|
-
LocadexManager.initialize({
|
|
50
|
-
mcpTransport: 'sse',
|
|
51
|
-
metadata: {},
|
|
52
|
-
cliOptions: allOptions,
|
|
53
|
-
options: {
|
|
54
|
-
...(allOptions.matchingFiles && {
|
|
55
|
-
matchingFiles: allOptions.matchingFiles
|
|
56
|
-
.split(',')
|
|
57
|
-
.map((file) => file.trim()),
|
|
58
|
-
}),
|
|
59
|
-
...(allOptions.matchingExtensions && {
|
|
60
|
-
matchingExtensions: allOptions.matchingExtensions
|
|
61
|
-
.split(',')
|
|
62
|
-
.map((ext) => ext.trim()),
|
|
63
|
-
}),
|
|
64
|
-
maxConcurrency: concurrency,
|
|
65
|
-
batchSize,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
await setupCommand(!!allOptions.bypassPrompts, allOptions.packageManager);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
33
|
+
.action(setupCommand);
|
|
71
34
|
program
|
|
72
35
|
.command('i18n')
|
|
73
36
|
.description('Run Locadex i18n on your project')
|
|
@@ -75,43 +38,11 @@ program
|
|
|
75
38
|
.option('-d, --debug', 'Debug output')
|
|
76
39
|
.option('-b, --batch-size <number>', 'File batch size', '10')
|
|
77
40
|
.option('-c, --concurrency <number>', 'Max number of concurrent agents', '1')
|
|
78
|
-
.option('-
|
|
79
|
-
.option('-e, --
|
|
41
|
+
.option('-f, --match-files <pattern>', 'Comma-separated list of glob patterns to match source files')
|
|
42
|
+
.option('-e, --extensions <extensions>', 'Comma-separated list of file extensions to match')
|
|
80
43
|
.option('--no-telemetry', 'Disable telemetry')
|
|
81
|
-
.action(
|
|
82
|
-
const parentOptions = command.parent?.opts() || {};
|
|
83
|
-
const allOptions = { ...parentOptions, ...options };
|
|
84
|
-
withTelemetry({ enabled: !allOptions.noTelemetry, options: allOptions }, async () => {
|
|
85
|
-
const batchSize = Number(allOptions.batchSize) || 1;
|
|
86
|
-
const concurrency = Number(allOptions.concurrency) || 1;
|
|
87
|
-
if (concurrency < 1 || batchSize < 1) {
|
|
88
|
-
logger.error('Batch size and concurrency must be greater than 0');
|
|
89
|
-
await exit(1);
|
|
90
|
-
}
|
|
91
|
-
displayHeader();
|
|
92
|
-
LocadexManager.initialize({
|
|
93
|
-
mcpTransport: 'sse',
|
|
94
|
-
metadata: {},
|
|
95
|
-
cliOptions: allOptions,
|
|
96
|
-
options: {
|
|
97
|
-
...(allOptions.matchingFiles && {
|
|
98
|
-
matchingFiles: allOptions.matchingFiles
|
|
99
|
-
.split(',')
|
|
100
|
-
.map((file) => file.trim()),
|
|
101
|
-
}),
|
|
102
|
-
...(allOptions.matchingExtensions && {
|
|
103
|
-
matchingExtensions: allOptions.matchingExtensions
|
|
104
|
-
.split(',')
|
|
105
|
-
.map((ext) => ext.trim()),
|
|
106
|
-
}),
|
|
107
|
-
maxConcurrency: concurrency,
|
|
108
|
-
batchSize,
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
await i18nCommand();
|
|
112
|
-
});
|
|
113
|
-
});
|
|
44
|
+
.action(i18nCommand);
|
|
114
45
|
main(program);
|
|
115
46
|
program.parse();
|
|
116
47
|
//# sourceMappingURL=cli.js.map
|
|
117
|
-
//# debugId=
|
|
48
|
+
//# debugId=8a32894c-2fdc-5cbf-b3ca-9766816204df
|
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 { Command } from 'commander';\nimport { readFileSync } from 'node:fs';\nimport { fromPackageRoot } from './utils/getPaths.js';\nimport { setupCommand } from './commands/setup.js';\nimport {
|
|
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 { Command } from 'commander';\nimport { readFileSync } from 'node:fs';\nimport { fromPackageRoot } from './utils/getPaths.js';\nimport { 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', '10')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents', '1')\n .option(\n '-f, --match-files <pattern>',\n 'Comma-separated list of glob patterns to match source files'\n )\n .option(\n '-e, --extensions <extensions>',\n 'Comma-separated list of file extensions to match'\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 .action(setupCommand);\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', '10')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents', '1')\n .option(\n '-f, --match-files <pattern>',\n 'Comma-separated list of glob patterns to match source files'\n )\n .option(\n '-e, --extensions <extensions>',\n 'Comma-separated list of file extensions to match'\n )\n .option('--no-telemetry', 'Disable telemetry')\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,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAE3D,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,MAAM,WAAW,G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AmB,CAAC;KAC7C,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,IAAI,CAAC,OAAO,CAAC,CAAC;AAEd,OAAO,CAAC,KAAK,EAAE,CAAC","debug_id":"8a32894c-2fdc-5cbf-b3ca-9766816204df"}
|
package/dist/commands/i18n.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["commands/i18n.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["commands/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAM7C,wBAAsB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,iBAsCtE"}
|
package/dist/commands/i18n.js
CHANGED
|
@@ -1,8 +1,44 @@
|
|
|
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]="
|
|
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]="0c9ca03e-3524-51f9-829a-4fa2f955f3d7")}catch(e){}}();
|
|
3
|
+
import { logger } from '../logging/logger.js';
|
|
3
4
|
import { i18nTask } from '../tasks/i18n.js';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import { withTelemetry } from '../telemetry.js';
|
|
6
|
+
import { LocadexManager } from '../utils/locadexManager.js';
|
|
7
|
+
import { displayHeader } from '../logging/console.js';
|
|
8
|
+
import { exit } from '../utils/shutdown.js';
|
|
9
|
+
export async function i18nCommand(options, command) {
|
|
10
|
+
const parentOptions = command.parent?.opts() || {};
|
|
11
|
+
const allOptions = { ...parentOptions, ...options };
|
|
12
|
+
const telemetryEnabled = !allOptions.noTelemetry;
|
|
13
|
+
withTelemetry({ enabled: telemetryEnabled, options: allOptions }, async () => {
|
|
14
|
+
const batchSize = Number(allOptions.batchSize) || 1;
|
|
15
|
+
const concurrency = Number(allOptions.concurrency) || 1;
|
|
16
|
+
if (concurrency < 1 || batchSize < 1) {
|
|
17
|
+
logger.error('Batch size and concurrency must be greater than 0');
|
|
18
|
+
await exit(1);
|
|
19
|
+
}
|
|
20
|
+
displayHeader(telemetryEnabled);
|
|
21
|
+
LocadexManager.initialize({
|
|
22
|
+
mcpTransport: 'sse',
|
|
23
|
+
metadata: {},
|
|
24
|
+
cliOptions: allOptions,
|
|
25
|
+
options: {
|
|
26
|
+
...(allOptions.matchingFiles && {
|
|
27
|
+
matchingFiles: allOptions.matchingFiles
|
|
28
|
+
.split(',')
|
|
29
|
+
.map((file) => file.trim()),
|
|
30
|
+
}),
|
|
31
|
+
...(allOptions.matchingExtensions && {
|
|
32
|
+
matchingExtensions: allOptions.matchingExtensions
|
|
33
|
+
.split(',')
|
|
34
|
+
.map((ext) => ext.trim()),
|
|
35
|
+
}),
|
|
36
|
+
maxConcurrency: concurrency,
|
|
37
|
+
batchSize,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
await i18nTask();
|
|
41
|
+
});
|
|
6
42
|
}
|
|
7
43
|
//# sourceMappingURL=i18n.js.map
|
|
8
|
-
//# debugId=
|
|
44
|
+
//# debugId=0c9ca03e-3524-51f9-829a-4fa2f955f3d7
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sources":["commands/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { i18nTask } from '../tasks/i18n.js';\n\nexport async function i18nCommand() {\n await i18nTask();\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"i18n.js","sources":["commands/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { Command } from 'commander';\nimport { logger } from '../logging/logger.js';\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 { exit } from '../utils/shutdown.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 const batchSize = Number(allOptions.batchSize) || 1;\n const concurrency = Number(allOptions.concurrency) || 1;\n\n if (concurrency < 1 || batchSize < 1) {\n logger.error('Batch size and concurrency must be greater than 0');\n await exit(1);\n }\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n mcpTransport: 'sse',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles\n .split(',')\n .map((file) => file.trim()),\n }),\n ...(allOptions.matchingExtensions && {\n matchingExtensions: allOptions.matchingExtensions\n .split(',')\n .map((ext) => ext.trim()),\n }),\n maxConcurrency: concurrency,\n batchSize,\n },\n });\n await i18nTask();\n }\n );\n}\n"],"names":[],"mappings":";;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,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,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAmB,EAAE,OAAg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gBAC3B,SAAS;aACV;SACF,CAAC,CAAC;QACH,MAAM,QAAQ,EAAE,CAAC;IACnB,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"0c9ca03e-3524-51f9-829a-4fa2f955f3d7"}
|
package/dist/commands/setup.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { CliOptions } from '../types/cli.js';
|
|
3
|
+
export declare function setupCommand(options: CliOptions & {
|
|
4
|
+
packageManager?: string;
|
|
5
|
+
bypassPrompts?: boolean;
|
|
6
|
+
}, command: Command): Promise<void>;
|
|
2
7
|
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"/","sources":["commands/setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"/","sources":["commands/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAM7C,wBAAsB,YAAY,CAChC,OAAO,EAAE,UAAU,GAAG;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,EACD,OAAO,EAAE,OAAO,iBAuCjB"}
|
package/dist/commands/setup.js
CHANGED
|
@@ -1,8 +1,44 @@
|
|
|
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]="
|
|
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]="f55fa730-9352-5e2c-8913-7a3a42ef5cb8")}catch(e){}}();
|
|
3
|
+
import { logger } from '../logging/logger.js';
|
|
3
4
|
import { setupTask } from '../tasks/setup.js';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import { withTelemetry } from '../telemetry.js';
|
|
6
|
+
import { LocadexManager } from '../utils/locadexManager.js';
|
|
7
|
+
import { displayHeader } from '../logging/console.js';
|
|
8
|
+
import { exit } from '../utils/shutdown.js';
|
|
9
|
+
export async function setupCommand(options, command) {
|
|
10
|
+
const parentOptions = command.parent?.opts() || {};
|
|
11
|
+
const allOptions = { ...parentOptions, ...options };
|
|
12
|
+
const telemetryEnabled = !allOptions.noTelemetry;
|
|
13
|
+
withTelemetry({ enabled: telemetryEnabled, options: allOptions }, async () => {
|
|
14
|
+
const batchSize = Number(allOptions.batchSize) || 1;
|
|
15
|
+
const concurrency = Number(allOptions.concurrency) || 1;
|
|
16
|
+
if (concurrency < 1 || batchSize < 1) {
|
|
17
|
+
logger.error('Batch size and concurrency must be greater than 0');
|
|
18
|
+
await exit(1);
|
|
19
|
+
}
|
|
20
|
+
displayHeader(telemetryEnabled);
|
|
21
|
+
LocadexManager.initialize({
|
|
22
|
+
mcpTransport: 'sse',
|
|
23
|
+
metadata: {},
|
|
24
|
+
cliOptions: allOptions,
|
|
25
|
+
options: {
|
|
26
|
+
...(allOptions.matchingFiles && {
|
|
27
|
+
matchingFiles: allOptions.matchingFiles
|
|
28
|
+
.split(',')
|
|
29
|
+
.map((file) => file.trim()),
|
|
30
|
+
}),
|
|
31
|
+
...(allOptions.matchingExtensions && {
|
|
32
|
+
matchingExtensions: allOptions.matchingExtensions
|
|
33
|
+
.split(',')
|
|
34
|
+
.map((ext) => ext.trim()),
|
|
35
|
+
}),
|
|
36
|
+
maxConcurrency: concurrency,
|
|
37
|
+
batchSize,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
await setupTask(!!allOptions.bypassPrompts, allOptions.packageManager);
|
|
41
|
+
});
|
|
6
42
|
}
|
|
7
43
|
//# sourceMappingURL=setup.js.map
|
|
8
|
-
//# debugId=
|
|
44
|
+
//# debugId=f55fa730-9352-5e2c-8913-7a3a42ef5cb8
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sources":["commands/setup.ts"],"sourceRoot":"/","sourcesContent":["import { setupTask } from '../tasks/setup.js';\n\nexport async function setupCommand(\n
|
|
1
|
+
{"version":3,"file":"setup.js","sources":["commands/setup.ts"],"sourceRoot":"/","sourcesContent":["import { Command } from 'commander';\nimport { logger } from '../logging/logger.js';\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 { exit } from '../utils/shutdown.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 const batchSize = Number(allOptions.batchSize) || 1;\n const concurrency = Number(allOptions.concurrency) || 1;\n\n if (concurrency < 1 || batchSize < 1) {\n logger.error('Batch size and concurrency must be greater than 0');\n await exit(1);\n }\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n mcpTransport: 'sse',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles\n .split(',')\n .map((file) => file.trim()),\n }),\n ...(allOptions.matchingExtensions && {\n matchingExtensions: allOptions.matchingExtensions\n .split(',')\n .map((ext) => ext.trim()),\n }),\n maxConcurrency: concurrency,\n batchSize,\n },\n });\n await setupTask(!!allOptions.bypassPrompts, allOptions.packageManager);\n }\n );\n}\n"],"names":[],"mappings":";;AACA,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;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,kBAAkB,IAAI;oBACnC,kBAAkB,EAAE,UAAU,CAAC,kBAAkB;yBAC9C,KAAK,CAAC,GAAG,CAAC;yBACV,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;iBAC5B,CAAC;gBACF,cAAc,EAAE,WAAW;gBAC3B,SAAS;aACV;SACF,CAAC,CAAC;QACH,MAAM,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;IACzE,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"f55fa730-9352-5e2c-8913-7a3a42ef5cb8"}
|
|
@@ -7,7 +7,7 @@ export declare function logMessage(message: string): void;
|
|
|
7
7
|
export declare function logErrorAndExit(message: string): Promise<void>;
|
|
8
8
|
export declare function startCommand(message: string): void;
|
|
9
9
|
export declare function endCommand(message: string): void;
|
|
10
|
-
export declare function displayHeader(): void;
|
|
10
|
+
export declare function displayHeader(telemetryEnabled: boolean): void;
|
|
11
11
|
export declare function createSpinner(indicator?: 'dots' | 'timer'): import("@clack/prompts").SpinnerResult;
|
|
12
12
|
export declare function createProgressBar(total: number): import("@clack/prompts").ProgressResult;
|
|
13
13
|
export declare function promptText({ message, defaultValue, validate, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.d.ts","sourceRoot":"/","sources":["logging/console.ts"],"names":[],"mappings":"AAmBA,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,QAEtC;AACD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,QAEzC;AACD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,QAEvC;AACD,wBAAgB,UAAU,CAAC,OAAO,EA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A;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,EACpC,OAAO,EACP,OAAO,EACP,YAAY,GACb,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,YAAY,CAAC,EAAE,CAAC,CAAC;CAClB,cAoBA;AAED,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,EACxD,OAAO,EACP,OAAO,EACP,QAAe,GAChB,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,gBAoBA;AAED,wBAAsB,aAAa,CAAC,EAClC,OAAO,EACP,YAAmB,EACnB,aAAqC,GACtC,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,6BAYA;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM;;;;EAE/C"}
|
package/dist/logging/console.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]="
|
|
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]="d7da7fb4-17ed-537e-bce1-3114e4d9feb3")}catch(e){}}();
|
|
3
3
|
import { log, spinner, intro, outro, text, select, confirm, isCancel, cancel, multiselect, taskLog, progress, } from '@clack/prompts';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { getLocadexVersion } from '../utils/getPaths.js';
|
|
@@ -35,9 +35,9 @@ export function endCommand(message) {
|
|
|
35
35
|
outro(chalk.cyan(message));
|
|
36
36
|
}
|
|
37
37
|
// GT specific logging
|
|
38
|
-
export function displayHeader() {
|
|
38
|
+
export function displayHeader(telemetryEnabled) {
|
|
39
39
|
displayAsciiTitle();
|
|
40
|
-
displayInitializingText();
|
|
40
|
+
displayInitializingText(telemetryEnabled);
|
|
41
41
|
startCommand(chalk.cyan(`Locadex v${getLocadexVersion()}`));
|
|
42
42
|
}
|
|
43
43
|
function displayAsciiTitle() {
|
|
@@ -51,12 +51,11 @@ Y8, 88 88
|
|
|
51
51
|
Y8a. .a88 88
|
|
52
52
|
\`"Y88888P" 88 `));
|
|
53
53
|
}
|
|
54
|
-
function displayInitializingText() {
|
|
54
|
+
function displayInitializingText(telemetryEnabled) {
|
|
55
55
|
// eslint-disable-next-line no-console
|
|
56
56
|
console.log(`\n${chalk.bold.blue('General Translation, Inc.')}
|
|
57
57
|
${chalk.dim('https://generaltranslation.com/docs')}
|
|
58
|
-
|
|
59
|
-
${chalk.dim('Locadex uses Sentry and PostHog to collect anonymous telemetry data. You can opt out by running with the --no-telemetry flag.')}
|
|
58
|
+
${telemetryEnabled ? chalk.dim('\nLocadex uses Sentry and PostHog to collect anonymous telemetry data. You can opt out by running with the --no-telemetry flag.') : ''}
|
|
60
59
|
`);
|
|
61
60
|
}
|
|
62
61
|
// Spinner functionality
|
|
@@ -135,4 +134,4 @@ export function createTaskLogger(message) {
|
|
|
135
134
|
return taskLog({ title: message });
|
|
136
135
|
}
|
|
137
136
|
//# sourceMappingURL=console.js.map
|
|
138
|
-
//# debugId=
|
|
137
|
+
//# debugId=d7da7fb4-17ed-537e-bce1-3114e4d9feb3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.js","sources":["logging/console.ts"],"sourceRoot":"/","sourcesContent":["import {\n log,\n spinner,\n intro,\n outro,\n text,\n select,\n confirm,\n isCancel,\n cancel,\n multiselect,\n taskLog,\n progress,\n} from '@clack/prompts';\nimport chalk from 'chalk';\nimport { getLocadexVersion } from '../utils/getPaths.js';\nimport { exit } from '../utils/shutdown.js';\n\n// Basic logging functions\nexport function logInfo(message: string) {\n log.info(message);\n}\nexport function logWarning(message: string) {\n log.warn(message);\n}\nexport function logError(message: string) {\n log.error(message);\n}\nexport function logSuccess(message: string) {\n log.success(message);\n}\nexport function logStep(message: string) {\n log.step(message);\n}\nexport function logMessage(message: string) {\n log.message(message, { symbol: chalk.cyan('~') });\n}\n\nexport async function logErrorAndExit(message: string) {\n log.error(message);\n await exit(1);\n}\n\n// Clack prompts\nexport function startCommand(message: string) {\n intro(chalk.cyan(message));\n}\nexport function endCommand(message: string) {\n outro(chalk.cyan(message));\n}\n\n// GT specific logging\nexport function displayHeader() {\n displayAsciiTitle();\n displayInitializingText();\n startCommand(chalk.cyan(`Locadex v${getLocadexVersion()}`));\n}\n\nfunction displayAsciiTitle() {\n // eslint-disable-next-line no-console\n console.log(\n chalk.cyan(\n `\\n ,ad8888ba, 888888888888 \n d8\"' \\`\"8b 88 \nd8' 88 \n88 88 \n88 88888 88 \nY8, 88 88 \n Y8a. .a88 88 \n \\`\"Y88888P\" 88 `\n )\n );\n}\n\nfunction displayInitializingText() {\n // eslint-disable-next-line no-console\n console.log(\n `\\n${chalk.bold.blue('General Translation, Inc.')}\n${chalk.dim('https://generaltranslation.com/docs')}\n
|
|
1
|
+
{"version":3,"file":"console.js","sources":["logging/console.ts"],"sourceRoot":"/","sourcesContent":["import {\n log,\n spinner,\n intro,\n outro,\n text,\n select,\n confirm,\n isCancel,\n cancel,\n multiselect,\n taskLog,\n progress,\n} from '@clack/prompts';\nimport chalk from 'chalk';\nimport { getLocadexVersion } from '../utils/getPaths.js';\nimport { exit } from '../utils/shutdown.js';\n\n// Basic logging functions\nexport function logInfo(message: string) {\n log.info(message);\n}\nexport function logWarning(message: string) {\n log.warn(message);\n}\nexport function logError(message: string) {\n log.error(message);\n}\nexport function logSuccess(message: string) {\n log.success(message);\n}\nexport function logStep(message: string) {\n log.step(message);\n}\nexport function logMessage(message: string) {\n log.message(message, { symbol: chalk.cyan('~') });\n}\n\nexport async function logErrorAndExit(message: string) {\n log.error(message);\n await exit(1);\n}\n\n// Clack prompts\nexport function startCommand(message: string) {\n intro(chalk.cyan(message));\n}\nexport function endCommand(message: string) {\n outro(chalk.cyan(message));\n}\n\n// GT specific logging\nexport function displayHeader(telemetryEnabled: boolean) {\n displayAsciiTitle();\n displayInitializingText(telemetryEnabled);\n startCommand(chalk.cyan(`Locadex v${getLocadexVersion()}`));\n}\n\nfunction displayAsciiTitle() {\n // eslint-disable-next-line no-console\n console.log(\n chalk.cyan(\n `\\n ,ad8888ba, 888888888888 \n d8\"' \\`\"8b 88 \nd8' 88 \n88 88 \n88 88888 88 \nY8, 88 88 \n Y8a. .a88 88 \n \\`\"Y88888P\" 88 `\n )\n );\n}\n\nfunction displayInitializingText(telemetryEnabled: boolean) {\n // eslint-disable-next-line no-console\n console.log(\n `\\n${chalk.bold.blue('General Translation, Inc.')}\n${chalk.dim('https://generaltranslation.com/docs')}\n${telemetryEnabled ? chalk.dim('\\nLocadex uses Sentry and PostHog to collect anonymous telemetry data. You can opt out by running with the --no-telemetry flag.') : ''}\n`\n );\n}\n\n// Spinner functionality\nexport function createSpinner(indicator: 'dots' | 'timer' = 'timer') {\n return spinner({ indicator });\n}\n\nexport function createProgressBar(total: number) {\n return progress({ max: total });\n}\n\n// Input prompts\nexport async function promptText({\n message,\n defaultValue,\n validate,\n}: {\n message: string;\n defaultValue?: string;\n validate?: (value: string) => boolean | string;\n}) {\n const result = await text({\n message,\n placeholder: defaultValue,\n validate: validate\n ? (value) => {\n const validation = validate(value || '');\n return validation === true ? undefined : validation.toString();\n }\n : undefined,\n });\n\n if (isCancel(result)) {\n cancel('Operation cancelled');\n await exit(0);\n }\n\n return result;\n}\n\nexport async function promptSelect<T>({\n message,\n options,\n defaultValue,\n}: {\n message: string;\n options: Array<{ value: T; label: string; hint?: string }>;\n defaultValue?: T;\n}) {\n // Convert options to the format expected by clack\n const clackOptions = options.map((opt) => ({\n value: opt.value,\n label: opt.label,\n hint: opt.hint,\n }));\n\n const result = await select({\n message,\n options: clackOptions as any,\n initialValue: defaultValue,\n });\n\n if (isCancel(result)) {\n cancel('Operation cancelled');\n await exit(0);\n }\n\n return result as T;\n}\n\nexport async function promptMultiSelect<T extends string>({\n message,\n options,\n required = true,\n}: {\n message: string;\n options: Array<{ value: T; label: string; hint?: string }>;\n required?: boolean;\n}) {\n // Convert options to the format expected by clack\n const clackOptions = options.map((opt) => ({\n value: opt.value,\n label: opt.label,\n hint: opt.hint,\n }));\n\n const result = await multiselect({\n message,\n options: clackOptions as any,\n required,\n });\n\n if (isCancel(result)) {\n cancel('Operation cancelled');\n await exit(0);\n }\n\n return result as Array<T>;\n}\n\nexport async function promptConfirm({\n message,\n defaultValue = true,\n cancelMessage = 'Operation cancelled',\n}: {\n message: string;\n defaultValue?: boolean;\n cancelMessage?: string;\n}) {\n const result = await confirm({\n message,\n initialValue: defaultValue,\n });\n\n if (isCancel(result)) {\n cancel(cancelMessage);\n await exit(0);\n }\n\n return result;\n}\n\nexport function createTaskLogger(message: string) {\n return taskLog({ title: message });\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EACL,GAAG,EACH,OAAO,EACP,KAAK,EACL,KAAK,EACL,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,WAAW,EACX,OAAO,EACP,QAAQ,GACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,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5B,QAAQ;KACT,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC9B,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC;IAED,OAAO,MAAkB,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAClC,OAAO,EACP,YAAY,GAAG,IAAI,EACnB,aAAa,GAAG,qBAAqB,GAKtC;IACC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;QAC3B,OAAO;QACP,YAAY,EAAE,YAAY;KAC3B,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,aAAa,CAAC,CAAC;QACtB,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AACrC,CAAC","debug_id":"d7da7fb4-17ed-537e-bce1-3114e4d9feb3"}
|
package/dist/tasks/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["tasks/i18n.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["tasks/i18n.ts"],"names":[],"mappings":"AAgCA,wBAAsB,QAAQ,kBAoT7B"}
|
package/dist/tasks/i18n.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]="
|
|
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]="fcae1e88-fef0-5f8c-af05-ed774539bc74")}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';
|
|
@@ -7,7 +7,7 @@ import { logger } from '../logging/logger.js';
|
|
|
7
7
|
import { createDag } from '../utils/dag/createDag.js';
|
|
8
8
|
import { findTsConfig, findWebpackConfig, findRequireConfig, } from '../utils/fs/findConfigs.js';
|
|
9
9
|
import { LocadexManager } from '../utils/locadexManager.js';
|
|
10
|
-
import { addFilesToManager, markFileAsEdited, markFileAsInProgress, } from '../utils/getFiles.js';
|
|
10
|
+
import { addFilesToManager, markFileAsEdited, markFileAsInProgress, } from '../utils/dag/getFiles.js';
|
|
11
11
|
import { outro } from '@clack/prompts';
|
|
12
12
|
import chalk from 'chalk';
|
|
13
13
|
import { appendFileSync } from 'node:fs';
|
|
@@ -16,6 +16,8 @@ import { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';
|
|
|
16
16
|
import { generateSettings } from 'gtx-cli/config/generateSettings';
|
|
17
17
|
import path from 'node:path';
|
|
18
18
|
import { findSourceFiles } from '../utils/dag/matchFiles.js';
|
|
19
|
+
import { getChangedFiles, updateLockfile, cleanupLockfile, } from '../utils/lockfile.js';
|
|
20
|
+
import { installClaudeCode } from '../utils/packages/installPackage.js';
|
|
19
21
|
export async function i18nTask() {
|
|
20
22
|
await validateInitialConfig();
|
|
21
23
|
const gtSettings = await generateSettings({});
|
|
@@ -23,13 +25,25 @@ export async function i18nTask() {
|
|
|
23
25
|
logger.error('Currently, locadex only supports Next.js App Router. Please use Next.js App Router.');
|
|
24
26
|
await exit(1);
|
|
25
27
|
}
|
|
28
|
+
// Install claude-code if not installed
|
|
29
|
+
await installClaudeCode();
|
|
26
30
|
// Init message
|
|
27
31
|
const spinner = createSpinner();
|
|
28
32
|
spinner.start('Initializing Locadex...');
|
|
29
33
|
const manager = LocadexManager.getInstance();
|
|
30
34
|
const config = manager.getConfig();
|
|
31
35
|
const allFiles = findSourceFiles(config.matchingFiles, config.matchingExtensions);
|
|
32
|
-
|
|
36
|
+
// Get lockfile path from manager
|
|
37
|
+
const lockfilePath = manager.getLockFilePath();
|
|
38
|
+
// Filter files to only include those with changed content hashes
|
|
39
|
+
const changedFiles = getChangedFiles(allFiles, lockfilePath);
|
|
40
|
+
if (changedFiles.length === 0) {
|
|
41
|
+
spinner.stop('No files have changed since last run');
|
|
42
|
+
outro(chalk.green('✅ Locadex i18n complete - no changes detected!'));
|
|
43
|
+
await exit(0);
|
|
44
|
+
}
|
|
45
|
+
logger.verboseMessage(`Processing ${changedFiles.length} changed files out of ${allFiles.length} total files`);
|
|
46
|
+
const dag = createDag(changedFiles, {
|
|
33
47
|
tsConfig: findTsConfig(),
|
|
34
48
|
webpackConfig: findWebpackConfig(),
|
|
35
49
|
requireConfig: findRequireConfig(),
|
|
@@ -193,6 +207,11 @@ ${reports.join('\n')}`;
|
|
|
193
207
|
if (formatter) {
|
|
194
208
|
await formatFiles(topologicalOrder, formatter);
|
|
195
209
|
}
|
|
210
|
+
// Update lockfile with processed files
|
|
211
|
+
updateLockfile(changedFiles, lockfilePath);
|
|
212
|
+
// Clean up stale entries from lockfile
|
|
213
|
+
cleanupLockfile(allFiles, lockfilePath);
|
|
214
|
+
logger.message(`Updated lockfile with ${changedFiles.length} files`);
|
|
196
215
|
// Clean up after successful completion
|
|
197
216
|
manager.cleanup();
|
|
198
217
|
logger.info(chalk.dim(`Total Cost: $${manager.stats.getStats().totalCost.toFixed(2)}
|
|
@@ -314,4 +333,4 @@ ${allMcpPrompt}
|
|
|
314
333
|
return prompt;
|
|
315
334
|
}
|
|
316
335
|
//# sourceMappingURL=i18n.js.map
|
|
317
|
-
//# debugId=
|
|
336
|
+
//# debugId=fcae1e88-fef0-5f8c-af05-ed774539bc74
|