locadex 0.1.12 → 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 (110) hide show
  1. package/dist/cli.js +4 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/fixErrors.js +4 -1
  4. package/dist/commands/fixErrors.js.map +1 -1
  5. package/dist/commands/i18n.js +4 -1
  6. package/dist/commands/i18n.js.map +1 -1
  7. package/dist/commands/setup.js +4 -1
  8. package/dist/commands/setup.js.map +1 -1
  9. package/dist/index.js +4 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/logging/console.js +4 -1
  12. package/dist/logging/console.js.map +1 -1
  13. package/dist/logging/logger.js +4 -1
  14. package/dist/logging/logger.js.map +1 -1
  15. package/dist/mcp/getDocs.js +4 -1
  16. package/dist/mcp/getDocs.js.map +1 -1
  17. package/dist/mcp/getGuide.js +4 -1
  18. package/dist/mcp/getGuide.js.map +1 -1
  19. package/dist/mcp/getPort.js +4 -1
  20. package/dist/mcp/getPort.js.map +1 -1
  21. package/dist/mcp/tools/docs.js +4 -1
  22. package/dist/mcp/tools/docs.js.map +1 -1
  23. package/dist/mcp/tools/guides.js +4 -1
  24. package/dist/mcp/tools/guides.js.map +1 -1
  25. package/dist/mcp/tools/validate.d.ts +3 -0
  26. package/dist/mcp/tools/validate.d.ts.map +1 -0
  27. package/dist/mcp/tools/validate.js +37 -0
  28. package/dist/mcp/tools/validate.js.map +1 -0
  29. package/dist/mcp/validateEnv.d.ts +9 -0
  30. package/dist/mcp/validateEnv.d.ts.map +1 -0
  31. package/dist/mcp/validateEnv.js +27 -0
  32. package/dist/mcp/validateEnv.js.map +1 -0
  33. package/dist/{mcp.d.ts → mcp-sse.d.ts} +1 -1
  34. package/dist/mcp-sse.d.ts.map +1 -0
  35. package/dist/{mcp.js → mcp-sse.js} +8 -5
  36. package/dist/mcp-sse.js.map +1 -0
  37. package/dist/mcp-stdio.js +8 -5
  38. package/dist/mcp-stdio.js.map +1 -1
  39. package/dist/prompts/system.d.ts +1 -0
  40. package/dist/prompts/system.d.ts.map +1 -1
  41. package/dist/prompts/system.js +16 -1
  42. package/dist/prompts/system.js.map +1 -1
  43. package/dist/resources/getResource.js +4 -1
  44. package/dist/resources/getResource.js.map +1 -1
  45. package/dist/tasks/concurrency.js +4 -1
  46. package/dist/tasks/concurrency.js.map +1 -1
  47. package/dist/tasks/fixErrors.js +13 -15
  48. package/dist/tasks/fixErrors.js.map +1 -1
  49. package/dist/tasks/i18n.d.ts.map +1 -1
  50. package/dist/tasks/i18n.js +25 -8
  51. package/dist/tasks/i18n.js.map +1 -1
  52. package/dist/tasks/setup.d.ts.map +1 -1
  53. package/dist/tasks/setup.js +11 -2
  54. package/dist/tasks/setup.js.map +1 -1
  55. package/dist/telemetry.js +4 -1
  56. package/dist/telemetry.js.map +1 -1
  57. package/dist/types/claude-sdk.js +4 -1
  58. package/dist/types/claude-sdk.js.map +1 -1
  59. package/dist/types/cli.js +4 -1
  60. package/dist/types/cli.js.map +1 -1
  61. package/dist/utils/claudeCode.d.ts.map +1 -1
  62. package/dist/utils/claudeCode.js +5 -1
  63. package/dist/utils/claudeCode.js.map +1 -1
  64. package/dist/utils/config.js +4 -1
  65. package/dist/utils/config.js.map +1 -1
  66. package/dist/utils/dag/createDag.js +4 -1
  67. package/dist/utils/dag/createDag.js.map +1 -1
  68. package/dist/utils/dag/extractFiles.js +4 -1
  69. package/dist/utils/dag/extractFiles.js.map +1 -1
  70. package/dist/utils/dag/getFiles.js +4 -1
  71. package/dist/utils/dag/getFiles.js.map +1 -1
  72. package/dist/utils/dag/matchFiles.js +4 -1
  73. package/dist/utils/dag/matchFiles.js.map +1 -1
  74. package/dist/utils/errors.js +4 -1
  75. package/dist/utils/errors.js.map +1 -1
  76. package/dist/utils/exec.d.ts +5 -1
  77. package/dist/utils/exec.d.ts.map +1 -1
  78. package/dist/utils/exec.js +19 -10
  79. package/dist/utils/exec.js.map +1 -1
  80. package/dist/utils/fs/findConfigs.js +4 -1
  81. package/dist/utils/fs/findConfigs.js.map +1 -1
  82. package/dist/utils/fs/getFiles.js +4 -1
  83. package/dist/utils/fs/getFiles.js.map +1 -1
  84. package/dist/utils/fs/git.js +4 -1
  85. package/dist/utils/fs/git.js.map +1 -1
  86. package/dist/utils/fs/writeFiles.js +4 -1
  87. package/dist/utils/fs/writeFiles.js.map +1 -1
  88. package/dist/utils/getPaths.js +4 -1
  89. package/dist/utils/getPaths.js.map +1 -1
  90. package/dist/utils/locadexManager.d.ts.map +1 -1
  91. package/dist/utils/locadexManager.js +14 -12
  92. package/dist/utils/locadexManager.js.map +1 -1
  93. package/dist/utils/lockfile.d.ts +0 -1
  94. package/dist/utils/lockfile.d.ts.map +1 -1
  95. package/dist/utils/lockfile.js +4 -3
  96. package/dist/utils/lockfile.js.map +1 -1
  97. package/dist/utils/packages/installPackage.js +4 -1
  98. package/dist/utils/packages/installPackage.js.map +1 -1
  99. package/dist/utils/session.js +4 -1
  100. package/dist/utils/session.js.map +1 -1
  101. package/dist/utils/shared.js +4 -1
  102. package/dist/utils/shared.js.map +1 -1
  103. package/dist/utils/shutdown.js +4 -1
  104. package/dist/utils/shutdown.js.map +1 -1
  105. package/dist/utils/stats.js +4 -1
  106. package/dist/utils/stats.js.map +1 -1
  107. package/guides/next/basic/variables.md +2 -2
  108. package/package.json +2 -2
  109. package/dist/mcp.d.ts.map +0 -1
  110. package/dist/mcp.js.map +0 -1
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
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]="fc44876b-0ae4-5975-895b-400e4cdf1431")}catch(e){}}();
2
4
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
5
  import { addDocsTools } from './mcp/tools/docs.js';
