lingo.dev 0.76.0 → 0.77.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/build/cli.cjs +62 -4
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +63 -5
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -3
package/build/cli.cjs
CHANGED
|
@@ -3223,7 +3223,7 @@ async function retryWithExponentialBackoff(operation, maxAttempts, baseDelay = 1
|
|
|
3223
3223
|
throw new Error("Unreachable code");
|
|
3224
3224
|
}
|
|
3225
3225
|
function createLocalizationEngineConnection(params) {
|
|
3226
|
-
const replexicaEngine = new (0, __sdk.
|
|
3226
|
+
const replexicaEngine = new (0, __sdk.LingoDotDevEngine)({
|
|
3227
3227
|
apiKey: params.apiKey,
|
|
3228
3228
|
apiUrl: params.apiUrl
|
|
3229
3229
|
});
|
|
@@ -3234,7 +3234,11 @@ function createLocalizationEngineConnection(params) {
|
|
|
3234
3234
|
args.processableData,
|
|
3235
3235
|
{
|
|
3236
3236
|
sourceLocale: args.sourceLocale,
|
|
3237
|
-
targetLocale: args.targetLocale
|
|
3237
|
+
targetLocale: args.targetLocale,
|
|
3238
|
+
reference: {
|
|
3239
|
+
[args.sourceLocale]: args.sourceData,
|
|
3240
|
+
[args.targetLocale]: args.targetData
|
|
3241
|
+
}
|
|
3238
3242
|
},
|
|
3239
3243
|
onProgress
|
|
3240
3244
|
),
|
|
@@ -3517,10 +3521,63 @@ function displaySummary(results) {
|
|
|
3517
3521
|
});
|
|
3518
3522
|
}
|
|
3519
3523
|
|
|
3524
|
+
// src/cli/cmd/mcp.ts
|
|
3525
|
+
|
|
3526
|
+
var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
3527
|
+
var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
3528
|
+
|
|
3529
|
+
|
|
3530
|
+
var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_21, program) => {
|
|
3531
|
+
const apiKey = program.args[0];
|
|
3532
|
+
const settings = getSettings(apiKey);
|
|
3533
|
+
if (!settings.auth.apiKey) {
|
|
3534
|
+
console.error("No API key provided");
|
|
3535
|
+
return;
|
|
3536
|
+
}
|
|
3537
|
+
const authenticator = createAuthenticator({
|
|
3538
|
+
apiUrl: settings.auth.apiUrl,
|
|
3539
|
+
apiKey: settings.auth.apiKey
|
|
3540
|
+
});
|
|
3541
|
+
const auth = await authenticator.whoami();
|
|
3542
|
+
if (!auth) {
|
|
3543
|
+
console.error("Not authenticated");
|
|
3544
|
+
return;
|
|
3545
|
+
} else {
|
|
3546
|
+
console.log(`Authenticated as ${auth.email}`);
|
|
3547
|
+
}
|
|
3548
|
+
const replexicaEngine = new (0, __sdk.ReplexicaEngine)({
|
|
3549
|
+
apiKey: settings.auth.apiKey,
|
|
3550
|
+
apiUrl: settings.auth.apiUrl
|
|
3551
|
+
});
|
|
3552
|
+
const server = new (0, _mcpjs.McpServer)({
|
|
3553
|
+
name: "Lingo.dev",
|
|
3554
|
+
version: "1.0.0"
|
|
3555
|
+
});
|
|
3556
|
+
server.tool(
|
|
3557
|
+
"translate",
|
|
3558
|
+
"Detect language and translate text with Lingo.dev.",
|
|
3559
|
+
{
|
|
3560
|
+
text: _zod2.default.string(),
|
|
3561
|
+
targetLocale: _zod2.default.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/)
|
|
3562
|
+
},
|
|
3563
|
+
async ({ text, targetLocale }) => {
|
|
3564
|
+
const sourceLocale = await replexicaEngine.recognizeLocale(text);
|
|
3565
|
+
const data = await replexicaEngine.localizeText(text, {
|
|
3566
|
+
sourceLocale,
|
|
3567
|
+
targetLocale
|
|
3568
|
+
});
|
|
3569
|
+
return { content: [{ type: "text", text: data }] };
|
|
3570
|
+
}
|
|
3571
|
+
);
|
|
3572
|
+
const transport = new (0, _stdiojs.StdioServerTransport)();
|
|
3573
|
+
await server.connect(transport);
|
|
3574
|
+
console.log("Lingo.dev MCP Server running on stdio");
|
|
3575
|
+
});
|
|
3576
|
+
|
|
3520
3577
|
// package.json
|
|
3521
3578
|
var package_default = {
|
|
3522
3579
|
name: "lingo.dev",
|
|
3523
|
-
version: "0.
|
|
3580
|
+
version: "0.77.1",
|
|
3524
3581
|
description: "Lingo.dev CLI",
|
|
3525
3582
|
private: false,
|
|
3526
3583
|
publishConfig: {
|
|
@@ -3568,6 +3625,7 @@ var package_default = {
|
|
|
3568
3625
|
"@inquirer/prompts": "^7.2.3",
|
|
3569
3626
|
"@lingo.dev/_sdk": "workspace:*",
|
|
3570
3627
|
"@lingo.dev/_spec": "workspace:*",
|
|
3628
|
+
"@modelcontextprotocol/sdk": "^1.5.0",
|
|
3571
3629
|
"@paralleldrive/cuid2": "^2.2.2",
|
|
3572
3630
|
chalk: "^5.4.1",
|
|
3573
3631
|
cors: "^2.8.5",
|
|
@@ -3657,7 +3715,7 @@ ${_gradientstring.vice.call(void 0,
|
|
|
3657
3715
|
|
|
3658
3716
|
Website: https://lingo.dev
|
|
3659
3717
|
`
|
|
3660
|
-
).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(lockfile_default).addCommand(cleanup_default).exitOverride((err) => {
|
|
3718
|
+
).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(lockfile_default).addCommand(cleanup_default).addCommand(mcp_default).exitOverride((err) => {
|
|
3661
3719
|
if (err.code === "commander.helpDisplayed" || err.code === "commander.version" || err.code === "commander.help") {
|
|
3662
3720
|
process.exit(0);
|
|
3663
3721
|
}
|