locadex 0.0.2-alpha.3 → 0.0.2-alpha.4
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 +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/i18n.d.ts +2 -1
- package/dist/commands/i18n.d.ts.map +1 -1
- package/dist/commands/i18n.js +101 -56
- package/dist/commands/i18n.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +64 -8
- package/dist/commands/setup.js.map +1 -1
- package/dist/logging/console.d.ts +1 -0
- package/dist/logging/console.d.ts.map +1 -1
- package/dist/logging/console.js +6 -3
- package/dist/logging/console.js.map +1 -1
- package/dist/logging/logger.d.ts +20 -0
- package/dist/logging/logger.d.ts.map +1 -1
- package/dist/logging/logger.js +75 -3
- package/dist/logging/logger.js.map +1 -1
- package/dist/mcp/tools/guides.d.ts.map +1 -1
- package/dist/mcp/tools/guides.js +10 -22
- package/dist/mcp/tools/guides.js.map +1 -1
- package/dist/mcp-sse.d.ts.map +1 -1
- package/dist/mcp-sse.js +29 -6
- package/dist/mcp-sse.js.map +1 -1
- package/dist/mcp.js +2 -4
- package/dist/mcp.js.map +1 -1
- package/dist/prompts/system.d.ts.map +1 -1
- package/dist/prompts/system.js +2 -8
- package/dist/prompts/system.js.map +1 -1
- package/dist/utils/agentManager.d.ts +18 -6
- package/dist/utils/agentManager.d.ts.map +1 -1
- package/dist/utils/agentManager.js +27 -14
- package/dist/utils/agentManager.js.map +1 -1
- package/dist/utils/claudeCode.d.ts +3 -3
- package/dist/utils/claudeCode.d.ts.map +1 -1
- package/dist/utils/claudeCode.js +29 -14
- package/dist/utils/claudeCode.js.map +1 -1
- package/dist/utils/dag/createDag.d.ts.map +1 -1
- package/dist/utils/dag/createDag.js +8 -2
- package/dist/utils/dag/createDag.js.map +1 -1
- package/dist/utils/shared.d.ts +2 -0
- package/dist/utils/shared.d.ts.map +1 -1
- package/dist/utils/shared.js +13 -2
- package/dist/utils/shared.js.map +1 -1
- package/dist/utils/stats.d.ts +25 -0
- package/dist/utils/stats.d.ts.map +1 -0
- package/dist/utils/stats.js +40 -0
- package/dist/utils/stats.js.map +1 -0
- package/guides/next/basic/branches.md +40 -12
- package/guides/next/basic/client-side-components.md +30 -23
- package/guides/next/basic/jsx.md +11 -2
- package/guides/next/basic/server-side-components.md +16 -15
- package/guides/next/basic/strings.md +144 -0
- package/guides/next/basic/variables.md +10 -34
- package/package.json +5 -4
- package/dist/logging/constructInfo.d.ts +0 -3
- package/dist/logging/constructInfo.d.ts.map +0 -1
- package/dist/logging/constructInfo.js +0 -15
- package/dist/logging/constructInfo.js.map +0 -1
- package/dist/mcp/tools/fileManager.d.ts +0 -6
- package/dist/mcp/tools/fileManager.d.ts.map +0 -1
- package/dist/mcp/tools/fileManager.js +0 -233
- package/dist/mcp/tools/fileManager.js.map +0 -1
- package/guides/next/basic/locale-selector.md +0 -5
- package/guides/next/basic/setup.md +0 -139
- package/guides/next/basic/translating-html.md +0 -36
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]="de41ed32-096f-5018-bae8-c28bdded6930")}catch(e){}}();
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
5
|
dotenv.config({ path: '.env' });
|
|
6
6
|
dotenv.config({ path: '.env.local', override: true });
|
|
@@ -26,7 +26,7 @@ program
|
|
|
26
26
|
.description('Run Locadex on your project')
|
|
27
27
|
.option('-v, --verbose', 'Verbose output')
|
|
28
28
|
.option('-d, --debug', 'Debug output')
|
|
29
|
-
.option('-b, --batch-size <number>', '
|
|
29
|
+
.option('-b, --batch-size <number>', 'File batch size', '10')
|
|
30
30
|
.option('--no-telemetry', 'Disable telemetry')
|
|
31
31
|
.action((options, command) => {
|
|
32
32
|
const parentOptions = command.parent?.opts() || {};
|
|
@@ -42,7 +42,7 @@ program
|
|
|
42
42
|
.description('Run Locadex i18n on your project')
|
|
43
43
|
.option('-v, --verbose', 'Verbose output')
|
|
44
44
|
.option('-d, --debug', 'Debug output')
|
|
45
|
-
.option('-b, --batch-size <number>', '
|
|
45
|
+
.option('-b, --batch-size <number>', 'File batch size', '10')
|
|
46
46
|
.option('--no-telemetry', 'Disable telemetry')
|
|
47
47
|
.action((options, command) => {
|
|
48
48
|
const parentOptions = command.parent?.opts() || {};
|
|
@@ -56,4 +56,4 @@ program
|
|
|
56
56
|
main(program);
|
|
57
57
|
program.parse();
|
|
58
58
|
//# sourceMappingURL=cli.js.map
|
|
59
|
-
//# debugId=
|
|
59
|
+
//# debugId=de41ed32-096f-5018-bae8-c28bdded6930
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sources":["cli.ts"],"sourceRoot":"/","sourcesContent":["#!/usr/bin/env node\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 { CliOptions } from './types/cli.js';\nimport { withTelemetry } from './telemetry.js';\nimport { logger } from './logging/logger.js';\nimport { i18nCommand } from './commands/i18n.js';\nimport { displayHeader } from './logging/console.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>', '
|
|
1
|
+
{"version":3,"file":"cli.js","sources":["cli.ts"],"sourceRoot":"/","sourcesContent":["#!/usr/bin/env node\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 { CliOptions } from './types/cli.js';\nimport { withTelemetry } from './telemetry.js';\nimport { logger } from './logging/logger.js';\nimport { i18nCommand } from './commands/i18n.js';\nimport { displayHeader } from './logging/console.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('--no-telemetry', 'Disable telemetry')\n .action((options: CliOptions, command: Command) => {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n withTelemetry(\n { enabled: !allOptions.noTelemetry, options: allOptions },\n () => {\n logger.initialize(allOptions);\n displayHeader();\n setupCommand(Number(allOptions.batchSize) || 1);\n }\n );\n });\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('--no-telemetry', 'Disable telemetry')\n .action((options: CliOptions, command: Command) => {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n withTelemetry(\n { enabled: !allOptions.noTelemetry, options: allOptions },\n () => {\n logger.initialize(allOptions);\n displayHeader();\n i18nCommand(Number(allOptions.batchSize) || 1);\n }\n );\n });\n\nmain(program);\n\nprogram.parse();\n"],"names":[],"mappings":";;;AACA,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;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,YAAY,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,CACtD,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI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OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,UAAU,GAAG,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,aAAa,CACX,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,EACzD,GAAG,EAAE;QACH,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC9B,aAAa,EAAE,CAAC;QAChB,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,IAAI,CAAC,OAAO,CAAC,CAAC;AAEd,OAAO,CAAC,KAAK,EAAE,CAAC","debug_id":"de41ed32-096f-5018-bae8-c28bdded6930"}
|
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":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAgC1D,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,iBAwK5E"}
|
package/dist/commands/i18n.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
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]="24e0dc6c-383b-537d-98d1-ca9226e5afa3")}catch(e){}}();
|
|
3
3
|
import { createSpinner } from '../logging/console.js';
|
|
4
4
|
import { allMcpPrompt } from '../prompts/system.js';
|
|
5
5
|
import { logger } from '../logging/logger.js';
|
|
6
6
|
import { createDag } from '../utils/dag/createDag.js';
|
|
7
7
|
import { findTsConfig, findWebpackConfig, findRequireConfig, } from '../utils/fs/findConfigs.js';
|
|
8
|
-
import {
|
|
8
|
+
import { LocadexManager } from '../utils/agentManager.js';
|
|
9
9
|
import { addFilesToManager, markFileAsEdited, markFileAsInProgress, } from '../utils/getFiles.js';
|
|
10
10
|
import { outro } from '@clack/prompts';
|
|
11
11
|
import chalk from 'chalk';
|
|
12
12
|
import { readdirSync, statSync } from 'node:fs';
|
|
13
13
|
import { EXCLUDED_DIRS } from '../utils/shared.js';
|
|
14
14
|
import { validateInitialConfig } from '../utils/validateConfig.js';
|
|
15
|
+
import { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';
|
|
15
16
|
function getCurrentDirectories() {
|
|
16
17
|
try {
|
|
17
18
|
return readdirSync(process.cwd())
|
|
@@ -32,34 +33,41 @@ function getCurrentDirectories() {
|
|
|
32
33
|
return [];
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
export async function i18nCommand(batchSize) {
|
|
36
|
+
export async function i18nCommand(batchSize, manager) {
|
|
36
37
|
validateInitialConfig();
|
|
37
38
|
// Init message
|
|
38
39
|
const spinner = createSpinner();
|
|
39
40
|
spinner.start('Initializing Locadex...');
|
|
40
|
-
|
|
41
|
-
logger.debugMessage('getCurrentDirectories(): ' + getCurrentDirectories().join(', '));
|
|
41
|
+
const startTime = Date.now();
|
|
42
42
|
const dag = createDag(getCurrentDirectories(), {
|
|
43
43
|
tsConfig: findTsConfig(),
|
|
44
44
|
webpackConfig: findWebpackConfig(),
|
|
45
45
|
requireConfig: findRequireConfig(),
|
|
46
46
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
// If no manager is provided, create a new one
|
|
48
|
+
if (!manager) {
|
|
49
|
+
manager = new LocadexManager({
|
|
50
|
+
mcpTransport: 'sse',
|
|
51
|
+
metadata: {
|
|
52
|
+
batchSize: batchSize,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
process.on('beforeExit', () => manager.cleanup());
|
|
56
|
+
}
|
|
57
|
+
const agent = manager.createAgent();
|
|
58
|
+
const filesStateFilePath = manager.getFilesStateFilePath();
|
|
56
59
|
// Track session id
|
|
57
60
|
let sessionId = undefined;
|
|
58
61
|
// Create the list of files (aka tasks) to process
|
|
59
|
-
const taskQueue = dag.getTopologicalOrder();
|
|
62
|
+
const taskQueue = [...dag.getTopologicalOrder()];
|
|
63
|
+
const allFiles = [...dag.getTopologicalOrder()];
|
|
60
64
|
// Add files to manager
|
|
61
65
|
const stateFilePath = addFilesToManager(filesStateFilePath, taskQueue);
|
|
62
|
-
|
|
66
|
+
spinner.stop('Locadex initialized');
|
|
67
|
+
logger.verboseMessage(`Number of files to process: ${dag.getTopologicalOrder().length}`);
|
|
68
|
+
logger.debugMessage(`Track progress here: ${stateFilePath}`);
|
|
69
|
+
logger.initializeProgressBar(taskQueue.length);
|
|
70
|
+
logger.progressBar.start('Processing files...');
|
|
63
71
|
// Main loop
|
|
64
72
|
let hasError = false;
|
|
65
73
|
while (taskQueue.length > 0) {
|
|
@@ -93,15 +101,20 @@ export async function i18nCommand(batchSize) {
|
|
|
93
101
|
}
|
|
94
102
|
catch (error) {
|
|
95
103
|
hasError = true;
|
|
96
|
-
logger.debugMessage(`[
|
|
104
|
+
logger.debugMessage(`[i18n] Error in claude i18n process: ${error}`);
|
|
97
105
|
break;
|
|
98
106
|
}
|
|
99
107
|
// Mark task as complete
|
|
100
108
|
tasks.forEach((task) => markFileAsEdited(task, filesStateFilePath));
|
|
109
|
+
logger.progressBar.advance(tasks.length, `Processed ${Number(((allFiles.length - taskQueue.length) / allFiles.length) * 100).toFixed(2)}% of files`);
|
|
110
|
+
manager.stats.updateStats({
|
|
111
|
+
newProcessedFiles: tasks.length,
|
|
112
|
+
});
|
|
101
113
|
}
|
|
114
|
+
logger.progressBar.stop(`Processed ${allFiles.length} files`);
|
|
102
115
|
// TODO: uncomment
|
|
103
116
|
// // Always clean up the file list when done, regardless of success or failure
|
|
104
|
-
// logger.info(`
|
|
117
|
+
// logger.info(`Cleaning up file list: ${stateFilePath}`);
|
|
105
118
|
// cleanUp(stateFilePath);
|
|
106
119
|
// If there was an error, exit with code 1
|
|
107
120
|
if (hasError) {
|
|
@@ -109,16 +122,21 @@ export async function i18nCommand(batchSize) {
|
|
|
109
122
|
process.exit(1);
|
|
110
123
|
}
|
|
111
124
|
// Fix prompt
|
|
125
|
+
logger.initializeSpinner();
|
|
126
|
+
logger.spinner.start('Fixing errors...');
|
|
112
127
|
const fixPrompt = getFixPrompt();
|
|
113
128
|
try {
|
|
114
129
|
await agent.run({ prompt: fixPrompt, sessionId }, { spinner });
|
|
115
130
|
}
|
|
116
131
|
catch (error) {
|
|
117
|
-
logger.debugMessage(`[
|
|
132
|
+
logger.debugMessage(`[i18n] Fixing errors failed: ${error}`);
|
|
118
133
|
outro(chalk.red('❌ Locadex i18n failed!'));
|
|
119
134
|
process.exit(1);
|
|
120
135
|
}
|
|
136
|
+
logger.spinner.stop('Fixed errors');
|
|
121
137
|
// Generate report
|
|
138
|
+
logger.initializeSpinner();
|
|
139
|
+
logger.spinner.start('Generating report...');
|
|
122
140
|
const reportPrompt = getReportPrompt();
|
|
123
141
|
try {
|
|
124
142
|
await agent.run({
|
|
@@ -127,24 +145,35 @@ export async function i18nCommand(batchSize) {
|
|
|
127
145
|
}, { spinner });
|
|
128
146
|
}
|
|
129
147
|
catch (error) {
|
|
130
|
-
logger.debugMessage(`[
|
|
148
|
+
logger.debugMessage(`[i18n] Error in claude report generation: ${error}`);
|
|
131
149
|
outro(chalk.red('❌ Locadex i18n failed!'));
|
|
132
150
|
process.exit(1);
|
|
133
151
|
}
|
|
152
|
+
logger.spinner.stop('Report generated');
|
|
153
|
+
// cleanup
|
|
154
|
+
const formatter = await detectFormatter();
|
|
155
|
+
if (formatter) {
|
|
156
|
+
await formatFiles(allFiles, formatter);
|
|
157
|
+
}
|
|
158
|
+
logger.info(chalk.dim(`Total Cost: $${manager.stats.getStats().totalCost.toFixed(2)}
|
|
159
|
+
Total API duration: ${Math.round(manager.stats.getStats().totalApiDuration / 1000)}s
|
|
160
|
+
Total wall duration: ${Math.round((Date.now() - startTime) / 1000)}s
|
|
161
|
+
Total files processed: ${manager.stats.getStats().processedFiles}`));
|
|
134
162
|
outro(chalk.green('✅ Locadex i18n complete!'));
|
|
135
163
|
process.exit(0);
|
|
136
164
|
}
|
|
137
165
|
function getPrompt({ targetFile, dependencyFiles, dependentFiles, }) {
|
|
138
|
-
const prompt = `# Task: Internationalize the target file using gt-next.
|
|
166
|
+
const prompt = `# Task: Internationalize the target file(s) using gt-next.
|
|
139
167
|
|
|
140
|
-
|
|
168
|
+
## INSTRUCTIONS
|
|
141
169
|
|
|
142
|
-
- You are given a list of target files and
|
|
143
|
-
- The project is already setup for internationalization.
|
|
170
|
+
- You are given a list of target files and their corresponding dependency/dependent files.
|
|
171
|
+
- The project is already setup for internationalization. Do not try to setup the project again for i18n.
|
|
144
172
|
|
|
145
173
|
## Workflow:
|
|
146
|
-
1. **Gather
|
|
147
|
-
2. **Evaluate if i18n is necessary** Evaluate if
|
|
174
|
+
1. **Gather context** Read the target files closely (you should not have to read the dependency/dependent files).
|
|
175
|
+
2. **Evaluate if i18n is necessary** Evaluate if the target files need to be internationalized using gt-next
|
|
176
|
+
- 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.
|
|
148
177
|
**IMPORTANT**: IF NONE OF THE TARGET FILES NEED TO BE INTERNATIONALIZED, YOUR TASK IS COMPLETE AND YOU MAY RETURN.
|
|
149
178
|
3. **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:
|
|
150
179
|
- 3.a. Does this file contain a component? If so, is it a server-side component or a client-side component?
|
|
@@ -156,30 +185,36 @@ function getPrompt({ targetFile, dependencyFiles, dependentFiles, }) {
|
|
|
156
185
|
- 4.a. Do not worry about running tsc. We will do that later.
|
|
157
186
|
|
|
158
187
|
## RULES:
|
|
159
|
-
- ALWAYS use the <T> component to internationalize HTML/JSX content.
|
|
160
|
-
-
|
|
188
|
+
- ALWAYS use the <T> component to internationalize HTML/JSX content.
|
|
189
|
+
- ALWAYS use getGT() or useGT() and getDict() or useDict() to internationalize string content.
|
|
190
|
+
- When possible, avoid using getDict() or useDict(); getGT() and useGT() are preferred.
|
|
191
|
+
- DO NOT internationalize non-user facing content or content that is functional, such as ids, class names, error strings, logical strings, etc.
|
|
192
|
+
- Do not add i18n middleware to the app.
|
|
161
193
|
- When adding 'useGT()' or 'useDict()' to a client component, you must add 'use client' to the top of the file.
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
194
|
+
- Always adhere to the guides provided via the 'mcp__locadex__' tools.
|
|
195
|
+
- These guides provide additional knowledge about how to internationalize the content.
|
|
196
|
+
- Minimize the footprint of your changes.
|
|
197
|
+
- Focus on internationalizing the content of the target files.
|
|
165
198
|
- NEVER move internationalized content to a different file. All content MUST remain in the same file where it came from.
|
|
166
199
|
- NEVER CREATE OR REMOVE ANY FILES (especially .bak files)
|
|
167
|
-
- Internationalize all user facing content in the target files.
|
|
200
|
+
- Internationalize all user facing content in the target files.
|
|
168
201
|
- NEVER EDIT FILES THAT ARE NOT GIVEN TO YOU.
|
|
169
202
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
${
|
|
173
|
-
Target file path:
|
|
203
|
+
## TARGET FILE INFORMATION
|
|
204
|
+
${targetFile.map((file, index) => `
|
|
205
|
+
TARGET FILE ${index + 1}:
|
|
174
206
|
${file}
|
|
175
207
|
|
|
176
|
-
|
|
208
|
+
DEPENDENCY FILES (files imported by target file ${index + 1}):
|
|
177
209
|
${dependencyFiles[file].length > 0 ? ` ${dependencyFiles[file].join(', ')}` : 'none'}
|
|
178
210
|
|
|
179
|
-
|
|
211
|
+
DEPENDENT FILES (files that import target file ${index + 1}):
|
|
180
212
|
${dependentFiles[file].length > 0 ? ` ${dependentFiles[file].join(', ')}` : 'none'}
|
|
181
213
|
`)}
|
|
182
|
-
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## MCP TOOLS
|
|
183
218
|
|
|
184
219
|
${allMcpPrompt}
|
|
185
220
|
`;
|
|
@@ -187,29 +222,39 @@ ${allMcpPrompt}
|
|
|
187
222
|
}
|
|
188
223
|
// check (dry run and ts check) should be at the end
|
|
189
224
|
function getFixPrompt() {
|
|
190
|
-
const prompt =
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
225
|
+
const prompt = `# Task: Fix implementation errors in the project.
|
|
226
|
+
|
|
227
|
+
## INSTRUCTIONS
|
|
228
|
+
|
|
229
|
+
Previously, you helped me internationalize a set of files in this project.
|
|
230
|
+
Your new task is as follows:
|
|
231
|
+
|
|
232
|
+
1. Run the gt-next validator.
|
|
233
|
+
2. Fix all errors relevant to the gt-next implementation code.
|
|
234
|
+
3. Whenever you are finished with your changes, run the gt-next validator.
|
|
235
|
+
4. Repeat steps 1-3 until there are no more errors, or until you believe that you have fixed all errors.
|
|
236
|
+
5. If the project is setup with linting, lint the project and fix all errors.
|
|
237
|
+
|
|
238
|
+
## RULES:
|
|
239
|
+
- DO NOT modify any files that are not relevant to the gt-next implementation code.
|
|
240
|
+
- ONLY fix errors that are relevant to the gt-next implementation code and your current or previous implementation.
|
|
241
|
+
- Resolve unused imports from 'gt-next'.
|
|
242
|
+
- In particular, if a file contains user-facing content that should be internationalized and is not, you should internationalize it.
|
|
243
|
+
- Resolve missing imports from 'gt-next'. If a file is missing an import from 'gt-next', add it.
|
|
244
|
+
|
|
245
|
+
To run the gt-next validator, run the following command:
|
|
246
|
+
'npx locadex translate --dry-run'
|
|
247
|
+
|
|
248
|
+
## MCP TOOLS
|
|
249
|
+
${allMcpPrompt}`;
|
|
204
250
|
return prompt;
|
|
205
251
|
}
|
|
206
252
|
function getReportPrompt() {
|
|
207
|
-
const prompt =
|
|
208
|
-
|
|
253
|
+
const prompt = `Your new task is as follows:
|
|
209
254
|
- Please add a markdown file called 'locadex-report.md' to the root of the project.
|
|
210
255
|
- The report should include a summary of the changes you made to the project.
|
|
211
256
|
- A list of items the user needs to complete to finish the internationalization process (adding env vars, etc.).`;
|
|
212
257
|
return prompt;
|
|
213
258
|
}
|
|
214
259
|
//# sourceMappingURL=i18n.js.map
|
|
215
|
-
//# debugId=
|
|
260
|
+
//# debugId=24e0dc6c-383b-537d-98d1-ca9226e5afa3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sources":["commands/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { createSpinner, displayHeader } from '../logging/console.js';\nimport { allMcpPrompt } from '../prompts/system.js';\n\nimport { logger } from '../logging/logger.js';\nimport { createDag } from '../utils/dag/createDag.js';\nimport {\n findTsConfig,\n findWebpackConfig,\n findRequireConfig,\n} from '../utils/fs/findConfigs.js';\nimport { configureAgent } from '../utils/agentManager.js';\nimport {\n addFilesToManager,\n cleanUp,\n markFileAsEdited,\n markFileAsInProgress,\n} from '../utils/getFiles.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { exec } from 'child_process';\nimport { promisify } from 'util';\nimport { readdirSync, statSync } from 'node:fs';\nimport { EXCLUDED_DIRS } from '../utils/shared.js';\nimport { validateInitialConfig } from '../utils/validateConfig.js';\n\nfunction getCurrentDirectories(): string[] {\n try {\n return readdirSync(process.cwd())\n .filter((item) => {\n try {\n return statSync(item).isDirectory();\n } catch {\n return false;\n }\n })\n .map((dir) => `./${dir}`)\n .filter((dir) => {\n return !EXCLUDED_DIRS.includes(dir);\n });\n } catch {\n return [];\n }\n}\n\nexport async function i18nCommand(batchSize: number) {\n validateInitialConfig();\n\n // Init message\n const spinner = createSpinner();\n spinner.start('Initializing Locadex...');\n\n // Create DAG\n logger.debugMessage(\n 'getCurrentDirectories(): ' + getCurrentDirectories().join(', ')\n );\n const dag = createDag(getCurrentDirectories(), {\n tsConfig: findTsConfig(),\n webpackConfig: findWebpackConfig(),\n requireConfig: findRequireConfig(),\n });\n\n logger.info(\n 'dag.getDag().length: ' + String(Object.keys(dag.getDag()).length)\n );\n logger.info(\n 'dag.getReverseDag().length: ' +\n String(Object.keys(dag.getReverseDag()).length)\n );\n logger.info(\n 'dag.getTopologicalOrder().length: ' +\n String(dag.getTopologicalOrder().length)\n );\n\n // Configure agent\n const { agent, filesStateFilePath } = configureAgent({\n mcpTransport: 'sse',\n });\n\n // Track session id\n let sessionId: string | undefined = undefined;\n\n // Create the list of files (aka tasks) to process\n const taskQueue = dag.getTopologicalOrder();\n\n // Add files to manager\n const stateFilePath = addFilesToManager(filesStateFilePath, taskQueue);\n logger.info(`[dagCommand] Track progress here: ${stateFilePath}`);\n\n // Main loop\n let hasError = false;\n while (taskQueue.length > 0) {\n // Get the next task\n const tasks = taskQueue.splice(0, batchSize);\n if (tasks.length === 0) {\n break;\n }\n\n // Mark task as in progress\n tasks.forEach((task) => markFileAsInProgress(task, filesStateFilePath));\n\n // Construct prompt\n const dependencies = Object.fromEntries(\n tasks.map((task) => [\n task,\n Array.from(new Set(dag.getDependencies(task))),\n ])\n );\n const dependents = Object.fromEntries(\n tasks.map((task) => [task, Array.from(new Set(dag.getDependents(task)))])\n );\n const prompt = getPrompt({\n targetFile: tasks,\n dependencyFiles: dependencies,\n dependentFiles: dependents,\n });\n\n // Claude call\n try {\n await agent.run(\n {\n prompt,\n sessionId,\n },\n { spinner }\n );\n if (!sessionId) {\n sessionId = agent.getSessionId();\n }\n } catch (error) {\n hasError = true;\n logger.debugMessage(\n `[dagCommand] Error in claude i18n process: ${error}`\n );\n break;\n }\n\n // Mark task as complete\n tasks.forEach((task) => markFileAsEdited(task, filesStateFilePath));\n }\n\n // TODO: uncomment\n // // Always clean up the file list when done, regardless of success or failure\n // logger.info(`[dagCommand] Cleaning up file list: ${stateFilePath}`);\n // cleanUp(stateFilePath);\n\n // If there was an error, exit with code 1\n if (hasError) {\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n\n // Fix prompt\n const fixPrompt = getFixPrompt();\n try {\n await agent.run({ prompt: fixPrompt, sessionId }, { spinner });\n } catch (error) {\n logger.debugMessage(`[dagCommand] Fixing errors failed: ${error}`);\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n\n // Generate report\n const reportPrompt = getReportPrompt();\n try {\n await agent.run(\n {\n prompt: reportPrompt,\n sessionId,\n },\n { spinner }\n );\n } catch (error) {\n logger.debugMessage(\n `[dagCommand] Error in claude report generation: ${error}`\n );\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n\n outro(chalk.green('✅ Locadex i18n complete!'));\n process.exit(0);\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 using gt-next.\n\n--- INSTRUCTIONS ---\n\n- You are given a list of target files and a list of dependency/dependent files.\n- The project is already setup for internationalization. You do not need to setup the project again for i18n.\n\n## Workflow:\n1. **Gather background** Read the target files closely (you should not have to read the dependency/dependent files).\n2. **Evaluate if i18n is necessary** Evaluate if just the target files need to be internationalized using gt-next (the target files may have no relevant content, they may already be internationalized, or they contain build-time code (e.g. nextjs plugins) 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. Does this file contain a component? If so, is it a server-side component or a client-side component?\n - 3.b. Is the content that needs to be i18ned being used in this same file, or is it being used in another file?\n - 3.c. Is there any string interpolation that needs to be i18ned?\n - 3.d. Is there any conditional logic or rendering that needs to be i18ned?\n - 3.e. 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 worry about running tsc. We will do that later.\n\n## RULES:\n- ALWAYS use the <T> component to internationalize HTML/JSX content. Only use getGT() or useGT() and getDict() or useDict() for string content.\n- Do not add i18n middleware to the app\n- When adding 'useGT()' or 'useDict()' to a client component, you must add 'use client' to the top of the file.\n- Strictly adhere to the guides provided to gain necessary knowledge about how to internationalize the content.\n- Minimize the footprint of the changes.\n- Only focus on internationalizing the content of the target files.\n- NEVER move internationalized content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR REMOVE ANY FILES (especially .bak files)\n- Internationalize all user facing content in the target files. Do not internationalize content that is not user facing.\n- NEVER EDIT FILES THAT ARE NOT GIVEN TO YOU.\n\n\n--- TARGET FILE INFORMATION ---\n${targetFile.map(\n (file) => `\nTarget file path:\n${file}\n\nDependency files (files imported by the target file):\n${dependencyFiles[file].length > 0 ? ` ${dependencyFiles[file].join(', ')}` : 'none'}\n\nDependent files (files that import the target file):\n${dependentFiles[file].length > 0 ? ` ${dependentFiles[file].join(', ')}` : 'none'}\n`\n)}\n--- MCP TOOLS ---\n\n${allMcpPrompt}\n`;\n\n return prompt;\n}\n\n// check (dry run and ts check) should be at the end\n\nfunction getFixPrompt() {\n const prompt = `--- INSTRUCTIONS ---\n \n Your task is as follows:\n Start by running the gt-next linter (and ts type check if there are ts/tsx files).\n (1) You need to fix all errors relevant to the gt implementation code.\n (2) Whenever you are finished with your changes please run the gt-next linter (and ts type check if applicable).\n (3) Repeat steps 1-2 until there are no more errors or until you believe that you have fixed all errors.\n\n Rules:\n - DO NOT modify any files that are not relevant to the gt implementation code.\n - ONLY fix errors that are relevant to the gt implementation code and your implementation.\n\n To run the gt-next linter, run the following command:\n 'npx gtx-cli translate --dry-run'and is appropriate for the files you have modified.`;\n\n return prompt;\n}\n\nfunction getReportPrompt() {\n const prompt = `--- INSTRUCTIONS ---\n\n- Please add a markdown file called 'locadex-report.md' to the root of the project.\n- The report should include a summary of the changes you made to the project.\n- A list of items the user needs to complete to finish the internationalization process (adding env vars, etc.).`;\n\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,iBAAiB,EAEjB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,SAAS,qBAAqB;IAC5B,IAAI,CAAC;QACH,OAAO,WAAW,C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Ac,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;CACjF,CACA;;;EAGC,YAAY;CACb,CAAC;IAEA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,oDAAoD;AAEpD,SAAS,YAAY;IACnB,MAAM,MAAM,GAAG;;;;;;;;;;;;;uFAasE,CAAC;IAEtF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe;IACtB,MAAM,MAAM,GAAG;;;;iHAIgG,CAAC;IAEhH,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"07fa5837-c204-572a-a464-4653a2df8e31"}
|
|
1
|
+
{"version":3,"file":"i18n.js","sources":["commands/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { createProgressBar, createSpinner } from '../logging/console.js';\nimport { allMcpPrompt } from '../prompts/system.js';\n\nimport { logger } from '../logging/logger.js';\nimport { createDag } from '../utils/dag/createDag.js';\nimport {\n findTsConfig,\n findWebpackConfig,\n findRequireConfig,\n} from '../utils/fs/findConfigs.js';\nimport { LocadexManager } from '../utils/agentManager.js';\nimport {\n addFilesToManager,\n markFileAsEdited,\n markFileAsInProgress,\n} from '../utils/getFiles.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { readdirSync, statSync } from 'node:fs';\nimport { EXCLUDED_DIRS } from '../utils/shared.js';\nimport { validateInitialConfig } from '../utils/validateConfig.js';\nimport { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';\n\nfunction getCurrentDirectories(): string[] {\n try {\n return readdirSync(process.cwd())\n .filter((item) => {\n try {\n return statSync(item).isDirectory();\n } catch {\n return false;\n }\n })\n .map((dir) => `./${dir}`)\n .filter((dir) => {\n return !EXCLUDED_DIRS.includes(dir);\n });\n } catch {\n return [];\n }\n}\n\nexport async function i18nCommand(batchSize: number, manager?: LocadexManager) {\n validateInitialConfig();\n\n // Init message\n const spinner = createSpinner();\n spinner.start('Initializing Locadex...');\n const startTime = Date.now();\n\n const dag = createDag(getCurrentDirectories(), {\n tsConfig: findTsConfig(),\n webpackConfig: findWebpackConfig(),\n requireConfig: findRequireConfig(),\n });\n\n // If no manager is provided, create a new one\n if (!manager) {\n manager = new LocadexManager({\n mcpTransport: 'sse',\n metadata: {\n batchSize: batchSize,\n },\n });\n process.on('beforeExit', () => manager!.cleanup());\n }\n\n const agent = manager.createAgent();\n const filesStateFilePath = manager.getFilesStateFilePath();\n\n // Track session id\n let sessionId: string | undefined = undefined;\n\n // Create the list of files (aka tasks) to process\n const taskQueue = [...dag.getTopologicalOrder()];\n\n const allFiles = [...dag.getTopologicalOrder()];\n\n // Add files to manager\n const stateFilePath = addFilesToManager(filesStateFilePath, taskQueue);\n spinner.stop('Locadex initialized');\n\n logger.verboseMessage(\n `Number of files to process: ${dag.getTopologicalOrder().length}`\n );\n logger.debugMessage(`Track progress here: ${stateFilePath}`);\n\n logger.initializeProgressBar(taskQueue.length);\n logger.progressBar.start('Processing files...');\n // Main loop\n let hasError = false;\n while (taskQueue.length > 0) {\n // Get the next task\n const tasks = taskQueue.splice(0, batchSize);\n if (tasks.length === 0) {\n break;\n }\n\n // Mark task as in progress\n tasks.forEach((task) => markFileAsInProgress(task, filesStateFilePath));\n\n // Construct prompt\n const dependencies = Object.fromEntries(\n tasks.map((task) => [\n task,\n Array.from(new Set(dag.getDependencies(task))),\n ])\n );\n const dependents = Object.fromEntries(\n tasks.map((task) => [task, Array.from(new Set(dag.getDependents(task)))])\n );\n const prompt = getPrompt({\n targetFile: tasks,\n dependencyFiles: dependencies,\n dependentFiles: dependents,\n });\n\n // Claude call\n try {\n await agent.run(\n {\n prompt,\n sessionId,\n },\n { spinner }\n );\n if (!sessionId) {\n sessionId = agent.getSessionId();\n }\n } catch (error) {\n hasError = true;\n logger.debugMessage(`[i18n] Error in claude i18n process: ${error}`);\n break;\n }\n\n // Mark task as complete\n tasks.forEach((task) => markFileAsEdited(task, filesStateFilePath));\n logger.progressBar.advance(\n tasks.length,\n `Processed ${Number(((allFiles.length - taskQueue.length) / allFiles.length) * 100).toFixed(2)}% of files`\n );\n manager.stats.updateStats({\n newProcessedFiles: tasks.length,\n });\n }\n\n logger.progressBar.stop(`Processed ${allFiles.length} files`);\n\n // TODO: uncomment\n // // Always clean up the file list when done, regardless of success or failure\n // logger.info(`Cleaning up file list: ${stateFilePath}`);\n // cleanUp(stateFilePath);\n\n // If there was an error, exit with code 1\n if (hasError) {\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n\n // Fix prompt\n logger.initializeSpinner();\n logger.spinner.start('Fixing errors...');\n const fixPrompt = getFixPrompt();\n try {\n await agent.run({ prompt: fixPrompt, sessionId }, { spinner });\n } catch (error) {\n logger.debugMessage(`[i18n] Fixing errors failed: ${error}`);\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n logger.spinner.stop('Fixed errors');\n\n // Generate report\n logger.initializeSpinner();\n logger.spinner.start('Generating report...');\n const reportPrompt = getReportPrompt();\n try {\n await agent.run(\n {\n prompt: reportPrompt,\n sessionId,\n },\n { spinner }\n );\n } catch (error) {\n logger.debugMessage(`[i18n] Error in claude report generation: ${error}`);\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n logger.spinner.stop('Report generated');\n\n // cleanup\n\n const formatter = await detectFormatter();\n\n if (formatter) {\n await formatFiles(allFiles, formatter);\n }\n\n logger.info(\n chalk.dim(\n `Total Cost: $${manager.stats.getStats().totalCost.toFixed(2)}\nTotal API duration: ${Math.round(manager.stats.getStats().totalApiDuration / 1000)}s\nTotal wall duration: ${Math.round((Date.now() - startTime) / 1000)}s\nTotal files processed: ${manager.stats.getStats().processedFiles}`\n )\n );\n\n outro(chalk.green('✅ Locadex i18n complete!'));\n process.exit(0);\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 (you should not have to read the dependency/dependent files).\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. Does this file contain a component? If so, is it a server-side component or a client-side component?\n - 3.b. Is the content that needs to be i18ned being used in this same file, or is it being used in another file?\n - 3.c. Is there any string interpolation that needs to be i18ned?\n - 3.d. Is there any conditional logic or rendering that needs to be i18ned?\n - 3.e. 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 worry about running tsc. We will do that later.\n\n## RULES:\n- ALWAYS use the <T> component to internationalize HTML/JSX content.\n- ALWAYS use getGT() or useGT() and getDict() or useDict() to internationalize string content.\n - When possible, avoid using getDict() or useDict(); getGT() and useGT() are 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- When adding 'useGT()' or 'useDict()' to a client component, you must add 'use client' to the top of the file.\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 the content of the target files.\n- NEVER move internationalized content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR REMOVE ANY FILES (especially .bak files)\n- Internationalize all user facing content in the target 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\n return prompt;\n}\n\n// check (dry run and ts check) should be at the end\n\nfunction getFixPrompt() {\n const prompt = `# Task: Fix implementation errors in the project.\n\n## INSTRUCTIONS\n\nPreviously, you helped me internationalize a set of files in this project.\nYour new task is as follows:\n\n1. Run the gt-next validator.\n2. Fix all errors relevant to the gt-next implementation code.\n3. Whenever you are finished with your changes, run the gt-next validator.\n4. Repeat steps 1-3 until there are no more errors, or until you believe that you have fixed all errors.\n5. If the project is setup with linting, lint the project and fix all errors.\n\n## RULES:\n- DO NOT modify any files that are not relevant to the gt-next implementation code.\n- ONLY fix errors that are relevant to the gt-next implementation code and your current or previous implementation.\n- Resolve unused imports from 'gt-next'. \n - In particular, if a file contains user-facing content that should be internationalized and is not, you should internationalize it.\n- Resolve missing imports from 'gt-next'. If a file is missing an import from 'gt-next', add it.\n\nTo run the gt-next validator, run the following command:\n'npx locadex translate --dry-run'\n\n## MCP TOOLS\n${allMcpPrompt}`;\n\n return prompt;\n}\n\nfunction getReportPrompt() {\n const prompt = `Your new task is as follows:\n- Please add a markdown file called 'locadex-report.md' to the root of the project.\n- The report should include a summary of the changes you made to the project.\n- A list of items the user needs to complete to finish the internationalization process (adding env vars, etc.).`;\n\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,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SAAS,YAAY;IACnB,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;EAwBf,YAAY,EAAE,CAAC;IAEf,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe;IACtB,MAAM,MAAM,GAAG;;;iHAGgG,CAAC;IAEhH,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"24e0dc6c-383b-537d-98d1-ca9226e5afa3"}
|
|
@@ -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":"AAqBA,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,iBAoHnD"}
|
package/dist/commands/setup.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]="e0489702-6a0a-5c5d-b5ec-ab08b146ea98")}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';
|
|
@@ -14,6 +14,8 @@ import { createOrUpdateConfig } from 'gtx-cli/fs/config/setupConfig';
|
|
|
14
14
|
import { i18nCommand } from './i18n.js';
|
|
15
15
|
import { validateInitialConfig } from '../utils/validateConfig.js';
|
|
16
16
|
import { getNextDirectories } from '../utils/fs/getFiles.js';
|
|
17
|
+
import { LocadexManager } from '../utils/agentManager.js';
|
|
18
|
+
import { outro } from '@clack/prompts';
|
|
17
19
|
export async function setupCommand(batchSize) {
|
|
18
20
|
validateInitialConfig();
|
|
19
21
|
const answer = await promptConfirm({
|
|
@@ -60,11 +62,6 @@ export async function setupCommand(batchSize) {
|
|
|
60
62
|
// Add the withGTConfig() function to the next.config.js file
|
|
61
63
|
await handleInitGT(nextConfigPath, errors, warnings, filesUpdated);
|
|
62
64
|
logger.step(chalk.green(`Added withGTConfig() to your ${nextConfigPath} file.`));
|
|
63
|
-
const formatter = await detectFormatter();
|
|
64
|
-
if (formatter && filesUpdated.length > 0) {
|
|
65
|
-
logger.step(chalk.green(`Formatting ${filesUpdated.length} files...`));
|
|
66
|
-
await formatFiles(filesUpdated, formatter);
|
|
67
|
-
}
|
|
68
65
|
// Create gt.config.json
|
|
69
66
|
await createOrUpdateConfig('gt.config.json', {
|
|
70
67
|
defaultLocale: 'en',
|
|
@@ -83,7 +80,66 @@ export async function setupCommand(batchSize) {
|
|
|
83
80
|
await installPackage('locadex', packageManager, true);
|
|
84
81
|
spinner.stop(chalk.green('Installed locadex.'));
|
|
85
82
|
}
|
|
86
|
-
|
|
83
|
+
// Create manager
|
|
84
|
+
const manager = new LocadexManager({
|
|
85
|
+
mcpTransport: 'sse',
|
|
86
|
+
metadata: {
|
|
87
|
+
batchSize: batchSize,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
process.on('beforeExit', () => manager.cleanup());
|
|
91
|
+
// Set up locale selector
|
|
92
|
+
await setupLocaleSelector(manager);
|
|
93
|
+
const formatter = await detectFormatter();
|
|
94
|
+
if (formatter && filesUpdated.length > 0) {
|
|
95
|
+
await formatFiles(filesUpdated, formatter);
|
|
96
|
+
}
|
|
97
|
+
// Run i18n command
|
|
98
|
+
i18nCommand(batchSize, manager);
|
|
99
|
+
}
|
|
100
|
+
async function setupLocaleSelector(manager) {
|
|
101
|
+
logger.initializeSpinner();
|
|
102
|
+
logger.spinner.start('Creating locale selector...');
|
|
103
|
+
// Create agent
|
|
104
|
+
const agent = manager.createAgent();
|
|
105
|
+
// Fix prompt
|
|
106
|
+
const localeSelectorPrompt = getLocaleSelectorPrompt();
|
|
107
|
+
try {
|
|
108
|
+
await agent.run({ prompt: localeSelectorPrompt }, {});
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
logger.debugMessage(`[setup] Adding locale selector failed: ${error}`);
|
|
112
|
+
outro(chalk.red('❌ Locadex setup failed!'));
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
logger.spinner.stop('Locale selector setup complete');
|
|
116
|
+
}
|
|
117
|
+
function getLocaleSelectorPrompt() {
|
|
118
|
+
const prompt = `Here is your task:
|
|
119
|
+
- Please add a locale selector to the project.
|
|
120
|
+
- The locale selector should be a dropdown that allows the user to select the locale.
|
|
121
|
+
|
|
122
|
+
--- LOCALE SELECTOR USAGE ---
|
|
123
|
+
(1) Import the locale selector component from 'gt-next/client'
|
|
124
|
+
(2) Add the locale selector to the project
|
|
125
|
+
|
|
126
|
+
For example:
|
|
127
|
+
import { LocaleSelector } from 'gt-next/client';
|
|
128
|
+
|
|
129
|
+
function MyComponent() {
|
|
130
|
+
return (
|
|
131
|
+
<div>
|
|
132
|
+
<LocaleSelector />
|
|
133
|
+
<p>Hello, world!</p>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
--- ADVICE ---
|
|
139
|
+
- The locale selector should be added to a header or footer or some other very obvious place in the project.
|
|
140
|
+
- Scan across files to find the best place to add the locale selector.
|
|
141
|
+
`;
|
|
142
|
+
return prompt;
|
|
87
143
|
}
|
|
88
144
|
//# sourceMappingURL=setup.js.map
|
|
89
|
-
//# debugId=
|
|
145
|
+
//# debugId=e0489702-6a0a-5c5d-b5ec-ab08b146ea98
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sources":["commands/setup.ts"],"sourceRoot":"/","sourcesContent":["import {\n createSpinner,\n displayHeader,\n promptConfirm,\n} from '../logging/console.js';\nimport { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';\nimport { getPackageManager } 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 { i18nCommand } from './i18n.js';\nimport { validateInitialConfig } from '../utils/validateConfig.js';\nimport { getNextDirectories } from '../utils/fs/getFiles.js';\n\nexport async function setupCommand(batchSize: number) {\n validateInitialConfig();\n const answer = 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 if (!answer) {\n logger.info('Operation cancelled.');\n process.exit(0);\n }\n\n const packageJson = await getPackageJson();\n const packageManager = await getPackageManager();\n\n const spinner = createSpinner('timer');\n\n spinner.start(`Installing gt-next with ${packageManager.name}...`);\n\n await installPackage('gt-next', packageManager);\n\n spinner.stop(chalk.green('Automatically installed gt-next.'));\n\n const nextConfigPath = findFilepaths([\n './next.config.js',\n './next.config.ts',\n './next.config.mjs',\n './next.config.mts',\n ])[0];\n\n if (!nextConfigPath) {\n logger.error('No next.config.[js|ts|mjs|mts] file found.');\n process.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 JSX content with <T> 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(),\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(chalk.green(`Modified ${filesUpdated.length} files.`));\n // Add the withGTConfig() function to the next.config.js file\n await handleInitGT(nextConfigPath, errors, warnings, filesUpdated);\n logger.step(\n chalk.green(`Added withGTConfig() to your ${nextConfigPath} file.`)\n );\n\n const formatter = await detectFormatter();\n if (formatter && filesUpdated.length > 0) {\n logger.step(chalk.green(`Formatting ${filesUpdated.length} files...`));\n await formatFiles(filesUpdated, formatter);\n }\n\n // Create gt.config.json\n await createOrUpdateConfig('gt.config.json', {\n defaultLocale: 'en',\n locales: ['es', 'fr', 'de', 'ja', 'zh'],\n framework: 'next-app',\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 // Install locadex if not installed\n const isLocadexInstalled = packageJson\n ? isPackageInstalled('locadex', packageJson, true, true)\n : true; // if no package.json, we can't install it\n\n if (!isLocadexInstalled) {\n const packageManager = await getPackageManager();\n const spinner = createSpinner();\n spinner.start(\n `Installing locadex as a dev dependency with ${packageManager.name}...`\n );\n await installPackage('locadex', packageManager, true);\n spinner.stop(chalk.green('Installed locadex.'));\n }\n\n i18nCommand(batchSize);\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EACL,aAAa,EAEb,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM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MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,YAAY,CAAC,MAAM,WAAW,CAAC,CAAC,CAAC;QACvE,MAAM,WAAW,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAC7C,CAAC;IAED,wBAAwB;IACxB,MAAM,oBAAoB,CAAC,gBAAgB,EAAE;QAC3C,aAAa,EAAE,IAAI;QACnB,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QACvC,SAAS,EAAE,UAAU;KACtB,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CACZ,qBAAqB,KAAK,CAAC,IAAI,CAC7B,gBAAgB,CACjB,sGAAsG,CACxG,CAAC;IAEF,mCAAmC;IACnC,MAAM,kBAAkB,GAAG,WAAW;QACpC,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC;QACxD,CAAC,CAAC,IAAI,CAAC,CAAC,0CAA0C;IAEpD,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,MAAM,cAAc,GAAG,MAAM,iBAAiB,EAAE,CAAC;QACjD,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CACX,+CAA+C,cAAc,CAAC,IAAI,KAAK,CACxE,CAAC;QACF,MAAM,cAAc,CAAC,SAAS,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,WAAW,CAAC,SAAS,CAAC,CAAC;AACzB,CAAC","debug_id":"a9e98ee6-f615-5247-9ff0-2ab8e30ae2c6"}
|
|
1
|
+
{"version":3,"file":"setup.js","sources":["commands/setup.ts"],"sourceRoot":"/","sourcesContent":["import {\n createSpinner,\n displayHeader,\n promptConfirm,\n} from '../logging/console.js';\nimport { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';\nimport { getPackageManager } 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 { i18nCommand } from './i18n.js';\nimport { validateInitialConfig } from '../utils/validateConfig.js';\nimport { getNextDirectories } from '../utils/fs/getFiles.js';\nimport { LocadexManager } from '../utils/agentManager.js';\nimport { outro } from '@clack/prompts';\n\nexport async function setupCommand(batchSize: number) {\n validateInitialConfig();\n const answer = 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 if (!answer) {\n logger.info('Operation cancelled.');\n process.exit(0);\n }\n\n const packageJson = await getPackageJson();\n const packageManager = await getPackageManager();\n\n const spinner = createSpinner('timer');\n\n spinner.start(`Installing gt-next with ${packageManager.name}...`);\n\n await installPackage('gt-next', packageManager);\n\n spinner.stop(chalk.green('Automatically installed gt-next.'));\n\n const nextConfigPath = findFilepaths([\n './next.config.js',\n './next.config.ts',\n './next.config.mjs',\n './next.config.mts',\n ])[0];\n\n if (!nextConfigPath) {\n logger.error('No next.config.[js|ts|mjs|mts] file found.');\n process.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 JSX content with <T> 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(),\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(chalk.green(`Modified ${filesUpdated.length} files.`));\n // Add the withGTConfig() function to the next.config.js file\n await handleInitGT(nextConfigPath, errors, warnings, filesUpdated);\n logger.step(\n chalk.green(`Added withGTConfig() to your ${nextConfigPath} file.`)\n );\n\n // Create gt.config.json\n await createOrUpdateConfig('gt.config.json', {\n defaultLocale: 'en',\n locales: ['es', 'fr', 'de', 'ja', 'zh'],\n framework: 'next-app',\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 // Install locadex if not installed\n const isLocadexInstalled = packageJson\n ? isPackageInstalled('locadex', packageJson, true, true)\n : true; // if no package.json, we can't install it\n\n if (!isLocadexInstalled) {\n const packageManager = await getPackageManager();\n const spinner = createSpinner();\n spinner.start(\n `Installing locadex as a dev dependency with ${packageManager.name}...`\n );\n await installPackage('locadex', packageManager, true);\n spinner.stop(chalk.green('Installed locadex.'));\n }\n\n // Create manager\n const manager = new LocadexManager({\n mcpTransport: 'sse',\n metadata: {\n batchSize: batchSize,\n },\n });\n\n process.on('beforeExit', () => manager.cleanup());\n\n // Set up locale selector\n await setupLocaleSelector(manager);\n\n const formatter = await detectFormatter();\n if (formatter && filesUpdated.length > 0) {\n await formatFiles(filesUpdated, formatter);\n }\n\n // Run i18n command\n i18nCommand(batchSize, manager);\n}\n\nasync function setupLocaleSelector(manager: LocadexManager) {\n logger.initializeSpinner();\n logger.spinner.start('Creating locale selector...');\n\n // Create agent\n const agent = manager.createAgent();\n\n // Fix prompt\n const localeSelectorPrompt = getLocaleSelectorPrompt();\n try {\n await agent.run({ prompt: localeSelectorPrompt }, {});\n } catch (error) {\n logger.debugMessage(`[setup] Adding locale selector failed: ${error}`);\n outro(chalk.red('❌ Locadex setup failed!'));\n process.exit(1);\n }\n\n logger.spinner.stop('Locale selector setup complete');\n}\n\nfunction getLocaleSelectorPrompt() {\n const prompt = `Here is your task:\n- Please add a locale selector to the project.\n- The locale selector should be a dropdown that allows the user to select the locale.\n\n--- LOCALE SELECTOR USAGE ---\n(1) Import the locale selector component from 'gt-next/client'\n(2) Add the locale selector to the project\n\nFor example:\nimport { LocaleSelector } from 'gt-next/client';\n\nfunction MyComponent() {\n return (\n <div>\n <LocaleSelector />\n <p>Hello, world!</p>\n </div>\n );\n}\n\n--- ADVICE ---\n- The locale selector should be added to a header or footer or some other very obvious place in the project.\n- Scan across files to find the best place to add the locale selector.\n`;\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EACL,aAAa,EAEb,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,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,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OA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AC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,YAAY,CAAC,0CAA0C,KAAK,EAAE,CAAC,CAAC;QACvE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,uBAAuB;IAC9B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBhB,CAAC;IACA,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"e0489702-6a0a-5c5d-b5ec-ab08b146ea98"}
|
|
@@ -9,6 +9,7 @@ export declare function startCommand(message: string): void;
|
|
|
9
9
|
export declare function endCommand(message: string): void;
|
|
10
10
|
export declare function displayHeader(): void;
|
|
11
11
|
export declare function createSpinner(indicator?: 'dots' | 'timer'): import("@clack/prompts").SpinnerResult;
|
|
12
|
+
export declare function createProgressBar(total: number): import("@clack/prompts").ProgressResult;
|
|
12
13
|
export declare function promptText({ message, defaultValue, validate, }: {
|
|
13
14
|
message: string;
|
|
14
15
|
defaultValue?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.d.ts","sourceRoot":"/","sources":["logging/console.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"/","sources":["logging/console.ts"],"names":[],"mappings":"AAkBA,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,EAAE,MAAM,QAEzC;AACD,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,QAEtC;AACD,wBAAgB,UAA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O,EACP,YAAmB,EACnB,aAAqC,GACtC,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,oBAYA;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM;;;;EAE/C"}
|
package/dist/logging/console.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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]="
|
|
3
|
-
import { log, spinner, intro, outro, text, select, confirm, isCancel, cancel, multiselect, taskLog, } from '@clack/prompts';
|
|
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]="23848c69-ab9d-5e02-92d6-6a4df9f5ee39")}catch(e){}}();
|
|
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';
|
|
6
6
|
// Basic logging functions
|
|
@@ -62,6 +62,9 @@ ${chalk.dim('Locadex uses Sentry and PostHog to collect anonymous telemetry data
|
|
|
62
62
|
export function createSpinner(indicator = 'timer') {
|
|
63
63
|
return spinner({ indicator });
|
|
64
64
|
}
|
|
65
|
+
export function createProgressBar(total) {
|
|
66
|
+
return progress({ max: total });
|
|
67
|
+
}
|
|
65
68
|
// Input prompts
|
|
66
69
|
export async function promptText({ message, defaultValue, validate, }) {
|
|
67
70
|
const result = await text({
|
|
@@ -131,4 +134,4 @@ export function createTaskLogger(message) {
|
|
|
131
134
|
return taskLog({ title: message });
|
|
132
135
|
}
|
|
133
136
|
//# sourceMappingURL=console.js.map
|
|
134
|
-
//# debugId=
|
|
137
|
+
//# debugId=23848c69-ab9d-5e02-92d6-6a4df9f5ee39
|