locadex 0.1.13-alpha.1 → 0.1.13-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.
Files changed (39) hide show
  1. package/dist/mcp/tools/validate.d.ts +3 -0
  2. package/dist/mcp/tools/validate.d.ts.map +1 -0
  3. package/dist/mcp/tools/validate.js +37 -0
  4. package/dist/mcp/tools/validate.js.map +1 -0
  5. package/dist/mcp/validateEnv.d.ts +9 -0
  6. package/dist/mcp/validateEnv.d.ts.map +1 -0
  7. package/dist/mcp/validateEnv.js +27 -0
  8. package/dist/mcp/validateEnv.js.map +1 -0
  9. package/dist/{mcp.d.ts → mcp-sse.d.ts} +1 -1
  10. package/dist/mcp-sse.d.ts.map +1 -0
  11. package/dist/{mcp.js → mcp-sse.js} +7 -7
  12. package/dist/mcp-sse.js.map +1 -0
  13. package/dist/mcp-stdio.js +6 -6
  14. package/dist/mcp-stdio.js.map +1 -1
  15. package/dist/prompts/system.d.ts +1 -0
  16. package/dist/prompts/system.d.ts.map +1 -1
  17. package/dist/prompts/system.js +14 -2
  18. package/dist/prompts/system.js.map +1 -1
  19. package/dist/tasks/fixErrors.js +6 -11
  20. package/dist/tasks/fixErrors.js.map +1 -1
  21. package/dist/tasks/i18n.d.ts.map +1 -1
  22. package/dist/tasks/i18n.js +18 -5
  23. package/dist/tasks/i18n.js.map +1 -1
  24. package/dist/tasks/setup.d.ts.map +1 -1
  25. package/dist/tasks/setup.js +9 -3
  26. package/dist/tasks/setup.js.map +1 -1
  27. package/dist/utils/claudeCode.d.ts.map +1 -1
  28. package/dist/utils/claudeCode.js +3 -2
  29. package/dist/utils/claudeCode.js.map +1 -1
  30. package/dist/utils/exec.d.ts +5 -1
  31. package/dist/utils/exec.d.ts.map +1 -1
  32. package/dist/utils/exec.js +17 -11
  33. package/dist/utils/exec.js.map +1 -1
  34. package/dist/utils/locadexManager.d.ts.map +1 -1
  35. package/dist/utils/locadexManager.js +12 -13
  36. package/dist/utils/locadexManager.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/mcp.d.ts.map +0 -1
  39. package/dist/mcp.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function addValidateProjectTool(server: McpServer, appDirectory: string): void;
3
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"/","sources":["mcp/tools/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,MAAM,QA8CrB"}
@@ -0,0 +1,37 @@
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]="a14f788a-86ac-5858-a5a8-21c1ba4a5eb4")}catch(e){}}();
3
+ import { logger } from '../../logging/logger.js';
4
+ import { execFunction } from '../../utils/exec.js';
5
+ export function addValidateProjectTool(server, appDirectory) {
6
+ server.tool('validate-project', 'Validates a project for internationalization errors', {}, async () => {
7
+ try {
8
+ const { stdout, stderr, code } = await execFunction('locadex', ['validate'], false, appDirectory, undefined, 1 * 60 * 1000 // 1 minute
9
+ );
10
+ if (code === 0) {
11
+ logger.log(`[locadex-mcp: validate] Successfully validated project: ${stdout}`);
12
+ return {
13
+ content: [{ type: 'text', text: stdout }],
14
+ };
15
+ }
16
+ else {
17
+ logger.log(`[locadex-mcp: validate] Error validating project: ${stdout} with code ${code}`);
18
+ return {
19
+ content: [{ type: 'text', text: stdout }],
20
+ };
21
+ }
22
+ }
23
+ catch (error) {
24
+ logger.log(`[locadex-mcp: validate] Error validating project: ${error instanceof Error ? error.message : String(error)}`);
25
+ return {
26
+ content: [
27
+ {
28
+ type: 'text',
29
+ text: `Error validating project: ${error instanceof Error ? error.message : String(error)}`,
30
+ },
31
+ ],
32
+ };
33
+ }
34
+ });
35
+ }
36
+ //# sourceMappingURL=validate.js.map
37
+ //# debugId=a14f788a-86ac-5858-a5a8-21c1ba4a5eb4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sources":["mcp/tools/validate.ts"],"sourceRoot":"/","sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { logger } from '../../logging/logger.js';\nimport { execFunction } from '../../utils/exec.js';\n\nexport function addValidateProjectTool(\n server: McpServer,\n appDirectory: string\n) {\n server.tool(\n 'validate-project',\n 'Validates a project for internationalization errors',\n {},\n async () => {\n try {\n const { stdout, stderr, code } = await execFunction(\n 'locadex',\n ['validate'],\n false,\n appDirectory,\n undefined,\n 1 * 60 * 1000 // 1 minute\n );\n if (code === 0) {\n logger.log(\n `[locadex-mcp: validate] Successfully validated project: ${stdout}`\n );\n return {\n content: [{ type: 'text', text: stdout }],\n };\n } else {\n logger.log(\n `[locadex-mcp: validate] Error validating project: ${stdout} with code ${code}`\n );\n return {\n content: [{ type: 'text', text: stdout }],\n };\n }\n } catch (error) {\n logger.log(\n `[locadex-mcp: validate] Error validating project: ${error instanceof Error ? error.message : String(error)}`\n );\n return {\n content: [\n {\n type: 'text',\n text: `Error validating project: ${error instanceof Error ? error.message : String(error)}`,\n },\n ],\n };\n }\n }\n );\n}\n"],"names":[],"mappings":";;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,UAAU,sBAAsB,CACpC,MAAiB,EACjB,YAAoB;IAEpB,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,qDAAqD,EACrD,EAAE,EACF,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,YAAY,CACjD,SAAS,EACT,CAAC,UAAU,CAAC,EACZ,KAAK,EACL,YAAY,EACZ,SAAS,EACT,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,WAAW;aAC1B,CAAC;YACF,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,MAAM,CAAC,GAAG,CACR,2DAA2D,MAAM,EAAE,CACpE,CAAC;gBACF,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iBAC1C,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CACR,qDAAqD,MAAM,cAAc,IAAI,EAAE,CAChF,CAAC;gBACF,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iBAC1C,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,GAAG,CACR,qDAAqD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC9G,CAAC;YACF,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,6BAA6B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC5F;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC","debug_id":"a14f788a-86ac-5858-a5a8-21c1ba4a5eb4"}
@@ -0,0 +1,9 @@
1
+ export type MCPConfig = {
2
+ stateFile: string;
3
+ logFile: string;
4
+ verbose: boolean;
5
+ debug: boolean;
6
+ appDirectory: string;
7
+ };
8
+ export declare function validateEnv(): MCPConfig;
9
+ //# sourceMappingURL=validateEnv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateEnv.d.ts","sourceRoot":"/","sources":["mcp/validateEnv.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,WAAW,IAAI,SAAS,CAsBvC"}
@@ -0,0 +1,27 @@
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]="fded2cd6-ceed-5502-bd33-7b96f213b80b")}catch(e){}}();
3
+ export function validateEnv() {
4
+ const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;
5
+ const logFile = process.env.LOCADEX_LOG_FILE_PATH;
6
+ if (!stateFile) {
7
+ throw new Error('LOCADEX_FILES_STATE_FILE_PATH is not set');
8
+ }
9
+ if (!logFile) {
10
+ throw new Error('LOCADEX_LOG_FILE_PATH is not set');
11
+ }
12
+ const verbose = process.env.LOCADEX_VERBOSE === 'true';
13
+ const debug = process.env.LOCADEX_DEBUG === 'true';
14
+ const appDirectory = process.env.APP_DIRECTORY;
15
+ if (!appDirectory) {
16
+ throw new Error('APP_DIRECTORY is not set');
17
+ }
18
+ return {
19
+ stateFile,
20
+ logFile,
21
+ verbose,
22
+ debug,
23
+ appDirectory,
24
+ };
25
+ }
26
+ //# sourceMappingURL=validateEnv.js.map
27
+ //# debugId=fded2cd6-ceed-5502-bd33-7b96f213b80b
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateEnv.js","sources":["mcp/validateEnv.ts"],"sourceRoot":"/","sourcesContent":["export type MCPConfig = {\n stateFile: string;\n logFile: string;\n verbose: boolean;\n debug: boolean;\n appDirectory: string;\n};\n\nexport function validateEnv(): MCPConfig {\n const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;\n const logFile = process.env.LOCADEX_LOG_FILE_PATH;\n if (!stateFile) {\n throw new Error('LOCADEX_FILES_STATE_FILE_PATH is not set');\n }\n if (!logFile) {\n throw new Error('LOCADEX_LOG_FILE_PATH is not set');\n }\n const verbose = process.env.LOCADEX_VERBOSE === 'true';\n const debug = process.env.LOCADEX_DEBUG === 'true';\n const appDirectory = process.env.APP_DIRECTORY;\n if (!appDirectory) {\n throw new Error('APP_DIRECTORY is not set');\n }\n return {\n stateFile,\n logFile,\n verbose,\n debug,\n appDirectory,\n };\n}\n"],"names":[],"mappings":";;AAQA,MAAM,UAAU,WAAW;IACzB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;IAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAClD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,MAAM,CAAC;IACvD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,CAAC;IACnD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IAC/C,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO;QACL,SAAS;QACT,OAAO;QACP,OAAO;QACP,KAAK;QACL,YAAY;KACb,CAAC;AACJ,CAAC","debug_id":"fded2cd6-ceed-5502-bd33-7b96f213b80b"}
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  export declare function start(): Promise<void>;
3
- //# sourceMappingURL=mcp.d.ts.map
3
+ //# sourceMappingURL=mcp-sse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-sse.d.ts","sourceRoot":"/","sources":["mcp-sse.ts"],"names":[],"mappings":";AAgBA,wBAAsB,KAAK,kBA0E1B"}
@@ -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]="2273bc28-11b6-5867-be6f-9518da4ef279")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fc44876b-0ae4-5975-895b-400e4cdf1431")}catch(e){}}();
4
4
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
5
  import { addDocsTools } from './mcp/tools/docs.js';