4
6
  import { existsSync, readFileSync } from 'node:fs';
@@ -9,13 +11,12 @@ import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
9
11
  import { logger } from './logging/logger.js';
10
12
  import { findAvailablePort } from './mcp/getPort.js';
11
13
  import { exit } from './utils/shutdown.js';
14
+ import { addValidateProjectTool } from './mcp/tools/validate.js';
15
+ import { validateEnv } from './mcp/validateEnv.js';
12
16
  export async function start() {
13
- const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;
14
- const logFile = process.env.LOCADEX_LOG_FILE_PATH;
17
+ const { stateFile, logFile, verbose, debug, appDirectory } = validateEnv();
15
18
  const requestedPort = process.env.PORT ? parseInt(process.env.PORT) : 8888;
16
19
  const port = await findAvailablePort(requestedPort);
17
- const verbose = process.env.LOCADEX_VERBOSE === 'true';
18
- const debug = process.env.LOCADEX_DEBUG === 'true';
19
20
  logger.initialize({ verbose, debug }, logFile);
20
21
  if (stateFile && existsSync(stateFile)) {
21
22
  const state = JSON.parse(readFileSync(stateFile, 'utf8'));
@@ -38,6 +39,7 @@ export async function start() {
38
39
  };
39
40
  addDocsTools(mcpServer);
40
41
  addGuidesTools(mcpServer);
42
+ addValidateProjectTool(mcpServer, appDirectory);
41
43
  // SSE endpoint for legacy clients
42
44
  // Claude Code only supports SSE as of 2025-06-04
43
45
  app.get('/sse', async (req, res) => {
@@ -73,4 +75,5 @@ start().catch(async (error) => {
73
75
  logger.error(`[locadex-mcp] Failed to start: ${error instanceof Error ? error.message : String(error)}`);
74
76
  await exit(1);
75
77
  });
76
- //# sourceMappingURL=mcp.js.map
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 `[locadex-mcp] Failed to start: ${error instanceof Error ? error.message : String(error)}`\n );\n await exit(1);\n});\n"],"names":[],"mappings":";;;AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,WAAW,EAAE,CAAC;IAC3E,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CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;QAChB,MAAM,CAAC,YAAY,CACjB,iBAAiB,iBAAiB,EAAE,qBAAqB,WAAW,oBAAoB,SAAS,EAAE,CACpG,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uBAAuB;AACvB,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;IAC5B,MAAM,CAAC,KAAK,CACV,kCAAkC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,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,4 +1,6 @@
1
1
  #!/usr/bin/env node
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]="130ecd64-a194-55ed-88c3-852d070aa468")}catch(e){}}();
2
4
  import './telemetry.js';
3
5
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
6
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -7,11 +9,10 @@ import { existsSync, readFileSync } from 'node:fs';
7
9
  import { fromPackageRoot } from './utils/getPaths.js';
8
10
  import { addGuidesTools } from './mcp/tools/guides.js';
9
11
  import { logger } from './logging/logger.js';
