outfitter 0.3.2 → 0.3.4

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-1gmrtapz.js +325 -0
  150. package/dist/shared/outfitter-1h7k8xxt.js +29 -0
  151. package/dist/shared/outfitter-1tfa9hke.d.ts +55 -0
  152. package/dist/shared/outfitter-2nx0k4b3.d.ts +4 -0
  153. package/dist/shared/outfitter-2ysjerp6.d.ts +44 -0
  154. package/dist/shared/outfitter-2z61gp5w.js +29 -0
  155. package/dist/shared/outfitter-34vg353f.d.ts +82 -0
  156. package/dist/shared/outfitter-3dq4r10s.d.ts +24 -0
  157. package/dist/shared/outfitter-3rcrvva8.js +103 -0
  158. package/dist/shared/outfitter-3tx3adgj.js +278 -0
  159. package/dist/shared/outfitter-4q1zfmvc.js +154 -0
  160. package/dist/shared/outfitter-4s9meh3j.js +221 -0
  161. package/dist/shared/outfitter-507ra35w.js +285 -0
  162. package/dist/shared/outfitter-56jq0rh2.d.ts +42 -0
  163. package/dist/shared/outfitter-58rn1sj1.d.ts +30 -0
  164. package/dist/shared/outfitter-5d9wbzhh.d.ts +19 -0
  165. package/dist/shared/outfitter-5j7zee11.d.ts +180 -0
  166. package/dist/shared/outfitter-5r6q2749.d.ts +18 -0
  167. package/dist/shared/outfitter-5vx1bp7h.js +41 -0
  168. package/dist/shared/outfitter-6ddf91vh.js +190 -0
  169. package/dist/shared/outfitter-6mpkh3zn.js +432 -0
  170. package/dist/shared/outfitter-6rtcemk7.d.ts +18 -0
  171. package/dist/shared/outfitter-6t7xeyg1.js +159 -0
  172. package/dist/shared/outfitter-738z4c37.js +262 -0
  173. package/dist/shared/outfitter-76k25svs.js +322 -0
  174. package/dist/shared/outfitter-7n7vsz95.js +101 -0
  175. package/dist/shared/outfitter-7q9fnbwa.js +60 -0
  176. package/dist/shared/outfitter-7r12fj7f.js +30 -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-dmfac1w9.js +306 -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-jwxggvz4.js +42 -0
  209. package/dist/shared/outfitter-ksyvwmb5.js +191 -0
  210. package/dist/shared/outfitter-m3ehh37q.d.ts +22 -0
  211. package/dist/shared/outfitter-mstr60zz.js +215 -0
  212. package/dist/shared/outfitter-n0ed012k.js +101 -0
  213. package/dist/shared/outfitter-n13pqaft.js +19 -0
  214. package/dist/shared/outfitter-nxvjxrmw.d.ts +48 -0
  215. package/dist/shared/outfitter-p2wn07b7.js +160 -0
  216. package/dist/shared/outfitter-px5sv5gn.js +321 -0
  217. package/dist/shared/outfitter-q1g58t85.js +8 -0
  218. package/dist/shared/outfitter-qsd5638j.js +378 -0
  219. package/dist/shared/outfitter-qsrx7m4w.js +72 -0
  220. package/dist/shared/outfitter-r2awqszh.d.ts +52 -0
  221. package/dist/shared/outfitter-rdpw2sbp.d.ts +77 -0
  222. package/dist/shared/outfitter-rp89dafm.js +109 -0
  223. package/dist/shared/outfitter-s1c0whzj.js +121 -0
  224. package/dist/shared/outfitter-ssrtakh3.js +342 -0
  225. package/dist/shared/outfitter-ssynegbs.js +167 -0
  226. package/dist/shared/outfitter-svts4wk2.js +36 -0
  227. package/dist/shared/outfitter-tavatb5p.js +166 -0
  228. package/dist/shared/outfitter-tqznjgbm.js +44 -0
  229. package/dist/shared/outfitter-ttjr95y9.js +98 -0
  230. package/dist/shared/outfitter-wcrp7d7m.d.ts +5 -0
  231. package/dist/shared/outfitter-wkt0a0ra.js +67 -0
  232. package/dist/shared/outfitter-wrcqq29p.js +132 -0
  233. package/dist/shared/outfitter-wyg1tpp5.d.ts +43 -0
  234. package/dist/shared/outfitter-x0vpb7tj.js +126 -0
  235. package/dist/shared/outfitter-x39awx8g.js +146 -0
  236. package/dist/shared/outfitter-x4cc5xsq.js +168 -0
  237. package/dist/shared/outfitter-x8w5sjnd.d.ts +39 -0
  238. package/dist/shared/outfitter-xr6g13nz.d.ts +50 -0
  239. package/dist/shared/outfitter-xs94pkfe.js +106 -0
  240. package/dist/shared/outfitter-xwzjgswj.js +488 -0
  241. package/dist/shared/outfitter-y37yfehn.d.ts +37 -0
  242. package/dist/shared/outfitter-y6ee0k45.d.ts +18 -0
  243. package/dist/shared/outfitter-ydw7x6bh.js +61 -0
  244. package/dist/shared/outfitter-yhb23pjc.js +89 -0
  245. package/dist/shared/outfitter-ypcvwg1s.js +91 -0
  246. package/dist/shared/outfitter-yywcypw8.js +53 -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,44 @@
