@icebreakers/monorepo 5.6.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +2 -0
  2. package/dist/baseline-DPfotf4y.mjs +146 -0
  3. package/dist/bundle-B9vRch4R.mjs +49 -0
  4. package/dist/catalog-CDEyc1uA.mjs +299 -0
  5. package/dist/cli.mjs +1487 -156
  6. package/dist/commands-TS8ABFdP.mjs +13820 -0
  7. package/dist/config-C38c_Q8L.mjs +66 -0
  8. package/dist/{create-flow-CXRhfGbb.mjs → create-flow-CCr2hfSY.mjs} +90 -24
  9. package/dist/deps-CUdI2DaB.mjs +47 -0
  10. package/dist/execute-PX1hT0qv.mjs +68 -0
  11. package/dist/execute-Vi4qHe-D.mjs +663 -0
  12. package/dist/format-DZ7L34rf.mjs +28 -0
  13. package/dist/index-CoCTFWZJ.d.mts +2150 -0
  14. package/dist/index.d.mts +1738 -112
  15. package/dist/index.mjs +60 -7
  16. package/dist/inputs-_xIVONmB.mjs +50 -0
  17. package/dist/npm-B25nrSyz.mjs +82 -0
  18. package/dist/plan-B5aE_WNF.mjs +75 -0
  19. package/dist/run-Lu7y1bNf.mjs +165 -0
  20. package/dist/save-CdCf630Z.mjs +79 -0
  21. package/dist/scan-4nboHNXP.mjs +293 -0
  22. package/dist/template-drift-BBhnrHY1.mjs +2740 -0
  23. package/dist/tooling-entry.d.mts +1 -1
  24. package/dist/tooling-entry.mjs +2 -2
  25. package/dist/transaction-DAhY8EpG.mjs +168 -0
  26. package/dist/tsconfig-CGntrzBM.mjs +1483 -0
  27. package/dist/{vitest-Blzbh8xZ.mjs → vitest-DkGh4Ygo.mjs} +1 -1
  28. package/dist/workspace-tasks-CnB8kkS0.mjs +4435 -0
  29. package/package.json +22 -4
  30. package/resources/api-report/runner.cjs +76 -0
  31. package/resources/devcontainer/setup.mjs +36 -0
  32. package/resources/knip/reporter.mjs +46 -0
  33. package/resources/maintenance/migration-lanes.mjs +141 -0
  34. package/resources/maintenance/migration-lock.mjs +119 -0
  35. package/resources/maintenance/migrations.mjs +215 -0
  36. package/resources/maintenance/presets.mjs +130 -0
  37. package/resources/maintenance/validate.mjs +233 -0
  38. package/resources/maintenance/workflow.yml +151 -0
  39. package/resources/skills/repoctl/SKILL.md +2 -0
  40. package/resources/skills/repoctl/references/commands.md +224 -13
  41. package/resources/skills/repoctl/references/config.md +70 -6
  42. package/resources/skills/repoctl/references/dependencies.md +37 -0
  43. package/resources/skills/repoctl/references/knip.md +34 -0
  44. package/resources/skills/repoctl/references/templates.md +23 -0
  45. package/dist/commands-D4xZQ5t-.mjs +0 -5685
  46. package/dist/config-p842Knhq.mjs +0 -114
  47. package/dist/index-Bl_PB2Ch.d.mts +0 -1039
  48. package/dist/tsconfig-BrjI_5yI.mjs +0 -75
  49. package/dist/types-MAUIQpfp.mjs +0 -499
  50. package/dist/workspace-MCKewElu.mjs +0 -123
