@event4u/agent-config 16.0.0 → 16.2.0

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 (382) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +289 -140
  5. package/CONTRIBUTING.md +9 -0
  6. package/README.md +2 -2
  7. package/dist/agent-src/commands/analyze/inbox.md +26 -0
  8. package/dist/agent-src/commands/analyze/roadmap-repos.md +27 -0
  9. package/dist/agent-src/commands/challenge-me/closure.md +178 -0
  10. package/dist/agent-src/commands/challenge-me.md +9 -2
  11. package/dist/agent-src/commands/council/default.md +25 -5
  12. package/dist/agent-src/commands/feature/plan.md +28 -1
  13. package/dist/agent-src/commands/feature/roadmap.md +28 -1
  14. package/dist/agent-src/commands/implement-ticket.md +27 -0
  15. package/dist/agent-src/commands/jira-ticket.md +27 -0
  16. package/dist/agent-src/commands/pr/create.md +29 -0
  17. package/dist/agent-src/commands/pr/merge.md +60 -9
  18. package/dist/agent-src/commands/roadmap/ai-council.md +7 -1
  19. package/dist/agent-src/commands/roadmap/create.md +74 -27
  20. package/dist/agent-src/commands/roadmap/materialize.md +27 -0
  21. package/dist/agent-src/commands/roadmap/process-full.md +123 -18
  22. package/dist/agent-src/commands/team.md +22 -0
  23. package/dist/agent-src/commands/work.md +4 -0
  24. package/dist/agent-src/contexts/authority/scope-growth-ownership.md +80 -0
  25. package/dist/agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +47 -0
  26. package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +44 -3
  27. package/dist/agent-src/contexts/execution/autonomy-mechanics.md +19 -23
  28. package/dist/agent-src/contexts/execution/decision-closure-execution.md +93 -0
  29. package/dist/agent-src/contexts/execution/fix-loop-ladder.md +108 -0
  30. package/dist/agent-src/contexts/execution/plan-confidence-gate.md +4 -2
  31. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +75 -6
  32. package/dist/agent-src/guidelines/agent-infra/active-remediation-mechanics.md +57 -0
  33. package/dist/agent-src/guidelines/agent-infra/evaluator-independence-mechanics.md +102 -0
  34. package/dist/agent-src/guidelines/design-fidelity-routing.md +29 -0
  35. package/dist/agent-src/rules/autonomous-execution.md +15 -8
  36. package/dist/agent-src/rules/delegation-policy.md +23 -45
  37. package/dist/agent-src/rules/design-fidelity.md +32 -37
  38. package/dist/agent-src/rules/evaluator-independence.md +43 -49
  39. package/dist/agent-src/rules/test-first.md +41 -0
  40. package/dist/agent-src/rules/ui-audit-gate.md +1 -2
  41. package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +1 -1
  42. package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
  43. package/dist/agent-src/skills/ai-council/SKILL.md +11 -3
  44. package/dist/agent-src/skills/api-design/data/manifest.json +3 -3
  45. package/dist/agent-src/skills/database/data/manifest.json +4 -4
  46. package/dist/agent-src/skills/database/data/query-tuning.csv +3 -3
  47. package/dist/agent-src/skills/design-review/SKILL.md +80 -4
  48. package/dist/agent-src/skills/design-review/references/verification-automation.md +32 -0
  49. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +30 -5
  50. package/dist/agent-src/skills/existing-ui-audit/references/component-taxonomy-detection.md +56 -0
  51. package/dist/agent-src/skills/experiment-loop/SKILL.md +31 -1
  52. package/dist/agent-src/skills/markitdown/SKILL.md +4 -0
  53. package/dist/agent-src/skills/playwright-testing/SKILL.md +30 -6
  54. package/dist/agent-src/skills/roadmap-writing/SKILL.md +1 -1
  55. package/dist/agent-src/skills/storybook-workshop/SKILL.md +42 -3
  56. package/dist/agent-src/skills/threat-modeling/SKILL.md +9 -4
  57. package/dist/agent-src/skills/threat-modeling/data/manifest.json +4 -4
  58. package/dist/agent-src/skills/ui-component-architect/SKILL.md +23 -0
  59. package/dist/agent-src/skills/verify-repair-loop/SKILL.md +37 -3
  60. package/dist/agent-src/templates/agent-settings.md +1 -1
  61. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  62. package/dist/agent-src/templates/roadmaps.md +218 -0
  63. package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +62 -2
  64. package/dist/agent-src/templates/scripts/work_engine/directives/backend/test.ts +1 -0
  65. package/dist/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +1 -0
  66. package/dist/agent-src/templates/scripts/work_engine/directives/ui/app_spec.ts +10 -4
  67. package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +260 -21
  68. package/dist/agent-src/templates/scripts/work_engine/directives/ui/audit.ts +22 -3
  69. package/dist/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +6 -1
  70. package/dist/agent-src/templates/scripts/work_engine/state.ts +57 -7
  71. package/dist/agent-src/templates/scripts/work_engine/taxonomy/detect.ts +500 -0
  72. package/dist/agent-src/templates/scripts/work_engine/taxonomy/place.ts +183 -0
  73. package/dist/cli/python/knowledge_ingest.js +1 -1
  74. package/dist/cli/python/workspace_drive.js +1 -1
  75. package/dist/cli-delegate/check_update_banner.js +40 -2
  76. package/dist/cli-delegate/chunk-4E2W63DA.js +335 -0
  77. package/dist/cli-delegate/{chunk-S3VFXMTM.js → chunk-4XFP2Y3E.js} +1 -1
  78. package/dist/cli-delegate/chunk-5R7HOLAF.js +99 -0
  79. package/dist/cli-delegate/{chunk-IVBPRCQO.js → chunk-6KFEC3G7.js} +1 -1
  80. package/dist/cli-delegate/{chunk-2TAQ2K4V.js → chunk-6KM6ORRY.js} +55 -386
  81. package/dist/cli-delegate/{chunk-AK6HODNQ.js → chunk-7XGBX6ZH.js} +973 -555
  82. package/dist/cli-delegate/{chunk-2XY7ILBT.js → chunk-FC75PGJE.js} +42 -2
  83. package/dist/cli-delegate/{chunk-55ACLDUE.js → chunk-FP36SWJD.js} +587 -141
  84. package/dist/cli-delegate/{chunk-3FKR64R5.js → chunk-IGD6ERX6.js} +62 -7
  85. package/dist/cli-delegate/{chunk-GYC3VRYN.js → chunk-JNMVLWLR.js} +99 -14
  86. package/dist/cli-delegate/{chunk-H32DGUJH.js → chunk-P6ZHP5W2.js} +1 -1
  87. package/dist/cli-delegate/{chunk-57PN4GYJ.js → chunk-RGNIWTEA.js} +1 -1
  88. package/dist/cli-delegate/chunk-ROYYTEZU.js +39 -0
  89. package/dist/cli-delegate/{chunk-2DK2VJWG.js → chunk-WGXTVKCQ.js} +20 -6
  90. package/dist/cli-delegate/chunk-YDPILCOL.js +152 -0
  91. package/dist/cli-delegate/{chunk-QJWAUMJW.js → chunk-YJ72UIAK.js} +730 -15
  92. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  93. package/dist/cli-delegate/cmd_brand_status.js +1 -1
  94. package/dist/cli-delegate/cmd_conformance.js +985 -831
  95. package/dist/cli-delegate/cmd_doctor.js +7 -5
  96. package/dist/cli-delegate/cmd_explain.js +2 -2
  97. package/dist/cli-delegate/cmd_export.js +9 -7
  98. package/dist/cli-delegate/cmd_fleet.js +4 -2
  99. package/dist/cli-delegate/cmd_handoff.js +7 -7
  100. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  101. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  102. package/dist/cli-delegate/cmd_migrate.js +2 -2
  103. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  104. package/dist/cli-delegate/cmd_preflight.js +4 -2
  105. package/dist/cli-delegate/cmd_prune.js +10 -8
  106. package/dist/cli-delegate/cmd_route_audit.js +3 -3
  107. package/dist/cli-delegate/cmd_route_explain.js +1 -1
  108. package/dist/cli-delegate/cmd_session_recycle.js +4 -4
  109. package/dist/cli-delegate/cmd_settings_get.js +28 -2
  110. package/dist/cli-delegate/cmd_settings_migrate.js +9 -7
  111. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  112. package/dist/cli-delegate/cmd_sync.js +10 -8
  113. package/dist/cli-delegate/cmd_uninstall.js +16 -13
  114. package/dist/cli-delegate/cmd_update.js +1 -1
  115. package/dist/cli-delegate/cmd_upgrade.js +1 -1
  116. package/dist/cli-delegate/cmd_validate.js +12 -10
  117. package/dist/cli-delegate/cmd_versions.js +1 -1
  118. package/dist/discovery/deprecation-report.md +1 -1
  119. package/dist/discovery/discovery-manifest.json +90 -43
  120. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  121. package/dist/discovery/discovery-manifest.summary.md +4 -4
  122. package/dist/discovery/dormancy-report.md +1 -1
  123. package/dist/discovery/orphan-report.md +1 -1
  124. package/dist/discovery/packs.json +10 -8
  125. package/dist/discovery/trust-report.md +3 -3
  126. package/dist/discovery/workspaces.json +8 -6
  127. package/dist/hooks/dispatch.js +7682 -2772
  128. package/dist/hooks/dispatch.sha256 +1 -0
  129. package/dist/install/claudeRuleRewrite.js +14 -3
  130. package/dist/install/conflict.js +60 -10
  131. package/dist/install/conflictTracker.js +218 -0
  132. package/dist/install/fsPrimitives.js +54 -0
  133. package/dist/install/install.mjs +2200 -1559
  134. package/dist/install/manifestFiles.js +259 -0
  135. package/dist/install/preflight.js +14 -2
  136. package/dist/install/preserve.js +157 -0
  137. package/dist/install/recordedOwnership.js +132 -0
  138. package/dist/install/txlog.js +11 -2
  139. package/dist/mcp/registry-manifest.json +3 -3
  140. package/dist/mcp/server.json +2 -2
  141. package/dist/mcp/server.mjs +3066 -1470
  142. package/dist/router.json +1 -1
  143. package/dist/scripts/_lib/agent_settings.js +3 -2
  144. package/dist/scripts/_lib/fs_atomic.js +167 -0
  145. package/dist/scripts/_lib/installed_tools.js +460 -0
  146. package/dist/scripts/_lib/lean_projection_mode.js +3 -2
  147. package/dist/scripts/_lib/settings_renamed_keys.js +78 -0
  148. package/dist/server/routes/install.js +8 -0
  149. package/dist/server/routes/wizard.js +9 -3
  150. package/dist/server/schemas/settings.js +40 -5
  151. package/dist/shared/missionExecution.js +97 -0
  152. package/dist/ui/assets/index-Cwq4d0hX.js +23 -0
  153. package/dist/ui/assets/index-Cyjy8bWO.css +1 -0
  154. package/dist/ui/index.html +2 -2
  155. package/docs/MIGRATION.md +103 -0
  156. package/docs/contracts/settings-classes.md +28 -7
  157. package/docs/guidelines/agent-infra/active-remediation-mechanics.md +57 -0
  158. package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +102 -0
  159. package/docs/guidelines/design-fidelity-routing.md +29 -0
  160. package/package.json +4 -4
  161. package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +62 -2
  162. package/src/agent-src/templates/scripts/work_engine/directives/backend/test.ts +1 -0
  163. package/src/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +1 -0
  164. package/src/agent-src/templates/scripts/work_engine/directives/ui/app_spec.ts +10 -4
  165. package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +260 -21
  166. package/src/agent-src/templates/scripts/work_engine/directives/ui/audit.ts +22 -3
  167. package/src/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +6 -1
  168. package/src/agent-src/templates/scripts/work_engine/state.ts +57 -7
  169. package/src/agent-src/templates/scripts/work_engine/taxonomy/detect.ts +500 -0
  170. package/src/agent-src/templates/scripts/work_engine/taxonomy/place.ts +183 -0
  171. package/src/config/agent-settings.template.yml +168 -27
  172. package/src/config/auto-rule-budget.json +16 -0
  173. package/src/config/ci-local-parity.yml +36 -5
  174. package/src/config/continuity-surface.json +23 -2
  175. package/src/config/gate-coverage.yml +377 -13
  176. package/src/config/gate-violation-baselines.json +10 -6
  177. package/src/config/hook-latency-budget.json +21 -0
  178. package/src/config/hook-token-budget.json +4 -2
  179. package/src/config/loop-surfaces.yaml +215 -0
  180. package/src/config/metric-registry.yml +114 -0
  181. package/src/config/placeholder-drift-budget.json +10 -0
  182. package/src/config/platform-anchor.json +3 -2
  183. package/src/config/release-gate-locality.yml +11 -0
  184. package/src/config/routing-coverage-seed.json +33 -5
  185. package/src/config/rule-enforcement-baseline.json +0 -1
  186. package/src/install/claudeRuleRewrite.ts +16 -2
  187. package/src/install/conflict.ts +65 -9
  188. package/src/install/conflictTracker.ts +299 -0
  189. package/src/install/fsPrimitives.ts +54 -0
  190. package/src/install/manifestFiles.ts +312 -0
  191. package/src/install/preflight.ts +16 -2
  192. package/src/install/preserve.ts +205 -0
  193. package/src/install/recordedOwnership.ts +149 -0
  194. package/src/install/txlog.ts +11 -2
  195. package/src/install/types.ts +19 -4
  196. package/src/scripts/_cli/cmd_conformance.ts +88 -15
  197. package/src/scripts/_cli/cmd_doctor.ts +7 -20
  198. package/src/scripts/_cli/cmd_route_explain.ts +9 -2
  199. package/src/scripts/_cli/cmd_settings_get.ts +44 -0
  200. package/src/scripts/_cli/doctor_execution.ts +173 -0
  201. package/src/scripts/_cli/doctor_network_posture.ts +226 -0
  202. package/src/scripts/_lib/activation_payload.ts +247 -0
  203. package/src/scripts/_lib/agent_settings.ts +4 -2
  204. package/src/scripts/_lib/authority_path.ts +102 -0
  205. package/src/scripts/_lib/body_portable.ts +102 -0
  206. package/src/scripts/_lib/cascade_base.ts +94 -0
  207. package/src/scripts/_lib/cc_transcript.ts +132 -1
  208. package/src/scripts/_lib/changelog_eras.ts +7 -2
  209. package/src/scripts/_lib/concern_sla_window.ts +200 -0
  210. package/src/scripts/_lib/continuation_ladder.ts +149 -2
  211. package/src/scripts/_lib/council_transport.ts +129 -0
  212. package/src/scripts/_lib/delivery_ready.ts +112 -0
  213. package/src/scripts/_lib/forge_protection.ts +381 -0
  214. package/src/scripts/_lib/forge_reader.ts +558 -0
  215. package/src/scripts/_lib/hook_platform_keys.ts +27 -0
  216. package/src/scripts/_lib/host_env_write.ts +111 -0
  217. package/src/scripts/_lib/json_python_parity.ts +127 -0
  218. package/src/scripts/_lib/lean_projection_mode.ts +14 -3
  219. package/src/scripts/_lib/llm_proposer_transport.ts +14 -4
  220. package/src/scripts/_lib/loop_surfaces.ts +382 -0
  221. package/src/scripts/_lib/mission_record.ts +190 -0
  222. package/src/scripts/_lib/obligation_frequency.ts +217 -0
  223. package/src/scripts/_lib/obligations.ts +513 -0
  224. package/src/scripts/_lib/orchestration_record.ts +11 -20
  225. package/src/scripts/_lib/probe_inputs.ts +271 -0
  226. package/src/scripts/_lib/read_surface_scan.ts +322 -0
  227. package/src/scripts/_lib/release_highlights.ts +201 -11
  228. package/src/scripts/_lib/release_holds.ts +493 -0
  229. package/src/scripts/_lib/release_migration_gate.ts +184 -0
  230. package/src/scripts/_lib/retrieval_sanitize.ts +77 -16
  231. package/src/scripts/_lib/rides_along.ts +102 -0
  232. package/src/scripts/_lib/settings_renamed_keys.ts +82 -0
  233. package/src/scripts/_lib/shell_write_shapes.ts +108 -0
  234. package/src/scripts/_lib/structural_hiding.ts +622 -0
  235. package/src/scripts/_lib/test_delta.ts +166 -0
  236. package/src/scripts/_lib/test_provenance.ts +171 -0
  237. package/src/scripts/_lib/turn_end_refusals.ts +525 -4
  238. package/src/scripts/_lib/turn_end_transcript.ts +216 -0
  239. package/src/scripts/_lib/typed_op_grant.ts +246 -0
  240. package/src/scripts/_lib/typed_op_watch.ts +185 -0
  241. package/src/scripts/_lib/verification_command.ts +324 -0
  242. package/src/scripts/_lib/verification_evidence.ts +647 -0
  243. package/src/scripts/_lib/verify_clause.ts +280 -0
  244. package/src/scripts/ai_council/config.ts +8 -11
  245. package/src/scripts/ai_council/fallback_config.ts +5 -3
  246. package/src/scripts/ai_council/ownership_classes.ts +118 -0
  247. package/src/scripts/ai_team/team_dispatch.ts +4 -0
  248. package/src/scripts/ask_block_census.ts +285 -15
  249. package/src/scripts/before_complete_hook.ts +340 -23
  250. package/src/scripts/bench_hook_latency.ts +412 -5
  251. package/src/scripts/cache_realization_report.ts +61 -1
  252. package/src/scripts/check_argument_hint.ts +287 -0
  253. package/src/scripts/check_claims.ts +125 -1
  254. package/src/scripts/check_enforcement_coverage.ts +38 -9
  255. package/src/scripts/check_enforcement_matrix.ts +866 -0
  256. package/src/scripts/check_finding_dispositions.ts +22 -3
  257. package/src/scripts/check_gate_reachability.ts +173 -10
  258. package/src/scripts/check_generator_sync.ts +1025 -0
  259. package/src/scripts/check_host_docs_digest.ts +786 -0
  260. package/src/scripts/check_host_format_column.ts +559 -0
  261. package/src/scripts/check_input_references.ts +228 -0
  262. package/src/scripts/check_inputs_parity.ts +235 -0
  263. package/src/scripts/check_kernel_edit_ratified.ts +47 -5
  264. package/src/scripts/check_kill_switch_table.ts +294 -0
  265. package/src/scripts/check_placeholder_drift.ts +221 -0
  266. package/src/scripts/check_preamble_payload_budget.ts +75 -2
  267. package/src/scripts/check_read_surface_coverage.ts +515 -0
  268. package/src/scripts/check_release_highlights.ts +33 -1
  269. package/src/scripts/check_release_holds.ts +568 -0
  270. package/src/scripts/check_routing_coverage.ts +378 -11
  271. package/src/scripts/check_rule_projection_integrity.ts +22 -12
  272. package/src/scripts/check_static_parity.ts +17 -0
  273. package/src/scripts/check_test_delta.ts +294 -0
  274. package/src/scripts/check_test_weakening.ts +299 -0
  275. package/src/scripts/ci_settle.ts +145 -19
  276. package/src/scripts/closure_scan.ts +447 -0
  277. package/src/scripts/compile_hook_manifest.ts +102 -18
  278. package/src/scripts/council_record_shape.ts +209 -0
  279. package/src/scripts/external_sources_denylist.json +29 -4
  280. package/src/scripts/hook_manifest.json +1 -1
  281. package/src/scripts/hook_manifest.yaml +127 -11
  282. package/src/scripts/hooks/block_config_weakening.ts +229 -4
  283. package/src/scripts/hooks/block_kernel_rule_writes.ts +9 -78
  284. package/src/scripts/hooks/block_plumbing_writes.ts +314 -0
  285. package/src/scripts/hooks/bundle_integrity.ts +291 -0
  286. package/src/scripts/hooks/chain_nudge_hook.ts +1 -2
  287. package/src/scripts/hooks/code_graph_context_hook.ts +1 -2
  288. package/src/scripts/hooks/comment_discipline_hook.ts +1 -3
  289. package/src/scripts/hooks/concern_registry.ts +6 -0
  290. package/src/scripts/hooks/concern_timings.ts +94 -0
  291. package/src/scripts/hooks/delegation_nudge_hook.ts +1 -2
  292. package/src/scripts/hooks/design_pass_hook.ts +221 -5
  293. package/src/scripts/hooks/design_slop_hook.ts +1 -2
  294. package/src/scripts/hooks/dispatch_hook.ts +25 -19
  295. package/src/scripts/hooks/edit_shape_hook.ts +1 -2
  296. package/src/scripts/hooks/end_review_nudge_hook.ts +1 -1
  297. package/src/scripts/hooks/evidence_independence.ts +97 -2
  298. package/src/scripts/hooks/exit_codes.ts +128 -0
  299. package/src/scripts/hooks/host_lowering.json +1 -0
  300. package/src/scripts/hooks/host_lowering.ts +128 -3
  301. package/src/scripts/hooks/host_lowering.yaml +262 -46
  302. package/src/scripts/hooks/host_semantics.ts +30 -2
  303. package/src/scripts/hooks/injection_budget.ts +9 -2
  304. package/src/scripts/hooks/interruption_ledger_hook.ts +1 -2
  305. package/src/scripts/hooks/journal_record_hook.ts +1 -2
  306. package/src/scripts/hooks/memory_recall_hook.ts +539 -0
  307. package/src/scripts/hooks/obligation_settle_hook.ts +328 -0
  308. package/src/scripts/hooks/one_question_per_ask_hook.ts +25 -4
  309. package/src/scripts/hooks/orchestration_record_hook.ts +1 -2
  310. package/src/scripts/hooks/permission_gate.ts +1 -2
  311. package/src/scripts/hooks/push_settle_hook.ts +1 -3
  312. package/src/scripts/hooks/replay_hook.ts +2 -1
  313. package/src/scripts/hooks/reread_guard_hook.ts +1 -2
  314. package/src/scripts/hooks/review_baseline_hook.ts +1 -2
  315. package/src/scripts/hooks/rtk_wrap_hook.ts +1 -2
  316. package/src/scripts/hooks/rule_inject_hook.ts +55 -4
  317. package/src/scripts/hooks/run_continuation_hook.ts +30 -35
  318. package/src/scripts/hooks/skill_route_hook.ts +1 -2
  319. package/src/scripts/hooks/source_first_gate_hook.ts +1 -2
  320. package/src/scripts/hooks/spawn_guard_shadow_hook.ts +1 -2
  321. package/src/scripts/hooks/subagent_ledger_hook.ts +1 -2
  322. package/src/scripts/hooks/suggestion_capture_hook.ts +1 -1
  323. package/src/scripts/hooks/table_fingerprint.ts +49 -0
  324. package/src/scripts/hooks/telemetry_flush_hook.ts +1 -2
  325. package/src/scripts/hooks/telemetry_usage_hook.ts +1 -2
  326. package/src/scripts/hooks/tool_result_bytes_hook.ts +93 -9
  327. package/src/scripts/hooks/turn_end_gate_hook.ts +337 -324
  328. package/src/scripts/hooks/ui_route_nudge_hook.ts +1 -2
  329. package/src/scripts/hooks_doctor.ts +85 -0
  330. package/src/scripts/hooks_status.ts +19 -0
  331. package/src/scripts/install.ts +109 -210
  332. package/src/scripts/janitor.ts +7 -0
  333. package/src/scripts/lint_decision_classes.ts +464 -0
  334. package/src/scripts/lint_deny_text.ts +419 -0
  335. package/src/scripts/lint_exit_codes.ts +262 -0
  336. package/src/scripts/lint_hook_manifest.ts +66 -0
  337. package/src/scripts/lint_major_migration_sections.ts +450 -0
  338. package/src/scripts/lint_plan_risk_register.ts +47 -3
  339. package/src/scripts/lint_roadmap_blockers.ts +139 -12
  340. package/src/scripts/lint_roadmap_producers.ts +202 -0
  341. package/src/scripts/lint_skill_descriptions.ts +1 -1
  342. package/src/scripts/lint_skill_scripts_readonly.ts +1 -1
  343. package/src/scripts/mcp_server/prompts.ts +142 -1
  344. package/src/scripts/measure_rule_budget.ts +101 -5
  345. package/src/scripts/measure_skill_ranker_baseline.ts +305 -51
  346. package/src/scripts/measure_turn_end_gate.ts +193 -0
  347. package/src/scripts/memory_lookup.ts +1 -1
  348. package/src/scripts/new_roadmap.ts +37 -0
  349. package/src/scripts/orchestration_record.ts +0 -5
  350. package/src/scripts/prepack-check.mjs +53 -0
  351. package/src/scripts/release.ts +14 -98
  352. package/src/scripts/release_drill.ts +267 -1
  353. package/src/scripts/release_publication.ts +64 -1
  354. package/src/scripts/report_enforcement_drift.ts +566 -0
  355. package/src/scripts/report_host_injection_effect.ts +3 -11
  356. package/src/scripts/report_invocation_surface.ts +383 -0
  357. package/src/scripts/report_obligation_carriers.ts +699 -0
  358. package/src/scripts/report_obligation_writer_split.ts +236 -0
  359. package/src/scripts/report_skill_menu_census.ts +208 -0
  360. package/src/scripts/report_standing_payload_by_host.ts +26 -152
  361. package/src/scripts/roadmap_verify_share.ts +213 -0
  362. package/src/scripts/schemas/agent-settings.schema.json +23 -0
  363. package/src/scripts/schemas/command.schema.json +48 -0
  364. package/src/scripts/schemas/review-findings.schema.json +4 -0
  365. package/src/scripts/schemas/skill.schema.json +44 -0
  366. package/src/scripts/scope_growth.ts +219 -0
  367. package/src/scripts/self_review_gate.ts +359 -10
  368. package/src/scripts/semantic_parity_census.ts +314 -0
  369. package/src/scripts/session_eol_report.ts +54 -1
  370. package/src/scripts/sweep_dead_scan_roots.ts +1 -1
  371. package/src/scripts/trigger_eval_grandfather.json +0 -3
  372. package/src/scripts/trigger_eval_rotation.ts +122 -27
  373. package/src/scripts/ui_conformance_probe.ts +774 -0
  374. package/src/scripts/update_prices.ts +85 -3
  375. package/src/scripts/write_bundle_digest.mjs +74 -0
  376. package/src/server/schemas/settings.ts +62 -7
  377. package/src/shared/missionExecution.ts +126 -0
  378. package/src/templates/consumer-settings/ONBOARDING.md +1 -0
  379. package/dist/cli-delegate/chunk-523HCFYO.js +0 -90
  380. package/dist/ui/assets/index-D0jaCRPM.js +0 -29
  381. package/dist/ui/assets/index-jSfMW8_t.css +0 -1
  382. /package/dist/cli-delegate/{chunk-YUM5KURG.js → chunk-7RQP4UDH.js} +0 -0
