locadex 0.0.1 → 0.0.2-alpha.1
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/.locadex-mcp.json +9 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +24 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/i18n.d.ts +2 -0
- package/dist/commands/i18n.d.ts.map +1 -0
- package/dist/commands/i18n.js +145 -0
- package/dist/commands/i18n.js.map +1 -0
- package/dist/commands/setup.d.ts +2 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +90 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/utils/claudeCode.d.ts +16 -0
- package/dist/utils/claudeCode.d.ts.map +1 -0
- package/dist/utils/claudeCode.js +114 -0
- package/dist/utils/claudeCode.js.map +1 -0
- package/dist/utils/logging.d.ts +49 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +226 -0
- package/dist/utils/logging.js.map +1 -0
- package/dist/utils/mcpConfig.d.ts +10 -0
- package/dist/utils/mcpConfig.d.ts.map +1 -0
- package/dist/utils/mcpConfig.js +10 -0
- package/dist/utils/mcpConfig.js.map +1 -0
- package/package.json +12 -6
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
dotenv.config();
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { fromPackageRoot } from './utils/getPaths.js';
|
|
7
|
+
import { setupCommand } from './commands/setup.js';
|
|
8
|
+
import { i18nCommand } from './commands/i18n.js';
|
|
9
|
+
var packageJson = JSON.parse(readFileSync(fromPackageRoot('package.json'), 'utf8'));
|
|
10
|
+
var program = new Command();
|
|
11
|
+
program
|
|
12
|
+
.name('locadex')
|
|
13
|
+
.description('AI agent for internationalization')
|
|
14
|
+
.version(packageJson.version);
|
|
15
|
+
program
|
|
16
|
+
.command('setup')
|
|
17
|
+
.description('Set up locadex for your project')
|
|
18
|
+
.action(setupCommand);
|
|
19
|
+
program
|
|
20
|
+
.command('i18n')
|
|
21
|
+
.description('Run AI-powered internationalization tasks')
|
|
22
|
+
.action(i18nCommand);
|
|
23
|
+
program.parse();
|
|
24
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,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,CAAC;AAEjD,IAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,YAAY,CAAC,eAAe,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,CACtD,CAAC;AAEF,IAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,mCAAmC,CAAC;KAChD,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAEhC,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,iCAAiC,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CAAC;AAExB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,2CAA2C,CAAC;KACxD,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/commands/i18n.ts"],"names":[],"mappings":"AAkBA,wBAAsB,WAAW,kBAiGhC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { intro, outro, text, select, spinner } from '@clack/prompts';
|
|
38
|
+
import chalk from 'chalk';
|
|
39
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
40
|
+
import { join } from 'node:path';
|
|
41
|
+
import { ClaudeCodeRunner } from '../utils/claudeCode.js';
|
|
42
|
+
import { fromPackageRoot } from '../utils/getPaths.js';
|
|
43
|
+
import { logInfo } from '../utils/logging.js';
|
|
44
|
+
var I18N_SYSTEM_PROMPT = "";
|
|
45
|
+
export function i18nCommand() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
+
var configPath, config, task, prompt_1, _a, targetLang, customPrompt, s, claudeRunner, mcpConfigPath, result, error_1;
|
|
48
|
+
return __generator(this, function (_b) {
|
|
49
|
+
switch (_b.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
intro(chalk.blue('🌍 Locadex i18n'));
|
|
52
|
+
_b.label = 1;
|
|
53
|
+
case 1:
|
|
54
|
+
_b.trys.push([1, 12, , 13]);
|
|
55
|
+
configPath = join(process.cwd(), '.locadex.json');
|
|
56
|
+
if (!existsSync(configPath)) {
|
|
57
|
+
outro(chalk.red('❌ Locadex not configured. Run `npx locadex setup` first.'));
|
|
58
|
+
return [2 /*return*/];
|
|
59
|
+
}
|
|
60
|
+
config = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
61
|
+
if (!config.setupComplete) {
|
|
62
|
+
outro(chalk.red('❌ Setup incomplete. Please run `npx locadex setup` again.'));
|
|
63
|
+
return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
return [4 /*yield*/, select({
|
|
66
|
+
message: 'What would you like to do?',
|
|
67
|
+
options: [
|
|
68
|
+
{ value: 'extract', label: 'Extract text for translation' },
|
|
69
|
+
{ value: 'translate', label: 'Generate translations' },
|
|
70
|
+
{ value: 'audit', label: 'Audit existing translations' },
|
|
71
|
+
{ value: 'refactor', label: 'Refactor hardcoded strings' },
|
|
72
|
+
{ value: 'custom', label: 'Custom i18n task' },
|
|
73
|
+
],
|
|
74
|
+
})];
|
|
75
|
+
case 2:
|
|
76
|
+
task = _b.sent();
|
|
77
|
+
prompt_1 = '';
|
|
78
|
+
_a = task;
|
|
79
|
+
switch (_a) {
|
|
80
|
+
case 'extract': return [3 /*break*/, 3];
|
|
81
|
+
case 'translate': return [3 /*break*/, 4];
|
|
82
|
+
case 'audit': return [3 /*break*/, 6];
|
|
83
|
+
case 'refactor': return [3 /*break*/, 7];
|
|
84
|
+
case 'custom': return [3 /*break*/, 8];
|
|
85
|
+
}
|
|
86
|
+
return [3 /*break*/, 10];
|
|
87
|
+
case 3:
|
|
88
|
+
prompt_1 =
|
|
89
|
+
'Scan the codebase and extract all user-facing text that needs translation. Create appropriate translation keys and organize them logically.';
|
|
90
|
+
return [3 /*break*/, 10];
|
|
91
|
+
case 4: return [4 /*yield*/, text({
|
|
92
|
+
message: 'Target language (e.g., "es", "fr", "de"):',
|
|
93
|
+
placeholder: 'es',
|
|
94
|
+
})];
|
|
95
|
+
case 5:
|
|
96
|
+
targetLang = _b.sent();
|
|
97
|
+
prompt_1 = "Generate translations for the target language: ".concat(typeof targetLang === 'string' ? targetLang : 'es', ". Maintain context and ensure culturally appropriate translations.");
|
|
98
|
+
return [3 /*break*/, 10];
|
|
99
|
+
case 6:
|
|
100
|
+
prompt_1 =
|
|
101
|
+
'Audit existing translations for completeness, consistency, and quality. Identify missing keys and potential improvements.';
|
|
102
|
+
return [3 /*break*/, 10];
|
|
103
|
+
case 7:
|
|
104
|
+
prompt_1 =
|
|
105
|
+
'Find hardcoded strings in the codebase and refactor them to use the i18n system. Maintain functionality while making text translatable.';
|
|
106
|
+
return [3 /*break*/, 10];
|
|
107
|
+
case 8: return [4 /*yield*/, text({
|
|
108
|
+
message: 'Describe your i18n task:',
|
|
109
|
+
placeholder: 'I need help with...',
|
|
110
|
+
})];
|
|
111
|
+
case 9:
|
|
112
|
+
customPrompt = _b.sent();
|
|
113
|
+
prompt_1 = typeof customPrompt === 'string' ? customPrompt : '';
|
|
114
|
+
return [3 /*break*/, 10];
|
|
115
|
+
case 10:
|
|
116
|
+
s = spinner();
|
|
117
|
+
s.start('Processing i18n task...');
|
|
118
|
+
claudeRunner = new ClaudeCodeRunner({
|
|
119
|
+
apiKey: config.apiKey,
|
|
120
|
+
});
|
|
121
|
+
mcpConfigPath = fromPackageRoot('.locadex-mcp.json');
|
|
122
|
+
return [4 /*yield*/, claudeRunner.run({
|
|
123
|
+
// systemPrompt: I18N_SYSTEM_PROMPT,
|
|
124
|
+
prompt: prompt_1,
|
|
125
|
+
mcpConfig: mcpConfigPath,
|
|
126
|
+
allowedTools: ['mcp__*'],
|
|
127
|
+
})];
|
|
128
|
+
case 11:
|
|
129
|
+
result = _b.sent();
|
|
130
|
+
s.stop('Task complete');
|
|
131
|
+
logInfo('\n' + chalk.green('📋 Result:'));
|
|
132
|
+
logInfo(result);
|
|
133
|
+
outro(chalk.green('✅ i18n task completed!'));
|
|
134
|
+
return [3 /*break*/, 13];
|
|
135
|
+
case 12:
|
|
136
|
+
error_1 = _b.sent();
|
|
137
|
+
outro(chalk.red("\u274C Task failed: ".concat(error_1 instanceof Error ? error_1.message : String(error_1))));
|
|
138
|
+
process.exit(1);
|
|
139
|
+
return [3 /*break*/, 13];
|
|
140
|
+
case 13: return [2 /*return*/];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/commands/i18n.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,IAAM,kBAAkB,GAAG,EAAE,CAAC;AAS9B,MAAM,UAAgB,WAAW;;;;;;oBAC/B,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;;;;oBAI7B,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC,CAAC;oBACxD,IAAI,CAAC,UAAU,C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AAC,MAAM,CAAC,OAAK,CAAC,CAAE,CAC3E,CACF,CAAC;oBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;;;;;CAEnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAUA,wBAAsB,YAAY,kBAkDjC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { intro, outro, text, spinner } from '@clack/prompts';
|
|
38
|
+
import chalk from 'chalk';
|
|
39
|
+
import { ClaudeCodeRunner } from '../utils/claudeCode.js';
|
|
40
|
+
import { fromPackageRoot } from '../utils/getPaths.js';
|
|
41
|
+
import { logInfo } from '../utils/logging.js';
|
|
42
|
+
var SETUP_SYSTEM_PROMPT = "";
|
|
43
|
+
export function setupCommand() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
+
var projectType, s, mcpConfigPath, claudeRunner, setupPrompt, result, error_1;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
switch (_a.label) {
|
|
48
|
+
case 0:
|
|
49
|
+
intro(chalk.blue('🌍 Locadex Setup'));
|
|
50
|
+
_a.label = 1;
|
|
51
|
+
case 1:
|
|
52
|
+
_a.trys.push([1, 4, , 5]);
|
|
53
|
+
return [4 /*yield*/, text({
|
|
54
|
+
message: 'What type of project is this? (e.g., React, Vue, Node.js, etc.):',
|
|
55
|
+
placeholder: 'React',
|
|
56
|
+
})];
|
|
57
|
+
case 2:
|
|
58
|
+
projectType = _a.sent();
|
|
59
|
+
s = spinner();
|
|
60
|
+
mcpConfigPath = fromPackageRoot('.locadex-mcp.json');
|
|
61
|
+
// Run Claude Code for project analysis
|
|
62
|
+
s.start('Analyzing project for i18n setup...');
|
|
63
|
+
claudeRunner = new ClaudeCodeRunner({
|
|
64
|
+
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
65
|
+
});
|
|
66
|
+
setupPrompt = "Use the locadex mcp server to learn how to use gt-next. \nThen, use gt-next to internationalize this next.js app";
|
|
67
|
+
return [4 /*yield*/, claudeRunner.run({
|
|
68
|
+
// systemPrompt: SETUP_SYSTEM_PROMPT,
|
|
69
|
+
prompt: setupPrompt,
|
|
70
|
+
mcpConfig: mcpConfigPath,
|
|
71
|
+
allowedTools: ['mcp__*'],
|
|
72
|
+
})];
|
|
73
|
+
case 3:
|
|
74
|
+
result = _a.sent();
|
|
75
|
+
s.stop('Analysis complete');
|
|
76
|
+
logInfo('\n' + chalk.green('📋 Setup Analysis:'));
|
|
77
|
+
logInfo(result);
|
|
78
|
+
outro(chalk.green('✅ Locadex setup complete! Run `npx locadex i18n` to start working on internationalization.'));
|
|
79
|
+
return [3 /*break*/, 5];
|
|
80
|
+
case 4:
|
|
81
|
+
error_1 = _a.sent();
|
|
82
|
+
outro(chalk.red("\u274C Setup failed: ".concat(error_1 instanceof Error ? error_1.message : String(error_1))));
|
|
83
|
+
process.exit(1);
|
|
84
|
+
return [3 /*break*/, 5];
|
|
85
|
+
case 5: return [2 /*return*/];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 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,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;oBAClD,OAAO,CAAC,MAAM,CAAC,CAAC;oBAEhB,KAAK,CACH,KAAK,CAAC,KAAK,CACT,4FAA4F,CAC7F,CACF,CAAC;;;;oBAEF,KAAK,CACH,KAAK,CAAC,GAAG,CACP,+BAAmB,OAAK,YAAY,KAAK,CAAC,CAAC,CAAC,OAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAK,CAAC,CAAE,CAC5E,CACF,CAAC;oBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;;;;;CAEnB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ClaudeCodeOptions {
|
|
2
|
+
systemPrompt?: string;
|
|
3
|
+
prompt: string;
|
|
4
|
+
outputFormat?: 'text' | 'json' | 'stream-json';
|
|
5
|
+
mcpConfig?: string;
|
|
6
|
+
allowedTools?: string[];
|
|
7
|
+
maxTurns?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class ClaudeCodeRunner {
|
|
10
|
+
private options;
|
|
11
|
+
constructor(options?: {
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
});
|
|
14
|
+
run(options: ClaudeCodeOptions): Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=claudeCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claudeCode.d.ts","sourceRoot":"","sources":["../../src/utils/claudeCode.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,OAAO;gBAAP,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;IAS/C,GAAG,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;CA4DvD"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { spawn } from 'node:child_process';
|
|
49
|
+
var ClaudeCodeRunner = /** @class */ (function () {
|
|
50
|
+
function ClaudeCodeRunner(options) {
|
|
51
|
+
if (options === void 0) { options = {}; }
|
|
52
|
+
this.options = options;
|
|
53
|
+
// Ensure API key is set
|
|
54
|
+
if (!process.env.ANTHROPIC_API_KEY && !this.options.apiKey) {
|
|
55
|
+
throw new Error('ANTHROPIC_API_KEY environment variable or apiKey option is required');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
ClaudeCodeRunner.prototype.run = function (options) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
+
var _this = this;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
var args = ['-p', options.prompt];
|
|
65
|
+
if (options.systemPrompt) {
|
|
66
|
+
args.push('--system-prompt', options.systemPrompt);
|
|
67
|
+
}
|
|
68
|
+
if (options.outputFormat) {
|
|
69
|
+
args.push('--output-format', options.outputFormat);
|
|
70
|
+
}
|
|
71
|
+
if (options.mcpConfig) {
|
|
72
|
+
args.push('--mcp-config', options.mcpConfig);
|
|
73
|
+
}
|
|
74
|
+
if (options.allowedTools) {
|
|
75
|
+
args.push('--allowedTools', options.allowedTools.join(','));
|
|
76
|
+
}
|
|
77
|
+
if (options.maxTurns) {
|
|
78
|
+
args.push('--max-turns', options.maxTurns.toString());
|
|
79
|
+
}
|
|
80
|
+
var env = __assign({}, process.env);
|
|
81
|
+
if (_this.options.apiKey) {
|
|
82
|
+
env.ANTHROPIC_API_KEY = _this.options.apiKey;
|
|
83
|
+
}
|
|
84
|
+
var claude = spawn('claude', args, {
|
|
85
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
86
|
+
env: env,
|
|
87
|
+
});
|
|
88
|
+
var output = '';
|
|
89
|
+
var errorOutput = '';
|
|
90
|
+
(_a = claude.stdout) === null || _a === void 0 ? void 0 : _a.on('data', function (data) {
|
|
91
|
+
output += data.toString();
|
|
92
|
+
});
|
|
93
|
+
(_b = claude.stderr) === null || _b === void 0 ? void 0 : _b.on('data', function (data) {
|
|
94
|
+
errorOutput += data.toString();
|
|
95
|
+
});
|
|
96
|
+
claude.on('close', function (code) {
|
|
97
|
+
if (code === 0) {
|
|
98
|
+
resolve(output.trim());
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
reject(new Error("Claude Code exited with code ".concat(code, ": ").concat(errorOutput)));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
claude.on('error', function (error) {
|
|
105
|
+
reject(new Error("Failed to run Claude Code: ".concat(error.message)));
|
|
106
|
+
});
|
|
107
|
+
})];
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
return ClaudeCodeRunner;
|
|
112
|
+
}());
|
|
113
|
+
export { ClaudeCodeRunner };
|
|
114
|
+
//# sourceMappingURL=claudeCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claudeCode.js","sourceRoot":"","sources":["../../src/utils/claudeCode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAW3C;IACE,0BAAoB,OAAiC;QAAjC,wBAAA,EAAA,YAAiC;QAAjC,YAAO,GAAP,OAAO,CAA0B;QACnD,wBAAwB;QACxB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YAC3D,MAAM,IAAI,KAAK,CACb,qEAAqE,CACtE,CAAC;QACJ,CAAC;IACH,CAAC;IAEK,8BAAG,GAAT,UAAU,OAA0B;;;;gBAClC,sBAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;;wBACjC,IAAM,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;wBAEpC,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;4BACzB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;wBACrD,CAAC;wBAED,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;4BACzB,IAAI,CAAC,IAAI,CAAC,iBAAi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wBAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,IAAI;4BACtB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gCACf,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;4BACzB,CAAC;iCAAM,CAAC;gCACN,MAAM,CACJ,IAAI,KAAK,CAAC,uCAAgC,IAAI,eAAK,WAAW,CAAE,CAAC,CAClE,CAAC;4BACJ,CAAC;wBACH,CAAC,CAAC,CAAC;wBAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,KAAK;4BACvB,MAAM,CAAC,IAAI,KAAK,CAAC,qCAA8B,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC,CAAC;wBACnE,CAAC,CAAC,CAAC;oBACL,CAAC,CAAC,EAAC;;;KACJ;IACH,uBAAC;AAAD,CAAC,AAtED,IAsEC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare function logInfo(message: string): void;
|
|
2
|
+
export declare function logWarning(message: string): void;
|
|
3
|
+
export declare function logError(message: string): void;
|
|
4
|
+
export declare function logSuccess(message: string): void;
|
|
5
|
+
export declare function logStep(message: string): void;
|
|
6
|
+
export declare function logMessage(message: string): void;
|
|
7
|
+
export declare function logErrorAndExit(message: string): void;
|
|
8
|
+
export declare function startCommand(message: string): void;
|
|
9
|
+
export declare function endCommand(message: string): void;
|
|
10
|
+
export declare function displayHeader(introString?: string): void;
|
|
11
|
+
export declare function displayProjectId(projectId: string): void;
|
|
12
|
+
export declare function displayResolvedPaths(resolvedPaths: [string, string][]): void;
|
|
13
|
+
export declare function displayCreatedConfigFile(configFilepath: string): void;
|
|
14
|
+
export declare function displayUpdatedConfigFile(configFilepath: string): void;
|
|
15
|
+
export declare function createSpinner(indicator?: 'dots' | 'timer'): {
|
|
16
|
+
start: (msg?: string) => void;
|
|
17
|
+
stop: (msg?: string, code?: number) => void;
|
|
18
|
+
message: (msg?: string) => void;
|
|
19
|
+
};
|
|
20
|
+
export declare function createOraSpinner(indicator?: 'dots' | 'circleHalves'): Promise<import("ora").Ora>;
|
|
21
|
+
export declare function promptText({ message, defaultValue, validate, }: {
|
|
22
|
+
message: string;
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
validate?: (value: string) => boolean | string;
|
|
25
|
+
}): Promise<string>;
|
|
26
|
+
export declare function promptSelect<T>({ message, options, defaultValue, }: {
|
|
27
|
+
message: string;
|
|
28
|
+
options: Array<{
|
|
29
|
+
value: T;
|
|
30
|
+
label: string;
|
|
31
|
+
hint?: string;
|
|
32
|
+
}>;
|
|
33
|
+
defaultValue?: T;
|
|
34
|
+
}): Promise<T>;
|
|
35
|
+
export declare function promptMultiSelect<T extends string>({ message, options, required, }: {
|
|
36
|
+
message: string;
|
|
37
|
+
options: Array<{
|
|
38
|
+
value: T;
|
|
39
|
+
label: string;
|
|
40
|
+
hint?: string;
|
|
41
|
+
}>;
|
|
42
|
+
required?: boolean;
|
|
43
|
+
}): Promise<T[]>;
|
|
44
|
+
export declare function promptConfirm({ message, defaultValue, cancelMessage, }: {
|
|
45
|
+
message: string;
|
|
46
|
+
defaultValue?: boolean;
|
|
47
|
+
cancelMessage?: string;
|
|
48
|
+
}): Promise<boolean>;
|
|
49
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":"AAeA,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,QAEtC;AACD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,QAEzC;AACD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,QAEvC;AACD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,QAEzC;AACD,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,QAEtC;AACD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,QAEzC;AAED,wBAAgB,eAAe,CAAC,OAAO,E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AChB,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,gBAoBA;AAED,wBAAsB,aAAa,CAAC,EAClC,OAAO,EACP,YAAmB,EACnB,aAAqC,GACtC,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,oBAYA"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { log, spinner, intro, outro, text, select, confirm, isCancel, cancel, multiselect, } from '@clack/prompts';
|
|
38
|
+
import chalk from 'chalk';
|
|
39
|
+
// Basic logging functions
|
|
40
|
+
export function logInfo(message) {
|
|
41
|
+
log.info(message);
|
|
42
|
+
}
|
|
43
|
+
export function logWarning(message) {
|
|
44
|
+
log.warn(message);
|
|
45
|
+
}
|
|
46
|
+
export function logError(message) {
|
|
47
|
+
log.error(message);
|
|
48
|
+
}
|
|
49
|
+
export function logSuccess(message) {
|
|
50
|
+
log.success(message);
|
|
51
|
+
}
|
|
52
|
+
export function logStep(message) {
|
|
53
|
+
log.step(message);
|
|
54
|
+
}
|
|
55
|
+
export function logMessage(message) {
|
|
56
|
+
log.message(message, { symbol: chalk.cyan('~') });
|
|
57
|
+
}
|
|
58
|
+
export function logErrorAndExit(message) {
|
|
59
|
+
log.error(message);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
// Clack prompts
|
|
63
|
+
export function startCommand(message) {
|
|
64
|
+
intro(chalk.cyan(message));
|
|
65
|
+
}
|
|
66
|
+
export function endCommand(message) {
|
|
67
|
+
outro(chalk.cyan(message));
|
|
68
|
+
}
|
|
69
|
+
// GT specific logging
|
|
70
|
+
export function displayHeader(introString) {
|
|
71
|
+
displayAsciiTitle();
|
|
72
|
+
displayInitializingText();
|
|
73
|
+
if (introString) {
|
|
74
|
+
startCommand(introString);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function displayAsciiTitle() {
|
|
78
|
+
// eslint-disable-next-line no-console
|
|
79
|
+
console.log(chalk.cyan("\n ,ad8888ba, 888888888888 \n d8\"' `\"8b 88 \nd8' 88 \n88 88 \n88 88888 88 \nY8, 88 88 \n Y8a. .a88 88 \n `\"Y88888P\" 88 "));
|
|
80
|
+
}
|
|
81
|
+
function displayInitializingText() {
|
|
82
|
+
// eslint-disable-next-line no-console
|
|
83
|
+
console.log("\n".concat(chalk.bold.blue('General Translation, Inc.'), "\n").concat(chalk.gray('https://generaltranslation.com/docs'), "\n"));
|
|
84
|
+
}
|
|
85
|
+
export function displayProjectId(projectId) {
|
|
86
|
+
logMessage(chalk.gray("Project ID: ".concat(chalk.bold(projectId))));
|
|
87
|
+
}
|
|
88
|
+
export function displayResolvedPaths(resolvedPaths) {
|
|
89
|
+
var paths = resolvedPaths.map(function (_a) {
|
|
90
|
+
var key = _a[0], resolvedPath = _a[1];
|
|
91
|
+
return chalk.gray("'".concat(chalk.white(key), "' \u2192 '").concat(chalk.green(resolvedPath), "'"));
|
|
92
|
+
});
|
|
93
|
+
log.step("Resolved path aliases:\n".concat(paths.join('\n')));
|
|
94
|
+
}
|
|
95
|
+
export function displayCreatedConfigFile(configFilepath) {
|
|
96
|
+
log.success("Created config file ".concat(chalk.cyan(configFilepath)));
|
|
97
|
+
}
|
|
98
|
+
export function displayUpdatedConfigFile(configFilepath) {
|
|
99
|
+
log.success("Updated config file ".concat(chalk.cyan(configFilepath)));
|
|
100
|
+
}
|
|
101
|
+
// Spinner functionality
|
|
102
|
+
export function createSpinner(indicator) {
|
|
103
|
+
if (indicator === void 0) { indicator = 'timer'; }
|
|
104
|
+
return spinner({ indicator: indicator });
|
|
105
|
+
}
|
|
106
|
+
// Spinner functionality
|
|
107
|
+
export function createOraSpinner() {
|
|
108
|
+
return __awaiter(this, arguments, void 0, function (indicator) {
|
|
109
|
+
var ora;
|
|
110
|
+
if (indicator === void 0) { indicator = 'circleHalves'; }
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0: return [4 /*yield*/, import('ora')];
|
|
114
|
+
case 1:
|
|
115
|
+
ora = _a.sent();
|
|
116
|
+
return [2 /*return*/, ora.default({ spinner: indicator })];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
// Input prompts
|
|
122
|
+
export function promptText(_a) {
|
|
123
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
124
|
+
var result;
|
|
125
|
+
var message = _b.message, defaultValue = _b.defaultValue, validate = _b.validate;
|
|
126
|
+
return __generator(this, function (_c) {
|
|
127
|
+
switch (_c.label) {
|
|
128
|
+
case 0: return [4 /*yield*/, text({
|
|
129
|
+
message: message,
|
|
130
|
+
placeholder: defaultValue,
|
|
131
|
+
validate: validate
|
|
132
|
+
? function (value) {
|
|
133
|
+
var validation = validate(value);
|
|
134
|
+
return validation === true ? undefined : validation.toString();
|
|
135
|
+
}
|
|
136
|
+
: undefined,
|
|
137
|
+
})];
|
|
138
|
+
case 1:
|
|
139
|
+
result = _c.sent();
|
|
140
|
+
if (isCancel(result)) {
|
|
141
|
+
cancel('Operation cancelled');
|
|
142
|
+
process.exit(0);
|
|
143
|
+
}
|
|
144
|
+
return [2 /*return*/, result];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export function promptSelect(_a) {
|
|
150
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
151
|
+
var clackOptions, result;
|
|
152
|
+
var message = _b.message, options = _b.options, defaultValue = _b.defaultValue;
|
|
153
|
+
return __generator(this, function (_c) {
|
|
154
|
+
switch (_c.label) {
|
|
155
|
+
case 0:
|
|
156
|
+
clackOptions = options.map(function (opt) { return ({
|
|
157
|
+
value: opt.value,
|
|
158
|
+
label: opt.label,
|
|
159
|
+
hint: opt.hint,
|
|
160
|
+
}); });
|
|
161
|
+
return [4 /*yield*/, select({
|
|
162
|
+
message: message,
|
|
163
|
+
options: clackOptions,
|
|
164
|
+
initialValue: defaultValue,
|
|
165
|
+
})];
|
|
166
|
+
case 1:
|
|
167
|
+
result = _c.sent();
|
|
168
|
+
if (isCancel(result)) {
|
|
169
|
+
cancel('Operation cancelled');
|
|
170
|
+
process.exit(0);
|
|
171
|
+
}
|
|
172
|
+
return [2 /*return*/, result];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
export function promptMultiSelect(_a) {
|
|
178
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
179
|
+
var clackOptions, result;
|
|
180
|
+
var message = _b.message, options = _b.options, _c = _b.required, required = _c === void 0 ? true : _c;
|
|
181
|
+
return __generator(this, function (_d) {
|
|
182
|
+
switch (_d.label) {
|
|
183
|
+
case 0:
|
|
184
|
+
clackOptions = options.map(function (opt) { return ({
|
|
185
|
+
value: opt.value,
|
|
186
|
+
label: opt.label,
|
|
187
|
+
hint: opt.hint,
|
|
188
|
+
}); });
|
|
189
|
+
return [4 /*yield*/, multiselect({
|
|
190
|
+
message: message,
|
|
191
|
+
options: clackOptions,
|
|
192
|
+
required: required,
|
|
193
|
+
})];
|
|
194
|
+
case 1:
|
|
195
|
+
result = _d.sent();
|
|
196
|
+
if (isCancel(result)) {
|
|
197
|
+
cancel('Operation cancelled');
|
|
198
|
+
process.exit(0);
|
|
199
|
+
}
|
|
200
|
+
return [2 /*return*/, result];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
export function promptConfirm(_a) {
|
|
206
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
207
|
+
var result;
|
|
208
|
+
var message = _b.message, _c = _b.defaultValue, defaultValue = _c === void 0 ? true : _c, _d = _b.cancelMessage, cancelMessage = _d === void 0 ? 'Operation cancelled' : _d;
|
|
209
|
+
return __generator(this, function (_e) {
|
|
210
|
+
switch (_e.label) {
|
|
211
|
+
case 0: return [4 /*yield*/, confirm({
|
|
212
|
+
message: message,
|
|
213
|
+
initialValue: defaultValue,
|
|
214
|
+
})];
|
|
215
|
+
case 1:
|
|
216
|
+
result = _e.sent();
|
|
217
|
+
if (isCancel(result)) {
|
|
218
|
+
cancel(cancelMessage);
|
|
219
|
+
process.exit(0);
|
|
220
|
+
}
|
|
221
|
+
return [2 /*return*/, result];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,GAAG,EACH,OAAO,EACP,KAAK,EACL,KAAK,EACL,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,WAAW,GACZ,MAAM,gBAAgB,CAAC;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,EAAnB,YAAY,mBAAG,IAAI,KAAA,EACnB,qBAAqC,EAArC,aAAa,mBAAG,qBAAqB,KAAA;;;wBAMtB,qBAAM,OAAO,CAAC;wBAC3B,OAAO,SAAA;wBACP,YAAY,EAAE,YAAY;qBAC3B,CAAC,EAAA;;oBAHI,MAAM,GAAG,SAGb;oBAEF,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;wBACrB,MAAM,CAAC,aAAa,CAAC,CAAC;wBACtB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBAClB,CAAC;oBAED,sBAAO,MAAM,EAAC;;;;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpConfig.d.ts","sourceRoot":"","sources":["../../src/utils/mcpConfig.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;CAQrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpConfig.js","sourceRoot":"","sources":["../../src/utils/mcpConfig.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,SAAS,GAAG;IACvB,UAAU,EAAE;QACV,OAAO,EAAE;YACP,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC;YAC3B,GAAG,EAAE,EAAE;SACR;KACF;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "locadex",
|
|
3
|
-
"version": "0.0.1",
|
|
3
|
+
"version": "0.0.2-alpha.1",
|
|
4
4
|
"description": "An AI agent for internationalization",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"
|
|
8
|
+
"locadex": "dist/cli.js",
|
|
9
|
+
"locadex-mcp": "dist/index.js"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
11
12
|
"dist",
|
|
12
|
-
"CHANGELOG.md"
|
|
13
|
+
"CHANGELOG.md",
|
|
14
|
+
".locadex-mcp.json"
|
|
13
15
|
],
|
|
14
16
|
"dependencies": {
|
|
15
|
-
"@modelcontextprotocol/sdk": "^1.12.0"
|
|
17
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
18
|
+
"@anthropic-ai/claude-code": "1.0.8",
|
|
19
|
+
"@clack/prompts": "^0.11.0",
|
|
20
|
+
"chalk": "^4.1.2",
|
|
21
|
+
"commander": "^12.1.0",
|
|
22
|
+
"dotenv": "^16.4.5"
|
|
16
23
|
},
|
|
17
24
|
"devDependencies": {
|
|
18
25
|
"@modelcontextprotocol/inspector": "^0.13.0",
|
|
@@ -27,8 +34,7 @@
|
|
|
27
34
|
},
|
|
28
35
|
"scripts": {
|
|
29
36
|
"patch": "npm version patch",
|
|
30
|
-
"
|
|
31
|
-
"build": "npm run transpile",
|
|
37
|
+
"build": "tsc",
|
|
32
38
|
"build:clean": "rm -rf dist; npm run lint && npm run build",
|
|
33
39
|
"dev": "npm run build && node dist/index.js",
|
|
34
40
|
"inspect": "npx @modelcontextprotocol/inspector node dist/index.js",
|