@shrkcrft/cli 0.1.0-alpha.2

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 +314 -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 +553 -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 +3242 -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 +681 -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 +127 -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 +301 -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 +74 -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 +650 -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 +958 -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 +354 -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 +699 -0
  393. package/dist/output/failure-hints.d.ts +55 -0
  394. package/dist/output/failure-hints.d.ts.map +1 -0
  395. package/dist/output/failure-hints.js +159 -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 +53 -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 +36 -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 +73 -0
@@ -0,0 +1,100 @@
1
+ /**
2
+ * IDs of pipelines treated as the "spine" — pipelines whose
3
+ * referenced commands are tier=Core regardless of any other catalog
4
+ * derivation rule.
5
+ *
6
+ * Today only `engine.feature-dev` exists in the engine repo.
7
+ * `engine.safe-generation` is a planned second spine pipeline; if a
8
+ * project ships it, it's automatically picked up here.
9
+ */
10
+ export const SPINE_PIPELINE_IDS = Object.freeze([
11
+ 'engine.feature-dev',
12
+ 'engine.safe-generation',
13
+ ]);
14
+ /**
15
+ * Verbs the spine derivation is allowed to promote to core. The
16
+ * spine pipelines reference write verbs (`apply`, `gen`, `plan
17
+ * review`) too, but those are power-user surfaces; letting them
18
+ * drift into core inflates the "brutally small" promise. Anything
19
+ * outside this allowlist stays tier=extended even when the spine
20
+ * references it.
21
+ */
22
+ const CORE_SPINE_VERB_ALLOWLIST = new Set([
23
+ 'context',
24
+ 'check boundaries',
25
+ ]);
26
+ /**
27
+ * Extract the catalog command names referenced from spine
28
+ * pipelines AND in the core verb allowlist. The function does NOT
29
+ * execute any pipeline — it walks `steps[].cliCommands[]` and parses
30
+ * out the verb path.
31
+ *
32
+ * Parsing rule: each `cliCommands` entry is a shell-style string like
33
+ * `bun run shrk plan review /tmp/plan.json`. The parser strips a
34
+ * leading `bun run shrk` or `shrk` and returns the first 1-2 tokens
35
+ * as a command path. Multi-token paths are joined with a space so
36
+ * they match {@link ICommandCatalogEntry.command} entries that already
37
+ * use this form (`pack author status`, `plan review`).
38
+ */
39
+ export function extractSpineCommands(pipelines) {
40
+ const out = new Set();
41
+ const spineIds = new Set(SPINE_PIPELINE_IDS);
42
+ for (const pipeline of pipelines) {
43
+ if (!spineIds.has(pipeline.id))
44
+ continue;
45
+ for (const step of pipeline.steps ?? []) {
46
+ for (const raw of step.cliCommands ?? []) {
47
+ const verb = parseCommandVerb(raw);
48
+ if (verb && CORE_SPINE_VERB_ALLOWLIST.has(verb))
49
+ out.add(verb);
50
+ }
51
+ }
52
+ }
53
+ return out;
54
+ }
55
+ /**
56
+ * Parse a single CLI command string into its catalog `command`
57
+ * path. Returns `undefined` if the string doesn't reference shrk.
58
+ *
59
+ * Examples:
60
+ * `bun run shrk doctor` → `doctor`
61
+ * `bun run shrk plan review /tmp/plan.json` → `plan review`
62
+ * `bun run shrk pack author status` → `pack author status`
63
+ * `bun run shrk context --task "<task>"` → `context`
64
+ * `bun x tsc` → undefined
65
+ */
66
+ export function parseCommandVerb(raw) {
67
+ let tokens = raw.trim().split(/\s+/);
68
+ if (tokens.length === 0)
69
+ return undefined;
70
+ // Drop leading `bun run` / `npx` / `pnpm exec` wrappers.
71
+ const wrappers = new Set(['bun', 'npx', 'pnpm', 'yarn']);
72
+ if (wrappers.has(tokens[0])) {
73
+ tokens = tokens.slice(1);
74
+ if (tokens[0] === 'run' || tokens[0] === 'exec' || tokens[0] === 'x') {
75
+ tokens = tokens.slice(1);
76
+ }
77
+ }
78
+ // Drop the `shrk` binary name.
79
+ if (tokens[0] !== 'shrk')
80
+ return undefined;
81
+ tokens = tokens.slice(1);
82
+ // Stop at the first flag, placeholder (`<...>`), path-looking arg
83
+ // (`/tmp/...`, `./...`), or quoted-string arg. Placeholders +
84
+ // positional args inflate the verb path so we exclude them.
85
+ const verbTokens = [];
86
+ for (const t of tokens) {
87
+ if (t.startsWith('-'))
88
+ break;
89
+ if (t.startsWith('<') || t.endsWith('>'))
90
+ break;
91
+ if (t.startsWith('/') || t.startsWith('./') || t.startsWith('../'))
92
+ break;
93
+ if (t.startsWith('"') || t.startsWith("'"))
94
+ break;
95
+ verbTokens.push(t);
96
+ }
97
+ if (verbTokens.length === 0)
98
+ return undefined;
99
+ return verbTokens.join(' ');
100
+ }
@@ -0,0 +1,59 @@
1
+ import type { ISurfaceConfig } from '@shrkcrft/config';
2
+ export interface ISurfaceConfigEdit {
3
+ /** What changed. */
4
+ field: 'enabled' | 'hidden';
5
+ /** Command name that was added/removed. */
6
+ command: string;
7
+ /** Operation. */
8
+ operation: 'add' | 'remove';
9
+ }
10
+ export interface ISurfaceConfigDiff {
11
+ configFile: string;
12
+ before: ISurfaceConfig;
13
+ after: ISurfaceConfig;
14
+ edits: readonly ISurfaceConfigEdit[];
15
+ /** Suggested next-command if the user wants to apply. */
16
+ nextCommand: string;
17
+ }
18
+ export interface ISurfaceConfigWriteResult {
19
+ configFile: string;
20
+ edits: readonly ISurfaceConfigEdit[];
21
+ /** Whether the file existed before the write. */
22
+ fileExisted: boolean;
23
+ }
24
+ /**
25
+ * Mutate the `surface.enabled[]` array in
26
+ * `sharkcraft.config.ts`. Preview-first: the caller computes the diff
27
+ * via {@link planSurfaceEdit} and only applies it via
28
+ * {@link applySurfaceEdit} when `--write` is passed.
29
+ */
30
+ export declare function planSurfaceEdit(configFile: string, before: ISurfaceConfig | undefined, edits: readonly ISurfaceConfigEdit[]): ISurfaceConfigDiff;
31
+ /**
32
+ * Apply a previously-planned surface edit to the config file.
33
+ *
34
+ * Strategy:
35
+ * 1. Read the config file as text.
36
+ * 2. If a `surface:` block exists, replace it.
37
+ * 3. Otherwise, append it before the final `})` / `});` of the
38
+ * default-exported config object.
39
+ *
40
+ * The mutator is intentionally text-based (not AST). The config shape
41
+ * is small and the surface block is well-defined; an AST pass would
42
+ * add complexity for no extra correctness. Unit tests lock the behavior.
43
+ */
44
+ export declare function applySurfaceEdit(diff: ISurfaceConfigDiff): ISurfaceConfigWriteResult;
45
+ /**
46
+ * Render the surface block as a TS object literal.
47
+ */
48
+ export declare function renderSurfaceBlock(surface: ISurfaceConfig, indent?: string): string;
49
+ /**
50
+ * Compute the new file body given the desired surface block.
51
+ *
52
+ * If the file already has a `surface: { ... }` block, replace it.
53
+ * Otherwise, insert before the closing `})` / `});` of the config
54
+ * literal.
55
+ */
56
+ export declare function applySurfaceTextEdit(original: string, surface: ISurfaceConfig): string;
57
+ /** Default config file path for a project. */
58
+ export declare function defaultConfigFile(sharkcraftDir: string): string;
59
+ //# sourceMappingURL=surface-config-writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface-config-writer.d.ts","sourceRoot":"","sources":["../../src/surface/surface-config-writer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,SAAS,EAAE,KAAK,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,cAAc,CAAC;IACtB,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrC,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrC,iDAAiD;IACjD,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,KAAK,EAAE,SAAS,kBAAkB,EAAE,GACnC,kBAAkB,CA0BpB;AAOD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,kBAAkB,GACvB,yBAAyB,CAe3B;AAmBD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAO,GAAG,MAAM,CAsBjF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CAgBtF;AAED,8CAA8C;AAC9C,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAE/D"}
@@ -0,0 +1,135 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+ import * as nodePath from 'node:path';
3
+ /**
4
+ * Mutate the `surface.enabled[]` array in
5
+ * `sharkcraft.config.ts`. Preview-first: the caller computes the diff
6
+ * via {@link planSurfaceEdit} and only applies it via
7
+ * {@link applySurfaceEdit} when `--write` is passed.
8
+ */
9
+ export function planSurfaceEdit(configFile, before, edits) {
10
+ const beforeNormalised = {
11
+ enabled: [...(before?.enabled ?? [])],
12
+ hidden: [...(before?.hidden ?? [])],
13
+ };
14
+ const afterEnabled = new Set(beforeNormalised.enabled ?? []);
15
+ const afterHidden = new Set(beforeNormalised.hidden ?? []);
16
+ for (const edit of edits) {
17
+ const target = edit.field === 'enabled' ? afterEnabled : afterHidden;
18
+ if (edit.operation === 'add')
19
+ target.add(edit.command);
20
+ else
21
+ target.delete(edit.command);
22
+ }
23
+ const after = {
24
+ enabled: [...afterEnabled].sort(),
25
+ hidden: [...afterHidden].sort(),
26
+ };
27
+ return {
28
+ configFile,
29
+ before: beforeNormalised,
30
+ after,
31
+ edits,
32
+ nextCommand: edits.length > 0 ? edits.map((e) => describeEdit(e)).join(', ') : '(no-op)',
33
+ };
34
+ }
35
+ function describeEdit(edit) {
36
+ const verb = edit.operation === 'add' ? '+' : '-';
37
+ return `${verb} surface.${edit.field}: ${edit.command}`;
38
+ }
39
+ /**
40
+ * Apply a previously-planned surface edit to the config file.
41
+ *
42
+ * Strategy:
43
+ * 1. Read the config file as text.
44
+ * 2. If a `surface:` block exists, replace it.
45
+ * 3. Otherwise, append it before the final `})` / `});` of the
46
+ * default-exported config object.
47
+ *
48
+ * The mutator is intentionally text-based (not AST). The config shape
49
+ * is small and the surface block is well-defined; an AST pass would
50
+ * add complexity for no extra correctness. Unit tests lock the behavior.
51
+ */
52
+ export function applySurfaceEdit(diff) {
53
+ if (diff.edits.length === 0) {
54
+ return { configFile: diff.configFile, edits: [], fileExisted: true };
55
+ }
56
+ const fileExisted = fileExists(diff.configFile);
57
+ const original = fileExisted ? readFileSync(diff.configFile, 'utf8') : DEFAULT_CONFIG_BODY;
58
+ const updated = applySurfaceTextEdit(original, diff.after);
59
+ writeFileSync(diff.configFile, updated, 'utf8');
60
+ return {
61
+ configFile: diff.configFile,
62
+ edits: diff.edits,
63
+ fileExisted,
64
+ };
65
+ }
66
+ function fileExists(p) {
67
+ try {
68
+ readFileSync(p, 'utf8');
69
+ return true;
70
+ }
71
+ catch {
72
+ return false;
73
+ }
74
+ }
75
+ const DEFAULT_CONFIG_BODY = `import { defineSharkCraftConfig } from '@shrkcrft/config';
76
+
77
+ export default defineSharkCraftConfig({
78
+ });
79
+ `;
80
+ const SURFACE_BLOCK_REGEX = /(^\s*surface\s*:\s*\{[\s\S]*?\}\s*,?\s*\n)/m;
81
+ /**
82
+ * Render the surface block as a TS object literal.
83
+ */
84
+ export function renderSurfaceBlock(surface, indent = ' ') {
85
+ const lines = [];
86
+ lines.push(`${indent}surface: {`);
87
+ if (surface.profile) {
88
+ lines.push(`${indent} profile: ${JSON.stringify(surface.profile)},`);
89
+ }
90
+ if (surface.enabled && surface.enabled.length > 0) {
91
+ lines.push(`${indent} enabled: [`);
92
+ for (const name of surface.enabled)
93
+ lines.push(`${indent} ${JSON.stringify(name)},`);
94
+ lines.push(`${indent} ],`);
95
+ }
96
+ else {
97
+ lines.push(`${indent} enabled: [],`);
98
+ }
99
+ if (surface.hidden && surface.hidden.length > 0) {
100
+ lines.push(`${indent} hidden: [`);
101
+ for (const name of surface.hidden)
102
+ lines.push(`${indent} ${JSON.stringify(name)},`);
103
+ lines.push(`${indent} ],`);
104
+ }
105
+ else {
106
+ lines.push(`${indent} hidden: [],`);
107
+ }
108
+ lines.push(`${indent}},`);
109
+ return lines.join('\n') + '\n';
110
+ }
111
+ /**
112
+ * Compute the new file body given the desired surface block.
113
+ *
114
+ * If the file already has a `surface: { ... }` block, replace it.
115
+ * Otherwise, insert before the closing `})` / `});` of the config
116
+ * literal.
117
+ */
118
+ export function applySurfaceTextEdit(original, surface) {
119
+ const block = renderSurfaceBlock(surface);
120
+ if (SURFACE_BLOCK_REGEX.test(original)) {
121
+ return original.replace(SURFACE_BLOCK_REGEX, block);
122
+ }
123
+ // Insert before the closing `})` / `});` of the config object.
124
+ // Prefer the last `})` so nested objects don't trip us up.
125
+ const closeRegex = /(\n)(\}\)\s*;?\s*)$/m;
126
+ if (closeRegex.test(original)) {
127
+ return original.replace(closeRegex, `\n${block}$2`);
128
+ }
129
+ // Fallback: append at end with a defineSharkCraftConfig wrapper.
130
+ return `${original}\n${DEFAULT_CONFIG_BODY.replace('})', `${block}})`)}`;
131
+ }
132
+ /** Default config file path for a project. */
133
+ export function defaultConfigFile(sharkcraftDir) {
134
+ return nodePath.join(sharkcraftDir, 'sharkcraft.config.ts');
135
+ }
@@ -0,0 +1,66 @@
1
+ import { CommandTier, type ICommandCatalogEntry } from '../commands/command-catalog.js';
2
+ import { TierSource, type ITierResolution, type ITierResolverContext } from './tier.js';
3
+ export declare const SURFACE_SUMMARY_SCHEMA = "sharkcraft.surface.v1";
4
+ /** Per-command snapshot used in {@link ISurfaceSummary}. */
5
+ export interface ISurfaceCommandView {
6
+ command: string;
7
+ tier: CommandTier;
8
+ source: TierSource;
9
+ detail?: string;
10
+ /** Whether the command is callable in this project's surface configuration. */
11
+ callable: boolean;
12
+ /** Whether the command shows in default `--help` output. */
13
+ visibleInHelp: boolean;
14
+ /** True if `surface.hidden[]` contains the command. */
15
+ hidden: boolean;
16
+ /** True if `surface.enabled[]` contains the command. */
17
+ enabled: boolean;
18
+ /** Pack contribution source, if any. */
19
+ pack?: string;
20
+ }
21
+ export interface ISurfaceTotals {
22
+ core: number;
23
+ extended: number;
24
+ experimental: number;
25
+ /** Sum of (core + extended visibleInHelp). */
26
+ visible: number;
27
+ /** Sum of all callable commands (core + extended). */
28
+ callable: number;
29
+ }
30
+ export interface ISurfaceSummary {
31
+ schema: typeof SURFACE_SUMMARY_SCHEMA;
32
+ tiers: {
33
+ core: readonly ISurfaceCommandView[];
34
+ extended: readonly ISurfaceCommandView[];
35
+ experimental: readonly ISurfaceCommandView[];
36
+ };
37
+ totals: ISurfaceTotals;
38
+ /**
39
+ * Warnings — e.g. a `surface.enabled` entry that doesn't match any
40
+ * catalog command, or an attempt to hide a core command.
41
+ */
42
+ warnings: readonly ISurfaceWarning[];
43
+ /** Stable hash of (catalog + context). Used in test snapshots. */
44
+ hash: string;
45
+ }
46
+ export interface ISurfaceWarning {
47
+ command: string;
48
+ code: 'unknown-command' | 'cannot-hide-core' | 'cannot-disable-core' | 'enable-noop' | 'tier-override-conflict';
49
+ message: string;
50
+ }
51
+ /**
52
+ * Build the canonical surface summary used by `shrk surface list`
53
+ * (text + JSON), the `--about` landing, the help renderer's hidden-set,
54
+ * and the MCP gating layer.
55
+ *
56
+ * Implementation note: deterministic. Same context + catalog → same
57
+ * summary, byte-for-byte. The `hash` field is the SHA-256 prefix of
58
+ * the canonical JSON form (sans the hash itself) — useful for cache
59
+ * keys and snapshot tests.
60
+ */
61
+ export declare function buildSurfaceSummary(context: ITierResolverContext): ISurfaceSummary;
62
+ /** Look up a single command's tier resolution from a summary. */
63
+ export declare function findCommandInSummary(summary: ISurfaceSummary, command: string): ISurfaceCommandView | undefined;
64
+ /** Resolve a single tier given a context (no summary needed). */
65
+ export declare function resolveTierForCommand(entry: ICommandCatalogEntry, context: ITierResolverContext): ITierResolution;
66
+ //# sourceMappingURL=surface-summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface-summary.d.ts","sourceRoot":"","sources":["../../src/surface/surface-summary.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EAGX,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAKL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC1B,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,sBAAsB,0BAA0B,CAAC;AAE9D,4DAA4D;AAC5D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,QAAQ,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,aAAa,EAAE,OAAO,CAAC;IACvB,uDAAuD;IACvD,MAAM,EAAE,OAAO,CAAC;IAChB,wDAAwD;IACxD,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,sBAAsB,CAAC;IACtC,KAAK,EAAE;QACL,IAAI,EAAE,SAAS,mBAAmB,EAAE,CAAC;QACrC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;QACzC,YAAY,EAAE,SAAS,mBAAmB,EAAE,CAAC;KAC9C,CAAC;IACF,MAAM,EAAE,cAAc,CAAC;IACvB;;;OAGG;IACH,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IACrC,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,qBAAqB,GAAG,aAAa,GAAG,wBAAwB,CAAC;IAChH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,GAC5B,eAAe,CAoFjB;AAkFD,iEAAiE;AACjE,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,MAAM,GACd,mBAAmB,GAAG,SAAS,CAMjC;AAED,iEAAiE;AACjE,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,oBAAoB,GAC5B,eAAe,CAEjB"}
@@ -0,0 +1,162 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { CommandTier, COMMAND_CATALOG, defaultShowInHelp, } from "../commands/command-catalog.js";
3
+ import { BOOTSTRAP_COMMANDS, isCallable, isVisibleInDefaultHelp, resolveTier, TierSource, } from "./tier.js";
4
+ export const SURFACE_SUMMARY_SCHEMA = 'sharkcraft.surface.v1';
5
+ /**
6
+ * Build the canonical surface summary used by `shrk surface list`
7
+ * (text + JSON), the `--about` landing, the help renderer's hidden-set,
8
+ * and the MCP gating layer.
9
+ *
10
+ * Implementation note: deterministic. Same context + catalog → same
11
+ * summary, byte-for-byte. The `hash` field is the SHA-256 prefix of
12
+ * the canonical JSON form (sans the hash itself) — useful for cache
13
+ * keys and snapshot tests.
14
+ */
15
+ export function buildSurfaceSummary(context) {
16
+ const core = [];
17
+ const extended = [];
18
+ const experimental = [];
19
+ const warnings = [];
20
+ const hiddenSet = new Set(context.surfaceConfig?.hidden ?? []);
21
+ const enabledSet = new Set(context.surfaceConfig?.enabled ?? []);
22
+ const knownCommands = new Set();
23
+ for (const entry of COMMAND_CATALOG) {
24
+ knownCommands.add(entry.command);
25
+ const view = makeCommandView(entry, context, hiddenSet, enabledSet, warnings);
26
+ pushIntoBucket(view, core, extended, experimental);
27
+ }
28
+ // Surface bootstrap meta-flags (e.g. `--about`) that aren't
29
+ // ordinary catalog entries. They sit in core for visibility but have
30
+ // no catalog row.
31
+ for (const bootstrap of BOOTSTRAP_COMMANDS) {
32
+ if (knownCommands.has(bootstrap))
33
+ continue;
34
+ core.push({
35
+ command: bootstrap,
36
+ tier: CommandTier.Core,
37
+ source: TierSource.Bootstrap,
38
+ detail: 'bootstrap meta-flag',
39
+ callable: true,
40
+ visibleInHelp: true,
41
+ hidden: false,
42
+ enabled: false,
43
+ });
44
+ }
45
+ // Sort each bucket alphabetically for stable output.
46
+ const sortByName = (a, b) => a.command.localeCompare(b.command);
47
+ core.sort(sortByName);
48
+ extended.sort(sortByName);
49
+ experimental.sort(sortByName);
50
+ // Audit warnings for config keys that don't correspond to anything.
51
+ for (const name of enabledSet) {
52
+ if (!knownCommands.has(name) && !BOOTSTRAP_COMMANDS.includes(name)) {
53
+ warnings.push({
54
+ command: name,
55
+ code: 'unknown-command',
56
+ message: `surface.enabled[] references unknown command: ${name}`,
57
+ });
58
+ }
59
+ }
60
+ for (const name of hiddenSet) {
61
+ if (!knownCommands.has(name) && !BOOTSTRAP_COMMANDS.includes(name)) {
62
+ warnings.push({
63
+ command: name,
64
+ code: 'unknown-command',
65
+ message: `surface.hidden[] references unknown command: ${name}`,
66
+ });
67
+ }
68
+ }
69
+ const totals = {
70
+ core: core.length,
71
+ extended: extended.length,
72
+ experimental: experimental.length,
73
+ visible: core.length + extended.filter((c) => c.visibleInHelp).length,
74
+ callable: core.length +
75
+ extended.length +
76
+ experimental.filter((c) => c.callable).length,
77
+ };
78
+ const summaryWithoutHash = {
79
+ schema: SURFACE_SUMMARY_SCHEMA,
80
+ tiers: { core, extended, experimental },
81
+ totals,
82
+ warnings,
83
+ };
84
+ const hash = createHash('sha256')
85
+ .update(JSON.stringify(summaryWithoutHash))
86
+ .digest('hex')
87
+ .slice(0, 16);
88
+ return { ...summaryWithoutHash, hash };
89
+ }
90
+ function makeCommandView(entry, context, hiddenSet, enabledSet, warnings) {
91
+ const resolution = resolveTier(entry, context);
92
+ const isHidden = hiddenSet.has(entry.command);
93
+ const isEnabled = enabledSet.has(entry.command);
94
+ // Cross-check the config against the derived tier.
95
+ if (resolution.tier === CommandTier.Core) {
96
+ if (isHidden) {
97
+ warnings.push({
98
+ command: entry.command,
99
+ code: 'cannot-hide-core',
100
+ message: `Cannot hide core command: ${entry.command}. Remove from surface.hidden.`,
101
+ });
102
+ }
103
+ if (isEnabled) {
104
+ // Enabling a core command is harmless but pointless.
105
+ warnings.push({
106
+ command: entry.command,
107
+ code: 'enable-noop',
108
+ message: `Enabling a core command is a no-op: ${entry.command}`,
109
+ });
110
+ }
111
+ }
112
+ // Cross-check explicit override against the resolver. If the catalog
113
+ // says Experimental but the resolver promoted to Core (spine /
114
+ // bootstrap), surface a warning so the override is corrected.
115
+ if (entry.tier !== undefined &&
116
+ entry.tier !== resolution.tier &&
117
+ resolution.source !== TierSource.Override) {
118
+ warnings.push({
119
+ command: entry.command,
120
+ code: 'tier-override-conflict',
121
+ message: `Catalog declares tier=${entry.tier} but mechanical derivation resolved to ${resolution.tier} (${resolution.source}). Remove the override.`,
122
+ });
123
+ }
124
+ const view = {
125
+ command: entry.command,
126
+ tier: resolution.tier,
127
+ source: resolution.source,
128
+ callable: isCallable(resolution),
129
+ visibleInHelp: isVisibleInDefaultHelp(resolution, isHidden) && defaultShowInHelp(entry),
130
+ hidden: isHidden,
131
+ enabled: isEnabled,
132
+ };
133
+ if (resolution.detail)
134
+ view.detail = resolution.detail;
135
+ const pack = context.packContributions.get(entry.command);
136
+ if (pack)
137
+ view.pack = pack;
138
+ return view;
139
+ }
140
+ function pushIntoBucket(view, core, extended, experimental) {
141
+ switch (view.tier) {
142
+ case CommandTier.Core:
143
+ core.push(view);
144
+ break;
145
+ case CommandTier.Extended:
146
+ extended.push(view);
147
+ break;
148
+ case CommandTier.Experimental:
149
+ experimental.push(view);
150
+ break;
151
+ }
152
+ }
153
+ /** Look up a single command's tier resolution from a summary. */
154
+ export function findCommandInSummary(summary, command) {
155
+ return (summary.tiers.core.find((c) => c.command === command) ??
156
+ summary.tiers.extended.find((c) => c.command === command) ??
157
+ summary.tiers.experimental.find((c) => c.command === command));
158
+ }
159
+ /** Resolve a single tier given a context (no summary needed). */
160
+ export function resolveTierForCommand(entry, context) {
161
+ return resolveTier(entry, context);
162
+ }
@@ -0,0 +1,100 @@
1
+ import type { ISurfaceConfig } from '@shrkcrft/config';
2
+ import { CommandTier, type ICommandCatalogEntry } from '../commands/command-catalog.js';
3
+ /**
4
+ * Bootstrap commands. Always tier=Core regardless of any other
5
+ * derivation rule. Listed here (and only here) so the rule is mechanical:
6
+ * a fresh repo with NO `sharkcraft.config.ts` can always reach these.
7
+ *
8
+ * Tokens are catalog `command` strings (the same form as
9
+ * {@link ICommandCatalogEntry.command}). Multi-token entries (e.g.
10
+ * `pack author status`) are matched exactly.
11
+ *
12
+ * Brutally small set. Discovery verbs (`commands`, `start-here`) live
13
+ * in extended tier; users find them via `shrk surface list` or `shrk
14
+ * recommend`.
15
+ */
16
+ export declare const BOOTSTRAP_COMMANDS: readonly string[];
17
+ /**
18
+ * Source explanations for tier classification. Returned by the
19
+ * resolver so `shrk surface explain <name>` can describe why a
20
+ * command's tier is what it is.
21
+ */
22
+ export declare enum TierSource {
23
+ Bootstrap = "bootstrap",
24
+ Spine = "spine",
25
+ PackContribution = "pack-contribution",
26
+ Override = "override",
27
+ Hidden = "hidden-flag",
28
+ Default = "default"
29
+ }
30
+ export interface ITierResolution {
31
+ /** Resolved tier (post-derivation, post-config). */
32
+ tier: CommandTier;
33
+ /** Why the tier resolved that way. */
34
+ source: TierSource;
35
+ /** Human-readable detail (e.g. "in engine.feature-dev spine pipeline"). */
36
+ detail?: string;
37
+ /** True if the user's surface config flipped the default. */
38
+ configApplied?: boolean;
39
+ }
40
+ export interface ITierResolverContext {
41
+ /** Catalog command names ({@link ICommandCatalogEntry.command}) referenced by spine pipelines. */
42
+ spineCommands: ReadonlySet<string>;
43
+ /** Catalog command names contributed by loaded packs (pack-contributed commands). */
44
+ packContributions: ReadonlyMap<string, string>;
45
+ /** User's `sharkcraft.config.ts surface{}` block (may be undefined for a fresh repo). */
46
+ surfaceConfig: ISurfaceConfig | undefined;
47
+ }
48
+ /**
49
+ * Mechanically derive a command's tier.
50
+ *
51
+ * Resolution order (HIGHEST wins, never demotes Core):
52
+ *
53
+ * 1. Bootstrap set → Core.
54
+ * 2. Spine pipeline reference → Core.
55
+ * 3. Pack contribution → Experimental (unless in surface.enabled).
56
+ * 4. Explicit catalog `tier` override → that value (cannot demote Core).
57
+ * 5. Catalog overlay `hidden` verdict → Experimental.
58
+ * 6. Otherwise → Extended.
59
+ *
60
+ * After derivation, the user's `surface.enabled` / `surface.hidden`
61
+ * config can flip a single dimension:
62
+ *
63
+ * - `surface.enabled` contains the command → promote Experimental
64
+ * to Extended (callable, visible in `surface list` only — `--help`
65
+ * visibility is governed by the catalog's own defaultShowInHelp).
66
+ * - `surface.hidden` contains the command AND tier is Extended →
67
+ * remains Extended-tier but hidden from `--help`. The visibility
68
+ * flip is read by the help renderer, not by the tier resolver
69
+ * directly.
70
+ *
71
+ * Core commands cannot be hidden or disabled. Attempts to do so are
72
+ * surfaced as warnings by `shrk doctor` and `shrk surface list --json`.
73
+ */
74
+ export declare function resolveTier(entry: ICommandCatalogEntry, context: ITierResolverContext): ITierResolution;
75
+ /**
76
+ * Is the command callable from the CLI / MCP in the current
77
+ * surface configuration?
78
+ *
79
+ * - Core: always callable.
80
+ * - Extended: always callable.
81
+ * - Experimental: callable only if in `surface.enabled`.
82
+ *
83
+ * The resolver's promotion of Experimental → Extended already accounts
84
+ * for `enabled[]`, so this is a simple tier check.
85
+ */
86
+ export declare function isCallable(resolution: ITierResolution): boolean;
87
+ /**
88
+ * Should the command be visible in `--help` output?
89
+ *
90
+ * - Core: always visible.
91
+ * - Extended: visible unless in `surface.hidden` (the help renderer
92
+ * checks the config and consults `defaultShowInHelp(entry)`).
93
+ * - Experimental: never visible in `--help`; only in `surface list`.
94
+ *
95
+ * The caller still consults `defaultShowInHelp(entry)` for the
96
+ * underlying surface/lifecycle gating; this function answers "does
97
+ * the tier permit visibility at all?".
98
+ */
99
+ export declare function isVisibleInDefaultHelp(resolution: ITierResolution, hiddenByConfig: boolean): boolean;
100
+ //# sourceMappingURL=tier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tier.d.ts","sourceRoot":"","sources":["../../src/surface/tier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EACL,WAAW,EACX,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAW9C,CAAC;AAEH;;;;GAIG;AACH,oBAAY,UAAU;IACpB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,gBAAgB,sBAAsB;IACtC,QAAQ,aAAa;IACrB,MAAM,gBAAgB;IACtB,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,oDAAoD;IACpD,IAAI,EAAE,WAAW,CAAC;IAClB,sCAAsC;IACtC,MAAM,EAAE,UAAU,CAAC;IACnB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,kGAAkG;IAClG,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,qFAAqF;IACrF,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/C,yFAAyF;IACzF,aAAa,EAAE,cAAc,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,oBAAoB,GAC5B,eAAe,CA4EjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CAK/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,eAAe,EAC3B,cAAc,EAAE,OAAO,GACtB,OAAO,CAKT"}