locadex 0.0.2-alpha.1 → 0.0.2-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/.locadex-mcp-stdio.json +9 -0
  2. package/.locadex-mcp.json +2 -3
  3. package/LICENSE.md +1 -1
  4. package/dist/cli.d.ts +1 -1
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +44 -9
  7. package/dist/cli.js.map +1 -1
  8. package/dist/commands/i18n.d.ts +2 -1
  9. package/dist/commands/i18n.d.ts.map +1 -1
  10. package/dist/commands/i18n.js +255 -140
  11. package/dist/commands/i18n.js.map +1 -1
  12. package/dist/commands/setup.d.ts +1 -1
  13. package/dist/commands/setup.d.ts.map +1 -1
  14. package/dist/commands/setup.js +141 -86
  15. package/dist/commands/setup.js.map +1 -1
  16. package/dist/index.d.ts +0 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +5 -68
  19. package/dist/index.js.map +1 -1
  20. package/dist/{utils/logging.d.ts → logging/console.d.ts} +9 -12
  21. package/dist/logging/console.d.ts.map +1 -0
  22. package/dist/logging/console.js +137 -0
  23. package/dist/logging/console.js.map +1 -0
  24. package/dist/logging/logger.d.ts +44 -0
  25. package/dist/logging/logger.d.ts.map +1 -0
  26. package/dist/logging/logger.js +142 -0
  27. package/dist/logging/logger.js.map +1 -0
  28. package/dist/mcp/debugger.d.ts +3 -0
  29. package/dist/mcp/debugger.d.ts.map +1 -0
  30. package/dist/mcp/debugger.js +37 -0
  31. package/dist/mcp/debugger.js.map +1 -0
  32. package/dist/mcp/getDocs.d.ts.map +1 -0
  33. package/dist/mcp/getDocs.js +56 -0
  34. package/dist/mcp/getDocs.js.map +1 -0
  35. package/dist/mcp/getGuide.d.ts +5 -0
  36. package/dist/mcp/getGuide.d.ts.map +1 -0
  37. package/dist/mcp/getGuide.js +17 -0
  38. package/dist/mcp/getGuide.js.map +1 -0
  39. package/dist/{tools → mcp/tools}/docs.d.ts +3 -0
  40. package/dist/mcp/tools/docs.d.ts.map +1 -0
  41. package/dist/mcp/tools/docs.js +86 -0
  42. package/dist/mcp/tools/docs.js.map +1 -0
  43. package/dist/mcp/tools/guides.d.ts +11 -0
  44. package/dist/mcp/tools/guides.d.ts.map +1 -0
  45. package/dist/mcp/tools/guides.js +118 -0
  46. package/dist/mcp/tools/guides.js.map +1 -0
  47. package/dist/mcp-sse.d.ts +3 -0
  48. package/dist/mcp-sse.d.ts.map +1 -0
  49. package/dist/mcp-sse.js +95 -0
  50. package/dist/mcp-sse.js.map +1 -0
  51. package/dist/mcp.d.ts +3 -0
  52. package/dist/mcp.d.ts.map +1 -0
  53. package/dist/mcp.js +34 -0
  54. package/dist/mcp.js.map +1 -0
  55. package/dist/prompts/system.d.ts +4 -0
  56. package/dist/prompts/system.d.ts.map +1 -0
  57. package/dist/prompts/system.js +17 -0
  58. package/dist/prompts/system.js.map +1 -0
  59. package/dist/telemetry.d.ts +11 -0
  60. package/dist/telemetry.d.ts.map +1 -0
  61. package/dist/telemetry.js +104 -0
  62. package/dist/telemetry.js.map +1 -0
  63. package/dist/types/claude-sdk.d.ts +39 -0
  64. package/dist/types/claude-sdk.d.ts.map +1 -0
  65. package/dist/types/claude-sdk.js +5 -0
  66. package/dist/types/claude-sdk.js.map +1 -0
  67. package/dist/types/cli.d.ts +7 -0
  68. package/dist/types/cli.d.ts.map +1 -0
  69. package/dist/types/cli.js +5 -0
  70. package/dist/types/cli.js.map +1 -0
  71. package/dist/utils/agentManager.d.ts +34 -0
  72. package/dist/utils/agentManager.d.ts.map +1 -0
  73. package/dist/utils/agentManager.js +123 -0
  74. package/dist/utils/agentManager.js.map +1 -0
  75. package/dist/utils/claudeCode.d.ts +14 -6
  76. package/dist/utils/claudeCode.d.ts.map +1 -1
  77. package/dist/utils/claudeCode.js +170 -102
  78. package/dist/utils/claudeCode.js.map +1 -1
  79. package/dist/utils/dag/createDag.d.ts +24 -0
  80. package/dist/utils/dag/createDag.d.ts.map +1 -0
  81. package/dist/utils/dag/createDag.js +181 -0
  82. package/dist/utils/dag/createDag.js.map +1 -0
  83. package/dist/utils/debugLogger.d.ts +3 -0
  84. package/dist/utils/debugLogger.d.ts.map +1 -0
  85. package/dist/utils/debugLogger.js +36 -0
  86. package/dist/utils/debugLogger.js.map +1 -0
  87. package/dist/utils/fs/findConfigs.d.ts +11 -0
  88. package/dist/utils/fs/findConfigs.d.ts.map +1 -0
  89. package/dist/utils/fs/findConfigs.js +63 -0
  90. package/dist/utils/fs/findConfigs.js.map +1 -0
  91. package/dist/utils/fs/getFiles.d.ts +2 -0
  92. package/dist/utils/fs/getFiles.d.ts.map +1 -0
  93. package/dist/utils/fs/getFiles.js +8 -0
  94. package/dist/utils/fs/getFiles.js.map +1 -0
  95. package/dist/utils/fs/writeFiles.d.ts +2 -0
  96. package/dist/utils/fs/writeFiles.d.ts.map +1 -0
  97. package/dist/utils/fs/writeFiles.js +19 -0
  98. package/dist/utils/fs/writeFiles.js.map +1 -0
  99. package/dist/utils/getFiles.d.ts +30 -0
  100. package/dist/utils/getFiles.d.ts.map +1 -0
  101. package/dist/utils/getFiles.js +152 -0
  102. package/dist/utils/getFiles.js.map +1 -0
  103. package/dist/utils/getPaths.d.ts +1 -0
  104. package/dist/utils/getPaths.d.ts.map +1 -1
  105. package/dist/utils/getPaths.js +19 -3
  106. package/dist/utils/getPaths.js.map +1 -1
  107. package/dist/utils/mcpConfig.d.ts.map +1 -1
  108. package/dist/utils/mcpConfig.js +5 -2
  109. package/dist/utils/mcpConfig.js.map +1 -1
  110. package/dist/utils/shared.d.ts +4 -0
  111. package/dist/utils/shared.d.ts.map +1 -0
  112. package/dist/utils/shared.js +26 -0
  113. package/dist/utils/shared.js.map +1 -0
  114. package/dist/utils/stats.d.ts +25 -0
  115. package/dist/utils/stats.d.ts.map +1 -0
  116. package/dist/utils/stats.js +40 -0
  117. package/dist/utils/stats.js.map +1 -0
  118. package/dist/utils/validateConfig.d.ts +2 -0
  119. package/dist/utils/validateConfig.d.ts.map +1 -0
  120. package/dist/utils/validateConfig.js +12 -0
  121. package/dist/utils/validateConfig.js.map +1 -0
  122. package/guides/next/advanced/complicated-mapping-expressions.md +200 -0
  123. package/guides/next/advanced/interpolated-strings.md +162 -0
  124. package/guides/next/advanced/migrating.md +86 -0
  125. package/guides/next/advanced/ternary-operators.md +217 -0
  126. package/guides/next/advanced/var-outside-client-component.md +446 -0
  127. package/guides/next/advanced/var-outside-client-server-component.md +550 -0
  128. package/guides/next/advanced/var-outside-server-component.md +545 -0
  129. package/guides/next/basic/branches.md +310 -0
  130. package/guides/next/basic/client-side-components.md +221 -0
  131. package/guides/next/basic/jsx.md +268 -0
  132. package/guides/next/basic/server-side-components.md +165 -0
  133. package/guides/next/basic/strings.md +144 -0
  134. package/guides/next/basic/variables.md +161 -0
  135. package/guides/next/important/functions.md +37 -0
  136. package/package.json +27 -13
  137. package/dist/resources/docs.d.ts +0 -4
  138. package/dist/resources/docs.d.ts.map +0 -1
  139. package/dist/resources/docs.js +0 -176
  140. package/dist/resources/docs.js.map +0 -1
  141. package/dist/tools/docs.d.ts.map +0 -1
  142. package/dist/tools/docs.js +0 -140
  143. package/dist/tools/docs.js.map +0 -1
  144. package/dist/utils/getDocs.d.ts.map +0 -1
  145. package/dist/utils/getDocs.js +0 -113
  146. package/dist/utils/getDocs.js.map +0 -1
  147. package/dist/utils/logging.d.ts.map +0 -1
  148. package/dist/utils/logging.js +0 -226
  149. package/dist/utils/logging.js.map +0 -1
  150. /package/dist/{utils → mcp}/getDocs.d.ts +0 -0
