codictator 0.0.0 → 0.1.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 (835) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +5 -0
  3. package/dist/builtin-packs/core/fixtures/agent-assets-present/passing/basic/case.json +10 -0
  4. package/dist/builtin-packs/core/fixtures/agent-assets-present/violating/basic/case.json +10 -0
  5. package/dist/builtin-packs/core/fixtures/arch-boundaries/passing/basic/case.json +10 -0
  6. package/dist/builtin-packs/core/fixtures/arch-boundaries/violating/basic/case.json +10 -0
  7. package/dist/builtin-packs/core/fixtures/arch-module-mapped/passing/basic/case.json +10 -0
  8. package/dist/builtin-packs/core/fixtures/arch-module-mapped/violating/basic/case.json +10 -0
  9. package/dist/builtin-packs/core/fixtures/arch-module-size/passing/basic/case.json +10 -0
  10. package/dist/builtin-packs/core/fixtures/arch-module-size/violating/basic/case.json +10 -0
  11. package/dist/builtin-packs/core/fixtures/arch-no-cycles/passing/basic/case.json +10 -0
  12. package/dist/builtin-packs/core/fixtures/arch-no-cycles/violating/basic/case.json +10 -0
  13. package/dist/builtin-packs/core/fixtures/arch-profile-declared/passing/basic/case.json +10 -0
  14. package/dist/builtin-packs/core/fixtures/arch-profile-declared/violating/basic/case.json +10 -0
  15. package/dist/builtin-packs/core/fixtures/arch-public-entry/passing/basic/case.json +10 -0
  16. package/dist/builtin-packs/core/fixtures/arch-public-entry/violating/basic/case.json +10 -0
  17. package/dist/builtin-packs/core/fixtures/branch-protection/passing/basic/case.json +10 -0
  18. package/dist/builtin-packs/core/fixtures/branch-protection/violating/basic/case.json +10 -0
  19. package/dist/builtin-packs/core/fixtures/bug-registry/passing/basic/case.json +10 -0
  20. package/dist/builtin-packs/core/fixtures/bug-registry/violating/basic/case.json +10 -0
  21. package/dist/builtin-packs/core/fixtures/bug-rows-immutable/passing/basic/case.json +10 -0
  22. package/dist/builtin-packs/core/fixtures/bug-rows-immutable/violating/basic/case.json +10 -0
  23. package/dist/builtin-packs/core/fixtures/ci-actions-pinned/passing/basic/case.json +10 -0
  24. package/dist/builtin-packs/core/fixtures/ci-actions-pinned/violating/basic/case.json +10 -0
  25. package/dist/builtin-packs/core/fixtures/ci-present/passing/basic/case.json +10 -0
  26. package/dist/builtin-packs/core/fixtures/ci-present/violating/basic/case.json +10 -0
  27. package/dist/builtin-packs/core/fixtures/ci-required-check/passing/basic/case.json +10 -0
  28. package/dist/builtin-packs/core/fixtures/ci-required-check/violating/basic/case.json +10 -0
  29. package/dist/builtin-packs/core/fixtures/compiler-strict/passing/basic/case.json +10 -0
  30. package/dist/builtin-packs/core/fixtures/compiler-strict/violating/basic/case.json +10 -0
  31. package/dist/builtin-packs/core/fixtures/complexity/passing/basic/case.json +10 -0
  32. package/dist/builtin-packs/core/fixtures/complexity/violating/basic/case.json +10 -0
  33. package/dist/builtin-packs/core/fixtures/context-hard-band/passing/basic/case.json +10 -0
  34. package/dist/builtin-packs/core/fixtures/context-hard-band/violating/basic/case.json +10 -0
  35. package/dist/builtin-packs/core/fixtures/context-soft-band/passing/basic/case.json +10 -0
  36. package/dist/builtin-packs/core/fixtures/context-soft-band/violating/basic/case.json +10 -0
  37. package/dist/builtin-packs/core/fixtures/conventional-commit/passing/basic/case.json +10 -0
  38. package/dist/builtin-packs/core/fixtures/conventional-commit/violating/basic/case.json +10 -0
  39. package/dist/builtin-packs/core/fixtures/coverage-floor/passing/basic/case.json +10 -0
  40. package/dist/builtin-packs/core/fixtures/coverage-floor/violating/basic/case.json +10 -0
  41. package/dist/builtin-packs/core/fixtures/custom-pack-selftest/passing/basic/case.json +10 -0
  42. package/dist/builtin-packs/core/fixtures/custom-pack-selftest/violating/basic/case.json +10 -0
  43. package/dist/builtin-packs/core/fixtures/dangerous-shell/passing/basic/case.json +10 -0
  44. package/dist/builtin-packs/core/fixtures/dangerous-shell/violating/basic/case.json +10 -0
  45. package/dist/builtin-packs/core/fixtures/dead-code/passing/basic/case.json +10 -0
  46. package/dist/builtin-packs/core/fixtures/dead-code/violating/basic/case.json +10 -0
  47. package/dist/builtin-packs/core/fixtures/dep-exact-pin/passing/basic/case.json +10 -0
  48. package/dist/builtin-packs/core/fixtures/dep-exact-pin/violating/basic/case.json +10 -0
  49. package/dist/builtin-packs/core/fixtures/dep-latest-stable/passing/basic/case.json +10 -0
  50. package/dist/builtin-packs/core/fixtures/dep-latest-stable/violating/basic/case.json +10 -0
  51. package/dist/builtin-packs/core/fixtures/dep-license/passing/basic/case.json +10 -0
  52. package/dist/builtin-packs/core/fixtures/dep-license/violating/basic/case.json +10 -0
  53. package/dist/builtin-packs/core/fixtures/dep-lockfile/passing/basic/case.json +10 -0
  54. package/dist/builtin-packs/core/fixtures/dep-lockfile/violating/basic/case.json +10 -0
  55. package/dist/builtin-packs/core/fixtures/dep-new-needs-reason/passing/basic/case.json +10 -0
  56. package/dist/builtin-packs/core/fixtures/dep-new-needs-reason/violating/basic/case.json +10 -0
  57. package/dist/builtin-packs/core/fixtures/dep-no-deprecated/passing/basic/case.json +10 -0
  58. package/dist/builtin-packs/core/fixtures/dep-no-deprecated/violating/basic/case.json +10 -0
  59. package/dist/builtin-packs/core/fixtures/dep-no-vulnerable/passing/basic/case.json +10 -0
  60. package/dist/builtin-packs/core/fixtures/dep-no-vulnerable/violating/basic/case.json +10 -0
  61. package/dist/builtin-packs/core/fixtures/dep-one-per-capability/passing/basic/case.json +10 -0
  62. package/dist/builtin-packs/core/fixtures/dep-one-per-capability/violating/basic/case.json +10 -0
  63. package/dist/builtin-packs/core/fixtures/diagnose-before-fix/passing/basic/case.json +10 -0
  64. package/dist/builtin-packs/core/fixtures/diagnose-before-fix/violating/basic/case.json +10 -0
  65. package/dist/builtin-packs/core/fixtures/doc-breadth/passing/basic/case.json +10 -0
  66. package/dist/builtin-packs/core/fixtures/doc-breadth/violating/basic/case.json +10 -0
  67. package/dist/builtin-packs/core/fixtures/doc-density/passing/basic/case.json +10 -0
  68. package/dist/builtin-packs/core/fixtures/doc-density/violating/basic/case.json +10 -0
  69. package/dist/builtin-packs/core/fixtures/doc-links-valid/passing/basic/case.json +10 -0
  70. package/dist/builtin-packs/core/fixtures/doc-links-valid/violating/basic/case.json +10 -0
  71. package/dist/builtin-packs/core/fixtures/doc-no-corpus-counts/passing/basic/case.json +10 -0
  72. package/dist/builtin-packs/core/fixtures/doc-no-corpus-counts/violating/basic/case.json +10 -0
  73. package/dist/builtin-packs/core/fixtures/doc-no-inline-changelog/passing/basic/case.json +10 -0
  74. package/dist/builtin-packs/core/fixtures/doc-no-inline-changelog/violating/basic/case.json +10 -0
  75. package/dist/builtin-packs/core/fixtures/doc-one-level/passing/basic/case.json +10 -0
  76. package/dist/builtin-packs/core/fixtures/doc-one-level/violating/basic/case.json +10 -0
  77. package/dist/builtin-packs/core/fixtures/doc-placement/passing/basic/case.json +10 -0
  78. package/dist/builtin-packs/core/fixtures/doc-placement/violating/basic/case.json +10 -0
  79. package/dist/builtin-packs/core/fixtures/doc-router-leaf/passing/basic/case.json +10 -0
  80. package/dist/builtin-packs/core/fixtures/doc-router-leaf/violating/basic/case.json +10 -0
  81. package/dist/builtin-packs/core/fixtures/doc-single-owner/passing/basic/case.json +10 -0
  82. package/dist/builtin-packs/core/fixtures/doc-single-owner/violating/basic/case.json +10 -0
  83. package/dist/builtin-packs/core/fixtures/doc-size/passing/basic/case.json +10 -0
  84. package/dist/builtin-packs/core/fixtures/doc-size/violating/basic/case.json +10 -0
  85. package/dist/builtin-packs/core/fixtures/duplication/passing/basic/case.json +10 -0
  86. package/dist/builtin-packs/core/fixtures/duplication/violating/basic/case.json +10 -0
  87. package/dist/builtin-packs/core/fixtures/engine-version-match/passing/basic/case.json +10 -0
  88. package/dist/builtin-packs/core/fixtures/engine-version-match/violating/basic/case.json +10 -0
  89. package/dist/builtin-packs/core/fixtures/file-naming/passing/basic/case.json +10 -0
  90. package/dist/builtin-packs/core/fixtures/file-naming/violating/basic/case.json +10 -0
  91. package/dist/builtin-packs/core/fixtures/file-size/passing/basic/case.json +10 -0
  92. package/dist/builtin-packs/core/fixtures/file-size/violating/basic/case.json +10 -0
  93. package/dist/builtin-packs/core/fixtures/function-size/passing/basic/case.json +10 -0
  94. package/dist/builtin-packs/core/fixtures/function-size/violating/basic/case.json +10 -0
  95. package/dist/builtin-packs/core/fixtures/graph-before-scan/passing/basic/case.json +10 -0
  96. package/dist/builtin-packs/core/fixtures/graph-before-scan/violating/basic/case.json +10 -0
  97. package/dist/builtin-packs/core/fixtures/guardrail-manifest/passing/basic/case.json +10 -0
  98. package/dist/builtin-packs/core/fixtures/guardrail-manifest/violating/basic/case.json +10 -0
  99. package/dist/builtin-packs/core/fixtures/history-append-only/passing/basic/case.json +10 -0
  100. package/dist/builtin-packs/core/fixtures/history-append-only/violating/basic/case.json +10 -0
  101. package/dist/builtin-packs/core/fixtures/history-entry/passing/basic/case.json +10 -0
  102. package/dist/builtin-packs/core/fixtures/history-entry/violating/basic/case.json +10 -0
  103. package/dist/builtin-packs/core/fixtures/history-entry-complete/passing/basic/case.json +10 -0
  104. package/dist/builtin-packs/core/fixtures/history-entry-complete/violating/basic/case.json +10 -0
  105. package/dist/builtin-packs/core/fixtures/hooks-active/passing/basic/case.json +10 -0
  106. package/dist/builtin-packs/core/fixtures/hooks-active/violating/basic/case.json +10 -0
  107. package/dist/builtin-packs/core/fixtures/loop-breaker/passing/basic/case.json +10 -0
  108. package/dist/builtin-packs/core/fixtures/loop-breaker/violating/basic/case.json +10 -0
  109. package/dist/builtin-packs/core/fixtures/max-file-bytes/passing/basic/case.json +10 -0
  110. package/dist/builtin-packs/core/fixtures/max-file-bytes/violating/basic/case.json +10 -0
  111. package/dist/builtin-packs/core/fixtures/mcp-declared/passing/basic/case.json +10 -0
  112. package/dist/builtin-packs/core/fixtures/mcp-declared/violating/basic/case.json +10 -0
  113. package/dist/builtin-packs/core/fixtures/no-assertion-loss/passing/basic/case.json +10 -0
  114. package/dist/builtin-packs/core/fixtures/no-assertion-loss/violating/basic/case.json +10 -0
  115. package/dist/builtin-packs/core/fixtures/no-baseline-raise/passing/basic/case.json +10 -0
  116. package/dist/builtin-packs/core/fixtures/no-baseline-raise/violating/basic/case.json +10 -0
  117. package/dist/builtin-packs/core/fixtures/no-bypass/passing/basic/case.json +10 -0
  118. package/dist/builtin-packs/core/fixtures/no-bypass/violating/basic/case.json +10 -0
  119. package/dist/builtin-packs/core/fixtures/no-fixture-shrink/passing/basic/case.json +10 -0
  120. package/dist/builtin-packs/core/fixtures/no-fixture-shrink/violating/basic/case.json +10 -0
  121. package/dist/builtin-packs/core/fixtures/no-guard-removal/passing/basic/case.json +10 -0
  122. package/dist/builtin-packs/core/fixtures/no-guard-removal/violating/basic/case.json +10 -0
  123. package/dist/builtin-packs/core/fixtures/no-new-suppressions/passing/basic/case.json +10 -0
  124. package/dist/builtin-packs/core/fixtures/no-new-suppressions/violating/basic/case.json +10 -0
  125. package/dist/builtin-packs/core/fixtures/no-secret-reads/passing/basic/case.json +10 -0
  126. package/dist/builtin-packs/core/fixtures/no-secret-reads/violating/basic/case.json +10 -0
  127. package/dist/builtin-packs/core/fixtures/no-secrets/passing/basic/case.json +10 -0
  128. package/dist/builtin-packs/core/fixtures/no-secrets/violating/basic/case.json +10 -0
  129. package/dist/builtin-packs/core/fixtures/no-skipped-tests/passing/basic/case.json +10 -0
  130. package/dist/builtin-packs/core/fixtures/no-skipped-tests/violating/basic/case.json +10 -0
  131. package/dist/builtin-packs/core/fixtures/no-speculative-abstraction/passing/basic/case.json +10 -0
  132. package/dist/builtin-packs/core/fixtures/no-speculative-abstraction/violating/basic/case.json +10 -0
  133. package/dist/builtin-packs/core/fixtures/no-threshold-lowering/passing/basic/case.json +10 -0
  134. package/dist/builtin-packs/core/fixtures/no-threshold-lowering/violating/basic/case.json +10 -0
  135. package/dist/builtin-packs/core/fixtures/perf-budgets/passing/basic/case.json +10 -0
  136. package/dist/builtin-packs/core/fixtures/perf-budgets/violating/basic/case.json +10 -0
  137. package/dist/builtin-packs/core/fixtures/ratchet-touched-improves/passing/basic/case.json +10 -0
  138. package/dist/builtin-packs/core/fixtures/ratchet-touched-improves/violating/basic/case.json +10 -0
  139. package/dist/builtin-packs/core/fixtures/read-dedupe/passing/basic/case.json +10 -0
  140. package/dist/builtin-packs/core/fixtures/read-dedupe/violating/basic/case.json +10 -0
  141. package/dist/builtin-packs/core/fixtures/red-before-green/passing/basic/case.json +10 -0
  142. package/dist/builtin-packs/core/fixtures/red-before-green/violating/basic/case.json +10 -0
  143. package/dist/builtin-packs/core/fixtures/regression-test-for-fix/passing/basic/case.json +10 -0
  144. package/dist/builtin-packs/core/fixtures/regression-test-for-fix/violating/basic/case.json +10 -0
  145. package/dist/builtin-packs/core/fixtures/remediation-step-size/passing/basic/case.json +10 -0
  146. package/dist/builtin-packs/core/fixtures/remediation-step-size/violating/basic/case.json +10 -0
  147. package/dist/builtin-packs/core/fixtures/repo-hygiene/passing/basic/case.json +10 -0
  148. package/dist/builtin-packs/core/fixtures/repo-hygiene/violating/basic/case.json +10 -0
  149. package/dist/builtin-packs/core/fixtures/review-gate/passing/basic/case.json +10 -0
  150. package/dist/builtin-packs/core/fixtures/review-gate/violating/basic/case.json +10 -0
  151. package/dist/builtin-packs/core/fixtures/review-round-cap/passing/basic/case.json +10 -0
  152. package/dist/builtin-packs/core/fixtures/review-round-cap/violating/basic/case.json +10 -0
  153. package/dist/builtin-packs/core/fixtures/session-tool-call-limit/passing/basic/case.json +10 -0
  154. package/dist/builtin-packs/core/fixtures/session-tool-call-limit/violating/basic/case.json +10 -0
  155. package/dist/builtin-packs/core/fixtures/spec-trace/passing/basic/case.json +10 -0
  156. package/dist/builtin-packs/core/fixtures/spec-trace/violating/basic/case.json +10 -0
  157. package/dist/builtin-packs/core/fixtures/test-command-intact/passing/basic/case.json +10 -0
  158. package/dist/builtin-packs/core/fixtures/test-command-intact/violating/basic/case.json +10 -0
  159. package/dist/builtin-packs/core/fixtures/test-kinds-by-scenario/passing/basic/case.json +10 -0
  160. package/dist/builtin-packs/core/fixtures/test-kinds-by-scenario/violating/basic/case.json +10 -0
  161. package/dist/builtin-packs/core/fixtures/waivers-valid/passing/basic/case.json +10 -0
  162. package/dist/builtin-packs/core/fixtures/waivers-valid/violating/basic/case.json +10 -0
  163. package/dist/builtin-packs/core/fixtures/workflow-gates/passing/basic/case.json +10 -0
  164. package/dist/builtin-packs/core/fixtures/workflow-gates/violating/basic/case.json +10 -0
  165. package/dist/builtin-packs/core/fixtures/write-confinement/passing/basic/case.json +10 -0
  166. package/dist/builtin-packs/core/fixtures/write-confinement/violating/basic/case.json +10 -0
  167. package/dist/builtin-packs/core/fixtures/writes-within-plan/passing/basic/case.json +10 -0
  168. package/dist/builtin-packs/core/fixtures/writes-within-plan/violating/basic/case.json +10 -0
  169. package/dist/builtin-packs/core/index.ts +8 -0
  170. package/dist/builtin-packs/core/pack.json +2057 -0
  171. package/dist/builtin-packs/dotnet/index.ts +47 -0
  172. package/dist/builtin-packs/python/extract.ts +245 -0
  173. package/dist/builtin-packs/python/fixtures/lint/passing/basic/case.json +10 -0
  174. package/dist/builtin-packs/python/fixtures/lint/violating/basic/case.json +10 -0
  175. package/dist/builtin-packs/python/fixtures/no-phantom-import/passing/basic/case.json +12 -0
  176. package/dist/builtin-packs/python/fixtures/no-phantom-import/violating/basic/case.json +11 -0
  177. package/dist/builtin-packs/python/fixtures/security-patterns/passing/basic/case.json +10 -0
  178. package/dist/builtin-packs/python/fixtures/security-patterns/violating/basic/case.json +10 -0
  179. package/dist/builtin-packs/python/fixtures/typecheck/passing/basic/case.json +10 -0
  180. package/dist/builtin-packs/python/fixtures/typecheck/violating/basic/case.json +10 -0
  181. package/dist/builtin-packs/python/index.ts +57 -0
  182. package/dist/builtin-packs/python/pack.json +116 -0
  183. package/dist/builtin-packs/typescript/extract-clauses.ts +153 -0
  184. package/dist/builtin-packs/typescript/extract-literals.ts +111 -0
  185. package/dist/builtin-packs/typescript/extract-words.ts +79 -0
  186. package/dist/builtin-packs/typescript/extract.ts +77 -0
  187. package/dist/builtin-packs/typescript/fixtures/lint/passing/basic/case.json +10 -0
  188. package/dist/builtin-packs/typescript/fixtures/lint/violating/basic/case.json +10 -0
  189. package/dist/builtin-packs/typescript/fixtures/no-phantom-import/passing/basic/case.json +10 -0
  190. package/dist/builtin-packs/typescript/fixtures/no-phantom-import/passing/host-provided/case.json +10 -0
  191. package/dist/builtin-packs/typescript/fixtures/no-phantom-import/violating/basic/case.json +10 -0
  192. package/dist/builtin-packs/typescript/fixtures/no-phantom-import/violating/host-provided/case.json +10 -0
  193. package/dist/builtin-packs/typescript/fixtures/security-patterns/passing/basic/case.json +10 -0
  194. package/dist/builtin-packs/typescript/fixtures/security-patterns/violating/basic/case.json +10 -0
  195. package/dist/builtin-packs/typescript/fixtures/typecheck/passing/basic/case.json +10 -0
  196. package/dist/builtin-packs/typescript/fixtures/typecheck/violating/basic/case.json +10 -0
  197. package/dist/builtin-packs/typescript/index.ts +85 -0
  198. package/dist/builtin-packs/typescript/lex.ts +199 -0
  199. package/dist/builtin-packs/typescript/measures-exports.ts +173 -0
  200. package/dist/builtin-packs/typescript/measures-functions.ts +138 -0
  201. package/dist/builtin-packs/typescript/measures.ts +10 -0
  202. package/dist/builtin-packs/typescript/naming.ts +47 -0
  203. package/dist/builtin-packs/typescript/pack.json +169 -0
  204. package/dist/builtin-packs/typescript/patterns.ts +93 -0
  205. package/dist/builtin-packs/typescript/resolve.ts +224 -0
  206. package/dist/builtin-packs/typescript/strict.ts +177 -0
  207. package/dist/builtin-packs/typescript/titles.ts +184 -0
  208. package/dist/cli/baseline.d.ts +3 -0
  209. package/dist/cli/baseline.js +67 -0
  210. package/dist/cli/ci-bot-change.d.ts +3 -0
  211. package/dist/cli/ci-bot-change.js +54 -0
  212. package/dist/cli/ci-range.d.ts +18 -0
  213. package/dist/cli/ci-range.js +228 -0
  214. package/dist/cli/ci-summary.d.ts +3 -0
  215. package/dist/cli/ci-summary.js +45 -0
  216. package/dist/cli/ci.d.ts +4 -0
  217. package/dist/cli/ci.js +195 -0
  218. package/dist/cli/commands.d.ts +5 -0
  219. package/dist/cli/commands.js +39 -0
  220. package/dist/cli/deps.d.ts +3 -0
  221. package/dist/cli/deps.js +115 -0
  222. package/dist/cli/drift.d.ts +11 -0
  223. package/dist/cli/drift.js +91 -0
  224. package/dist/cli/evaluate.d.ts +20 -0
  225. package/dist/cli/evaluate.js +213 -0
  226. package/dist/cli/gate-scope.d.ts +10 -0
  227. package/dist/cli/gate-scope.js +82 -0
  228. package/dist/cli/git-hook.d.ts +3 -0
  229. package/dist/cli/git-hook.js +179 -0
  230. package/dist/cli/guardrail.d.ts +5 -0
  231. package/dist/cli/guardrail.js +190 -0
  232. package/dist/cli/index.d.ts +12 -0
  233. package/dist/cli/index.js +198 -0
  234. package/dist/cli/init-plan.d.ts +23 -0
  235. package/dist/cli/init-plan.js +135 -0
  236. package/dist/cli/init.d.ts +3 -0
  237. package/dist/cli/init.js +122 -0
  238. package/dist/cli/inspect-status.d.ts +8 -0
  239. package/dist/cli/inspect-status.js +164 -0
  240. package/dist/cli/inspect.d.ts +5 -0
  241. package/dist/cli/inspect.js +98 -0
  242. package/dist/cli/main.d.ts +2 -0
  243. package/dist/cli/main.js +60 -0
  244. package/dist/cli/pack-adapters.d.ts +3 -0
  245. package/dist/cli/pack-adapters.js +81 -0
  246. package/dist/cli/packs.d.ts +6 -0
  247. package/dist/cli/packs.js +131 -0
  248. package/dist/cli/plan-launcher.d.ts +1 -0
  249. package/dist/cli/plan-launcher.js +222 -0
  250. package/dist/cli/plan.d.ts +25 -0
  251. package/dist/cli/plan.js +121 -0
  252. package/dist/cli/proofs-test.d.ts +3 -0
  253. package/dist/cli/proofs-test.js +77 -0
  254. package/dist/cli/proofs.d.ts +3 -0
  255. package/dist/cli/proofs.js +168 -0
  256. package/dist/cli/remediation.d.ts +3 -0
  257. package/dist/cli/remediation.js +107 -0
  258. package/dist/cli/report.d.ts +4 -0
  259. package/dist/cli/report.js +93 -0
  260. package/dist/cli/serve-eval.d.ts +2 -0
  261. package/dist/cli/serve-eval.js +165 -0
  262. package/dist/cli/serve-log.d.ts +2 -0
  263. package/dist/cli/serve-log.js +150 -0
  264. package/dist/cli/serve-methods.d.ts +2 -0
  265. package/dist/cli/serve-methods.js +181 -0
  266. package/dist/cli/serve-protocol.d.ts +35 -0
  267. package/dist/cli/serve-protocol.js +97 -0
  268. package/dist/cli/serve-run.d.ts +9 -0
  269. package/dist/cli/serve-run.js +135 -0
  270. package/dist/cli/serve-server.d.ts +5 -0
  271. package/dist/cli/serve-server.js +120 -0
  272. package/dist/cli/serve-shared.d.ts +34 -0
  273. package/dist/cli/serve-shared.js +20 -0
  274. package/dist/cli/serve-status.d.ts +2 -0
  275. package/dist/cli/serve-status.js +130 -0
  276. package/dist/cli/serve-transport.d.ts +2 -0
  277. package/dist/cli/serve-transport.js +114 -0
  278. package/dist/cli/shared.d.ts +35 -0
  279. package/dist/cli/shared.js +181 -0
  280. package/dist/cli/task-advance.d.ts +3 -0
  281. package/dist/cli/task-advance.js +144 -0
  282. package/dist/cli/task-phases.d.ts +3 -0
  283. package/dist/cli/task-phases.js +77 -0
  284. package/dist/cli/tasks.d.ts +12 -0
  285. package/dist/cli/tasks.js +176 -0
  286. package/dist/cli/transparency.d.ts +4 -0
  287. package/dist/cli/transparency.js +197 -0
  288. package/dist/cli/waivers.d.ts +3 -0
  289. package/dist/cli/waivers.js +195 -0
  290. package/dist/features/adapters/claude-code.d.ts +8 -0
  291. package/dist/features/adapters/claude-code.js +198 -0
  292. package/dist/features/adapters/claude-shaped.d.ts +3 -0
  293. package/dist/features/adapters/claude-shaped.js +176 -0
  294. package/dist/features/adapters/codex-cli.d.ts +8 -0
  295. package/dist/features/adapters/codex-cli.js +180 -0
  296. package/dist/features/adapters/contract.d.ts +104 -0
  297. package/dist/features/adapters/contract.js +17 -0
  298. package/dist/features/adapters/copilot-capabilities.d.ts +2 -0
  299. package/dist/features/adapters/copilot-capabilities.js +46 -0
  300. package/dist/features/adapters/copilot.d.ts +8 -0
  301. package/dist/features/adapters/copilot.js +207 -0
  302. package/dist/features/adapters/cursor.d.ts +8 -0
  303. package/dist/features/adapters/cursor.js +245 -0
  304. package/dist/features/adapters/custom-event.d.ts +3 -0
  305. package/dist/features/adapters/custom-event.js +180 -0
  306. package/dist/features/adapters/custom-load.d.ts +3 -0
  307. package/dist/features/adapters/custom-load.js +185 -0
  308. package/dist/features/adapters/custom-shape.d.ts +21 -0
  309. package/dist/features/adapters/custom-shape.js +87 -0
  310. package/dist/features/adapters/custom.d.ts +9 -0
  311. package/dist/features/adapters/custom.js +130 -0
  312. package/dist/features/adapters/effective-cache.d.ts +5 -0
  313. package/dist/features/adapters/effective-cache.js +45 -0
  314. package/dist/features/adapters/gemini-cli.d.ts +6 -0
  315. package/dist/features/adapters/gemini-cli.js +160 -0
  316. package/dist/features/adapters/gemini-tables.d.ts +7 -0
  317. package/dist/features/adapters/gemini-tables.js +104 -0
  318. package/dist/features/adapters/hook-dispatch.d.ts +7 -0
  319. package/dist/features/adapters/hook-dispatch.js +97 -0
  320. package/dist/features/adapters/hook-injection.d.ts +12 -0
  321. package/dist/features/adapters/hook-injection.js +75 -0
  322. package/dist/features/adapters/hook-load.d.ts +15 -0
  323. package/dist/features/adapters/hook-load.js +152 -0
  324. package/dist/features/adapters/hook-scope.d.ts +3 -0
  325. package/dist/features/adapters/hook-scope.js +54 -0
  326. package/dist/features/adapters/index.d.ts +22 -0
  327. package/dist/features/adapters/index.js +86 -0
  328. package/dist/features/adapters/muse-code.d.ts +8 -0
  329. package/dist/features/adapters/muse-code.js +223 -0
  330. package/dist/features/adapters/opencode-bridge.d.ts +1 -0
  331. package/dist/features/adapters/opencode-bridge.js +230 -0
  332. package/dist/features/adapters/opencode-capabilities.d.ts +2 -0
  333. package/dist/features/adapters/opencode-capabilities.js +47 -0
  334. package/dist/features/adapters/opencode-parse.d.ts +3 -0
  335. package/dist/features/adapters/opencode-parse.js +137 -0
  336. package/dist/features/adapters/opencode-tables.d.ts +5 -0
  337. package/dist/features/adapters/opencode-tables.js +63 -0
  338. package/dist/features/adapters/opencode.d.ts +10 -0
  339. package/dist/features/adapters/opencode.js +97 -0
  340. package/dist/features/adapters/runtime.d.ts +25 -0
  341. package/dist/features/adapters/runtime.js +148 -0
  342. package/dist/features/adapters/universal.d.ts +7 -0
  343. package/dist/features/adapters/universal.js +89 -0
  344. package/dist/features/arch/arch-profiles.d.ts +3 -0
  345. package/dist/features/arch/arch-profiles.js +5 -0
  346. package/dist/features/arch/checks.d.ts +25 -0
  347. package/dist/features/arch/checks.js +173 -0
  348. package/dist/features/arch/codictator-modules.d.ts +4 -0
  349. package/dist/features/arch/codictator-modules.js +180 -0
  350. package/dist/features/arch/cycle-walk.d.ts +1 -0
  351. package/dist/features/arch/cycle-walk.js +36 -0
  352. package/dist/features/arch/edge-checks.d.ts +13 -0
  353. package/dist/features/arch/edge-checks.js +186 -0
  354. package/dist/features/arch/graph.d.ts +32 -0
  355. package/dist/features/arch/graph.js +202 -0
  356. package/dist/features/arch/index.d.ts +29 -0
  357. package/dist/features/arch/index.js +16 -0
  358. package/dist/features/arch/layer-rules.d.ts +3 -0
  359. package/dist/features/arch/layer-rules.js +38 -0
  360. package/dist/features/arch/module-map-validation.d.ts +3 -0
  361. package/dist/features/arch/module-map-validation.js +30 -0
  362. package/dist/features/arch/module-mapping.d.ts +15 -0
  363. package/dist/features/arch/module-mapping.js +184 -0
  364. package/dist/features/arch/profiles.d.ts +4 -0
  365. package/dist/features/arch/profiles.js +8 -0
  366. package/dist/features/audit/append.d.ts +26 -0
  367. package/dist/features/audit/append.js +205 -0
  368. package/dist/features/audit/explain-table-tail.d.ts +2 -0
  369. package/dist/features/audit/explain-table-tail.js +29 -0
  370. package/dist/features/audit/explain-table.d.ts +8 -0
  371. package/dist/features/audit/explain-table.js +48 -0
  372. package/dist/features/audit/explain.d.ts +7 -0
  373. package/dist/features/audit/explain.js +87 -0
  374. package/dist/features/audit/index.d.ts +37 -0
  375. package/dist/features/audit/index.js +17 -0
  376. package/dist/features/audit/injection-event.d.ts +11 -0
  377. package/dist/features/audit/injection-event.js +17 -0
  378. package/dist/features/audit/read.d.ts +8 -0
  379. package/dist/features/audit/read.js +62 -0
  380. package/dist/features/audit/summarize.d.ts +1 -0
  381. package/dist/features/audit/summarize.js +41 -0
  382. package/dist/features/audit/surfaces.d.ts +47 -0
  383. package/dist/features/audit/surfaces.js +165 -0
  384. package/dist/features/audit/token-saver-evidence.d.ts +14 -0
  385. package/dist/features/audit/token-saver-evidence.js +85 -0
  386. package/dist/features/ci/changes.d.ts +28 -0
  387. package/dist/features/ci/changes.js +88 -0
  388. package/dist/features/ci/index.d.ts +22 -0
  389. package/dist/features/ci/index.js +75 -0
  390. package/dist/features/ci/protection-read.d.ts +3 -0
  391. package/dist/features/ci/protection-read.js +264 -0
  392. package/dist/features/ci/protection.d.ts +25 -0
  393. package/dist/features/ci/protection.js +77 -0
  394. package/dist/features/ci/workflow.d.ts +23 -0
  395. package/dist/features/ci/workflow.js +261 -0
  396. package/dist/features/config/human.d.ts +4 -0
  397. package/dist/features/config/human.js +31 -0
  398. package/dist/features/config/index.d.ts +37 -0
  399. package/dist/features/config/index.js +129 -0
  400. package/dist/features/config/pack-data.d.ts +18 -0
  401. package/dist/features/config/pack-data.js +116 -0
  402. package/dist/features/config/validate-sections.d.ts +6 -0
  403. package/dist/features/config/validate-sections.js +198 -0
  404. package/dist/features/config/validate-shared.d.ts +8 -0
  405. package/dist/features/config/validate-shared.js +69 -0
  406. package/dist/features/config/validate-tunables.d.ts +1 -0
  407. package/dist/features/config/validate-tunables.js +89 -0
  408. package/dist/features/config/validate.d.ts +2 -0
  409. package/dist/features/config/validate.js +57 -0
  410. package/dist/features/deps/bots.d.ts +5 -0
  411. package/dist/features/deps/bots.js +39 -0
  412. package/dist/features/deps/capabilities.d.ts +3 -0
  413. package/dist/features/deps/capabilities.js +91 -0
  414. package/dist/features/deps/check.d.ts +18 -0
  415. package/dist/features/deps/check.js +70 -0
  416. package/dist/features/deps/dependabot.d.ts +10 -0
  417. package/dist/features/deps/dependabot.js +154 -0
  418. package/dist/features/deps/eval.d.ts +41 -0
  419. package/dist/features/deps/eval.js +24 -0
  420. package/dist/features/deps/fields.d.ts +4 -0
  421. package/dist/features/deps/fields.js +18 -0
  422. package/dist/features/deps/index.d.ts +67 -0
  423. package/dist/features/deps/index.js +27 -0
  424. package/dist/features/deps/lockfile.d.ts +8 -0
  425. package/dist/features/deps/lockfile.js +87 -0
  426. package/dist/features/deps/npm.d.ts +22 -0
  427. package/dist/features/deps/npm.js +172 -0
  428. package/dist/features/deps/npmrc.d.ts +12 -0
  429. package/dist/features/deps/npmrc.js +50 -0
  430. package/dist/features/deps/nuget.d.ts +25 -0
  431. package/dist/features/deps/nuget.js +112 -0
  432. package/dist/features/deps/osv-ranges.d.ts +12 -0
  433. package/dist/features/deps/osv-ranges.js +83 -0
  434. package/dist/features/deps/osv.d.ts +16 -0
  435. package/dist/features/deps/osv.js +144 -0
  436. package/dist/features/deps/pypi-pyproject.d.ts +7 -0
  437. package/dist/features/deps/pypi-pyproject.js +118 -0
  438. package/dist/features/deps/pypi.d.ts +29 -0
  439. package/dist/features/deps/pypi.js +137 -0
  440. package/dist/features/deps/registry.d.ts +29 -0
  441. package/dist/features/deps/registry.js +147 -0
  442. package/dist/features/deps/renovate.d.ts +15 -0
  443. package/dist/features/deps/renovate.js +98 -0
  444. package/dist/features/deps/selection.d.ts +20 -0
  445. package/dist/features/deps/selection.js +150 -0
  446. package/dist/features/deps/snapshot-verdicts.d.ts +16 -0
  447. package/dist/features/deps/snapshot-verdicts.js +184 -0
  448. package/dist/features/deps/stable.d.ts +19 -0
  449. package/dist/features/deps/stable.js +106 -0
  450. package/dist/features/deps/step-size.d.ts +7 -0
  451. package/dist/features/deps/step-size.js +24 -0
  452. package/dist/features/deps/upgrade.d.ts +35 -0
  453. package/dist/features/deps/upgrade.js +114 -0
  454. package/dist/features/deps/verdicts.d.ts +21 -0
  455. package/dist/features/deps/verdicts.js +219 -0
  456. package/dist/features/engine/evaluate.d.ts +12 -0
  457. package/dist/features/engine/evaluate.js +165 -0
  458. package/dist/features/engine/index.d.ts +21 -0
  459. package/dist/features/engine/index.js +24 -0
  460. package/dist/features/engine/message.d.ts +3 -0
  461. package/dist/features/engine/message.js +69 -0
  462. package/dist/features/engine/ratchet.d.ts +1 -0
  463. package/dist/features/engine/ratchet.js +63 -0
  464. package/dist/features/engine/run-enforcer.d.ts +4 -0
  465. package/dist/features/engine/run-enforcer.js +82 -0
  466. package/dist/features/engine/waivers.d.ts +23 -0
  467. package/dist/features/engine/waivers.js +169 -0
  468. package/dist/features/generator/draft.d.ts +7 -0
  469. package/dist/features/generator/draft.js +148 -0
  470. package/dist/features/generator/index.d.ts +22 -0
  471. package/dist/features/generator/index.js +8 -0
  472. package/dist/features/generator/llm-draft.d.ts +3 -0
  473. package/dist/features/generator/llm-draft.js +93 -0
  474. package/dist/features/generator/prompt.d.ts +25 -0
  475. package/dist/features/generator/prompt.js +105 -0
  476. package/dist/features/generator/self-test.d.ts +12 -0
  477. package/dist/features/generator/self-test.js +65 -0
  478. package/dist/features/generator/templates.d.ts +26 -0
  479. package/dist/features/generator/templates.js +177 -0
  480. package/dist/features/integrity/drift.d.ts +19 -0
  481. package/dist/features/integrity/drift.js +168 -0
  482. package/dist/features/integrity/hooks.d.ts +19 -0
  483. package/dist/features/integrity/hooks.js +54 -0
  484. package/dist/features/integrity/index.d.ts +10 -0
  485. package/dist/features/integrity/index.js +14 -0
  486. package/dist/features/integrity/manifest.d.ts +15 -0
  487. package/dist/features/integrity/manifest.js +26 -0
  488. package/dist/features/integrity/self-protection.d.ts +12 -0
  489. package/dist/features/integrity/self-protection.js +144 -0
  490. package/dist/features/llm/attempt.d.ts +17 -0
  491. package/dist/features/llm/attempt.js +99 -0
  492. package/dist/features/llm/errors.d.ts +5 -0
  493. package/dist/features/llm/errors.js +18 -0
  494. package/dist/features/llm/index.d.ts +23 -0
  495. package/dist/features/llm/index.js +46 -0
  496. package/dist/features/llm/presets.d.ts +25 -0
  497. package/dist/features/llm/presets.js +159 -0
  498. package/dist/features/llm/wire.d.ts +17 -0
  499. package/dist/features/llm/wire.js +163 -0
  500. package/dist/features/packs/accept.d.ts +7 -0
  501. package/dist/features/packs/accept.js +73 -0
  502. package/dist/features/packs/enforcers/arch-guards.d.ts +12 -0
  503. package/dist/features/packs/enforcers/arch-guards.js +193 -0
  504. package/dist/features/packs/enforcers/binding.d.ts +31 -0
  505. package/dist/features/packs/enforcers/binding.js +157 -0
  506. package/dist/features/packs/enforcers/ci-guards.d.ts +10 -0
  507. package/dist/features/packs/enforcers/ci-guards.js +128 -0
  508. package/dist/features/packs/enforcers/code-health.d.ts +9 -0
  509. package/dist/features/packs/enforcers/code-health.js +180 -0
  510. package/dist/features/packs/enforcers/code.d.ts +5 -0
  511. package/dist/features/packs/enforcers/code.js +128 -0
  512. package/dist/features/packs/enforcers/command-forbid.d.ts +8 -0
  513. package/dist/features/packs/enforcers/command-forbid.js +61 -0
  514. package/dist/features/packs/enforcers/deps-guards.d.ts +15 -0
  515. package/dist/features/packs/enforcers/deps-guards.js +235 -0
  516. package/dist/features/packs/enforcers/deps-policy-guards.d.ts +9 -0
  517. package/dist/features/packs/enforcers/deps-policy-guards.js +135 -0
  518. package/dist/features/packs/enforcers/docs-guards-measures.d.ts +9 -0
  519. package/dist/features/packs/enforcers/docs-guards-measures.js +117 -0
  520. package/dist/features/packs/enforcers/docs-guards.d.ts +11 -0
  521. package/dist/features/packs/enforcers/docs-guards.js +180 -0
  522. package/dist/features/packs/enforcers/external-attribute.d.ts +18 -0
  523. package/dist/features/packs/enforcers/external-attribute.js +122 -0
  524. package/dist/features/packs/enforcers/external-bind.d.ts +4 -0
  525. package/dist/features/packs/enforcers/external-bind.js +172 -0
  526. package/dist/features/packs/enforcers/external-check.d.ts +7 -0
  527. package/dist/features/packs/enforcers/external-check.js +131 -0
  528. package/dist/features/packs/enforcers/external-output.d.ts +30 -0
  529. package/dist/features/packs/enforcers/external-output.js +144 -0
  530. package/dist/features/packs/enforcers/external-probe.d.ts +4 -0
  531. package/dist/features/packs/enforcers/external-probe.js +65 -0
  532. package/dist/features/packs/enforcers/external-runs.d.ts +33 -0
  533. package/dist/features/packs/enforcers/external-runs.js +162 -0
  534. package/dist/features/packs/enforcers/external-sarif.d.ts +3 -0
  535. package/dist/features/packs/enforcers/external-sarif.js +103 -0
  536. package/dist/features/packs/enforcers/external.d.ts +39 -0
  537. package/dist/features/packs/enforcers/external.js +11 -0
  538. package/dist/features/packs/enforcers/gate-guards.d.ts +12 -0
  539. package/dist/features/packs/enforcers/gate-guards.js +170 -0
  540. package/dist/features/packs/enforcers/health-abstraction.d.ts +5 -0
  541. package/dist/features/packs/enforcers/health-abstraction.js +126 -0
  542. package/dist/features/packs/enforcers/health-duplication.d.ts +5 -0
  543. package/dist/features/packs/enforcers/health-duplication.js +197 -0
  544. package/dist/features/packs/enforcers/health-lex-imports.d.ts +5 -0
  545. package/dist/features/packs/enforcers/health-lex-imports.js +225 -0
  546. package/dist/features/packs/enforcers/health-lex-template.d.ts +10 -0
  547. package/dist/features/packs/enforcers/health-lex-template.js +67 -0
  548. package/dist/features/packs/enforcers/health-lex.d.ts +8 -0
  549. package/dist/features/packs/enforcers/health-lex.js +227 -0
  550. package/dist/features/packs/enforcers/health-markers.d.ts +3 -0
  551. package/dist/features/packs/enforcers/health-markers.js +31 -0
  552. package/dist/features/packs/enforcers/health-measures.d.ts +24 -0
  553. package/dist/features/packs/enforcers/health-measures.js +214 -0
  554. package/dist/features/packs/enforcers/health-refs.d.ts +6 -0
  555. package/dist/features/packs/enforcers/health-refs.js +61 -0
  556. package/dist/features/packs/enforcers/integrity-guards-repo.d.ts +6 -0
  557. package/dist/features/packs/enforcers/integrity-guards-repo.js +189 -0
  558. package/dist/features/packs/enforcers/integrity-guards.d.ts +12 -0
  559. package/dist/features/packs/enforcers/integrity-guards.js +202 -0
  560. package/dist/features/packs/enforcers/jsonkey.d.ts +13 -0
  561. package/dist/features/packs/enforcers/jsonkey.js +95 -0
  562. package/dist/features/packs/enforcers/parametric.d.ts +7 -0
  563. package/dist/features/packs/enforcers/parametric.js +138 -0
  564. package/dist/features/packs/enforcers/pattern.d.ts +11 -0
  565. package/dist/features/packs/enforcers/pattern.js +88 -0
  566. package/dist/features/packs/enforcers/placement.d.ts +10 -0
  567. package/dist/features/packs/enforcers/placement.js +54 -0
  568. package/dist/features/packs/enforcers/py-checks.d.ts +7 -0
  569. package/dist/features/packs/enforcers/py-checks.js +131 -0
  570. package/dist/features/packs/enforcers/py-lex.d.ts +10 -0
  571. package/dist/features/packs/enforcers/py-lex.js +271 -0
  572. package/dist/features/packs/enforcers/py-phantom.d.ts +6 -0
  573. package/dist/features/packs/enforcers/py-phantom.js +163 -0
  574. package/dist/features/packs/enforcers/py-pins.d.ts +16 -0
  575. package/dist/features/packs/enforcers/py-pins.js +184 -0
  576. package/dist/features/packs/enforcers/py-security-patterns.d.ts +18 -0
  577. package/dist/features/packs/enforcers/py-security-patterns.js +70 -0
  578. package/dist/features/packs/enforcers/records-guards.d.ts +12 -0
  579. package/dist/features/packs/enforcers/records-guards.js +178 -0
  580. package/dist/features/packs/enforcers/remediation-guards.d.ts +6 -0
  581. package/dist/features/packs/enforcers/remediation-guards.js +42 -0
  582. package/dist/features/packs/enforcers/required.d.ts +10 -0
  583. package/dist/features/packs/enforcers/required.js +65 -0
  584. package/dist/features/packs/enforcers/secret-scan.d.ts +22 -0
  585. package/dist/features/packs/enforcers/secret-scan.js +179 -0
  586. package/dist/features/packs/enforcers/shell-analyse.d.ts +14 -0
  587. package/dist/features/packs/enforcers/shell-analyse.js +105 -0
  588. package/dist/features/packs/enforcers/sizes.d.ts +10 -0
  589. package/dist/features/packs/enforcers/sizes.js +82 -0
  590. package/dist/features/packs/enforcers/steering-guards.d.ts +11 -0
  591. package/dist/features/packs/enforcers/steering-guards.js +162 -0
  592. package/dist/features/packs/enforcers/testing-guards.d.ts +10 -0
  593. package/dist/features/packs/enforcers/testing-guards.js +118 -0
  594. package/dist/features/packs/enforcers/ts-checks.d.ts +7 -0
  595. package/dist/features/packs/enforcers/ts-checks.js +101 -0
  596. package/dist/features/packs/enforcers/ts-phantom-host.d.ts +11 -0
  597. package/dist/features/packs/enforcers/ts-phantom-host.js +155 -0
  598. package/dist/features/packs/enforcers/ts-phantom.d.ts +6 -0
  599. package/dist/features/packs/enforcers/ts-phantom.js +117 -0
  600. package/dist/features/packs/enforcers/ts-security-patterns.d.ts +18 -0
  601. package/dist/features/packs/enforcers/ts-security-patterns.js +93 -0
  602. package/dist/features/packs/enforcers/workflow-guards.d.ts +10 -0
  603. package/dist/features/packs/enforcers/workflow-guards.js +117 -0
  604. package/dist/features/packs/enforcers/write-confine.d.ts +13 -0
  605. package/dist/features/packs/enforcers/write-confine.js +131 -0
  606. package/dist/features/packs/hashes.d.ts +6 -0
  607. package/dist/features/packs/hashes.js +84 -0
  608. package/dist/features/packs/index.d.ts +22 -0
  609. package/dist/features/packs/index.js +15 -0
  610. package/dist/features/packs/loader.d.ts +13 -0
  611. package/dist/features/packs/loader.js +205 -0
  612. package/dist/features/packs/manifest.d.ts +17 -0
  613. package/dist/features/packs/manifest.js +180 -0
  614. package/dist/features/packs/params.d.ts +2 -0
  615. package/dist/features/packs/params.js +90 -0
  616. package/dist/features/packs/registry.d.ts +11 -0
  617. package/dist/features/packs/registry.js +136 -0
  618. package/dist/features/packs/selftest.d.ts +3 -0
  619. package/dist/features/packs/selftest.js +127 -0
  620. package/dist/features/records/bug-grammar.d.ts +17 -0
  621. package/dist/features/records/bug-grammar.js +128 -0
  622. package/dist/features/records/bug-registry.d.ts +9 -0
  623. package/dist/features/records/bug-registry.js +67 -0
  624. package/dist/features/records/bug-rows-immutable.d.ts +3 -0
  625. package/dist/features/records/bug-rows-immutable.js +52 -0
  626. package/dist/features/records/bugs.d.ts +2 -0
  627. package/dist/features/records/bugs.js +24 -0
  628. package/dist/features/records/docs-lines.d.ts +16 -0
  629. package/dist/features/records/docs-lines.js +36 -0
  630. package/dist/features/records/docs-prose.d.ts +14 -0
  631. package/dist/features/records/docs-prose.js +252 -0
  632. package/dist/features/records/docs-structure.d.ts +17 -0
  633. package/dist/features/records/docs-structure.js +223 -0
  634. package/dist/features/records/docs.d.ts +9 -0
  635. package/dist/features/records/docs.js +238 -0
  636. package/dist/features/records/history-checks.d.ts +6 -0
  637. package/dist/features/records/history-checks.js +94 -0
  638. package/dist/features/records/history-parse.d.ts +16 -0
  639. package/dist/features/records/history-parse.js +101 -0
  640. package/dist/features/records/history-scope.d.ts +5 -0
  641. package/dist/features/records/history-scope.js +86 -0
  642. package/dist/features/records/history.d.ts +3 -0
  643. package/dist/features/records/history.js +5 -0
  644. package/dist/features/records/index.d.ts +8 -0
  645. package/dist/features/records/index.js +11 -0
  646. package/dist/features/remediation/adoption.d.ts +32 -0
  647. package/dist/features/remediation/adoption.js +131 -0
  648. package/dist/features/remediation/index.d.ts +12 -0
  649. package/dist/features/remediation/index.js +21 -0
  650. package/dist/features/remediation/plan-chains.d.ts +3 -0
  651. package/dist/features/remediation/plan-chains.js +111 -0
  652. package/dist/features/remediation/plan-generate.d.ts +3 -0
  653. package/dist/features/remediation/plan-generate.js +129 -0
  654. package/dist/features/remediation/plan-kinds.d.ts +32 -0
  655. package/dist/features/remediation/plan-kinds.js +42 -0
  656. package/dist/features/remediation/plan-markers.d.ts +2 -0
  657. package/dist/features/remediation/plan-markers.js +155 -0
  658. package/dist/features/remediation/plan-merge.d.ts +6 -0
  659. package/dist/features/remediation/plan-merge.js +33 -0
  660. package/dist/features/remediation/plan.d.ts +4 -0
  661. package/dist/features/remediation/plan.js +7 -0
  662. package/dist/features/remediation/step-floor.d.ts +5 -0
  663. package/dist/features/remediation/step-floor.js +76 -0
  664. package/dist/features/remediation/step-gates.d.ts +18 -0
  665. package/dist/features/remediation/step-gates.js +77 -0
  666. package/dist/features/remediation/step-split.d.ts +12 -0
  667. package/dist/features/remediation/step-split.js +75 -0
  668. package/dist/features/remediation/steps.d.ts +3 -0
  669. package/dist/features/remediation/steps.js +6 -0
  670. package/dist/features/remediation/types.d.ts +37 -0
  671. package/dist/features/remediation/types.js +1 -0
  672. package/dist/features/security/index.d.ts +12 -0
  673. package/dist/features/security/index.js +142 -0
  674. package/dist/features/steering/agent-assets.d.ts +7 -0
  675. package/dist/features/steering/agent-assets.js +75 -0
  676. package/dist/features/steering/budgets.d.ts +20 -0
  677. package/dist/features/steering/budgets.js +86 -0
  678. package/dist/features/steering/checks.d.ts +7 -0
  679. package/dist/features/steering/checks.js +67 -0
  680. package/dist/features/steering/context-file.d.ts +11 -0
  681. package/dist/features/steering/context-file.js +107 -0
  682. package/dist/features/steering/graph-scan.d.ts +7 -0
  683. package/dist/features/steering/graph-scan.js +17 -0
  684. package/dist/features/steering/index.d.ts +30 -0
  685. package/dist/features/steering/index.js +45 -0
  686. package/dist/features/steering/injection.d.ts +23 -0
  687. package/dist/features/steering/injection.js +124 -0
  688. package/dist/features/steering/mcp.d.ts +2 -0
  689. package/dist/features/steering/mcp.js +18 -0
  690. package/dist/features/steering/precedence.d.ts +10 -0
  691. package/dist/features/steering/precedence.js +28 -0
  692. package/dist/features/steering/read-cache.d.ts +13 -0
  693. package/dist/features/steering/read-cache.js +51 -0
  694. package/dist/features/testing/base.d.ts +1 -0
  695. package/dist/features/testing/base.js +8 -0
  696. package/dist/features/testing/covers.d.ts +8 -0
  697. package/dist/features/testing/covers.js +50 -0
  698. package/dist/features/testing/evaluate.d.ts +19 -0
  699. package/dist/features/testing/evaluate.js +47 -0
  700. package/dist/features/testing/index.d.ts +10 -0
  701. package/dist/features/testing/index.js +13 -0
  702. package/dist/features/testing/integrity.d.ts +28 -0
  703. package/dist/features/testing/integrity.js +140 -0
  704. package/dist/features/testing/ledger.d.ts +11 -0
  705. package/dist/features/testing/ledger.js +51 -0
  706. package/dist/features/testing/proofs.d.ts +26 -0
  707. package/dist/features/testing/proofs.js +88 -0
  708. package/dist/features/testing/report.d.ts +6 -0
  709. package/dist/features/testing/report.js +16 -0
  710. package/dist/features/testing/scenarios.d.ts +34 -0
  711. package/dist/features/testing/scenarios.js +90 -0
  712. package/dist/features/testing/tap-parser.d.ts +9 -0
  713. package/dist/features/testing/tap-parser.js +84 -0
  714. package/dist/features/testing/trace.d.ts +23 -0
  715. package/dist/features/testing/trace.js +110 -0
  716. package/dist/features/workflow/index.d.ts +14 -0
  717. package/dist/features/workflow/index.js +19 -0
  718. package/dist/features/workflow/loop.d.ts +5 -0
  719. package/dist/features/workflow/loop.js +36 -0
  720. package/dist/features/workflow/phases.d.ts +10 -0
  721. package/dist/features/workflow/phases.js +181 -0
  722. package/dist/features/workflow/review.d.ts +25 -0
  723. package/dist/features/workflow/review.js +112 -0
  724. package/dist/features/workflow/tasks.d.ts +73 -0
  725. package/dist/features/workflow/tasks.js +80 -0
  726. package/dist/features/workflow/writes.d.ts +8 -0
  727. package/dist/features/workflow/writes.js +96 -0
  728. package/dist/kernel/clock.d.ts +4 -0
  729. package/dist/kernel/clock.js +5 -0
  730. package/dist/kernel/config-keys.d.ts +2 -0
  731. package/dist/kernel/config-keys.js +5 -0
  732. package/dist/kernel/config-toml-keys.d.ts +2 -0
  733. package/dist/kernel/config-toml-keys.js +237 -0
  734. package/dist/kernel/config-yaml-keys.d.ts +2 -0
  735. package/dist/kernel/config-yaml-keys.js +177 -0
  736. package/dist/kernel/contracts.d.ts +76 -0
  737. package/dist/kernel/contracts.js +9 -0
  738. package/dist/kernel/entry.d.ts +1 -0
  739. package/dist/kernel/entry.js +31 -0
  740. package/dist/kernel/env.d.ts +4 -0
  741. package/dist/kernel/env.js +5 -0
  742. package/dist/kernel/errors.d.ts +7 -0
  743. package/dist/kernel/errors.js +6 -0
  744. package/dist/kernel/fs-confine.d.ts +14 -0
  745. package/dist/kernel/fs-confine.js +129 -0
  746. package/dist/kernel/fs-errors.d.ts +8 -0
  747. package/dist/kernel/fs-errors.js +37 -0
  748. package/dist/kernel/fs.d.ts +28 -0
  749. package/dist/kernel/fs.js +245 -0
  750. package/dist/kernel/git.d.ts +16 -0
  751. package/dist/kernel/git.js +125 -0
  752. package/dist/kernel/glob.d.ts +1 -0
  753. package/dist/kernel/glob.js +178 -0
  754. package/dist/kernel/hash.d.ts +3 -0
  755. package/dist/kernel/hash.js +12 -0
  756. package/dist/kernel/host.d.ts +3 -0
  757. package/dist/kernel/host.js +48 -0
  758. package/dist/kernel/index.d.ts +115 -0
  759. package/dist/kernel/index.js +33 -0
  760. package/dist/kernel/json.d.ts +4 -0
  761. package/dist/kernel/json.js +68 -0
  762. package/dist/kernel/net-allow.d.ts +8 -0
  763. package/dist/kernel/net-allow.js +45 -0
  764. package/dist/kernel/net-fetch.d.ts +5 -0
  765. package/dist/kernel/net-fetch.js +135 -0
  766. package/dist/kernel/net.d.ts +10 -0
  767. package/dist/kernel/net.js +24 -0
  768. package/dist/kernel/path.d.ts +3 -0
  769. package/dist/kernel/path.js +40 -0
  770. package/dist/kernel/pattern.d.ts +2 -0
  771. package/dist/kernel/pattern.js +116 -0
  772. package/dist/kernel/proc.d.ts +6 -0
  773. package/dist/kernel/proc.js +207 -0
  774. package/dist/kernel/read-cache.d.ts +6 -0
  775. package/dist/kernel/read-cache.js +27 -0
  776. package/dist/kernel/redact.d.ts +1 -0
  777. package/dist/kernel/redact.js +206 -0
  778. package/dist/kernel/repo-root.d.ts +3 -0
  779. package/dist/kernel/repo-root.js +29 -0
  780. package/dist/kernel/result.d.ts +10 -0
  781. package/dist/kernel/result.js +6 -0
  782. package/dist/kernel/schema-helpers.d.ts +11 -0
  783. package/dist/kernel/schema-helpers.js +101 -0
  784. package/dist/kernel/schema.d.ts +2 -0
  785. package/dist/kernel/schema.js +203 -0
  786. package/dist/kernel/secret-paths.d.ts +3 -0
  787. package/dist/kernel/secret-paths.js +56 -0
  788. package/dist/kernel/shell-bypass.d.ts +4 -0
  789. package/dist/kernel/shell-bypass.js +151 -0
  790. package/dist/kernel/shell-cmd.d.ts +6 -0
  791. package/dist/kernel/shell-cmd.js +196 -0
  792. package/dist/kernel/shell-deny-cmd.d.ts +7 -0
  793. package/dist/kernel/shell-deny-cmd.js +35 -0
  794. package/dist/kernel/shell-deny-destroy.d.ts +7 -0
  795. package/dist/kernel/shell-deny-destroy.js +71 -0
  796. package/dist/kernel/shell-deny-escalate.d.ts +7 -0
  797. package/dist/kernel/shell-deny-escalate.js +96 -0
  798. package/dist/kernel/shell-deny-target.d.ts +4 -0
  799. package/dist/kernel/shell-deny-target.js +51 -0
  800. package/dist/kernel/shell-deny.d.ts +8 -0
  801. package/dist/kernel/shell-deny.js +171 -0
  802. package/dist/kernel/shell-scan.d.ts +3 -0
  803. package/dist/kernel/shell-scan.js +226 -0
  804. package/dist/kernel/shell-word.d.ts +15 -0
  805. package/dist/kernel/shell-word.js +216 -0
  806. package/dist/kernel/shell.d.ts +22 -0
  807. package/dist/kernel/shell.js +2 -0
  808. package/dist/kernel/stdin.d.ts +2 -0
  809. package/dist/kernel/stdin.js +59 -0
  810. package/dist/kernel/test-report.d.ts +7 -0
  811. package/dist/kernel/test-report.js +112 -0
  812. package/dist/kernel/version.d.ts +2 -0
  813. package/dist/kernel/version.js +46 -0
  814. package/dist/tsconfig.build.tsbuildinfo +1 -0
  815. package/package.json +19 -11
  816. package/schema/accepted.schema.json +20 -0
  817. package/schema/baseline.schema.json +17 -0
  818. package/schema/capability.schema.json +31 -0
  819. package/schema/cli/error.schema.json +15 -0
  820. package/schema/cli/explain.schema.json +19 -0
  821. package/schema/cli/report.schema.json +15 -0
  822. package/schema/cli/status.schema.json +51 -0
  823. package/schema/cli/verify.schema.json +15 -0
  824. package/schema/config.schema.json +43 -0
  825. package/schema/event-log.schema.json +52 -0
  826. package/schema/hook-decision.schema.json +13 -0
  827. package/schema/hook-event.schema.json +50 -0
  828. package/schema/manifest.schema.json +26 -0
  829. package/schema/pack-draft.schema.json +42 -0
  830. package/schema/pack.schema.json +70 -0
  831. package/schema/registry-snapshot.schema.json +41 -0
  832. package/schema/remediation-plan.schema.json +44 -0
  833. package/schema/review-findings.schema.json +25 -0
  834. package/schema/task-record.schema.json +49 -0
  835. package/schema/waivers.schema.json +29 -0
