@event4u/agent-config 14.10.0 → 14.12.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 +161 -208
- package/README.md +1 -1
- package/dist/agent-src/commands/design.md +88 -0
- package/dist/agent-src/commands/project/analyze.md +47 -0
- package/dist/agent-src/commands/review/changes.md +67 -6
- package/dist/agent-src/commands/roadmap/create.md +49 -0
- package/dist/agent-src/commands/roadmap/next.md +27 -11
- package/dist/agent-src/commands/roadmap/process-full.md +14 -0
- package/dist/agent-src/commands/video/from-script.md +60 -3
- package/dist/agent-src/commands/video/stitch.md +14 -0
- package/dist/agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +1 -0
- package/dist/agent-src/contexts/execution/evidence-discipline.md +26 -0
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +154 -2
- package/dist/agent-src/rules/active-remediation.md +3 -3
- package/dist/agent-src/rules/code-provenance.md +2 -2
- package/dist/agent-src/rules/context-hygiene.md +13 -33
- package/dist/agent-src/rules/council-availability.md +2 -2
- package/dist/agent-src/rules/decision-revisit-gate.md +3 -1
- package/dist/agent-src/rules/design-fidelity.md +18 -0
- package/dist/agent-src/rules/design-review-after-ui-write.md +2 -2
- package/dist/agent-src/rules/evaluator-independence.md +56 -44
- package/dist/agent-src/rules/fix-what-you-see.md +9 -1
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +1 -1
- package/dist/agent-src/rules/minimal-safe-diff.md +14 -20
- package/dist/agent-src/rules/missing-skill-recovery.md +13 -1
- package/dist/agent-src/rules/playbook-precedence.md +105 -0
- package/dist/agent-src/rules/recurring-criticism.md +3 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +14 -13
- package/dist/agent-src/rules/scale-discipline.md +24 -0
- package/dist/agent-src/rules/security-sensitive-stop.md +2 -2
- package/dist/agent-src/rules/settings-ask-protocol.md +2 -2
- package/dist/agent-src/rules/ui-audit-gate.md +27 -15
- package/dist/agent-src/rules/untrusted-input-defense.md +2 -2
- package/dist/agent-src/skills/accessibility-auditor/SKILL.md +19 -0
- package/dist/agent-src/skills/adr-create/SKILL.md +7 -0
- package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +33 -0
- package/dist/agent-src/skills/ai-council/references/advanced-modes.md +17 -3
- package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +31 -0
- package/dist/agent-src/skills/ai-council/references/procedure.md +19 -0
- package/dist/agent-src/skills/alerting-doctrine/SKILL.md +225 -0
- package/dist/agent-src/skills/authz-review/SKILL.md +0 -1
- package/dist/agent-src/skills/blast-radius-analyzer/SKILL.md +32 -0
- package/dist/agent-src/skills/brand/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-asset-generation/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-audit/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-identity/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-strategy/SKILL.md +3 -0
- package/dist/agent-src/skills/brand-to-tokens/SKILL.md +3 -0
- package/dist/agent-src/skills/check-refs/SKILL.md +3 -0
- package/dist/agent-src/skills/code-refactoring/SKILL.md +45 -1
- package/dist/agent-src/skills/code-review/SKILL.md +75 -5
- package/dist/agent-src/skills/command-routing/SKILL.md +6 -0
- package/dist/agent-src/skills/command-writing/SKILL.md +35 -0
- package/dist/agent-src/skills/condense-memory/SKILL.md +3 -0
- package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
- package/dist/agent-src/skills/conventional-commits-writing/SKILL.md +3 -0
- package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +10 -0
- package/dist/agent-src/skills/corpus-grounding/SKILL.md +3 -0
- package/dist/agent-src/skills/design-intelligence/SKILL.md +3 -0
- package/dist/agent-src/skills/design-intelligence/data/landing.csv +36 -35
- package/dist/agent-src/skills/design-intelligence/data/stacks/threejs.csv +1 -0
- package/dist/agent-src/skills/design-review/SKILL.md +79 -1
- package/dist/agent-src/skills/design-review/references/verification-automation.md +41 -0
- package/dist/agent-src/skills/design-system-capture/SKILL.md +35 -40
- package/dist/agent-src/skills/design-system-capture/references/import-procedure.md +50 -0
- package/dist/agent-src/skills/design-tokens/SKILL.md +3 -0
- package/dist/agent-src/skills/design-variations/SKILL.md +3 -0
- package/dist/agent-src/skills/developer-like-execution/SKILL.md +3 -0
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +3 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +28 -4
- package/dist/agent-src/skills/fe-design/SKILL.md +74 -41
- package/dist/agent-src/skills/fe-design/references/craft-floor.md +52 -0
- package/dist/agent-src/skills/fe-design/references/source-led-port.md +36 -0
- package/dist/agent-src/skills/file-editor/SKILL.md +5 -0
- package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +2 -2
- package/dist/agent-src/skills/git-workflow/SKILL.md +3 -0
- package/dist/agent-src/skills/html-deck/SKILL.md +3 -0
- package/dist/agent-src/skills/iconography/SKILL.md +3 -0
- package/dist/agent-src/skills/image-editing/SKILL.md +3 -0
- package/dist/agent-src/skills/image-generation/SKILL.md +3 -0
- package/dist/agent-src/skills/image-provider-routing/SKILL.md +3 -0
- package/dist/agent-src/skills/incident-commander/SKILL.md +10 -0
- package/dist/agent-src/skills/js-library-packaging/SKILL.md +173 -0
- package/dist/agent-src/skills/js-library-packaging/scripts/check_package_surface.ts +270 -0
- package/dist/agent-src/skills/laravel-migration/SKILL.md +3 -0
- package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +3 -0
- package/dist/agent-src/skills/lint-skills/SKILL.md +3 -0
- package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +3 -0
- package/dist/agent-src/skills/logging-monitoring/SKILL.md +234 -51
- package/dist/agent-src/skills/logo-generation/SKILL.md +3 -0
- package/dist/agent-src/skills/md-language-check/SKILL.md +3 -0
- package/dist/agent-src/skills/monorepo-workspace/SKILL.md +149 -0
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +6 -0
- package/dist/agent-src/skills/multi-tenancy/SKILL.md +4 -0
- package/dist/agent-src/skills/operational-readiness/SKILL.md +184 -0
- package/dist/agent-src/skills/override-management/SKILL.md +3 -0
- package/dist/agent-src/skills/persona-improvement/SKILL.md +3 -0
- package/dist/agent-src/skills/pest-testing/SKILL.md +3 -0
- package/dist/agent-src/skills/playbook-authoring/SKILL.md +162 -0
- package/dist/agent-src/skills/playwright-testing/SKILL.md +3 -0
- package/dist/agent-src/skills/privacy-review/SKILL.md +3 -0
- package/dist/agent-src/skills/project-analysis-core/SKILL.md +23 -0
- package/dist/agent-src/skills/prompt-engineering-image/SKILL.md +3 -0
- package/dist/agent-src/skills/quality-tools/SKILL.md +5 -0
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +81 -33
- package/dist/agent-src/skills/readme-reviewer/SKILL.md +3 -0
- package/dist/agent-src/skills/readme-writing/SKILL.md +3 -0
- package/dist/agent-src/skills/readme-writing-package/SKILL.md +3 -0
- package/dist/agent-src/skills/receiving-code-review/SKILL.md +2 -2
- package/dist/agent-src/skills/refine-prompt/SKILL.md +3 -0
- package/dist/agent-src/skills/refine-ticket/SKILL.md +3 -0
- package/dist/agent-src/skills/requesting-code-review/SKILL.md +2 -2
- package/dist/agent-src/skills/review-routing/SKILL.md +2 -2
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +23 -41
- package/dist/agent-src/skills/roadmap-writing/references/follow-up-roadmap-shape.md +47 -0
- package/dist/agent-src/skills/rtk-output-filtering/SKILL.md +22 -6
- package/dist/agent-src/skills/runway-cognition/SKILL.md +3 -0
- package/dist/agent-src/skills/scene-expander/scene-blueprint.schema.yaml +26 -0
- package/dist/agent-src/skills/secrets-management/SKILL.md +4 -0
- package/dist/agent-src/skills/server-hardening/SKILL.md +159 -0
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +3 -0
- package/dist/agent-src/skills/skill-management/SKILL.md +3 -0
- package/dist/agent-src/skills/skill-reviewer/SKILL.md +3 -0
- package/dist/agent-src/skills/skill-writing/SKILL.md +6 -0
- package/dist/agent-src/skills/skill-writing/references/procedure.md +24 -2
- package/dist/agent-src/skills/spreadsheet-authoring/SKILL.md +3 -0
- package/dist/agent-src/skills/storybook-workshop/SKILL.md +203 -0
- package/dist/agent-src/skills/storybook-workshop/scripts/story_contrast_floor.ts +134 -0
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +1 -1
- package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +25 -0
- package/dist/agent-src/skills/supply-chain-intake/SKILL.md +12 -0
- package/dist/agent-src/skills/systematic-debugging/SKILL.md +1 -1
- package/dist/agent-src/skills/terraform/SKILL.md +3 -0
- package/dist/agent-src/skills/test-driven-development/SKILL.md +1 -1
- package/dist/agent-src/skills/threat-modeling/SKILL.md +0 -3
- package/dist/agent-src/skills/token-optimizer/SKILL.md +3 -0
- package/dist/agent-src/skills/typography-system/SKILL.md +3 -0
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +17 -1
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +3 -0
- package/dist/agent-src/skills/validate-feature-fit/SKILL.md +3 -0
- package/dist/agent-src/skills/verify-completion-evidence/SKILL.md +2 -2
- package/dist/agent-src/skills/wireframe/SKILL.md +3 -0
- package/dist/agent-src/skills/wireframe/references/story-beat-ledger.schema.json +115 -0
- package/dist/agent-src/skills/workspace-link/SKILL.md +131 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/playbook.md +75 -0
- package/dist/agent-src/templates/roadmaps.md +37 -0
- package/dist/agent-src/templates/scripts/check_playbook_invokes.ts +231 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +24 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +216 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +159 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +73 -4
- package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +325 -40
- package/dist/cli/commands/uiAudit.js +221 -0
- package/dist/cli/commands/uiRender.js +206 -0
- package/dist/cli/main.js +22 -1
- package/dist/cli/mcp/content.js +64 -1
- package/dist/cli/mcp/dispatch.js +175 -10
- package/dist/cli/registry.js +3 -0
- package/dist/cli-delegate/{chunk-G23AT6GD.js → chunk-DMSZHXZS.js} +57 -1
- package/dist/cli-delegate/{chunk-77GR3VD4.js → chunk-FF7WAFMR.js} +58 -3
- package/dist/cli-delegate/{chunk-YM4GZDJG.js → chunk-JCW7ZLHK.js} +10 -0
- package/dist/cli-delegate/{chunk-H4VIVD4C.js → chunk-JJA2QEWA.js} +413 -391
- package/dist/cli-delegate/{chunk-PLSG6UL5.js → chunk-K4FFODTS.js} +341 -204
- package/dist/cli-delegate/{chunk-B2ERU2VA.js → chunk-WOKWX5PL.js} +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +8 -6
- package/dist/cli-delegate/cmd_conformance.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +3 -3
- package/dist/cli-delegate/cmd_export.js +4 -4
- package/dist/cli-delegate/cmd_handoff.js +1 -1
- package/dist/cli-delegate/cmd_preflight.js +2 -2
- package/dist/cli-delegate/cmd_prune.js +4 -4
- package/dist/cli-delegate/cmd_session_recycle.js +70 -9
- package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +4 -4
- package/dist/cli-delegate/cmd_uninstall.js +4 -4
- package/dist/cli-delegate/cmd_validate.js +4 -4
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +362 -127
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +18 -8
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +16 -6
- package/dist/hooks/dispatch.js +2575 -1472
- package/dist/install/install.mjs +800 -708
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1685 -1250
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/lean_projection_mode.js +40 -0
- package/dist/scripts/_lib/scoped_projection.js +84 -0
- package/dist/scripts/_lib/ui_surface.js +89 -0
- package/dist/scripts/condense.js +6 -10
- package/dist/scripts/project_thin_rules.js +40 -2
- package/dist/server/schemas/settings.js +6 -0
- package/dist/shared/skillRanking.js +159 -0
- package/docs/contracts/provider-lifecycle.md +47 -18
- package/docs/contracts/settings-classes.md +35 -5
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +49 -0
- package/docs/guidelines/agent-infra/downstream-changes-mechanics.md +91 -0
- package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +92 -0
- package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +45 -1
- package/docs/guidelines/agent-infra/roadmap-deferred-resolution-provenance.md +54 -0
- package/docs/guidelines/code-clarity.md +21 -0
- package/docs/guidelines/design-antipatterns.md +4 -2
- package/docs/guidelines/design-asset-discipline.md +38 -0
- package/docs/guidelines/design-fidelity-mechanics.md +45 -29
- package/docs/guidelines/design-handover-extraction.md +35 -5
- package/docs/guidelines/design-modes.md +41 -1
- package/docs/guidelines/monorepo-antipatterns.md +141 -0
- package/docs/guidelines/redundancy-taxonomy.md +180 -0
- package/llms.txt +50 -39
- package/package.json +6 -2
- package/src/agent-src/templates/scripts/check_playbook_invokes.ts +231 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +24 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +216 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +159 -0
- package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +73 -4
- package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +325 -40
- package/src/config/agent-settings.template.yml +44 -0
- package/src/config/assurance-capability-registry.json +223 -0
- package/src/config/assurance-threshold-budget.json +65 -0
- package/src/config/budgets.yml +19 -0
- package/src/config/ci-local-parity.yml +29 -0
- package/src/config/discovery/prompt-patterns.yml +56 -0
- package/src/config/discovery/unassigned-artefacts.yml +2 -0
- package/src/config/dispatch-economy-metrics.json +4 -2
- package/src/config/estate-count-budget.json +8 -3
- package/src/config/evaluator-budgets.json +14 -14
- package/src/config/gate-coverage.yml +392 -8
- package/src/config/gate-violation-baselines.json +76 -72
- package/src/config/hook-latency-budget.json +1 -0
- package/src/config/hook-token-budget.json +137 -125
- package/src/config/pack-size-budget.json +39 -10
- package/src/config/preamble-payload-budget.json +97 -71
- package/src/config/quorum-attendance-budget.json +12 -4
- package/src/config/routing-coverage-seed.json +29 -0
- package/src/config/rule-activation-census.json +7 -3
- package/src/config/rule-enforcement-baseline.json +0 -1
- package/src/config/rule-stub-ceilings.json +112 -91
- package/src/config/suggestion-capture.json +28 -0
- package/src/config/surface-matrix.yml +21 -2
- package/src/config/web-launch-readiness.json +188 -0
- package/src/scripts/_cli/cmd_doctor.ts +15 -16
- package/src/scripts/_cli/doctor_install_mode.ts +49 -0
- package/src/scripts/_cli/doctor_overrides.ts +154 -0
- package/src/scripts/_dispatch.bash +17 -0
- package/src/scripts/_lib/as_of.ts +412 -0
- package/src/scripts/_lib/exec_evidence.ts +7 -0
- package/src/scripts/_lib/gate_baseline.ts +150 -1
- package/src/scripts/_lib/hook_settings.ts +33 -0
- package/src/scripts/_lib/host_listing_model.ts +192 -0
- package/src/scripts/_lib/lean_projection_mode.ts +44 -0
- package/src/scripts/_lib/mcp_bridge.ts +199 -0
- package/src/scripts/_lib/review_independence.ts +62 -10
- package/src/scripts/_lib/rule_injection.ts +239 -0
- package/src/scripts/_lib/run_checkpoint.ts +54 -1
- package/src/scripts/_lib/scoped_projection.ts +96 -0
- package/src/scripts/_lib/session_register.ts +44 -2
- package/src/scripts/_lib/skill_catalogue.ts +38 -2
- package/src/scripts/_lib/skill_estate.ts +115 -0
- package/src/scripts/_lib/transcript_reads.ts +207 -0
- package/src/scripts/_lib/ui_authority.ts +343 -0
- package/src/scripts/ai-video/adapters/fal.sh +8 -3
- package/src/scripts/ai-video/adapters/gemini-veo.sh +10 -0
- package/src/scripts/ai-video/adapters/higgsfield.sh +10 -2
- package/src/scripts/ai-video/adapters/kling.sh +10 -0
- package/src/scripts/ai-video/adapters/sora.sh +10 -0
- package/src/scripts/ai-video/lib/calibrate-cost.sh +145 -0
- package/src/scripts/ai-video/lib/model-capabilities/README.md +53 -7
- package/src/scripts/ai-video/lib/model-capabilities/comfyui.json +15 -3
- package/src/scripts/ai-video/lib/model-capabilities/fal.json +36 -6
- package/src/scripts/ai-video/lib/model-capabilities/gemini-veo.json +23 -0
- package/src/scripts/ai-video/lib/model-capabilities/higgsfield.json +23 -0
- package/src/scripts/ai-video/lib/model-capabilities/kling.json +23 -0
- package/src/scripts/ai-video/lib/model-capabilities/musetalk.json +8 -2
- package/src/scripts/ai-video/lib/model-capabilities/replicate.json +36 -6
- package/src/scripts/ai-video/lib/model-capabilities/sora.json +45 -0
- package/src/scripts/ai-video/lib/model-capabilities/syncso.json +8 -2
- package/src/scripts/ai-video/lib/parse-blueprint.sh +52 -5
- package/src/scripts/ai-video/lib/resume-scan.sh +92 -3
- package/src/scripts/ai-video/lib/seam-plan.sh +212 -0
- package/src/scripts/ai-video/smoke-trace.sh +450 -2
- package/src/scripts/ai-video/stitch.sh +191 -10
- package/src/scripts/ai-video/test-pipeline.sh +84 -6
- package/src/scripts/ai_council/argument_exhaustion.ts +130 -0
- package/src/scripts/ai_council/cli_agency_bounds.ts +139 -0
- package/src/scripts/ai_council/cli_least_agency_canary.ts +347 -0
- package/src/scripts/ai_council/clients.ts +3 -2
- package/src/scripts/ai_council/consensus.ts +63 -6
- package/src/scripts/ai_council/events_log.ts +46 -1
- package/src/scripts/ai_council/orchestrator.ts +103 -108
- package/src/scripts/ai_council/orchestrator_results.ts +166 -0
- package/src/scripts/ai_council/prompts.ts +12 -5
- package/src/scripts/ai_council/quorum.ts +82 -1
- package/src/scripts/ai_council/quorum_wiring.ts +82 -5
- package/src/scripts/ai_council/stance_tally.ts +22 -0
- package/src/scripts/bench_hook_latency.ts +62 -0
- package/src/scripts/build_proof.ts +12 -1
- package/src/scripts/capture_skill_catalogue.ts +21 -0
- package/src/scripts/check_always_budget.ts +2 -1
- package/src/scripts/check_augmentignore.ts +2 -1
- package/src/scripts/check_beta_review_markers.ts +2 -1
- package/src/scripts/check_bundle_path_leakage.ts +162 -7
- package/src/scripts/check_command_examples.ts +557 -0
- package/src/scripts/check_composite_arming.ts +364 -0
- package/src/scripts/check_corpus_staleness.ts +2 -1
- package/src/scripts/check_council_pin_staleness.ts +3 -1
- package/src/scripts/check_enforcement_coverage.ts +116 -3
- package/src/scripts/check_enforcement_denominator.ts +365 -0
- package/src/scripts/check_estate_count.ts +122 -3
- package/src/scripts/check_gate_coverage.ts +2 -1
- package/src/scripts/check_hook_bundle_freshness.ts +13 -1
- package/src/scripts/check_knowledge_cards.ts +2 -1
- package/src/scripts/check_knowledge_pages.ts +3 -2
- package/src/scripts/check_memory.ts +2 -1
- package/src/scripts/check_no_automerge_key.ts +287 -0
- package/src/scripts/check_pack_conformance_fixture.ts +565 -0
- package/src/scripts/check_preamble_payload_budget.ts +30 -3
- package/src/scripts/check_proposal.ts +2 -1
- package/src/scripts/check_reach_staleness.ts +2 -1
- package/src/scripts/check_release_adjacent_health.ts +2 -1
- package/src/scripts/check_release_pr_shape.ts +5 -0
- package/src/scripts/check_review_schema.ts +34 -1
- package/src/scripts/check_roadmap_trackable.ts +48 -3
- package/src/scripts/check_routing_coverage.ts +352 -0
- package/src/scripts/check_score_contract.ts +505 -0
- package/src/scripts/check_skill_admissions.ts +514 -0
- package/src/scripts/check_source_size_budget.ts +2 -1
- package/src/scripts/check_standing_payload_delta.ts +505 -0
- package/src/scripts/check_trigger_evals.ts +2 -1
- package/src/scripts/check_web_launch_readiness.ts +705 -0
- package/src/scripts/classify_change_risk.ts +281 -0
- package/src/scripts/compute_skill_tiers.ts +186 -0
- package/src/scripts/condense.ts +8 -13
- package/src/scripts/council_attendance_metrics.ts +183 -0
- package/src/scripts/council_cli.ts +10 -8
- package/src/scripts/council_parse_rate.ts +116 -0
- package/src/scripts/derive_playbooks.ts +406 -0
- package/src/scripts/description_route_check.ts +494 -0
- package/src/scripts/design_slop_rules.ts +56 -2
- package/src/scripts/dispatch_r2_reviewer.ts +16 -0
- package/src/scripts/frontend_corpus_hash.ts +116 -0
- package/src/scripts/grade_target_readiness.ts +478 -0
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +124 -16
- package/src/scripts/hooks/concern_registry.ts +6 -0
- package/src/scripts/hooks/design_pass_hook.ts +356 -0
- package/src/scripts/hooks/rtk_wrap_hook.ts +30 -7
- package/src/scripts/hooks/rule_inject_hook.ts +318 -0
- package/src/scripts/hooks/suggestion_capture_hook.ts +368 -0
- package/src/scripts/hot_context_hook.ts +74 -7
- package/src/scripts/install.ts +40 -89
- package/src/scripts/lint_adapter_tier.ts +663 -0
- package/src/scripts/lint_archived_skills.ts +93 -0
- package/src/scripts/lint_budget_ownership.ts +56 -5
- package/src/scripts/lint_deterministic_time.ts +470 -0
- package/src/scripts/lint_framework_leakage.ts +5 -0
- package/src/scripts/lint_handoffs.ts +525 -1
- package/src/scripts/lint_judge_prompt_expectation.ts +155 -0
- package/src/scripts/lint_marketplace.ts +88 -0
- package/src/scripts/lint_media_policy_linkage.ts +140 -1
- package/src/scripts/lint_one_off_age.ts +6 -1
- package/src/scripts/lint_override_kernel_guard.ts +87 -5
- package/src/scripts/lint_roadmap_complexity.ts +56 -0
- package/src/scripts/lint_rule_enforcement_declaration.ts +24 -7
- package/src/scripts/lint_rule_norm_pin.ts +321 -0
- package/src/scripts/lint_skill_trigger_corpus.ts +349 -0
- package/src/scripts/lint_spawn_payload.ts +42 -5
- package/src/scripts/lint_symptom_intake.ts +2 -1
- package/src/scripts/mcp_parity_smoke.ts +30 -4
- package/src/scripts/mcp_render.ts +66 -1
- package/src/scripts/mcp_tool_fingerprint.ts +241 -0
- package/src/scripts/measure_risk_class_drift.ts +140 -0
- package/src/scripts/measure_skill_ranker_baseline.ts +212 -0
- package/src/scripts/media/lib/adapter-common.sh +211 -1
- package/src/scripts/media/lib/adapter-contract.md +74 -6
- package/src/scripts/model_rule_injection.ts +907 -0
- package/src/scripts/pack_install_smoke.ts +363 -0
- package/src/scripts/pr_conflict_census.ts +187 -0
- package/src/scripts/project_thin_rules.ts +45 -2
- package/src/scripts/release.ts +66 -860
- package/src/scripts/release_drill.ts +59 -3
- package/src/scripts/release_env.ts +298 -0
- package/src/scripts/release_publication.ts +720 -0
- package/src/scripts/report_pack_delta.ts +204 -0
- package/src/scripts/roadmap_context.ts +778 -0
- package/src/scripts/schemas/fidelity-measurement-sheet.schema.json +169 -0
- package/src/scripts/schemas/rule.schema.json +24 -2
- package/src/scripts/schemas/skill.schema.json +39 -0
- package/src/scripts/schemas/ui-authority.schema.json +114 -0
- package/src/scripts/select_analysis_mode.ts +112 -0
- package/src/scripts/session_register_hook.ts +29 -3
- package/src/scripts/sessions_cli.ts +67 -3
- package/src/scripts/skill_tools/score_skill_relevance.ts +36 -53
- package/src/scripts/sync_pr_branch.ts +40 -1
- package/src/scripts/token_sink_report.ts +239 -0
- package/src/scripts/trigger_coverage.ts +122 -3
- package/src/scripts/update_counts.ts +7 -3
- package/src/scripts/validate_frontmatter.ts +66 -0
- package/src/server/schemas/settings.ts +10 -0
- package/src/shared/skillRanking.ts +183 -0
- package/dist/agent-src/skills/accessibility-auditor/evals/evals.json +0 -15
- package/dist/agent-src/skills/agent-security-review/evals/triggers.json +0 -52
- package/dist/agent-src/skills/ai-code-blindspots/evals/triggers.json +0 -52
- package/dist/agent-src/skills/analysis-skill-router/evals/evals.json +0 -13
- package/dist/agent-src/skills/brand/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-asset-generation/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-audit/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-identity/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-strategy/evals/triggers.json +0 -17
- package/dist/agent-src/skills/brand-to-tokens/evals/triggers.json +0 -17
- package/dist/agent-src/skills/bug-analyzer/evals/evals.json +0 -13
- package/dist/agent-src/skills/canvas-design/evals/triggers.json +0 -17
- package/dist/agent-src/skills/character-consistency/evals/evals.json +0 -16
- package/dist/agent-src/skills/code-intelligence/evals/triggers.json +0 -52
- package/dist/agent-src/skills/code-review/evals/evals.json +0 -100
- package/dist/agent-src/skills/command-routing/evals/evals.json +0 -14
- package/dist/agent-src/skills/complexity-first-planning/evals/triggers.json +0 -17
- package/dist/agent-src/skills/contract-review/evals/triggers.json +0 -17
- package/dist/agent-src/skills/conventional-commits-writing/evals/evals.json +0 -15
- package/dist/agent-src/skills/corpus-grounding/evals/triggers.json +0 -17
- package/dist/agent-src/skills/dashboard-design/evals/evals.json +0 -16
- package/dist/agent-src/skills/dcf-modeling/evals/domain-truth.json +0 -29
- package/dist/agent-src/skills/dcf-modeling/evals/evals.json +0 -20
- package/dist/agent-src/skills/decision-record/evals/evals.json +0 -20
- package/dist/agent-src/skills/decision-record/evals/triggers.json +0 -87
- package/dist/agent-src/skills/design-intelligence/evals/evals.json +0 -14
- package/dist/agent-src/skills/design-intelligence/evals/triggers.json +0 -17
- package/dist/agent-src/skills/design-system-capture/evals/evals.json +0 -15
- package/dist/agent-src/skills/design-tokens/evals/triggers.json +0 -17
- package/dist/agent-src/skills/design-variations/evals/triggers.json +0 -17
- package/dist/agent-src/skills/developer-like-execution/evals/evals.json +0 -16
- package/dist/agent-src/skills/doc-coauthoring/evals/evals.json +0 -16
- package/dist/agent-src/skills/doc-coauthoring/evals/triggers.json +0 -17
- package/dist/agent-src/skills/docx-authoring/evals/triggers.json +0 -52
- package/dist/agent-src/skills/dpa-review/evals/triggers.json +0 -17
- package/dist/agent-src/skills/editorial-calendar/evals/domain-truth.json +0 -16
- package/dist/agent-src/skills/editorial-calendar/evals/evals.json +0 -16
- package/dist/agent-src/skills/eloquent/evals/triggers.json +0 -17
- package/dist/agent-src/skills/estimate-ticket/evals/evals.json +0 -16
- package/dist/agent-src/skills/estimate-ticket/evals/output-schema.yml +0 -20
- package/dist/agent-src/skills/estimate-ticket/evals/triggers.json +0 -19
- package/dist/agent-src/skills/evaluate-llm-feature/evals/triggers.json +0 -52
- package/dist/agent-src/skills/existing-ui-audit/evals/triggers.json +0 -47
- package/dist/agent-src/skills/experiment-loop/evals/output-schema.yml +0 -27
- package/dist/agent-src/skills/experiment-loop/evals/triggers.json +0 -17
- package/dist/agent-src/skills/fe-design/evals/triggers.json +0 -55
- package/dist/agent-src/skills/forecasting/evals/domain-truth.json +0 -29
- package/dist/agent-src/skills/forecasting/evals/evals.json +0 -20
- package/dist/agent-src/skills/forensics-report/evals/triggers.json +0 -17
- package/dist/agent-src/skills/frontend-render-security/evals/triggers.json +0 -52
- package/dist/agent-src/skills/fundraising-narrative/evals/domain-truth.json +0 -16
- package/dist/agent-src/skills/fundraising-narrative/evals/evals.json +0 -16
- package/dist/agent-src/skills/gated-reach/evals/triggers.json +0 -72
- package/dist/agent-src/skills/github-ci/evals/evals.json +0 -25
- package/dist/agent-src/skills/history-design/evals/triggers.json +0 -17
- package/dist/agent-src/skills/html-deck/evals/triggers.json +0 -17
- package/dist/agent-src/skills/humanizer/evals/strip_fixtures.json +0 -57
- package/dist/agent-src/skills/humanizer/evals/triggers.json +0 -17
- package/dist/agent-src/skills/iconography/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-analyser/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-creator/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-editing/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-generation/evals/triggers.json +0 -17
- package/dist/agent-src/skills/image-provider-routing/evals/triggers.json +0 -17
- package/dist/agent-src/skills/incident-commander/evals/domain-truth.json +0 -16
- package/dist/agent-src/skills/incident-commander/evals/evals.json +0 -20
- package/dist/agent-src/skills/judge-artifact-completeness/evals/triggers.json +0 -17
- package/dist/agent-src/skills/judge-injection-defense/evals/triggers.json +0 -17
- package/dist/agent-src/skills/judge-synthesis/evals/triggers.json +0 -17
- package/dist/agent-src/skills/launch-readiness/evals/evals.json +0 -21
- package/dist/agent-src/skills/learning-tutor/evals/triggers.json +0 -52
- package/dist/agent-src/skills/legal-intake-triage/evals/triggers.json +0 -17
- package/dist/agent-src/skills/legal-practice-profile/evals/triggers.json +0 -17
- package/dist/agent-src/skills/license-compliance-audit/evals/triggers.json +0 -52
- package/dist/agent-src/skills/license-compliance-borrow-check/evals/triggers.json +0 -52
- package/dist/agent-src/skills/license-compliance-credits/evals/triggers.json +0 -52
- package/dist/agent-src/skills/llm-provider-knowledge/evals/triggers.json +0 -20
- package/dist/agent-src/skills/logging-monitoring/evals/evals.json +0 -16
- package/dist/agent-src/skills/logo-generation/evals/triggers.json +0 -17
- package/dist/agent-src/skills/messaging-architecture/evals/domain-truth.json +0 -16
- package/dist/agent-src/skills/messaging-architecture/evals/evals.json +0 -16
- package/dist/agent-src/skills/nda-triage/evals/triggers.json +0 -17
- package/dist/agent-src/skills/pdf-tools/evals/triggers.json +0 -52
- package/dist/agent-src/skills/perf-feedback-craft/evals/evals.json +0 -16
- package/dist/agent-src/skills/persona-improvement/evals/triggers.json +0 -52
- package/dist/agent-src/skills/php-coder/evals/triggers.json +0 -17
- package/dist/agent-src/skills/prediction-pool-optimizer/evals/triggers.json +0 -21
- package/dist/agent-src/skills/prompt-engineering-image/evals/triggers.json +0 -17
- package/dist/agent-src/skills/prompt-engineering-patterns/evals/evals.json +0 -16
- package/dist/agent-src/skills/prompt-validator/evals/triggers.json +0 -17
- package/dist/agent-src/skills/quality-tools/evals/evals.json +0 -15
- package/dist/agent-src/skills/reasoning-orchestrator/evals/triggers.json +0 -17
- package/dist/agent-src/skills/refine-prompt/evals/evals.json +0 -16
- package/dist/agent-src/skills/refine-ticket/evals/evals.json +0 -16
- package/dist/agent-src/skills/refine-ticket/evals/output-schema.yml +0 -16
- package/dist/agent-src/skills/refine-ticket/evals/triggers.json +0 -17
- package/dist/agent-src/skills/release-comms/evals/evals.json +0 -16
- package/dist/agent-src/skills/rice-prioritization/evals/evals.json +0 -20
- package/dist/agent-src/skills/runway-cognition/evals/domain-truth.json +0 -29
- package/dist/agent-src/skills/runway-cognition/evals/evals.json +0 -20
- package/dist/agent-src/skills/scenario-modeling/evals/domain-truth.json +0 -29
- package/dist/agent-src/skills/scenario-modeling/evals/evals.json +0 -20
- package/dist/agent-src/skills/schema-review/evals/triggers.json +0 -17
- package/dist/agent-src/skills/screenshot-hygiene/evals/triggers.json +0 -52
- package/dist/agent-src/skills/security-maturity-assessment/evals/triggers.json +0 -52
- package/dist/agent-src/skills/skill-writing/evals/triggers.json +0 -17
- package/dist/agent-src/skills/spreadsheet-authoring/evals/triggers.json +0 -47
- package/dist/agent-src/skills/subagent-orchestration/evals/evals.json +0 -60
- package/dist/agent-src/skills/supply-chain-intake/evals/triggers.json +0 -52
- package/dist/agent-src/skills/systematic-debugging/evals/evals.json +0 -20
- package/dist/agent-src/skills/test-case-discovery/evals/triggers.json +0 -52
- package/dist/agent-src/skills/test-driven-development/evals/evals.json +0 -16
- package/dist/agent-src/skills/threat-modeling/evals/evals.json +0 -21
- package/dist/agent-src/skills/typography-system/evals/evals.json +0 -14
- package/dist/agent-src/skills/typography-system/evals/triggers.json +0 -17
- package/dist/agent-src/skills/unit-economics-modeling/evals/domain-truth.json +0 -40
- package/dist/agent-src/skills/unit-economics-modeling/evals/evals.json +0 -24
- package/dist/agent-src/skills/verify-completion-evidence/evals/evals.json +0 -16
- package/dist/agent-src/skills/verify-repair-loop/evals/output-schema.yml +0 -20
- package/dist/agent-src/skills/verify-repair-loop/evals/triggers.json +0 -17
- package/dist/agent-src/skills/vision-articulation/evals/evals.json +0 -16
- package/dist/agent-src/skills/voice-and-tone-design/evals/evals.json +0 -16
- package/dist/agent-src/skills/wireframe/evals/triggers.json +0 -17
- package/dist/agent-src/skills/worktree-lifecycle/evals/evals.json +0 -38
- package/dist/agent-src/skills/worktree-lifecycle/evals/triggers.json +0 -52
- package/dist/cli/agent-config.js.map +0 -1
- package/dist/cli/bash/runBash.js.map +0 -1
- package/dist/cli/commands/commands.js.map +0 -1
- package/dist/cli/commands/config.js.map +0 -1
- package/dist/cli/commands/doctorShell.js.map +0 -1
- package/dist/cli/commands/mcpServer.js.map +0 -1
- package/dist/cli/commands/packs.js.map +0 -1
- package/dist/cli/commands/profiles.js.map +0 -1
- package/dist/cli/commands/recordTriggerEval.js.map +0 -1
- package/dist/cli/commands/rtkDetect.js.map +0 -1
- package/dist/cli/commands/settings.js.map +0 -1
- package/dist/cli/commands/uiServe.js.map +0 -1
- package/dist/cli/commands/versions.js.map +0 -1
- package/dist/cli/commands/workspaces.js.map +0 -1
- package/dist/cli/configRoot.js.map +0 -1
- package/dist/cli/discovery/loadManifest.js.map +0 -1
- package/dist/cli/firstRunNotice.js.map +0 -1
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/initRouting.js.map +0 -1
- package/dist/cli/log/logger.js.map +0 -1
- package/dist/cli/main.js.map +0 -1
- package/dist/cli/mcp/content.js.map +0 -1
- package/dist/cli/mcp/dispatch.js.map +0 -1
- package/dist/cli/mcp/stdio.js.map +0 -1
- package/dist/cli/paths.js.map +0 -1
- package/dist/cli/python/knowledge_ingest.js.map +0 -1
- package/dist/cli/python/workspace_analytics.js.map +0 -1
- package/dist/cli/python/workspace_crypto.js.map +0 -1
- package/dist/cli/python/workspace_documents.js.map +0 -1
- package/dist/cli/python/workspace_drive.js.map +0 -1
- package/dist/cli/python/workspace_drive_health.js.map +0 -1
- package/dist/cli/python/workspace_explain.js.map +0 -1
- package/dist/cli/python/workspace_hosts.js.map +0 -1
- package/dist/cli/python/workspace_inbox.js.map +0 -1
- package/dist/cli/python/workspace_render.js.map +0 -1
- package/dist/cli/python/workspace_roles.js.map +0 -1
- package/dist/cli/python/workspace_secrets.js.map +0 -1
- package/dist/cli/python/workspace_sessions.js.map +0 -1
- package/dist/cli/python/workspace_skills.js.map +0 -1
- package/dist/cli/registry.js.map +0 -1
- package/dist/install/agentSwitchDetection.js.map +0 -1
- package/dist/install/agentSwitchProfile.js.map +0 -1
- package/dist/install/atomic.js.map +0 -1
- package/dist/install/claudePathsPlan.js.map +0 -1
- package/dist/install/conflict.js.map +0 -1
- package/dist/install/detect.js.map +0 -1
- package/dist/install/emit_host_rules_cli.js.map +0 -1
- package/dist/install/globalRuleLayers.js.map +0 -1
- package/dist/install/hostLayerFingerprint.js.map +0 -1
- package/dist/install/partitionEligibility.js.map +0 -1
- package/dist/install/paths.js.map +0 -1
- package/dist/install/plan.js.map +0 -1
- package/dist/install/preflight.js.map +0 -1
- package/dist/install/rtkDetection.js.map +0 -1
- package/dist/install/ruleInScope.js.map +0 -1
- package/dist/install/ruleLayerPartition.js.map +0 -1
- package/dist/install/rule_scope.js.map +0 -1
- package/dist/install/rule_scope_cli.js.map +0 -1
- package/dist/install/selectedTools.js.map +0 -1
- package/dist/install/toolDetection.js.map +0 -1
- package/dist/install/txlog.js.map +0 -1
- package/dist/install/types.js.map +0 -1
- package/dist/install/wizard-plan.js.map +0 -1
- package/dist/install/wizardDismissals.js.map +0 -1
- package/dist/scripts/_lib/agent_settings.js.map +0 -1
- package/dist/scripts/_lib/agent_src.js.map +0 -1
- package/dist/scripts/_lib/claude_builtin_names.js.map +0 -1
- package/dist/scripts/_lib/claude_plugin.js.map +0 -1
- package/dist/scripts/_lib/claude_settings_hooks.js.map +0 -1
- package/dist/scripts/_lib/compile_time_toggles.js.map +0 -1
- package/dist/scripts/_lib/environment_detector.js.map +0 -1
- package/dist/scripts/_lib/host_launch.js.map +0 -1
- package/dist/scripts/_lib/install_layout.js.map +0 -1
- package/dist/scripts/_lib/installed_lock.js.map +0 -1
- package/dist/scripts/_lib/model_tier.js.map +0 -1
- package/dist/scripts/_lib/prune_empty_dirs.js.map +0 -1
- package/dist/scripts/_lib/scoped_projection.js.map +0 -1
- package/dist/scripts/_lib/script_output.js.map +0 -1
- package/dist/scripts/_lib/spawn_env.js.map +0 -1
- package/dist/scripts/_lib/surface_tiers.js.map +0 -1
- package/dist/scripts/_lib/token_count.js.map +0 -1
- package/dist/scripts/_lib/trigger_eval_floors.js.map +0 -1
- package/dist/scripts/_lib/user_global_paths.js.map +0 -1
- package/dist/scripts/ai_council/modes.js.map +0 -1
- package/dist/scripts/ai_council/transport_resolver.js.map +0 -1
- package/dist/scripts/condense.js.map +0 -1
- package/dist/scripts/project_thin_rules.js.map +0 -1
- package/dist/server/app.js.map +0 -1
- package/dist/server/io/atomicMultiWrite.js.map +0 -1
- package/dist/server/io/atomicWrite.js.map +0 -1
- package/dist/server/io/sharedWriteCheck.js.map +0 -1
- package/dist/server/io/substituteTemplate.js.map +0 -1
- package/dist/server/io/yamlIO.js.map +0 -1
- package/dist/server/nicknameResolver.js.map +0 -1
- package/dist/server/port.js.map +0 -1
- package/dist/server/routes/discovery.js.map +0 -1
- package/dist/server/routes/install.js.map +0 -1
- package/dist/server/routes/ping.js.map +0 -1
- package/dist/server/routes/schema.js.map +0 -1
- package/dist/server/routes/settings.js.map +0 -1
- package/dist/server/routes/settingsChanges.js.map +0 -1
- package/dist/server/routes/userMd.js.map +0 -1
- package/dist/server/routes/wizard.js.map +0 -1
- package/dist/server/routes/workspace.js.map +0 -1
- package/dist/server/schemas/settings.js.map +0 -1
- package/dist/server/serverInfo.js.map +0 -1
- package/dist/server/token.js.map +0 -1
- package/dist/server/writeRoot.js.map +0 -1
- package/dist/shared/capabilities.js.map +0 -1
- package/dist/shared/interactiveContext.js.map +0 -1
- package/dist/shared/nicknamePrefill.js.map +0 -1
- package/dist/shared/settingsAsks.js.map +0 -1
- package/dist/shared/settingsCarveOut.js.map +0 -1
- package/dist/shared/settingsClasses.js.map +0 -1
- package/dist/shared/settingsConsent.js.map +0 -1
- package/dist/shared/settingsSurface.js.map +0 -1
- package/dist/shared/userMd/formAdapter.js.map +0 -1
- package/dist/shared/userMd/schema.js.map +0 -1
- package/dist/shared/userMd/utils.js.map +0 -1
- package/dist/ui/assets/index-Cxgy63kz.js.map +0 -1
- package/src/scripts/_lib/adr_frontmatter.test.ts +0 -365
- package/src/scripts/_lib/adversarial_council_gate.test.ts +0 -112
- package/src/scripts/_lib/adversarial_reconcile.test.ts +0 -197
- package/src/scripts/_lib/auto_dispatch.corpus.test.ts +0 -150
- package/src/scripts/_lib/secret_detector.test.ts +0 -108
- package/src/scripts/_lib/secret_detector_adversarial.test.ts +0 -116
- package/src/scripts/_lib/untrusted_content.test.ts +0 -175
- package/src/scripts/check_secret_leak.test.ts +0 -90
- package/src/scripts/design_slop_rules.test.ts +0 -239
- package/src/scripts/self_review_gate.test.ts +0 -296
- package/src/shared/capabilities.test.ts +0 -43
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The skill corpus, measured — the two dimensions `check_estate_count` ratchets.
|
|
3
|
+
*
|
|
4
|
+
* WHY TWO. A file count is what a `one_in_one_out` lint can express; it is not
|
|
5
|
+
* what a skill COSTS. Merging four large skills into one file satisfies a count
|
|
6
|
+
* ratchet while the description payload a host must carry stays put or grows.
|
|
7
|
+
* AI council 2/2 (2026-08-24) asked for both dimensions in one gate for exactly
|
|
8
|
+
* that reason, over the roadmap's own recommendation of a count plus an
|
|
9
|
+
* informational companion figure: "that supports treating tokens as a coarse
|
|
10
|
+
* secondary budget — not leaving the only cost-sensitive metric informational
|
|
11
|
+
* forever."
|
|
12
|
+
*
|
|
13
|
+
* WHY NOT THE OTHER TWO CANDIDATES, measured before asking rather than argued:
|
|
14
|
+
*
|
|
15
|
+
* - **Catalogue bytes** via `_lib/skill_catalogue.ts` read **0** on this
|
|
16
|
+
* checkout. `readProjectedCatalogue` walks `.claude/skills`, which is empty in
|
|
17
|
+
* any tree where `task generate-tools` cannot complete — it fails under
|
|
18
|
+
* `projection.mode=scoped` without the config package. A ratchet whose reading
|
|
19
|
+
* depends on whether a generator ran is a ratchet that reds for the
|
|
20
|
+
* environment.
|
|
21
|
+
* - **Host-listing slots** are the host's decision, not the repository's. A
|
|
22
|
+
* measured install published its own budget event stating it had stripped
|
|
23
|
+
* every description and dropped 402 entries.
|
|
24
|
+
*
|
|
25
|
+
* DEPRECATED SKILLS ARE EXCLUDED, and that is load-bearing rather than tidy:
|
|
26
|
+
* with them counted, deprecating a skill would create no headroom and the
|
|
27
|
+
* retirement mechanism would be unusable against its own gate. (Currently 0
|
|
28
|
+
* skills carry it, so the exclusion is a no-op today and a correctness property
|
|
29
|
+
* tomorrow.)
|
|
30
|
+
*/
|
|
31
|
+
import * as fs from 'node:fs';
|
|
32
|
+
import * as path from 'node:path';
|
|
33
|
+
|
|
34
|
+
import { gpt_tokens } from './token_count.js';
|
|
35
|
+
|
|
36
|
+
/** Where the corpus lives, POSIX — the same string a base-tree subtree takes. */
|
|
37
|
+
export const SKILLS_POSIX = 'src/skills';
|
|
38
|
+
|
|
39
|
+
export interface SkillEstate {
|
|
40
|
+
/** Maintained `SKILL.md` files — `lifecycle: deprecated` excluded. */
|
|
41
|
+
skill_count: number;
|
|
42
|
+
/**
|
|
43
|
+
* Exact-BPE tokens across the maintained skills' `description:` fields.
|
|
44
|
+
*
|
|
45
|
+
* `null` when the tokeniser could not resolve. A ratchet must never compare
|
|
46
|
+
* an exact reading against a proxy one — the numbers differ by more than the
|
|
47
|
+
* growth a gate is trying to catch, so the metric is reported UNRESOLVED
|
|
48
|
+
* rather than measured with whatever was available.
|
|
49
|
+
*/
|
|
50
|
+
skill_description_tokens: number | null;
|
|
51
|
+
/** Excluded from both figures, reported so the exclusion is visible. */
|
|
52
|
+
deprecated_count: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** `description:` from a `SKILL.md` frontmatter block, unquoted. */
|
|
56
|
+
export function descriptionOf(text: string): string {
|
|
57
|
+
const fm = /^---\n([\s\S]*?)\n---/.exec(text);
|
|
58
|
+
if (fm === null) return '';
|
|
59
|
+
const m = /^description:\s*(.+)$/m.exec(fm[1]!);
|
|
60
|
+
if (m === null) return '';
|
|
61
|
+
return m[1]!.trim().replace(/^["']|["']$/g, '');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** `lifecycle: deprecated` in the frontmatter — the retirement transition state. */
|
|
65
|
+
export function isDeprecated(text: string): boolean {
|
|
66
|
+
const fm = /^---\n([\s\S]*?)\n---/.exec(text);
|
|
67
|
+
if (fm === null) return false;
|
|
68
|
+
return /^lifecycle:\s*["']?deprecated["']?\s*$/m.test(fm[1]!);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Measure the corpus under `root`.
|
|
73
|
+
*
|
|
74
|
+
* `root` is a repository root OR a materialised base-ref tree holding
|
|
75
|
+
* `src/skills/...`, so the floor side runs this exact function over the base
|
|
76
|
+
* ref's own tree — the property `check_estate_count` already has for the roadmap
|
|
77
|
+
* estate, and the reason the "before" side cannot be rewritten by the change
|
|
78
|
+
* under review.
|
|
79
|
+
*/
|
|
80
|
+
export function measureSkillEstate(root: string): SkillEstate {
|
|
81
|
+
const base = path.join(root, ...SKILLS_POSIX.split('/'));
|
|
82
|
+
let entries: fs.Dirent[];
|
|
83
|
+
try {
|
|
84
|
+
entries = fs.readdirSync(base, { withFileTypes: true });
|
|
85
|
+
} catch {
|
|
86
|
+
return { skill_count: 0, skill_description_tokens: null, deprecated_count: 0 };
|
|
87
|
+
}
|
|
88
|
+
let count = 0;
|
|
89
|
+
let deprecated = 0;
|
|
90
|
+
let tokens = 0;
|
|
91
|
+
let exact = true;
|
|
92
|
+
for (const e of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
93
|
+
if (!e.isDirectory()) continue;
|
|
94
|
+
const p = path.join(base, e.name, 'SKILL.md');
|
|
95
|
+
let text: string;
|
|
96
|
+
try {
|
|
97
|
+
text = fs.readFileSync(p, 'utf-8');
|
|
98
|
+
} catch {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (isDeprecated(text)) {
|
|
102
|
+
deprecated += 1;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
count += 1;
|
|
106
|
+
const r = gpt_tokens(descriptionOf(text));
|
|
107
|
+
if (!r.exact) exact = false;
|
|
108
|
+
tokens += r.tokens;
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
skill_count: count,
|
|
112
|
+
skill_description_tokens: exact ? tokens : null,
|
|
113
|
+
deprecated_count: deprecated,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-read measurement over Claude Code transcript legs.
|
|
3
|
+
*
|
|
4
|
+
* `road-to-role-scoped-spawn-profiles` Phase 3 Step 3 requires a re-read
|
|
5
|
+
* measurement BEFORE any suppression: *"A suppression built without this
|
|
6
|
+
* measurement is suppressing whatever the author happened to notice."* This
|
|
7
|
+
* module is that measurement, and it is deliberately a sibling of
|
|
8
|
+
* `cc_transcript.ts` rather than a widening of it — `scanTranscripts` keeps
|
|
9
|
+
* only `type: "assistant"` records carrying a `usage` block, which is exactly
|
|
10
|
+
* the population a `tool_result` is NOT in.
|
|
11
|
+
*
|
|
12
|
+
* **What a "leg" is, stated because every count below depends on it.** One
|
|
13
|
+
* `.jsonl` file is one leg. Claude Code writes the main session to
|
|
14
|
+
* `<project>/<sessionId>.jsonl` and each subagent to
|
|
15
|
+
* `<project>/<sessionId>/subagents/agent-*.jsonl`, so a leg is a single
|
|
16
|
+
* conversation whose context window is its own. A file read once in the main
|
|
17
|
+
* leg and once inside a subagent is NOT a re-read — the second leg never had
|
|
18
|
+
* the first one's context — and {@link computeRereads} counts per leg for that
|
|
19
|
+
* reason.
|
|
20
|
+
*
|
|
21
|
+
* **The wasted-token figure is a `chars / 4` PROXY, not a measurement.** The
|
|
22
|
+
* transcript records no per-tool-result token count, so the size of a
|
|
23
|
+
* duplicate read is estimated from the JSON-encoded length of its
|
|
24
|
+
* `tool_result` body. Every caller must label it as a proxy; this module names
|
|
25
|
+
* the field `wasted_tokens_proxy` so the label cannot be dropped by accident.
|
|
26
|
+
*
|
|
27
|
+
* Read-only: no writes, no network, no spawn.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import * as fs from 'node:fs';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Tools whose result is a file body the model already holds after the first
|
|
34
|
+
* call. Deliberately narrow: `Edit` and `Write` also carry a `file_path`, but
|
|
35
|
+
* re-reading after a mutation is correct behaviour, not waste, so counting
|
|
36
|
+
* them would manufacture "re-reads" out of the loop this measurement exists to
|
|
37
|
+
* distinguish from.
|
|
38
|
+
*/
|
|
39
|
+
export const READ_SHAPED_TOOLS: ReadonlySet<string> = new Set(['Read', 'NotebookRead']);
|
|
40
|
+
|
|
41
|
+
/** One observed read-shaped tool call inside one leg. */
|
|
42
|
+
export interface ReadEvent {
|
|
43
|
+
filePath: string;
|
|
44
|
+
/** JSON-encoded length of the matching `tool_result` body; 0 when no result was recorded. */
|
|
45
|
+
resultChars: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Per-path rollup across every leg that read it more than once. */
|
|
49
|
+
export interface RereadFile {
|
|
50
|
+
file_path: string;
|
|
51
|
+
/** Total read-shaped calls on this path, across all legs. */
|
|
52
|
+
total_reads: number;
|
|
53
|
+
/** Reads beyond the first WITHIN a leg, summed over legs. */
|
|
54
|
+
duplicate_reads: number;
|
|
55
|
+
/** Number of legs in which this path was read at least twice. */
|
|
56
|
+
legs_with_reread: number;
|
|
57
|
+
/** `chars / 4` proxy over the duplicate reads only — never a measurement. */
|
|
58
|
+
wasted_tokens_proxy: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface RereadResult {
|
|
62
|
+
legs_scanned: number;
|
|
63
|
+
total_reads: number;
|
|
64
|
+
duplicate_reads: number;
|
|
65
|
+
wasted_tokens_proxy: number;
|
|
66
|
+
/** Only paths with at least one duplicate, ranked by `wasted_tokens_proxy` desc. */
|
|
67
|
+
files: RereadFile[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function parseLine(line: string): Record<string, unknown> | null {
|
|
71
|
+
const t = line.trim();
|
|
72
|
+
if (t.length === 0) return null;
|
|
73
|
+
try {
|
|
74
|
+
const v = JSON.parse(t) as unknown;
|
|
75
|
+
return v && typeof v === 'object' && !Array.isArray(v) ? (v as Record<string, unknown>) : null;
|
|
76
|
+
} catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function contentBlocks(rec: Record<string, unknown>): Array<Record<string, unknown>> {
|
|
82
|
+
const msg = rec.message;
|
|
83
|
+
if (!msg || typeof msg !== 'object' || Array.isArray(msg)) return [];
|
|
84
|
+
const content = (msg as Record<string, unknown>).content;
|
|
85
|
+
if (!Array.isArray(content)) return [];
|
|
86
|
+
return content.filter((c): c is Record<string, unknown> => !!c && typeof c === 'object' && !Array.isArray(c));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function readPathOf(input: unknown): string | null {
|
|
90
|
+
if (!input || typeof input !== 'object' || Array.isArray(input)) return null;
|
|
91
|
+
const o = input as Record<string, unknown>;
|
|
92
|
+
for (const key of ['file_path', 'filePath', 'notebook_path', 'notebookPath']) {
|
|
93
|
+
const v = o[key];
|
|
94
|
+
if (typeof v === 'string' && v.length > 0) return v;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Every read-shaped call in one leg, in call order, each paired with the size
|
|
101
|
+
* of its result.
|
|
102
|
+
*
|
|
103
|
+
* Two passes on purpose: a `tool_result` can only be matched by
|
|
104
|
+
* `tool_use_id`, and nothing guarantees it appears after its `tool_use` in
|
|
105
|
+
* file order once a transcript has been resumed or replayed. An unreadable or
|
|
106
|
+
* malformed file yields `[]` — this is instrumentation, and a measurement that
|
|
107
|
+
* throws on one bad leg reports nothing about the other two thousand.
|
|
108
|
+
*/
|
|
109
|
+
export function collectReadEvents(file: string): ReadEvent[] {
|
|
110
|
+
let text: string;
|
|
111
|
+
try {
|
|
112
|
+
text = fs.readFileSync(file, 'utf-8');
|
|
113
|
+
} catch {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const order: Array<{ id: string | null; filePath: string }> = [];
|
|
118
|
+
const sizes = new Map<string, number>();
|
|
119
|
+
|
|
120
|
+
for (const line of text.split('\n')) {
|
|
121
|
+
const rec = parseLine(line);
|
|
122
|
+
if (!rec) continue;
|
|
123
|
+
for (const block of contentBlocks(rec)) {
|
|
124
|
+
if (block.type === 'tool_use') {
|
|
125
|
+
if (typeof block.name !== 'string' || !READ_SHAPED_TOOLS.has(block.name)) continue;
|
|
126
|
+
const filePath = readPathOf(block.input);
|
|
127
|
+
if (filePath === null) continue;
|
|
128
|
+
order.push({ id: typeof block.id === 'string' ? block.id : null, filePath });
|
|
129
|
+
} else if (block.type === 'tool_result') {
|
|
130
|
+
const id = block.tool_use_id ?? block.toolUseId;
|
|
131
|
+
if (typeof id !== 'string') continue;
|
|
132
|
+
let chars = 0;
|
|
133
|
+
try {
|
|
134
|
+
chars = JSON.stringify(block.content ?? '').length;
|
|
135
|
+
} catch {
|
|
136
|
+
chars = 0;
|
|
137
|
+
}
|
|
138
|
+
sizes.set(id, chars);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return order.map((o) => ({
|
|
144
|
+
filePath: o.filePath,
|
|
145
|
+
resultChars: o.id === null ? 0 : (sizes.get(o.id) ?? 0),
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const CHARS_PER_TOKEN_PROXY = 4;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Roll every leg up into a per-path re-read ranking.
|
|
153
|
+
*
|
|
154
|
+
* The duplicate count is per leg: the first read of a path in a leg is the
|
|
155
|
+
* cost of knowing it, every later read in the SAME leg is the waste. Legs are
|
|
156
|
+
* never joined, so a path read once in each of two legs contributes zero
|
|
157
|
+
* duplicates — see the module doc.
|
|
158
|
+
*/
|
|
159
|
+
export function computeRereads(files: readonly string[]): RereadResult {
|
|
160
|
+
const acc = new Map<string, RereadFile>();
|
|
161
|
+
let legsScanned = 0;
|
|
162
|
+
let totalReads = 0;
|
|
163
|
+
|
|
164
|
+
for (const file of files) {
|
|
165
|
+
const events = collectReadEvents(file);
|
|
166
|
+
legsScanned += 1;
|
|
167
|
+
if (events.length === 0) continue;
|
|
168
|
+
|
|
169
|
+
const seenInLeg = new Map<string, number>();
|
|
170
|
+
for (const ev of events) {
|
|
171
|
+
totalReads += 1;
|
|
172
|
+
const priorInLeg = seenInLeg.get(ev.filePath) ?? 0;
|
|
173
|
+
seenInLeg.set(ev.filePath, priorInLeg + 1);
|
|
174
|
+
|
|
175
|
+
const row = acc.get(ev.filePath) ?? {
|
|
176
|
+
file_path: ev.filePath,
|
|
177
|
+
total_reads: 0,
|
|
178
|
+
duplicate_reads: 0,
|
|
179
|
+
legs_with_reread: 0,
|
|
180
|
+
wasted_tokens_proxy: 0,
|
|
181
|
+
};
|
|
182
|
+
row.total_reads += 1;
|
|
183
|
+
if (priorInLeg >= 1) {
|
|
184
|
+
row.duplicate_reads += 1;
|
|
185
|
+
row.wasted_tokens_proxy += Math.round(ev.resultChars / CHARS_PER_TOKEN_PROXY);
|
|
186
|
+
if (priorInLeg === 1) row.legs_with_reread += 1;
|
|
187
|
+
}
|
|
188
|
+
acc.set(ev.filePath, row);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const withDuplicates = [...acc.values()].filter((r) => r.duplicate_reads > 0);
|
|
193
|
+
withDuplicates.sort(
|
|
194
|
+
(a, b) =>
|
|
195
|
+
b.wasted_tokens_proxy - a.wasted_tokens_proxy ||
|
|
196
|
+
b.duplicate_reads - a.duplicate_reads ||
|
|
197
|
+
a.file_path.localeCompare(b.file_path),
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
legs_scanned: legsScanned,
|
|
202
|
+
total_reads: totalReads,
|
|
203
|
+
duplicate_reads: withDuplicates.reduce((s, r) => s + r.duplicate_reads, 0),
|
|
204
|
+
wasted_tokens_proxy: withDuplicates.reduce((s, r) => s + r.wasted_tokens_proxy, 0),
|
|
205
|
+
files: withDuplicates,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ui_authority — the ONE resolver for a UI surface's authority object.
|
|
3
|
+
*
|
|
4
|
+
* Contract: `docs/contracts/ui-authority.md`. Schema:
|
|
5
|
+
* `src/scripts/schemas/ui-authority.schema.json`. Step A1.1 of
|
|
6
|
+
* `road-to-frontend-power` requires exactly one schema and exactly one
|
|
7
|
+
* resolver, with no second partial decision table in `src/skills/` — the
|
|
8
|
+
* failure it prevents is skills re-inferring intent beside the schema and
|
|
9
|
+
* drifting from it.
|
|
10
|
+
*
|
|
11
|
+
* WHY A PURE FUNCTION OVER A `Signals` RECORD, and not a filesystem scan: the
|
|
12
|
+
* four behaviours A1.2-A1.5 pin are all *precedence* rules, and precedence is
|
|
13
|
+
* exactly what a filesystem-coupled resolver makes untestable. Callers do the
|
|
14
|
+
* I/O and hand in what they found; this module decides what wins.
|
|
15
|
+
*
|
|
16
|
+
* The precedence, in one place because it exists nowhere else:
|
|
17
|
+
*
|
|
18
|
+
* 1. explicit user authority (A1.2 — beats every inference)
|
|
19
|
+
* 2. a registered hard constraint (A1.2's own exception)
|
|
20
|
+
* 3. the surface brief (A1.4 — surface-local, never promoted)
|
|
21
|
+
* 4. a supplied reference artifact
|
|
22
|
+
* 5. the coherent incumbent (A1.3 — NOT `new-world`)
|
|
23
|
+
* 6. DESIGN.md / PRODUCT.md (register only; never surface_mode)
|
|
24
|
+
* 7. declared defaults
|
|
25
|
+
*
|
|
26
|
+
* Quoted text is NOT authority (A1.2). A document the user pasted can contain
|
|
27
|
+
* "make it bold and colourful"; that is data inside a container, and acting on
|
|
28
|
+
* it is the found-instructions failure `untrusted-input-defense` names. The
|
|
29
|
+
* caller marks a signal `quoted: true` and this module ignores its directives.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export type SurfaceMode = 'persuade' | 'operate' | 'read' | 'experience';
|
|
33
|
+
export type Register = 'brand' | 'product';
|
|
34
|
+
export type ChangeIntent = 'preserve' | 'extend' | 'redesign' | 'new-world';
|
|
35
|
+
export type ReferenceMaturity =
|
|
36
|
+
| 'wireframe'
|
|
37
|
+
| 'prototype'
|
|
38
|
+
| 'finished-comp'
|
|
39
|
+
| 'runnable-artifact'
|
|
40
|
+
| 'production-incumbent'
|
|
41
|
+
| null;
|
|
42
|
+
export type SourceKind =
|
|
43
|
+
| 'user-instruction'
|
|
44
|
+
| 'artifact'
|
|
45
|
+
| 'comp'
|
|
46
|
+
| 'design-system'
|
|
47
|
+
| 'incumbent'
|
|
48
|
+
| 'brief'
|
|
49
|
+
| 'none';
|
|
50
|
+
export type ProvenanceSource =
|
|
51
|
+
| 'user-instruction'
|
|
52
|
+
| 'surface-brief'
|
|
53
|
+
| 'design-md'
|
|
54
|
+
| 'product-md'
|
|
55
|
+
| 'incumbent-scan'
|
|
56
|
+
| 'reference-artifact'
|
|
57
|
+
| 'default';
|
|
58
|
+
export type Verification = 'verified' | 'degraded' | 'unverified';
|
|
59
|
+
|
|
60
|
+
export interface Conflict {
|
|
61
|
+
dimension: string;
|
|
62
|
+
wanted: string;
|
|
63
|
+
blocked_by: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ProvenanceEntry {
|
|
66
|
+
field: string;
|
|
67
|
+
source: ProvenanceSource;
|
|
68
|
+
detail: string | null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface UiAuthority {
|
|
72
|
+
surface_mode: SurfaceMode;
|
|
73
|
+
register: Register;
|
|
74
|
+
change_intent: ChangeIntent;
|
|
75
|
+
reference_maturity: ReferenceMaturity;
|
|
76
|
+
fidelity_mandate: string | null;
|
|
77
|
+
primary_source: { kind: SourceKind; path: string | null };
|
|
78
|
+
constraints: {
|
|
79
|
+
preserve_palette?: boolean;
|
|
80
|
+
preserve_type_family?: boolean;
|
|
81
|
+
preserve_layout?: boolean;
|
|
82
|
+
preserve_copy?: boolean;
|
|
83
|
+
};
|
|
84
|
+
conflicts: Conflict[];
|
|
85
|
+
provenance: ProvenanceEntry[];
|
|
86
|
+
verification: Verification;
|
|
87
|
+
degradation_reason?: string | null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** What a caller found. Every field optional — absence is a real input. */
|
|
91
|
+
export interface Signals {
|
|
92
|
+
/** Explicit, unquoted user authority. Beats every inference (A1.2). */
|
|
93
|
+
user?: {
|
|
94
|
+
surface_mode?: SurfaceMode;
|
|
95
|
+
register?: Register;
|
|
96
|
+
change_intent?: ChangeIntent;
|
|
97
|
+
/** True when the text came from INSIDE a supplied document (A1.2). */
|
|
98
|
+
quoted?: boolean;
|
|
99
|
+
};
|
|
100
|
+
/** A surface-local brief. Never mutates DESIGN.md / PRODUCT.md (A1.4). */
|
|
101
|
+
brief?: { surface_mode?: SurfaceMode; register?: Register; path?: string };
|
|
102
|
+
/** A supplied reference and how finished it is. */
|
|
103
|
+
reference?: { maturity: Exclude<ReferenceMaturity, null>; path?: string };
|
|
104
|
+
/** Result of an incumbent scan — typically from `ui:audit`. */
|
|
105
|
+
incumbent?: { coherent: boolean; palette?: string[]; type_families?: string[] };
|
|
106
|
+
/** Presence and register of the repo-level documents. */
|
|
107
|
+
design_md?: { present: boolean; register?: Register };
|
|
108
|
+
product_md?: { present: boolean; register?: Register };
|
|
109
|
+
/** Carried from the fidelity roadmap's Phase 0, never derived here. */
|
|
110
|
+
fidelity_mandate?: string | null;
|
|
111
|
+
/** A registered hard constraint outranks even explicit user authority. */
|
|
112
|
+
hard_constraints?: Array<keyof UiAuthority['constraints']>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Declared defaults, in one place so "where did this come from" has an answer. */
|
|
116
|
+
export const DEFAULTS = {
|
|
117
|
+
surface_mode: 'operate' as SurfaceMode,
|
|
118
|
+
register: 'product' as Register,
|
|
119
|
+
change_intent: 'extend' as ChangeIntent,
|
|
120
|
+
} as const;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* A1.5's threshold, pre-registered in `internal/bench/frontend-power-PREREG.md`
|
|
124
|
+
* § A1.5's delta threshold and NOT chosen here. Palette and type family only —
|
|
125
|
+
* spacing, radius, weight, size and layout are deliberately excluded so
|
|
126
|
+
* `polish` and `refine` can move them under `preserve`, which is the whole
|
|
127
|
+
* point of those verbs.
|
|
128
|
+
*/
|
|
129
|
+
export const PRESERVE_DELTA_DIMENSIONS = ['palette', 'type_family'] as const;
|
|
130
|
+
/** Colour keywords that are never a palette delta. */
|
|
131
|
+
const PALETTE_NEUTRALS = new Set(['transparent', 'currentcolor', 'inherit', 'unset', 'initial']);
|
|
132
|
+
|
|
133
|
+
export function resolveUiAuthority(signals: Signals = {}): UiAuthority {
|
|
134
|
+
const provenance: ProvenanceEntry[] = [];
|
|
135
|
+
const conflicts: Conflict[] = [];
|
|
136
|
+
const note = (field: string, source: ProvenanceSource, detail: string | null = null): void => {
|
|
137
|
+
provenance.push({ field, source, detail });
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// A1.2 — quoted text inside a supplied document is data, not authorisation.
|
|
141
|
+
const user = signals.user?.quoted ? undefined : signals.user;
|
|
142
|
+
|
|
143
|
+
// surface_mode: user → brief → default. DESIGN.md/PRODUCT.md never supply
|
|
144
|
+
// it (A2.1: the surface job is per-surface, persisted in the brief).
|
|
145
|
+
let surface_mode: SurfaceMode;
|
|
146
|
+
if (user?.surface_mode) {
|
|
147
|
+
surface_mode = user.surface_mode;
|
|
148
|
+
note('surface_mode', 'user-instruction');
|
|
149
|
+
} else if (signals.brief?.surface_mode) {
|
|
150
|
+
surface_mode = signals.brief.surface_mode;
|
|
151
|
+
note('surface_mode', 'surface-brief', signals.brief.path ?? null);
|
|
152
|
+
} else {
|
|
153
|
+
surface_mode = DEFAULTS.surface_mode;
|
|
154
|
+
note('surface_mode', 'default', 'no user or brief signal');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// register: user → brief → DESIGN.md → PRODUCT.md → default. The brief
|
|
158
|
+
// outranks PRODUCT.md, which is the `surface-mode-not-product-mode` case:
|
|
159
|
+
// a brand surface inside a product repo must not inherit `product`.
|
|
160
|
+
let register: Register;
|
|
161
|
+
if (user?.register) {
|
|
162
|
+
register = user.register;
|
|
163
|
+
note('register', 'user-instruction');
|
|
164
|
+
} else if (signals.brief?.register) {
|
|
165
|
+
register = signals.brief.register;
|
|
166
|
+
note('register', 'surface-brief', signals.brief.path ?? null);
|
|
167
|
+
} else if (signals.design_md?.present && signals.design_md.register) {
|
|
168
|
+
register = signals.design_md.register;
|
|
169
|
+
note('register', 'design-md');
|
|
170
|
+
} else if (signals.product_md?.present && signals.product_md.register) {
|
|
171
|
+
register = signals.product_md.register;
|
|
172
|
+
note('register', 'product-md');
|
|
173
|
+
} else {
|
|
174
|
+
register = DEFAULTS.register;
|
|
175
|
+
note('register', 'default', 'no register signal');
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// change_intent: user → (incumbent coherence) → default.
|
|
179
|
+
//
|
|
180
|
+
// A1.3 is the load-bearing branch: a MISSING DESIGN.md is not `new-world`.
|
|
181
|
+
// A coherent incumbent resolves to `extend` with incumbent authority, and
|
|
182
|
+
// only a genuinely empty surface — no incumbent, no reference — is
|
|
183
|
+
// `new-world`.
|
|
184
|
+
let change_intent: ChangeIntent;
|
|
185
|
+
if (user?.change_intent) {
|
|
186
|
+
change_intent = user.change_intent;
|
|
187
|
+
note('change_intent', 'user-instruction');
|
|
188
|
+
} else if (signals.incumbent?.coherent) {
|
|
189
|
+
change_intent = 'extend';
|
|
190
|
+
note('change_intent', 'incumbent-scan', 'coherent incumbent — not new-world (A1.3)');
|
|
191
|
+
} else if (!signals.incumbent && !signals.reference && !signals.design_md?.present) {
|
|
192
|
+
change_intent = 'new-world';
|
|
193
|
+
note('change_intent', 'default', 'no incumbent, no reference, no DESIGN.md');
|
|
194
|
+
} else {
|
|
195
|
+
change_intent = DEFAULTS.change_intent;
|
|
196
|
+
note('change_intent', 'default', 'incumbent present but incoherent');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const reference_maturity: ReferenceMaturity = signals.reference?.maturity ?? null;
|
|
200
|
+
note(
|
|
201
|
+
'reference_maturity',
|
|
202
|
+
signals.reference ? 'reference-artifact' : 'default',
|
|
203
|
+
signals.reference?.path ?? 'no reference supplied',
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
// primary_source — which authority the run builds FROM.
|
|
207
|
+
let kind: SourceKind = 'none';
|
|
208
|
+
let sourcePath: string | null = null;
|
|
209
|
+
if (signals.reference) {
|
|
210
|
+
kind =
|
|
211
|
+
signals.reference.maturity === 'runnable-artifact'
|
|
212
|
+
? 'artifact'
|
|
213
|
+
: signals.reference.maturity === 'finished-comp'
|
|
214
|
+
? 'comp'
|
|
215
|
+
: signals.reference.maturity === 'production-incumbent'
|
|
216
|
+
? 'incumbent'
|
|
217
|
+
: 'brief';
|
|
218
|
+
sourcePath = signals.reference.path ?? null;
|
|
219
|
+
} else if (signals.incumbent?.coherent) {
|
|
220
|
+
kind = 'incumbent';
|
|
221
|
+
} else if (signals.design_md?.present) {
|
|
222
|
+
kind = 'design-system';
|
|
223
|
+
} else if (signals.brief) {
|
|
224
|
+
kind = 'brief';
|
|
225
|
+
sourcePath = signals.brief.path ?? null;
|
|
226
|
+
} else if (user) {
|
|
227
|
+
kind = 'user-instruction';
|
|
228
|
+
}
|
|
229
|
+
note('primary_source', signals.reference ? 'reference-artifact' : 'incumbent-scan', kind);
|
|
230
|
+
|
|
231
|
+
// constraints — `preserve` implies the visual world is locked. A hard
|
|
232
|
+
// constraint is additive and, per A1.2, outranks explicit user authority.
|
|
233
|
+
const constraints: UiAuthority['constraints'] = {};
|
|
234
|
+
if (change_intent === 'preserve') {
|
|
235
|
+
constraints.preserve_palette = true;
|
|
236
|
+
constraints.preserve_type_family = true;
|
|
237
|
+
}
|
|
238
|
+
for (const c of signals.hard_constraints ?? []) {
|
|
239
|
+
if (constraints[c] === false) {
|
|
240
|
+
conflicts.push({
|
|
241
|
+
dimension: c,
|
|
242
|
+
wanted: 'released by user instruction',
|
|
243
|
+
blocked_by: 'registered hard constraint',
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
constraints[c] = true;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
surface_mode,
|
|
251
|
+
register,
|
|
252
|
+
change_intent,
|
|
253
|
+
reference_maturity,
|
|
254
|
+
fidelity_mandate: signals.fidelity_mandate ?? null,
|
|
255
|
+
primary_source: { kind, path: sourcePath },
|
|
256
|
+
constraints,
|
|
257
|
+
conflicts,
|
|
258
|
+
provenance,
|
|
259
|
+
verification: 'verified',
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** Mark an object degraded. Refuses a reason-free degrade by construction. */
|
|
264
|
+
export function degrade(a: UiAuthority, reason: string, state: Exclude<Verification, 'verified'> = 'degraded'): UiAuthority {
|
|
265
|
+
if (!reason.trim()) throw new Error('degrade() requires a non-empty degradation_reason');
|
|
266
|
+
return { ...a, verification: state, degradation_reason: reason };
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface WorldSnapshot {
|
|
270
|
+
palette: readonly string[];
|
|
271
|
+
type_families: readonly string[];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const norm = (s: string): string => s.trim().toLowerCase();
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* A1.5 — the intent-aware gate. Returns the dimensions that changed and are
|
|
278
|
+
* NOT authorised by `change_intent`. Empty array = the write may proceed.
|
|
279
|
+
*
|
|
280
|
+
* Under `preserve` a palette or type-family delta blocks; under `redesign` and
|
|
281
|
+
* `new-world` nothing here blocks. `extend` sits in between and is treated as
|
|
282
|
+
* permissive on this axis deliberately: extending a surface routinely adds a
|
|
283
|
+
* semantic colour, and blocking that would make the verb unusable.
|
|
284
|
+
*/
|
|
285
|
+
export function preserveViolations(
|
|
286
|
+
authority: UiAuthority,
|
|
287
|
+
incumbent: WorldSnapshot,
|
|
288
|
+
proposed: WorldSnapshot,
|
|
289
|
+
): string[] {
|
|
290
|
+
if (authority.change_intent !== 'preserve') return [];
|
|
291
|
+
const out: string[] = [];
|
|
292
|
+
|
|
293
|
+
if (authority.constraints.preserve_palette) {
|
|
294
|
+
const known = new Set(incumbent.palette.map(norm));
|
|
295
|
+
const added = proposed.palette.map(norm).filter((c) => !known.has(c) && !PALETTE_NEUTRALS.has(c));
|
|
296
|
+
if (added.length) out.push(`palette: ${[...new Set(added)].sort().join(', ')}`);
|
|
297
|
+
}
|
|
298
|
+
if (authority.constraints.preserve_type_family) {
|
|
299
|
+
const known = new Set(incumbent.type_families.map(norm));
|
|
300
|
+
const added = proposed.type_families.map(norm).filter((f) => !known.has(f));
|
|
301
|
+
if (added.length) out.push(`type_family: ${[...new Set(added)].sort().join(', ')}`);
|
|
302
|
+
}
|
|
303
|
+
return out;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* A4.1 — the six intervention operations as values of ONE field rather than as
|
|
308
|
+
* six commands. Each declares the dimensions it may touch, so a collision with
|
|
309
|
+
* a constraint is decidable instead of a judgement call.
|
|
310
|
+
*/
|
|
311
|
+
export const OPERATIONS = {
|
|
312
|
+
polish: ['spacing', 'rhythm', 'alignment'],
|
|
313
|
+
quieter: ['spacing', 'weight', 'contrast_within_palette'],
|
|
314
|
+
bolder: ['palette', 'type_family', 'weight', 'scale'],
|
|
315
|
+
distill: ['content_density', 'spacing'],
|
|
316
|
+
harden: ['a11y', 'focus', 'contrast_within_palette'],
|
|
317
|
+
clarify: ['hierarchy', 'copy', 'labels'],
|
|
318
|
+
} as const;
|
|
319
|
+
export type Operation = keyof typeof OPERATIONS;
|
|
320
|
+
|
|
321
|
+
/** Maps an operation dimension onto the constraint that would forbid it. */
|
|
322
|
+
const DIMENSION_CONSTRAINT: Readonly<Record<string, keyof UiAuthority['constraints']>> = {
|
|
323
|
+
palette: 'preserve_palette',
|
|
324
|
+
type_family: 'preserve_type_family',
|
|
325
|
+
hierarchy: 'preserve_layout',
|
|
326
|
+
copy: 'preserve_copy',
|
|
327
|
+
labels: 'preserve_copy',
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* A4.1 — does `op` collide with the authority's constraints? A collision is
|
|
332
|
+
* returned as conflicts to APPEND; the caller performs no write. `bolder`
|
|
333
|
+
* under `preserve` is the pinned case.
|
|
334
|
+
*/
|
|
335
|
+
export function operationConflicts(authority: UiAuthority, op: Operation): Conflict[] {
|
|
336
|
+
const out: Conflict[] = [];
|
|
337
|
+
for (const dim of OPERATIONS[op] as readonly string[]) {
|
|
338
|
+
const c = DIMENSION_CONSTRAINT[dim];
|
|
339
|
+
if (!c || authority.constraints[c] !== true) continue;
|
|
340
|
+
out.push({ dimension: dim, wanted: `${op} may move ${dim}`, blocked_by: c });
|
|
341
|
+
}
|
|
342
|
+
return out;
|
|
343
|
+
}
|
|
@@ -288,9 +288,14 @@ aiv_fal_capability() {
|
|
|
288
288
|
jq -e --arg m "${model}" '.models[$m]' "${FAL_MANIFEST}" >/dev/null 2>&1 \
|
|
289
289
|
|| aiv_die 7 "${ADAPTER_ID}: model not in manifest: ${model}"
|
|
290
290
|
_fal_warn_unverified "${model}"
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
# Emission goes through the shared helper so the decay markers
|
|
292
|
+
# (`verified_at` / `recheck_by`, derived from the trace index) appear here
|
|
293
|
+
# too. fal is the adapter that actually CARRIES smoke_trace ids, so a
|
|
294
|
+
# capability path that skipped them would leave the only traced adapter as
|
|
295
|
+
# the one place the dates are invisible. Model validation, the
|
|
296
|
+
# manifest-missing check and the unverified warning stay above — this
|
|
297
|
+
# replaces the JSON emission only.
|
|
298
|
+
aiv_capability_recheck "${ADAPTER_ID}" "${model}" "${FAL_MANIFEST}"
|
|
294
299
|
return 0
|
|
295
300
|
fi
|
|
296
301
|
if [ -f "${FAL_MANIFEST}" ] && command -v jq >/dev/null 2>&1; then
|