@icebreakers/monorepo 5.8.0 → 5.9.0
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/{baseline-Cx3VuGue.mjs → baseline-B9EyxrbO.mjs} +1 -1
- package/dist/{catalog-BKW8udNq.mjs → catalog-5kzxXyLB.mjs} +3 -3
- package/dist/cli.mjs +375 -64
- package/dist/{commands-C1KOgvKa.mjs → commands-CusCWJxk.mjs} +59 -19
- package/dist/{config-ITi4Uywg.mjs → config-rSoYOMXe.mjs} +3 -3
- package/dist/{create-flow-C_ar-XrN.mjs → create-flow-CBuv4d_0.mjs} +3 -3
- package/dist/{deps-_M128Hqi.mjs → deps-BncO3_-h.mjs} +3 -3
- package/dist/{execute-DTrS4Jqx.mjs → execute-0x7C8Kn_.mjs} +2 -2
- package/dist/{execute-CNGJsU9v.mjs → execute-BG1gfWOr.mjs} +2 -2
- package/dist/{format-Dxe0grKF.mjs → format-CR1vN-6r.mjs} +1 -1
- package/dist/{index-CoCTFWZJ.d.mts → index-D61zjikU.d.mts} +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +9 -9
- package/dist/{inputs-DkBp5uc7.mjs → inputs-WX7RZBFF.mjs} +1 -1
- package/dist/{npm-BttWVZSI.mjs → npm-Dq9vIMv5.mjs} +1 -1
- package/dist/{plan-DkRsq9Oj.mjs → plan-BvJst3z5.mjs} +1 -1
- package/dist/{run-BHsnON3k.mjs → run-Bj0TtsEm.mjs} +4 -4
- package/dist/{save-DTVXKc6k.mjs → save-PjFHzG0t.mjs} +3 -3
- package/dist/{scan-uUmUqFA6.mjs → scan-DlTxgMtA.mjs} +2 -3
- package/dist/{template-drift-Bhvs_DPa.mjs → template-drift-CekAiCI1.mjs} +3 -3
- package/dist/tooling-entry.d.mts +1 -1
- package/dist/tooling-entry.mjs +2 -2
- package/dist/{transaction-ut5-TLoD.mjs → transaction-g0QYi-eZ.mjs} +2 -2
- package/dist/{tsconfig-DtgBJ7Vi.mjs → tsconfig-CjMxxX9j.mjs} +2 -2
- package/dist/{vitest-DkD49zO4.mjs → vitest-B4Gcs7ZS.mjs} +10 -8
- package/dist/{workspace-tasks-PcOR82ko.mjs → workspace-tasks-DeISSjjU.mjs} +17 -7
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { Ct as message, Et as supportedLocales, J as getWorkspaceGraph, Q as whyWorkspaceDependency, St as localize, Z as getWorkspaceImpact, a as inspectWorkspaceOwners, i as planCodeowners, jt as fs$1, n as locateWorkspace, r as applyCodeownersPlan, t as getWorkspaceTaskCatalog, vt as cliName, wt as repoctlLocale } from "./workspace-tasks-
|
|
2
|
-
import { f as logger } from "./execute-
|
|
3
|
-
import { At as resolveTemplateCatalog, C as applyOrganizationPresetAssets, D as applyInstallSecurityPreset, F as upgradeMonorepo, Ft as sanitizeConfigReport, I as formatUpgradePlan, It as validateConfigFile, M as applyPublicApiUpdate, N as planPublicApiUpdate, O as planInstallSecurityPreset, Ot as resolveRemoteTemplateSource, P as formatPublicApiReport, Pt as explainMonorepoConfig, _ as applyProjectReferencesPlan, a as planWorkspaceMove, b as getMaintenanceWorkflow, bt as applyUpgradePlan, c as applyToolingCapability, d as planTemplateValidation, f as releaseSnapshot, g as syncProjectReferences, h as checkProjectReferences, i as applyWorkspaceMovePlan, j as checkPublicApi, jt as loadTemplateCatalogContext, k as checkPeerDependencies, kt as createTemplateCatalog, l as planToolingCapability, lt as initToolingTargets, m as createReleasePlan, n as applyWorkspaceRemovalPlan, nt as resolveReleaseMode, o as applyWorkspaceArtifactPlan, r as planWorkspaceRemoval, rt as renderReleasePullRequest, s as planWorkspaceArtifact, u as validateTemplate, v as planProjectReferences, vt as planUpgrade, w as planOrganizationPresetAssets, x as prepareMaintenanceUpgrade, y as checkPackages } from "./commands-
|
|
4
|
-
import { S as canonicalDirectory, W as splitConfigPath, _ as listToolingCapabilities, d as loadMonorepoConfig, f as loadMonorepoConfigDetails, j as ConfigValidationError, k as version, p as resolveCommandConfig } from "./tsconfig-
|
|
5
|
-
import { s as resolveCommandValues } from "./scan-
|
|
6
|
-
import { S as checkDependencyAdmission, f as inspectInstallSecurity, x as checkWorkspaceBoundaries } from "./template-drift-
|
|
1
|
+
import { Ct as message, Et as supportedLocales, J as getWorkspaceGraph, Q as whyWorkspaceDependency, St as localize, Ut as getWorkspaceData, Z as getWorkspaceImpact, a as inspectWorkspaceOwners, i as planCodeowners, jt as fs$1, n as locateWorkspace, r as applyCodeownersPlan, t as getWorkspaceTaskCatalog, vt as cliName, wt as repoctlLocale } from "./workspace-tasks-DeISSjjU.mjs";
|
|
2
|
+
import { f as logger } from "./execute-BG1gfWOr.mjs";
|
|
3
|
+
import { At as resolveTemplateCatalog, C as applyOrganizationPresetAssets, D as applyInstallSecurityPreset, F as upgradeMonorepo, Ft as sanitizeConfigReport, I as formatUpgradePlan, It as validateConfigFile, M as applyPublicApiUpdate, N as planPublicApiUpdate, O as planInstallSecurityPreset, Ot as resolveRemoteTemplateSource, P as formatPublicApiReport, Pt as explainMonorepoConfig, _ as applyProjectReferencesPlan, a as planWorkspaceMove, b as getMaintenanceWorkflow, bt as applyUpgradePlan, c as applyToolingCapability, d as planTemplateValidation, f as releaseSnapshot, g as syncProjectReferences, h as checkProjectReferences, i as applyWorkspaceMovePlan, j as checkPublicApi, jt as loadTemplateCatalogContext, k as checkPeerDependencies, kt as createTemplateCatalog, l as planToolingCapability, lt as initToolingTargets, m as createReleasePlan, n as applyWorkspaceRemovalPlan, nt as resolveReleaseMode, o as applyWorkspaceArtifactPlan, r as planWorkspaceRemoval, rt as renderReleasePullRequest, s as planWorkspaceArtifact, tt as parsePublishSummary, u as validateTemplate, v as planProjectReferences, vt as planUpgrade, w as planOrganizationPresetAssets, x as prepareMaintenanceUpgrade, y as checkPackages } from "./commands-CusCWJxk.mjs";
|
|
4
|
+
import { S as canonicalDirectory, W as splitConfigPath, _ as listToolingCapabilities, d as loadMonorepoConfig, f as loadMonorepoConfigDetails, j as ConfigValidationError, k as version, p as resolveCommandConfig } from "./tsconfig-CjMxxX9j.mjs";
|
|
5
|
+
import { s as resolveCommandValues } from "./scan-DlTxgMtA.mjs";
|
|
6
|
+
import { S as checkDependencyAdmission, f as inspectInstallSecurity, x as checkWorkspaceBoundaries } from "./template-drift-CekAiCI1.mjs";
|
|
7
7
|
import { findWorkspaceDir } from "@pnpm/find-workspace-dir";
|
|
8
8
|
import path from "pathe";
|
|
9
9
|
import process from "node:process";
|
|
10
|
-
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
10
|
+
import { appendFile, mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
11
|
+
import { valid } from "semver";
|
|
11
12
|
import path$1 from "node:path";
|
|
12
13
|
import { select } from "@icebreakers/monorepo-templates";
|
|
13
14
|
import pc from "picocolors";
|
|
14
15
|
import os from "node:os";
|
|
16
|
+
import { performance } from "node:perf_hooks";
|
|
15
17
|
import { Command, Option } from "commander";
|
|
18
|
+
import { setTimeout } from "node:timers/promises";
|
|
16
19
|
//#region src/cli/config-preflight.ts
|
|
17
20
|
function registerConfigPreflight(program, cwd) {
|
|
18
21
|
program.hook("preAction", async (_parent, action) => {
|
|
@@ -44,8 +47,8 @@ function reportCliFailure(error) {
|
|
|
44
47
|
async function handleAiPromptCreate(cwd, opts) {
|
|
45
48
|
const [{ input }, { createTimestampFolderName, defaultAgenticBaseDir, generateAgenticTemplate, generateAgenticTemplates, loadAgenticTasks }, { resolveCommandConfig }] = await Promise.all([
|
|
46
49
|
import("@icebreakers/monorepo-templates"),
|
|
47
|
-
import("./commands-
|
|
48
|
-
import("./tsconfig-
|
|
50
|
+
import("./commands-CusCWJxk.mjs").then((n) => n.t),
|
|
51
|
+
import("./tsconfig-CjMxxX9j.mjs").then((n) => n.c)
|
|
49
52
|
]);
|
|
50
53
|
const aiConfig = await resolveCommandConfig("ai", cwd);
|
|
51
54
|
const resolved = resolveCommandValues("ai", aiConfig, {
|
|
@@ -234,7 +237,7 @@ function registerConfigCommands(program, cwd) {
|
|
|
234
237
|
if (!report.valid) throw new ConfigValidationError(report.diagnostics);
|
|
235
238
|
await emitConfigInspection(report, opts, cwd, report);
|
|
236
239
|
} else {
|
|
237
|
-
const { inspectMonorepoConfig } = await import("./commands-
|
|
240
|
+
const { inspectMonorepoConfig } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
238
241
|
await emitConfigInspection(await inspectMonorepoConfig(cwd), opts, cwd);
|
|
239
242
|
}
|
|
240
243
|
} catch (error) {
|
|
@@ -287,7 +290,7 @@ const output$2 = (value) => process.stdout.write(`${JSON.stringify(value, null,
|
|
|
287
290
|
function registerCatalogCommands(deps, cwd) {
|
|
288
291
|
const catalog = deps.command("catalog").description(localize("Inspect pnpm catalogs and review coordinated migrations", "巡检 pnpm catalog 并审阅联动迁移"));
|
|
289
292
|
catalog.command("check").description(localize("Inspect references, usage and direct-version bypasses without writing", "只读巡检引用、使用情况和直接版本绕过")).option("--catalog <name>", localize("Catalog policy for direct declarations and migration candidates", "直接声明与迁移候选所采用的 catalog 策略"), "default").option("--json", localize("Output a versioned catalog report", "输出有版本结构的 catalog 报告")).action(async (options) => {
|
|
290
|
-
const { checkCatalogs } = await import("./catalog-
|
|
293
|
+
const { checkCatalogs } = await import("./catalog-5kzxXyLB.mjs").then((n) => n.t);
|
|
291
294
|
const report = await checkCatalogs(cwd, options);
|
|
292
295
|
if (options.json) output$2(report);
|
|
293
296
|
else {
|
|
@@ -297,7 +300,7 @@ function registerCatalogCommands(deps, cwd) {
|
|
|
297
300
|
if (report.summary.missing || report.summary.direct) process.exitCode = 1;
|
|
298
301
|
});
|
|
299
302
|
catalog.command("plan").description(localize("Preview catalog YAML and consumer manifest changes without writing", "只读预览 catalog YAML 与消费者清单的联动变更")).argument("<dependency>", localize("Dependency to migrate", "待迁移依赖")).requiredOption("--section <section>", localize("Dependency section; peer ranges remain unchanged", "依赖分区;peer 范围保留原样")).option("--catalog <name>", localize("Default or named catalog", "默认或命名 catalog"), "default").option("--group <name>", localize("Configured dependency version group", "已配置的依赖版本组"), "default").option("--to <specifier>", localize("Explicit common subrange for non-equivalent declarations", "不等价声明的明确共同子范围")).option("--dry-run", localize("Preview only (the default)", "仅预览(默认行为)")).option("--json", localize("Output a reviewed plan for catalog apply", "输出可审阅并交给 catalog apply 的计划")).action(async (dependency, options) => {
|
|
300
|
-
const { planCatalogMigration } = await import("./catalog-
|
|
303
|
+
const { planCatalogMigration } = await import("./catalog-5kzxXyLB.mjs").then((n) => n.t);
|
|
301
304
|
const plan = await planCatalogMigration(cwd, {
|
|
302
305
|
dependency,
|
|
303
306
|
...options
|
|
@@ -309,7 +312,7 @@ function registerCatalogCommands(deps, cwd) {
|
|
|
309
312
|
}
|
|
310
313
|
});
|
|
311
314
|
catalog.command("apply").description(localize("Apply a reviewed catalog migration with conflict checks and rollback", "应用已审阅的 catalog 迁移,检查冲突并支持失败恢复")).argument("<plan>", localize("Reviewed JSON plan", "已审阅的 JSON 计划")).option("--json", localize("Output the apply result as JSON", "以 JSON 输出应用结果")).action(async (file, options) => {
|
|
312
|
-
const { applyCatalogMigrationPlan } = await import("./catalog-
|
|
315
|
+
const { applyCatalogMigrationPlan } = await import("./catalog-5kzxXyLB.mjs").then((n) => n.t);
|
|
313
316
|
const result = await applyCatalogMigrationPlan(cwd, JSON.parse(await readFile(file, "utf8")));
|
|
314
317
|
if (options.json) output$2(result);
|
|
315
318
|
else process.stdout.write(`${result.status}: ${result.changed.join(", ")}\n${result.nextSteps.join("\n")}\n`);
|
|
@@ -336,7 +339,7 @@ function registerDepsCommands(program, cwd) {
|
|
|
336
339
|
registerDependencyAdmission(deps, cwd);
|
|
337
340
|
registerCatalogCommands(deps, cwd);
|
|
338
341
|
deps.command("check").description(localize("Check dependency consistency without writing or accessing registries", "只读检查依赖版本一致性,不访问 registry")).option("--json", localize("Output the dependency report as JSON", "以 JSON 输出依赖报告")).action(async (options) => {
|
|
339
|
-
const { checkDependencies } = await import("./deps-
|
|
342
|
+
const { checkDependencies } = await import("./deps-BncO3_-h.mjs").then((n) => n.n);
|
|
340
343
|
const report = await checkDependencies(cwd);
|
|
341
344
|
if (options.json) output$1(report);
|
|
342
345
|
else for (const group of report.groups) {
|
|
@@ -346,7 +349,7 @@ function registerDepsCommands(program, cwd) {
|
|
|
346
349
|
if (report.summary.equivalent + report.summary.compatible + report.summary.conflict > 0) process.exitCode = 1;
|
|
347
350
|
});
|
|
348
351
|
deps.command("plan").alias("fix").description(localize("Preview an explicit dependency fix; always read-only", "预览显式依赖修复;始终只读")).argument("<dependency>", localize("Dependency name", "依赖名称")).requiredOption("--section <section>", localize("dependencies, devDependencies, peerDependencies or optionalDependencies", "依赖分区:dependencies、devDependencies、peerDependencies 或 optionalDependencies")).requiredOption("--to <specifier>", localize("Explicit target semver range or same-source npm alias", "明确的目标 semver 范围或同源 npm alias")).option("--group <name>", localize("Configured version group", "配置中的版本分组"), "default").option("--dry-run", localize("Preview only (already the default)", "仅预览(默认行为)")).option("--json", localize("Output a serializable plan for deps apply", "输出可交给 deps apply 的 JSON 计划")).action(async (dependency, options) => {
|
|
349
|
-
const { planDependencyFix } = await import("./deps-
|
|
352
|
+
const { planDependencyFix } = await import("./deps-BncO3_-h.mjs").then((n) => n.n);
|
|
350
353
|
const plan = await planDependencyFix(cwd, {
|
|
351
354
|
dependency,
|
|
352
355
|
section: options.section,
|
|
@@ -361,7 +364,7 @@ function registerDepsCommands(program, cwd) {
|
|
|
361
364
|
process.stdout.write(localize("Preview only. Save --json output, review it, then run deps apply <plan.json>.\n", "仅预览。保存并审阅 --json 输出,然后执行 deps apply <plan.json>。\n"));
|
|
362
365
|
});
|
|
363
366
|
deps.command("apply").description(localize("Apply a reviewed dependency plan with conflict checks and rollback", "应用已审阅的依赖计划,检查冲突并支持失败回滚")).argument("<plan>", localize("JSON plan file", "JSON 计划文件")).option("--json", localize("Output the result as JSON", "以 JSON 输出结果")).action(async (file, options) => {
|
|
364
|
-
const { applyDependencyFixPlan } = await import("./deps-
|
|
367
|
+
const { applyDependencyFixPlan } = await import("./deps-BncO3_-h.mjs").then((n) => n.n);
|
|
365
368
|
const result = await applyDependencyFixPlan(cwd, JSON.parse(await readFile(file, "utf8")));
|
|
366
369
|
if (options.json) output$1(result);
|
|
367
370
|
else {
|
|
@@ -375,8 +378,8 @@ function registerDepsCommands(program, cwd) {
|
|
|
375
378
|
function registerEnvironmentCheck(command, cwd) {
|
|
376
379
|
command.command("check [tasks...]").description(localize("Check static environment references against Turbo cache declarations", "检查静态环境变量引用与 Turbo 缓存声明")).option("--json", localize("Output structured findings", "输出结构化诊断")).option("--markdown", localize("Output Markdown to stdout", "向标准输出写入 Markdown")).option("--strict", localize("Fail on warnings as well as errors", "警告也返回失败码")).option("--no-framework-inference", localize("Disable framework prefix assumptions", "不采用框架变量前缀推断")).option("--dry-run", localize("Read-only check (always enabled)", "只读检查(始终启用)")).action(async (tasks, options, action) => {
|
|
377
380
|
if (options.json && options.markdown) throw new Error("--json and --markdown cannot be combined");
|
|
378
|
-
const { checkEnvironmentCache } = await import("./workspace-tasks-
|
|
379
|
-
const { formatEnvironmentCache } = await import("./workspace-tasks-
|
|
381
|
+
const { checkEnvironmentCache } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.F);
|
|
382
|
+
const { formatEnvironmentCache } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.N);
|
|
380
383
|
const report = await checkEnvironmentCache(cwd, {
|
|
381
384
|
...tasks.length ? { tasks } : {},
|
|
382
385
|
...action.getOptionValueSource("frameworkInference") === "cli" ? { frameworkInference: options.frameworkInference } : {}
|
|
@@ -702,23 +705,23 @@ function registerEnvCommands(program, cwd) {
|
|
|
702
705
|
const envCommand = program.command("env").alias("e").description(localize("Environment and support commands", "环境命令"));
|
|
703
706
|
registerEnvironmentCheck(envCommand, cwd);
|
|
704
707
|
envCommand.command("info").description(localize("Show environment information for the current repository", "输出当前仓库环境信息")).alias("i").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).action(async (opts) => {
|
|
705
|
-
const { collectEnvInfo } = await import("./commands-
|
|
708
|
+
const { collectEnvInfo } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
706
709
|
await emitEnvInfo(await collectEnvInfo(cwd), opts, cwd);
|
|
707
710
|
});
|
|
708
711
|
envCommand.command("snapshot").description(localize("Create a support snapshot with environment, doctor, and check data", "输出排障快照,包含环境、doctor 和 check 计划")).alias("s").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--strict", localize("Fail when doctor reports a failure or warning", "输出快照后,如果 doctor 有 fail 或 warn 则返回失败码")).action(async (opts) => {
|
|
709
|
-
const { collectEnvSnapshot } = await import("./commands-
|
|
712
|
+
const { collectEnvSnapshot } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
710
713
|
await emitEnvSnapshot(await collectEnvSnapshot(cwd), opts, cwd);
|
|
711
714
|
});
|
|
712
715
|
envCommand.command("paths").description(localize("Show important repository and report paths", "输出当前仓库关键路径和报告建议位置")).alias("p").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).action(async (opts) => {
|
|
713
|
-
const { collectEnvPaths } = await import("./commands-
|
|
716
|
+
const { collectEnvPaths } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
714
717
|
await emitEnvPaths(await collectEnvPaths(cwd), opts, cwd);
|
|
715
718
|
});
|
|
716
719
|
envCommand.command("support").description(localize("Create a complete support bundle", "输出完整排障包,包含环境、路径、配置、doctor 和 check 计划")).alias("b").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--strict", localize("Fail when doctor reports a failure or warning", "输出排障包后,如果 doctor 有 fail 或 warn 则返回失败码")).action(async (opts) => {
|
|
717
|
-
const { collectEnvSupportBundle } = await import("./commands-
|
|
720
|
+
const { collectEnvSupportBundle } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
718
721
|
await emitEnvSupportBundle(await collectEnvSupportBundle(cwd), opts, cwd);
|
|
719
722
|
});
|
|
720
723
|
envCommand.command("mirror").description(localize("Configure the VS Code binary mirror", "设置 VS Code binary mirror")).alias("m").action(async () => {
|
|
721
|
-
const { setVscodeBinaryMirror } = await import("./commands-
|
|
724
|
+
const { setVscodeBinaryMirror } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
722
725
|
await setVscodeBinaryMirror(cwd);
|
|
723
726
|
logger.success(localize("Environment mirror finished.", "环境镜像完成。"));
|
|
724
727
|
});
|
|
@@ -728,7 +731,7 @@ function registerEnvCommands(program, cwd) {
|
|
|
728
731
|
function registerGenerateCommand(program, cwd) {
|
|
729
732
|
program.command("generate").alias("g").description(localize("Generate a component or route inside an existing package", "在已有包内生成组件或路由")).argument("<generator>", "vue-component, react-component, hono-route").argument("<name>", localize("Kebab-case component or route name", "kebab-case 组件或路由名称")).requiredOption("--package <name-or-path>", localize("Exact workspace package name or relative directory", "精确 workspace 包名或相对目录")).option("--directory <path>", localize("Package-relative source directory", "包内源文件相对目录")).option("--barrel <path>", localize("TypeScript export barrel, used with --export", "配合 --export 使用的 TypeScript 导出文件")).option("--export", localize("Add a named export to src/index.ts or --barrel", "向 src/index.ts 或 --barrel 添加具名导出")).option("--params <json>", localize("Additional typed generator parameters as JSON", "JSON 格式的类型化生成参数")).option("--dry-run", localize("Preview all generated changes without writing", "预览全部生成变更,不写入文件")).option("--json", localize("Print a JSON preview without writing", "以 JSON 输出预览,不写入文件")).action(async (generator, name, options) => {
|
|
730
733
|
try {
|
|
731
|
-
const { applyGeneratePlan, planGenerate } = await import("./workspace-tasks-
|
|
734
|
+
const { applyGeneratePlan, planGenerate } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.v);
|
|
732
735
|
const extra = options.params ? JSON.parse(options.params) : {};
|
|
733
736
|
if (!extra || typeof extra !== "object" || Array.isArray(extra)) throw new Error("--params must contain a JSON object.");
|
|
734
737
|
if (Object.hasOwn(extra, "name") || options.export !== void 0 && Object.hasOwn(extra, "export")) throw new Error("Do not supply the same generator parameter through multiple inputs.");
|
|
@@ -830,7 +833,7 @@ function registerPackageCommands(program, cwd) {
|
|
|
830
833
|
registerPackageCheckCommand(packageCommand, cwd);
|
|
831
834
|
registerPublicApiCommands(packageCommand, cwd);
|
|
832
835
|
packageCommand.command("create").description(localize("Create a new workspace package", "创建一个新的子包")).alias("new").argument("[name]").option("--offline", localize("Use only verified cached remote assets", "只使用通过校验的远程资产缓存")).option("--data <file>", localize("Read typed template parameters from a JSON file", "从 JSON 文件读取类型化模板参数")).option("--cache-dir <directory>", localize("Template asset cache directory", "模板资产缓存目录")).option("-t, --template <template>", localize("Use a template key without prompting", "直接使用指定模板,跳过模板选择")).option("--dry-run", localize("Preview without writing files", "预览将要创建的目录与 package 信息,不写入文件")).option("--json", localize("Output JSON; implies --dry-run", "以 JSON 输出创建预览,隐含 --dry-run")).option("--out <file>", localize("Write the preview to a file; implies --dry-run", "把创建预览写入文件,隐含 --dry-run")).action(async (inputName, opts) => {
|
|
833
|
-
const { runCreateFlow } = await import("./create-flow-
|
|
836
|
+
const { runCreateFlow } = await import("./create-flow-CBuv4d_0.mjs");
|
|
834
837
|
const result = await runCreateFlow(cwd, inputName, {
|
|
835
838
|
...opts.offline !== void 0 ? { offline: opts.offline } : {},
|
|
836
839
|
...opts.cacheDir ? { cacheDir: opts.cacheDir } : {},
|
|
@@ -882,6 +885,312 @@ function registerPresetCommands(program, cwd) {
|
|
|
882
885
|
});
|
|
883
886
|
}
|
|
884
887
|
//#endregion
|
|
888
|
+
//#region src/commands/release/npmmirror/http.ts
|
|
889
|
+
const sourceRegistry = "https://registry.npmjs.org";
|
|
890
|
+
const mirrorRegistry = "https://registry.npmmirror.com";
|
|
891
|
+
const syncRegistry = "https://registry-direct.npmmirror.com";
|
|
892
|
+
var MirrorHttpError = class extends Error {
|
|
893
|
+
status;
|
|
894
|
+
url;
|
|
895
|
+
constructor(status, url, message) {
|
|
896
|
+
super(message);
|
|
897
|
+
this.status = status;
|
|
898
|
+
this.url = url;
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
function remaining(context) {
|
|
902
|
+
const milliseconds = context.deadline - context.now();
|
|
903
|
+
if (milliseconds <= 0) throw new Error("npmmirror sync timed out");
|
|
904
|
+
return milliseconds;
|
|
905
|
+
}
|
|
906
|
+
async function pause(context, milliseconds) {
|
|
907
|
+
await context.sleep(Math.min(milliseconds, remaining(context)));
|
|
908
|
+
remaining(context);
|
|
909
|
+
}
|
|
910
|
+
function retryDelay(response, attempt) {
|
|
911
|
+
const header = response.headers.get("retry-after");
|
|
912
|
+
if (header !== null) {
|
|
913
|
+
const seconds = Number(header);
|
|
914
|
+
const milliseconds = Number.isFinite(seconds) ? seconds * 1e3 : Date.parse(header) - Date.now();
|
|
915
|
+
if (Number.isFinite(milliseconds) && milliseconds >= 0) return milliseconds;
|
|
916
|
+
}
|
|
917
|
+
return (attempt + 1) * 1e3;
|
|
918
|
+
}
|
|
919
|
+
/** 所有请求、响应读取和重试共用本次同步的截止时间。 */
|
|
920
|
+
async function requestJson(url, context, init = {}) {
|
|
921
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
922
|
+
const signal = AbortSignal.timeout(Math.max(1, Math.ceil(Math.min(1e4, remaining(context)))));
|
|
923
|
+
let response;
|
|
924
|
+
let body;
|
|
925
|
+
try {
|
|
926
|
+
response = await context.fetch(url, {
|
|
927
|
+
...init,
|
|
928
|
+
headers: {
|
|
929
|
+
accept: "application/json",
|
|
930
|
+
...init.headers
|
|
931
|
+
},
|
|
932
|
+
signal
|
|
933
|
+
});
|
|
934
|
+
body = await response.text();
|
|
935
|
+
} catch (error) {
|
|
936
|
+
if (attempt === 2) throw new Error(`npmmirror request failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
937
|
+
await pause(context, (attempt + 1) * 1e3);
|
|
938
|
+
continue;
|
|
939
|
+
}
|
|
940
|
+
if (!response.ok) {
|
|
941
|
+
if ((response.status === 429 || response.status >= 500) && attempt < 2) {
|
|
942
|
+
await pause(context, retryDelay(response, attempt));
|
|
943
|
+
continue;
|
|
944
|
+
}
|
|
945
|
+
throw new MirrorHttpError(response.status, url, `HTTP ${response.status}: ${body.slice(0, 500)}`);
|
|
946
|
+
}
|
|
947
|
+
remaining(context);
|
|
948
|
+
try {
|
|
949
|
+
return JSON.parse(body);
|
|
950
|
+
} catch {
|
|
951
|
+
throw new Error(`Invalid JSON response from ${url}`);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
throw new Error("npmmirror request exhausted retries");
|
|
955
|
+
}
|
|
956
|
+
function validatePackageName(name) {
|
|
957
|
+
if (name.length > 214 || !/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u.test(name)) throw new Error(`Invalid npm package name: ${name}`);
|
|
958
|
+
}
|
|
959
|
+
/** 包名整体编码,scoped 包的斜线仍属于同一个路由参数。 */
|
|
960
|
+
function taskEndpoint(name) {
|
|
961
|
+
validatePackageName(name);
|
|
962
|
+
return `${syncRegistry}/-/package/${encodeURIComponent(name)}/syncs`;
|
|
963
|
+
}
|
|
964
|
+
//#endregion
|
|
965
|
+
//#region src/commands/release/npmmirror/sync.ts
|
|
966
|
+
function object(value) {
|
|
967
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
968
|
+
}
|
|
969
|
+
async function metadata(registry, name, context) {
|
|
970
|
+
const value = await requestJson(`${registry}/${encodeURIComponent(name)}`, context);
|
|
971
|
+
if (!object(value) || !object(value["versions"]) || !object(value["dist-tags"]) || Object.values(value["dist-tags"]).some((version) => typeof version !== "string")) throw new Error(`Invalid npm metadata for ${name}`);
|
|
972
|
+
return {
|
|
973
|
+
"versions": value["versions"],
|
|
974
|
+
"dist-tags": value["dist-tags"]
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
function parseTask(value) {
|
|
978
|
+
if (!object(value) || value["ok"] !== true || typeof value["id"] !== "string" || !value["id"] || ![
|
|
979
|
+
"waiting",
|
|
980
|
+
"processing",
|
|
981
|
+
"success",
|
|
982
|
+
"error"
|
|
983
|
+
].includes(String(value["state"]))) throw new Error("Invalid npmmirror sync task response");
|
|
984
|
+
if (value["state"] === "error") throw new Error(`npmmirror task failed: ${String(value["error"] ?? value["id"])}`);
|
|
985
|
+
return {
|
|
986
|
+
id: value["id"],
|
|
987
|
+
state: String(value["state"])
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
async function syncTarget(target, context, dryRun, result) {
|
|
991
|
+
let upstream = await metadata(sourceRegistry, target.name, context);
|
|
992
|
+
const versions = target.versions.length ? target.versions : [...new Set(Object.values(upstream["dist-tags"]))];
|
|
993
|
+
if (!versions.length || versions.some((version) => valid(version) !== version || !Object.hasOwn(upstream.versions, version))) throw new Error(`Requested versions are not published on npm: ${target.name}@${versions.join(", ")}`);
|
|
994
|
+
result.versions = versions;
|
|
995
|
+
if (dryRun) {
|
|
996
|
+
result.state = "dry-run";
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
const endpoint = taskEndpoint(target.name);
|
|
1000
|
+
const created = await requestJson(endpoint, context, {
|
|
1001
|
+
method: "PUT",
|
|
1002
|
+
headers: { "content-type": "application/json" },
|
|
1003
|
+
body: JSON.stringify({
|
|
1004
|
+
skipDependencies: true,
|
|
1005
|
+
specificVersions: JSON.stringify(versions)
|
|
1006
|
+
})
|
|
1007
|
+
});
|
|
1008
|
+
if (object(created) && typeof created["id"] === "string") result.taskId = created["id"];
|
|
1009
|
+
let task = parseTask(created);
|
|
1010
|
+
while (true) {
|
|
1011
|
+
if (task.state === "success") {
|
|
1012
|
+
upstream = await metadata(sourceRegistry, target.name, context);
|
|
1013
|
+
let mirror;
|
|
1014
|
+
try {
|
|
1015
|
+
mirror = await metadata(mirrorRegistry, target.name, context);
|
|
1016
|
+
} catch (error) {
|
|
1017
|
+
if (!(error instanceof MirrorHttpError && error.status === 404)) throw error;
|
|
1018
|
+
}
|
|
1019
|
+
const tags = Object.entries(upstream["dist-tags"]).filter(([, version]) => versions.includes(version));
|
|
1020
|
+
if (mirror && versions.every((version) => Object.hasOwn(mirror.versions, version)) && tags.every(([tag, version]) => mirror["dist-tags"][tag] === version)) {
|
|
1021
|
+
result.state = "success";
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
await pause(context, 1e4);
|
|
1026
|
+
if (task.state !== "success") task = parseTask(await requestJson(`${endpoint}/${encodeURIComponent(task.id)}`, context));
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
//#endregion
|
|
1030
|
+
//#region src/commands/release/npmmirror/targets.ts
|
|
1031
|
+
function validateOptions(options) {
|
|
1032
|
+
if ([
|
|
1033
|
+
options.published,
|
|
1034
|
+
options.all,
|
|
1035
|
+
options.packageName !== void 0
|
|
1036
|
+
].filter(Boolean).length !== 1) throw new Error("Choose exactly one of --published, --all or --package <name>");
|
|
1037
|
+
if (options.version !== void 0 && options.packageName === void 0) throw new Error("--version requires --package");
|
|
1038
|
+
const timeout = options.timeout ?? 300;
|
|
1039
|
+
if (!Number.isFinite(timeout) || timeout <= 0) throw new Error("--timeout must be a positive number of seconds");
|
|
1040
|
+
if (options.packageName !== void 0) validatePackageName(options.packageName);
|
|
1041
|
+
if (options.version !== void 0 && valid(options.version) !== options.version) throw new Error(`Invalid npm version: ${options.version}`);
|
|
1042
|
+
return timeout;
|
|
1043
|
+
}
|
|
1044
|
+
/** 发布结果是自动同步的唯一目标来源,不回退扫描整仓或旧摘要。 */
|
|
1045
|
+
async function selectTargets(options) {
|
|
1046
|
+
if (options.packageName !== void 0) return [{
|
|
1047
|
+
name: options.packageName,
|
|
1048
|
+
versions: options.version === void 0 ? [] : [options.version]
|
|
1049
|
+
}];
|
|
1050
|
+
if (options.all) {
|
|
1051
|
+
const { packages } = await getWorkspaceData(options.cwd);
|
|
1052
|
+
const names = packages.flatMap(({ manifest }) => {
|
|
1053
|
+
if (!manifest.name) return [];
|
|
1054
|
+
const publishConfig = manifest.publishConfig;
|
|
1055
|
+
if (publishConfig?.registry && publishConfig.registry.replace(/\/$/u, "") !== "https://registry.npmjs.org") return [];
|
|
1056
|
+
return [manifest.name];
|
|
1057
|
+
});
|
|
1058
|
+
for (const name of names) validatePackageName(name);
|
|
1059
|
+
return [...new Set(names)].sort().map((name) => ({
|
|
1060
|
+
name,
|
|
1061
|
+
versions: []
|
|
1062
|
+
}));
|
|
1063
|
+
}
|
|
1064
|
+
const value = options.env?.["REPO_RELEASE_PUBLISHED_PACKAGES"];
|
|
1065
|
+
const summaryPath = options.env?.["REPO_RELEASE_PUBLISH_SUMMARY"];
|
|
1066
|
+
let packages;
|
|
1067
|
+
if (value?.trim()) {
|
|
1068
|
+
let parsed;
|
|
1069
|
+
try {
|
|
1070
|
+
parsed = JSON.parse(value);
|
|
1071
|
+
} catch {
|
|
1072
|
+
throw new Error("REPO_RELEASE_PUBLISHED_PACKAGES is not valid JSON");
|
|
1073
|
+
}
|
|
1074
|
+
packages = parsePublishSummary(JSON.stringify({ publishedPackages: parsed }));
|
|
1075
|
+
} else if (summaryPath?.trim()) packages = parsePublishSummary(await readFile(summaryPath, "utf8"));
|
|
1076
|
+
else throw new Error("--published requires REPO_RELEASE_PUBLISHED_PACKAGES or REPO_RELEASE_PUBLISH_SUMMARY");
|
|
1077
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
1078
|
+
for (const { name, version } of packages) {
|
|
1079
|
+
validatePackageName(name);
|
|
1080
|
+
if (valid(version) !== version) throw new Error(`Invalid npm version: ${version}`);
|
|
1081
|
+
if (!grouped.has(name)) grouped.set(name, /* @__PURE__ */ new Set());
|
|
1082
|
+
grouped.get(name).add(version);
|
|
1083
|
+
}
|
|
1084
|
+
return [...grouped].map(([name, versions]) => ({
|
|
1085
|
+
name,
|
|
1086
|
+
versions: [...versions]
|
|
1087
|
+
}));
|
|
1088
|
+
}
|
|
1089
|
+
//#endregion
|
|
1090
|
+
//#region src/commands/release/npmmirror/index.ts
|
|
1091
|
+
/** 同步结果逐包汇总;镜像失败由调用方决定是否阻断发布。 */
|
|
1092
|
+
async function syncNpmMirror(options, runtime = {}) {
|
|
1093
|
+
const timeout = validateOptions(options);
|
|
1094
|
+
const now = runtime.now ?? (() => performance.now());
|
|
1095
|
+
const context = {
|
|
1096
|
+
now,
|
|
1097
|
+
fetch: runtime.fetch ?? globalThis.fetch,
|
|
1098
|
+
sleep: runtime.sleep ?? (async (milliseconds) => {
|
|
1099
|
+
await setTimeout(milliseconds);
|
|
1100
|
+
}),
|
|
1101
|
+
deadline: now() + timeout * 1e3
|
|
1102
|
+
};
|
|
1103
|
+
const targets = await selectTargets({
|
|
1104
|
+
...options,
|
|
1105
|
+
env: options.env ?? process.env
|
|
1106
|
+
});
|
|
1107
|
+
const results = targets.map((target) => ({
|
|
1108
|
+
...target,
|
|
1109
|
+
state: "failed"
|
|
1110
|
+
}));
|
|
1111
|
+
let cursor = 0;
|
|
1112
|
+
async function worker() {
|
|
1113
|
+
while (cursor < targets.length) {
|
|
1114
|
+
const index = cursor++;
|
|
1115
|
+
const target = targets[index];
|
|
1116
|
+
const result = results[index];
|
|
1117
|
+
try {
|
|
1118
|
+
await syncTarget(target, context, options.dryRun === true, result);
|
|
1119
|
+
} catch (error) {
|
|
1120
|
+
result.error = error instanceof Error ? error.message : String(error);
|
|
1121
|
+
if (options.all && error instanceof MirrorHttpError && error.status === 404 && error.url === `https://registry.npmjs.org/${encodeURIComponent(target.name)}`) {
|
|
1122
|
+
result.state = "skipped";
|
|
1123
|
+
result.error = "Not yet published on public npm";
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
await Promise.all([worker(), worker()]);
|
|
1129
|
+
return results;
|
|
1130
|
+
}
|
|
1131
|
+
//#endregion
|
|
1132
|
+
//#region src/commands/release/npmmirror/report.ts
|
|
1133
|
+
function retryCommand(result) {
|
|
1134
|
+
const version = result.versions.length === 1 ? ` --version ${result.versions[0]}` : "";
|
|
1135
|
+
return `pnpm exec repo release sync-npmmirror --package ${result.name}${version}`;
|
|
1136
|
+
}
|
|
1137
|
+
function annotation(message) {
|
|
1138
|
+
return message.replaceAll("%", "%25").replaceAll("\r", "%0D").replaceAll("\n", "%0A");
|
|
1139
|
+
}
|
|
1140
|
+
function cell(value) {
|
|
1141
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("|", "|").replaceAll("\r", " ").replaceAll("\n", " ");
|
|
1142
|
+
}
|
|
1143
|
+
async function reportSync(results, env, dryRun = false, error) {
|
|
1144
|
+
if (!results.length && !error) logger.info("No published npm packages; skipping npmmirror sync.");
|
|
1145
|
+
for (const result of results) {
|
|
1146
|
+
const message = `npmmirror ${result.state}: ${result.name}@${result.versions.join(", ") || "(dist-tags)"}${result.taskId ? ` (task ${result.taskId})` : ""}`;
|
|
1147
|
+
if (result.state === "failed") {
|
|
1148
|
+
logger.warn(`${message}: ${result.error}\nRetry: ${retryCommand(result)}`);
|
|
1149
|
+
if (env["GITHUB_ACTIONS"] === "true") process.stdout.write(`::warning::${annotation(`${message}: ${result.error}`)}\n`);
|
|
1150
|
+
} else logger.info(`${message}${result.error ? `: ${result.error}` : ""}`);
|
|
1151
|
+
}
|
|
1152
|
+
if (error) {
|
|
1153
|
+
logger.error(error);
|
|
1154
|
+
if (env["GITHUB_ACTIONS"] === "true") process.stdout.write(`::warning::${annotation(`npmmirror: ${error}`)}\n`);
|
|
1155
|
+
}
|
|
1156
|
+
if (!env["GITHUB_STEP_SUMMARY"] || dryRun) return;
|
|
1157
|
+
const rows = results.map((result) => `| ${cell(result.name)} | ${cell(result.versions.join(", "))} | ${result.state} | ${cell(result.taskId ?? "")} | ${cell(result.error ?? "")} |`);
|
|
1158
|
+
const retries = results.filter((result) => result.state === "failed").map((result) => `- \`${retryCommand(result)}\``);
|
|
1159
|
+
await appendFile(env["GITHUB_STEP_SUMMARY"], [
|
|
1160
|
+
"",
|
|
1161
|
+
"### npmmirror sync",
|
|
1162
|
+
"",
|
|
1163
|
+
...error ? [cell(error), ""] : [],
|
|
1164
|
+
...rows.length ? [
|
|
1165
|
+
"| Package | Versions | Result | Task ID | Details |",
|
|
1166
|
+
"| --- | --- | --- | --- | --- |",
|
|
1167
|
+
...rows
|
|
1168
|
+
] : ["No published npm packages."],
|
|
1169
|
+
"",
|
|
1170
|
+
...retries,
|
|
1171
|
+
""
|
|
1172
|
+
].join("\n"));
|
|
1173
|
+
}
|
|
1174
|
+
//#endregion
|
|
1175
|
+
//#region src/cli/commands/release/npmmirror.ts
|
|
1176
|
+
function registerNpmMirror(release, cwd) {
|
|
1177
|
+
release.command("sync-npmmirror").description(localize("Sync published npm packages to npmmirror using its HTTP API", "通过 HTTP API 同步已发布 npm 包到 npmmirror")).option("--published", localize("Use the afterPublish package list or summary", "使用 afterPublish 发布包列表或摘要")).option("--all", localize("Sync all public workspace packages from npm dist-tags", "按 npm dist-tag 同步 workspace 全部公开包")).option("--package <name>", localize("Sync one public npm package", "同步一个公开 npm 包")).option("--version <version>", localize("Specific published version; requires --package", "指定已发布版本,须配合 --package")).option("--dry-run", localize("Preview targets without creating sync tasks", "预览目标,不创建同步任务")).option("--timeout <seconds>", localize("Total time budget in seconds", "本次同步的总时间上限(秒)"), "300").action(async (opts) => {
|
|
1178
|
+
try {
|
|
1179
|
+
const results = await syncNpmMirror({
|
|
1180
|
+
cwd,
|
|
1181
|
+
...opts,
|
|
1182
|
+
...opts.package !== void 0 ? { packageName: opts.package } : {},
|
|
1183
|
+
timeout: Number(opts.timeout)
|
|
1184
|
+
});
|
|
1185
|
+
await reportSync(results, process.env, opts.dryRun);
|
|
1186
|
+
if (results.some((result) => result.state === "failed")) process.exitCode = 1;
|
|
1187
|
+
} catch (error) {
|
|
1188
|
+
await reportSync([], process.env, opts.dryRun, error instanceof Error ? error.message : String(error));
|
|
1189
|
+
process.exitCode = 1;
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
//#endregion
|
|
885
1194
|
//#region src/cli/commands/release/plan.ts
|
|
886
1195
|
function formatReleasePlan(plan) {
|
|
887
1196
|
const cell = (value) => String(value).replaceAll("|", "\\|").replaceAll("\n", "<br>");
|
|
@@ -981,9 +1290,10 @@ function registerReleaseCommands(program, cwd) {
|
|
|
981
1290
|
const releaseCommand = program.command("release").description(localize("Release and pnpm versioning commands", "发布与 pnpm versioning 工具集"));
|
|
982
1291
|
registerReleasePlan(releaseCommand, cwd);
|
|
983
1292
|
registerSnapshot(releaseCommand, cwd);
|
|
1293
|
+
registerNpmMirror(releaseCommand, cwd);
|
|
984
1294
|
releaseCommand.command("ci").description(localize("Prepare, publish, or recover versions in CI", "在 CI 中自动准备、发布和恢复版本")).option("--mode <mode>", "auto / prepare / publish / publish-unpublished / reconcile / oidc-audit", "auto").option("--package <name>", localize("Package used by publish-unpublished mode", "publish-unpublished 使用的 package")).option("--version <version>", localize("Version used by publish-unpublished mode", "publish-unpublished 使用的版本")).option("--source-sha <sha>", localize("Recover a prepared release from the selected line history", "从所选发布线的历史提交恢复整批发布")).option("--dry-run", localize("Preview reconcile changes without updating GitHub", "只预览 reconcile 变更,不更新 GitHub")).action(async (opts) => {
|
|
985
1295
|
await runReleaseAction(async () => {
|
|
986
|
-
const { releaseCi } = await import("./commands-
|
|
1296
|
+
const { releaseCi } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
987
1297
|
const mode = resolveReleaseMode(opts);
|
|
988
1298
|
await releaseCi({
|
|
989
1299
|
...mode === "oidc-audit" ? { cwd } : await resolveReleaseOptions(cwd),
|
|
@@ -998,7 +1308,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
998
1308
|
});
|
|
999
1309
|
releaseCommand.command("notes").description(localize("Manage GitHub Release notes", "维护 GitHub Release 正文")).command("repair").description(localize("Rebuild GitHub Release notes from the changelog for each release tag", "按每个发布 tag 对应的 changelog 重建 GitHub Release 正文")).option("--all", localize("Repair every recognized GitHub Release", "修复所有可识别的 GitHub Release")).option("--tag <package@version>", localize("Repair only the specified package@version", "只修复指定 package@version")).option("--dry-run", localize("Generate and summarize without updating GitHub Releases", "只生成并统计,不更新 GitHub Release")).option("--create-missing", localize("Create a missing GitHub Release after validating the published package and tag", "核验已发布 package 和 tag 后补建缺失的 GitHub Release")).action(async (opts) => {
|
|
1000
1310
|
await runReleaseAction(async () => {
|
|
1001
|
-
const { repairReleaseNotes } = await import("./commands-
|
|
1311
|
+
const { repairReleaseNotes } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1002
1312
|
const result = await repairReleaseNotes({
|
|
1003
1313
|
cwd,
|
|
1004
1314
|
...opts.all ? { all: true } : {},
|
|
@@ -1011,7 +1321,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
1011
1321
|
});
|
|
1012
1322
|
const stableCommand = releaseCommand.command("stable").description(localize("Run a stable release from the configured release line", "在配置的正式发布线执行发布")).action(async () => {
|
|
1013
1323
|
await runReleaseAction(async () => {
|
|
1014
|
-
const { releaseCi } = await import("./commands-
|
|
1324
|
+
const { releaseCi } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1015
1325
|
await releaseCi({
|
|
1016
1326
|
...await resolveReleaseOptions(cwd),
|
|
1017
1327
|
mode: "publish"
|
|
@@ -1021,7 +1331,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
1021
1331
|
});
|
|
1022
1332
|
stableCommand.command("prepare").description(localize("Consume pnpm change intents and prepare a Release PR", "消费 pnpm change intents 并准备 Release PR")).action(async () => {
|
|
1023
1333
|
await runReleaseAction(async () => {
|
|
1024
|
-
const { releaseCi } = await import("./commands-
|
|
1334
|
+
const { releaseCi } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1025
1335
|
await releaseCi({
|
|
1026
1336
|
...await resolveReleaseOptions(cwd),
|
|
1027
1337
|
mode: "prepare"
|
|
@@ -1031,7 +1341,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
1031
1341
|
});
|
|
1032
1342
|
stableCommand.command("publish").description(localize("Publish prepared versions from the configured release line", "发布所选发布线已经准备的包版本")).action(async () => {
|
|
1033
1343
|
await runReleaseAction(async () => {
|
|
1034
|
-
const { releaseCi } = await import("./commands-
|
|
1344
|
+
const { releaseCi } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1035
1345
|
await releaseCi({
|
|
1036
1346
|
...await resolveReleaseOptions(cwd),
|
|
1037
1347
|
mode: "publish"
|
|
@@ -1042,21 +1352,21 @@ function registerReleaseCommands(program, cwd) {
|
|
|
1042
1352
|
const preCommand = releaseCommand.command("pre").description(localize("Run or manage prereleases", "执行或管理 prerelease 发布"));
|
|
1043
1353
|
preCommand.command("publish").alias("run").description(localize("Publish from a configured prerelease branch", "在已配置的预发布分支发布 prerelease")).action(async () => {
|
|
1044
1354
|
await runReleaseAction(async () => {
|
|
1045
|
-
const { releaseCi } = await import("./commands-
|
|
1355
|
+
const { releaseCi } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1046
1356
|
await releaseCi(await resolveReleaseOptions(cwd));
|
|
1047
1357
|
logger.success(localize("Prerelease finished.", "预发布完成。"));
|
|
1048
1358
|
});
|
|
1049
1359
|
});
|
|
1050
1360
|
preCommand.command("enter").description(localize("Enter a pnpm prerelease lane", "进入 pnpm prerelease lane")).argument("<tag>", localize("Configured pnpm prerelease lane", "已配置的 pnpm 预发布 lane")).action(async (tag) => {
|
|
1051
1361
|
await runReleaseAction(async () => {
|
|
1052
|
-
const { enterPrerelease } = await import("./commands-
|
|
1362
|
+
const { enterPrerelease } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1053
1363
|
await enterPrerelease(tag, { cwd });
|
|
1054
1364
|
logger.success(localize(`Entered ${tag} prerelease mode.`, `已进入 ${tag} 预发布模式。`));
|
|
1055
1365
|
});
|
|
1056
1366
|
});
|
|
1057
1367
|
preCommand.command("exit").description(localize("Exit the pnpm prerelease lane", "退出 pnpm prerelease lane")).action(async () => {
|
|
1058
1368
|
await runReleaseAction(async () => {
|
|
1059
|
-
const { exitPrerelease } = await import("./commands-
|
|
1369
|
+
const { exitPrerelease } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1060
1370
|
const target = await exitPrerelease({ cwd });
|
|
1061
1371
|
logger.success(localize(`Exited prerelease mode. Stable target: ${target.branch}.`, `已退出预发布模式,正式目标分支:${target.branch}。`));
|
|
1062
1372
|
});
|
|
@@ -1073,7 +1383,7 @@ const skillTargets = [
|
|
|
1073
1383
|
];
|
|
1074
1384
|
function registerSkillsCommands(program, cwd) {
|
|
1075
1385
|
program.command("skills").alias("sk").description(localize("AI skill commands", "技能工具集")).command("sync").description(localize("Synchronize the repoctl skill to global agent directories", "同步 resources/skills/repoctl 到全局目录")).alias("s").option("--codex", localize("Synchronize to ~/.codex/skills", "同步到 ~/.codex/skills")).option("--claude", localize("Synchronize to ~/.claude/skills", "同步到 ~/.claude/skills")).option("--cursor", localize("Synchronize to ~/.cursor/skills", "同步到 ~/.cursor/skills")).option("--agents", localize("Synchronize to ~/.agents/skills", "同步到 ~/.agents/skills")).option("--grok", localize("Synchronize to ~/.grok/skills", "同步到 ~/.grok/skills")).option("--all", localize("Synchronize every target", "同步全部目标")).action(async (opts) => {
|
|
1076
|
-
const { syncSkills } = await import("./commands-
|
|
1386
|
+
const { syncSkills } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1077
1387
|
const selected = /* @__PURE__ */ new Set();
|
|
1078
1388
|
if (opts.all) for (const target of skillTargets) selected.add(target);
|
|
1079
1389
|
else {
|
|
@@ -1109,7 +1419,7 @@ async function emitTemplateReport(value, options) {
|
|
|
1109
1419
|
//#region src/cli/commands/template-instances/drift.ts
|
|
1110
1420
|
function registerTemplateDriftCommand(templates) {
|
|
1111
1421
|
templates.command("drift").description(localize("Inspect template versions and managed file drift without changing assets", "只读诊断模板版本、基线和受管文件漂移")).option("--source-dir <directory>", localize("Compare with metadata from an extracted template package", "与已解压模板包的真实版本元数据比较")).option("--remote", localize("Explicitly query the public npm latest dist-tag", "显式查询公共 npm 仓库的 latest 版本")).option("--strict", localize("Fail on active warnings, including unavailable evidence", "存在有效告警或证据不可用时失败")).option("--json", localize("Output structured JSON", "输出结构化 JSON")).option("--markdown", localize("Output a Markdown report (default)", "输出 Markdown 报告(默认)")).option("--out <file>", localize("Write only the report to this file", "仅将诊断报告写入指定文件")).action(async (options, command) => {
|
|
1112
|
-
const { checkTemplateDrift, formatTemplateDriftReport, hasTemplateDriftIssues } = await import("./template-drift-
|
|
1422
|
+
const { checkTemplateDrift, formatTemplateDriftReport, hasTemplateDriftIssues } = await import("./template-drift-CekAiCI1.mjs").then((n) => n.n);
|
|
1113
1423
|
const merged = {
|
|
1114
1424
|
...command.optsWithGlobals(),
|
|
1115
1425
|
...options
|
|
@@ -1128,7 +1438,7 @@ function registerTemplateDriftCommand(templates) {
|
|
|
1128
1438
|
//#region src/cli/commands/template-instances/upgrade.ts
|
|
1129
1439
|
function registerTemplateUpgradeCommands(templates) {
|
|
1130
1440
|
templates.command("upgrade").description(localize("Preview a selected template instance upgrade, preserving business changes", "预览所选模板实例的增量升级,保留业务修改")).argument("<instance>", localize("Registered instance ID or target path", "已登记实例 ID 或目标路径")).requiredOption("--source-version <version>", localize("Exact target template package version", "目标模板包的精确版本")).option("--source-dir <directory>", localize("Read an extracted target template package", "只读使用已解压的目标模板包")).option("--exclude <paths...>", localize("Keep these relative files or directories unmanaged in future upgrades", "将这些相对文件或目录持久标记为不受管")).option("--apply", localize("Apply a conflict-free instance upgrade", "应用无冲突的实例升级")).option("--json", localize("Output structured JSON", "输出结构化 JSON")).option("--out <file>", localize("Write the report to a file", "将报告写入文件")).action(async (instance, options, command) => {
|
|
1131
|
-
const { planTemplateUpgrade, applyTemplateUpgradePlan } = await import("./workspace-tasks-
|
|
1441
|
+
const { planTemplateUpgrade, applyTemplateUpgradePlan } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.d);
|
|
1132
1442
|
const plan = await planTemplateUpgrade({
|
|
1133
1443
|
cwd: await templateWorkspaceRoot(),
|
|
1134
1444
|
instance,
|
|
@@ -1142,7 +1452,7 @@ function registerTemplateUpgradeCommands(templates) {
|
|
|
1142
1452
|
});
|
|
1143
1453
|
});
|
|
1144
1454
|
templates.command("recover-upgrade").description(localize("Inspect or restore an interrupted instance upgrade", "检查或恢复中断的实例升级")).argument("<instance>", localize("Registered instance ID or target path", "已登记实例 ID 或目标路径")).option("--apply", localize("Restore the recorded instance and changed files", "恢复记录中的实例信息及受影响文件")).option("--json", localize("Output structured JSON", "输出结构化 JSON")).option("--out <file>", localize("Write the report to a file", "将报告写入文件")).action(async (instance, options, command) => {
|
|
1145
|
-
const { recoverTemplateUpgrade } = await import("./workspace-tasks-
|
|
1455
|
+
const { recoverTemplateUpgrade } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.d);
|
|
1146
1456
|
await emitTemplateReport(await recoverTemplateUpgrade(await templateWorkspaceRoot(), instance, options.apply), {
|
|
1147
1457
|
...command.optsWithGlobals(),
|
|
1148
1458
|
...options
|
|
@@ -1155,7 +1465,7 @@ function registerTemplateInstanceCommands(templates) {
|
|
|
1155
1465
|
registerTemplateDriftCommand(templates);
|
|
1156
1466
|
registerTemplateUpgradeCommands(templates);
|
|
1157
1467
|
templates.command("instances").description(localize("Inspect registered template instances without changing files", "只读查询已登记模板实例")).argument("[target]", localize("Instance ID or workspace-relative target", "实例 ID 或相对工作区路径")).option("--json", localize("Output structured JSON", "输出结构化 JSON")).option("--out <file>", localize("Write the report to a file", "将报告写入文件")).action(async (target, options, command) => {
|
|
1158
|
-
const { listTemplateInstances } = await import("./workspace-tasks-
|
|
1468
|
+
const { listTemplateInstances } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.d);
|
|
1159
1469
|
const instances = await listTemplateInstances(await templateWorkspaceRoot());
|
|
1160
1470
|
const selected = target ? instances.filter((item) => item.instance.id === target || item.instance.target === target) : instances;
|
|
1161
1471
|
if (target && !selected.length) throw new Error(`Unknown template instance: ${target}`);
|
|
@@ -1168,7 +1478,7 @@ function registerTemplateInstanceCommands(templates) {
|
|
|
1168
1478
|
});
|
|
1169
1479
|
});
|
|
1170
1480
|
templates.command("link").description(localize("Preview an explicit historical template association; --apply writes metadata only", "预览历史模板关联;--apply 仅写登记信息")).argument("<target>", localize("Existing workspace-relative project path", "存量项目相对工作区路径")).requiredOption("--template <key>", localize("Stable template key", "稳定模板标识")).requiredOption("--source-version <version>", localize("Exact historical template package version", "模板包的精确历史版本")).option("--source-dir <directory>", localize("Read an extracted historical template package without executing it", "只读使用已解压的历史模板包,不执行其脚本")).option("--profile <profile>", localize("workspace-copy-v1 or repo-new-v1", "workspace-copy-v1 或 repo-new-v1"), "repo-new-v1").option("--package-name <name>", localize("Historical generated package name", "历史生成包名")).option("--rename-json", localize("Historical output used package.mock.json", "历史生成时使用了 package.mock.json")).option("--unverified", localize("Explicitly allow metadata-only association when the source is unavailable", "来源不可用时显式允许未验证关联")).option("--apply", localize("Apply the reviewed association without changing project files", "应用关联,不改写项目文件")).option("--json", localize("Output the plan as JSON", "以 JSON 输出计划")).option("--out <file>", localize("Write the plan or result to a file", "将计划或结果写入文件")).action(async (target, options, command) => {
|
|
1171
|
-
const { applyTemplateLinkPlan, planTemplateLink } = await import("./workspace-tasks-
|
|
1481
|
+
const { applyTemplateLinkPlan, planTemplateLink } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.d);
|
|
1172
1482
|
const plan = await planTemplateLink({
|
|
1173
1483
|
cwd: await templateWorkspaceRoot(),
|
|
1174
1484
|
target,
|
|
@@ -1188,14 +1498,14 @@ function registerTemplateInstanceCommands(templates) {
|
|
|
1188
1498
|
});
|
|
1189
1499
|
});
|
|
1190
1500
|
templates.command("relocate").description(localize("Associate a missing instance with an identical destination, without moving files", "显式关联已移动且可验证的实例,不移动业务文件")).argument("<instance>", localize("Registered instance ID or old path", "已登记实例 ID 或旧路径")).argument("<target>", localize("New workspace-relative path", "新相对工作区路径")).option("--apply", localize("Update the registered path", "更新登记路径")).option("--json", localize("Output JSON", "输出 JSON")).option("--out <file>", localize("Write the report to a file", "将报告写入文件")).action(async (instance, target, options, command) => {
|
|
1191
|
-
const { relocateTemplateInstance } = await import("./workspace-tasks-
|
|
1501
|
+
const { relocateTemplateInstance } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.d);
|
|
1192
1502
|
await emitTemplateReport(await relocateTemplateInstance(await templateWorkspaceRoot(), instance, target, options.apply), {
|
|
1193
1503
|
...command.optsWithGlobals(),
|
|
1194
1504
|
...options
|
|
1195
1505
|
});
|
|
1196
1506
|
});
|
|
1197
1507
|
templates.command("rebuild-baseline").description(localize("Reconstruct a retained baseline into a new isolated directory", "在新的隔离目录中重建留存基线")).argument("<instance>", localize("Instance ID or target", "实例 ID 或目标路径")).requiredOption("--destination <directory>", localize("A directory that does not exist", "尚不存在的目录")).option("--original", localize("Reconstruct the original template before repoctl transformations", "重建 repoctl 处理前的原始模板")).action(async (instance, options) => {
|
|
1198
|
-
const { rebuildTemplateInstanceBaseline } = await import("./workspace-tasks-
|
|
1508
|
+
const { rebuildTemplateInstanceBaseline } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.d);
|
|
1199
1509
|
await emitTemplateReport({
|
|
1200
1510
|
instance: (await rebuildTemplateInstanceBaseline(await templateWorkspaceRoot(), instance, path.resolve(options.destination), options.original ? "original" : "rendered")).id,
|
|
1201
1511
|
destination: path.resolve(options.destination)
|
|
@@ -1400,7 +1710,7 @@ function registerTemplatesCommands(program) {
|
|
|
1400
1710
|
const templates = program.command("templates").alias("tpl").description(localize("List built-in and configured templates", "列出内置与自定义模板")).argument("[key]", localize("Show details for a template key", "查看指定模板详情")).option("-c, --category <category>", localize("Filter by library, app, service, docs, or tool", "按模板分类过滤:library / app / service / docs / tool")).option("--check", localize("Check template configuration, metadata and directories", "检查模板配置、元数据、目录和临时文件")).option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown for documentation", "输出 Markdown,方便同步文档")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).action(async (key, opts) => {
|
|
1401
1711
|
const { isTemplateCategory, suggestTemplateKey, templateCategories } = await import("@icebreakers/monorepo-templates");
|
|
1402
1712
|
if (opts.check) {
|
|
1403
|
-
const { checkTemplates } = await import("./commands-
|
|
1713
|
+
const { checkTemplates } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1404
1714
|
const report = await checkTemplates();
|
|
1405
1715
|
if (opts.json) await emitTemplateOutput(JSON.stringify(report, null, 2), opts);
|
|
1406
1716
|
else await emitTemplateOutput(formatTemplateHealthReport(report, !opts.out), opts);
|
|
@@ -1524,7 +1834,7 @@ function registerCapabilityCommands(toolingCommand, cwd) {
|
|
|
1524
1834
|
function registerDevContainerCommand(command, cwd) {
|
|
1525
1835
|
command.command("devcontainer").description(localize("Preview a pnpm Dev Container preset, or apply a reviewed plan", "预览 pnpm Dev Container 预设,或应用已审查的计划")).option("--node-version <version>", localize("Choose an exact Node version allowed by engines.node", "选择 engines.node 允许的精确 Node 版本")).option("--apply <plan>", localize("Apply a saved JSON plan without starting containers", "应用已保存的 JSON 计划,不启动容器")).option("--dry-run", localize("Preview only (the default)", "只读预览(默认行为)")).option("--json", localize("Output JSON with generated files and diffs", "输出包含生成文件与差异的 JSON")).option("--out <file>", localize("Save the JSON preview to a new file", "将 JSON 预览保存到一个新文件")).action(async (_options, current) => {
|
|
1526
1836
|
const options = current.optsWithGlobals();
|
|
1527
|
-
const { applyDevContainerPlan, planDevContainer } = await import("./commands-
|
|
1837
|
+
const { applyDevContainerPlan, planDevContainer } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1528
1838
|
if (options.apply) {
|
|
1529
1839
|
if (options.nodeVersion || options.dryRun || options.out) throw new Error("--apply cannot be combined with preview or selection options.");
|
|
1530
1840
|
const filename = path.resolve(cwd, options.apply);
|
|
@@ -1576,7 +1886,7 @@ function registerToolingCommands(program, cwd) {
|
|
|
1576
1886
|
registerDevContainerCommand(toolingCommand, cwd);
|
|
1577
1887
|
toolingCommand.command("init").description(localize(`Generate tooling configuration (${initToolingTargets.join(", ")})`, `生成 tooling 配置(可选值:${initToolingTargets.join(", ")})`)).alias("i").argument("[tooling...]").option("-a, --all", localize("Generate every tooling configuration", "生成全部 tooling 配置")).option("-f, --force", localize("Overwrite existing tooling configuration files", "覆盖已存在的 tooling 配置文件")).action(async (tooling = [], opts) => {
|
|
1578
1888
|
const normalizedTooling = normalizeToolingTargets(tooling);
|
|
1579
|
-
const { initTooling } = await import("./commands-
|
|
1889
|
+
const { initTooling } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1580
1890
|
await initTooling(cwd, {
|
|
1581
1891
|
...normalizedTooling ? { targets: normalizedTooling } : {},
|
|
1582
1892
|
...opts.all !== void 0 ? { all: opts.all } : {},
|
|
@@ -1600,8 +1910,8 @@ function registerCacheAnalysis(check, cwd) {
|
|
|
1600
1910
|
const markdown = options.markdown || parent["markdown"] === true;
|
|
1601
1911
|
if (json && markdown) throw new Error("--json and --markdown cannot be combined");
|
|
1602
1912
|
const own = command.opts();
|
|
1603
|
-
const { analyzeTurboRuns } = await import("./workspace-tasks-
|
|
1604
|
-
const { formatTurboAnalysis } = await import("./format-
|
|
1913
|
+
const { analyzeTurboRuns } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.G);
|
|
1914
|
+
const { formatTurboAnalysis } = await import("./format-CR1vN-6r.mjs");
|
|
1605
1915
|
const result = await analyzeTurboRuns(path.resolve(cwd, current), {
|
|
1606
1916
|
...previous !== void 0 ? { previous: path.resolve(cwd, previous) } : {},
|
|
1607
1917
|
...own.slowest !== void 0 ? { slowest: Number(own.slowest) } : {}
|
|
@@ -1629,7 +1939,7 @@ function registerKnipCheck(check, cwd) {
|
|
|
1629
1939
|
};
|
|
1630
1940
|
if (opts.saveBaseline && (opts.baseline || opts.newOnly || opts.dryRun || opts.recommendConfig)) throw new Error("--save-baseline cannot be combined with --baseline, --new-only, --dry-run or --recommend-config.");
|
|
1631
1941
|
if (opts.recommendConfig && (opts.config || opts.baseline || opts.newOnly || opts.timeout || opts.production || opts.strict)) throw new Error("--recommend-config only provides native configuration suggestions; it cannot run or compare an analysis.");
|
|
1632
|
-
const { getKnipConfigurationSuggestions, planKnipCheck, runKnipCheck, saveKnipBaseline } = await import("./workspace-tasks-
|
|
1942
|
+
const { getKnipConfigurationSuggestions, planKnipCheck, runKnipCheck, saveKnipBaseline } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.L);
|
|
1633
1943
|
if (opts.recommendConfig) {
|
|
1634
1944
|
process.stdout.write(`${JSON.stringify(await getKnipConfigurationSuggestions(cwd), null, 2)}\n`);
|
|
1635
1945
|
return;
|
|
@@ -1784,7 +2094,7 @@ function registerCheckCommand(program, cwd) {
|
|
|
1784
2094
|
...opts.globalInput ? { globalInputs: opts.globalInput } : {}
|
|
1785
2095
|
};
|
|
1786
2096
|
if (opts.matrix) {
|
|
1787
|
-
const { resolveAffectedCheckMatrix } = await import("./commands-
|
|
2097
|
+
const { resolveAffectedCheckMatrix } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1788
2098
|
const matrix = await resolveAffectedCheckMatrix({
|
|
1789
2099
|
...options,
|
|
1790
2100
|
...opts.shards !== void 0 ? { shards: Number(opts.shards) } : {}
|
|
@@ -1798,19 +2108,19 @@ function registerCheckCommand(program, cwd) {
|
|
|
1798
2108
|
if (opts.dryRun || opts.json || opts.markdown || opts.out) throw new Error("--report cannot be combined with preview options: --dry-run, --json, --markdown, --out");
|
|
1799
2109
|
const format = opts.reportFormat ?? "json";
|
|
1800
2110
|
if (format !== "json" && format !== "markdown") throw new Error("--report-format must be json or markdown");
|
|
1801
|
-
const { runCheckExecution } = await import("./execute-
|
|
2111
|
+
const { runCheckExecution } = await import("./execute-0x7C8Kn_.mjs");
|
|
1802
2112
|
await runCheckExecution(options, opts.report, format, opts.redact);
|
|
1803
2113
|
return;
|
|
1804
2114
|
}
|
|
1805
|
-
const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-
|
|
2115
|
+
const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1806
2116
|
if (opts.dryRun || opts.json || opts.markdown || opts.out) {
|
|
1807
2117
|
if (opts.affected) {
|
|
1808
|
-
const { resolveAffectedCheckPlan } = await import("./commands-
|
|
2118
|
+
const { resolveAffectedCheckPlan } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1809
2119
|
await emitCheckPlan(await resolveAffectedCheckPlan(options), opts, cwd);
|
|
1810
2120
|
return;
|
|
1811
2121
|
}
|
|
1812
2122
|
if (opts.full) {
|
|
1813
|
-
const { resolveFullWorkspaceCheckPlan } = await import("./commands-
|
|
2123
|
+
const { resolveFullWorkspaceCheckPlan } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1814
2124
|
await emitCheckPlan(await resolveFullWorkspaceCheckPlan(cwd), opts, cwd);
|
|
1815
2125
|
return;
|
|
1816
2126
|
}
|
|
@@ -1818,7 +2128,7 @@ function registerCheckCommand(program, cwd) {
|
|
|
1818
2128
|
return;
|
|
1819
2129
|
}
|
|
1820
2130
|
if (opts.affected) {
|
|
1821
|
-
const { runCheckExecution } = await import("./execute-
|
|
2131
|
+
const { runCheckExecution } = await import("./execute-0x7C8Kn_.mjs");
|
|
1822
2132
|
await runCheckExecution(options);
|
|
1823
2133
|
return;
|
|
1824
2134
|
}
|
|
@@ -1984,7 +2294,7 @@ async function emitDoctorReport(report, opts, cwd) {
|
|
|
1984
2294
|
}
|
|
1985
2295
|
function registerDoctorCommand(program, cwd) {
|
|
1986
2296
|
registerInstallSecurityCommand(program.command("doctor").description(localize("Diagnose whether the current repository is ready to use", "诊断当前仓库是否适合直接开始使用")).option("--json", localize("Output JSON for CI or scripts", "输出 JSON 报告,方便 CI 或脚本消费")).option("--markdown", localize("Output Markdown for an issue or pull request", "输出 Markdown 报告,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write the diagnostic report to a file", "把诊断报告写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--strict", localize("Treat warnings as failures", "把 warning 也视为失败,适合 CI 门禁")).option("--rules <ids>", localize("Select exact check IDs, separated by commas", "选择精确检查 ID,以逗号分隔")).option("--list-rules", localize("List all available check IDs", "列出全部可用检查 ID")).option("--fix", localize("Preview safe fixes without writing", "预览安全修复,不写入文件")).option("--apply <plan>", localize("Apply a reviewed doctor fix JSON plan", "应用已审核的 doctor 修复 JSON 计划")).action(async (opts) => {
|
|
1987
|
-
const commands = await import("./commands-
|
|
2297
|
+
const commands = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
1988
2298
|
if (opts.fix && opts.apply || opts.apply && opts.rules !== void 0 || opts.listRules && (opts.fix || opts.apply || opts.rules !== void 0)) throw new Error("Use one of --list-rules, --fix, or --apply; --apply cannot change the reviewed rule selection.");
|
|
1989
2299
|
if (opts.listRules || opts.fix || opts.apply) {
|
|
1990
2300
|
if (opts.markdown || opts.redact) throw new Error("--markdown and --redact apply to diagnostic reports, not rule lists or executable plans.");
|
|
@@ -2053,7 +2363,7 @@ function registerUpgradeCommand(parent, cwd, alias) {
|
|
|
2053
2363
|
//#region src/cli/commands/top-level.ts
|
|
2054
2364
|
function registerTopLevelCommands(program, cwd) {
|
|
2055
2365
|
program.command("init").description(localize("Initialize the current workspace with recommended configuration", "初始化当前 workspace,并生成推荐配置")).option("--preset <preset>", localize("Initialization preset: minimal or standard", "初始化预设:minimal / standard")).option("-f, --force", localize("Overwrite existing tooling configuration files", "覆盖已存在的 tooling 配置文件")).option("--overwrite", localize("Overwrite existing managed files", "覆盖受管的已存在文件")).option("-y, --yes", localize("Use defaults without prompting; suitable for CI", "使用默认值跳过所有交互,适合 CI")).action(async (opts) => {
|
|
2056
|
-
const { init } = await import("./commands-
|
|
2366
|
+
const { init } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
2057
2367
|
const config = await loadMonorepoConfig(cwd);
|
|
2058
2368
|
const { preset } = resolveCommandValues("init", config.commands?.init, { preset: opts.preset }, { entry: "cli" }).values;
|
|
2059
2369
|
await init(cwd, {
|
|
@@ -2066,7 +2376,7 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
2066
2376
|
logger.info(localize("Next: run `pnpm install` and `pnpm build`.", "下一步:运行 `pnpm install` 和 `pnpm build`。"));
|
|
2067
2377
|
});
|
|
2068
2378
|
program.command("new").description(localize("Create a new package or application", "创建新的 package / app")).argument("[name]").option("--offline", localize("Use only verified cached remote assets", "只使用通过校验的远程资产缓存")).option("--data <file>", localize("Read typed template parameters from a JSON file", "从 JSON 文件读取类型化模板参数")).option("--cache-dir <directory>", localize("Template asset cache directory", "模板资产缓存目录")).option("-t, --template <template>", localize("Use a template key without prompting", "直接使用指定模板,跳过模板选择")).option("--dry-run", localize("Preview directories and package metadata without writing", "预览将要创建的目录与 package 信息,不写入文件")).option("--json", localize("Output the creation preview as JSON; implies --dry-run", "以 JSON 输出创建预览,隐含 --dry-run")).option("--out <file>", localize("Write the creation preview to a file; implies --dry-run", "把创建预览写入文件,隐含 --dry-run")).action(async (inputName, opts) => {
|
|
2069
|
-
const { runCreateFlow } = await import("./create-flow-
|
|
2379
|
+
const { runCreateFlow } = await import("./create-flow-CBuv4d_0.mjs");
|
|
2070
2380
|
const result = await runCreateFlow(cwd, inputName, {
|
|
2071
2381
|
...opts.offline !== void 0 ? { offline: opts.offline } : {},
|
|
2072
2382
|
...opts.cacheDir ? { cacheDir: opts.cacheDir } : {},
|
|
@@ -2089,22 +2399,22 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
2089
2399
|
function registerVerifyCommands(program, cwd) {
|
|
2090
2400
|
const verifyCommand = program.command("verify").alias("v").description(localize("Local verification commands", "本地校验工具集"));
|
|
2091
2401
|
verifyCommand.command("pre-push").description(localize("Run build, test, and tsd checks for pushed changes", "按推送变更范围执行 build/test/tsd 校验")).alias("push").action(async () => {
|
|
2092
|
-
const { verifyPrePush } = await import("./commands-
|
|
2402
|
+
const { verifyPrePush } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
2093
2403
|
await verifyPrePush({ cwd });
|
|
2094
2404
|
});
|
|
2095
2405
|
verifyCommand.command("pre-commit").description(localize("Run lint-staged verification", "执行 lint-staged 校验")).alias("commit").action(async () => {
|
|
2096
|
-
const { verifyPreCommit } = await import("./commands-
|
|
2406
|
+
const { verifyPreCommit } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
2097
2407
|
await verifyPreCommit({ cwd });
|
|
2098
2408
|
});
|
|
2099
2409
|
verifyCommand.command("commit-msg").description(localize("Run commitlint verification", "执行 commitlint 校验")).alias("msg").argument("<edit-file>").action(async (editFile) => {
|
|
2100
|
-
const { verifyCommitMsg } = await import("./commands-
|
|
2410
|
+
const { verifyCommitMsg } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
2101
2411
|
await verifyCommitMsg({
|
|
2102
2412
|
cwd,
|
|
2103
2413
|
editFile
|
|
2104
2414
|
});
|
|
2105
2415
|
});
|
|
2106
2416
|
verifyCommand.command("staged-typecheck").description(localize("Run typecheck in workspaces containing staged files", "按暂存文件所在 workspace 执行 typecheck")).alias("tc").argument("[files...]").action(async (files = []) => {
|
|
2107
|
-
const { verifyStagedTypecheck } = await import("./commands-
|
|
2417
|
+
const { verifyStagedTypecheck } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
2108
2418
|
verifyStagedTypecheck(files, { cwd });
|
|
2109
2419
|
});
|
|
2110
2420
|
}
|
|
@@ -2468,12 +2778,12 @@ function registerWorkspaceCommands(program, cwd) {
|
|
|
2468
2778
|
registerWorkspaceRemoval(workspaceCommand, cwd);
|
|
2469
2779
|
registerWorkspaceMove(workspaceCommand, cwd);
|
|
2470
2780
|
workspaceCommand.command("init").description(localize("Initialize workspace metadata and repository files", "初始化工作区元信息(README、package.json、pnpm intent、issue template)")).alias("i").action(async () => {
|
|
2471
|
-
const { initMetadata } = await import("./commands-
|
|
2781
|
+
const { initMetadata } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
2472
2782
|
await initMetadata(cwd);
|
|
2473
2783
|
logger.success(localize("Workspace initialization finished.", "Workspace 初始化完成。"));
|
|
2474
2784
|
});
|
|
2475
2785
|
workspaceCommand.command("list").description(localize("List workspace packages", "列出 workspace 包")).alias("ls").option("--json", localize("Output JSON", "输出 JSON")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--include-private", localize("Include private packages", "包含 private 包")).option("--include-root", localize("Include the workspace root package", "包含 workspace 根包")).option("-p, --pattern <glob>", localize("Append a workspace glob; repeatable", "追加自定义 workspace glob,可重复"), collectValues).option("--out <file>", localize("Write the package list to a file", "把当前列表输出写入文件")).action(async (opts) => {
|
|
2476
|
-
const { getWorkspacePackageSummaries } = await import("./workspace-tasks-
|
|
2786
|
+
const { getWorkspacePackageSummaries } = await import("./workspace-tasks-DeISSjjU.mjs").then((n) => n.Kt);
|
|
2477
2787
|
await emitWorkspaceList(await getWorkspacePackageSummaries(cwd, {
|
|
2478
2788
|
ignorePrivatePackage: !opts.includePrivate,
|
|
2479
2789
|
ignoreRootPackage: !opts.includeRoot,
|
|
@@ -2481,7 +2791,7 @@ function registerWorkspaceCommands(program, cwd) {
|
|
|
2481
2791
|
}), opts);
|
|
2482
2792
|
});
|
|
2483
2793
|
workspaceCommand.command("clean").description(localize("Remove selected workspace packages", "清除选中的包")).alias("rm").option("-y, --yes", localize("Select all eligible workspace packages without prompting", "跳过交互并选择所有符合条件的工作区包")).option("--dry-run", localize("Preview directory deletions and metadata changes without writing", "预览目录删除和元数据变更,不写入文件")).option("--include-private", localize("Include private packages", "包含 private 包")).option("--pinned-version <version>", localize("Override the repoctl version written to the root package", "覆盖写入的 repoctl 版本")).action(async (opts) => {
|
|
2484
|
-
const { cleanProjects } = await import("./commands-
|
|
2794
|
+
const { cleanProjects } = await import("./commands-CusCWJxk.mjs").then((n) => n.t);
|
|
2485
2795
|
await cleanProjects(cwd, normalizeCleanOptions(opts));
|
|
2486
2796
|
});
|
|
2487
2797
|
}
|
|
@@ -2497,6 +2807,7 @@ function localizeCommanderError(value) {
|
|
|
2497
2807
|
return value.replaceAll("Did you mean one of", message("commanderDidYouMeanOneOf")).replaceAll("Did you mean", message("commanderDidYouMean")).replaceAll("Allowed choices are", message("commanderAllowedChoices")).replaceAll("missing required argument", message("commanderMissingRequiredArgument")).replaceAll("required option", message("commanderRequiredOption")).replaceAll("argument missing", message("commanderArgumentMissing")).replaceAll("not specified", message("commanderNotSpecified")).replaceAll("too many arguments", message("commanderTooManyArguments")).replaceAll("unknown command", message("commanderUnknownCommand")).replaceAll("unknown option", message("commanderUnknownOption")).replace(/^error:/, message("commanderErrorPrefix"));
|
|
2498
2808
|
}
|
|
2499
2809
|
function configureLocalizedHelp(command) {
|
|
2810
|
+
if (command !== program && !command.options.some((option) => option.long === "--lang")) command.addOption(new Option("--lang <locale>", message("languageOption")).choices([...supportedLocales]));
|
|
2500
2811
|
const defaultHelp = command.createHelp();
|
|
2501
2812
|
const titles = {
|
|
2502
2813
|
"Arguments:": message("argumentsTitle"),
|
|
@@ -2513,7 +2824,7 @@ function configureLocalizedHelp(command) {
|
|
|
2513
2824
|
if (command.commands.length) command.addHelpCommand("help [command]", message("helpCommand"));
|
|
2514
2825
|
command.commands.forEach(configureLocalizedHelp);
|
|
2515
2826
|
}
|
|
2516
|
-
program.name(activeCliName).version(version, "-V, --version", message("versionOption")).description(message("cliDescription")).addOption(new Option("--lang <locale>", message("languageOption")).choices([...supportedLocales]));
|
|
2827
|
+
program.enablePositionalOptions().name(activeCliName).version(version, "-V, --version", message("versionOption")).description(message("cliDescription")).addOption(new Option("--lang <locale>", message("languageOption")).choices([...supportedLocales]));
|
|
2517
2828
|
registerTopLevelCommands(program, cwd);
|
|
2518
2829
|
registerTemplatesCommands(program);
|
|
2519
2830
|
registerWorkspaceCommands(program, cwd);
|