locadex 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/fixErrors.d.ts +4 -0
- package/dist/commands/fixErrors.d.ts.map +1 -0
- package/dist/commands/fixErrors.js +41 -0
- package/dist/commands/fixErrors.js.map +1 -0
- package/dist/logging/logger.d.ts.map +1 -1
- package/dist/logging/logger.js.map +1 -1
- package/dist/mcp/getGuide.d.ts.map +1 -1
- package/dist/mcp/getGuide.js +2 -1
- package/dist/mcp/getGuide.js.map +1 -1
- package/dist/mcp/tools/guides.d.ts.map +1 -1
- package/dist/mcp/tools/guides.js +25 -55
- package/dist/mcp/tools/guides.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +4 -2
- package/dist/mcp.js.map +1 -1
- package/dist/tasks/concurrency.d.ts.map +1 -1
- package/dist/tasks/concurrency.js +15 -23
- package/dist/tasks/concurrency.js.map +1 -1
- package/dist/tasks/fixErrors.d.ts +2 -0
- package/dist/tasks/fixErrors.d.ts.map +1 -0
- package/dist/tasks/fixErrors.js +82 -0
- package/dist/tasks/fixErrors.js.map +1 -0
- package/dist/tasks/i18n.d.ts.map +1 -1
- package/dist/tasks/i18n.js +25 -82
- package/dist/tasks/i18n.js.map +1 -1
- package/dist/tasks/setup.d.ts.map +1 -1
- package/dist/tasks/setup.js +21 -9
- package/dist/tasks/setup.js.map +1 -1
- package/dist/types/claude-sdk.d.ts +13 -9
- package/dist/types/claude-sdk.d.ts.map +1 -1
- package/dist/types/claude-sdk.js.map +1 -1
- package/dist/utils/claudeCode.d.ts +13 -1
- package/dist/utils/claudeCode.d.ts.map +1 -1
- package/dist/utils/claudeCode.js +173 -66
- package/dist/utils/claudeCode.js.map +1 -1
- package/dist/utils/errors.d.ts +20 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +39 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/packages/installPackage.d.ts +1 -2
- package/dist/utils/packages/installPackage.d.ts.map +1 -1
- package/dist/utils/packages/installPackage.js +19 -28
- package/dist/utils/packages/installPackage.js.map +1 -1
- package/dist/utils/shared.d.ts +1 -1
- package/dist/utils/shared.js +1 -1
- package/dist/utils/shared.js.map +1 -1
- package/dist/utils/shutdown.d.ts +1 -2
- package/dist/utils/shutdown.d.ts.map +1 -1
- package/dist/utils/shutdown.js +1 -5
- package/dist/utils/shutdown.js.map +1 -1
- package/guides/next/advanced/{ternary-operators.md → conditional-rendering.md} +97 -39
- package/guides/next/advanced/external-strings.md +346 -0
- package/guides/next/advanced/interpolated-strings.md +35 -115
- package/guides/next/advanced/{complicated-mapping-expressions.md → mapping-expressions.md} +58 -51
- package/guides/next/basic/branches.md +62 -45
- package/guides/next/basic/jsx.md +35 -33
- package/guides/next/basic/strings.md +43 -25
- package/guides/next/basic/variables.md +12 -12
- package/guides/next/important/functions.md +13 -11
- package/guides/next/{advanced → migration}/migrating.md +2 -3
- package/package.json +1 -1
- package/guides/next/advanced/var-outside-client-component.md +0 -446
- package/guides/next/advanced/var-outside-client-server-component.md +0 -550
- package/guides/next/advanced/var-outside-server-component.md +0 -545
- package/guides/next/basic/client-side-components.md +0 -221
- package/guides/next/basic/server-side-components.md +0 -165
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# locadex
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#382](https://github.com/generaltranslation/gt/pull/382) [`f798109`](https://github.com/generaltranslation/gt/commit/f798109470e37c8fa2c849dd68c7656811f16a07) Thanks [@brian-lou](https://github.com/brian-lou)! - Fix incorrect import
|
|
8
|
+
|
|
9
|
+
## 0.1.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#380](https://github.com/generaltranslation/gt/pull/380) [`92f8d33`](https://github.com/generaltranslation/gt/commit/92f8d33b7c833f5e7081209f864b93b5a2ba8aa7) Thanks [@brian-lou](https://github.com/brian-lou)! - Update prompts + fix bugs
|
|
14
|
+
|
|
3
15
|
## 0.1.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"/","sources":["cli.ts"],"names":[],"mappings":";AAQA,OAAO,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"/","sources":["cli.ts"],"names":[],"mappings":";AAQA,OAAO,gBAAgB,CAAC;AACxB,OAAO,qBAAqB,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -4,12 +4,14 @@ dotenv.config({ path: '.env' });
|
|
|
4
4
|
dotenv.config({ path: '.env.local', override: true });
|
|
5
5
|
dotenv.config({ path: '.env.production', override: true });
|
|
6
6
|
import './telemetry.js';
|
|
7
|
+
import './utils/shutdown.js';
|
|
7
8
|
import { Command } from 'commander';
|
|
8
9
|
import { readFileSync } from 'node:fs';
|
|
9
10
|
import { fromPackageRoot } from './utils/getPaths.js';
|
|
10
11
|
import { setupCommand } from './commands/setup.js';
|
|
11
12
|
import { i18nCommand } from './commands/i18n.js';
|
|
12
13
|
import { main } from 'gtx-cli/index';
|
|
14
|
+
import { fixErrorsCommand } from './commands/fixErrors.js';
|
|
13
15
|
const packageJson = JSON.parse(readFileSync(fromPackageRoot('package.json'), 'utf8'));
|
|
14
16
|
const program = new Command();
|
|
15
17
|
program
|
|
@@ -42,6 +44,18 @@ program
|
|
|
42
44
|
.option('--no-telemetry', 'Disable telemetry')
|
|
43
45
|
.option('--app-dir <dir>', 'Relative path to the application directory', '.')
|
|
44
46
|
.action(i18nCommand);
|
|
47
|
+
program
|
|
48
|
+
.command('fix')
|
|
49
|
+
.description('Run Locadex to validate your project and fix errors')
|
|
50
|
+
.option('-v, --verbose', 'Verbose output')
|
|
51
|
+
.option('-d, --debug', 'Debug output')
|
|
52
|
+
.option('-b, --batch-size <number>', 'File batch size')
|
|
53
|
+
.option('-t, --timeout <number>', 'Timeout for each file in a batch')
|
|
54
|
+
.option('-c, --concurrency <number>', 'Max number of concurrent agents')
|
|
55
|
+
.option('-m, --match-files <pattern>', 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.')
|
|
56
|
+
.option('--no-telemetry', 'Disable telemetry')
|
|
57
|
+
.option('--app-dir <dir>', 'Relative path to the application directory', '.')
|
|
58
|
+
.action(fixErrorsCommand);
|
|
45
59
|
main(program);
|
|
46
60
|
program.parse();
|
|
47
61
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"/","sources":["cli.ts"],"names":[],"mappings":";AAEA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAE3D,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAA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AM,CAAC,4BAA4B,EAAE,iCAAiC,CAAC;KACvE,MAAM,CACL,6BAA6B,EAC7B,oGAAoG,CACrG;KACA,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;KAC7C,MAAM,CAAC,iBAAiB,EAAE,4CAA4C,EAAE,GAAG,CAAC;KAC5E,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE5B,IAAI,CAAC,OAAO,CAAC,CAAC;AAEd,OAAO,CAAC,KAAK,EAAE,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport dotenv from 'dotenv';\n\ndotenv.config({ path: '.env' });\ndotenv.config({ path: '.env.local', override: true });\ndotenv.config({ path: '.env.production', override: true });\n\nimport './telemetry.js';\nimport './utils/shutdown.js';\nimport { Command } from 'commander';\nimport { readFileSync } from 'node:fs';\nimport { fromPackageRoot } from './utils/getPaths.js';\nimport { setupCommand } from './commands/setup.js';\nimport { i18nCommand } from './commands/i18n.js';\nimport { main } from 'gtx-cli/index';\nimport { fixErrorsCommand } from './commands/fixErrors.js';\n\nconst packageJson = JSON.parse(\n readFileSync(fromPackageRoot('package.json'), 'utf8')\n);\n\nconst program = new Command();\n\nprogram\n .name('locadex')\n .description('AI agent for internationalization')\n .version(packageJson.version);\n\nprogram\n .command('start')\n .description('Run Locadex on your project')\n .option('-v, --verbose', 'Verbose output')\n .option('-d, --debug', 'Debug output')\n .option('-b, --batch-size <number>', 'File batch size')\n .option('-t, --timeout <number>', 'Timeout for each file in a batch')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents')\n .option(\n '-m, --match-files <pattern>',\n 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.'\n )\n .option(\n '--package-manager <manager>',\n 'Package manager to use. (npm, pnpm, yarn_v1, yarn_v2, bun, deno)'\n )\n .option('-y, --bypass-prompts', 'Bypass interactive prompts')\n .option('--no-telemetry', 'Disable telemetry')\n .option('--app-dir <dir>', 'Relative path to the application directory', '.')\n .action(setupCommand);\n\nprogram\n .command('i18n')\n .description('Run Locadex i18n on your project')\n .option('-v, --verbose', 'Verbose output')\n .option('-d, --debug', 'Debug output')\n .option('-b, --batch-size <number>', 'File batch size')\n .option('-t, --timeout <number>', 'Timeout for each file in a batch')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents')\n .option(\n '-m, --match-files <pattern>',\n 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.'\n )\n .option('--no-telemetry', 'Disable telemetry')\n .option('--app-dir <dir>', 'Relative path to the application directory', '.')\n .action(i18nCommand);\n\nprogram\n .command('fix')\n .description('Run Locadex to validate your project and fix errors')\n .option('-v, --verbose', 'Verbose output')\n .option('-d, --debug', 'Debug output')\n .option('-b, --batch-size <number>', 'File batch size')\n .option('-t, --timeout <number>', 'Timeout for each file in a batch')\n .option('-c, --concurrency <number>', 'Max number of concurrent agents')\n .option(\n '-m, --match-files <pattern>',\n 'Comma-separated list of glob patterns to match source files. Should be relative to root directory.'\n )\n .option('--no-telemetry', 'Disable telemetry')\n .option('--app-dir <dir>', 'Relative path to the application directory', '.')\n .action(fixErrorsCommand);\n\nmain(program);\n\nprogram.parse();\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixErrors.d.ts","sourceRoot":"/","sources":["commands/fixErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ7C,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,iBAqC3E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { withTelemetry } from '../telemetry.js';
|
|
2
|
+
import { LocadexManager } from '../utils/locadexManager.js';
|
|
3
|
+
import { displayHeader } from '../logging/console.js';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { validateConfig } from '../utils/config.js';
|
|
6
|
+
import { fixErrorsTask } from '../tasks/fixErrors.js';
|
|
7
|
+
export async function fixErrorsCommand(options, command) {
|
|
8
|
+
const parentOptions = command.parent?.opts() || {};
|
|
9
|
+
const allOptions = { ...parentOptions, ...options };
|
|
10
|
+
const telemetryEnabled = !allOptions.noTelemetry;
|
|
11
|
+
withTelemetry({ enabled: telemetryEnabled, options: allOptions }, async () => {
|
|
12
|
+
await validateConfig(allOptions);
|
|
13
|
+
displayHeader(telemetryEnabled);
|
|
14
|
+
LocadexManager.initialize({
|
|
15
|
+
rootDirectory: process.cwd(),
|
|
16
|
+
appDirectory: path.resolve(process.cwd(), allOptions.appDir),
|
|
17
|
+
mcpTransport: 'sse',
|
|
18
|
+
apiKey: process.env.ANTHROPIC_API_KEY || '',
|
|
19
|
+
metadata: {},
|
|
20
|
+
cliOptions: allOptions,
|
|
21
|
+
options: {
|
|
22
|
+
...(allOptions.matchingFiles && {
|
|
23
|
+
matchingFiles: allOptions.matchingFiles
|
|
24
|
+
.split(',')
|
|
25
|
+
.map((file) => file.trim()),
|
|
26
|
+
}),
|
|
27
|
+
...(allOptions.concurrency && {
|
|
28
|
+
maxConcurrency: Number(allOptions.concurrency),
|
|
29
|
+
}),
|
|
30
|
+
...(allOptions.batchSize && {
|
|
31
|
+
batchSize: Number(allOptions.batchSize),
|
|
32
|
+
}),
|
|
33
|
+
...(allOptions.timeout && {
|
|
34
|
+
timeout: Number(allOptions.timeout),
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
await fixErrorsTask();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=fixErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixErrors.js","sourceRoot":"/","sources":["commands/fixErrors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC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gBACF,GAAG,CAAC,UAAU,CAAC,SAAS,IAAI;oBAC1B,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;iBACxC,CAAC;gBACF,GAAG,CAAC,UAAU,CAAC,OAAO,IAAI;oBACxB,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;iBACpC,CAAC;aACH;SACF,CAAC,CAAC;QACH,MAAM,aAAa,EAAE,CAAC;IACxB,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import { Command } from 'commander';\nimport { CliOptions } from '../types/cli.js';\nimport { withTelemetry } from '../telemetry.js';\nimport { LocadexManager } from '../utils/locadexManager.js';\nimport { displayHeader } from '../logging/console.js';\nimport path from 'node:path';\nimport { validateConfig } from '../utils/config.js';\nimport { fixErrorsTask } from '../tasks/fixErrors.js';\n\nexport async function fixErrorsCommand(options: CliOptions, command: Command) {\n const parentOptions = command.parent?.opts() || {};\n const allOptions = { ...parentOptions, ...options };\n const telemetryEnabled = !allOptions.noTelemetry;\n withTelemetry(\n { enabled: telemetryEnabled, options: allOptions },\n async () => {\n await validateConfig(allOptions);\n\n displayHeader(telemetryEnabled);\n LocadexManager.initialize({\n rootDirectory: process.cwd(),\n appDirectory: path.resolve(process.cwd(), allOptions.appDir),\n mcpTransport: 'sse',\n apiKey: process.env.ANTHROPIC_API_KEY || '',\n metadata: {},\n cliOptions: allOptions,\n options: {\n ...(allOptions.matchingFiles && {\n matchingFiles: allOptions.matchingFiles\n .split(',')\n .map((file) => file.trim()),\n }),\n ...(allOptions.concurrency && {\n maxConcurrency: Number(allOptions.concurrency),\n }),\n ...(allOptions.batchSize && {\n batchSize: Number(allOptions.batchSize),\n }),\n ...(allOptions.timeout && {\n timeout: Number(allOptions.timeout),\n }),\n },\n });\n await fixErrorsTask();\n }\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"/","sources":["logging/logger.ts"],"names":[],"mappings":"
|
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KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK3B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKxB,YAAY,CAAC,OAAO,EAAE,MAAM;IAMlC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAOrC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAOnC,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAO1B,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAW1C,iBAAiB,IAAI,IAAI;CAQ1B;AAED,eAAO,MAAM,MAAM,QAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"/","sources":["logging/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"/","sources":["logging/logger.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,UAAU,EACV,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,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,CA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,OAAO,EAAE,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,CAAC;QAC9D,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;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,cAAc,CACZ,IAAI,CAAC,OAAO,EACZ,yCAAyC,KAAK,IAAI,CACnD,CAAC;QACJ,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;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC","sourcesContent":["import { ProgressResult, SpinnerResult } from '@clack/prompts';\nimport {\n logInfo,\n logWarning,\n logError,\n logSuccess,\n logStep,\n logMessage,\n logErrorAndExit,\n createProgressBar,\n createSpinner,\n} from './console.js';\nimport { appendFileSync } from 'node:fs';\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 private logFile: string | undefined;\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(\n options: { verbose?: boolean; debug?: boolean },\n logFile?: string\n ): void {\n if (options.debug) {\n this._debug = true;\n this._verbose = true;\n }\n if (options.verbose) {\n this._verbose = true;\n }\n if (logFile) {\n this.logFile = logFile;\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 this.log(message);\n logInfo(message);\n }\n\n warning(message: string): void {\n this.log(message);\n logWarning(message);\n }\n\n error(message: string): void {\n this.log(message);\n logError(message);\n }\n\n success(message: string): void {\n this.log(message);\n logSuccess(message);\n }\n\n step(message: string): void {\n this.log(message);\n logStep(message);\n }\n\n message(message: string): void {\n this.log(message);\n logMessage(message);\n }\n\n async errorAndExit(message: string) {\n this.log(message);\n await logErrorAndExit(message);\n }\n\n // Conditional logging methods\n verboseMessage(message: string): void {\n this.log(message);\n if (this._verbose) {\n logMessage(message);\n }\n }\n\n debugMessage(message: string): void {\n this.log(message);\n if (this._debug) {\n logMessage(message);\n }\n }\n\n log(message: string): void {\n if (this.logFile) {\n const timestamp = new Date().toISOString();\n appendFileSync(this.logFile, `[${timestamp}] ${message}\\n`);\n }\n }\n\n initializeProgressBar(total: number): void {\n if (!this._verbose && !this._debug) {\n this.progressBar.init(total);\n }\n if (this.logFile) {\n appendFileSync(\n this.logFile,\n `Initializing progress bar with total: ${total}\\n`\n );\n }\n }\n initializeSpinner(): void {\n if (!this._verbose && !this._debug) {\n this.spinner.init();\n }\n if (this.logFile) {\n appendFileSync(this.logFile, `Initializing spinner\\n`);\n }\n }\n}\n\nexport const logger = Logger.getInstance();\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGuide.d.ts","sourceRoot":"/","sources":["mcp/getGuide.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getGuide.d.ts","sourceRoot":"/","sources":["mcp/getGuide.ts"],"names":[],"mappings":"AAIA,wBAA8B,QAAQ,CACpC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAS/C"}
|
package/dist/mcp/getGuide.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { fromPackageRoot } from '../utils/getPaths.js';
|
|
3
|
+
import { logger } from '../logging/logger.js';
|
|
3
4
|
export default async function getGuide(path) {
|
|
4
5
|
try {
|
|
5
6
|
const filePath = fromPackageRoot(path);
|
|
@@ -7,7 +8,7 @@ export default async function getGuide(path) {
|
|
|
7
8
|
return { content };
|
|
8
9
|
}
|
|
9
10
|
catch (error) {
|
|
10
|
-
|
|
11
|
+
logger.log(`Error reading guide ${path}: ${error}`);
|
|
11
12
|
return { error: error instanceof Error ? error.message : String(error) };
|
|
12
13
|
}
|
|
13
14
|
}
|
package/dist/mcp/getGuide.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGuide.js","sourceRoot":"/","sources":["mcp/getGuide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"getGuide.js","sourceRoot":"/","sources":["mcp/getGuide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,QAAQ,CACpC,IAAY;IAEZ,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,GAAG,CAAC,uBAAuB,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;QACpD,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3E,CAAC;AACH,CAAC","sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { fromPackageRoot } from '../utils/getPaths.js';\nimport { logger } from '../logging/logger.js';\n\nexport default async function getGuide(\n path: string\n): Promise<{ content?: string; error?: string }> {\n try {\n const filePath = fromPackageRoot(path);\n const content = await readFile(filePath, 'utf-8');\n return { content };\n } catch (error) {\n logger.log(`Error reading guide ${path}: ${error}`);\n return { error: error instanceof Error ? error.message : String(error) };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guides.d.ts","sourceRoot":"/","sources":["mcp/tools/guides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"guides.d.ts","sourceRoot":"/","sources":["mcp/tools/guides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,KAAK,KAAK,GAAG;IACX,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAAK,EA+DzB,CAAC;AAEF,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,QA8B/C"}
|
package/dist/mcp/tools/guides.js
CHANGED
|
@@ -2,87 +2,57 @@ import getGuide from '../getGuide.js';
|
|
|
2
2
|
import { logger } from '../../logging/logger.js';
|
|
3
3
|
export const guides = [
|
|
4
4
|
{
|
|
5
|
-
id: '
|
|
5
|
+
id: 'next_important_functions',
|
|
6
6
|
description: 'Important documentation outlining the imports available in `gt-next`.',
|
|
7
7
|
path: 'guides/next/important/functions.md',
|
|
8
8
|
type: 'important',
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
id: '
|
|
12
|
-
description: '
|
|
11
|
+
id: 'next_basic_jsx',
|
|
12
|
+
description: 'Call this tool when you see content in JSX or HTML that needs to be internationalized.',
|
|
13
13
|
path: 'guides/next/basic/jsx.md',
|
|
14
14
|
type: 'basic',
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
id: '
|
|
18
|
-
description:
|
|
19
|
-
path: 'guides/next/basic/branches.md',
|
|
20
|
-
type: 'basic',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: 'basic_next-strings',
|
|
24
|
-
description: 'Basic guide for how to use `useGT()` and `getGT()` to internationalize strings in a Next.js project.',
|
|
17
|
+
id: 'next_basic_strings',
|
|
18
|
+
description: `Call this tool when you see a string created by '', "", or \`\` that needs to be internationalized.`,
|
|
25
19
|
path: 'guides/next/basic/strings.md',
|
|
26
20
|
type: 'basic',
|
|
27
21
|
},
|
|
28
22
|
{
|
|
29
|
-
id: '
|
|
30
|
-
description: '
|
|
31
|
-
path: 'guides/next/basic/
|
|
32
|
-
type: 'basic',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: 'basic_next-client-side-components',
|
|
36
|
-
description: 'Basic guide on how to internationalize client-side components.',
|
|
37
|
-
path: 'guides/next/basic/client-side-components.md',
|
|
23
|
+
id: 'next_basic_branches',
|
|
24
|
+
description: 'Call this tool when you see a conditional statement or a pluralization statement that needs to be internationalized.',
|
|
25
|
+
path: 'guides/next/basic/branches.md',
|
|
38
26
|
type: 'basic',
|
|
39
27
|
},
|
|
40
28
|
{
|
|
41
|
-
id: '
|
|
42
|
-
description: '
|
|
43
|
-
path: 'guides/next/basic/
|
|
29
|
+
id: 'next_basic_variables',
|
|
30
|
+
description: 'Call this tool when you see variable content (Currency, DateTime, Numbers, and other dynamic content) that needs to be internationalized.',
|
|
31
|
+
path: 'guides/next/basic/variables.md',
|
|
44
32
|
type: 'basic',
|
|
45
33
|
},
|
|
46
34
|
{
|
|
47
|
-
id: '
|
|
48
|
-
description: '
|
|
49
|
-
path: 'guides/next/advanced/
|
|
50
|
-
type: 'advanced',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: 'advanced_next-outside-server-component',
|
|
54
|
-
description: 'Advanced guide for wherever you see a `const` or `let` or a function outside of a function scope that needs to be internationalized. This guide is specifically for when these variables are ONLY used or imported by server side components.',
|
|
55
|
-
path: 'guides/next/advanced/var-outside-server-component.md',
|
|
56
|
-
type: 'advanced',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: 'advanced_next-outside-client-server-component',
|
|
60
|
-
description: 'Advanced guide for wherever you see a `const` or `let` or a function outside of a function scope that needs to be internationalized. This guide is specifically for when these variables are used or imported by both client side and server side components.',
|
|
61
|
-
path: 'guides/next/advanced/var-outside-client-server-component.md',
|
|
62
|
-
type: 'advanced',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: 'advanced_next-ternary-operators',
|
|
66
|
-
description: 'Advanced guide for complex scenarios with ternary operators or conditional statements that needs to be internationalized.',
|
|
67
|
-
path: 'guides/next/advanced/ternary-operators.md',
|
|
35
|
+
id: 'next_advanced_interpolated-strings',
|
|
36
|
+
description: 'Call this tool when you see a string with variables within/around it or interpolated string (template string literal with quasis) that needs to be internationalized.',
|
|
37
|
+
path: 'guides/next/advanced/interpolated-strings.md',
|
|
68
38
|
type: 'advanced',
|
|
69
39
|
},
|
|
70
40
|
{
|
|
71
|
-
id: '
|
|
72
|
-
description: '
|
|
73
|
-
path: 'guides/next/advanced/
|
|
41
|
+
id: 'next_advanced_conditional-rendering',
|
|
42
|
+
description: 'Call this tool when you see a conditional statement or a pluralization statement that needs to be internationalized.',
|
|
43
|
+
path: 'guides/next/advanced/conditional-rendering.md',
|
|
74
44
|
type: 'advanced',
|
|
75
45
|
},
|
|
76
46
|
{
|
|
77
|
-
id: '
|
|
78
|
-
description: '
|
|
79
|
-
path: 'guides/next/advanced/
|
|
47
|
+
id: 'next_advanced_external-strings',
|
|
48
|
+
description: 'Call this tool when you see a variable, constant, or function containing strings outside of a component scope that needs to be internationalized.',
|
|
49
|
+
path: 'guides/next/advanced/external-strings.md',
|
|
80
50
|
type: 'advanced',
|
|
81
51
|
},
|
|
82
52
|
{
|
|
83
|
-
id: '
|
|
84
|
-
description: '
|
|
85
|
-
path: 'guides/next/advanced/
|
|
53
|
+
id: 'next_advanced_mapping-expressions',
|
|
54
|
+
description: 'Call this tool when you see a mapping expression for a nested data structure that contains content that needs to be internationalized.',
|
|
55
|
+
path: 'guides/next/advanced/mapping-expressions.md',
|
|
86
56
|
type: 'advanced',
|
|
87
57
|
},
|
|
88
58
|
];
|
|
@@ -92,7 +62,7 @@ export function addGuidesTools(server) {
|
|
|
92
62
|
const path = guide.path;
|
|
93
63
|
const { content, error } = await getGuide(path);
|
|
94
64
|
if (error) {
|
|
95
|
-
logger.log(`[locadex-mcp: ${guide.id}] Error fetching guide: ${path}`);
|
|
65
|
+
logger.log(`[locadex-mcp: ${guide.id}] Error fetching guide: ${guide.id} at path ${path}`);
|
|
96
66
|
return {
|
|
97
67
|
content: [
|
|
98
68
|
{
|
|
@@ -103,7 +73,7 @@ export function addGuidesTools(server) {
|
|
|
103
73
|
isError: true,
|
|
104
74
|
};
|
|
105
75
|
}
|
|
106
|
-
logger.log(`[locadex-mcp: ${guide.id}]
|
|
76
|
+
logger.log(`[locadex-mcp: ${guide.id}] Returning guide: ${guide.id}`);
|
|
107
77
|
return {
|
|
108
78
|
content: [
|
|
109
79
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guides.js","sourceRoot":"/","sources":["mcp/tools/guides.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AASjD,MAAM,CAAC,MAAM,MAAM,GAAY;IAC7B;QACE,EAAE,EAAE,0BAA0B;QAC9B,WAAW,EACT,uEAAuE;QACzE,IAAI,EAAE,oCAAoC;QAC1C,IAAI,EAAE,WAAW;KAClB;IACD;QACE,EAAE,EAAE,gBAAgB;QACpB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"guides.js","sourceRoot":"/","sources":["mcp/tools/guides.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;A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C,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE;YACtD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YACxB,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChD,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,CAAC,GAAG,CACR,iBAAiB,KAAK,CAAC,EAAE,2BAA2B,KAAK,CAAC,EAAE,YAAY,IAAI,EAAE,CAC/E,CAAC;gBACF,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,yBAAyB,KAAK,EAAE;yBACvC;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,iBAAiB,KAAK,CAAC,EAAE,sBAAsB,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YACtE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,OAAO,IAAI,EAAE;qBACpB;iBACF;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport getGuide from '../getGuide.js';\nimport { logger } from '../../logging/logger.js';\n\ntype Guide = {\n id: string;\n description: string;\n path: string;\n type: 'important' | 'basic' | 'advanced';\n};\n\nexport const guides: Guide[] = [\n {\n id: 'next_important_functions',\n description:\n 'Important documentation outlining the imports available in `gt-next`.',\n path: 'guides/next/important/functions.md',\n type: 'important',\n },\n {\n id: 'next_basic_jsx',\n description:\n 'Call this tool when you see content in JSX or HTML that needs to be internationalized.',\n path: 'guides/next/basic/jsx.md',\n type: 'basic',\n },\n {\n id: 'next_basic_strings',\n description: `Call this tool when you see a string created by '', \"\", or \\`\\` that needs to be internationalized.`,\n path: 'guides/next/basic/strings.md',\n type: 'basic',\n },\n {\n id: 'next_basic_branches',\n description:\n 'Call this tool when you see a conditional statement or a pluralization statement that needs to be internationalized.',\n path: 'guides/next/basic/branches.md',\n type: 'basic',\n },\n {\n id: 'next_basic_variables',\n description:\n 'Call this tool when you see variable content (Currency, DateTime, Numbers, and other dynamic content) that needs to be internationalized.',\n path: 'guides/next/basic/variables.md',\n type: 'basic',\n },\n {\n id: 'next_advanced_interpolated-strings',\n description:\n 'Call this tool when you see a string with variables within/around it or interpolated string (template string literal with quasis) that needs to be internationalized.',\n path: 'guides/next/advanced/interpolated-strings.md',\n type: 'advanced',\n },\n {\n id: 'next_advanced_conditional-rendering',\n description:\n 'Call this tool when you see a conditional statement or a pluralization statement that needs to be internationalized.',\n path: 'guides/next/advanced/conditional-rendering.md',\n type: 'advanced',\n },\n {\n id: 'next_advanced_external-strings',\n description:\n 'Call this tool when you see a variable, constant, or function containing strings outside of a component scope that needs to be internationalized.',\n path: 'guides/next/advanced/external-strings.md',\n type: 'advanced',\n },\n {\n id: 'next_advanced_mapping-expressions',\n description:\n 'Call this tool when you see a mapping expression for a nested data structure that contains content that needs to be internationalized.',\n path: 'guides/next/advanced/mapping-expressions.md',\n type: 'advanced',\n },\n];\n\nexport function addGuidesTools(server: McpServer) {\n guides.forEach((guide) => {\n server.tool(guide.id, guide.description, {}, async () => {\n const path = guide.path;\n const { content, error } = await getGuide(path);\n if (error) {\n logger.log(\n `[locadex-mcp: ${guide.id}] Error fetching guide: ${guide.id} at path ${path}`\n );\n return {\n content: [\n {\n type: 'text',\n text: `Error fetching guide: ${error}`,\n },\n ],\n isError: true,\n };\n }\n logger.log(`[locadex-mcp: ${guide.id}] Returning guide: ${guide.id}`);\n return {\n content: [\n {\n type: 'text',\n text: content ?? '',\n },\n ],\n };\n });\n });\n}\n"]}
|
package/dist/mcp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"/","sources":["mcp.ts"],"names":[],"mappings":";AAcA,wBAAsB,KAAK,
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"/","sources":["mcp.ts"],"names":[],"mappings":";AAcA,wBAAsB,KAAK,kBA6E1B"}
|
package/dist/mcp.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { addDocsTools } from './mcp/tools/docs.js';
|
|
4
4
|
import { existsSync, readFileSync } from 'node:fs';
|
|
5
|
-
import { fromPackageRoot } from './utils/getPaths.js';
|
|
5
|
+
import { fromPackageRoot, getLocadexVersion } from './utils/getPaths.js';
|
|
6
6
|
import { addGuidesTools } from './mcp/tools/guides.js';
|
|
7
7
|
import express from 'express';
|
|
8
8
|
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
@@ -44,6 +44,7 @@ export async function start() {
|
|
|
44
44
|
const transport = new SSEServerTransport('/messages', res);
|
|
45
45
|
transports.sse[transport.sessionId] = transport;
|
|
46
46
|
res.on('close', () => {
|
|
47
|
+
logger.log(`[locadex-mcp] SSE transport closed for sessionId: ${transport.sessionId}`);
|
|
47
48
|
delete transports.sse[transport.sessionId];
|
|
48
49
|
});
|
|
49
50
|
await mcpServer.connect(transport);
|
|
@@ -56,6 +57,7 @@ export async function start() {
|
|
|
56
57
|
await transport.handlePostMessage(req, res, req.body);
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
60
|
+
logger.log(`[locadex-mcp] No transport found for sessionId: ${sessionId}`);
|
|
59
61
|
res.status(400).send('No transport found for sessionId');
|
|
60
62
|
}
|
|
61
63
|
});
|
|
@@ -63,7 +65,7 @@ export async function start() {
|
|
|
63
65
|
const portMessage = port !== requestedPort
|
|
64
66
|
? `${port} (requested ${requestedPort} was in use)`
|
|
65
67
|
: `${port}`;
|
|
66
|
-
logger.debugMessage(`[locadex-mcp] started on port ${portMessage} with state file ${stateFile}`);
|
|
68
|
+
logger.debugMessage(`[locadex-mcp v${getLocadexVersion()}] started on port ${portMessage} with state file ${stateFile}`);
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
// Start the SSE server
|
package/dist/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"/","sources":["mcp.ts"],"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;
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"/","sources":["mcp.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;IAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAClD,MAAM,aAAa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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,iBAAiB,iBAAiB,EAAE,qBAAqB,WAAW,oBAAoB,SAAS,EAAE,CACpG,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uBAAuB;AACvB,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;IAC5B,MAAM,CAAC,KAAK,CACV,kCAAkC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC3F,CAAC;IACF,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { addDocsTools } from './mcp/tools/docs.js';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { fromPackageRoot, getLocadexVersion } from './utils/getPaths.js';\nimport { addGuidesTools } from './mcp/tools/guides.js';\nimport express from 'express';\nimport { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';\nimport { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';\nimport { logger } from './logging/logger.js';\nimport { findAvailablePort } from './mcp/getPort.js';\nimport { exit } from './utils/shutdown.js';\n\nexport async function start() {\n const stateFile = process.env.LOCADEX_FILES_STATE_FILE_PATH;\n const logFile = process.env.LOCADEX_LOG_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 }, logFile);\n\n if (stateFile && existsSync(stateFile)) {\n const state = JSON.parse(readFileSync(stateFile, 'utf8'));\n logger.debugMessage(\n `[locadex-mcp] state: ${JSON.stringify(state, null, 2)}`\n );\n } else {\n throw new Error(`[locadex-mcp] state file not found: ${stateFile}`);\n }\n\n const mcpServer = new McpServer({\n name: 'Locadex: AI Agent for Internationalization',\n version: JSON.parse(readFileSync(fromPackageRoot('package.json'), 'utf8'))\n .version,\n });\n\n const app = express();\n app.use(express.json());\n\n // Store transports for each session type\n const transports = {\n streamable: {} as Record<string, StreamableHTTPServerTransport>,\n sse: {} as Record<string, SSEServerTransport>,\n };\n\n addDocsTools(mcpServer);\n addGuidesTools(mcpServer);\n\n // SSE endpoint for legacy clients\n // Claude Code only supports SSE as of 2025-06-04\n app.get('/sse', async (req, res) => {\n const transport = new SSEServerTransport('/messages', res);\n transports.sse[transport.sessionId] = transport;\n\n res.on('close', () => {\n logger.log(\n `[locadex-mcp] SSE transport closed for sessionId: ${transport.sessionId}`\n );\n delete transports.sse[transport.sessionId];\n });\n\n await mcpServer.connect(transport);\n });\n\n // Companion endpoint for sending messages\n app.post('/messages', async (req, res) => {\n const sessionId = req.query.sessionId as string;\n const transport = transports.sse[sessionId];\n if (transport) {\n await transport.handlePostMessage(req, res, req.body);\n } else {\n logger.log(\n `[locadex-mcp] No transport found for sessionId: ${sessionId}`\n );\n res.status(400).send('No transport found for sessionId');\n }\n });\n\n app.listen(port, () => {\n const portMessage =\n port !== requestedPort\n ? `${port} (requested ${requestedPort} was in use)`\n : `${port}`;\n logger.debugMessage(\n `[locadex-mcp v${getLocadexVersion()}] started on port ${portMessage} with state file ${stateFile}`\n );\n });\n}\n\n// Start the SSE server\nstart().catch(async (error) => {\n logger.error(\n `[locadex-mcp] Failed to start: ${error instanceof Error ? error.message : String(error)}`\n );\n await exit(1);\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concurrency.d.ts","sourceRoot":"/","sources":["tasks/concurrency.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"concurrency.d.ts","sourceRoot":"/","sources":["tasks/concurrency.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,MAAM,WAAW,aAAa,CAAC,KAAK,EAAE,QAAQ;IAC5C;;;;;;;OAOG;IACH,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnE;;;;;;;OAOG;IACH,WAAW,EAAE,CACX,KAAK,EAAE,KAAK,EAAE,EACd,OAAO,EAAE,QAAQ,EACjB,WAAW,EAAE,MAAM,KAChB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,qDAAqD;IACrD,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE,QAAQ,EACzD,SAAS,EAAE,KAAK,EAAE,EAClB,SAAS,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,EACzC,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,yBAAyB,EAClC,UAAU,GAAE,MAAU,GACrB,OAAO,CAAC,IAAI,CAAC,CA6Gf"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LocadexManager } from '../utils/locadexManager.js';
|
|
2
2
|
import { logger } from '../logging/logger.js';
|
|
3
3
|
import { exit } from '../utils/shutdown.js';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { outro } from '@clack/prompts';
|
|
4
6
|
/**
|
|
5
7
|
* Executes tasks in parallel using a pool of agents with proper concurrency control.
|
|
6
8
|
*
|
|
@@ -39,7 +41,6 @@ export async function runParallelProcessing(taskQueue, processor, context, optio
|
|
|
39
41
|
const { concurrency, batchSize } = options;
|
|
40
42
|
const manager = LocadexManager.getInstance();
|
|
41
43
|
const agentAbortController = manager.getAgentAbortController();
|
|
42
|
-
let firstError = null;
|
|
43
44
|
// Mutex for task queue access
|
|
44
45
|
let taskQueueMutex = Promise.resolve();
|
|
45
46
|
// Helper function to safely get tasks from queue
|
|
@@ -95,17 +96,8 @@ export async function runParallelProcessing(taskQueue, processor, context, optio
|
|
|
95
96
|
await processor.postProcess(tasks, context, agentReport);
|
|
96
97
|
}
|
|
97
98
|
catch (error) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
// Capture the first error and signal all other agents to abort
|
|
103
|
-
if (!firstError) {
|
|
104
|
-
firstError = new Error(`Error in claude parallel process (${agentId}): ${error}`);
|
|
105
|
-
logger.debugMessage(firstError.message);
|
|
106
|
-
}
|
|
107
|
-
await exit(1); // Exit this agent's processing immediately
|
|
108
|
-
return;
|
|
99
|
+
logger.debugMessage(`[${agentId}] error: ${error}`);
|
|
100
|
+
throw error;
|
|
109
101
|
}
|
|
110
102
|
}
|
|
111
103
|
};
|
|
@@ -117,19 +109,19 @@ export async function runParallelProcessing(taskQueue, processor, context, optio
|
|
|
117
109
|
await Promise.all(processingPromises);
|
|
118
110
|
}
|
|
119
111
|
catch (error) {
|
|
120
|
-
|
|
112
|
+
manager.getAgentPool().forEach((agentInfo) => {
|
|
113
|
+
agentInfo.agent.aggregateStats();
|
|
114
|
+
});
|
|
115
|
+
manager.stats.recordTelemetry(false); // do this after aggregateStats()
|
|
116
|
+
// Check if this is a manual abort
|
|
121
117
|
if (agentAbortController.signal.aborted) {
|
|
122
|
-
|
|
118
|
+
return;
|
|
123
119
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (!firstError) {
|
|
127
|
-
firstError = new Error(`Unexpected error in parallel processing: ${error}`);
|
|
128
|
-
}
|
|
129
|
-
throw firstError;
|
|
130
|
-
}
|
|
131
|
-
if (firstError) {
|
|
132
|
-
throw firstError;
|
|
120
|
+
outro(chalk.red('❌ Locadex failed with error: ' + error.message));
|
|
121
|
+
await exit(1); // Exit the process
|
|
133
122
|
}
|
|
123
|
+
manager.getAgentPool().forEach((agentInfo) => {
|
|
124
|
+
agentInfo.agent.aggregateStats();
|
|
125
|
+
});
|
|
134
126
|
}
|
|
135
127
|
//# sourceMappingURL=concurrency.js.map
|