12
+ import { addValidateProjectTool } from './mcp/tools/validate.js';
13
+ import { validateEnv } from './mcp/validateEnv.js';
10
14
  async function main() {
11
- const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;
12
- const logFile = process.env.LOCADEX_LOG_FILE_PATH;
13
- const verbose = process.env.LOCADEX_VERBOSE === 'true';
14
- const debug = process.env.LOCADEX_DEBUG === 'true';
15
+ const { stateFile, logFile, verbose, debug, appDirectory } = validateEnv();
15
16
  logger.initialize({ verbose, debug }, logFile);
16
17
  if (stateFile && existsSync(stateFile)) {
17
18
  const state = JSON.parse(readFileSync(stateFile, 'utf8'));
@@ -27,10 +28,12 @@ async function main() {
27
28
  });
28
29
  addDocsTools(server);
29
30
  addGuidesTools(server);
31
+ addValidateProjectTool(server, appDirectory);
30
32
  logger.log('[locadex-mcp] All tools registered');
31
33
  const transport = new StdioServerTransport();
32
34
  await server.connect(transport);
33
35
  logger.log('[locadex-mcp] started on stdio');
34
36
  }
35
37
  main();
36
- //# sourceMappingURL=mcp-stdio.js.map
38
+ //# sourceMappingURL=mcp-stdio.js.map
39
+ //# debugId=130ecd64-a194-55ed-88c3-852d070aa468
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-stdio.js","sourceRoot":"/","sources":["mcp-stdio.ts"],"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;AAE7C,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;IAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAClD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,MAAM,CAAC;IACvD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,CAAC;IAEnD,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;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","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.log('[locadex-mcp] started on stdio');\n}\nmain();\n"]}
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,3 +1,5 @@
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]="f049faca-f704-566a-abda-540d7a59c61a")}catch(e){}}();
1
3
  import { guides } from '../mcp/tools/guides.js';
2
4
  import { docsTools } from '../mcp/tools/docs.js';
3
5
  export const mcpDocsTools = Object.keys(docsTools).map((tool) => `mcp__locadex__${tool}`);
@@ -11,4 +13,17 @@ ${mcpDocsTools.join('\n')}
11
13
  ${mcpGuidesTools.join('\n')}
12
14
 
13
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.`;
14
- //# sourceMappingURL=system.js.map
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
+
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.`;
28
+ //# sourceMappingURL=system.js.map
29
+ //# debugId=f049faca-f704-566a-abda-540d7a59c61a
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sourceRoot":"/","sources":["prompts/system.ts"],"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","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"]}
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,3 +1,5 @@
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]="88504afd-5278-5cca-855f-d157fa96541e")}catch(e){}}();
1
3
  import { readFileSync } from 'node:fs';
2
4
  import { join } from 'node:path';
3
5
  import { fromPackageRoot } from '../utils/getPaths.js';
@@ -13,4 +15,5 @@ export function getResource(path) {
13
15
  return { error: error instanceof Error ? error.message : String(error) };
14
16
  }
15
17
  }
16
- //# sourceMappingURL=getResource.js.map
18
+ //# sourceMappingURL=getResource.js.map
19
+ //# debugId=88504afd-5278-5cca-855f-d157fa96541e
@@ -1 +1 @@
1
- {"version":3,"file":"getResource.js","sourceRoot":"/","sources":["resources/getResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,UAAU,WAAW,CAAC,IAAY;IAItC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,GAAG,CAAC,0BAA0B,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;QACvD,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3E,CAAC;AACH,CAAC","sourcesContent":["import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { fromPackageRoot } from '../utils/getPaths.js';\nimport { logger } from '../logging/logger.js';\n\nexport function getResource(path: string): {\n content?: string;\n error?: string;\n} {\n try {\n const filePath = fromPackageRoot(join('resources', path));\n const content = readFileSync(filePath, 'utf-8');\n return { content };\n } catch (error) {\n logger.log(`Error reading resource ${path}: ${error}`);\n return { error: error instanceof Error ? error.message : String(error) };\n }\n}\n"]}
1
+ {"version":3,"file":"getResource.js","sources":["resources/getResource.ts"],"sourceRoot":"/","sourcesContent":["import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { fromPackageRoot } from '../utils/getPaths.js';\nimport { logger } from '../logging/logger.js';\n\nexport function getResource(path: string): {\n content?: string;\n error?: string;\n} {\n try {\n const filePath = fromPackageRoot(join('resources', path));\n const content = readFileSync(filePath, 'utf-8');\n return { content };\n } catch (error) {\n logger.log(`Error reading resource ${path}: ${error}`);\n return { error: error instanceof Error ? error.message : String(error) };\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,UAAU,WAAW,CAAC,IAAY;IAItC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,GAAG,CAAC,0BAA0B,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;QACvD,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3E,CAAC;AACH,CAAC","debug_id":"88504afd-5278-5cca-855f-d157fa96541e"}
@@ -1,3 +1,5 @@
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]="f92d5871-6752-52e3-a0f3-16e4db1e84fc")}catch(e){}}();
1
3
  import { LocadexManager } from '../utils/locadexManager.js';
2
4
  import { logger } from '../logging/logger.js';
3
5
  import { exit } from '../utils/shutdown.js';
@@ -124,4 +126,5 @@ export async function runParallelProcessing(taskQueue, processor, context, optio
124
126
  agentInfo.agent.aggregateStats();
125
127
  });