@@ -1,2 +1,2 @@
1
- import { A as MonorepoVitestProjectConfigResult, C as MonorepoLintStagedConfigOptions, D as MonorepoVitestConfigOverrides, E as MonorepoVitestConfigOptions, O as MonorepoVitestConfigResult, S as MonorepoLintStagedConfig, T as MonorepoTsconfig, _ as DefineEslintConfigOptions, a as createMonorepoTsconfig, b as MonorepoCommitlintConfig, c as createMonorepoCommitlintConfig, d as defineCommitlintConfig, f as defineEslintConfig, g as DefineConfigOptions, h as defineLintStagedConfig, i as defineVitestProjectConfig, k as MonorepoVitestProjectConfigOptions, l as createMonorepoEslintConfig, m as createMonorepoLintStagedConfig, n as createMonorepoVitestProjectConfig, o as defineTsconfigConfig, p as defineStylelintConfig, r as defineVitestConfig, s as loadMonorepoToolingConfig, t as createMonorepoVitestConfig, u as createMonorepoStylelintConfig, v as DefineVitestConfigOptions, w as MonorepoStylelintConfig, x as MonorepoEslintConfig, y as DefineVitestProjectConfigOptions } from "./index-Bl_PB2Ch.mjs";
1
+ import { A as MonorepoVitestProjectConfigResult, C as MonorepoLintStagedConfigOptions, D as MonorepoVitestConfigOverrides, E as MonorepoVitestConfigOptions, O as MonorepoVitestConfigResult, S as MonorepoLintStagedConfig, T as MonorepoTsconfig, _ as DefineEslintConfigOptions, a as createMonorepoTsconfig, b as MonorepoCommitlintConfig, c as createMonorepoCommitlintConfig, d as defineCommitlintConfig, f as defineEslintConfig, g as DefineConfigOptions, h as defineLintStagedConfig, i as defineVitestProjectConfig, k as MonorepoVitestProjectConfigOptions, l as createMonorepoEslintConfig, m as createMonorepoLintStagedConfig, n as createMonorepoVitestProjectConfig, o as defineTsconfigConfig, p as defineStylelintConfig, r as defineVitestConfig, s as loadMonorepoToolingConfig, t as createMonorepoVitestConfig, u as createMonorepoStylelintConfig, v as DefineVitestConfigOptions, w as MonorepoStylelintConfig, x as MonorepoEslintConfig, y as DefineVitestProjectConfigOptions } from "./index-CoCTFWZJ.mjs";
2
2
  export { DefineConfigOptions, DefineEslintConfigOptions, DefineVitestConfigOptions, DefineVitestProjectConfigOptions, MonorepoCommitlintConfig, MonorepoEslintConfig, MonorepoLintStagedConfig, MonorepoLintStagedConfigOptions, MonorepoStylelintConfig, MonorepoTsconfig, MonorepoVitestConfigOptions, MonorepoVitestConfigOverrides, MonorepoVitestConfigResult, MonorepoVitestProjectConfigOptions, MonorepoVitestProjectConfigResult, createMonorepoCommitlintConfig, createMonorepoEslintConfig, createMonorepoLintStagedConfig, createMonorepoStylelintConfig, createMonorepoTsconfig, createMonorepoVitestConfig, createMonorepoVitestProjectConfig, defineCommitlintConfig, defineEslintConfig, defineLintStagedConfig, defineStylelintConfig, defineTsconfigConfig, defineVitestConfig, defineVitestProjectConfig, loadMonorepoToolingConfig };
