@andpipes/cli 0.1.8 → 0.1.9
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/dist/bin.cjs +170 -110
- package/dist/bin.js +1 -1
- package/dist/{chunk-KICI3MTW.js → chunk-YOEZJUW3.js} +95 -33
- package/dist/index.cjs +171 -111
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -145,7 +145,7 @@ function readVersion() {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// src/cli.ts
|
|
148
|
-
var
|
|
148
|
+
var import_localization18 = require("@andpipes/localization");
|
|
149
149
|
var import_commander = require("commander");
|
|
150
150
|
|
|
151
151
|
// src/commands/audit-export.ts
|
|
@@ -185,7 +185,7 @@ var ADMIN_CLI_SCOPES = [
|
|
|
185
185
|
"admin.tool.read"
|
|
186
186
|
];
|
|
187
187
|
var ADMIN_CLI_DEFAULT_SCOPES = ADMIN_CLI_SCOPES.filter(
|
|
188
|
-
(scope) => !scope.startsWith("admin.audit_export.")
|
|
188
|
+
(scope) => !scope.startsWith("admin.audit_export.") && !scope.startsWith("admin.onboarding_template.")
|
|
189
189
|
);
|
|
190
190
|
var FILE_VERSION = 3;
|
|
191
191
|
var DEFAULT_PROFILE = "default";
|
|
@@ -6946,7 +6946,7 @@ function registerDomain(program, writer, locale = import_localization6.DEFAULT_L
|
|
|
6946
6946
|
var import_node_crypto11 = require("crypto");
|
|
6947
6947
|
var import_node_path11 = require("path");
|
|
6948
6948
|
var import_promises2 = require("readline/promises");
|
|
6949
|
-
var
|
|
6949
|
+
var import_localization10 = require("@andpipes/localization");
|
|
6950
6950
|
var import_tool_contract9 = require("@andpipes/tool-contract");
|
|
6951
6951
|
|
|
6952
6952
|
// src/lib/init-manifest.ts
|
|
@@ -7557,6 +7557,37 @@ function authModeMismatchGuidance(mismatch, text = import_localization7.CLI_OPEN
|
|
|
7557
7557
|
return lines.join("\n");
|
|
7558
7558
|
}
|
|
7559
7559
|
|
|
7560
|
+
// src/lib/scope-login-guidance.ts
|
|
7561
|
+
var import_localization8 = require("@andpipes/localization");
|
|
7562
|
+
var SCOPE_LOGIN_GUIDANCE = {
|
|
7563
|
+
ja: "\u5FC5\u8981\u306A\u6A29\u9650\u3067\u30ED\u30B0\u30A4\u30F3\u3057\u3001{profile} \u3092\u4ED8\u3051\u3066\u64CD\u4F5C\u3092\u518D\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
7564
|
+
en: "Sign in with the required permissions, then retry the operation with {profile}.",
|
|
7565
|
+
"zh-Hant": "\u8ACB\u4EE5\u6240\u9700\u6B0A\u9650\u767B\u5165\uFF0C\u7136\u5F8C\u52A0\u4E0A {profile} \u91CD\u8A66\u64CD\u4F5C\u3002",
|
|
7566
|
+
"zh-Hans": "\u8BF7\u4EE5\u6240\u9700\u6743\u9650\u767B\u5F55\uFF0C\u7136\u540E\u52A0\u4E0A {profile} \u91CD\u8BD5\u64CD\u4F5C\u3002",
|
|
7567
|
+
ko: "\uD544\uC694\uD55C \uAD8C\uD55C\uC73C\uB85C \uB85C\uADF8\uC778\uD55C \uD6C4 {profile} \uC635\uC158\uC744 \uBD99\uC5EC \uC791\uC5C5\uC744 \uB2E4\uC2DC \uC2E4\uD589\uD558\uC138\uC694.",
|
|
7568
|
+
fr: "Connectez-vous avec les autorisations requises, puis r\xE9essayez avec {profile}.",
|
|
7569
|
+
es: "Inicia sesi\xF3n con los permisos necesarios y vuelve a intentar la operaci\xF3n con {profile}.",
|
|
7570
|
+
pt: "Entre com as permiss\xF5es necess\xE1rias e tente novamente com {profile}.",
|
|
7571
|
+
it: "Accedi con le autorizzazioni richieste e riprova con {profile}.",
|
|
7572
|
+
ru: "\u0412\u043E\u0439\u0434\u0438\u0442\u0435 \u0441 \u043D\u0443\u0436\u043D\u044B\u043C\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u044F\u043C\u0438 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u044E \u0441 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u043E\u043C {profile}."
|
|
7573
|
+
};
|
|
7574
|
+
async function withScopeLoginGuidance(request, writer, locale, profile, scopes = []) {
|
|
7575
|
+
try {
|
|
7576
|
+
return await request;
|
|
7577
|
+
} catch (error) {
|
|
7578
|
+
if (error instanceof AdminApiClientError && error.status === 403 && error.code === "AP_INVALID_SCOPE") {
|
|
7579
|
+
const profileOption = `--profile ${profile}`;
|
|
7580
|
+
const scopeOption = scopes.length === 0 ? "" : ` --scope ${scopes.join(",")}`;
|
|
7581
|
+
interactive(
|
|
7582
|
+
writer,
|
|
7583
|
+
`${(0, import_localization8.formatCliOpenApiTemplateMessage)(SCOPE_LOGIN_GUIDANCE[locale], { profile: profileOption })}
|
|
7584
|
+
andpipe login ${profileOption}${scopeOption}`
|
|
7585
|
+
);
|
|
7586
|
+
}
|
|
7587
|
+
throw error;
|
|
7588
|
+
}
|
|
7589
|
+
}
|
|
7590
|
+
|
|
7560
7591
|
// src/lib/terminal-safe.ts
|
|
7561
7592
|
var import_tool_contract7 = require("@andpipes/tool-contract");
|
|
7562
7593
|
function terminalSafeText(value) {
|
|
@@ -7578,22 +7609,25 @@ function terminalSafeValue(value) {
|
|
|
7578
7609
|
// src/commands/template.ts
|
|
7579
7610
|
var import_node_crypto10 = require("crypto");
|
|
7580
7611
|
var import_node_path10 = require("path");
|
|
7581
|
-
var
|
|
7612
|
+
var import_localization9 = require("@andpipes/localization");
|
|
7582
7613
|
var import_tool_contract8 = require("@andpipes/tool-contract");
|
|
7583
7614
|
var BINDINGS_MAX_BYTES = 64 * 1024;
|
|
7584
7615
|
var EXPORT_MAX_BYTES = 1280 * 1024;
|
|
7585
7616
|
var TEMPLATE_ID_RE2 = /^[a-z][a-z0-9._-]{0,63}$/u;
|
|
7617
|
+
var TEMPLATE_PROFILE = "onboarding-template";
|
|
7618
|
+
var TEMPLATE_READ_SCOPES = ["admin.onboarding_template.read"];
|
|
7619
|
+
var TEMPLATE_WRITE_SCOPES = [...TEMPLATE_READ_SCOPES, "admin.onboarding_template.write"];
|
|
7586
7620
|
function createTemplateCommandRuntime(createClient = (profile) => createAdminApiClient({ profile })) {
|
|
7587
7621
|
return { createClient, idempotencyKey: import_node_crypto10.randomUUID };
|
|
7588
7622
|
}
|
|
7589
7623
|
function jsonObject(text, label, messages) {
|
|
7590
7624
|
const parsed = (0, import_tool_contract8.parseToolContract)(text, { format: "json" });
|
|
7591
7625
|
if (!parsed.ok || !parsed.contract || typeof parsed.contract !== "object" || Array.isArray(parsed.contract)) {
|
|
7592
|
-
throw new UsageError((0,
|
|
7626
|
+
throw new UsageError((0, import_localization9.formatCliOpenApiTemplateMessage)(messages.jsonObjectInvalid, { label }));
|
|
7593
7627
|
}
|
|
7594
7628
|
return parsed.contract;
|
|
7595
7629
|
}
|
|
7596
|
-
function loadOnboardingTemplateArtifact(cwd, file, bindingsFile, messages =
|
|
7630
|
+
function loadOnboardingTemplateArtifact(cwd, file, bindingsFile, messages = import_localization9.CLI_OPENAPI_TEMPLATE_MESSAGES.ja) {
|
|
7597
7631
|
const anchor = captureLocalRootPath(cwd);
|
|
7598
7632
|
const readArtifact = (path, maxBytes, label) => {
|
|
7599
7633
|
const value = readBoundedLocalFileSnapshot((0, import_node_path10.resolve)(anchor.root, path), {
|
|
@@ -7739,14 +7773,20 @@ function assertApplyMatchesLocal(result, projectId, loaded, planCommitment, mess
|
|
|
7739
7773
|
throw new UsageError(messages.templateApplyMismatch);
|
|
7740
7774
|
}
|
|
7741
7775
|
}
|
|
7742
|
-
async function runTemplatePlanOrApply(options, writer, cwd, runtime = createTemplateCommandRuntime(), locale =
|
|
7743
|
-
const messages =
|
|
7776
|
+
async function runTemplatePlanOrApply(options, writer, cwd, runtime = createTemplateCommandRuntime(), locale = import_localization9.DEFAULT_LOCALE) {
|
|
7777
|
+
const messages = import_localization9.CLI_OPENAPI_TEMPLATE_MESSAGES[locale];
|
|
7744
7778
|
const proof = applyProof(options, messages);
|
|
7745
7779
|
const projectId = assertProjectId(options.project);
|
|
7746
7780
|
const loaded = loadOnboardingTemplateArtifact(cwd, options.file, options.bindings, messages);
|
|
7747
7781
|
const client = runtime.createClient(options.profile ?? DEFAULT_PROFILE_NAME);
|
|
7748
7782
|
if (!proof) {
|
|
7749
|
-
const plan = await
|
|
7783
|
+
const plan = await withScopeLoginGuidance(
|
|
7784
|
+
client.planOnboardingTemplate(projectId, loaded.manifest, loaded.bindings),
|
|
7785
|
+
writer,
|
|
7786
|
+
locale,
|
|
7787
|
+
TEMPLATE_PROFILE,
|
|
7788
|
+
TEMPLATE_READ_SCOPES
|
|
7789
|
+
);
|
|
7750
7790
|
assertPlanMatchesLocal(plan, projectId, loaded, messages);
|
|
7751
7791
|
json(writer, {
|
|
7752
7792
|
mode: "dry-run",
|
|
@@ -7764,30 +7804,42 @@ async function runTemplatePlanOrApply(options, writer, cwd, runtime = createTemp
|
|
|
7764
7804
|
if (loaded.exportProjectId !== void 0 && loaded.exportProjectId !== projectId) {
|
|
7765
7805
|
throw new UsageError(messages.exportProjectMismatch);
|
|
7766
7806
|
}
|
|
7767
|
-
const result = await
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7807
|
+
const result = await withScopeLoginGuidance(
|
|
7808
|
+
client.applyOnboardingTemplate(projectId, options.idempotencyKey, {
|
|
7809
|
+
scopeRiskReviewVersion: proof.scopeRiskReviewVersion,
|
|
7810
|
+
scopeRiskReview: proof.scopeRiskReview,
|
|
7811
|
+
manifest: loaded.manifest,
|
|
7812
|
+
bindings: loaded.bindings,
|
|
7813
|
+
expectedCurrentApplicationCommitment: proof.expectedCurrent,
|
|
7814
|
+
planCommitment: proof.planCommitment,
|
|
7815
|
+
confirmed: true
|
|
7816
|
+
}),
|
|
7817
|
+
writer,
|
|
7818
|
+
locale,
|
|
7819
|
+
TEMPLATE_PROFILE,
|
|
7820
|
+
TEMPLATE_WRITE_SCOPES
|
|
7821
|
+
);
|
|
7776
7822
|
assertApplyMatchesLocal(result, projectId, loaded, proof.planCommitment, messages);
|
|
7777
7823
|
if (JSON.stringify(result.scopeRiskReview) !== JSON.stringify(proof.scopeRiskReview)) {
|
|
7778
7824
|
throw new UsageError(messages.scopeMismatch);
|
|
7779
7825
|
}
|
|
7780
7826
|
json(writer, { mode: "applied", ...result });
|
|
7781
7827
|
}
|
|
7782
|
-
async function runTemplateRollback(options, writer, runtime = createTemplateCommandRuntime(), locale =
|
|
7783
|
-
const messages =
|
|
7828
|
+
async function runTemplateRollback(options, writer, runtime = createTemplateCommandRuntime(), locale = import_localization9.DEFAULT_LOCALE) {
|
|
7829
|
+
const messages = import_localization9.CLI_OPENAPI_TEMPLATE_MESSAGES[locale];
|
|
7784
7830
|
const proof = applyProof(options, messages);
|
|
7785
7831
|
const projectId = assertProjectId(options.project);
|
|
7786
7832
|
const templateId = canonicalTemplateId(options.template, messages);
|
|
7787
7833
|
const targetRevision = positiveRevision(options.targetRevision, messages);
|
|
7788
7834
|
const client = runtime.createClient(options.profile ?? DEFAULT_PROFILE_NAME);
|
|
7789
7835
|
if (!proof) {
|
|
7790
|
-
const plan = await
|
|
7836
|
+
const plan = await withScopeLoginGuidance(
|
|
7837
|
+
client.planOnboardingTemplateRollback(projectId, templateId, targetRevision),
|
|
7838
|
+
writer,
|
|
7839
|
+
locale,
|
|
7840
|
+
TEMPLATE_PROFILE,
|
|
7841
|
+
TEMPLATE_READ_SCOPES
|
|
7842
|
+
);
|
|
7791
7843
|
const parsed2 = (0, import_tool_contract8.parseOnboardingTemplateSafePlanDto)(plan);
|
|
7792
7844
|
if (parsed2.projectId !== projectId || parsed2.templateId !== templateId || parsed2.operation !== "rollback" || parsed2.rollbackFromRevision !== targetRevision || parsed2.currentApplicationCommitment === null) {
|
|
7793
7845
|
throw new UsageError(messages.rollbackPlanMismatch);
|
|
@@ -7809,18 +7861,19 @@ async function runTemplateRollback(options, writer, runtime = createTemplateComm
|
|
|
7809
7861
|
if (!options.idempotencyKey) {
|
|
7810
7862
|
throw new UsageError(messages.idemRequired);
|
|
7811
7863
|
}
|
|
7812
|
-
const result = await
|
|
7813
|
-
projectId,
|
|
7814
|
-
templateId,
|
|
7815
|
-
options.idempotencyKey,
|
|
7816
|
-
{
|
|
7864
|
+
const result = await withScopeLoginGuidance(
|
|
7865
|
+
client.rollbackOnboardingTemplate(projectId, templateId, options.idempotencyKey, {
|
|
7817
7866
|
targetRevision,
|
|
7818
7867
|
scopeRiskReviewVersion: proof.scopeRiskReviewVersion,
|
|
7819
7868
|
scopeRiskReview: proof.scopeRiskReview,
|
|
7820
7869
|
expectedCurrentApplicationCommitment: proof.expectedCurrent,
|
|
7821
7870
|
planCommitment: proof.planCommitment,
|
|
7822
7871
|
confirmed: true
|
|
7823
|
-
}
|
|
7872
|
+
}),
|
|
7873
|
+
writer,
|
|
7874
|
+
locale,
|
|
7875
|
+
TEMPLATE_PROFILE,
|
|
7876
|
+
TEMPLATE_WRITE_SCOPES
|
|
7824
7877
|
);
|
|
7825
7878
|
const parsed = (0, import_tool_contract8.parseOnboardingTemplateApplyDto)(result);
|
|
7826
7879
|
if (parsed.projectId !== projectId || parsed.templateId !== templateId || parsed.operation !== "rollback" || parsed.rollbackFromRevision !== targetRevision || parsed.planCommitment !== proof.planCommitment || parsed.applicationCommitment === proof.expectedCurrent || JSON.stringify(parsed.scopeRiskReview) !== JSON.stringify(proof.scopeRiskReview)) {
|
|
@@ -7828,9 +7881,9 @@ async function runTemplateRollback(options, writer, runtime = createTemplateComm
|
|
|
7828
7881
|
}
|
|
7829
7882
|
json(writer, { mode: "rolled_back", ...parsed });
|
|
7830
7883
|
}
|
|
7831
|
-
function registerTemplate(program, writer, cwd, runtime = createTemplateCommandRuntime(), locale =
|
|
7832
|
-
const messages =
|
|
7833
|
-
const common =
|
|
7884
|
+
function registerTemplate(program, writer, cwd, runtime = createTemplateCommandRuntime(), locale = import_localization9.DEFAULT_LOCALE) {
|
|
7885
|
+
const messages = import_localization9.CLI_OPENAPI_TEMPLATE_MESSAGES[locale];
|
|
7886
|
+
const common = import_localization9.CLI_MESSAGES[locale].common;
|
|
7834
7887
|
const template = program.command("template").description(messages.templateDescription);
|
|
7835
7888
|
template.command("validate").description(messages.validateDescription).requiredOption("--file <path>", messages.templateFileOption).option("--bindings <path>", messages.bindingsOption).action((options) => {
|
|
7836
7889
|
const loaded = loadOnboardingTemplateArtifact(
|
|
@@ -7859,7 +7912,13 @@ function registerTemplate(program, writer, cwd, runtime = createTemplateCommandR
|
|
|
7859
7912
|
const templateId = canonicalTemplateId(options.template, messages);
|
|
7860
7913
|
const anchor = captureLocalRootPath(cwd());
|
|
7861
7914
|
const result = (0, import_tool_contract8.parseOnboardingTemplateExportDto)(
|
|
7862
|
-
await
|
|
7915
|
+
await withScopeLoginGuidance(
|
|
7916
|
+
runtime.createClient(options.profile).exportOnboardingTemplate(projectId, templateId),
|
|
7917
|
+
writer,
|
|
7918
|
+
locale,
|
|
7919
|
+
TEMPLATE_PROFILE,
|
|
7920
|
+
TEMPLATE_READ_SCOPES
|
|
7921
|
+
)
|
|
7863
7922
|
);
|
|
7864
7923
|
if (result.projectId !== projectId || result.manifest.templateId !== templateId) {
|
|
7865
7924
|
throw new UsageError(messages.exportMismatch);
|
|
@@ -7909,10 +7968,10 @@ var MANIFEST_KEYS2 = [
|
|
|
7909
7968
|
"template_id",
|
|
7910
7969
|
"template_application_commitment"
|
|
7911
7970
|
];
|
|
7912
|
-
var DEFAULT_INIT_MESSAGES =
|
|
7913
|
-
var DEFAULT_SCOPE_REGISTRATION_MESSAGES =
|
|
7971
|
+
var DEFAULT_INIT_MESSAGES = import_localization10.CLI_MESSAGES.ja.init;
|
|
7972
|
+
var DEFAULT_SCOPE_REGISTRATION_MESSAGES = import_localization10.OAUTH_SCOPE_REGISTRATION_MESSAGES.ja.cli;
|
|
7914
7973
|
var CONNECTOR_PLACEHOLDER = "<connector-uuid>";
|
|
7915
|
-
function assertTemplateInitOptionShape(options, messages = DEFAULT_INIT_MESSAGES, copy =
|
|
7974
|
+
function assertTemplateInitOptionShape(options, messages = DEFAULT_INIT_MESSAGES, copy = import_localization10.CLI_OPENAPI_TEMPLATE_MESSAGES.ja) {
|
|
7916
7975
|
if (options.openapi !== void 0 && options.project === void 0) {
|
|
7917
7976
|
throw new UsageError(messages.optionRequires("--openapi", "--project <uuid>"));
|
|
7918
7977
|
}
|
|
@@ -7979,14 +8038,14 @@ async function materializeOpenApiInit(options, anchor, runtime, messages, copy)
|
|
|
7979
8038
|
}
|
|
7980
8039
|
} catch (error) {
|
|
7981
8040
|
if (error instanceof import_tool_contract9.OpenApiImportError) {
|
|
7982
|
-
throw new UsageError((0,
|
|
8041
|
+
throw new UsageError((0, import_localization10.formatCliOpenApiTemplateMessage)(copy.generateFailure, { detail: error.message }));
|
|
7983
8042
|
}
|
|
7984
8043
|
throw error;
|
|
7985
8044
|
}
|
|
7986
8045
|
const blocked = imported.operations.filter((operation) => !operation.publishGate.ok);
|
|
7987
8046
|
if (blocked.length > 0) {
|
|
7988
8047
|
throw new UsageError(
|
|
7989
|
-
(0,
|
|
8048
|
+
(0, import_localization10.formatCliOpenApiTemplateMessage)(copy.initGateFailed, {
|
|
7990
8049
|
tools: blocked.map((operation) => operation.toolName).join(", ")
|
|
7991
8050
|
})
|
|
7992
8051
|
);
|
|
@@ -8542,8 +8601,8 @@ function assertIdempotencyKey(value, messages) {
|
|
|
8542
8601
|
}
|
|
8543
8602
|
return canonical;
|
|
8544
8603
|
}
|
|
8545
|
-
async function runInitCommand(options, writer, cwd, runtime, messages = DEFAULT_INIT_MESSAGES, scopeRegistrationMessages = DEFAULT_SCOPE_REGISTRATION_MESSAGES, locale =
|
|
8546
|
-
const copy =
|
|
8604
|
+
async function runInitCommand(options, writer, cwd, runtime, messages = DEFAULT_INIT_MESSAGES, scopeRegistrationMessages = DEFAULT_SCOPE_REGISTRATION_MESSAGES, locale = import_localization10.DEFAULT_LOCALE) {
|
|
8605
|
+
const copy = import_localization10.CLI_OPENAPI_TEMPLATE_MESSAGES[locale];
|
|
8547
8606
|
assertTemplateInitOptionShape(options, messages, copy);
|
|
8548
8607
|
if (options.template !== void 0 && options.project === void 0) {
|
|
8549
8608
|
throw new UsageError(copy.initProjectRequired);
|
|
@@ -8679,8 +8738,8 @@ async function runInitCommand(options, writer, cwd, runtime, messages = DEFAULT_
|
|
|
8679
8738
|
);
|
|
8680
8739
|
}
|
|
8681
8740
|
}
|
|
8682
|
-
function registerInit(program, writer, cwd, createClient, description = "Project\u3092\u660E\u793A\u9078\u629E\u307E\u305F\u306F\u4F5C\u6210\u3057\u3001\u5B89\u5168\u306Alocal manifest\u3078bind\u3057\u307E\u3059", runtime = void 0, messages = DEFAULT_INIT_MESSAGES, scopeRegistrationMessages = DEFAULT_SCOPE_REGISTRATION_MESSAGES, locale =
|
|
8683
|
-
const copy =
|
|
8741
|
+
function registerInit(program, writer, cwd, createClient, description = "Project\u3092\u660E\u793A\u9078\u629E\u307E\u305F\u306F\u4F5C\u6210\u3057\u3001\u5B89\u5168\u306Alocal manifest\u3078bind\u3057\u307E\u3059", runtime = void 0, messages = DEFAULT_INIT_MESSAGES, scopeRegistrationMessages = DEFAULT_SCOPE_REGISTRATION_MESSAGES, locale = import_localization10.DEFAULT_LOCALE) {
|
|
8742
|
+
const copy = import_localization10.CLI_OPENAPI_TEMPLATE_MESSAGES[locale];
|
|
8684
8743
|
const commandRuntime = runtime ?? createInitCommandRuntime(createClient, messages);
|
|
8685
8744
|
program.command("init").description(description).option("--project <project-uuid>", messages.projectOption).option("--create", messages.createOption).option("--name <name>", messages.nameOption).option("--slug <slug>", messages.slugOption).option("--contract <root-file>", messages.contractOption).option("--template <export-file>", copy.initTemplateOption).option("--openapi <file>", messages.openApiOption).option("--base-url <https-url>", messages.openApiBaseUrlOption).option("--service-name <name>", messages.openApiServiceNameOption).option("--auth-mode <mode>", copy.authModeOption).option(
|
|
8686
8745
|
"--side-effect-free <toolName=level>",
|
|
@@ -8688,7 +8747,7 @@ function registerInit(program, writer, cwd, createClient, description = "Project
|
|
|
8688
8747
|
(value, previous) => [...previous, value],
|
|
8689
8748
|
[]
|
|
8690
8749
|
).option("--create-connector", copy.initCreateConnectorOption, false).option("--profile <name>", messages.profileOption, DEFAULT_PROFILE_NAME).option("--yes", messages.yesOption, false).action(async (options) => {
|
|
8691
|
-
|
|
8750
|
+
const result = runInitCommand(
|
|
8692
8751
|
options,
|
|
8693
8752
|
writer,
|
|
8694
8753
|
cwd(),
|
|
@@ -8697,14 +8756,15 @@ function registerInit(program, writer, cwd, createClient, description = "Project
|
|
|
8697
8756
|
scopeRegistrationMessages,
|
|
8698
8757
|
locale
|
|
8699
8758
|
);
|
|
8759
|
+
await (options.template === void 0 ? result : withScopeLoginGuidance(result, writer, locale, DEFAULT_PROFILE_NAME));
|
|
8700
8760
|
});
|
|
8701
8761
|
}
|
|
8702
8762
|
|
|
8703
8763
|
// src/commands/logs.ts
|
|
8704
|
-
var
|
|
8705
|
-
function registerLogs(program, writer, locale =
|
|
8706
|
-
const messages =
|
|
8707
|
-
const logMessages =
|
|
8764
|
+
var import_localization11 = require("@andpipes/localization");
|
|
8765
|
+
function registerLogs(program, writer, locale = import_localization11.DEFAULT_LOCALE) {
|
|
8766
|
+
const messages = import_localization11.CLI_MESSAGES[locale];
|
|
8767
|
+
const logMessages = import_localization11.CLI_LOG_MESSAGES[locale];
|
|
8708
8768
|
const logs = program.command("logs").description(messages.logs.commandDescription);
|
|
8709
8769
|
logs.command("tail").description(messages.logs.tailDescription).requiredOption("--project <project>", messages.logs.projectOption).option("--limit <count>", logMessages.limitOption, "20").option("--profile <name>", messages.common.targetProfileOption, DEFAULT_PROFILE_NAME).action(async (opts) => {
|
|
8710
8770
|
if (!/^(0|[1-9][0-9]*)$/.test(opts.limit)) {
|
|
@@ -8723,15 +8783,15 @@ function registerLogs(program, writer, locale = import_localization10.DEFAULT_LO
|
|
|
8723
8783
|
var import_node_crypto12 = require("crypto");
|
|
8724
8784
|
var import_node_fs12 = require("fs");
|
|
8725
8785
|
var import_node_path13 = require("path");
|
|
8726
|
-
var
|
|
8786
|
+
var import_localization13 = require("@andpipes/localization");
|
|
8727
8787
|
var import_tool_contract10 = require("@andpipes/tool-contract");
|
|
8728
8788
|
|
|
8729
8789
|
// src/commands/validate.ts
|
|
8730
8790
|
var import_node_fs11 = require("fs");
|
|
8731
8791
|
var import_node_path12 = require("path");
|
|
8732
|
-
var
|
|
8733
|
-
function resolveContractPath(file, cwd, locale =
|
|
8734
|
-
const messages =
|
|
8792
|
+
var import_localization12 = require("@andpipes/localization");
|
|
8793
|
+
function resolveContractPath(file, cwd, locale = import_localization12.DEFAULT_LOCALE) {
|
|
8794
|
+
const messages = import_localization12.CLI_MESSAGES[locale].validate;
|
|
8735
8795
|
if (file) {
|
|
8736
8796
|
const abs = (0, import_node_path12.resolve)(cwd, file);
|
|
8737
8797
|
if (!(0, import_node_fs11.existsSync)(abs)) {
|
|
@@ -8747,13 +8807,13 @@ function resolveContractPath(file, cwd, locale = import_localization11.DEFAULT_L
|
|
|
8747
8807
|
}
|
|
8748
8808
|
throw new UsageError(messages.defaultFileNotFound(import_tool_contract4.CONTRACT_FILENAMES));
|
|
8749
8809
|
}
|
|
8750
|
-
function loadContract(path, locale =
|
|
8810
|
+
function loadContract(path, locale = import_localization12.DEFAULT_LOCALE) {
|
|
8751
8811
|
void locale;
|
|
8752
8812
|
return loadContractFile(path).contract;
|
|
8753
8813
|
}
|
|
8754
|
-
function registerValidate(program, writer, cwd, locale =
|
|
8755
|
-
const text =
|
|
8756
|
-
const messages =
|
|
8814
|
+
function registerValidate(program, writer, cwd, locale = import_localization12.DEFAULT_LOCALE) {
|
|
8815
|
+
const text = import_localization12.LOCALIZED_TEXT[locale].cli;
|
|
8816
|
+
const messages = import_localization12.CLI_MESSAGES[locale].validate;
|
|
8757
8817
|
program.command("validate").description(`${text.validateDescription} (10 checks)`).option("--file <path>", messages.fileOption).action((opts) => {
|
|
8758
8818
|
const path = resolveContractPath(opts.file, cwd(), locale);
|
|
8759
8819
|
const loaded = loadContractFile(path);
|
|
@@ -8803,13 +8863,13 @@ var REASON_KEYS = {
|
|
|
8803
8863
|
};
|
|
8804
8864
|
function parseToolNames(value, locale) {
|
|
8805
8865
|
const names = (value ?? "").split(",").map((name) => name.trim()).filter((name) => name.length > 0);
|
|
8806
|
-
if (names.length === 0) throw new UsageError(
|
|
8866
|
+
if (names.length === 0) throw new UsageError(import_localization13.MUSE_SETUP_MESSAGES[locale].cli.toolsRequired);
|
|
8807
8867
|
return names;
|
|
8808
8868
|
}
|
|
8809
8869
|
function parseOutputDir(value, locale) {
|
|
8810
8870
|
const output = value ?? DEFAULT_MUSE_OUTPUT_DIR;
|
|
8811
8871
|
if (!OUTPUT_DIR_RE.test(output) || output === "." || output === "..") {
|
|
8812
|
-
throw new UsageError(
|
|
8872
|
+
throw new UsageError(import_localization13.MUSE_SETUP_MESSAGES[locale].cli.outputInvalid);
|
|
8813
8873
|
}
|
|
8814
8874
|
return output;
|
|
8815
8875
|
}
|
|
@@ -8842,7 +8902,7 @@ function museWriteOrder(paths) {
|
|
|
8842
8902
|
);
|
|
8843
8903
|
}
|
|
8844
8904
|
function writeBundle(root, output, files, locale) {
|
|
8845
|
-
const messages =
|
|
8905
|
+
const messages = import_localization13.MUSE_SETUP_MESSAGES[locale].cli;
|
|
8846
8906
|
const target = (0, import_node_path13.join)(root, output);
|
|
8847
8907
|
const ordered = museWriteOrder(Object.keys(files));
|
|
8848
8908
|
const directoryNames = /* @__PURE__ */ new Set();
|
|
@@ -8885,8 +8945,8 @@ function writeBundle(root, output, files, locale) {
|
|
|
8885
8945
|
throw new UsageError(`${messages.outputIncomplete(output)}${reason}`);
|
|
8886
8946
|
}
|
|
8887
8947
|
}
|
|
8888
|
-
function runMusePrepare(options, writer, cwd, locale =
|
|
8889
|
-
const messages =
|
|
8948
|
+
function runMusePrepare(options, writer, cwd, locale = import_localization13.DEFAULT_LOCALE) {
|
|
8949
|
+
const messages = import_localization13.MUSE_SETUP_MESSAGES[locale];
|
|
8890
8950
|
const toolNames = parseToolNames(options.tools, locale);
|
|
8891
8951
|
const output = parseOutputDir(options.output, locale);
|
|
8892
8952
|
const anchor = captureLocalRootPath(cwd);
|
|
@@ -8927,7 +8987,7 @@ function runMusePrepare(options, writer, cwd, locale = import_localization12.DEF
|
|
|
8927
8987
|
if (key) info(writer, ` ${output}/${path}: ${messages.files[key]}`);
|
|
8928
8988
|
}
|
|
8929
8989
|
info(writer, `${messages.cli.statesHeading}:`);
|
|
8930
|
-
for (const key of
|
|
8990
|
+
for (const key of import_localization13.MUSE_SETUP_STATE_KEYS) {
|
|
8931
8991
|
const state = messages.states[key];
|
|
8932
8992
|
info(
|
|
8933
8993
|
writer,
|
|
@@ -8936,8 +8996,8 @@ function runMusePrepare(options, writer, cwd, locale = import_localization12.DEF
|
|
|
8936
8996
|
}
|
|
8937
8997
|
info(writer, messages.cli.nextStep);
|
|
8938
8998
|
}
|
|
8939
|
-
function registerMuse(program, writer, cwd, locale =
|
|
8940
|
-
const messages =
|
|
8999
|
+
function registerMuse(program, writer, cwd, locale = import_localization13.DEFAULT_LOCALE) {
|
|
9000
|
+
const messages = import_localization13.MUSE_SETUP_MESSAGES[locale].cli;
|
|
8941
9001
|
const muse = program.command("muse").description(messages.groupDescription);
|
|
8942
9002
|
muse.command("prepare").description(messages.prepareDescription).option(
|
|
8943
9003
|
"--tools <names>",
|
|
@@ -8949,20 +9009,20 @@ function registerMuse(program, writer, cwd, locale = import_localization12.DEFAU
|
|
|
8949
9009
|
// src/commands/oauth.ts
|
|
8950
9010
|
var import_node_crypto14 = require("crypto");
|
|
8951
9011
|
var import_node_fs13 = require("fs");
|
|
8952
|
-
var
|
|
9012
|
+
var import_localization15 = require("@andpipes/localization");
|
|
8953
9013
|
var import_tool_contract12 = require("@andpipes/tool-contract");
|
|
8954
9014
|
|
|
8955
9015
|
// src/commands/publish.ts
|
|
8956
9016
|
var import_node_crypto13 = require("crypto");
|
|
8957
|
-
var
|
|
9017
|
+
var import_localization14 = require("@andpipes/localization");
|
|
8958
9018
|
var import_tool_contract11 = require("@andpipes/tool-contract");
|
|
8959
9019
|
var UUID_RE6 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u;
|
|
8960
9020
|
var SAFE_AP_CODE_RE2 = /^AP_[A-Z0-9_]{1,64}$/u;
|
|
8961
9021
|
var PUBLICATION_RESPONSE_MAX_BYTES = 96 * 1024;
|
|
8962
9022
|
var INITIAL_APPLY_MAX_ATTEMPTS = 3;
|
|
8963
|
-
var DEFAULT_PUBLISH_MESSAGES =
|
|
8964
|
-
var DEFAULT_SCOPE_REGISTRATION_MESSAGES2 =
|
|
8965
|
-
var DEFAULT_SCHEMA_REVIEW_MESSAGES =
|
|
9023
|
+
var DEFAULT_PUBLISH_MESSAGES = import_localization14.CLI_MESSAGES.ja.publish;
|
|
9024
|
+
var DEFAULT_SCOPE_REGISTRATION_MESSAGES2 = import_localization14.OAUTH_SCOPE_REGISTRATION_MESSAGES.ja.cli;
|
|
9025
|
+
var DEFAULT_SCHEMA_REVIEW_MESSAGES = import_localization14.PUBLICATION_SCHEMA_REVIEW_CLI_MESSAGES.ja;
|
|
8966
9026
|
var REVIEW_PROFILE_REQUEST = Object.freeze({
|
|
8967
9027
|
reviewProfile: CLI_PUBLICATION_REVIEW_PROFILE
|
|
8968
9028
|
});
|
|
@@ -9460,7 +9520,7 @@ function writeSafeJson(writer, value) {
|
|
|
9460
9520
|
json(writer, terminalSafeValue(value));
|
|
9461
9521
|
}
|
|
9462
9522
|
function writePlan(writer, plan, messages) {
|
|
9463
|
-
const copy = messages.scopeRiskCopy ??
|
|
9523
|
+
const copy = messages.scopeRiskCopy ?? import_localization14.CLI_SCOPE_RISK_SUMMARY.ja;
|
|
9464
9524
|
writeSafeJson(writer, { phase: "plan", ...plan });
|
|
9465
9525
|
for (const item of plan.scopeRiskReview.items)
|
|
9466
9526
|
interactive(
|
|
@@ -9927,8 +9987,8 @@ function isUrl(value) {
|
|
|
9927
9987
|
function field(meta, snake, camel) {
|
|
9928
9988
|
return snake in meta ? meta[snake] : meta[camel];
|
|
9929
9989
|
}
|
|
9930
|
-
function validateOAuthMetadata(meta, locale =
|
|
9931
|
-
const messages =
|
|
9990
|
+
function validateOAuthMetadata(meta, locale = import_localization15.DEFAULT_LOCALE) {
|
|
9991
|
+
const messages = import_localization15.CLI_MESSAGES[locale].oauth;
|
|
9932
9992
|
const results = [];
|
|
9933
9993
|
if (!meta || typeof meta !== "object" || Array.isArray(meta)) {
|
|
9934
9994
|
return {
|
|
@@ -10022,9 +10082,9 @@ function parseDraftOption(value, messages) {
|
|
|
10022
10082
|
}
|
|
10023
10083
|
return { toolId, versionId };
|
|
10024
10084
|
}
|
|
10025
|
-
function normalizeOAuthScopeRegisterOptions(options, locale =
|
|
10026
|
-
const messages =
|
|
10027
|
-
const cliMessages =
|
|
10085
|
+
function normalizeOAuthScopeRegisterOptions(options, locale = import_localization15.DEFAULT_LOCALE) {
|
|
10086
|
+
const messages = import_localization15.OAUTH_SCOPE_REGISTRATION_MESSAGES[locale].cli;
|
|
10087
|
+
const cliMessages = import_localization15.CLI_MESSAGES[locale];
|
|
10028
10088
|
const apply = options.apply === true;
|
|
10029
10089
|
if (options.yes === true && !apply) throw new UsageError(messages.yesRequiresApply);
|
|
10030
10090
|
if (apply && options.yes !== true) {
|
|
@@ -10169,8 +10229,8 @@ async function projectAccessibility(client, projectId, error) {
|
|
|
10169
10229
|
}
|
|
10170
10230
|
}
|
|
10171
10231
|
function localCandidateSource(normalized, cwd, runtime, locale) {
|
|
10172
|
-
const messages =
|
|
10173
|
-
const publishMessages =
|
|
10232
|
+
const messages = import_localization15.OAUTH_SCOPE_REGISTRATION_MESSAGES[locale].cli;
|
|
10233
|
+
const publishMessages = import_localization15.CLI_MESSAGES[locale].publish;
|
|
10174
10234
|
const project = loadPublicationProject(runtime.loadProject, cwd, publishMessages);
|
|
10175
10235
|
const projectId = assertManifestProject(project, normalized.projectId, publishMessages);
|
|
10176
10236
|
const connectorId = normalized.connectorId ?? project.manifest.connector_id;
|
|
@@ -10199,8 +10259,8 @@ function localCandidateSource(normalized, cwd, runtime, locale) {
|
|
|
10199
10259
|
expectedToolNames: candidate.expectedToolNames
|
|
10200
10260
|
};
|
|
10201
10261
|
}
|
|
10202
|
-
async function runOAuthScopeRegisterCommand(options, writer, cwd, runtime, locale =
|
|
10203
|
-
const messages =
|
|
10262
|
+
async function runOAuthScopeRegisterCommand(options, writer, cwd, runtime, locale = import_localization15.DEFAULT_LOCALE) {
|
|
10263
|
+
const messages = import_localization15.OAUTH_SCOPE_REGISTRATION_MESSAGES[locale];
|
|
10204
10264
|
const normalized = normalizeOAuthScopeRegisterOptions(options, locale);
|
|
10205
10265
|
const target = normalized.kind === "saved_drafts" ? {
|
|
10206
10266
|
projectId: normalized.projectId,
|
|
@@ -10248,7 +10308,7 @@ async function runOAuthScopeRegisterCommand(options, writer, cwd, runtime, local
|
|
|
10248
10308
|
throw new OAuthScopeRegistrationCommandError(
|
|
10249
10309
|
"AP_NETWORK_ERROR",
|
|
10250
10310
|
"secure_random_invalid",
|
|
10251
|
-
|
|
10311
|
+
import_localization15.CLI_MESSAGES[locale].publish.failure("secure_random_invalid")
|
|
10252
10312
|
);
|
|
10253
10313
|
}
|
|
10254
10314
|
let applied;
|
|
@@ -10269,18 +10329,18 @@ async function runOAuthScopeRegisterCommand(options, writer, cwd, runtime, local
|
|
|
10269
10329
|
writeRegistrationSummary(writer, applied, true, messages);
|
|
10270
10330
|
return { ok: true };
|
|
10271
10331
|
}
|
|
10272
|
-
function upstreamOAuthWizardUrl(profile, projectId, connectorId, locale =
|
|
10332
|
+
function upstreamOAuthWizardUrl(profile, projectId, connectorId, locale = import_localization15.DEFAULT_LOCALE) {
|
|
10273
10333
|
const record = getProfile(profile);
|
|
10274
10334
|
if (!record)
|
|
10275
10335
|
throw new UsageError(
|
|
10276
|
-
(0,
|
|
10336
|
+
(0, import_localization15.formatCliOpenApiTemplateMessage)(import_localization15.CLI_OAUTH_DOCTOR_MESSAGES[locale].oauth.profileMissing, { profile })
|
|
10277
10337
|
);
|
|
10278
10338
|
const url = new URL(`/projects/${projectId}/oauth`, new URL(record.verificationUriBase).origin);
|
|
10279
10339
|
url.searchParams.set("connector", connectorId);
|
|
10280
10340
|
return url.toString();
|
|
10281
10341
|
}
|
|
10282
10342
|
async function loadOAuthMetadata(opts, locale) {
|
|
10283
|
-
const messages =
|
|
10343
|
+
const messages = import_localization15.CLI_MESSAGES[locale];
|
|
10284
10344
|
if (opts.file && opts.issuer) {
|
|
10285
10345
|
throw new UsageError(messages.init.incompatibleOptions("--file / --issuer"));
|
|
10286
10346
|
}
|
|
@@ -10297,7 +10357,7 @@ async function loadOAuthMetadata(opts, locale) {
|
|
|
10297
10357
|
}
|
|
10298
10358
|
}
|
|
10299
10359
|
async function runOAuthMetadataValidate(opts, writer, locale) {
|
|
10300
|
-
const messages =
|
|
10360
|
+
const messages = import_localization15.CLI_MESSAGES[locale];
|
|
10301
10361
|
const parsed = await loadOAuthMetadata(opts, locale);
|
|
10302
10362
|
const report = validateOAuthMetadata(parsed, locale);
|
|
10303
10363
|
json(writer, report.results);
|
|
@@ -10308,9 +10368,9 @@ async function runOAuthMetadataValidate(opts, writer, locale) {
|
|
|
10308
10368
|
info(writer, messages.oauth.metadataOk);
|
|
10309
10369
|
}
|
|
10310
10370
|
}
|
|
10311
|
-
function registerOauth(program, writer, locale =
|
|
10312
|
-
const messages =
|
|
10313
|
-
const copy =
|
|
10371
|
+
function registerOauth(program, writer, locale = import_localization15.DEFAULT_LOCALE, dependencies = {}) {
|
|
10372
|
+
const messages = import_localization15.CLI_MESSAGES[locale];
|
|
10373
|
+
const copy = import_localization15.CLI_OAUTH_DOCTOR_MESSAGES[locale].oauth;
|
|
10314
10374
|
const oauth = program.command("oauth").description(messages.oauth.commandDescription);
|
|
10315
10375
|
oauth.command("init").description(messages.oauth.initDescription).requiredOption("--provider <name>", messages.oauth.providerOption).action((opts) => {
|
|
10316
10376
|
info(writer, messages.oauth.templateHeading(opts.provider));
|
|
@@ -10353,7 +10413,7 @@ function registerOauth(program, writer, locale = import_localization14.DEFAULT_L
|
|
|
10353
10413
|
});
|
|
10354
10414
|
json(writer, result);
|
|
10355
10415
|
});
|
|
10356
|
-
const registration =
|
|
10416
|
+
const registration = import_localization15.OAUTH_SCOPE_REGISTRATION_MESSAGES[locale].cli;
|
|
10357
10417
|
const scopeRegisterRuntime = dependencies.scopeRegisterRuntime ?? createOAuthScopeRegisterRuntime();
|
|
10358
10418
|
const cwd = dependencies.cwd ?? (() => process.cwd());
|
|
10359
10419
|
scopes.command("register").description(registration.commandDescription).option("--project <project-uuid>", registration.projectOption).option("--connector <connector-uuid>", registration.connectorOption).option(
|
|
@@ -10460,7 +10520,7 @@ function registerOauth(program, writer, locale = import_localization14.DEFAULT_L
|
|
|
10460
10520
|
}).getUpstreamOAuthConnectionState(projectId, opts.connector);
|
|
10461
10521
|
json(writer, state);
|
|
10462
10522
|
const url = upstreamOAuthWizardUrl(opts.profile, projectId, opts.connector, locale);
|
|
10463
|
-
info(writer, (0,
|
|
10523
|
+
info(writer, (0, import_localization15.formatCliOpenApiTemplateMessage)(copy.continueInAdmin, { url }));
|
|
10464
10524
|
if (opts.browser) {
|
|
10465
10525
|
try {
|
|
10466
10526
|
(dependencies.openBrowser ?? openBrowser)(url);
|
|
@@ -10483,7 +10543,7 @@ function registerOauth(program, writer, locale = import_localization14.DEFAULT_L
|
|
|
10483
10543
|
// src/commands/openapi.ts
|
|
10484
10544
|
var import_node_crypto15 = require("crypto");
|
|
10485
10545
|
var import_node_path14 = require("path");
|
|
10486
|
-
var
|
|
10546
|
+
var import_localization16 = require("@andpipes/localization");
|
|
10487
10547
|
var import_tool_contract13 = require("@andpipes/tool-contract");
|
|
10488
10548
|
function createOpenApiImportRuntime(createClient = (profile) => createAdminApiClient({ profile })) {
|
|
10489
10549
|
return { createClient, idempotencyKey: import_node_crypto15.randomUUID };
|
|
@@ -10501,13 +10561,13 @@ function normalizedOptions(options, text) {
|
|
|
10501
10561
|
const apply = options.apply === true;
|
|
10502
10562
|
const yes = options.yes === true;
|
|
10503
10563
|
if (yes && !apply) {
|
|
10504
|
-
throw new UsageError((0,
|
|
10564
|
+
throw new UsageError((0, import_localization16.formatCliOpenApiTemplateMessage)(text.requiresApply, { flags: "--yes" }));
|
|
10505
10565
|
}
|
|
10506
10566
|
if (options.idempotencyKey !== void 0 && !apply) {
|
|
10507
|
-
throw new UsageError((0,
|
|
10567
|
+
throw new UsageError((0, import_localization16.formatCliOpenApiTemplateMessage)(text.requiresApply, { flags: "--idempotency-key" }));
|
|
10508
10568
|
}
|
|
10509
10569
|
if (!apply && options.planCommitment !== void 0) {
|
|
10510
|
-
throw new UsageError((0,
|
|
10570
|
+
throw new UsageError((0, import_localization16.formatCliOpenApiTemplateMessage)(text.requiresApply, { flags: "--plan-commitment" }));
|
|
10511
10571
|
}
|
|
10512
10572
|
return {
|
|
10513
10573
|
file: options.file,
|
|
@@ -10531,8 +10591,8 @@ function rethrowWithAuthModeGuidance(error, text) {
|
|
|
10531
10591
|
}
|
|
10532
10592
|
throw error;
|
|
10533
10593
|
}
|
|
10534
|
-
async function runOpenApiImportCommand(options, writer, cwd, runtime = createOpenApiImportRuntime(), locale =
|
|
10535
|
-
const text =
|
|
10594
|
+
async function runOpenApiImportCommand(options, writer, cwd, runtime = createOpenApiImportRuntime(), locale = import_localization16.DEFAULT_LOCALE) {
|
|
10595
|
+
const text = import_localization16.CLI_OPENAPI_TEMPLATE_MESSAGES[locale];
|
|
10536
10596
|
const normalized = normalizedOptions(options, text);
|
|
10537
10597
|
if (normalized.apply && !normalized.yes) {
|
|
10538
10598
|
throw new ConfirmationRequiredError("andpipe openapi import --apply", text.openapiConfirm);
|
|
@@ -10575,7 +10635,7 @@ async function runOpenApiImportCommand(options, writer, cwd, runtime = createOpe
|
|
|
10575
10635
|
);
|
|
10576
10636
|
} catch (error) {
|
|
10577
10637
|
if (error instanceof import_tool_contract13.OpenApiImportError) {
|
|
10578
|
-
throw new UsageError((0,
|
|
10638
|
+
throw new UsageError((0, import_localization16.formatCliOpenApiTemplateMessage)(text.generateFailure, { detail: error.message }));
|
|
10579
10639
|
}
|
|
10580
10640
|
throw error;
|
|
10581
10641
|
}
|
|
@@ -10617,9 +10677,9 @@ async function runOpenApiImportCommand(options, writer, cwd, runtime = createOpe
|
|
|
10617
10677
|
function collect(value, previous) {
|
|
10618
10678
|
return [...previous, value];
|
|
10619
10679
|
}
|
|
10620
|
-
function registerOpenApi(program, writer, cwd, runtime = createOpenApiImportRuntime(), locale =
|
|
10621
|
-
const text =
|
|
10622
|
-
const common =
|
|
10680
|
+
function registerOpenApi(program, writer, cwd, runtime = createOpenApiImportRuntime(), locale = import_localization16.DEFAULT_LOCALE) {
|
|
10681
|
+
const text = import_localization16.CLI_OPENAPI_TEMPLATE_MESSAGES[locale];
|
|
10682
|
+
const common = import_localization16.CLI_MESSAGES[locale].common;
|
|
10623
10683
|
const openapi = program.command("openapi").description(text.openapiDescription);
|
|
10624
10684
|
openapi.command("import").description(text.importDescription).requiredOption("--file <path>", text.sourceFileOption).requiredOption("--project <uuid>", common.projectOption).requiredOption("--connector <uuid>", text.connectorOption).option("--profile <name>", common.targetProfileOption, DEFAULT_PROFILE_NAME).option("--format <format>", text.formatOption).option("--base-url <url>", text.baseUrlOption).option("--service-name <name>", text.serviceNameOption).option("--apply", text.openapiApplyOption, false).option("--yes", text.openapiYesOption, false).option("--idempotency-key <key>", text.idempotencyOption).option("--plan-commitment <sha256>", text.openapiPlanOption).option("--auth-mode <mode>", text.authModeOption).option("--side-effect-free <toolName=level>", text.sideEffectOption, collect, []).action(
|
|
10625
10685
|
(options) => runOpenApiImportCommand(options, writer, cwd(), runtime, locale)
|
|
@@ -10627,16 +10687,16 @@ function registerOpenApi(program, writer, cwd, runtime = createOpenApiImportRunt
|
|
|
10627
10687
|
}
|
|
10628
10688
|
|
|
10629
10689
|
// src/commands/review-package.ts
|
|
10630
|
-
var
|
|
10690
|
+
var import_localization17 = require("@andpipes/localization");
|
|
10631
10691
|
var TARGETS = ["chatgpt", "claude", "generic_mcp"];
|
|
10632
|
-
function assertTarget(value, locale =
|
|
10692
|
+
function assertTarget(value, locale = import_localization17.DEFAULT_LOCALE) {
|
|
10633
10693
|
if (!TARGETS.includes(value)) {
|
|
10634
|
-
throw new UsageError(
|
|
10694
|
+
throw new UsageError(import_localization17.CLI_MESSAGES[locale].reviewPackage.invalidTarget(value, TARGETS));
|
|
10635
10695
|
}
|
|
10636
10696
|
}
|
|
10637
|
-
function registerReviewPackage(program, writer, locale =
|
|
10638
|
-
const messages =
|
|
10639
|
-
const guidance =
|
|
10697
|
+
function registerReviewPackage(program, writer, locale = import_localization17.DEFAULT_LOCALE, cwd = () => process.cwd()) {
|
|
10698
|
+
const messages = import_localization17.CLI_MESSAGES[locale];
|
|
10699
|
+
const guidance = import_localization17.REVIEW_PACKAGE_GUIDANCE[locale];
|
|
10640
10700
|
const reviewPackage = program.command("review-package").description(messages.reviewPackage.commandDescription);
|
|
10641
10701
|
reviewPackage.command("generate").description(messages.reviewPackage.generateDescription).requiredOption("--project <project>", messages.common.projectOption).requiredOption("--package-version <version>", messages.reviewPackage.packageVersionOption).option("--target <target>", messages.reviewPackage.targetOption).option("--from-template", guidance.fromTemplateOption, false).option("--profile <name>", messages.common.targetProfileOption, DEFAULT_PROFILE_NAME).option("--yes", messages.domain.yesOption, false).action(
|
|
10642
10702
|
async (opts) => {
|
|
@@ -10694,12 +10754,12 @@ function registerReviewPackage(program, writer, locale = import_localization16.D
|
|
|
10694
10754
|
}
|
|
10695
10755
|
|
|
10696
10756
|
// src/cli.ts
|
|
10697
|
-
function buildProgram(writer = defaultWriter, cwd = () => process.cwd(), locale = (0,
|
|
10698
|
-
const text =
|
|
10699
|
-
const messages =
|
|
10700
|
-
const scopeRegistrationMessages =
|
|
10757
|
+
function buildProgram(writer = defaultWriter, cwd = () => process.cwd(), locale = (0, import_localization18.normalizeLocale)(process.env.ANDPIPE_LOCALE ?? process.env.LANG)) {
|
|
10758
|
+
const text = import_localization18.LOCALIZED_TEXT[locale].cli;
|
|
10759
|
+
const messages = import_localization18.CLI_MESSAGES[locale];
|
|
10760
|
+
const scopeRegistrationMessages = import_localization18.OAUTH_SCOPE_REGISTRATION_MESSAGES[locale].cli;
|
|
10701
10761
|
const program = new import_commander.Command();
|
|
10702
|
-
program.name(CLI_NAME).description(text.description).option("--locale <locale>", messages.localeOption,
|
|
10762
|
+
program.name(CLI_NAME).description(text.description).option("--locale <locale>", messages.localeOption, import_localization18.DEFAULT_LOCALE).version(readVersion());
|
|
10703
10763
|
registerAuth(program, writer, locale);
|
|
10704
10764
|
registerAuditExport(program, writer, locale);
|
|
10705
10765
|
registerInit(
|
|
@@ -10733,20 +10793,20 @@ function buildProgram(writer = defaultWriter, cwd = () => process.cwd(), locale
|
|
|
10733
10793
|
void 0,
|
|
10734
10794
|
messages.publish,
|
|
10735
10795
|
scopeRegistrationMessages,
|
|
10736
|
-
|
|
10796
|
+
import_localization18.PUBLICATION_SCHEMA_REVIEW_CLI_MESSAGES[locale]
|
|
10737
10797
|
);
|
|
10738
10798
|
return program;
|
|
10739
10799
|
}
|
|
10740
10800
|
function localeFromArgv(argv) {
|
|
10741
10801
|
const localeIndex = argv.indexOf("--locale");
|
|
10742
10802
|
if (localeIndex >= 0) {
|
|
10743
|
-
return (0,
|
|
10803
|
+
return (0, import_localization18.normalizeLocale)(argv[localeIndex + 1]);
|
|
10744
10804
|
}
|
|
10745
10805
|
const inlineLocale = argv.find((arg) => arg.startsWith("--locale="));
|
|
10746
10806
|
if (inlineLocale) {
|
|
10747
|
-
return (0,
|
|
10807
|
+
return (0, import_localization18.normalizeLocale)(inlineLocale.slice("--locale=".length));
|
|
10748
10808
|
}
|
|
10749
|
-
return (0,
|
|
10809
|
+
return (0, import_localization18.normalizeLocale)(process.env.ANDPIPE_LOCALE ?? process.env.LANG);
|
|
10750
10810
|
}
|
|
10751
10811
|
async function runCli(argv, writer = defaultWriter) {
|
|
10752
10812
|
await buildProgram(writer, () => process.cwd(), localeFromArgv(argv)).parseAsync(argv);
|