126
128
  }
127
- //# sourceMappingURL=concurrency.js.map
129
+ //# sourceMappingURL=concurrency.js.map
130
+ //# debugId=f92d5871-6752-52e3-a0f3-16e4db1e84fc
@@ -1 +1 @@
1
- {"version":3,"file":"concurrency.js","sourceRoot":"/","sources":["tasks/concurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AA6CvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,SAAkB,EAClB,SAAyC,EACzC,OAAiB,EACjB,OAAkC,EAClC,aAAqB,CAAC;IAEtB,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC3C,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAC7C,MAAM,oBAAoB,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAE/D,8BAA8B;IAC9B,IAAI,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAEvC,iDAAiD;IACjD,MAAM,YAAY,GAAG,KAAK,EAAE,SAAiB,EAAoB,EAAE;QACjE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,E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,EAAE,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAC3C,SAAS,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,iCAAiC;QAEvE,kCAAkC;QAClC,IAAI,oBAAoB,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACxC,OAAO;QACT,CAAC;QAED,KAAK,CACH,KAAK,CAAC,GAAG,CAAC,+BAA+B,GAAI,KAAe,CAAC,OAAO,CAAC,CACtE,CAAC;QACF,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB;IACpC,CAAC;IACD,OAAO,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAC3C,SAAS,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { LocadexManager } from '../utils/locadexManager.js';\nimport { logger } from '../logging/logger.js';\nimport { exit } from '../utils/shutdown.js';\nimport chalk from 'chalk';\nimport { outro } from '@clack/prompts';\n\n/**\n * Interface for defining how to process tasks in parallel.\n * Separates task preparation (preProcess) from result handling (postProcess).\n *\n * @template TTask - The type of individual tasks being processed\n * @template TContext - The type of shared context/configuration\n */\nexport interface TaskProcessor<TTask, TContext> {\n /**\n * Prepares tasks for processing and generates the prompt for the AI agent.\n * Called before each batch is sent to an agent.\n *\n * @param tasks - Batch of tasks to process\n * @param context - Shared context containing configuration and state\n * @returns Promise that resolves to the prompt string for the AI agent\n */\n preProcess: (tasks: TTask[], context: TContext) => Promise<string>;\n\n /**\n * Handles the results after the AI agent completes processing.\n * Called after each batch is successfully processed.\n *\n * @param tasks - The batch of tasks that were processed\n * @param context - Shared context containing configuration and state\n * @param agentReport - The report/output generated by the AI agent\n */\n postProcess: (\n tasks: TTask[],\n context: TContext,\n agentReport: string\n ) => Promise<void>;\n}\n\n/**\n * Configuration options for parallel processing behavior.\n */\nexport interface ParallelProcessingOptions {\n /** Number of concurrent agents to run in parallel */\n concurrency: number;\n /** Number of tasks to process in each batch */\n batchSize: number;\n}\n\n/**\n * Executes tasks in parallel using a pool of agents with proper concurrency control.\n *\n * This is a generic parallel processing framework that handles:\n * - Task queue management with thread-safe access\n * - Agent pool creation and lifecycle management\n * - Error handling and abort signal propagation\n * - Proper cleanup and resource management\n *\n * @template TTask - The type of tasks to process (e.g., string, object, etc.)\n * @template TContext - The type of context passed to the processor functions\n *\n * @param taskQueue - Array of tasks to process. Will be consumed (mutated) during processing.\n * @param processor - Object implementing preProcess and postProcess methods for task handling\n * @param context - Context object passed to processor methods, containing shared state/config\n * @param options - Configuration for parallel processing (concurrency level, batch size)\n *\n * @throws {Error} If processing fails or is aborted\n *\n * @example\n * ```typescript\n * const processor: TaskProcessor<string, { config: Config }> = {\n * preProcess: async (files, context) => generatePrompt(files, context.config),\n * postProcess: async (files, context, report) => handleResults(files, report)\n * };\n *\n * await runParallelProcessing(\n * ['file1.ts', 'file2.ts'],\n * processor,\n * { config: myConfig },\n * { concurrency: 3, batchSize: 2 }\n * );\n * ```\n */\nexport async function runParallelProcessing<TTask, TContext>(\n taskQueue: TTask[],\n processor: TaskProcessor<TTask, TContext>,\n context: TContext,\n options: ParallelProcessingOptions,\n maxRetries: number = 3\n): Promise<void> {\n const { concurrency, batchSize } = options;\n const manager = LocadexManager.getInstance();\n const agentAbortController = manager.getAgentAbortController();\n\n // Mutex for task queue access\n let taskQueueMutex = Promise.resolve();\n\n // Helper function to safely get tasks from queue\n const getNextTasks = async (batchSize: number): Promise<TTask[]> => {\n return new Promise((resolve) => {\n taskQueueMutex = taskQueueMutex.then(() => {\n const tasks = taskQueue.splice(0, batchSize);\n resolve(tasks);\n });\n });\n };\n\n const processTask = async (): Promise<void> => {\n while (taskQueue.length > 0 && !agentAbortController.signal.aborted) {\n // Check if we should abort early\n if (agentAbortController.signal.aborted) {\n return;\n }\n\n // Get an available agent atomically\n const agentInfo = await manager.getAvailableAgent();\n if (!agentInfo) {\n // No available agents, wait a bit (but check for abort)\n await new Promise((resolve) => {\n const timeout = global.setTimeout(resolve, 100);\n agentAbortController.signal.addEventListener('abort', () => {\n global.clearTimeout(timeout);\n resolve(undefined);\n });\n });\n continue;\n }\n\n const { id: agentId, agent } = agentInfo;\n\n // Get the next batch of tasks (thread-safe)\n const tasks = await getNextTasks(batchSize);\n if (tasks.length === 0) {\n manager.markAgentFree(agentId);\n break;\n }\n\n logger.debugMessage(`Using agent ${agentId} for ${tasks.length} tasks.`);\n\n // Process tasks using the provided processor\n try {\n // Pre-process: generate prompt\n const prompt = await processor.preProcess(tasks, context);\n\n // dynamic timeout based on the number of tasks\n const dynamicTimeoutSec = manager.getTimeoutFactor() * tasks.length;\n\n // Claude call with timeout and retry (handled inside agent.run)\n await agent.run(\n prompt,\n {\n timeoutSec: dynamicTimeoutSec,\n maxRetries,\n },\n {}\n );\n\n const agentReport = agent.generateReport();\n manager.markAgentFree(agentId);\n\n // Post-process: handle reports, progress, etc.\n await processor.postProcess(tasks, context, agentReport);\n } catch (error) {\n logger.debugMessage(`[${agentId}] error: ${error}`);\n throw error;\n }\n }\n };\n\n // Create agent pool with 100 (soft) turns cutoff\n manager.createAgentPool({ softTurnLimit: 100 });\n\n // Start parallel processing\n const processingPromises = Array.from({ length: concurrency }, () =>\n processTask()\n );\n\n try {\n await Promise.all(processingPromises);\n } catch (error) {\n manager.getAgentPool().forEach((agentInfo) => {\n agentInfo.agent.aggregateStats();\n });\n manager.stats.recordTelemetry(false); // do this after aggregateStats()\n\n // Check if this is a manual abort\n if (agentAbortController.signal.aborted) {\n return;\n }\n\n outro(\n chalk.red('❌ Locadex failed with error: ' + (error as Error).message)\n );\n await exit(1); // Exit the process\n }\n manager.getAgentPool().forEach((agentInfo) => {\n agentInfo.agent.aggregateStats();\n });\n}\n"]}
1
+ {"version":3,"file":"concurrency.js","sources":["tasks/concurrency.ts"],"sourceRoot":"/","sourcesContent":["import { LocadexManager } from '../utils/locadexManager.js';\nimport { logger } from '../logging/logger.js';\nimport { exit } from '../utils/shutdown.js';\nimport chalk from 'chalk';\nimport { outro } from '@clack/prompts';\n\n/**\n * Interface for defining how to process tasks in parallel.\n * Separates task preparation (preProcess) from result handling (postProcess).\n *\n * @template TTask - The type of individual tasks being processed\n * @template TContext - The type of shared context/configuration\n */\nexport interface TaskProcessor<TTask, TContext> {\n /**\n * Prepares tasks for processing and generates the prompt for the AI agent.\n * Called before each batch is sent to an agent.\n *\n * @param tasks - Batch of tasks to process\n * @param context - Shared context containing configuration and state\n * @returns Promise that resolves to the prompt string for the AI agent\n */\n preProcess: (tasks: TTask[], context: TContext) => Promise<string>;\n\n /**\n * Handles the results after the AI agent completes processing.\n * Called after each batch is successfully processed.\n *\n * @param tasks - The batch of tasks that were processed\n * @param context - Shared context containing configuration and state\n * @param agentReport - The report/output generated by the AI agent\n */\n postProcess: (\n tasks: TTask[],\n context: TContext,\n agentReport: string\n ) => Promise<void>;\n}\n\n/**\n * Configuration options for parallel processing behavior.\n */\nexport interface ParallelProcessingOptions {\n /** Number of concurrent agents to run in parallel */\n concurrency: number;\n /** Number of tasks to process in each batch */\n batchSize: number;\n}\n\n/**\n * Executes tasks in parallel using a pool of agents with proper concurrency control.\n *\n * This is a generic parallel processing framework that handles:\n * - Task queue management with thread-safe access\n * - Agent pool creation and lifecycle management\n * - Error handling and abort signal propagation\n * - Proper cleanup and resource management\n *\n * @template TTask - The type of tasks to process (e.g., string, object, etc.)\n * @template TContext - The type of context passed to the processor functions\n *\n * @param taskQueue - Array of tasks to process. Will be consumed (mutated) during processing.\n * @param processor - Object implementing preProcess and postProcess methods for task handling\n * @param context - Context object passed to processor methods, containing shared state/config\n * @param options - Configuration for parallel processing (concurrency level, batch size)\n *\n * @throws {Error} If processing fails or is aborted\n *\n * @example\n * ```typescript\n * const processor: TaskProcessor<string, { config: Config }> = {\n * preProcess: async (files, context) => generatePrompt(files, context.config),\n * postProcess: async (files, context, report) => handleResults(files, report)\n * };\n *\n * await runParallelProcessing(\n * ['file1.ts', 'file2.ts'],\n * processor,\n * { config: myConfig },\n * { concurrency: 3, batchSize: 2 }\n * );\n * ```\n */\nexport async function runParallelProcessing<TTask, TContext>(\n taskQueue: TTask[],\n processor: TaskProcessor<TTask, TContext>,\n context: TContext,\n options: ParallelProcessingOptions,\n maxRetries: number = 3\n): Promise<void> {\n const { concurrency, batchSize } = options;\n const manager = LocadexManager.getInstance();\n const agentAbortController = manager.getAgentAbortController();\n\n // Mutex for task queue access\n let taskQueueMutex = Promise.resolve();\n\n // Helper function to safely get tasks from queue\n const getNextTasks = async (batchSize: number): Promise<TTask[]> => {\n return new Promise((resolve) => {\n taskQueueMutex = taskQueueMutex.then(() => {\n const tasks = taskQueue.splice(0, batchSize);\n resolve(tasks);\n });\n });\n };\n\n const processTask = async (): Promise<void> => {\n while (taskQueue.length > 0 && !agentAbortController.signal.aborted) {\n // Check if we should abort early\n if (agentAbortController.signal.aborted) {\n return;\n }\n\n // Get an available agent atomically\n const agentInfo = await manager.getAvailableAgent();\n if (!agentInfo) {\n // No available agents, wait a bit (but check for abort)\n await new Promise((resolve) => {\n const timeout = global.setTimeout(resolve, 100);\n agentAbortController.signal.addEventListener('abort', () => {\n global.clearTimeout(timeout);\n resolve(undefined);\n });\n });\n continue;\n }\n\n const { id: agentId, agent } = agentInfo;\n\n // Get the next batch of tasks (thread-safe)\n const tasks = await getNextTasks(batchSize);\n if (tasks.length === 0) {\n manager.markAgentFree(agentId);\n break;\n }\n\n logger.debugMessage(`Using agent ${agentId} for ${tasks.length} tasks.`);\n\n // Process tasks using the provided processor\n try {\n // Pre-process: generate prompt\n const prompt = await processor.preProcess(tasks, context);\n\n // dynamic timeout based on the number of tasks\n const dynamicTimeoutSec = manager.getTimeoutFactor() * tasks.length;\n\n // Claude call with timeout and retry (handled inside agent.run)\n await agent.run(\n prompt,\n {\n timeoutSec: dynamicTimeoutSec,\n maxRetries,\n },\n {}\n );\n\n const agentReport = agent.generateReport();\n manager.markAgentFree(agentId);\n\n // Post-process: handle reports, progress, etc.\n await processor.postProcess(tasks, context, agentReport);\n } catch (error) {\n logger.debugMessage(`[${agentId}] error: ${error}`);\n throw error;\n }\n }\n };\n\n // Create agent pool with 100 (soft) turns cutoff\n manager.createAgentPool({ softTurnLimit: 100 });\n\n // Start parallel processing\n const processingPromises = Array.from({ length: concurrency }, () =>\n processTask()\n );\n\n try {\n await Promise.all(processingPromises);\n } catch (error) {\n manager.getAgentPool().forEach((agentInfo) => {\n agentInfo.agent.aggregateStats();\n });\n manager.stats.recordTelemetry(false); // do this after aggregateStats()\n\n // Check if this is a manual abort\n if (agentAbortController.signal.aborted) {\n return;\n }\n\n outro(\n chalk.red('❌ Locadex failed with error: ' + (error as Error).message)\n );\n await exit(1); // Exit the process\n }\n manager.getAgentPool().forEach((agentInfo) => {\n agentInfo.agent.aggregateStats();\n });\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AA6CvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,SAAkB,EAClB,SAAyC,EACzC,OAAiB,EACjB,OAAkC,EAClC,aAAqB,CAAC;IAEtB,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC3C,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAC7C,MAAM,oBAAoB,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAE/D,8BAA8B;IAC9B,IAAI,cAAc,GAAG,OA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CAAC;IAEF,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAC3C,SAAS,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,iCAAiC;QAEvE,kCAAkC;QAClC,IAAI,oBAAoB,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACxC,OAAO;QACT,CAAC;QAED,KAAK,CACH,KAAK,CAAC,GAAG,CAAC,+BAA+B,GAAI,KAAe,CAAC,OAAO,CAAC,CACtE,CAAC;QACF,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB;IACpC,CAAC;IACD,OAAO,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAC3C,SAAS,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC","debug_id":"f92d5871-6752-52e3-a0f3-16e4db1e84fc"}
@@ -1,4 +1,6 @@
1
- import { allMcpPrompt } from '../prompts/system.js';
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]="75d184a3-1343-57e6-abe7-ee95709748cf")}catch(e){}}();
3
+ import { allMcpPromptFixErrors } from '../prompts/system.js';
2
4
  import { exit } from '../utils/shutdown.js';
