@icebreakers/monorepo 6.4.0 → 6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/{baseline-BahTYIy-.mjs → baseline-CgvgNCUI.mjs} +3 -5
  2. package/dist/{bundle-B9vRch4R.mjs → bundle-BT26jZsH.mjs} +1 -2
  3. package/dist/{catalog-CXITrKhb.mjs → catalog-zafyCCYH.mjs} +11 -18
  4. package/dist/cli.mjs +141 -220
  5. package/dist/{commands-1ApnhvJF.mjs → commands-By0wXIqB.mjs} +371 -725
  6. package/dist/{config-BmK7bacv.mjs → config-CnB1hpD_.mjs} +4 -5
  7. package/dist/{create-flow-B2sFa_5j.mjs → create-flow-B6mkhe47.mjs} +6 -9
  8. package/dist/{deps-BbkQSTqk.mjs → deps-BJyokXyG.mjs} +6 -8
  9. package/dist/docs-context-entry.d.mts +0 -4
  10. package/dist/docs-context-entry.mjs +2 -4
  11. package/dist/{execute-0NGtp4hR.mjs → execute-By0DFwdk.mjs} +12 -22
  12. package/dist/{execute-BdnLU2-t.mjs → execute-dyUt94Dv.mjs} +4 -6
  13. package/dist/{format-BcU-hzT_.mjs → format-qyk-2EXc.mjs} +2 -3
  14. package/dist/{index-BBYRSLAi.d.mts → index-CyUOTGW4.d.mts} +1 -85
  15. package/dist/index.d.mts +3 -345
  16. package/dist/index.mjs +11 -13
  17. package/dist/{inputs-DCMUM9kz.mjs → inputs-D0jkn1xJ.mjs} +2 -3
  18. package/dist/{npm-DB-0FHcW.mjs → npm-BkilS3Rx.mjs} +2 -3
  19. package/dist/{plan-C47MSubl.mjs → plan-lepevajA.mjs} +2 -3
  20. package/dist/{rolldown-runtime-8H4AJuhK.mjs → rolldown-runtime-BJohB4LM.mjs} +1 -2
  21. package/dist/{run-5IdtzJJR.mjs → run-Coc92Trs.mjs} +6 -8
  22. package/dist/{save-cKCfFQrh.mjs → save-6C5t4ZGp.mjs} +4 -5
  23. package/dist/{scan-Diyd5MkZ.mjs → scan-DsiJldTw.mjs} +7 -12
  24. package/dist/{template-drift-C8gMh7d5.mjs → template-drift-DOG6iGjV.mjs} +60 -113
  25. package/dist/tooling-entry.d.mts +1 -1
  26. package/dist/tooling-entry.mjs +2 -2
  27. package/dist/{transaction-B33_Cacq.mjs → transaction-DWst6RWq.mjs} +6 -10
  28. package/dist/{tsconfig-B32VPzfD.mjs → tsconfig-KnvwNzkL.mjs} +36 -63
  29. package/dist/{vitest-HFe4zq1M.mjs → vitest-YHXyRHui.mjs} +6 -9
  30. package/dist/{workspace-tasks-xyIJwdmH.mjs → workspace-tasks-i69iIhom.mjs} +78 -157
  31. package/package.json +10 -10
@@ -1,12 +1,12 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { A as referenceTarget, B as saveKnipBaseline, C as loadCompiler, D as ownershipFile, E as exists$1, Gt as getWorkspacePackages, Ht as clearWorkspaceCache, I as getKnipConfigurationSuggestions, J as getWorkspaceGraph, Jt as GitClient, K as mergeText, M as formatEnvironmentCache, O as readText, P as checkEnvironmentCache, R as planKnipCheck, S as configReader, St as localize, T as compare$1, Tt as resolveRepoctlLocale, Ut as getWorkspaceData, W as analyzeTurboRuns, Wt as getWorkspacePackageSummaries, Z as getWorkspaceImpact, _ as planTemplateLink, _t as assetsDir$1, at as record$6, b as planGenerate, c as loadTemplateInstanceRegistry$1, ct as renderCreateNewProject, dt as migrateLegacyToolingReferences, et as compareGraphValues, f as recoverTemplateUpgrade, ft as setByPath, g as applyTemplateLinkPlan, gt as validateCleanTargets, h as loadTemplateUpgradeJournal, ht as isWithin, it as readInput, j as relativeFile, jt as fs$2, k as referencePath, l as rebuildTemplateInstanceBaseline, lt as rewriteTemplateSnapshotReferences, m as planTemplateUpgrade, mt as assertSafePath, nt as workspaceDependencyTypes, o as listTemplateInstances, ot as safeFile, p as applyTemplateUpgradePlan, pt as stageFileTransaction, q as withOperationLock, qt as findWorkspacePackages, rt as hash$1, s as loadTemplateBaseline$1, tt as resolveWorkspaceGraphNode, u as relocateTemplateInstance, w as validateGraph, x as generators, xt as templatesDir, y as applyGeneratePlan, yt as packageDir$1, z as runKnipCheck } from "./workspace-tasks-xyIJwdmH.mjs";
3
- import { a as resolveFullWorkspaceCheckPlan, c as verifyCommitMsg, d as logger, i as getKnownRepoCheckCommands, l as verifyPreCommit, n as resolveAffectedCheckContext, o as resolveRecommendedCheckPlan, r as resolveAffectedCheckPlan, s as runRecommendedCheck, t as runCheckWithReport, u as runPnpmCommand } from "./execute-0NGtp4hR.mjs";
4
- import { $ as commandConfigDirectory, A as package_default$1, B as templateSourcePath, C as checkedFile, D as relativeFile$1, E as readOptionalSource, G as presetPackageName, H as isUpgradeExpiry, I as normalizeTemplateRemoteSource, K as presetVersion, L as normalizeTemplateSourceRequest, N as ConfigValidationError, O as engines$1, S as canonicalDirectory, T as readOptional$1, U as defaultNightlyQualityTimeoutMs, W as resolveNightlyConfig, Y as isRecord$2, Z as appendConfigPath, _ as listToolingCapabilities, b as presetRelativePath, d as loadMonorepoConfig, f as loadMonorepoConfigDetails, g as presetAssetTarget, j as version$2, n as defineTsconfigConfig, p as resolveCommandConfig, q as withLegacyHookConfig, u as getRepoctlConfigCandidates, v as installedPresetDirectory, w as hash$2, x as readPresetFile, y as parsePresetJson, z as sourceRequestKey } from "./tsconfig-B32VPzfD.mjs";
5
- import { c as selectCommandOverrides, i as rangesOverlap, l as chinaMirrorsEnvs, o as matchGroup, r as parseSpecifier, s as resolveCommandValues, t as scanDependencies } from "./scan-Diyd5MkZ.mjs";
6
- import { A as isRootAsset, B as toWorkspaceAssetPath, C as lockfileRecord, D as baselineDirectory, E as checkDependencyAdmission, F as getWorkspacePatterns, I as summarizeChecks, L as legacyStagedConfigNames, M as templatePackage, N as getAssetTargets, O as baselinePath, P as record$7, S as inspectPnpmRuntime, a as applyDoctorSuppressions, b as resolveReleaseBranches, c as collectSelectedDoctorChecks, d as recommendedRepoScripts, f as inspectInstallSecurity, g as isLegacyReleaseWorkflow, h as supportedVersion, i as hasTemplateDriftIssues, j as parseBaseline, k as encodeBaseline, l as getDoctorRuleIds, m as settingState, o as validateDoctorSuppressions, p as readSecuritySources, r as formatTemplateDriftReport, s as validateDoctorConfiguration, t as checkTemplateDrift, u as selectDoctorRules, v as renderReleaseWorkflow, w as parseWorkspaceLockfile, x as ReleaseCommandError, y as releasePullRequestHead } from "./template-drift-C8gMh7d5.mjs";
7
- import { t as writeDependencyTransaction } from "./transaction-B33_Cacq.mjs";
8
- import { i as applyDependencyFixPlan, r as planDependencyFix, t as checkDependencies } from "./deps-BbkQSTqk.mjs";
9
- import { i as applyCatalogMigrationPlan, n as checkCatalogs, r as planCatalogMigration } from "./catalog-CXITrKhb.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-BJohB4LM.mjs";
2
+ import { A as referenceTarget, B as saveKnipBaseline, C as loadCompiler, D as ownershipFile, E as exists$1, Gt as getWorkspacePackages, Ht as clearWorkspaceCache, I as getKnipConfigurationSuggestions, J as getWorkspaceGraph, Jt as GitClient, K as mergeText, M as formatEnvironmentCache, O as readText, P as checkEnvironmentCache, R as planKnipCheck, S as configReader, St as localize, T as compare$1, Tt as resolveRepoctlLocale, Ut as getWorkspaceData, W as analyzeTurboRuns, Wt as getWorkspacePackageSummaries, Z as getWorkspaceImpact, _ as planTemplateLink, _t as assetsDir$1, at as record$6, b as planGenerate, c as loadTemplateInstanceRegistry$1, ct as renderCreateNewProject, dt as migrateLegacyToolingReferences, et as compareGraphValues, f as recoverTemplateUpgrade, ft as setByPath, g as applyTemplateLinkPlan, gt as validateCleanTargets, h as loadTemplateUpgradeJournal, ht as isWithin, it as readInput, j as relativeFile, jt as fs$2, k as referencePath, l as rebuildTemplateInstanceBaseline, lt as rewriteTemplateSnapshotReferences, m as planTemplateUpgrade, mt as assertSafePath, nt as workspaceDependencyTypes, o as listTemplateInstances, ot as safeFile, p as applyTemplateUpgradePlan, pt as stageFileTransaction, q as withOperationLock, qt as findWorkspacePackages, rt as hash$1, s as loadTemplateBaseline$1, tt as resolveWorkspaceGraphNode, u as relocateTemplateInstance, w as validateGraph, x as generators, xt as templatesDir, y as applyGeneratePlan, yt as packageDir$1, z as runKnipCheck } from "./workspace-tasks-i69iIhom.mjs";
3
+ import { a as resolveFullWorkspaceCheckPlan, c as verifyCommitMsg, d as logger, i as getKnownRepoCheckCommands, l as verifyPreCommit, n as resolveAffectedCheckContext, o as resolveRecommendedCheckPlan, r as resolveAffectedCheckPlan, s as runRecommendedCheck, t as runCheckWithReport, u as runPnpmCommand } from "./execute-By0DFwdk.mjs";
4
+ import { $ as commandConfigDirectory, A as package_default$1, B as templateSourcePath, C as checkedFile, D as relativeFile$1, E as readOptionalSource, G as presetPackageName, H as isUpgradeExpiry, I as normalizeTemplateRemoteSource, K as presetVersion, L as normalizeTemplateSourceRequest, N as ConfigValidationError, O as engines$1, S as canonicalDirectory, T as readOptional$1, U as defaultNightlyQualityTimeoutMs, W as resolveNightlyConfig, Y as isRecord$2, Z as appendConfigPath, _ as listToolingCapabilities, b as presetRelativePath, d as loadMonorepoConfig, f as loadMonorepoConfigDetails, g as presetAssetTarget, j as version$2, n as defineTsconfigConfig, p as resolveCommandConfig, q as withLegacyHookConfig, u as getRepoctlConfigCandidates, v as installedPresetDirectory, w as hash$2, x as readPresetFile, y as parsePresetJson, z as sourceRequestKey } from "./tsconfig-KnvwNzkL.mjs";
5
+ import { c as selectCommandOverrides, i as rangesOverlap, l as chinaMirrorsEnvs, o as matchGroup, r as parseSpecifier, s as resolveCommandValues, t as scanDependencies } from "./scan-DsiJldTw.mjs";
6
+ import { A as isRootAsset, B as toWorkspaceAssetPath, C as lockfileRecord, D as baselineDirectory, E as checkDependencyAdmission, F as getWorkspacePatterns, I as summarizeChecks, L as legacyStagedConfigNames, M as templatePackage, N as getAssetTargets, O as baselinePath, P as record$7, S as inspectPnpmRuntime, a as applyDoctorSuppressions, b as resolveReleaseBranches, c as collectSelectedDoctorChecks, d as recommendedRepoScripts, f as inspectInstallSecurity, g as isLegacyReleaseWorkflow, h as supportedVersion, i as hasTemplateDriftIssues, j as parseBaseline, k as encodeBaseline, l as getDoctorRuleIds, m as settingState, o as validateDoctorSuppressions, p as readSecuritySources, r as formatTemplateDriftReport, s as validateDoctorConfiguration, t as checkTemplateDrift, u as selectDoctorRules, v as renderReleaseWorkflow, w as parseWorkspaceLockfile, x as ReleaseCommandError, y as releasePullRequestHead } from "./template-drift-DOG6iGjV.mjs";
7
+ import { t as writeDependencyTransaction } from "./transaction-DWst6RWq.mjs";
8
+ import { i as applyDependencyFixPlan, r as planDependencyFix, t as checkDependencies } from "./deps-BJyokXyG.mjs";
9
+ import { i as applyCatalogMigrationPlan, n as checkCatalogs, r as planCatalogMigration } from "./catalog-zafyCCYH.mjs";
10
10
  import { createRequire, isBuiltin } from "node:module";
11
11
  import { findWorkspaceDir } from "@pnpm/find-workspace-dir";
12
12
  import { readWorkspaceManifest } from "@pnpm/workspace.read-manifest";
@@ -42,7 +42,7 @@ import * as yauzl from "yauzl";
42
42
  import { createPackageFromTarballData } from "@arethetypeswrong/core";
43
43
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
44
44
  import { build } from "esbuild";
45
- //#region src/commands/ai.ts
45
+ // src/commands/ai.ts
46
46
  const agenticSections = [
47
47
  ["Goal and deliverables", "目标与产物"],
48
48
  ["Constraints (performance, style, compatibility, and protected scope)", "约束(性能、风格、兼容性和不可改动范围)"],
@@ -111,8 +111,7 @@ async function generateAgenticTemplates(tasks, defaults = {}) {
111
111
  }
112
112
  return results;
113
113
  }
114
- //#endregion
115
- //#region src/commands/verify/pre-push/git.ts
114
+ // src/commands/verify/pre-push/git.ts
116
115
  const zeroSha = "0".repeat(40);
117
116
  const whitespacePattern = /\s+/;
118
117
  function getPushChangedFiles(stdin, cwd, execFile) {
@@ -156,8 +155,7 @@ async function readHookStdin() {
156
155
  }
157
156
  return output.trim();
158
157
  }
159
- //#endregion
160
- //#region src/commands/verify/pre-push/workspace.ts
158
+ // src/commands/verify/pre-push/workspace.ts
161
159
  async function resolvePrePushWorkspaces(cwd, workspaces) {
162
160
  if (workspaces === void 0) {
163
161
  clearWorkspaceCache();
@@ -191,8 +189,7 @@ function resolveWorkspaceDir(filePath, workspaces) {
191
189
  const normalized = filePath.split(path$1.sep).join("/");
192
190
  return workspaces.find((workspace) => normalized === workspace || normalized.startsWith(`${workspace}/`));
193
191
  }
194
- //#endregion
195
- //#region src/commands/verify/pre-push/index.ts
192
+ // src/commands/verify/pre-push/index.ts
196
193
  /**
197
194
  * 根据 push 范围校验改动所属的 pnpm workspace(含 private 包,不重复运行根包)。
198
195
  * 按包执行已有 build/test/tsd,根配置变更补跑根任务,始终执行根 lint/typecheck。
@@ -236,8 +233,7 @@ async function verifyPrePush(options = {}) {
236
233
  "tsd"
237
234
  ]) if (rootTasks.has(task)) runPnpmCommand(cwd, `[pre-push:${task}] .`, [task], spawn);
238
235
  }
239
- //#endregion
240
- //#region src/commands/verify/staged.ts
236
+ // src/commands/verify/staged.ts
241
237
  const typecheckExtensions = /* @__PURE__ */ new Set([
242
238
  ".ts",
243
239
  ".tsx",
@@ -317,8 +313,7 @@ function verifyStagedTypecheck(stagedFiles, options = {}) {
317
313
  ], spawn);
318
314
  }
319
315
  }
320
- //#endregion
321
- //#region src/commands/clean/discovery.ts
316
+ // src/commands/clean/discovery.ts
322
317
  /** Keep lexical package paths: resolving symlinks here would hide unsafe targets. */
323
318
  async function discoverCleanWorkspace(cwd) {
324
319
  const found = await findWorkspaceDir(cwd);
@@ -333,8 +328,7 @@ async function discoverCleanWorkspace(cwd) {
333
328
  })).filter((pkg) => pkg.rootDir !== workspaceDir)
334
329
  };
335
330
  }
336
- //#endregion
337
- //#region src/commands/clean/plan.ts
331
+ // src/commands/clean/plan.ts
338
332
  async function createCleanPlan(workspace, selected, config) {
339
333
  await validateCleanTargets(workspace, selected);
340
334
  const targets = [...new Set(selected)].sort();
@@ -383,8 +377,7 @@ async function createCleanPlan(workspace, selected, config) {
383
377
  }, void 0, 2)}\n` : original
384
378
  };
385
379
  }
386
- //#endregion
387
- //#region src/commands/clean/index.ts
380
+ // src/commands/clean/index.ts
388
381
  /** Remove only selected workspace directories; dry-run prints every resulting change. */
389
382
  async function cleanProjects(cwd, overrides) {
390
383
  const workspace = await discoverCleanWorkspace(cwd);
@@ -429,8 +422,7 @@ async function cleanProjects(cwd, overrides) {
429
422
  }
430
423
  logger.success(localize("Workspace cleanup finished.", "Workspace 清理完成。"));
431
424
  }
432
- //#endregion
433
- //#region src/core/config/inspection.ts
425
+ // src/core/config/inspection.ts
434
426
  const privatePaths = /* @__PURE__ */ new Set([
435
427
  "commands.mirror.env",
436
428
  "commands.upgrade.scripts",
@@ -511,8 +503,7 @@ async function validateConfigFile(cwd) {
511
503
  diagnostics
512
504
  };
513
505
  }
514
- //#endregion
515
- //#region src/core/presets/recommendations.ts
506
+ // src/core/presets/recommendations.ts
516
507
  /** Later preset recommendations replace an earlier reason for the same supported capability. */
517
508
  function presetRecommendations(layers) {
518
509
  const recommendations = /* @__PURE__ */ new Map();
@@ -527,8 +518,7 @@ function presetRecommendations(layers) {
527
518
  });
528
519
  return [...recommendations.values()];
529
520
  }
530
- //#endregion
531
- //#region src/commands/config.ts
521
+ // src/commands/config.ts
532
522
  async function inspectMonorepoConfig(cwd) {
533
523
  const { file, config, sources, sourceLayers, presets } = await loadMonorepoConfigDetails(cwd);
534
524
  return {
@@ -546,8 +536,7 @@ async function inspectMonorepoConfig(cwd) {
546
536
  } : {}
547
537
  };
548
538
  }
549
- //#endregion
550
- //#region src/core/file-transaction/state.ts
539
+ // src/core/file-transaction/state.ts
551
540
  async function ensureParent(directory, created) {
552
541
  try {
553
542
  const info = await lstat(directory, { bigint: true });
@@ -608,8 +597,7 @@ async function removeOwnedFile(root, file) {
608
597
  file.owned = false;
609
598
  }
610
599
  }
611
- //#endregion
612
- //#region src/core/file-transaction/write.ts
600
+ // src/core/file-transaction/write.ts
613
601
  async function rollback(root, staged) {
614
602
  const recovery = [];
615
603
  for (const item of [...staged].reverse()) {
@@ -724,8 +712,7 @@ async function writeFileTransaction(root, files, options = {}) {
724
712
  if (retained.length) throw new Error(`Upgrade applied; remove retained backups after review: ${retained.join(", ")}`);
725
713
  return new Map(staged.flatMap((item) => item.appliedIdentity ? [[item.file.path, item.appliedIdentity]] : []));
726
714
  }
727
- //#endregion
728
- //#region src/commands/create/workspace.ts
715
+ // src/commands/create/workspace.ts
729
716
  function inferWorkspacePattern(targetName) {
730
717
  const parts = targetName.split(path.sep).join("/").split("/").filter(Boolean);
731
718
  if (parts.length >= 2) return `${parts[0]}/*`;
@@ -754,8 +741,7 @@ async function updateWorkspaceManifest(workspaceDir, targetName) {
754
741
  const plan = await planWorkspaceManifest$1(workspaceDir, targetName);
755
742
  if (plan.after && !plan.after.equals(plan.before ?? Buffer.alloc(0))) await fs$2.outputFile(path.resolve(workspaceDir, "pnpm-workspace.yaml"), plan.after);
756
743
  }
757
- //#endregion
758
- //#region src/utils/github.ts
744
+ // src/utils/github.ts
759
745
  /**
760
746
  * 将 Issue 模版里的 discussions 链接同步为当前仓库的 discussions 地址。
761
747
  */
@@ -790,8 +776,7 @@ function updateIssueTemplateConfig(source, repoName) {
790
776
  if (!changed) return source;
791
777
  return doc.toString();
792
778
  }
793
- //#endregion
794
- //#region src/commands/create/parameters/prepare.ts
779
+ // src/commands/create/parameters/prepare.ts
795
780
  const preparedPlans = /* @__PURE__ */ new WeakMap();
796
781
  const planIdentities = /* @__PURE__ */ new WeakMap();
797
782
  async function attachCreateParameters(plan, values, prompt) {
@@ -836,8 +821,7 @@ function getPreparedCreateParameters(plan) {
836
821
  if (!prepared || prepared.fingerprint !== JSON.stringify(plan)) throw new Error("The parameterized creation plan changed or lost its private inputs. Resolve a fresh plan with the original parameter data before applying.");
837
822
  return prepared;
838
823
  }
839
- //#endregion
840
- //#region src/commands/create/parameters/stage.ts
824
+ // src/commands/create/parameters/stage.ts
841
825
  async function stageParameterizedProject(plan, prepared, target, gitMetadata) {
842
826
  const temporary = await mkdtemp(path.join(tmpdir(), "repoctl-template-parameters-"));
843
827
  const targetDir = path.join(temporary, target);
@@ -885,8 +869,7 @@ async function stageParameterizedProject(plan, prepared, target, gitMetadata) {
885
869
  });
886
870
  }
887
871
  }
888
- //#endregion
889
- //#region src/commands/create/parameters/apply.ts
872
+ // src/commands/create/parameters/apply.ts
890
873
  async function applyParameterizedProject(plan, gitMetadata) {
891
874
  const prepared = getPreparedCreateParameters(plan);
892
875
  const root = await canonicalDirectory(plan.cwd);
@@ -992,8 +975,7 @@ async function applyParameterizedProject(plan, gitMetadata) {
992
975
  committed: async () => {}
993
976
  });
994
977
  }
995
- //#endregion
996
- //#region src/core/presets/templates.ts
978
+ // src/core/presets/templates.ts
997
979
  /** Fixed package identities enter the existing remote template provider; catalog loading never fetches. */
998
980
  function presetTemplateDeclarations(layers) {
999
981
  return layers.flatMap((layer) => Object.entries(layer.manifest.templates ?? {}).map(([key, value]) => ({
@@ -1014,8 +996,7 @@ function presetTemplateDeclarations(layers) {
1014
996
  }
1015
997
  })));
1016
998
  }
1017
- //#endregion
1018
- //#region src/core/template-catalog/entries.ts
999
+ // src/core/template-catalog/entries.ts
1019
1000
  function record$5(value) {
1020
1001
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
1021
1002
  }
@@ -1129,8 +1110,7 @@ function resolveCatalogEntries(context, diagnostics) {
1129
1110
  }
1130
1111
  return entries;
1131
1112
  }
1132
- //#endregion
1133
- //#region src/core/template-catalog/choices.ts
1113
+ // src/core/template-catalog/choices.ts
1134
1114
  function resolveCatalogChoices(context, entries, diagnostics) {
1135
1115
  const { choices } = context.createConfig;
1136
1116
  const selected = /* @__PURE__ */ new Set();
@@ -1175,8 +1155,7 @@ function resolveCatalogChoices(context, entries, diagnostics) {
1175
1155
  ...entry.disabled !== void 0 ? { disabled: entry.disabled } : {}
1176
1156
  }));
1177
1157
  }
1178
- //#endregion
1179
- //#region src/core/template-catalog/config.ts
1158
+ // src/core/template-catalog/config.ts
1180
1159
  async function loadTemplateCatalogContext(options = {}) {
1181
1160
  const cwd = path.resolve(options.cwd ?? process.cwd());
1182
1161
  const workspaceDir = await findWorkspaceDir(cwd) ?? cwd;
@@ -1218,8 +1197,7 @@ async function loadTemplateCatalogContext(options = {}) {
1218
1197
  rawCreateConfigs: loaded.rawLayers.map((layer) => layer.commands?.create).filter((layer) => layer !== void 0)
1219
1198
  };
1220
1199
  }
1221
- //#endregion
1222
- //#region src/core/template-catalog/index.ts
1200
+ // src/core/template-catalog/index.ts
1223
1201
  function createTemplateCatalog(context) {
1224
1202
  const diagnostics = [...context.diagnostics ?? []];
1225
1203
  const blocked = diagnostics.some((diagnostic) => diagnostic.status === "fail");
@@ -1238,8 +1216,7 @@ function createTemplateCatalog(context) {
1238
1216
  async function resolveTemplateCatalog(options = {}) {
1239
1217
  return createTemplateCatalog(await loadTemplateCatalogContext(options));
1240
1218
  }
1241
- //#endregion
1242
- //#region src/core/template-source/archive.ts
1219
+ // src/core/template-source/archive.ts
1243
1220
  function digestBytes(bytes) {
1244
1221
  return createHash("sha256").update(bytes).digest("hex");
1245
1222
  }
@@ -1356,8 +1333,7 @@ async function extractTemplateArchive(archive, destination, prefix) {
1356
1333
  if (await hashAssetDirectory(destination) !== expected) throw new Error("Extracted template assets do not match the verified archive.");
1357
1334
  return expected;
1358
1335
  }
1359
- //#endregion
1360
- //#region src/core/template-source/cache.ts
1336
+ // src/core/template-source/cache.ts
1361
1337
  function resolvedIdentity(value, request) {
1362
1338
  const data = value;
1363
1339
  if (!data || typeof data["integrity"] !== "string") throw new Error("Invalid source integrity.");
@@ -1434,8 +1410,7 @@ async function withTemplateSourceLock(file, run) {
1434
1410
  if (current?.dev === identity.dev && current.ino === identity.ino) await unlink(file);
1435
1411
  }
1436
1412
  }
1437
- //#endregion
1438
- //#region src/core/process-environment/index.ts
1413
+ // src/core/process-environment/index.ts
1439
1414
  /** Prevent a disposable child workspace from rediscovering its caller's Git checkout. */
1440
1415
  function isolatedProcessEnvironment(ceiling, source = process.env) {
1441
1416
  const env = { ...source };
@@ -1450,8 +1425,7 @@ function isolatedProcessEnvironment(ceiling, source = process.env) {
1450
1425
  env["GIT_CEILING_DIRECTORIES"] = ceiling;
1451
1426
  return env;
1452
1427
  }
1453
- //#endregion
1454
- //#region src/core/template-source/git.ts
1428
+ // src/core/template-source/git.ts
1455
1429
  const run$1 = promisify(execFile);
1456
1430
  async function downloadGitTemplate(source, directory, timeout) {
1457
1431
  const repository = path$1.join(directory, "repository.git");
@@ -1537,13 +1511,12 @@ async function downloadGitTemplate(source, directory, timeout) {
1537
1511
  throw new Error("Git template download failed. Verify the repository and ref, network access and Git credential helper or SSH agent; no target files were created.");
1538
1512
  }
1539
1513
  }
1540
- //#endregion
1541
- //#region src/core/template-source/index.ts
1514
+ // src/core/template-source/index.ts
1542
1515
  /** Prepare verified assets only. Never installs dependencies, executes remote scripts or writes the target workspace. */
1543
1516
  async function resolveRemoteTemplateSource(source, templatePath = ".", options = {}) {
1544
1517
  const request = normalizeTemplateSourceRequest(source, templatePath);
1545
1518
  const cwd = path$1.resolve(options.cwd ?? process.cwd());
1546
- const npm = request.source.kind === "npm" ? await import("./npm-DB-0FHcW.mjs") : void 0;
1519
+ const npm = request.source.kind === "npm" ? await import("./npm-BkilS3Rx.mjs") : void 0;
1547
1520
  const configuration = request.source.kind === "npm" ? await npm.npmTemplateConfiguration(request.source, cwd) : void 0;
1548
1521
  if (request.source.kind === "npm") request.source.registry = configuration.registry;
1549
1522
  const cacheDir = path$1.resolve(cwd, options.cacheDir ?? path$1.join(process.env["XDG_CACHE_HOME"] ?? path$1.join(homedir(), ".cache"), "repoctl", "template-sources-v1"));
@@ -1610,8 +1583,7 @@ async function resolveRemoteTemplateSource(source, templatePath = ".", options =
1610
1583
  }
1611
1584
  });
1612
1585
  }
1613
- //#endregion
1614
- //#region src/core/template-catalog/definitions.ts
1586
+ // src/core/template-catalog/definitions.ts
1615
1587
  const legacyOrder = new Map([
1616
1588
  "tsdown",
1617
1589
  "vue-lib",
@@ -1645,8 +1617,7 @@ function getCreateChoices(choices) {
1645
1617
  ...choice.description ? { description: choice.description } : {}
1646
1618
  }));
1647
1619
  }