6
6
  import { existsSync, readFileSync } from 'node:fs';
@@ -11,13 +11,12 @@ import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
11
11
  import { logger } from './logging/logger.js';
12
12
  import { findAvailablePort } from './mcp/getPort.js';
13
13
  import { exit } from './utils/shutdown.js';
14
+ import { addValidateProjectTool } from './mcp/tools/validate.js';
15
+ import { validateEnv } from './mcp/validateEnv.js';
14
16
  export async function start() {
15
- const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;
16
- const logFile = process.env.LOCADEX_LOG_FILE_PATH;
17
+ const { stateFile, logFile, verbose, debug, appDirectory } = validateEnv();
17
18
  const requestedPort = process.env.PORT ? parseInt(process.env.PORT) : 8888;
18
19
  const port = await findAvailablePort(requestedPort);
19
- const verbose = process.env.LOCADEX_VERBOSE === 'true';
20
- const debug = process.env.LOCADEX_DEBUG === 'true';
21
20
  logger.initialize({ verbose, debug }, logFile);
22
21
  if (stateFile && existsSync(stateFile)) {
23
22
  const state = JSON.parse(readFileSync(stateFile, 'utf8'));
@@ -40,6 +39,7 @@ export async function start() {
40
39
  };
41
40
  addDocsTools(mcpServer);
42
41
  addGuidesTools(mcpServer);
42
+ addValidateProjectTool(mcpServer, appDirectory);
43
43
  // SSE endpoint for legacy clients
44
44
  // Claude Code only supports SSE as of 2025-06-04
45
45
  app.get('/sse', async (req, res) => {
@@ -75,5 +75,5 @@ start().catch(async (error) => {
75
75
  logger.error(`[locadex-mcp] Failed to start: ${error instanceof Error ? error.message : String(error)}`);
76
76
  await exit(1);
77
77
  });
78
- //# sourceMappingURL=mcp.js.map
79
- //# debugId=2273bc28-11b6-5867-be6f-9518da4ef279
78
+ //# sourceMappingURL=mcp-sse.js.map
79
+ //# debugId=fc44876b-0ae4-5975-895b-400e4cdf1431
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-sse.js","sources":["mcp-sse.ts"],"sourceRoot":"/","sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { addDocsTools } from './mcp/tools/docs.js';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { fromPackageRoot, getLocadexVersion } from './utils/getPaths.js';\nimport { addGuidesTools } from './mcp/tools/guides.js';\nimport express from 'express';\nimport { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';\nimport { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';\nimport { logger } from './logging/logger.js';\nimport { findAvailablePort } from './mcp/getPort.js';\nimport { exit } from './utils/shutdown.js';\nimport { addValidateProjectTool } from './mcp/tools/validate.js';\nimport { validateEnv } from './mcp/validateEnv.js';\n\nexport async function start() {\n const { stateFile, logFile, verbose, debug, appDirectory } = validateEnv();\n const requestedPort = process.env.PORT ? parseInt(process.env.PORT) : 8888;\n const port = await findAvailablePort(requestedPort);\n\n logger.initialize({ verbose, debug }, logFile);\n\n if (stateFile && existsSync(stateFile)) {\n const state = JSON.parse(readFileSync(stateFile, 'utf8'));\n logger.debugMessage(\n `[locadex-mcp] state: ${JSON.stringify(state, null, 2)}`\n );\n } else {\n throw new Error(`[locadex-mcp] state file not found: ${stateFile}`);\n }\n\n const mcpServer = new McpServer({\n name: 'Locadex: AI Agent for Internationalization',\n version: JSON.parse(readFileSync(fromPackageRoot('package.json'), 'utf8'))\n .version,\n });\n\n const app = express();\n app.use(express.json());\n\n // Store transports for each session type\n const transports = {\n streamable: {} as Record<string, StreamableHTTPServerTransport>,\n sse: {} as Record<string, SSEServerTransport>,\n };\n\n addDocsTools(mcpServer);\n addGuidesTools(mcpServer);\n addValidateProjectTool(mcpServer, appDirectory);\n\n // SSE endpoint for legacy clients\n // Claude Code only supports SSE as of 2025-06-04\n app.get('/sse', async (req, res) => {\n const transport = new SSEServerTransport('/messages', res);\n transports.sse[transport.sessionId] = transport;\n\n res.on('close', () => {\n logger.log(\n `[locadex-mcp] SSE transport closed for sessionId: ${transport.sessionId}`\n );\n delete transports.sse[transport.sessionId];\n });\n\n await mcpServer.connect(transport);\n });\n\n // Companion endpoint for sending messages\n app.post('/messages', async (req, res) => {\n const sessionId = req.query.sessionId as string;\n const transport = transports.sse[sessionId];\n if (transport) {\n await transport.handlePostMessage(req, res, req.body);\n } else {\n logger.log(\n `[locadex-mcp] No transport found for sessionId: ${sessionId}`\n );\n res.status(400).send('No transport found for sessionId');\n }\n });\n\n app.listen(port, () => {\n const portMessage =\n port !== requestedPort\n ? `${port} (requested ${requestedPort} was in use)`\n : `${port}`;\n logger.debugMessage(\n `[locadex-mcp v${getLocadexVersion()}] started on port ${portMessage} with state file ${stateFile}`\n );\n });\n}\n\n// Start the SSE server\nstart().catch(async (error) => {\n logger.error(\n `[locad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AAC,EAAE,CAC3F,CAAC;IACF,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC,CAAC","debug_id":"fc44876b-0ae4-5975-895b-400e4cdf1431"}
package/dist/mcp-stdio.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]="eca8e05e-4313-51cf-877c-e042ba0d08c0")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="130ecd64-a194-55ed-88c3-852d070aa468")}catch(e){}}();
4
4
  import './telemetry.js';
5
5
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
6
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -9,11 +9,10 @@ import { existsSync, readFileSync } from 'node:fs';
9
9
  import { fromPackageRoot } from './utils/getPaths.js';
10
10
  import { addGuidesTools } from './mcp/tools/guides.js';
11
11
  import { logger } from './logging/logger.js';
12
+ import { addValidateProjectTool } from './mcp/tools/validate.js';
13
+ import { validateEnv } from './mcp/validateEnv.js';
12
14
  async function main() {
13
- const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;
14
- const logFile = process.env.LOCADEX_LOG_FILE_PATH;
15
- const verbose = process.env.LOCADEX_VERBOSE === 'true';
16
- const debug = process.env.LOCADEX_DEBUG === 'true';
15
+ const { stateFile, logFile, verbose, debug, appDirectory } = validateEnv();
17
16
  logger.initialize({ verbose, debug }, logFile);
18
17
  if (stateFile && existsSync(stateFile)) {
19
18
  const state = JSON.parse(readFileSync(stateFile, 'utf8'));
@@ -29,6 +28,7 @@ async function main() {
29
28
  });
30
29
  addDocsTools(server);
31
30
  addGuidesTools(server);
31
+ addValidateProjectTool(server, appDirectory);
32
32
  logger.log('[locadex-mcp] All tools registered');
33
33
  const transport = new StdioServerTransport();
34
34
  await server.connect(transport);
@@ -36,4 +36,4 @@ async function main() {
36
36
  }
37
37
  main();
38
38
  //# sourceMappingURL=mcp-stdio.js.map
39
- //# debugId=eca8e05e-4313-51cf-877c-e042ba0d08c0
39
+ //# debugId=130ecd64-a194-55ed-88c3-852d070aa468
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-stdio.js","sources":["mcp-stdio.ts"],"sourceRoot":"/","sourcesContent":["#!/usr/bin/env node\n\nimport './telemetry.js';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { addDocsTools } from './mcp/tools/docs.js';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { fromPackageRoot } from './utils/getPaths.js';\nimport { addGuidesTools } from './mcp/tools/guides.js';\nimport { logger } from './logging/logger.js';\n\nasync function main() {\n const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;\n const logFile = process.env.LOCADEX_LOG_FILE_PATH;\n const verbose = process.env.LOCADEX_VERBOSE === 'true';\n const debug = process.env.LOCADEX_DEBUG === 'true';\n\n logger.initialize({ verbose, debug }, logFile);\n\n if (stateFile && existsSync(stateFile)) {\n const state = JSON.parse(readFileSync(stateFile, 'utf8'));\n logger.log(`[locadex-mcp] state: ${JSON.stringify(state, null, 2)}`);\n } else {\n throw new Error(`[locadex-mcp] state file not found: ${stateFile}`);\n }\n\n const server = new McpServer({\n name: 'Locadex: AI Agent for Internationalization',\n version: JSON.parse(readFileSync(fromPackageRoot('package.json'), 'utf8'))\n .version,\n });\n\n addDocsTools(server);\n addGuidesTools(server);\n\n logger.log('[locadex-mcp] All tools registered');\n const transport = new StdioServerTransport();\n await server.connect(transport);\n logger.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CAAC;QAC3B,IAAI,EAAE,4CAA4C;QAClD,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;aACvE,OAAO;KACX,CAAC,CAAC;IAEH,YAAY,CAAC,MAAM,CAAC,CAAC;IACrB,cAAc,CAAC,MAAM,CAAC,CAAC;IAEvB,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAC/C,CAAC;AACD,IAAI,EAAE,CAAC","debug_id":"eca8e05e-4313-51cf-877c-e042ba0d08c0"}
1
+ {"version":3,"file":"mcp-stdio.js","sources":["mcp-stdio.ts"],"sourceRoot":"/","sourcesContent":["#!/usr/bin/env node\n\nimport './telemetry.js';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { addDocsTools } from './mcp/tools/docs.js';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { fromPackageRoot } from './utils/getPaths.js';\nimport { addGuidesTools } from './mcp/tools/guides.js';\nimport { logger } from './logging/logger.js';\nimport { addValidateProjectTool } from './mcp/tools/validate.js';\nimport { validateEnv } from './mcp/validateEnv.js';\n\nasync function main() {\n const { stateFile, logFile, verbose, debug, appDirectory } = validateEnv();\n logger.initialize({ verbose, debug }, logFile);\n\n if (stateFile && existsSync(stateFile)) {\n const state = JSON.parse(readFileSync(stateFile, 'utf8'));\n logger.log(`[locadex-mcp] state: ${JSON.stringify(state, null, 2)}`);\n } else {\n throw new Error(`[locadex-mcp] state file not found: ${stateFile}`);\n }\n\n const server = new McpServer({\n name: 'Locadex: AI Agent for Internationalization',\n version: JSON.parse(readFileSync(fromPackageRoot('package.json'), 'utf8'))\n .version,\n });\n\n addDocsTools(server);\n addGuidesTools(server);\n addValidateProjectTool(server, appDirectory);\n\n logger.log('[locadex-mcp] All tools registered');\n const transport = new StdioServerTransport();\n await server.connect(transport);\n logger.log('[locadex-mcp] started on stdio');\n}\nmain();\n"],"names":[],"mappings":";;;AAEA,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,WAAW,EAAE,CAAC;IAC3E,MAAM,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;IAE/C,IAAI,SAAS,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1D,MAAM,CAAC,GAAG,CAAC,wBAAwB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,uCAAuC,SAAS,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,4CAA4C;QAClD,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;aACvE,OAAO;KACX,CAAC,CAAC;IAEH,YAAY,CAAC,MAAM,CAAC,CAAC;IACrB,cAAc,CAAC,MAAM,CAAC,CAAC;IACvB,sBAAsB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAE7C,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,MAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAC/C,CAAC;AACD,IAAI,EAAE,CAAC","debug_id":"130ecd64-a194-55ed-88c3-852d070aa468"}
@@ -1,4 +1,5 @@
1
1
  export declare const mcpDocsTools: string[];
2
2
  export declare const mcpGuidesTools: string[];
3
3
  export declare const allMcpPrompt: string;
4
+ export declare const allMcpPromptFixErrors: string;
4
5
  //# sourceMappingURL=system.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.d.ts","sourceRoot":"/","sources":["prompts/system.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,UAExB,CAAC;AAEF,eAAO,MAAM,cAAc,UAE1B,CAAC;AAEF,eAAO,MAAM,YAAY,QAQiJ,CAAC"}
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"/","sources":["prompts/system.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,UAExB,CAAC;AAEF,eAAO,MAAM,cAAc,UAE1B,CAAC;AAEF,eAAO,MAAM,YAAY,QAQiJ,CAAC;AAE3K,eAAO,MAAM,qBAAqB,QAWwI,CAAC"}
@@ -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]="1e9e969a-185e-5a86-a7a7-a61c5b750119")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f049faca-f704-566a-abda-540d7a59c61a")}catch(e){}}();
3
3
  import { guides } from '../mcp/tools/guides.js';