3
5
  import { logger } from '../logging/logger.js';
4
6
  import { LocadexManager } from '../utils/locadexManager.js';
@@ -42,35 +44,30 @@ function getFixPrompt(appDirectory) {
42
44
 
43
45
  ## INSTRUCTIONS
44
46
 
45
- 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}").
46
48
  Your new task is to fix any errors that were introduced by your previous implementation.
49
+ You should only fix errors that the gt-next validator has identified.
47
50
 
48
51
  ## Steps:
49
52
  1. Run the gt-next validator.
50
53
  2. Fix all errors output by the gt-next validator.
51
54
  3. Repeat steps 1-2 until there are no more errors, or until you believe that you have fixed all errors.
52
55
 
56
+ To run the gt-next validator, call the 'mcp__locadex__validate-project' tool.
57
+
53
58
  ## RULES:
54
59
  - ONLY modify files that are relevant to the internationalization of the project.
55
- - ONLY fix errors that result from your current or previous implementation.
56
- - Resolve unused imports from 'gt-next'.
57
- - In particular, if a file contains user-facing content that should be internationalized and is not, you should internationalize it.
60
+ - ONLY fix errors that the gt-next validator has identified.
58
61
  - Resolve missing imports from 'gt-next'. If a file is missing an import from 'gt-next', add it.