@@ -0,0 +1,381 @@
1
+ /**
2
+ * The five `forge_protection` rows, read from the forge rather than guessed.
3
+ *
4
+ * `road-to-adversarial-verification-and-long-runs` Phase 3.2. ADR-268 § 3 trades
5
+ * the owner's confirmation for a mechanical check, and branch protection is the
6
+ * check it trades for — so a run that cannot say whether protection exists has
7
+ * not established the thing the trade depends on.
8
+ *
9
+ * **Every row carries the API call its value came from, and a row that was not
10
+ * read says so.** That is the whole shape: the step's word is *read, never
11
+ * guessed*, and the only way a reader can tell one from the other is if the
12
+ * provenance travels with the value. A row is `satisfied` / `unsatisfied` only
13
+ * when a named call produced it; otherwise it is `unread`, which is a third
14
+ * state and never a false.
15
+ *
16
+ * **Rulesets, not the classic branch-protection endpoint.** On this repository
17
+ * `repos/<owner>/<repo>/branches/main/protection` returns `404 {"message":"Branch
18
+ * not protected"}` while an active ruleset protects the default branch — so a
19
+ * checker reading the classic endpoint reports "unprotected" for a repository
20
+ * that is protected. The `forge-protection-settings` blocker was re-scoped for
21
+ * exactly this reason on 2026-09-10, and the re-scope forbids treating that 404
22
+ * as absence of protection. No ruleset ID is pinned: rulesets can be replaced or
23
+ * split, and pinning one would break on the first change.
24
+ *
25
+ * Pure. The network lives in the caller, so both polarities are testable offline.
26
+ */
27
+
28
+ import type { BypassActor, RulesetDetail } from './platform_anchor.js';
29
+
30
+ /** Whether a row was established, refuted, or never read. */
31
+ export type RowState = 'satisfied' | 'unsatisfied' | 'unread';
32
+
33
+ /** One `forge_protection` row. */
34
+ export interface ProtectionRow {
35
+ /** Stable key. Rows are addressed by this, never by position. */
36
+ readonly id: string;
37
+ readonly state: RowState;
38
+ /**
39
+ * The forge API call this value came from — or would come from, when the row
40
+ * is `unread`. Never empty: a value whose provenance is unstated is the
41
+ * guess this block exists to refuse.
42
+ */
43
+ readonly source: string;
44
+ /** One line a human can act on when the row is not satisfied. */
45
+ readonly detail: string;
46
+ }
47
+
48
+ /** The five rows, in the order the blocker's own table lists them. */
49
+ export const PROTECTION_ROW_IDS: readonly string[] = [
50
+ 'default_branch_protected',
51
+ 'required_checks_present',
52
+ 'force_push_disabled',
53
+ 'auto_merge_available',
54
+ 'deploy_via_pipeline_only',
55
+ ] as const;
56
+
57
+ /** What a caller must supply for a row to be readable. `null` = not read. */
58
+ export interface ForgeReading {
59
+ /** `repos/<repo>/rulesets` + `/rulesets/<id>`, or `null` when unread. */
60
+ readonly rulesets: readonly RulesetDetail[] | null;
61
+ /** The repository's default branch, or `null` when unread. */
62
+ readonly defaultBranch: string | null;
63
+ /** `repos/<repo>` → `allow_auto_merge`, or `null` when unread. */
64
+ readonly allowAutoMerge: boolean | null;
65
+ /**
66
+ * `repos/<repo>/environments` → whether every environment with deployment
67
+ * branch policies restricts them, or `null` when unread.
68
+ *
69
+ * Deliberately a boolean the caller derives rather than a raw payload: what
70
+ * the row asserts is a property of the SET of environments, and handing this
71
+ * module the raw list would put that judgement in two places.
72
+ */
73
+ readonly deployRestricted: boolean | null;
74
+ }
75
+
76
+ /**
77
+ * The all-null reading: nothing was queried.
78
+ *
79
+ * Lives here, beside {@link ForgeReading}, rather than in the `doctor` caller
80
+ * that first needed it — `_lib/forge_reader.ts` returns it on every failure
81
+ * path, and a second hand-written all-null literal is exactly the drift that
82
+ * makes "offline output is unchanged" an assertion instead of a fact.
83
+ *
84
+ * It MOVED from `_cli/doctor_execution.ts`, which no longer exports it in any
85
+ * form. Nothing broke, because nothing outside that file imported it — but an
86
+ * earlier draft of this comment claimed a re-export kept every caller in place,
87
+ * and no such shim was ever written. Corrected rather than quietly deleted: a
88
+ * comment describing a compatibility layer that does not exist is the next
89
+ * reader's false premise.
90
+ */
91
+ export const UNREAD_FORGE: ForgeReading = {
92
+ rulesets: null,
93
+ defaultBranch: null,
94
+ allowAutoMerge: null,
95
+ deployRestricted: null,
96
+ };
97
+
98
+ /**
99
+ * The two fields of an environment this row reads, as
100
+ * `GET repos/{owner}/{repo}/environments` returns them.
101
+ *
102
+ * A NARROW PROJECTION, not the full payload: the real response also carries
103
+ * `id`, `protection_rules`, `can_admins_bypass`, timestamps and more. Declared
104
+ * this way on purpose — a caller passes the real object and structural typing
105
+ * accepts the superset, while the interface states exactly which fields this
106
+ * decision depends on. Calling it "the shape" would overstate it.
107
+ *
108
+ * `null` is GitHub's encoding for *no restriction at all* — every branch may
109
+ * deploy. It is therefore the one shape that refutes the row.
110
+ */
111
+ export interface EnvironmentPolicy {
112
+ readonly name: string;
113
+ readonly deployment_branch_policy: {
114
+ readonly protected_branches?: boolean;
115
+ readonly custom_branch_policies?: boolean;
116
+ } | null;
117
+ }
118
+
119
+ /**
120
+ * Derive `deployRestricted` from the environments payload.
121
+ *
122
+ * **Both restriction mechanisms count, and reading only one is the defect this
123
+ * function exists to close.** GitHub restricts deployment branches two ways:
124
+ * `protected_branches` (whatever the forge currently treats as protected) and
125
+ * `custom_branch_policies` (an explicit named list). A checker that reads only
126
+ * the first reports "accepts a deployment from any branch" for an environment
127
+ * pinned to exactly one named branch — which is the opposite of what the
128
+ * payload says, and is precisely the misreading recorded against this
129
+ * repository on 2026-09-13: `github-pages` carried
130
+ * `custom_branch_policies: true` with a single policy, `main`, and was written
131
+ * up as unrestricted because only `protected_branches` was consulted.
132
+ *
133
+ * The named-list mechanism is also the STRICTER of the two here, which is why
134
+ * the row is satisfied without changing the forge: `protected_branches` widens
135
+ * with the protected set, while a custom list names one branch and stays there.
136
+ * On a ruleset-protected repository it is additionally the safer mechanism —
137
+ * `protected_branches` resolves against a notion of protection whose classic
138
+ * endpoint 404s here (see the module header), so switching to it would trade a
139
+ * precise restriction for one whose evaluation is exactly the ambiguity the
140
+ * `forge-protection-settings` re-scope forbids relying on.
141
+ *
142
+ * **An empty environment set returns `null`, not `true`.** The first draft
143
+ * returned `true` on the reasoning that with no environment there is no
144
+ * deployment surface to leave open. That is sound about a *confirmed* empty
145
+ * set and wrong about the value actually reaching this function: an empty
146
+ * array is what a failed fetch, a truncated page, or a caller that never
147
+ * queried also produces, and collapsing those into `satisfied` is exactly the
148
+ * quiet false-positive the three-state row exists to prevent. `null` maps to
149
+ * `unread`, which is the state this module already reserves for a value nobody
150
+ * established. A caller that has genuinely confirmed zero environments can say
151
+ * so by passing `true` itself; it cannot be inferred from the array alone.
152
+ *
153
+ * **Wildcard patterns.** A custom policy's NAMES live behind a second call
154
+ * (`GET .../environments/{name}/deployment-branch-policies`) and accept globs,
155
+ * so `custom_branch_policies: true` alone cannot distinguish a policy pinned to
156
+ * `main` from one whose pattern is `*`. Pass `patternsByEnv` when those names
157
+ * have been read: an environment whose patterns admit everything is reported
158
+ * unrestricted. Omit it and the flag is trusted — the narrower guarantee was
159
+ * not checked, which is stated here rather than left for a reader to discover.
160
+ *
161
+ * **A confirmed-EMPTY pattern list also yields `false`, and it is NOT the same
162
+ * case as a wildcard.** With `custom_branch_policies: true` and zero named
163
+ * patterns nothing matches, so nothing can deploy — strictly the most
164
+ * restrictive posture there is, and the exact opposite of `*`. Both land on
165
+ * `false` deliberately, because this row feeds an ACTION line rather than a
166
+ * permission: an environment configured to accept no deployment at all is a
167
+ * misconfiguration worth a human look, and `false` surfaces it where `true`
168
+ * would silently bless it. The direction is the safe one — it can under-report
169
+ * satisfaction, never over-report it. Written down because the two states are
170
+ * genuinely opposite, and a reader deriving the behaviour from the expression
171
+ * alone would reasonably take it for a bug.
172
+ */
173
+ export function deployRestrictedFrom(
174
+ environments: readonly EnvironmentPolicy[],
175
+ patternsByEnv?: Readonly<Record<string, readonly string[]>>,
176
+ ): boolean | null {
177
+ if (environments.length === 0) return null;
178
+ return environments.every((env) => {
179
+ const policy = env.deployment_branch_policy;
180
+ if (policy === null || policy === undefined) return false;
181
+ if (policy.protected_branches === true) return true;
182
+ if (policy.custom_branch_policies !== true) return false;
183
+ const patterns = patternsByEnv?.[env.name];
184
+ if (patterns === undefined) return true;
185
+ // A policy admitting every ref restricts nothing, whatever the flag says.
186
+ return patterns.length > 0 && !patterns.some((p) => p === '*' || p === '**');
187
+ });
188
+ }
189
+
190
+ const SOURCE = {
191
+ rulesets: 'GET repos/{owner}/{repo}/rulesets + GET .../rulesets/{id}',
192
+ repo: 'GET repos/{owner}/{repo} (allow_auto_merge)',
193
+ environments: 'GET repos/{owner}/{repo}/environments (deployment_branch_policy)',
194
+ } as const;
195
+
196
+ /** `true` when this ruleset is active and targets branches. */
197
+ function isActiveBranchRuleset(rs: RulesetDetail): boolean {
198
+ return rs.enforcement === 'active' && rs.target === 'branch';
199
+ }
200
+
201
+ /** `true` when the ruleset's ref conditions reach the default branch. */
202
+ function reachesDefaultBranch(rs: RulesetDetail, defaultBranch: string): boolean {
203
+ const include = rs.conditions?.ref_name?.include ?? [];
204
+ return include.some(
205
+ (p) => p === '~DEFAULT_BRANCH' || p === '~ALL' || p === `refs/heads/${defaultBranch}`,
206
+ );
207
+ }
208
+
209
+ function hasRule(rs: RulesetDetail, type: string): boolean {
210
+ return (rs.rules ?? []).some((r) => r.type === type);
211
+ }
212
+
213
+ function requiredContexts(rs: RulesetDetail): string[] {
214
+ for (const r of rs.rules ?? []) {
215
+ if (r.type !== 'required_status_checks') continue;
216
+ const p = r.parameters;
217
+ if (p === null || typeof p !== 'object') continue;
218
+ const list = (p as Record<string, unknown>)['required_status_checks'];
219
+ if (!Array.isArray(list)) continue;
220
+ return list
221
+ .map((e) =>
222
+ e !== null && typeof e === 'object'
223
+ ? (e as Record<string, unknown>)['context']
224
+ : null,
225
+ )
226
+ .filter((c): c is string => typeof c === 'string');
227
+ }
228
+ return [];
229
+ }
230
+
231
+ /**
232
+ * Map a forge reading onto the five rows.
233
+ *
234
+ * Never throws and never invents: an input of `null` produces `unread`, which is
235
+ * why the return type has three states rather than two. A gate that reports
236
+ * `false` for something it did not look at is the failure this separation exists
237
+ * to prevent — and it is the failure the `forge-protection-settings` re-scope
238
+ * names, one layer up.
239
+ */
240
+ export function forgeProtectionRows(reading: ForgeReading): ProtectionRow[] {
241
+ const rows: ProtectionRow[] = [];
242
+ const rulesets = reading.rulesets;
243
+ const branch = reading.defaultBranch;
244
+
245
+ const covering =
246
+ rulesets === null || branch === null
247
+ ? null
248
+ : rulesets.filter((rs) => isActiveBranchRuleset(rs) && reachesDefaultBranch(rs, branch));
249
+
250
+ rows.push(
251
+ covering === null
252
+ ? {
253
+ id: 'default_branch_protected',
254
+ state: 'unread',
255
+ source: SOURCE.rulesets,
256
+ detail: 'the rulesets were not queried',
257
+ }
258
+ : covering.length > 0
259
+ ? {
260
+ id: 'default_branch_protected',
261
+ state: 'satisfied',
262
+ source: SOURCE.rulesets,
263
+ detail: `${String(covering.length)} active branch ruleset(s) cover the default branch`,
264
+ }
265
+ : {
266
+ id: 'default_branch_protected',
267
+ state: 'unsatisfied',
268
+ source: SOURCE.rulesets,
269
+ detail:
270
+ 'no active branch ruleset covers the default branch. NOTE: the classic ' +
271
+ 'branches/<b>/protection endpoint 404s on a ruleset-protected repository, ' +
272
+ 'so a 404 there is not evidence for this row.',
273
+ },
274
+ );
275
+
276
+ const contexts = covering === null ? null : covering.flatMap(requiredContexts);
277
+ rows.push(
278
+ contexts === null
279
+ ? {
280
+ id: 'required_checks_present',
281
+ state: 'unread',
282
+ source: SOURCE.rulesets,
283
+ detail: 'the rulesets were not queried',
284
+ }
285
+ : contexts.length > 0
286
+ ? {
287
+ id: 'required_checks_present',
288
+ state: 'satisfied',
289
+ source: SOURCE.rulesets,
290
+ detail: `${String(contexts.length)} required context(s): ${contexts.join(', ')}`,
291
+ }
292
+ : {
293
+ id: 'required_checks_present',
294
+ state: 'unsatisfied',
295
+ source: SOURCE.rulesets,
296
+ detail: 'no required status check context is configured',
297
+ },
298
+ );
299
+
300
+ const noFastForward = covering === null ? null : covering.some((rs) => hasRule(rs, 'non_fast_forward'));
301
+ rows.push(
302
+ noFastForward === null
303
+ ? {
304
+ id: 'force_push_disabled',
305
+ state: 'unread',
306
+ source: SOURCE.rulesets,
307
+ detail: 'the rulesets were not queried',
308
+ }
309
+ : {
310
+ id: 'force_push_disabled',
311
+ state: noFastForward ? 'satisfied' : 'unsatisfied',
312
+ source: SOURCE.rulesets,
313
+ detail: noFastForward
314
+ ? 'a non_fast_forward rule is active on the default branch'
315
+ : 'no non_fast_forward rule covers the default branch',
316
+ },
317
+ );
318
+
319
+ rows.push(
320
+ reading.allowAutoMerge === null
321
+ ? {
322
+ id: 'auto_merge_available',
323
+ state: 'unread',
324
+ source: SOURCE.repo,
325
+ detail: 'the repository record was not queried',
326
+ }
327
+ : {
328
+ id: 'auto_merge_available',
329
+ state: reading.allowAutoMerge ? 'satisfied' : 'unsatisfied',
330
+ source: SOURCE.repo,
331
+ detail: reading.allowAutoMerge
332
+ ? 'allow_auto_merge is enabled'
333
+ : 'allow_auto_merge is disabled — merge delivery cannot queue behind checks',
334
+ },
335
+ );
336
+
337
+ rows.push(
338
+ reading.deployRestricted === null
339
+ ? {
340
+ id: 'deploy_via_pipeline_only',
341
+ state: 'unread',
342
+ source: SOURCE.environments,
343
+ detail: 'the environments were not queried',
344
+ }
345
+ : {
346
+ id: 'deploy_via_pipeline_only',
347
+ state: reading.deployRestricted ? 'satisfied' : 'unsatisfied',
348
+ source: SOURCE.environments,
349
+ detail: reading.deployRestricted
350
+ ? 'every environment restricts its deployment branches'
351
+ : 'at least one environment accepts a deployment from any branch',
352
+ },
353
+ );
354
+
355
+ return rows;
356
+ }
357
+
358
+ /**
359
+ * The human ACTION lines for rows that are not satisfied.
360
+ *
361
+ * **Not a halt, and the step says so explicitly**: `doctor` LISTS what is
362
+ * missing and the run continues. An `unread` row produces an action too — "go
363
+ * and read it" is a real instruction, and silently omitting it would make an
364
+ * unmeasured row indistinguishable from a satisfied one, which is the same
365
+ * conflation the three-state row type exists to prevent.
366
+ */
367
+ export function protectionActions(rows: readonly ProtectionRow[]): string[] {
368
+ return rows
369
+ .filter((r) => r.state !== 'satisfied')
370
+ .map((r) => `${r.id}: ${r.state} — ${r.detail} (source: ${r.source})`);
371
+ }
372
+
373
+ /** Unconditional bypass actors across the covering rulesets, for reporting. */
374
+ export function unconditionalBypasses(
375
+ rulesets: readonly RulesetDetail[],
376
+ defaultBranch: string,
377
+ ): BypassActor[] {
378
+ return rulesets
379
+ .filter((rs) => isActiveBranchRuleset(rs) && reachesDefaultBranch(rs, defaultBranch))
380
+ .flatMap((rs) => (rs.bypass_actors ?? []).filter((a) => a.bypass_mode === 'always'));
381
+ }