4
4
  import { docsTools } from '../mcp/tools/docs.js';
5
5
  export const mcpDocsTools = Object.keys(docsTools).map((tool) => `mcp__locadex__${tool}`);
@@ -12,6 +12,18 @@ ${mcpDocsTools.join('\n')}
12
12
  ## Guide Tools:
13
13
  ${mcpGuidesTools.join('\n')}
14
14
 
15
+ Generally, you should use the guides tools to help you with your tasks. You should only call the docs tools when you need specific information not covered by the guides.`;
16
+ export const allMcpPromptFixErrors = `You have access to mcp tools made available via the 'locadex' mcp server:
17
+
18
+ ## Documentation Tools:
19
+ ${mcpDocsTools.join('\n')}
20
+
21
+ ## Guide Tools:
22
+ ${mcpGuidesTools.join('\n')}
23
+
24
+ ## Validation Tools:
25
+ mcp__locadex__validate-project
26
+
15
27
  Generally, you should use the guides tools to help you with your tasks. You should only call the docs tools when you need specific information not covered by the guides.`;
16
28
  //# sourceMappingURL=system.js.map
17
- //# debugId=1e9e969a-185e-5a86-a7a7-a61c5b750119
29
+ //# debugId=f049faca-f704-566a-abda-540d7a59c61a
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sources":["prompts/system.ts"],"sourceRoot":"/","sourcesContent":["import { guides } from '../mcp/tools/guides.js';\nimport { docsTools } from '../mcp/tools/docs.js';\n\nexport const mcpDocsTools = Object.keys(docsTools).map(\n (tool) => `mcp__locadex__${tool}`\n);\n\nexport const mcpGuidesTools = guides.map(\n (guide) => `mcp__locadex__${guide.id}`\n);\n\nexport const allMcpPrompt = `You have access to mcp tools made available via the 'locadex' mcp server:\n\n## Documentation Tools:\n${mcpDocsTools.join('\\n')}\n\n## Guide Tools:\n${mcpGuidesTools.join('\\n')}\n\nGenerally, you should use the guides tools to help you with your tasks. You should only call the docs tools when you need specific information not covered by the guides.`;\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CACpD,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,IAAI,EAAE,CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CACtC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,KAAK,CAAC,EAAE,EAAE,CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;;;EAG1B,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;;;EAGvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;;0KAE+I,CAAC","debug_id":"1e9e969a-185e-5a86-a7a7-a61c5b750119"}
1
+ {"version":3,"file":"system.js","sources":["prompts/system.ts"],"sourceRoot":"/","sourcesContent":["import { guides } from '../mcp/tools/guides.js';\nimport { docsTools } from '../mcp/tools/docs.js';\n\nexport const mcpDocsTools = Object.keys(docsTools).map(\n (tool) => `mcp__locadex__${tool}`\n);\n\nexport const mcpGuidesTools = guides.map(\n (guide) => `mcp__locadex__${guide.id}`\n);\n\nexport const allMcpPrompt = `You have access to mcp tools made available via the 'locadex' mcp server:\n\n## Documentation Tools:\n${mcpDocsTools.join('\\n')}\n\n## Guide Tools:\n${mcpGuidesTools.join('\\n')}\n\nGenerally, you should use the guides tools to help you with your tasks. You should only call the docs tools when you need specific information not covered by the guides.`;\n\nexport const allMcpPromptFixErrors = `You have access to mcp tools made available via the 'locadex' mcp server:\n\n## Documentation Tools:\n${mcpDocsTools.join('\\n')}\n\n## Guide Tools:\n${mcpGuidesTools.join('\\n')}\n\n## Validation Tools:\nmcp__locadex__validate-project\n\nGenerally, you should use the guides tools to help you with your tasks. You should only call the docs tools when you need specific information not covered by the guides.`;\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CACpD,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,IAAI,EAAE,CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CACtC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,KAAK,CAAC,EAAE,EAAE,CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;;;EAG1B,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;;;EAGvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;;0KAE+I,CAAC;AAE3K,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;EAGnC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;;;EAGvB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;0KAK+I,CAAC","debug_id":"f049faca-f704-566a-abda-540d7a59c61a"}
@@ -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]="41e4d0d1-d9df-5b7c-a175-e144207cf63e")}catch(e){}}();
3
- import { allMcpPrompt } from '../prompts/system.js';
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]="75d184a3-1343-57e6-abe7-ee95709748cf")}catch(e){}}();
3
+ import { allMcpPromptFixErrors } from '../prompts/system.js';
4
4
  import { exit } from '../utils/shutdown.js';
