locadex 0.0.2-alpha.4 → 0.0.2-alpha.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["commands/i18n.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAgC1D,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,iBAwK5E"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"/","sources":["commands/i18n.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAgC1D,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,iBAyK5E"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="24e0dc6c-383b-537d-98d1-ca9226e5afa3")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="45fc236d-924c-5d3f-9d18-1f9b354d86e1")}catch(e){}}();
3
3
  import { createSpinner } from '../logging/console.js';
4
4
  import { allMcpPrompt } from '../prompts/system.js';
5
5
  import { logger } from '../logging/logger.js';
@@ -38,7 +38,6 @@ export async function i18nCommand(batchSize, manager) {
38
38
  // Init message
39
39
  const spinner = createSpinner();
40
40
  spinner.start('Initializing Locadex...');
41
- const startTime = Date.now();
42
41
  const dag = createDag(getCurrentDirectories(), {
43
42
  tsConfig: findTsConfig(),
44
43
  webpackConfig: findWebpackConfig(),
@@ -157,7 +156,7 @@ export async function i18nCommand(batchSize, manager) {
157
156
  }
158
157
  logger.info(chalk.dim(`Total Cost: $${manager.stats.getStats().totalCost.toFixed(2)}
159
158
  Total API duration: ${Math.round(manager.stats.getStats().totalApiDuration / 1000)}s
160
- Total wall duration: ${Math.round((Date.now() - startTime) / 1000)}s
159
+ Total wall time: ${Math.round((Date.now() - manager.stats.getStats().startTime) / 1000)}s
161
160
  Total files processed: ${manager.stats.getStats().processedFiles}`));
162
161
  outro(chalk.green('✅ Locadex i18n complete!'));
163
162
  process.exit(0);
@@ -257,4 +256,4 @@ function getReportPrompt() {
257
256
  return prompt;
258
257
  }
259
258
  //# sourceMappingURL=i18n.js.map
260
- //# debugId=24e0dc6c-383b-537d-98d1-ca9226e5afa3
259
+ //# debugId=45fc236d-924c-5d3f-9d18-1f9b354d86e1
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.js","sources":["commands/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { createProgressBar, createSpinner } from '../logging/console.js';\nimport { allMcpPrompt } from '../prompts/system.js';\n\nimport { logger } from '../logging/logger.js';\nimport { createDag } from '../utils/dag/createDag.js';\nimport {\n findTsConfig,\n findWebpackConfig,\n findRequireConfig,\n} from '../utils/fs/findConfigs.js';\nimport { LocadexManager } from '../utils/agentManager.js';\nimport {\n addFilesToManager,\n markFileAsEdited,\n markFileAsInProgress,\n} from '../utils/getFiles.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { readdirSync, statSync } from 'node:fs';\nimport { EXCLUDED_DIRS } from '../utils/shared.js';\nimport { validateInitialConfig } from '../utils/validateConfig.js';\nimport { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';\n\nfunction getCurrentDirectories(): string[] {\n try {\n return readdirSync(process.cwd())\n .filter((item) => {\n try {\n return statSync(item).isDirectory();\n } catch {\n return false;\n }\n })\n .map((dir) => `./${dir}`)\n .filter((dir) => {\n return !EXCLUDED_DIRS.includes(dir);\n });\n } catch {\n return [];\n }\n}\n\nexport async function i18nCommand(batchSize: number, manager?: LocadexManager) {\n validateInitialConfig();\n\n // Init message\n const spinner = createSpinner();\n spinner.start('Initializing Locadex...');\n const startTime = Date.now();\n\n const dag = createDag(getCurrentDirectories(), {\n tsConfig: findTsConfig(),\n webpackConfig: findWebpackConfig(),\n requireConfig: findRequireConfig(),\n });\n\n // If no manager is provided, create a new one\n if (!manager) {\n manager = new LocadexManager({\n mcpTransport: 'sse',\n metadata: {\n batchSize: batchSize,\n },\n });\n process.on('beforeExit', () => manager!.cleanup());\n }\n\n const agent = manager.createAgent();\n const filesStateFilePath = manager.getFilesStateFilePath();\n\n // Track session id\n let sessionId: string | undefined = undefined;\n\n // Create the list of files (aka tasks) to process\n const taskQueue = [...dag.getTopologicalOrder()];\n\n const allFiles = [...dag.getTopologicalOrder()];\n\n // Add files to manager\n const stateFilePath = addFilesToManager(filesStateFilePath, taskQueue);\n spinner.stop('Locadex initialized');\n\n logger.verboseMessage(\n `Number of files to process: ${dag.getTopologicalOrder().length}`\n );\n logger.debugMessage(`Track progress here: ${stateFilePath}`);\n\n logger.initializeProgressBar(taskQueue.length);\n logger.progressBar.start('Processing files...');\n // Main loop\n let hasError = false;\n while (taskQueue.length > 0) {\n // Get the next task\n const tasks = taskQueue.splice(0, batchSize);\n if (tasks.length === 0) {\n break;\n }\n\n // Mark task as in progress\n tasks.forEach((task) => markFileAsInProgress(task, filesStateFilePath));\n\n // Construct prompt\n const dependencies = Object.fromEntries(\n tasks.map((task) => [\n task,\n Array.from(new Set(dag.getDependencies(task))),\n ])\n );\n const dependents = Object.fromEntries(\n tasks.map((task) => [task, Array.from(new Set(dag.getDependents(task)))])\n );\n const prompt = getPrompt({\n targetFile: tasks,\n dependencyFiles: dependencies,\n dependentFiles: dependents,\n });\n\n // Claude call\n try {\n await agent.run(\n {\n prompt,\n sessionId,\n },\n { spinner }\n );\n if (!sessionId) {\n sessionId = agent.getSessionId();\n }\n } catch (error) {\n hasError = true;\n logger.debugMessage(`[i18n] Error in claude i18n process: ${error}`);\n break;\n }\n\n // Mark task as complete\n tasks.forEach((task) => markFileAsEdited(task, filesStateFilePath));\n logger.progressBar.advance(\n tasks.length,\n `Processed ${Number(((allFiles.length - taskQueue.length) / allFiles.length) * 100).toFixed(2)}% of files`\n );\n manager.stats.updateStats({\n newProcessedFiles: tasks.length,\n });\n }\n\n logger.progressBar.stop(`Processed ${allFiles.length} files`);\n\n // TODO: uncomment\n // // Always clean up the file list when done, regardless of success or failure\n // logger.info(`Cleaning up file list: ${stateFilePath}`);\n // cleanUp(stateFilePath);\n\n // If there was an error, exit with code 1\n if (hasError) {\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n\n // Fix prompt\n logger.initializeSpinner();\n logger.spinner.start('Fixing errors...');\n const fixPrompt = getFixPrompt();\n try {\n await agent.run({ prompt: fixPrompt, sessionId }, { spinner });\n } catch (error) {\n logger.debugMessage(`[i18n] Fixing errors failed: ${error}`);\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n logger.spinner.stop('Fixed errors');\n\n // Generate report\n logger.initializeSpinner();\n logger.spinner.start('Generating report...');\n const reportPrompt = getReportPrompt();\n try {\n await agent.run(\n {\n prompt: reportPrompt,\n sessionId,\n },\n { spinner }\n );\n } catch (error) {\n logger.debugMessage(`[i18n] Error in claude report generation: ${error}`);\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n logger.spinner.stop('Report generated');\n\n // cleanup\n\n const formatter = await detectFormatter();\n\n if (formatter) {\n await formatFiles(allFiles, formatter);\n }\n\n logger.info(\n chalk.dim(\n `Total Cost: $${manager.stats.getStats().totalCost.toFixed(2)}\nTotal API duration: ${Math.round(manager.stats.getStats().totalApiDuration / 1000)}s\nTotal wall duration: ${Math.round((Date.now() - startTime) / 1000)}s\nTotal files processed: ${manager.stats.getStats().processedFiles}`\n )\n );\n\n outro(chalk.green('✅ Locadex i18n complete!'));\n process.exit(0);\n}\n\nfunction getPrompt({\n targetFile,\n dependencyFiles,\n dependentFiles,\n}: {\n targetFile: string[];\n dependencyFiles: Record<string, string[]>;\n dependentFiles: Record<string, string[]>;\n}) {\n const prompt = `# Task: Internationalize the target file(s) using gt-next.\n\n## INSTRUCTIONS\n\n- You are given a list of target files and their corresponding dependency/dependent files.\n- The project is already setup for internationalization. Do not try to setup the project again for i18n.\n\n## Workflow:\n1. **Gather context** Read the target files closely (you should not have to read the dependency/dependent files).\n2. **Evaluate if i18n is necessary** Evaluate if the target files need to be internationalized using gt-next \n - If the target files have no relevant content, are already internationalized, or contain build-time code (e.g. nextjs plugins) they should never be internationalized.\n**IMPORTANT**: IF NONE OF THE TARGET FILES NEED TO BE INTERNATIONALIZED, YOUR TASK IS COMPLETE AND YOU MAY RETURN.\n3. **Identify the tools to use** Given the contents of the files, ask yourself which tools and guides you need to use to get the necessary knowledge to internationalize the target files. Here are some helpful questions to evaluate for tool selection:\n - 3.a. Does this file contain a component? If so, is it a server-side component or a client-side component?\n - 3.b. Is the content that needs to be i18ned being used in this same file, or is it being used in another file?\n - 3.c. Is there any string interpolation that needs to be i18ned?\n - 3.d. Is there any conditional logic or rendering that needs to be i18ned?\n - 3.e. Is the content that needs to be i18ned HTML/JSX or a string?\n4. **Internationalize** You now have the necessary knowledge. Internationalize the files using the information from the tools provided to you.\n - 4.a. Do not worry about running tsc. We will do that later.\n\n## RULES:\n- ALWAYS use the <T> component to internationalize HTML/JSX content.\n- ALWAYS use getGT() or useGT() and getDict() or useDict() to internationalize string content.\n - When possible, avoid using getDict() or useDict(); getGT() and useGT() are preferred.\n- DO NOT internationalize non-user facing content or content that is functional, such as ids, class names, error strings, logical strings, etc.\n- Do not add i18n middleware to the app.\n- When adding 'useGT()' or 'useDict()' to a client component, you must add 'use client' to the top of the file.\n- Always adhere to the guides provided via the 'mcp__locadex__' tools.\n - These guides provide additional knowledge about how to internationalize the content.\n- Minimize the footprint of your changes.\n- Focus on internationalizing the content of the target files.\n- NEVER move internationalized content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR REMOVE ANY FILES (especially .bak files)\n- Internationalize all user facing content in the target files. \n- NEVER EDIT FILES THAT ARE NOT GIVEN TO YOU.\n\n## TARGET FILE INFORMATION\n${targetFile.map(\n (file, index) => `\nTARGET FILE ${index + 1}:\n${file}\n\nDEPENDENCY FILES (files imported by target file ${index + 1}):\n${dependencyFiles[file].length > 0 ? ` ${dependencyFiles[file].join(', ')}` : 'none'}\n\nDEPENDENT FILES (files that import target file ${index + 1}):\n${dependentFiles[file].length > 0 ? ` ${dependentFiles[file].join(', ')}` : 'none'}\n`\n)}\n\n---\n\n## MCP TOOLS\n\n${allMcpPrompt}\n`;\n\n return prompt;\n}\n\n// check (dry run and ts check) should be at the end\n\nfunction getFixPrompt() {\n const prompt = `# Task: Fix implementation errors in the project.\n\n## INSTRUCTIONS\n\nPreviously, you helped me internationalize a set of files in this project.\nYour new task is as follows:\n\n1. Run the gt-next validator.\n2. Fix all errors relevant to the gt-next implementation code.\n3. Whenever you are finished with your changes, run the gt-next validator.\n4. Repeat steps 1-3 until there are no more errors, or until you believe that you have fixed all errors.\n5. If the project is setup with linting, lint the project and fix all errors.\n\n## RULES:\n- DO NOT modify any files that are not relevant to the gt-next implementation code.\n- ONLY fix errors that are relevant to the gt-next implementation code and your current or previous implementation.\n- Resolve unused imports from 'gt-next'. \n - In particular, if a file contains user-facing content that should be internationalized and is not, you should internationalize it.\n- Resolve missing imports from 'gt-next'. If a file is missing an import from 'gt-next', add it.\n\nTo run the gt-next validator, run the following command:\n'npx locadex translate --dry-run'\n\n## MCP TOOLS\n${allMcpPrompt}`;\n\n return prompt;\n}\n\nfunction getReportPrompt() {\n const prompt = `Your new task is as follows:\n- Please add a markdown file called 'locadex-report.md' to the root of the project.\n- The report should include a summary of the changes you made to the project.\n- A list of items the user needs to complete to finish the internationalization process (adding env vars, etc.).`;\n\n return prompt;\n}\n"],"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AAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;CACjF,CACA;;;;;;EAMC,YAAY;CACb,CAAC;IAEA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,oDAAoD;AAEpD,SAAS,YAAY;IACnB,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;EAwBf,YAAY,EAAE,CAAC;IAEf,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe;IACtB,MAAM,MAAM,GAAG;;;iHAGgG,CAAC;IAEhH,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"24e0dc6c-383b-537d-98d1-ca9226e5afa3"}
1
+ {"version":3,"file":"i18n.js","sources":["commands/i18n.ts"],"sourceRoot":"/","sourcesContent":["import { createProgressBar, createSpinner } from '../logging/console.js';\nimport { allMcpPrompt } from '../prompts/system.js';\n\nimport { logger } from '../logging/logger.js';\nimport { createDag } from '../utils/dag/createDag.js';\nimport {\n findTsConfig,\n findWebpackConfig,\n findRequireConfig,\n} from '../utils/fs/findConfigs.js';\nimport { LocadexManager } from '../utils/agentManager.js';\nimport {\n addFilesToManager,\n markFileAsEdited,\n markFileAsInProgress,\n} from '../utils/getFiles.js';\nimport { outro } from '@clack/prompts';\nimport chalk from 'chalk';\nimport { readdirSync, statSync } from 'node:fs';\nimport { EXCLUDED_DIRS } from '../utils/shared.js';\nimport { validateInitialConfig } from '../utils/validateConfig.js';\nimport { detectFormatter, formatFiles } from 'gtx-cli/hooks/postProcess';\n\nfunction getCurrentDirectories(): string[] {\n try {\n return readdirSync(process.cwd())\n .filter((item) => {\n try {\n return statSync(item).isDirectory();\n } catch {\n return false;\n }\n })\n .map((dir) => `./${dir}`)\n .filter((dir) => {\n return !EXCLUDED_DIRS.includes(dir);\n });\n } catch {\n return [];\n }\n}\n\nexport async function i18nCommand(batchSize: number, manager?: LocadexManager) {\n validateInitialConfig();\n\n // Init message\n const spinner = createSpinner();\n spinner.start('Initializing Locadex...');\n\n const dag = createDag(getCurrentDirectories(), {\n tsConfig: findTsConfig(),\n webpackConfig: findWebpackConfig(),\n requireConfig: findRequireConfig(),\n });\n\n // If no manager is provided, create a new one\n if (!manager) {\n manager = new LocadexManager({\n mcpTransport: 'sse',\n metadata: {\n batchSize: batchSize,\n },\n });\n process.on('beforeExit', () => manager!.cleanup());\n }\n\n const agent = manager.createAgent();\n const filesStateFilePath = manager.getFilesStateFilePath();\n\n // Track session id\n let sessionId: string | undefined = undefined;\n\n // Create the list of files (aka tasks) to process\n const taskQueue = [...dag.getTopologicalOrder()];\n\n const allFiles = [...dag.getTopologicalOrder()];\n\n // Add files to manager\n const stateFilePath = addFilesToManager(filesStateFilePath, taskQueue);\n spinner.stop('Locadex initialized');\n\n logger.verboseMessage(\n `Number of files to process: ${dag.getTopologicalOrder().length}`\n );\n logger.debugMessage(`Track progress here: ${stateFilePath}`);\n\n logger.initializeProgressBar(taskQueue.length);\n logger.progressBar.start('Processing files...');\n // Main loop\n let hasError = false;\n while (taskQueue.length > 0) {\n // Get the next task\n const tasks = taskQueue.splice(0, batchSize);\n if (tasks.length === 0) {\n break;\n }\n\n // Mark task as in progress\n tasks.forEach((task) => markFileAsInProgress(task, filesStateFilePath));\n\n // Construct prompt\n const dependencies = Object.fromEntries(\n tasks.map((task) => [\n task,\n Array.from(new Set(dag.getDependencies(task))),\n ])\n );\n const dependents = Object.fromEntries(\n tasks.map((task) => [task, Array.from(new Set(dag.getDependents(task)))])\n );\n const prompt = getPrompt({\n targetFile: tasks,\n dependencyFiles: dependencies,\n dependentFiles: dependents,\n });\n\n // Claude call\n try {\n await agent.run(\n {\n prompt,\n sessionId,\n },\n { spinner }\n );\n if (!sessionId) {\n sessionId = agent.getSessionId();\n }\n } catch (error) {\n hasError = true;\n logger.debugMessage(`[i18n] Error in claude i18n process: ${error}`);\n break;\n }\n\n // Mark task as complete\n tasks.forEach((task) => markFileAsEdited(task, filesStateFilePath));\n logger.progressBar.advance(\n tasks.length,\n `Processed ${Number(((allFiles.length - taskQueue.length) / allFiles.length) * 100).toFixed(2)}% of files`\n );\n manager.stats.updateStats({\n newProcessedFiles: tasks.length,\n });\n }\n\n logger.progressBar.stop(`Processed ${allFiles.length} files`);\n\n // TODO: uncomment\n // // Always clean up the file list when done, regardless of success or failure\n // logger.info(`Cleaning up file list: ${stateFilePath}`);\n // cleanUp(stateFilePath);\n\n // If there was an error, exit with code 1\n if (hasError) {\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n\n // Fix prompt\n logger.initializeSpinner();\n logger.spinner.start('Fixing errors...');\n const fixPrompt = getFixPrompt();\n try {\n await agent.run({ prompt: fixPrompt, sessionId }, { spinner });\n } catch (error) {\n logger.debugMessage(`[i18n] Fixing errors failed: ${error}`);\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n logger.spinner.stop('Fixed errors');\n\n // Generate report\n logger.initializeSpinner();\n logger.spinner.start('Generating report...');\n const reportPrompt = getReportPrompt();\n try {\n await agent.run(\n {\n prompt: reportPrompt,\n sessionId,\n },\n { spinner }\n );\n } catch (error) {\n logger.debugMessage(`[i18n] Error in claude report generation: ${error}`);\n outro(chalk.red('❌ Locadex i18n failed!'));\n process.exit(1);\n }\n logger.spinner.stop('Report generated');\n\n // cleanup\n\n const formatter = await detectFormatter();\n\n if (formatter) {\n await formatFiles(allFiles, formatter);\n }\n\n logger.info(\n chalk.dim(\n `Total Cost: $${manager.stats.getStats().totalCost.toFixed(2)}\nTotal API duration: ${Math.round(manager.stats.getStats().totalApiDuration / 1000)}s\nTotal wall time: ${Math.round(\n (Date.now() - manager.stats.getStats().startTime) / 1000\n )}s\nTotal files processed: ${manager.stats.getStats().processedFiles}`\n )\n );\n\n outro(chalk.green('✅ Locadex i18n complete!'));\n process.exit(0);\n}\n\nfunction getPrompt({\n targetFile,\n dependencyFiles,\n dependentFiles,\n}: {\n targetFile: string[];\n dependencyFiles: Record<string, string[]>;\n dependentFiles: Record<string, string[]>;\n}) {\n const prompt = `# Task: Internationalize the target file(s) using gt-next.\n\n## INSTRUCTIONS\n\n- You are given a list of target files and their corresponding dependency/dependent files.\n- The project is already setup for internationalization. Do not try to setup the project again for i18n.\n\n## Workflow:\n1. **Gather context** Read the target files closely (you should not have to read the dependency/dependent files).\n2. **Evaluate if i18n is necessary** Evaluate if the target files need to be internationalized using gt-next \n - If the target files have no relevant content, are already internationalized, or contain build-time code (e.g. nextjs plugins) they should never be internationalized.\n**IMPORTANT**: IF NONE OF THE TARGET FILES NEED TO BE INTERNATIONALIZED, YOUR TASK IS COMPLETE AND YOU MAY RETURN.\n3. **Identify the tools to use** Given the contents of the files, ask yourself which tools and guides you need to use to get the necessary knowledge to internationalize the target files. Here are some helpful questions to evaluate for tool selection:\n - 3.a. Does this file contain a component? If so, is it a server-side component or a client-side component?\n - 3.b. Is the content that needs to be i18ned being used in this same file, or is it being used in another file?\n - 3.c. Is there any string interpolation that needs to be i18ned?\n - 3.d. Is there any conditional logic or rendering that needs to be i18ned?\n - 3.e. Is the content that needs to be i18ned HTML/JSX or a string?\n4. **Internationalize** You now have the necessary knowledge. Internationalize the files using the information from the tools provided to you.\n - 4.a. Do not worry about running tsc. We will do that later.\n\n## RULES:\n- ALWAYS use the <T> component to internationalize HTML/JSX content.\n- ALWAYS use getGT() or useGT() and getDict() or useDict() to internationalize string content.\n - When possible, avoid using getDict() or useDict(); getGT() and useGT() are preferred.\n- DO NOT internationalize non-user facing content or content that is functional, such as ids, class names, error strings, logical strings, etc.\n- Do not add i18n middleware to the app.\n- When adding 'useGT()' or 'useDict()' to a client component, you must add 'use client' to the top of the file.\n- Always adhere to the guides provided via the 'mcp__locadex__' tools.\n - These guides provide additional knowledge about how to internationalize the content.\n- Minimize the footprint of your changes.\n- Focus on internationalizing the content of the target files.\n- NEVER move internationalized content to a different file. All content MUST remain in the same file where it came from.\n- NEVER CREATE OR REMOVE ANY FILES (especially .bak files)\n- Internationalize all user facing content in the target files. \n- NEVER EDIT FILES THAT ARE NOT GIVEN TO YOU.\n\n## TARGET FILE INFORMATION\n${targetFile.map(\n (file, index) => `\nTARGET FILE ${index + 1}:\n${file}\n\nDEPENDENCY FILES (files imported by target file ${index + 1}):\n${dependencyFiles[file].length > 0 ? ` ${dependencyFiles[file].join(', ')}` : 'none'}\n\nDEPENDENT FILES (files that import target file ${index + 1}):\n${dependentFiles[file].length > 0 ? ` ${dependentFiles[file].join(', ')}` : 'none'}\n`\n)}\n\n---\n\n## MCP TOOLS\n\n${allMcpPrompt}\n`;\n\n return prompt;\n}\n\n// check (dry run and ts check) should be at the end\n\nfunction getFixPrompt() {\n const prompt = `# Task: Fix implementation errors in the project.\n\n## INSTRUCTIONS\n\nPreviously, you helped me internationalize a set of files in this project.\nYour new task is as follows:\n\n1. Run the gt-next validator.\n2. Fix all errors relevant to the gt-next implementation code.\n3. Whenever you are finished with your changes, run the gt-next validator.\n4. Repeat steps 1-3 until there are no more errors, or until you believe that you have fixed all errors.\n5. If the project is setup with linting, lint the project and fix all errors.\n\n## RULES:\n- DO NOT modify any files that are not relevant to the gt-next implementation code.\n- ONLY fix errors that are relevant to the gt-next implementation code and your current or previous implementation.\n- Resolve unused imports from 'gt-next'. \n - In particular, if a file contains user-facing content that should be internationalized and is not, you should internationalize it.\n- Resolve missing imports from 'gt-next'. If a file is missing an import from 'gt-next', add it.\n\nTo run the gt-next validator, run the following command:\n'npx locadex translate --dry-run'\n\n## MCP TOOLS\n${allMcpPrompt}`;\n\n return prompt;\n}\n\nfunction getReportPrompt() {\n const prompt = `Your new task is as follows:\n- Please add a markdown file called 'locadex-report.md' to the root of the project.\n- The report should include a summary of the changes you made to the project.\n- A list of items the user needs to complete to finish the internationalization process (adding env vars, etc.).`;\n\n return prompt;\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM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AAS,YAAY;IACnB,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;EAwBf,YAAY,EAAE,CAAC;IAEf,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe;IACtB,MAAM,MAAM,GAAG;;;iHAGgG,CAAC;IAEhH,OAAO,MAAM,CAAC;AAChB,CAAC","debug_id":"45fc236d-924c-5d3f-9d18-1f9b354d86e1"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4bdf228e-fa91-599c-a406-3cfbe5bb4b91")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b15992f1-272d-53e9-9bd7-d99e84099701")}catch(e){}}();
3
3
  import { logInfo, logWarning, logError, logSuccess, logStep, logMessage, logErrorAndExit, createProgressBar, createSpinner, } from './console.js';
4
4
  class ProgressBar {
5
5
  progressBar;
@@ -123,7 +123,7 @@ class Logger {
123
123
  }
124
124
  debugMessage(message) {
125
125
  if (this._debug) {
126
- this.message(`[locadex] ${message}`);
126
+ this.message(message);
127
127
  }
128
128
  }
129
129
  initializeProgressBar(total) {
@@ -139,4 +139,4 @@ class Logger {
139
139
  }
140
140
  export const logger = Logger.getInstance();
141
141
  //# sourceMappingURL=logger.js.map
142
- //# debugId=4bdf228e-fa91-599c-a406-3cfbe5bb4b91
142
+ //# debugId=b15992f1-272d-53e9-9bd7-d99e84099701
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sources":["logging/logger.ts"],"sourceRoot":"/","sourcesContent":["import { ProgressResult, SpinnerResult } from '@clack/prompts';\nimport { CliOptions } from '../types/cli.js';\nimport {\n logInfo,\n logWarning,\n logError,\n logSuccess,\n logStep,\n logMessage,\n logErrorAndExit,\n createProgressBar,\n createSpinner,\n} from './console.js';\n\nclass ProgressBar {\n private progressBar: ProgressResult | undefined;\n constructor() {}\n\n init(total: number): void {\n if (!this.progressBar) {\n this.progressBar = createProgressBar(total);\n }\n }\n\n start(message?: string): void {\n if (this.progressBar) {\n this.progressBar.start(message);\n }\n }\n\n advance(amount: number, message?: string): void {\n if (this.progressBar) {\n this.progressBar.advance(amount, message);\n }\n }\n\n stop(message?: string): void {\n if (this.progressBar) {\n try {\n this.progressBar.stop(message);\n this.progressBar = undefined;\n } catch (error) {\n this.progressBar = undefined;\n }\n }\n }\n}\n\nclass Spinner {\n private spinner: SpinnerResult | undefined;\n constructor() {}\n\n init(): void {\n if (!this.spinner) {\n this.spinner = createSpinner();\n }\n }\n\n start(message?: string): void {\n if (this.spinner) {\n this.spinner.start(message);\n }\n }\n\n update(message?: string): void {\n if (this.spinner) {\n this.spinner.message(message);\n }\n }\n\n stop(message?: string): void {\n if (this.spinner) {\n try {\n this.spinner.stop(message);\n this.spinner = undefined;\n } catch (error) {\n this.spinner = undefined;\n }\n }\n }\n}\n\nclass Logger {\n private static instance: Logger;\n private _verbose: boolean = false;\n private _debug: boolean = false;\n progressBar: ProgressBar = new ProgressBar();\n spinner: Spinner = new Spinner();\n private constructor() {}\n\n static getInstance(): Logger {\n if (!Logger.instance) {\n Logger.instance = new Logger();\n }\n return Logger.instance;\n }\n\n initialize(options: CliOptions): void {\n if (options.debug) {\n this._debug = true;\n this._verbose = true;\n }\n if (options.verbose) {\n this._verbose = true;\n }\n }\n\n get verbose(): boolean {\n return this._verbose;\n }\n\n get debug(): boolean {\n return this._debug;\n }\n\n reset(): void {\n this._verbose = false;\n this._debug = false;\n }\n\n // Basic logging methods using existing console functions\n info(message: string): void {\n logInfo(message);\n }\n\n warning(message: string): void {\n logWarning(message);\n }\n\n error(message: string): void {\n logError(message);\n }\n\n success(message: string): void {\n logSuccess(message);\n }\n\n step(message: string): void {\n logStep(message);\n }\n\n message(message: string): void {\n logMessage(message);\n }\n\n errorAndExit(message: string): void {\n logErrorAndExit(message);\n }\n\n // Conditional logging methods\n verboseMessage(message: string): void {\n if (this._verbose) {\n this.message(message);\n }\n }\n\n debugMessage(message: string): void {\n if (this._debug) {\n this.message(`[locadex] ${message}`);\n }\n }\n\n initializeProgressBar(total: number): void {\n if (!this._verbose && !this._debug) {\n this.progressBar.init(total);\n }\n }\n initializeSpinner(): void {\n if (!this._verbose && !this._debug) {\n this.spinner.init();\n }\n }\n}\n\nexport const logger = Logger.getInstance();\n"],"names":[],"mappings":";;AAEA,OAAO,EACL,OAAO,EACP,UAAU,EACV,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW;IACP,WAAW,CAA6B;IAChD,gBAAe,CAAC;IAEhB,IAAI,CAAC,KAAa;QAChB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,IAAI,CAAC,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAgB;QACpB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAED,OAAO,CAAC,MAAc,EAAE,OAAgB;QACtC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAgB;QACnB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,IAAI,CAAC;gBACH,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,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AI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,YAAY,CAAC,OAAe;QAC1B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,CAAC,aAAa,OAAO,EAAE,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,qBAAqB,CAAC,KAAa;QACjC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACnC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IACD,iBAAiB;QACf,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC","debug_id":"4bdf228e-fa91-599c-a406-3cfbe5bb4b91"}
1
+ {"version":3,"file":"logger.js","sources":["logging/logger.ts"],"sourceRoot":"/","sourcesContent":["import { ProgressResult, SpinnerResult } from '@clack/prompts';\nimport { CliOptions } from '../types/cli.js';\nimport {\n logInfo,\n logWarning,\n logError,\n logSuccess,\n logStep,\n logMessage,\n logErrorAndExit,\n createProgressBar,\n createSpinner,\n} from './console.js';\n\nclass ProgressBar {\n private progressBar: ProgressResult | undefined;\n constructor() {}\n\n init(total: number): void {\n if (!this.progressBar) {\n this.progressBar = createProgressBar(total);\n }\n }\n\n start(message?: string): void {\n if (this.progressBar) {\n this.progressBar.start(message);\n }\n }\n\n advance(amount: number, message?: string): void {\n if (this.progressBar) {\n this.progressBar.advance(amount, message);\n }\n }\n\n stop(message?: string): void {\n if (this.progressBar) {\n try {\n this.progressBar.stop(message);\n this.progressBar = undefined;\n } catch (error) {\n this.progressBar = undefined;\n }\n }\n }\n}\n\nclass Spinner {\n private spinner: SpinnerResult | undefined;\n constructor() {}\n\n init(): void {\n if (!this.spinner) {\n this.spinner = createSpinner();\n }\n }\n\n start(message?: string): void {\n if (this.spinner) {\n this.spinner.start(message);\n }\n }\n\n update(message?: string): void {\n if (this.spinner) {\n this.spinner.message(message);\n }\n }\n\n stop(message?: string): void {\n if (this.spinner) {\n try {\n this.spinner.stop(message);\n this.spinner = undefined;\n } catch (error) {\n this.spinner = undefined;\n }\n }\n }\n}\n\nclass Logger {\n private static instance: Logger;\n private _verbose: boolean = false;\n private _debug: boolean = false;\n progressBar: ProgressBar = new ProgressBar();\n spinner: Spinner = new Spinner();\n private constructor() {}\n\n static getInstance(): Logger {\n if (!Logger.instance) {\n Logger.instance = new Logger();\n }\n return Logger.instance;\n }\n\n initialize(options: CliOptions): void {\n if (options.debug) {\n this._debug = true;\n this._verbose = true;\n }\n if (options.verbose) {\n this._verbose = true;\n }\n }\n\n get verbose(): boolean {\n return this._verbose;\n }\n\n get debug(): boolean {\n return this._debug;\n }\n\n reset(): void {\n this._verbose = false;\n this._debug = false;\n }\n\n // Basic logging methods using existing console functions\n info(message: string): void {\n logInfo(message);\n }\n\n warning(message: string): void {\n logWarning(message);\n }\n\n error(message: string): void {\n logError(message);\n }\n\n success(message: string): void {\n logSuccess(message);\n }\n\n step(message: string): void {\n logStep(message);\n }\n\n message(message: string): void {\n logMessage(message);\n }\n\n errorAndExit(message: string): void {\n logErrorAndExit(message);\n }\n\n // Conditional logging methods\n verboseMessage(message: string): void {\n if (this._verbose) {\n this.message(message);\n }\n }\n\n debugMessage(message: string): void {\n if (this._debug) {\n this.message(message);\n }\n }\n\n initializeProgressBar(total: number): void {\n if (!this._verbose && !this._debug) {\n this.progressBar.init(total);\n }\n }\n initializeSpinner(): void {\n if (!this._verbose && !this._debug) {\n this.spinner.init();\n }\n }\n}\n\nexport const logger = Logger.getInstance();\n"],"names":[],"mappings":";;AAEA,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D,iBAAiB;QACf,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC","debug_id":"b15992f1-272d-53e9-9bd7-d99e84099701"}
@@ -5,6 +5,7 @@ export declare class AgentStats {
5
5
  private totalToolCalls;
6
6
  private totalApiDuration;
7
7
  private totalWallDuration;
8
+ private startTime;
8
9
  constructor();
9
10
  updateStats(stats: {
10
11
  newProcessedFiles?: number;
@@ -20,6 +21,7 @@ export declare class AgentStats {
20
21
  totalToolCalls: number;
21
22
  totalApiDuration: number;
22
23
  totalWallDuration: number;
24
+ startTime: number;
23
25
  };
24
26
  }
25
27
  //# sourceMappingURL=stats.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"/","sources":["utils/stats.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,gBAAgB,CAAa;IACrC,OAAO,CAAC,iBAAiB,CAAa;;IAItC,WAAW,CAAC,KAAK,EAAE;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;IAkBD,QAAQ,IAAI;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,MAAM,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;KAC3B;CAUF"}
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"/","sources":["utils/stats.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,gBAAgB,CAAa;IACrC,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,SAAS,CAAS;;IAM1B,WAAW,CAAC,KAAK,EAAE;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;IAkBD,QAAQ,IAAI;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,MAAM,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;KACnB;CAWF"}
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f4ae1a46-30f3-5eeb-9733-0407efdaf7f3")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cae70ec6-4bdd-5777-af0d-5eea7935c485")}catch(e){}}();
3
3
  export class AgentStats {
4
4
  totalFiles = 0;
5
5
  processedFiles = 0;
@@ -7,7 +7,10 @@ export class AgentStats {
7
7
  totalToolCalls = 0;
8
8
  totalApiDuration = 0;
9
9
  totalWallDuration = 0;
10
- constructor() { }
10
+ startTime;
11
+ constructor() {
12
+ this.startTime = Date.now();
13
+ }
11
14
  updateStats(stats) {
12
15
  if (stats.newProcessedFiles) {
13
16
  this.processedFiles += stats.newProcessedFiles;
@@ -33,8 +36,9 @@ export class AgentStats {
33
36
  totalToolCalls: this.totalToolCalls,
34
37
  totalApiDuration: this.totalApiDuration,
35
38
  totalWallDuration: this.totalWallDuration,
39
+ startTime: this.startTime,
36
40
  };
37
41
  }
38
42
  }
39
43
  //# sourceMappingURL=stats.js.map
40
- //# debugId=f4ae1a46-30f3-5eeb-9733-0407efdaf7f3
44
+ //# debugId=cae70ec6-4bdd-5777-af0d-5eea7935c485
@@ -1 +1 @@
1
- {"version":3,"file":"stats.js","sources":["utils/stats.ts"],"sourceRoot":"/","sourcesContent":["export class AgentStats {\n private totalFiles: number = 0;\n private processedFiles: number = 0;\n private totalCost: number = 0;\n private totalToolCalls: number = 0;\n private totalApiDuration: number = 0;\n private totalWallDuration: number = 0;\n\n constructor() {}\n\n updateStats(stats: {\n newProcessedFiles?: number;\n newCost?: number;\n newToolCalls?: number;\n newApiDuration?: number;\n newWallDuration?: number;\n }) {\n if (stats.newProcessedFiles) {\n this.processedFiles += stats.newProcessedFiles;\n }\n if (stats.newCost) {\n this.totalCost += stats.newCost;\n }\n if (stats.newToolCalls) {\n this.totalToolCalls += stats.newToolCalls;\n }\n if (stats.newApiDuration) {\n this.totalApiDuration += stats.newApiDuration;\n }\n if (stats.newWallDuration) {\n this.totalWallDuration += stats.newWallDuration;\n }\n }\n\n getStats(): {\n totalFiles: number;\n processedFiles: number;\n totalCost: number;\n totalToolCalls: number;\n totalApiDuration: number;\n totalWallDuration: number;\n } {\n return {\n totalFiles: this.totalFiles,\n processedFiles: this.processedFiles,\n totalCost: this.totalCost,\n totalToolCalls: this.totalToolCalls,\n totalApiDuration: this.totalApiDuration,\n totalWallDuration: this.totalWallDuration,\n };\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,OAAO,UAAU;IACb,UAAU,GAAW,CAAC,CAAC;IACvB,cAAc,GAAW,CAAC,CAAC;IAC3B,SAAS,GAAW,CAAC,CAAC;IACtB,cAAc,GAAW,CAAC,CAAC;IAC3B,gBAAgB,GAAW,CAAC,CAAC;IAC7B,iBAAiB,GAAW,CAAC,CAAC;IAEtC,gBAAe,CAAC;IAEhB,WAAW,CAAC,KAMX;QACC,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,iBAAiB,CAAC;QACjD,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC;QAClC,CAAC;QACD,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACvB,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,YAAY,CAAC;QAC5C,CAAC;QACD,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;YACzB,IAAI,CAAC,gBAAgB,IAAI,KAAK,CAAC,cAAc,CAAC;QAChD,CAAC;QACD,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;YAC1B,IAAI,CAAC,iBAAiB,IAAI,KAAK,CAAC,eAAe,CAAC;QAClD,CAAC;IACH,CAAC;IAED,QAAQ;QAQN,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC;IACJ,CAAC;CACF","debug_id":"f4ae1a46-30f3-5eeb-9733-0407efdaf7f3"}
1
+ {"version":3,"file":"stats.js","sources":["utils/stats.ts"],"sourceRoot":"/","sourcesContent":["export class AgentStats {\n private totalFiles: number = 0;\n private processedFiles: number = 0;\n private totalCost: number = 0;\n private totalToolCalls: number = 0;\n private totalApiDuration: number = 0;\n private totalWallDuration: number = 0;\n private startTime: number;\n\n constructor() {\n this.startTime = Date.now();\n }\n\n updateStats(stats: {\n newProcessedFiles?: number;\n newCost?: number;\n newToolCalls?: number;\n newApiDuration?: number;\n newWallDuration?: number;\n }) {\n if (stats.newProcessedFiles) {\n this.processedFiles += stats.newProcessedFiles;\n }\n if (stats.newCost) {\n this.totalCost += stats.newCost;\n }\n if (stats.newToolCalls) {\n this.totalToolCalls += stats.newToolCalls;\n }\n if (stats.newApiDuration) {\n this.totalApiDuration += stats.newApiDuration;\n }\n if (stats.newWallDuration) {\n this.totalWallDuration += stats.newWallDuration;\n }\n }\n\n getStats(): {\n totalFiles: number;\n processedFiles: number;\n totalCost: number;\n totalToolCalls: number;\n totalApiDuration: number;\n totalWallDuration: number;\n startTime: number;\n } {\n return {\n totalFiles: this.totalFiles,\n processedFiles: this.processedFiles,\n totalCost: this.totalCost,\n totalToolCalls: this.totalToolCalls,\n totalApiDuration: this.totalApiDuration,\n totalWallDuration: this.totalWallDuration,\n startTime: this.startTime,\n };\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,OAAO,UAAU;IACb,UAAU,GAAW,CAAC,CAAC;IACvB,cAAc,GAAW,CAAC,CAAC;IAC3B,SAAS,GAAW,CAAC,CAAC;IACtB,cAAc,GAAW,CAAC,CAAC;IAC3B,gBAAgB,GAAW,CAAC,CAAC;IAC7B,iBAAiB,GAAW,CAAC,CAAC;IAC9B,SAAS,CAAS;IAE1B;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED,WAAW,CAAC,KAMX;QACC,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,iBAAiB,CAAC;QACjD,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC;QAClC,CAAC;QACD,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YACvB,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,YAAY,CAAC;QAC5C,CAAC;QACD,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;YACzB,IAAI,CAAC,gBAAgB,IAAI,KAAK,CAAC,cAAc,CAAC;QAChD,CAAC;QACD,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;YAC1B,IAAI,CAAC,iBAAiB,IAAI,KAAK,CAAC,eAAe,CAAC;QAClD,CAAC;IACH,CAAC;IAED,QAAQ;QASN,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;CACF","debug_id":"cae70ec6-4bdd-5777-af0d-5eea7935c485"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locadex",
3
- "version": "0.0.2-alpha.4",
3
+ "version": "0.0.2-alpha.5",
4
4
  "description": "An AI agent for internationalization",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",