@shrkcrft/cli 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/asset-preview/apply-action-hint-stub.d.ts +28 -0
  4. package/dist/asset-preview/apply-action-hint-stub.d.ts.map +1 -0
  5. package/dist/asset-preview/apply-action-hint-stub.js +170 -0
  6. package/dist/asset-preview/apply-asset-preview.d.ts +31 -0
  7. package/dist/asset-preview/apply-asset-preview.d.ts.map +1 -0
  8. package/dist/asset-preview/apply-asset-preview.js +210 -0
  9. package/dist/asset-preview/apply-knowledge-stale-fix.d.ts +37 -0
  10. package/dist/asset-preview/apply-knowledge-stale-fix.d.ts.map +1 -0
  11. package/dist/asset-preview/apply-knowledge-stale-fix.js +344 -0
  12. package/dist/asset-preview/apply-missing-barrel.d.ts +15 -0
  13. package/dist/asset-preview/apply-missing-barrel.d.ts.map +1 -0
  14. package/dist/asset-preview/apply-missing-barrel.js +65 -0
  15. package/dist/asset-preview/apply-template-drift-fix.d.ts +21 -0
  16. package/dist/asset-preview/apply-template-drift-fix.d.ts.map +1 -0
  17. package/dist/asset-preview/apply-template-drift-fix.js +125 -0
  18. package/dist/asset-preview/apply-template-update.d.ts +43 -0
  19. package/dist/asset-preview/apply-template-update.d.ts.map +1 -0
  20. package/dist/asset-preview/apply-template-update.js +257 -0
  21. package/dist/asset-preview/entry-mutator.d.ts +106 -0
  22. package/dist/asset-preview/entry-mutator.d.ts.map +1 -0
  23. package/dist/asset-preview/entry-mutator.js +428 -0
  24. package/dist/authoring/authoring-kit.d.ts +36 -0
  25. package/dist/authoring/authoring-kit.d.ts.map +1 -0
  26. package/dist/authoring/authoring-kit.js +106 -0
  27. package/dist/command-registry.d.ts +158 -0
  28. package/dist/command-registry.d.ts.map +1 -0
  29. package/dist/command-registry.js +348 -0
  30. package/dist/commands/apply.command.d.ts +3 -0
  31. package/dist/commands/apply.command.d.ts.map +1 -0
  32. package/dist/commands/apply.command.js +879 -0
  33. package/dist/commands/architecture.command.d.ts +5 -0
  34. package/dist/commands/architecture.command.d.ts.map +1 -0
  35. package/dist/commands/architecture.command.js +141 -0
  36. package/dist/commands/ask.command.d.ts +3 -0
  37. package/dist/commands/ask.command.d.ts.map +1 -0
  38. package/dist/commands/ask.command.js +58 -0
  39. package/dist/commands/audit.command.d.ts +3 -0
  40. package/dist/commands/audit.command.d.ts.map +1 -0
  41. package/dist/commands/audit.command.js +141 -0
  42. package/dist/commands/biome.command.d.ts +7 -0
  43. package/dist/commands/biome.command.d.ts.map +1 -0
  44. package/dist/commands/biome.command.js +350 -0
  45. package/dist/commands/boundaries.command.d.ts +9 -0
  46. package/dist/commands/boundaries.command.d.ts.map +1 -0
  47. package/dist/commands/boundaries.command.js +326 -0
  48. package/dist/commands/brief.command.d.ts +3 -0
  49. package/dist/commands/brief.command.d.ts.map +1 -0
  50. package/dist/commands/brief.command.js +206 -0
  51. package/dist/commands/bundle.command.d.ts +3 -0
  52. package/dist/commands/bundle.command.d.ts.map +1 -0
  53. package/dist/commands/bundle.command.js +1183 -0
  54. package/dist/commands/changes.command.d.ts +3 -0
  55. package/dist/commands/changes.command.d.ts.map +1 -0
  56. package/dist/commands/changes.command.js +155 -0
  57. package/dist/commands/check.command.d.ts +3 -0
  58. package/dist/commands/check.command.d.ts.map +1 -0
  59. package/dist/commands/check.command.js +580 -0
  60. package/dist/commands/checks.command.d.ts +29 -0
  61. package/dist/commands/checks.command.d.ts.map +1 -0
  62. package/dist/commands/checks.command.js +521 -0
  63. package/dist/commands/ci.command.d.ts +3 -0
  64. package/dist/commands/ci.command.d.ts.map +1 -0
  65. package/dist/commands/ci.command.js +680 -0
  66. package/dist/commands/codemod.command.d.ts +3 -0
  67. package/dist/commands/codemod.command.d.ts.map +1 -0
  68. package/dist/commands/codemod.command.js +130 -0
  69. package/dist/commands/command-catalog.d.ts +265 -0
  70. package/dist/commands/command-catalog.d.ts.map +1 -0
  71. package/dist/commands/command-catalog.js +3255 -0
  72. package/dist/commands/commands.command.d.ts +92 -0
  73. package/dist/commands/commands.command.d.ts.map +1 -0
  74. package/dist/commands/commands.command.js +1208 -0
  75. package/dist/commands/constructs.command.d.ts +15 -0
  76. package/dist/commands/constructs.command.d.ts.map +1 -0
  77. package/dist/commands/constructs.command.js +669 -0
  78. package/dist/commands/context.command.d.ts +3 -0
  79. package/dist/commands/context.command.d.ts.map +1 -0
  80. package/dist/commands/context.command.js +120 -0
  81. package/dist/commands/contract-gate.command.d.ts +5 -0
  82. package/dist/commands/contract-gate.command.d.ts.map +1 -0
  83. package/dist/commands/contract-gate.command.js +208 -0
  84. package/dist/commands/contract-templates.command.d.ts +8 -0
  85. package/dist/commands/contract-templates.command.d.ts.map +1 -0
  86. package/dist/commands/contract-templates.command.js +151 -0
  87. package/dist/commands/contract.command.d.ts +3 -0
  88. package/dist/commands/contract.command.d.ts.map +1 -0
  89. package/dist/commands/contract.command.js +105 -0
  90. package/dist/commands/conventions.command.d.ts +8 -0
  91. package/dist/commands/conventions.command.d.ts.map +1 -0
  92. package/dist/commands/conventions.command.js +169 -0
  93. package/dist/commands/coverage.command.d.ts +3 -0
  94. package/dist/commands/coverage.command.d.ts.map +1 -0
  95. package/dist/commands/coverage.command.js +56 -0
  96. package/dist/commands/daily.commands.d.ts +5 -0
  97. package/dist/commands/daily.commands.d.ts.map +1 -0
  98. package/dist/commands/daily.commands.js +224 -0
  99. package/dist/commands/dashboard-export.command.d.ts +4 -0
  100. package/dist/commands/dashboard-export.command.d.ts.map +1 -0
  101. package/dist/commands/dashboard-export.command.js +86 -0
  102. package/dist/commands/dashboard.command.d.ts +3 -0
  103. package/dist/commands/dashboard.command.d.ts.map +1 -0
  104. package/dist/commands/dashboard.command.js +106 -0
  105. package/dist/commands/dev.command.d.ts +3 -0
  106. package/dist/commands/dev.command.d.ts.map +1 -0
  107. package/dist/commands/dev.command.js +1392 -0
  108. package/dist/commands/diagnostics.command.d.ts +5 -0
  109. package/dist/commands/diagnostics.command.d.ts.map +1 -0
  110. package/dist/commands/diagnostics.command.js +97 -0
  111. package/dist/commands/docs.command.d.ts +4 -0
  112. package/dist/commands/docs.command.d.ts.map +1 -0
  113. package/dist/commands/docs.command.js +34 -0
  114. package/dist/commands/doctor.command.d.ts +7 -0
  115. package/dist/commands/doctor.command.d.ts.map +1 -0
  116. package/dist/commands/doctor.command.js +682 -0
  117. package/dist/commands/drift.command.d.ts +3 -0
  118. package/dist/commands/drift.command.d.ts.map +1 -0
  119. package/dist/commands/drift.command.js +124 -0
  120. package/dist/commands/eslint.command.d.ts +7 -0
  121. package/dist/commands/eslint.command.d.ts.map +1 -0
  122. package/dist/commands/eslint.command.js +423 -0
  123. package/dist/commands/explore.command.d.ts +3 -0
  124. package/dist/commands/explore.command.d.ts.map +1 -0
  125. package/dist/commands/explore.command.js +65 -0
  126. package/dist/commands/export-bundle.command.d.ts +6 -0
  127. package/dist/commands/export-bundle.command.d.ts.map +1 -0
  128. package/dist/commands/export-bundle.command.js +96 -0
  129. package/dist/commands/export.command.d.ts +3 -0
  130. package/dist/commands/export.command.d.ts.map +1 -0
  131. package/dist/commands/export.command.js +83 -0
  132. package/dist/commands/feedback-dispatch.command.d.ts +12 -0
  133. package/dist/commands/feedback-dispatch.command.d.ts.map +1 -0
  134. package/dist/commands/feedback-dispatch.command.js +63 -0
  135. package/dist/commands/feedback.command.d.ts +11 -0
  136. package/dist/commands/feedback.command.d.ts.map +1 -0
  137. package/dist/commands/feedback.command.js +336 -0
  138. package/dist/commands/fix.command.d.ts +3 -0
  139. package/dist/commands/fix.command.d.ts.map +1 -0
  140. package/dist/commands/fix.command.js +776 -0
  141. package/dist/commands/gen.command.d.ts +3 -0
  142. package/dist/commands/gen.command.d.ts.map +1 -0
  143. package/dist/commands/gen.command.js +136 -0
  144. package/dist/commands/git.command.d.ts +6 -0
  145. package/dist/commands/git.command.d.ts.map +1 -0
  146. package/dist/commands/git.command.js +81 -0
  147. package/dist/commands/graph.command.d.ts +3 -0
  148. package/dist/commands/graph.command.d.ts.map +1 -0
  149. package/dist/commands/graph.command.js +287 -0
  150. package/dist/commands/grounding.command.d.ts +7 -0
  151. package/dist/commands/grounding.command.d.ts.map +1 -0
  152. package/dist/commands/grounding.command.js +54 -0
  153. package/dist/commands/help.command.d.ts +20 -0
  154. package/dist/commands/help.command.d.ts.map +1 -0
  155. package/dist/commands/help.command.js +129 -0
  156. package/dist/commands/helper.command.d.ts +6 -0
  157. package/dist/commands/helper.command.d.ts.map +1 -0
  158. package/dist/commands/helper.command.js +170 -0
  159. package/dist/commands/ide.command.d.ts +6 -0
  160. package/dist/commands/ide.command.d.ts.map +1 -0
  161. package/dist/commands/ide.command.js +340 -0
  162. package/dist/commands/impact.command.d.ts +3 -0
  163. package/dist/commands/impact.command.d.ts.map +1 -0
  164. package/dist/commands/impact.command.js +819 -0
  165. package/dist/commands/import.command.d.ts +3 -0
  166. package/dist/commands/import.command.d.ts.map +1 -0
  167. package/dist/commands/import.command.js +115 -0
  168. package/dist/commands/infer.command.d.ts +3 -0
  169. package/dist/commands/infer.command.d.ts.map +1 -0
  170. package/dist/commands/infer.command.js +227 -0
  171. package/dist/commands/ingest.command.d.ts +6 -0
  172. package/dist/commands/ingest.command.d.ts.map +1 -0
  173. package/dist/commands/ingest.command.js +532 -0
  174. package/dist/commands/init.command.d.ts +3 -0
  175. package/dist/commands/init.command.d.ts.map +1 -0
  176. package/dist/commands/init.command.js +300 -0
  177. package/dist/commands/inspect.command.d.ts +3 -0
  178. package/dist/commands/inspect.command.d.ts.map +1 -0
  179. package/dist/commands/inspect.command.js +122 -0
  180. package/dist/commands/knowledge-author.command.d.ts +22 -0
  181. package/dist/commands/knowledge-author.command.d.ts.map +1 -0
  182. package/dist/commands/knowledge-author.command.js +366 -0
  183. package/dist/commands/knowledge-propose.command.d.ts +3 -0
  184. package/dist/commands/knowledge-propose.command.d.ts.map +1 -0
  185. package/dist/commands/knowledge-propose.command.js +125 -0
  186. package/dist/commands/knowledge.command.d.ts +18 -0
  187. package/dist/commands/knowledge.command.d.ts.map +1 -0
  188. package/dist/commands/knowledge.command.js +538 -0
  189. package/dist/commands/languages.command.d.ts +3 -0
  190. package/dist/commands/languages.command.d.ts.map +1 -0
  191. package/dist/commands/languages.command.js +300 -0
  192. package/dist/commands/lint.command.d.ts +15 -0
  193. package/dist/commands/lint.command.d.ts.map +1 -0
  194. package/dist/commands/lint.command.js +194 -0
  195. package/dist/commands/mcp.command.d.ts +3 -0
  196. package/dist/commands/mcp.command.d.ts.map +1 -0
  197. package/dist/commands/mcp.command.js +203 -0
  198. package/dist/commands/memory.command.d.ts +11 -0
  199. package/dist/commands/memory.command.d.ts.map +1 -0
  200. package/dist/commands/memory.command.js +264 -0
  201. package/dist/commands/onboard.command.d.ts +3 -0
  202. package/dist/commands/onboard.command.d.ts.map +1 -0
  203. package/dist/commands/onboard.command.js +662 -0
  204. package/dist/commands/orchestrate.command.d.ts +3 -0
  205. package/dist/commands/orchestrate.command.d.ts.map +1 -0
  206. package/dist/commands/orchestrate.command.js +49 -0
  207. package/dist/commands/owners.command.d.ts +5 -0
  208. package/dist/commands/owners.command.d.ts.map +1 -0
  209. package/dist/commands/owners.command.js +113 -0
  210. package/dist/commands/ownership.command.d.ts +5 -0
  211. package/dist/commands/ownership.command.d.ts.map +1 -0
  212. package/dist/commands/ownership.command.js +117 -0
  213. package/dist/commands/pack-author.command.d.ts +30 -0
  214. package/dist/commands/pack-author.command.d.ts.map +1 -0
  215. package/dist/commands/pack-author.command.js +242 -0
  216. package/dist/commands/packs-new.d.ts +27 -0
  217. package/dist/commands/packs-new.d.ts.map +1 -0
  218. package/dist/commands/packs-new.js +805 -0
  219. package/dist/commands/packs.command.d.ts +15 -0
  220. package/dist/commands/packs.command.d.ts.map +1 -0
  221. package/dist/commands/packs.command.js +964 -0
  222. package/dist/commands/paths.command.d.ts +6 -0
  223. package/dist/commands/paths.command.d.ts.map +1 -0
  224. package/dist/commands/paths.command.js +97 -0
  225. package/dist/commands/pipelines.command.d.ts +9 -0
  226. package/dist/commands/pipelines.command.d.ts.map +1 -0
  227. package/dist/commands/pipelines.command.js +308 -0
  228. package/dist/commands/plan-check.command.d.ts +27 -0
  229. package/dist/commands/plan-check.command.d.ts.map +1 -0
  230. package/dist/commands/plan-check.command.js +150 -0
  231. package/dist/commands/plan-simulate.command.d.ts +3 -0
  232. package/dist/commands/plan-simulate.command.d.ts.map +1 -0
  233. package/dist/commands/plan-simulate.command.js +60 -0
  234. package/dist/commands/plan.command.d.ts +8 -0
  235. package/dist/commands/plan.command.d.ts.map +1 -0
  236. package/dist/commands/plan.command.js +139 -0
  237. package/dist/commands/playbooks.command.d.ts +10 -0
  238. package/dist/commands/playbooks.command.d.ts.map +1 -0
  239. package/dist/commands/playbooks.command.js +296 -0
  240. package/dist/commands/plugin.command.d.ts +11 -0
  241. package/dist/commands/plugin.command.d.ts.map +1 -0
  242. package/dist/commands/plugin.command.js +394 -0
  243. package/dist/commands/policy.command.d.ts +8 -0
  244. package/dist/commands/policy.command.d.ts.map +1 -0
  245. package/dist/commands/policy.command.js +451 -0
  246. package/dist/commands/pr.command.d.ts +3 -0
  247. package/dist/commands/pr.command.d.ts.map +1 -0
  248. package/dist/commands/pr.command.js +132 -0
  249. package/dist/commands/preflight.command.d.ts +3 -0
  250. package/dist/commands/preflight.command.d.ts.map +1 -0
  251. package/dist/commands/preflight.command.js +102 -0
  252. package/dist/commands/presets.command.d.ts +17 -0
  253. package/dist/commands/presets.command.d.ts.map +1 -0
  254. package/dist/commands/presets.command.js +647 -0
  255. package/dist/commands/profiles.command.d.ts +7 -0
  256. package/dist/commands/profiles.command.d.ts.map +1 -0
  257. package/dist/commands/profiles.command.js +151 -0
  258. package/dist/commands/provenance.command.d.ts +26 -0
  259. package/dist/commands/provenance.command.d.ts.map +1 -0
  260. package/dist/commands/provenance.command.js +237 -0
  261. package/dist/commands/quality.command.d.ts +5 -0
  262. package/dist/commands/quality.command.d.ts.map +1 -0
  263. package/dist/commands/quality.command.js +69 -0
  264. package/dist/commands/recommend.command.d.ts +4 -0
  265. package/dist/commands/recommend.command.d.ts.map +1 -0
  266. package/dist/commands/recommend.command.js +270 -0
  267. package/dist/commands/registrations.command.d.ts +3 -0
  268. package/dist/commands/registrations.command.d.ts.map +1 -0
  269. package/dist/commands/registrations.command.js +300 -0
  270. package/dist/commands/registry.command.d.ts +4 -0
  271. package/dist/commands/registry.command.d.ts.map +1 -0
  272. package/dist/commands/registry.command.js +37 -0
  273. package/dist/commands/release.command.d.ts +4 -0
  274. package/dist/commands/release.command.d.ts.map +1 -0
  275. package/dist/commands/release.command.js +639 -0
  276. package/dist/commands/repo.command.d.ts +3 -0
  277. package/dist/commands/repo.command.d.ts.map +1 -0
  278. package/dist/commands/repo.command.js +24 -0
  279. package/dist/commands/report.command.d.ts +3 -0
  280. package/dist/commands/report.command.d.ts.map +1 -0
  281. package/dist/commands/report.command.js +511 -0
  282. package/dist/commands/reposet.command.d.ts +6 -0
  283. package/dist/commands/reposet.command.d.ts.map +1 -0
  284. package/dist/commands/reposet.command.js +120 -0
  285. package/dist/commands/review.command.d.ts +3 -0
  286. package/dist/commands/review.command.d.ts.map +1 -0
  287. package/dist/commands/review.command.js +380 -0
  288. package/dist/commands/risk.command.d.ts +3 -0
  289. package/dist/commands/risk.command.d.ts.map +1 -0
  290. package/dist/commands/risk.command.js +56 -0
  291. package/dist/commands/rounds.command.d.ts +8 -0
  292. package/dist/commands/rounds.command.d.ts.map +1 -0
  293. package/dist/commands/rounds.command.js +180 -0
  294. package/dist/commands/rules.command.d.ts +49 -0
  295. package/dist/commands/rules.command.d.ts.map +1 -0
  296. package/dist/commands/rules.command.js +435 -0
  297. package/dist/commands/runtime.command.d.ts +3 -0
  298. package/dist/commands/runtime.command.d.ts.map +1 -0
  299. package/dist/commands/runtime.command.js +56 -0
  300. package/dist/commands/safety.command.d.ts +3 -0
  301. package/dist/commands/safety.command.d.ts.map +1 -0
  302. package/dist/commands/safety.command.js +117 -0
  303. package/dist/commands/scaffolds.command.d.ts +5 -0
  304. package/dist/commands/scaffolds.command.d.ts.map +1 -0
  305. package/dist/commands/scaffolds.command.js +122 -0
  306. package/dist/commands/schemas.command.d.ts +21 -0
  307. package/dist/commands/schemas.command.d.ts.map +1 -0
  308. package/dist/commands/schemas.command.js +296 -0
  309. package/dist/commands/search.command.d.ts +12 -0
  310. package/dist/commands/search.command.d.ts.map +1 -0
  311. package/dist/commands/search.command.js +275 -0
  312. package/dist/commands/self-config.command.d.ts +7 -0
  313. package/dist/commands/self-config.command.d.ts.map +1 -0
  314. package/dist/commands/self-config.command.js +156 -0
  315. package/dist/commands/self.command.d.ts +3 -0
  316. package/dist/commands/self.command.d.ts.map +1 -0
  317. package/dist/commands/self.command.js +117 -0
  318. package/dist/commands/simulate.command.d.ts +3 -0
  319. package/dist/commands/simulate.command.d.ts.map +1 -0
  320. package/dist/commands/simulate.command.js +54 -0
  321. package/dist/commands/spec.command.d.ts +29 -0
  322. package/dist/commands/spec.command.d.ts.map +1 -0
  323. package/dist/commands/spec.command.js +985 -0
  324. package/dist/commands/start-here.command.d.ts +3 -0
  325. package/dist/commands/start-here.command.d.ts.map +1 -0
  326. package/dist/commands/start-here.command.js +35 -0
  327. package/dist/commands/stats.command.d.ts +3 -0
  328. package/dist/commands/stats.command.d.ts.map +1 -0
  329. package/dist/commands/stats.command.js +88 -0
  330. package/dist/commands/surface.command.d.ts +15 -0
  331. package/dist/commands/surface.command.d.ts.map +1 -0
  332. package/dist/commands/surface.command.js +328 -0
  333. package/dist/commands/task-context.command.d.ts +7 -0
  334. package/dist/commands/task-context.command.d.ts.map +1 -0
  335. package/dist/commands/task-context.command.js +646 -0
  336. package/dist/commands/task.command.d.ts +3 -0
  337. package/dist/commands/task.command.d.ts.map +1 -0
  338. package/dist/commands/task.command.js +301 -0
  339. package/dist/commands/template-quality.command.d.ts +5 -0
  340. package/dist/commands/template-quality.command.d.ts.map +1 -0
  341. package/dist/commands/template-quality.command.js +128 -0
  342. package/dist/commands/templates.command.d.ts +26 -0
  343. package/dist/commands/templates.command.d.ts.map +1 -0
  344. package/dist/commands/templates.command.js +964 -0
  345. package/dist/commands/test.command.d.ts +3 -0
  346. package/dist/commands/test.command.d.ts.map +1 -0
  347. package/dist/commands/test.command.js +262 -0
  348. package/dist/commands/tests.command.d.ts +5 -0
  349. package/dist/commands/tests.command.d.ts.map +1 -0
  350. package/dist/commands/tests.command.js +97 -0
  351. package/dist/commands/trace.command.d.ts +3 -0
  352. package/dist/commands/trace.command.d.ts.map +1 -0
  353. package/dist/commands/trace.command.js +121 -0
  354. package/dist/commands/upgrade.command.d.ts +4 -0
  355. package/dist/commands/upgrade.command.d.ts.map +1 -0
  356. package/dist/commands/upgrade.command.js +43 -0
  357. package/dist/commands/version.command.d.ts +3 -0
  358. package/dist/commands/version.command.d.ts.map +1 -0
  359. package/dist/commands/version.command.js +10 -0
  360. package/dist/commands/why.command.d.ts +24 -0
  361. package/dist/commands/why.command.d.ts.map +1 -0
  362. package/dist/commands/why.command.js +119 -0
  363. package/dist/dashboard/dashboard-api-server.d.ts +21 -0
  364. package/dist/dashboard/dashboard-api-server.d.ts.map +1 -0
  365. package/dist/dashboard/dashboard-api-server.js +410 -0
  366. package/dist/dashboard/live-session-server.d.ts +18 -0
  367. package/dist/dashboard/live-session-server.d.ts.map +1 -0
  368. package/dist/dashboard/live-session-server.js +133 -0
  369. package/dist/diff/collect-changed-paths.d.ts +27 -0
  370. package/dist/diff/collect-changed-paths.d.ts.map +1 -0
  371. package/dist/diff/collect-changed-paths.js +68 -0
  372. package/dist/doctor/doctor-tags.d.ts +63 -0
  373. package/dist/doctor/doctor-tags.d.ts.map +1 -0
  374. package/dist/doctor/doctor-tags.js +146 -0
  375. package/dist/export/export-formats.d.ts +22 -0
  376. package/dist/export/export-formats.d.ts.map +1 -0
  377. package/dist/export/export-formats.js +135 -0
  378. package/dist/index.d.ts +22 -0
  379. package/dist/index.d.ts.map +1 -0
  380. package/dist/index.js +21 -0
  381. package/dist/init/detected-block.d.ts +57 -0
  382. package/dist/init/detected-block.d.ts.map +1 -0
  383. package/dist/init/detected-block.js +197 -0
  384. package/dist/init/gitignore.d.ts +30 -0
  385. package/dist/init/gitignore.d.ts.map +1 -0
  386. package/dist/init/gitignore.js +110 -0
  387. package/dist/init/init-templates.d.ts +6 -0
  388. package/dist/init/init-templates.d.ts.map +1 -0
  389. package/dist/init/init-templates.js +413 -0
  390. package/dist/main.d.ts +18 -0
  391. package/dist/main.d.ts.map +1 -0
  392. package/dist/main.js +721 -0
  393. package/dist/output/failure-hints.d.ts +63 -0
  394. package/dist/output/failure-hints.d.ts.map +1 -0
  395. package/dist/output/failure-hints.js +165 -0
  396. package/dist/output/format-output.d.ts +9 -0
  397. package/dist/output/format-output.d.ts.map +1 -0
  398. package/dist/output/format-output.js +26 -0
  399. package/dist/output/print-error.d.ts +3 -0
  400. package/dist/output/print-error.d.ts.map +1 -0
  401. package/dist/output/print-error.js +14 -0
  402. package/dist/output/watch-loop.d.ts +37 -0
  403. package/dist/output/watch-loop.d.ts.map +1 -0
  404. package/dist/output/watch-loop.js +115 -0
  405. package/dist/schemas/json-schemas.d.ts +1630 -0
  406. package/dist/schemas/json-schemas.d.ts.map +1 -0
  407. package/dist/schemas/json-schemas.js +811 -0
  408. package/dist/surface/about.d.ts +10 -0
  409. package/dist/surface/about.d.ts.map +1 -0
  410. package/dist/surface/about.js +31 -0
  411. package/dist/surface/load-surface-context.d.ts +34 -0
  412. package/dist/surface/load-surface-context.d.ts.map +1 -0
  413. package/dist/surface/load-surface-context.js +100 -0
  414. package/dist/surface/no-args-landing.d.ts +7 -0
  415. package/dist/surface/no-args-landing.d.ts.map +1 -0
  416. package/dist/surface/no-args-landing.js +40 -0
  417. package/dist/surface/not-enabled-error.d.ts +24 -0
  418. package/dist/surface/not-enabled-error.d.ts.map +1 -0
  419. package/dist/surface/not-enabled-error.js +36 -0
  420. package/dist/surface/profiles.d.ts +37 -0
  421. package/dist/surface/profiles.d.ts.map +1 -0
  422. package/dist/surface/profiles.js +151 -0
  423. package/dist/surface/shape-defaults.d.ts +21 -0
  424. package/dist/surface/shape-defaults.d.ts.map +1 -0
  425. package/dist/surface/shape-defaults.js +50 -0
  426. package/dist/surface/spine-extractor.d.ts +38 -0
  427. package/dist/surface/spine-extractor.d.ts.map +1 -0
  428. package/dist/surface/spine-extractor.js +100 -0
  429. package/dist/surface/surface-config-writer.d.ts +59 -0
  430. package/dist/surface/surface-config-writer.d.ts.map +1 -0
  431. package/dist/surface/surface-config-writer.js +135 -0
  432. package/dist/surface/surface-summary.d.ts +66 -0
  433. package/dist/surface/surface-summary.d.ts.map +1 -0
  434. package/dist/surface/surface-summary.js +162 -0
  435. package/dist/surface/tier.d.ts +100 -0
  436. package/dist/surface/tier.d.ts.map +1 -0
  437. package/dist/surface/tier.js +172 -0
  438. package/dist/task-next/apply-batch-runner.d.ts +42 -0
  439. package/dist/task-next/apply-batch-runner.d.ts.map +1 -0
  440. package/dist/task-next/apply-batch-runner.js +192 -0
  441. package/dist/task-next/task-next-ranker.d.ts +75 -0
  442. package/dist/task-next/task-next-ranker.d.ts.map +1 -0
  443. package/dist/task-next/task-next-ranker.js +179 -0
  444. package/dist/usage/usage-log.d.ts +54 -0
  445. package/dist/usage/usage-log.d.ts.map +1 -0
  446. package/dist/usage/usage-log.js +105 -0
  447. package/dist/validation/run-validation-loop.d.ts +38 -0
  448. package/dist/validation/run-validation-loop.d.ts.map +1 -0
  449. package/dist/validation/run-validation-loop.js +100 -0
  450. package/package.json +72 -0