5
5
  import { logger } from '../logging/logger.js';
6
6
  import { LocadexManager } from '../utils/locadexManager.js';
@@ -44,7 +44,7 @@ function getFixPrompt(appDirectory) {
44
44
 
45
45
  ## INSTRUCTIONS
46
46
 
47
- Previously, you helped me internationalize a set of files in this project.
47
+ Previously, you helped me internationalize a set of files in this project (app directory: "${appDirectory}").
48
48
  Your new task is to fix any errors that were introduced by your previous implementation.
49
49
  You should only fix errors that the gt-next validator has identified.
50
50
 
@@ -53,9 +53,7 @@ You should only fix errors that the gt-next validator has identified.
53
53
  2. Fix all errors output by the gt-next validator.
54
54
  3. Repeat steps 1-2 until there are no more errors, or until you believe that you have fixed all errors.
55
55
 
56
- To run the gt-next validator, run the following command from the app root directory:
57
- 'locadex validate' (global command)
58
- The app root is: "${appDirectory}"
56
+ To run the gt-next validator, call the 'mcp__locadex__validate-project' tool.
59
57
 
60
58
  ## RULES:
61
59
  - ONLY modify files that are relevant to the internationalization of the project.
@@ -66,13 +64,10 @@ The app root is: "${appDirectory}"
66
64
  - NEVER move content to a different file. All content MUST remain in the same file where it came from.
67
65
  - NEVER CREATE OR DELETE ANY FILES (especially .bak files)
68
66
  - NEVER try running build commands (for example, 'next dev' or 'next build')
69
- - YOU MAY NOT RUN ANY COMMANDS THAT ARE NOT LISTED BELOW:
70
- - 'locadex validate'
71
- - 'tsc --noEmit'
72
67
 
73
68
  ## MCP TOOLS
74
69
 
75
- ${allMcpPrompt}
70
+ ${allMcpPromptFixErrors}
76
71
 
77
72
  ## Final output
78
73
  - When you are done, please return a brief summary of the files you modified, following this format.
@@ -85,4 +80,4 @@ ${allMcpPrompt}
85
80
  return prompt;
86
81
  }
87
82
  //# sourceMappingURL=fixErrors.js.map
