@icebreakers/monorepo 5.5.0 → 5.5.2
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/cli.mjs +39 -37
- package/dist/{commands-ByI13wrh.mjs → commands-CDgRX9SA.mjs} +192 -34
- package/dist/{create-flow-9c4YQqzw.mjs → create-flow-BhC9hNBT.mjs} +2 -2
- package/dist/index.d.mts +27 -2
- package/dist/index.mjs +3 -3
- package/dist/{types-BOsjWpX0.mjs → types-B4jCdNd-.mjs} +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as message, l as version, m as logger, p as supportedLocales, r as cliName, t as initToolingTargets, u as localize, y as fs } from "./types-
|
|
1
|
+
import { d as message, l as version, m as logger, p as supportedLocales, r as cliName, t as initToolingTargets, u as localize, y as fs } from "./types-B4jCdNd-.mjs";
|
|
2
2
|
import { s as resolveCommandConfig } from "./config-p842Knhq.mjs";
|
|
3
3
|
import path from "pathe";
|
|
4
4
|
import process from "node:process";
|
|
@@ -10,7 +10,7 @@ import { Command, Option } from "commander";
|
|
|
10
10
|
async function handleAiPromptCreate(cwd, opts) {
|
|
11
11
|
const [{ input }, { createTimestampFolderName, defaultAgenticBaseDir, generateAgenticTemplate, generateAgenticTemplates, loadAgenticTasks }, { resolveCommandConfig }] = await Promise.all([
|
|
12
12
|
import("@icebreakers/monorepo-templates"),
|
|
13
|
-
import("./commands-
|
|
13
|
+
import("./commands-CDgRX9SA.mjs").then((n) => n.t),
|
|
14
14
|
import("./config-p842Knhq.mjs").then((n) => n.n)
|
|
15
15
|
]);
|
|
16
16
|
const aiConfig = await resolveCommandConfig("ai", cwd);
|
|
@@ -125,7 +125,7 @@ async function emitConfigInspection(inspection, opts, cwd) {
|
|
|
125
125
|
}
|
|
126
126
|
function registerConfigCommands(program, cwd) {
|
|
127
127
|
program.command("config").alias("cfg").description(localize("Configuration commands", "配置命令")).command("inspect").description(localize("Show the active repoctl config file and resolved configuration", "输出当前 repoctl 配置文件和已解析配置")).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 cwd, configDir, and home paths", "脱敏 cwd/configDir/home 绝对路径后再输出")).action(async (opts) => {
|
|
128
|
-
const { inspectMonorepoConfig } = await import("./commands-
|
|
128
|
+
const { inspectMonorepoConfig } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
129
129
|
await emitConfigInspection(await inspectMonorepoConfig(cwd), opts, cwd);
|
|
130
130
|
});
|
|
131
131
|
}
|
|
@@ -445,23 +445,23 @@ async function emitEnvSupportBundle(bundle, opts, cwd) {
|
|
|
445
445
|
function registerEnvCommands(program, cwd) {
|
|
446
446
|
const envCommand = program.command("env").alias("e").description(localize("Environment and support commands", "环境命令"));
|
|
447
447
|
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) => {
|
|
448
|
-
const { collectEnvInfo } = await import("./commands-
|
|
448
|
+
const { collectEnvInfo } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
449
449
|
await emitEnvInfo(await collectEnvInfo(cwd), opts, cwd);
|
|
450
450
|
});
|
|
451
451
|
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) => {
|
|
452
|
-
const { collectEnvSnapshot } = await import("./commands-
|
|
452
|
+
const { collectEnvSnapshot } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
453
453
|
await emitEnvSnapshot(await collectEnvSnapshot(cwd), opts, cwd);
|
|
454
454
|
});
|
|
455
455
|
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) => {
|
|
456
|
-
const { collectEnvPaths } = await import("./commands-
|
|
456
|
+
const { collectEnvPaths } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
457
457
|
await emitEnvPaths(await collectEnvPaths(cwd), opts, cwd);
|
|
458
458
|
});
|
|
459
459
|
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) => {
|
|
460
|
-
const { collectEnvSupportBundle } = await import("./commands-
|
|
460
|
+
const { collectEnvSupportBundle } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
461
461
|
await emitEnvSupportBundle(await collectEnvSupportBundle(cwd), opts, cwd);
|
|
462
462
|
});
|
|
463
463
|
envCommand.command("mirror").description(localize("Configure the VS Code binary mirror", "设置 VS Code binary mirror")).alias("m").action(async () => {
|
|
464
|
-
const { setVscodeBinaryMirror } = await import("./commands-
|
|
464
|
+
const { setVscodeBinaryMirror } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
465
465
|
await setVscodeBinaryMirror(cwd);
|
|
466
466
|
logger.success(localize("Environment mirror finished.", "环境镜像完成。"));
|
|
467
467
|
});
|
|
@@ -470,7 +470,7 @@ function registerEnvCommands(program, cwd) {
|
|
|
470
470
|
//#region src/cli/commands/package.ts
|
|
471
471
|
function registerPackageCommands(program, cwd) {
|
|
472
472
|
program.command("package").alias("pkg").description(localize("Package commands", "子包命令")).command("create").description(localize("Create a new workspace package", "创建一个新的子包")).alias("new").argument("[name]").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) => {
|
|
473
|
-
const { runCreateFlow } = await import("./create-flow-
|
|
473
|
+
const { runCreateFlow } = await import("./create-flow-BhC9hNBT.mjs");
|
|
474
474
|
const result = await runCreateFlow(cwd, inputName, {
|
|
475
475
|
...opts.template !== void 0 ? { template: opts.template } : {},
|
|
476
476
|
...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
|
|
@@ -500,33 +500,35 @@ async function resolveReleaseOptions(cwd) {
|
|
|
500
500
|
}
|
|
501
501
|
function registerReleaseCommands(program, cwd) {
|
|
502
502
|
const releaseCommand = program.command("release").description(localize("Release and pnpm versioning commands", "发布与 pnpm versioning 工具集"));
|
|
503
|
-
releaseCommand.command("ci").description(localize("Prepare, publish, or recover versions in CI", "在 CI 中自动准备、发布和恢复版本")).option("--mode <mode>", localize("auto / prepare / publish / publish-unpublished", "auto / prepare / publish / publish-unpublished"), "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 使用的版本")).action(async (opts) => {
|
|
503
|
+
releaseCommand.command("ci").description(localize("Prepare, publish, or recover versions in CI", "在 CI 中自动准备、发布和恢复版本")).option("--mode <mode>", localize("auto / prepare / publish / publish-unpublished / reconcile", "auto / prepare / publish / publish-unpublished / reconcile"), "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("--dry-run", localize("Preview reconcile changes without updating GitHub", "只预览 reconcile 变更,不更新 GitHub")).action(async (opts) => {
|
|
504
504
|
await runReleaseAction(async () => {
|
|
505
|
-
const { releaseCi } = await import("./commands-
|
|
505
|
+
const { releaseCi } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
506
506
|
await releaseCi({
|
|
507
507
|
...await resolveReleaseOptions(cwd),
|
|
508
508
|
...opts.mode ? { mode: opts.mode } : {},
|
|
509
509
|
...opts.package ? { packageName: opts.package } : {},
|
|
510
|
-
...opts.version ? { packageVersion: opts.version } : {}
|
|
510
|
+
...opts.version ? { packageVersion: opts.version } : {},
|
|
511
|
+
...opts.dryRun ? { dryRun: true } : {}
|
|
511
512
|
});
|
|
512
513
|
logger.success(localize("Release CI finished.", "Release CI 完成。"));
|
|
513
514
|
});
|
|
514
515
|
});
|
|
515
|
-
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")).action(async (opts) => {
|
|
516
|
+
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) => {
|
|
516
517
|
await runReleaseAction(async () => {
|
|
517
|
-
const { repairReleaseNotes } = await import("./commands-
|
|
518
|
+
const { repairReleaseNotes } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
518
519
|
const result = await repairReleaseNotes({
|
|
519
520
|
cwd,
|
|
520
521
|
...opts.all ? { all: true } : {},
|
|
521
522
|
...opts.tag ? { tag: opts.tag } : {},
|
|
522
|
-
...opts.dryRun ? { dryRun: true } : {}
|
|
523
|
+
...opts.dryRun ? { dryRun: true } : {},
|
|
524
|
+
...opts.createMissing ? { createMissing: true } : {}
|
|
523
525
|
});
|
|
524
526
|
logger.success(localize(`Release notes repaired: ${result.repaired.length}; skipped: ${result.skipped.length}`, `Release 正文已修复:${result.repaired.length};已跳过:${result.skipped.length}`));
|
|
525
527
|
});
|
|
526
528
|
});
|
|
527
529
|
const stableCommand = releaseCommand.command("stable").description(localize("Run a stable release from main", "在 main 分支执行正式发布")).action(async () => {
|
|
528
530
|
await runReleaseAction(async () => {
|
|
529
|
-
const { releaseCi } = await import("./commands-
|
|
531
|
+
const { releaseCi } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
530
532
|
await releaseCi({
|
|
531
533
|
...await resolveReleaseOptions(cwd),
|
|
532
534
|
mode: "publish"
|
|
@@ -536,7 +538,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
536
538
|
});
|
|
537
539
|
stableCommand.command("prepare").description(localize("Consume pnpm change intents and prepare a Release PR", "消费 pnpm change intents 并准备 Release PR")).action(async () => {
|
|
538
540
|
await runReleaseAction(async () => {
|
|
539
|
-
const { releaseCi } = await import("./commands-
|
|
541
|
+
const { releaseCi } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
540
542
|
await releaseCi({
|
|
541
543
|
...await resolveReleaseOptions(cwd),
|
|
542
544
|
mode: "prepare"
|
|
@@ -546,7 +548,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
546
548
|
});
|
|
547
549
|
stableCommand.command("publish").description(localize("Publish versions on main that are not yet on npm", "发布 main 分支上尚未发布的包")).action(async () => {
|
|
548
550
|
await runReleaseAction(async () => {
|
|
549
|
-
const { releaseCi } = await import("./commands-
|
|
551
|
+
const { releaseCi } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
550
552
|
await releaseCi({
|
|
551
553
|
...await resolveReleaseOptions(cwd),
|
|
552
554
|
mode: "publish"
|
|
@@ -557,21 +559,21 @@ function registerReleaseCommands(program, cwd) {
|
|
|
557
559
|
const preCommand = releaseCommand.command("pre").description(localize("Run or manage prereleases", "执行或管理 prerelease 发布"));
|
|
558
560
|
preCommand.command("publish").alias("run").description(localize("Publish a prerelease from an alpha, beta, rc, or next lane", "在 alpha/beta/rc/next 分支发布 prerelease")).action(async () => {
|
|
559
561
|
await runReleaseAction(async () => {
|
|
560
|
-
const { releaseCi } = await import("./commands-
|
|
562
|
+
const { releaseCi } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
561
563
|
await releaseCi(await resolveReleaseOptions(cwd));
|
|
562
564
|
logger.success(localize("Prerelease finished.", "预发布完成。"));
|
|
563
565
|
});
|
|
564
566
|
});
|
|
565
567
|
preCommand.command("enter").description(localize("Enter a pnpm prerelease lane", "进入 pnpm prerelease lane")).argument("<tag>", localize("alpha / beta / rc / next", "alpha / beta / rc / next")).action(async (tag) => {
|
|
566
568
|
await runReleaseAction(async () => {
|
|
567
|
-
const { enterPrerelease } = await import("./commands-
|
|
569
|
+
const { enterPrerelease } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
568
570
|
await enterPrerelease(tag, { cwd });
|
|
569
571
|
logger.success(localize(`Entered ${tag} prerelease mode.`, `已进入 ${tag} 预发布模式。`));
|
|
570
572
|
});
|
|
571
573
|
});
|
|
572
574
|
preCommand.command("exit").description(localize("Exit the pnpm prerelease lane", "退出 pnpm prerelease lane")).action(async () => {
|
|
573
575
|
await runReleaseAction(async () => {
|
|
574
|
-
const { exitPrerelease } = await import("./commands-
|
|
576
|
+
const { exitPrerelease } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
575
577
|
await exitPrerelease({ cwd });
|
|
576
578
|
logger.success(localize("Exited prerelease mode.", "已退出预发布模式。"));
|
|
577
579
|
});
|
|
@@ -588,7 +590,7 @@ const skillTargets = [
|
|
|
588
590
|
];
|
|
589
591
|
function registerSkillsCommands(program, cwd) {
|
|
590
592
|
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) => {
|
|
591
|
-
const { syncSkills } = await import("./commands-
|
|
593
|
+
const { syncSkills } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
592
594
|
const selected = /* @__PURE__ */ new Set();
|
|
593
595
|
if (opts.all) for (const target of skillTargets) selected.add(target);
|
|
594
596
|
else {
|
|
@@ -711,7 +713,7 @@ function registerTemplatesCommands(program) {
|
|
|
711
713
|
program.command("templates").alias("tpl").description(localize("List the built-in 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 built-in template 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) => {
|
|
712
714
|
const { getTemplateChoice, getTemplateChoices, isTemplateCategory, suggestTemplateKey, templateCategories } = await import("@icebreakers/monorepo-templates");
|
|
713
715
|
if (opts.check) {
|
|
714
|
-
const { checkTemplates } = await import("./commands-
|
|
716
|
+
const { checkTemplates } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
715
717
|
const report = await checkTemplates();
|
|
716
718
|
if (opts.json) await emitTemplateOutput(JSON.stringify(report, null, 2), opts);
|
|
717
719
|
else await emitTemplateOutput(formatTemplateHealthReport(report, !opts.out), opts);
|
|
@@ -790,7 +792,7 @@ function normalizeToolingTargets(tooling) {
|
|
|
790
792
|
function registerToolingCommands(program, cwd) {
|
|
791
793
|
program.command("tooling").alias("tg").description(localize("Tooling configuration commands", "工程化配置命令")).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) => {
|
|
792
794
|
const normalizedTooling = normalizeToolingTargets(tooling);
|
|
793
|
-
const { initTooling } = await import("./commands-
|
|
795
|
+
const { initTooling } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
794
796
|
await initTooling(cwd, {
|
|
795
797
|
...normalizedTooling ? { targets: normalizedTooling } : {},
|
|
796
798
|
...opts.all !== void 0 ? { all: opts.all } : {},
|
|
@@ -961,7 +963,7 @@ async function emitCheckPlan(plan, opts, cwd) {
|
|
|
961
963
|
}
|
|
962
964
|
function registerTopLevelCommands(program, cwd) {
|
|
963
965
|
program.command("init").description(localize("Initialize the current workspace with recommended configuration", "初始化当前 workspace,并生成推荐配置")).option("--preset <preset>", localize("Initialization preset: minimal or standard", "初始化预设:minimal / standard"), "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) => {
|
|
964
|
-
const { init } = await import("./commands-
|
|
966
|
+
const { init } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
965
967
|
await init(cwd, {
|
|
966
968
|
...opts.preset !== void 0 ? { preset: opts.preset } : {},
|
|
967
969
|
...opts.force !== void 0 ? { force: opts.force } : {},
|
|
@@ -972,7 +974,7 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
972
974
|
logger.info(localize("Next: run `pnpm install` and `pnpm build`.", "下一步:运行 `pnpm install` 和 `pnpm build`。"));
|
|
973
975
|
});
|
|
974
976
|
program.command("new").description(localize("Create a new package or application", "创建新的 package / app")).argument("[name]").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) => {
|
|
975
|
-
const { runCreateFlow } = await import("./create-flow-
|
|
977
|
+
const { runCreateFlow } = await import("./create-flow-BhC9hNBT.mjs");
|
|
976
978
|
const result = await runCreateFlow(cwd, inputName, {
|
|
977
979
|
...opts.template !== void 0 ? { template: opts.template } : {},
|
|
978
980
|
...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
|
|
@@ -990,10 +992,10 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
990
992
|
...opts.staged !== void 0 ? { staged: opts.staged } : {},
|
|
991
993
|
...opts.editFile !== void 0 ? { editFile: opts.editFile } : {}
|
|
992
994
|
};
|
|
993
|
-
const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-
|
|
995
|
+
const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
994
996
|
if (opts.dryRun || opts.json || opts.markdown || opts.out) {
|
|
995
997
|
if (opts.full) {
|
|
996
|
-
const { resolveFullWorkspaceCheckPlan } = await import("./commands-
|
|
998
|
+
const { resolveFullWorkspaceCheckPlan } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
997
999
|
await emitCheckPlan(await resolveFullWorkspaceCheckPlan(cwd), opts, cwd);
|
|
998
1000
|
return;
|
|
999
1001
|
}
|
|
@@ -1004,7 +1006,7 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
1004
1006
|
logger.success(localize("Checks finished.", "检查完成。"));
|
|
1005
1007
|
});
|
|
1006
1008
|
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 门禁")).action(async (opts) => {
|
|
1007
|
-
const { runDoctor } = await import("./commands-
|
|
1009
|
+
const { runDoctor } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
1008
1010
|
const report = await runDoctor(cwd);
|
|
1009
1011
|
await emitDoctorReport(report, opts, cwd);
|
|
1010
1012
|
if (opts.out || opts.json || opts.markdown) {
|
|
@@ -1027,7 +1029,7 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
1027
1029
|
logger.success(localize("Doctor finished.", "Doctor 诊断完成。"));
|
|
1028
1030
|
});
|
|
1029
1031
|
program.command("upgrade").description(localize("Synchronize standard repository assets and scripts", "同步仓库标准资产与脚本")).option("-i,--interactive", localize("Select managed files interactively", "交互式选择受管文件")).option("-c,--core", localize("Synchronize core configuration without GitHub assets", "仅同步核心配置,跳过 GitHub 相关资产")).option("--outDir <dir>", localize("Output directory", "输出目录")).option("-s,--skip-overwrite", localize("Preserve existing files", "保留已存在文件")).option("-y, --yes", localize("Skip prompts and overwrite drifted managed assets", "跳过交互并覆盖 drifted 标准资产")).option("--overwrite", localize("Overwrite drifted managed assets", "覆盖 drifted 标准资产")).option("--no-overwrite", localize("Preserve drifted managed assets", "不覆盖 drifted 标准资产")).option("--overwrite-release", localize("Overwrite an unmarked custom release workflow", "覆盖未标记的自定义 release workflow")).action(async (opts) => {
|
|
1030
|
-
const { upgradeMonorepo } = await import("./commands-
|
|
1032
|
+
const { upgradeMonorepo } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
1031
1033
|
await upgradeMonorepo(normalizeCliOpts(cwd, opts));
|
|
1032
1034
|
logger.success(localize("Upgrade finished.", "升级完成。"));
|
|
1033
1035
|
});
|
|
@@ -1037,22 +1039,22 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
1037
1039
|
function registerVerifyCommands(program, cwd) {
|
|
1038
1040
|
const verifyCommand = program.command("verify").alias("v").description(localize("Local verification commands", "本地校验工具集"));
|
|
1039
1041
|
verifyCommand.command("pre-push").description(localize("Run build, test, and tsd checks for pushed changes", "按推送变更范围执行 build/test/tsd 校验")).alias("push").action(async () => {
|
|
1040
|
-
const { verifyPrePush } = await import("./commands-
|
|
1042
|
+
const { verifyPrePush } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
1041
1043
|
await verifyPrePush({ cwd });
|
|
1042
1044
|
});
|
|
1043
1045
|
verifyCommand.command("pre-commit").description(localize("Run lint-staged verification", "执行 lint-staged 校验")).alias("commit").action(async () => {
|
|
1044
|
-
const { verifyPreCommit } = await import("./commands-
|
|
1046
|
+
const { verifyPreCommit } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
1045
1047
|
await verifyPreCommit({ cwd });
|
|
1046
1048
|
});
|
|
1047
1049
|
verifyCommand.command("commit-msg").description(localize("Run commitlint verification", "执行 commitlint 校验")).alias("msg").argument("<edit-file>").action(async (editFile) => {
|
|
1048
|
-
const { verifyCommitMsg } = await import("./commands-
|
|
1050
|
+
const { verifyCommitMsg } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
1049
1051
|
await verifyCommitMsg({
|
|
1050
1052
|
cwd,
|
|
1051
1053
|
editFile
|
|
1052
1054
|
});
|
|
1053
1055
|
});
|
|
1054
1056
|
verifyCommand.command("staged-typecheck").description(localize("Run typecheck in workspaces containing staged files", "按暂存文件所在 workspace 执行 typecheck")).alias("tc").argument("[files...]").action(async (files = []) => {
|
|
1055
|
-
const { verifyStagedTypecheck } = await import("./commands-
|
|
1057
|
+
const { verifyStagedTypecheck } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
1056
1058
|
verifyStagedTypecheck(files, { cwd });
|
|
1057
1059
|
});
|
|
1058
1060
|
}
|
|
@@ -1131,12 +1133,12 @@ async function emitWorkspaceList(result, opts) {
|
|
|
1131
1133
|
function registerWorkspaceCommands(program, cwd) {
|
|
1132
1134
|
const workspaceCommand = program.command("workspace").alias("ws").description(localize("Workspace commands", "工作区命令"));
|
|
1133
1135
|
workspaceCommand.command("upgrade").description(localize("Upgrade or synchronize monorepo packages", "升级/同步 monorepo 相关包")).alias("up").option("-i,--interactive", localize("Select managed files interactively", "交互式选择受管文件")).option("-c,--core", localize("Synchronize core configuration without GitHub assets", "仅同步核心配置,跳过 GitHub 相关资产")).option("--outDir <dir>", localize("Output directory", "输出目录")).option("-s,--skip-overwrite", localize("Preserve existing files", "保留已存在文件")).option("-y, --yes", localize("Skip prompts and overwrite drifted managed assets", "跳过交互并覆盖 drifted 标准资产")).option("--overwrite", localize("Overwrite drifted managed assets", "覆盖 drifted 标准资产")).option("--no-overwrite", localize("Preserve drifted managed assets", "不覆盖 drifted 标准资产")).option("--overwrite-release", localize("Overwrite an unmarked custom release workflow", "覆盖未标记的自定义 release workflow")).action(async (opts) => {
|
|
1134
|
-
const { upgradeMonorepo } = await import("./commands-
|
|
1136
|
+
const { upgradeMonorepo } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
1135
1137
|
await upgradeMonorepo(normalizeCliOpts(cwd, opts));
|
|
1136
1138
|
logger.success(localize("Workspace upgrade finished.", "Workspace 升级完成。"));
|
|
1137
1139
|
});
|
|
1138
1140
|
workspaceCommand.command("init").description(localize("Initialize workspace metadata and repository files", "初始化工作区元信息(README、package.json、pnpm intent、issue template)")).alias("i").action(async () => {
|
|
1139
|
-
const { initMetadata } = await import("./commands-
|
|
1141
|
+
const { initMetadata } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
1140
1142
|
await initMetadata(cwd);
|
|
1141
1143
|
logger.success(localize("Workspace initialization finished.", "Workspace 初始化完成。"));
|
|
1142
1144
|
});
|
|
@@ -1149,7 +1151,7 @@ function registerWorkspaceCommands(program, cwd) {
|
|
|
1149
1151
|
}), opts);
|
|
1150
1152
|
});
|
|
1151
1153
|
workspaceCommand.command("clean").description(localize("Remove selected workspace packages", "清除选中的包")).alias("rm").option("-y, --yes", localize("Skip prompts and clean immediately", "跳过交互直接清理(等价 autoConfirm)")).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) => {
|
|
1152
|
-
const { cleanProjects } = await import("./commands-
|
|
1154
|
+
const { cleanProjects } = await import("./commands-CDgRX9SA.mjs").then((n) => n.t);
|
|
1153
1155
|
await cleanProjects(cwd, normalizeCleanOptions(opts));
|
|
1154
1156
|
logger.success(localize("Workspace cleanup finished.", "Workspace 清理完成。"));
|
|
1155
1157
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
2
|
import { i as getWorkspacePackages, n as getWorkspaceData, r as getWorkspacePackageSummaries } from "./workspace-MCKewElu.mjs";
|
|
3
|
-
import { b as isIgnorableFsError, c as package_default$1, f as resolveRepoctlLocale, i as packageDir, l as version$1, m as logger, n as assetsDir, o as templatesDir, t as initToolingTargets, u as localize, y as fs$1 } from "./types-
|
|
3
|
+
import { b as isIgnorableFsError, c as package_default$1, f as resolveRepoctlLocale, i as packageDir, l as version$1, m as logger, n as assetsDir, o as templatesDir, t as initToolingTargets, u as localize, y as fs$1 } from "./types-B4jCdNd-.mjs";
|
|
4
4
|
import { a as loadMonorepoConfig, c as resolveToolingConfig, i as getRepoctlConfigCandidates, o as loadMonorepoConfigDetails, s as resolveCommandConfig } from "./config-p842Knhq.mjs";
|
|
5
5
|
import { f as defineTsconfigConfig } from "./tooling-BfXlmCi-.mjs";
|
|
6
6
|
import gitUrlParse from "git-url-parse";
|
|
@@ -2970,11 +2970,17 @@ var GitHubClient = class {
|
|
|
2970
2970
|
repository;
|
|
2971
2971
|
apiUrl;
|
|
2972
2972
|
requestFetch;
|
|
2973
|
+
retryAttempts;
|
|
2974
|
+
retryDelay;
|
|
2975
|
+
sleep;
|
|
2973
2976
|
constructor(options = {}) {
|
|
2974
2977
|
this.token = options.token ?? process.env["GITHUB_TOKEN"];
|
|
2975
2978
|
this.repository = options.repository ?? process.env["GITHUB_REPOSITORY"];
|
|
2976
2979
|
this.apiUrl = (options.apiUrl ?? process.env["GITHUB_API_URL"] ?? "https://api.github.com").replace(/\/$/, "");
|
|
2977
2980
|
this.requestFetch = options.fetch ?? globalThis.fetch;
|
|
2981
|
+
this.retryAttempts = Math.max(1, options.retryAttempts ?? 4);
|
|
2982
|
+
this.retryDelay = Math.max(0, options.retryDelay ?? 1e3);
|
|
2983
|
+
this.sleep = options.sleep ?? ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
2978
2984
|
}
|
|
2979
2985
|
getRepository() {
|
|
2980
2986
|
if (!this.token) throw new GitHubApiError("GITHUB_TOKEN is required for GitHub release orchestration", 0);
|
|
@@ -2983,36 +2989,56 @@ var GitHubClient = class {
|
|
|
2983
2989
|
}
|
|
2984
2990
|
async request(method, endpoint, body) {
|
|
2985
2991
|
const repository = this.getRepository();
|
|
2986
|
-
let
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
2992
|
+
for (let attempt = 1; attempt <= this.retryAttempts; attempt += 1) {
|
|
2993
|
+
let response;
|
|
2994
|
+
try {
|
|
2995
|
+
response = await this.requestFetch(`${this.apiUrl}/repos/${repository}${endpoint}`, {
|
|
2996
|
+
method,
|
|
2997
|
+
headers: {
|
|
2998
|
+
"Accept": "application/vnd.github+json",
|
|
2999
|
+
"Authorization": `Bearer ${this.token}`,
|
|
3000
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
3001
|
+
...body === void 0 ? {} : { "Content-Type": "application/json" }
|
|
3002
|
+
},
|
|
3003
|
+
...body === void 0 ? {} : { body: JSON.stringify(body) }
|
|
3004
|
+
});
|
|
3005
|
+
} catch (error) {
|
|
3006
|
+
if (attempt < this.retryAttempts) {
|
|
3007
|
+
await this.sleep(this.retryDelay * 2 ** (attempt - 1));
|
|
3008
|
+
continue;
|
|
3009
|
+
}
|
|
3010
|
+
throw new GitHubApiError(`GitHub API request ${method} ${endpoint} failed: ${error instanceof Error ? error.message : String(error)}. Check network access and GITHUB_API_URL.`, 0);
|
|
3011
|
+
}
|
|
3012
|
+
const text = await response.text();
|
|
3013
|
+
let data;
|
|
3014
|
+
if (text) try {
|
|
3015
|
+
data = JSON.parse(text);
|
|
3016
|
+
} catch {
|
|
3017
|
+
if (attempt < this.retryAttempts) {
|
|
3018
|
+
await this.sleep(this.retryDelay * 2 ** (attempt - 1));
|
|
3019
|
+
continue;
|
|
3020
|
+
}
|
|
3021
|
+
throw new GitHubApiError(`GitHub API returned invalid JSON for ${method} ${endpoint}`, response.status, text);
|
|
3022
|
+
}
|
|
3023
|
+
if (!response.ok) {
|
|
3024
|
+
const message = typeof data === "object" && data !== null && "message" in data ? String(data.message) : text || response.statusText;
|
|
3025
|
+
if ((response.status === 429 || response.status >= 500) && attempt < this.retryAttempts) {
|
|
3026
|
+
const retryAfter = response.headers.get("retry-after");
|
|
3027
|
+
const reset = response.headers.get("x-ratelimit-reset");
|
|
3028
|
+
const retrySeconds = retryAfter && /^\d+(?:\.\d+)?$/.test(retryAfter) ? Number(retryAfter) : retryAfter ? Math.max(0, (Date.parse(retryAfter) - Date.now()) / 1e3) : 0;
|
|
3029
|
+
const resetSeconds = reset && /^\d+$/.test(reset) ? Math.max(0, Number(reset) - Date.now() / 1e3) : 0;
|
|
3030
|
+
const delay = Math.max(this.retryDelay * 2 ** (attempt - 1), retrySeconds * 1e3, resetSeconds * 1e3);
|
|
3031
|
+
await this.sleep(delay);
|
|
3032
|
+
continue;
|
|
3033
|
+
}
|
|
3034
|
+
throw new GitHubApiError(`GitHub API ${method} ${endpoint} failed (${response.status}): ${message}`, response.status, text);
|
|
3035
|
+
}
|
|
3036
|
+
return {
|
|
3037
|
+
status: response.status,
|
|
3038
|
+
data
|
|
3039
|
+
};
|
|
3011
3040
|
}
|
|
3012
|
-
|
|
3013
|
-
status: response.status,
|
|
3014
|
-
data
|
|
3015
|
-
};
|
|
3041
|
+
throw new GitHubApiError(`GitHub API request ${method} ${endpoint} exhausted retries`, 0);
|
|
3016
3042
|
}
|
|
3017
3043
|
getRequest() {
|
|
3018
3044
|
return this.request.bind(this);
|
|
@@ -3045,7 +3071,21 @@ var GitHubClient = class {
|
|
|
3045
3071
|
if (!created.data) throw new GitHubApiError("GitHub did not return the created pull request", created.status);
|
|
3046
3072
|
return created.data;
|
|
3047
3073
|
} catch (error) {
|
|
3048
|
-
if (!(error instanceof GitHubApiError) ||
|
|
3074
|
+
if (!(error instanceof GitHubApiError) || ![
|
|
3075
|
+
0,
|
|
3076
|
+
429,
|
|
3077
|
+
500,
|
|
3078
|
+
502,
|
|
3079
|
+
503,
|
|
3080
|
+
504,
|
|
3081
|
+
505,
|
|
3082
|
+
506,
|
|
3083
|
+
507,
|
|
3084
|
+
508,
|
|
3085
|
+
509,
|
|
3086
|
+
510,
|
|
3087
|
+
511
|
|
3088
|
+
].includes(error.status) && error.status !== 422) throw error;
|
|
3049
3089
|
const recovered = await this.request("GET", `/pulls?${query.toString()}`);
|
|
3050
3090
|
if (recovered.data?.[0]) return recovered.data[0];
|
|
3051
3091
|
throw error;
|
|
@@ -3089,7 +3129,21 @@ var GitHubClient = class {
|
|
|
3089
3129
|
if (!created.data) throw new GitHubApiError("GitHub did not return the created release", created.status);
|
|
3090
3130
|
return created.data;
|
|
3091
3131
|
} catch (error) {
|
|
3092
|
-
if (!(error instanceof GitHubApiError) ||
|
|
3132
|
+
if (!(error instanceof GitHubApiError) || ![
|
|
3133
|
+
0,
|
|
3134
|
+
429,
|
|
3135
|
+
500,
|
|
3136
|
+
502,
|
|
3137
|
+
503,
|
|
3138
|
+
504,
|
|
3139
|
+
505,
|
|
3140
|
+
506,
|
|
3141
|
+
507,
|
|
3142
|
+
508,
|
|
3143
|
+
509,
|
|
3144
|
+
510,
|
|
3145
|
+
511
|
|
3146
|
+
].includes(error.status) && error.status !== 422) throw error;
|
|
3093
3147
|
const recovered = await this.request("GET", `/releases/tags/${encodeURIComponent(options.tag)}`);
|
|
3094
3148
|
if (!recovered.data) throw error;
|
|
3095
3149
|
return recovered.data;
|
|
@@ -3399,6 +3453,90 @@ async function exitPrerelease(options) {
|
|
|
3399
3453
|
await runLane("main", options);
|
|
3400
3454
|
}
|
|
3401
3455
|
//#endregion
|
|
3456
|
+
//#region src/commands/release/reconcile.ts
|
|
3457
|
+
function remoteTagExists$1(tag, options) {
|
|
3458
|
+
return (options.spawn ?? spawnSync)("git", [
|
|
3459
|
+
"ls-remote",
|
|
3460
|
+
"--exit-code",
|
|
3461
|
+
"--refs",
|
|
3462
|
+
"origin",
|
|
3463
|
+
`refs/tags/${tag}`
|
|
3464
|
+
], {
|
|
3465
|
+
cwd: options.cwd,
|
|
3466
|
+
encoding: "utf8",
|
|
3467
|
+
shell: false,
|
|
3468
|
+
stdio: "ignore"
|
|
3469
|
+
}).status === 0;
|
|
3470
|
+
}
|
|
3471
|
+
function resolveTarget$1(options) {
|
|
3472
|
+
return getReleaseEnv(options)["GITHUB_SHA"]?.trim() || capture("git", ["rev-parse", "HEAD"], options);
|
|
3473
|
+
}
|
|
3474
|
+
function isPublished(pkg, options) {
|
|
3475
|
+
const result = (options.spawn ?? spawnSync)("npm", [
|
|
3476
|
+
"view",
|
|
3477
|
+
`${pkg.name}@${pkg.version}`,
|
|
3478
|
+
"version"
|
|
3479
|
+
], {
|
|
3480
|
+
cwd: options.cwd,
|
|
3481
|
+
encoding: "utf8",
|
|
3482
|
+
shell: false,
|
|
3483
|
+
stdio: [
|
|
3484
|
+
"ignore",
|
|
3485
|
+
"pipe",
|
|
3486
|
+
"ignore"
|
|
3487
|
+
]
|
|
3488
|
+
});
|
|
3489
|
+
return result.status === 0 && String(result.stdout ?? "").trim() === pkg.version;
|
|
3490
|
+
}
|
|
3491
|
+
async function reconcileRelease(options) {
|
|
3492
|
+
const github = options.github ?? new GitHubClient();
|
|
3493
|
+
if (!github.listReleases || !github.ensureRelease) throw new Error("GitHub release reconcile requires listReleases and ensureRelease operations");
|
|
3494
|
+
const releases = await github.listReleases();
|
|
3495
|
+
const existing = new Map(releases.map((release) => [release.tag_name, release]));
|
|
3496
|
+
const packages = (await getWorkspacePackages(options.cwd)).flatMap(({ manifest }) => typeof manifest.name === "string" && typeof manifest.version === "string" ? [{
|
|
3497
|
+
name: manifest.name,
|
|
3498
|
+
version: manifest.version
|
|
3499
|
+
}] : []).filter((pkg) => (!options.packageName || pkg.name === options.packageName) && (!options.packageVersion || pkg.version === options.packageVersion)).filter((pkg) => isPublished(pkg, options));
|
|
3500
|
+
const env = getReleaseEnv(options);
|
|
3501
|
+
const metadata = {};
|
|
3502
|
+
if (env["GITHUB_REPOSITORY"]) metadata.repository = env["GITHUB_REPOSITORY"];
|
|
3503
|
+
if (env["GITHUB_SERVER_URL"]) metadata.serverUrl = env["GITHUB_SERVER_URL"];
|
|
3504
|
+
const document = await buildReleaseNoteDocument(options.cwd, void 0, metadata, new Set(packages.map((pkg) => pkg.name)));
|
|
3505
|
+
const repaired = [];
|
|
3506
|
+
const pending = [];
|
|
3507
|
+
for (const pkg of packages) {
|
|
3508
|
+
const tag = `${pkg.name}@${pkg.version}`;
|
|
3509
|
+
const release = existing.get(tag);
|
|
3510
|
+
const body = renderGitHubRelease({
|
|
3511
|
+
...document,
|
|
3512
|
+
packages: document.packages.filter((item) => item.name === pkg.name && item.version === pkg.version),
|
|
3513
|
+
entries: document.entries.filter((entry) => entry.packageName === pkg.name && entry.version === pkg.version),
|
|
3514
|
+
compareUrls: document.compareUrls.filter((url) => url.includes(encodeURIComponent(`${pkg.name}@`)))
|
|
3515
|
+
});
|
|
3516
|
+
const needsTag = !remoteTagExists$1(tag, options);
|
|
3517
|
+
const needsRelease = !release || release.name !== tag || release.body !== body;
|
|
3518
|
+
if (!needsTag && !needsRelease) continue;
|
|
3519
|
+
pending.push(tag);
|
|
3520
|
+
if (options.dryRun) continue;
|
|
3521
|
+
if (needsTag && github.ensureTag) await github.ensureTag({
|
|
3522
|
+
tag,
|
|
3523
|
+
target: resolveTarget$1(options)
|
|
3524
|
+
});
|
|
3525
|
+
await github.ensureRelease({
|
|
3526
|
+
tag,
|
|
3527
|
+
target: resolveTarget$1(options),
|
|
3528
|
+
name: tag,
|
|
3529
|
+
body
|
|
3530
|
+
});
|
|
3531
|
+
repaired.push(tag);
|
|
3532
|
+
}
|
|
3533
|
+
return {
|
|
3534
|
+
repaired,
|
|
3535
|
+
pending,
|
|
3536
|
+
skipped: packages.filter((pkg) => !pending.includes(`${pkg.name}@${pkg.version}`)).map((pkg) => `${pkg.name}@${pkg.version}`)
|
|
3537
|
+
};
|
|
3538
|
+
}
|
|
3539
|
+
//#endregion
|
|
3402
3540
|
//#region src/commands/release/stable.ts
|
|
3403
3541
|
async function prepareStable(options) {
|
|
3404
3542
|
const branch = resolveBranch(options);
|
|
@@ -3770,7 +3908,11 @@ async function releaseCi(options) {
|
|
|
3770
3908
|
return packages;
|
|
3771
3909
|
}
|
|
3772
3910
|
if (mode === "publish-unpublished") return recoverUnpublished(options);
|
|
3773
|
-
if (mode
|
|
3911
|
+
if (mode === "reconcile") return reconcileRelease({
|
|
3912
|
+
...options,
|
|
3913
|
+
dryRun: options.dryRun ?? getReleaseEnv(options)["REPO_RELEASE_DRY_RUN"] === "true"
|
|
3914
|
+
});
|
|
3915
|
+
if (mode !== "auto") throw new ReleaseCommandError(`unknown release CI mode ${mode}; expected auto, prepare, publish, publish-unpublished, or reconcile`);
|
|
3774
3916
|
const eventName = getReleaseEnv(options)["GITHUB_EVENT_NAME"]?.trim();
|
|
3775
3917
|
if (eventName && eventName !== "workflow_dispatch") {
|
|
3776
3918
|
if (!shouldRunRelease(await readReleaseTriggerContext(options))) {
|
|
@@ -3854,6 +3996,21 @@ function releaseMetadata(options) {
|
|
|
3854
3996
|
async function repairReleaseNotes(options) {
|
|
3855
3997
|
if (!options.all && !options.tag) throw new ReleaseCommandError("release notes repair requires --all or --tag <package@version>");
|
|
3856
3998
|
const github = options.github ?? new GitHubClient();
|
|
3999
|
+
if (options.createMissing) {
|
|
4000
|
+
if (!options.tag) throw new ReleaseCommandError("release notes repair --create-missing requires --tag <package@version>");
|
|
4001
|
+
const separator = options.tag.lastIndexOf("@");
|
|
4002
|
+
if (separator <= 0) throw new ReleaseCommandError(`invalid release tag ${options.tag}`);
|
|
4003
|
+
const result = await reconcileRelease({
|
|
4004
|
+
...options,
|
|
4005
|
+
packageName: options.tag.slice(0, separator),
|
|
4006
|
+
packageVersion: options.tag.slice(separator + 1),
|
|
4007
|
+
github
|
|
4008
|
+
});
|
|
4009
|
+
return {
|
|
4010
|
+
repaired: result.repaired,
|
|
4011
|
+
skipped: result.skipped
|
|
4012
|
+
};
|
|
4013
|
+
}
|
|
3857
4014
|
if (!github.listReleases || !github.updateRelease) throw new ReleaseCommandError("GitHub release repair requires listReleases and updateRelease operations");
|
|
3858
4015
|
const releases = await github.listReleases();
|
|
3859
4016
|
const selected = options.tag ? releases.filter((release) => release.tag_name === options.tag) : releases;
|
|
@@ -4643,6 +4800,7 @@ var commands_exports = /* @__PURE__ */ __exportAll({
|
|
|
4643
4800
|
parsePublishSummary: () => parsePublishSummary,
|
|
4644
4801
|
prepareStable: () => prepareStable,
|
|
4645
4802
|
publishStable: () => publishStable,
|
|
4803
|
+
reconcileRelease: () => reconcileRelease,
|
|
4646
4804
|
recoverUnpublished: () => recoverUnpublished,
|
|
4647
4805
|
releaseCi: () => releaseCi,
|
|
4648
4806
|
releasePrerelease: () => releasePrerelease,
|
|
@@ -4664,4 +4822,4 @@ var commands_exports = /* @__PURE__ */ __exportAll({
|
|
|
4664
4822
|
verifyStagedTypecheck: () => verifyStagedTypecheck
|
|
4665
4823
|
});
|
|
4666
4824
|
//#endregion
|
|
4667
|
-
export {
|
|
4825
|
+
export { verifyCommitMsg as $, defaultTemplate as A, escapeStringRegexp as B, createContext as C, collectEnvSupportBundle as D, collectEnvSnapshot as E, inspectMonorepoConfig as F, isGitignoreFile as G, setByPath as H, cleanProjects as I, updateIssueTemplateConfig as J, toPublishGitignorePath as K, getSkillTargetPaths as L, getTemplateMap as M, resolveCreateNewProjectPlan as N, runDoctor as O, templateMap as P, runRecommendedCheck as Q, skillTargets as R, normalizeInitToolingTargets as S, collectEnvPaths as T, getFileHash as U, isMatch as V, isFileChanged as W, resolveFullWorkspaceCheckPlan as X, getKnownRepoCheckCommands as Y, resolveRecommendedCheckPlan as Z, parsePublishSummary as _, createReleasePullRequest as a, generateAgenticTemplate as at, initMetadata as b, prepareStable as c, GitClient as ct, reconcileRelease as d, verifyPreCommit as et, enterPrerelease as f, GitHubClient as g, GitHubApiError as h, repairReleaseNotes as i, defaultAgenticBaseDir as it, getCreateChoices as j, createNewProject as k, publishStable as l, releasePrerelease as m, upgradeMonorepo as n, verifyStagedTypecheck as nt, recoverUnpublished as o, generateAgenticTemplates as ot, exitPrerelease as p, toWorkspaceGitignorePath as q, checkTemplates as r, createTimestampFolderName as rt, releaseCi as s, loadAgenticTasks as st, commands_exports as t, verifyPrePush as tt, releaseStable as u, setVscodeBinaryMirror as v, collectEnvInfo as w, initTooling as x, init as y, syncSkills as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { m as logger, u as localize, y as fs } from "./types-
|
|
1
|
+
import { A as defaultTemplate, N as resolveCreateNewProjectPlan, j as getCreateChoices, k as createNewProject } from "./commands-CDgRX9SA.mjs";
|
|
2
|
+
import { m as logger, u as localize, y as fs } from "./types-B4jCdNd-.mjs";
|
|
3
3
|
import { s as resolveCommandConfig } from "./config-p842Knhq.mjs";
|
|
4
4
|
import path from "pathe";
|
|
5
5
|
import process from "node:process";
|
package/dist/index.d.mts
CHANGED
|
@@ -300,6 +300,9 @@ interface GitHubClientOptions {
|
|
|
300
300
|
repository?: string;
|
|
301
301
|
apiUrl?: string;
|
|
302
302
|
fetch?: typeof fetch;
|
|
303
|
+
retryAttempts?: number;
|
|
304
|
+
retryDelay?: number;
|
|
305
|
+
sleep?: (milliseconds: number) => Promise<void>;
|
|
303
306
|
}
|
|
304
307
|
interface EnsurePullRequestOptions {
|
|
305
308
|
head: string;
|
|
@@ -355,6 +358,9 @@ export declare class GitHubClient implements GitHubOperations {
|
|
|
355
358
|
private readonly repository;
|
|
356
359
|
private readonly apiUrl;
|
|
357
360
|
private readonly requestFetch;
|
|
361
|
+
private readonly retryAttempts;
|
|
362
|
+
private readonly retryDelay;
|
|
363
|
+
private readonly sleep;
|
|
358
364
|
constructor(options?: GitHubClientOptions);
|
|
359
365
|
private getRepository;
|
|
360
366
|
private request;
|
|
@@ -370,7 +376,7 @@ export declare class GitHubClient implements GitHubOperations {
|
|
|
370
376
|
}
|
|
371
377
|
//#endregion
|
|
372
378
|
//#region src/commands/release/types.d.ts
|
|
373
|
-
type ReleaseMode = 'auto' | 'prepare' | 'publish' | 'publish-unpublished';
|
|
379
|
+
type ReleaseMode = 'auto' | 'prepare' | 'publish' | 'publish-unpublished' | 'reconcile';
|
|
374
380
|
interface ReleaseOptions {
|
|
375
381
|
cwd: string;
|
|
376
382
|
branch?: string;
|
|
@@ -384,6 +390,7 @@ interface ReleaseCiOptions extends ReleaseOptions {
|
|
|
384
390
|
mode?: ReleaseMode;
|
|
385
391
|
packageName?: string;
|
|
386
392
|
packageVersion?: string;
|
|
393
|
+
dryRun?: boolean;
|
|
387
394
|
github?: GitHubOperations;
|
|
388
395
|
}
|
|
389
396
|
interface PublishedPackage {
|
|
@@ -394,18 +401,36 @@ interface PublishedPackage {
|
|
|
394
401
|
//#region src/commands/release/ci.d.ts
|
|
395
402
|
declare function createReleasePullRequest(options: ReleaseCiOptions): Promise<boolean>;
|
|
396
403
|
declare function recoverUnpublished(options: ReleaseCiOptions): Promise<PublishedPackage[]>;
|
|
397
|
-
export declare function releaseCi(options: ReleaseCiOptions): Promise<PublishedPackage[] |
|
|
404
|
+
export declare function releaseCi(options: ReleaseCiOptions): Promise<PublishedPackage[] | {
|
|
405
|
+
repaired: string[];
|
|
406
|
+
pending: string[];
|
|
407
|
+
skipped: string[];
|
|
408
|
+
} | undefined>;
|
|
398
409
|
//#endregion
|
|
399
410
|
//#region src/commands/release/prerelease.d.ts
|
|
400
411
|
export declare function releasePrerelease(options: ReleaseOptions): Promise<PublishedPackage[] | undefined>;
|
|
401
412
|
export declare function enterPrerelease(tag: string, options: ReleaseOptions): Promise<void>;
|
|
402
413
|
export declare function exitPrerelease(options: ReleaseOptions): Promise<void>;
|
|
403
414
|
//#endregion
|
|
415
|
+
//#region src/commands/release/reconcile.d.ts
|
|
416
|
+
interface ReleaseReconcileOptions extends ReleaseOptions {
|
|
417
|
+
packageName?: string;
|
|
418
|
+
packageVersion?: string;
|
|
419
|
+
dryRun?: boolean;
|
|
420
|
+
github?: Pick<GitHubOperations, 'listReleases' | 'ensureRelease' | 'ensureTag' | 'enrichReleaseNote' | 'readReleasePullRequestContributors'>;
|
|
421
|
+
}
|
|
422
|
+
export declare function reconcileRelease(options: ReleaseReconcileOptions): Promise<{
|
|
423
|
+
repaired: string[];
|
|
424
|
+
pending: string[];
|
|
425
|
+
skipped: string[];
|
|
426
|
+
}>;
|
|
427
|
+
//#endregion
|
|
404
428
|
//#region src/commands/release/repair.d.ts
|
|
405
429
|
interface RepairReleaseNotesOptions extends ReleaseOptions {
|
|
406
430
|
tag?: string;
|
|
407
431
|
all?: boolean;
|
|
408
432
|
dryRun?: boolean;
|
|
433
|
+
createMissing?: boolean;
|
|
409
434
|
github?: Pick<GitHubOperations, 'listReleases' | 'updateRelease' | 'readReleasePullRequestContributors'>;
|
|
410
435
|
}
|
|
411
436
|
export declare function repairReleaseNotes(options: RepairReleaseNotesOptions): Promise<{
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as verifyCommitMsg, B as escapeStringRegexp, C as createContext, D as collectEnvSupportBundle, E as collectEnvSnapshot, F as inspectMonorepoConfig, G as isGitignoreFile, H as setByPath, I as cleanProjects, J as updateIssueTemplateConfig, K as toPublishGitignorePath, L as getSkillTargetPaths, M as getTemplateMap, N as resolveCreateNewProjectPlan, O as runDoctor, P as templateMap, Q as runRecommendedCheck, R as skillTargets, S as normalizeInitToolingTargets, T as collectEnvPaths, U as getFileHash, V as isMatch, W as isFileChanged, X as resolveFullWorkspaceCheckPlan, Y as getKnownRepoCheckCommands, Z as resolveRecommendedCheckPlan, _ as parsePublishSummary, a as createReleasePullRequest, at as generateAgenticTemplate, b as initMetadata, c as prepareStable, ct as GitClient, d as reconcileRelease, et as verifyPreCommit, f as enterPrerelease, g as GitHubClient, h as GitHubApiError, i as repairReleaseNotes, it as defaultAgenticBaseDir, j as getCreateChoices, k as createNewProject, l as publishStable, m as releasePrerelease, n as upgradeMonorepo, nt as verifyStagedTypecheck, o as recoverUnpublished, ot as generateAgenticTemplates, p as exitPrerelease, q as toWorkspaceGitignorePath, r as checkTemplates, rt as createTimestampFolderName, s as releaseCi, st as loadAgenticTasks, tt as verifyPrePush, u as releaseStable, v as setVscodeBinaryMirror, w as collectEnvInfo, x as initTooling, y as init, z as syncSkills } from "./commands-CDgRX9SA.mjs";
|
|
2
2
|
import { i as getWorkspacePackages, n as getWorkspaceData, r as getWorkspacePackageSummaries, t as clearWorkspaceCache } from "./workspace-MCKewElu.mjs";
|
|
3
|
-
import { C as outputJson, D as remove, E as readJson, O as writeJSON, S as outputJSON, T as readJSON, _ as ensureFile, a as rootDir, b as isIgnorableFsError, g as ensureDir, h as copy, i as packageDir, k as writeJson, l as version, m as logger, n as assetsDir, o as templatesDir, r as cliName, s as name, t as initToolingTargets, v as exists, w as pathExists, x as outputFile } from "./types-
|
|
3
|
+
import { C as outputJson, D as remove, E as readJson, O as writeJSON, S as outputJSON, T as readJSON, _ as ensureFile, a as rootDir, b as isIgnorableFsError, g as ensureDir, h as copy, i as packageDir, k as writeJson, l as version, m as logger, n as assetsDir, o as templatesDir, r as cliName, s as name, t as initToolingTargets, v as exists, w as pathExists, x as outputFile } from "./types-B4jCdNd-.mjs";
|
|
4
4
|
import { a as loadMonorepoConfig, c as resolveToolingConfig, i as getRepoctlConfigCandidates, o as loadMonorepoConfigDetails, r as defineMonorepoConfig, s as resolveCommandConfig, t as configExtensions } from "./config-p842Knhq.mjs";
|
|
5
5
|
import { a as createMonorepoTsconfig, c as defineCommitlintConfig, d as defineStylelintConfig, f as defineTsconfigConfig, h as loadMonorepoToolingConfig, i as createMonorepoStylelintConfig, l as defineEslintConfig, m as defineVitestProjectConfig, n as createMonorepoEslintConfig, o as createMonorepoVitestConfig, p as defineVitestConfig, r as createMonorepoLintStagedConfig, s as createMonorepoVitestProjectConfig, t as createMonorepoCommitlintConfig, u as defineLintStagedConfig } from "./tooling-BfXlmCi-.mjs";
|
|
6
|
-
export { GitClient, GitHubApiError, GitHubClient, assetsDir, checkTemplates, cleanProjects, clearWorkspaceCache, cliName, collectEnvInfo, collectEnvPaths, collectEnvSnapshot, collectEnvSupportBundle, configExtensions, copy, createContext, createMonorepoCommitlintConfig, createMonorepoEslintConfig, createMonorepoLintStagedConfig, createMonorepoStylelintConfig, createMonorepoTsconfig, createMonorepoVitestConfig, createMonorepoVitestProjectConfig, createNewProject, createReleasePullRequest, createTimestampFolderName, defaultAgenticBaseDir, defineCommitlintConfig, defineEslintConfig, defineLintStagedConfig, defineMonorepoConfig, defineStylelintConfig, defineTsconfigConfig, defineVitestConfig, defineVitestProjectConfig, ensureDir, ensureFile, enterPrerelease, escapeStringRegexp, exists, exitPrerelease, generateAgenticTemplate, generateAgenticTemplates, getCreateChoices, getFileHash, getKnownRepoCheckCommands, getRepoctlConfigCandidates, getSkillTargetPaths, getTemplateMap, getWorkspaceData, getWorkspacePackageSummaries, getWorkspacePackages, init, initMetadata, initTooling, initToolingTargets, inspectMonorepoConfig, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadAgenticTasks, loadMonorepoConfig, loadMonorepoConfigDetails, loadMonorepoToolingConfig, logger, normalizeInitToolingTargets, outputFile, outputJSON, outputJson, packageDir, name as packageName, parsePublishSummary, pathExists, prepareStable, publishStable, readJSON, readJson, recoverUnpublished, releaseCi, releasePrerelease, releaseStable, remove, repairReleaseNotes, resolveCommandConfig, resolveCreateNewProjectPlan, resolveFullWorkspaceCheckPlan, resolveRecommendedCheckPlan, resolveToolingConfig, rootDir, runDoctor, runRecommendedCheck, setByPath, setVscodeBinaryMirror, skillTargets, syncSkills, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath, updateIssueTemplateConfig, upgradeMonorepo, verifyCommitMsg, verifyPreCommit, verifyPrePush, verifyStagedTypecheck, version, writeJSON, writeJson };
|
|
6
|
+
export { GitClient, GitHubApiError, GitHubClient, assetsDir, checkTemplates, cleanProjects, clearWorkspaceCache, cliName, collectEnvInfo, collectEnvPaths, collectEnvSnapshot, collectEnvSupportBundle, configExtensions, copy, createContext, createMonorepoCommitlintConfig, createMonorepoEslintConfig, createMonorepoLintStagedConfig, createMonorepoStylelintConfig, createMonorepoTsconfig, createMonorepoVitestConfig, createMonorepoVitestProjectConfig, createNewProject, createReleasePullRequest, createTimestampFolderName, defaultAgenticBaseDir, defineCommitlintConfig, defineEslintConfig, defineLintStagedConfig, defineMonorepoConfig, defineStylelintConfig, defineTsconfigConfig, defineVitestConfig, defineVitestProjectConfig, ensureDir, ensureFile, enterPrerelease, escapeStringRegexp, exists, exitPrerelease, generateAgenticTemplate, generateAgenticTemplates, getCreateChoices, getFileHash, getKnownRepoCheckCommands, getRepoctlConfigCandidates, getSkillTargetPaths, getTemplateMap, getWorkspaceData, getWorkspacePackageSummaries, getWorkspacePackages, init, initMetadata, initTooling, initToolingTargets, inspectMonorepoConfig, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadAgenticTasks, loadMonorepoConfig, loadMonorepoConfigDetails, loadMonorepoToolingConfig, logger, normalizeInitToolingTargets, outputFile, outputJSON, outputJson, packageDir, name as packageName, parsePublishSummary, pathExists, prepareStable, publishStable, readJSON, readJson, reconcileRelease, recoverUnpublished, releaseCi, releasePrerelease, releaseStable, remove, repairReleaseNotes, resolveCommandConfig, resolveCreateNewProjectPlan, resolveFullWorkspaceCheckPlan, resolveRecommendedCheckPlan, resolveToolingConfig, rootDir, runDoctor, runRecommendedCheck, setByPath, setVscodeBinaryMirror, skillTargets, syncSkills, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath, updateIssueTemplateConfig, upgradeMonorepo, verifyCommitMsg, verifyPreCommit, verifyPrePush, verifyStagedTypecheck, version, writeJSON, writeJson };
|