@@ -0,0 +1,88 @@
1
+ const RECOGNISED_BOTS = ["renovate[bot]", "dependabot[bot]"];
2
+ const MANIFEST_BASENAMES = new Set([
3
+ "package.json",
4
+ "package-lock.json",
5
+ "pnpm-lock.yaml",
6
+ "yarn.lock",
7
+ "bun.lockb",
8
+ "Gemfile.lock",
9
+ "poetry.lock",
10
+ "requirements.txt",
11
+ "renovate.json",
12
+ "renovate.json5",
13
+ ".renovaterc",
14
+ ".renovaterc.json",
15
+ "dependabot.yml",
16
+ ".nvmrc",
17
+ ]);
18
+ export function isRecognisedBot(author, trailerExempt) {
19
+ return RECOGNISED_BOTS.includes(author) || trailerExempt.includes(author);
20
+ }
21
+ function touchesOnlyManifests(files) {
22
+ if (files.length === 0) {
23
+ return false;
24
+ }
25
+ return files.every((file) => {
26
+ const base = file.replaceAll("\\", "/").split("/").pop() ?? file;
27
+ return MANIFEST_BASENAMES.has(base) || base.endsWith(".lock");
28
+ });
29
+ }
30
+ // SPEC §4.15.3: a PR qualifies when its commits only touch manifests and
31
+ // lockfiles and its author is a recognised bot. Fork PRs are never written
32
+ // to; their entries are required as usual (EC-8).
33
+ export function qualifyBotChange(input) {
34
+ if (!isRecognisedBot(input.author, input.trailerExempt)) {
35
+ return { qualifies: false, writeCommit: false, findings: [] };
36
+ }
37
+ if (!touchesOnlyManifests(input.filesChanged)) {
38
+ return {
39
+ qualifies: false,
40
+ writeCommit: false,
41
+ findings: [
42
+ {
43
+ ruleId: "core/history-entry",
44
+ message: `bot PR by ${input.author} touches non-manifest files: the history entry is required`,
45
+ remediation: "Record the change in docs/HISTORY like any other change (§4.15.3).",
46
+ },
47
+ ],
48
+ };
49
+ }
50
+ if (input.isFork) {
51
+ return {
52
+ qualifies: true,
53
+ writeCommit: false,
54
+ findings: [
55
+ {
56
+ ruleId: "core/history-entry",
57
+ message: "bot PR from a fork: no commit written; the history entry is required",
58
+ remediation: "Carry the deps entry in the PR body or a follow-up commit (EC-8).",
59
+ },
60
+ ],
61
+ };
62
+ }
63
+ return { qualifies: true, writeCommit: true, findings: [] };
64
+ }
65
+ // SPEC §4.15.4: changes to committed state go to a single codictator/sweep
66
+ // PR updated in place, never to the default branch (EC-9). A sweep that
67
+ // finds a new floor finding on the default branch fails (EC-10).
68
+ export function planSweep(input) {
69
+ return {
70
+ pr: "codictator/sweep",
71
+ action: input.sweepPrOpen ? "update-in-place" : "create",
72
+ findings: [...input.floorFindings],
73
+ };
74
+ }
75
+ // SPEC §4.15.6: host external skips workflow generation; without the human
76
+ // confirmation record the gate stays unverified everywhere.
77
+ export function externalCiStatus(options) {
78
+ if (options.host === "github" || options.confirmed) {
79
+ return [];
80
+ }
81
+ return [
82
+ {
83
+ ruleId: "core/ci-present",
84
+ message: "external CI host without a confirmation record: the gate is unverified",
85
+ remediation: "Wire `npx --no-install codictator ci verify --base <sha> --head <sha>` as a required check and confirm it (§4.15.6).",
86
+ },
87
+ ];
88
+ }
@@ -0,0 +1,22 @@
1
+ import type { CheckContext, Finding } from "../engine/index.ts";
2
+ import { type BotChangeInput, externalCiStatus, planSweep, qualifyBotChange, type SweepInput } from "./changes.ts";
3
+ import { type BaseRefInput, checkActionsPinned, evaluateProtection, type PinnedUse, type ProtectionRead, resolveBaseRef } from "./protection.ts";
4
+ import { readProtection } from "./protection-read.ts";
5
+ import { type CiWorkflow, FALLBACK_PINS, type RenderWorkflowOptions, scheduleCronFor, type WorkflowPins } from "./workflow.ts";
6
+ export type { BaseRefInput, BotChangeInput, CiWorkflow, PinnedUse, ProtectionRead, RenderWorkflowOptions, SweepInput, WorkflowPins, };
7
+ export { checkActionsPinned, evaluateProtection, externalCiStatus, FALLBACK_PINS, planSweep, qualifyBotChange, readProtection, resolveBaseRef, scheduleCronFor, };
8
+ export interface CiEvidence {
9
+ readonly baseReachable?: boolean;
10
+ readonly forkPr?: boolean;
11
+ readonly protection?: ProtectionRead;
12
+ readonly unpinnedUses?: ReadonlyArray<PinnedUse>;
13
+ readonly workflowDrifted?: boolean;
14
+ readonly botChange?: BotChangeInput;
15
+ readonly sweep?: SweepInput;
16
+ readonly external?: {
17
+ readonly host: "github" | "external";
18
+ readonly confirmed: boolean;
19
+ };
20
+ }
21
+ export declare function renderWorkflow(repoRoot: string, options?: RenderWorkflowOptions): CiWorkflow;
22
+ export declare function checkCi(_ctx: CheckContext, workflow: CiWorkflow, evidence?: CiEvidence): Array<Finding>;
@@ -0,0 +1,75 @@
1
+ import { externalCiStatus, planSweep, qualifyBotChange, } from "./changes.js";
2
+ import { checkActionsPinned, evaluateProtection, resolveBaseRef, } from "./protection.js";
3
+ import { readProtection } from "./protection-read.js";
4
+ import { FALLBACK_PINS, renderWorkflow as renderWorkflowImpl, scheduleCronFor, } from "./workflow.js";
5
+ export { checkActionsPinned, evaluateProtection, externalCiStatus, FALLBACK_PINS, planSweep, qualifyBotChange, readProtection, resolveBaseRef, scheduleCronFor, };
6
+ // SPEC §4.15.1: generated workflow rendering.
7
+ export function renderWorkflow(repoRoot, options) {
8
+ return renderWorkflowImpl(repoRoot, options);
9
+ }
10
+ function unreachableBase() {
11
+ return {
12
+ ruleId: "core/ci-present",
13
+ code: "CDX-E503",
14
+ message: "CI base commit reachability is unconfirmed: blocking fail-closed",
15
+ remediation: "Fetch with fetch-depth 0 so the base is reachable, then rerun (EC-2).",
16
+ };
17
+ }
18
+ // SPEC §4.15.2 core/ci-actions-pinned: without caller evidence the check
19
+ // reads the rendered workflow's own uses: entries (the trailing version
20
+ // comment is not part of the ref). No rendered text to read fails closed.
21
+ const WORKFLOW_USES_LINE = /^\s*-\s*uses:\s*(\S+)/;
22
+ const GENERATED_WORKFLOW_FILE = ".github/workflows/codictator.yml";
23
+ function defaultUses(workflow) {
24
+ if (workflow.text === undefined) {
25
+ return [{ file: GENERATED_WORKFLOW_FILE, uses: "actions/checkout" }];
26
+ }
27
+ const found = [];
28
+ for (const line of workflow.text.split("\n")) {
29
+ const ref = WORKFLOW_USES_LINE.exec(line)?.[1];
30
+ if (ref !== undefined) {
31
+ found.push({ file: GENERATED_WORKFLOW_FILE, uses: ref });
32
+ }
33
+ }
34
+ return found;
35
+ }
36
+ // SPEC §4.15.2: CI-side checks (required checks present, no bypass).
37
+ // Defaults fail closed: unknown base → CDX-E503, unreadable protection →
38
+ // advise, unpinned steps → core/ci-actions-pinned.
39
+ export function checkCi(_ctx, workflow, evidence) {
40
+ const findings = [];
41
+ if (evidence?.baseReachable !== true) {
42
+ findings.push(unreachableBase());
43
+ }
44
+ findings.push(...evaluateProtection(evidence?.protection));
45
+ if (evidence?.unpinnedUses !== undefined) {
46
+ findings.push(...checkActionsPinned(evidence.unpinnedUses));
47
+ }
48
+ else if (workflow.host === "github") {
49
+ findings.push(...checkActionsPinned(defaultUses(workflow)));
50
+ }
51
+ if (evidence?.workflowDrifted === true) {
52
+ findings.push({
53
+ ruleId: "core/guardrail-manifest",
54
+ message: "CI workflow differs from its manifest entry (for example continue-on-error added)",
55
+ remediation: "Restore the workflow with `codictator regen` (EC-4).",
56
+ });
57
+ }
58
+ if (evidence?.botChange !== undefined) {
59
+ findings.push(...qualifyBotChange(evidence.botChange).findings);
60
+ }
61
+ else if (evidence?.forkPr === true) {
62
+ findings.push({
63
+ ruleId: "core/ci-required-check",
64
+ message: "PR from a fork with a read-only token: verify runs, protection reads only advise",
65
+ remediation: "Confirm the required check on the merge commit by hand (EC-1).",
66
+ });
67
+ }
68
+ if (evidence?.sweep !== undefined) {
69
+ findings.push(...planSweep(evidence.sweep).findings);
70
+ }
71
+ if (evidence?.external !== undefined) {
72
+ findings.push(...externalCiStatus(evidence.external));
73
+ }
74
+ return findings;
75
+ }
@@ -0,0 +1,3 @@
1
+ import { type Env, type Net } from "../../kernel/index.ts";
2
+ import type { ProtectionRead } from "./protection.ts";
3
+ export declare function readProtection(net: Net, env: Env): Promise<ProtectionRead | undefined>;
@@ -0,0 +1,264 @@
1
+ // SPEC §4.15.2 + §4.15.7 EC-1/EC-6: the live branch-protection read behind
2
+ // `ci verify`. Pure over Net/Env: branch rules go first, classic second;
3
+ // unreadable resolves to undefined (advise), readable classic 404 to
4
+ // blocking (EC-7, reported-not-protected).
5
+ import { parseJson } from "../../kernel/index.js";
6
+ const DEFAULT_API_URL = "https://api.github.com";
7
+ const REQUEST_TIMEOUT_MS = 10_000;
8
+ function isRecord(value) {
9
+ return typeof value === "object" && value !== null && !Array.isArray(value);
10
+ }
11
+ // Dynamic-key read: literal dot access would widen the unknown, and literal
12
+ // bracket access trips useLiteralKeys, so every JSON field goes through here.
13
+ function field(record, key) {
14
+ return record[key];
15
+ }
16
+ function stringItems(value) {
17
+ if (!Array.isArray(value)) {
18
+ return undefined;
19
+ }
20
+ const out = [];
21
+ for (const item of value) {
22
+ if (typeof item !== "string") {
23
+ return undefined;
24
+ }
25
+ out.push(item);
26
+ }
27
+ return out;
28
+ }
29
+ // Classic protection bodies list required contexts two ways: the legacy
30
+ // `contexts` strings and the newer `checks` objects carrying `context`.
31
+ // Null or absent means no required checks (fail closed downstream), while a
32
+ // malformed shape means the read cannot be trusted (advise downstream).
33
+ function requiredContexts(checks) {
34
+ if (checks === null || checks === undefined) {
35
+ return [];
36
+ }
37
+ if (!isRecord(checks)) {
38
+ return undefined;
39
+ }
40
+ const legacy = stringItems(field(checks, "contexts"));
41
+ if (legacy !== undefined) {
42
+ return legacy;
43
+ }
44
+ const modern = field(checks, "checks");
45
+ if (!Array.isArray(modern)) {
46
+ return undefined;
47
+ }
48
+ const out = [];
49
+ for (const entry of modern) {
50
+ if (!isRecord(entry)) {
51
+ return undefined;
52
+ }
53
+ const context = field(entry, "context");
54
+ if (typeof context !== "string") {
55
+ return undefined;
56
+ }
57
+ out.push(context);
58
+ }
59
+ return out;
60
+ }
61
+ function enabledFlag(body, key) {
62
+ if (!isRecord(body)) {
63
+ return undefined;
64
+ }
65
+ const section = field(body, key);
66
+ if (!isRecord(section)) {
67
+ return undefined;
68
+ }
69
+ const enabled = field(section, "enabled");
70
+ return typeof enabled === "boolean" ? enabled : undefined;
71
+ }
72
+ function defaultBranchOf(body) {
73
+ if (!isRecord(body)) {
74
+ return undefined;
75
+ }
76
+ const branch = field(body, "default_branch");
77
+ return typeof branch === "string" && branch !== "" ? branch : undefined;
78
+ }
79
+ // SPEC §4.15.2: a required check is verify-shaped when its context is the
80
+ // gate's name. Matrix jobs append a parenthesised suffix (`verify
81
+ // (ubuntu-latest)`), stripped before the exact match, so `pre-verify` fails.
82
+ function verifyBaseOf(context) {
83
+ return context
84
+ .replace(/\s*\([^)]*\)\s*$/, "")
85
+ .trim()
86
+ .toLowerCase();
87
+ }
88
+ function verifyRequiredIn(contexts) {
89
+ return contexts.some((context) => verifyBaseOf(context) === "verify");
90
+ }
91
+ // SPEC §4.15.2: the branch-rules endpoint answers an array of repository
92
+ // rules; anything else falls through to classic, never assumes.
93
+ function protectionFromRuleset(rulesBody, repoBody) {
94
+ const parsed = parseJson(rulesBody);
95
+ if (!parsed.ok || !Array.isArray(parsed.value)) {
96
+ return undefined;
97
+ }
98
+ const contexts = [];
99
+ let forcePushBlocked = false;
100
+ let deletionBlocked = false;
101
+ for (const entry of parsed.value) {
102
+ if (!isRecord(entry) || typeof field(entry, "type") !== "string") {
103
+ return undefined;
104
+ }
105
+ const type = field(entry, "type");
106
+ forcePushBlocked = forcePushBlocked || type === "non_fast_forward";
107
+ deletionBlocked = deletionBlocked || type === "deletion";
108
+ if (type !== "required_status_checks") {
109
+ continue;
110
+ }
111
+ const params = field(entry, "parameters");
112
+ if (!isRecord(params)) {
113
+ return undefined;
114
+ }
115
+ const checks = field(params, "required_status_checks");
116
+ if (!Array.isArray(checks)) {
117
+ return undefined;
118
+ }
119
+ for (const check of checks) {
120
+ if (!isRecord(check)) {
121
+ return undefined;
122
+ }
123
+ const context = field(check, "context");
124
+ if (typeof context !== "string") {
125
+ return undefined;
126
+ }
127
+ contexts.push(context);
128
+ }
129
+ }
130
+ const squash = isRecord(repoBody)
131
+ ? field(repoBody, "allow_squash_merge")
132
+ : undefined;
133
+ return {
134
+ readable: true,
135
+ verifyRequired: verifyRequiredIn(contexts),
136
+ forcePushBlocked,
137
+ deletionBlocked,
138
+ ...(typeof squash === "boolean" ? { allowSquashMerge: squash } : {}),
139
+ };
140
+ }
141
+ function protectionFrom(body) {
142
+ const parsed = parseJson(body);
143
+ if (!parsed.ok || !isRecord(parsed.value)) {
144
+ return undefined;
145
+ }
146
+ const contexts = requiredContexts(field(parsed.value, "required_status_checks"));
147
+ if (contexts === undefined) {
148
+ return undefined;
149
+ }
150
+ const squash = field(parsed.value, "allow_squash_merge");
151
+ const forcePushes = enabledFlag(parsed.value, "allow_force_pushes");
152
+ const deletions = enabledFlag(parsed.value, "allow_deletions");
153
+ return {
154
+ readable: true,
155
+ verifyRequired: verifyRequiredIn(contexts),
156
+ ...(forcePushes === undefined ? {} : { forcePushBlocked: !forcePushes }),
157
+ ...(deletions === undefined ? {} : { deletionBlocked: !deletions }),
158
+ ...(typeof squash === "boolean" ? { allowSquashMerge: squash } : {}),
159
+ };
160
+ }
161
+ // SPEC §4.15.2 EC-7: reported-not-protected is readable, so every missing
162
+ // setting blocks instead of advising.
163
+ function unprotectedRead() {
164
+ return {
165
+ readable: true,
166
+ verifyRequired: false,
167
+ forcePushBlocked: false,
168
+ deletionBlocked: false,
169
+ allowSquashMerge: true,
170
+ };
171
+ }
172
+ function repoRefOf(value) {
173
+ if (value === undefined || value === "") {
174
+ return undefined;
175
+ }
176
+ const parts = value.split("/");
177
+ if (parts.length !== 2) {
178
+ return undefined;
179
+ }
180
+ const owner = parts[0];
181
+ const repo = parts[1];
182
+ if (owner === undefined ||
183
+ owner === "" ||
184
+ repo === undefined ||
185
+ repo === "") {
186
+ return undefined;
187
+ }
188
+ return { owner, repo };
189
+ }
190
+ function repoUrl(api, ref) {
191
+ return `${api}/repos/${encodeURIComponent(ref.owner)}/${encodeURIComponent(ref.repo)}`;
192
+ }
193
+ // SPEC §4.15.7 EC-1/EC-6: outside Actions, without a token, or on any
194
+ // unreadable answer (403, timeout, network error) the read is absent and the
195
+ // gate advises; it never throws, so a host outage cannot fail the run.
196
+ export async function readProtection(net, env) {
197
+ if (env.get("GITHUB_ACTIONS") !== "true") {
198
+ return undefined;
199
+ }
200
+ const token = env.get("GITHUB_TOKEN");
201
+ const ref = repoRefOf(env.get("GITHUB_REPOSITORY"));
202
+ if (token === undefined || token === "" || ref === undefined) {
203
+ return undefined;
204
+ }
205
+ const api = (env.get("GITHUB_API_URL") ?? DEFAULT_API_URL).replace(/\/+$/, "");
206
+ if (api === "") {
207
+ return undefined;
208
+ }
209
+ const headers = {
210
+ Accept: "application/vnd.github+json",
211
+ Authorization: `Bearer ${token}`,
212
+ // GitHub rejects API calls without a UA (403 "Request forbidden by
213
+ // administrative rules"); without this the read always advises.
214
+ "User-Agent": "codictator",
215
+ "X-GitHub-Api-Version": "2022-11-28",
216
+ };
217
+ const repoSeen = await net.request({
218
+ method: "GET",
219
+ url: repoUrl(api, ref),
220
+ headers,
221
+ timeoutMs: REQUEST_TIMEOUT_MS,
222
+ });
223
+ if (!repoSeen.ok || repoSeen.value.status !== 200) {
224
+ return undefined;
225
+ }
226
+ const repoParsed = parseJson(repoSeen.value.body);
227
+ if (!repoParsed.ok) {
228
+ return undefined;
229
+ }
230
+ const branch = defaultBranchOf(repoParsed.value);
231
+ if (branch === undefined) {
232
+ return undefined;
233
+ }
234
+ // SPEC §4.15.2: rulesets first; unreadable or untrustworthy answers
235
+ // fall through to classic, only a readable ruleset resolves here.
236
+ const rulesSeen = await net.request({
237
+ method: "GET",
238
+ url: `${repoUrl(api, ref)}/rules/branches/${encodeURIComponent(branch)}`,
239
+ headers,
240
+ timeoutMs: REQUEST_TIMEOUT_MS,
241
+ });
242
+ if (rulesSeen.ok && rulesSeen.value.status === 200) {
243
+ const ruleset = protectionFromRuleset(rulesSeen.value.body, repoParsed.value);
244
+ if (ruleset !== undefined) {
245
+ return ruleset;
246
+ }
247
+ }
248
+ const seen = await net.request({
249
+ method: "GET",
250
+ url: `${repoUrl(api, ref)}/branches/${encodeURIComponent(branch)}/protection`,
251
+ headers,
252
+ timeoutMs: REQUEST_TIMEOUT_MS,
253
+ });
254
+ if (!seen.ok) {
255
+ return undefined;
256
+ }
257
+ if (seen.value.status === 404) {
258
+ return unprotectedRead();
259
+ }
260
+ if (seen.value.status !== 200) {
261
+ return undefined;
262
+ }
263
+ return protectionFrom(seen.value.body);
264
+ }
@@ -0,0 +1,25 @@
1
+ import { type Result } from "../../kernel/index.ts";
2
+ import type { Finding } from "../engine/index.ts";
3
+ export interface ProtectionRead {
4
+ readonly readable: boolean;
5
+ readonly verifyRequired?: boolean;
6
+ readonly forcePushBlocked?: boolean;
7
+ readonly deletionBlocked?: boolean;
8
+ readonly allowSquashMerge?: boolean;
9
+ readonly rulesetMergeMethods?: ReadonlyArray<string>;
10
+ }
11
+ export interface BaseRefInput {
12
+ readonly eventName: "pull_request" | "push" | "schedule" | "dispatch";
13
+ readonly before?: string;
14
+ readonly pullBaseSha?: string;
15
+ readonly defaultBranch?: string;
16
+ readonly reachable?: boolean;
17
+ }
18
+ export interface PinnedUse {
19
+ readonly file: string;
20
+ readonly uses: string;
21
+ readonly image?: string;
22
+ }
23
+ export declare function evaluateProtection(read?: ProtectionRead): Array<Finding>;
24
+ export declare function resolveBaseRef(input: BaseRefInput): Result<string>;
25
+ export declare function checkActionsPinned(uses: ReadonlyArray<PinnedUse>): Array<Finding>;
@@ -0,0 +1,77 @@
1
+ // SPEC §4.15.2–§4.15.3 + §4.15.6–§4.15.7: merge-gate reads and the CI base.
2
+ // Reads are pure over caller-supplied host data (rulesets, repo settings,
3
+ // workflow texts); the CLI fetches them through the kernel Net/Git ports, so
4
+ // this module never touches the network (§10.3) and fork PRs with read-only
5
+ // tokens degrade to advise, never to allow (EC-1, EC-6).
6
+ import { err, makeError, ok } from "../../kernel/index.js";
7
+ const SHA_PATTERN = /^[0-9a-f]{40}$/;
8
+ function advise(ruleId, message, remediation) {
9
+ return { ruleId, message, remediation };
10
+ }
11
+ function block(ruleId, message, remediation) {
12
+ return { ruleId, message, remediation };
13
+ }
14
+ // SPEC §4.15.2: reported not required → block; unreadable → advise (PRD
15
+ // §11.1). The same read feeds core/branch-protection below.
16
+ export function evaluateProtection(read) {
17
+ if (read === undefined || !read.readable) {
18
+ return [
19
+ advise("core/ci-required-check", "cannot confirm the verify check is required: branch protection is unreadable", "Grant the workflow read access to rulesets/branch protection, or confirm the required check by hand (EC-1, EC-6)."),
20
+ advise("core/branch-protection", "cannot confirm force-push, deletion and squash settings: branch protection is unreadable", "Grant the workflow read access to the repo settings and rulesets, or confirm them by hand (§4.15.2)."),
21
+ ];
22
+ }
23
+ const findings = [];
24
+ if (read.verifyRequired !== true) {
25
+ findings.push(block("core/ci-required-check", "the verify check is not a required check on the default branch", "Add verify to the required checks of the branch ruleset (§4.15 EC-7)."));
26
+ }
27
+ const squashExcluded = read.allowSquashMerge === false ||
28
+ (read.rulesetMergeMethods !== undefined &&
29
+ !read.rulesetMergeMethods.includes("squash"));
30
+ if (!squashExcluded) {
31
+ findings.push(block("core/branch-protection", "squash merging is allowed and no ruleset excludes it", "Set allow_squash_merge to false and exclude squash from the ruleset allowed_merge_methods (§4.9.3, EC-11, S33)."));
32
+ }
33
+ if (read.forcePushBlocked !== true || read.deletionBlocked !== true) {
34
+ findings.push(block("core/branch-protection", "force-push or deletion is not blocked on the default branch", "Block force-pushes and deletions on the default branch in settings and rulesets (§4.15.2)."));
35
+ }
36
+ return findings;
37
+ }
38
+ // SPEC §4.15.1 + EC-2/EC-3: PRs read the base from the event; pushes use
39
+ // before, or the merge-base with the default branch when before is absent
40
+ // (new branch); an unreachable base is CDX-E503 and blocks.
41
+ export function resolveBaseRef(input) {
42
+ if (input.reachable === false) {
43
+ return err(makeError("CDX-E503", "CI base commit is unreachable (shallow clone despite config)", "Fetch with fetch-depth 0 and rerun; ci.verify needs the full base..head range (EC-2)."));
44
+ }
45
+ if (input.eventName === "pull_request" && input.pullBaseSha !== undefined) {
46
+ return ok(input.pullBaseSha);
47
+ }
48
+ const zero = "0000000000000000000000000000000000000000";
49
+ if (input.before !== undefined &&
50
+ input.before !== "" &&
51
+ input.before !== zero) {
52
+ return ok(input.before);
53
+ }
54
+ if (input.eventName === "push") {
55
+ return ok(`merge-base(${input.defaultBranch ?? "main"},HEAD)`);
56
+ }
57
+ return ok(input.pullBaseSha ?? `merge-base(${input.defaultBranch ?? "main"},HEAD)`);
58
+ }
59
+ function usesRef(uses) {
60
+ const at = uses.indexOf("@");
61
+ return at >= 0 ? uses.slice(at + 1) : undefined;
62
+ }
63
+ // SPEC §4.15.2: every uses: in every workflow is a 40-hex SHA; every
64
+ // container/services image is digest-pinned (EC-5).
65
+ export function checkActionsPinned(uses) {
66
+ const findings = [];
67
+ for (const entry of uses) {
68
+ const ref = entry.uses.includes("@") ? usesRef(entry.uses) : undefined;
69
+ if (ref === undefined || !SHA_PATTERN.test(ref)) {
70
+ findings.push(block("core/ci-actions-pinned", `${entry.file} uses ${entry.uses} without a full commit SHA`, "Pin every uses: by full 40-hex commit SHA with the version as a trailing comment (EC-5)."));
71
+ }
72
+ if (entry.image !== undefined && !entry.image.includes("@sha256:")) {
73
+ findings.push(block("core/ci-actions-pinned", `${entry.file} runs container ${entry.image} without a digest pin`, "Pin every container/services image by digest (EC-5)."));
74
+ }
75
+ }
76
+ return findings;
77
+ }
@@ -0,0 +1,23 @@
1
+ export interface CiWorkflow {
2
+ readonly host: "github" | "external";
3
+ readonly os: ReadonlyArray<string>;
4
+ readonly steps: ReadonlyArray<string>;
5
+ readonly text?: string;
6
+ readonly scheduleCron?: string;
7
+ }
8
+ export interface WorkflowPins {
9
+ readonly checkoutSha: string;
10
+ readonly checkoutVersion: string;
11
+ readonly setupNodeSha: string;
12
+ readonly setupNodeVersion: string;
13
+ }
14
+ export declare const FALLBACK_PINS: WorkflowPins;
15
+ export interface RenderWorkflowOptions {
16
+ readonly os?: ReadonlyArray<string>;
17
+ readonly repoName?: string;
18
+ readonly defaultBranch?: string;
19
+ readonly pins?: WorkflowPins;
20
+ readonly bot?: "auto" | "renovate" | "dependabot" | "none";
21
+ }
22
+ export declare function scheduleCronFor(repoName: string): string;
23
+ export declare function renderWorkflow(repoRoot: string, options?: RenderWorkflowOptions): CiWorkflow;