lingo.dev 0.122.0 → 0.122.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 +2 -57
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +55 -110
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.mjs
CHANGED
|
@@ -12233,63 +12233,8 @@ function displaySummary(results) {
|
|
|
12233
12233
|
});
|
|
12234
12234
|
}
|
|
12235
12235
|
|
|
12236
|
-
// src/cli/cmd/mcp.ts
|
|
12237
|
-
import { Command as Command17 } from "interactive-commander";
|
|
12238
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
12239
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12240
|
-
import Z6 from "zod";
|
|
12241
|
-
import { ReplexicaEngine } from "@lingo.dev/_sdk";
|
|
12242
|
-
var mcp_default = new Command17().command("mcp").description(
|
|
12243
|
-
"Start a Model Context Protocol (MCP) server for AI assistant integration"
|
|
12244
|
-
).helpOption("-h, --help", "Show help").action(async (_37, program) => {
|
|
12245
|
-
const apiKey = program.args[0];
|
|
12246
|
-
const settings = getSettings(apiKey);
|
|
12247
|
-
if (!settings.auth.apiKey) {
|
|
12248
|
-
console.error("No API key provided");
|
|
12249
|
-
return;
|
|
12250
|
-
}
|
|
12251
|
-
const authenticator = createAuthenticator({
|
|
12252
|
-
apiUrl: settings.auth.apiUrl,
|
|
12253
|
-
apiKey: settings.auth.apiKey
|
|
12254
|
-
});
|
|
12255
|
-
const auth = await authenticator.whoami();
|
|
12256
|
-
if (!auth) {
|
|
12257
|
-
console.error("Not authenticated");
|
|
12258
|
-
return;
|
|
12259
|
-
} else {
|
|
12260
|
-
console.log(`Authenticated as ${auth.email}`);
|
|
12261
|
-
}
|
|
12262
|
-
const replexicaEngine = new ReplexicaEngine({
|
|
12263
|
-
apiKey: settings.auth.apiKey,
|
|
12264
|
-
apiUrl: settings.auth.apiUrl
|
|
12265
|
-
});
|
|
12266
|
-
const server = new McpServer({
|
|
12267
|
-
name: "Lingo.dev",
|
|
12268
|
-
version: "1.0.0"
|
|
12269
|
-
});
|
|
12270
|
-
server.tool(
|
|
12271
|
-
"translate",
|
|
12272
|
-
"Detect language and translate text with Lingo.dev.",
|
|
12273
|
-
{
|
|
12274
|
-
text: Z6.string(),
|
|
12275
|
-
targetLocale: Z6.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/)
|
|
12276
|
-
},
|
|
12277
|
-
async ({ text, targetLocale }) => {
|
|
12278
|
-
const sourceLocale = await replexicaEngine.recognizeLocale(text);
|
|
12279
|
-
const data = await replexicaEngine.localizeText(text, {
|
|
12280
|
-
sourceLocale,
|
|
12281
|
-
targetLocale
|
|
12282
|
-
});
|
|
12283
|
-
return { content: [{ type: "text", text: data }] };
|
|
12284
|
-
}
|
|
12285
|
-
);
|
|
12286
|
-
const transport = new StdioServerTransport();
|
|
12287
|
-
await server.connect(transport);
|
|
12288
|
-
console.log("Lingo.dev MCP Server running on stdio");
|
|
12289
|
-
});
|
|
12290
|
-
|
|
12291
12236
|
// src/cli/cmd/ci/index.ts
|
|
12292
|
-
import { Command as
|
|
12237
|
+
import { Command as Command18 } from "interactive-commander";
|
|
12293
12238
|
import createOra from "ora";
|
|
12294
12239
|
|
|
12295
12240
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
@@ -12318,7 +12263,7 @@ function escapeShellArg(arg) {
|
|
|
12318
12263
|
}
|
|
12319
12264
|
|
|
12320
12265
|
// src/cli/cmd/run/index.ts
|
|
12321
|
-
import { Command as
|
|
12266
|
+
import { Command as Command17 } from "interactive-commander";
|
|
12322
12267
|
import { exec } from "child_process";
|
|
12323
12268
|
import path18 from "path";
|
|
12324
12269
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
@@ -13751,7 +13696,7 @@ function playSound(type) {
|
|
|
13751
13696
|
setTimeout(resolve, 3e3);
|
|
13752
13697
|
});
|
|
13753
13698
|
}
|
|
13754
|
-
var run_default = new
|
|
13699
|
+
var run_default = new Command17().command("run").description("Run localization pipeline").helpOption("-h, --help", "Show help").option(
|
|
13755
13700
|
"--source-locale <source-locale>",
|
|
13756
13701
|
"Override the source locale from i18n.json for this run"
|
|
13757
13702
|
).option(
|
|
@@ -14154,11 +14099,11 @@ Hey team,
|
|
|
14154
14099
|
// src/cli/cmd/ci/platforms/bitbucket.ts
|
|
14155
14100
|
import { execSync as execSync5 } from "child_process";
|
|
14156
14101
|
import bbLib from "bitbucket";
|
|
14157
|
-
import
|
|
14102
|
+
import Z7 from "zod";
|
|
14158
14103
|
|
|
14159
14104
|
// src/cli/cmd/ci/platforms/_base.ts
|
|
14160
14105
|
import { execSync as execSync4 } from "child_process";
|
|
14161
|
-
import
|
|
14106
|
+
import Z6 from "zod";
|
|
14162
14107
|
var defaultMessage = "feat: update translations via @lingodotdev";
|
|
14163
14108
|
var PlatformKit = class {
|
|
14164
14109
|
gitConfig(token, repoUrl) {
|
|
@@ -14169,20 +14114,20 @@ var PlatformKit = class {
|
|
|
14169
14114
|
}
|
|
14170
14115
|
}
|
|
14171
14116
|
get config() {
|
|
14172
|
-
const env =
|
|
14173
|
-
LINGODOTDEV_API_KEY:
|
|
14174
|
-
LINGODOTDEV_PULL_REQUEST:
|
|
14117
|
+
const env = Z6.object({
|
|
14118
|
+
LINGODOTDEV_API_KEY: Z6.string(),
|
|
14119
|
+
LINGODOTDEV_PULL_REQUEST: Z6.preprocess(
|
|
14175
14120
|
(val) => val === "true" || val === true,
|
|
14176
|
-
|
|
14121
|
+
Z6.boolean()
|
|
14177
14122
|
),
|
|
14178
|
-
LINGODOTDEV_COMMIT_MESSAGE:
|
|
14179
|
-
LINGODOTDEV_PULL_REQUEST_TITLE:
|
|
14180
|
-
LINGODOTDEV_COMMIT_AUTHOR_NAME:
|
|
14181
|
-
LINGODOTDEV_COMMIT_AUTHOR_EMAIL:
|
|
14182
|
-
LINGODOTDEV_WORKING_DIRECTORY:
|
|
14183
|
-
LINGODOTDEV_PROCESS_OWN_COMMITS:
|
|
14123
|
+
LINGODOTDEV_COMMIT_MESSAGE: Z6.string().optional(),
|
|
14124
|
+
LINGODOTDEV_PULL_REQUEST_TITLE: Z6.string().optional(),
|
|
14125
|
+
LINGODOTDEV_COMMIT_AUTHOR_NAME: Z6.string().optional(),
|
|
14126
|
+
LINGODOTDEV_COMMIT_AUTHOR_EMAIL: Z6.string().optional(),
|
|
14127
|
+
LINGODOTDEV_WORKING_DIRECTORY: Z6.string().optional(),
|
|
14128
|
+
LINGODOTDEV_PROCESS_OWN_COMMITS: Z6.preprocess(
|
|
14184
14129
|
(val) => val === "true" || val === true,
|
|
14185
|
-
|
|
14130
|
+
Z6.boolean()
|
|
14186
14131
|
).optional()
|
|
14187
14132
|
}).parse(process.env);
|
|
14188
14133
|
return {
|
|
@@ -14278,10 +14223,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
14278
14223
|
);
|
|
14279
14224
|
}
|
|
14280
14225
|
get platformConfig() {
|
|
14281
|
-
const env =
|
|
14282
|
-
BITBUCKET_BRANCH:
|
|
14283
|
-
BITBUCKET_REPO_FULL_NAME:
|
|
14284
|
-
BB_TOKEN:
|
|
14226
|
+
const env = Z7.object({
|
|
14227
|
+
BITBUCKET_BRANCH: Z7.string(),
|
|
14228
|
+
BITBUCKET_REPO_FULL_NAME: Z7.string(),
|
|
14229
|
+
BB_TOKEN: Z7.string().optional()
|
|
14285
14230
|
}).parse(process.env);
|
|
14286
14231
|
const [repositoryOwner, repositoryName] = env.BITBUCKET_REPO_FULL_NAME.split("/");
|
|
14287
14232
|
return {
|
|
@@ -14299,7 +14244,7 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
14299
14244
|
|
|
14300
14245
|
// src/cli/cmd/ci/platforms/github.ts
|
|
14301
14246
|
import { Octokit } from "octokit";
|
|
14302
|
-
import
|
|
14247
|
+
import Z8 from "zod";
|
|
14303
14248
|
var GitHubPlatformKit = class extends PlatformKit {
|
|
14304
14249
|
_octokit;
|
|
14305
14250
|
get octokit() {
|
|
@@ -14369,12 +14314,12 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
14369
14314
|
}
|
|
14370
14315
|
}
|
|
14371
14316
|
get platformConfig() {
|
|
14372
|
-
const env =
|
|
14373
|
-
GITHUB_REPOSITORY:
|
|
14374
|
-
GITHUB_REPOSITORY_OWNER:
|
|
14375
|
-
GITHUB_REF_NAME:
|
|
14376
|
-
GITHUB_HEAD_REF:
|
|
14377
|
-
GH_TOKEN:
|
|
14317
|
+
const env = Z8.object({
|
|
14318
|
+
GITHUB_REPOSITORY: Z8.string(),
|
|
14319
|
+
GITHUB_REPOSITORY_OWNER: Z8.string(),
|
|
14320
|
+
GITHUB_REF_NAME: Z8.string(),
|
|
14321
|
+
GITHUB_HEAD_REF: Z8.string(),
|
|
14322
|
+
GH_TOKEN: Z8.string().optional()
|
|
14378
14323
|
}).parse(process.env);
|
|
14379
14324
|
const baseBranchName = !env.GITHUB_REF_NAME.endsWith("/merge") ? env.GITHUB_REF_NAME : env.GITHUB_HEAD_REF;
|
|
14380
14325
|
return {
|
|
@@ -14392,7 +14337,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
14392
14337
|
|
|
14393
14338
|
// src/cli/cmd/ci/platforms/gitlab.ts
|
|
14394
14339
|
import { Gitlab } from "@gitbeaker/rest";
|
|
14395
|
-
import
|
|
14340
|
+
import Z9 from "zod";
|
|
14396
14341
|
var gl = new Gitlab({ token: "" });
|
|
14397
14342
|
var GitlabPlatformKit = class extends PlatformKit {
|
|
14398
14343
|
_gitlab;
|
|
@@ -14409,15 +14354,15 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
14409
14354
|
return this._gitlab;
|
|
14410
14355
|
}
|
|
14411
14356
|
get platformConfig() {
|
|
14412
|
-
const env =
|
|
14413
|
-
GL_TOKEN:
|
|
14414
|
-
CI_COMMIT_BRANCH:
|
|
14415
|
-
CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:
|
|
14416
|
-
CI_PROJECT_NAMESPACE:
|
|
14417
|
-
CI_PROJECT_NAME:
|
|
14418
|
-
CI_PROJECT_ID:
|
|
14419
|
-
CI_PROJECT_DIR:
|
|
14420
|
-
CI_REPOSITORY_URL:
|
|
14357
|
+
const env = Z9.object({
|
|
14358
|
+
GL_TOKEN: Z9.string().optional(),
|
|
14359
|
+
CI_COMMIT_BRANCH: Z9.string(),
|
|
14360
|
+
CI_MERGE_REQUEST_SOURCE_BRANCH_NAME: Z9.string().optional(),
|
|
14361
|
+
CI_PROJECT_NAMESPACE: Z9.string(),
|
|
14362
|
+
CI_PROJECT_NAME: Z9.string(),
|
|
14363
|
+
CI_PROJECT_ID: Z9.string(),
|
|
14364
|
+
CI_PROJECT_DIR: Z9.string(),
|
|
14365
|
+
CI_REPOSITORY_URL: Z9.string()
|
|
14421
14366
|
}).parse(process.env);
|
|
14422
14367
|
const config = {
|
|
14423
14368
|
glToken: env.GL_TOKEN,
|
|
@@ -14513,7 +14458,7 @@ var getPlatformKit = () => {
|
|
|
14513
14458
|
};
|
|
14514
14459
|
|
|
14515
14460
|
// src/cli/cmd/ci/index.ts
|
|
14516
|
-
var ci_default = new
|
|
14461
|
+
var ci_default = new Command18().command("ci").description("Run localization pipeline in CI/CD environment").helpOption("-h, --help", "Show help").option(
|
|
14517
14462
|
"--parallel [boolean]",
|
|
14518
14463
|
"Process translations concurrently for faster execution. Defaults to false",
|
|
14519
14464
|
parseBooleanArg
|
|
@@ -14613,8 +14558,8 @@ import {
|
|
|
14613
14558
|
localeCodeSchema as localeCodeSchema3,
|
|
14614
14559
|
resolveOverriddenLocale as resolveOverriddenLocale9
|
|
14615
14560
|
} from "@lingo.dev/_spec";
|
|
14616
|
-
import { Command as
|
|
14617
|
-
import
|
|
14561
|
+
import { Command as Command19 } from "interactive-commander";
|
|
14562
|
+
import Z10 from "zod";
|
|
14618
14563
|
import Ora13 from "ora";
|
|
14619
14564
|
import chalk16 from "chalk";
|
|
14620
14565
|
import Table from "cli-table3";
|
|
@@ -14653,7 +14598,7 @@ function checkForPendingOperations() {
|
|
|
14653
14598
|
}
|
|
14654
14599
|
|
|
14655
14600
|
// src/cli/cmd/status.ts
|
|
14656
|
-
var status_default = new
|
|
14601
|
+
var status_default = new Command19().command("status").description("Show the status of the localization process").helpOption("-h, --help", "Show help").option(
|
|
14657
14602
|
"--locale <locale>",
|
|
14658
14603
|
"Limit the report to specific target locales from i18n.json. Repeat the flag to include multiple locales. Defaults to all configured target locales",
|
|
14659
14604
|
(val, prev) => prev ? [...prev, val] : [val]
|
|
@@ -15109,14 +15054,14 @@ var status_default = new Command20().command("status").description("Show the sta
|
|
|
15109
15054
|
}
|
|
15110
15055
|
});
|
|
15111
15056
|
function parseFlags2(options) {
|
|
15112
|
-
return
|
|
15113
|
-
locale:
|
|
15114
|
-
bucket:
|
|
15115
|
-
force:
|
|
15116
|
-
confirm:
|
|
15117
|
-
verbose:
|
|
15118
|
-
file:
|
|
15119
|
-
apiKey:
|
|
15057
|
+
return Z10.object({
|
|
15058
|
+
locale: Z10.array(localeCodeSchema3).optional(),
|
|
15059
|
+
bucket: Z10.array(bucketTypeSchema4).optional(),
|
|
15060
|
+
force: Z10.boolean().optional(),
|
|
15061
|
+
confirm: Z10.boolean().optional(),
|
|
15062
|
+
verbose: Z10.boolean().optional(),
|
|
15063
|
+
file: Z10.array(Z10.string()).optional(),
|
|
15064
|
+
apiKey: Z10.string().optional()
|
|
15120
15065
|
}).parse(options);
|
|
15121
15066
|
}
|
|
15122
15067
|
async function tryAuthenticate(settings) {
|
|
@@ -15161,7 +15106,7 @@ function validateParams2(i18nConfig, flags) {
|
|
|
15161
15106
|
}
|
|
15162
15107
|
|
|
15163
15108
|
// src/cli/cmd/may-the-fourth.ts
|
|
15164
|
-
import { Command as
|
|
15109
|
+
import { Command as Command20 } from "interactive-commander";
|
|
15165
15110
|
import * as cp from "child_process";
|
|
15166
15111
|
import figlet2 from "figlet";
|
|
15167
15112
|
import chalk17 from "chalk";
|
|
@@ -15174,7 +15119,7 @@ var colors2 = {
|
|
|
15174
15119
|
grey: "#808080",
|
|
15175
15120
|
red: "#ff0000"
|
|
15176
15121
|
};
|
|
15177
|
-
var may_the_fourth_default = new
|
|
15122
|
+
var may_the_fourth_default = new Command20().command("may-the-fourth").description("May the Fourth be with you").helpOption("-h, --help", "Show help").action(async () => {
|
|
15178
15123
|
await renderClear2();
|
|
15179
15124
|
await renderBanner2();
|
|
15180
15125
|
await renderSpacer2();
|
|
@@ -15242,7 +15187,7 @@ async function renderHero2() {
|
|
|
15242
15187
|
// package.json
|
|
15243
15188
|
var package_default = {
|
|
15244
15189
|
name: "lingo.dev",
|
|
15245
|
-
version: "0.122.
|
|
15190
|
+
version: "0.122.1",
|
|
15246
15191
|
description: "Lingo.dev CLI",
|
|
15247
15192
|
private: false,
|
|
15248
15193
|
repository: {
|
|
@@ -15503,11 +15448,11 @@ var package_default = {
|
|
|
15503
15448
|
};
|
|
15504
15449
|
|
|
15505
15450
|
// src/cli/cmd/purge.ts
|
|
15506
|
-
import { Command as
|
|
15451
|
+
import { Command as Command21 } from "interactive-commander";
|
|
15507
15452
|
import Ora14 from "ora";
|
|
15508
15453
|
import { resolveOverriddenLocale as resolveOverriddenLocale10 } from "@lingo.dev/_spec";
|
|
15509
15454
|
import { confirm as confirm4 } from "@inquirer/prompts";
|
|
15510
|
-
var purge_default = new
|
|
15455
|
+
var purge_default = new Command21().command("purge").description(
|
|
15511
15456
|
"WARNING: Permanently delete translation entries from bucket path patterns defined in i18n.json. This is a destructive operation that cannot be undone. Without any filters, ALL managed keys will be removed from EVERY target locale."
|
|
15512
15457
|
).helpOption("-h, --help", "Show help").option(
|
|
15513
15458
|
"--bucket <bucket>",
|
|
@@ -15685,7 +15630,7 @@ Star the the repo :) https://github.com/LingoDotDev/lingo.dev
|
|
|
15685
15630
|
).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive(
|
|
15686
15631
|
"-y, --no-interactive",
|
|
15687
15632
|
"Run every command in non-interactive mode (no prompts); required when scripting"
|
|
15688
|
-
).addCommand(i18n_default).addCommand(auth_default).addCommand(login_default).addCommand(logout_default).addCommand(show_default).addCommand(config_default2).addCommand(lockfile_default).addCommand(cleanup_default).addCommand(
|
|
15633
|
+
).addCommand(i18n_default).addCommand(auth_default).addCommand(login_default).addCommand(logout_default).addCommand(show_default).addCommand(config_default2).addCommand(lockfile_default).addCommand(cleanup_default).addCommand(ci_default).addCommand(status_default).addCommand(may_the_fourth_default, { hidden: true }).addCommand(run_default).addCommand(purge_default).exitOverride((err) => {
|
|
15689
15634
|
if (err.code === "commander.helpDisplayed" || err.code === "commander.version" || err.code === "commander.help") {
|
|
15690
15635
|
process.exit(0);
|
|
15691
15636
|
}
|