59
- - ALWAYS adhere to the guides provided via the 'mcp__locadex__' tools.
62
+ - ALWAYS adhere to the guides provided via the 'mcp__locadex__*' tools.
60
63
  - These guides provide additional knowledge about how to internationalize the content.
61
64
  - NEVER move content to a different file. All content MUST remain in the same file where it came from.
62
65
  - NEVER CREATE OR DELETE ANY FILES (especially .bak files)
63
- - YOU MAY NOT RUN ANY COMMANDS THAT ARE NOT LISTED BELOW:
64
- - 'locadex validate'
65
- - 'tsc --noEmit'
66
-
67
- To run the gt-next validator, run the following command from the app root directory:
68
- 'locadex validate' (global command)
69
- The app root is: "${appDirectory}"
66
+ - NEVER try running build commands (for example, 'next dev' or 'next build')
70
67
 
71
68
  ## MCP TOOLS
72
69
 
73
- ${allMcpPrompt}
70
+ ${allMcpPromptFixErrors}
74
71
 
75
72
  ## Final output
76
73
  - When you are done, please return a brief summary of the files you modified, following this format.
@@ -82,4 +79,5 @@ ${allMcpPrompt}
82
79
  `;
83
80
  return prompt;
84
81
  }
85
- //# sourceMappingURL=fixErrors.js.map
82
+ //# sourceMappingURL=fixErrors.js.map
83
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,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,YAAY,CAAC,cAAc,EAAE,CAAC;QAC9B,MAAM,CAAC,YAAY,CACjB,gDAAgD,KAAK,EAAE,CACxD,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACrC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAC3C,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,OAAO;IACT,CAAC;IACD,YAAY,CAAC,cAAc,EAAE,CAAC;IAC9B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACpC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,oDAAoD;AAEpD,SAAS,YAAY,CAAC,YAAoB;IACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA4BG,YAAY;;;;EAI9B,YAAY;;;;;;;;;CASb,CAAC;IAEA,OAAO,MAAM,CAAC;AAChB,CAAC","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.\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\n## RULES:\n- ONLY modify files that are relevant to the internationalization of the project.\n- ONLY fix errors that result from 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- 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- YOU MAY NOT RUN ANY COMMANDS THAT ARE NOT LISTED BELOW:\n - 'locadex validate'\n - 'tsc --noEmit'\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## 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"]}
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,CAAC,2BAA2B,EAAE,mBAAmB,CAAC,CAAC;IAE7E,mCAAmC;IACnC,MAAM,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;IAE3E,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAC3B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,k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 {"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,3 +1,5 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d655e317-abac-5345-8a2c-ea1e6a0ca6f0")}catch(e){}}();
1
3
  import { createSpinner } from '../logging/console.js';
2
4
  import { allMcpPrompt } from '../prompts/system.js';
3
5
  import { exit } from '../utils/shutdown.js';
@@ -126,7 +128,13 @@ ${reports.join('\n')}`;
126
128
  logger.step(`Saved summary of changes to: ${summaryFilePath}`);
