outfitter 0.3.2 → 0.3.3

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 (256) hide show
  1. package/README.md +33 -5
  2. package/dist/actions/add.d.ts +18 -0
  3. package/dist/actions/add.js +14 -0
  4. package/dist/actions/check-automation.d.ts +20 -0
  5. package/dist/actions/check-automation.js +27 -0
  6. package/dist/actions/check.d.ts +34 -0
  7. package/dist/actions/check.js +19 -0
  8. package/dist/actions/demo.d.ts +12 -0
  9. package/dist/actions/demo.js +11 -0
  10. package/dist/actions/docs-output-mode.d.ts +4 -0
  11. package/dist/actions/docs-output-mode.js +8 -0
  12. package/dist/actions/docs.d.ts +25 -0
  13. package/dist/actions/docs.js +31 -0
  14. package/dist/actions/doctor.d.ts +10 -0
  15. package/dist/actions/doctor.js +15 -0
  16. package/dist/actions/init.d.ts +28 -0
  17. package/dist/actions/init.js +31 -0
  18. package/dist/actions/scaffold.d.ts +19 -0
  19. package/dist/actions/scaffold.js +21 -0
  20. package/dist/actions/shared.d.ts +61 -0
  21. package/dist/actions/shared.js +30 -0
  22. package/dist/actions/upgrade.d.ts +17 -0
  23. package/dist/actions/upgrade.js +21 -0
  24. package/dist/actions.d.ts +2 -0
  25. package/dist/actions.js +66 -0
  26. package/dist/cli.js +66 -4
  27. package/dist/commands/add.d.ts +54 -0
  28. package/dist/commands/add.js +16 -0
  29. package/dist/commands/check-action-ceremony.d.ts +55 -0
  30. package/dist/commands/check-action-ceremony.js +15 -0
  31. package/dist/commands/check-docs-sentinel.d.ts +27 -0
  32. package/dist/commands/check-docs-sentinel.js +18 -0
  33. package/dist/commands/check-orchestrator.d.ts +2 -0
  34. package/dist/commands/check-orchestrator.js +17 -0
  35. package/dist/commands/check-preset-versions.d.ts +20 -0
  36. package/dist/commands/check-preset-versions.js +15 -0
  37. package/dist/commands/check-publish-guardrails.d.ts +38 -0
  38. package/dist/commands/check-publish-guardrails.js +19 -0
  39. package/dist/commands/check-surface-map-format.d.ts +29 -0
  40. package/dist/commands/check-surface-map-format.js +19 -0
  41. package/dist/commands/check-surface-map.d.ts +20 -0
  42. package/dist/commands/check-surface-map.js +15 -0
  43. package/dist/commands/check-tsdoc.d.ts +3 -0
  44. package/dist/commands/check-tsdoc.js +9 -0
  45. package/dist/commands/check.d.ts +93 -0
  46. package/dist/commands/check.js +14 -0
  47. package/dist/commands/demo.d.ts +21 -0
  48. package/dist/commands/demo.js +8 -0
  49. package/dist/commands/docs-api.d.ts +4 -0
  50. package/dist/commands/docs-api.js +13 -0
  51. package/dist/commands/docs-export.d.ts +4 -0
  52. package/dist/commands/docs-export.js +12 -0
  53. package/dist/commands/docs-list.d.ts +3 -0
  54. package/dist/commands/docs-list.js +13 -0
  55. package/dist/commands/docs-module-loader.d.ts +2 -0
  56. package/dist/commands/docs-module-loader.js +8 -0
  57. package/dist/commands/docs-search.d.ts +3 -0
  58. package/dist/commands/docs-search.js +13 -0
  59. package/dist/commands/docs-show.d.ts +3 -0
  60. package/dist/commands/docs-show.js +13 -0
  61. package/dist/commands/docs-types.d.ts +21 -0
  62. package/dist/commands/docs-types.js +1 -0
  63. package/dist/commands/doctor.d.ts +2 -0
  64. package/dist/commands/doctor.js +17 -0
  65. package/dist/commands/init-execution.d.ts +8 -0
  66. package/dist/commands/init-execution.js +11 -0
  67. package/dist/commands/init-option-resolution.d.ts +5 -0
  68. package/dist/commands/init-option-resolution.js +14 -0
  69. package/dist/commands/init-output.d.ts +9 -0
  70. package/dist/commands/init-output.js +11 -0
  71. package/dist/commands/init.d.ts +9 -0
  72. package/dist/commands/init.js +24 -0
  73. package/dist/commands/jq-utils.d.ts +17 -0
  74. package/dist/commands/jq-utils.js +8 -0
  75. package/dist/commands/repo.d.ts +3 -0
  76. package/dist/commands/repo.js +13 -0
  77. package/dist/commands/scaffold-output.d.ts +4 -0
  78. package/dist/commands/scaffold-output.js +11 -0
  79. package/dist/commands/scaffold-planning.d.ts +65 -0
  80. package/dist/commands/scaffold-planning.js +20 -0
  81. package/dist/commands/scaffold.d.ts +4 -0
  82. package/dist/commands/scaffold.js +26 -0
  83. package/dist/commands/shared-deps.d.ts +22 -0
  84. package/dist/commands/shared-deps.js +11 -0
  85. package/dist/commands/upgrade-apply.d.ts +14 -0
  86. package/dist/commands/upgrade-apply.js +8 -0
  87. package/dist/commands/upgrade-codemods.d.ts +47 -0
  88. package/dist/commands/upgrade-codemods.js +14 -0
  89. package/dist/commands/upgrade-latest-version.d.ts +8 -0
  90. package/dist/commands/upgrade-latest-version.js +8 -0
  91. package/dist/commands/upgrade-migration-docs.d.ts +3 -0
  92. package/dist/commands/upgrade-migration-docs.js +15 -0
  93. package/dist/commands/upgrade-migration-frontmatter.d.ts +2 -0
  94. package/dist/commands/upgrade-migration-frontmatter.js +10 -0
  95. package/dist/commands/upgrade-migration-guides.d.ts +5 -0
  96. package/dist/commands/upgrade-migration-guides.js +10 -0
  97. package/dist/commands/upgrade-output.d.ts +5 -0
  98. package/dist/commands/upgrade-output.js +11 -0
  99. package/dist/commands/upgrade-planner.d.ts +58 -0
  100. package/dist/commands/upgrade-planner.js +8 -0
  101. package/dist/commands/upgrade-report.d.ts +5 -0
  102. package/dist/commands/upgrade-report.js +8 -0
  103. package/dist/commands/upgrade-workspace.d.ts +2 -0
  104. package/dist/commands/upgrade-workspace.js +16 -0
  105. package/dist/commands/upgrade.d.ts +5 -0
  106. package/dist/commands/upgrade.js +37 -0
  107. package/dist/create/index.d.ts +5 -0
  108. package/dist/create/index.js +2 -0
  109. package/dist/create/planner.d.ts +3 -0
  110. package/dist/create/planner.js +85 -0
  111. package/dist/create/presets.d.ts +3 -0
  112. package/dist/create/presets.js +12 -0
  113. package/dist/create/types.d.ts +2 -0
  114. package/dist/create/types.js +1 -0
  115. package/dist/engine/blocks.d.ts +3 -0
  116. package/dist/engine/blocks.js +12 -0
  117. package/dist/engine/collector.d.ts +2 -0
  118. package/dist/engine/collector.js +8 -0
  119. package/dist/engine/config.d.ts +3 -0
  120. package/dist/engine/config.js +15 -0
  121. package/dist/engine/dependency-versions.d.ts +17 -0
  122. package/dist/engine/dependency-versions.js +12 -0
  123. package/dist/engine/executor.d.ts +3 -0
  124. package/dist/engine/executor.js +156 -0
  125. package/dist/engine/index.d.ts +10 -0
  126. package/dist/engine/index.js +54 -0
  127. package/dist/engine/names.d.ts +2 -0
  128. package/dist/engine/names.js +24 -0
  129. package/dist/engine/post-scaffold.d.ts +3 -0
  130. package/dist/engine/post-scaffold.js +8 -0
  131. package/dist/engine/preset.d.ts +3 -0
  132. package/dist/engine/preset.js +17 -0
  133. package/dist/engine/render-plan.d.ts +7 -0
  134. package/dist/engine/render-plan.js +9 -0
  135. package/dist/engine/template.d.ts +4 -0
  136. package/dist/engine/template.js +34 -0
  137. package/dist/engine/types.d.ts +2 -0
  138. package/dist/engine/types.js +8 -0
  139. package/dist/engine/workspace.d.ts +3 -0
  140. package/dist/engine/workspace.js +20 -0
  141. package/dist/index.d.ts +17 -397
  142. package/dist/index.js +7 -165
  143. package/dist/manifest.d.ts +71 -0
  144. package/dist/manifest.js +16 -0
  145. package/dist/output-mode.d.ts +2 -0
  146. package/dist/output-mode.js +10 -0
  147. package/dist/shared/outfitter-109s75x0.d.ts +76 -0
  148. package/dist/shared/outfitter-1fy7byz5.js +170 -0
  149. package/dist/shared/outfitter-1h7k8xxt.js +29 -0
  150. package/dist/shared/outfitter-1tfa9hke.d.ts +55 -0
  151. package/dist/shared/outfitter-2nx0k4b3.d.ts +4 -0
  152. package/dist/shared/outfitter-2ysjerp6.d.ts +44 -0
  153. package/dist/shared/outfitter-2z61gp5w.js +29 -0
  154. package/dist/shared/outfitter-34vg353f.d.ts +82 -0
  155. package/dist/shared/outfitter-3dq4r10s.d.ts +24 -0
  156. package/dist/shared/outfitter-3rcrvva8.js +103 -0
  157. package/dist/shared/outfitter-3tx3adgj.js +278 -0
  158. package/dist/shared/outfitter-4q1zfmvc.js +154 -0
  159. package/dist/shared/outfitter-4s9meh3j.js +221 -0
  160. package/dist/shared/outfitter-507ra35w.js +285 -0
  161. package/dist/shared/outfitter-56jq0rh2.d.ts +42 -0
  162. package/dist/shared/outfitter-58rn1sj1.d.ts +30 -0
  163. package/dist/shared/outfitter-5d9wbzhh.d.ts +19 -0
  164. package/dist/shared/outfitter-5j7zee11.d.ts +180 -0
  165. package/dist/shared/outfitter-5r6q2749.d.ts +18 -0
  166. package/dist/shared/outfitter-5vx1bp7h.js +41 -0
  167. package/dist/shared/outfitter-6ddf91vh.js +190 -0
  168. package/dist/shared/outfitter-6mpkh3zn.js +432 -0
  169. package/dist/shared/outfitter-6rtcemk7.d.ts +18 -0
  170. package/dist/shared/outfitter-6t7xeyg1.js +159 -0
  171. package/dist/shared/outfitter-738z4c37.js +262 -0
  172. package/dist/shared/outfitter-76k25svs.js +322 -0
  173. package/dist/shared/outfitter-7n7vsz95.js +101 -0
  174. package/dist/shared/outfitter-7q9fnbwa.js +60 -0
  175. package/dist/shared/outfitter-7r12fj7f.js +30 -0
  176. package/dist/shared/outfitter-84chvazx.js +480 -0
  177. package/dist/shared/outfitter-8ggmja91.js +301 -0
  178. package/dist/shared/outfitter-8kmak0wc.d.ts +4 -0
  179. package/dist/shared/outfitter-8y2dfx6n.js +11 -0
  180. package/dist/shared/outfitter-940h0x7b.js +71 -0
  181. package/dist/shared/outfitter-954y4mzx.d.ts +5 -0
  182. package/dist/shared/outfitter-a79xrm12.d.ts +17 -0
  183. package/dist/shared/outfitter-b9cpnr7e.js +110 -0
  184. package/dist/shared/outfitter-bpr28y54.js +70 -0
  185. package/dist/shared/outfitter-c7sbs7es.js +92 -0
  186. package/dist/shared/outfitter-cyhzstz0.js +93 -0
  187. package/dist/shared/outfitter-cyvr4r8d.d.ts +67 -0
  188. package/dist/shared/outfitter-d0kqashd.d.ts +98 -0
  189. package/dist/shared/outfitter-dx4hn4ta.js +325 -0
  190. package/dist/shared/outfitter-e84cr97g.js +232 -0
  191. package/dist/shared/outfitter-ec83h4v2.js +17 -0
  192. package/dist/shared/outfitter-eepj7rf7.js +4 -0
  193. package/dist/shared/outfitter-ekb6t1zz.js +35 -0
  194. package/dist/shared/outfitter-ex8gn945.js +51 -0
  195. package/dist/shared/outfitter-f3a70135.js +75 -0
  196. package/dist/shared/outfitter-fbvfd5zq.d.ts +13 -0
  197. package/dist/shared/outfitter-fj2v5ffz.js +165 -0
  198. package/dist/shared/outfitter-fx1m251y.js +122 -0
  199. package/dist/shared/outfitter-fxry5n58.js +254 -0
  200. package/dist/shared/outfitter-g3hvjshg.js +1 -0
  201. package/dist/shared/outfitter-gdc7b7de.d.ts +5 -0
  202. package/dist/shared/outfitter-gyayfx5r.js +156 -0
  203. package/dist/shared/outfitter-h0wmtxw8.d.ts +23 -0
  204. package/dist/shared/outfitter-hcexcvxe.d.ts +25 -0
  205. package/dist/shared/outfitter-hf5bj2gq.js +117 -0
  206. package/dist/shared/outfitter-hsp8vy5m.d.ts +146 -0
  207. package/dist/shared/outfitter-htx4asgr.d.ts +52 -0
  208. package/dist/shared/outfitter-jkct38dh.js +53 -0
  209. package/dist/shared/outfitter-jwxggvz4.js +42 -0
  210. package/dist/shared/outfitter-k6zyvg2n.js +306 -0
  211. package/dist/shared/outfitter-ksyvwmb5.js +191 -0
  212. package/dist/shared/outfitter-m3ehh37q.d.ts +22 -0
  213. package/dist/shared/outfitter-mstr60zz.js +215 -0
  214. package/dist/shared/outfitter-n0ed012k.js +101 -0
  215. package/dist/shared/outfitter-n13pqaft.js +19 -0
  216. package/dist/shared/outfitter-nxvjxrmw.d.ts +48 -0
  217. package/dist/shared/outfitter-p2wn07b7.js +160 -0
  218. package/dist/shared/outfitter-px5sv5gn.js +321 -0
  219. package/dist/shared/outfitter-q1g58t85.js +8 -0
  220. package/dist/shared/outfitter-qsd5638j.js +378 -0
  221. package/dist/shared/outfitter-qsrx7m4w.js +72 -0
  222. package/dist/shared/outfitter-r2awqszh.d.ts +52 -0
  223. package/dist/shared/outfitter-rdpw2sbp.d.ts +77 -0
  224. package/dist/shared/outfitter-rp89dafm.js +109 -0
  225. package/dist/shared/outfitter-s1c0whzj.js +121 -0
  226. package/dist/shared/outfitter-ssrtakh3.js +342 -0
  227. package/dist/shared/outfitter-ssynegbs.js +167 -0
  228. package/dist/shared/outfitter-svts4wk2.js +36 -0
  229. package/dist/shared/outfitter-tavatb5p.js +166 -0
  230. package/dist/shared/outfitter-tqznjgbm.js +44 -0
  231. package/dist/shared/outfitter-ttjr95y9.js +98 -0
  232. package/dist/shared/outfitter-wcrp7d7m.d.ts +5 -0
  233. package/dist/shared/outfitter-wkt0a0ra.js +67 -0
  234. package/dist/shared/outfitter-wrcqq29p.js +132 -0
  235. package/dist/shared/outfitter-wyg1tpp5.d.ts +43 -0
  236. package/dist/shared/outfitter-x0vpb7tj.js +126 -0
  237. package/dist/shared/outfitter-x39awx8g.js +146 -0
  238. package/dist/shared/outfitter-x4cc5xsq.js +168 -0
  239. package/dist/shared/outfitter-x8w5sjnd.d.ts +39 -0
  240. package/dist/shared/outfitter-xr6g13nz.d.ts +50 -0
  241. package/dist/shared/outfitter-xs94pkfe.js +106 -0
  242. package/dist/shared/outfitter-y37yfehn.d.ts +37 -0
  243. package/dist/shared/outfitter-y6ee0k45.d.ts +18 -0
  244. package/dist/shared/outfitter-ydw7x6bh.js +61 -0
  245. package/dist/shared/outfitter-yhb23pjc.js +89 -0
  246. package/dist/shared/outfitter-ypcvwg1s.js +91 -0
  247. package/dist/shared/outfitter-znbqe5zy.d.ts +45 -0
  248. package/dist/shared/outfitter-zng6w0t9.d.ts +4 -0
  249. package/dist/targets/index.d.ts +4 -0
  250. package/dist/targets/index.js +28 -0
  251. package/dist/targets/registry.d.ts +3 -0
  252. package/dist/targets/registry.js +221 -0
  253. package/dist/targets/types.d.ts +2 -0
  254. package/dist/targets/types.js +1 -0
  255. package/package.json +194 -35
  256. package/dist/shared/chunk-3pwh8ys4.js +0 -6461