@@ -1,3 +1,3 @@
1
- import { i as loadMonorepoToolingConfig, n as defineTsconfigConfig, t as createMonorepoTsconfig } from "./tsconfig-BrjI_5yI.mjs";
2
- import { a as createMonorepoCommitlintConfig, c as defineCommitlintConfig, d as createMonorepoLintStagedConfig, f as defineLintStagedConfig, i as defineVitestProjectConfig, l as defineEslintConfig, n as createMonorepoVitestProjectConfig, o as createMonorepoEslintConfig, r as defineVitestConfig, s as createMonorepoStylelintConfig, t as createMonorepoVitestConfig, u as defineStylelintConfig } from "./vitest-Blzbh8xZ.mjs";
1
+ import { i as loadMonorepoToolingConfig, n as defineTsconfigConfig, t as createMonorepoTsconfig } from "./tsconfig-CGntrzBM.mjs";
2
+ import { a as createMonorepoCommitlintConfig, c as defineCommitlintConfig, d as createMonorepoLintStagedConfig, f as defineLintStagedConfig, i as defineVitestProjectConfig, l as defineEslintConfig, n as createMonorepoVitestProjectConfig, o as createMonorepoEslintConfig, r as defineVitestConfig, s as createMonorepoStylelintConfig, t as createMonorepoVitestConfig, u as defineStylelintConfig } from "./vitest-DkGh4Ygo.mjs";
3
3
  export { createMonorepoCommitlintConfig, createMonorepoEslintConfig, createMonorepoLintStagedConfig, createMonorepoStylelintConfig, createMonorepoTsconfig, createMonorepoVitestConfig, createMonorepoVitestProjectConfig, defineCommitlintConfig, defineEslintConfig, defineLintStagedConfig, defineStylelintConfig, defineTsconfigConfig, defineVitestConfig, defineVitestProjectConfig, loadMonorepoToolingConfig };
