@event4u/agent-config 16.3.0 → 16.5.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.
- package/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +178 -78
- package/README.md +2 -2
- package/agents/templates/.ai-council.yml.example +26 -8
- package/dist/agent-src/commands/analyze/inbox.md +10 -7
- package/dist/agent-src/commands/bug/investigate.md +1 -1
- package/dist/agent-src/commands/commit/in-chunks.md +40 -31
- package/dist/agent-src/commands/commit.md +72 -33
- package/dist/agent-src/commands/condense.md +2 -8
- package/dist/agent-src/commands/council/debate.md +11 -7
- package/dist/agent-src/commands/council/default.md +10 -9
- package/dist/agent-src/commands/council.md +1 -1
- package/dist/agent-src/commands/design.md +1 -1
- package/dist/agent-src/commands/estimate-ticket.md +1 -1
- package/dist/agent-src/commands/feature/explore.md +3 -3
- package/dist/agent-src/commands/feature/plan.md +1 -1
- package/dist/agent-src/commands/fix/ci.md +17 -3
- package/dist/agent-src/commands/fix/commit-messages.md +48 -23
- package/dist/agent-src/commands/fix/pr-comments.md +3 -6
- package/dist/agent-src/commands/implement-ticket.md +3 -3
- package/dist/agent-src/commands/memory/add.md +4 -16
- package/dist/agent-src/commands/memory/load.md +5 -6
- package/dist/agent-src/commands/memory/promote.md +3 -16
- package/dist/agent-src/commands/mission/upgrade.md +3 -2
- package/dist/agent-src/commands/optimize/agents-dir.md +2 -2
- package/dist/agent-src/commands/optimize/deep.md +4 -2
- package/dist/agent-src/commands/optimize/rtk.md +4 -26
- package/dist/agent-src/commands/pr/create/description-only.md +18 -15
- package/dist/agent-src/commands/pr/create.md +42 -34
- package/dist/agent-src/commands/pr/merge.md +136 -9
- package/dist/agent-src/commands/prepare-for-review.md +13 -11
- package/dist/agent-src/commands/project/analyze.md +7 -35
- package/dist/agent-src/commands/refine-ticket.md +1 -1
- package/dist/agent-src/commands/review/changes.md +14 -19
- package/dist/agent-src/commands/roadmap/next.md +10 -1
- package/dist/agent-src/commands/roadmap/process-full.md +52 -38
- package/dist/agent-src/commands/roadmap/resolve-blockers.md +64 -14
- package/dist/agent-src/commands/worktree/create.md +7 -3
- package/dist/agent-src/commands/worktree/verify.md +2 -1
- package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +5 -3
- package/dist/agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +7 -9
- package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +8 -6
- package/dist/agent-src/contexts/contracts/frugality-charter.md +8 -5
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +1 -1
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +0 -1
- package/dist/agent-src/contexts/execution/evidence-discipline.md +2 -2
- package/dist/agent-src/contexts/execution/non-interactive-contract.md +5 -8
- package/dist/agent-src/contexts/execution/rdp-gate.md +4 -4
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +9 -8
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +67 -52
- package/dist/agent-src/contexts/execution/subagent-routing.md +8 -8
- package/dist/agent-src/contexts/execution/subagent-steering.md +6 -4
- package/dist/agent-src/contexts/execution/terminal-states.md +2 -2
- package/dist/agent-src/contexts/execution/toolchain-resolver.md +4 -10
- package/dist/agent-src/contexts/subagent-configuration.md +1 -1
- package/dist/agent-src/guidelines/agent-infra/active-remediation-mechanics.md +39 -0
- package/dist/agent-src/guidelines/agent-infra/context-hygiene-mechanics.md +1 -1
- package/dist/agent-src/guidelines/agent-infra/cross-source-consistency-mechanics.md +8 -10
- package/dist/agent-src/guidelines/agent-infra/frontier-reasoning-operating-profile.md +3 -2
- package/dist/agent-src/guidelines/agent-infra/layered-settings.md +13 -1
- package/dist/agent-src/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/dist/agent-src/guidelines/agent-infra/self-improvement-pipeline.md +10 -3
- package/dist/agent-src/guidelines/agent-infra/size-and-scope.md +36 -0
- package/dist/agent-src/guidelines/design-antipatterns.md +1 -1
- package/dist/agent-src/guidelines/php/git.md +15 -2
- package/dist/agent-src/rules/active-remediation.md +0 -1
- package/dist/agent-src/rules/analysis-skill-routing.md +0 -1
- package/dist/agent-src/rules/architecture.md +0 -1
- package/dist/agent-src/rules/artifact-drafting-protocol.md +0 -1
- package/dist/agent-src/rules/artifact-engagement-recording.md +0 -1
- package/dist/agent-src/rules/augment-edit-discipline.md +0 -1
- package/dist/agent-src/rules/autonomous-execution.md +0 -1
- package/dist/agent-src/rules/brand-consistency.md +0 -1
- package/dist/agent-src/rules/brand-source-of-truth.md +0 -1
- package/dist/agent-src/rules/broken-access-control.md +0 -1
- package/dist/agent-src/rules/cli-output-handling.md +0 -1
- package/dist/agent-src/rules/code-comment-discipline.md +0 -1
- package/dist/agent-src/rules/code-provenance.md +0 -1
- package/dist/agent-src/rules/command-suggestion-policy.md +0 -1
- package/dist/agent-src/rules/commit-conventions.md +1 -2
- package/dist/agent-src/rules/communication-through-line.md +1 -2
- package/dist/agent-src/rules/content-quoting-floor.md +1 -2
- package/dist/agent-src/rules/context-hygiene.md +5 -5
- package/dist/agent-src/rules/copilot-routing.md +1 -2
- package/dist/agent-src/rules/council-availability.md +4 -4
- package/dist/agent-src/rules/cross-source-consistency.md +4 -6
- package/dist/agent-src/rules/decision-revisit-gate.md +2 -3
- package/dist/agent-src/rules/delegation-policy.md +2 -3
- package/dist/agent-src/rules/design-fidelity.md +0 -1
- package/dist/agent-src/rules/design-review-after-ui-write.md +3 -3
- package/dist/agent-src/rules/devcontainer-routing.md +1 -2
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +0 -1
- package/dist/agent-src/rules/docker-commands.md +0 -1
- package/dist/agent-src/rules/domain-adoption-policy.md +0 -1
- package/dist/agent-src/rules/domain-safety-disclaimer.md +0 -1
- package/dist/agent-src/rules/domain-safety-pii.md +0 -1
- package/dist/agent-src/rules/domain-safety-retention.md +0 -1
- package/dist/agent-src/rules/downstream-changes.md +0 -1
- package/dist/agent-src/rules/engineering-safety-floor.md +0 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +0 -1
- package/dist/agent-src/rules/external-reference-deep-dive.md +0 -1
- package/dist/agent-src/rules/fast-path-marker-visibility.md +1 -2
- package/dist/agent-src/rules/finance-safety-floor.md +0 -1
- package/dist/agent-src/rules/fix-what-you-see.md +6 -32
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +0 -1
- package/dist/agent-src/rules/git-history-discipline.md +1 -2
- package/dist/agent-src/rules/guidelines.md +0 -1
- package/dist/agent-src/rules/history-discipline.md +0 -1
- package/dist/agent-src/rules/icon-consistency.md +0 -1
- package/dist/agent-src/rules/image-likeness-and-rights.md +0 -1
- package/dist/agent-src/rules/improve-before-implement.md +0 -1
- package/dist/agent-src/rules/invite-challenge.md +0 -1
- package/dist/agent-src/rules/laravel-routing.md +1 -2
- package/dist/agent-src/rules/laravel-translations.md +0 -1
- package/dist/agent-src/rules/legal-safety-floor.md +0 -1
- package/dist/agent-src/rules/lethal-trifecta-guard.md +0 -1
- package/dist/agent-src/rules/linked-projects-onboarding-gate.md +0 -1
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +0 -1
- package/dist/agent-src/rules/markdown-safe-codeblocks.md +0 -1
- package/dist/agent-src/rules/media-governance-routing.md +1 -2
- package/dist/agent-src/rules/media-sync-ground-truth.md +0 -1
- package/dist/agent-src/rules/minimal-safe-diff.md +0 -1
- package/dist/agent-src/rules/missing-skill-recovery.md +0 -1
- package/dist/agent-src/rules/missing-tool-handling.md +0 -1
- package/dist/agent-src/rules/model-recommendation.md +0 -1
- package/dist/agent-src/rules/neighbour-precedence.md +64 -0
- package/dist/agent-src/rules/no-attribution-footers.md +0 -1
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +0 -1
- package/dist/agent-src/rules/no-pr-progress-comments.md +0 -1
- package/dist/agent-src/rules/no-roadmap-references.md +0 -1
- package/dist/agent-src/rules/notes-first-reasoning.md +0 -1
- package/dist/agent-src/rules/onboarding-gate.md +0 -1
- package/dist/agent-src/rules/output-discipline.md +0 -1
- package/dist/agent-src/rules/package-ci-checks.md +0 -1
- package/dist/agent-src/rules/persona-governance.md +2 -3
- package/dist/agent-src/rules/php-coding.md +0 -1
- package/dist/agent-src/rules/prefer-enums-over-literals.md +0 -1
- package/dist/agent-src/rules/preservation-guard.md +0 -1
- package/dist/agent-src/rules/provider-lifecycle-discipline.md +2 -3
- package/dist/agent-src/rules/question-not-instruction.md +0 -1
- package/dist/agent-src/rules/reviewer-awareness.md +0 -1
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +0 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +3 -6
- package/dist/agent-src/rules/role-mode-adherence.md +0 -1
- package/dist/agent-src/rules/rule-type-governance.md +0 -1
- package/dist/agent-src/rules/runtime-safety.md +0 -1
- package/dist/agent-src/rules/scale-discipline.md +0 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +0 -1
- package/dist/agent-src/rules/security-sensitive-stop.md +0 -1
- package/dist/agent-src/rules/self-repair-loop.md +0 -1
- package/dist/agent-src/rules/senior-engineering-discipline.md +0 -1
- package/dist/agent-src/rules/session-canary.md +0 -1
- package/dist/agent-src/rules/settings-ask-protocol.md +5 -6
- package/dist/agent-src/rules/size-enforcement.md +0 -1
- package/dist/agent-src/rules/skill-improvement-trigger.md +2 -3
- package/dist/agent-src/rules/skill-quality.md +0 -1
- package/dist/agent-src/rules/slash-command-routing-policy.md +0 -1
- package/dist/agent-src/rules/source-confidentiality.md +0 -1
- package/dist/agent-src/rules/source-discovery-gate.md +0 -1
- package/dist/agent-src/rules/source-of-truth.md +0 -1
- package/dist/agent-src/rules/spreadsheet-source-quality.md +1 -2
- package/dist/agent-src/rules/strategy-safety-floor.md +0 -1
- package/dist/agent-src/rules/symfony-routing.md +1 -2
- package/dist/agent-src/rules/think-before-action.md +0 -1
- package/dist/agent-src/rules/token-budget-discipline.md +14 -48
- package/dist/agent-src/rules/token-efficiency.md +0 -1
- package/dist/agent-src/rules/token-optimizer-maintenance.md +0 -1
- package/dist/agent-src/rules/tool-safety.md +0 -1
- package/dist/agent-src/rules/ui-audit-gate.md +1 -2
- package/dist/agent-src/rules/untrusted-input-defense.md +0 -1
- package/dist/agent-src/rules/upstream-proposal.md +0 -1
- package/dist/agent-src/rules/user-interaction.md +0 -1
- package/dist/agent-src/rules/user-interrupt-priority.md +0 -1
- package/dist/agent-src/scripts/gate_budget.ts +47 -23
- package/dist/agent-src/scripts/gate_execute.ts +12 -4
- package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +2 -0
- package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
- package/dist/agent-src/skills/ai-council/SKILL.md +7 -4
- package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +21 -11
- package/dist/agent-src/skills/ai-council/references/procedure.md +12 -6
- package/dist/agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
- package/dist/agent-src/skills/bug-analyzer/SKILL.md +1 -1
- package/dist/agent-src/skills/canvas-design/SKILL.md +4 -2
- package/dist/agent-src/skills/command-routing/SKILL.md +3 -4
- package/dist/agent-src/skills/conventional-commits-writing/SKILL.md +127 -139
- package/dist/agent-src/skills/corpus-grounding/ATTRIBUTION.md +39 -0
- package/dist/agent-src/skills/corpus-grounding/SKILL.md +8 -2
- package/dist/agent-src/skills/database/data/manifest.json +2 -2
- package/dist/agent-src/skills/database/data/query-tuning.csv +13 -13
- package/dist/agent-src/skills/design-intelligence/references/integration-mapping.md +13 -10
- package/dist/agent-src/skills/design-system-capture/SKILL.md +0 -3
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +1 -1
- package/dist/agent-src/skills/fe-design/references/design-patterns.md +49 -2
- package/dist/agent-src/skills/feature-planning/SKILL.md +1 -1
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +9 -0
- package/dist/agent-src/skills/git-workflow/SKILL.md +44 -44
- package/dist/agent-src/skills/git-workflow/references/branch-update.md +312 -0
- package/dist/agent-src/skills/git-workflow/references/commit-subject.md +205 -0
- package/dist/agent-src/skills/iconography/SKILL.md +4 -2
- package/dist/agent-src/skills/image-provider-routing/SKILL.md +16 -5
- package/dist/agent-src/skills/jira-integration/SKILL.md +3 -3
- package/dist/agent-src/skills/logo-generation/SKILL.md +12 -8
- package/dist/agent-src/skills/merge-conflicts/SKILL.md +10 -4
- package/dist/agent-src/skills/po-discovery/SKILL.md +1 -1
- package/dist/agent-src/skills/refine-ticket/SKILL.md +4 -4
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +2 -2
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +4 -2
- package/dist/agent-src/skills/source-discovery/SKILL.md +1 -1
- package/dist/agent-src/skills/svg-authoring/SKILL.md +318 -0
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +3 -1
- package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +1 -1
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +2 -2
- package/dist/agent-src/skills/wireframe/SKILL.md +5 -2
- package/dist/agent-src/templates/AGENTS.md +1 -1
- package/dist/agent-src/templates/agent-settings.md +46 -129
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +3 -3
- package/dist/agent-src/templates/command.md +2 -2
- package/dist/agent-src/templates/roadmaps.md +6 -1
- package/dist/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +0 -6
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +11 -7
- package/dist/agent-src/templates/scripts/work_engine/hooks/builtin/decision_trace.ts +3 -2
- package/dist/agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.ts +2 -1
- package/dist/agent-src/templates/scripts/work_engine/hooks/settings.ts +0 -6
- package/dist/agent-src/templates/scripts/work_engine/scoring/decision_engine.ts +9 -12
- package/dist/agent-src/templates/scripts/work_engine/scoring/memory_visibility.ts +2 -1
- package/dist/agent-src/templates/skill.md +1 -1
- package/dist/cli/commands/uiRender.js +201 -4
- package/dist/cli/commands/uiRenderAsset.js +1308 -0
- package/dist/cli/commands/uiRenderAssetCompare.js +752 -0
- package/dist/cli/commands/uiRenderAssetGrid.js +265 -0
- package/dist/cli/commands/uiRenderAssetGrounds.js +323 -0
- package/dist/cli/commands/uiRenderAssetIsolation.js +85 -0
- package/dist/cli/commands/uiRenderAssetTypes.js +145 -0
- package/dist/cli/main.js +47 -1
- package/dist/cli/registry.js +2 -1
- package/dist/cli-delegate/check_update_banner.js +195 -119
- package/dist/cli-delegate/{chunk-S4UMZNES.js → chunk-4DBG5K7M.js} +5 -5
- package/dist/cli-delegate/{chunk-TRI6DQZ6.js → chunk-5GPULQBE.js} +60 -42
- package/dist/cli-delegate/{chunk-JQVYKIZA.js → chunk-6SRJTYJS.js} +33 -177
- package/dist/cli-delegate/chunk-6V5FMA3P.js +186 -0
- package/dist/cli-delegate/chunk-6YQC2HLF.js +415 -0
- package/dist/cli-delegate/{chunk-E4XIZDIB.js → chunk-7HKRE54K.js} +1 -64
- package/dist/cli-delegate/{chunk-7HQ52DHU.js → chunk-AL3RZ22D.js} +1 -1
- package/dist/cli-delegate/{chunk-DBH4AHDK.js → chunk-ED7KCMLB.js} +9 -11
- package/dist/cli-delegate/{chunk-NXEILF2K.js → chunk-F3QDG2GT.js} +481 -72
- package/dist/cli-delegate/{chunk-CQWX336L.js → chunk-G5VVIZRC.js} +3 -3
- package/dist/cli-delegate/{chunk-JY2I2DXV.js → chunk-H76PHZBI.js} +137 -60
- package/dist/cli-delegate/chunk-IAYTIIQW.js +67 -0
- package/dist/cli-delegate/{chunk-LIYTLH6O.js → chunk-KXXWJTDO.js} +5 -10
- package/dist/cli-delegate/{chunk-T7L2QK3K.js → chunk-LQOCRFWT.js} +1 -1
- package/dist/cli-delegate/{chunk-S4YWNRKO.js → chunk-MDPPKQCQ.js} +34 -1
- package/dist/cli-delegate/chunk-OAFSJBHH.js +272 -0
- package/dist/cli-delegate/{chunk-GKE7ZVFA.js → chunk-PWX7CKMD.js} +1 -1
- package/dist/cli-delegate/{chunk-NDJLNC6Q.js → chunk-T6BP34WI.js} +1 -0
- package/dist/cli-delegate/{chunk-RQNNW7IF.js → chunk-T7XSJSUQ.js} +433 -632
- package/dist/cli-delegate/{chunk-NQ7WT43P.js → chunk-TMWYUOK4.js} +75 -12
- package/dist/cli-delegate/{chunk-EEHDXSYD.js → chunk-WQWXGIWB.js} +12 -273
- package/dist/cli-delegate/{chunk-QLDHIPWR.js → chunk-XQTPXKFA.js} +1 -1
- package/dist/cli-delegate/cmd_analyze_session.js +223 -43
- package/dist/cli-delegate/cmd_brand_status.js +3 -2
- package/dist/cli-delegate/cmd_conformance.js +489 -238
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +15 -12
- package/dist/cli-delegate/cmd_doctor_neighbours.js +11 -4
- package/dist/cli-delegate/cmd_explain.js +43 -19
- package/dist/cli-delegate/cmd_export.js +10 -10
- package/dist/cli-delegate/cmd_git_convention.js +1851 -0
- package/dist/cli-delegate/cmd_handoff.js +40 -21
- package/dist/cli-delegate/cmd_mcp_available.js +3 -2
- package/dist/cli-delegate/cmd_migrate.js +3 -3
- package/dist/cli-delegate/cmd_packs_active.js +4 -3
- package/dist/cli-delegate/cmd_prune.js +10 -10
- package/dist/cli-delegate/cmd_route_audit.js +7 -7
- package/dist/cli-delegate/cmd_route_explain.js +5 -5
- package/dist/cli-delegate/cmd_session_recycle.js +9 -7
- package/dist/cli-delegate/cmd_settings_check.js +54 -7
- package/dist/cli-delegate/cmd_settings_get.js +18 -8
- package/dist/cli-delegate/cmd_settings_migrate.js +10 -10
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +10 -10
- package/dist/cli-delegate/cmd_uninstall.js +10 -10
- package/dist/cli-delegate/cmd_update.js +7 -7
- package/dist/cli-delegate/cmd_upgrade.js +7 -7
- package/dist/cli-delegate/cmd_validate.js +10 -10
- package/dist/cli-delegate/cmd_versions.js +5 -5
- package/dist/cli-delegate/gate_budget.js +1 -1
- package/dist/cli-delegate/gate_execute.js +2 -2
- package/dist/cli-delegate/roadmap_gates.js +2 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +171 -107
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +7 -7
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +41 -22
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +16 -11
- package/dist/hooks/dispatch.js +2520 -1924
- package/dist/hooks/dispatch.sha256 +1 -1
- package/dist/hooks/svg_rules.chunk.cjs +1626 -0
- package/dist/hooks/svg_rules.chunk.cjs.sha256 +1 -0
- package/dist/install/install.mjs +462 -431
- package/dist/install/installThinLayer.js +40 -12
- package/dist/install/installedRuleLinks.js +105 -19
- package/dist/mcp/awesome-mcp-servers.row.md +1 -1
- package/dist/mcp/mcp-cloudflare-catalogue.json +2 -2
- package/dist/mcp/registry-manifest.json +5 -5
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +3063 -2160
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_settings.js +15 -120
- package/dist/scripts/_lib/compile_time_toggles.js +12 -21
- package/dist/scripts/_lib/git_convention.js +232 -0
- package/dist/scripts/_lib/global_deploy_inventory.js +730 -0
- package/dist/scripts/_lib/installed_layer.js +344 -18
- package/dist/scripts/_lib/package_root.js +68 -0
- package/dist/scripts/_lib/rule_law_section.js +1 -1
- package/dist/scripts/_lib/scan_scope.js +105 -0
- package/dist/scripts/_lib/settings_removed_keys.js +168 -0
- package/dist/scripts/_lib/svg_dom.js +284 -0
- package/dist/scripts/_lib/svg_geometry.js +477 -0
- package/dist/scripts/_lib/svg_motion.js +179 -0
- package/dist/scripts/_lib/svg_rules.js +1337 -0
- package/dist/scripts/_lib/svg_urls.js +67 -0
- package/dist/scripts/_lib/thin_rules.js +80 -3
- package/dist/scripts/lint_svg_asset.js +324 -0
- package/dist/server/app.js +2 -1
- package/dist/server/gitKeysGate.js +105 -0
- package/dist/server/routes/settings.js +67 -8
- package/dist/server/routes/wizard.js +4 -0
- package/dist/server/schemas/settings.js +23 -81
- package/dist/shared/skillRanking.js +30 -4
- package/dist/ui/assets/{index-Cwq4d0hX.js → index-C3djEJah.js} +2 -2
- package/dist/ui/index.html +1 -1
- package/docs/MIGRATION.md +72 -1
- package/docs/contracts/settings-classes.md +35 -65
- package/docs/guidelines/agent-infra/active-remediation-mechanics.md +39 -0
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/cross-source-consistency-mechanics.md +8 -10
- package/docs/guidelines/agent-infra/frontier-reasoning-operating-profile.md +3 -2
- package/docs/guidelines/agent-infra/layered-settings.md +13 -1
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/self-improvement-pipeline.md +10 -3
- package/docs/guidelines/agent-infra/size-and-scope.md +36 -0
- package/docs/guidelines/design-antipatterns.md +1 -1
- package/docs/guidelines/php/git.md +15 -2
- package/package.json +4 -3
- package/src/agent-src/scripts/gate_budget.ts +47 -23
- package/src/agent-src/scripts/gate_execute.ts +12 -4
- package/src/agent-src/templates/AGENTS.md +1 -1
- package/src/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +0 -6
- package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +11 -7
- package/src/agent-src/templates/scripts/work_engine/hooks/builtin/decision_trace.ts +3 -2
- package/src/agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.ts +2 -1
- package/src/agent-src/templates/scripts/work_engine/hooks/settings.ts +0 -6
- package/src/agent-src/templates/scripts/work_engine/scoring/decision_engine.ts +9 -12
- package/src/agent-src/templates/scripts/work_engine/scoring/memory_visibility.ts +2 -1
- package/src/config/agent-settings.template.yml +79 -312
- package/src/config/agents-paths.yml +16 -0
- package/src/config/assurance-capability-registry.json +7 -3
- package/src/config/ci-local-parity.yml +3 -0
- package/src/config/continuity-surface.json +3 -3
- package/src/config/discovery/packs.yml +17 -1
- package/src/config/evaluator-budgets.json +19 -6
- package/src/config/gate-coverage.yml +65 -23
- package/src/config/gate-violation-baselines.json +56 -16
- package/src/config/gitignore-block.txt +19 -0
- package/src/config/hook-bundle-budget.json +1 -1
- package/src/config/release-gate-locality.yml +2 -1
- package/src/config/routing-coverage-seed.json +55 -6
- package/src/config/rule-law-ceilings.json +12 -6
- package/src/config/rule-obligations.json +833 -0
- package/src/install/installThinLayer.ts +76 -10
- package/src/install/installedRuleLinks.ts +105 -17
- package/src/scripts/_cli/cmd_analyze_session.ts +9 -15
- package/src/scripts/_cli/cmd_conformance.ts +13 -2
- package/src/scripts/_cli/cmd_doctor.ts +10 -10
- package/src/scripts/_cli/cmd_doctor_neighbours.ts +133 -0
- package/src/scripts/_cli/cmd_explain.ts +72 -14
- package/src/scripts/_cli/cmd_git_convention.ts +637 -0
- package/src/scripts/_cli/cmd_settings_check.ts +66 -8
- package/src/scripts/_cli/cmd_settings_get.ts +18 -3
- package/src/scripts/_cli/doctor_execution.ts +72 -1
- package/src/scripts/_dispatch.bash +37 -2
- package/src/scripts/_lib/agent_settings.ts +15 -124
- package/src/scripts/_lib/blocked_by_marker.ts +1 -1
- package/src/scripts/_lib/compile_time_toggles.ts +12 -21
- package/src/scripts/_lib/dispatch_import_closure.ts +163 -0
- package/src/scripts/_lib/git_base_ref.ts +92 -0
- package/src/scripts/_lib/git_convention.ts +291 -0
- package/src/scripts/_lib/git_convention_carrier.ts +389 -0
- package/src/scripts/_lib/git_convention_grammar.ts +246 -0
- package/src/scripts/_lib/git_convention_measure.ts +344 -0
- package/src/scripts/_lib/global_deploy_inventory.ts +74 -0
- package/src/scripts/_lib/graph_feeder_record.ts +236 -13
- package/src/scripts/_lib/installed_layer.ts +448 -23
- package/src/scripts/_lib/knowledge_global.ts +14 -1
- package/src/scripts/_lib/module_reach.ts +456 -0
- package/src/scripts/_lib/neighbour_contradictions.ts +236 -0
- package/src/scripts/_lib/neighbour_tool_use.ts +8 -10
- package/src/scripts/_lib/ratification_artifact.ts +220 -1
- package/src/scripts/_lib/ratification_subject.ts +92 -0
- package/src/scripts/_lib/release_findings_ingest.ts +15 -7
- package/src/scripts/_lib/release_highlights.ts +5 -0
- package/src/scripts/_lib/rule_law_section.ts +1 -1
- package/src/scripts/_lib/rule_obligations.ts +205 -0
- package/src/scripts/_lib/self_repair.ts +1 -1
- package/src/scripts/_lib/settings_removed_keys.ts +173 -0
- package/src/scripts/_lib/svg_dom.ts +318 -0
- package/src/scripts/_lib/svg_geometry.ts +480 -0
- package/src/scripts/_lib/svg_motion.ts +208 -0
- package/src/scripts/_lib/svg_rules.ts +1453 -0
- package/src/scripts/_lib/svg_urls.ts +72 -0
- package/src/scripts/_lib/test_red_state.ts +5 -0
- package/src/scripts/_lib/thin_rules.ts +83 -3
- package/src/scripts/_lib/touched_file_quality.ts +142 -6
- package/src/scripts/_lib/verification_command.ts +59 -0
- package/src/scripts/_lib/verify_clause.ts +27 -17
- package/src/scripts/_lib/worker_budget.ts +1 -1
- package/src/scripts/adr/regenerate_index.ts +16 -1
- package/src/scripts/ai_council/config.ts +7 -7
- package/src/scripts/ai_council/modification_review.ts +100 -0
- package/src/scripts/ai_council/modification_review_questions.ts +90 -0
- package/src/scripts/ai_council/orchestrator.ts +5 -5
- package/src/scripts/ai_council/spend_gate.ts +18 -7
- package/src/scripts/ai_team/config.ts +11 -16
- package/src/scripts/audit_user_type_axis.ts +20 -8
- package/src/scripts/bench_ab_clone.ts +1 -2
- package/src/scripts/bench_concern_spawn_path.ts +129 -0
- package/src/scripts/bench_graph_feeder_latency.ts +584 -0
- package/src/scripts/check_agent_artifact_location.ts +36 -0
- package/src/scripts/check_branch_freshness.ts +147 -24
- package/src/scripts/check_enforcement_coverage.ts +130 -0
- package/src/scripts/check_evaluator_budgets.ts +4 -0
- package/src/scripts/check_finding_dispositions.ts +88 -25
- package/src/scripts/check_gate_coverage.ts +4 -3
- package/src/scripts/check_gate_reachability.ts +48 -1
- package/src/scripts/check_generator_sync.ts +48 -0
- package/src/scripts/check_hook_bundle_composition.ts +107 -0
- package/src/scripts/check_kernel_edit_ratified.ts +86 -6
- package/src/scripts/check_pack_size.ts +1 -1
- package/src/scripts/check_release_manifest_content.ts +189 -0
- package/src/scripts/check_standing_rule_delivery.ts +96 -0
- package/src/scripts/check_suppression_hygiene.ts +2 -5
- package/src/scripts/ci_settle.ts +42 -5
- package/src/scripts/classify_merge_risk.ts +320 -0
- package/src/scripts/closure_scan.ts +91 -1
- package/src/scripts/command_suggester/settings.ts +8 -108
- package/src/scripts/command_suggester/types.ts +4 -5
- package/src/scripts/consumer_matrix.ts +102 -0
- package/src/scripts/context_hygiene_hook.ts +13 -23
- package/src/scripts/cost/preflight.mjs +12 -1
- package/src/scripts/council_cli.ts +7 -7
- package/src/scripts/dispatch_r2_reviewer.ts +24 -11
- package/src/scripts/explain_run.ts +8 -13
- package/src/scripts/generate_git_convention_grammar.ts +127 -0
- package/src/scripts/generate_host_cost_table.ts +20 -3
- package/src/scripts/handoff_context_hook.ts +86 -37
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +25 -6
- package/src/scripts/hooks/block_config_weakening.ts +48 -5
- package/src/scripts/hooks/block_plumbing_writes.ts +8 -4
- package/src/scripts/hooks/block_speaking_inbox_dir.ts +16 -1
- package/src/scripts/hooks/concern_registry.ts +2 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +2 -3
- package/src/scripts/hooks/design_pass_hook.ts +157 -3
- package/src/scripts/hooks/evidence_independence.ts +12 -4
- package/src/scripts/hooks/mcp_usage_observation_hook.ts +121 -0
- package/src/scripts/hooks/push_settle_hook.ts +4 -3
- package/src/scripts/hooks/rule_inject_hook.ts +44 -3
- package/src/scripts/hooks/state_io.ts +8 -4
- package/src/scripts/hooks/svg_obligation.ts +497 -0
- package/src/scripts/hooks/svg_rules_loader.ts +133 -0
- package/src/scripts/hooks/telemetry_usage_hook.ts +7 -46
- package/src/scripts/hooks/turn_end_gate_hook.ts +6 -3
- package/src/scripts/install-hooks.sh +42 -14
- package/src/scripts/install.ts +7 -31
- package/src/scripts/lint_blocker_citations.ts +198 -0
- package/src/scripts/lint_consolidation_lineage.ts +6 -3
- package/src/scripts/lint_design_quality.ts +60 -12
- package/src/scripts/lint_evidence_artifacts.ts +9 -0
- package/src/scripts/lint_hook_concern_budget.ts +10 -21
- package/src/scripts/lint_motion_authority_drift.ts +27 -0
- package/src/scripts/lint_pack_boundaries.ts +406 -28
- package/src/scripts/lint_roadmap_blockers.ts +282 -29
- package/src/scripts/lint_roadmap_complexity.ts +4 -2
- package/src/scripts/lint_rule_law_section.ts +151 -21
- package/src/scripts/lint_rule_skill_pack_reach.ts +17 -0
- package/src/scripts/lint_settings_classes.ts +1 -1
- package/src/scripts/lint_svg_asset.ts +365 -0
- package/src/scripts/lint_ticked_unmet_criteria.ts +165 -0
- package/src/scripts/lint_workflow_security.ts +12 -1
- package/src/scripts/measure_skill_ranker_baseline.ts +5 -0
- package/src/scripts/model_rule_injection.ts +3 -3
- package/src/scripts/onboarding_gate_hook.ts +7 -6
- package/src/scripts/print_required_checks.ts +15 -3
- package/src/scripts/probe_host_compliance.ts +33 -5
- package/src/scripts/probe_turnaround.ts +183 -3
- package/src/scripts/ratification_header.ts +77 -0
- package/src/scripts/refusal_envelope.ts +138 -0
- package/src/scripts/release_publication.ts +29 -3
- package/src/scripts/report_dispatch_import_closure.ts +76 -0
- package/src/scripts/report_installed_rule_links.ts +118 -1
- package/src/scripts/report_module_reach.ts +212 -0
- package/src/scripts/report_obligation_mechanism.ts +16 -18
- package/src/scripts/report_parked_blockers.ts +222 -0
- package/src/scripts/report_required_checks_drift.ts +196 -0
- package/src/scripts/report_skill_ranker_confusion.ts +103 -2
- package/src/scripts/report_standing_payload_by_host.ts +1 -1
- package/src/scripts/routing_doctor.ts +2 -2
- package/src/scripts/schemas/agent-settings.schema.json +17 -31
- package/src/scripts/schemas/command.schema.json +1 -1
- package/src/scripts/schemas/skill.schema.json +1 -1
- package/src/scripts/self_review_gate.ts +39 -2
- package/src/scripts/skill_tools/score_skill_relevance.ts +28 -19
- package/src/scripts/sync_pr_branch.ts +403 -132
- package/src/scripts/trigger_eval_grandfather.json +0 -16
- package/src/server/schemas/settings.ts +33 -177
- package/src/shared/skillRanking.ts +53 -4
- package/dist/cli-delegate/chunk-NYX3L2PZ.js +0 -99
- package/src/scripts/_lib/config_chain.ts +0 -477
- package/src/scripts/_lib/conformance_report.ts +0 -403
- package/src/scripts/_lib/eval_discrimination.ts +0 -95
- package/src/scripts/_lib/evaluator_promotion.ts +0 -225
- package/src/scripts/_lib/file_slicer.ts +0 -117
- package/src/scripts/_lib/legacy_boundary_map.ts +0 -228
- package/src/scripts/_lib/minimality_tiebreak.ts +0 -168
- package/src/scripts/_lib/overbuild_lens_contract.ts +0 -196
- package/src/scripts/_lib/role_split.ts +0 -338
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Evaluator promotion — a new evaluator earns its seat by cross-grading, or it
|
|
3
|
-
* does not get one.
|
|
4
|
-
*
|
|
5
|
-
* `road-to-governed-harness-evolution` Phase 4, step 4.7.
|
|
6
|
-
*
|
|
7
|
-
* > *Reuse the discrimination and hygiene machinery. `eval_publication`'s
|
|
8
|
-
* > `PlantedItem` for plants, `judge_hygiene` for order-swap. Add the
|
|
9
|
-
* > evaluator-promotion procedure the master omitted: an old and a new
|
|
10
|
-
* > evaluator must cross-grade frozen candidate sets, and evaluator promotion
|
|
11
|
-
* > itself requires discrimination plants.*
|
|
12
|
-
* > verify: **a planted candidate the control arm also satisfies is reported as
|
|
13
|
-
* > a discrimination deficit, not as a win; an evaluator change with no
|
|
14
|
-
* > cross-grade is refused.**
|
|
15
|
-
*
|
|
16
|
-
* ## Reuse, not reimplementation
|
|
17
|
-
*
|
|
18
|
-
* Risk 1 on this roadmap is a parallel rebuild of machinery that already
|
|
19
|
-
* exists, committed four times by the source proposals. So nothing here scores
|
|
20
|
-
* a plant, classifies an assertion, or decides a paired verdict:
|
|
21
|
-
* {@link reportPlants} delegates to `eval_publication.discriminationDeficit`
|
|
22
|
-
* and {@link assertEvaluatorPromotable} delegates to
|
|
23
|
-
* `judge_hygiene.auditAssertions`. What this module adds is the one thing
|
|
24
|
-
* neither has: the REFUSAL that turns an evaluator swap into a gated event.
|
|
25
|
-
*
|
|
26
|
-
* ## Why a satisfied plant can be a deficit rather than a win
|
|
27
|
-
*
|
|
28
|
-
* A plant exists to be recoverable only via the behaviour under test. If the
|
|
29
|
-
* control arm also satisfies it, then the item measured general competence and
|
|
30
|
-
* the treatment's success over it is not evidence about the treatment — the two
|
|
31
|
-
* arms scored the same for different-looking reasons. Counting it as a win is
|
|
32
|
-
* the exact inflation `eval_publication`'s header describes, so
|
|
33
|
-
* {@link reportPlants} moves it into `discrimination_deficits` and, critically,
|
|
34
|
-
* strips its `requires_artifact_behaviour` flag before handing the set to
|
|
35
|
-
* `discriminationDeficit` — otherwise a fixture set whose every discriminating
|
|
36
|
-
* plant turned out to be non-discriminating in practice would still pass the
|
|
37
|
-
* pre-run check on its declared intent.
|
|
38
|
-
*
|
|
39
|
-
* ## Order-swap is carried as a declared property, and refused when absent
|
|
40
|
-
*
|
|
41
|
-
* `judge_hygiene`'s header records that blinding and the order-swap are already
|
|
42
|
-
* met upstream by `check_quality_regression.evaluatePair`, which judges every
|
|
43
|
-
* pair in both orders and resolves a flip to `inconsistent`. This module does
|
|
44
|
-
* not re-implement that; it requires the cross-grade to DECLARE that it ran
|
|
45
|
-
* that way ({@link CrossGrade.order_swapped}) and refuses the promotion when it
|
|
46
|
-
* did not. That is an honest boundary: the property is asserted by the caller
|
|
47
|
-
* and checked here, not observed here.
|
|
48
|
-
*/
|
|
49
|
-
import { discriminationDeficit, type PlantedItem } from './eval_publication.js';
|
|
50
|
-
import { auditAssertions, type AssertionObservation } from './judge_hygiene.js';
|
|
51
|
-
|
|
52
|
-
/** One plant, and what each arm actually did with it. */
|
|
53
|
-
export interface PlantOutcome {
|
|
54
|
-
item: PlantedItem;
|
|
55
|
-
treatment_satisfied: boolean;
|
|
56
|
-
control_satisfied: boolean;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface DiscriminationDeficitFinding {
|
|
60
|
-
id: string;
|
|
61
|
-
reason: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface PlantReport {
|
|
65
|
-
/** Plants the treatment satisfied and the control did not. The measurement. */
|
|
66
|
-
wins: readonly string[];
|
|
67
|
-
/** Plants the control also satisfied. Never wins, whatever the treatment did. */
|
|
68
|
-
discrimination_deficits: readonly DiscriminationDeficitFinding[];
|
|
69
|
-
/**
|
|
70
|
-
* The set-level verdict from `eval_publication.discriminationDeficit`, run
|
|
71
|
-
* over the EFFECTIVE set (observed, not declared). Non-null means the set
|
|
72
|
-
* cannot adjudicate at all.
|
|
73
|
-
*/
|
|
74
|
-
set_deficit: string | null;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** Classify every plant outcome. See the header for why a shared satisfaction is a deficit. */
|
|
78
|
-
export function reportPlants(outcomes: readonly PlantOutcome[]): PlantReport {
|
|
79
|
-
const wins: string[] = [];
|
|
80
|
-
const deficits: DiscriminationDeficitFinding[] = [];
|
|
81
|
-
const effective: PlantedItem[] = [];
|
|
82
|
-
|
|
83
|
-
for (const o of outcomes) {
|
|
84
|
-
if (o.control_satisfied) {
|
|
85
|
-
deficits.push({
|
|
86
|
-
id: o.item.id,
|
|
87
|
-
reason:
|
|
88
|
-
`the control arm also satisfied '${o.item.id}', so it measures general ` +
|
|
89
|
-
'competence rather than the behaviour under test — a discrimination deficit, not a win',
|
|
90
|
-
});
|
|
91
|
-
effective.push({ id: o.item.id, requires_artifact_behaviour: false });
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
effective.push({ id: o.item.id, requires_artifact_behaviour: o.item.requires_artifact_behaviour });
|
|
95
|
-
if (o.treatment_satisfied && o.item.requires_artifact_behaviour) {
|
|
96
|
-
wins.push(o.item.id);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
wins,
|
|
102
|
-
discrimination_deficits: deficits,
|
|
103
|
-
set_deficit: discriminationDeficit(effective),
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** The frozen candidate set both evaluators must grade. Frozen means: named and enumerated. */
|
|
108
|
-
export interface FrozenCandidateSet {
|
|
109
|
-
id: string;
|
|
110
|
-
candidate_ids: readonly string[];
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface CrossGrade {
|
|
114
|
-
from_evaluator: string;
|
|
115
|
-
to_evaluator: string;
|
|
116
|
-
/** Must equal the change's frozen set id — a cross-grade of some other set proves nothing. */
|
|
117
|
-
frozen_set_id: string;
|
|
118
|
-
/** Candidate ids the OLD evaluator graded. */
|
|
119
|
-
graded_by_from: readonly string[];
|
|
120
|
-
/** Candidate ids the NEW evaluator graded. */
|
|
121
|
-
graded_by_to: readonly string[];
|
|
122
|
-
/**
|
|
123
|
-
* Declared by the caller: every pair was judged in both orders upstream
|
|
124
|
-
* (`check_quality_regression.evaluatePair`). See the header — asserted, not
|
|
125
|
-
* observed here.
|
|
126
|
-
*/
|
|
127
|
-
order_swapped: boolean;
|
|
128
|
-
/** Rubric assertions used by the grading, audited via `judge_hygiene`. */
|
|
129
|
-
assertions: readonly AssertionObservation[];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface EvaluatorChange {
|
|
133
|
-
from: string;
|
|
134
|
-
to: string;
|
|
135
|
-
frozen_set: FrozenCandidateSet;
|
|
136
|
-
/** `null` is the case step 4.7 names: an evaluator change with no cross-grade. */
|
|
137
|
-
cross_grade: CrossGrade | null;
|
|
138
|
-
/** Discrimination plants. Evaluator promotion requires them, per step 4.7. */
|
|
139
|
-
plants: readonly PlantOutcome[];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export class EvaluatorPromotionRefused extends Error {
|
|
143
|
-
readonly reasons: readonly string[];
|
|
144
|
-
constructor(reasons: readonly string[]) {
|
|
145
|
-
super(`evaluator promotion refused: ${reasons.join('; ')}`);
|
|
146
|
-
this.name = 'EvaluatorPromotionRefused';
|
|
147
|
-
this.reasons = reasons;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function missing(required: readonly string[], graded: readonly string[]): string[] {
|
|
152
|
-
const seen = new Set(graded);
|
|
153
|
-
return required.filter((id) => !seen.has(id));
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Throw {@link EvaluatorPromotionRefused} unless every condition holds.
|
|
158
|
-
*
|
|
159
|
-
* Fail-closed by construction: the function has no permissive path and no
|
|
160
|
-
* option object that could relax one. A caller who wants to promote an
|
|
161
|
-
* evaluator without a cross-grade has to delete this call, which is visible in
|
|
162
|
-
* a diff, rather than pass a flag, which is not.
|
|
163
|
-
*/
|
|
164
|
-
export function assertEvaluatorPromotable(change: EvaluatorChange): void {
|
|
165
|
-
const reasons: string[] = [];
|
|
166
|
-
const cg = change.cross_grade;
|
|
167
|
-
|
|
168
|
-
if (cg === null) {
|
|
169
|
-
reasons.push(
|
|
170
|
-
`no cross-grade between '${change.from}' and '${change.to}' — an evaluator change ` +
|
|
171
|
-
'without one has no evidence that the two agree on anything',
|
|
172
|
-
);
|
|
173
|
-
} else {
|
|
174
|
-
if (cg.frozen_set_id !== change.frozen_set.id) {
|
|
175
|
-
reasons.push(
|
|
176
|
-
`the cross-grade names frozen set '${cg.frozen_set_id}' but the change is over ` +
|
|
177
|
-
`'${change.frozen_set.id}'`,
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
if (cg.from_evaluator !== change.from || cg.to_evaluator !== change.to) {
|
|
181
|
-
reasons.push(
|
|
182
|
-
`the cross-grade is between '${cg.from_evaluator}' and '${cg.to_evaluator}', ` +
|
|
183
|
-
`not between '${change.from}' and '${change.to}'`,
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
const missFrom = missing(change.frozen_set.candidate_ids, cg.graded_by_from);
|
|
187
|
-
const missTo = missing(change.frozen_set.candidate_ids, cg.graded_by_to);
|
|
188
|
-
if (missFrom.length > 0) {
|
|
189
|
-
reasons.push(`'${change.from}' did not grade: ${missFrom.join(', ')}`);
|
|
190
|
-
}
|
|
191
|
-
if (missTo.length > 0) {
|
|
192
|
-
reasons.push(`'${change.to}' did not grade: ${missTo.join(', ')}`);
|
|
193
|
-
}
|
|
194
|
-
if (!cg.order_swapped) {
|
|
195
|
-
reasons.push('the cross-grade did not declare the order-swap, so a position bias is unexcluded');
|
|
196
|
-
}
|
|
197
|
-
const audit = auditAssertions(cg.assertions);
|
|
198
|
-
const alwaysPass = audit.findings.filter((f) => f.verdict === 'non-discriminating-always-pass');
|
|
199
|
-
if (alwaysPass.length > 0) {
|
|
200
|
-
reasons.push(
|
|
201
|
-
`${String(alwaysPass.length)} assertion(s) pass in both arms and narrow nothing: ` +
|
|
202
|
-
alwaysPass.map((f) => f.id).join(', '),
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (change.plants.length === 0) {
|
|
208
|
-
reasons.push('evaluator promotion requires discrimination plants and this change carries none');
|
|
209
|
-
} else {
|
|
210
|
-
const report = reportPlants(change.plants);
|
|
211
|
-
if (report.set_deficit !== null) {
|
|
212
|
-
reasons.push(`plants cannot discriminate: ${report.set_deficit}`);
|
|
213
|
-
}
|
|
214
|
-
if (report.discrimination_deficits.length > 0) {
|
|
215
|
-
reasons.push(
|
|
216
|
-
`${String(report.discrimination_deficits.length)} plant(s) were also satisfied by the control arm: ` +
|
|
217
|
-
report.discrimination_deficits.map((d) => d.id).join(', '),
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (reasons.length > 0) {
|
|
223
|
-
throw new EvaluatorPromotionRefused(reasons);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic document slicer for oversized knowledge ingest
|
|
3
|
-
* (road-to-retrieval-substrate-hardening B8).
|
|
4
|
-
*
|
|
5
|
-
* Splits a large markdown document into bounded slices at the cleanest
|
|
6
|
-
* available boundary — heading > paragraph (blank line) > line — while
|
|
7
|
-
* guaranteeing three invariants a downstream re-assembler can rely on:
|
|
8
|
-
*
|
|
9
|
-
* 1. GAP-FREE + NON-OVERLAPPING — slices cover contiguous line ranges over
|
|
10
|
-
* the whole document, in order.
|
|
11
|
-
* 2. CONCAT == ORIGINAL — joining every slice's `text` in order reproduces
|
|
12
|
-
* the input byte-for-byte (slices are exact offset ranges).
|
|
13
|
-
* 3. PARENTED — every slice carries its source `parentPath` (when given) and
|
|
14
|
-
* its `[startLine, endLine)` range, so a chunk can point home.
|
|
15
|
-
*
|
|
16
|
-
* Deterministic: identical input + budget → identical slices.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export interface Slice {
|
|
20
|
-
parentPath: string | null;
|
|
21
|
-
index: number;
|
|
22
|
-
startLine: number; // 0-based, inclusive
|
|
23
|
-
endLine: number; // 0-based, exclusive
|
|
24
|
-
text: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/** Default per-slice character budget. */
|
|
28
|
-
export const DEFAULT_MAX_CHARS = 2000;
|
|
29
|
-
|
|
30
|
-
function _lineStartOffsets(text: string): number[] {
|
|
31
|
-
const starts = [0];
|
|
32
|
-
for (let i = 0; i < text.length; i++) {
|
|
33
|
-
if (text[i] === '\n') starts.push(i + 1);
|
|
34
|
-
}
|
|
35
|
-
return starts; // one entry per line; starts[k] = offset where line k begins
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _isHeading(line: string): boolean {
|
|
39
|
-
return /^#{1,6}\s/.test(line);
|
|
40
|
-
}
|
|
41
|
-
function _isBlank(line: string): boolean {
|
|
42
|
-
return line.trim() === '';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Slice `text` into ≤ `maxChars` pieces (best-effort — a single over-long line
|
|
47
|
-
* is emitted whole rather than split mid-line, preserving invariant 2).
|
|
48
|
-
* `parentPath` is stamped on every slice.
|
|
49
|
-
*/
|
|
50
|
-
export function sliceDocument(
|
|
51
|
-
text: string,
|
|
52
|
-
opts: { maxChars?: number; parentPath?: string } = {},
|
|
53
|
-
): Slice[] {
|
|
54
|
-
const maxChars = opts.maxChars ?? DEFAULT_MAX_CHARS;
|
|
55
|
-
const parentPath = opts.parentPath ?? null;
|
|
56
|
-
if (text === '') return [];
|
|
57
|
-
|
|
58
|
-
const starts = _lineStartOffsets(text);
|
|
59
|
-
const nLines = starts.length;
|
|
60
|
-
// lineAt(k) = the raw text of line k INCLUDING its trailing newline (if any).
|
|
61
|
-
const lineEnd = (k: number): number => (k + 1 < nLines ? starts[k + 1]! : text.length);
|
|
62
|
-
const lines: string[] = [];
|
|
63
|
-
for (let k = 0; k < nLines; k++) lines.push(text.slice(starts[k]!, lineEnd(k)));
|
|
64
|
-
|
|
65
|
-
const slices: Slice[] = [];
|
|
66
|
-
let sliceStartLine = 0;
|
|
67
|
-
let idx = 0;
|
|
68
|
-
const flush = (endLine: number): void => {
|
|
69
|
-
if (endLine <= sliceStartLine) return;
|
|
70
|
-
const from = starts[sliceStartLine]!;
|
|
71
|
-
const to = endLine < nLines ? starts[endLine]! : text.length;
|
|
72
|
-
slices.push({ parentPath, index: idx++, startLine: sliceStartLine, endLine, text: text.slice(from, to) });
|
|
73
|
-
sliceStartLine = endLine;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
let curChars = 0;
|
|
77
|
-
for (let k = 0; k < nLines; k++) {
|
|
78
|
-
const lineLen = lines[k]!.length;
|
|
79
|
-
const wouldExceed = curChars + lineLen > maxChars && k > sliceStartLine;
|
|
80
|
-
// Cut BEFORE a heading that opens a new section (clean boundary), or
|
|
81
|
-
// when the budget would overflow — preferring a preceding blank line.
|
|
82
|
-
const headingBoundary = _isHeading(lines[k]!) && k > sliceStartLine;
|
|
83
|
-
if (headingBoundary || wouldExceed) {
|
|
84
|
-
// Prefer to end the previous slice at the last blank line in-range,
|
|
85
|
-
// so a slice ends on a paragraph boundary when one is available.
|
|
86
|
-
let cut = k;
|
|
87
|
-
if (wouldExceed && !headingBoundary) {
|
|
88
|
-
for (let b = k - 1; b > sliceStartLine; b--) {
|
|
89
|
-
if (_isBlank(lines[b]!)) {
|
|
90
|
-
cut = b + 1;
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
flush(cut);
|
|
96
|
-
curChars = 0;
|
|
97
|
-
for (let j = sliceStartLine; j <= k; j++) curChars += lines[j]!.length;
|
|
98
|
-
} else {
|
|
99
|
-
curChars += lineLen;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
flush(nLines);
|
|
103
|
-
return slices;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** True iff the slices reproduce `text` exactly, gap-free and non-overlapping. */
|
|
107
|
-
export function verifySlices(text: string, slices: readonly Slice[]): boolean {
|
|
108
|
-
if (slices.length === 0) return text === '';
|
|
109
|
-
let expectedLine = 0;
|
|
110
|
-
const parts: string[] = [];
|
|
111
|
-
for (const s of slices) {
|
|
112
|
-
if (s.startLine !== expectedLine) return false; // gap or overlap
|
|
113
|
-
expectedLine = s.endLine;
|
|
114
|
-
parts.push(s.text);
|
|
115
|
-
}
|
|
116
|
-
return parts.join('') === text;
|
|
117
|
-
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A per-path legacy/modern verdict for a half-migrated repository.
|
|
3
|
-
*
|
|
4
|
-
* `road-to-consumer-repo-reality` Phase 4, step 4.1. Incremental replacement of
|
|
5
|
-
* a legacy system alongside the system it replaces is a named, published
|
|
6
|
-
* migration pattern; the artifact that pattern needs and nobody produces is a
|
|
7
|
-
* decidable answer to *"which conventions hold HERE"*.
|
|
8
|
-
*
|
|
9
|
-
* Current guidance says to respect existing patterns and to keep diffs minimal.
|
|
10
|
-
* Neither is decidable without this: in a tree that is two-fifths namespaced,
|
|
11
|
-
* strict-typed, PSR-shaped code and three-fifths an older include-and-dispatch
|
|
12
|
-
* module system, "the existing pattern" is not a property of the repository.
|
|
13
|
-
*
|
|
14
|
-
* A MIXED VERDICT IS NOT A REFUSAL TO DECIDE. That is the step's own wording and
|
|
15
|
-
* it is the hardest requirement here: a verdict that says only "mixed" leaves
|
|
16
|
-
* the caller exactly where it started. So a mixed file reports WHICH convention
|
|
17
|
-
* governs WHICH REGION, by line range, and `conventionAt(verdict, line)` answers
|
|
18
|
-
* the only question an editor actually has — *what must my edit at this point
|
|
19
|
-
* follow?*
|
|
20
|
-
*
|
|
21
|
-
* WHAT THIS MAY AND MAY NOT ENCODE. The phase states the trap in its own body:
|
|
22
|
-
* 4.2 and 4.3 were each observed in exactly one tree, so what may be encoded is
|
|
23
|
-
* the QUESTION, never the particular mechanism that tree happened to use. 4.1 is
|
|
24
|
-
* not in that category — namespaces, strict-type declarations and PSR-4
|
|
25
|
-
* autoloading are language-level and specification-level facts, not one
|
|
26
|
-
* repository's arrangement — but the same restraint is applied anyway: the
|
|
27
|
-
* signals below are all language constructs, and none is a project-specific
|
|
28
|
-
* naming convention, directory layout or framework marker.
|
|
29
|
-
*
|
|
30
|
-
* PER PATH, NEVER PER REPOSITORY. A repository-wide verdict is the thing that
|
|
31
|
-
* makes this artifact useless: the whole point is that the answer differs by
|
|
32
|
-
* file, and inside a file by region.
|
|
33
|
-
*/
|
|
34
|
-
import * as fs from 'node:fs';
|
|
35
|
-
|
|
36
|
-
/** Which convention governs. `unknown` is returned rather than guessed. */
|
|
37
|
-
export type Convention = 'modern' | 'legacy' | 'mixed' | 'unknown';
|
|
38
|
-
|
|
39
|
-
/** A contiguous run of lines governed by one convention. */
|
|
40
|
-
export interface Region {
|
|
41
|
-
/** 1-indexed, inclusive. */
|
|
42
|
-
startLine: number;
|
|
43
|
-
/** 1-indexed, inclusive. */
|
|
44
|
-
endLine: number;
|
|
45
|
-
convention: 'modern' | 'legacy';
|
|
46
|
-
/** The construct that decided it. Never empty. */
|
|
47
|
-
signal: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface PathVerdict {
|
|
51
|
-
/** The path as given. */
|
|
52
|
-
path: string;
|
|
53
|
-
convention: Convention;
|
|
54
|
-
/**
|
|
55
|
-
* Populated for EVERY verdict that is not `unknown`, including a
|
|
56
|
-
* single-convention file — a caller should not need two code paths.
|
|
57
|
-
*/
|
|
58
|
-
regions: Region[];
|
|
59
|
-
/**
|
|
60
|
-
* A single foreign signal inside an otherwise uniform file — one `$GLOBALS`
|
|
61
|
-
* read in a namespaced class, one class-like declaration in an
|
|
62
|
-
* include-and-dispatch file. Reported as a POINT and deliberately not as a
|
|
63
|
-
* region: a lone signal says something true about ITS line and nothing about
|
|
64
|
-
* the lines after it, and letting it open a region made every line to the end
|
|
65
|
-
* of the file inherit a convention it does not have.
|
|
66
|
-
*/
|
|
67
|
-
foreignPoints: { line: number; convention: 'modern' | 'legacy'; signal: string }[];
|
|
68
|
-
/** One sentence naming what decided it. Never empty. */
|
|
69
|
-
reason: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Signals, as language constructs only.
|
|
74
|
-
*
|
|
75
|
-
* `modern` markers are things the older include-and-dispatch style cannot
|
|
76
|
-
* express; `legacy` markers are things the namespaced style does not use. A line
|
|
77
|
-
* matching neither is inherited from the enclosing region rather than guessed —
|
|
78
|
-
* most lines in any file carry no signal at all.
|
|
79
|
-
*/
|
|
80
|
-
const MODERN: readonly { re: RegExp; signal: string }[] = [
|
|
81
|
-
{ re: /^\s*declare\s*\(\s*strict_types\s*=\s*1\s*\)/, signal: 'declare(strict_types=1)' },
|
|
82
|
-
{ re: /^\s*namespace\s+[A-Za-z_]/, signal: 'namespace declaration' },
|
|
83
|
-
{ re: /^\s*use\s+[A-Za-z_][A-Za-z0-9_]*\\/, signal: 'namespaced use statement' },
|
|
84
|
-
{ re: /^\s*(?:final\s+|abstract\s+)?(?:readonly\s+)?(?:class|interface|trait|enum)\s+/, signal: 'class-like declaration' },
|
|
85
|
-
];
|
|
86
|
-
|
|
87
|
-
const LEGACY: readonly { re: RegExp; signal: string }[] = [
|
|
88
|
-
{ re: /^\s*(?:require|include)(?:_once)?\s*[\s(]/, signal: 'require/include' },
|
|
89
|
-
{ re: /^\s*global\s+\$/, signal: 'global statement' },
|
|
90
|
-
{ re: /\$GLOBALS\s*\[/, signal: '$GLOBALS access' },
|
|
91
|
-
{ re: /^\s*function\s+[a-z][A-Za-z0-9_]*\s*\(/, signal: 'unnamespaced snake/camel function' },
|
|
92
|
-
];
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Requiring the Composer autoloader is the MODERN ecosystem's own bootstrap, not
|
|
96
|
-
* the include-and-dispatch pattern. Without this exception the canonical PSR-4
|
|
97
|
-
* entry point — `require __DIR__ . '/../vendor/autoload.php';` — makes every
|
|
98
|
-
* modern application's front controller come back `mixed`, which is the single
|
|
99
|
-
* most common file shape in the ecosystem this module is meant to classify.
|
|
100
|
-
*/
|
|
101
|
-
const AUTOLOAD_REQUIRE = /vendor\/autoload\.php/;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* A line that is only a comment carries no convention. `// never touch
|
|
105
|
-
* $GLOBALS['x']` is advice ABOUT legacy code, and reading it as legacy code
|
|
106
|
-
* flips the region a reader is standing in. Block-comment interiors are not
|
|
107
|
-
* tracked — that needs a lexer — so only whole-line `//`, `#` and `*`
|
|
108
|
-
* continuations are skipped.
|
|
109
|
-
*/
|
|
110
|
-
const COMMENT_ONLY = /^\s*(?:\/\/|#|\*|\/\*)/;
|
|
111
|
-
|
|
112
|
-
function _signalFor(line: string): { convention: 'modern' | 'legacy'; signal: string } | null {
|
|
113
|
-
if (COMMENT_ONLY.test(line)) return null;
|
|
114
|
-
for (const { re, signal } of MODERN) if (re.test(line)) return { convention: 'modern', signal };
|
|
115
|
-
if (AUTOLOAD_REQUIRE.test(line)) return null;
|
|
116
|
-
for (const { re, signal } of LEGACY) if (re.test(line)) return { convention: 'legacy', signal };
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Classify one file's text into regions.
|
|
122
|
-
*
|
|
123
|
-
* A signal starts a region that runs until the next signal of the OTHER
|
|
124
|
-
* convention. Lines before the first signal belong to the first region, so every
|
|
125
|
-
* line of a classified file is covered — a caller asking about line 1 of a file
|
|
126
|
-
* whose first signal is on line 3 gets an answer rather than a hole.
|
|
127
|
-
*/
|
|
128
|
-
export function classifyText(pathName: string, text: string): PathVerdict {
|
|
129
|
-
const lines = text.split('\n');
|
|
130
|
-
const hits: { line: number; convention: 'modern' | 'legacy'; signal: string }[] = [];
|
|
131
|
-
for (let i = 0; i < lines.length; i += 1) {
|
|
132
|
-
const hit = _signalFor(lines[i] ?? '');
|
|
133
|
-
if (hit !== null) hits.push({ line: i + 1, ...hit });
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// A lone signal of one convention, against two or more of the other, is a
|
|
137
|
-
// POINT rather than a region boundary. Two is the threshold because one
|
|
138
|
-
// occurrence is as likely to be an artifact — a legacy global read inside a
|
|
139
|
-
// modern service, a single class declaration in an old dispatch file — as a
|
|
140
|
-
// statement about the surrounding code.
|
|
141
|
-
const counts = { modern: 0, legacy: 0 };
|
|
142
|
-
for (const h of hits) counts[h.convention] += 1;
|
|
143
|
-
const isolated: 'modern' | 'legacy' | null =
|
|
144
|
-
counts.modern === 1 && counts.legacy >= 2 ? 'modern'
|
|
145
|
-
: counts.legacy === 1 && counts.modern >= 2 ? 'legacy'
|
|
146
|
-
: null;
|
|
147
|
-
const foreignPoints = isolated === null ? [] : hits.filter((h) => h.convention === isolated);
|
|
148
|
-
const structural = isolated === null ? hits : hits.filter((h) => h.convention !== isolated);
|
|
149
|
-
|
|
150
|
-
const regions: Region[] = [];
|
|
151
|
-
for (const hit of structural) {
|
|
152
|
-
const i = hit.line - 1;
|
|
153
|
-
const last = regions[regions.length - 1];
|
|
154
|
-
if (last !== undefined && last.convention === hit.convention) {
|
|
155
|
-
last.endLine = i + 1;
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
regions.push({ startLine: i + 1, endLine: i + 1, convention: hit.convention, signal: hit.signal });
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (regions.length === 0) {
|
|
162
|
-
return {
|
|
163
|
-
path: pathName,
|
|
164
|
-
convention: 'unknown',
|
|
165
|
-
regions: [],
|
|
166
|
-
foreignPoints,
|
|
167
|
-
reason: 'no convention signal found — neither a namespaced construct nor an include-and-dispatch one',
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// Extend each region to meet the next, and the first back to line 1, so the
|
|
172
|
-
// whole file is covered and `conventionAt` never returns a hole.
|
|
173
|
-
const first = regions[0] as Region;
|
|
174
|
-
first.startLine = 1;
|
|
175
|
-
for (let i = 0; i < regions.length - 1; i += 1) {
|
|
176
|
-
(regions[i] as Region).endLine = (regions[i + 1] as Region).startLine - 1;
|
|
177
|
-
}
|
|
178
|
-
(regions[regions.length - 1] as Region).endLine = Math.max(lines.length, 1);
|
|
179
|
-
|
|
180
|
-
const kinds = new Set(regions.map((r) => r.convention));
|
|
181
|
-
if (kinds.size === 1) {
|
|
182
|
-
const only = [...kinds][0] as 'modern' | 'legacy';
|
|
183
|
-
return {
|
|
184
|
-
path: pathName,
|
|
185
|
-
convention: only,
|
|
186
|
-
regions,
|
|
187
|
-
foreignPoints,
|
|
188
|
-
reason:
|
|
189
|
-
`every structural signal in this file is ${only} (${regions.map((r) => r.signal).join(', ')})` +
|
|
190
|
-
(foreignPoints.length === 0
|
|
191
|
-
? ''
|
|
192
|
-
: `. One isolated ${isolated} signal at L${foreignPoints.map((f) => f.line).join(', L')} ` +
|
|
193
|
-
`(${foreignPoints.map((f) => f.signal).join(', ')}) — true of that line, not of the lines after it`),
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
return {
|
|
197
|
-
path: pathName,
|
|
198
|
-
convention: 'mixed',
|
|
199
|
-
regions,
|
|
200
|
-
foreignPoints,
|
|
201
|
-
reason:
|
|
202
|
-
`both conventions appear in this file, in ${regions.length} regions. ` +
|
|
203
|
-
regions.map((r) => `L${r.startLine}-${r.endLine} ${r.convention} (${r.signal})`).join('; ') +
|
|
204
|
-
'. An edit follows the convention of the region it lands in, not the file as a whole.',
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/** Read and classify one file. An unreadable file is `unknown`, never guessed. */
|
|
209
|
-
export function classifyPath(absPath: string, displayPath = absPath): PathVerdict {
|
|
210
|
-
try {
|
|
211
|
-
return classifyText(displayPath, fs.readFileSync(absPath, 'utf8'));
|
|
212
|
-
} catch {
|
|
213
|
-
return { path: displayPath, convention: 'unknown', regions: [], foreignPoints: [], reason: 'unreadable' };
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* The only question an editor actually has: what must an edit at THIS line
|
|
219
|
-
* follow? Returns `null` when the file carries no signal at all — which is a
|
|
220
|
-
* real answer, and different from "modern by default".
|
|
221
|
-
*/
|
|
222
|
-
export function conventionAt(verdict: PathVerdict, line: number): 'modern' | 'legacy' | null {
|
|
223
|
-
for (const f of verdict.foreignPoints) if (f.line === line) return f.convention;
|
|
224
|
-
for (const r of verdict.regions) {
|
|
225
|
-
if (line >= r.startLine && line <= r.endLine) return r.convention;
|
|
226
|
-
}
|
|
227
|
-
return null;
|
|
228
|
-
}
|