88
- //# debugId=41e4d0d1-d9df-5b7c-a175-e144207cf63e
83
+ //# debugId=75d184a3-1343-57e6-abe7-ee95709748cf
@@ -1 +1 @@
1
- {"version":3,"file":"fixErrors.js","sources":["tasks/fixErrors.ts"],"sourceRoot":"/","sourcesContent":["import { allMcpPrompt } from '../prompts/system.js';\nimport { exit } from '../utils/shutdown.js';\nimport { logger } from '../logging/logger.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { CLAUDE_CODE_VERSION } from '../utils/shared.js';\nimport { installGlobalPackage } from '../utils/packages/installPackage.js';\n\nexport async function fixErrorsTask() {\n const manager = LocadexManager.getInstance();\n const reports: string[] = [];\n // Install claude-code if not installed\n await installGlobalPackage('@anthropic-ai/claude-code', CLAUDE_CODE_VERSION);\n\n // Create a clean agent for cleanup\n const cleanupAgent = manager.createSingleAgent('claude_cleanup_agent', {});\n\n logger.initializeSpinner();\n logger.spinner.start('Fixing errors...');\n const fixPrompt = getFixPrompt(manager.appDirectory);\n try {\n await cleanupAgent.run(\n fixPrompt,\n {\n maxTurns: 200,\n timeoutSec: 300,\n maxRetries: 2,\n },\n {}\n );\n reports.push(`## Fixed errors\\n${cleanupAgent.generateReport()}`);\n } catch (error) {\n cleanupAgent.aggregateStats();\n logger.debugMessage(\n `[claude_cleanup_agent] Fixing errors failed: ${error}`\n );\n manager.stats.recordTelemetry(false);\n outro(chalk.red('❌ Locadex i18n failed!'));\n await exit(1);\n return;\n }\n cleanupAgent.aggregateStats();\n logger.spinner.stop('Fixed errors');\n return reports;\n}\n\n// check (dry run and ts check) should be at the end\n\nfunction getFixPrompt(appDirectory: string) {\n const prompt = `# Task: Fix internationalization errors in the project.\n\n## INSTRUCTIONS\n\nPreviously, you helped me internationalize a set of files in this project.\nYour new task is to fix any errors that were introduced by your previous implementation.\nYou should only fix errors that the gt-next validator has identified.\n\n## Steps:\n1. Run the gt-next validator.\n2. Fix all errors output by the gt-next validator.\n3. Repeat steps 1-2 until there are no more errors, or until you believe that you have fixed all errors.\n\nTo run the gt-next validator, run the following command from the app root directory:\n'locadex validate' (global command)\nThe app root is: \"${appDirectory}\"\n\n## RULES:\n- ONLY modify files that are relevant to the internationalization of the project.\n- ONLY fix errors that the gt-next validator has identified.\n- Resolve missing imports from 'gt-next'. If a file is missing an import from 'gt-next', add it.\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- NEVER move content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR DELETE ANY FILES (especially .bak files)\n- NEVER try running build commands (for example, 'next dev' or 'next build')\n- YOU MAY NOT RUN ANY COMMANDS THAT ARE NOT LISTED BELOW:\n - 'locadex validate'\n - 'tsc --noEmit'\n\n## MCP TOOLS\n\n${allMcpPrompt}\n\n## Final output\n- When you are done, please return a brief summary of the files you modified, following this format.\n- **DO NOT** include any other text in your response. \n- If there were issues with some files, please include the issues in the list of changes for that file.\n\n[file 1 path]\n- List of changes to file 1\n`;\n\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,MAAM,C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G;;;;;;;;;;;;;;;oBAeG,YAAY;;;;;;;;;;;;;;;;;EAiB9B,YAAY;;;;;;;;;CASb,CAAC;IAEA,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"41e4d0d1-d9df-5b7c-a175-e144207cf63e"}
1
+ {"version":3,"file":"fixErrors.js","sources":["tasks/fixErrors.ts"],"sourceRoot":"/","sourcesContent":["import { allMcpPromptFixErrors } from '../prompts/system.js';\nimport { exit } from '../utils/shutdown.js';\nimport { logger } from '../logging/logger.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { CLAUDE_CODE_VERSION } from '../utils/shared.js';\nimport { installGlobalPackage } from '../utils/packages/installPackage.js';\n\nexport async function fixErrorsTask() {\n const manager = LocadexManager.getInstance();\n const reports: string[] = [];\n // Install claude-code if not installed\n await installGlobalPackage('@anthropic-ai/claude-code', CLAUDE_CODE_VERSION);\n\n // Create a clean agent for cleanup\n const cleanupAgent = manager.createSingleAgent('claude_cleanup_agent', {});\n\n logger.initializeSpinner();\n logger.spinner.start('Fixing errors...');\n const fixPrompt = getFixPrompt(manager.appDirectory);\n try {\n await cleanupAgent.run(\n fixPrompt,\n {\n maxTurns: 200,\n timeoutSec: 300,\n maxRetries: 2,\n },\n {}\n );\n reports.push(`## Fixed errors\\n${cleanupAgent.generateReport()}`);\n } catch (error) {\n cleanupAgent.aggregateStats();\n logger.debugMessage(\n `[claude_cleanup_agent] Fixing errors failed: ${error}`\n );\n manager.stats.recordTelemetry(false);\n outro(chalk.red('❌ Locadex i18n failed!'));\n await exit(1);\n return;\n }\n cleanupAgent.aggregateStats();\n logger.spinner.stop('Fixed errors');\n return reports;\n}\n\n// check (dry run and ts check) should be at the end\n\nfunction getFixPrompt(appDirectory: string) {\n const prompt = `# Task: Fix internationalization errors in the project.\n\n## INSTRUCTIONS\n\nPreviously, you helped me internationalize a set of files in this project (app directory: \"${appDirectory}\").\nYour new task is to fix any errors that were introduced by your previous implementation.\nYou should only fix errors that the gt-next validator has identified.\n\n## Steps:\n1. Run the gt-next validator.\n2. Fix all errors output by the gt-next validator.\n3. Repeat steps 1-2 until there are no more errors, or until you believe that you have fixed all errors.\n\nTo run the gt-next validator, call the 'mcp__locadex__validate-project' tool.\n\n## RULES:\n- ONLY modify files that are relevant to the internationalization of the project.\n- ONLY fix errors that the gt-next validator has identified.\n- Resolve missing imports from 'gt-next'. If a file is missing an import from 'gt-next', add it.\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- NEVER move content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR DELETE ANY FILES (especially .bak files)\n- NEVER try running build commands (for example, 'next dev' or 'next build')\n\n## MCP TOOLS\n\n${allMcpPromptFixErrors}\n\n## Final output\n- When you are done, please return a brief summary of the files you modified, following this format.\n- **DO NOT** include any other text in your response. \n- If there were issues with some files, please include the issues in the list of changes for that file.\n\n[file 1 path]\n- List of changes to file 1\n`;\n\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAC7C,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,uCAAuC;IACvC,MAAM,oBAAoB,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ee95709748cf"}
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["tasks/i18n.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,UAAU,EAAE,UAAU,iBA4NpD"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["tasks/i18n.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,UAAU,EAAE,UAAU,iBAyOpD"}
@@ -1,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]="2dce1901-ae4e-5ffd-9874-15168322869f")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d655e317-abac-5345-8a2c-ea1e6a0ca6f0")}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';
@@ -128,7 +128,13 @@ ${reports.join('\n')}`;
128
128
  logger.step(`Saved summary of changes to: ${summaryFilePath}`);
129
129
  // cleanup
130
130
  if (cliOptions.formatCmd) {
131
- await execFunction(cliOptions.formatCmd, [], false, manager.appDirectory, manager.getAgentAbortController());
131
+ const { stderr, code } = await execFunction(cliOptions.formatCmd, [], false, manager.appDirectory, manager.getAgentAbortController());
132
+ if (code !== 0) {
133
+ logger.error(`Error running '${cliOptions.formatCmd}': ${stderr}`);
134
+ }
135
+ else {
136
+ logger.step(`Formatted ${files.length} files with ${cliOptions.formatCmd}`);
137
+ }
132
138
  }
133
139
  else {
134
140
  const formatter = await detectFormatter();
@@ -151,8 +157,15 @@ ${reports.join('\n')}`;
151
157
  try {
152
158
  logger.initializeSpinner();
153
159
  logger.spinner.start('Running locadex translate...');
154
- await execFunction('locadex', ['translate'], false, manager.appDirectory, manager.getAgentAbortController());
155
- logger.spinner.stop('Translations generated!');
160
+ const { stderr, code } = await execFunction('locadex', ['translate'], false, manager.appDirectory, manager.getAgentAbortController());
161
+ if (code !== 0) {
162
+ logger.spinner.stop('Translations failed!');
163
+ logger.error(`Error running 'locadex translate': ${stderr}`);
164
+ }
165
+ else {
166
+ logger.spinner.stop('Translations generated!');
167
+ logger.log(`Translations generated with 'locadex translate'`);
168
+ }
156
169
  }
157
170
  catch (error) {
158
171
  logger.spinner.stop('Translations failed!');
@@ -243,4 +256,4 @@ ${allMcpPrompt}
243
256
  return prompt;
244
257
  }
245
258
  //# sourceMappingURL=i18n.js.map
246
- //# debugId=2dce1901-ae4e-5ffd-9874-15168322869f
259
+ //# debugId=d655e317-abac-5345-8a2c-ea1e6a0ca6f0
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sources":["tasks/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { createSpinner } from '../logging/console.js';\nimport { allMcpPrompt } from '../prompts/system.js';\nimport { exit } from '../utils/shutdown.js';\nimport { logger } from '../logging/logger.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport {\n addFilesToManager,\n markFileAsEdited,\n markFileAsInProgress,\n} from '../utils/dag/getFiles.js';\nimport { runParallelProcessing, TaskProcessor } from './concurrency.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { appendFileSync } from 'node:fs';\nimport { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';\nimport path from 'node:path';\nimport { updateLockfile, cleanupLockfile } from '../utils/lockfile.js';\nimport { extractFiles } from '../utils/dag/extractFiles.js';\nimport { Dag } from '../utils/dag/createDag.js';\nimport { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';\nimport { deleteAddedFiles } from '../utils/fs/git.js';\nimport { CLAUDE_CODE_VERSION } from '../utils/shared.js';\nimport { installGlobalPackage } from '../utils/packages/installPackage.js';\nimport { fixErrorsTask } from './fixErrors.js';\nimport { getLocadexVersion } from '../utils/getPaths.js';\nimport { execFunction } from '../utils/exec.js';\nimport { isGTAuthConfigured } from '../utils/config.js';\nimport { CliOptions } from '../types/cli.js';\n\n/**\n * Run Locadex i18n on the project\n * This task requires no human intervention and is safe to run in CI/CD pipelines.\n */\nexport async function i18nTask(cliOptions: CliOptions) {\n const manager = LocadexManager.getInstance();\n // have to use the package.json from the appDir\n const packageJson = await getPackageJson(manager.appDirectory);\n const isUsingGTNext = packageJson\n ? isPackageInstalled('gt-next', packageJson)\n : false;\n if (!isUsingGTNext) {\n logger.error(\n `gt-next not detected in ${manager.appDirectory}. Please specify the correct app directory with the --app-dir flag, or ensure that gt-next is correctly installed in the project.`\n );\n await exit(1);\n }\n\n // Install claude-code if not installed\n await installGlobalPackage('@anthropic-ai/claude-code', CLAUDE_CODE_VERSION);\n // Install locadex if not installed\n await installGlobalPackage('locadex', getLocadexVersion());\n\n logger.debugMessage('App directory: ' + manager.appDirectory);\n logger.debugMessage('Root directory: ' + manager.rootDirectory);\n\n // Init message\n const spinner = createSpinner();\n spinner.start('Initializing Locadex...');\n\n const { files, dag } = extractFiles(manager);\n\n if (files.length === 0) {\n spinner.stop('No files have changed since last run');\n outro(chalk.green('✅ Locadex i18n complete - no changes detected!'));\n await exit(0);\n }\n\n const filesStateFilePath = manager.getFilesStateFilePath();\n const concurrency = manager.getMaxConcurrency();\n const batchSize = manager.getBatchSize();\n\n // Create the list of files (aka tasks) to process\n const taskQueue = Array.from(files);\n\n // Add files to manager\n const stateFilePath = addFilesToManager(filesStateFilePath, taskQueue);\n spinner.stop('Locadex initialized');\n\n logger.verboseMessage(`Processing ${files.length} modified files`);\n logger.debugMessage(`Track progress here: ${stateFilePath}`);\n logger.debugMessage(`Order:\\n${taskQueue.join('\\n')}`);\n\n logger.message(`Using ${concurrency} concurrent agents`);\n logger.initializeProgressBar(taskQueue.length);\n\n const fileProcessingStartTime = Date.now();\n logger.progressBar.start(`Processing ${taskQueue.length} files...`);\n\n // Shared reports array for collecting results\n const reports: string[] = [];\n\n // Create i18n task processor\n const i18nProcessor: TaskProcessor<\n string,\n {\n dag: Dag;\n files: string[];\n filesStateFilePath: string;\n }\n > = {\n preProcess: async (files, context) => {\n const { dag, filesStateFilePath } = context;\n logger.debugMessage(`Files: ${files.join(', ')}`);\n // Mark tasks as in progress\n await Promise.all(\n files.map((file) => markFileAsInProgress(file, filesStateFilePath))\n );\n\n // Construct prompt\n const dependencies = Object.fromEntries(\n files.map((file) => [\n file,\n Array.from(new Set(dag.getDependencies(file))).map(String),\n ])\n );\n const dependents = Object.fromEntries(\n files.map((file) => [\n file,\n Array.from(new Set(dag.getDependents(file))).map(String),\n ])\n );\n\n return getPrompt({\n targetFile: files,\n dependencyFiles: dependencies,\n dependentFiles: dependents,\n });\n },\n postProcess: async (processedFiles, context, agentReport) => {\n const { filesStateFilePath } = context;\n\n // Mark tasks as complete\n await Promise.all(\n processedFiles.map((file) => markFileAsEdited(file, filesStateFilePath))\n );\n\n // Add agent report\n reports.push(agentReport);\n\n // Update stats\n manager.stats.updateStats({\n newProcessedFiles: processedFiles.length,\n });\n\n // Update progress bar\n logger.progressBar.advance(\n processedFiles.length,\n `Processed ${Number((manager.stats.getStats().processedFiles / files.length) * 100).toFixed(2)}% of files`\n );\n },\n };\n\n // Run parallel processing\n await runParallelProcessing(\n Array.from(taskQueue),\n i18nProcessor,\n { dag, files, filesStateFilePath },\n {\n concurrency,\n batchSize,\n },\n 3\n );\n\n if (manager.isAborted()) {\n cleanupOnExit();\n await exit(1);\n return;\n }\n\n logger.progressBar.stop(\n `Processed ${files.length} files [${Math.round(\n (Date.now() - fileProcessingStartTime) / 1000\n )}s]`\n );\n\n const cleanupReports = await fixErrorsTask();\n if (cleanupReports) {\n reports.push(...cleanupReports);\n }\n\n // Generate report\n const reportSummary = `# Summary of locadex i18n changes\n${reports.join('\\n')}`;\n const summaryFilePath = path.join(\n manager.getLogDirectory(),\n 'locadex-report.md'\n );\n appendFileSync(summaryFilePath, reportSummary);\n logger.step(`Saved summary of changes to: ${summaryFilePath}`);\n\n // cleanup\n if (cliOptions.formatCmd) {\n await execFunction(\n cliOptions.formatCmd,\n [],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n } else {\n const formatter = await detectFormatter();\n if (formatter && files.length > 0) {\n await formatFiles(files, formatter);\n logger.log(`Formatted ${files.length} files with ${formatter}`);\n }\n }\n\n const lockfilePath = manager.getLockFilePath();\n\n // Delete any files the AI may have arbitrarily created\n deleteAddedFiles(\n [path.relative(manager.rootDirectory, manager.locadexDirectory)],\n ['dictionary.json', 'gt.config.json', 'locadex.yml']\n );\n\n // Update lockfile with processed files\n updateLockfile(files, lockfilePath, manager.rootDirectory);\n\n // Clean up stale entries from lockfile\n cleanupLockfile(lockfilePath, manager.rootDirectory);\n\n logger.message(chalk.dim(`Updated lockfile with ${files.length} files`));\n\n cleanupOnExit();\n\n // Run translate cmd\n if (isGTAuthConfigured(manager.appDirectory) && !cliOptions.noTranslate) {\n try {\n logger.initializeSpinner();\n logger.spinner.start('Running locadex translate...');\n await execFunction(\n 'locadex',\n ['translate'],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n logger.spinner.stop('Translations generated!');\n } catch (error) {\n logger.spinner.stop('Translations failed!');\n logger.error(\n `Error running 'locadex translate': ${(error as Error).message}`\n );\n }\n } else {\n logger.step(\n `No GT_API_KEY or GT_PROJECT_ID found. Skipping translation step...`\n );\n }\n\n outro(chalk.green('✅ Locadex i18n complete!'));\n await exit(0);\n}\n\nfunction cleanupOnExit() {\n const manager = LocadexManager.getInstance();\n logger.info(\n chalk.dim(\n `Locadex Cost: $${manager.stats.getStats().totalCost.toFixed(2)}\nLocadex wall time: ${Math.round(\n (Date.now() - manager.stats.getStats().startTime) / 1000\n )}s\nLocadex files processed: ${manager.stats.getStats().processedFiles}`\n )\n );\n\n const finalStats = manager.stats.getStats();\n\n // Record telemetry for final stats\n manager.stats.recordTelemetry(true);\n\n logger.verboseMessage(\n `Locadex input tokens: ${finalStats.inputTokens}\nLocadex cached input tokens: ${finalStats.cachedInputTokens}\nLocadex output tokens: ${finalStats.outputTokens}\nLocadex turns: ${finalStats.turns}`\n );\n}\n\nfunction getPrompt({\n targetFile,\n dependencyFiles,\n dependentFiles,\n}: {\n targetFile: string[];\n dependencyFiles: Record<string, string[]>;\n dependentFiles: Record<string, string[]>;\n}) {\n const prompt = `# Task: Internationalize the target file(s) using gt-next.\n\n## INSTRUCTIONS\n\n- You are given a list of target files and their corresponding dependency/dependent files.\n- The project is already setup for internationalization. Do not try to setup the project again for i18n.\n\n## Workflow:\n1. **Gather context** Read the target files closely \n - You do not have to read the dependency/dependent files for each target file. They are provided for convenience.\n2. **Evaluate if i18n is necessary** Evaluate if the target files need to be internationalized using gt-next \n - If the target files have no relevant content, are already internationalized, or contain build-time code (e.g. nextjs plugins) they should never be internationalized.\n**IMPORTANT**: IF NONE OF THE TARGET FILES NEED TO BE INTERNATIONALIZED, YOUR TASK IS COMPLETE AND YOU MAY RETURN.\n3. **Identify the tools to use** Given the contents of the files, ask yourself which tools and guides you need to use to get the necessary knowledge to internationalize the target files. Here are some helpful questions to evaluate for tool selection:\n - 3.a. Is the content that needs to be i18ned being used in this same file, or is it being used in another file?\n - 3.b. Is there any string interpolation that needs to be i18ned?\n - 3.c. Is there any conditional logic or rendering that needs to be i18ned?\n - 3.d. Is the content that needs to be i18ned HTML/JSX or a string?\n4. **Internationalize** You now have the necessary knowledge. Internationalize the files using the information from the tools provided to you.\n - 4.a. Do not run validation checks such as tsc. We will do that later.\n\n## RULES:\n- ALWAYS use the <T> component to internationalize HTML/JSX content.\n- ALWAYS use useGT() or useTranslations() to internationalize string content (strings created with '', \"\", or \\`\\`).\n - When possible, avoid using useTranslations(); useGT() is always preferred.\n- DO NOT internationalize non-user facing content or content that is functional, such as ids, class names, error strings, logical strings, etc.\n- Do not add i18n middleware to the app.\n- ALWAYS adhere to the guides provided via the 'mcp__locadex__*' tools.\n - These guides provide additional knowledge about how to internationalize the content.\n- Minimize the footprint of your changes.\n- Focus on internationalizing all user facing content in the target files. \n- NEVER move content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR DELETE ANY FILES (especially .bak files)\n- NEVER EDIT FILES THAT ARE NOT GIVEN TO YOU.\n\n## TARGET FILE INFORMATION\n${targetFile.map(\n (file, index) => `\nTARGET FILE ${index + 1}:\n${file}\n\nDEPENDENCY FILES (files imported by target file ${index + 1}):\n${dependencyFiles[file].length > 0 ? ` ${dependencyFiles[file].join(', ')}` : 'none'}\n\nDEPENDENT FILES (files that import target file ${index + 1}):\n${dependentFiles[file].length > 0 ? ` ${dependentFiles[file].join(', ')}` : 'none'}\n`\n)}\n\n---\n\n## MCP TOOLS\n\n${allMcpPrompt}\n\n## Final output\n- When you are done, please return a brief summary of the files you modified, following this format.\n- **DO NOT** include any other text in your response. \n- If there were issues with some files, please include the issues in the list of changes for that file.\n\n[file 1 path]\n- List of changes to file 1\n`;\n\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAiB,MAAM,k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AAG,CAAC,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;;iDAEnC,KAAK,GAAG,CAAC;EACxD,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;CACjF,CACA;;;;;;EAMC,YAAY;;;;;;;;;CASb,CAAC;IAEA,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"2dce1901-ae4e-5ffd-9874-15168322869f"}
1
+ {"version":3,"file":"i18n.js","sources":["tasks/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { createSpinner } from '../logging/console.js';\nimport { allMcpPrompt } from '../prompts/system.js';\nimport { exit } from '../utils/shutdown.js';\nimport { logger } from '../logging/logger.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport {\n addFilesToManager,\n markFileAsEdited,\n markFileAsInProgress,\n} from '../utils/dag/getFiles.js';\nimport { runParallelProcessing, TaskProcessor } from './concurrency.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { appendFileSync } from 'node:fs';\nimport { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';\nimport path from 'node:path';\nimport { updateLockfile, cleanupLockfile } from '../utils/lockfile.js';\nimport { extractFiles } from '../utils/dag/extractFiles.js';\nimport { Dag } from '../utils/dag/createDag.js';\nimport { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';\nimport { deleteAddedFiles } from '../utils/fs/git.js';\nimport { CLAUDE_CODE_VERSION } from '../utils/shared.js';\nimport { installGlobalPackage } from '../utils/packages/installPackage.js';\nimport { fixErrorsTask } from './fixErrors.js';\nimport { getLocadexVersion } from '../utils/getPaths.js';\nimport { execFunction } from '../utils/exec.js';\nimport { isGTAuthConfigured } from '../utils/config.js';\nimport { CliOptions } from '../types/cli.js';\n\n/**\n * Run Locadex i18n on the project\n * This task requires no human intervention and is safe to run in CI/CD pipelines.\n */\nexport async function i18nTask(cliOptions: CliOptions) {\n const manager = LocadexManager.getInstance();\n // have to use the package.json from the appDir\n const packageJson = await getPackageJson(manager.appDirectory);\n const isUsingGTNext = packageJson\n ? isPackageInstalled('gt-next', packageJson)\n : false;\n if (!isUsingGTNext) {\n logger.error(\n `gt-next not detected in ${manager.appDirectory}. Please specify the correct app directory with the --app-dir flag, or ensure that gt-next is correctly installed in the project.`\n );\n await exit(1);\n }\n\n // Install claude-code if not installed\n await installGlobalPackage('@anthropic-ai/claude-code', CLAUDE_CODE_VERSION);\n // Install locadex if not installed\n await installGlobalPackage('locadex', getLocadexVersion());\n\n logger.debugMessage('App directory: ' + manager.appDirectory);\n logger.debugMessage('Root directory: ' + manager.rootDirectory);\n\n // Init message\n const spinner = createSpinner();\n spinner.start('Initializing Locadex...');\n\n const { files, dag } = extractFiles(manager);\n\n if (files.length === 0) {\n spinner.stop('No files have changed since last run');\n outro(chalk.green('✅ Locadex i18n complete - no changes detected!'));\n await exit(0);\n }\n\n const filesStateFilePath = manager.getFilesStateFilePath();\n const concurrency = manager.getMaxConcurrency();\n const batchSize = manager.getBatchSize();\n\n // Create the list of files (aka tasks) to process\n const taskQueue = Array.from(files);\n\n // Add files to manager\n const stateFilePath = addFilesToManager(filesStateFilePath, taskQueue);\n spinner.stop('Locadex initialized');\n\n logger.verboseMessage(`Processing ${files.length} modified files`);\n logger.debugMessage(`Track progress here: ${stateFilePath}`);\n logger.debugMessage(`Order:\\n${taskQueue.join('\\n')}`);\n\n logger.message(`Using ${concurrency} concurrent agents`);\n logger.initializeProgressBar(taskQueue.length);\n\n const fileProcessingStartTime = Date.now();\n logger.progressBar.start(`Processing ${taskQueue.length} files...`);\n\n // Shared reports array for collecting results\n const reports: string[] = [];\n\n // Create i18n task processor\n const i18nProcessor: TaskProcessor<\n string,\n {\n dag: Dag;\n files: string[];\n filesStateFilePath: string;\n }\n > = {\n preProcess: async (files, context) => {\n const { dag, filesStateFilePath } = context;\n logger.debugMessage(`Files: ${files.join(', ')}`);\n // Mark tasks as in progress\n await Promise.all(\n files.map((file) => markFileAsInProgress(file, filesStateFilePath))\n );\n\n // Construct prompt\n const dependencies = Object.fromEntries(\n files.map((file) => [\n file,\n Array.from(new Set(dag.getDependencies(file))).map(String),\n ])\n );\n const dependents = Object.fromEntries(\n files.map((file) => [\n file,\n Array.from(new Set(dag.getDependents(file))).map(String),\n ])\n );\n\n return getPrompt({\n targetFile: files,\n dependencyFiles: dependencies,\n dependentFiles: dependents,\n });\n },\n postProcess: async (processedFiles, context, agentReport) => {\n const { filesStateFilePath } = context;\n\n // Mark tasks as complete\n await Promise.all(\n processedFiles.map((file) => markFileAsEdited(file, filesStateFilePath))\n );\n\n // Add agent report\n reports.push(agentReport);\n\n // Update stats\n manager.stats.updateStats({\n newProcessedFiles: processedFiles.length,\n });\n\n // Update progress bar\n logger.progressBar.advance(\n processedFiles.length,\n `Processed ${Number((manager.stats.getStats().processedFiles / files.length) * 100).toFixed(2)}% of files`\n );\n },\n };\n\n // Run parallel processing\n await runParallelProcessing(\n Array.from(taskQueue),\n i18nProcessor,\n { dag, files, filesStateFilePath },\n {\n concurrency,\n batchSize,\n },\n 3\n );\n\n if (manager.isAborted()) {\n cleanupOnExit();\n await exit(1);\n return;\n }\n\n logger.progressBar.stop(\n `Processed ${files.length} files [${Math.round(\n (Date.now() - fileProcessingStartTime) / 1000\n )}s]`\n );\n\n const cleanupReports = await fixErrorsTask();\n if (cleanupReports) {\n reports.push(...cleanupReports);\n }\n\n // Generate report\n const reportSummary = `# Summary of locadex i18n changes\n${reports.join('\\n')}`;\n const summaryFilePath = path.join(\n manager.getLogDirectory(),\n 'locadex-report.md'\n );\n appendFileSync(summaryFilePath, reportSummary);\n logger.step(`Saved summary of changes to: ${summaryFilePath}`);\n\n // cleanup\n if (cliOptions.formatCmd) {\n const { stderr, code } = await execFunction(\n cliOptions.formatCmd,\n [],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n if (code !== 0) {\n logger.error(`Error running '${cliOptions.formatCmd}': ${stderr}`);\n } else {\n logger.step(\n `Formatted ${files.length} files with ${cliOptions.formatCmd}`\n );\n }\n } else {\n const formatter = await detectFormatter();\n if (formatter && files.length > 0) {\n await formatFiles(files, formatter);\n logger.log(`Formatted ${files.length} files with ${formatter}`);\n }\n }\n\n const lockfilePath = manager.getLockFilePath();\n\n // Delete any files the AI may have arbitrarily created\n deleteAddedFiles(\n [path.relative(manager.rootDirectory, manager.locadexDirectory)],\n ['dictionary.json', 'gt.config.json', 'locadex.yml']\n );\n\n // Update lockfile with processed files\n updateLockfile(files, lockfilePath, manager.rootDirectory);\n\n // Clean up stale entries from lockfile\n cleanupLockfile(lockfilePath, manager.rootDirectory);\n\n logger.message(chalk.dim(`Updated lockfile with ${files.length} files`));\n\n cleanupOnExit();\n\n // Run translate cmd\n if (isGTAuthConfigured(manager.appDirectory) && !cliOptions.noTranslate) {\n try {\n logger.initializeSpinner();\n logger.spinner.start('Running locadex translate...');\n const { stderr, code } = await execFunction(\n 'locadex',\n ['translate'],\n false,\n manager.appDirectory,\n manager.getAgentAbortController()\n );\n if (code !== 0) {\n logger.spinner.stop('Translations failed!');\n logger.error(`Error running 'locadex translate': ${stderr}`);\n } else {\n logger.spinner.stop('Translations generated!');\n logger.log(`Translations generated with 'locadex translate'`);\n }\n } catch (error) {\n logger.spinner.stop('Translations failed!');\n logger.error(\n `Error running 'locadex translate': ${(error as Error).message}`\n );\n }\n } else {\n logger.step(\n `No GT_API_KEY or GT_PROJECT_ID found. Skipping translation step...`\n );\n }\n\n outro(chalk.green('✅ Locadex i18n complete!'));\n await exit(0);\n}\n\nfunction cleanupOnExit() {\n const manager = LocadexManager.getInstance();\n logger.info(\n chalk.dim(\n `Locadex Cost: $${manager.stats.getStats().totalCost.toFixed(2)}\nLocadex wall time: ${Math.round(\n (Date.now() - manager.stats.getStats().startTime) / 1000\n )}s\nLocadex files processed: ${manager.stats.getStats().processedFiles}`\n )\n );\n\n const finalStats = manager.stats.getStats();\n\n // Record telemetry for final stats\n manager.stats.recordTelemetry(true);\n\n logger.verboseMessage(\n `Locadex input tokens: ${finalStats.inputTokens}\nLocadex cached input tokens: ${finalStats.cachedInputTokens}\nLocadex output tokens: ${finalStats.outputTokens}\nLocadex turns: ${finalStats.turns}`\n );\n}\n\nfunction getPrompt({\n targetFile,\n dependencyFiles,\n dependentFiles,\n}: {\n targetFile: string[];\n dependencyFiles: Record<string, string[]>;\n dependentFiles: Record<string, string[]>;\n}) {\n const prompt = `# Task: Internationalize the target file(s) using gt-next.\n\n## INSTRUCTIONS\n\n- You are given a list of target files and their corresponding dependency/dependent files.\n- The project is already setup for internationalization. Do not try to setup the project again for i18n.\n\n## Workflow:\n1. **Gather context** Read the target files closely \n - You do not have to read the dependency/dependent files for each target file. They are provided for convenience.\n2. **Evaluate if i18n is necessary** Evaluate if the target files need to be internationalized using gt-next \n - If the target files have no relevant content, are already internationalized, or contain build-time code (e.g. nextjs plugins) they should never be internationalized.\n**IMPORTANT**: IF NONE OF THE TARGET FILES NEED TO BE INTERNATIONALIZED, YOUR TASK IS COMPLETE AND YOU MAY RETURN.\n3. **Identify the tools to use** Given the contents of the files, ask yourself which tools and guides you need to use to get the necessary knowledge to internationalize the target files. Here are some helpful questions to evaluate for tool selection:\n - 3.a. Is the content that needs to be i18ned being used in this same file, or is it being used in another file?\n - 3.b. Is there any string interpolation that needs to be i18ned?\n - 3.c. Is there any conditional logic or rendering that needs to be i18ned?\n - 3.d. Is the content that needs to be i18ned HTML/JSX or a string?\n4. **Internationalize** You now have the necessary knowledge. Internationalize the files using the information from the tools provided to you.\n - 4.a. Do not run validation checks such as tsc. We will do that later.\n\n## RULES:\n- ALWAYS use the <T> component to internationalize HTML/JSX content.\n- ALWAYS use useGT() or useTranslations() to internationalize string content (strings created with '', \"\", or \\`\\`).\n - When possible, avoid using useTranslations(); useGT() is always preferred.\n- DO NOT internationalize non-user facing content or content that is functional, such as ids, class names, error strings, logical strings, etc.\n- Do not add i18n middleware to the app.\n- ALWAYS adhere to the guides provided via the 'mcp__locadex__*' tools.\n - These guides provide additional knowledge about how to internationalize the content.\n- Minimize the footprint of your changes.\n- Focus on internationalizing all user facing content in the target files. \n- NEVER move content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR DELETE ANY FILES (especially .bak files)\n- NEVER EDIT FILES THAT ARE NOT GIVEN TO YOU.\n\n## TARGET FILE INFORMATION\n${targetFile.map(\n (file, index) => `\nTARGET FILE ${index + 1}:\n${file}\n\nDEPENDENCY FILES (files imported by target file ${index + 1}):\n${dependencyFiles[file].length > 0 ? ` ${dependencyFiles[file].join(', ')}` : 'none'}\n\nDEPENDENT FILES (files that import target file ${index + 1}):\n${dependentFiles[file].length > 0 ? ` ${dependentFiles[file].join(', ')}` : 'none'}\n`\n)}\n\n---\n\n## MCP TOOLS\n\n${allMcpPrompt}\n\n## Final output\n- When you are done, please return a brief summary of the files you modified, following this format.\n- **DO NOT** include any other text in your response. \n- If there were issues with some files, please include the issues in the list of changes for that file.\n\n[file 1 path]\n- List of changes to file 1\n`;\n\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAiB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAA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AAE,MAAM,iBAoJjC"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"/","sources":["tasks/setup.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,OAAO,EAClB,aAAa,EAAE,OAAO,EACtB,uBAAuB,CAAC,EAAE,MAAM,iBA2JjC"}
@@ -1,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]="56ed945b-d610-5417-93c7-7826a3743902")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="da80142d-3899-5af8-abcc-7e9163fff826")}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';
@@ -115,7 +115,13 @@ export async function setupTask(cliOptions, autoSetup, bypassPrompts, specifiedP
115
115
  // Add locadex github action if not exists
116
116
  setupGithubAction(manager, packageManager);
117
117
  if (cliOptions.formatCmd) {
118
- await execFunction(cliOptions.formatCmd, [], false, manager.appDirectory, manager.getAgentAbortController());
118
+ const { stderr, code } = await execFunction(cliOptions.formatCmd, [], false, manager.appDirectory, manager.getAgentAbortController());
119
+ if (code !== 0) {
120
+ logger.error(`Error running '${cliOptions.formatCmd}': ${stderr}`);
121
+ }
122
+ else {
123
+ logger.step(`Formatted ${filesUpdated.length} files with ${cliOptions.formatCmd}`);
124
+ }
119
125
  }
120
126
  else {
121
127
  const formatter = await detectFormatter();
@@ -235,4 +241,4 @@ function MyComponent() {
235
241
  return prompt;
236
242
  }
237
243
  //# sourceMappingURL=setup.js.map
238
- //# debugId=56ed945b-d610-5417-93c7-7826a3743902
244
+ //# debugId=da80142d-3899-5af8-abcc-7e9163fff826