127
129
  // cleanup
128
130
  if (cliOptions.formatCmd) {
129
- 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
+ }
130
138
  }
131
139
  else {
132
140
  const formatter = await detectFormatter();
@@ -136,21 +144,28 @@ ${reports.join('\n')}`;
136
144
  }
137
145
  }
138
146
  const lockfilePath = manager.getLockFilePath();
147
+ // Delete any files the AI may have arbitrarily created
148
+ deleteAddedFiles([path.relative(manager.rootDirectory, manager.locadexDirectory)], ['dictionary.json', 'gt.config.json', 'locadex.yml']);
139
149
  // Update lockfile with processed files
140
150
  updateLockfile(files, lockfilePath, manager.rootDirectory);
141
151
  // Clean up stale entries from lockfile
142
152
  cleanupLockfile(lockfilePath, manager.rootDirectory);
143
153
  logger.message(chalk.dim(`Updated lockfile with ${files.length} files`));
144
- // Delete any files the AI may have arbitrarily created
145
- deleteAddedFiles([path.relative(manager.rootDirectory, manager.locadexDirectory)], ['dictionary.json', 'gt.config.json', 'locadex.yml']);
146
154
  cleanupOnExit();
147
155
  // Run translate cmd
148
156
  if (isGTAuthConfigured(manager.appDirectory) && !cliOptions.noTranslate) {
149
157
  try {
150
158
  logger.initializeSpinner();
151
159
  logger.spinner.start('Running locadex translate...');
152
- await execFunction('locadex', ['translate'], false, manager.appDirectory, manager.getAgentAbortController());
153
- 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
+ }
154
169
  }
155
170
  catch (error) {
156
171
  logger.spinner.stop('Translations failed!');
@@ -185,7 +200,8 @@ function getPrompt({ targetFile, dependencyFiles, dependentFiles, }) {
185
200
  - The project is already setup for internationalization. Do not try to setup the project again for i18n.
186
201
 
187
202
  ## Workflow:
188
- 1. **Gather context** Read the target files closely (you should not have to read the dependency/dependent files).
203
+ 1. **Gather context** Read the target files closely
204
+ - You do not have to read the dependency/dependent files for each target file. They are provided for convenience.
189
205
  2. **Evaluate if i18n is necessary** Evaluate if the target files need to be internationalized using gt-next
190
206
  - 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.
191
207
  **IMPORTANT**: IF NONE OF THE TARGET FILES NEED TO BE INTERNATIONALIZED, YOUR TASK IS COMPLETE AND YOU MAY RETURN.
@@ -203,7 +219,7 @@ function getPrompt({ targetFile, dependencyFiles, dependentFiles, }) {
203
219
  - When possible, avoid using useTranslations(); useGT() is always preferred.
204
220
  - DO NOT internationalize non-user facing content or content that is functional, such as ids, class names, error strings, logical strings, etc.
205
221
  - Do not add i18n middleware to the app.
206
- - ALWAYS adhere to the guides provided via the 'mcp__locadex__' tools.
222
+ - ALWAYS adhere to the guides provided via the 'mcp__locadex__*' tools.
207
223
  - These guides provide additional knowledge about how to internationalize the content.
208
224
  - Minimize the footprint of your changes.
209
225
  - Focus on internationalizing all user facing content in the target files.
@@ -239,4 +255,5 @@ ${allMcpPrompt}
239
255
  `;
240
256
  return prompt;
241
257
  }
