outfitter 0.2.7 → 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 (312) hide show
  1. package/README.md +34 -7
  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 +1 -1
  25. package/dist/actions.js +53 -22
  26. package/dist/cli.js +66 -4
  27. package/dist/commands/add.js +3 -3
  28. package/dist/commands/check-action-ceremony.d.ts +55 -0
  29. package/dist/commands/check-action-ceremony.js +15 -0
  30. package/dist/commands/check-docs-sentinel.d.ts +27 -0
  31. package/dist/commands/check-docs-sentinel.js +18 -0
  32. package/dist/commands/check-orchestrator.d.ts +2 -0
  33. package/dist/commands/check-orchestrator.js +17 -0
  34. package/dist/commands/check-preset-versions.d.ts +20 -0
  35. package/dist/commands/check-preset-versions.js +15 -0
  36. package/dist/commands/check-publish-guardrails.d.ts +38 -0
  37. package/dist/commands/check-publish-guardrails.js +19 -0
  38. package/dist/commands/check-surface-map-format.d.ts +29 -0
  39. package/dist/commands/check-surface-map-format.js +19 -0
  40. package/dist/commands/check-surface-map.d.ts +20 -0
  41. package/dist/commands/check-surface-map.js +15 -0
  42. package/dist/commands/check-tsdoc.d.ts +2 -21
  43. package/dist/commands/check-tsdoc.js +3 -2
  44. package/dist/commands/check.d.ts +2 -0
  45. package/dist/commands/check.js +3 -3
  46. package/dist/commands/demo.js +1 -1
  47. package/dist/commands/docs-api.d.ts +4 -0
  48. package/dist/commands/docs-api.js +13 -0
  49. package/dist/commands/docs-export.d.ts +4 -0
  50. package/dist/commands/docs-export.js +12 -0
  51. package/dist/commands/docs-list.d.ts +3 -0
  52. package/dist/commands/docs-list.js +13 -0
  53. package/dist/commands/docs-module-loader.d.ts +2 -2
  54. package/dist/commands/docs-module-loader.js +2 -2
  55. package/dist/commands/docs-search.d.ts +3 -0
  56. package/dist/commands/docs-search.js +13 -0
  57. package/dist/commands/docs-show.d.ts +3 -0
  58. package/dist/commands/docs-show.js +13 -0
  59. package/dist/commands/docs-types.d.ts +21 -0
  60. package/dist/commands/doctor.js +4 -12
  61. package/dist/commands/init-execution.d.ts +8 -0
  62. package/dist/commands/init-execution.js +11 -0
  63. package/dist/commands/init-option-resolution.d.ts +5 -0
  64. package/dist/commands/init-option-resolution.js +14 -0
  65. package/dist/commands/init-output.d.ts +9 -0
  66. package/dist/commands/init-output.js +11 -0
  67. package/dist/commands/init.d.ts +7 -5
  68. package/dist/commands/init.js +10 -18
  69. package/dist/commands/jq-utils.d.ts +17 -0
  70. package/dist/commands/jq-utils.js +8 -0
  71. package/dist/commands/repo.d.ts +3 -3
  72. package/dist/commands/repo.js +8 -4
  73. package/dist/commands/scaffold-output.d.ts +4 -0
  74. package/dist/commands/scaffold-output.js +11 -0
  75. package/dist/commands/scaffold-planning.d.ts +65 -0
  76. package/dist/commands/scaffold-planning.js +20 -0
  77. package/dist/commands/scaffold.d.ts +3 -3
  78. package/dist/commands/scaffold.js +10 -16
  79. package/dist/commands/shared-deps.d.ts +5 -4
  80. package/dist/commands/shared-deps.js +3 -3
  81. package/dist/commands/upgrade-apply.d.ts +14 -0
  82. package/dist/commands/upgrade-apply.js +8 -0
  83. package/dist/commands/upgrade-codemods.d.ts +5 -0
  84. package/dist/commands/upgrade-codemods.js +4 -5
  85. package/dist/commands/upgrade-latest-version.d.ts +8 -0
  86. package/dist/commands/upgrade-latest-version.js +8 -0
  87. package/dist/commands/upgrade-migration-docs.d.ts +3 -0
  88. package/dist/commands/upgrade-migration-docs.js +15 -0
  89. package/dist/commands/upgrade-migration-frontmatter.d.ts +2 -0
  90. package/dist/commands/upgrade-migration-frontmatter.js +10 -0
  91. package/dist/commands/upgrade-migration-guides.d.ts +5 -0
  92. package/dist/commands/upgrade-migration-guides.js +10 -0
  93. package/dist/commands/upgrade-output.d.ts +5 -0
  94. package/dist/commands/upgrade-output.js +11 -0
  95. package/dist/commands/upgrade-planner.js +1 -1
  96. package/dist/commands/upgrade-report.d.ts +5 -0
  97. package/dist/commands/upgrade-report.js +8 -0
  98. package/dist/commands/upgrade-workspace.js +2 -2
  99. package/dist/commands/upgrade.d.ts +4 -220
  100. package/dist/commands/upgrade.js +21 -9
  101. package/dist/create/index.d.ts +3 -3
  102. package/dist/create/index.js +2 -30
  103. package/dist/create/planner.d.ts +2 -2
  104. package/dist/create/planner.js +80 -17
  105. package/dist/create/presets.d.ts +2 -2
  106. package/dist/create/presets.js +2 -2
  107. package/dist/create/types.d.ts +1 -1
  108. package/dist/engine/blocks.d.ts +2 -2
  109. package/dist/engine/blocks.js +5 -5
  110. package/dist/engine/collector.d.ts +1 -1
  111. package/dist/engine/collector.js +1 -1
  112. package/dist/engine/config.d.ts +2 -2
  113. package/dist/engine/config.js +4 -4
  114. package/dist/engine/dependency-versions.d.ts +13 -8
  115. package/dist/engine/dependency-versions.js +4 -4
  116. package/dist/engine/executor.d.ts +2 -2
  117. package/dist/engine/executor.js +149 -12
  118. package/dist/engine/index.d.ts +9 -7
  119. package/dist/engine/index.js +17 -31
  120. package/dist/engine/names.js +1 -1
  121. package/dist/engine/post-scaffold.d.ts +2 -2
  122. package/dist/engine/post-scaffold.js +1 -1
  123. package/dist/engine/preset.d.ts +3 -0
  124. package/dist/engine/preset.js +17 -0
  125. package/dist/engine/render-plan.d.ts +1 -1
  126. package/dist/engine/render-plan.js +1 -1
  127. package/dist/engine/template.d.ts +3 -2
  128. package/dist/engine/template.js +24 -7
  129. package/dist/engine/types.d.ts +1 -1
  130. package/dist/engine/types.js +1 -1
  131. package/dist/engine/workspace.d.ts +2 -2
  132. package/dist/engine/workspace.js +1 -1
  133. package/dist/index.d.ts +17 -398
  134. package/dist/index.js +7 -164
  135. package/dist/manifest.js +2 -2
  136. package/dist/output-mode.js +1 -1
  137. package/dist/shared/{outfitter-6fgk6adm.d.ts → outfitter-1tfa9hke.d.ts} +16 -1
  138. package/dist/shared/{outfitter-6bkqjk86.d.ts → outfitter-2nx0k4b3.d.ts} +1 -0
  139. package/dist/shared/outfitter-2ysjerp6.d.ts +44 -0
  140. package/dist/shared/outfitter-2z61gp5w.js +29 -0
  141. package/dist/shared/outfitter-34vg353f.d.ts +82 -0
  142. package/dist/shared/{outfitter-5yjr404v.d.ts → outfitter-3dq4r10s.d.ts} +5 -3
  143. package/dist/shared/outfitter-3rcrvva8.js +103 -0
  144. package/dist/shared/{outfitter-79vfxt6y.js → outfitter-3tx3adgj.js} +12 -3
  145. package/dist/shared/{outfitter-63gse8fv.js → outfitter-507ra35w.js} +33 -64
  146. package/dist/shared/outfitter-56jq0rh2.d.ts +42 -0
  147. package/dist/shared/{outfitter-r419zfgs.d.ts → outfitter-58rn1sj1.d.ts} +1 -1
  148. package/dist/shared/outfitter-5d9wbzhh.d.ts +19 -0
  149. package/dist/shared/outfitter-5j7zee11.d.ts +180 -0
  150. package/dist/shared/{outfitter-s7jetkge.d.ts → outfitter-5r6q2749.d.ts} +1 -1
  151. package/dist/shared/outfitter-5vx1bp7h.js +41 -0
  152. package/dist/shared/outfitter-6ddf91vh.js +190 -0
  153. package/dist/shared/{outfitter-mt7d1ek2.js → outfitter-6mpkh3zn.js} +39 -305
  154. package/dist/shared/{outfitter-ybbazsxq.d.ts → outfitter-6rtcemk7.d.ts} +8 -4
  155. package/dist/shared/{outfitter-9x1brcmq.js → outfitter-6t7xeyg1.js} +13 -38
  156. package/dist/shared/outfitter-738z4c37.js +262 -0
  157. package/dist/shared/{outfitter-yvksv5qb.js → outfitter-76k25svs.js} +4 -4
  158. package/dist/shared/outfitter-7n7vsz95.js +101 -0
  159. package/dist/shared/outfitter-7q9fnbwa.js +60 -0
  160. package/dist/shared/outfitter-84chvazx.js +480 -0
  161. package/dist/shared/outfitter-8ggmja91.js +301 -0
  162. package/dist/shared/{outfitter-qakwgrrh.d.ts → outfitter-8kmak0wc.d.ts} +1 -1
  163. package/dist/shared/outfitter-940h0x7b.js +71 -0
  164. package/dist/shared/{outfitter-fn20r49x.d.ts → outfitter-954y4mzx.d.ts} +1 -1
  165. package/dist/shared/outfitter-b9cpnr7e.js +110 -0
  166. package/dist/shared/outfitter-c7sbs7es.js +92 -0
  167. package/dist/shared/outfitter-cyhzstz0.js +93 -0
  168. package/dist/shared/{outfitter-n9g1zk4x.d.ts → outfitter-cyvr4r8d.d.ts} +3 -2
  169. package/dist/shared/outfitter-d0kqashd.d.ts +98 -0
  170. package/dist/shared/outfitter-dx4hn4ta.js +325 -0
  171. package/dist/shared/{outfitter-bn9c8p2e.js → outfitter-e84cr97g.js} +37 -9
  172. package/dist/shared/outfitter-ec83h4v2.js +17 -0
  173. package/dist/shared/{outfitter-vh4xgb93.js → outfitter-ekb6t1zz.js} +4 -4
  174. package/dist/shared/outfitter-ex8gn945.js +51 -0
  175. package/dist/shared/outfitter-f3a70135.js +75 -0
  176. package/dist/shared/outfitter-fbvfd5zq.d.ts +13 -0
  177. package/dist/shared/outfitter-fj2v5ffz.js +165 -0
  178. package/dist/shared/outfitter-fx1m251y.js +122 -0
  179. package/dist/shared/outfitter-fxry5n58.js +254 -0
  180. package/dist/shared/outfitter-g3hvjshg.js +1 -0
  181. package/dist/shared/{outfitter-f9znfhkn.d.ts → outfitter-gdc7b7de.d.ts} +1 -1
  182. package/dist/shared/outfitter-gyayfx5r.js +156 -0
  183. package/dist/shared/outfitter-h0wmtxw8.d.ts +23 -0
  184. package/dist/shared/{outfitter-z5sx06qe.d.ts → outfitter-hcexcvxe.d.ts} +1 -1
  185. package/dist/shared/outfitter-hf5bj2gq.js +117 -0
  186. package/dist/shared/{outfitter-e9rrfekb.d.ts → outfitter-htx4asgr.d.ts} +4 -3
  187. package/dist/shared/outfitter-jkct38dh.js +53 -0
  188. package/dist/shared/outfitter-jwxggvz4.js +42 -0
  189. package/dist/shared/outfitter-k6zyvg2n.js +306 -0
  190. package/dist/shared/outfitter-mstr60zz.js +215 -0
  191. package/dist/shared/outfitter-n0ed012k.js +101 -0
  192. package/dist/shared/outfitter-n13pqaft.js +19 -0
  193. package/dist/shared/outfitter-nxvjxrmw.d.ts +48 -0
  194. package/dist/shared/outfitter-p2wn07b7.js +160 -0
  195. package/dist/shared/{outfitter-5y646xzk.js → outfitter-px5sv5gn.js} +29 -9
  196. package/dist/shared/outfitter-q1g58t85.js +8 -0
  197. package/dist/shared/{outfitter-pj9vp00r.js → outfitter-qsd5638j.js} +26 -249
  198. package/dist/shared/outfitter-qsrx7m4w.js +72 -0
  199. package/dist/shared/outfitter-r2awqszh.d.ts +52 -0
  200. package/dist/shared/outfitter-rdpw2sbp.d.ts +77 -0
  201. package/dist/shared/outfitter-rp89dafm.js +109 -0
  202. package/dist/shared/outfitter-s1c0whzj.js +121 -0
  203. package/dist/shared/{outfitter-w1j80j1r.js → outfitter-ssrtakh3.js} +21 -5
  204. package/dist/shared/outfitter-ssynegbs.js +167 -0
  205. package/dist/shared/{outfitter-zwyvewr1.js → outfitter-svts4wk2.js} +1 -1
  206. package/dist/shared/outfitter-tavatb5p.js +166 -0
  207. package/dist/shared/outfitter-tqznjgbm.js +44 -0
  208. package/dist/shared/{outfitter-yraebrmw.d.ts → outfitter-wcrp7d7m.d.ts} +1 -1
  209. package/dist/shared/outfitter-wkt0a0ra.js +67 -0
  210. package/dist/shared/{outfitter-ha89qf8q.js → outfitter-wrcqq29p.js} +4 -4
  211. package/dist/shared/outfitter-wyg1tpp5.d.ts +43 -0
  212. package/dist/shared/outfitter-x0vpb7tj.js +126 -0
  213. package/dist/shared/{outfitter-m44n0qzw.js → outfitter-x39awx8g.js} +11 -26
  214. package/dist/shared/outfitter-x4cc5xsq.js +168 -0
  215. package/dist/shared/outfitter-x8w5sjnd.d.ts +39 -0
  216. package/dist/shared/{outfitter-amc4jbs1.d.ts → outfitter-xr6g13nz.d.ts} +2 -2
  217. package/dist/shared/outfitter-xs94pkfe.js +106 -0
  218. package/dist/shared/outfitter-y37yfehn.d.ts +37 -0
  219. package/dist/shared/{outfitter-fhnjpjwc.d.ts → outfitter-y6ee0k45.d.ts} +1 -1
  220. package/dist/shared/{outfitter-j833sxws.js → outfitter-ydw7x6bh.js} +1 -1
  221. package/dist/shared/outfitter-yhb23pjc.js +89 -0
  222. package/dist/shared/{outfitter-mtbpabf3.js → outfitter-ypcvwg1s.js} +1 -1
  223. package/dist/shared/outfitter-znbqe5zy.d.ts +45 -0
  224. package/dist/shared/{outfitter-dpj9erew.d.ts → outfitter-zng6w0t9.d.ts} +1 -1
  225. package/dist/targets/index.d.ts +2 -2
  226. package/dist/targets/index.js +2 -3
  227. package/dist/targets/registry.d.ts +2 -2
  228. package/dist/targets/registry.js +207 -14
  229. package/dist/targets/types.d.ts +1 -1
  230. package/package.json +203 -40
  231. package/dist/shared/chunk-x6644tk8.js +0 -6491
  232. package/dist/shared/outfitter-20f6a2n4.js +0 -35
  233. package/dist/shared/outfitter-5akzvppx.js +0 -125
  234. package/dist/shared/outfitter-7ch26yq8.js +0 -885
  235. package/dist/shared/outfitter-ehp18x1n.js +0 -1
  236. package/dist/shared/outfitter-h3q6ae6d.d.ts +0 -48
  237. package/dist/shared/outfitter-hvsaxgcp.js +0 -1
  238. package/dist/shared/outfitter-p71qb0f0.js +0 -82
  239. package/dist/shared/outfitter-pcj9gg2g.js +0 -909
  240. package/dist/shared/outfitter-xe5mzgdc.js +0 -208
  241. package/dist/shared/outfitter-z0we32cp.d.ts +0 -63
  242. package/template-versions.json +0 -22
  243. package/templates/.gitkeep +0 -0
  244. package/templates/basic/.gitignore.template +0 -30
  245. package/templates/basic/.lefthook.yml.template +0 -26
  246. package/templates/basic/package.json.template +0 -46
  247. package/templates/basic/src/index.ts.template +0 -26
  248. package/templates/basic/tsconfig.json.template +0 -34
  249. package/templates/cli/.gitignore.template +0 -4
  250. package/templates/cli/.lefthook.yml.template +0 -26
  251. package/templates/cli/README.md.template +0 -35
  252. package/templates/cli/biome.json.template +0 -4
  253. package/templates/cli/package.json.template +0 -53
  254. package/templates/cli/src/cli.ts.template +0 -8
  255. package/templates/cli/src/index.ts.template +0 -7
  256. package/templates/cli/src/program.ts.template +0 -31
  257. package/templates/cli/tsconfig.json.template +0 -34
  258. package/templates/daemon/.gitignore.template +0 -4
  259. package/templates/daemon/.lefthook.yml.template +0 -26
  260. package/templates/daemon/README.md.template +0 -67
  261. package/templates/daemon/biome.json.template +0 -4
  262. package/templates/daemon/package.json.template +0 -56
  263. package/templates/daemon/src/cli.ts.template +0 -96
  264. package/templates/daemon/src/daemon-main.ts.template +0 -79
  265. package/templates/daemon/src/daemon.ts.template +0 -11
  266. package/templates/daemon/src/index.ts.template +0 -7
  267. package/templates/daemon/tsconfig.json.template +0 -23
  268. package/templates/full-stack/.gitignore.template +0 -30
  269. package/templates/full-stack/README.md.template +0 -30
  270. package/templates/full-stack/apps/cli/package.json.template +0 -39
  271. package/templates/full-stack/apps/cli/src/cli.ts.template +0 -24
  272. package/templates/full-stack/apps/cli/src/index.test.ts.template +0 -18
  273. package/templates/full-stack/apps/cli/src/index.ts.template +0 -5
  274. package/templates/full-stack/apps/cli/tsconfig.json.template +0 -37
  275. package/templates/full-stack/apps/mcp/package.json.template +0 -40
  276. package/templates/full-stack/apps/mcp/src/index.test.ts.template +0 -18
  277. package/templates/full-stack/apps/mcp/src/index.ts.template +0 -6
  278. package/templates/full-stack/apps/mcp/src/mcp.ts.template +0 -22
  279. package/templates/full-stack/apps/mcp/src/server.ts.template +0 -10
  280. package/templates/full-stack/apps/mcp/tsconfig.json.template +0 -37
  281. package/templates/full-stack/package.json.template +0 -16
  282. package/templates/full-stack/packages/core/package.json.template +0 -36
  283. package/templates/full-stack/packages/core/src/handlers.ts.template +0 -31
  284. package/templates/full-stack/packages/core/src/index.test.ts.template +0 -30
  285. package/templates/full-stack/packages/core/src/index.ts.template +0 -8
  286. package/templates/full-stack/packages/core/src/types.ts.template +0 -13
  287. package/templates/full-stack/packages/core/tsconfig.json.template +0 -34
  288. package/templates/library/.gitignore.template +0 -30
  289. package/templates/library/README.md.template +0 -29
  290. package/templates/library/bunup.config.ts.template +0 -20
  291. package/templates/library/package.json.template +0 -55
  292. package/templates/library/src/handlers.ts.template +0 -31
  293. package/templates/library/src/index.test.ts.template +0 -35
  294. package/templates/library/src/index.ts.template +0 -8
  295. package/templates/library/src/types.ts.template +0 -13
  296. package/templates/library/tsconfig.json.template +0 -34
  297. package/templates/mcp/.gitignore.template +0 -4
  298. package/templates/mcp/.lefthook.yml.template +0 -26
  299. package/templates/mcp/README.md.template +0 -54
  300. package/templates/mcp/biome.json.template +0 -4
  301. package/templates/mcp/package.json.template +0 -53
  302. package/templates/mcp/src/index.ts.template +0 -7
  303. package/templates/mcp/src/mcp.ts.template +0 -33
  304. package/templates/mcp/src/server.ts.template +0 -8
  305. package/templates/mcp/tsconfig.json.template +0 -23
  306. package/templates/minimal/.gitignore.template +0 -30
  307. package/templates/minimal/.lefthook.yml.template +0 -26
  308. package/templates/minimal/package.json.template +0 -53
  309. package/templates/minimal/src/index.ts.template +0 -26
  310. package/templates/minimal/tsconfig.json.template +0 -34
  311. /package/dist/{shared/outfitter-344t1r38.js → commands/docs-types.js} +0 -0
  312. /package/dist/shared/{outfitter-mdt37hqm.js → outfitter-eepj7rf7.js} +0 -0
