@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
@@ -0,0 +1,680 @@
1
+ import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
2
+ import * as nodePath from 'node:path';
3
+ import { auditCiWorkflow, buildCiIntegrityReport, GateStatus, renderAzureCiWorkflow, renderBitbucketCiWorkflow, renderCiIntegrityHtml, renderCiIntegrityMarkdown, renderGitlabCiWorkflow, renderJenkinsCiWorkflow, } from '@shrkcrft/inspector';
4
+ import { flagBool, flagString, flagList, resolveCwd, } from "../command-registry.js";
5
+ import { asJson, header, kv } from "../output/format-output.js";
6
+ function detectRepoAssetState(cwd) {
7
+ const dir = nodePath.join(cwd, 'sharkcraft');
8
+ return {
9
+ hasSharkcraftConfig: existsSync(nodePath.join(dir, 'sharkcraft.config.ts')),
10
+ hasKnowledge: existsSync(nodePath.join(dir, 'knowledge.ts')),
11
+ hasTemplates: existsSync(nodePath.join(dir, 'templates.ts')),
12
+ hasPacks: existsSync(nodePath.join(dir, 'packs.ts')),
13
+ };
14
+ }
15
+ function buildSteps(inputs) {
16
+ const steps = [];
17
+ if (inputs.withDoctor) {
18
+ steps.push({ name: 'SharkCraft doctor', command: 'bun run shrk doctor', artifact: 'doctor.log' });
19
+ }
20
+ if (inputs.withQuality) {
21
+ const qa = inputs.withDriftGate ? 'quality --ci --require-drift-clean' : 'quality --ci';
22
+ steps.push({ name: 'SharkCraft quality', command: `bun run shrk ${qa} > quality.json`, artifact: 'quality.json' });
23
+ }
24
+ if (inputs.withReview) {
25
+ steps.push({ name: 'Build review packet', command: 'bun run shrk review --since origin/main --json > review-packet.json', artifact: 'review-packet.json' });
26
+ }
27
+ if (inputs.withBoundaries) {
28
+ const boundaryFlags = inputs.changedOnly
29
+ ? 'check boundaries --changed-only --json'
30
+ : 'check boundaries --json';
31
+ steps.push({ name: 'Boundary check', command: `bun run shrk ${boundaryFlags} > boundaries.json`, artifact: 'boundaries.json' });
32
+ }
33
+ if (inputs.withSelfConfigDoctor) {
34
+ steps.push({ name: 'Self-config doctor', command: 'bun run shrk self-config doctor --json > self-config-doctor.json', artifact: 'self-config-doctor.json' });
35
+ }
36
+ if (inputs.withPackSignatureStatus) {
37
+ steps.push({ name: 'Pack signature status', command: 'bun run shrk packs signature-status --json > pack-signature-status.json', artifact: 'pack-signature-status.json' });
38
+ }
39
+ if (inputs.withCoverage) {
40
+ steps.push({ name: 'Coverage report', command: 'bun run shrk coverage --json > coverage.json', artifact: 'coverage.json' });
41
+ }
42
+ if (inputs.withAgentTests) {
43
+ steps.push({ name: 'Agent contract tests', command: 'bun run shrk test agent --json > agent-tests.json', artifact: 'agent-tests.json' });
44
+ }
45
+ if (inputs.withDrift && !inputs.withDriftGate) {
46
+ steps.push({ name: 'Drift report', command: 'bun run shrk drift --json > drift.json', artifact: 'drift.json' });
47
+ }
48
+ if (inputs.withBaseline) {
49
+ steps.push({ name: 'Quality baseline compare', command: 'bun run shrk quality baseline-compare --fail-on-regression --json > baseline-compare.json', artifact: 'baseline-compare.json' });
50
+ }
51
+ if (inputs.withPolicy) {
52
+ steps.push({ name: 'Policy check', command: 'bun run shrk policy check --json > policy.json', artifact: 'policy.json' });
53
+ }
54
+ if (inputs.withPolicySnapshotGate) {
55
+ steps.push({
56
+ name: 'Policy snapshot gate',
57
+ command: 'bun run shrk policy snapshot --all --gate --json > policy-snapshots.json',
58
+ artifact: 'policy-snapshots.json',
59
+ });
60
+ }
61
+ if (inputs.withImpact) {
62
+ steps.push({
63
+ name: 'Impact since origin/main',
64
+ command: 'mkdir -p .sharkcraft/reports && bun run shrk impact --since origin/main --format json > .sharkcraft/reports/impact.json || true',
65
+ artifact: '.sharkcraft/reports/impact.json',
66
+ });
67
+ }
68
+ if (inputs.withBundleReplay) {
69
+ steps.push({
70
+ name: 'Bundle replay (all)',
71
+ command: 'bun run shrk bundle replay --all --report --html || true',
72
+ artifact: '.sharkcraft/reports/bundle-replay-all.md',
73
+ });
74
+ }
75
+ if (inputs.withReportSite) {
76
+ steps.push({
77
+ name: 'Static report site',
78
+ command: 'bun run shrk report site --output .sharkcraft/reports/site || true',
79
+ artifact: '.sharkcraft/reports/site/index.html',
80
+ });
81
+ }
82
+ if (inputs.withOwners) {
83
+ steps.push({ name: 'Owners list', command: 'bun run shrk owners list --json > owners.json', artifact: 'owners.json' });
84
+ }
85
+ if (inputs.withTestImpact) {
86
+ steps.push({ name: 'Test impact', command: 'bun run shrk tests impact --json > test-impact.json', artifact: 'test-impact.json' });
87
+ }
88
+ if (inputs.withDashboardE2e) {
89
+ steps.push({ name: 'Dashboard E2E', command: 'bun run test:e2e:dashboard', artifact: 'dashboard-e2e.log' });
90
+ }
91
+ if (inputs.withSafetyAudit) {
92
+ steps.push({ name: 'Safety audit', command: 'bun run shrk safety audit --json > safety-audit.json', artifact: 'safety-audit.json' });
93
+ }
94
+ if (inputs.withCommandDoctor) {
95
+ steps.push({ name: 'Command doctor', command: 'bun run shrk commands doctor --json > commands-doctor.json', artifact: 'commands-doctor.json' });
96
+ }
97
+ if (inputs.withNodeCompat) {
98
+ steps.push({ name: 'Node compatibility', command: 'bun run compat:node > node-compat.json', artifact: 'node-compat.json' });
99
+ }
100
+ if (inputs.withPackTests && inputs.packPaths.length > 0) {
101
+ for (const p of inputs.packPaths) {
102
+ const slug = p.replace(/[^a-z0-9]+/gi, '-').replace(/^-|-$/g, '').slice(0, 32) || 'pack';
103
+ steps.push({ name: `Pack test (${slug})`, command: `bun run shrk packs test ${p} --load --json > pack-test-${slug}.json`, artifact: `pack-test-${slug}.json` });
104
+ }
105
+ }
106
+ // Integrity gates.
107
+ if (inputs.withKnowledgeCheck) {
108
+ steps.push({
109
+ name: 'Knowledge stale-check (CI)',
110
+ command: 'mkdir -p .sharkcraft/reports && bun run shrk knowledge stale-check --ci --format json > .sharkcraft/reports/knowledge-stale.json',
111
+ artifact: '.sharkcraft/reports/knowledge-stale.json',
112
+ });
113
+ }
114
+ if (inputs.withTemplateDrift) {
115
+ steps.push({
116
+ name: 'Template drift (CI)',
117
+ command: 'mkdir -p .sharkcraft/reports && bun run shrk templates drift --ci --format json > .sharkcraft/reports/template-drift.json',
118
+ artifact: '.sharkcraft/reports/template-drift.json',
119
+ });
120
+ }
121
+ return steps;
122
+ }
123
+ function githubYaml(steps, inputs) {
124
+ const lines = [];
125
+ lines.push('# .github/workflows/sharkcraft.yml');
126
+ lines.push('name: SharkCraft');
127
+ lines.push('on:');
128
+ lines.push(' pull_request:');
129
+ lines.push(' branches: [main]');
130
+ lines.push(' push:');
131
+ lines.push(' branches: [main]');
132
+ if (inputs?.prComment) {
133
+ lines.push('permissions:');
134
+ lines.push(' contents: read');
135
+ lines.push(' pull-requests: write');
136
+ }
137
+ lines.push('jobs:');
138
+ lines.push(' sharkcraft:');
139
+ lines.push(' runs-on: ubuntu-latest');
140
+ lines.push(' steps:');
141
+ lines.push(' - uses: actions/checkout@v4');
142
+ lines.push(' with:');
143
+ lines.push(' fetch-depth: 0');
144
+ lines.push(' - uses: oven-sh/setup-bun@v1');
145
+ lines.push(' - run: bun install');
146
+ for (const s of steps) {
147
+ lines.push(` - name: ${s.name}`);
148
+ // Small-repo quickstart should not fail builds on missing advanced
149
+ // surfaces. Wrap each step in `|| true` for quickstart-style runs.
150
+ const wrapped = inputs && inputs.withDoctor && !s.command.includes('|| true')
151
+ ? `${s.command} || true`
152
+ : s.command;
153
+ lines.push(` run: ${wrapped}`);
154
+ }
155
+ for (const s of steps) {
156
+ lines.push(' - uses: actions/upload-artifact@v4');
157
+ lines.push(' if: always()');
158
+ lines.push(' with:');
159
+ lines.push(` name: ${slug(s.name)}`);
160
+ lines.push(` path: ${s.artifact}`);
161
+ }
162
+ if (inputs?.prComment) {
163
+ lines.push(' - name: Post SharkCraft summary comment');
164
+ lines.push(" if: github.event_name == 'pull_request'");
165
+ lines.push(' uses: actions/github-script@v7');
166
+ lines.push(' with:');
167
+ lines.push(' script: |');
168
+ lines.push(" const body = '### SharkCraft checks completed\\n\\nSee the workflow artifacts for full reports.';");
169
+ lines.push(' await github.rest.issues.createComment({');
170
+ lines.push(' issue_number: context.issue.number,');
171
+ lines.push(' owner: context.repo.owner,');
172
+ lines.push(' repo: context.repo.repo,');
173
+ lines.push(' body,');
174
+ lines.push(' });');
175
+ }
176
+ if (steps.length === 0) {
177
+ lines.push(' - run: echo "No SharkCraft checks selected — pass --quickstart for sensible defaults."');
178
+ }
179
+ return lines.join('\n') + '\n';
180
+ }
181
+ function gitlabYaml(steps, inputs) {
182
+ if (inputs) {
183
+ // Use the richer staged scaffold from @shrkcrft/inspector.
184
+ return renderGitlabCiWorkflow({
185
+ withQuality: inputs.withQuality,
186
+ withPolicy: inputs.withPolicy,
187
+ withPolicySnapshotGate: inputs.withPolicySnapshotGate,
188
+ withImpact: inputs.withImpact,
189
+ withReview: inputs.withReview,
190
+ withReportSite: inputs.withReportSite,
191
+ withBundleReplay: inputs.withBundleReplay,
192
+ withNodeCompat: inputs.withNodeCompat,
193
+ });
194
+ }
195
+ const lines = [];
196
+ lines.push('# .gitlab-ci.yml');
197
+ lines.push('sharkcraft:');
198
+ lines.push(' image: oven/bun:1.1');
199
+ lines.push(' stage: test');
200
+ lines.push(' script:');
201
+ lines.push(' - bun install');
202
+ for (const s of steps) {
203
+ lines.push(` - ${s.command}`);
204
+ }
205
+ if (steps.length > 0) {
206
+ lines.push(' artifacts:');
207
+ lines.push(' when: always');
208
+ lines.push(' paths:');
209
+ for (const s of steps)
210
+ lines.push(` - ${s.artifact}`);
211
+ }
212
+ return lines.join('\n') + '\n';
213
+ }
214
+ function circleciYaml(steps) {
215
+ const lines = [];
216
+ lines.push('# .circleci/config.yml');
217
+ lines.push("version: '2.1'");
218
+ lines.push('jobs:');
219
+ lines.push(' sharkcraft:');
220
+ lines.push(' docker:');
221
+ lines.push(' - image: oven/bun:1.1');
222
+ lines.push(' steps:');
223
+ lines.push(' - checkout');
224
+ lines.push(' - run: bun install');
225
+ for (const s of steps) {
226
+ lines.push(` - run:`);
227
+ lines.push(` name: ${s.name}`);
228
+ lines.push(` command: ${s.command}`);
229
+ }
230
+ for (const s of steps) {
231
+ lines.push(` - store_artifacts:`);
232
+ lines.push(` path: ${s.artifact}`);
233
+ }
234
+ lines.push('workflows:');
235
+ lines.push(' sharkcraft:');
236
+ lines.push(' jobs:');
237
+ lines.push(' - sharkcraft');
238
+ return lines.join('\n') + '\n';
239
+ }
240
+ function bitbucketYaml(steps, inputs) {
241
+ if (inputs) {
242
+ return renderBitbucketCiWorkflow({
243
+ withQuality: inputs.withQuality,
244
+ withPolicy: inputs.withPolicy,
245
+ withPolicySnapshotGate: inputs.withPolicySnapshotGate,
246
+ withImpact: inputs.withImpact,
247
+ withReview: inputs.withReview,
248
+ withReportSite: inputs.withReportSite,
249
+ withBundleReplay: inputs.withBundleReplay,
250
+ withNodeCompat: inputs.withNodeCompat,
251
+ });
252
+ }
253
+ const lines = [];
254
+ lines.push('# bitbucket-pipelines.yml');
255
+ lines.push('image: oven/bun:1.1');
256
+ lines.push('pipelines:');
257
+ lines.push(' default:');
258
+ lines.push(' - step:');
259
+ lines.push(' name: SharkCraft');
260
+ lines.push(' script:');
261
+ lines.push(' - bun install');
262
+ for (const s of steps)
263
+ lines.push(` - ${s.command}`);
264
+ if (steps.length > 0) {
265
+ lines.push(' artifacts:');
266
+ for (const s of steps)
267
+ lines.push(` - ${s.artifact}`);
268
+ }
269
+ return lines.join('\n') + '\n';
270
+ }
271
+ function azureYaml(steps) {
272
+ const lines = [];
273
+ lines.push('# azure-pipelines.yml');
274
+ lines.push('trigger:');
275
+ lines.push(' - main');
276
+ lines.push('pool:');
277
+ lines.push(' vmImage: ubuntu-latest');
278
+ lines.push('steps:');
279
+ lines.push(' - script: curl -fsSL https://bun.sh/install | bash');
280
+ lines.push(' displayName: Install Bun');
281
+ lines.push(' - script: ~/.bun/bin/bun install');
282
+ lines.push(' displayName: Install deps');
283
+ for (const s of steps) {
284
+ lines.push(` - script: ~/.bun/bin/${s.command}`);
285
+ lines.push(` displayName: ${s.name}`);
286
+ }
287
+ for (const s of steps) {
288
+ lines.push(` - publish: ${s.artifact}`);
289
+ lines.push(` artifact: ${slug(s.name)}`);
290
+ lines.push(' condition: always()');
291
+ }
292
+ return lines.join('\n') + '\n';
293
+ }
294
+ function jenkinsFile(_steps, inputs) {
295
+ if (!inputs)
296
+ return '// (no inputs)\n';
297
+ const opts = {
298
+ withQuality: inputs.withQuality,
299
+ withPolicy: inputs.withPolicy,
300
+ withPolicySnapshotGate: inputs.withPolicySnapshotGate,
301
+ withImpact: inputs.withImpact,
302
+ withReview: inputs.withReview,
303
+ withReportSite: inputs.withReportSite,
304
+ withBundleReplay: inputs.withBundleReplay,
305
+ withNodeCompat: inputs.withNodeCompat,
306
+ };
307
+ return renderJenkinsCiWorkflow(opts);
308
+ }
309
+ function azureFromInputs(_steps, inputs) {
310
+ if (!inputs)
311
+ return '# (no inputs)\n';
312
+ const opts = {
313
+ withQuality: inputs.withQuality,
314
+ withPolicy: inputs.withPolicy,
315
+ withPolicySnapshotGate: inputs.withPolicySnapshotGate,
316
+ withImpact: inputs.withImpact,
317
+ withReview: inputs.withReview,
318
+ withReportSite: inputs.withReportSite,
319
+ withBundleReplay: inputs.withBundleReplay,
320
+ withNodeCompat: inputs.withNodeCompat,
321
+ };
322
+ return renderAzureCiWorkflow(opts);
323
+ }
324
+ // `circleci`, `azure`, `azure-pipelines`, `jenkins` providers are not
325
+ // part of the visible scaffold surface. GHA is first-class; GitLab and
326
+ // Bitbucket remain as supported alternatives. The other providers are
327
+ // documented in `docs/ci-providers.md` only. Their `*Yaml` / `*File`
328
+ // builders stay importable for code that needs the rendered output
329
+ // (tests / pack consumers), but the CLI no longer routes to them.
330
+ const PROVIDERS = {
331
+ 'github-actions': { defaultPath: '.github/workflows/sharkcraft.yml', build: githubYaml },
332
+ gitlab: { defaultPath: '.gitlab-ci.yml', build: gitlabYaml },
333
+ bitbucket: { defaultPath: 'bitbucket-pipelines.yml', build: bitbucketYaml },
334
+ };
335
+ function slug(s) {
336
+ return s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
337
+ }
338
+ function buildGateExplanations(inputs, state) {
339
+ const rows = [];
340
+ if (inputs.withDoctor) {
341
+ rows.push({
342
+ gate: 'shrk doctor',
343
+ enabledBy: 'detected',
344
+ purpose: 'Validate sharkcraft/ config + knowledge / rules / templates registries.',
345
+ });
346
+ }
347
+ if (inputs.withBoundaries) {
348
+ rows.push({
349
+ gate: inputs.changedOnly ? 'check boundaries --changed-only' : 'check boundaries',
350
+ enabledBy: inputs.changedOnly ? 'detected' : 'flag',
351
+ purpose: 'Cross-layer / cross-package boundary enforcement (ESLint cannot express this).',
352
+ });
353
+ }
354
+ if (inputs.withSelfConfigDoctor) {
355
+ rows.push({
356
+ gate: 'self-config doctor',
357
+ enabledBy: state.hasSharkcraftConfig ? 'detected' : 'flag',
358
+ purpose: 'Repo-shape sanity (action hints, verification commands, rule wiring).',
359
+ });
360
+ }
361
+ if (inputs.withKnowledgeCheck) {
362
+ rows.push({
363
+ gate: 'knowledge stale-check',
364
+ enabledBy: state.hasKnowledge ? 'detected' : 'flag',
365
+ purpose: 'Surface knowledge entries that no longer match the code they reference.',
366
+ });
367
+ }
368
+ if (inputs.withTemplateDrift) {
369
+ rows.push({
370
+ gate: 'templates drift',
371
+ enabledBy: state.hasTemplates ? 'detected' : 'flag',
372
+ purpose: 'Catch templates that have drifted from the constructs they generate.',
373
+ });
374
+ }
375
+ if (inputs.withPackSignatureStatus) {
376
+ rows.push({
377
+ gate: 'packs signature-status',
378
+ enabledBy: state.hasPacks ? 'detected' : 'flag',
379
+ purpose: 'Surface unsigned / stale pack signatures before merge.',
380
+ });
381
+ }
382
+ if (inputs.withQuality) {
383
+ rows.push({
384
+ gate: 'shrk quality',
385
+ enabledBy: 'flag',
386
+ purpose: 'Aggregated quality gate (doctor + boundaries + coverage + drift + packs).',
387
+ });
388
+ }
389
+ if (inputs.withSafetyAudit) {
390
+ rows.push({
391
+ gate: 'safety audit',
392
+ enabledBy: 'flag',
393
+ purpose: 'MCP-write + sign-bypass + write-policy audit (no fake signing tolerated).',
394
+ });
395
+ }
396
+ if (inputs.prComment) {
397
+ rows.push({
398
+ gate: 'PR summary comment',
399
+ enabledBy: 'flag',
400
+ purpose: 'Post a short status comment on the PR after the workflow completes.',
401
+ });
402
+ }
403
+ return rows;
404
+ }
405
+ export const ciCommand = {
406
+ name: 'ci',
407
+ description: 'Scaffold CI configurations for SharkCraft (github-actions, gitlab, circleci, bitbucket, azure-pipelines, jenkins, azure). `shrk ci permissions` audits a workflow file. Supports --with-knowledge-check / --with-template-drift / --with-integrity.',
408
+ usage: 'shrk ci scaffold <provider> [--with-quality] [--with-review] [--with-boundaries] [--with-coverage] [--with-drift-gate] [--with-drift] [--with-baseline] [--with-policy] [--with-owners] [--with-test-impact] [--with-dashboard-e2e] [--with-node-compat] [--with-safety-audit] [--with-command-doctor] [--with-pack-tests --pack-paths <p1,p2>] [--with-knowledge-check] [--with-template-drift] [--with-integrity] [--output <path>] [--write] [--force] [--json]\n shrk ci permissions <workflow-file> [--provider github-actions|gitlab|bitbucket|azure|jenkins] [--json]',
409
+ async run(args) {
410
+ const verb = args.positional[0];
411
+ if (verb === 'permissions') {
412
+ return runCiPermissions({ ...args, positional: args.positional.slice(1) });
413
+ }
414
+ if (verb === 'report') {
415
+ return runCiReport({ ...args, positional: args.positional.slice(1) });
416
+ }
417
+ // `ci predict` / `ci would-fail` removed (advisory; no tests; not on spine).
418
+ if (verb !== 'scaffold') {
419
+ process.stderr.write('Usage: shrk ci scaffold <provider> [...flags]\n or: shrk ci permissions <workflow-file>\n or: shrk ci report [--reports-dir <dir>] [--format text|markdown|html|json] [--fail-on error|warning|none]\n');
420
+ return 2;
421
+ }
422
+ const target = args.positional[1];
423
+ if (!target || !PROVIDERS[target]) {
424
+ process.stderr.write(`Unknown CI target "${target ?? ''}". Available: ${Object.keys(PROVIDERS).join(', ')}\n`);
425
+ return 2;
426
+ }
427
+ const cwd = resolveCwd(args);
428
+ const packPathsList = flagList(args, 'pack-paths');
429
+ const withIntegrity = flagBool(args, 'with-integrity');
430
+ // Quickstart / preset auto / pr-checks all expand into the
431
+ // sensible-default bundle, gated on what the small repo actually has.
432
+ const wantQuickstart = flagBool(args, 'quickstart') ||
433
+ flagBool(args, 'with-pr-checks') ||
434
+ flagString(args, 'preset') === 'auto';
435
+ const wantChangedOnly = flagBool(args, 'changed-only') || wantQuickstart;
436
+ const wantPrComment = flagBool(args, 'pr-comment');
437
+ // Snapshot which assets are present so we never enable a gate the repo
438
+ // cannot run.
439
+ const assetState = detectRepoAssetState(cwd);
440
+ const quickstartOverrides = wantQuickstart
441
+ ? {
442
+ withDoctor: true,
443
+ withBoundaries: true,
444
+ withKnowledgeCheck: assetState.hasKnowledge,
445
+ withTemplateDrift: assetState.hasTemplates,
446
+ withSelfConfigDoctor: assetState.hasSharkcraftConfig,
447
+ withPackSignatureStatus: assetState.hasPacks,
448
+ }
449
+ : {};
450
+ const inputs = {
451
+ withQuality: flagBool(args, 'with-quality'),
452
+ withReview: flagBool(args, 'with-review'),
453
+ withBoundaries: flagBool(args, 'with-boundaries') || (quickstartOverrides.withBoundaries ?? false),
454
+ withCoverage: flagBool(args, 'with-coverage'),
455
+ withAgentTests: flagBool(args, 'with-agent-tests'),
456
+ withDriftGate: flagBool(args, 'with-drift-gate'),
457
+ withDrift: flagBool(args, 'with-drift'),
458
+ withBaseline: flagBool(args, 'with-baseline'),
459
+ withPolicy: flagBool(args, 'with-policy'),
460
+ withOwners: flagBool(args, 'with-owners'),
461
+ withTestImpact: flagBool(args, 'with-test-impact'),
462
+ withDashboardE2e: flagBool(args, 'with-dashboard-e2e'),
463
+ withNodeCompat: flagBool(args, 'with-node-compat'),
464
+ withSafetyAudit: flagBool(args, 'with-safety-audit'),
465
+ withCommandDoctor: flagBool(args, 'with-command-doctor'),
466
+ withPackTests: flagBool(args, 'with-pack-tests'),
467
+ withImpact: flagBool(args, 'with-impact'),
468
+ withReportSite: flagBool(args, 'with-report-site'),
469
+ withBundleReplay: flagBool(args, 'with-bundle-replay'),
470
+ withPolicySnapshotGate: flagBool(args, 'with-policy-snapshot-gate'),
471
+ // Knowledge stale-check + template drift gates. `--with-integrity`
472
+ // is the shortcut that enables both.
473
+ withKnowledgeCheck: flagBool(args, 'with-knowledge-check') || withIntegrity || (quickstartOverrides.withKnowledgeCheck ?? false),
474
+ withTemplateDrift: flagBool(args, 'with-template-drift') || withIntegrity || (quickstartOverrides.withTemplateDrift ?? false),
475
+ // Quickstart helpers + boundary flag + pr-comment.
476
+ withDoctor: flagBool(args, 'with-doctor') || (quickstartOverrides.withDoctor ?? false),
477
+ withSelfConfigDoctor: flagBool(args, 'with-self-config-doctor') || (quickstartOverrides.withSelfConfigDoctor ?? false),
478
+ withPackSignatureStatus: flagBool(args, 'with-pack-signature-status') || (quickstartOverrides.withPackSignatureStatus ?? false),
479
+ changedOnly: wantChangedOnly,
480
+ prComment: wantPrComment && target === 'github-actions',
481
+ packPaths: packPathsList,
482
+ };
483
+ const steps = buildSteps(inputs);
484
+ let body = PROVIDERS[target].build(steps, inputs);
485
+ // --polyglot appends per-language jobs to the rendered
486
+ // workflow. All providers are supported.
487
+ if (flagBool(args, 'polyglot')) {
488
+ const { renderPolyglotGitHubActionsJobs, renderPolyglotGitlabJobs, renderPolyglotBitbucketSteps, renderPolyglotAzureStages, renderPolyglotJenkinsStages, } = await import('@shrkcrft/inspector');
489
+ if (target === 'github-actions')
490
+ body += renderPolyglotGitHubActionsJobs(cwd);
491
+ else if (target === 'gitlab')
492
+ body += renderPolyglotGitlabJobs(cwd);
493
+ else if (target === 'bitbucket')
494
+ body += renderPolyglotBitbucketSteps(cwd);
495
+ else if (target === 'azure')
496
+ body += renderPolyglotAzureStages(cwd);
497
+ else if (target === 'jenkins')
498
+ body += renderPolyglotJenkinsStages(cwd);
499
+ else
500
+ body += `\n# (provider does not yet support polyglot job injection)\n`;
501
+ }
502
+ const outputRel = flagString(args, 'output') ?? PROVIDERS[target].defaultPath;
503
+ const outputAbs = nodePath.isAbsolute(outputRel) ? outputRel : nodePath.resolve(cwd, outputRel);
504
+ const wantWrite = flagBool(args, 'write');
505
+ const force = flagBool(args, 'force');
506
+ const wantJson = flagBool(args, 'json');
507
+ if (!wantWrite) {
508
+ if (wantJson) {
509
+ process.stdout.write(asJson({
510
+ mode: 'dry-run',
511
+ target,
512
+ output: outputAbs,
513
+ bytes: body.length,
514
+ body,
515
+ // Surface why each step is in the workflow so reviewers can
516
+ // see what came from detection vs. an explicit flag.
517
+ gates: buildGateExplanations(inputs, assetState),
518
+ nextCommand: `shrk ci scaffold ${target} ${flagBool(args, 'quickstart') ? '--quickstart ' : ''}--write`,
519
+ }) + '\n');
520
+ return 0;
521
+ }
522
+ process.stdout.write(header(`CI scaffold (${target}) — dry-run`));
523
+ process.stdout.write(kv('exact path', outputAbs) + '\n');
524
+ process.stdout.write(kv('bytes', String(body.length)) + '\n');
525
+ process.stdout.write(kv('next command', `shrk ci scaffold ${target} ${flagBool(args, 'quickstart') ? '--quickstart ' : ''}--write`) + '\n\n');
526
+ process.stdout.write(body);
527
+ // Gate explanation block. Lists every step the workflow runs,
528
+ // whether it was enabled by detection or by an explicit flag, and
529
+ // what each step protects. Small repos see exactly what their CI
530
+ // will do without having to read the YAML.
531
+ const gates = buildGateExplanations(inputs, assetState);
532
+ if (gates.length) {
533
+ process.stdout.write('\n=== Explanation of gates ===\n');
534
+ for (const g of gates) {
535
+ process.stdout.write(` ${g.gate.padEnd(28)} ${g.enabledBy.padEnd(14)} ${g.purpose}\n`);
536
+ }
537
+ }
538
+ return 0;
539
+ }
540
+ if (existsSync(outputAbs) && !force) {
541
+ process.stderr.write(`Refusing to overwrite existing file: ${outputAbs}. Pass --force.\n`);
542
+ return 1;
543
+ }
544
+ mkdirSync(nodePath.dirname(outputAbs), { recursive: true });
545
+ writeFileSync(outputAbs, body, 'utf8');
546
+ if (wantJson)
547
+ process.stdout.write(asJson({ mode: 'write', target, output: outputAbs, bytes: body.length }) + '\n');
548
+ else
549
+ process.stdout.write(`Wrote ${outputAbs}\n`);
550
+ return 0;
551
+ },
552
+ };
553
+ async function runCiPermissions(args) {
554
+ const file = args.positional[0];
555
+ if (!file) {
556
+ process.stderr.write('Usage: shrk ci permissions <workflow-file> [--provider github-actions|gitlab|bitbucket|azure|jenkins]\n');
557
+ return 2;
558
+ }
559
+ const cwd = resolveCwd(args);
560
+ const abs = nodePath.isAbsolute(file) ? file : nodePath.resolve(cwd, file);
561
+ const providerRaw = flagString(args, 'provider');
562
+ const valid = new Set(['github-actions', 'gitlab', 'bitbucket', 'azure', 'jenkins']);
563
+ if (providerRaw && !valid.has(providerRaw)) {
564
+ process.stderr.write(`Unknown --provider "${providerRaw}". Use github-actions|gitlab|bitbucket|azure|jenkins.\n`);
565
+ return 2;
566
+ }
567
+ const audit = auditCiWorkflow({
568
+ file: abs,
569
+ provider: providerRaw ? providerRaw : null,
570
+ });
571
+ if (flagBool(args, 'fix-preview')) {
572
+ const { buildCiPermissionsFixPreview, renderCiPermissionsFixPreview } = await import('@shrkcrft/inspector');
573
+ const preview = buildCiPermissionsFixPreview(audit);
574
+ const formatRaw = flagString(args, 'format') ?? (flagBool(args, 'json') ? 'json' : 'markdown');
575
+ const fmt = formatRaw === 'patch' || formatRaw === 'json' || formatRaw === 'markdown'
576
+ ? formatRaw
577
+ : 'markdown';
578
+ process.stdout.write(renderCiPermissionsFixPreview(preview, fmt));
579
+ return preview.hints.some((h) => h.severity === 'error') ? 1 : 0;
580
+ }
581
+ if (flagBool(args, 'json')) {
582
+ process.stdout.write(asJson(audit) + '\n');
583
+ return audit.findings.some((f) => f.severity === 'error') ? 1 : 0;
584
+ }
585
+ process.stdout.write(header(`CI permissions audit (${audit.provider})`));
586
+ process.stdout.write(kv('workflow', audit.workflowFile) + '\n');
587
+ process.stdout.write(kv('exists', audit.exists ? 'yes' : 'no') + '\n');
588
+ if (!audit.exists) {
589
+ process.stdout.write(' workflow file not found\n');
590
+ return 1;
591
+ }
592
+ process.stdout.write(kv('posts comments', audit.postsComments ? 'yes' : 'no') + '\n');
593
+ process.stdout.write(kv('write perms requested', audit.requestsWritePermissions ? 'yes' : 'no') + '\n');
594
+ process.stdout.write(kv('uses tokens', audit.usesTokens ? 'yes' : 'no') + '\n');
595
+ process.stdout.write(kv('external actions', String(audit.externalActions.length)) + '\n');
596
+ process.stdout.write(kv('external images', String(audit.externalImages.length)) + '\n');
597
+ process.stdout.write(kv('uploads artifacts', audit.uploadsArtifacts ? 'yes' : 'no') + '\n\n');
598
+ for (const f of audit.findings) {
599
+ process.stdout.write(` ${f.severity.toUpperCase().padEnd(8)} ${f.code.padEnd(28)} ${f.message}\n`);
600
+ if (f.suggestion)
601
+ process.stdout.write(` ↳ ${f.suggestion}\n`);
602
+ if (f.lines.length > 0)
603
+ process.stdout.write(` lines: ${f.lines.slice(0, 10).join(', ')}${f.lines.length > 10 ? '…' : ''}\n`);
604
+ }
605
+ if (audit.recommendation) {
606
+ process.stdout.write('\nRecommended least-privilege block:\n');
607
+ for (const line of audit.recommendation.split('\n'))
608
+ process.stdout.write(` ${line}\n`);
609
+ }
610
+ for (const n of audit.notes)
611
+ process.stdout.write(`\nnote: ${n}\n`);
612
+ return audit.findings.some((f) => f.severity === 'error') ? 1 : 0;
613
+ }
614
+ async function runCiReport(args) {
615
+ const cwd = resolveCwd(args);
616
+ const reportsDir = flagString(args, 'reports-dir') ?? '.sharkcraft/reports';
617
+ const report = buildCiIntegrityReport(cwd, { reportsDir });
618
+ const format = (flagString(args, 'format') ?? (flagBool(args, 'json') ? 'json' : 'text')).toLowerCase();
619
+ const failOnRaw = (flagString(args, 'fail-on') ?? 'error').toLowerCase();
620
+ const output = flagString(args, 'output');
621
+ const exitForLevel = (level) => {
622
+ if (level === 'none')
623
+ return 0;
624
+ if (level === 'warning')
625
+ return report.overall === GateStatus.Fail || report.overall === GateStatus.Warn ? 1 : 0;
626
+ // default: error
627
+ return report.overall === GateStatus.Fail ? 1 : 0;
628
+ };
629
+ const exitCode = exitForLevel(failOnRaw);
630
+ if (format === 'json') {
631
+ const payload = asJson(report) + '\n';
632
+ if (output)
633
+ writeReportFile(cwd, output, payload);
634
+ else
635
+ process.stdout.write(payload);
636
+ return exitCode;
637
+ }
638
+ if (format === 'markdown') {
639
+ const md = renderCiIntegrityMarkdown(report);
640
+ if (output)
641
+ writeReportFile(cwd, output, md);
642
+ else
643
+ process.stdout.write(md);
644
+ return exitCode;
645
+ }
646
+ if (format === 'html') {
647
+ const html = renderCiIntegrityHtml(report);
648
+ if (output)
649
+ writeReportFile(cwd, output, html);
650
+ else
651
+ process.stdout.write(html);
652
+ return exitCode;
653
+ }
654
+ // text default
655
+ process.stdout.write(header(`CI integrity (${report.overall})`));
656
+ process.stdout.write(` reports dir: ${report.reportsDir}\n`);
657
+ process.stdout.write(` errors: ${report.totalErrors}\n`);
658
+ process.stdout.write(` warnings: ${report.totalWarnings}\n\n`);
659
+ for (const g of report.gates) {
660
+ process.stdout.write(` ${g.status.padEnd(7)} ${g.title.padEnd(28)} ${g.summary}\n`);
661
+ if (g.nextCommand)
662
+ process.stdout.write(` next: ${g.nextCommand}\n`);
663
+ }
664
+ if (report.nextCommands.length > 0) {
665
+ process.stdout.write('\nNext commands:\n');
666
+ for (const c of report.nextCommands)
667
+ process.stdout.write(` $ ${c}\n`);
668
+ }
669
+ else if (report.gates.every((g) => g.status === GateStatus.Unknown)) {
670
+ const { ciReportEmptyHints, renderFailureHints } = await import("../output/failure-hints.js");
671
+ process.stdout.write(renderFailureHints(ciReportEmptyHints()));
672
+ }
673
+ return exitCode;
674
+ }
675
+ function writeReportFile(cwd, file, body) {
676
+ const abs = nodePath.isAbsolute(file) ? file : nodePath.join(cwd, file);
677
+ mkdirSync(nodePath.dirname(abs), { recursive: true });
678
+ writeFileSync(abs, body, 'utf8');
679
+ process.stdout.write(`Wrote ${abs}\n`);
680
+ }