242
- //# sourceMappingURL=i18n.js.map
258
+ //# sourceMappingURL=i18n.js.map
259
+ //# debugId=d655e317-abac-5345-8a2c-ea1e6a0ca6f0
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sourceRoot":"/","sources":["tasks/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAiB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO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,CAAC;AAChB,CAAC","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 // 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 // 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 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 (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. 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"]}
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,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oB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KAAK,EAAE,EAAE,CAAC;cACL,KAAK,GAAG,CAAC;EACrB,IAAI;;kDAE4C,KAAK,GAAG,CAAC;EACzD,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;;iDAEnC,KAAK,GAAG,CAAC;EACxD,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;CACjF,CACA;;;;;;EAMC,YAAY;;;;;;;;;CASb,CAAC;IAEA,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"d655e317-abac-5345-8a2c-ea1e6a0ca6f0"}
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"/","sources":["tasks/setup.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;GAIG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,OAAO,EAClB,aAAa,EAAE,OAAO,EACtB,uBAAuB,CAAC,EAAE,MAAM,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,3 +1,5 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="da80142d-3899-5af8-abcc-7e9163fff826")}catch(e){}}();
1
3
  import { createSpinner, promptConfirm } from '../logging/console.js';
2
4
  import { getPackageJson, isPackageInstalled } from 'gtx-cli/utils/packageJson';
3
5
  import { getPackageManager, } from 'gtx-cli/utils/packageManager';
@@ -113,7 +115,13 @@ export async function setupTask(cliOptions, autoSetup, bypassPrompts, specifiedP
113
115
  // Add locadex github action if not exists
114
116
  setupGithubAction(manager, packageManager);
115
117
  if (cliOptions.formatCmd) {
116
- 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
+ }
117
125
  }
118
126
  else {
119
127
  const formatter = await detectFormatter();
@@ -232,4 +240,5 @@ function MyComponent() {
232
240
  `;
233
241
  return prompt;
234
242
  }
235
- //# sourceMappingURL=setup.js.map
243
+ //# sourceMappingURL=setup.js.map
244
+ //# debugId=da80142d-3899-5af8-abcc-7e9163fff826