@@ -0,0 +1,168 @@
1
+ import { St as localize, at as record, ot as safeFile, pt as stageFileTransaction, rt as hash, st as updateManifest } from "./workspace-tasks-CnB8kkS0.mjs";
2
+ import { a as dependencySections, i as rangesOverlap, n as equivalentRanges, o as matchGroup, r as parseSpecifier } from "./scan-4nboHNXP.mjs";
3
+ import { isDeepStrictEqual } from "node:util";
4
+ //#region src/commands/deps/report.ts
5
+ function classify(group) {
6
+ const occurrences = group.occurrences;
7
+ if (group.status === "exception") return;
8
+ if (occurrences.every((item) => item.protocol === "workspace")) {
9
+ group.status = "managed";
10
+ group.detail = localize("Workspace references are managed by workspace/release rules.", "workspace 引用由工作区和发布规则管理。");
11
+ return;
12
+ }
13
+ const ranges = occurrences.map((item) => item.range);
14
+ if (ranges.includes(null) || new Set(occurrences.map((item) => item.source)).size !== 1) {
15
+ group.status = "uncomparable";
16
+ group.detail = localize("The source package or protocol cannot be compared as one semver range.", "来源包或协议不能按同一个 semver 范围比较。");
17
+ return;
18
+ }
19
+ if (new Set(occurrences.map((item) => `${item.protocol}:${item.specifier}`)).size === 1) {
20
+ group.status = "consistent";
21
+ group.detail = localize("Declarations are identical.", "版本声明相同。");
22
+ return;
23
+ }
24
+ const knownRanges = ranges;
25
+ if (equivalentRanges(knownRanges)) {
26
+ group.status = "equivalent";
27
+ group.detail = localize("Declarations differ in text but allow equivalent versions.", "声明文本不同,但允许的版本等价。");
28
+ return;
29
+ }
30
+ const overlap = rangesOverlap(knownRanges);
31
+ group.status = overlap === void 0 ? "uncomparable" : overlap ? "compatible" : "conflict";
32
+ group.detail = overlap === void 0 ? localize("The range expression is too complex to prove a common version.", "版本表达式过于复杂,无法确认共同版本。") : overlap ? localize("Different ranges share a common allowed version.", "不同版本范围存在共同允许的版本。") : localize("Ranges have no common allowed version; declare intentional groups before aligning.", "版本范围没有共同允许的版本;统一前请声明有意保留的分组。");
33
+ }
34
+ function dependencyReport(scan) {
35
+ const grouped = /* @__PURE__ */ new Map();
36
+ for (const occurrence of scan.occurrences) {
37
+ const policy = matchGroup(occurrence, scan.policy);
38
+ const key = JSON.stringify([
39
+ occurrence.name,
40
+ occurrence.section,
41
+ policy?.name ?? "default"
42
+ ]);
43
+ let group = grouped.get(key);
44
+ if (!group) {
45
+ group = {
46
+ dependency: occurrence.name,
47
+ section: occurrence.section,
48
+ group: policy?.name ?? "default",
49
+ reason: policy?.reason ?? null,
50
+ status: policy?.ignore ? "exception" : "consistent",
51
+ detail: policy?.ignore ? localize("Explicit exception: ", "显式例外:") + policy.reason : "",
52
+ occurrences: []
53
+ };
54
+ grouped.set(key, group);
55
+ }
56
+ group.occurrences.push(occurrence);
57
+ }
58
+ const groups = [...grouped].sort(([a], [b]) => a.localeCompare(b)).map(([, group]) => group);
59
+ const summary = {
60
+ consistent: 0,
61
+ equivalent: 0,
62
+ compatible: 0,
63
+ conflict: 0,
64
+ uncomparable: 0,
65
+ managed: 0,
66
+ exception: 0
67
+ };
68
+ for (const group of groups) {
69
+ classify(group);
70
+ summary[group.status]++;
71
+ }
72
+ return {
73
+ schemaVersion: 1,
74
+ workspaceDir: scan.workspaceDir,
75
+ groups,
76
+ summary
77
+ };
78
+ }
79
+ //#endregion
80
+ //#region src/commands/deps/plan.ts
81
+ const dependencyNextSteps = ["pnpm install --lockfile-only", "pnpm install --frozen-lockfile"];
82
+ function prepareDependencyFix(scan, options) {
83
+ if (!options || typeof options.dependency !== "string" || !options.dependency.trim() || !dependencySections.includes(options.section) || typeof options.to !== "string" || !options.to.trim() || options.group !== void 0 && (typeof options.group !== "string" || !options.group)) throw new Error(localize("Select a dependency, dependency section and explicit target specifier.", "请明确选择依赖名称、依赖分区和目标版本声明。"));
84
+ const selection = {
85
+ ...options,
86
+ group: options.group ?? "default"
87
+ };
88
+ const group = dependencyReport(scan).groups.find((item) => item.dependency === selection.dependency && item.section === selection.section && item.group === selection.group);
89
+ if (!group) throw new Error(localize("No dependency declarations match this selection.", "没有依赖声明符合当前选择。"));
90
+ if (![
91
+ "consistent",
92
+ "equivalent",
93
+ "compatible"
94
+ ].includes(group.status)) throw new Error(localize(`Cannot align ${group.status} declarations: ${group.detail}`, `不能统一 ${group.status} 声明:${group.detail}`));
95
+ const target = parseSpecifier(selection.dependency, selection.to);
96
+ if (!["semver", "npm"].includes(target.protocol) || !target.range || group.occurrences.some((item) => item.protocol !== target.protocol || item.source !== target.source)) throw new Error(localize("Fixes require comparable semver declarations or npm aliases of the same source. Managed and unknown protocols are report-only.", "修复仅支持可比较的 semver 声明或来源相同的 npm alias;受管及未知协议仅报告。"));
97
+ if (rangesOverlap([...group.occurrences.map((item) => item.range), target.range]) !== true) throw new Error(localize("The target has no proven common version with the selected declarations; incompatible upgrades require a separate change.", "目标与所选声明没有可确认的共同版本;不兼容升级需要单独处理。"));
98
+ const updates = group.occurrences.filter((item) => item.specifier !== selection.to).map((item) => {
99
+ const original = scan.contents.get(item.path);
100
+ const content = updateManifest(original, item.section, item.name, selection.to);
101
+ return {
102
+ path: item.path,
103
+ original,
104
+ content,
105
+ change: {
106
+ path: item.path,
107
+ beforeHash: hash(original),
108
+ afterHash: hash(content),
109
+ section: item.section,
110
+ dependency: item.name,
111
+ before: item.specifier,
112
+ after: selection.to
113
+ }
114
+ };
115
+ });
116
+ return {
117
+ plan: {
118
+ schemaVersion: 1,
119
+ workspaceDir: scan.workspaceDir,
120
+ selection,
121
+ inputs: scan.inputs,
122
+ files: updates.map((item) => item.change),
123
+ nextSteps: [...dependencyNextSteps]
124
+ },
125
+ updates
126
+ };
127
+ }
128
+ //#endregion
129
+ //#region src/commands/deps/guard.ts
130
+ function validateDependencyPlan(plan) {
131
+ if (!record(plan) || plan.schemaVersion !== 1 || typeof plan.workspaceDir !== "string" || !record(plan.selection) || !Array.isArray(plan.inputs) || !Array.isArray(plan.files) || plan.inputs.some((item) => !record(item) || typeof item.path !== "string" || typeof item.hash !== "string") || plan.files.some((item) => !record(item) || typeof item.path !== "string" || typeof item.beforeHash !== "string" || typeof item.afterHash !== "string") || 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(localize("Invalid dependency fix plan.", "依赖修复计划无效。"));
132
+ }
133
+ /** Verify the entire input snapshot before any caller stages replacements. */
134
+ function inspectDependencyPlanInputs(scan, plan) {
135
+ if (scan.workspaceDir !== plan.workspaceDir || !isDeepStrictEqual(scan.inputs.map((item) => item.path), plan.inputs.map((item) => item.path))) throw new Error(localize("The workspace or input file set changed; generate a new dependency plan.", "工作区或输入文件集合已变更,请重新生成依赖计划。"));
136
+ let pending = 0;
137
+ let applied = 0;
138
+ for (const input of scan.inputs) {
139
+ const expected = plan.inputs.find((item) => item.path === input.path);
140
+ const change = plan.files.find((item) => item.path === input.path);
141
+ if (change && change.beforeHash !== expected.hash) throw new Error(localize("The plan contains inconsistent input hashes.", "计划中的输入校验值不一致。"));
142
+ if (input.hash === expected.hash) {
143
+ if (change) pending++;
144
+ } else if (change && input.hash === change.afterHash) applied++;
145
+ else throw new Error(localize(`Dependency plan conflict: ${input.path} changed.`, `依赖计划冲突:${input.path} 已变更。`));
146
+ }
147
+ if (plan.files.some((file) => !scan.inputs.some((input) => input.path === file.path))) throw new Error(localize("The plan contains an undiscovered file.", "计划包含不属于工作区输入的文件。"));
148
+ if (applied && pending) throw new Error(localize("The plan is partially applied; restore the retained backups or generate a new plan after review.", "计划只应用了一部分;请恢复保留的备份,或核查后重新生成计划。"));
149
+ if (applied === plan.files.length && applied > 0) return true;
150
+ return false;
151
+ }
152
+ //#endregion
153
+ //#region src/commands/deps/transaction.ts
154
+ /** Stage every replacement, retain originals until commit, and roll back recoverable failures. */
155
+ async function writeDependencyTransaction(root, updates) {
156
+ const transaction = await stageFileTransaction(updates, (file) => safeFile(root, file), "deps");
157
+ try {
158
+ await transaction.apply();
159
+ } catch (error) {
160
+ const recovery = await transaction.rollback();
161
+ if (recovery.length) throw new AggregateError([error], localize(`Dependency fix failed; original backups retained for manual recovery: ${recovery.join(", ")}`, `依赖修复失败;原始备份已保留,请手动恢复:${recovery.join(",")}`));
162
+ throw error;
163
+ }
164
+ const leftovers = await transaction.cleanup();
165
+ if (leftovers.length) throw new Error(localize(`Dependency changes were applied; remove retained backups after review: ${leftovers.join(", ")}`, `依赖变更已应用;核查后请删除保留的备份:${leftovers.join(",")}`));
166
+ }
167
+ //#endregion
168
+ export { prepareDependencyFix as a, dependencyNextSteps as i, inspectDependencyPlanInputs as n, dependencyReport as o, validateDependencyPlan as r, writeDependencyTransaction as t };