package/dist/main.js ADDED
@@ -0,0 +1,721 @@
1
+ #!/usr/bin/env bun
2
+ import { CommandRegistry, extractGlobalCwd, parseArgs, } from "./command-registry.js";
3
+ import { initCommand } from "./commands/init.command.js";
4
+ import { inspectCommand } from "./commands/inspect.command.js";
5
+ import { doctorAcknowledgeCommand, doctorAcknowledgementsCommand, doctorCommand, doctorSuppressCommand, doctorSuppressionsCommand, } from "./commands/doctor.command.js";
6
+ import { knowledgeAnchorsCommand, knowledgeGetCommand, knowledgeListCommand, knowledgeReferencesCommand, knowledgeRenameFileCommand, knowledgeRenameSymbolCommand, knowledgeSearchCommand, knowledgeStaleCheckCommand, knowledgeUpdateAnchorCommand, knowledgeVerifyCommand, } from "./commands/knowledge.command.js";
7
+ import { knowledgeAddCommand, knowledgeLintCommand, knowledgeRemoveCommand, knowledgeUpdateCommand, } from "./commands/knowledge-author.command.js";
8
+ import { knowledgeProposeCommand } from "./commands/knowledge-propose.command.js";
9
+ import { provenanceDoctorCommand, provenanceListCommand, provenanceMissingCommand, provenanceReportCommand, provenanceShowCommand, } from "./commands/provenance.command.js";
10
+ import { packAuthorPendingCommand, packAuthorPreviewCommand, packAuthorStatusCommand, packAuthorValidateCommand, } from "./commands/pack-author.command.js";
11
+ import { rulesAddCommand, rulesDoctorCommand, rulesGetCommand, rulesLintCommand, rulesListCommand, rulesRelevantCommand, rulesRemoveCommand, rulesScaffoldCommand, rulesUpdateCommand, } from "./commands/rules.command.js";
12
+ import { checksListCommand, checksDoctorCommand, checksRunCommand, checksParseReportCommand, checksImportCommand, checksAggregateCommand, checksReportCommand, checksConvertCommand, } from "./commands/checks.command.js";
13
+ import { codemodCommand } from "./commands/codemod.command.js";
14
+ import { pathsListCommand, pathsGetCommand, pathsSearchCommand, pathsBestCommand, } from "./commands/paths.command.js";
15
+ import { templatesAddCommand, templatesDoctorCommand, templatesDriftCommand, templatesGetCommand, templatesListCommand, templatesPreviewCommand, templatesRemoveCommand, templatesScaffoldCommand, templatesSearchCommand, templatesSmokeCommand, templatesUpdateCommand, templatesVarsCommand, templatesVerifyPathsCommand, } from "./commands/templates.command.js";
16
+ import { pipelinesListCommand, pipelinesGetCommand, pipelinesContextCommand, pipelinesPlanCommand, pipelinesScriptCommand, pipelinesNextCommand, pipelinesVarsCommand, } from "./commands/pipelines.command.js";
17
+ import { packsListCommand, packsContributionsCommand, packsConflictsCommand, packsSignatureStatusCommand, packsGetCommand, packsInspectCommand, packsDoctorCommand, packsReleaseCheckCommand, packsCompatCommand, packsSignCommand, packsVerifyCommand, packsDevStatusCommand, packsWatchCommand, } from "./commands/packs.command.js";
18
+ import { packsNewCommand, packsTestCommand } from "./commands/packs-new.js";
19
+ import { presetsListCommand, presetsGetCommand, presetsExplainCommand, presetsRecommendCommand, presetsPreviewCommand, presetsApplyCommand, presetsDoctorCommand, presetsDiffCommand, presetsPatchCommand, } from "./commands/presets.command.js";
20
+ import { taskCommand } from "./commands/task.command.js";
21
+ import { preflightCommand } from "./commands/preflight.command.js";
22
+ import { checkCommand } from "./commands/check.command.js";
23
+ import { driftCommand } from "./commands/drift.command.js";
24
+ import { graphCommand } from "./commands/graph.command.js";
25
+ import { coverageCommand } from "./commands/coverage.command.js";
26
+ import { statsCommand } from "./commands/stats.command.js";
27
+ import { reviewCommand } from "./commands/review.command.js";
28
+ import { onboardCommand } from "./commands/onboard.command.js";
29
+ import { contradictionsCommand, generatedCommand, ingestCommand, } from "./commands/ingest.command.js";
30
+ import { contextBuildCommand, contextRefreshCommand, contextStatusCommand, understandTaskCommand, validateChangeCommand, } from "./commands/task-context.command.js";
31
+ import { testCommand } from "./commands/test.command.js";
32
+ import { planParentCommand, planReviewCommand } from "./commands/plan.command.js";
33
+ import { devCommand } from "./commands/dev.command.js";
34
+ import { explainCommand, } from "./commands/daily.commands.js";
35
+ import { schemasListCommand, schemasGetCommand, schemasInventoryCommand, schemasWriteCommand, schemasEmitCommand, } from "./commands/schemas.command.js";
36
+ import { contextCommand } from "./commands/context.command.js";
37
+ import { diffParentCommand, diffRoundsCommand, roundsCaptureCommand, roundsListCommand, roundsParentCommand, roundsShowCommand, } from "./commands/rounds.command.js";
38
+ import { genCommand } from "./commands/gen.command.js";
39
+ import { applyCommand } from "./commands/apply.command.js";
40
+ import { groundingCommand } from "./commands/grounding.command.js";
41
+ import { planCheckCommand } from "./commands/plan-check.command.js";
42
+ import { whyCommand } from "./commands/why.command.js";
43
+ import { specParentCommand, specCreateCommand, specReviewCommand, specImplementCommand, specVerifyCommand, specListCommand, specShowCommand, specStatusCommand, specLintCommand, } from "./commands/spec.command.js";
44
+ import { exportCommand } from "./commands/export.command.js";
45
+ import { dashboardCommand } from "./commands/dashboard.command.js";
46
+ import { dashboardDiffCommand, dashboardExportCommand, } from "./commands/dashboard-export.command.js";
47
+ import { importCommand } from "./commands/import.command.js";
48
+ import { askCommand } from "./commands/ask.command.js";
49
+ import { mcpCommand } from "./commands/mcp.command.js";
50
+ import { versionCommand } from "./commands/version.command.js";
51
+ import { makeHelpCommand } from "./commands/help.command.js";
52
+ import { qualityCommand } from "./commands/quality.command.js";
53
+ import { ciCommand } from "./commands/ci.command.js";
54
+ import { eslintCommand } from "./commands/eslint.command.js";
55
+ import { biomeCommand } from "./commands/biome.command.js";
56
+ import { ideCommand } from "./commands/ide.command.js";
57
+ import { makeCommandsCommand } from "./commands/commands.command.js";
58
+ import { safetyCommand } from "./commands/safety.command.js";
59
+ import { pluginCommand } from "./commands/plugin.command.js";
60
+ import { profilesCommand } from "./commands/profiles.command.js";
61
+ import { auditProjectCouplingCommand } from "./commands/audit.command.js";
62
+ import { conventionsCommand } from "./commands/conventions.command.js";
63
+ import { selfConfigCommand } from "./commands/self-config.command.js";
64
+ import { helperCommand } from "./commands/helper.command.js";
65
+ import { registryCommand } from "./commands/registry.command.js";
66
+ import { registrationsCommand } from "./commands/registrations.command.js";
67
+ import { boundariesListCommand, boundariesGetCommand, boundariesExplainCommand, boundariesInferCommand, } from "./commands/boundaries.command.js";
68
+ import { scaffoldsListCommand, scaffoldsGetCommand, scaffoldsDoctorCommand, } from "./commands/scaffolds.command.js";
69
+ import { inferCommand } from "./commands/infer.command.js";
70
+ import { reportCommand } from "./commands/report.command.js";
71
+ import { bundleCommand } from "./commands/bundle.command.js";
72
+ import { impactCommand } from "./commands/impact.command.js";
73
+ import { traceCommand } from "./commands/trace.command.js";
74
+ import { feedbackCommand } from "./commands/feedback-dispatch.command.js";
75
+ import { searchCommand } from "./commands/search.command.js";
76
+ import { briefCommand } from "./commands/brief.command.js";
77
+ import { releaseCommand, installSmokeCommand } from "./commands/release.command.js";
78
+ import { startHereCommand } from "./commands/start-here.command.js";
79
+ import { docsCheckCommand, examplesCheckCommand } from "./commands/docs.command.js";
80
+ import { selfAuditCommand } from "./commands/self.command.js";
81
+ import { diagnosticsListCommand } from "./commands/diagnostics.command.js";
82
+ import { architectureMapCommand } from "./commands/architecture.command.js";
83
+ import { orchestrateCommand } from "./commands/orchestrate.command.js";
84
+ import { simulateCommand } from "./commands/simulate.command.js";
85
+ import { reposetInitCommand, reposetListCommand, reposetDoctorCommand, reposetMapCommand, } from "./commands/reposet.command.js";
86
+ import { recommendCommand } from "./commands/recommend.command.js";
87
+ import { surfaceCommand } from "./commands/surface.command.js";
88
+ import { upgradeCheckCommand, upgradePlanCommand } from "./commands/upgrade.command.js";
89
+ import { architectureViolationsCommand, architectureAreaCommand, } from "./commands/architecture.command.js";
90
+ import { riskCommand } from "./commands/risk.command.js";
91
+ import { contractCommand } from "./commands/contract.command.js";
92
+ import { contractApproveCommand, contractCheckCommand, contractStatusCommand, } from "./commands/contract-gate.command.js";
93
+ import { planSimulateCommand } from "./commands/plan-simulate.command.js";
94
+ import { memoryBuildCommand, memoryDiagnosticsCommand, memoryDiffCommand, memoryDriftCommand, memoryFilesCommand, memoryReportCommand, memoryResetCommand, memoryRiskCommand, memorySnapshotsCommand, } from "./commands/memory.command.js";
95
+ import { constructsAdoptCommand, constructsApiCommand, constructsEventsCommand, constructsFacetsCommand, constructsFilesCommand, constructsGetCommand, constructsImpactCommand, constructsInferCommand, constructsListCommand, constructsRelatedCommand, constructsSearchCommand, constructsTokensCommand, constructsTraceCommand, } from "./commands/constructs.command.js";
96
+ import { playbooksBriefCommand, playbooksGetCommand, playbooksListCommand, playbooksPreviewCommand, playbooksRecommendCommand, playbooksRunbookCommand, playbooksScriptCommand, playbooksValidateCommand, } from "./commands/playbooks.command.js";
97
+ import { repoAreasCommand } from "./commands/repo.command.js";
98
+ import { policyCheckCommand, policyListCommand, policyGetCommand, policySnapshotCommand, policyTestCommand, policyRunCommand, } from "./commands/policy.command.js";
99
+ import { ownersListCommand, ownersMatchCommand, ownersImpactCommand } from "./commands/owners.command.js";
100
+ import { ownershipListCommand, ownershipForCommand, ownershipAffectedCommand, } from "./commands/ownership.command.js";
101
+ import { runtimeDoctorCommand } from "./commands/runtime.command.js";
102
+ import { testsImpactCommand, testsSuggestCommand, testsMissingCommand } from "./commands/tests.command.js";
103
+ import { gitChangedCommand, gitRootCommand, gitBranchCommand, gitStatusSummaryCommand, } from "./commands/git.command.js";
104
+ import { templatesLintCommand, templatesTestCommand, templatesSnapshotCommand, } from "./commands/template-quality.command.js";
105
+ import { boundariesEnforceCommand, boundariesSuggestCommand } from "./commands/boundaries.command.js";
106
+ import { languagesCommand } from "./commands/languages.command.js";
107
+ import { fixCommand } from "./commands/fix.command.js";
108
+ // unified lint aggregator.
109
+ import { lintCommand } from "./commands/lint.command.js";
110
+ import { changesCommand } from "./commands/changes.command.js";
111
+ import { exploreCommand } from "./commands/explore.command.js";
112
+ import { prCommand } from "./commands/pr.command.js";
113
+ import { suggestDidYouMean } from '@shrkcrft/inspector';
114
+ import { COMMAND_CATALOG } from "./commands/command-catalog.js";
115
+ import { errorFooterFor, renderErrorFooter } from "./output/failure-hints.js";
116
+ import { renderAbout } from "./surface/about.js";
117
+ import { renderNoArgsLanding } from "./surface/no-args-landing.js";
118
+ import { loadSurfaceContext } from "./surface/load-surface-context.js";
119
+ import { buildSurfaceSummary, findCommandInSummary } from "./surface/surface-summary.js";
120
+ import { makeSurfaceNotEnabledError, renderSurfaceNotEnabledText, SURFACE_NOT_ENABLED_EXIT_CODE, } from "./surface/not-enabled-error.js";
121
+ import { extractCommandPath, recordUsage, sanitizeFlagNames, } from "./usage/usage-log.js";
122
+ import { loadProjectConfig } from '@shrkcrft/config';
123
+ import { initTokenizer } from '@shrkcrft/context';
124
+ import { statSync } from 'node:fs';
125
+ import { resolve as resolvePath } from 'node:path';
126
+ function isUsableDirectory(path) {
127
+ try {
128
+ return statSync(path).isDirectory();
129
+ }
130
+ catch {
131
+ return false;
132
+ }
133
+ }
134
+ let tokenizerInitPromise = null;
135
+ /**
136
+ * Best-effort one-time upgrade from the estimator to gpt-tokenizer.
137
+ *
138
+ * The estimator is always active before this resolves, so commands that
139
+ * race the load still get a budget-safe (if slightly off) count. Subsequent
140
+ * `countTokens` calls get the real BPE count.
141
+ */
142
+ async function ensureTokenizerReady() {
143
+ if (process.env.SHARKCRAFT_NO_REAL_TOKENIZER === '1')
144
+ return;
145
+ if (!tokenizerInitPromise) {
146
+ tokenizerInitPromise = initTokenizer().catch(() => false);
147
+ }
148
+ await tokenizerInitPromise;
149
+ }
150
+ export function buildRegistry() {
151
+ const registry = new CommandRegistry();
152
+ registry.register(initCommand);
153
+ registry.register(inspectCommand);
154
+ registry.register(doctorCommand);
155
+ registry.registerSubcommand('doctor', doctorSuppressCommand);
156
+ registry.registerSubcommand('doctor', doctorSuppressionsCommand);
157
+ // Acknowledgements with required reason + expiry.
158
+ registry.registerSubcommand('doctor', doctorAcknowledgeCommand);
159
+ registry.registerSubcommand('doctor', doctorAcknowledgementsCommand);
160
+ registry.register(contextCommand);
161
+ registry.register(genCommand);
162
+ registry.register(applyCommand);
163
+ // `shrk grounding` thin context primer.
164
+ registry.register(groundingCommand);
165
+ // feedback3 — `shrk why <file>` (closes the dangling ide-suggested verb).
166
+ registry.register(whyCommand);
167
+ // spec verb + subcommands.
168
+ registry.register(specParentCommand);
169
+ registry.registerSubcommand('spec', specCreateCommand);
170
+ registry.registerSubcommand('spec', specReviewCommand);
171
+ registry.registerSubcommand('spec', specImplementCommand);
172
+ registry.registerSubcommand('spec', specVerifyCommand);
173
+ registry.registerSubcommand('spec', specListCommand);
174
+ registry.registerSubcommand('spec', specShowCommand);
175
+ registry.registerSubcommand('spec', specStatusCommand);
176
+ registry.registerSubcommand('spec', specLintCommand);
177
+ // rounds capture + diff.
178
+ registry.register(roundsParentCommand);
179
+ registry.registerSubcommand('rounds', roundsCaptureCommand);
180
+ registry.registerSubcommand('rounds', roundsListCommand);
181
+ registry.registerSubcommand('rounds', roundsShowCommand);
182
+ registry.register(diffParentCommand);
183
+ registry.registerSubcommand('diff', diffRoundsCommand);
184
+ registry.register(exportCommand);
185
+ registry.register(dashboardCommand);
186
+ registry.registerSubcommand('dashboard', dashboardExportCommand);
187
+ registry.registerSubcommand('dashboard', dashboardDiffCommand);
188
+ registry.register(importCommand);
189
+ registry.register(taskCommand);
190
+ registry.register(explainCommand);
191
+ registry.register(checkCommand);
192
+ // changed-only preflight orchestrator.
193
+ registry.register(preflightCommand);
194
+ registry.register(driftCommand);
195
+ registry.register(graphCommand);
196
+ registry.register(coverageCommand);
197
+ registry.register(statsCommand);
198
+ registry.register(reviewCommand);
199
+ registry.register(onboardCommand);
200
+ registry.register(ingestCommand);
201
+ registry.register(contradictionsCommand);
202
+ registry.register(generatedCommand);
203
+ registry.register(understandTaskCommand);
204
+ registry.register(validateChangeCommand);
205
+ // contextBuildCommand / contextRefreshCommand / contextStatusCommand are
206
+ // dispatched from inside contextCommand based on the first positional arg
207
+ // (avoids breaking `shrk context --task "..."` flat usage).
208
+ void contextBuildCommand;
209
+ void contextRefreshCommand;
210
+ void contextStatusCommand;
211
+ registry.register(testCommand);
212
+ registry.register(planParentCommand);
213
+ registry.register(devCommand);
214
+ registry.register(askCommand);
215
+ registry.register(mcpCommand);
216
+ registry.register(versionCommand);
217
+ registry.register(qualityCommand);
218
+ registry.register(ciCommand);
219
+ registry.register(eslintCommand);
220
+ registry.register(biomeCommand);
221
+ registry.register(ideCommand);
222
+ registry.register(pluginCommand);
223
+ registry.register(profilesCommand);
224
+ registry.registerSubcommand('audit', auditProjectCouplingCommand);
225
+ registry.register(conventionsCommand);
226
+ registry.register(selfConfigCommand);
227
+ registry.register(helperCommand);
228
+ registry.register(registryCommand);
229
+ registry.register(registrationsCommand);
230
+ registry.register(makeCommandsCommand(registry));
231
+ registry.register(safetyCommand);
232
+ registry.register(inferCommand);
233
+ registry.register(reportCommand);
234
+ registry.register(bundleCommand);
235
+ registry.register(impactCommand);
236
+ registry.register(traceCommand);
237
+ registry.register(feedbackCommand);
238
+ registry.register(fixCommand);
239
+ // unified lint verb (knowledge / rules / templates aggregator).
240
+ registry.register(lintCommand);
241
+ registry.register(changesCommand);
242
+ registry.register(prCommand);
243
+ registry.register(searchCommand);
244
+ registry.register(briefCommand);
245
+ registry.register(releaseCommand);
246
+ registry.register(startHereCommand);
247
+ registry.register(exploreCommand);
248
+ registry.register(orchestrateCommand);
249
+ registry.register(simulateCommand);
250
+ registry.register(recommendCommand);
251
+ // Adaptive surface introspection + management.
252
+ registry.register(surfaceCommand);
253
+ registry.register(riskCommand);
254
+ registry.register(contractCommand);
255
+ // contract gates — dispatched from inside contractCommand when the
256
+ // first positional is check/approve/status (avoids subcommand-routing
257
+ // collision with the task-string form `shrk contract "<task>"`).
258
+ void contractCheckCommand;
259
+ void contractApproveCommand;
260
+ void contractStatusCommand;
261
+ registry.registerSubcommand('plan', planSimulateCommand);
262
+ // register `plan review` as a proper subcommand so the catalog
263
+ // and registry agree. The internal dispatch in planParentCommand still
264
+ // works (acts as a fallback for direct invocation), but the canonical
265
+ // wire-up is now explicit.
266
+ registry.registerSubcommand('plan', planReviewCommand);
267
+ // `shrk plan check <path>` validates external plans.
268
+ registry.registerSubcommand('plan', planCheckCommand);
269
+ registry.registerSubcommand('memory', memoryBuildCommand);
270
+ registry.registerSubcommand('memory', memoryReportCommand);
271
+ registry.registerSubcommand('memory', memoryRiskCommand);
272
+ registry.registerSubcommand('memory', memoryFilesCommand);
273
+ registry.registerSubcommand('memory', memoryDiagnosticsCommand);
274
+ registry.registerSubcommand('memory', memoryResetCommand);
275
+ registry.registerSubcommand('memory', memoryDiffCommand);
276
+ registry.registerSubcommand('memory', memoryDriftCommand);
277
+ registry.registerSubcommand('memory', memorySnapshotsCommand);
278
+ registry.register(languagesCommand);
279
+ registry.registerSubcommand('docs', docsCheckCommand);
280
+ registry.registerSubcommand('examples', examplesCheckCommand);
281
+ registry.registerSubcommand('self', selfAuditCommand);
282
+ registry.registerSubcommand('install', installSmokeCommand);
283
+ registry.registerSubcommand('diagnostics', diagnosticsListCommand);
284
+ registry.registerSubcommand('architecture', architectureMapCommand);
285
+ registry.registerSubcommand('architecture', architectureViolationsCommand);
286
+ registry.registerSubcommand('architecture', architectureAreaCommand);
287
+ registry.registerSubcommand('reposet', reposetInitCommand);
288
+ registry.registerSubcommand('reposet', reposetListCommand);
289
+ registry.registerSubcommand('reposet', reposetDoctorCommand);
290
+ registry.registerSubcommand('reposet', reposetMapCommand);
291
+ registry.registerSubcommand('upgrade', upgradeCheckCommand);
292
+ registry.registerSubcommand('upgrade', upgradePlanCommand);
293
+ registry.registerSubcommand('boundaries', boundariesListCommand);
294
+ registry.registerSubcommand('boundaries', boundariesGetCommand);
295
+ registry.registerSubcommand('boundaries', boundariesExplainCommand);
296
+ registry.registerSubcommand('boundaries', boundariesInferCommand);
297
+ registry.registerSubcommand('boundaries', boundariesSuggestCommand);
298
+ registry.registerSubcommand('boundaries', boundariesEnforceCommand);
299
+ registry.registerSubcommand('repo', repoAreasCommand);
300
+ registry.registerSubcommand('policy', policyListCommand);
301
+ registry.registerSubcommand('policy', policyGetCommand);
302
+ registry.registerSubcommand('policy', policyTestCommand);
303
+ registry.registerSubcommand('policy', policyRunCommand);
304
+ registry.registerSubcommand('policy', policyCheckCommand);
305
+ registry.registerSubcommand('policy', policySnapshotCommand);
306
+ registry.registerSubcommand('owners', ownersListCommand);
307
+ registry.registerSubcommand('owners', ownersMatchCommand);
308
+ registry.registerSubcommand('owners', ownersImpactCommand);
309
+ registry.registerSubcommand('ownership', ownershipListCommand);
310
+ registry.registerSubcommand('ownership', ownershipForCommand);
311
+ registry.registerSubcommand('ownership', ownershipAffectedCommand);
312
+ registry.registerSubcommand('runtime', runtimeDoctorCommand);
313
+ registry.registerSubcommand('constructs', constructsListCommand);
314
+ registry.registerSubcommand('constructs', constructsGetCommand);
315
+ registry.registerSubcommand('constructs', constructsTraceCommand);
316
+ registry.registerSubcommand('constructs', constructsApiCommand);
317
+ registry.registerSubcommand('constructs', constructsEventsCommand);
318
+ registry.registerSubcommand('constructs', constructsTokensCommand);
319
+ registry.registerSubcommand('constructs', constructsFacetsCommand);
320
+ registry.registerSubcommand('constructs', constructsSearchCommand);
321
+ registry.registerSubcommand('constructs', constructsInferCommand);
322
+ registry.registerSubcommand('constructs', constructsAdoptCommand);
323
+ registry.registerSubcommand('constructs', constructsImpactCommand);
324
+ registry.registerSubcommand('constructs', constructsRelatedCommand);
325
+ registry.registerSubcommand('constructs', constructsFilesCommand);
326
+ registry.registerSubcommand('playbooks', playbooksListCommand);
327
+ registry.registerSubcommand('playbooks', playbooksGetCommand);
328
+ registry.registerSubcommand('playbooks', playbooksRecommendCommand);
329
+ registry.registerSubcommand('playbooks', playbooksRunbookCommand);
330
+ registry.registerSubcommand('playbooks', playbooksBriefCommand);
331
+ registry.registerSubcommand('playbooks', playbooksScriptCommand);
332
+ registry.registerSubcommand('playbooks', playbooksPreviewCommand);
333
+ registry.registerSubcommand('playbooks', playbooksValidateCommand);
334
+ registry.aliasGroup('construct', 'constructs');
335
+ registry.aliasGroup('playbook', 'playbooks');
336
+ registry.registerSubcommand('tests', testsImpactCommand);
337
+ registry.registerSubcommand('tests', testsSuggestCommand);
338
+ registry.registerSubcommand('tests', testsMissingCommand);
339
+ registry.registerSubcommand('git', gitChangedCommand);
340
+ registry.registerSubcommand('git', gitRootCommand);
341
+ registry.registerSubcommand('git', gitBranchCommand);
342
+ registry.registerSubcommand('git', gitStatusSummaryCommand);
343
+ registry.registerSubcommand('templates', templatesLintCommand);
344
+ registry.registerSubcommand('templates', templatesTestCommand);
345
+ registry.registerSubcommand('templates', templatesSnapshotCommand);
346
+ registry.registerSubcommand('knowledge', knowledgeListCommand);
347
+ registry.registerSubcommand('knowledge', knowledgeGetCommand);
348
+ registry.registerSubcommand('knowledge', knowledgeSearchCommand);
349
+ registry.registerSubcommand('knowledge', knowledgeStaleCheckCommand);
350
+ registry.registerSubcommand('knowledge', knowledgeVerifyCommand);
351
+ registry.registerSubcommand('knowledge', knowledgeReferencesCommand);
352
+ registry.registerSubcommand('knowledge', knowledgeAnchorsCommand);
353
+ registry.registerSubcommand('knowledge', knowledgeRenameSymbolCommand);
354
+ registry.registerSubcommand('knowledge', knowledgeRenameFileCommand);
355
+ registry.registerSubcommand('knowledge', knowledgeUpdateAnchorCommand);
356
+ // knowledge authoring preview surface.
357
+ registry.registerSubcommand('knowledge', knowledgeAddCommand);
358
+ registry.registerSubcommand('knowledge', knowledgeUpdateCommand);
359
+ registry.registerSubcommand('knowledge', knowledgeRemoveCommand);
360
+ registry.registerSubcommand('knowledge', knowledgeLintCommand);
361
+ // propose stub entries for uncovered exports (AST-driven).
362
+ registry.registerSubcommand('knowledge', knowledgeProposeCommand);
363
+ registry.registerSubcommand('rules', rulesListCommand);
364
+ registry.registerSubcommand('rules', rulesGetCommand);
365
+ registry.registerSubcommand('rules', rulesRelevantCommand);
366
+ registry.registerSubcommand('rules', rulesScaffoldCommand);
367
+ // `rules update` thin wrapper over knowledge update.
368
+ registry.registerSubcommand('rules', rulesUpdateCommand);
369
+ // authoring symmetry: rules add / rules remove (parity with knowledge).
370
+ registry.registerSubcommand('rules', rulesAddCommand);
371
+ registry.registerSubcommand('rules', rulesRemoveCommand);
372
+ registry.registerSubcommand('rules', rulesDoctorCommand);
373
+ registry.registerSubcommand('rules', rulesLintCommand);
374
+ // custom checks registry.
375
+ registry.registerSubcommand('checks', checksListCommand);
376
+ registry.registerSubcommand('checks', checksDoctorCommand);
377
+ registry.registerSubcommand('checks', checksRunCommand);
378
+ registry.registerSubcommand('checks', checksParseReportCommand);
379
+ // universal check-result protocol.
380
+ registry.registerSubcommand('checks', checksImportCommand);
381
+ registry.registerSubcommand('checks', checksAggregateCommand);
382
+ registry.registerSubcommand('checks', checksReportCommand);
383
+ registry.registerSubcommand('checks', checksConvertCommand);
384
+ // codemod-assist (NOT a codemod engine).
385
+ registry.register(codemodCommand);
386
+ registry.registerSubcommand('paths', pathsListCommand);
387
+ registry.registerSubcommand('paths', pathsGetCommand);
388
+ registry.registerSubcommand('paths', pathsSearchCommand);
389
+ registry.registerSubcommand('paths', pathsBestCommand);
390
+ registry.registerSubcommand('templates', templatesListCommand);
391
+ registry.registerSubcommand('templates', templatesGetCommand);
392
+ registry.registerSubcommand('templates', templatesSearchCommand);
393
+ registry.registerSubcommand('templates', templatesPreviewCommand);
394
+ registry.registerSubcommand('templates', templatesVarsCommand);
395
+ registry.registerSubcommand('templates', templatesDriftCommand);
396
+ registry.registerSubcommand('templates', templatesVerifyPathsCommand);
397
+ registry.registerSubcommand('templates', templatesSmokeCommand);
398
+ // authoring stack: scaffold / add / doctor.
399
+ registry.registerSubcommand('templates', templatesScaffoldCommand);
400
+ registry.registerSubcommand('templates', templatesAddCommand);
401
+ registry.registerSubcommand('templates', templatesDoctorCommand);
402
+ // authoring parity: update / remove.
403
+ registry.registerSubcommand('templates', templatesUpdateCommand);
404
+ registry.registerSubcommand('templates', templatesRemoveCommand);
405
+ registry.registerSubcommand('pipelines', pipelinesListCommand);
406
+ registry.registerSubcommand('pipelines', pipelinesGetCommand);
407
+ registry.registerSubcommand('pipelines', pipelinesContextCommand);
408
+ registry.registerSubcommand('pipelines', pipelinesPlanCommand);
409
+ registry.registerSubcommand('pipelines', pipelinesScriptCommand);
410
+ registry.registerSubcommand('pipelines', pipelinesNextCommand);
411
+ registry.registerSubcommand('pipelines', pipelinesVarsCommand);
412
+ registry.registerSubcommand('packs', packsListCommand);
413
+ registry.registerSubcommand('packs', packsContributionsCommand);
414
+ registry.registerSubcommand('packs', packsConflictsCommand);
415
+ registry.registerSubcommand('packs', packsSignatureStatusCommand);
416
+ registry.registerSubcommand('packs', packsGetCommand);
417
+ registry.registerSubcommand('packs', packsInspectCommand);
418
+ registry.registerSubcommand('packs', packsDoctorCommand);
419
+ registry.registerSubcommand('packs', packsSignCommand);
420
+ registry.registerSubcommand('packs', packsVerifyCommand);
421
+ registry.registerSubcommand('packs', packsNewCommand);
422
+ registry.registerSubcommand('packs', packsTestCommand);
423
+ registry.registerSubcommand('packs', packsReleaseCheckCommand);
424
+ registry.registerSubcommand('packs', packsCompatCommand);
425
+ registry.registerSubcommand('packs', packsDevStatusCommand);
426
+ registry.registerSubcommand('packs', packsWatchCommand);
427
+ // pack authoring moved to a 3-level group: `shrk pack author <verb>`.
428
+ // The old `pack-author <verb>` shape is gone (no backward-compat shim).
429
+ // `shrk packs pending` survives as a convenience for the pending view.
430
+ registry.registerAt(['pack', 'author', packAuthorStatusCommand.name], packAuthorStatusCommand);
431
+ registry.registerAt(['pack', 'author', packAuthorPreviewCommand.name], packAuthorPreviewCommand);
432
+ registry.registerAt(['pack', 'author', packAuthorPendingCommand.name], packAuthorPendingCommand);
433
+ registry.registerAt(['pack', 'author', packAuthorValidateCommand.name], packAuthorValidateCommand);
434
+ registry.registerSubcommand('packs', packAuthorPendingCommand);
435
+ // provenance ledger CLI.
436
+ registry.registerSubcommand('provenance', provenanceListCommand);
437
+ registry.registerSubcommand('provenance', provenanceShowCommand);
438
+ registry.registerSubcommand('provenance', provenanceReportCommand);
439
+ // missing / doctor verbs.
440
+ registry.registerSubcommand('provenance', provenanceMissingCommand);
441
+ registry.registerSubcommand('provenance', provenanceDoctorCommand);
442
+ registry.registerSubcommand('schemas', schemasListCommand);
443
+ registry.registerSubcommand('schemas', schemasGetCommand);
444
+ registry.registerSubcommand('schemas', schemasInventoryCommand);
445
+ registry.registerSubcommand('schemas', schemasWriteCommand);
446
+ // preview-first emission + preflight drift check.
447
+ registry.registerSubcommand('schemas', schemasEmitCommand);
448
+ registry.registerSubcommand('scaffolds', scaffoldsListCommand);
449
+ registry.registerSubcommand('scaffolds', scaffoldsGetCommand);
450
+ registry.registerSubcommand('scaffolds', scaffoldsDoctorCommand);
451
+ registry.registerSubcommand('presets', presetsListCommand);
452
+ registry.registerSubcommand('presets', presetsGetCommand);
453
+ registry.registerSubcommand('presets', presetsExplainCommand);
454
+ registry.registerSubcommand('presets', presetsRecommendCommand);
455
+ registry.registerSubcommand('presets', presetsPreviewCommand);
456
+ registry.registerSubcommand('presets', presetsApplyCommand);
457
+ registry.registerSubcommand('presets', presetsDoctorCommand);
458
+ registry.registerSubcommand('presets', presetsDiffCommand);
459
+ registry.registerSubcommand('presets', presetsPatchCommand);
460
+ // release subcommand additions — register under 'release' group via 'train'.
461
+ // We pass 'train' as the canonical name; users invoke `shrk release train <verb>`.
462
+ // Convenience aliases so users can say either form.
463
+ registry.aliasGroup('pipeline', 'pipelines');
464
+ registry.aliasGroup('schema', 'schemas');
465
+ registry.aliasGroup('preset', 'presets');
466
+ registry.aliasGroup('scaffold', 'scaffolds');
467
+ const help = makeHelpCommand(registry);
468
+ registry.register(help);
469
+ return registry;
470
+ }
471
+ export async function runCli(argv) {
472
+ const usageStart = performance.now();
473
+ const { cwd: probeCwd, rest: probeArgv } = extractGlobalCwd(argv);
474
+ let exitCode = 0;
475
+ try {
476
+ exitCode = await runCliInner(argv);
477
+ return exitCode;
478
+ }
479
+ finally {
480
+ // append one local usage entry. Failure is silent.
481
+ try {
482
+ const command = extractCommandPath(probeArgv);
483
+ if (command.length > 0) {
484
+ const flags = sanitizeFlagNames(probeArgv);
485
+ const enabled = await isUsageEnabled(probeCwd ?? process.cwd());
486
+ recordUsage({
487
+ cwd: probeCwd ?? process.cwd(),
488
+ command,
489
+ exitCode,
490
+ durationMs: performance.now() - usageStart,
491
+ flags,
492
+ enabled,
493
+ });
494
+ }
495
+ }
496
+ catch {
497
+ // ignore — usage log must never fail the CLI
498
+ }
499
+ }
500
+ }
501
+ /**
502
+ * Resolve whether the local usage log is enabled. Order:
503
+ * 1. `SHARKCRAFT_USAGE_DISABLED=1` env → false (disabled).
504
+ * 2. `sharkcraft.config.ts usage.enabled === false` → false.
505
+ * 3. Otherwise → true.
506
+ */
507
+ async function isUsageEnabled(cwd) {
508
+ if (process.env.SHARKCRAFT_USAGE_DISABLED === '1')
509
+ return false;
510
+ try {
511
+ const result = await loadProjectConfig(cwd);
512
+ if (!result.ok)
513
+ return true;
514
+ return result.value.config.usage?.enabled !== false;
515
+ }
516
+ catch {
517
+ return true;
518
+ }
519
+ }
520
+ async function runCliInner(argv) {
521
+ await ensureTokenizerReady();
522
+ const registry = buildRegistry();
523
+ // Pre-parse the global --cwd so it can appear anywhere (incl. before the command).
524
+ const { cwd: globalCwd, rest: cleanArgv } = extractGlobalCwd(argv);
525
+ if (globalCwd !== undefined && !isUsableDirectory(globalCwd)) {
526
+ process.stderr.write(`error: --cwd "${globalCwd}" is not an existing directory.\n` +
527
+ `Resolved to: ${resolvePath(globalCwd)}\n`);
528
+ return 2;
529
+ }
530
+ const [first] = cleanArgv;
531
+ // bare invocation lands on the curated tiered view.
532
+ if (!first) {
533
+ const landing = await renderNoArgsLanding(globalCwd ?? process.cwd());
534
+ process.stdout.write(landing);
535
+ return 0;
536
+ }
537
+ // Top-level meta flags.
538
+ if (first === '--help' || first === '-h') {
539
+ return registry.get('help').run(parseArgs([], { globalCwd }));
540
+ }
541
+ if (first === '--full-help') {
542
+ return registry.get('help').run(parseArgs(['--full'], { globalCwd }));
543
+ }
544
+ if (first === '--version' || first === '-v') {
545
+ return registry.get('version').run(parseArgs([], { globalCwd }));
546
+ }
547
+ // `shrk --about` prints the in-binary philosophy summary.
548
+ if (first === '--about') {
549
+ process.stdout.write(renderAbout());
550
+ return 0;
551
+ }
552
+ // greedy trie descent. Handles 1-, 2-, and 3-level commands uniformly
553
+ // (`shrk doctor`, `shrk packs list`, `shrk pack author status`). The
554
+ // resolver stops when it hits a flag or a token that isn't a child of the
555
+ // current node, returning the deepest handler + the leftover tokens.
556
+ const { handler, matchedPath, rest: leftover, node } = registry.resolve(cleanArgv);
557
+ // `--help` / `-h` immediately after a (sub)group → render help for that
558
+ // path. This works at any depth.
559
+ if (leftover[0] === '--help' || leftover[0] === '-h') {
560
+ return registry.get('help').run(parseArgs([matchedPath.join(' ')], { globalCwd }));
561
+ }
562
+ if (handler) {
563
+ // gate experimental commands. Bootstrap commands and core/extended
564
+ // tiers pass through; experimental commands return the structured
565
+ // not-enabled error unless `surface.enabled[]` contains them.
566
+ const gateReason = await checkSurfaceGate(matchedPath, globalCwd ?? process.cwd());
567
+ if (gateReason) {
568
+ const err = makeSurfaceNotEnabledError(gateReason.command, { reason: gateReason.detail });
569
+ process.stderr.write(renderSurfaceNotEnabledText(err));
570
+ return SURFACE_NOT_ENABLED_EXIT_CODE;
571
+ }
572
+ return await handler.run(parseArgs(leftover, { globalCwd }));
573
+ }
574
+ // No handler at the deepest match. If we landed on a group node (has
575
+ // children), show that group's help so the user discovers the verbs.
576
+ if (matchedPath.length > 0 && node.children.size > 0) {
577
+ return registry.get('help').run(parseArgs([matchedPath.join(' ')], { globalCwd }));
578
+ }
579
+ // Genuinely unknown — fall back to free-form / did-you-mean.
580
+ const probe = cleanArgv.filter((t) => typeof t === 'string' && t.length > 0 && !t.startsWith('-'));
581
+ if (looksLikeFreeFormTask(probe)) {
582
+ printFreeFormTaskHint(probe.join(' '));
583
+ return 2;
584
+ }
585
+ const attempted = probe.slice(0, 2).join(' ');
586
+ process.stderr.write(`Unknown command: ${attempted}\n`);
587
+ printDidYouMean(attempted);
588
+ return 2;
589
+ }
590
+ /**
591
+ * Heuristic for "this looks like a task, not a command".
592
+ *
593
+ * - At least two non-flag tokens (commands have at most two tokens: a
594
+ * top-level + a subcommand verb).
595
+ * - Or one token that matches a known free-form verb (rename / add / fix /
596
+ * refactor / remove / migrate / implement / update / build / …).
597
+ * - Never matches `--`-prefixed flag tokens.
598
+ *
599
+ * The function is deterministic and accepts only positional tokens.
600
+ * Exported for tests.
601
+ */
602
+ export function looksLikeFreeFormTask(tokens) {
603
+ const clean = tokens.filter((t) => t.length > 0 && !t.startsWith('-'));
604
+ if (clean.length < 2)
605
+ return false;
606
+ // 3+ tokens is almost always a sentence, not a command — `shrk` only has
607
+ // 2 levels (top + sub), so anything beyond that has no chance of being a
608
+ // real path.
609
+ if (clean.length >= 3)
610
+ return true;
611
+ // 2 tokens: only treat as a task if the first token is a recognisable
612
+ // task verb. Otherwise it's plausibly a typo of a subcommand and we let
613
+ // the regular did-you-mean handle it.
614
+ const verbs = new Set([
615
+ 'rename',
616
+ 'add',
617
+ 'fix',
618
+ 'refactor',
619
+ 'remove',
620
+ 'delete',
621
+ 'migrate',
622
+ 'wire',
623
+ 'create',
624
+ 'implement',
625
+ 'update',
626
+ 'introduce',
627
+ 'build',
628
+ 'extract',
629
+ 'move',
630
+ 'inline',
631
+ 'generate',
632
+ 'scaffold',
633
+ 'explain',
634
+ 'document',
635
+ 'review',
636
+ 'test',
637
+ 'design',
638
+ 'refresh',
639
+ 'reorganise',
640
+ 'reorganize',
641
+ 'restructure',
642
+ 'split',
643
+ 'merge',
644
+ 'reduce',
645
+ 'simplify',
646
+ ]);
647
+ return verbs.has(clean[0].toLowerCase());
648
+ }
649
+ function printFreeFormTaskHint(task) {
650
+ process.stderr.write(`\nThis looks like a task, not a command.\n` +
651
+ `\n` +
652
+ `Recommended:\n` +
653
+ ` $ shrk recommend "${task}"\n` +
654
+ `\n` +
655
+ `Why:\n` +
656
+ ` \`shrk recommend\` is the canonical human entrypoint for "what should I do?".\n` +
657
+ `\n` +
658
+ `More detail:\n` +
659
+ ` $ shrk start-here\n` +
660
+ ` $ shrk commands\n`);
661
+ }
662
+ /**
663
+ * Check whether the resolved command path is gated by the
664
+ * surface tier model. Returns `null` if the command is callable
665
+ * (core/extended), or `{ command, detail }` if it is an experimental
666
+ * command not enabled in the current repo's surface config.
667
+ *
668
+ * Failure-soft: any error loading the inspection (fresh repo, no
669
+ * config, etc.) lets the command through. The gate must NEVER false-
670
+ * positive a bootstrap call — the bootstrap set in `tier.ts` plus
671
+ * spine-derived core commands always pass through cleanly.
672
+ */
673
+ async function checkSurfaceGate(matchedPath, cwd) {
674
+ const candidate = matchedPath.join(' ');
675
+ if (candidate.length === 0)
676
+ return null;
677
+ try {
678
+ const { context } = await loadSurfaceContext({ cwd });
679
+ const summary = buildSurfaceSummary(context);
680
+ // Try the full path first; fall back to the top-level token. The
681
+ // catalog uses both shapes ("doctor" and "plan review").
682
+ const view = findCommandInSummary(summary, candidate) ??
683
+ findCommandInSummary(summary, matchedPath[0] ?? '');
684
+ if (!view)
685
+ return null;
686
+ if (view.callable)
687
+ return null;
688
+ return { command: view.command, detail: view.detail };
689
+ }
690
+ catch {
691
+ return null;
692
+ }
693
+ }
694
+ function printDidYouMean(attempted) {
695
+ const candidates = suggestDidYouMean(COMMAND_CATALOG, [attempted], 3);
696
+ if (candidates.length === 0) {
697
+ process.stderr.write("Tip: run `shrk commands suggest \"<partial>\"` or `shrk help` to discover commands.\n");
698
+ const footer = errorFooterFor('unknown-command', { task: attempted });
699
+ if (footer)
700
+ process.stderr.write(renderErrorFooter(footer));
701
+ return;
702
+ }
703
+ process.stderr.write('Did you mean:\n');
704
+ for (const c of candidates) {
705
+ process.stderr.write(` shrk ${c.command} — ${c.description}\n`);
706
+ }
707
+ // append the standardised next-command footer so the user
708
+ // always has a deterministic exit route.
709
+ const footer = errorFooterFor('unknown-command', { task: attempted });
710
+ if (footer)
711
+ process.stderr.write(renderErrorFooter(footer));
712
+ }
713
+ // Entry point when invoked directly.
714
+ const isMain = typeof import.meta !== 'undefined' && import.meta.main === true;
715
+ if (isMain || process.argv[1]?.endsWith('main.ts') || process.argv[1]?.endsWith('shrk')) {
716
+ const argv = process.argv.slice(2);
717
+ runCli(argv).then((code) => process.exit(code), (err) => {
718
+ process.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}\n`);
719
+ process.exit(1);
720
+ });
721
+ }