@@ -0,0 +1,168 @@
1
+ // @bun
2
+ import {
3
+ findMigrationDocsDir,
4
+ readMigrationDocs
5
+ } from "./outfitter-fx1m251y.js";
6
+ import {
7
+ resolveStructuredOutputMode
8
+ } from "./outfitter-7r12fj7f.js";
9
+
10
+ // apps/outfitter/src/commands/upgrade-output.ts
11
+ import { output } from "@outfitter/cli";
12
+ import { createTheme } from "@outfitter/tui/render";
13
+ async function printUpgradeResults(result, options) {
14
+ const structuredMode = resolveStructuredOutputMode(options?.mode);
15
+ if (structuredMode) {
16
+ await output(result, { mode: structuredMode });
17
+ return;
18
+ }
19
+ const theme = createTheme();
20
+ const lines = ["", "Outfitter Upgrade", "", "=".repeat(60)];
21
+ if (result.packages.length === 0) {
22
+ lines.push("No @outfitter/* packages found in package.json.");
23
+ if (!result.unknownPackages || result.unknownPackages.length === 0) {
24
+ await output(lines, { mode: "human" });
25
+ return;
26
+ }
27
+ lines.push("");
28
+ } else {
29
+ lines.push(` ${"Package".padEnd(28)} ${"Current".padEnd(10)} ${"Available".padEnd(10)} Migration`);
30
+ lines.push(` ${"\u2500".repeat(28)} ${"\u2500".repeat(10)} ${"\u2500".repeat(10)} ${"\u2500".repeat(20)}`);
31
+ for (const pkg of result.packages) {
32
+ const name = pkg.name.padEnd(28);
33
+ const current = pkg.current.padEnd(10);
34
+ const available = (pkg.latest ?? "unknown").padEnd(10);
35
+ let migration;
36
+ if (pkg.latest === null) {
37
+ migration = theme.muted("lookup failed");
38
+ } else if (!pkg.updateAvailable) {
39
+ migration = theme.muted("up to date");
40
+ } else if (pkg.breaking) {
41
+ migration = theme.error("breaking");
42
+ } else {
43
+ migration = theme.success("non-breaking");
44
+ }
45
+ lines.push(` ${name} ${current} ${available} ${migration}`);
46
+ }
47
+ lines.push("");
48
+ }
49
+ if (result.applied && result.appliedPackages.length > 0) {
50
+ const breakingApplied = result.appliedPackages.filter((name) => result.packages.some((p) => p.name === name && p.breaking));
51
+ const nonBreakingApplied = result.appliedPackages.filter((name) => !result.packages.some((p) => p.name === name && p.breaking));
52
+ if (nonBreakingApplied.length > 0) {
53
+ lines.push(theme.success(`Applied ${nonBreakingApplied.length} non-breaking upgrade(s):`));
54
+ for (const name of nonBreakingApplied) {
55
+ lines.push(` - ${name}`);
56
+ }
57
+ lines.push("");
58
+ }
59
+ if (breakingApplied.length > 0) {
60
+ lines.push(theme.error(`Applied ${breakingApplied.length} breaking upgrade(s):`));
61
+ for (const name of breakingApplied) {
62
+ const pkg = result.packages.find((p) => p.name === name);
63
+ lines.push(` - ${name} (${pkg?.current} -> ${pkg?.latest})`);
64
+ }
65
+ lines.push("", theme.muted("Review migration guides: 'outfitter upgrade --guide'"));
66
+ lines.push("");
67
+ }
68
+ }
69
+ if (result.skippedBreaking.length > 0 && options?.all !== true) {
70
+ if (result.applied) {
71
+ lines.push(theme.error(`Skipped ${result.skippedBreaking.length} breaking upgrade(s):`));
72
+ } else {
73
+ lines.push(" Excluded (breaking):");
74
+ }
75
+ for (const name of result.skippedBreaking) {
76
+ const pkg = result.packages.find((p) => p.name === name);
77
+ const codemodHint = pkg?.breaking ? "(migration guide)" : "";
78
+ lines.push(` ${name.padEnd(24)} ${(pkg?.current ?? "").padEnd(8)} -> ${(pkg?.latest ?? "").padEnd(8)} ${codemodHint}`.trimEnd());
79
+ }
80
+ lines.push("", theme.muted(" Use --all to include breaking changes"));
81
+ lines.push("");
82
+ }
83
+ if (result.codemods !== undefined) {
84
+ const uniqueChangedFiles = [
85
+ ...new Set(result.codemods.changedFiles)
86
+ ].toSorted();
87
+ lines.push(theme.info(`Ran ${result.codemods.codemodCount} codemod(s).`));
88
+ if (uniqueChangedFiles.length > 0) {
89
+ lines.push(theme.success(`Codemods changed ${uniqueChangedFiles.length} file(s):`));
90
+ for (const file of uniqueChangedFiles) {
91
+ lines.push(` - ${file}`);
92
+ }
93
+ }
94
+ if (result.codemods.errors.length > 0) {
95
+ lines.push(theme.error(`Codemod errors (${result.codemods.errors.length}):`));
96
+ for (const error of result.codemods.errors) {
97
+ lines.push(` - ${error}`);
98
+ }
99
+ }
100
+ lines.push("");
101
+ }
102
+ if (result.conflicts && result.conflicts.length > 0) {
103
+ lines.push(theme.warning(`Version conflict(s) across workspace (${result.conflicts.length}):`));
104
+ for (const conflict of result.conflicts) {
105
+ lines.push(` ${conflict.name}`);
106
+ for (const entry of conflict.versions) {
107
+ const manifests = entry.manifests.map((m) => {
108
+ const dir = m.replace(/\/package\.json$/, "");
109
+ const parts = dir.split("/");
110
+ return parts.slice(-2).join("/");
111
+ }).join(", ");
112
+ lines.push(` ${entry.version.padEnd(10)} ${theme.muted(manifests)}`);
113
+ }
114
+ }
115
+ lines.push("");
116
+ }
117
+ if (result.unknownPackages && result.unknownPackages.length > 0) {
118
+ lines.push(theme.error("Unknown package(s) not found in workspace:"));
119
+ for (const name of result.unknownPackages) {
120
+ lines.push(` - ${name}`);
121
+ }
122
+ lines.push("");
123
+ }
124
+ if (!result.applied) {
125
+ if (options?.dryRun) {
126
+ lines.push(theme.muted("Dry run \u2014 no changes applied."));
127
+ } else if (result.updatesAvailable > 0) {
128
+ lines.push(theme.muted("Run 'outfitter upgrade --guide' for migration instructions."));
129
+ } else {
130
+ lines.push(theme.success("All packages are up to date."));
131
+ }
132
+ }
133
+ if (options?.guide && result.guides && result.guides.length > 0) {
134
+ lines.push("", "=".repeat(60), "", "Migration Guide", "");
135
+ for (const guide of result.guides) {
136
+ const label = guide.breaking ? theme.error("BREAKING") : theme.success("non-breaking");
137
+ lines.push(`${theme.info(guide.packageName)} ${guide.fromVersion} -> ${guide.toVersion} [${label}]`);
138
+ if (guide.steps.length > 0) {
139
+ for (const step of guide.steps) {
140
+ lines.push(` ${step}`);
141
+ }
142
+ } else {
143
+ lines.push(` ${theme.muted("No migration steps available. Check release notes.")}`);
144
+ }
145
+ lines.push("");
146
+ }
147
+ } else if (options?.guide && result.updatesAvailable > 0 && !result.guides) {
148
+ const cwd = options.cwd ?? process.cwd();
149
+ const migrationsDir = findMigrationDocsDir(cwd);
150
+ if (migrationsDir) {
151
+ lines.push("", "=".repeat(60), "", "Migration Guide", "");
152
+ for (const pkg of result.packages) {
153
+ if (!(pkg.updateAvailable && pkg.latest))
154
+ continue;
155
+ const shortName = pkg.name.replace("@outfitter/", "");
156
+ const docs = readMigrationDocs(migrationsDir, shortName, pkg.current, pkg.latest);
157
+ for (const doc of docs) {
158
+ lines.push(doc, "", "---", "");
159
+ }
160
+ }
161
+ } else {
162
+ lines.push("", theme.muted("Migration docs not found locally. See https://github.com/outfitter-dev/outfitter for migration guides."));
163
+ }
164
+ }
165
+ await output(lines, { mode: "human" });
166
+ }
167
+
168
+ export { printUpgradeResults };
@@ -0,0 +1,39 @@
1
+ import { CliOutputMode } from "./outfitter-a79xrm12.js";
2
+ import { DocsExportTarget, loadDocsModule } from "./outfitter-1tfa9hke.js";
3
+ import { InternalError, Result } from "@outfitter/contracts";
4
+ /** Validated input for the docs.action handler. */
5
+ interface DocsExportInput {
6
+ readonly cwd: string;
7
+ readonly outputMode: CliOutputMode;
8
+ readonly target: DocsExportTarget;
9
+ }
10
+ /** Output shape for the docs.action. */
11
+ interface DocsExportOutput {
12
+ readonly exitCode: number;
13
+ readonly messages: string[];
14
+ readonly target: string;
15
+ readonly warnings: string[];
16
+ }
17
+ interface DocsExportDependencies {
18
+ readonly loadDocsModule?: typeof loadDocsModule;
19
+ }
20
+ /**
21
+ * Export documentation to the specified target format.
22
+ *
23
+ * Delegates to `executeExportCommand` from "@outfitter/docs" via the
24
+ * dynamic module loader.
25
+ *
26
+ * @param input - Validated action input
27
+ * @returns Result containing the output or an error
28
+ */
29
+ declare function runDocsExport(input: DocsExportInput, dependencies?: DocsExportDependencies): Promise<Result<DocsExportOutput, InternalError>>;
30
+ /**
31
+ * Print docs results in the appropriate output format.
32
+ *
33
+ * @param result - The docs output
34
+ * @param options - Output formatting options
35
+ */
36
+ declare function printDocsExportResults(result: DocsExportOutput, options?: {
37
+ mode?: CliOutputMode;
38
+ }): Promise<void>;
39
+ export { DocsExportInput, DocsExportOutput, runDocsExport, printDocsExportResults };
@@ -0,0 +1,50 @@
1
+ type Operation = {
2
+ readonly type: "file-create";
3
+ readonly path: string;
4
+ readonly source: "preset" | "block" | "generated";
5
+ } | {
6
+ readonly type: "file-overwrite";
7
+ readonly path: string;
8
+ readonly source: "preset" | "block" | "generated";
9
+ } | {
10
+ readonly type: "file-skip";
11
+ readonly path: string;
12
+ readonly reason: string;
13
+ } | {
14
+ readonly type: "dir-create";
15
+ readonly path: string;
16
+ } | {
17
+ readonly type: "dependency-add";
18
+ readonly name: string;
19
+ readonly version: string;
20
+ readonly section: "dependencies" | "devDependencies" | "peerDependencies";
21
+ } | {
22
+ readonly type: "block-add";
23
+ readonly name: string;
24
+ readonly files: readonly string[];
25
+ } | {
26
+ readonly type: "config-inject";
27
+ readonly target: string;
28
+ readonly description: string;
29
+ } | {
30
+ readonly type: "git";
31
+ readonly action: "init" | "add-all" | "commit";
32
+ readonly cwd: string;
33
+ readonly message?: string | undefined;
34
+ } | {
35
+ readonly type: "install";
36
+ readonly command: string;
37
+ readonly cwd: string;
38
+ };
39
+ declare class OperationCollector {
40
+ private readonly operations;
41
+ add(op: Operation): void;
42
+ getOperations(): readonly Operation[];
43
+ countByType(): Record<string, number>;
44
+ isEmpty(): boolean;
45
+ toJSON(): {
46
+ operations: readonly Operation[];
47
+ summary: Record<string, number>;
48
+ };
49
+ }
50
+ export { Operation, OperationCollector };
@@ -0,0 +1,106 @@
1
+ // @bun
2
+ import {
3
+ actionInternalErr,
4
+ outputModeSchema,
5
+ resolveBooleanFlagAlias,
6
+ resolveInstallTimeoutFlag,
7
+ resolveLocalFlag,
8
+ resolveNoToolingFlag,
9
+ resolveStringFlag
10
+ } from "./outfitter-7n7vsz95.js";
11
+ import {
12
+ runScaffold
13
+ } from "./outfitter-6ddf91vh.js";
14
+ import {
15
+ printScaffoldResults
16
+ } from "./outfitter-qsrx7m4w.js";
17
+ import {
18
+ resolveOutputModeFromContext
19
+ } from "./outfitter-7r12fj7f.js";
20
+
21
+ // apps/outfitter/src/actions/scaffold.ts
22
+ import { actionCliPresets } from "@outfitter/cli/actions";
23
+ import { dryRunPreset, forcePreset } from "@outfitter/cli/flags";
24
+ import { defineAction, Result } from "@outfitter/contracts";
25
+ import { z } from "zod";
26
+ var scaffoldInputSchema = z.object({
27
+ target: z.string(),
28
+ name: z.string().optional(),
29
+ force: z.boolean(),
30
+ skipInstall: z.boolean(),
31
+ dryRun: z.boolean(),
32
+ with: z.string().optional(),
33
+ noTooling: z.boolean().optional(),
34
+ local: z.boolean().optional(),
35
+ installTimeout: z.number().optional(),
36
+ cwd: z.string(),
37
+ outputMode: outputModeSchema
38
+ });
39
+ var scaffoldSharedFlags = actionCliPresets(forcePreset(), dryRunPreset());
40
+ function resolveScaffoldOptions(context) {
41
+ const flags = context.flags;
42
+ const { force, dryRun } = scaffoldSharedFlags.resolve(context);
43
+ const outputMode = resolveOutputModeFromContext(context.flags);
44
+ const noTooling = resolveNoToolingFlag(flags);
45
+ const local = resolveLocalFlag(flags);
46
+ const installTimeout = resolveInstallTimeoutFlag(flags.installTimeout);
47
+ return {
48
+ target: String(context.args[0] ?? ""),
49
+ name: resolveStringFlag(context.args[1]),
50
+ force,
51
+ skipInstall: resolveBooleanFlagAlias(context.flags, "skipInstall", "skip-install"),
52
+ dryRun,
53
+ ...local !== undefined ? { local } : {},
54
+ with: resolveStringFlag(flags.with),
55
+ ...noTooling !== undefined ? { noTooling } : {},
56
+ ...installTimeout !== undefined ? { installTimeout } : {},
57
+ cwd: process.cwd(),
58
+ outputMode
59
+ };
60
+ }
61
+ var scaffoldAction = defineAction({
62
+ id: "scaffold",
63
+ description: "Add a capability to an existing project",
64
+ surfaces: ["cli"],
65
+ input: scaffoldInputSchema,
66
+ cli: {
67
+ command: "scaffold <target> [name]",
68
+ description: "Add a capability (cli, mcp, daemon, lib, ...) to an existing project",
69
+ options: [
70
+ ...scaffoldSharedFlags.options,
71
+ {
72
+ flags: "--skip-install",
73
+ description: "Skip bun install",
74
+ defaultValue: false
75
+ },
76
+ {
77
+ flags: "--with <blocks>",
78
+ description: "Comma-separated tooling blocks to add"
79
+ },
80
+ {
81
+ flags: "--no-tooling",
82
+ description: "Skip default tooling blocks"
83
+ },
84
+ {
85
+ flags: "--local",
86
+ description: "Use workspace:* for @outfitter dependencies"
87
+ },
88
+ {
89
+ flags: "--install-timeout <ms>",
90
+ description: "bun install timeout in milliseconds"
91
+ }
92
+ ],
93
+ mapInput: resolveScaffoldOptions
94
+ },
95
+ handler: async (input) => {
96
+ const { outputMode, ...scaffoldInput } = input;
97
+ const result = await runScaffold(scaffoldInput);
98
+ if (result.isErr()) {
99
+ return actionInternalErr("scaffold", result.error);
100
+ }
101
+ await printScaffoldResults(result.value, { mode: outputMode });
102
+ return Result.ok(result.value);
103
+ }
104
+ });
105
+
106
+ export { scaffoldAction };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Structured migration doc frontmatter parsing for `outfitter upgrade`.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ /** Classification of a change within a migration. */
7
+ type MigrationChangeType = "renamed" | "removed" | "signature-changed" | "moved" | "deprecated" | "added";
8
+ /** A single structured change entry from migration frontmatter. */
9
+ interface MigrationChange {
10
+ /** Path to codemod script relative to the codemods directory. */
11
+ readonly codemod?: string;
12
+ readonly detail?: string;
13
+ readonly export?: string;
14
+ readonly from?: string;
15
+ readonly path?: string;
16
+ readonly to?: string;
17
+ readonly type: MigrationChangeType;
18
+ }
19
+ /** Parsed frontmatter from a migration doc. */
20
+ interface MigrationFrontmatter {
21
+ readonly breaking: boolean;
22
+ readonly changes?: readonly MigrationChange[];
23
+ readonly package: string;
24
+ readonly version: string;
25
+ }
26
+ /**
27
+ * Strip a YAML frontmatter block from migration doc content.
28
+ */
29
+ declare function stripMigrationFrontmatter(content: string): string;
30
+ /**
31
+ * Parse the full frontmatter from a migration doc, including the `changes` array.
32
+ *
33
+ * Returns `null` if the content has no valid frontmatter or is missing
34
+ * required fields (`package`, `version`, `breaking`).
35
+ */
36
+ declare function parseMigrationFrontmatter(content: string): MigrationFrontmatter | null;
37
+ export { MigrationChangeType, MigrationChange, MigrationFrontmatter, stripMigrationFrontmatter, parseMigrationFrontmatter };
@@ -0,0 +1,18 @@
1
+ import { ScaffoldError } from "./outfitter-cyvr4r8d.js";
2
+ import { Result } from "@outfitter/contracts";
3
+ declare function buildWorkspaceRootReadme(workspaceName: string): string;
4
+ declare function buildWorkspaceRootPackageJson(workspaceName: string): string;
5
+ declare function scaffoldWorkspaceRoot(rootDir: string, workspaceName: string, force: boolean): Result<void, ScaffoldError>;
6
+ /**
7
+ * Extracts workspace glob patterns from a package.json `workspaces` field.
8
+ *
9
+ * Handles both array form (`["apps/*"]`) and object form (`{ packages: ["apps/*"] }`).
10
+ */
11
+ declare function getWorkspacePatterns(workspaces: unknown): readonly string[];
12
+ interface PackageDeps {
13
+ workspaces?: unknown;
14
+ [key: string]: unknown;
15
+ }
16
+ declare function hasWorkspacesField(pkg: PackageDeps): boolean;
17
+ declare function detectWorkspaceRoot(cwd: string): Result<string | null, ScaffoldError>;
18
+ export { buildWorkspaceRootReadme, buildWorkspaceRootPackageJson, scaffoldWorkspaceRoot, getWorkspacePatterns, hasWorkspacesField, detectWorkspaceRoot };
@@ -0,0 +1,61 @@
1
+ // @bun
2
+ import {
3
+ runAdd
4
+ } from "./outfitter-3tx3adgj.js";
5
+ import {
6
+ ScaffoldError
7
+ } from "./outfitter-8y2dfx6n.js";
8
+
9
+ // apps/outfitter/src/engine/blocks.ts
10
+ import { Result } from "@outfitter/contracts";
11
+ async function addBlocks(targetDir, blocks, options) {
12
+ const mergedResult = {
13
+ created: [],
14
+ skipped: [],
15
+ overwritten: [],
16
+ dependencies: {},
17
+ devDependencies: {}
18
+ };
19
+ for (const blockName of blocks) {
20
+ const result = await runAdd({
21
+ block: blockName,
22
+ force: options.force,
23
+ dryRun: Boolean(options.collector),
24
+ cwd: targetDir
25
+ });
26
+ if (result.isErr()) {
27
+ return Result.err(new ScaffoldError(`Failed to add block '${blockName}': ${result.error.message}`));
28
+ }
29
+ if (options.collector) {
30
+ options.collector.add({
31
+ type: "block-add",
32
+ name: blockName,
33
+ files: [...result.value.created, ...result.value.overwritten]
34
+ });
35
+ for (const [name, version] of Object.entries(result.value.dependencies)) {
36
+ options.collector.add({
37
+ type: "dependency-add",
38
+ name,
39
+ version,
40
+ section: "dependencies"
41
+ });
42
+ }
43
+ for (const [name, version] of Object.entries(result.value.devDependencies)) {
44
+ options.collector.add({
45
+ type: "dependency-add",
46
+ name,
47
+ version,
48
+ section: "devDependencies"
49
+ });
50
+ }
51
+ }
52
+ mergedResult.created.push(...result.value.created);
53
+ mergedResult.skipped.push(...result.value.skipped);
54
+ mergedResult.overwritten.push(...result.value.overwritten);
55
+ Object.assign(mergedResult.dependencies, result.value.dependencies);
56
+ Object.assign(mergedResult.devDependencies, result.value.devDependencies);
57
+ }
58
+ return Result.ok(mergedResult);
59
+ }
60
+
61
+ export { addBlocks };
@@ -0,0 +1,89 @@
1
+ // @bun
2
+ import {
3
+ applyJq
4
+ } from "./outfitter-5vx1bp7h.js";
5
+ import {
6
+ loadDocsModule
7
+ } from "./outfitter-svts4wk2.js";
8
+ import {
9
+ resolveStructuredOutputMode
10
+ } from "./outfitter-7r12fj7f.js";
11
+
12
+ // apps/outfitter/src/commands/docs-list.ts
13
+ import { resolve } from "path";
14
+ import { output } from "@outfitter/cli";
15
+ import { InternalError, Result } from "@outfitter/contracts";
16
+ import { createTheme } from "@outfitter/tui/render";
17
+ async function runDocsList(input) {
18
+ try {
19
+ const cwd = resolve(input.cwd);
20
+ const docsModule = await loadDocsModule();
21
+ const mapResult = await docsModule.generateDocsMap({ workspaceRoot: cwd });
22
+ if (mapResult.isErr()) {
23
+ return Result.err(new InternalError({
24
+ message: mapResult.error.message,
25
+ context: { action: "docs.list" }
26
+ }));
27
+ }
28
+ const rawMap = mapResult.value;
29
+ let entries = rawMap.entries.map((entry) => ({
30
+ id: entry.id,
31
+ kind: entry.kind,
32
+ title: entry.title,
33
+ sourcePath: entry.sourcePath,
34
+ outputPath: entry.outputPath,
35
+ ...entry.package !== undefined ? { package: entry.package } : {}
36
+ }));
37
+ if (input.kind) {
38
+ entries = entries.filter((entry) => entry.kind === input.kind);
39
+ }
40
+ if (input.package) {
41
+ entries = entries.filter((entry) => entry.package === input.package);
42
+ }
43
+ return Result.ok({
44
+ entries,
45
+ total: entries.length
46
+ });
47
+ } catch (error) {
48
+ return Result.err(new InternalError({
49
+ message: error instanceof Error ? error.message : "Failed to list docs",
50
+ context: { action: "docs.list" }
51
+ }));
52
+ }
53
+ }
54
+ async function printDocsListResults(result, options) {
55
+ const structuredMode = resolveStructuredOutputMode(options?.mode);
56
+ if (structuredMode) {
57
+ if (options?.jq) {
58
+ const filtered = await applyJq(result, options.jq, {
59
+ compact: structuredMode === "jsonl"
60
+ });
61
+ process.stdout.write(filtered);
62
+ } else {
63
+ await output(result, { mode: structuredMode });
64
+ }
65
+ return;
66
+ }
67
+ const theme = createTheme();
68
+ const lines = [];
69
+ if (result.total === 0) {
70
+ lines.push(theme.muted("No documentation entries found."));
71
+ await output(lines, { mode: "human" });
72
+ return;
73
+ }
74
+ lines.push("");
75
+ lines.push(`Documentation Entries (${result.total})`);
76
+ lines.push("=".repeat(60));
77
+ lines.push("");
78
+ for (const entry of result.entries) {
79
+ const pkg = entry.package ? theme.muted(` [${entry.package}]`) : "";
80
+ const kind = theme.muted(`(${entry.kind})`);
81
+ lines.push(` ${entry.id} ${kind}${pkg}`);
82
+ lines.push(` ${entry.title}`);
83
+ lines.push(` ${theme.muted(entry.sourcePath)}`);
84
+ lines.push("");
85
+ }
86
+ await output(lines, { mode: "human" });
87
+ }
88
+
89
+ export { runDocsList, printDocsListResults };
@@ -0,0 +1,91 @@
1
+ // @bun
2
+ import {
3
+ __require
4
+ } from "./outfitter-eepj7rf7.js";
5
+
6
+ // apps/outfitter/src/manifest.ts
7
+ import { join } from "path";
8
+ import {
9
+ InternalError,
10
+ Result,
11
+ ValidationError
12
+ } from "@outfitter/contracts";
13
+ import { z } from "zod";
14
+ var OUTFITTER_DIR = ".outfitter";
15
+ var MANIFEST_FILE = "manifest.json";
16
+ var BlockEntrySchema = z.object({
17
+ installedFrom: z.string(),
18
+ installedAt: z.string().datetime()
19
+ });
20
+ var ManifestSchema = z.object({
21
+ version: z.literal(1),
22
+ blocks: z.record(z.string(), BlockEntrySchema)
23
+ });
24
+ function manifestPath(cwd) {
25
+ return join(cwd, OUTFITTER_DIR, MANIFEST_FILE);
26
+ }
27
+ async function readManifest(cwd) {
28
+ const path = manifestPath(cwd);
29
+ const file = Bun.file(path);
30
+ if (!await file.exists()) {
31
+ return Result.ok(null);
32
+ }
33
+ let raw;
34
+ try {
35
+ raw = await file.text();
36
+ } catch {
37
+ return Result.err(InternalError.create("Failed to read manifest file", { path }));
38
+ }
39
+ let parsed;
40
+ try {
41
+ parsed = JSON.parse(raw);
42
+ } catch {
43
+ return Result.err(ValidationError.create("manifest", "Invalid JSON in manifest file"));
44
+ }
45
+ const validated = ManifestSchema.safeParse(parsed);
46
+ if (!validated.success) {
47
+ return Result.err(ValidationError.create("manifest", "Manifest file does not match expected schema"));
48
+ }
49
+ return Result.ok(validated.data);
50
+ }
51
+ async function writeManifest(cwd, manifest) {
52
+ const dirPath = join(cwd, OUTFITTER_DIR);
53
+ const path = join(dirPath, MANIFEST_FILE);
54
+ try {
55
+ const { mkdirSync, existsSync, statSync } = await import("fs");
56
+ if (existsSync(dirPath)) {
57
+ if (!statSync(dirPath).isDirectory()) {
58
+ return Result.err(ValidationError.create("manifest", ".outfitter exists but is not a directory"));
59
+ }
60
+ } else {
61
+ mkdirSync(dirPath, { recursive: true });
62
+ }
63
+ const content = JSON.stringify(manifest, null, "\t");
64
+ await Bun.write(path, `${content}
65
+ `);
66
+ return Result.ok(undefined);
67
+ } catch {
68
+ return Result.err(InternalError.create("Failed to write manifest file", { path }));
69
+ }
70
+ }
71
+ async function stampBlock(cwd, blockName, toolingVersion) {
72
+ const readResult = await readManifest(cwd);
73
+ if (readResult.isErr()) {
74
+ return readResult;
75
+ }
76
+ const existing = readResult.value;
77
+ const manifest = existing ?? { version: 1, blocks: {} };
78
+ const updated = {
79
+ ...manifest,
80
+ blocks: {
81
+ ...manifest.blocks,
82
+ [blockName]: {
83
+ installedFrom: toolingVersion,
84
+ installedAt: new Date().toISOString()
85
+ }
86
+ }
87
+ };
88
+ return writeManifest(cwd, updated);
89
+ }
90
+
91
+ export { BlockEntrySchema, ManifestSchema, readManifest, writeManifest, stampBlock };