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.mjs CHANGED
@@ -780,7 +780,7 @@ var show_default = new Command5().command("show").description("Prints out the cu
780
780
 
781
781
  // src/cli/cmd/i18n.ts
782
782
  import { bucketTypeSchema, localeCodeSchema, resolveOverridenLocale as resolveOverridenLocale3 } from "@lingo.dev/_spec";
783
- import { ReplexicaEngine } from "@lingo.dev/_sdk";
783
+ import { LingoDotDevEngine } from "@lingo.dev/_sdk";
784
784
  import { Command as Command6 } from "interactive-commander";
785
785
  import Z4 from "zod";
786
786
  import _19 from "lodash";
@@ -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 ReplexicaEngine({
3226
+ const replexicaEngine = new 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
+ import { Command as Command9 } from "interactive-commander";
3526
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3527
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3528
+ import Z6 from "zod";
3529
+ import { ReplexicaEngine } from "@lingo.dev/_sdk";
3530
+ var mcp_default = new Command9().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 ReplexicaEngine({
3549
+ apiKey: settings.auth.apiKey,
3550
+ apiUrl: settings.auth.apiUrl
3551
+ });
3552
+ const server = new 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: Z6.string(),
3561
+ targetLocale: Z6.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 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.76.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 @@ ${vice(
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
  }