1
+ // @bun
2
+ import {
3
+ resolvePresetDependencyVersions
4
+ } from "./outfitter-x39awx8g.js";
5
+
6
+ // apps/outfitter/src/commands/shared-deps.ts
7
+ import { getResolvedVersions } from "@outfitter/presets";
8
+ var { all: resolvedVersions } = getResolvedVersions();
9
+ function requireVersion(name) {
10
+ const version = resolvedVersions[name];
11
+ if (!version) {
12
+ throw new Error(`Missing resolved version for "${name}" in @outfitter/presets`);
13
+ }
14
+ return version;
15
+ }
16
+ function requireInternalVersion(name) {
17
+ const versions = resolvePresetDependencyVersions();
18
+ const version = versions.internal[name];
19
+ if (!version) {
20
+ throw new Error(`Missing internal version for "${name}" \u2014 not found in workspace packages or outfitter's own dependencies`);
21
+ }
22
+ return version;
23
+ }
24
+ var SHARED_DEV_DEPS = {
25
+ "@outfitter/oxlint-plugin": requireInternalVersion("@outfitter/oxlint-plugin"),
26
+ "@outfitter/tooling": requireInternalVersion("@outfitter/tooling"),
27
+ "@types/bun": requireVersion("@types/bun"),
28
+ lefthook: requireVersion("lefthook"),
29
+ oxfmt: requireVersion("oxfmt"),
30
+ oxlint: requireVersion("oxlint"),
31
+ typescript: requireVersion("typescript"),
32
+ ultracite: requireVersion("ultracite")
33
+ };
34
+ var SHARED_SCRIPTS = {
35
+ check: "ultracite check",
36
+ "clean:artifacts": "rm -rf dist .turbo",
37
+ "verify:ci": "bun run typecheck && bun run check && bun run build && bun run test",
38
+ lint: "oxlint .",
39
+ "lint:fix": "oxlint --fix .",
40
+ format: "oxfmt --write .",
41
+ typecheck: "tsc --noEmit"
42
+ };
43
+
44
+ export { SHARED_DEV_DEPS, SHARED_SCRIPTS };
@@ -0,0 +1,98 @@
1
+ // @bun
2
+ import {
3
+ resolveStructuredOutputMode
4
+ } from "./outfitter-7r12fj7f.js";
5
+
6
+ // apps/outfitter/src/engine/render-plan.ts
7
+ import { relative } from "path";
8
+ import { output } from "@outfitter/cli";
9
+ async function renderOperationPlan(collector, options) {
10
+ const structuredMode = resolveStructuredOutputMode(options?.mode);
11
+ if (structuredMode) {
12
+ await output(collector.toJSON(), { mode: structuredMode });
13
+ return;
14
+ }
15
+ const rootDir = options?.rootDir ?? process.cwd();
16
+ const operations = collector.getOperations();
17
+ const lines = ["[dry-run] Operation plan:", ""];
18
+ const fileCreates = operations.filter((op) => op.type === "file-create");
19
+ const fileOverwrites = operations.filter((op) => op.type === "file-overwrite");
20
+ const fileSkips = operations.filter((op) => op.type === "file-skip");
21
+ const dirCreates = operations.filter((op) => op.type === "dir-create");
22
+ const blockAdds = operations.filter((op) => op.type === "block-add");
23
+ const depAdds = operations.filter((op) => op.type === "dependency-add");
24
+ const configInjects = operations.filter((op) => op.type === "config-inject");
25
+ const installOps = operations.filter((op) => op.type === "install");
26
+ const gitOps = operations.filter((op) => op.type === "git");
27
+ if (fileCreates.length > 0) {
28
+ lines.push(`Create ${fileCreates.length} file(s):`);
29
+ for (const op of fileCreates) {
30
+ lines.push(` + ${relative(rootDir, op.path)}`);
31
+ }
32
+ lines.push("");
33
+ }
34
+ if (fileOverwrites.length > 0) {
35
+ lines.push(`Overwrite ${fileOverwrites.length} file(s):`);
36
+ for (const op of fileOverwrites) {
37
+ lines.push(` ~ ${relative(rootDir, op.path)}`);
38
+ }
39
+ lines.push("");
40
+ }
41
+ if (fileSkips.length > 0) {
42
+ lines.push(`Skip ${fileSkips.length} file(s):`);
43
+ for (const op of fileSkips) {
44
+ lines.push(` - ${relative(rootDir, op.path)} (${op.reason})`);
45
+ }
46
+ lines.push("");
47
+ }
48
+ if (dirCreates.length > 0) {
49
+ lines.push(`Create ${dirCreates.length} directory(ies):`);
50
+ for (const op of dirCreates) {
51
+ lines.push(` + ${relative(rootDir, op.path)}/`);
52
+ }
53
+ lines.push("");
54
+ }
55
+ if (depAdds.length > 0) {
56
+ lines.push(`Add ${depAdds.length} dependency(ies):`);
57
+ for (const dep of depAdds) {
58
+ const suffix = dep.section === "devDependencies" ? " (dev)" : "";
59
+ lines.push(` + ${dep.name}@${dep.version}${suffix}`);
60
+ }
61
+ lines.push("");
62
+ }
63
+ if (blockAdds.length > 0) {
64
+ lines.push(`Add ${blockAdds.length} block(s):`);
65
+ for (const block of blockAdds) {
66
+ lines.push(` + ${block.name}`);
67
+ }
68
+ lines.push("");
69
+ }
70
+ if (configInjects.length > 0) {
71
+ lines.push(`Config injections (${configInjects.length}):`);
72
+ for (const op of configInjects) {
73
+ lines.push(` ~ ${relative(rootDir, op.target)} (${op.description})`);
74
+ }
75
+ lines.push("");
76
+ }
77
+ if (installOps.length > 0 || gitOps.length > 0) {
78
+ lines.push("Post-scaffold:");
79
+ for (const op of installOps) {
80
+ lines.push(` $ ${op.command}`);
81
+ }
82
+ for (const op of gitOps) {
83
+ if (op.action === "init") {
84
+ lines.push(" $ git init");
85
+ } else if (op.action === "add-all") {
86
+ lines.push(" $ git add .");
87
+ } else {
88
+ lines.push(` $ git commit -m "${op.message ?? ""}"`);
89
+ }
90
+ }
91
+ lines.push("");
92
+ }
93
+ const summary = collector.countByType();
94
+ lines.push(`Total operations: ${Object.values(summary).reduce((a, b) => a + b, 0)}`);
95
+ await output(lines, { mode: "human" });
96
+ }
97
+
98
+ export { renderOperationPlan };
@@ -0,0 +1,5 @@
1
+ import { CreatePresetDefinition, CreatePresetId } from "./outfitter-htx4asgr.js";
2
+ declare const CREATE_PRESETS: Readonly<Record<CreatePresetId, CreatePresetDefinition>>;
3
+ declare const CREATE_PRESET_IDS: CreatePresetId[];
4
+ declare function getCreatePreset(id: string): CreatePresetDefinition | undefined;
5
+ export { CREATE_PRESETS, CREATE_PRESET_IDS, getCreatePreset };
@@ -0,0 +1,67 @@
1
+ // @bun
2
+ import {
3
+ outputModeSchema,
4
+ toActionInternalErrorFromUnknown
5
+ } from "./outfitter-7n7vsz95.js";
6
+ import {
7
+ runDemo
8
+ } from "./outfitter-ksyvwmb5.js";
9
+ import {
10
+ resolveOutputModeFromContext
11
+ } from "./outfitter-7r12fj7f.js";
12
+
13
+ // apps/outfitter/src/actions/demo.ts
14
+ import { defineAction, Result } from "@outfitter/contracts";
15
+ import { z } from "zod";
16
+ var demoInputSchema = z.object({
17
+ section: z.string().optional(),
18
+ list: z.boolean().optional(),
19
+ animate: z.boolean().optional(),
20
+ outputMode: outputModeSchema
21
+ });
22
+ var demoAction = defineAction({
23
+ id: "demo",
24
+ description: "Run the CLI demo app",
25
+ surfaces: ["cli"],
26
+ input: demoInputSchema,
27
+ cli: {
28
+ command: "demo [section]",
29
+ description: "Run the CLI demo app",
30
+ options: [
31
+ {
32
+ flags: "-l, --list",
33
+ description: "List available demo sections",
34
+ defaultValue: false
35
+ },
36
+ {
37
+ flags: "-a, --animate",
38
+ description: "Run animated demo (spinners only)",
39
+ defaultValue: false
40
+ }
41
+ ],
42
+ mapInput: (context) => {
43
+ const outputMode = resolveOutputModeFromContext(context.flags);
44
+ const section = context.args[0];
45
+ return {
46
+ ...section !== undefined ? { section } : {},
47
+ list: Boolean(context.flags["list"]),
48
+ animate: Boolean(context.flags["animate"]),
49
+ outputMode
50
+ };
51
+ }
52
+ },
53
+ handler: async (input) => {
54
+ const { outputMode, ...demoInput } = input;
55
+ try {
56
+ const result = await runDemo({ ...demoInput, outputMode });
57
+ if (result.exitCode !== 0) {
58
+ process.exit(result.exitCode);
59
+ }
60
+ return Result.ok(result);
61
+ } catch (error) {
62
+ return Result.err(toActionInternalErrorFromUnknown("demo", error, "Failed to run demo"));
63
+ }
64
+ }
65
+ });
66
+
67
+ export { demoAction };
@@ -0,0 +1,132 @@
1
+ // @bun
2
+ import {
3
+ SHARED_DEV_DEPS,
4
+ SHARED_SCRIPTS
5
+ } from "./outfitter-tqznjgbm.js";
6
+ import {
7
+ applyResolvedDependencyVersions,
8
+ resolvePresetDependencyVersions
9
+ } from "./outfitter-x39awx8g.js";
10
+ import {
11
+ getWorkspacePatterns
12
+ } from "./outfitter-1fy7byz5.js";
13
+ import {
14
+ ScaffoldError
15
+ } from "./outfitter-8y2dfx6n.js";
16
+
17
+ // apps/outfitter/src/engine/config.ts
18
+ import { existsSync, readdirSync, readFileSync, writeFileSync } from "fs";
19
+ import { join } from "path";
20
+ import { Result } from "@outfitter/contracts";
21
+ var DEPENDENCY_SECTIONS = [
22
+ "dependencies",
23
+ "devDependencies",
24
+ "peerDependencies",
25
+ "optionalDependencies"
26
+ ];
27
+ function getWorkspaceMemberPackageJsonPaths(rootDir, rootPackageJson) {
28
+ const patterns = getWorkspacePatterns(rootPackageJson["workspaces"]);
29
+ const packageJsonPaths = new Set;
30
+ for (const pattern of patterns) {
31
+ if (pattern.endsWith("/*")) {
32
+ const baseDir = join(rootDir, pattern.slice(0, -2));
33
+ if (!existsSync(baseDir)) {
34
+ continue;
35
+ }
36
+ for (const entry of readdirSync(baseDir, { withFileTypes: true })) {
37
+ if (!entry.isDirectory()) {
38
+ continue;
39
+ }
40
+ const packageJsonPath2 = join(baseDir, entry.name, "package.json");
41
+ if (existsSync(packageJsonPath2)) {
42
+ packageJsonPaths.add(packageJsonPath2);
43
+ }
44
+ }
45
+ continue;
46
+ }
47
+ const packageJsonPath = join(rootDir, pattern, "package.json");
48
+ if (existsSync(packageJsonPath)) {
49
+ packageJsonPaths.add(packageJsonPath);
50
+ }
51
+ }
52
+ return [...packageJsonPaths];
53
+ }
54
+ function rewriteOutfitterDepsToWorkspace(packageJson) {
55
+ let updated = false;
56
+ for (const section of DEPENDENCY_SECTIONS) {
57
+ const deps = packageJson[section];
58
+ if (!deps || typeof deps !== "object" || Array.isArray(deps)) {
59
+ continue;
60
+ }
61
+ const entries = deps;
62
+ for (const [name, version] of Object.entries(entries)) {
63
+ if (typeof version === "string" && name.startsWith("@outfitter/") && version !== "workspace:*") {
64
+ entries[name] = "workspace:*";
65
+ updated = true;
66
+ }
67
+ }
68
+ }
69
+ return updated;
70
+ }
71
+ function injectSharedConfig(targetDir) {
72
+ const packageJsonPath = join(targetDir, "package.json");
73
+ if (!existsSync(packageJsonPath)) {
74
+ return Result.ok(undefined);
75
+ }
76
+ try {
77
+ const content = readFileSync(packageJsonPath, "utf-8");
78
+ const parsed = JSON.parse(content);
79
+ const dependencyVersions = resolvePresetDependencyVersions();
80
+ applyResolvedDependencyVersions(parsed, dependencyVersions);
81
+ const existingDevDeps = parsed["devDependencies"] ?? {};
82
+ parsed["devDependencies"] = { ...SHARED_DEV_DEPS, ...existingDevDeps };
83
+ const existingScripts = parsed["scripts"] ?? {};
84
+ parsed["scripts"] = { ...SHARED_SCRIPTS, ...existingScripts };
85
+ writeFileSync(packageJsonPath, `${JSON.stringify(parsed, null, 2)}
86
+ `, "utf-8");
87
+ const workspaceMembers = getWorkspaceMemberPackageJsonPaths(targetDir, parsed);
88
+ for (const memberPackageJsonPath of workspaceMembers) {
89
+ const memberContent = readFileSync(memberPackageJsonPath, "utf-8");
90
+ const memberParsed = JSON.parse(memberContent);
91
+ const before = JSON.stringify(memberParsed);
92
+ applyResolvedDependencyVersions(memberParsed, dependencyVersions);
93
+ if (JSON.stringify(memberParsed) !== before) {
94
+ writeFileSync(memberPackageJsonPath, `${JSON.stringify(memberParsed, null, 2)}
95
+ `, "utf-8");
96
+ }
97
+ }
98
+ return Result.ok(undefined);
99
+ } catch (error) {
100
+ const message = error instanceof Error ? error.message : "Unknown error";
101
+ return Result.err(new ScaffoldError(`Failed to inject shared config: ${message}`));
102
+ }
103
+ }
104
+ function rewriteLocalDependencies(targetDir) {
105
+ const packageJsonPath = join(targetDir, "package.json");
106
+ if (!existsSync(packageJsonPath)) {
107
+ return Result.ok(undefined);
108
+ }
109
+ try {
110
+ const content = readFileSync(packageJsonPath, "utf-8");
111
+ const parsed = JSON.parse(content);
112
+ if (rewriteOutfitterDepsToWorkspace(parsed)) {
113
+ writeFileSync(packageJsonPath, `${JSON.stringify(parsed, null, 2)}
114
+ `, "utf-8");
115
+ }
116
+ const workspaceMembers = getWorkspaceMemberPackageJsonPaths(targetDir, parsed);
117
+ for (const memberPackageJsonPath of workspaceMembers) {
118
+ const memberContent = readFileSync(memberPackageJsonPath, "utf-8");
119
+ const memberParsed = JSON.parse(memberContent);
120
+ if (rewriteOutfitterDepsToWorkspace(memberParsed)) {
121
+ writeFileSync(memberPackageJsonPath, `${JSON.stringify(memberParsed, null, 2)}
122
+ `, "utf-8");
123
+ }
124
+ }
125
+ return Result.ok(undefined);
126
+ } catch (error) {
127
+ const message = error instanceof Error ? error.message : "Unknown error";
128
+ return Result.err(new ScaffoldError(`Failed to update local dependencies: ${message}`));
129
+ }
130
+ }
131
+
132
+ export { injectSharedConfig, rewriteLocalDependencies };
@@ -0,0 +1,43 @@
1
+ import { CliOutputMode } from "./outfitter-a79xrm12.js";
2
+ import { InternalError, NotFoundError, Result } from "@outfitter/contracts";
3
+ /** Validated input for the docs.show action handler. */
4
+ interface DocsShowInput {
5
+ readonly cwd: string;
6
+ readonly id: string;
7
+ readonly jq?: string | undefined;
8
+ readonly outputMode: CliOutputMode;
9
+ }
10
+ /** Output shape for the docs.show action. */
11
+ interface DocsShowOutput {
12
+ readonly content: string;
13
+ readonly entry: {
14
+ readonly id: string;
15
+ readonly kind: string;
16
+ readonly outputPath: string;
17
+ readonly package?: string;
18
+ readonly sourcePath: string;
19
+ readonly tags: string[];
20
+ readonly title: string;
21
+ };
22
+ }
23
+ /**
24
+ * Show a specific documentation entry and its file content.
25
+ *
26
+ * Generates the docs map for the workspace, looks up the entry by ID,
27
+ * and reads the source file content.
28
+ *
29
+ * @param input - Validated action input
30
+ * @returns Result containing the entry metadata and content, or an error
31
+ */
32
+ declare function runDocsShow(input: DocsShowInput): Promise<Result<DocsShowOutput, InternalError | NotFoundError>>;
33
+ /**
34
+ * Print docs show results in the appropriate output format.
35
+ *
36
+ * @param result - The docs show output
37
+ * @param options - Output formatting options
38
+ */
39
+ declare function printDocsShowResults(result: DocsShowOutput, options?: {
40
+ mode?: CliOutputMode;
41
+ jq?: string | undefined;
42
+ }): Promise<void>;
43
+ export { DocsShowInput, DocsShowOutput, runDocsShow, printDocsShowResults };
@@ -0,0 +1,126 @@
1
+ // @bun
2
+ import {
3
+ readMigrationDocsWithMetadata
4
+ } from "./outfitter-fx1m251y.js";
5
+
6
+ // apps/outfitter/src/commands/upgrade-codemods.ts
7
+ import { existsSync } from "fs";
8
+ import { isAbsolute, join, relative, resolve } from "path";
9
+ import { InternalError, Result } from "@outfitter/contracts";
10
+ var CODEMOD_PATHS = ["plugins/outfitter/shared/codemods"];
11
+ function findCodemodsDir(cwd, binaryDir) {
12
+ for (const relativePath of CODEMOD_PATHS) {
13
+ const dir = join(cwd, relativePath);
14
+ if (existsSync(dir))
15
+ return dir;
16
+ }
17
+ let current = resolve(cwd);
18
+ const root = resolve("/");
19
+ while (current !== root) {
20
+ const parent = resolve(current, "..");
21
+ if (parent === current)
22
+ break;
23
+ current = parent;
24
+ for (const relativePath of CODEMOD_PATHS) {
25
+ const dir = join(current, relativePath);
26
+ if (existsSync(dir))
27
+ return dir;
28
+ }
29
+ }
30
+ const resolvedBinaryDir = binaryDir ?? resolve(import.meta.dir, "../../../..");
31
+ for (const relativePath of CODEMOD_PATHS) {
32
+ const dir = join(resolvedBinaryDir, relativePath);
33
+ if (existsSync(dir))
34
+ return dir;
35
+ }
36
+ return null;
37
+ }
38
+ function discoverCodemods(migrationsDir, codemodsDir, shortName, fromVersion, toVersion) {
39
+ const resolvedCodemodsDir = resolve(codemodsDir);
40
+ const docs = (() => {
41
+ try {
42
+ return readMigrationDocsWithMetadata(migrationsDir, shortName, fromVersion, toVersion);
43
+ } catch {
44
+ return [];
45
+ }
46
+ })();
47
+ const seen = new Set;
48
+ const codemods = [];
49
+ for (const doc of docs) {
50
+ if (!doc.frontmatter.changes)
51
+ continue;
52
+ for (const change of doc.frontmatter.changes) {
53
+ if (!change.codemod)
54
+ continue;
55
+ if (seen.has(change.codemod))
56
+ continue;
57
+ seen.add(change.codemod);
58
+ const absolutePath = resolveCodemodPath(resolvedCodemodsDir, change.codemod);
59
+ if (absolutePath === null)
60
+ continue;
61
+ if (!existsSync(absolutePath))
62
+ continue;
63
+ codemods.push({
64
+ relativePath: change.codemod,
65
+ absolutePath
66
+ });
67
+ }
68
+ }
69
+ return codemods;
70
+ }
71
+ function resolveCodemodPath(codemodsDir, relativePath) {
72
+ if (relativePath.trim().length === 0) {
73
+ return null;
74
+ }
75
+ if (isAbsolute(relativePath)) {
76
+ return null;
77
+ }
78
+ const resolvedPath = resolve(codemodsDir, relativePath);
79
+ const relPath = relative(codemodsDir, resolvedPath);
80
+ if (relPath === "" || relPath.startsWith("..") || isAbsolute(relPath)) {
81
+ return null;
82
+ }
83
+ return resolvedPath;
84
+ }
85
+ async function runCodemod(codemodPath, targetDir, dryRun) {
86
+ let mod;
87
+ try {
88
+ mod = await import(codemodPath);
89
+ } catch (error) {
90
+ return Result.err(InternalError.create("Failed to load codemod", {
91
+ codemodPath,
92
+ error: error instanceof Error ? error.message : String(error)
93
+ }));
94
+ }
95
+ if (typeof mod["transform"] !== "function") {
96
+ return Result.err(InternalError.create(`Codemod has no transform export: ${codemodPath}`, {
97
+ codemodPath
98
+ }));
99
+ }
100
+ const transform = mod["transform"];
101
+ try {
102
+ const result = await transform({ targetDir, dryRun });
103
+ if (!isCodemodResult(result)) {
104
+ return Result.err(InternalError.create("Codemod returned invalid result shape", {
105
+ codemodPath
106
+ }));
107
+ }
108
+ return Result.ok(result);
109
+ } catch (error) {
110
+ return Result.err(InternalError.create("Codemod execution failed", {
111
+ codemodPath,
112
+ error: error instanceof Error ? error.message : String(error)
113
+ }));
114
+ }
115
+ }
116
+ function isCodemodResult(value) {
117
+ if (typeof value !== "object" || value === null)
118
+ return false;
119
+ const candidate = value;
120
+ return isStringArray(candidate["changedFiles"]) && isStringArray(candidate["skippedFiles"]) && isStringArray(candidate["errors"]);
121
+ }
122
+ function isStringArray(value) {
123
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
124
+ }
125
+
126
+ export { findCodemodsDir, discoverCodemods, runCodemod };
@@ -0,0 +1,146 @@
1
+ // @bun
2
+ // apps/outfitter/src/engine/dependency-versions.ts
3
+ import { existsSync, readdirSync, readFileSync } from "fs";
4
+ import { dirname, join, resolve } from "path";
5
+ import { fileURLToPath } from "url";
6
+ import { getResolvedVersions } from "@outfitter/presets";
7
+ var DEPENDENCY_SECTIONS = [
8
+ "dependencies",
9
+ "devDependencies",
10
+ "peerDependencies",
11
+ "optionalDependencies"
12
+ ];
13
+ var cachedResolvedVersions;
14
+ function clearResolvedVersionsCache() {
15
+ cachedResolvedVersions = undefined;
16
+ }
17
+ function readJsonFile(path) {
18
+ return JSON.parse(readFileSync(path, "utf-8"));
19
+ }
20
+ function isRecord(value) {
21
+ return typeof value === "object" && value !== null && !Array.isArray(value);
22
+ }
23
+ function normalizeRange(value) {
24
+ const trimmed = value.trim();
25
+ if (trimmed.length === 0 || trimmed === "workspace:*") {
26
+ return;
27
+ }
28
+ if (/^\d+\.\d+\.\d+(?:[-+].+)?$/.test(trimmed)) {
29
+ return `^${trimmed}`;
30
+ }
31
+ return trimmed;
32
+ }
33
+ function findOutfitterPackageRoot() {
34
+ let currentDir = dirname(fileURLToPath(import.meta.url));
35
+ for (let i = 0;i < 10; i += 1) {
36
+ const packageJsonPath = join(currentDir, "package.json");
37
+ if (existsSync(packageJsonPath)) {
38
+ try {
39
+ const parsed = readJsonFile(packageJsonPath);
40
+ if (isRecord(parsed) && typeof parsed["name"] === "string" && parsed["name"] === "outfitter") {
41
+ return currentDir;
42
+ }
43
+ } catch {}
44
+ }
45
+ currentDir = dirname(currentDir);
46
+ }
47
+ throw new Error(`Unable to find outfitter package root (walked 10 levels up from ${dirname(fileURLToPath(import.meta.url))}). ` + "Ensure this module is running from within the outfitter package tree.");
48
+ }
49
+ function collectOutfitterDepsFromPackageJson(packageJson) {
50
+ const collected = {};
51
+ for (const section of DEPENDENCY_SECTIONS) {
52
+ const sectionValue = packageJson[section];
53
+ if (!isRecord(sectionValue)) {
54
+ continue;
55
+ }
56
+ for (const [name, value] of Object.entries(sectionValue)) {
57
+ if (typeof value !== "string" || !name.startsWith("@outfitter/")) {
58
+ continue;
59
+ }
60
+ const normalized = normalizeRange(value);
61
+ if (normalized) {
62
+ collected[name] = normalized;
63
+ }
64
+ }
65
+ }
66
+ return collected;
67
+ }
68
+ function collectWorkspacePackageRanges(packageRoot) {
69
+ const repoRoot = resolve(packageRoot, "..", "..");
70
+ const expectedPackageRoot = join(repoRoot, "apps", "outfitter");
71
+ if (resolve(expectedPackageRoot) !== resolve(packageRoot)) {
72
+ return {};
73
+ }
74
+ const packagesDir = join(repoRoot, "packages");
75
+ if (!existsSync(packagesDir)) {
76
+ return {};
77
+ }
78
+ const collected = {};
79
+ for (const entry of readdirSync(packagesDir)) {
80
+ const packageJsonPath = join(packagesDir, entry, "package.json");
81
+ if (!existsSync(packageJsonPath)) {
82
+ continue;
83
+ }
84
+ try {
85
+ const parsed = readJsonFile(packageJsonPath);
86
+ if (!isRecord(parsed)) {
87
+ continue;
88
+ }
89
+ const name = parsed["name"];
90
+ const version = parsed["version"];
91
+ if (typeof name === "string" && typeof version === "string" && name.startsWith("@outfitter/")) {
92
+ const normalized = normalizeRange(version);
93
+ if (normalized) {
94
+ collected[name] = normalized;
95
+ }
96
+ }
97
+ } catch {}
98
+ }
99
+ return collected;
100
+ }
101
+ function resolvePresetDependencyVersions() {
102
+ if (cachedResolvedVersions) {
103
+ return cachedResolvedVersions;
104
+ }
105
+ const { all: presetsVersions } = getResolvedVersions();
106
+ const packageRoot = findOutfitterPackageRoot();
107
+ const packageJsonPath = join(packageRoot, "package.json");
108
+ const raw = existsSync(packageJsonPath) ? readJsonFile(packageJsonPath) : undefined;
109
+ const fromOutfitterPackage = raw !== undefined && isRecord(raw) ? collectOutfitterDepsFromPackageJson(raw) : {};
110
+ const fromWorkspacePackages = collectWorkspacePackageRanges(packageRoot);
111
+ const internal = {
112
+ ...fromOutfitterPackage,
113
+ ...fromWorkspacePackages
114
+ };
115
+ cachedResolvedVersions = {
116
+ internal,
117
+ external: { ...presetsVersions }
118
+ };
119
+ return cachedResolvedVersions;
120
+ }
121
+ function applyResolvedDependencyVersions(parsedPackageJson, versions) {
122
+ for (const section of DEPENDENCY_SECTIONS) {
123
+ const sectionValue = parsedPackageJson[section];
124
+ if (!isRecord(sectionValue)) {
125
+ continue;
126
+ }
127
+ for (const [name, value] of Object.entries(sectionValue)) {
128
+ if (typeof value !== "string") {
129
+ continue;
130
+ }
131
+ if (name.startsWith("@outfitter/")) {
132
+ const resolvedInternal = versions.internal[name];
133
+ if (resolvedInternal) {
134
+ sectionValue[name] = resolvedInternal;
135
+ }
136
+ continue;
137
+ }
138
+ const resolvedExternal = versions.external[name];
139
+ if (resolvedExternal) {
140
+ sectionValue[name] = resolvedExternal;
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ export { clearResolvedVersionsCache, resolvePresetDependencyVersions, applyResolvedDependencyVersions };