@@ -0,0 +1,480 @@
1
+ // @bun
2
+ import {
3
+ resolveStructuredOutputMode
4
+ } from "./outfitter-7r12fj7f.js";
5
+
6
+ // apps/outfitter/src/commands/check-orchestrator.ts
7
+ import { resolve } from "path";
8
+ import { Result } from "@outfitter/contracts";
9
+ import { createTheme } from "@outfitter/tui/render";
10
+ var SUCCESS_ADVISORY_PATTERNS = [
11
+ /\bwarn(?:ing)?\b/i,
12
+ /\bno changeset found\b/i,
13
+ /\bconsider adding one\b/i,
14
+ /\binvalid changeset package reference\b/i
15
+ ];
16
+
17
+ class CheckOrchestratorError extends Error {
18
+ _tag = "CheckOrchestratorError";
19
+ constructor(message) {
20
+ super(message);
21
+ this.name = "CheckOrchestratorError";
22
+ }
23
+ }
24
+ function normalizePaths(paths) {
25
+ if (!paths || paths.length === 0) {
26
+ return [];
27
+ }
28
+ return paths.map((path) => path.trim()).filter((path) => path.length > 0).toSorted();
29
+ }
30
+ function shouldSyncAgentScaffolding(paths) {
31
+ return paths.some((path) => path === ".claude/settings.json" || path.startsWith(".claude/hooks/"));
32
+ }
33
+ function buildCheckOrchestratorPlan(options) {
34
+ const stagedFiles = normalizePaths(options.stagedFiles);
35
+ if (options.mode === "all" || options.mode === "ci") {
36
+ const steps = [
37
+ {
38
+ id: "block-drift",
39
+ label: "Block drift",
40
+ command: [
41
+ "bun",
42
+ "run",
43
+ "apps/outfitter/src/cli.ts",
44
+ "check",
45
+ "--manifest-only",
46
+ "--cwd",
47
+ "."
48
+ ]
49
+ },
50
+ {
51
+ id: "typecheck",
52
+ label: "Typecheck",
53
+ command: ["bun", "run", "typecheck", "--", "--only"]
54
+ },
55
+ {
56
+ id: "lint-and-format",
57
+ label: "Lint/Format checks",
58
+ command: ["bun", "run", "check"]
59
+ },
60
+ {
61
+ id: "publish-guardrails",
62
+ label: "Publish guardrails",
63
+ command: [
64
+ "bun",
65
+ "run",
66
+ "apps/outfitter/src/cli.ts",
67
+ "check",
68
+ "publish-guardrails",
69
+ "--cwd",
70
+ "."
71
+ ]
72
+ },
73
+ {
74
+ id: "changeset",
75
+ label: "Changeset",
76
+ command: [
77
+ "bun",
78
+ "run",
79
+ "apps/outfitter/src/commands/repo.ts",
80
+ "check",
81
+ "changeset",
82
+ "--cwd",
83
+ "."
84
+ ]
85
+ },
86
+ {
87
+ id: "registry",
88
+ label: "Bunup registry",
89
+ command: [
90
+ "bun",
91
+ "run",
92
+ "apps/outfitter/src/commands/repo.ts",
93
+ "check",
94
+ "registry",
95
+ "--cwd",
96
+ "."
97
+ ]
98
+ },
99
+ {
100
+ id: "preset-versions",
101
+ label: "Preset dependency versions",
102
+ command: [
103
+ "bun",
104
+ "run",
105
+ "apps/outfitter/src/cli.ts",
106
+ "check",
107
+ "preset-versions",
108
+ "--cwd",
109
+ "."
110
+ ]
111
+ },
112
+ {
113
+ id: "action-ceremony",
114
+ label: "Action ceremony guardrails",
115
+ command: [
116
+ "bun",
117
+ "run",
118
+ "apps/outfitter/src/cli.ts",
119
+ "check",
120
+ "action-ceremony",
121
+ "--cwd",
122
+ "."
123
+ ]
124
+ },
125
+ {
126
+ id: "docs-sentinel",
127
+ label: "Docs readme sentinel",
128
+ command: [
129
+ "bun",
130
+ "run",
131
+ "apps/outfitter/src/cli.ts",
132
+ "check",
133
+ "docs-sentinel",
134
+ "--cwd",
135
+ "."
136
+ ]
137
+ },
138
+ {
139
+ id: "docs-links",
140
+ label: "Markdown links",
141
+ command: [
142
+ "bun",
143
+ "run",
144
+ "apps/outfitter/src/commands/repo.ts",
145
+ "check",
146
+ "markdown-links",
147
+ "--cwd",
148
+ "."
149
+ ]
150
+ },
151
+ {
152
+ id: "exports",
153
+ label: "Exports",
154
+ command: [
155
+ "bun",
156
+ "run",
157
+ "apps/outfitter/src/commands/repo.ts",
158
+ "check",
159
+ "exports",
160
+ "--cwd",
161
+ "."
162
+ ]
163
+ },
164
+ {
165
+ id: "readme-imports",
166
+ label: "README imports",
167
+ command: [
168
+ "bun",
169
+ "run",
170
+ "apps/outfitter/src/commands/repo.ts",
171
+ "check",
172
+ "readme",
173
+ "--cwd",
174
+ "."
175
+ ]
176
+ },
177
+ {
178
+ id: "exports-normalized",
179
+ label: "Exports normalized",
180
+ command: ["bun", "run", "exports:check"]
181
+ },
182
+ {
183
+ id: "tree-clean",
184
+ label: "Working tree clean",
185
+ command: [
186
+ "bun",
187
+ "run",
188
+ "apps/outfitter/src/commands/repo.ts",
189
+ "check",
190
+ "tree",
191
+ "--cwd",
192
+ "."
193
+ ]
194
+ },
195
+ {
196
+ id: "boundary-invocations",
197
+ label: "Boundary invocations",
198
+ command: [
199
+ "bun",
200
+ "run",
201
+ "apps/outfitter/src/commands/repo.ts",
202
+ "check",
203
+ "boundary-invocations",
204
+ "--cwd",
205
+ "."
206
+ ]
207
+ },
208
+ {
209
+ id: "surface-map-canonical",
210
+ label: "Surface map canonical path",
211
+ command: [
212
+ "bun",
213
+ "run",
214
+ "apps/outfitter/src/cli.ts",
215
+ "check",
216
+ "surface-map",
217
+ "--cwd",
218
+ "."
219
+ ]
220
+ },
221
+ {
222
+ id: "surface-map-format",
223
+ label: "Surface map format",
224
+ command: [
225
+ "bun",
226
+ "run",
227
+ "apps/outfitter/src/cli.ts",
228
+ "check",
229
+ "surface-map-format",
230
+ "--cwd",
231
+ "."
232
+ ]
233
+ },
234
+ {
235
+ id: "schema-diff",
236
+ label: "Schema drift",
237
+ command: ["bun", "run", "schema:diff"]
238
+ }
239
+ ];
240
+ if (options.mode === "ci") {
241
+ steps.push({
242
+ id: "tests",
243
+ label: "Tests",
244
+ command: ["bun", "run", "test:ci"]
245
+ });
246
+ }
247
+ return steps;
248
+ }
249
+ if (options.mode === "pre-push") {
250
+ return [
251
+ {
252
+ id: "block-drift",
253
+ label: "Block drift",
254
+ command: [
255
+ "bun",
256
+ "run",
257
+ "apps/outfitter/src/cli.ts",
258
+ "check",
259
+ "--manifest-only",
260
+ "--cwd",
261
+ "."
262
+ ]
263
+ },
264
+ {
265
+ id: "pre-push-verify",
266
+ label: "Hook verify",
267
+ command: [
268
+ "bun",
269
+ "run",
270
+ "packages/tooling/src/cli/index.ts",
271
+ "pre-push"
272
+ ]
273
+ },
274
+ {
275
+ id: "schema-drift",
276
+ label: "Schema drift",
277
+ command: ["bun", "run", "apps/outfitter/src/cli.ts", "schema", "diff"]
278
+ }
279
+ ];
280
+ }
281
+ const hasStagedFiles = stagedFiles.length > 0;
282
+ const tsFiles = stagedFiles.filter((f) => /\.(ts|tsx)$/.test(f));
283
+ const preCommitSteps = [
284
+ {
285
+ id: "ultracite-fix",
286
+ label: "Ultracite fix",
287
+ command: hasStagedFiles ? ["bun", "x", "ultracite", "fix", ...stagedFiles] : ["bun", "x", "ultracite", "fix", "."]
288
+ },
289
+ {
290
+ id: "exports",
291
+ label: "Exports",
292
+ command: ["bun", "run", "check-exports"]
293
+ }
294
+ ];
295
+ if (tsFiles.length > 0) {
296
+ preCommitSteps.splice(1, 0, {
297
+ id: "typecheck",
298
+ label: "Typecheck",
299
+ command: ["./scripts/pre-commit-typecheck.sh", ...tsFiles]
300
+ });
301
+ } else if (!hasStagedFiles) {
302
+ preCommitSteps.splice(1, 0, {
303
+ id: "typecheck",
304
+ label: "Typecheck",
305
+ command: ["bun", "run", "typecheck", "--", "--only"]
306
+ });
307
+ }
308
+ if (shouldSyncAgentScaffolding(stagedFiles)) {
309
+ preCommitSteps.push({
310
+ id: "sync-agent-scaffolding",
311
+ label: "Sync agent scaffolding",
312
+ command: ["./scripts/sync-agent-scaffolding.sh"]
313
+ });
314
+ }
315
+ return preCommitSteps;
316
+ }
317
+ function parseTreePaths(statusOutput) {
318
+ return statusOutput.split(`
319
+ `).filter((line) => line.length >= 3).map((line) => {
320
+ const payload = line.slice(3).trim();
321
+ const renameParts = payload.split(" -> ");
322
+ return renameParts.at(-1) ?? payload;
323
+ }).toSorted();
324
+ }
325
+ function readTreePaths(cwd) {
326
+ const result = Bun.spawnSync(["git", "status", "--porcelain"], {
327
+ cwd,
328
+ stderr: "ignore"
329
+ });
330
+ if (result.exitCode !== 0) {
331
+ return [];
332
+ }
333
+ return parseTreePaths(result.stdout.toString());
334
+ }
335
+ function diffTreePaths(before, after) {
336
+ const beforeSet = new Set(before);
337
+ return after.filter((path) => !beforeSet.has(path));
338
+ }
339
+ async function runStep(cwd, step) {
340
+ const startedAt = Date.now();
341
+ const processHandle = Bun.spawn([...step.command], {
342
+ cwd,
343
+ stdout: "pipe",
344
+ stderr: "pipe"
345
+ });
346
+ const [exitCode, stdout, stderr] = await Promise.all([
347
+ processHandle.exited,
348
+ new Response(processHandle.stdout).text(),
349
+ new Response(processHandle.stderr).text()
350
+ ]);
351
+ return {
352
+ id: step.id,
353
+ label: step.label,
354
+ command: step.command,
355
+ exitCode,
356
+ stdout,
357
+ stderr,
358
+ durationMs: Date.now() - startedAt
359
+ };
360
+ }
361
+ function extractSuccessAdvisory(stderr) {
362
+ const lines = stderr.split(`
363
+ `).map((line) => line.trim()).filter((line) => line.length > 0);
364
+ if (lines.length === 0) {
365
+ return;
366
+ }
367
+ const advisoryLines = lines.filter((line) => SUCCESS_ADVISORY_PATTERNS.some((pattern) => pattern.test(line)));
368
+ if (advisoryLines.length === 0) {
369
+ return;
370
+ }
371
+ const maxLines = 3;
372
+ const visibleLines = advisoryLines.slice(0, maxLines);
373
+ if (advisoryLines.length > maxLines) {
374
+ visibleLines.push(`...and ${advisoryLines.length - maxLines} more advisory line(s)`);
375
+ }
376
+ return visibleLines.join(`
377
+ `);
378
+ }
379
+ async function runCheckOrchestrator(options) {
380
+ try {
381
+ const cwd = resolve(options.cwd);
382
+ const plan = buildCheckOrchestratorPlan({ ...options, cwd });
383
+ if (plan.length === 0) {
384
+ return Result.err(new CheckOrchestratorError("No checks configured for selected mode"));
385
+ }
386
+ const treeBefore = readTreePaths(cwd);
387
+ const stepResults = [];
388
+ for (const step of plan) {
389
+ const result = await runStep(cwd, step);
390
+ stepResults.push(result);
391
+ if (result.exitCode !== 0) {
392
+ break;
393
+ }
394
+ }
395
+ const treeAfter = readTreePaths(cwd);
396
+ const failedStepIds = stepResults.filter((step) => step.exitCode !== 0).map((step) => step.id);
397
+ const mutatedPaths = diffTreePaths(treeBefore, treeAfter);
398
+ const treeClean = mutatedPaths.length === 0;
399
+ const enforceCleanTree = options.mode !== "pre-commit";
400
+ return Result.ok({
401
+ mode: options.mode,
402
+ steps: stepResults,
403
+ failedStepIds,
404
+ mutatedPaths,
405
+ treeClean,
406
+ ok: failedStepIds.length === 0 && (!enforceCleanTree || enforceCleanTree && treeClean)
407
+ });
408
+ } catch (error) {
409
+ const message = error instanceof Error ? error.message : "Unknown error";
410
+ return Result.err(new CheckOrchestratorError(`Failed to run check orchestrator: ${message}`));
411
+ }
412
+ }
413
+ function toCompactResult(result) {
414
+ return {
415
+ mode: result.mode,
416
+ ok: result.ok,
417
+ treeClean: result.treeClean,
418
+ failedStepIds: result.failedStepIds,
419
+ mutatedPaths: result.mutatedPaths,
420
+ steps: result.steps.map((step) => ({
421
+ id: step.id,
422
+ label: step.label,
423
+ exitCode: step.exitCode,
424
+ durationMs: step.durationMs
425
+ }))
426
+ };
427
+ }
428
+ async function printCheckOrchestratorResults(result, options = {}) {
429
+ const mode = resolveStructuredOutputMode(options.mode) ?? "human";
430
+ if (mode === "json" || mode === "jsonl") {
431
+ const payload = options.compact ? toCompactResult(result) : result;
432
+ process.stdout.write(`${JSON.stringify(payload)}
433
+ `);
434
+ return;
435
+ }
436
+ const theme = createTheme();
437
+ process.stdout.write(`${theme.bold("Check Orchestrator")} (${result.mode})
438
+
439
+ `);
440
+ for (const step of result.steps) {
441
+ const icon = step.exitCode === 0 ? theme.success("\u2713") : theme.error("\u2717");
442
+ const duration = `${step.durationMs}ms`;
443
+ process.stdout.write(` ${icon} ${step.label} ${theme.muted(`(${duration})`)}
444
+ `);
445
+ if (step.exitCode !== 0) {
446
+ const snippet = `${step.stdout}
447
+ ${step.stderr}`.trim();
448
+ if (snippet.length > 0) {
449
+ process.stdout.write(`${theme.muted(snippet)}
450
+ `);
451
+ }
452
+ } else {
453
+ const advisory = extractSuccessAdvisory(step.stderr);
454
+ if (advisory) {
455
+ process.stdout.write(` ${theme.warning("!")} ${theme.muted(advisory)}
456
+ `);
457
+ }
458
+ }
459
+ }
460
+ if (!result.treeClean) {
461
+ process.stdout.write(`
462
+ ${theme.warning("Mutation traceability")}: working tree changed during run
463
+ `);
464
+ for (const path of result.mutatedPaths) {
465
+ process.stdout.write(` ${theme.muted(path)}
466
+ `);
467
+ }
468
+ }
469
+ process.stdout.write(`
470
+ `);
471
+ if (result.ok) {
472
+ process.stdout.write(`${theme.success("All orchestrated checks passed.")}
473
+ `);
474
+ } else {
475
+ process.stdout.write(`${theme.error("Orchestrated checks failed.")} ${theme.muted(`(${result.failedStepIds.join(", ") || "tree-clean"})`)}
476
+ `);
477
+ }
478
+ }
479
+
480
+ export { CheckOrchestratorError, buildCheckOrchestratorPlan, parseTreePaths, runCheckOrchestrator, printCheckOrchestratorResults };