1648
- //#endregion
1649
- //#region src/commands/create/plan.ts
1620
+ // src/commands/create/plan.ts
1650
1621
  /**
1651
1622
  * `createNewProject()` 默认使用的模板类型。
1652
1623
  * @default 'tsdown'
@@ -1722,8 +1693,7 @@ function resolveCreateNewProjectPlan(options) {
1722
1693
  function resolveCreationPlan(options) {
1723
1694
  return resolvePlan(options, true);
1724
1695
  }
1725
- //#endregion
1726
- //#region src/commands/create/index.ts
1696
+ // src/commands/create/index.ts
1727
1697
  /** Shared generation path for creation and disposable author validation. */
1728
1698
  async function applyCreateNewProjectPlan(plan, includeGitMetadata = true) {
1729
1699
  const plannedSource = validateCreatePlan(plan);
@@ -1769,8 +1739,7 @@ async function createNewProject(options) {
1769
1739
  await applyCreateNewProjectPlan(plan);
1770
1740
  logger.success(localize(`${pc.bgGreenBright(pc.white(`[${plan.template}]`))} Created ${plan.targetName}.`, `${pc.bgGreenBright(pc.white(`[${plan.template}]`))} ${plan.targetName} 项目创建成功!`));
1771
1741
  }
1772
- //#endregion
1773
- //#region src/commands/doctor/manifest/discovery.ts
1742
+ // src/commands/doctor/manifest/discovery.ts
1774
1743
  async function discoverDoctorManifests(workspaceDir, patterns) {
1775
1744
  const files = await glob(patterns.map((pattern) => pattern.replace(/\/?$/, "/package.{json,yaml,json5}")), {
1776
1745
  cwd: workspaceDir,
@@ -1812,8 +1781,7 @@ async function discoverDoctorManifests(workspaceDir, patterns) {
1812
1781
  }
1813
1782
  return manifests.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
1814
1783
  }
1815
- //#endregion
1816
- //#region src/commands/doctor/context.ts
1784
+ // src/commands/doctor/context.ts
1817
1785
  function rootPackageJson(data = {}) {
1818
1786
  const stringMap = (value) => Object.fromEntries(Object.entries(record$7(value) ?? {}).filter((item) => typeof item[1] === "string"));
1819
1787
  return {
@@ -1892,8 +1860,7 @@ async function collectDoctorContext(cwd) {
1892
1860
  isSourceWorkspace: await isRepoctlSourceWorkspace(workspaceDir)
1893
1861
  };
1894
1862
  }
1895
- //#endregion
1896
- //#region src/commands/upgrade/plan/files.ts
1863
+ // src/commands/upgrade/plan/files.ts
1897
1864
  /** Schema-v1 plans and recovery journals previously classified this manifest as config. */
1898
1865
  function normalizeUpgradeInput(plan, input) {
1899
1866
  if (input.area === "config" && input.path === path.resolve(plan.assetDir, "../package.json")) return {
@@ -1913,8 +1880,7 @@ function readUpgradeInput(plan, location) {
1913
1880
  const root = input.area === "target" ? plan.rootDir : path.dirname(input.path);
1914
1881
  return readOptional$1(root, input.area === "config" ? path.basename(input.path) : input.path);
1915
1882
  }
1916
- //#endregion
1917
- //#region src/commands/upgrade/baseline/apply.ts
1883
+ // src/commands/upgrade/baseline/apply.ts
1918
1884
  const writesAsset = (file) => [
1919
1885
  "add",
1920
1886
  "modify",
@@ -1959,8 +1925,7 @@ function validateBaselineChange(file, plan) {
1959
1925
  const record = parseBaseline(content, change.path);
1960
1926
  if (!plan.inputs.some((input) => input.area === "asset" && input.path === record.source.assetPath && input.hash === record.source.hash)) throw new Error(`Missing baseline source precondition: ${file.path}`);
1961
1927
  }
1962
- //#endregion
1963
- //#region src/commands/upgrade/hooks/defaults.ts
1928
+ // src/commands/upgrade/hooks/defaults.ts
1964
1929
  const factoryHash = "8fc345beb5481e70f47f5dadf18f8afdb5ff3550d8f2677128aecac814c06680";
1965
1930
  const factoryPattern = /^function createLintStagedConfig\(monorepoCommand: string\) \{[\s\S]+?^\}/mu;
1966
1931
  const callPattern = /\blintStaged\s*:\s*\{\s*config\s*:\s*createLintStagedConfig\(['"]pnpm exec repoctl['"]\)\s*(?:,\s*)?\}\s*,?/u;
@@ -1973,8 +1938,7 @@ function removeDefaultStagedFactory(content) {
1973
1938
  const migrated = withoutCall.replace(factory, "");
1974
1939
  return withoutCall !== content && !/\bcreateLintStagedConfig\b/u.test(migrated) ? migrated : content;
1975
1940
  }
1976
- //#endregion
1977
- //#region src/commands/upgrade/hooks/inspect.ts
1941
+ // src/commands/upgrade/hooks/inspect.ts
1978
1942
  const defaultHookCommands = {
1979
1943
  "pre-commit": ["pnpm exec repo verify pre-commit", "pnpm exec lint-staged"],
1980
1944
  "commit-msg": ["pnpm exec repo verify commit-msg \"$1\"", "pnpm exec commitlint --edit \"$1\""],
@@ -2022,8 +1986,7 @@ async function inspectLegacyHooks(cwd, pkg) {
2022
1986
  config
2023
1987
  };
2024
1988
  }
2025
- //#endregion
2026
- //#region src/commands/upgrade/hooks/index.ts
1989
+ // src/commands/upgrade/hooks/index.ts
2027
1990
  const hookGroup = "lefthook-migration";
2028
1991
  const hookTargets = [
2029
1992
  "lefthook.yml",
@@ -2081,8 +2044,7 @@ async function prepareHooksUpgrade(context) {
2081
2044
  config: legacy.config
2082
2045
  };
2083
2046
  }
2084
- //#endregion
2085
- //#region src/commands/hooks/git.ts
2047
+ // src/commands/hooks/git.ts
2086
2048
  function runHookGit(cwd, env, args) {
2087
2049
  const result = spawnSync("git", args, {
2088
2050
  cwd,
@@ -2149,8 +2111,7 @@ function unsetOwnedHuskySetting(cwd, env, scope) {
2149
2111
  "core.hooksPath"
2150
2112
  ]).status !== 0) throw new Error("Could not remove the repository-local Husky hooks path.");
2151
2113
  }
2152
- //#endregion
2153
- //#region src/commands/upgrade/hooks/git.ts
2114
+ // src/commands/upgrade/hooks/git.ts
2154
2115
  /** Only remove this checkout's old Husky setting; never change global Git config. */
2155
2116
  function resetHuskyHooksPath(cwd) {
2156
2117
  const root = hookRepositoryRoot(cwd, process.env);
@@ -2171,14 +2132,12 @@ async function finishHooksUpgrade(cwd) {
2171
2132
  ].includes(error.code ?? "")) throw error;
2172
2133
  }
2173
2134
  }
2174
- //#endregion
2175
- //#region src/commands/upgrade/apply/transaction/index.ts
2135
+ // src/commands/upgrade/apply/transaction/index.ts
2176
2136
  /** Preserve reviewed migration recovery IDs at the shared transaction boundary. */
2177
2137
  async function writeUpgradeTransaction(root, files, id) {
2178
2138
  await writeFileTransaction(root, files, id === void 0 ? {} : { id });
2179
2139
  }
2180
- //#endregion
2181
- //#region src/commands/upgrade/migrations/record.ts
2140
+ // src/commands/upgrade/migrations/record.ts
2182
2141
  const ledgerPath = ".repoctl/migrations/ledger.json";
2183
2142
  const migrationGroup = "legacy-versioning";
2184
2143
  const emptyLedger = () => ({
@@ -2213,8 +2172,7 @@ function parseLedger$1(content) {
2213
2172
  else if (Object.values(ledger.entries).some((entry) => ledger.evaluatedVersion === null || gt(entry.toVersion, ledger.evaluatedVersion))) throw new Error("Completed migration exceeds the recorded evaluation cursor.");
2214
2173
  return ledger;
2215
2174
  }
2216
- //#endregion
2217
- //#region src/commands/upgrade/migrations/apply.ts
2175
+ // src/commands/upgrade/migrations/apply.ts
2218
2176
  function ledgerOperation(beforeHash, content) {
2219
2177
  return {
2220
2178
  path: ledgerPath,
@@ -2259,8 +2217,7 @@ async function applyMigrationFiles(plan, files) {
2259
2217
  throw error;
2260
2218
  }
2261
2219
  }
2262
- //#endregion
2263
- //#region src/commands/upgrade/apply/schema.ts
2220
+ // src/commands/upgrade/apply/schema.ts
2264
2221
  const digest$2 = (value) => value === null || typeof value === "string" && /^[\da-f]{64}$/.test(value);
2265
2222
  function validateUpgradePlanFiles(plan) {
2266
2223
  if (!plan || plan.schemaVersion !== 1 || plan.status !== "ready" || !Array.isArray(plan.files) || !Array.isArray(plan.inputs) || typeof plan.cwd !== "string" || typeof plan.rootDir !== "string" || typeof plan.assetDir !== "string" || !Array.isArray(plan.blockers) || plan.blockers.length || plan.files.some((file) => !file || typeof file !== "object") || plan.inputs.some((input) => !input || typeof input !== "object") || new Set(plan.files.map((file) => file.path)).size !== plan.files.length || new Set(plan.inputs.map((input) => `${input.area}:${input.path}`)).size !== plan.inputs.length) throw new Error("Invalid or blocked upgrade plan.");
@@ -2290,8 +2247,7 @@ function validateUpgradePlanFiles(plan) {
2290
2247
  }
2291
2248
  }
2292
2249
  }
2293
- //#endregion
2294
- //#region src/commands/upgrade/migrations/validate.ts
2250
+ // src/commands/upgrade/migrations/validate.ts
2295
2251
  function validateMigrationPlan(plan) {
2296
2252
  const migration = plan.migrations;
2297
2253
  if (!migration) return;
@@ -2338,8 +2294,7 @@ function validateMigrationPlan(plan) {
2338
2294
  if (!planned || planned.group !== "legacy-versioning" || planned.afterHash !== original.afterHash || planned.content !== null && hash$2(Buffer.from(planned.content, "base64")) !== original.afterHash) throw new Error(`Migration output changed since journal review: ${original.path}`);
2339
2295
  }
2340
2296
  }
2341
- //#endregion
2342
- //#region src/commands/upgrade/workspace/decisions.ts
2297
+ // src/commands/upgrade/workspace/decisions.ts
2343
2298
  /** Override values are strings. Include presence so absence and YAML null differ. */
2344
2299
  function overrideFingerprint(values, selector) {
2345
2300
  return hash$2(Buffer.from(JSON.stringify(Object.hasOwn(values, selector) ? {
@@ -2376,8 +2331,7 @@ function validateWorkspacePolicyExpiry(plan) {
2376
2331
  if (expires !== void 0 && (!isUpgradeExpiry(expires) || expires < today)) throw new Error(`Upgrade keep decision expired or invalid for ${file.path}; regenerate the plan.`);
2377
2332
  }
2378
2333
  }
2379
- //#endregion
2380
- //#region src/commands/upgrade/apply/validate.ts
2334
+ // src/commands/upgrade/apply/validate.ts
2381
2335
  const actionable = (file) => writesAsset(file) || Boolean(file.baseline);
2382
2336
  function blockedUpgradeGroups(plan) {
2383
2337
  return new Set(plan.files.filter((file) => file.group && ["conflict", "skip"].includes(file.status)).map((file) => file.group));
@@ -2387,8 +2341,7 @@ function validateUpgradePlan(plan) {
2387
2341
  validateMigrationPlan(plan);
2388
2342
  validateWorkspacePolicyExpiry(plan);
2389
2343
  }
2390
- //#endregion
2391
- //#region src/commands/upgrade/apply/index.ts
2344
+ // src/commands/upgrade/apply/index.ts
2392
2345
  /** Apply reviewed bytes only after all plan preconditions have been checked. */
2393
2346
  async function applyLocked$2(cwd, plan, options) {
2394
2347
  validateUpgradePlan(plan);
@@ -2463,8 +2416,7 @@ async function applyUpgradePlan(cwd, plan, options = {}) {
2463
2416
  await cleanDirectories(directories);
2464
2417
  }
2465
2418
  }
2466
- //#endregion
2467
- //#region src/commands/upgrade/migrations/recovery.ts
2419
+ // src/commands/upgrade/migrations/recovery.ts
2468
2420
  /** Resume exact reviewed bytes only; arbitrary intervening edits are never adopted. */
2469
2421
  async function planMigrationRecovery(context, attempt) {
2470
2422
  validateUpgradePlanFiles({
@@ -2531,8 +2483,7 @@ async function planMigrationRecovery(context, attempt) {
2531
2483
  state
2532
2484
  }));
2533
2485
  }
2534
- //#endregion
2535
- //#region src/commands/upgrade/workspace/merge.ts
2486
+ // src/commands/upgrade/workspace/merge.ts
2536
2487
  function isPlainObject(value) {
2537
2488
  return typeof value === "object" && value !== null && !Array.isArray(value);
2538
2489
  }
@@ -2595,8 +2546,7 @@ function mergeWorkspaceManifest(source, target) {
2595
2546
  }
2596
2547
  return result;
2597
2548
  }
2598
- //#endregion
2599
- //#region src/commands/upgrade/workspace/overrides.ts
2549
+ // src/commands/upgrade/workspace/overrides.ts
2600
2550
  /** Nested parent selectors need a resolved dependency graph; never guess their scope. */
2601
2551
  function parseSelector(selector) {
2602
2552
  const match = /^((?:@[\w.~-]+\/)?[\w.~-]+)(?:@(.+))?$/.exec(selector);
@@ -2671,8 +2621,7 @@ function inspectOverride(selector, upstream, local, scan) {
2671
2621
  }
2672
2622
  return finding;
2673
2623
  }
2674
- //#endregion
2675
- //#region src/commands/upgrade/workspace/plan.ts
2624
+ // src/commands/upgrade/workspace/plan.ts
2676
2625
  async function planWorkspaceManifest(context, upstream, local, deferUnverified = false) {
2677
2626
  const merged = mergeWorkspaceManifest(upstream, local);
2678
2627
  const sourceOverrides = record$6(upstream["overrides"]) ?? {};
@@ -2714,8 +2663,7 @@ async function planWorkspaceManifest(context, upstream, local, deferUnverified =
2714
2663
  policy
2715
2664
  };
2716
2665
  }
2717
- //#endregion
2718
- //#region src/commands/upgrade/plan/migration.ts
2666
+ // src/commands/upgrade/plan/migration.ts
2719
2667
  /** Plan both lane changes and legacy metadata removals before any asset is applied. */
2720
2668
  async function planVersioningMigration(context) {
2721
2669
  const { plan, read, put, options } = context;
@@ -2768,8 +2716,7 @@ async function planVersioningMigration(context) {
2768
2716
  if (config !== null) await put(".changeset/config.json", null, "legacy-config-removal", "Remove configuration that belongs to the replaced Changesets CLI.", { group });
2769
2717
  for (const file of plan.files) if (["package.json", ".github/workflows/release.yml"].includes(file.path) && ["add", "modify"].includes(file.status)) file.group = group;
2770
2718
  }
2771
- //#endregion
2772
- //#region src/commands/upgrade/migrations/registry.ts
2719
+ // src/commands/upgrade/migrations/registry.ts
2773
2720
  const migrationRegistry = [{
2774
2721
  id: "changesets-to-pnpm-versioning",
2775
2722
  version: "1.1.0",
@@ -2814,8 +2761,7 @@ const migrationRegistry = [{
2814
2761
  function selectMigrations(registry, from, to) {
2815
2762
  return [...registry].filter((item) => lte(item.version, to) && (from === null || gt(item.version, from))).sort((a, b) => compare(a.version, b.version) || a.id.localeCompare(b.id));
2816
2763
  }
2817
- //#endregion
2818
- //#region src/commands/upgrade/migrations/plan.ts
2764
+ // src/commands/upgrade/migrations/plan.ts
2819
2765
  function transition(ledger, steps, fromVersion, toVersion, status, attempt) {
2820
2766
  const entries = { ...ledger.entries };
2821
2767
  for (const step of steps.filter((step) => step.status === "pending" || step.status === "failed")) entries[step.id] = {
@@ -2949,8 +2895,7 @@ async function planMigrations(context, registry = migrationRegistry) {
2949
2895
  });
2950
2896
  } };
2951
2897
  }
2952
- //#endregion
2953
- //#region src/commands/upgrade/agents.ts
2898
+ // src/commands/upgrade/agents.ts
2954
2899
  const crlfPattern$1 = /\r\n/g;
2955
2900
  const h2HeadingPrefixPattern = /^##\s+/;
2956
2901
  function normalizeEol$1(input) {
@@ -3048,8 +2993,7 @@ function mergeAgentsMarkdown(source, target) {
3048
2993
  function isAgentsMarkdownEquivalent(left, right) {
3049
2994
  return normalizeComparableContent(left) === normalizeComparableContent(right);
3050
2995
  }
3051
- //#endregion
3052
- //#region src/core/presets/asset-plan/baseline.ts
2996
+ // src/core/presets/asset-plan/baseline.ts
3053
2997
  /** A separate provider record; never adopts or broadens repoctl's root baseline ownership. */
3054
2998
  const presetBaselinePath = (target) => `.repoctl/baselines/presets/${hash$2(Buffer.from(target))}.json`;
3055
2999
  function parsePresetBaseline(content, filename) {
@@ -3073,8 +3017,7 @@ function encodePresetBaseline(asset, source, content) {
3073
3017
  };
3074
3018
  return Buffer.from(`${JSON.stringify(record, null, 2)}\n`);
3075
3019
  }
3076
- //#endregion
3077
- //#region src/commands/upgrade/baseline/merge.ts
3020
+ // src/commands/upgrade/baseline/merge.ts
3078
3021
  /** Merge complete lines, retaining their original line endings and final newline. */
3079
3022
  function mergeRootAsset(base, local, upstream) {
3080
3023
  const { content, reason, conflicts } = mergeText(base, local, upstream);
@@ -3089,8 +3032,7 @@ function mergeRootAsset(base, local, upstream) {
3089
3032
  reason
3090
3033
  };
3091
3034
  }
3092
- //#endregion
3093
- //#region src/commands/upgrade/baseline/plan.ts
3035
+ // src/commands/upgrade/baseline/plan.ts
3094
3036
  /** Baseline planning never evaluates templates or reconstructs historical code. */
3095
3037
  async function createBaselinePlanner(context) {
3096
3038
  const { plan, read, put, options } = context;
@@ -3232,8 +3174,7 @@ const scriptsEntries = Object.entries({
3232
3174
  "repo:doctor": "repo doctor",
3233
3175
  "commitlint": "commitlint --edit"
3234
3176
  });
3235
- //#endregion
3236
- //#region src/commands/upgrade/pkg-json.ts
3177
+ // src/commands/upgrade/pkg-json.ts
3237
3178
  const NON_OVERRIDABLE_PREFIXES = ["workspace:", "catalog:"];
3238
3179
  function isCatalogSpecifier(version) {
3239
3180
  return version.startsWith("catalog:");
@@ -3323,8 +3264,7 @@ function setPkgJson(sourcePkgJson, targetPkgJson, options) {
3323
3264
  if (["husky", "husky install"].includes(targetPkgJson.scripts?.["prepare"] ?? "")) delete targetPkgJson.scripts?.["prepare"];
3324
3265
  }
3325
3266
  }
3326
- //#endregion
3327
- //#region src/commands/upgrade/text/index.ts
3267
+ // src/commands/upgrade/text/index.ts
3328
3268
  const crlfPattern = /\r\n/g;
3329
3269
  function normalizeEol(input) {
3330
3270
  return input.replace(crlfPattern, "\n");
@@ -3355,8 +3295,7 @@ function mergeGitignore(source, target) {
3355
3295
  }
3356
3296
  return `${result.join("\n")}\n`;
3357
3297
  }
3358
- //#endregion
3359
- //#region src/commands/upgrade/plan/assets.ts
3298
+ // src/commands/upgrade/plan/assets.ts
3360
3299
  async function planAssets(context) {
3361
3300
  const { plan, read, put, options, config } = context;
3362
3301
  const hooks = await prepareHooksUpgrade(context);
@@ -3481,8 +3420,7 @@ async function planAssets(context) {
3481
3420
  if (hooks.migrate) for (const file of plan.files.filter((file) => hookTargets.includes(file.path))) file.group = hookGroup;
3482
3421
  return baseline;
3483
3422
  }
3484
- //#endregion
3485
- //#region src/commands/upgrade/plan/diff.ts
3423
+ // src/commands/upgrade/plan/diff.ts
3486
3424
  function decodeText(content) {
3487
3425
  if (content?.includes(0)) return null;
3488
3426
  try {
@@ -3538,8 +3476,7 @@ function fileDiff(filename, before, after) {
3538
3476
  ].join("\n")
3539
3477
  };
3540
3478
  }
3541
- //#endregion
3542
- //#region src/commands/upgrade/plan/context.ts
3479
+ // src/commands/upgrade/plan/context.ts
3543
3480
  async function createContext$1(opts) {
3544
3481
  const cwd = await canonicalDirectory(path.resolve(opts.cwd ?? process.cwd()));
3545
3482
  const loaded = await loadMonorepoConfigDetails(cwd, { refresh: true });
@@ -3645,8 +3582,7 @@ async function createContext$1(opts) {
3645
3582
  conflict
3646
3583
  };
3647
3584
  }
3648
- //#endregion
3649
- //#region src/commands/upgrade/plan/index.ts
3585
+ // src/commands/upgrade/plan/index.ts
3650
3586
  /** Read-only: even asset preparation must be explicitly performed before previewing. */
3651
3587
  async function createUpgradePlan(options) {
3652
3588
  let plan = {
@@ -3693,8 +3629,7 @@ async function createUpgradePlan(options) {
3693
3629
  function planUpgrade(options = {}) {
3694
3630
  return withLegacyHookConfig(() => createUpgradePlan(options));
3695
3631
  }
3696
- //#endregion
3697
- //#region src/commands/doctor/fix/files.ts
3632
+ // src/commands/doctor/fix/files.ts
3698
3633
  async function readDoctorManifest(workspaceDir) {
3699
3634
  const bytes = await readFile(await safeFile(workspaceDir, "package.json"));
3700
3635
  try {
@@ -3706,8 +3641,7 @@ async function readDoctorManifest(workspaceDir) {
3706
3641
  throw new Error("Doctor cannot safely fix a package.json that is not valid UTF-8.");
3707
3642
  }
3708
3643
  }
3709
- //#endregion
3710
- //#region src/commands/doctor/fix/scripts.ts
3644
+ // src/commands/doctor/fix/scripts.ts
3711
3645
  /** Existing keys, including malformed/empty values, always remain user-owned. */
3712
3646
  function planMissingRootScripts(original) {
3713
3647
  let manifest;
@@ -3753,8 +3687,7 @@ function planMissingRootScripts(original) {
3753
3687
  notes
3754
3688
  };
3755
3689
  }
3756
- //#endregion
3757
- //#region src/commands/doctor/fix/index.ts
3690
+ // src/commands/doctor/fix/index.ts
3758
3691
  async function root(cwd) {
3759
3692
  return path.normalize(await realpath(await findWorkspaceDir(cwd) ?? cwd));
3760
3693
  }
@@ -3824,8 +3757,7 @@ async function applyDoctorFixPlan(cwd, plan) {
3824
3757
  const workspaceDir = await root(cwd);
3825
3758
  return withOperationLock(workspaceDir, "doctor-fix", () => applyLocked$1(workspaceDir, plan));
3826
3759
  }
3827
- //#endregion
3828
- //#region src/commands/doctor/index.ts
3760
+ // src/commands/doctor/index.ts
3829
3761
  async function collectDoctorReport(cwd, options) {
3830
3762
  if (!options || typeof options !== "object" || Array.isArray(options)) throw new Error("Doctor options must be an object.");
3831
3763
  if (options.rules !== void 0) selectDoctorRules(options.rules);
@@ -3853,8 +3785,7 @@ async function collectDoctorReport(cwd, options) {
3853
3785
  function runDoctor(cwd, options = {}) {
3854
3786
  return withLegacyHookConfig(() => collectDoctorReport(cwd, options));
3855
3787
  }
3856
- //#endregion
3857
- //#region src/commands/env.ts
3788
+ // src/commands/env.ts
3858
3789
  async function createEnvPathEntry(workspaceDir, targetPath) {
3859
3790
  return {
3860
3791
  path: targetPath,
@@ -3936,8 +3867,7 @@ async function collectEnvSupportBundle(cwd, now = /* @__PURE__ */ new Date()) {
3936
3867
  checkPlan: resolveRecommendedCheckPlan({ cwd })
3937
3868
  };
3938
3869
  }
3939
- //#endregion
3940
- //#region src/core/context.ts
3870
+ // src/core/context.ts
3941
3871
  /**
3942
3872
  * 构建命令执行上下文,封装常用的工作区、Git、配置等信息。
3943
3873
  */
@@ -3956,8 +3886,7 @@ async function createContext(cwd) {
3956
3886
  config: await loadMonorepoConfig(workspaceDir)
3957
3887
  };
3958
3888
  }
3959
- //#endregion
3960
- //#region src/core/runtime/node.ts
3889
+ // src/core/runtime/node.ts
3961
3890
  const supportedNodeRange = engines$1.node;
3962
3891
  const defaultNodeVersion = "24.22.1";
3963
3892
  const devContainerNodeVersions = [
@@ -3965,16 +3894,14 @@ const devContainerNodeVersions = [
3965
3894
  "22.23.4",
3966
3895
  "26.12.1"
3967
3896
  ];
3968
- //#endregion
3969
- //#region src/commands/init/setChangeset.ts
3897
+ // src/commands/init/setChangeset.ts
3970
3898
  /**
3971
3899
  * 保留兼容的初始化入口,并确保 pnpm change 有可写入的 intent 目录。
3972
3900
  */
3973
3901
  async function setChangeset_default(ctx) {
3974
3902
  if (await fs$2.exists(ctx.workspaceDir)) await fs$2.ensureDir(path.join(ctx.workspaceDir, ".changeset"));
3975
3903
  }
3976
- //#endregion
3977
- //#region src/commands/init/setIssueTemplateConfig.ts
3904
+ // src/commands/init/setIssueTemplateConfig.ts
3978
3905
  /**
3979
3906
  * 同步 Issue 模版里的 discussions 链接到当前仓库。
3980
3907
  */
@@ -3987,8 +3914,7 @@ async function setIssueTemplateConfig_default(ctx) {
3987
3914
  const next = updateIssueTemplateConfig(source, repoName);
3988
3915
  if (next !== source) await fs$2.writeFile(configPath, next, "utf8");
3989
3916
  }
3990
- //#endregion
3991
- //#region src/commands/init/setPkgJson.ts
3917
+ // src/commands/init/setPkgJson.ts
3992
3918
  /**
3993
3919
  * 根据当前仓库信息同步 package.json 的仓库、作者等字段。
3994
3920
  */
@@ -4011,8 +3937,7 @@ async function setPkgJson_default(ctx) {
4011
3937
  if (await fs$2.readFile(pkg.pkgJsonPath, "utf8") !== nextContent) await fs$2.writeFile(pkg.pkgJsonPath, nextContent, "utf8");
4012
3938
  }));
4013
3939
  }
4014
- //#endregion
4015
- //#region src/commands/init/setReadme.ts
3940
+ // src/commands/init/setReadme.ts
4016
3941
  async function getRows(ctx) {
4017
3942
  const { packages, gitUrl, gitUser, cwd } = ctx;
4018
3943
  const rows = [];
@@ -4059,8 +3984,7 @@ async function setReadme_default(ctx, options = {}) {
4059
3984
  const rows = await getRows(ctx);
4060
3985
  await fs$2.writeFile(readmePath, `${rows.join("\n")}\n`);
4061
3986
  }
4062
- //#endregion
4063
- //#region src/commands/init/tooling/build-approval.ts
3987
+ // src/commands/init/tooling/build-approval.ts
4064
3988
  async function ensureLefthookBuildApproval(cwd) {
4065
3989
  const workspacePath = path$1.join(cwd, "pnpm-workspace.yaml");
4066
3990
  const content = await fs$2.pathExists(workspacePath) ? await fs$2.readFile(workspacePath, "utf8") : "";
@@ -4072,14 +3996,13 @@ async function ensureLefthookBuildApproval(cwd) {
4072
3996
  }
4073
3997
  await fs$2.outputFile(workspacePath, YAML.stringify(merged, { singleQuote: true }));
4074
3998
  }
4075
- //#endregion
4076
- //#region ../../package.json
3999
+ // ../../package.json
4077
4000
  var package_default = {
4078
4001
  name: "repoctl-workspace",
4079
4002
  type: "module",
4080
4003
  version: "0.0.0",
4081
4004
  "private": true,
4082
- packageManager: "pnpm@12.14.0",
4005
+ packageManager: "pnpm@12.17.0",
4083
4006
  description: "Source workspace for repoctl and Icebreaker's shared development packages",
4084
4007
  author: "ice breaker <hi@sonofmagic.top>",
4085
4008
  license: "MIT",
@@ -4183,20 +4106,20 @@ var package_default = {
4183
4106
  "@icebreakers/eslint-config": "workspace:*",
4184
4107
  "@icebreakers/monorepo": "workspace:*",
4185
4108
  "@icebreakers/stylelint-config": "workspace:*",
4186
- "@types/node": "^26.6.5",
4109
+ "@types/node": "^26.6.6",
4187
4110
  "@vitest/coverage-v8": "~5.0.5",
4188
- "eslint": "^10.13.0",
4189
- "execa": "^10.2.0",
4111
+ "eslint": "^10.14.0",
4112
+ "execa": "^10.2.1",
4190
4113
  "lefthook": "2.2.2",
4191
4114
  "make-fetch-happen": "15.0.6",
4192
4115
  "only-allow": "^1.2.2",
4193
4116
  "playwright": "^1.64.1",
4194
4117
  "repoctl": "workspace:*",
4195
- "stylelint": "^17.16.0",
4118
+ "stylelint": "^18.0.0",
4196
4119
  "tailwindcss": "^4.3.3",
4197
4120
  "tsd": "^0.33.0",
4198
- "tsdown": "0.23.1",
4199
- "turbo": "^2.11.9",
4121
+ "tsdown": "0.23.4",
4122
+ "turbo": "^2.11.10",
4200
4123
  "typescript": "^6.0.3",
4201
4124
  "vitest": "~5.0.5",
4202
4125
  "yaml": "^2.9.1"
@@ -4206,8 +4129,7 @@ var package_default = {
4206
4129
  "registry": "https://registry.npmjs.org"
4207
4130
  }
4208
4131
  };
4209
- //#endregion
4210
- //#region src/commands/init/tooling/presets.ts
4132
+ // src/commands/init/tooling/presets.ts
4211
4133
  function isConcreteNpmSpecifier(version) {
4212
4134
  return !version.startsWith("catalog:") && !version.startsWith("workspace:");
4213
4135
  }
@@ -4315,8 +4237,7 @@ const initToolingPresets = {
4315
4237
  })
4316
4238
  }
4317
4239
  };
4318
- //#endregion
4319
- //#region src/commands/init/tooling/types.ts
4240
+ // src/commands/init/tooling/types.ts
4320
4241
  const initToolingTargets = [
4321
4242
  "commitlint",
4322
4243
  "eslint",
@@ -4325,8 +4246,7 @@ const initToolingTargets = [
4325
4246
  "tsconfig",
4326
4247
  "vitest"
4327
4248
  ];
4328
- //#endregion
4329
- //#region src/commands/init/tooling/index.ts
4249
+ // src/commands/init/tooling/index.ts
4330
4250
  function sortRecord(input) {
4331
4251
  return Object.fromEntries(Object.entries(input).filter((entry) => typeof entry[1] === "string" && entry[1].length > 0).sort(([left], [right]) => left.localeCompare(right)));
4332
4252
  }
@@ -4410,8 +4330,7 @@ async function initTooling(cwd, options = {}) {
4410
4330
  updatedPackageJson
4411
4331
  };
4412
4332
  }
4413
- //#endregion
4414
- //#region src/commands/init/index.ts
4333
+ // src/commands/init/index.ts
4415
4334
  const presetToolingMap = {
4416
4335
  minimal: ["tsconfig"],
4417
4336
  standard: [...initToolingTargets]
@@ -4496,8 +4415,7 @@ async function init(cwd, options = {}) {
4496
4415
  ...options.all !== void 0 ? { all: options.all } : {}
4497
4416
  });
4498
4417
  }
4499
- //#endregion
4500
- //#region src/commands/mirror/utils.ts
4418
+ // src/commands/mirror/utils.ts
4501
4419
  /**
4502
4420
  * 在 vscode 里面设置镜像下载地址的环境变量,避免下载缓慢
4503
4421
  */
@@ -4510,8 +4428,7 @@ function setMirror(obj, envs = chinaMirrorsEnvs) {
4510
4428
  const prefix = "terminal.integrated.env";
4511
4429
  if (typeof obj === "object" && obj) for (const platform of platforms) setByPath(obj, [prefix, platform].join(".").replaceAll(".", "\\."), envs);
4512
4430
  }
4513
- //#endregion
4514
- //#region src/commands/mirror/binaryMirror.ts
4431
+ // src/commands/mirror/binaryMirror.ts
4515
4432
  /**
4516
4433
  * 根据中国大陆镜像源,自动向 VSCode settings.json 注入终端环境变量。
4517
4434
  */
@@ -4524,8 +4441,7 @@ async function setVscodeBinaryMirror(cwd) {
4524
4441
  json && typeof json === "object" && setMirror(json, env);
4525
4442
  await fs$2.writeFile(targetJsonPath, `${stringify$1(json, void 0, 2)}\n`, "utf8");
4526
4443
  }
4527
- //#endregion
4528
- //#region src/commands/release/snapshot/prepared/github/client.ts
4444
+ // src/commands/release/snapshot/prepared/github/client.ts
4529
4445
  function record$4(value, label = "GitHub response") {
4530
4446
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`Invalid ${label}.`);
4531
4447
  return value;
@@ -4629,8 +4545,7 @@ function createSnapshotGitHub(options) {
4629
4545
  list
4630
4546
  };
4631
4547
  }
4632
- //#endregion
4633
- //#region src/commands/release/auto-changeset/github/client.ts
4548
+ // src/commands/release/auto-changeset/github/client.ts
4634
4549
  function record$3(value, label = "GitHub response") {
4635
4550
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`Invalid ${label}.`);
4636
4551
  return value;
@@ -4724,8 +4639,7 @@ function createGitHub(options) {
4724
4639
  graphql
4725
4640
  };
4726
4641
  }
4727
- //#endregion
4728
- //#region src/commands/release/auto-changeset/github/tree.ts
4642
+ // src/commands/release/auto-changeset/github/tree.ts
4729
4643
  async function readFiles$1(client, revision) {
4730
4644
  const files = await client.list(`/pulls/${revision.pullRequest}/files`, void 0, 31);
4731
4645
  if (files.length !== revision.changedFiles || new Set(files.map((file) => file["filename"])).size !== files.length) throw new Error("Pull request file pagination is incomplete or contains duplicates.");
@@ -4781,8 +4695,7 @@ async function readBlob$1(client, entry) {
4781
4695
  if (bytes.length !== blob["size"] || bytes.toString("base64") !== encoded || hash !== entry.sha) throw new Error(`Metadata blob integrity mismatch: ${entry.path}.`);
4782
4696
  return bytes.toString("utf8");
4783
4697
  }
4784
- //#endregion
4785
- //#region src/commands/release/auto-changeset/github/revision.ts
4698
+ // src/commands/release/auto-changeset/github/revision.ts
4786
4699
  function branch$1(value) {
4787
4700
  const result = textValue(value, "Git branch");
4788
4701
  if (/^[/-]|[~^:?*[\\\s]|\.\.|@\{|\/$|\.$|\.lock(?:\/|$)|\/\//u.test(result)) throw new Error("Invalid Git branch.");
@@ -4844,8 +4757,7 @@ function canonical(value) {
4844
4757
  function assertRevision(actual, expected) {
4845
4758
  if (canonical(actual) !== canonical(expected)) throw new Error("Frozen auto changeset revision is stale; plan again and obtain a fresh approval.");
4846
4759
  }
4847
- //#endregion
4848
- //#region src/commands/release/auto-changeset/policy/schema.ts
4760
+ // src/commands/release/auto-changeset/policy/schema.ts
4849
4761
  const levels = [
4850
4762
  "patch",
4851
4763
  "minor",
@@ -4948,8 +4860,7 @@ async function readPolicy(client, revision, options) {
4948
4860
  })).digest("hex")
4949
4861
  };
4950
4862
  }
4951
- //#endregion
4952
- //#region src/commands/release/auto-changeset/workflow.ts
4863
+ // src/commands/release/auto-changeset/workflow.ts
4953
4864
  function workflowConfiguration(options = {}) {
4954
4865
  const configuration = {
4955
4866
  environment: options.environment ?? "release-intent-write",
@@ -4981,8 +4892,7 @@ async function getAutoChangesetWorkflow(options = {}) {
4981
4892
  };
4982
4893
  return template.replace(/__[A-Z_]+__/gu, (key) => values[key] ?? key);
4983
4894
  }
4984
- //#endregion
4985
- //#region src/commands/release/auto-changeset/approval.ts
4895
+ // src/commands/release/auto-changeset/approval.ts
4986
4896
  function timestamp(value) {
4987
4897
  if (typeof value !== "string" || !Number.isFinite(Date.parse(value))) throw new TypeError("Missing GitHub job execution timestamp.");
4988
4898
  return Date.parse(value);
@@ -5023,8 +4933,7 @@ async function verifyApproval(client, revision, options) {
5023
4933
  const apply = job(configuration.applyJobName);
5024
4934
  if (plan["status"] !== "completed" || plan["conclusion"] !== "success" || apply["status"] !== "in_progress" || timestamp(plan["started_at"]) > timestamp(plan["completed_at"]) || timestamp(plan["completed_at"]) > timestamp(apply["started_at"])) throw new Error("A successful current-attempt plan must precede the protected application job.");
5025
4935
  }
5026
- //#endregion
5027
- //#region src/commands/release/intents/index.ts
4936
+ // src/commands/release/intents/index.ts
5028
4937
  function isIntentConsumed(ledger, intentId, name, dir, lane) {
5029
4938
  return Object.entries(ledger).some(([key, entry]) => (entry.dir ? entry.dir.replace(/^\.\//, "") === dir : key.slice(0, key.lastIndexOf("@")) === name) && entry.intents.includes(intentId) && (lane && lane !== "main" || !semver.prerelease(key.slice(key.lastIndexOf("@") + 1))));
5030
4939
  }
@@ -5102,8 +5011,7 @@ async function readPendingIntents(cwd) {
5102
5011
  }
5103
5012
  return pending;
5104
5013
  }
5105
- //#endregion
5106
- //#region src/commands/release/auto-changeset/manual.ts
5014
+ // src/commands/release/auto-changeset/manual.ts
5107
5015
  async function manualIntents(client, files, tree, packages, ownPath) {
5108
5016
  const manual = [];
5109
5017
  for (const file of files) {
@@ -5116,8 +5024,7 @@ async function manualIntents(client, files, tree, packages, ownPath) {
5116
5024
  }
5117
5025
  return manual;
5118
5026
  }
5119
- //#endregion
5120
- //#region src/commands/release/auto-changeset/selection.ts
5027
+ // src/commands/release/auto-changeset/selection.ts
5121
5028
  const priorities = {
5122
5029
  patch: 0,
5123
5030
  minor: 1,
@@ -5209,8 +5116,7 @@ function selectPackages$1(files, head, base, policy, level) {
5209
5116
  }
5210
5117
  return [...selections.values()].filter((pkg) => !head.find((item) => item.name === pkg.name).private).sort((a, b) => a.name.localeCompare(b.name));
5211
5118
  }
5212
- //#endregion
5213
- //#region src/commands/release/auto-changeset/ownership.ts
5119
+ // src/commands/release/auto-changeset/ownership.ts
5214
5120
  function managedPath(pullRequest) {
5215
5121
  return `.changeset/auto-pr-${pullRequest}.md`;
5216
5122
  }
@@ -5235,8 +5141,7 @@ function renderChangeset(packages, policy, revision) {
5235
5141
  const digest = createHash("sha256").update(body).digest("hex");
5236
5142
  return `${body}\n<!-- repoctl:auto-changeset:v1 ${revision.repository} ${revision.pullRequest} ${digest} -->\n`;
5237
5143
  }
5238
- //#endregion
5239
- //#region src/commands/package-check/dependencies.ts
5144
+ // src/commands/package-check/dependencies.ts
5240
5145
  function namedSpec(spec) {
5241
5146
  const match = /^(@[^/]+\/[^@]+|[^@/]+)@(.+)$/u.exec(spec);
5242
5147
  return match ? {
@@ -5285,8 +5190,7 @@ function dependencyReferences(manifest, directory, includeDev = false) {
5285
5190
  }
5286
5191
  return references;
5287
5192
  }
5288
- //#endregion
5289
- //#region src/commands/release/auto-changeset/workspace.ts
5193
+ // src/commands/release/auto-changeset/workspace.ts
5290
5194
  const fields = [
5291
5195
  "dependencies",
5292
5196
  "optionalDependencies",
@@ -5381,8 +5285,7 @@ async function discoverPackages(client, tree) {
5381
5285
  });
5382
5286
  }
5383
5287
  }
5384
- //#endregion
5385
- //#region src/commands/release/auto-changeset/plan.ts
5288
+ // src/commands/release/auto-changeset/plan.ts
5386
5289
  async function planAutoChangeset(options, expected) {
5387
5290
  const client = createGitHub(options);
5388
5291
  const initial = await readRevision(client, options);
@@ -5467,8 +5370,7 @@ async function planAutoChangeset(options, expected) {
5467
5370
  async function createAutoChangesetPlan(options) {
5468
5371
  return (await planAutoChangeset(options)).report;
5469
5372
  }
5470
- //#endregion
5471
- //#region src/commands/release/auto-changeset/apply.ts
5373
+ // src/commands/release/auto-changeset/apply.ts
5472
5374
  const mutation = `mutation CreateAutoChangesetCommit($input: CreateCommitOnBranchInput!) {
5473
5375
  createCommitOnBranch(input: $input) { commit { oid } }
5474
5376
  }`;
@@ -5506,8 +5408,7 @@ async function applyAutoChangeset(options) {
5506
5408
  commitSha
5507
5409
  };
5508
5410
  }
5509
- //#endregion
5510
- //#region src/commands/release/notes/model.ts
5411
+ // src/commands/release/notes/model.ts
5511
5412
  const categoryOrder = [
5512
5413
  "breaking",
5513
5414
  "features",
@@ -5623,8 +5524,7 @@ function buildPackageCompareUrl(release, metadata) {
5623
5524
  function buildNpmPackageUrl(name, version) {
5624
5525
  return `https://www.npmjs.com/package/${name.startsWith("@") ? name : encodeURIComponent(name)}/v/${encodeURIComponent(version)}`;
5625
5526
  }
5626
- //#endregion
5627
- //#region src/commands/release/notes/entries.ts
5527
+ // src/commands/release/notes/entries.ts
5628
5528
  function parseReferences(commits, content) {
5629
5529
  const pullRequests = /* @__PURE__ */ new Set();
5630
5530
  const issues = /* @__PURE__ */ new Set();
@@ -5796,8 +5696,7 @@ function buildEntries(release, commits) {
5796
5696
  }];
5797
5697
  });
5798
5698
  }
5799
- //#endregion
5800
- //#region src/commands/release/notes/render.ts
5699
+ // src/commands/release/notes/render.ts
5801
5700
  function isChinese(metadata) {
5802
5701
  return (metadata.locale ?? resolveRepoctlLocale()) === "zh-CN";
5803
5702
  }
@@ -5888,8 +5787,7 @@ function renderGitHubRelease(document, metadata = {}) {
5888
5787
  if (document.compareUrls.length) sections.push("", `##### [${localized(metadata, "View changes on GitHub", "在 GitHub 查看变更")}](${document.compareUrls[0]})`);
5889
5788
  return sections.join("\n");
5890
5789
  }
5891
- //#endregion
5892
- //#region src/commands/release/shared.ts
5790
+ // src/commands/release/shared.ts
5893
5791
  function getReleaseEnv(options) {
5894
5792
  return options.env ?? process.env;
5895
5793
  }
@@ -6013,8 +5911,7 @@ async function readPublishSummary(cwd) {
6013
5911
  return [];
6014
5912
  }
6015
5913
  }
6016
- //#endregion
6017
- //#region src/commands/release/body.ts
5914
+ // src/commands/release/body.ts
6018
5915
  async function readPackageRelease(name, version, rootDir) {
6019
5916
  let changelog;
6020
5917
  try {
@@ -6155,8 +6052,7 @@ function buildGitHubReleaseBodyFromChangelog(packageName, packageVersion, change
6155
6052
  content: section.content ?? ""
6156
6053
  }], metadata), metadata);
6157
6054
  }
6158
- //#endregion
6159
- //#region src/commands/release/lines/index.ts
6055
+ // src/commands/release/lines/index.ts
6160
6056
  async function readReleaseBranches(options) {
6161
6057
  const config = options.config ?? await resolveCommandConfig("release", options.cwd);
6162
6058
  return resolveReleaseBranches(config?.branches);
@@ -6186,8 +6082,7 @@ async function resolveStableReleaseBranch(options, operation) {
6186
6082
  if (!selected) throw new ReleaseCommandError(`repo release stable ${operation} is only allowed on ${stable.map((rule) => rule.branch).join(", ")}, got ${name}`);
6187
6083
  return selected;
6188
6084
  }
6189
- //#endregion
6190
- //#region src/commands/release/snapshot/process.ts
6085
+ // src/commands/release/snapshot/process.ts
6191
6086
  function isolatedSnapshotEnvironment(options, directory) {
6192
6087
  const env = { ...options.env ?? process.env };
6193
6088
  for (const name of [
@@ -6229,8 +6124,7 @@ const isolatedPnpmOptions = [
6229
6124
  "--config.pm-on-fail=ignore",
6230
6125
  "--config.runtime-on-fail=ignore"
6231
6126
  ];
6232
- //#endregion
6233
- //#region src/commands/release/bootstrap/preparation/environment.ts
6127
+ // src/commands/release/bootstrap/preparation/environment.ts
6234
6128
  /** 在加载候选配置前同时检查当前进程与子进程环境,禁止凭据泄漏和递归准备。 */
6235
6129
  function assertBootstrapPreparationEnvironment(options) {
6236
6130
  const environments = options.env ? [process.env, options.env] : [process.env];
@@ -6241,8 +6135,7 @@ function assertBootstrapPreparationEnvironment(options) {
6241
6135
  "NPM_TOKEN"
6242
6136
  ].some((key) => env[key]))) throw new Error("Bootstrap preparation must run without OIDC or npm publishing credentials.");
6243
6137
  }
6244
- //#endregion
6245
- //#region src/commands/release/bootstrap/preparation/source.ts
6138
+ // src/commands/release/bootstrap/preparation/source.ts
6246
6139
  function record$2(value) {
6247
6140
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Bootstrap source must be a JSON object.");
6248
6141
  return value;
@@ -6310,8 +6203,7 @@ async function bootstrapSourceDirectory(options, source) {
6310
6203
  ], options))) throw new Error("Bootstrap source archives do not support symbolic links or Git submodules.");
6311
6204
  return root;
6312
6205
  }
6313
- //#endregion
6314
- //#region src/commands/release/bootstrap/preparation/workspace.ts
6206
+ // src/commands/release/bootstrap/preparation/workspace.ts
6315
6207
  function inside$5(root, target) {
6316
6208
  const relative = path$1.relative(root, path$1.resolve(target));
6317
6209
  return relative === "" || !relative.startsWith(`..${path$1.sep}`) && relative !== ".." && !path$1.isAbsolute(relative);
@@ -6362,8 +6254,7 @@ async function bootstrapWorkspace(root, packageName) {
6362
6254
  buildDirectories: [...closure.keys()].map((directory) => path$1.relative(root, directory).split(path$1.sep).join("/") || ".").sort()
6363
6255
  };
6364
6256
  }
6365
- //#endregion
6366
- //#region src/commands/package-check/consumer/runtime-assets.ts
6257
+ // src/commands/package-check/consumer/runtime-assets.ts
6367
6258
  function consumerRuntimeAssets(manifest) {
6368
6259
  const assets = manifest.repoctl?.packageCheck?.runtimeAssets ?? [];
6369
6260
  const result = /* @__PURE__ */ new Set();
@@ -6388,8 +6279,7 @@ function consumerAssetSource(entry, specifier, installed) {
6388
6279
  "fs.readFileSync(filename);"
6389
6280
  ].join("\n");
6390
6281
  }
6391
- //#endregion
6392
- //#region src/commands/package-check/consumer/runtime-contexts/source.ts
6282
+ // src/commands/package-check/consumer/runtime-contexts/source.ts
6393
6283
  /** 实际导入平台保护入口,只接受声明的精确错误。 */
6394
6284
  function expectedErrorConsumerSource(specifier, context) {
6395
6285
  return [
@@ -6398,8 +6288,7 @@ function expectedErrorConsumerSource(specifier, context) {
6398
6288
  `if (!(failure instanceof Error) || failure.name !== ${JSON.stringify(context.name)} || failure.message !== ${JSON.stringify(context.message)}) throw new Error("Entry did not preserve its declared unavailable-runtime error.", { cause: failure });`
6399
6289
  ].join("\n");
6400
6290
  }
6401
- //#endregion
6402
- //#region src/commands/package-check/consumer/runtime-contexts/vitest.ts
6291
+ // src/commands/package-check/consumer/runtime-contexts/vitest.ts
6403
6292
  function importTarget(value) {
6404
6293
  if (typeof value === "string") return value;
6405
6294
  if (Array.isArray(value)) return value.map(importTarget).find(Boolean);
@@ -6456,8 +6345,7 @@ async function vitestConsumerInvocation(entry, specifier, directory, installed)
6456
6345
  ].join("\n"));
6457
6346
  return [runnerFile];
6458
6347
  }
6459
- //#endregion
6460
- //#region src/commands/package-check/consumer/runtime-contexts/index.ts
6348
+ // src/commands/package-check/consumer/runtime-contexts/index.ts
6461
6349
  function exactSubpath(value) {
6462
6350
  return value === "." || value.startsWith("./") && !value.includes("*") && !value.includes("\\") && value.slice(2).split("/").every((segment) => segment && segment !== "." && segment !== "..");
6463
6351
  }
@@ -6502,8 +6390,7 @@ async function consumerRuntimeInvocation(entry, specifier, directory, installed)
6502
6390
  source
6503
6391
  ];
6504
6392
  }
6505
- //#endregion
6506
- //#region src/commands/package-check/entries.ts
6393
+ // src/commands/package-check/entries.ts
6507
6394
  function resolveTarget$1(value, conditions) {
6508
6395
  if (typeof value === "string") return value;
6509
6396
  if (Array.isArray(value)) return value.map((item) => resolveTarget$1(item, conditions)).find(Boolean);
@@ -6586,8 +6473,7 @@ function supportsResolution(entries, subpath, kind, legacy) {
6586
6473
  if (kind === "node10") return legacy && entries.some((entry) => entry.subpath === subpath);
6587
6474
  return entries.some((entry) => entry.subpath === subpath && (kind === "bundler" || entry.format === (kind === "node16-cjs" ? "cjs" : "esm")));
6588
6475
  }
6589
- //#endregion
6590
- //#region src/commands/release/snapshot/archive/index.ts
6476
+ // src/commands/release/snapshot/archive/index.ts
6591
6477
  /** Read without extracting archive paths or following links on the filesystem. */
6592
6478
  async function readSnapshotArchive(bytes) {
6593
6479
  return new Promise((resolve, reject) => {
@@ -6642,8 +6528,7 @@ function writeSnapshotArchive(entries) {
6642
6528
  compressed[9] = 255;
6643
6529
  return compressed;
6644
6530
  }
6645
- //#endregion
6646
- //#region src/commands/release/bootstrap/schema.ts
6531
+ // src/commands/release/bootstrap/schema.ts
6647
6532
  const bootstrapRegistry = "https://registry.npmjs.org/";
6648
6533
  const bootstrapWorkflow = ".github/workflows/release.yml";
6649
6534
  /** 共享入口与跨作业合同使用同一 npm 标签语法,保留受管快照渠道。 */
@@ -6727,8 +6612,7 @@ function matchBootstrapRequest(manifest, options) {
6727
6612
  assert.equal(manifest.package.version, options.version, "Bootstrap version differs from the dispatch input");
6728
6613
  assert.equal(manifest.tag, options.tag ?? "alpha", "Bootstrap tag differs from the dispatch input");
6729
6614
  }
6730
- //#endregion
6731
- //#region src/commands/release/bootstrap/plan.ts
6615
+ // src/commands/release/bootstrap/plan.ts
6732
6616
  /** 冻结单包预发布与稳定发布线保护,不执行安装、构建或生命周期。 */
6733
6617
  async function createBootstrapPlan(options) {
6734
6618
  assertBootstrapPreparationEnvironment(options);
@@ -6767,8 +6651,7 @@ async function createBootstrapPlan(options) {
6767
6651
  protectedTags
6768
6652
  };
6769
6653
  }
6770
- //#endregion
6771
- //#region src/commands/release/snapshot/identity.ts
6654
+ // src/commands/release/snapshot/identity.ts
6772
6655
  function snapshotMetadata(report) {
6773
6656
  return {
6774
6657
  ...report.identity,
@@ -6822,8 +6705,7 @@ async function assertSnapshotAuthorization(options) {
6822
6705
  if (env["GITHUB_EVENT_NAME"] !== "pull_request" || event.number !== options.identity.pullRequest || !pr || pr.head?.repo?.fork !== false || pr.head?.repo?.full_name !== env["GITHUB_REPOSITORY"] || pr.base?.repo?.full_name !== env["GITHUB_REPOSITORY"] || ![pr.head?.sha, pr.merge_commit_sha].includes(options.identity.commit)) throw new Error("Snapshot PR publication requires a same-repository pull_request event; fork and pull_request_target jobs cannot publish.");
6823
6706
  } else if (!["schedule", "workflow_dispatch"].includes(env["GITHUB_EVENT_NAME"] ?? "")) throw new Error("Nightly snapshot publication requires a schedule or workflow_dispatch event.");
6824
6707
  }
6825
- //#endregion
6826
- //#region src/commands/release/snapshot/prepared/schema.ts
6708
+ // src/commands/release/snapshot/prepared/schema.ts
6827
6709
  function object$2(value) {
6828
6710
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Snapshot data must be a JSON object.");
6829
6711
  return value;
@@ -6955,8 +6837,7 @@ function validateSnapshotBuildPlan(value) {
6955
6837
  }
6956
6838
  return value;
6957
6839
  }
6958
- //#endregion
6959
- //#region src/commands/package-check/analyze.ts
6840
+ // src/commands/package-check/analyze.ts
6960
6841
  const packageCheckTools = {
6961
6842
  publint: "0.3.25",
6962
6843
  attw: "0.18.5"
@@ -7007,8 +6888,7 @@ async function analyzeTarball(packed) {
7007
6888
  }
7008
6889
  return entries;
7009
6890
  }
7010
- //#endregion
7011
- //#region src/commands/package-check/consumer/dependencies.ts
6891
+ // src/commands/package-check/consumer/dependencies.ts
7012
6892
  function consumerDependency(pkg, reference, expected) {
7013
6893
  return expected?.get(String(pkg.manifest.name))?.get(`${reference.field}.${reference.alias}`);
7014
6894
  }
@@ -7047,8 +6927,7 @@ function checkDependencyRanges(pkg, packages, results, expected) {
7047
6927
  }
7048
6928
  }
7049
6929
  }
7050
- //#endregion
7051
- //#region src/commands/package-check/consumer/optional-peers.ts
6930
+ // src/commands/package-check/consumer/optional-peers.ts
7052
6931
  /** 显式安装可选集成和本批次必需 peer,避免包管理器使用 registry 旧包。 */
7053
6932
  function consumerOptionalPeers(closure, localLocators) {
7054
6933
  const peers = /* @__PURE__ */ new Map();
@@ -7092,8 +6971,7 @@ function consumerOptionalPeers(closure, localLocators) {
7092
6971
  return [alias, alias === name ? range : `npm:${name}@${range}`];
7093
6972
  }));
7094
6973
  }
7095
- //#endregion
7096
- //#region src/commands/package-check/consumer/peer-aliases.ts
6974
+ // src/commands/package-check/consumer/peer-aliases.ts
7097
6975
  /** pnpm 12 cannot install npm aliases whose range contains AND comparators. */
7098
6976
  async function resolveConsumerPeerAliases(dependencies, query) {
7099
6977
  const resolved = { ...dependencies };
@@ -7115,8 +6993,7 @@ async function resolveConsumerPeerAliases(dependencies, query) {
7115
6993
  }
7116
6994
  return resolved;
7117
6995
  }
7118
- //#endregion
7119
- //#region src/commands/package-check/consumer/platform.ts
6996
+ // src/commands/package-check/consumer/platform.ts
7120
6997
  let actualHost;
7121
6998
  /** 仅使用当前 Node 进程和系统证据,忽略包管理器的目标平台覆盖配置。 */
7122
6999
  function consumerHost() {
@@ -7187,8 +7064,7 @@ function consumerPackageApplicability(manifests) {
7187
7064
  ...consumerApplicability(manifest, host)
7188
7065
  }));
7189
7066
  }
7190
- //#endregion
7191
- //#region src/commands/package-check/consumer/runtime-closure.ts
7067
+ // src/commands/package-check/consumer/runtime-closure.ts
7192
7068
  /** Follow checked runtime dependencies and peers without importing development tooling. */
7193
7069
  function consumerRuntimeClosure(roots, manifests, expected) {
7194
7070
  const known = new Map(manifests.map((manifest) => [manifest.name, manifest]));
@@ -7234,8 +7110,7 @@ function consumerRuntimeClosure(roots, manifests, expected) {
7234
7110
  references
7235
7111
  };
7236
7112
  }
7237
- //#endregion
7238
- //#region src/commands/package-check/consumer/typescript.ts
7113
+ // src/commands/package-check/consumer/typescript.ts
7239
7114
  async function packageVersion(filename, name) {
7240
7115
  const manifest = JSON.parse(await readFile(filename, "utf8"));
7241
7116
  if (manifest.name !== name || !manifest.version || !valid(manifest.version)) throw new Error(`Consumer requires an exact installed ${name} version: ${filename}.`);
@@ -7305,8 +7180,7 @@ async function installedConsumerTypeToolchain(directory, toolchain) {
7305
7180
  typeRoots
7306
7181
  };
7307
7182
  }
7308
- //#endregion
7309
- //#region src/commands/package-check/process.ts
7183
+ // src/commands/package-check/process.ts
7310
7184
  function stop$1(child) {
7311
7185
  if (!child.pid) return;
7312
7186
  if (process.platform === "win32") {
@@ -7408,8 +7282,7 @@ async function execute(executable, args, cwd, timeoutMs, options = {}) {
7408
7282
  function failureMessage(command) {
7409
7283
  return `${command.executable} ${command.args.join(" ")} failed (${command.exitCode ?? "process error"}): ${command.output}`;
7410
7284
  }
7411
- //#endregion
7412
- //#region src/commands/package-check/consumer.ts
7285
+ // src/commands/package-check/consumer.ts
7413
7286
  async function consumeTarball(pkg, packages, results, entries, directory, timeout, options = {}) {
7414
7287
  const { result } = pkg;
7415
7288
  const { packageManager } = options;
@@ -7573,8 +7446,7 @@ async function consumeTarball(pkg, packages, results, entries, directory, timeou
7573
7446
  });
7574
7447
  }
7575
7448
  }
7576
- //#endregion
7577
- //#region src/commands/package-check/workspace.ts
7449
+ // src/commands/package-check/workspace.ts
7578
7450
  function packageBuildSelector(workspaceDir, directory) {
7579
7451
  return `./${path$1.relative(workspaceDir, directory).split(path$1.sep).join("/").replace(/[*?[\]{}!()+@]/gu, (character) => `[${character}]`).replace(/\.$/u, "[.]")}`;
7580
7452
  }
@@ -7647,8 +7519,7 @@ async function selectPackages(options, timeout, execution = {}) {
7647
7519
  buildDirectories: [...buildClosure.keys()].sort()
7648
7520
  };
7649
7521
  }
7650
- //#endregion
7651
- //#region src/commands/release/bootstrap/preparation/artifact.ts
7522
+ // src/commands/release/bootstrap/preparation/artifact.ts
7652
7523
  async function assertRegistryDependencies(item, names, context, options) {
7653
7524
  for (const reference of dependencyReferences(item.manifest, item.result.directory)) {
7654
7525
  if (reference.protocol !== "registry") throw new Error(`Bootstrap packed dependency ${reference.alias} still uses ${reference.protocol}: instead of a registry range.`);
@@ -7777,8 +7648,7 @@ async function bootstrapArtifact(context, plan, options, names) {
7777
7648
  integrity: `sha512-${createHash("sha512").update(bytes).digest("base64")}`
7778
7649
  };
7779
7650
  }
7780
- //#endregion
7781
- //#region src/commands/release/nightly/consumer/environment.ts
7651
+ // src/commands/release/nightly/consumer/environment.ts
7782
7652
  function consumerEnvironment(env, directory) {
7783
7653
  return {
7784
7654
  ...Object.fromEntries([
@@ -7808,15 +7678,13 @@ const consumerPnpmOptions = [
7808
7678
  "--config.manage-package-manager-versions=false",
7809
7679
  "--config.ignore-pnpmfile=true"
7810
7680
  ];
7811
- //#endregion
7812
- //#region src/commands/release/bootstrap/output.ts
7681
+ // src/commands/release/bootstrap/output.ts
7813
7682
  /** 每次执行使用空目录,失败或恢复不能覆盖既有冻结产物与验收历史。 */
7814
7683
  async function emptyBootstrapOutput(directory) {
7815
7684
  await mkdir(directory, { recursive: true });
7816
7685
  assert.equal((await readdir(directory)).length, 0, "Bootstrap evidence directory must be empty; preserve the previous run and select a new output directory");
7817
7686
  }
7818
- //#endregion
7819
- //#region src/commands/release/bootstrap/preparation/isolate.ts
7687
+ // src/commands/release/bootstrap/preparation/isolate.ts
7820
7688
  function inside$3(root, target) {
7821
7689
  const relative = path$1.relative(root, target);
7822
7690
  return relative === "" || !relative.startsWith(`..${path$1.sep}`) && relative !== ".." && !path$1.isAbsolute(relative);
@@ -7886,8 +7754,7 @@ async function isolateBootstrap(root, plan, options) {
7886
7754
  env: execution.env
7887
7755
  };
7888
7756
  }
7889
- //#endregion
7890
- //#region src/commands/release/bootstrap/prepare.ts
7757
+ // src/commands/release/bootstrap/prepare.ts
7891
7758
  /** 在无发布凭据的隔离目录构建、检查并原生打包一个冻结的公开包。 */
7892
7759
  async function prepareBootstrap(options) {
7893
7760
  assertBootstrapPreparationEnvironment(options);
@@ -7936,8 +7803,7 @@ async function prepareBootstrap(options) {
7936
7803
  checks: [check]
7937
7804
  };
7938
7805
  }
7939
- //#endregion
7940
- //#region src/core/oidc/identity.ts
7806
+ // src/core/oidc/identity.ts
7941
7807
  const npmRegistry = "https://registry.npmjs.org";
7942
7808
  const npmAudience = "npm:registry.npmjs.org";
7943
7809
  const requestTimeout = 15e3;
@@ -8003,8 +7869,7 @@ async function requestIdentity(env, fetcher) {
8003
7869
  identity: Object.fromEntries(identityKeys.filter((key) => typeof claims[key] === "string").map((key) => [key, publicMessage(claims[key], [idToken, requestToken])]))
8004
7870
  };
8005
7871
  }
8006
- //#endregion
8007
- //#region src/core/oidc/exchange.ts
7872
+ // src/core/oidc/exchange.ts
8008
7873
  async function exchangePackage(name, idToken, requestToken, fetcher) {
8009
7874
  try {
8010
7875
  const response = await fetcher(new URL(`/-/npm/v1/oidc/token/exchange/package/${encodeURIComponent(name)}`, npmRegistry), {
@@ -8049,8 +7914,7 @@ async function exchangePackage(name, idToken, requestToken, fetcher) {
8049
7914
  };
8050
7915
  }
8051
7916
  }
8052
- //#endregion
8053
- //#region src/commands/release/oidc/candidates.ts
7917
+ // src/commands/release/oidc/candidates.ts
8054
7918
  async function auditCandidates(options) {
8055
7919
  if (options.packages !== void 0) {
8056
7920
  if (options.cwd !== void 0 || options.packageNames !== void 0 || !Array.isArray(options.packages) || !options.packages.length || new Set(options.packages.map((pkg) => pkg?.name)).size !== options.packages.length || options.packages.some((pkg) => !pkg || typeof pkg.name !== "string" || !validatePackageName(pkg.name).validForNewPackages || typeof pkg.version !== "string" || !valid(pkg.version) || pkg.registry !== void 0 && (typeof pkg.registry !== "string" || pkg.registry.replace(/\/$/, "") !== "https://registry.npmjs.org"))) throw new ReleaseCommandError("OIDC audit requires unique versioned artifact packages on the official npm registry; no credentials were requested");
@@ -8069,8 +7933,7 @@ async function auditCandidates(options) {
8069
7933
  })) throw new ReleaseCommandError("OIDC audit supports only the official npm registry; no credentials were requested");
8070
7934
  return [...new Set(candidates.map((pkg) => pkg.manifest.name))].sort();
8071
7935
  }
8072
- //#endregion
8073
- //#region src/commands/release/oidc/index.ts
7936
+ // src/commands/release/oidc/index.ts
8074
7937
  /** 逐包核验官方 npm 的短时凭据交换;不发布、不执行 hooks,也不保存凭据。 */
8075
7938
  async function auditReleaseOidc(options) {
8076
7939
  const names = await auditCandidates(options);
@@ -8104,8 +7967,7 @@ async function runReleaseOidcAudit(options) {
8104
7967
  if (!report.ok) throw new ReleaseCommandError(`npm OIDC audit failed for ${report.results.filter((result) => !result.ok).length}/${report.results.length} packages; see the safe report above`);
8105
7968
  return report;
8106
7969
  }
8107
- //#endregion
8108
- //#region src/commands/release/publish/evidence.ts
7970
+ // src/commands/release/publish/evidence.ts
8109
7971
  function outputText(output) {
8110
7972
  return output == null ? "" : String(output);
8111
7973
  }
@@ -8126,8 +7988,7 @@ function isTransientPublishFailure(output) {
8126
7988
  function isPublishConflict(output) {
8127
7989
  return /cannot publish over|EPUBLISHCONFLICT|previously published|already exists|status\s*(?::\s*)?409\b/i.test(output);
8128
7990
  }
8129
- //#endregion
8130
- //#region src/commands/release/publish/command.ts
7991
+ // src/commands/release/publish/command.ts
8131
7992
  function runPublishAttempt(args, options) {
8132
7993
  const result = (options.spawn ?? spawnSync)("pnpm", args, {
8133
7994
  cwd: options.cwd,
@@ -8150,8 +8011,7 @@ function runPublishAttempt(args, options) {
8150
8011
  output: `${stdout}\n${stderr}`
8151
8012
  };
8152
8013
  }
8153
- //#endregion
8154
- //#region src/commands/release/publish/state.ts
8014
+ // src/commands/release/publish/state.ts
8155
8015
  function packageKey(pkg) {
8156
8016
  return `${pkg.name}@${pkg.version}`;
8157
8017
  }
@@ -8205,8 +8065,7 @@ var PublishState = class {
8205
8065
  await this.checkpoint?.(acceptedPackages);
8206
8066
  }
8207
8067
  };
8208
- //#endregion
8209
- //#region src/commands/release/registry/cli.ts
8068
+ // src/commands/release/registry/cli.ts
8210
8069
  async function queryNpm(args, timeout, options) {
8211
8070
  const settings = {
8212
8071
  cwd: options.cwd,
@@ -8244,8 +8103,7 @@ async function queryNpm(args, timeout, options) {
8244
8103
  }));
8245
8104
  });
8246
8105
  }
8247
- //#endregion
8248
- //#region src/commands/release/registry/configuration.ts
8106
+ // src/commands/release/registry/configuration.ts
8249
8107
  const require = createRequire(import.meta.url);
8250
8108
  async function registryConfiguration(options) {
8251
8109
  const config = new Config({
@@ -8275,8 +8133,7 @@ async function registryConfiguration(options) {
8275
8133
  return registry.replace(/\/$/, "") === "https://registry.npmjs.org" && access.get(name) !== "restricted" && !configuredTransport && !authenticated;
8276
8134
  };
8277
8135
  }
8278
- //#endregion
8279
- //#region src/commands/release/registry/settings.ts
8136
+ // src/commands/release/registry/settings.ts
8280
8137
  function registrySettings(options) {
8281
8138
  const config = resolveCommandValues("release", options.config).values.registry;
8282
8139
  return {
@@ -8303,8 +8160,7 @@ async function mapConcurrent(items, concurrency, task) {
8303
8160
  if (failure) throw failure;
8304
8161
  return results;
8305
8162
  }
8306
- //#endregion
8307
- //#region src/commands/release/registry/index.ts
8163
+ // src/commands/release/registry/index.ts
8308
8164
  function sleep(milliseconds, options) {
8309
8165
  return options.sleep?.(milliseconds) ?? new Promise((resolve) => setTimeout(resolve, milliseconds));
8310
8166
  }
@@ -8417,8 +8273,7 @@ var RegistryClient = class {
8417
8273
  throw new ReleaseCommandError(`npm registry state is unknown for ${packageKey(pkg)} after bounded retries; no upload attempted (${reason})`);
8418
8274
  }
8419
8275
  };
8420
- //#endregion
8421
- //#region src/commands/release/publish/registry.ts
8276
+ // src/commands/release/publish/registry.ts
8422
8277
  async function refreshRegistry(state, options, packages = state.candidates, deadline = performance.now() + registrySettings(options).visibilityTimeoutMs) {
8423
8278
  const unknown = [];
8424
8279
  const client = registryClient(options);
@@ -8486,8 +8341,7 @@ async function confirmVisibility(state, options, packages, initialDelay = 0, dis
8486
8341
  throw error;
8487
8342
  }
8488
8343
  }
8489
- //#endregion
8490
- //#region src/commands/release/publish/index.ts
8344
+ // src/commands/release/publish/index.ts
8491
8345
  const publishAttempts = 3;
8492
8346
  const retryDelays = [2e4, 4e4];
8493
8347
  async function getPublishCandidates(cwd) {
@@ -8550,8 +8404,7 @@ async function publishWithRetry(args, options, candidates, confirmAll = false, r
8550
8404
  throw error;
8551
8405
  }
8552
8406
  }
8553
- //#endregion
8554
- //#region src/commands/release/snapshot/prepared/github/archive.ts
8407
+ // src/commands/release/snapshot/prepared/github/archive.ts
8555
8408
  const archiveLimit = 268435456;
8556
8409
  const expandedLimit = 536870912;
8557
8410
  const entryLimit = 134217728;
@@ -8649,8 +8502,7 @@ async function downloadSnapshotArtifact(client, options) {
8649
8502
  if (`sha256:${createHash("sha256").update(bytes).digest("hex")}` !== expectedDigest) throw new Error("Snapshot artifact ZIP digest does not match the immutable GitHub artifact.");
8650
8503
  return readSnapshotZip(bytes);
8651
8504
  }
8652
- //#endregion
8653
- //#region src/commands/release/bootstrap/evidence.ts
8505
+ // src/commands/release/bootstrap/evidence.ts
8654
8506
  /** 仅默认分支的同一发布工作流可取得上传或恢复资格。 */
8655
8507
  function bootstrapInvocation(options) {
8656
8508
  const env = options.env ?? process.env;
@@ -8748,8 +8600,7 @@ async function bootstrapBundle(options, kind) {
8748
8600
  }
8749
8601
  };
8750
8602
  }
8751
- //#endregion
8752
- //#region src/commands/release/bootstrap/provenance.ts
8603
+ // src/commands/release/bootstrap/provenance.ts
8753
8604
  /** 签名验证之外还必须绑定实际上传运行,避免把其他 workflow 的发布算作首次验证。 */
8754
8605
  async function verifyBootstrapProvenance(manifest, url, options) {
8755
8606
  const endpoint = new URL(url);
@@ -8789,8 +8640,7 @@ async function verifyBootstrapProvenance(manifest, url, options) {
8789
8640
  }), "Bootstrap provenance source differs from the frozen default branch commit");
8790
8641
  assert.equal(record$4(record$4(predicate["runDetails"])["metadata"])["invocationId"], `${repository}/actions/runs/${manifest.source.runId}/attempts/${manifest.source.runAttempt}`);
8791
8642
  }
8792
- //#endregion
8793
- //#region src/commands/release/bootstrap/registry.ts
8643
+ // src/commands/release/bootstrap/registry.ts
8794
8644
  async function metadata(path, options, deadline = performance.now() + 3e4) {
8795
8645
  const response = await (options.registryFetch ?? globalThis.fetch)(`${bootstrapRegistry}${path}`, {
8796
8646
  redirect: "error",
@@ -8878,8 +8728,7 @@ async function confirmBootstrapRegistry(report, options) {
8878
8728
  }
8879
8729
  throw new Error("Bootstrap registry confirmation timed out; preserve the accepted upload and use verify-run-id without publishing again.");
8880
8730
  }
8881
- //#endregion
8882
- //#region src/commands/release/bootstrap/publication.ts
8731
+ // src/commands/release/bootstrap/publication.ts
8883
8732
  async function writeBootstrapReport(report) {
8884
8733
  await writeFile(path$1.join(report.outputDirectory, "bootstrap-report.json"), `${JSON.stringify(report, null, 2)}\n`);
8885
8734
  }
@@ -9007,8 +8856,7 @@ async function publishBootstrap(options) {
9007
8856
  await writeBootstrapReport(report);
9008
8857
  return report;
9009
8858
  }
9010
- //#endregion
9011
- //#region src/commands/release/nightly/consumer/entries.ts
8859
+ // src/commands/release/nightly/consumer/entries.ts
9012
8860
  async function checkInstalledEntries(manifest, files, installed, directory, run, packageIndex, toolchain) {
9013
8861
  const entries = consumerEntries(manifest, files);
9014
8862
  const checkTypes = files.some((file) => /\.d\.[cm]?ts$/u.test(file));
@@ -9048,8 +8896,7 @@ async function checkInstalledEntries(manifest, files, installed, directory, run,
9048
8896
  await run(process.execPath, ["--check", filename]);
9049
8897
  }
9050
8898
  }
9051
- //#endregion
9052
- //#region src/commands/release/nightly/consumer/run.ts
8899
+ // src/commands/release/nightly/consumer/run.ts
9053
8900
  var ConsumerCommandError = class extends Error {
9054
8901
  command;
9055
8902
  constructor(command) {
@@ -9099,8 +8946,7 @@ function consumerRunner(result, options, cwd, env) {
9099
8946
  return output;
9100
8947
  };
9101
8948
  }
9102
- //#endregion
9103
- //#region src/commands/release/bootstrap/consumer.ts
8949
+ // src/commands/release/bootstrap/consumer.ts
9104
8950
  function assertInside(directory, filename) {
9105
8951
  const relative = path$1.relative(directory, filename);
9106
8952
  assert.ok(relative && relative !== ".." && !relative.startsWith(`..${path$1.sep}`) && !path$1.isAbsolute(relative), "Bootstrap consumer resolved a file outside its isolated package");
@@ -9206,8 +9052,7 @@ async function verifyBootstrapConsumer(report, options) {
9206
9052
  }
9207
9053
  if (failure) throw failure;
9208
9054
  }
9209
- //#endregion
9210
- //#region src/commands/release/bootstrap/recovery.ts
9055
+ // src/commands/release/bootstrap/recovery.ts
9211
9056
  /** 恢复只使用原运行的不可变证据,不构建、不交换凭据,也不重新上传。 */
9212
9057
  async function verifyBootstrapPublication(options) {
9213
9058
  assert.ok(!options.dryRun && options.outputDirectory, "Bootstrap recovery requires an evidence directory and cannot be a dry-run");
@@ -9259,8 +9104,7 @@ async function verifyBootstrapPublication(options) {
9259
9104
  await writeBootstrapReport(report);
9260
9105
  return report;
9261
9106
  }
9262
- //#endregion
9263
- //#region src/commands/release/bootstrap/index.ts
9107
+ // src/commands/release/bootstrap/index.ts
9264
9108
  /** 默认只准备;实际上传与只读恢复必须显式选择独立工作流阶段。 */
9265
9109
  async function releaseBootstrap(options) {
9266
9110
  const stage = options.verifyRunId ? "verify" : options.stage ?? "prepare";
@@ -9278,8 +9122,7 @@ async function releaseBootstrap(options) {
9278
9122
  plan
9279
9123
  });
9280
9124
  }
9281
- //#endregion
9282
- //#region src/commands/release/stages/verification.ts
9125
+ // src/commands/release/stages/verification.ts
9283
9126
  const verified = Symbol("repoctl verified stage");
9284
9127
  function authorizeVerification(options) {
9285
9128
  return {
@@ -9290,8 +9133,7 @@ function authorizeVerification(options) {
9290
9133
  function hasVerification(options) {
9291
9134
  return options[verified] === true;
9292
9135
  }
9293
- //#endregion
9294
- //#region src/commands/release/workspace-protocol.ts
9136
+ // src/commands/release/workspace-protocol.ts
9295
9137
  const EXPECTED_WORKSPACE_SPEC = "workspace:*";
9296
9138
  const PEER_WORKSPACE_SPECS = /* @__PURE__ */ new Set([
9297
9139
  EXPECTED_WORKSPACE_SPEC,
@@ -9342,8 +9184,7 @@ async function assertWorkspaceDependencyProtocols(cwd) {
9342
9184
  ...violations.map((violation) => `- ${violation}`)
9343
9185
  ].join("\n"));
9344
9186
  }
9345
- //#endregion
9346
- //#region src/commands/release/hooks.ts
9187
+ // src/commands/release/hooks.ts
9347
9188
  function validateScriptName(script) {
9348
9189
  const normalizedScript = script.trim();
9349
9190
  if (!normalizedScript) throw new ReleaseCommandError("release script name must not be empty");
@@ -9406,15 +9247,13 @@ function runAfterPublishHooks(packages, options) {
9406
9247
  logger.warn(`release afterPublish hook failed and was ignored: ${hook.script}`);
9407
9248
  }
9408
9249
  }
9409
- //#endregion
9410
- //#region src/commands/release/lifecycle/registry.ts
9250
+ // src/commands/release/lifecycle/registry.ts
9411
9251
  /** Only an explicit 404 proves absence; unknown state must never cause an upload. */
9412
9252
  function inspectRegistry(pkg, options, deadline) {
9413
9253
  const settings = registrySettings(options);
9414
9254
  return registryClient(options).inspect(pkg, deadline ?? performance.now() + Math.min(settings.visibilityTimeoutMs, settings.requestTimeoutMs * 6 + 3e3));
9415
9255
  }
9416
- //#endregion
9417
- //#region src/commands/release/github/errors.ts
9256
+ // src/commands/release/github/errors.ts
9418
9257
  var GitHubApiError = class extends ReleaseCommandError {
9419
9258
  status;
9420
9259
  responseBody;
@@ -9425,8 +9264,7 @@ var GitHubApiError = class extends ReleaseCommandError {
9425
9264
  this.name = "GitHubApiError";
9426
9265
  }
9427
9266
  };
9428
- //#endregion
9429
- //#region src/commands/release/github/client/transport.ts
9267
+ // src/commands/release/github/client/transport.ts
9430
9268
  /** Shared authenticated transport; mutation callers own reconciliation. */
9431
9269
  var GitHubTransport = class {
9432
9270
  token;
@@ -9514,8 +9352,7 @@ var GitHubTransport = class {
9514
9352
  throw new GitHubApiError(`GitHub API request ${method} ${endpoint} exhausted retries`, 0);
9515
9353
  }
9516
9354
  };
9517
- //#endregion
9518
- //#region src/commands/release/github/metadata.ts
9355
+ // src/commands/release/github/metadata.ts
9519
9356
  function parseReleasePullRequestContributors(body) {
9520
9357
  if (!body) return [];
9521
9358
  const contributors = body.match(/(?:Thanks to|感谢)\s+([^\n]+)/i)?.[1];
@@ -9562,8 +9399,7 @@ async function enrichReleaseNote(request, document) {
9562
9399
  contributors: uniqueContributors([...document.contributors, ...entries.flatMap((entry) => entry.authors)])
9563
9400
  };
9564
9401
  }
9565
- //#endregion
9566
- //#region src/commands/release/github/state.ts
9402
+ // src/commands/release/github/state.ts
9567
9403
  const branch = "repoctl-release-state";
9568
9404
  function missing(error) {
9569
9405
  return error instanceof Error && "status" in error && error.status === 404;
@@ -9663,8 +9499,7 @@ function writeReleaseState(request, key, state, revision, options) {
9663
9499
  function writeAutomationState(request, key, value, revision, options) {
9664
9500
  return writeState(request, automationPath(key), value, revision, options);
9665
9501
  }
9666
- //#endregion
9667
- //#region src/commands/release/github/tags.ts
9502
+ // src/commands/release/github/tags.ts
9668
9503
  async function readBranchHead(request, branch) {
9669
9504
  if (!/^[a-z\d][\w./-]*$/i.test(branch) || branch.includes("..") || branch.includes("//") || branch.endsWith("/")) throw new ReleaseCommandError("Invalid Git branch name");
9670
9505
  const object = (await request("GET", `/git/ref/heads/${encodeURIComponent(branch)}`)).data?.object;
@@ -9709,8 +9544,7 @@ async function ensureTag(request, options) {
9709
9544
  if (!await verify()) throw error;
9710
9545
  }
9711
9546
  }
9712
- //#endregion
9713
- //#region src/commands/release/github/client.ts
9547
+ // src/commands/release/github/client.ts
9714
9548
  var GitHubClient = class extends GitHubTransport {
9715
9549
  getRequest() {
9716
9550
  return this.request.bind(this);
@@ -9893,8 +9727,7 @@ var GitHubClient = class extends GitHubTransport {
9893
9727
  return ensureTag(this.getRequest(), options);
9894
9728
  }
9895
9729
  };
9896
- //#endregion
9897
- //#region src/commands/release/metadata.ts
9730
+ // src/commands/release/metadata.ts
9898
9731
  function gitRefExists(ref, options) {
9899
9732
  return (options.spawn ?? spawnSync)("git", [
9900
9733
  "rev-parse",
@@ -10017,8 +9850,7 @@ async function publishMetadata(packages, options, prerelease = false) {
10017
9850
  }
10018
9851
  logger.success(formatPublishedPackageSummary(packages));
10019
9852
  }
10020
- //#endregion
10021
- //#region src/commands/release/completion/record.ts
9853
+ // src/commands/release/completion/record.ts
10022
9854
  function completionId(value) {
10023
9855
  return createHash("sha256").update(JSON.stringify(value)).digest("hex");
10024
9856
  }
@@ -10058,8 +9890,7 @@ async function readReleaseCompletion(github, id) {
10058
9890
  if (!snapshot) throw new ReleaseCommandError(`Stable release completion record is missing: ${id}`);
10059
9891
  return parseReleaseCompletion(snapshot.value, id);
10060
9892
  }
10061
- //#endregion
10062
- //#region src/commands/release/completion/index.ts
9893
+ // src/commands/release/completion/index.ts
10063
9894
  function publishedSourceIsAncestor(options, tag, sourceSha) {
10064
9895
  const result = (options.spawn ?? spawnSync)("git", [
10065
9896
  "merge-base",
@@ -10138,8 +9969,7 @@ async function recordReleaseCompletion(options, state, checkpointKey, rule) {
10138
9969
  sites
10139
9970
  };
10140
9971
  }
10141
- //#endregion
10142
- //#region src/commands/release/lifecycle/hooks.ts
9972
+ // src/commands/release/lifecycle/hooks.ts
10143
9973
  async function finishHooks(state, save, options) {
10144
9974
  const acknowledged = new Set((getReleaseEnv(options)["REPO_RELEASE_ACKNOWLEDGE_HOOKS"] ?? "").split(",").filter(Boolean));
10145
9975
  for (const hook of options.config?.hooks?.afterPublish ?? []) {
@@ -10175,8 +10005,7 @@ async function finishHooks(state, save, options) {
10175
10005
  await save();
10176
10006
  }
10177
10007
  }
10178
- //#endregion
10179
- //#region src/commands/release/lifecycle/key.ts
10008
+ // src/commands/release/lifecycle/key.ts
10180
10009
  function releaseStateKey(repository, distTag, candidates) {
10181
10010
  return createHash("sha256").update(JSON.stringify({
10182
10011
  repository,
@@ -10184,8 +10013,7 @@ function releaseStateKey(repository, distTag, candidates) {
10184
10013
  packages: candidates.map(packageKey).sort()
10185
10014
  })).digest("hex");
10186
10015
  }
10187
- //#endregion
10188
- //#region src/commands/release/lifecycle/identity.ts
10016
+ // src/commands/release/lifecycle/identity.ts
10189
10017
  /** 用原提交中的 manifest/changelog 校验版本归属,禁止以重跑 HEAD 偷换来源。 */
10190
10018
  async function verifySource$1(pkg, target, options) {
10191
10019
  if (!/^[a-f0-9]{40}$/.test(target)) throw new ReleaseCommandError(`Cannot establish original commit for ${pkg.name}@${pkg.version}; restore its checkpoint or use an explicit verified source commit`);
@@ -10246,8 +10074,7 @@ async function findVersionCommit(pkg, options) {
10246
10074
  await verifySource$1(pkg, target, options);
10247
10075
  return target;
10248
10076
  }
10249
- //#endregion
10250
- //#region src/commands/release/lifecycle/session.ts
10077
+ // src/commands/release/lifecycle/session.ts
10251
10078
  async function openLifecycle(options, selected, distTag = "latest") {
10252
10079
  const github = resolveGitHub(options);
10253
10080
  if (!github.readReleaseState || !github.writeReleaseState || !github.ensureTag || !github.listReleases) throw new ReleaseCommandError("Release recovery requires checkpoint, tag and release query operations");
@@ -10368,8 +10195,7 @@ async function openLifecycle(options, selected, distTag = "latest") {
10368
10195
  releases
10369
10196
  };
10370
10197
  }
10371
- //#endregion
10372
- //#region src/commands/release/lifecycle/index.ts
10198
+ // src/commands/release/lifecycle/index.ts
10373
10199
  async function upload(session, options, distTag) {
10374
10200
  const { state, save, packages, registry, rule } = session;
10375
10201
  const confirmed = new PublishState(packages);
@@ -10475,8 +10301,7 @@ async function publishLifecycle(options, selected, distTag = "latest", completed
10475
10301
  }
10476
10302
  return session.packages;
10477
10303
  }
10478
- //#endregion
10479
- //#region src/commands/release/plan/native.ts
10304
+ // src/commands/release/plan/native.ts
10480
10305
  var PlanError = class extends Error {
10481
10306
  id;
10482
10307
  constructor(id, message) {
@@ -10584,8 +10409,7 @@ function nativePlan(options) {
10584
10409
  version
10585
10410
  };
10586
10411
  }
10587
- //#endregion
10588
- //#region src/commands/release/lines/preview.ts
10412
+ // src/commands/release/lines/preview.ts
10589
10413
  async function assertAppliedLine(rule, releases, options) {
10590
10414
  const names = new Set((await getPublishCandidates(options.cwd)).map((pkg) => pkg.name));
10591
10415
  const publicReleases = releases.filter((pkg) => names.has(pkg.name));
@@ -10616,8 +10440,7 @@ async function assertProjectedLine(rule, releases, options) {
10616
10440
  version: planned.get(manifest.name) ?? manifest.version
10617
10441
  }] : []));
10618
10442
  }
10619
- //#endregion
10620
- //#region src/commands/release/preparation/guard.ts
10443
+ // src/commands/release/preparation/guard.ts
10621
10444
  /** A prepared version belongs to its original source, even before npm accepts it. */
10622
10445
  async function assertPreviousReleaseComplete(options, distTag = "latest") {
10623
10446
  const ledger = await readLedger(options.cwd);
@@ -10667,8 +10490,7 @@ async function assertPreviousReleaseComplete(options, distTag = "latest") {
10667
10490
  }
10668
10491
  if (blocked.length) throw new ReleaseCommandError(`Prepared releases must finish before consuming new intents:\n${blocked.join("\n")}`);
10669
10492
  }
10670
- //#endregion
10671
- //#region src/commands/release/preparation/result.ts
10493
+ // src/commands/release/preparation/result.ts
10672
10494
  async function applyVersions(options) {
10673
10495
  const before = await readWorkspaceVersions(options.cwd, {
10674
10496
  includePrivate: true,
@@ -10699,8 +10521,7 @@ async function applyVersions(options) {
10699
10521
  for (const [name, version] of after) if (before.get(name) !== version && !names.has(name)) throw new ReleaseCommandError(`pnpm version omitted changed package ${name}`);
10700
10522
  return data;
10701
10523
  }
10702
- //#endregion
10703
- //#region src/commands/release/prerelease.ts
10524
+ // src/commands/release/prerelease.ts
10704
10525
  async function releasePrerelease(options, publish) {
10705
10526
  const rule = await resolveReleaseBranch(options);
10706
10527
  const branch = rule.branch;
@@ -10776,8 +10597,7 @@ async function exitPrerelease(options) {
10776
10597
  lane: target.lane
10777
10598
  };
10778
10599
  }
10779
- //#endregion
10780
- //#region src/commands/release/reconcile.ts
10600
+ // src/commands/release/reconcile.ts
10781
10601
  function remoteTagTarget(tag, options) {
10782
10602
  const result = (options.spawn ?? spawnSync)("git", [
10783
10603
  "ls-remote",
@@ -10867,8 +10687,7 @@ async function reconcileRelease(options) {
10867
10687
  skipped: publishedPackages.filter((pkg) => !pending.includes(`${pkg.name}@${pkg.version}`)).map((pkg) => `${pkg.name}@${pkg.version}`)
10868
10688
  };
10869
10689
  }
10870
- //#endregion
10871
- //#region src/commands/release/recovery/candidates.ts
10690
+ // src/commands/release/recovery/candidates.ts
10872
10691
  /** Dependency propagation can change manifests without adding ledger entries. */
10873
10692
  async function readSourceCandidates(options, source) {
10874
10693
  const ledger = await readLedger(options.cwd);
@@ -10898,8 +10717,7 @@ async function readSourceCandidates(options, source) {
10898
10717
  }
10899
10718
  return candidates;
10900
10719
  }
10901
- //#endregion
10902
- //#region src/commands/release/recovery/environment.ts
10720
+ // src/commands/release/recovery/environment.ts
10903
10721
  /** Resolve pnpm from the historical checkout for installs and nested lifecycle scripts. */
10904
10722
  async function sourcePackageManagerEnvironment(options, root) {
10905
10723
  const directory = path$1.join(root, "package-manager");
@@ -10918,8 +10736,7 @@ async function sourcePackageManagerEnvironment(options, root) {
10918
10736
  env["COREPACK_ENABLE_AUTO_PIN"] = "0";
10919
10737
  return env;
10920
10738
  }
10921
- //#endregion
10922
- //#region src/commands/release/recovery/source.ts
10739
+ // src/commands/release/recovery/source.ts
10923
10740
  /** Run current tooling against the original source, never today's package contents. */
10924
10741
  async function recoverSource(options, source) {
10925
10742
  const rule = await resolveStableReleaseBranch(options, "publish");
@@ -11026,8 +10843,7 @@ async function recoverSource(options, source) {
11026
10843
  });
11027
10844
  }
11028
10845
  }
11029
- //#endregion
11030
- //#region src/commands/release/stable.ts
10846
+ // src/commands/release/stable.ts
11031
10847
  async function prepareStableReleases(options) {
11032
10848
  const rule = await resolveStableReleaseBranch(options, "prepare");
11033
10849
  await assertStableLaneAssignments(options);
@@ -11075,8 +10891,7 @@ async function publishStable(options) {
11075
10891
  async function releaseStable(options) {
11076
10892
  return publishStable(options);
11077
10893
  }
11078
- //#endregion
11079
- //#region src/commands/release/trigger.ts
10894
+ // src/commands/release/trigger.ts
11080
10895
  function normalizePath(file) {
11081
10896
  return file.replaceAll("\\", "/").replace(/^\.\//, "");
11082
10897
  }
@@ -11159,8 +10974,7 @@ async function readReleaseTriggerContext(options) {
11159
10974
  ])
11160
10975
  };
11161
10976
  }
11162
- //#endregion
11163
- //#region src/commands/release/stages/receipt.ts
10977
+ // src/commands/release/stages/receipt.ts
11164
10978
  function ordered(value) {
11165
10979
  if (Array.isArray(value)) return value.map(ordered);
11166
10980
  if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => [key, ordered(item)]));
@@ -11281,8 +11095,7 @@ async function reportStage(receipt, options, stage, started, status, progressCwd
11281
11095
  if (summary) await appendFile(summary, `### Release ${stage}\n\n- Status: ${status}\n- Duration: ${(elapsedMs / 1e3).toFixed(2)}s\n- Completed: ${count}\n- Pending: ${pending.join(", ") || "(none)"}\n\n`);
11282
11096
  await saveReceipt(receipt, options);
11283
11097
  }
11284
- //#endregion
11285
- //#region src/commands/release/stages/source.ts
11098
+ // src/commands/release/stages/source.ts
11286
11099
  async function stagedSource(options, create = false, install = false) {
11287
11100
  const source = options.sourceSha ?? getReleaseEnv(options)["REPO_RELEASE_RECOVERY_SOURCE_SHA"]?.trim();
11288
11101
  if (!source) return {
@@ -11388,8 +11201,7 @@ async function stagedSource(options, create = false, install = false) {
11388
11201
  selected
11389
11202
  };
11390
11203
  }
11391
- //#endregion
11392
- //#region src/commands/release/stages/index.ts
11204
+ // src/commands/release/stages/index.ts
11393
11205
  const stages = [
11394
11206
  "plan",
11395
11207
  "verify",
@@ -11540,8 +11352,7 @@ async function releaseCiStage(options) {
11540
11352
  }
11541
11353
  return receipt;
11542
11354
  }
11543
- //#endregion
11544
- //#region src/commands/release/ci.ts
11355
+ // src/commands/release/ci.ts
11545
11356
  async function createReleasePullRequest(options) {
11546
11357
  const rule = await resolveStableReleaseBranch(options, "prepare");
11547
11358
  const releaseBranch = releasePullRequestHead(rule);
@@ -11740,8 +11551,7 @@ async function releaseCi(options) {
11740
11551
  }
11741
11552
  return publishStableCi(options);
11742
11553
  }
11743
- //#endregion
11744
- //#region src/commands/release/repair.ts
11554
+ // src/commands/release/repair.ts
11745
11555
  function parseReleaseTag(tag) {
11746
11556
  const separator = tag.lastIndexOf("@");
11747
11557
  if (separator <= 0) return;
@@ -11862,8 +11672,7 @@ async function repairReleaseNotes(options) {
11862
11672
  skipped
11863
11673
  };
11864
11674
  }
11865
- //#endregion
11866
- //#region src/commands/release/plan/native-report.ts
11675
+ // src/commands/release/plan/native-report.ts
11867
11676
  function createNotes(packages) {
11868
11677
  return {
11869
11678
  packages: packages.map((pkg) => ({
@@ -11968,8 +11777,7 @@ async function createNativeReleasePlan(options) {
11968
11777
  }
11969
11778
  return report;
11970
11779
  }
11971
- //#endregion
11972
- //#region src/commands/release/validation/git.ts
11780
+ // src/commands/release/validation/git.ts
11973
11781
  function safePath(filename) {
11974
11782
  return Boolean(filename) && !filename.includes("\\") && !filename.includes("\0") && !filename.startsWith("/") && !/^[a-z]:/i.test(filename) && filename.split("/").every((part) => part !== "" && part !== "." && part !== ".." && part.toLowerCase() !== ".git");
11975
11783
  }
@@ -12034,8 +11842,7 @@ function readReleasePreparationPolicy(options) {
12034
11842
  if (!entry) throw new Error(`Release validation policy is missing from the frozen base: ${options.path}`);
12035
11843
  return JSON.parse(readBlob(entry, options).toString());
12036
11844
  }
12037
- //#endregion
12038
- //#region src/commands/release/validation/metadata.ts
11845
+ // src/commands/release/validation/metadata.ts
12039
11846
  const manifestFields = [
12040
11847
  "name",
12041
11848
  "version",
@@ -12191,8 +11998,7 @@ async function readExpected(cwd, metadata) {
12191
11998
  }
12192
11999
  return expected;
12193
12000
  }
12194
- //#endregion
12195
- //#region src/commands/release/validation/compare.ts
12001
+ // src/commands/release/validation/compare.ts
12196
12002
  async function comparePreparation(base, head, original, expected, report, options) {
12197
12003
  const paths = /* @__PURE__ */ new Set([
12198
12004
  ...base.keys(),
@@ -12243,8 +12049,7 @@ async function comparePreparation(base, head, original, expected, report, option
12243
12049
  }
12244
12050
  return files;
12245
12051
  }
12246
- //#endregion
12247
- //#region src/commands/release/validation/policy.ts
12052
+ // src/commands/release/validation/policy.ts
12248
12053
  function nativeFile(filename) {
12249
12054
  return /(?:^|\/)package\.json$/.test(filename) || /(?:^|\/)CHANGELOG\.md$/i.test(filename) || filename.startsWith(".changeset/") || ["pnpm-workspace.yaml", "pnpm-lock.yaml"].includes(filename);
12250
12055
  }
@@ -12270,8 +12075,7 @@ function validatePolicy(value) {
12270
12075
  if (!digest && !callback || file.sha256 !== void 0 && file.validate !== void 0) throw new Error(`Generated file requires one SHA-256 digest or trusted callback: ${file.path}`);
12271
12076
  }
12272
12077
  }
12273
- //#endregion
12274
- //#region src/commands/release/validation/index.ts
12078
+ // src/commands/release/validation/index.ts
12275
12079
  /** Verify frozen commits by replaying native versioning in disposable inert metadata. */
12276
12080
  async function validateReleasePreparation(options) {
12277
12081
  const report = {
@@ -12339,8 +12143,7 @@ async function validateReleasePreparation(options) {
12339
12143
  }
12340
12144
  return report;
12341
12145
  }
12342
- //#endregion
12343
- //#region src/commands/skills.ts
12146
+ // src/commands/skills.ts
12344
12147
  /**
12345
12148
  * 内置 skills 目录名称。
12346
12149
  */
@@ -12428,8 +12231,7 @@ async function syncSkills(options = {}) {
12428
12231
  }
12429
12232
  return results;
12430
12233
  }
12431
- //#endregion
12432
- //#region src/commands/templates.ts
12234
+ // src/commands/templates.ts
12433
12235
  async function collectFiles(rootDir) {
12434
12236
  const files = [];
12435
12237
  async function walk(currentDir) {
@@ -12607,8 +12409,7 @@ async function checkTemplates(options = {}) {
12607
12409
  summary: summarizeTemplateChecks(checks)
12608
12410
  };
12609
12411
  }
12610
- //#endregion
12611
- //#region src/commands/upgrade/select.ts
12412
+ // src/commands/upgrade/select.ts
12612
12413
  /** Collect every approval before apply, including atomic migration groups. */
12613
12414
  async function selectUpgradeFiles(plan) {
12614
12415
  const blocked = blockedUpgradeGroups(plan);
@@ -12630,8 +12431,7 @@ async function selectUpgradeFiles(plan) {
12630
12431
  }));
12631
12432
  return selected.flatMap((key) => groups.get(key)?.map((file) => file.path) ?? []);
12632
12433
  }
12633
- //#endregion
12634
- //#region src/commands/upgrade/format.ts
12434
+ // src/commands/upgrade/format.ts
12635
12435
  function formatUpgradePlan(plan, format = "text") {
12636
12436
  const heading = localize("Upgrade plan", "升级计划");
12637
12437
  const lines = [
@@ -12671,8 +12471,7 @@ function formatUpgradePlan(plan, format = "text") {
12671
12471
  for (const blocker of plan.blockers) lines.push(`${blocker.id}: ${blocker.path ?? ""} ${blocker.detail}`);
12672
12472
  return lines.join("\n");
12673
12473
  }
12674
- //#endregion
12675
- //#region src/commands/upgrade/index.ts
12474
+ // src/commands/upgrade/index.ts
12676
12475
  /** Existing execution API now plans the complete operation before its first write. */
12677
12476
  async function upgradeMonorepo(options) {
12678
12477
  if (options.dryRun) return planUpgrade(options);
@@ -12702,8 +12501,7 @@ async function upgradeMonorepo(options) {
12702
12501
  for (const filename of result.changed) logger.success(path.join(plan.rootDir, filename));
12703
12502
  if (result.conflicts?.length) throw new Error(`Unresolved upgrade conflicts: ${result.conflicts.join(", ")}`);
12704
12503
  }
12705
- //#endregion
12706
- //#region src/commands/api-report/intents.ts
12504
+ // src/commands/api-report/intents.ts
12707
12505
  /** Advisory links only: no planner, hooks, intent consumption or version inference. */
12708
12506
  async function publicApiIntents(root) {
12709
12507
  const pending = await readPendingIntents(root);
@@ -12720,8 +12518,7 @@ async function publicApiIntents(root) {
12720
12518
  return !isIntentConsumed(ledger, path.basename(file, ".md"), name ?? "", workspace, lane);
12721
12519
  })).map((item) => item.file);
12722
12520
  }
12723
- //#endregion
12724
- //#region src/commands/api-report/paths.ts
12521
+ // src/commands/api-report/paths.ts
12725
12522
  function reportPath(value) {
12726
12523
  relativeFile$1(value);
12727
12524
  if ([...value].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127 || char === ":") || value.split("/").some((part) => [
@@ -12764,8 +12561,7 @@ async function entryPaths(root, workspace, subpath, config, tsconfig = "tsconfig
12764
12561
  entryRelative: path.relative(root, path.join(root, relative(source)))
12765
12562
  };
12766
12563
  }
12767
- //#endregion
12768
- //#region src/commands/api-report/settings.ts
12564
+ // src/commands/api-report/settings.ts
12769
12565
  function configValue(input) {
12770
12566
  const config = record$6(input);
12771
12567
  if (!config) throw new Error("tooling.apiReports must map exact workspace selectors to entry configurations.");
@@ -12819,8 +12615,7 @@ async function apiReportSettings(cwd, options) {
12819
12615
  }))
12820
12616
  };
12821
12617
  }
12822
- //#endregion
12823
- //#region src/commands/api-report/tool.ts
12618
+ // src/commands/api-report/tool.ts
12824
12619
  async function resolveApiExtractor(root) {
12825
12620
  const require = createRequire(path.join(root, "package.json"));
12826
12621
  let module;
@@ -12893,8 +12688,7 @@ async function extractPublicApi(root, tool, packageJson, entryPoint, tsconfig, o
12893
12688
  });
12894
12689
  }
12895
12690
  }
12896
- //#endregion
12897
- //#region src/commands/api-report/report.ts
12691
+ // src/commands/api-report/report.ts
12898
12692
  const cell = (value) => value.replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
12899
12693
  function formatPublicApiReport(report) {
12900
12694
  const lines = [
@@ -12916,8 +12710,7 @@ function formatPublicApiReport(report) {
12916
12710
  for (const entry of report.skipped) lines.push("", `- ${cell(entry.workspace)}: skipped (${entry.reason})`);
12917
12711
  return lines.join("\n");
12918
12712
  }
12919
- //#endregion
12920
- //#region src/commands/api-report/update.ts
12713
+ // src/commands/api-report/update.ts
12921
12714
  async function planPublicApiUpdate(cwd, options = {}) {
12922
12715
  return {
12923
12716
  schemaVersion: 1,
@@ -12979,8 +12772,7 @@ async function applyPublicApiUpdate(cwd, plan, options = {}) {
12979
12772
  };
12980
12773
  });
12981
12774
  }
12982
- //#endregion
12983
- //#region src/commands/api-report/index.ts
12775
+ // src/commands/api-report/index.ts
12984
12776
  async function checkPublicApi(cwd, options = {}) {
12985
12777
  options.signal?.throwIfAborted();
12986
12778
  const settings = await apiReportSettings(cwd, options);
@@ -13076,8 +12868,7 @@ async function checkPublicApi(cwd, options = {}) {
13076
12868
  report.status = report.entries.some((entry) => entry.status === "failed") ? "failed" : report.entries.some((entry) => entry.status !== "unchanged") ? "changes" : "unchanged";
13077
12869
  return report;
13078
12870
  }
13079
- //#endregion
13080
- //#region src/commands/check/matrix/index.ts
12871
+ // src/commands/check/matrix/index.ts
13081
12872
  const githubJobLimit = 256;
13082
12873
  /** Generate data only; preserve stage ordering, build dependencies and full-fallback semantics. */
13083
12874
  async function resolveAffectedCheckMatrix(options) {
@@ -13119,8 +12910,7 @@ async function resolveAffectedCheckMatrix(options) {
13119
12910
  affectedPlan: plan
13120
12911
  };
13121
12912
  }
13122
- //#endregion
13123
- //#region src/commands/deps/peers/lockfile.ts
12913
+ // src/commands/deps/peers/lockfile.ts
13124
12914
  async function readPeerLockfile(root) {
13125
12915
  try {
13126
12916
  const documents = parseAllDocuments(await readFile(path$1.join(root, "pnpm-lock.yaml"), "utf8"));
@@ -13156,8 +12946,7 @@ function lockedPeerVersion(lock, directory, name, specifiers, source, range) {
13156
12946
  version
13157
12947
  };
13158
12948
  }
13159
- //#endregion
13160
- //#region src/commands/deps/peers/check.ts
12949
+ // src/commands/deps/peers/check.ts
13161
12950
  function comparePeer(check, peer, test, lock) {
13162
12951
  const finish = (status, code, detail) => Object.assign(check, {
13163
12952
  status,
@@ -13196,8 +12985,7 @@ function comparePeer(check, peer, test, lock) {
13196
12985
  if (subset(test.range, peer.range)) return finish("pass", "compatible", "The declared test range is contained in the peer range; installed versions and full-range compatibility are not verified.");
13197
12986
  return rangesOverlap([test.range, peer.range]) === false ? finish("fail", "incompatible_test_range", "The declared test and peer ranges have no shared compatible version.") : finish("unknown", "partial_range_overlap", "The test range is not fully contained in the peer range; pin or lock the version to establish compatibility.");
13198
12987
  }
13199
- //#endregion
13200
- //#region src/commands/deps/peers/specifier.ts
12988
+ // src/commands/deps/peers/specifier.ts
13201
12989
  function resolvePeerSpecifier(name, input, directory, packages, workspace) {
13202
12990
  let effective = input;
13203
12991
  if (input.startsWith("catalog:")) {
@@ -13245,8 +13033,7 @@ function resolvePeerSpecifier(name, input, directory, packages, workspace) {
13245
13033
  workspaceMismatch: !!validRange(resolved) && !satisfies(version, resolved)
13246
13034
  };
13247
13035
  }
13248
- //#endregion
13249
- //#region src/commands/deps/peers/index.ts
13036
+ // src/commands/deps/peers/index.ts
13250
13037
  /** Compare explicit devDependencies with peer promises, without installs or writes. */
13251
13038
  async function checkPeerDependencies(cwd) {
13252
13039
  clearWorkspaceCache();
@@ -13311,8 +13098,7 @@ async function checkPeerDependencies(cwd) {
13311
13098
  }
13312
13099
  return report;
13313
13100
  }
13314
- //#endregion
13315
- //#region src/commands/docs/diagnostics.ts
13101
+ // src/commands/docs/diagnostics.ts
13316
13102
  /** Only repoctl-owned messages enter generated errors and reports; never copy exception text. */
13317
13103
  const messages = {
13318
13104
  "plan-failed": "Run repo docs plan with the same inputs to inspect configuration, source selection and release evidence before retrying.",
@@ -13376,8 +13162,7 @@ var DocsDiagnosticError = class extends Error {
13376
13162
  this.name = "DocsDiagnosticError";
13377
13163
  }
13378
13164
  };
13379
- //#endregion
13380
- //#region src/commands/docs/execute.ts
13165
+ // src/commands/docs/execute.ts
13381
13166
  function runDocsProcess(options, source, args, env) {
13382
13167
  const result = (options.spawn ?? crossSpawn.sync)("pnpm", args, {
13383
13168
  cwd: source,
@@ -13425,8 +13210,7 @@ async function readDeploymentResult(filename) {
13425
13210
  ..."url" in value ? { url: value.url } : {}
13426
13211
  };
13427
13212
  }
13428
- //#endregion
13429
- //#region src/commands/docs/git.ts
13213
+ // src/commands/docs/git.ts
13430
13214
  function gitOutput(cwd, args, input) {
13431
13215
  return execFileSync("git", args, {
13432
13216
  cwd,
@@ -13491,8 +13275,7 @@ async function withSource(cwd, sha, use) {
13491
13275
  });
13492
13276
  }
13493
13277
  }
13494
- //#endregion
13495
- //#region src/commands/docs/patches.ts
13278
+ // src/commands/docs/patches.ts
13496
13279
  const contentExtension = /\.(?:md|mdx|txt|png|jpe?g|gif|webp|avif|svg|ico|pdf)$/i;
13497
13280
  const protectedFile = /(?:^|\/)(?:AGENTS\.md|SKILL\.md|CLAUDE\.md|package\.json|pnpm-lock\.yaml|pnpm-workspace\.yaml|repoctl\.config\.[^/]+)$/i;
13498
13281
  function applyDocsPatches(cwd, source, sourceSha, commits, site) {
@@ -13553,8 +13336,7 @@ function applyDocsPatches(cwd, source, sourceSha, commits, site) {
13553
13336
  }
13554
13337
  return applied;
13555
13338
  }
13556
- //#endregion
13557
- //#region src/commands/docs/catalog.ts
13339
+ // src/commands/docs/catalog.ts
13558
13340
  function resolveCatalog(alias, specifier, configuration) {
13559
13341
  if (!specifier.startsWith("catalog:")) return specifier;
13560
13342
  const catalog = specifier.slice(8) || "default";
@@ -13589,8 +13371,7 @@ async function changedCatalogDependencies(source, publishedSha, manifest) {
13589
13371
  return before === after ? [] : [`${field}.${alias} (${specifier}: ${before} -> ${after})`];
13590
13372
  });
13591
13373
  }
13592
- //#endregion
13593
- //#region src/commands/docs/packages.ts
13374
+ // src/commands/docs/packages.ts
13594
13375
  /** Resolve product runtime relationships from the frozen checkout, including aliases. */
13595
13376
  async function coveredPackages(source, site) {
13596
13377
  const workspace = await getWorkspacePackages(source, { ignorePrivatePackage: false });
@@ -13626,8 +13407,7 @@ async function coveredPackages(source, site) {
13626
13407
  }
13627
13408
  return [...visited].sort().map((name) => byName.get(name));
13628
13409
  }
13629
- //#endregion
13630
- //#region src/commands/docs/coverage.ts
13410
+ // src/commands/docs/coverage.ts
13631
13411
  const excludedInputs = [
13632
13412
  "**/README*",
13633
13413
  "**/CHANGELOG*",
@@ -13685,8 +13465,7 @@ async function checkReleaseCoverage(source, record, site) {
13685
13465
  names: packages.map((pkg) => pkg.manifest.name)
13686
13466
  };
13687
13467
  }
13688
- //#endregion
13689
- //#region src/commands/docs/artifacts/paths.ts
13468
+ // src/commands/docs/artifacts/paths.ts
13690
13469
  function contained(root, filename) {
13691
13470
  const relative = path.relative(root, filename);
13692
13471
  return relative === "" || !path.isAbsolute(relative) && relative !== ".." && !relative.startsWith("../");
@@ -13714,8 +13493,7 @@ async function assertContainedPath(root, filename) {
13714
13493
  return;
13715
13494
  }
13716
13495
  }
13717
- //#endregion
13718
- //#region src/commands/docs/manifest.ts
13496
+ // src/commands/docs/manifest.ts
13719
13497
  const docsManifestPath = ".well-known/repoctl-deployment.json";
13720
13498
  function docsManifest(plan) {
13721
13499
  return {
@@ -13745,8 +13523,7 @@ async function stampDocsManifest(source, output, plan) {
13745
13523
  await assertContainedPath(source, filename);
13746
13524
  await writeFile(filename, `${JSON.stringify(expected)}\n`, { flag: "wx" });
13747
13525
  }
13748
- //#endregion
13749
- //#region src/commands/docs/readiness.ts
13526
+ // src/commands/docs/readiness.ts
13750
13527
  var DocsReadinessError = class extends Error {
13751
13528
  reason;
13752
13529
  attempts;
@@ -13865,8 +13642,7 @@ async function verifyDocsReadiness(target, plan, request = fetch, now = () => pe
13865
13642
  }
13866
13643
  throw new DocsReadinessError(reason, attempts);
13867
13644
  }
13868
- //#endregion
13869
- //#region src/commands/docs/config.ts
13645
+ // src/commands/docs/config.ts
13870
13646
  function assertPatterns(patterns, label) {
13871
13647
  if (!patterns.length || !patterns.some((value) => !value.startsWith("!"))) throw new Error(`${label} requires at least one positive repository-relative glob`);
13872
13648
  for (const pattern of patterns) {
@@ -13906,8 +13682,7 @@ async function resolveDocsSite(options) {
13906
13682
  validateSite(site);
13907
13683
  return site;
13908
13684
  }
13909
- //#endregion
13910
- //#region src/commands/docs/state.ts
13685
+ // src/commands/docs/state.ts
13911
13686
  function isObject(value) {
13912
13687
  return typeof value === "object" && value !== null && !Array.isArray(value);
13913
13688
  }
@@ -13988,8 +13763,7 @@ async function writeDocsState(context, state, revision) {
13988
13763
  throw new DocsDiagnosticError("checkpoint-write-failed");
13989
13764
  }
13990
13765
  }
13991
- //#endregion
13992
- //#region src/commands/docs/recovery.ts
13766
+ // src/commands/docs/recovery.ts
13993
13767
  async function prepareDocsContext(options) {
13994
13768
  const identity = docsIdentity(options);
13995
13769
  const previous = await readDocsState(identity, options.site, options.channel);
@@ -14013,8 +13787,7 @@ async function prepareDocsContext(options) {
14013
13787
  function assertRecoveredPlan(plan, snapshot, deploymentId) {
14014
13788
  if (plan.sourceSha !== snapshot.sourceSha || plan.releaseId !== snapshot.releaseId || plan.treeSha !== snapshot.treeSha || plan.deploymentId !== deploymentId || JSON.stringify(plan.commits) !== JSON.stringify(snapshot.commits)) throw new DocsDiagnosticError("snapshot-mismatch");
14015
13789
  }
14016
- //#endregion
14017
- //#region src/commands/docs/plan.ts
13790
+ // src/commands/docs/plan.ts
14018
13791
  async function prepareDocsPlan(options) {
14019
13792
  if (options.channel === "preview" && (options.release || options.commits?.length)) throw new DocsDiagnosticError("preview-selection-invalid");
14020
13793
  if (options.channel === "stable" && options.sourceSha) throw new DocsDiagnosticError("stable-selection-invalid");
@@ -14090,8 +13863,7 @@ async function prepareDocsPlan(options) {
14090
13863
  async function planDocsDeployment(options) {
14091
13864
  return (await prepareDocsPlan(options)).plan;
14092
13865
  }
14093
- //#endregion
14094
- //#region src/commands/docs/providers/cloudflare/client.ts
13866
+ // src/commands/docs/providers/cloudflare/client.ts
14095
13867
  const cloudflareApiOrigin = "https://api.cloudflare.com/client/v4";
14096
13868
  const versionPattern = /^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/i;
14097
13869
  const deploymentMessage = (deploymentId) => `repoctl-docs:${deploymentId}`;
@@ -14162,8 +13934,7 @@ async function activeMatchingVersion(client, deploymentId) {
14162
13934
  if (message !== void 0 && typeof message !== "string") throw new DocsDiagnosticError("provider-response-invalid");
14163
13935
  return message === deploymentMessage(deploymentId) ? versionId : void 0;
14164
13936
  }
14165
- //#endregion
14166
- //#region src/commands/docs/providers/cloudflare/shape.ts
13937
+ // src/commands/docs/providers/cloudflare/shape.ts
14167
13938
  const common = /* @__PURE__ */ new Set([
14168
13939
  "name",
14169
13940
  "account_id",
@@ -14225,8 +13996,7 @@ function customDomains(config) {
14225
13996
  return route["pattern"].toLowerCase();
14226
13997
  });
14227
13998
  }
14228
- //#endregion
14229
- //#region src/commands/docs/providers/cloudflare/config.ts
13999
+ // src/commands/docs/providers/cloudflare/config.ts
14230
14000
  async function readCloudflareConfig(source, target) {
14231
14001
  if (!/^[a-f\d]{32}$/.test(target.accountId) || !/^[a-z\d][a-z\d-]{0,62}$/.test(target.workerName) || target.environment !== void 0 && !/^[\w-]+$/.test(target.environment)) throw new DocsDiagnosticError("provider-target-invalid");
14232
14002
  const filename = relativePath(source, target.config, "Cloudflare config");
@@ -14295,8 +14065,7 @@ async function preflightConfiguration(source, site, channel) {
14295
14065
  }
14296
14066
  return current;
14297
14067
  }
14298
- //#endregion
14299
- //#region src/commands/docs/providers/cloudflare/wrangler.ts
14068
+ // src/commands/docs/providers/cloudflare/wrangler.ts
14300
14069
  /** Unset alternate credentials and CI identity overrides; empty values can still override Wrangler config. */
14301
14070
  function wranglerEnvironment(env, accountId, environment, output) {
14302
14071
  const result = {
@@ -14347,8 +14116,7 @@ async function readWranglerVersion(filename, worker, environment) {
14347
14116
  if (versions.size !== 1) throw new DocsDiagnosticError("wrangler-result-invalid");
14348
14117
  return [...versions][0];
14349
14118
  }
14350
- //#endregion
14351
- //#region src/commands/docs/providers/index.ts
14119
+ // src/commands/docs/providers/index.ts
14352
14120
  /** Select a closed provider contract without changing script targets or frozen plan identities. */
14353
14121
  async function prepareDocsProvider(options, source, site, plan, env, resultFile, operation) {
14354
14122
  const target = site[plan.channel];
@@ -14406,8 +14174,7 @@ async function reconcileDocsProvider(options, site, plan, env, receipt) {
14406
14174
  if (await activeMatchingVersion(cloudflareClient(target, env, options.fetch), plan.deploymentId) !== receipt.versionId) throw new DocsDiagnosticError("saved-version-inactive");
14407
14175
  }
14408
14176
  }
14409
- //#endregion
14410
- //#region src/commands/docs/report/safety.ts
14177
+ // src/commands/docs/report/safety.ts
14411
14178
  const stageOrder = [
14412
14179
  "plan",
14413
14180
  "preflight",
@@ -14454,8 +14221,7 @@ function identityRedactor(env) {
14454
14221
  function duration(start, end) {
14455
14222
  return Number.isFinite(start) && Number.isFinite(end) ? Math.max(0, Math.round(end - start)) : 0;
14456
14223
  }
14457
- //#endregion
14458
- //#region src/commands/docs/report/summary.ts
14224
+ // src/commands/docs/report/summary.ts
14459
14225
  function escape$1(value) {
14460
14226
  return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("`", "&#96;").replaceAll("|", "&#124;").replace(/[\p{Cc}\p{Cf}]+/gu, " ").replace(/[[\]()!*_\\~]/g, (character) => `&#${character.charCodeAt(0)};`);
14461
14227
  }
@@ -14491,8 +14257,7 @@ async function writeDocsSummary(report, filename) {
14491
14257
  report.warnings = [.../* @__PURE__ */ new Set([...report.warnings ?? [], "summary-write-failed"])];
14492
14258
  }
14493
14259
  }
14494
- //#endregion
14495
- //#region src/commands/docs/report/index.ts
14260
+ // src/commands/docs/report/index.ts
14496
14261
  var DocsDeploymentError = class extends Error {
14497
14262
  report;
14498
14263
  constructor(report) {
@@ -14596,8 +14361,7 @@ function createDocsReport(options, clock = {
14596
14361
  }
14597
14362
  };
14598
14363
  }
14599
- //#endregion
14600
- //#region src/commands/docs/deploy.ts
14364
+ // src/commands/docs/deploy.ts
14601
14365
  /** Build, deploy and optionally verify an independently recoverable documentation snapshot. */
14602
14366
  async function deployDocs(options) {
14603
14367
  const report = createDocsReport(options);
@@ -14744,8 +14508,7 @@ async function deployDocs(options) {
14744
14508
  throw await report.fail(error, resumablePhase, receipt?.versionId);
14745
14509
  }
14746
14510
  }
14747
- //#endregion
14748
- //#region src/commands/doctor/security/preset.ts
14511
+ // src/commands/doctor/security/preset.ts
14749
14512
  const presetValues = {
14750
14513
  minimumReleaseAge: 1440,
14751
14514
  minimumReleaseAgeStrict: true,
@@ -14822,8 +14585,7 @@ async function applyInstallSecurityPreset(cwd, plan) {
14822
14585
  changed: ["pnpm-workspace.yaml"]
14823
14586
  };
14824
14587
  }
14825
- //#endregion
14826
- //#region src/commands/hooks/checks.ts
14588
+ // src/commands/hooks/checks.ts
14827
14589
  const jobPrefix = "repoctl-domain:";
14828
14590
  /** Modify native jobs only; Lefthook remains responsible for index protection. */
14829
14591
  async function prepareHookChecks(cwd, checks) {
@@ -14868,8 +14630,7 @@ async function prepareHookChecks(cwd, checks) {
14868
14630
  async function applyHookChecks(plan) {
14869
14631
  if (plan.updated !== plan.content) await writeFile(plan.filename, plan.updated);
14870
14632
  }
14871
- //#endregion
14872
- //#region src/commands/hooks/index.ts
14633
+ // src/commands/hooks/index.ts
14873
14634
  function enabled(value) {
14874
14635
  return Boolean(value && value !== "0" && value !== "false");
14875
14636
  }
@@ -14961,8 +14722,7 @@ async function installGitHooks(cwd, options = {}) {
14961
14722
  status: "installed"
14962
14723
  };
14963
14724
  }
14964
- //#endregion
14965
- //#region src/commands/init/devcontainer/files.ts
14725
+ // src/commands/init/devcontainer/files.ts
14966
14726
  const hash = (content) => createHash("sha256").update(content).digest("hex");
14967
14727
  async function readOptional(root, relative) {
14968
14728
  const filename = await checkedFile(root, relative);
@@ -14980,8 +14740,7 @@ async function assertInputs(root, inputs) {
14980
14740
  if ((content === null ? null : hash(content)) !== input.hash) throw new Error(`Dev Container input changed: ${input.path}`);
14981
14741
  }
14982
14742
  }
14983
- //#endregion
14984
- //#region src/commands/init/devcontainer/templates.ts
14743
+ // src/commands/init/devcontainer/templates.ts
14985
14744
  async function devContainerFiles(nodeVersion) {
14986
14745
  const config = {
14987
14746
  name: "pnpm monorepo",
@@ -15039,8 +14798,7 @@ async function devContainerFiles(nodeVersion) {
15039
14798
  [".devcontainer/README.md", readme]
15040
14799
  ]);
15041
14800
  }
15042
- //#endregion
15043
- //#region src/commands/init/devcontainer/plan.ts
14801
+ // src/commands/init/devcontainer/plan.ts
15044
14802
  async function planDevContainer(cwd, options = {}) {
15045
14803
  const workspace = await findWorkspaceDir(cwd);
15046
14804
  if (!workspace) throw new Error("Dev Container presets require an existing pnpm workspace root.");
@@ -15104,8 +14862,7 @@ async function planDevContainer(cwd, options = {}) {
15104
14862
  fingerprint: hash(JSON.stringify(payload))
15105
14863
  };
15106
14864
  }
15107
- //#endregion
15108
- //#region src/commands/init/devcontainer/apply.ts
14865
+ // src/commands/init/devcontainer/apply.ts
15109
14866
  async function apply(cwd, plan) {
15110
14867
  const current = await planDevContainer(cwd, { nodeVersion: plan.nodeVersion });
15111
14868
  if (current.workspaceDir !== plan.workspaceDir || JSON.stringify(current.inputs) !== JSON.stringify(plan.inputs)) throw new Error("Dev Container workspace inputs changed; generate a fresh plan.");
@@ -15146,8 +14903,7 @@ async function applyDevContainerPlan(cwd, plan) {
15146
14903
  if (current.workspaceDir !== plan.workspaceDir) throw new Error("Dev Container workspace changed; generate a fresh plan.");
15147
14904
  return withOperationLock(current.workspaceDir, "devcontainer", () => apply(cwd, plan));
15148
14905
  }
15149
- //#endregion
15150
- //#region src/core/presets/asset-plan/plan.ts
14906
+ // src/core/presets/asset-plan/plan.ts
15151
14907
  /** Inspection is read-only. Applying this plan is the only preset asset write entrypoint. */
15152
14908
  async function planOrganizationPresetAssets(cwd, targets) {
15153
14909
  const selected = targets === void 0 ? void 0 : [...new Set(targets.map(presetAssetTarget))].sort();
@@ -15257,8 +15013,7 @@ async function planOrganizationPresetAssets(cwd, targets) {
15257
15013
  plan.status = plan.conflicts.length ? "blocked" : plan.files.some((file) => file.status !== "identical" || file.baseline?.beforeHash !== file.baseline?.afterHash) ? "ready" : "unchanged";
15258
15014
  return plan;
15259
15015
  }
15260
- //#endregion
15261
- //#region src/core/presets/asset-plan/apply.ts
15016
+ // src/core/presets/asset-plan/apply.ts
15262
15017
  async function applyOrganizationPresetAssets(plan) {
15263
15018
  if (!plan || plan.schemaVersion !== 1 || plan.kind !== "organization-preset-assets" || typeof plan.rootDir !== "string" || !Array.isArray(plan.files)) throw new Error("Unsupported organization preset asset plan");
15264
15019
  if (plan.status === "blocked") throw new Error("Organization preset asset plan is blocked");
@@ -15330,8 +15085,7 @@ async function applyOrganizationPresetAssets(plan) {
15330
15085
  };
15331
15086
  });
15332
15087
  }
15333
- //#endregion
15334
- //#region src/commands/maintenance/apply.ts
15088
+ // src/commands/maintenance/apply.ts
15335
15089
  /** Reconcile only inputs written by the reviewed root plan; preset outcomes remain immutable. */
15336
15090
  async function applyMaintenancePlans(cwd, report) {
15337
15091
  const presetPlan = report.presets?.plan;
@@ -15356,8 +15110,7 @@ async function applyMaintenancePlans(cwd, report) {
15356
15110
  }
15357
15111
  return rootChanged || presetChanged;
15358
15112
  }
15359
- //#endregion
15360
- //#region src/commands/maintenance/process.ts
15113
+ // src/commands/maintenance/process.ts
15361
15114
  const digest = (value) => createHash("sha256").update(value).digest("hex");
15362
15115
  const maintenanceGitBytes = (cwd, args) => execFileSync("git", ["--no-optional-locks", ...args], {
15363
15116
  cwd,
@@ -15394,8 +15147,7 @@ function maintenanceCommand(options, args) {
15394
15147
  output: `${result.stdout ?? ""}\n${result.stderr ?? ""}\n${result.error?.message ?? ""}`
15395
15148
  };
15396
15149
  }
15397
- //#endregion
15398
- //#region src/commands/maintenance/artifacts.ts
15150
+ // src/commands/maintenance/artifacts.ts
15399
15151
  function entries(text) {
15400
15152
  return new Map(text.split("\0").filter(Boolean).map((entry) => {
15401
15153
  const [metadata, filename] = entry.split(" ");
@@ -15519,8 +15271,7 @@ function maintenanceBody(report) {
15519
15271
  "The workflow artifact contains the complete plan, exact patch, file hashes, skipped/conflicting entries and validation logs. This PR is never merged automatically."
15520
15272
  ].join("\n")}\n`;
15521
15273
  }
15522
- //#endregion
15523
- //#region src/commands/maintenance/migrations.ts
15274
+ // src/commands/maintenance/migrations.ts
15524
15275
  /** Export the same built-in identities and path policy that produced the upgrade plan. */
15525
15276
  function getMaintenanceMigrationPolicy() {
15526
15277
  return {
@@ -15572,8 +15323,7 @@ async function maintenanceMigrationPath(cwd, head, toolVersion, plan) {
15572
15323
  fail
15573
15324
  })?.path ?? null;
15574
15325
  }
15575
- //#endregion
15576
- //#region src/commands/maintenance/presets/bytes.ts
15326
+ // src/commands/maintenance/presets/bytes.ts
15577
15327
  /** Capture exact working preconditions before applying; publication checks their Git identities. */
15578
15328
  async function capturePresetCheckout(cwd, plan) {
15579
15329
  const autocrlf = maintenanceGit(cwd, [
@@ -15615,8 +15365,7 @@ async function capturePresetCheckout(cwd, plan) {
15615
15365
  before
15616
15366
  };
15617
15367
  }
15618
- //#endregion
15619
- //#region src/commands/maintenance/versions.ts
15368
+ // src/commands/maintenance/versions.ts
15620
15369
  function lockedMaintenanceVersion(source, packageName = "repoctl", exact = false) {
15621
15370
  const lock = parseWorkspaceLockfile(source);
15622
15371
  if (!lock) throw new Error("Unsupported or ambiguous pnpm workspace lockfile; expected one v9 workspace document.");
@@ -15676,8 +15425,7 @@ function detectMaintenanceVersionChange(before, after) {
15676
15425
  };
15677
15426
  }
15678
15427
  }
15679
- //#endregion
15680
- //#region src/commands/maintenance/presets.ts
15428
+ // src/commands/maintenance/presets.ts
15681
15429
  function exactPresetDependency(manifest, packageName) {
15682
15430
  if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) throw new Error("Maintenance requires a root package manifest on both sides.");
15683
15431
  const root = manifest;
@@ -15761,8 +15509,7 @@ async function planMaintenancePresets(options, head, before, after) {
15761
15509
  function assertMaintenancePresetLocks(presets, lockfile) {
15762
15510
  for (const change of presets?.versions ?? []) if (lockedMaintenanceVersion(lockfile, change.packageName, true) !== change.to) throw new Error(`Asset dependency resolution changed the target preset version: ${change.packageName}.`);
15763
15511
  }
15764
- //#endregion
15765
- //#region src/commands/maintenance/prepare.ts
15512
+ // src/commands/maintenance/prepare.ts
15766
15513
  async function runCheck(options, report, name, args) {
15767
15514
  const result = maintenanceCommand(options, args);
15768
15515
  const log = `check-${report.checks.length}.log`;
@@ -15894,8 +15641,7 @@ async function prepareMaintenanceUpgrade(input) {
15894
15641
  await writeFile(path$1.join(outputDirectory, "body.md"), maintenanceBody(report));
15895
15642
  return report;
15896
15643
  }
15897
- //#endregion
15898
- //#region src/commands/maintenance/workflow.ts
15644
+ // src/commands/maintenance/workflow.ts
15899
15645
  /** Export an opt-in workflow. The publisher embeds trusted code and never imports workspace scripts. */
15900
15646
  async function getMaintenanceWorkflow(cwd) {
15901
15647
  const directory = path$1.join(packageDir$1, "resources/maintenance");
@@ -15920,8 +15666,7 @@ async function getMaintenanceWorkflow(cwd) {
15920
15666
  ].map((source) => source.replace("export function", "function")).join("\n")}\n${validator.replace(/^import .*\n/gmu, "").replace("export async function", "async function")}`.trimEnd();
15921
15667
  return template.replace(" __VALIDATOR__", () => script.split("\n").map((line) => ` ${line}`).join("\n")).replace("__TARGETS__", () => JSON.stringify(getAssetTargets())).replace("__PRESET_ASSETS__", () => JSON.stringify(policy)).replace("__MIGRATION_POLICY__", () => JSON.stringify(getMaintenanceMigrationPolicy()));
15922
15668
  }
15923
- //#endregion
15924
- //#region src/commands/package-check/index.ts
15669
+ // src/commands/package-check/index.ts
15925
15670
  /** Build, pack, and consume actual publish artifacts without publishing or versioning. */
15926
15671
  async function checkPackages(options) {
15927
15672
  if (process.env["REPOCTL_PACKAGE_CHECK_RUNNING"]) throw new Error("package check cannot run recursively from a build or pack lifecycle script.");
@@ -16013,8 +15758,7 @@ async function checkPackages(options) {
16013
15758
  });
16014
15759
  }
16015
15760
  }
16016
- //#endregion
16017
- //#region src/commands/project-references/ownership.ts
15761
+ // src/commands/project-references/ownership.ts
16018
15762
  async function readOwnership(root, inputs) {
16019
15763
  if (!await exists$1(root, ".repoctl/typescript-references.json")) {
16020
15764
  inputs[ownershipFile] = "missing";
@@ -16087,8 +15831,7 @@ function renderReferences(ts, config, references) {
16087
15831
  const end = object.end - 1;
16088
15832
  return (last && !object.properties.hasTrailingComma ? `${config.original.slice(0, last.end)},${config.original.slice(last.end, end)}` : config.original.slice(0, end)) + insertion + config.original.slice(end);
16089
15833
  }
16090
- //#endregion
16091
- //#region src/commands/project-references/settings.ts
15834
+ // src/commands/project-references/settings.ts
16092
15835
  function parseSettings(value) {
16093
15836
  if (value === void 0) return {};
16094
15837
  const config = record$6(value);
@@ -16119,8 +15862,7 @@ function validateLayers(layers) {
16119
15862
  if (tooling && Object.hasOwn(tooling, "projectReferences")) parseSettings(tooling["projectReferences"]);
16120
15863
  }
16121
15864
  }
16122
- //#endregion
16123
- //#region src/commands/project-references/plan.ts
15865
+ // src/commands/project-references/plan.ts
16124
15866
  function operation(file, before, after) {
16125
15867
  return {
16126
15868
  path: file,
@@ -16276,8 +16018,7 @@ async function planProjectReferences(cwd) {
16276
16018
  plan.action = plan.diagnostics.length ? "blocked" : !plan.enabled ? "disabled" : plan.operations.length ? "update" : "unchanged";
16277
16019
  return plan;
16278
16020
  }
16279
- //#endregion
16280
- //#region src/commands/project-references/apply.ts
16021
+ // src/commands/project-references/apply.ts
16281
16022
  /** Re-derive every byte before staging, then verify the final graph before discarding backups. */
16282
16023
  async function applyLocked(plan) {
16283
16024
  const fresh = await planProjectReferences(plan.workspaceDir);
@@ -16351,8 +16092,7 @@ async function applyProjectReferencesPlan(plan) {
16351
16092
  if (plan?.schemaVersion !== 1 || typeof plan.workspaceDir !== "string" || path.normalize(await realpath(plan.workspaceDir)) !== plan.workspaceDir) throw new Error("Invalid project references plan or noncanonical workspace root.");
16352
16093
  return withOperationLock(plan.workspaceDir, "typescript-references", () => applyLocked(plan));
16353
16094
  }
16354
- //#endregion
16355
- //#region src/commands/project-references/index.ts
16095
+ // src/commands/project-references/index.ts
16356
16096
  async function checkProjectReferences(cwd) {
16357
16097
  const plan = await planProjectReferences(cwd);
16358
16098
  return {
@@ -16364,8 +16104,7 @@ async function checkProjectReferences(cwd) {
16364
16104
  async function syncProjectReferences(cwd) {
16365
16105
  return applyProjectReferencesPlan(await planProjectReferences(cwd));
16366
16106
  }
16367
- //#endregion
16368
- //#region src/commands/release/snapshot/source/paths.ts
16107
+ // src/commands/release/snapshot/source/paths.ts
16369
16108
  /** 产物和 Git tree 使用逻辑路径;只在文件系统边界转换分隔符。 */
16370
16109
  function sourceRelativePath(value) {
16371
16110
  if (typeof value !== "string" || !value || path$1.posix.isAbsolute(value) || path$1.win32.isAbsolute(value) || /[\\:\p{Cc}]/u.test(value) || value.split("/").some((part) => !part || part === "." || part === ".." || [".git", "node_modules"].includes(part.toLowerCase()))) throw new Error("Snapshot source paths must be canonical relative paths without Git or node_modules components.");
@@ -16374,8 +16113,7 @@ function sourceRelativePath(value) {
16374
16113
  function sourcePath(directory, relative) {
16375
16114
  return path$1.join(directory, ...sourceRelativePath(relative).split("/"));
16376
16115
  }
16377
- //#endregion
16378
- //#region src/commands/release/snapshot/source/references.ts
16116
+ // src/commands/release/snapshot/source/references.ts
16379
16117
  function snapshotSourceEvidence(options) {
16380
16118
  const allowed = options.referenceGitlinks ?? [];
16381
16119
  if (!Array.isArray(allowed)) throw new TypeError("Snapshot referenceGitlinks must be an explicit array of Git tree paths.");
@@ -16436,8 +16174,7 @@ function assertSnapshotEvidence(report, options) {
16436
16174
  report.referenceGitlinks = evidence.referenceGitlinks;
16437
16175
  return evidence;
16438
16176
  }
16439
- //#endregion
16440
- //#region src/commands/release/snapshot/plan.ts
16177
+ // src/commands/release/snapshot/plan.ts
16441
16178
  /** Reuse pnpm's version explanations, while snapshotting every public package together. */
16442
16179
  async function createSnapshotPlan(options) {
16443
16180
  const { identity, key, tag } = snapshotIdentity(options);
@@ -16520,8 +16257,7 @@ async function createSnapshotPlan(options) {
16520
16257
  installCommand: `pnpm ${installArgs.map(quote).join(" ")}`
16521
16258
  };
16522
16259
  }
16523
- //#endregion
16524
- //#region src/commands/release/snapshot/source/archive.ts
16260
+ // src/commands/release/snapshot/source/archive.ts
16525
16261
  /** 最终归档中出现的外部输入必须保留回执字节,防止 pack 生命周期临时替换后还原。 */
16526
16262
  function assertPreparedArchive(entries, pkg, report) {
16527
16263
  if (!report.preparation) return;
@@ -16535,8 +16271,7 @@ function assertPreparedArchive(entries, pkg, report) {
16535
16271
  if (entry && (entry.type !== "File" || createHash("sha256").update(entry.data).digest("hex") !== expected.sha256)) throw new Error(`Snapshot prepared artifact changed during build or pack: ${expected.path} in tarball ${pkg.name}.`);
16536
16272
  }
16537
16273
  }
16538
- //#endregion
16539
- //#region src/commands/release/snapshot/archive/finalize.ts
16274
+ // src/commands/release/snapshot/archive/finalize.ts
16540
16275
  /** Finalize only packed metadata, after every pack lifecycle script has completed. */
16541
16276
  async function finalizeSnapshotTarball(bytes, pkg, report, target, references) {
16542
16277
  if (target.provider === "pkg-pr-new" && !/^[\w.-]+\/[\w.-]+$/.test(target.repository)) throw new Error("Snapshot pkg.pr.new target requires an owner/repository identity.");
@@ -16569,8 +16304,7 @@ async function finalizeSnapshotTarball(bytes, pkg, report, target, references) {
16569
16304
  expected
16570
16305
  };
16571
16306
  }
16572
- //#endregion
16573
- //#region src/commands/release/snapshot/artifacts.ts
16307
+ // src/commands/release/snapshot/artifacts.ts
16574
16308
  async function prepareSnapshotArtifacts(source, report, options, target, references) {
16575
16309
  snapshotCommand("pnpm", [
16576
16310
  ...isolatedPnpmOptions,
@@ -16630,8 +16364,7 @@ async function prepareSnapshotArtifacts(source, report, options, target, referen
16630
16364
  if (report.checks.some((check) => check.status === "failed")) throw new Error(`Snapshot package validation failed: ${report.checks.filter((check) => check.status === "failed").map((check) => `${check.name}: ${check.diagnostics.filter((item) => item.severity === "error").map((item) => item.code).join(", ")}`).join("; ")}`);
16631
16365
  report.status = "prepared";
16632
16366
  }
16633
- //#endregion
16634
- //#region src/commands/release/snapshot/isolate.ts
16367
+ // src/commands/release/snapshot/isolate.ts
16635
16368
  function inside$2(root, target) {
16636
16369
  const relative = path$1.relative(root, target);
16637
16370
  return relative === "" || !relative.startsWith(`..${path$1.sep}`) && relative !== ".." && !path$1.isAbsolute(relative);
@@ -16696,8 +16429,7 @@ async function isolateSnapshot(report, options) {
16696
16429
  await assertOmittedReferences(source, evidence.referenceGitlinks);
16697
16430
  return source;
16698
16431
  }
16699
- //#endregion
16700
- //#region src/commands/release/snapshot/manifests.ts
16432
+ // src/commands/release/snapshot/manifests.ts
16701
16433
  /** Keep workspace edges intact until build and pack lifecycle scripts have finished. */
16702
16434
  async function writeSnapshotManifests(source, report) {
16703
16435
  clearWorkspaceCache();
@@ -16742,8 +16474,7 @@ async function writeSnapshotManifests(source, report) {
16742
16474
  }
16743
16475
  return references;
16744
16476
  }
16745
- //#endregion
16746
- //#region src/commands/release/snapshot/source/inventory.ts
16477
+ // src/commands/release/snapshot/source/inventory.ts
16747
16478
  /** 安装依赖不属于归档源码;其余原有文件和所有新增产物均逐字节检查。 */
16748
16479
  async function sourceInventory(directory) {
16749
16480
  const files = /* @__PURE__ */ new Map();
@@ -16764,8 +16495,7 @@ async function sourceInventory(directory) {
16764
16495
  await visit(directory, []);
16765
16496
  return files;
16766
16497
  }
16767
- //#endregion
16768
- //#region src/commands/release/snapshot/source/prepare.ts
16498
+ // src/commands/release/snapshot/source/prepare.ts
16769
16499
  function preparationContext(directory, report) {
16770
16500
  if (!report.sourceTree) throw new Error("Snapshot source preparation requires verified Git tree evidence.");
16771
16501
  return Object.freeze({
@@ -16821,8 +16551,7 @@ async function assertPreparedArtifacts(directory, report) {
16821
16551
  const files = await sourceInventory(directory);
16822
16552
  for (const expected of report.preparation.files) if (files.get(expected.path)?.sha256 !== expected.sha256) throw new Error(`Snapshot prepared artifact changed during build or pack: ${expected.path}`);
16823
16553
  }
16824
- //#endregion
16825
- //#region src/commands/release/snapshot/prepare.ts
16554
+ // src/commands/release/snapshot/prepare.ts
16826
16555
  async function checkpointSnapshot(report) {
16827
16556
  if (report.outputDirectory) {
16828
16557
  const target = path$1.join(report.outputDirectory, "snapshot-report.json");
@@ -16851,8 +16580,7 @@ async function prepareNightlySnapshot(report, options, target) {
16851
16580
  throw error;
16852
16581
  }
16853
16582
  }
16854
- //#endregion
16855
- //#region src/commands/release/snapshot/publish/registry.ts
16583
+ // src/commands/release/snapshot/publish/registry.ts
16856
16584
  async function registryPresence(pkg, report, options, deadline) {
16857
16585
  const settings = registrySettings(options);
16858
16586
  const metadata = await registryClient(options).inspect(pkg, deadline ?? performance.now() + Math.min(settings.visibilityTimeoutMs, settings.requestTimeoutMs * 3 + 3e3), "manifest");
@@ -16877,8 +16605,7 @@ async function confirmSnapshotPublication(pkg, report, options) {
16877
16605
  }
16878
16606
  throw new Error(`Published snapshot metadata confirmation timed out for ${pkg.name}@${pkg.version}; the accepted upload was not repeated.`);
16879
16607
  }
16880
- //#endregion
16881
- //#region src/commands/release/snapshot/publish/index.ts
16608
+ // src/commands/release/snapshot/publish/index.ts
16882
16609
  async function publishSnapshotArtifacts(report, options, checkpoint) {
16883
16610
  const cwd = path$1.join(report.outputDirectory, "publication");
16884
16611
  await mkdir(cwd);
@@ -16914,8 +16641,7 @@ async function publishSnapshotArtifacts(report, options, checkpoint) {
16914
16641
  }
16915
16642
  report.status = "published";
16916
16643
  }
16917
- //#endregion
16918
- //#region src/commands/release/snapshot/index.ts
16644
+ // src/commands/release/snapshot/index.ts
16919
16645
  /** Prepare immutable package artifacts in an archive of HEAD; original files and Git refs are never versioned. */
16920
16646
  async function releaseSnapshot(options) {
16921
16647
  const report = await createSnapshotPlan(options);
@@ -16939,8 +16665,7 @@ async function releaseSnapshot(options) {
16939
16665
  await checkpoint();
16940
16666
  return report;
16941
16667
  }
16942
- //#endregion
16943
- //#region src/commands/release/nightly/consumer/missing-version.ts
16668
+ // src/commands/release/nightly/consumer/missing-version.ts
16944
16669
  function isRecord(value) {
16945
16670
  return value !== null && typeof value === "object" && !Array.isArray(value);
16946
16671
  }
@@ -16986,8 +16711,7 @@ function missingRegistryVersion(error, expected) {
16986
16711
  function missingBatchVersion(error, report) {
16987
16712
  return missingRegistryVersion(error, new Set(report.packages.flatMap((pkg) => [`${pkg.name}@snapshot-nightly`, `${pkg.name}@${pkg.version}`])));
16988
16713
  }
16989
- //#endregion
16990
- //#region src/commands/release/nightly/consumer/install.ts
16714
+ // src/commands/release/nightly/consumer/install.ts
16991
16715
  /** Retry installation only; accepted uploads and subsequent identity checks are never repeated. */
16992
16716
  async function installNightlyConsumer(report, options, directory, run) {
16993
16717
  const budget = report.provider === "npm" ? Math.min(9e5, registrySettings(options).visibilityTimeoutMs) : 6e5;
@@ -17039,8 +16763,7 @@ async function installNightlyConsumer(report, options, directory, run) {
17039
16763
  }
17040
16764
  throw new Error("Nightly consumer installation visibility timed out; the confirmed npm batch was not uploaded again.", { cause: lastFailure });
17041
16765
  }
17042
- //#endregion
17043
- //#region src/commands/release/nightly/consumer/manifests.ts
16766
+ // src/commands/release/nightly/consumer/manifests.ts
17044
16767
  /** Derive the consumer contract from the checked artifacts, never mutable source manifests. */
17045
16768
  async function nightlyConsumerManifests(report) {
17046
16769
  const snapshot = report.snapshot;
@@ -17055,8 +16778,7 @@ async function nightlyConsumerManifests(report) {
17055
16778
  return manifest;
17056
16779
  }));
17057
16780
  }
17058
- //#endregion
17059
- //#region src/commands/release/nightly/consumer.ts
16781
+ // src/commands/release/nightly/consumer.ts
17060
16782
  /** Exercise the real published channel with no workspace links or dependency overrides. */
17061
16783
  async function verifyNightlyConsumer(report, options) {
17062
16784
  if (!report.confirmed || !report.snapshot || !report.outputDirectory || !report.packages.length) throw new Error("Nightly consumer requires a confirmed publication and retained artifacts.");
@@ -17160,8 +16882,7 @@ async function verifyNightlyConsumer(report, options) {
17160
16882
  }
17161
16883
  if (failure) throw failure;
17162
16884
  }
17163
- //#endregion
17164
- //#region src/commands/release/nightly/context.ts
16885
+ // src/commands/release/nightly/context.ts
17165
16886
  async function nightlyContext(options, config) {
17166
16887
  const env = options.env ?? process.env;
17167
16888
  if (env["REPOCTL_NIGHTLY_PROVIDER"] !== void 0 && env["REPOCTL_NIGHTLY_PROVIDER"] !== config.provider || env["REPOCTL_NIGHTLY_SCHEDULE"] !== void 0 && env["REPOCTL_NIGHTLY_SCHEDULE"] !== (config.schedule ?? "")) throw new Error("Nightly workflow markers differ from commands.release.nightly; synchronize the workflow with repo upgrade.");
@@ -17187,8 +16908,7 @@ async function nightlyContext(options, config) {
17187
16908
  skipReason: eventName === "schedule" && (!config.schedule || config.schedule !== event.schedule) ? "This schedule is not enabled by commands.release.nightly.schedule." : void 0
17188
16909
  };
17189
16910
  }
17190
- //#endregion
17191
- //#region src/commands/release/nightly/process.ts
16911
+ // src/commands/release/nightly/process.ts
17192
16912
  function nightlyCommand(report, options, executable, args, timeout = 6e5) {
17193
16913
  const result = (options.spawn ?? crossSpawn.sync)(executable, args, {
17194
16914
  cwd: options.cwd,
@@ -17236,8 +16956,7 @@ function nightlyQualityCommand(report, options, executable, args, timeout = defa
17236
16956
  }
17237
16957
  return nightlyCommand(report, options, executable, args, timeout);
17238
16958
  }
17239
- //#endregion
17240
- //#region src/commands/release/nightly/providers/npm.ts
16959
+ // src/commands/release/nightly/providers/npm.ts
17241
16960
  const registry = "https://registry.npmjs.org/";
17242
16961
  const tag = "snapshot-nightly";
17243
16962
  function object$1(value) {
@@ -17339,8 +17058,7 @@ async function confirmNpmNightly(report, options) {
17339
17058
  await (options.sleep ?? setTimeout$1)(Math.min(5e3, Math.max(0, deadline - Date.now())));
17340
17059
  }
17341
17060
  }
17342
- //#endregion
17343
- //#region src/commands/release/nightly/providers/pkg-pr-new/registry.ts
17061
+ // src/commands/release/nightly/providers/pkg-pr-new/registry.ts
17344
17062
  const pkgPrNewLocator = (repository, name, commit) => `https://pkg.pr.new/${repository}/${name}@${commit}`;
17345
17063
  async function downloadPkgPrNew(pkg, report, options) {
17346
17064
  let response;
@@ -17370,8 +17088,7 @@ async function inspectPkgPrNew(report, options) {
17370
17088
  }
17371
17089
  return Object.keys(report.existing).length === report.packages.length;
17372
17090
  }
17373
- //#endregion
17374
- //#region src/commands/release/nightly/providers/pkg-pr-new/index.ts
17091
+ // src/commands/release/nightly/providers/pkg-pr-new/index.ts
17375
17092
  async function pinnedPublisher() {
17376
17093
  const manifestPath = createRequire(import.meta.url).resolve("pkg-pr-new/package.json");
17377
17094
  const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
@@ -17443,8 +17160,7 @@ async function publishPkgPrNew(report, options, checkpoint) {
17443
17160
  await (options.sleep ?? setTimeout$1)(5e3);
17444
17161
  }
17445
17162
  }
17446
- //#endregion
17447
- //#region src/commands/release/nightly/report.ts
17163
+ // src/commands/release/nightly/report.ts
17448
17164
  async function createNightlyOutput(source, options) {
17449
17165
  const env = options.env ?? process.env;
17450
17166
  const requested = path$1.resolve(options.outputDirectory ?? path$1.join(env["RUNNER_TEMP"] ?? tmpdir(), "repoctl-nightly"));
@@ -17497,8 +17213,7 @@ function formatNightlySummary(report) {
17497
17213
  async function writeNightlySummary(report, filename) {
17498
17214
  if (filename) await appendFile(filename, formatNightlySummary(report));
17499
17215
  }
17500
- //#endregion
17501
- //#region src/commands/release/nightly/index.ts
17216
+ // src/commands/release/nightly/index.ts
17502
17217
  function updatePackages(report) {
17503
17218
  report.packages = report.snapshot.packages.map((pkg) => ({
17504
17219
  name: pkg.name,
@@ -17631,8 +17346,7 @@ function createNightlyPlan(options) {
17631
17346
  function releaseNightly(options) {
17632
17347
  return nightly(options, true);
17633
17348
  }
17634
- //#endregion
17635
- //#region src/commands/release/plan/index.ts
17349
+ // src/commands/release/plan/index.ts
17636
17350
  /** Preview unconsumed intents under one explicit release line, without executing hooks or writes. */
17637
17351
  async function createReleasePlan(options) {
17638
17352
  let report = emptyReleasePlan(options);
@@ -17671,8 +17385,7 @@ async function createReleasePlan(options) {
17671
17385
  }
17672
17386
  return report;
17673
17387
  }
17674
- //#endregion
17675
- //#region src/commands/release/snapshot/prepared/validate.ts
17388
+ // src/commands/release/snapshot/prepared/validate.ts
17676
17389
  function validatePackedManifest(value, pkg, plan) {
17677
17390
  const manifest = object$2(value);
17678
17391
  const publish = object$2(manifest["publishConfig"]);
@@ -17755,8 +17468,7 @@ async function validatePreparedSnapshot(value, trustedPlan, files) {
17755
17468
  if (files.size !== expectedFiles.size || [...files.keys()].some((file) => !expectedFiles.has(file))) throw new Error("Prepared snapshot bundle contains missing or unexpected files.");
17756
17469
  return value;
17757
17470
  }
17758
- //#endregion
17759
- //#region src/commands/release/snapshot/prepared/consumer/retry.ts
17471
+ // src/commands/release/snapshot/prepared/consumer/retry.ts
17760
17472
  function snapshotConsumerBudget(options) {
17761
17473
  const started = performance.now();
17762
17474
  const timeout = Math.min(9e5, registrySettings({
@@ -17788,8 +17500,7 @@ async function retrySnapshotVisibility(task, retryable, budget) {
17788
17500
  }
17789
17501
  throw new Error("Snapshot consumer registry visibility timed out; confirmed packages were not uploaded again.", { cause: lastFailure });
17790
17502
  }
17791
- //#endregion
17792
- //#region src/commands/release/snapshot/prepared/consumer/artifacts.ts
17503
+ // src/commands/release/snapshot/prepared/consumer/artifacts.ts
17793
17504
  var RegistryVisibilityError = class extends Error {};
17794
17505
  async function request(url, options, budget) {
17795
17506
  return retrySnapshotVisibility(async () => {
@@ -17836,8 +17547,7 @@ async function publishedSnapshotManifests(manifest, options, budget = snapshotCo
17836
17547
  }
17837
17548
  return manifests;
17838
17549
  }
17839
- //#endregion
17840
- //#region src/commands/release/snapshot/prepared/consumer/install.ts
17550
+ // src/commands/release/snapshot/prepared/consumer/install.ts
17841
17551
  async function installPreparedSnapshotConsumer(manifest, directory, run, budget) {
17842
17552
  const versions = new Set(manifest.packages.map((pkg) => `${pkg.name}@${pkg.version}`));
17843
17553
  await retrySnapshotVisibility(async (attempt) => {
@@ -17870,8 +17580,7 @@ async function installPreparedSnapshotConsumer(manifest, directory, run, budget)
17870
17580
  }
17871
17581
  }, (error) => missingRegistryVersion(error, versions), budget);
17872
17582
  }
17873
- //#endregion
17874
- //#region src/commands/release/snapshot/prepared/publish/context.ts
17583
+ // src/commands/release/snapshot/prepared/publish/context.ts
17875
17584
  async function publisherEnvironment(options, manifest, directory) {
17876
17585
  const env = options.env ?? process.env;
17877
17586
  const { source } = manifest.plan;
@@ -17919,8 +17628,7 @@ function snapshotPublicationReport(manifest, directory) {
17919
17628
  outputDirectory: directory
17920
17629
  };
17921
17630
  }
17922
- //#endregion
17923
- //#region src/commands/release/snapshot/prepared/consumer/installed.ts
17631
+ // src/commands/release/snapshot/prepared/consumer/installed.ts
17924
17632
  /** Validate the entire installed batch before any candidate entrypoint can run. */
17925
17633
  async function installedSnapshotPackages(manifest, directory, applicable) {
17926
17634
  const packages = object$2(object$2(parse$1(await readFile(path$1.join(directory, "pnpm-lock.yaml"), "utf8")))["packages"]);
@@ -17941,8 +17649,7 @@ async function installedSnapshotPackages(manifest, directory, applicable) {
17941
17649
  }
17942
17650
  return validated;
17943
17651
  }
17944
- //#endregion
17945
- //#region src/commands/release/snapshot/prepared/consumer/index.ts
17652
+ // src/commands/release/snapshot/prepared/consumer/index.ts
17946
17653
  /** Execute candidate packages only in a separate consumer job with a credential-free child environment. */
17947
17654
  async function verifyPreparedSnapshotConsumer(options) {
17948
17655
  const report = options.report;
@@ -18033,8 +17740,7 @@ async function verifyPreparedSnapshotConsumer(options) {
18033
17740
  }
18034
17741
  return result;
18035
17742
  }
18036
- //#endregion
18037
- //#region src/commands/release/snapshot/prepared/github/evidence.ts
17743
+ // src/commands/release/snapshot/prepared/github/evidence.ts
18038
17744
  const marker = "REPOCTL_SNAPSHOT_FREEZE_V1:";
18039
17745
  /** Print only after the trusted freeze job has uploaded its immutable plan artifact. */
18040
17746
  function createSnapshotFreezeRecord(plan, artifact) {
@@ -18101,8 +17807,7 @@ async function verifySnapshotJobs(client, options) {
18101
17807
  frozen: readSnapshotFreezeRecord(Buffer.from(logs).toString("utf8"))
18102
17808
  };
18103
17809
  }
18104
- //#endregion
18105
- //#region src/commands/release/snapshot/prepared/github/source.ts
17810
+ // src/commands/release/snapshot/prepared/github/source.ts
18106
17811
  async function readSnapshotRun(client, options, completed) {
18107
17812
  positive$2(options.runId, "workflow run ID");
18108
17813
  positive$2(options.runAttempt, "workflow run attempt");
@@ -18169,8 +17874,7 @@ async function freezeSnapshotSource(options) {
18169
17874
  await assertSnapshotSourceCurrent(client, source);
18170
17875
  return source;
18171
17876
  }
18172
- //#endregion
18173
- //#region src/commands/release/snapshot/prepared/github/index.ts
17877
+ // src/commands/release/snapshot/prepared/github/index.ts
18174
17878
  /** Verify GitHub evidence and portable artifacts without executing any candidate code. */
18175
17879
  async function verifySnapshotRun(options) {
18176
17880
  const client = createSnapshotGitHub(options);
@@ -18235,8 +17939,7 @@ async function verifySnapshotRun(options) {
18235
17939
  assertCurrent
18236
17940
  };
18237
17941
  }
18238
- //#endregion
18239
- //#region src/commands/release/snapshot/prepared/plan.ts
17942
+ // src/commands/release/snapshot/prepared/plan.ts
18240
17943
  /** Freeze the existing version solver and workspace graph without installing or building candidates. */
18241
17944
  async function createSnapshotBuildPlan(options) {
18242
17945
  if ("referenceGitlinks" in options || "prepareSource" in options) throw new Error("Prepared snapshots do not accept source preparation extensions outside the frozen plan.");
@@ -18311,8 +18014,7 @@ async function createSnapshotBuildPlan(options) {
18311
18014
  packages
18312
18015
  });
18313
18016
  }
18314
- //#endregion
18315
- //#region src/commands/release/snapshot/prepared/prepare.ts
18017
+ // src/commands/release/snapshot/prepared/prepare.ts
18316
18018
  /** Build on an unprivileged runner; emit a portable bundle separate from retained diagnostics. */
18317
18019
  async function prepareSnapshot(options) {
18318
18020
  if ("referenceGitlinks" in options || "prepareSource" in options) throw new Error("Prepared snapshots do not accept source preparation extensions outside the frozen plan.");
@@ -18377,8 +18079,7 @@ async function prepareSnapshot(options) {
18377
18079
  directory
18378
18080
  };
18379
18081
  }
18380
- //#endregion
18381
- //#region src/commands/release/snapshot/prepared/publish/tags.ts
18082
+ // src/commands/release/snapshot/prepared/publish/tags.ts
18382
18083
  async function readSnapshotTags(name, options) {
18383
18084
  const response = await (options.registryFetch ?? globalThis.fetch)(`https://registry.npmjs.org/-/package/${encodeURIComponent(name)}/dist-tags`, {
18384
18085
  headers: {
@@ -18454,8 +18155,7 @@ async function confirmSnapshotTag(name, version, tag, options) {
18454
18155
  }
18455
18156
  throw new Error(`Snapshot tag confirmation timed out for ${name}@${version}; the accepted upload was not repeated.`);
18456
18157
  }
18457
- //#endregion
18458
- //#region src/commands/release/snapshot/prepared/publish/index.ts
18158
+ // src/commands/release/snapshot/prepared/publish/index.ts
18459
18159
  /** Publish only a GitHub-verified portable bundle; candidate code is never loaded. */
18460
18160
  async function publishPreparedSnapshot(options) {
18461
18161
  const env = options.env ?? process.env;
@@ -18562,8 +18262,7 @@ async function publishPreparedSnapshot(options) {
18562
18262
  await checkpoint();
18563
18263
  return report;
18564
18264
  }
18565
- //#endregion
18566
- //#region src/commands/release/snapshot/prepared/workflow/options.ts
18265
+ // src/commands/release/snapshot/prepared/workflow/options.ts
18567
18266
  const snapshotWorkflowDefaults = {
18568
18267
  pnpmVersion: "12.14.0",
18569
18268
  environment: "pr-snapshot",
@@ -18587,8 +18286,7 @@ function resolveSnapshotWorkflowOptions(options = {}) {
18587
18286
  if (builderWorkflowPath.toLowerCase() === publisherWorkflowPath.toLowerCase() || builderWorkflowName.toLowerCase() === publisherWorkflowName.toLowerCase()) throw new Error("Snapshot builder and publisher require distinct workflow paths and names.");
18588
18287
  return resolved;
18589
18288
  }
18590
- //#endregion
18591
- //#region src/commands/release/snapshot/prepared/workflow/index.ts
18289
+ // src/commands/release/snapshot/prepared/workflow/index.ts
18592
18290
  /** Export a matched, opt-in workflow pair with an exact trusted tool and builder policy. */
18593
18291
  async function getSnapshotWorkflows(options = {}) {
18594
18292
  const configuration = resolveSnapshotWorkflowOptions(options);
@@ -18611,8 +18309,7 @@ async function getSnapshotWorkflows(options = {}) {
18611
18309
  publish: render(publishTemplate)
18612
18310
  };
18613
18311
  }
18614
- //#endregion
18615
- //#region src/commands/template-validation/files.ts
18312
+ // src/commands/template-validation/files.ts
18616
18313
  function inside$1(root, candidate) {
18617
18314
  const relative = path$1.relative(root, candidate);
18618
18315
  return relative !== ".." && !relative.startsWith(`..${path$1.sep}`) && !path$1.isAbsolute(relative);
@@ -18677,8 +18374,7 @@ async function inspectGeneratedFiles(workspace, target, sources) {
18677
18374
  }
18678
18375
  return diagnostics;
18679
18376
  }
18680
- //#endregion
18681
- //#region src/commands/template-validation/parameters.ts
18377
+ // src/commands/template-validation/parameters.ts
18682
18378
  const preparedSets = /* @__PURE__ */ new WeakMap();
18683
18379
  function validationSourceDigest(snapshot) {
18684
18380
  return createHash("sha256").update(JSON.stringify(snapshot)).digest("hex");
@@ -18770,8 +18466,7 @@ async function prepareValidationParameters(sourceDir, category, names, inputs =
18770
18466
  return set;
18771
18467
  }) };
18772
18468
  }
18773
- //#endregion
18774
- //#region src/commands/template-validation/plan.ts
18469
+ // src/commands/template-validation/plan.ts
18775
18470
  async function prepareTemplateValidationPlan(options, download = false) {
18776
18471
  const cwd = path$1.resolve(options.cwd ?? process.cwd());
18777
18472
  const context = await loadTemplateCatalogContext({ cwd });
@@ -18834,8 +18529,7 @@ async function prepareTemplateValidationPlan(options, download = false) {
18834
18529
  function planTemplateValidation(options) {
18835
18530
  return prepareTemplateValidationPlan(options);
18836
18531
  }
18837
- //#endregion
18838
- //#region src/commands/template-validation/artifact/dependencies.ts
18532
+ // src/commands/template-validation/artifact/dependencies.ts
18839
18533
  async function checkConditionalDependencies(packed) {
18840
18534
  const { createPackageFromTarballData } = await import("@arethetypeswrong/core");
18841
18535
  const pkg = createPackageFromTarballData(packed.bytes);
@@ -18890,8 +18584,7 @@ async function checkConditionalDependencies(packed) {
18890
18584
  }]
18891
18585
  });
18892
18586
  }
18893
- //#endregion
18894
- //#region src/commands/template-validation/artifact/index.ts
18587
+ // src/commands/template-validation/artifact/index.ts
18895
18588
  async function validateLibraryArtifact(target, directory, timeout, packageManager, signal) {
18896
18589
  const workspace = path$1.resolve(target, "../..");
18897
18590
  const execution = {
@@ -18961,8 +18654,7 @@ async function validateLibraryArtifact(target, directory, timeout, packageManage
18961
18654
  report.status = results.some((result) => result.status === "failed") ? "failed" : "passed";
18962
18655
  return report;
18963
18656
  }
18964
- //#endregion
18965
- //#region src/commands/template-validation/generate.ts
18657
+ // src/commands/template-validation/generate.ts
18966
18658
  async function generateValidationSample(plan, workspace, name, parameterSet) {
18967
18659
  await scaffoldWorkspace({
18968
18660
  targetDir: workspace,
@@ -19009,8 +18701,7 @@ async function generateValidationSample(plan, workspace, name, parameterSet) {
19009
18701
  await applyCreateNewProjectPlan(creation, false);
19010
18702
  return targetDir;
19011
18703
  }
19012
- //#endregion
19013
- //#region src/commands/template-validation/run.ts
18704
+ // src/commands/template-validation/run.ts
19014
18705
  async function runValidationSample(plan, name, directory, options, parameterSet) {
19015
18706
  const sample = {
19016
18707
  name,
@@ -19093,8 +18784,7 @@ async function runValidationSample(plan, name, directory, options, parameterSet)
19093
18784
  }
19094
18785
  return sanitizeValidationSample(sample, parameterSet);
19095
18786
  }
19096
- //#endregion
19097
- //#region src/commands/template-validation/index.ts
18787
+ // src/commands/template-validation/index.ts
19098
18788
  /** Explicitly execute a template author's generated project and publication checks. */
19099
18789
  async function validateTemplate(options) {
19100
18790
  if (process.env["REPOCTL_PACKAGE_CHECK_RUNNING"]) throw new Error("Template validation cannot run recursively from a validation script.");
@@ -19130,8 +18820,7 @@ async function validateTemplate(options) {
19130
18820
  });
19131
18821
  }
19132
18822
  }
19133
- //#endregion
19134
- //#region src/commands/tooling-capabilities/playwright/files.ts
18823
+ // src/commands/tooling-capabilities/playwright/files.ts
19135
18824
  const json$1 = (value) => `${JSON.stringify(value, null, 2)}\n`;
19136
18825
  const quote$1 = (value) => `'${JSON.stringify(value).slice(1, -1).replaceAll("\\\"", "\"").replaceAll("'", "\\'")}'`;
19137
18826
  function playwrightFiles(settings) {
@@ -19239,8 +18928,7 @@ Edit the route, click locator and expected text in \`tests/interaction.spec.ts\`
19239
18928
  dependencies
19240
18929
  };
19241
18930
  }
19242
- //#endregion
19243
- //#region src/commands/tooling-capabilities/playwright/workflow.ts
18931
+ // src/commands/tooling-capabilities/playwright/workflow.ts
19244
18932
  function playwrightWorkflow({ workspace }) {
19245
18933
  const filter = `'${workspace.name}'`;
19246
18934
  const run = `pnpm --filter ${filter}`;
@@ -19300,8 +18988,7 @@ function playwrightWorkflow({ workspace }) {
19300
18988
  } }
19301
18989
  });
19302
18990
  }
19303
- //#endregion
19304
- //#region src/commands/tooling-capabilities/root-files.ts
18991
+ // src/commands/tooling-capabilities/root-files.ts
19305
18992
  async function rootFiles(settings, conflicts) {
19306
18993
  const { root, workspace } = settings;
19307
18994
  const files = {};
@@ -19357,8 +19044,7 @@ async function rootFiles(settings, conflicts) {
19357
19044
  files["turbo.json"] = `${JSONC.stringify(turbo, null, 2)}\n`;
19358
19045
  return files;
19359
19046
  }
19360
- //#endregion
19361
- //#region src/commands/tooling-capabilities/storybook/settings.ts
19047
+ // src/commands/tooling-capabilities/storybook/settings.ts
19362
19048
  function text$1(value, label) {
19363
19049
  if (typeof value !== "string" || !value.trim() || value.includes("\0")) throw new Error(`Invalid Storybook ${label}`);
19364
19050
  return value;
@@ -19459,8 +19145,7 @@ async function resolveStorybookSettings(cwd, input) {
19459
19145
  }
19460
19146
  };
19461
19147
  }
19462
- //#endregion
19463
- //#region src/commands/tooling-capabilities/settings/playwright.ts
19148
+ // src/commands/tooling-capabilities/settings/playwright.ts
19464
19149
  function text(value, label) {
19465
19150
  if (typeof value !== "string" || !value.trim() || value.includes("\0")) throw new Error(`Invalid tooling capability ${label}`);
19466
19151
  return value;
@@ -19533,8 +19218,7 @@ async function resolvePlaywrightSettings(cwd, input) {
19533
19218
  }
19534
19219
  };
19535
19220
  }
19536
- //#endregion
19537
- //#region src/commands/tooling-capabilities/settings/index.ts
19221
+ // src/commands/tooling-capabilities/settings/index.ts
19538
19222
  async function resolveCapabilitySettings(cwd, input) {
19539
19223
  if (input?.capability === "storybook") return {
19540
19224
  ...await resolveStorybookSettings(cwd, input),
@@ -19545,8 +19229,7 @@ async function resolveCapabilitySettings(cwd, input) {
19545
19229
  kind: "playwright"
19546
19230
  };
19547
19231
  }
19548
- //#endregion
19549
- //#region src/commands/tooling-capabilities/storybook/stories.ts
19232
+ // src/commands/tooling-capabilities/storybook/stories.ts
19550
19233
  const quote = (value) => `'${JSON.stringify(value).slice(1, -1).replaceAll("\\\"", "\"").replaceAll("'", "\\'")}'`;
19551
19234
  function object(value) {
19552
19235
  return `{ ${Object.entries(value).map(([key, item]) => `${key}: ${typeof item === "string" ? quote(item) : JSON.stringify(item)}`).join(", ")} }`;
@@ -19615,8 +19298,7 @@ ${render} play: async ({ canvasElement }) => {
19615
19298
  }
19616
19299
  `;
19617
19300
  }
19618
- //#endregion
19619
- //#region src/commands/tooling-capabilities/storybook/files.ts
19301
+ // src/commands/tooling-capabilities/storybook/files.ts
19620
19302
  const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
19621
19303
  function storybookFiles(settings) {
19622
19304
  const { options, target, workspace, runtimeRange } = settings;
@@ -19757,8 +19439,7 @@ Optional Storybook workspace consuming \`${target.name}\`. Library sources, test
19757
19439
  dependencies
19758
19440
  };
19759
19441
  }
19760
- //#endregion
19761
- //#region src/commands/tooling-capabilities/storybook/workflow.ts
19442
+ // src/commands/tooling-capabilities/storybook/workflow.ts
19762
19443
  function storybookWorkflow({ workspace }) {
19763
19444
  const filter = `'${workspace.name}'`;
19764
19445
  const run = `pnpm --filter ${filter}`;
@@ -19818,8 +19499,7 @@ function storybookWorkflow({ workspace }) {
19818
19499
  } }
19819
19500
  });
19820
19501
  }
19821
- //#endregion
19822
- //#region src/commands/tooling-capabilities/plan.ts
19502
+ // src/commands/tooling-capabilities/plan.ts
19823
19503
  async function planToolingCapability(cwd, input) {
19824
19504
  const settings = await resolveCapabilitySettings(cwd, input);
19825
19505
  const conflicts = [];
@@ -19896,8 +19576,7 @@ async function planToolingCapability(cwd, input) {
19896
19576
  ]
19897
19577
  };
19898
19578
  }
19899
- //#endregion
19900
- //#region src/commands/tooling-capabilities/apply.ts
19579
+ // src/commands/tooling-capabilities/apply.ts
19901
19580
  async function applyToolingCapability(plan) {
19902
19581
  if (!plan || plan.schemaVersion !== 1 || !["playwright", "storybook"].includes(plan.capability?.id) || !Array.isArray(plan.files)) throw new Error("Unsupported tooling capability plan");
19903
19582
  if (plan.status === "blocked") throw new Error("Tooling capability plan is blocked; resolve conflicts before applying");
@@ -19932,8 +19611,7 @@ async function applyToolingCapability(plan) {
19932
19611
  };
19933
19612
  });
19934
19613
  }
19935
- //#endregion
19936
- //#region src/commands/workspace/artifact/process.ts
19614
+ // src/commands/workspace/artifact/process.ts
19937
19615
  const pnpmGuards = [
19938
19616
  "--config.pm-on-fail=ignore",
19939
19617
  "--config.runtime-on-fail=ignore",
@@ -20020,8 +19698,7 @@ function runNative(executable, args, cwd, options = {}) {
20020
19698
  });
20021
19699
  });
20022
19700
  }
20023
- //#endregion
20024
- //#region src/commands/workspace/artifact/paths.ts
19701
+ // src/commands/workspace/artifact/paths.ts
20025
19702
  function relativeArtifactPath(value) {
20026
19703
  if (!value || path.isAbsolute(value) || value.includes("\\") || value.split("/").some((part) => !part || [".", ".."].includes(part)) || /[\p{Cc}\p{Cf}]/u.test(value)) throw new Error(`Unsafe artifact relative path: ${value}`);
20027
19704
  return value;
@@ -20051,8 +19728,7 @@ async function destination(root, value) {
20051
19728
  empty: stat ? (await readdir(output)).length === 0 : true
20052
19729
  };
20053
19730
  }
20054
- //#endregion
20055
- //#region src/commands/workspace/artifact/settings.ts
19731
+ // src/commands/workspace/artifact/settings.ts
20056
19732
  const pathKeys = [
20057
19733
  "store-dir",
20058
19734
  "cache-dir",
@@ -20109,8 +19785,7 @@ async function deployWritePaths(root, executable, prefix) {
20109
19785
  await verifyWritePaths(root, void 0, paths);
20110
19786
  return paths;
20111
19787
  }
20112
- //#endregion
20113
- //#region src/commands/workspace/artifact/tree.ts
19788
+ // src/commands/workspace/artifact/tree.ts
20114
19789
  const ignored = /* @__PURE__ */ new Set([
20115
19790
  "node_modules",
20116
19791
  ".git",
@@ -20204,8 +19879,7 @@ async function copySource(root, destination, files) {
20204
19879
  else await copyFile(path.join(root, file.path), output);
20205
19880
  }
20206
19881
  }
20207
- //#endregion
20208
- //#region src/commands/workspace/artifact/native.ts
19882
+ // src/commands/workspace/artifact/native.ts
20209
19883
  async function executable(name) {
20210
19884
  const suffixes = process.platform === "win32" ? [
20211
19885
  ".exe",
@@ -20277,8 +19951,7 @@ async function nativeTool(root, mode, packageManager) {
20277
19951
  writePaths: []
20278
19952
  };
20279
19953
  }
20280
- //#endregion
20281
- //#region src/commands/workspace/artifact/plan.ts
19954
+ // src/commands/workspace/artifact/plan.ts
20282
19955
  function options(input) {
20283
19956
  if (!input || typeof input.target !== "string" || !input.target || !["prune", "deploy"].includes(input.mode) || typeof input.output !== "string" || Object.keys(input).some((key) => ![
20284
19957
  "target",
@@ -20391,8 +20064,7 @@ async function buildArtifactPlan(cwd, input) {
20391
20064
  fingerprint: fingerprint(plan)
20392
20065
  };
20393
20066
  }
20394
- //#endregion
20395
- //#region src/commands/workspace/artifact/receipt.ts
20067
+ // src/commands/workspace/artifact/receipt.ts
20396
20068
  const receiptName = ".repoctl-artifact.json";
20397
20069
  function receipt(plan, files, excluded) {
20398
20070
  return `${JSON.stringify({
@@ -20424,8 +20096,7 @@ async function previousArtifact(plan) {
20424
20096
  excluded: saved["excluded"]
20425
20097
  };
20426
20098
  }
20427
- //#endregion
20428
- //#region src/commands/workspace/artifact/publication/files.ts
20099
+ // src/commands/workspace/artifact/publication/files.ts
20429
20100
  /** Own the exclusive file descriptor before writing; retain proof of each written prefix for recovery. */
20430
20101
  async function writeOwnedFile(filename, chunks, expected, owned) {
20431
20102
  const handle = await open(filename, "wx", expected.mode);
@@ -20459,8 +20130,7 @@ async function writeOwnedFile(filename, chunks, expected, owned) {
20459
20130
  await handle.close();
20460
20131
  }
20461
20132
  }
20462
- //#endregion
20463
- //#region src/commands/workspace/artifact/publication/state.ts
20133
+ // src/commands/workspace/artifact/publication/state.ts
20464
20134
  function sameIdentity(left, right) {
20465
20135
  return left.ino === right.ino && left.dev === right.dev;
20466
20136
  }
@@ -20499,8 +20169,7 @@ async function rollbackOutput(root, entries, directories, createdRoot) {
20499
20169
  }
20500
20170
  return retained;
20501
20171
  }
20502
- //#endregion
20503
- //#region src/commands/workspace/artifact/publication/index.ts
20172
+ // src/commands/workspace/artifact/publication/index.ts
20504
20173
  /** Publish exclusively, commit the receipt last, and never roll back another writer's files. */
20505
20174
  async function publishArtifact(plan, staging, files, excluded, verify) {
20506
20175
  const current = await destination(plan.workspaceDir, plan.selection.output);
@@ -20557,8 +20226,7 @@ async function publishArtifact(plan, staging, files, excluded, verify) {
20557
20226
  throw error;
20558
20227
  }
20559
20228
  }
20560
- //#endregion
20561
- //#region src/commands/workspace/artifact/verify.ts
20229
+ // src/commands/workspace/artifact/verify.ts
20562
20230
  async function verifySource(plan) {
20563
20231
  const current = await inventory(plan.workspaceDir, true);
20564
20232
  if (!isDeepStrictEqual(current.files, plan.inputs) || !isDeepStrictEqual(current.excluded, plan.excluded)) throw new Error("Artifact source inputs changed; review a new plan. Source edits were preserved.");
@@ -20593,8 +20261,7 @@ async function inspectNativeOutput(plan, directory) {
20593
20261
  excluded: [.../* @__PURE__ */ new Set([...plan.excluded, ...excluded])].sort()
20594
20262
  };
20595
20263
  }
20596
- //#endregion
20597
- //#region src/commands/workspace/artifact/index.ts
20264
+ // src/commands/workspace/artifact/index.ts
20598
20265
  async function planWorkspaceArtifact(cwd, options) {
20599
20266
  const plan = await buildArtifactPlan(cwd, options);
20600
20267
  await previousArtifact(plan);
@@ -20668,8 +20335,7 @@ async function applyWorkspaceArtifactPlan(cwd, plan, options = {}) {
20668
20335
  return result;
20669
20336
  });
20670
20337
  }
20671
- //#endregion
20672
- //#region src/commands/workspace/move/instances.ts
20338
+ // src/commands/workspace/move/instances.ts
20673
20339
  async function pendingInstanceUpgrades(root, plan) {
20674
20340
  const pending = [];
20675
20341
  for (const instance of plan.relocations) if (await loadTemplateUpgradeJournal(root, instance.id)) pending.push(instance.id);
@@ -20679,8 +20345,7 @@ async function assertNoPendingInstanceUpgrades(root, plan) {
20679
20345
  const pending = await pendingInstanceUpgrades(root, plan);
20680
20346
  if (pending.length) throw new Error(`Template instances have pending upgrades. Inspect templates recover-upgrade before moving: ${pending.join(", ")}`);
20681
20347
  }
20682
- //#endregion
20683
- //#region src/commands/workspace/move/paths.ts
20348
+ // src/commands/workspace/move/paths.ts
20684
20349
  function movedPath(file, from, to) {
20685
20350
  return file === from ? to : file.startsWith(`${from}/`) ? to + file.slice(from.length) : file;
20686
20351
  }
@@ -20756,8 +20421,7 @@ async function prepareDestination(root, relative) {
20756
20421
  }
20757
20422
  };
20758
20423
  }
20759
- //#endregion
20760
- //#region src/core/workspace-mutation/git.ts
20424
+ // src/core/workspace-mutation/git.ts
20761
20425
  const exec = promisify(execFile);
20762
20426
  async function workspaceGit(root, target) {
20763
20427
  try {
@@ -20812,8 +20476,7 @@ async function workspaceGit(root, target) {
20812
20476
  };
20813
20477
  }
20814
20478
  }
20815
- //#endregion
20816
- //#region src/core/workspace-mutation/inventory.ts
20479
+ // src/core/workspace-mutation/inventory.ts
20817
20480
  /** Enumerate links themselves, never their destinations, including ignored files. */
20818
20481
  async function workspaceInventory(root, target) {
20819
20482
  await assertSafePath(root, target, "directory");
@@ -20867,8 +20530,7 @@ async function workspaceInventory(root, target) {
20867
20530
  repositories
20868
20531
  };
20869
20532
  }
20870
- //#endregion
20871
- //#region src/commands/workspace/shared/inspection.ts
20533
+ // src/commands/workspace/shared/inspection.ts
20872
20534
  async function relevantDiagnostics(graph, target, workspace) {
20873
20535
  const selected = path.join(graph.workspaceDir, target.id);
20874
20536
  const relevant = await Promise.all(graph.diagnostics.map(async (item) => {
@@ -20918,8 +20580,7 @@ async function manifestInputs(root, graph) {
20918
20580
  unsupported
20919
20581
  };
20920
20582
  }
20921
- //#endregion
20922
- //#region src/commands/workspace/move/manifests.ts
20583
+ // src/commands/workspace/move/manifests.ts
20923
20584
  function changedFile(file, before, after, fields) {
20924
20585
  return {
20925
20586
  path: file,
@@ -21022,8 +20683,7 @@ function moveWorkspaceManifest(before, from, to) {
21022
20683
  updated.slice(packages.length).forEach((item) => sequence.add(item));
21023
20684
  return changedFile("pnpm-workspace.yaml", before, document.toString({ lineWidth: 0 }), ["packages"]);
21024
20685
  }
21025
- //#endregion
21026
- //#region src/commands/workspace/move/configuration.ts
20686
+ // src/commands/workspace/move/configuration.ts
21027
20687
  function moveTypeScriptConfig(root, file, before, target, to, name) {
21028
20688
  const tasks = [];
21029
20689
  const fields = [];
@@ -21124,8 +20784,7 @@ function moveConfigurationChanges(root, contents, target, to, name) {
21124
20784
  tasks
21125
20785
  };
21126
20786
  }
21127
- //#endregion
21128
- //#region src/commands/workspace/move/review.ts
20787
+ // src/commands/workspace/move/review.ts
21129
20788
  const textExtensions$1 = /* @__PURE__ */ new Set([
21130
20789
  ".js",
21131
20790
  ".jsx",
@@ -21203,8 +20862,7 @@ function moveReview(root, contents, target, to, name, files, scanned, skipped, t
21203
20862
  result.tasks.sort((a, b) => a.path.localeCompare(b.path) || a.line - b.line || a.reason.localeCompare(b.reason));
21204
20863
  return result;
21205
20864
  }
21206
- //#endregion
21207
- //#region src/commands/workspace/move/plan.ts
20865
+ // src/commands/workspace/move/plan.ts
21208
20866
  const moveNextSteps = [
21209
20867
  "Resolve source/configuration review tasks before building; source imports are never rewritten automatically.",
21210
20868
  "Run pnpm install --lockfile-only with the declared pnpm version, then pnpm install --frozen-lockfile to refresh links.",
@@ -21318,8 +20976,7 @@ async function planWorkspaceMove(cwd, options) {
21318
20976
  ]
21319
20977
  };
21320
20978
  }
21321
- //#endregion
21322
- //#region src/commands/workspace/move/verify.ts
20979
+ // src/commands/workspace/move/verify.ts
21323
20980
  function validateMovePlan(plan) {
21324
20981
  if (!record$6(plan) || plan.schemaVersion !== 1 || plan.kind !== "workspace-move" || typeof plan.workspaceDir !== "string" || !record$6(plan.selection) || !record$6(plan.target) || !record$6(plan.destination) || typeof plan.target.id !== "string" || typeof plan.destination.id !== "string" || plan.selection.target !== `./${plan.target.id}` || plan.selection.to !== plan.destination.id || plan.selection.name !== plan.destination.name || typeof plan.canApply !== "boolean" || !Array.isArray(plan.blockers) || !Array.isArray(plan.inputs) || !Array.isArray(plan.files) || !Array.isArray(plan.inventory) || !Array.isArray(plan.workspaces) || plan.inputs.some((item) => !record$6(item) || typeof item.path !== "string" || !/^[a-f\d]{64}$/u.test(item.hash)) || plan.files.some((item) => !record$6(item) || typeof item.path !== "string" || typeof item.before !== "string" || typeof item.after !== "string" || item.beforeHash !== hash$1(item.before) || item.afterHash !== hash$1(item.after) || !plan.inputs.some((input) => input.path === item.path && input.hash === item.beforeHash)) || new Set(plan.inputs.map((item) => item.path)).size !== plan.inputs.length || new Set(plan.files.map((item) => item.path)).size !== plan.files.length || !record$6(plan.templateInstances) || plan.templateInstances.from !== plan.target.id || plan.templateInstances.to !== plan.destination.id || !/^[a-f\d]{64}$/u.test(plan.templateInstances.beforeHash) || !/^[a-f\d]{64}$/u.test(plan.templateInstances.afterHash) || !Array.isArray(plan.templateInstances.relocations) || plan.templateInstances.relocations.some((item) => !record$6(item) || !/^[a-f\d]{24}$/u.test(item.id) || typeof item.from !== "string" || item.to !== movedPath(item.from, plan.target.id, plan.destination.id))) throw new Error("Invalid workspace move plan.");
21325
20982
  }
@@ -21366,8 +21023,7 @@ async function verifyMovePostState(plan, recoveryPaths = [], requireHead = true)
21366
21023
  if (requireHead && !isDeepStrictEqual((await workspaceGit(root, path.join(root, to))).git, plan.git)) throw new Error("Git HEAD or repository identity changed during the move.");
21367
21024
  return retained;
21368
21025
  }
21369
- //#endregion
21370
- //#region src/commands/workspace/move/transaction.ts
21026
+ // src/commands/workspace/move/transaction.ts
21371
21027
  /** File backups remain available until the instance registry has committed. */
21372
21028
  function createMoveTransaction(plan) {
21373
21029
  const root = plan.workspaceDir;
@@ -21424,8 +21080,7 @@ function createMoveTransaction(plan) {
21424
21080
  }
21425
21081
  };
21426
21082
  }
21427
- //#endregion
21428
- //#region src/commands/workspace/move/apply.ts
21083
+ // src/commands/workspace/move/apply.ts
21429
21084
  async function applyMove(cwd, plan) {
21430
21085
  validateMovePlan(plan);
21431
21086
  const root = (await discoverCleanWorkspace(cwd)).workspaceDir;
@@ -21491,14 +21146,12 @@ async function applyWorkspaceMovePlan(cwd, plan) {
21491
21146
  const root = (await discoverCleanWorkspace(cwd)).workspaceDir;
21492
21147
  return withOperationLock(root, "workspace-move", () => applyMove(root, plan));
21493
21148
  }
21494
- //#endregion
21495
- //#region src/commands/workspace/remove/instances.ts
21149
+ // src/commands/workspace/remove/instances.ts
21496
21150
  /** Removal keeps origin records so deleting files cannot silently erase their history. */
21497
21151
  async function removalInstanceNextSteps(workspaceDir, target) {
21498
21152
  return (await loadTemplateInstanceRegistry(workspaceDir)).instances.filter((instance) => instance.target === target || instance.target.startsWith(`${target}/`)).map((instance) => `Template instance ${instance.id} at ${instance.target} retains its provenance and baselines and will be reported as missing. Inspect it with repo templates instances ${instance.id} --json. Restore the original project from version control or a backup; use a different unowned path for a new project. Removal does not release registered paths.`);
21499
21153
  }
21500
- //#endregion
21501
- //#region src/commands/workspace/remove/manifests.ts
21154
+ // src/commands/workspace/remove/manifests.ts
21502
21155
  function removalManifestChanges(contents, references) {
21503
21156
  const groups = /* @__PURE__ */ new Map();
21504
21157
  for (const edge of references) {
@@ -21536,8 +21189,7 @@ function removalManifestChanges(contents, references) {
21536
21189
  };
21537
21190
  });
21538
21191
  }
21539
- //#endregion
21540
- //#region src/commands/workspace/remove/review.ts
21192
+ // src/commands/workspace/remove/review.ts
21541
21193
  const textExtensions = /* @__PURE__ */ new Set([
21542
21194
  ".js",
21543
21195
  ".jsx",
@@ -21601,8 +21253,7 @@ async function removalReview(root, target, name, tracked, changes) {
21601
21253
  inputs
21602
21254
  };
21603
21255
  }
21604
- //#endregion
21605
- //#region src/commands/workspace/remove/plan.ts
21256
+ // src/commands/workspace/remove/plan.ts
21606
21257
  const removalNextSteps = [
21607
21258
  "Review remaining source/configuration reference candidates; the literal text scan is not an exhaustive import or configuration analysis.",
21608
21259
  "Run pnpm install --lockfile-only with the declared pnpm version, then pnpm install --frozen-lockfile.",
@@ -21687,8 +21338,7 @@ async function planWorkspaceRemoval(cwd, options) {
21687
21338
  nextSteps: [...removalNextSteps, ...await removalInstanceNextSteps(root, target.id)]
21688
21339
  };
21689
21340
  }
21690
- //#endregion
21691
- //#region src/commands/workspace/remove/recovery.ts
21341
+ // src/commands/workspace/remove/recovery.ts
21692
21342
  async function validateRoot(root) {
21693
21343
  if ((await lstat(root)).isSymbolicLink() || path.resolve(await realpath(root)) !== root) throw new Error("The removal workspace root changed.");
21694
21344
  }
@@ -21769,8 +21419,7 @@ async function cleanupRemovalRecovery(root, recovery, inventory) {
21769
21419
  } catch {}
21770
21420
  return [];
21771
21421
  }
21772
- //#endregion
21773
- //#region src/commands/workspace/remove/verify.ts
21422
+ // src/commands/workspace/remove/verify.ts
21774
21423
  function validateRemovalPlan(plan) {
21775
21424
  if (!record$6(plan) || plan.schemaVersion !== 1 || plan.kind !== "workspace-removal" || typeof plan.workspaceDir !== "string" || !record$6(plan.selection) || !record$6(plan.target) || typeof plan.target.id !== "string" || typeof plan.selection.target !== "string" || typeof plan.selection.removeReferences !== "boolean" || typeof plan.canApply !== "boolean" || !Array.isArray(plan.inputs) || !Array.isArray(plan.files) || !Array.isArray(plan.inventory) || !Array.isArray(plan.workspaces) || !Array.isArray(plan.blockers) || !record$6(plan.review) || !Array.isArray(plan.nextSteps) || plan.nextSteps.some((step) => typeof step !== "string") || plan.inputs.some((item) => !record$6(item) || typeof item.path !== "string" || typeof item.hash !== "string") || plan.files.some((item) => !record$6(item) || typeof item.path !== "string" || typeof item.before !== "string" || typeof item.after !== "string" || item.beforeHash !== hash$1(item.before) || item.afterHash !== hash$1(item.after) || !plan.inputs.some((input) => input.path === item.path && input.hash === item.beforeHash)) || plan.workspaces.some((item) => typeof item !== "string") || !plan.workspaces.includes(plan.target.id) || plan.selection.target !== `./${plan.target.id}` || plan.review.scope !== "git-tracked-text-literal-matches" || !Array.isArray(plan.review.scanned) || !Array.isArray(plan.review.matches) || !Array.isArray(plan.review.skipped) || new Set(plan.inputs.map((item) => item.path)).size !== plan.inputs.length || new Set(plan.files.map((item) => item.path)).size !== plan.files.length) throw new Error("Invalid workspace removal plan.");
21776
21425
  }
@@ -21792,8 +21441,7 @@ async function verifyRemovalPostState(plan, requireHead = true) {
21792
21441
  const reviewed = await removalReview(root, plan.target.id, plan.target.name, state.tracked, []);
21793
21442
  if (!isDeepStrictEqual(reviewed.review, plan.review)) throw new Error("The tracked source/configuration review evidence changed during removal.");
21794
21443
  }
21795
- //#endregion
21796
- //#region src/commands/workspace/remove/apply.ts
21444
+ // src/commands/workspace/remove/apply.ts
21797
21445
  async function applyRemoval(cwd, plan) {
21798
21446
  validateRemovalPlan(plan);
21799
21447
  const root = (await discoverCleanWorkspace(cwd)).workspaceDir;
@@ -21866,8 +21514,7 @@ async function applyWorkspaceRemovalPlan(cwd, plan) {
21866
21514
  const root = (await discoverCleanWorkspace(cwd)).workspaceDir;
21867
21515
  return withOperationLock(root, "workspace-remove", () => applyRemoval(root, plan));
21868
21516
  }
21869
- //#endregion
21870
- //#region src/commands/index.ts
21517
+ // src/commands/index.ts
21871
21518
  var commands_exports = /* @__PURE__ */ __exportAll({
21872
21519
  DocsDeploymentError: () => DocsDeploymentError,
21873
21520
  GitClient: () => GitClient,
@@ -22021,5 +21668,4 @@ var commands_exports = /* @__PURE__ */ __exportAll({
22021
21668
  verifySnapshotRun: () => verifySnapshotRun,
22022
21669
  verifyStagedTypecheck: () => verifyStagedTypecheck
22023
21670
  });
22024
- //#endregion
22025
21671
  export { formatUpgradePlan as $, resolveCreateNewProjectPlan as $t, applyProjectReferencesPlan as A, renderReleasePullRequest as At, installGitHooks as B, createContext as Bt, createNightlyPlan as C, prepareBootstrap as Ct, createSnapshotPlan as D, createBootstrapPlan as Dt, releaseSnapshot as E, validateSnapshotSource as Et, detectMaintenanceVersionChange as F, init as Ft, planDocsDeployment as G, runDoctor as Gt, planInstallSecurityPreset as H, collectEnvPaths as Ht, applyOrganizationPresetAssets as I, initMetadata as It, checkPublicApi as J, planUpgrade as Jt, checkPeerDependencies as K, applyDoctorFixPlan as Kt, planOrganizationPresetAssets as L, initTooling as Lt, checkPackages as M, createAutoChangesetPlan as Mt, getMaintenanceWorkflow as N, getAutoChangesetWorkflow as Nt, checkProjectReferences as O, parsePublishSummary as Ot, prepareMaintenanceUpgrade as P, setVscodeBinaryMirror as Pt, upgradeMonorepo as Q, defaultTemplate as Qt, applyDevContainerPlan as R, normalizeInitToolingTargets as Rt, createReleasePlan as S, auditReleaseOidc as St, formatNightlySummary as T, validateSnapshotBuildPlan as Tt, deployDocs as U, collectEnvSnapshot as Ut, applyInstallSecurityPreset as V, collectEnvInfo as Vt, DocsDeploymentError as W, collectEnvSupportBundle as Wt, planPublicApiUpdate as X, applyCreateNewProjectPlan as Xt, applyPublicApiUpdate as Y, applyUpgradePlan as Yt, formatPublicApiReport as Z, createNewProject as Zt, createSnapshotBuildPlan as _, generateAgenticTemplate as _n, GitHubClient as _t, planWorkspaceMove as a, resolveTemplateCatalog as an, readReleasePreparationPolicy as at, createSnapshotFreezeRecord as b, verifyBootstrapPublication as bt, applyToolingCapability as c, inspectMonorepoConfig as cn, recoverUnpublished as ct, planTemplateValidation as d, validateConfigFile as dn, publishStable as dt, getCreateChoices as en, checkTemplates as et, getSnapshotWorkflows as f, cleanProjects as fn, releaseStable as ft, prepareSnapshot as g, defaultAgenticBaseDir as gn, releasePrerelease as gt, publishPreparedSnapshot as h, createTimestampFolderName as hn, exitPrerelease as ht, applyWorkspaceMovePlan as i, createTemplateCatalog as in, validateReleasePreparation as it, planProjectReferences as j, applyAutoChangeset as jt, syncProjectReferences as k, resolveReleaseMode as kt, planToolingCapability as l, explainMonorepoConfig as ln, releaseCi as lt, snapshotWorkflowDefaults as m, verifyPrePush as mn, enterPrerelease as mt, applyWorkspaceRemovalPlan as n, templateMap as nn, skillTargets as nt, applyWorkspaceArtifactPlan as o, loadTemplateCatalogContext as on, repairReleaseNotes as ot, resolveSnapshotWorkflowOptions as p, verifyStagedTypecheck as pn, reconcileRelease as pt, resolveAffectedCheckMatrix as q, planDoctorFix as qt, planWorkspaceRemoval as r, resolveRemoteTemplateSource as rn, syncSkills as rt, planWorkspaceArtifact as s, updateIssueTemplateConfig as sn, createReleasePullRequest as st, commands_exports as t, getTemplateMap as tn, getSkillTargetPaths as tt, validateTemplate as u, sanitizeConfigReport as un, prepareStable as ut, verifySnapshotRun as v, generateAgenticTemplates as vn, GitHubApiError as vt, releaseNightly as w, snapshotPlanDigest as wt, verifyPreparedSnapshotConsumer as x, publishBootstrap as xt, freezeSnapshotSource as y, loadAgenticTasks as yn, releaseBootstrap as yt, planDevContainer as z, initToolingTargets as zt };