@@ -0,0 +1,95 @@
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]="ec071f2d-6d98-5b71-bce6-58436c1599e5")}catch(e){}}();
4
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import { addDocsTools } from './mcp/tools/docs.js';
6
+ import { existsSync, readFileSync } from 'node:fs';
7
+ import { fromPackageRoot } from './utils/getPaths.js';
8
+ import { addGuidesTools } from './mcp/tools/guides.js';
9
+ import express from 'express';
10
+ import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
11
+ import { logger } from './logging/logger.js';
12
+ import { createServer } from 'node:http';
13
+ async function findAvailablePort(startPort) {
14
+ return new Promise((resolve, reject) => {
15
+ const server = createServer();
16
+ server.listen(startPort, () => {
17
+ const port = server.address()?.port;
18
+ server.close(() => resolve(port));
19
+ });
20
+ server.on('error', (err) => {
21
+ if (err.code === 'EADDRINUSE') {
22
+ // Port is in use, try the next one
23
+ findAvailablePort(startPort + 1)
24
+ .then(resolve)
25
+ .catch(reject);
26
+ }
27
+ else {
28
+ reject(err);
29
+ }
30
+ });
31
+ });
32
+ }
33
+ export async function start() {
34
+ const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;
35
+ const requestedPort = process.env.PORT ? parseInt(process.env.PORT) : 8888;
36
+ const port = await findAvailablePort(requestedPort);
37
+ const verbose = process.env.LOCADEX_VERBOSE === 'true';
38
+ const debug = process.env.LOCADEX_DEBUG === 'true';
39
+ logger.initialize({ verbose, debug });
40
+ if (stateFile && existsSync(stateFile)) {
41
+ const state = JSON.parse(readFileSync(stateFile, 'utf8'));
42
+ logger.debugMessage(`[locadex-mcp] state: ${JSON.stringify(state, null, 2)}`);
43
+ }
44
+ else {
45
+ throw new Error(`[locadex-mcp] state file not found: ${stateFile}`);
46
+ }
47
+ const mcpServer = new McpServer({
48
+ name: 'Locadex: AI Agent for Internationalization',
49
+ version: JSON.parse(readFileSync(fromPackageRoot('package.json'), 'utf8'))
50
+ .version,
51
+ });
52
+ const app = express();
53
+ app.use(express.json());
54
+ // Store transports for each session type
55
+ const transports = {
56
+ streamable: {},
57
+ sse: {},
58
+ };
59
+ addDocsTools(mcpServer);
60
+ addGuidesTools(mcpServer);
61
+ // SSE endpoint for legacy clients
62
+ // Claude Code only supports SSE as of 2025-06-04
63
+ app.get('/sse', async (req, res) => {
64
+ const transport = new SSEServerTransport('/messages', res);
65
+ transports.sse[transport.sessionId] = transport;
66
+ res.on('close', () => {
67
+ delete transports.sse[transport.sessionId];
68
+ });
69
+ await mcpServer.connect(transport);
70
+ });
71
+ // Companion endpoint for sending messages
72
+ app.post('/messages', async (req, res) => {
73
+ const sessionId = req.query.sessionId;
74
+ const transport = transports.sse[sessionId];
75
+ if (transport) {
76
+ await transport.handlePostMessage(req, res, req.body);
77
+ }
78
+ else {
79
+ res.status(400).send('No transport found for sessionId');
80
+ }
81
+ });
82
+ app.listen(port, () => {
83
+ const portMessage = port !== requestedPort
84
+ ? `${port} (requested ${requestedPort} was in use)`
85
+ : `${port}`;
86
+ logger.debugMessage(`[locadex-mcp] started on port ${portMessage} with state file ${stateFile}`);
87
+ });
88
+ }
89
+ // Start the SSE server
90
+ start().catch((error) => {
91
+ logger.error(`[locadex-mcp-sse] Failed to start: ${error instanceof Error ? error.message : String(error)}`);
92
+ process.exit(1);
93
+ });
94
+ //# sourceMappingURL=mcp-sse.js.map
95
+ //# debugId=ec071f2d-6d98-5b71-bce6-58436c1599e5
@@ -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 } 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 { createServer } from 'node:http';\n\nasync function findAvailablePort(startPort: number): Promise<number> {\n return new Promise((resolve, reject) => {\n const server = createServer();\n\n server.listen(startPort, () => {\n const port = (server.address() as any)?.port;\n server.close(() => resolve(port));\n });\n\n server.on('error', (err: any) => {\n if (err.code === 'EADDRINUSE') {\n // Port is in use, try the next one\n findAvailablePort(startPort + 1)\n .then(resolve)\n .catch(reject);\n } else {\n reject(err);\n }\n });\n });\n}\n\nexport async function start() {\n const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;\n const requestedPort = process.env.PORT ? parseInt(process.env.PORT) : 8888;\n const port = await findAvailablePort(requestedPort);\n\n const verbose = process.env.LOCADEX_VERBOSE === 'true';\n const debug = process.env.LOCADEX_DEBUG === 'true';\n\n logger.initialize({ verbose, debug });\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\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 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 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] started on port ${portMessage} with state file ${stateFile}`\n );\n });\n}\n\n// Start the SSE server\nstart().catch((error) => {\n logger.error(\n `[locadex-mcp-sse] Failed to start: ${error instanceof Error ? error.message : String(error)}`\n );\n process.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,MAAM,qBAAqB,CAAC;AACtD,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,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,KAAK,UAAU,iBAAiB,CAAC,SAAiB;IAChD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;QAE9B,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE;YAC5B,MAAM,IAAI,GAAI,MAAM,CAAC,OAAO,EAAU,EAAE,IAAI,CAAC;YAC7C,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAQ,EAAE,EAAE;YAC9B,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC9B,mCAAmC;gBACnC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QACxD,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;QACpB,MAAM,WAAW,GACf,IAAI,KAAK,aAAa;YACpB,CAAC,CAAC,GAAG,IAAI,eAAe,aAAa,cAAc;YACnD,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;QAChB,MAAM,CAAC,YAAY,CACjB,iCAAiC,WAAW,oBAAoB,SAAS,EAAE,CAC5E,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uBAAuB;AACvB,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACtB,MAAM,CAAC,KAAK,CACV,sCAAsC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC/F,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","debug_id":"ec071f2d-6d98-5b71-bce6-58436c1599e5"}
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import './telemetry.js';
3
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"/","sources":["mcp.ts"],"names":[],"mappings":";AAEA,OAAO,gBAAgB,CAAC"}
package/dist/mcp.js ADDED
@@ -0,0 +1,34 @@
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]="d5982bc6-3621-56f8-ac4a-8f0368dd1b1e")}catch(e){}}();
4
+ import './telemetry.js';
5
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
+ import { addDocsTools } from './mcp/tools/docs.js';
8
+ import { existsSync, readFileSync } from 'node:fs';
9
+ import { fromPackageRoot } from './utils/getPaths.js';
10
+ import { addGuidesTools } from './mcp/tools/guides.js';
11
+ async function main() {
12
+ const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;
13
+ if (stateFile && existsSync(stateFile)) {
14
+ const state = JSON.parse(readFileSync(stateFile, 'utf8'));
15
+ console.error(`[locadex-mcp] state: ${JSON.stringify(state, null, 2)}`);
16
+ }
17
+ else {
18
+ throw new Error(`[locadex-mcp] state file not found: ${stateFile}`);
19
+ }
20
+ const server = new McpServer({
21
+ name: 'Locadex: AI Agent for Internationalization',
22
+ version: JSON.parse(readFileSync(fromPackageRoot('package.json'), 'utf8'))
23
+ .version,
24
+ });
25
+ addDocsTools(server);
26
+ addGuidesTools(server);
27
+ console.error('[locadex-mcp] All tools registered');
28
+ const transport = new StdioServerTransport();
29
+ await server.connect(transport);
30
+ console.error('[locadex-mcp] started on stdio');
31
+ }
32
+ main();
33
+ //# sourceMappingURL=mcp.js.map
34
+ //# debugId=d5982bc6-3621-56f8-ac4a-8f0368dd1b1e
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sources":["mcp.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';\n\nasync function main() {\n const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;\n if (stateFile && existsSync(stateFile)) {\n const state = JSON.parse(readFileSync(stateFile, 'utf8'));\n console.error(`[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 addDocsTools(server);\n addGuidesTools(server);\n\n console.error('[locadex-mcp] All tools registered');\n const transport = new StdioServerTransport();\n await server.connect(transport);\n console.error('[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;AAEvD,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;IAC5D,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,OAAO,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1E,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;IACH,YAAY,CAAC,MAAM,CAAC,CAAC;IACrB,cAAc,CAAC,MAAM,CAAC,CAAC;IAEvB,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;AAClD,CAAC;AACD,IAAI,EAAE,CAAC","debug_id":"d5982bc6-3621-56f8-ac4a-8f0368dd1b1e"}
@@ -0,0 +1,4 @@
1
+ export declare const mcpDocsTools: string[];
2
+ export declare const mcpGuidesTools: string[];
3
+ export declare const allMcpPrompt: string;
4
+ //# sourceMappingURL=system.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,17 @@
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){}}();
3
+ import { guides } from '../mcp/tools/guides.js';
4
+ import { docsTools } from '../mcp/tools/docs.js';
5
+ export const mcpDocsTools = Object.keys(docsTools).map((tool) => `mcp__locadex__${tool}`);
6
+ export const mcpGuidesTools = guides.map((guide) => `mcp__locadex__${guide.id}`);
7
+ export const allMcpPrompt = `You have access to mcp tools made available via the 'locadex' mcp server:
8
+
9
+ ## Documentation Tools:
10
+ ${mcpDocsTools.join('\n')}
11
+
12
+ ## Guide Tools:
13
+ ${mcpGuidesTools.join('\n')}
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
+ //# sourceMappingURL=system.js.map
17
+ //# debugId=1e9e969a-185e-5a86-a7a7-a61c5b750119
@@ -0,0 +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"}
@@ -0,0 +1,11 @@
1
+ import * as Sentry from '@sentry/node';
2
+ import { PostHog } from 'posthog-node';
3
+ import { CliOptions } from './types/cli.js';
4
+ declare const posthog: PostHog;
5
+ export { posthog };
6
+ export { Sentry };
7
+ export declare function withTelemetry<F>(params: {
8
+ enabled: boolean;
9
+ options: CliOptions;
10
+ }, callback: () => F | Promise<F>): Promise<F>;
11
+ //# sourceMappingURL=telemetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"/","sources":["telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAO5C,QAAA,MAAM,OAAO,SAcX,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,OAAO,EAAE,MAAM,EAAE,CAAC;AAqClB,wBAAsB,aAAa,CAAC,CAAC,EACnC,MAAM,EAAE;IACN,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC;CACrB,EACD,QAAQ,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,CAAC,CAAC,CAiCZ"}
@@ -0,0 +1,104 @@
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]="1778889b-e97a-571b-a4e0-eaccf88a9e01")}catch(e){}}();
3
+ import * as Sentry from '@sentry/node';
4
+ import { PostHog } from 'posthog-node';
5
+ import { getLocadexVersion } from './utils/getPaths.js';
6
+ let _posthog = null;
7
+ let sentryInitialized = false;
8
+ let telemetryEnabled = false;
9
+ // Create a PostHog proxy that behaves like PostHog but does nothing when disabled
10
+ const posthog = new Proxy({}, {
11
+ get(target, prop) {
12
+ if (!telemetryEnabled || !_posthog) {
13
+ // Return no-op functions for all PostHog methods
14
+ if (typeof prop === 'string' &&
15
+ ['capture', 'identify', 'alias', 'shutdown'].includes(prop)) {
16
+ return () => { };
17
+ }
18
+ return undefined;
19
+ }
20
+ return _posthog[prop];
21
+ },
22
+ });
23
+ export { posthog };
24
+ export { Sentry };
25
+ function initializeTelemetry(enabled) {
26
+ telemetryEnabled = enabled;
27
+ if (!sentryInitialized) {
28
+ Sentry.init({
29
+ dsn: 'https://f542d2155ab069c9de0fcd913ed3ce3b@o4508407294853120.ingest.us.sentry.io/4509441836843008',
30
+ release: getLocadexVersion(),
31
+ enabled,
32
+ beforeSend: (event) => {
33
+ event.exception?.values?.forEach((exception) => {
34
+ delete exception.stacktrace;
35
+ });
36
+ delete event.server_name;
37
+ return event;
38
+ },
39
+ });
40
+ sentryInitialized = true;
41
+ }
42
+ if (!_posthog && enabled) {
43
+ _posthog = new PostHog('phc_LJRRBlhH8kgjiydp2bKjC7QPMguDoNd1b4QHQArxtha', {
44
+ host: 'https://us.i.posthog.com',
45
+ disableGeoip: true,
46
+ });
47
+ }
48
+ }
49
+ function updateProgress(status) {
50
+ posthog.capture({
51
+ distinctId: 'anonymous',
52
+ event: 'locadex_progress',
53
+ properties: { status },
54
+ });
55
+ }
56
+ export async function withTelemetry(params, callback) {
57
+ const { enabled, options } = params;
58
+ initializeTelemetry(enabled);
59
+ if (!enabled) {
60
+ return await callback();
61
+ }
62
+ Sentry.setTag('args.verbose', !!options.verbose);
63
+ Sentry.setTag('args.noTelemetry', !!options.noTelemetry);
64
+ try {
65
+ return await Sentry.startSpan({
66
+ name: 'locadex-execution',
67
+ op: 'locadex.flow',
68
+ }, async () => {
69
+ updateProgress('start');
70
+ const res = await callback();
71
+ updateProgress('finished');
72
+ return res;
73
+ });
74
+ }
75
+ catch (e) {
76
+ Sentry.captureException(e);
77
+ throw e;
78
+ }
79
+ finally {
80
+ await Sentry.flush(3000).then(null, () => { });
81
+ if (_posthog) {
82
+ await _posthog.shutdown();
83
+ }
84
+ }
85
+ }
86
+ const shutdown = async () => {
87
+ if (_posthog) {
88
+ await _posthog.shutdown();
89
+ }
90
+ process.exit(0);
91
+ };
92
+ process.on('SIGINT', () => {
93
+ shutdown();
94
+ });
95
+ process.on('SIGTERM', () => {
96
+ shutdown();
97
+ });
98
+ process.on('exit', () => {
99
+ if (_posthog) {
100
+ _posthog.shutdown();
101
+ }
102
+ });
103
+ //# sourceMappingURL=telemetry.js.map
104
+ //# debugId=1778889b-e97a-571b-a4e0-eaccf88a9e01
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.js","sources":["telemetry.ts"],"sourceRoot":"/","sourcesContent":["import * as Sentry from '@sentry/node';\nimport { PostHog } from 'posthog-node';\nimport { getLocadexVersion } from './utils/getPaths.js';\nimport { CliOptions } from './types/cli.js';\n\nlet _posthog: PostHog | null = null;\nlet sentryInitialized = false;\nlet telemetryEnabled = false;\n\n// Create a PostHog proxy that behaves like PostHog but does nothing when disabled\nconst posthog = new Proxy({} as PostHog, {\n get(target, prop) {\n if (!telemetryEnabled || !_posthog) {\n // Return no-op functions for all PostHog methods\n if (\n typeof prop === 'string' &&\n ['capture', 'identify', 'alias', 'shutdown'].includes(prop)\n ) {\n return () => {};\n }\n return undefined;\n }\n return _posthog[prop as keyof PostHog];\n },\n});\n\nexport { posthog };\nexport { Sentry };\n\nfunction initializeTelemetry(enabled: boolean) {\n telemetryEnabled = enabled;\n\n if (!sentryInitialized) {\n Sentry.init({\n dsn: 'https://f542d2155ab069c9de0fcd913ed3ce3b@o4508407294853120.ingest.us.sentry.io/4509441836843008',\n release: getLocadexVersion(),\n enabled,\n beforeSend: (event) => {\n event.exception?.values?.forEach((exception) => {\n delete exception.stacktrace;\n });\n delete event.server_name;\n return event;\n },\n });\n sentryInitialized = true;\n }\n\n if (!_posthog && enabled) {\n _posthog = new PostHog('phc_LJRRBlhH8kgjiydp2bKjC7QPMguDoNd1b4QHQArxtha', {\n host: 'https://us.i.posthog.com',\n disableGeoip: true,\n });\n }\n}\n\nfunction updateProgress(status: string) {\n posthog.capture({\n distinctId: 'anonymous',\n event: 'locadex_progress',\n properties: { status },\n });\n}\n\nexport async function withTelemetry<F>(\n params: {\n enabled: boolean;\n options: CliOptions;\n },\n callback: () => F | Promise<F>\n): Promise<F> {\n const { enabled, options } = params;\n initializeTelemetry(enabled);\n\n if (!enabled) {\n return await callback();\n }\n\n Sentry.setTag('args.verbose', !!options.verbose);\n Sentry.setTag('args.noTelemetry', !!options.noTelemetry);\n\n try {\n return await Sentry.startSpan(\n {\n name: 'locadex-execution',\n op: 'locadex.flow',\n },\n async () => {\n updateProgress('start');\n const res = await callback();\n updateProgress('finished');\n return res;\n }\n );\n } catch (e) {\n Sentry.captureException(e);\n throw e;\n } finally {\n await Sentry.flush(3000).then(null, () => {});\n if (_posthog) {\n await _posthog.shutdown();\n }\n }\n}\n\nconst shutdown = async () => {\n if (_posthog) {\n await _posthog.shutdown();\n }\n process.exit(0);\n};\n\nprocess.on('SIGINT', () => {\n shutdown();\n});\nprocess.on('SIGTERM', () => {\n shutdown();\n});\nprocess.on('exit', () => {\n if (_posthog) {\n _posthog.shutdown();\n }\n});\n"],"names":[],"mappings":";;AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,IAAI,QAAQ,GAAmB,IAAI,CAAC;AACpC,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAE7B,kFAAkF;AAClF,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,EAAa,EAAE;I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AAM,QAAQ,GAAG,KAAK,IAAI,EAAE;IAC1B,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,QAAQ,EAAE,CAAC;AACb,CAAC,CAAC,CAAC;AACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACzB,QAAQ,EAAE,CAAC;AACb,CAAC,CAAC,CAAC;AACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;IACtB,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACtB,CAAC;AACH,CAAC,CAAC,CAAC","debug_id":"1778889b-e97a-571b-a4e0-eaccf88a9e01"}
@@ -0,0 +1,39 @@
1
+ import { Message, MessageParam } from '@anthropic-ai/sdk/resources';
2
+ export type ClaudeSDKMessage = {
3
+ type: 'assistant';
4
+ message: Message;
5
+ session_id: string;
6
+ } | {
7
+ type: 'user';
8
+ message: MessageParam;
9
+ session_id: string;
10
+ } | {
11
+ type: 'result';
12
+ subtype: 'success';
13
+ cost_usd: Number;
14
+ duration_ms: Number;
15
+ duration_api_ms: Number;
16
+ is_error: boolean;
17
+ num_turns: Number;
18
+ result: string;
19
+ session_id: string;
20
+ } | {
21
+ type: 'result';
22
+ subtype: 'error_max_turns';
23
+ cost_usd: Number;
24
+ duration_ms: Number;
25
+ duration_api_ms: Number;
26
+ is_error: boolean;
27
+ num_turns: Number;
28
+ session_id: string;
29
+ } | {
30
+ type: 'system';
31
+ subtype: 'init';
32
+ session_id: string;
33
+ tools: string[];
34
+ mcp_servers: {
35
+ name: string;
36
+ status: string;
37
+ }[];
38
+ };
39
+ //# sourceMappingURL=claude-sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-sdk.d.ts","sourceRoot":"/","sources":["types/claude-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAExB;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,GAGD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,GAGD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,GAGD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,GAGD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;CACL,CAAC"}
@@ -0,0 +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]="0c2e0fbb-3b18-500a-8d12-ba9e398d3b39")}catch(e){}}();
3
+ export {};
4
+ //# sourceMappingURL=claude-sdk.js.map
5
+ //# debugId=0c2e0fbb-3b18-500a-8d12-ba9e398d3b39
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-sdk.js","sources":["types/claude-sdk.ts"],"sourceRoot":"/","sourcesContent":["import { Message, MessageParam } from '@anthropic-ai/sdk/resources';\n\nexport type ClaudeSDKMessage =\n // An assistant message\n | {\n type: 'assistant';\n message: Message; // from Anthropic SDK\n session_id: string;\n }\n\n // A user message\n | {\n type: 'user';\n message: MessageParam; // from Anthropic SDK\n session_id: string;\n }\n\n // Emitted as the last message\n | {\n type: 'result';\n subtype: 'success';\n cost_usd: Number;\n duration_ms: Number;\n duration_api_ms: Number;\n is_error: boolean;\n num_turns: Number;\n result: string;\n session_id: string;\n }\n\n // Emitted as the last message, when we've reached the maximum number of turns\n | {\n type: 'result';\n subtype: 'error_max_turns';\n cost_usd: Number;\n duration_ms: Number;\n duration_api_ms: Number;\n is_error: boolean;\n num_turns: Number;\n session_id: string;\n }\n\n // Emitted as the first message at the start of a conversation\n | {\n type: 'system';\n subtype: 'init';\n session_id: string;\n tools: string[];\n mcp_servers: {\n name: string;\n status: string;\n }[];\n };\n"],"names":[],"mappings":"","debug_id":"0c2e0fbb-3b18-500a-8d12-ba9e398d3b39"}
@@ -0,0 +1,7 @@
1
+ export type CliOptions = {
2
+ verbose?: boolean;
3
+ debug?: boolean;
4
+ noTelemetry?: boolean;
5
+ batchSize?: string;
6
+ };
7
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"/","sources":["types/cli.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
@@ -0,0 +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]="0bcfa866-9916-5f4e-8612-cd741b840359")}catch(e){}}();
3
+ export {};
4
+ //# sourceMappingURL=cli.js.map
5
+ //# debugId=0bcfa866-9916-5f4e-8612-cd741b840359
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sources":["types/cli.ts"],"sourceRoot":"/","sourcesContent":["export type CliOptions = {\n verbose?: boolean;\n debug?: boolean;\n noTelemetry?: boolean;\n batchSize?: string;\n};\n"],"names":[],"mappings":"","debug_id":"0bcfa866-9916-5f4e-8612-cd741b840359"}
@@ -0,0 +1,34 @@
1
+ import { ClaudeCodeRunner } from './claudeCode.js';
2
+ import { AgentStats } from './stats.js';
3
+ export interface LocadexMetadata {
4
+ createdAt: string;
5
+ locadexVersion: string;
6
+ workingDirectory: string;
7
+ projectName: string;
8
+ transport: 'sse' | 'stdio';
9
+ tempDirectory: string;
10
+ nodeVersion: string;
11
+ platform: string;
12
+ arch: string;
13
+ batchSize?: number;
14
+ [key: string]: any;
15
+ }
16
+ export declare class LocadexManager {
17
+ private mcpProcess;
18
+ private mcpConfigPath;
19
+ private filesStateFilePath;
20
+ private metadataFilePath;
21
+ private tempDir;
22
+ private apiKey?;
23
+ stats: AgentStats;
24
+ constructor(options: {
25
+ mcpTransport: 'sse' | 'stdio';
26
+ apiKey?: string;
27
+ metadata?: Partial<LocadexMetadata>;
28
+ });
29
+ createAgent(): ClaudeCodeRunner;
30
+ getFilesStateFilePath(): string;
31
+ getMetadataFilePath(): string;
32
+ cleanup(): void;
33
+ }
34
+ //# sourceMappingURL=agentManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentManager.d.ts","sourceRoot":"/","sources":["utils/agentManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AASnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,KAAK,GAAG,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAYD,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,KAAK,EAAE,UAAU,CAAC;gBAEN,OAAO,EAAE;QACnB,YAAY,EAAE,KAAK,GAAG,OAAO,CAAC;QAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;KACrC;IA2FD,WAAW,IAAI,gBAAgB;IAO/B,qBAAqB,IAAI,MAAM;IAI/B,mBAAmB,IAAI,MAAM;IAI7B,OAAO,IAAI,IAAI;CAUhB"}
@@ -0,0 +1,123 @@
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]="72460f4b-3120-52fb-a586-974a085b144e")}catch(e){}}();
3
+ import { ClaudeCodeRunner } from './claudeCode.js';
4
+ import { fromPackageRoot } from './getPaths.js';
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+ import { logger } from '../logging/logger.js';
8
+ import { addToGitIgnore } from './fs/writeFiles.js';
9
+ import { spawn } from 'node:child_process';
10
+ import { AgentStats } from './stats.js';
11
+ const mcpStdioConfig = {
12
+ mcpServers: {
13
+ locadex: {
14
+ command: 'npx',
15
+ args: ['locadex-mcp'],
16
+ env: {},
17
+ },
18
+ },
19
+ };
20
+ export class LocadexManager {
21
+ mcpProcess;
22
+ mcpConfigPath;
23
+ filesStateFilePath;
24
+ metadataFilePath;
25
+ tempDir;
26
+ apiKey;
27
+ stats;
28
+ constructor(options) {
29
+ this.apiKey = options.apiKey || process.env.ANTHROPIC_API_KEY;
30
+ this.stats = new AgentStats();
31
+ const cwd = process.cwd();
32
+ this.tempDir = path.resolve(cwd, '.locadex', Date.now().toString());
33
+ fs.mkdirSync(this.tempDir, { recursive: true });
34
+ logger.debugMessage(`Temp directory created at: ${this.tempDir}`);
35
+ addToGitIgnore(cwd, '.locadex');
36
+ logger.debugMessage(`Added .locadex to .gitignore`);
37
+ this.mcpConfigPath = path.resolve(this.tempDir, 'mcp.json');
38
+ this.filesStateFilePath = path.resolve(this.tempDir, 'files-state.json');
39
+ this.metadataFilePath = path.resolve(this.tempDir, 'metadata.json');
40
+ // Create files-state.json
41
+ const filesState = [];
42
+ fs.writeFileSync(this.filesStateFilePath, JSON.stringify(filesState, null, 2));
43
+ // Create metadata.json
44
+ const metadata = {
45
+ createdAt: new Date().toISOString(),
46
+ locadexVersion: JSON.parse(fs.readFileSync(fromPackageRoot('package.json'), 'utf8')).version,
47
+ workingDirectory: cwd,
48
+ projectName: path.basename(cwd),
49
+ transport: options.mcpTransport,
50
+ tempDirectory: this.tempDir,
51
+ nodeVersion: process.version,
52
+ platform: process.platform,
53
+ arch: process.arch,
54
+ ...options.metadata,
55
+ };
56
+ fs.writeFileSync(this.metadataFilePath, JSON.stringify(metadata, null, 2));
57
+ logger.debugMessage(`Created metadata.json at: ${this.metadataFilePath}`);
58
+ if (options.mcpTransport === 'stdio') {
59
+ mcpStdioConfig.mcpServers.locadex.env = {
60
+ LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,
61
+ };
62
+ try {
63
+ fs.writeFileSync(this.mcpConfigPath, JSON.stringify(mcpStdioConfig, null, 2));
64
+ }
65
+ catch {
66
+ this.mcpConfigPath = fromPackageRoot('.locadex-mcp-stdio.json');
67
+ }
68
+ }
69
+ else {
70
+ this.mcpProcess = spawn('node', [fromPackageRoot('dist/mcp-sse.js')], {
71
+ env: {
72
+ LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,
73
+ LOCADEX_VERBOSE: logger.verbose ? 'true' : 'false',
74
+ LOCADEX_DEBUG: logger.debug ? 'true' : 'false',
75
+ ...process.env,
76
+ },
77
+ stdio: 'inherit',
78
+ });
79
+ this.mcpProcess.on('error', (error) => {
80
+ logger.error(`MCP server failed to start: ${error.message}`);
81
+ process.exit(1);
82
+ });
83
+ this.mcpProcess.on('exit', (code, signal) => {
84
+ if (code !== 0 && code !== null) {
85
+ logger.error(`MCP server exited with code ${code}`);
86
+ process.exit(code);
87
+ }
88
+ if (signal) {
89
+ logger.error(`MCP server was killed with signal ${signal}`);
90
+ process.exit(1);
91
+ }
92
+ });
93
+ process.on('exit', () => {
94
+ this.cleanup();
95
+ });
96
+ this.mcpConfigPath = fromPackageRoot('.locadex-mcp.json');
97
+ }
98
+ }
99
+ createAgent() {
100
+ return new ClaudeCodeRunner(this, {
101
+ apiKey: this.apiKey,
102
+ mcpConfig: this.mcpConfigPath,
103
+ });
104
+ }
105
+ getFilesStateFilePath() {
106
+ return this.filesStateFilePath;
107
+ }
108
+ getMetadataFilePath() {
109
+ return this.metadataFilePath;
110
+ }
111
+ cleanup() {
112
+ if (this.mcpProcess && !this.mcpProcess.killed) {
113
+ this.mcpProcess.kill('SIGTERM');
114
+ setTimeout(() => {
115
+ if (this.mcpProcess && !this.mcpProcess.killed) {
116
+ this.mcpProcess.kill('SIGKILL');
117
+ }
118
+ }, 1000);
119
+ }
120
+ }
121
+ }
122
+ //# sourceMappingURL=agentManager.js.map
123
+ //# debugId=72460f4b-3120-52fb-a586-974a085b144e
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentManager.js","sources":["utils/agentManager.ts"],"sourceRoot":"/","sourcesContent":["import { ClaudeCodeRunner } from './claudeCode.js';\nimport { fromPackageRoot } from './getPaths.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { FileEntry } from './getFiles.js';\nimport { logger } from '../logging/logger.js';\nimport { addToGitIgnore } from './fs/writeFiles.js';\nimport { spawn } from 'node:child_process';\nimport type { ChildProcess } from 'node:child_process';\nimport { AgentStats } from './stats.js';\n\nexport interface LocadexMetadata {\n createdAt: string;\n locadexVersion: string;\n workingDirectory: string;\n projectName: string;\n transport: 'sse' | 'stdio';\n tempDirectory: string;\n nodeVersion: string;\n platform: string;\n arch: string;\n batchSize?: number;\n [key: string]: any;\n}\n\nconst mcpStdioConfig = {\n mcpServers: {\n locadex: {\n command: 'npx',\n args: ['locadex-mcp'],\n env: {},\n },\n },\n};\n\nexport class LocadexManager {\n private mcpProcess: ChildProcess | undefined;\n private mcpConfigPath: string;\n private filesStateFilePath: string;\n private metadataFilePath: string;\n private tempDir: string;\n private apiKey?: string;\n stats: AgentStats;\n\n constructor(options: {\n mcpTransport: 'sse' | 'stdio';\n apiKey?: string;\n metadata?: Partial<LocadexMetadata>;\n }) {\n this.apiKey = options.apiKey || process.env.ANTHROPIC_API_KEY;\n this.stats = new AgentStats();\n\n const cwd = process.cwd();\n this.tempDir = path.resolve(cwd, '.locadex', Date.now().toString());\n fs.mkdirSync(this.tempDir, { recursive: true });\n\n logger.debugMessage(`Temp directory created at: ${this.tempDir}`);\n\n addToGitIgnore(cwd, '.locadex');\n\n logger.debugMessage(`Added .locadex to .gitignore`);\n\n this.mcpConfigPath = path.resolve(this.tempDir, 'mcp.json');\n this.filesStateFilePath = path.resolve(this.tempDir, 'files-state.json');\n this.metadataFilePath = path.resolve(this.tempDir, 'metadata.json');\n\n // Create files-state.json\n const filesState: FileEntry[] = [];\n fs.writeFileSync(\n this.filesStateFilePath,\n JSON.stringify(filesState, null, 2)\n );\n\n // Create metadata.json\n const metadata: LocadexMetadata = {\n createdAt: new Date().toISOString(),\n locadexVersion: JSON.parse(\n fs.readFileSync(fromPackageRoot('package.json'), 'utf8')\n ).version,\n workingDirectory: cwd,\n projectName: path.basename(cwd),\n transport: options.mcpTransport,\n tempDirectory: this.tempDir,\n nodeVersion: process.version,\n platform: process.platform,\n arch: process.arch,\n ...options.metadata,\n };\n fs.writeFileSync(this.metadataFilePath, JSON.stringify(metadata, null, 2));\n\n logger.debugMessage(`Created metadata.json at: ${this.metadataFilePath}`);\n\n if (options.mcpTransport === 'stdio') {\n mcpStdioConfig.mcpServers.locadex.env = {\n LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,\n };\n try {\n fs.writeFileSync(\n this.mcpConfigPath,\n JSON.stringify(mcpStdioConfig, null, 2)\n );\n } catch {\n this.mcpConfigPath = fromPackageRoot('.locadex-mcp-stdio.json');\n }\n } else {\n this.mcpProcess = spawn('node', [fromPackageRoot('dist/mcp-sse.js')], {\n env: {\n LOCADEX_FILES_STATE_FILE_PATH: this.filesStateFilePath,\n LOCADEX_VERBOSE: logger.verbose ? 'true' : 'false',\n LOCADEX_DEBUG: logger.debug ? 'true' : 'false',\n ...process.env,\n },\n stdio: 'inherit',\n });\n\n this.mcpProcess.on('error', (error) => {\n logger.error(`MCP server failed to start: ${error.message}`);\n process.exit(1);\n });\n\n this.mcpProcess.on('exit', (code, signal) => {\n if (code !== 0 && code !== null) {\n logger.error(`MCP server exited with code ${code}`);\n process.exit(code);\n }\n if (signal) {\n logger.error(`MCP server was killed with signal ${signal}`);\n process.exit(1);\n }\n });\n\n process.on('exit', () => {\n this.cleanup();\n });\n\n this.mcpConfigPath = fromPackageRoot('.locadex-mcp.json');\n }\n }\n\n createAgent(): ClaudeCodeRunner {\n return new ClaudeCodeRunner(this, {\n apiKey: this.apiKey,\n mcpConfig: this.mcpConfigPath,\n });\n }\n\n getFilesStateFilePath(): string {\n return this.filesStateFilePath;\n }\n\n getMetadataFilePath(): string {\n return this.metadataFilePath;\n }\n\n cleanup(): void {\n if (this.mcpProcess && !this.mcpProcess.killed) {\n this.mcpProcess.kill('SIGTERM');\n setTimeout(() => {\n if (this.mcpProcess && !this.mcpProcess.killed) {\n this.mcpProcess.kill('SIGKILL');\n }\n }, 1000);\n }\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAgBxC,MAAM,cAAc,GAAG;IACrB,UAAU,EAAE;QACV,OAAO,EAAE;YACP,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,aAAa,CAAC;YACrB,GAAG,EAAE,EAAE;SACR;KACF;CACF,CAAC;AAEF,MAAM,OAAO,cAAc;IACjB,UAAU,CAA2B;IACrC,aAAa,CAAS;IACtB,kBAAkB,CAAS;IAC3B,gBAAgB,CAAS;IACzB,OAAO,CAAS;IAChB,MAAM,CAAU;IACxB,KAA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EAAE,IAAI,CAAC,aAAa;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,qBAAqB;QACnB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED,mBAAmB;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC/C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAChC,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;oBAC/C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;IACH,CAAC;CACF","debug_id":"72460f4b-3120-52fb-a586-974a085b144e"}
@@ -1,16 +1,24 @@
1
+ import { LocadexManager } from './agentManager.js';
1
2
  export interface ClaudeCodeOptions {
2
- systemPrompt?: string;
3
+ additionalSystemPrompt?: string;
3
4
  prompt: string;
4
- outputFormat?: 'text' | 'json' | 'stream-json';
5
- mcpConfig?: string;
6
- allowedTools?: string[];
5
+ additionalAllowedTools?: string[];
7
6
  maxTurns?: number;
7
+ sessionId?: string;
8
+ }
9
+ export interface ClaudeCodeObservation {
8
10
  }
9
11
  export declare class ClaudeCodeRunner {
10
12
  private options;
11
- constructor(options?: {
13
+ private sessionId;
14
+ private mcpConfig;
15
+ private manager;
16
+ constructor(manager: LocadexManager, options?: {
12
17
  apiKey?: string;
18
+ mcpConfig?: string;
13
19
  });
14
- run(options: ClaudeCodeOptions): Promise<string>;
20
+ getSessionId(): string;
21
+ run(options: ClaudeCodeOptions, obs: ClaudeCodeObservation): Promise<string>;
22
+ private handleSDKOutput;
15
23
  }
16
24
  //# sourceMappingURL=claudeCode.d.ts.map