@event4u/agent-config 14.9.0 → 14.11.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 +384 -0
- 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/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/alerting-doctrine/evals/triggers.json +17 -0
- package/dist/agent-src/skills/async-python-patterns/SKILL.md +1 -1
- 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 +1 -1
- package/dist/agent-src/skills/code-review/SKILL.md +11 -0
- package/dist/agent-src/skills/command-routing/SKILL.md +6 -0
- package/dist/agent-src/skills/condense-memory/SKILL.md +4 -1
- package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
- package/dist/agent-src/skills/conventional-commits-writing/SKILL.md +4 -1
- 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 +80 -2
- 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/discovery-interview/SKILL.md +1 -1
- package/dist/agent-src/skills/doc-coauthoring/SKILL.md +1 -1
- package/dist/agent-src/skills/docx-authoring/SKILL.md +1 -1
- package/dist/agent-src/skills/editorial-calendar/SKILL.md +1 -1
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +3 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +20 -3
- package/dist/agent-src/skills/fe-design/SKILL.md +74 -41
- package/dist/agent-src/skills/fe-design/evals/triggers.json +65 -53
- 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/github-ci/SKILL.md +1 -1
- 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/evals/triggers.json +17 -0
- package/dist/agent-src/skills/js-library-packaging/scripts/check_package_surface.ts +270 -0
- package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +1 -1
- package/dist/agent-src/skills/judge-injection-defense/SKILL.md +1 -1
- package/dist/agent-src/skills/laravel-migration/SKILL.md +3 -0
- package/dist/agent-src/skills/laravel-validation/SKILL.md +1 -1
- package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +3 -0
- package/dist/agent-src/skills/legal-intake-triage/SKILL.md +1 -1
- package/dist/agent-src/skills/legal-practice-profile/SKILL.md +1 -1
- 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/messaging-architecture/SKILL.md +1 -1
- package/dist/agent-src/skills/migration-architect/SKILL.md +1 -1
- package/dist/agent-src/skills/module-detect-on-the-fly/SKILL.md +1 -1
- package/dist/agent-src/skills/module-management/SKILL.md +1 -1
- package/dist/agent-src/skills/monorepo-workspace/SKILL.md +149 -0
- package/dist/agent-src/skills/monorepo-workspace/evals/triggers.json +17 -0
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +7 -1
- package/dist/agent-src/skills/multi-tenancy/SKILL.md +4 -0
- package/dist/agent-src/skills/onboarding-program/SKILL.md +1 -1
- package/dist/agent-src/skills/operational-readiness/SKILL.md +184 -0
- package/dist/agent-src/skills/operational-readiness/evals/triggers.json +17 -0
- package/dist/agent-src/skills/override-management/SKILL.md +3 -0
- package/dist/agent-src/skills/perf-feedback-craft/SKILL.md +1 -1
- 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/prompt-engineering-image/SKILL.md +3 -0
- package/dist/agent-src/skills/prompt-optimizer/SKILL.md +1 -1
- package/dist/agent-src/skills/quality-tools/SKILL.md +5 -0
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +52 -21
- 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 +3 -3
- 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/SKILL.md +1 -1
- package/dist/agent-src/skills/scene-expander/scene-blueprint.schema.yaml +26 -0
- package/dist/agent-src/skills/secrets-management/SKILL.md +5 -1
- package/dist/agent-src/skills/server-hardening/SKILL.md +159 -0
- package/dist/agent-src/skills/server-hardening/evals/triggers.json +17 -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/spreadsheet-authoring/SKILL.md +3 -0
- package/dist/agent-src/skills/storybook-workshop/SKILL.md +194 -0
- package/dist/agent-src/skills/storybook-workshop/evals/triggers.json +17 -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 +9 -1
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +3 -0
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +1 -1
- 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/skills/workspace-link/evals/triggers.json +17 -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/uiAudit.js.map +1 -0
- package/dist/cli/commands/uiRender.js +206 -0
- package/dist/cli/commands/uiRender.js.map +1 -0
- package/dist/cli/main.js +22 -1
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/mcp/content.js +64 -1
- package/dist/cli/mcp/content.js.map +1 -1
- package/dist/cli/mcp/dispatch.js +175 -10
- package/dist/cli/mcp/dispatch.js.map +1 -1
- package/dist/cli/registry.js +3 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/{chunk-H4VIVD4C.js → chunk-236PNQZK.js} +413 -391
- 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-PLSG6UL5.js → chunk-K4FFODTS.js} +341 -204
- package/dist/cli-delegate/{chunk-YM4GZDJG.js → chunk-L43NCYPB.js} +5 -0
- 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 +380 -145
- 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 +2337 -1436
- package/dist/install/install.mjs +795 -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/lean_projection_mode.js.map +1 -0
- package/dist/scripts/_lib/scoped_projection.js +84 -0
- package/dist/scripts/_lib/scoped_projection.js.map +1 -1
- package/dist/scripts/_lib/ui_surface.js +89 -0
- package/dist/scripts/_lib/ui_surface.js.map +1 -0
- package/dist/scripts/condense.js +6 -10
- package/dist/scripts/condense.js.map +1 -1
- package/dist/scripts/project_thin_rules.js +40 -2
- package/dist/scripts/project_thin_rules.js.map +1 -1
- package/dist/server/schemas/settings.js +3 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/shared/skillRanking.js +159 -0
- package/dist/shared/skillRanking.js.map +1 -0
- package/docs/contracts/provider-lifecycle.md +47 -18
- package/docs/contracts/settings-classes.md +14 -4
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +49 -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/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/llms.txt +50 -39
- package/package.json +1 -1
- 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 +28 -0
- package/src/config/assurance-capability-registry.json +223 -0
- package/src/config/assurance-threshold-budget.json +65 -0
- package/src/config/ci-local-parity.yml +14 -0
- package/src/config/discovery/unassigned-artefacts.yml +2 -0
- package/src/config/dispatch-economy-metrics.json +4 -2
- package/src/config/evaluator-budgets.json +14 -14
- package/src/config/gate-coverage.yml +227 -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 +4 -2
- package/src/config/preamble-payload-budget.json +71 -67
- package/src/config/quorum-attendance-budget.json +12 -4
- 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/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/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/transcript_reads.ts +207 -0
- package/src/scripts/_lib/ui_authority.test.ts +251 -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/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/seating.ts +211 -0
- 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_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_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_pack_passport_reconciliation.ts +274 -0
- 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_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/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/design_slop_rules.test.ts +7 -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/generate_pack_manifests.ts +78 -0
- package/src/scripts/grade_target_readiness.ts +478 -0
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +97 -16
- package/src/scripts/hooks/concern_registry.ts +4 -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/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 +2 -1
- 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_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/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/roadmap_context.ts +778 -0
- package/src/scripts/schemas/fidelity-measurement-sheet.schema.json +169 -0
- package/src/scripts/schemas/pack.schema.json +62 -4
- package/src/scripts/schemas/rule.schema.json +24 -2
- package/src/scripts/schemas/skill.schema.json +41 -2
- package/src/scripts/schemas/ui-authority.schema.json +114 -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/tighten_skill_descriptions.ts +264 -0
- 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 +5 -0
- package/src/shared/skillRanking.ts +183 -0
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
projectStoreSlug,
|
|
27
27
|
scanTranscripts,
|
|
28
28
|
weightedInputUnits
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-FF7WAFMR.js";
|
|
30
30
|
import {
|
|
31
31
|
git_common_dir
|
|
32
32
|
} from "./chunk-E4XIZDIB.js";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
LEGACY_ALL,
|
|
47
47
|
excludedRuleBasenames,
|
|
48
48
|
ruleScopeFromSettings
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-DMSZHXZS.js";
|
|
50
50
|
import {
|
|
51
51
|
require_dist
|
|
52
52
|
} from "./chunk-OY53J6II.js";
|
|
@@ -73,17 +73,150 @@ import {
|
|
|
73
73
|
// src/scripts/_cli/cmd_doctor.ts
|
|
74
74
|
var YAML2 = __toESM(require_dist(), 1);
|
|
75
75
|
import * as crypto2 from "node:crypto";
|
|
76
|
-
import * as
|
|
76
|
+
import * as fs11 from "node:fs";
|
|
77
77
|
import * as os3 from "node:os";
|
|
78
|
-
import * as
|
|
78
|
+
import * as path15 from "node:path";
|
|
79
79
|
import process2 from "node:process";
|
|
80
80
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL4 } from "node:url";
|
|
81
81
|
|
|
82
|
-
// src/scripts/
|
|
82
|
+
// src/scripts/_cli/doctor_overrides.ts
|
|
83
83
|
import * as fs from "node:fs";
|
|
84
84
|
import * as path from "node:path";
|
|
85
|
+
|
|
86
|
+
// src/scripts/_lib/kernel_rules.ts
|
|
87
|
+
var KERNEL_RULE_IDS = [
|
|
88
|
+
"agent-authority",
|
|
89
|
+
"ask-when-uncertain",
|
|
90
|
+
"commit-policy",
|
|
91
|
+
"direct-answers",
|
|
92
|
+
"language-and-tone",
|
|
93
|
+
"no-cheap-questions",
|
|
94
|
+
"non-destructive-by-default",
|
|
95
|
+
"scope-control",
|
|
96
|
+
"verify-before-complete"
|
|
97
|
+
];
|
|
98
|
+
var KERNEL_RULE_FILENAMES = new Set(
|
|
99
|
+
KERNEL_RULE_IDS.map((id) => `${id}.md`)
|
|
100
|
+
);
|
|
101
|
+
var KERNEL_RULE_ID_SET = new Set(KERNEL_RULE_IDS);
|
|
102
|
+
|
|
103
|
+
// src/scripts/_cli/doctor_overrides.ts
|
|
104
|
+
function isDir(p) {
|
|
105
|
+
try {
|
|
106
|
+
return fs.statSync(p).isDirectory();
|
|
107
|
+
} catch {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function isFile(p) {
|
|
112
|
+
try {
|
|
113
|
+
return fs.statSync(p).isFile();
|
|
114
|
+
} catch {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function _check_overrides(project_root) {
|
|
119
|
+
const dir = path.join(project_root, "agents", "overrides", "rules");
|
|
120
|
+
if (!isDir(dir)) {
|
|
121
|
+
return {
|
|
122
|
+
id: "overrides",
|
|
123
|
+
status: "skip",
|
|
124
|
+
message: "no agents/overrides/rules/ \u2014 no overrides declared",
|
|
125
|
+
remedy: ""
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
let names;
|
|
129
|
+
try {
|
|
130
|
+
names = fs.readdirSync(dir).filter((n) => n.endsWith(".md")).sort();
|
|
131
|
+
} catch {
|
|
132
|
+
return {
|
|
133
|
+
id: "overrides",
|
|
134
|
+
status: "warn",
|
|
135
|
+
message: "agents/overrides/rules/ is present but unreadable",
|
|
136
|
+
remedy: "check permissions on agents/overrides/rules/"
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (names.length === 0) {
|
|
140
|
+
return {
|
|
141
|
+
id: "overrides",
|
|
142
|
+
status: "ok",
|
|
143
|
+
message: "agents/overrides/rules/ present, 0 overrides declared",
|
|
144
|
+
remedy: ""
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const registryPath = path.join(project_root, "agents", "overrides", "kernel-exceptions.yml");
|
|
148
|
+
const registered = /* @__PURE__ */ new Set();
|
|
149
|
+
if (isFile(registryPath)) {
|
|
150
|
+
let inExceptions = false;
|
|
151
|
+
for (const raw of fs.readFileSync(registryPath, "utf-8").split("\n")) {
|
|
152
|
+
const line = raw.replace(/\s+$/, "");
|
|
153
|
+
if (/^exceptions:\s*$/.test(line)) {
|
|
154
|
+
inExceptions = true;
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (!inExceptions) continue;
|
|
158
|
+
if (/^\S/.test(line)) break;
|
|
159
|
+
const m = /^\s*-?\s*rule:\s*"?([a-z0-9-]+)"?\s*$/i.exec(line);
|
|
160
|
+
if (m?.[1] !== void 0) registered.add(m[1]);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
let kernel = 0;
|
|
164
|
+
let uncited = 0;
|
|
165
|
+
let unregisteredKernel = 0;
|
|
166
|
+
for (const n of names) {
|
|
167
|
+
const rule = n.replace(/\.md$/, "");
|
|
168
|
+
const isKernel = KERNEL_RULE_ID_SET.has(rule);
|
|
169
|
+
if (isKernel) kernel += 1;
|
|
170
|
+
const text = fs.readFileSync(path.join(dir, n), "utf-8");
|
|
171
|
+
if (!/^>\s*Overrides:/m.test(text)) uncited += 1;
|
|
172
|
+
if (isKernel && !registered.has(rule)) {
|
|
173
|
+
unregisteredKernel += 1;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const parts = [
|
|
177
|
+
`${String(names.length)} override(s) present`,
|
|
178
|
+
`${String(kernel)} kernel`
|
|
179
|
+
];
|
|
180
|
+
if (kernel > 0) {
|
|
181
|
+
parts.push(`${String(kernel - unregisteredKernel)}/${String(kernel)} kernel registered`);
|
|
182
|
+
}
|
|
183
|
+
parts.push(`${String(names.length - uncited)}/${String(names.length)} cited`);
|
|
184
|
+
parts.push("delivery only \u2014 efficacy unmeasured");
|
|
185
|
+
return {
|
|
186
|
+
id: "overrides",
|
|
187
|
+
status: uncited > 0 || unregisteredKernel > 0 ? "warn" : "ok",
|
|
188
|
+
message: parts.join(", "),
|
|
189
|
+
remedy: uncited > 0 || unregisteredKernel > 0 ? "run `./scripts-run src/scripts/lint_override_kernel_guard --strict` for the detail" : ""
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/scripts/_cli/doctor_install_mode.ts
|
|
194
|
+
import * as fs2 from "node:fs";
|
|
195
|
+
import * as path2 from "node:path";
|
|
196
|
+
function isFile2(p) {
|
|
197
|
+
try {
|
|
198
|
+
return fs2.statSync(p).isFile();
|
|
199
|
+
} catch {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function isDir2(p) {
|
|
204
|
+
try {
|
|
205
|
+
return fs2.statSync(p).isDirectory();
|
|
206
|
+
} catch {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
var INSTALL_MODE_MARKER_RELATIVE = "agents/.agent-state/install-mode.txt";
|
|
211
|
+
function _is_global_only_consumer(project_root) {
|
|
212
|
+
return isFile2(path2.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir2(path2.join(project_root, "agents", "overrides"));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// src/scripts/_lib/duplicate_scope_census.ts
|
|
216
|
+
import * as fs3 from "node:fs";
|
|
217
|
+
import * as path3 from "node:path";
|
|
85
218
|
function censusDuplicateScope(userRulesDir, projectRulesDir) {
|
|
86
|
-
if (!
|
|
219
|
+
if (!fs3.existsSync(userRulesDir) || !fs3.existsSync(projectRulesDir)) {
|
|
87
220
|
return {
|
|
88
221
|
evaluable: false,
|
|
89
222
|
reason: `one or both rule directories are missing (user: ${userRulesDir}, project: ${projectRulesDir})`,
|
|
@@ -91,15 +224,15 @@ function censusDuplicateScope(userRulesDir, projectRulesDir) {
|
|
|
91
224
|
duplicate_chars: 0
|
|
92
225
|
};
|
|
93
226
|
}
|
|
94
|
-
const userFiles = new Set(
|
|
95
|
-
const projectFiles =
|
|
227
|
+
const userFiles = new Set(fs3.readdirSync(userRulesDir).filter((f) => f.endsWith(".md")));
|
|
228
|
+
const projectFiles = fs3.readdirSync(projectRulesDir).filter((f) => f.endsWith(".md"));
|
|
96
229
|
const shared = [];
|
|
97
230
|
let duplicateChars = 0;
|
|
98
231
|
for (const f of projectFiles) {
|
|
99
232
|
if (!userFiles.has(f)) continue;
|
|
100
233
|
shared.push(f);
|
|
101
|
-
const a =
|
|
102
|
-
const b =
|
|
234
|
+
const a = fs3.statSync(path3.join(userRulesDir, f)).size;
|
|
235
|
+
const b = fs3.statSync(path3.join(projectRulesDir, f)).size;
|
|
103
236
|
duplicateChars += Math.min(a, b);
|
|
104
237
|
}
|
|
105
238
|
shared.sort();
|
|
@@ -133,31 +266,31 @@ __export(preamble_byte_census_exports, {
|
|
|
133
266
|
topRulesByCost: () => topRulesByCost
|
|
134
267
|
});
|
|
135
268
|
var YAML = __toESM(require_dist(), 1);
|
|
136
|
-
import * as
|
|
269
|
+
import * as fs7 from "node:fs";
|
|
137
270
|
import { homedir as homedir2 } from "node:os";
|
|
138
|
-
import * as
|
|
271
|
+
import * as path10 from "node:path";
|
|
139
272
|
import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
140
273
|
|
|
141
274
|
// src/scripts/_lib/agent_user_profile.ts
|
|
142
|
-
import * as
|
|
275
|
+
import * as path6 from "node:path";
|
|
143
276
|
|
|
144
277
|
// src/scripts/_lib/user_global_revocations.ts
|
|
145
|
-
import * as
|
|
146
|
-
var REVOCATIONS_RELATIVE =
|
|
278
|
+
import * as path4 from "node:path";
|
|
279
|
+
var REVOCATIONS_RELATIVE = path4.join("user", ".revocations.jsonl");
|
|
147
280
|
|
|
148
281
|
// src/scripts/_lib/user_memory_gate_counters.ts
|
|
149
|
-
import * as
|
|
150
|
-
var GATE_COUNTERS_RELATIVE =
|
|
282
|
+
import * as path5 from "node:path";
|
|
283
|
+
var GATE_COUNTERS_RELATIVE = path5.join("user", "promotion-gate-counters.json");
|
|
151
284
|
|
|
152
285
|
// src/scripts/_lib/agent_user_profile.ts
|
|
153
|
-
var GLOBAL_PROFILE_RELATIVE =
|
|
286
|
+
var GLOBAL_PROFILE_RELATIVE = path6.join("user", "profile.md");
|
|
154
287
|
function resolveGlobalProfilePath(env) {
|
|
155
288
|
return resolve_with_fallback(GLOBAL_PROFILE_RELATIVE, { env: env ?? null });
|
|
156
289
|
}
|
|
157
290
|
|
|
158
291
|
// src/scripts/_lib/carrier_divergence.ts
|
|
159
|
-
import * as
|
|
160
|
-
import * as
|
|
292
|
+
import * as fs4 from "node:fs";
|
|
293
|
+
import * as path7 from "node:path";
|
|
161
294
|
var OWNERSHIP_KEYS = ["package", "source_path"];
|
|
162
295
|
function stripOwnershipKeys(text) {
|
|
163
296
|
return text.split("\n").filter((line) => !OWNERSHIP_KEYS.some((k) => line.startsWith(`${k}:`))).join("\n");
|
|
@@ -207,14 +340,14 @@ function censusRuleDir(dir) {
|
|
|
207
340
|
let chars = 0;
|
|
208
341
|
let entries;
|
|
209
342
|
try {
|
|
210
|
-
entries =
|
|
343
|
+
entries = fs4.readdirSync(dir);
|
|
211
344
|
} catch {
|
|
212
345
|
return { files: 0, chars: 0 };
|
|
213
346
|
}
|
|
214
347
|
for (const name of entries) {
|
|
215
348
|
if (!name.endsWith(".md")) continue;
|
|
216
349
|
try {
|
|
217
|
-
chars +=
|
|
350
|
+
chars += fs4.statSync(path7.join(dir, name)).size;
|
|
218
351
|
files += 1;
|
|
219
352
|
} catch {
|
|
220
353
|
}
|
|
@@ -224,14 +357,14 @@ function censusRuleDir(dir) {
|
|
|
224
357
|
|
|
225
358
|
// src/scripts/cache_realization_report.ts
|
|
226
359
|
import { execFileSync } from "node:child_process";
|
|
227
|
-
import * as
|
|
360
|
+
import * as fs6 from "node:fs";
|
|
228
361
|
import { homedir } from "node:os";
|
|
229
|
-
import * as
|
|
362
|
+
import * as path9 from "node:path";
|
|
230
363
|
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
|
|
231
364
|
|
|
232
365
|
// src/scripts/ai_council/pricing.ts
|
|
233
|
-
import * as
|
|
234
|
-
import * as
|
|
366
|
+
import * as fs5 from "node:fs";
|
|
367
|
+
import * as path8 from "node:path";
|
|
235
368
|
import { fileURLToPath } from "node:url";
|
|
236
369
|
|
|
237
370
|
// src/scripts/ai_council/_default_prices.ts
|
|
@@ -276,8 +409,8 @@ function as_rows() {
|
|
|
276
409
|
|
|
277
410
|
// src/scripts/ai_council/pricing.ts
|
|
278
411
|
var _HERE = fileURLToPath(import.meta.url);
|
|
279
|
-
var REPO_ROOT =
|
|
280
|
-
var PRICES_FILE =
|
|
412
|
+
var REPO_ROOT = path8.resolve(path8.dirname(_HERE), "..", "..", "..");
|
|
413
|
+
var PRICES_FILE = path8.join(REPO_ROOT, "agents", "runtime", ".agent-prices.md");
|
|
281
414
|
function lookup(table, provider, model) {
|
|
282
415
|
const exact = table.prices.get(priceKey(provider, model));
|
|
283
416
|
if (exact !== void 0) {
|
|
@@ -336,16 +469,16 @@ function reprice_with_cache(provider, model, tokens, table, ttl = "5m") {
|
|
|
336
469
|
};
|
|
337
470
|
}
|
|
338
471
|
function load_prices(p = PRICES_FILE) {
|
|
339
|
-
if (!
|
|
472
|
+
if (!fs5.existsSync(p)) {
|
|
340
473
|
bootstrap_from_defaults(p);
|
|
341
474
|
}
|
|
342
|
-
return _parse(
|
|
475
|
+
return _parse(fs5.readFileSync(p, "utf-8"));
|
|
343
476
|
}
|
|
344
477
|
function bootstrap_from_defaults(p = PRICES_FILE) {
|
|
345
|
-
|
|
478
|
+
fs5.mkdirSync(path8.dirname(p), { recursive: true });
|
|
346
479
|
const rows = as_rows();
|
|
347
480
|
const body = _render_markdown(LAST_UPDATED, "shipped-default", rows);
|
|
348
|
-
|
|
481
|
+
fs5.writeFileSync(p, body, "utf-8");
|
|
349
482
|
}
|
|
350
483
|
function _fmt62f(x) {
|
|
351
484
|
const s = x.toFixed(2);
|
|
@@ -465,7 +598,7 @@ function _pyFloat(s) {
|
|
|
465
598
|
|
|
466
599
|
// src/scripts/cache_realization_report.ts
|
|
467
600
|
var _HERE2 = fileURLToPath2(import.meta.url);
|
|
468
|
-
var REPO_ROOT2 =
|
|
601
|
+
var REPO_ROOT2 = path9.resolve(path9.dirname(_HERE2), "..", "..");
|
|
469
602
|
var C1_COLD_START_DOMINANCE_THRESHOLD = 0.5;
|
|
470
603
|
var C2_DUPLICATE_SCOPE_THRESHOLD = 0.25;
|
|
471
604
|
var C4_COUNCIL_MISPRICING_THRESHOLD = 0.05;
|
|
@@ -570,20 +703,20 @@ function computeDuplicateScope(userRulesDir, projectRulesDir, subagentWriteVolum
|
|
|
570
703
|
};
|
|
571
704
|
}
|
|
572
705
|
function findDebateRoundFiles(councilRoot) {
|
|
573
|
-
const base =
|
|
574
|
-
if (!
|
|
706
|
+
const base = path9.join(councilRoot, "agents", "runtime", "council", "responses");
|
|
707
|
+
if (!fs6.existsSync(base)) return [];
|
|
575
708
|
const out = [];
|
|
576
709
|
const stack = [base];
|
|
577
710
|
while (stack.length > 0) {
|
|
578
711
|
const dir = stack.pop();
|
|
579
712
|
let entries;
|
|
580
713
|
try {
|
|
581
|
-
entries =
|
|
714
|
+
entries = fs6.readdirSync(dir, { withFileTypes: true });
|
|
582
715
|
} catch {
|
|
583
716
|
continue;
|
|
584
717
|
}
|
|
585
718
|
for (const entry of entries) {
|
|
586
|
-
const full =
|
|
719
|
+
const full = path9.join(dir, entry.name);
|
|
587
720
|
if (entry.isDirectory()) {
|
|
588
721
|
stack.push(full);
|
|
589
722
|
continue;
|
|
@@ -606,7 +739,7 @@ function computeCouncilMispricing(councilRoot) {
|
|
|
606
739
|
}
|
|
607
740
|
const groups = /* @__PURE__ */ new Map();
|
|
608
741
|
for (const f of files) {
|
|
609
|
-
const dir =
|
|
742
|
+
const dir = path9.dirname(f);
|
|
610
743
|
const arr = groups.get(dir) ?? [];
|
|
611
744
|
arr.push(f);
|
|
612
745
|
groups.set(dir, arr);
|
|
@@ -627,7 +760,7 @@ function computeCouncilMispricing(councilRoot) {
|
|
|
627
760
|
for (const f of groupFiles) {
|
|
628
761
|
let data;
|
|
629
762
|
try {
|
|
630
|
-
data = JSON.parse(
|
|
763
|
+
data = JSON.parse(fs6.readFileSync(f, "utf-8"));
|
|
631
764
|
} catch {
|
|
632
765
|
continue;
|
|
633
766
|
}
|
|
@@ -667,7 +800,7 @@ function computeCouncilMispricing(councilRoot) {
|
|
|
667
800
|
const status = Math.abs(deltaPct) >= C4_COUNCIL_MISPRICING_THRESHOLD ? "confirmed" : "falsified";
|
|
668
801
|
return {
|
|
669
802
|
status,
|
|
670
|
-
session:
|
|
803
|
+
session: path9.relative(councilRoot, best.dir) || "(top-level)",
|
|
671
804
|
rounds: best.rounds,
|
|
672
805
|
recorded_cost_usd: best.recorded,
|
|
673
806
|
cache_aware_cost_usd: best.cacheAware,
|
|
@@ -695,8 +828,8 @@ function computeWorktreeFragmentation(projectsRoot, worktreePaths, maxAgeDays) {
|
|
|
695
828
|
}
|
|
696
829
|
const established = worktreePaths[0];
|
|
697
830
|
const encodedEstablished = encodeProjectPath(established);
|
|
698
|
-
const worktreeDirs = worktreePaths.slice(1).map(encodeProjectPath).filter((d) =>
|
|
699
|
-
if (!
|
|
831
|
+
const worktreeDirs = worktreePaths.slice(1).map(encodeProjectPath).filter((d) => fs6.existsSync(path9.join(projectsRoot, d)));
|
|
832
|
+
if (!fs6.existsSync(path9.join(projectsRoot, encodedEstablished)) || worktreeDirs.length === 0) {
|
|
700
833
|
return {
|
|
701
834
|
status: "pending",
|
|
702
835
|
reason: "no transcript directory found for both an established and a fresh-worktree checkout of this repo"
|
|
@@ -812,8 +945,8 @@ function defaultOptions() {
|
|
|
812
945
|
maxAgeDays: 14,
|
|
813
946
|
repoRoot: REPO_ROOT2,
|
|
814
947
|
councilRoot: REPO_ROOT2,
|
|
815
|
-
userRulesDir:
|
|
816
|
-
projectRulesDir:
|
|
948
|
+
userRulesDir: path9.join(homedir(), ".claude", "rules"),
|
|
949
|
+
projectRulesDir: path9.join(REPO_ROOT2, "dist", "agent-src", "rules")
|
|
817
950
|
};
|
|
818
951
|
}
|
|
819
952
|
function parseArgs(argv) {
|
|
@@ -940,13 +1073,13 @@ function main(argv = process.argv.slice(2)) {
|
|
|
940
1073
|
return 0;
|
|
941
1074
|
}
|
|
942
1075
|
if (process.argv[1] !== void 0) {
|
|
943
|
-
const invokedUrl = pathToFileURL(
|
|
1076
|
+
const invokedUrl = pathToFileURL(path9.resolve(process.argv[1])).href;
|
|
944
1077
|
if (import.meta.url === invokedUrl) process.exit(main());
|
|
945
1078
|
}
|
|
946
1079
|
|
|
947
1080
|
// src/scripts/preamble_byte_census.ts
|
|
948
1081
|
var _HERE3 = fileURLToPath3(import.meta.url);
|
|
949
|
-
var REPO_ROOT3 =
|
|
1082
|
+
var REPO_ROOT3 = path10.resolve(path10.dirname(_HERE3), "..", "..");
|
|
950
1083
|
var CHARS_PER_TOKEN = 4;
|
|
951
1084
|
var SUM_TOLERANCE_PCT = 0.1;
|
|
952
1085
|
function tokensFromChars(chars) {
|
|
@@ -954,19 +1087,19 @@ function tokensFromChars(chars) {
|
|
|
954
1087
|
}
|
|
955
1088
|
function readCharsIfExists(p) {
|
|
956
1089
|
try {
|
|
957
|
-
return
|
|
1090
|
+
return fs7.statSync(p).size;
|
|
958
1091
|
} catch {
|
|
959
1092
|
return 0;
|
|
960
1093
|
}
|
|
961
1094
|
}
|
|
962
1095
|
function topRulesByCost(dir, limit = 10) {
|
|
963
|
-
if (!
|
|
1096
|
+
if (!fs7.existsSync(dir)) return [];
|
|
964
1097
|
const entries = [];
|
|
965
|
-
for (const name of
|
|
1098
|
+
for (const name of fs7.readdirSync(dir)) {
|
|
966
1099
|
if (!name.endsWith(".md")) continue;
|
|
967
1100
|
let chars;
|
|
968
1101
|
try {
|
|
969
|
-
chars =
|
|
1102
|
+
chars = fs7.statSync(path10.join(dir, name)).size;
|
|
970
1103
|
} catch {
|
|
971
1104
|
continue;
|
|
972
1105
|
}
|
|
@@ -979,33 +1112,33 @@ var IMPORT_LINE_RE = /^@(\S+)\s*$/;
|
|
|
979
1112
|
function parseClaudeMdImports(claudeMdPath) {
|
|
980
1113
|
let text;
|
|
981
1114
|
try {
|
|
982
|
-
text =
|
|
1115
|
+
text = fs7.readFileSync(claudeMdPath, "utf-8");
|
|
983
1116
|
} catch {
|
|
984
1117
|
return [];
|
|
985
1118
|
}
|
|
986
|
-
const base =
|
|
1119
|
+
const base = path10.dirname(claudeMdPath);
|
|
987
1120
|
const out = [];
|
|
988
1121
|
for (const line of text.split("\n")) {
|
|
989
1122
|
const m = IMPORT_LINE_RE.exec(line.trim());
|
|
990
1123
|
if (!m) continue;
|
|
991
1124
|
const rel = m[1];
|
|
992
|
-
const resolved =
|
|
1125
|
+
const resolved = path10.isAbsolute(rel) ? rel : path10.join(base, rel);
|
|
993
1126
|
const chars = readCharsIfExists(resolved);
|
|
994
1127
|
if (chars > 0) out.push({ file: rel, chars });
|
|
995
1128
|
}
|
|
996
1129
|
return out;
|
|
997
1130
|
}
|
|
998
1131
|
function censusClaudeMdHierarchy(repoRoot, userHome) {
|
|
999
|
-
const projectClaudeMd =
|
|
1000
|
-
const projectClaudeLocalMd =
|
|
1001
|
-
const userClaudeMd =
|
|
1132
|
+
const projectClaudeMd = path10.join(repoRoot, "CLAUDE.md");
|
|
1133
|
+
const projectClaudeLocalMd = path10.join(repoRoot, "CLAUDE.local.md");
|
|
1134
|
+
const userClaudeMd = path10.join(userHome, ".claude", "CLAUDE.md");
|
|
1002
1135
|
return {
|
|
1003
1136
|
project_claude_md_chars: readCharsIfExists(projectClaudeMd),
|
|
1004
|
-
project_claude_md_present:
|
|
1137
|
+
project_claude_md_present: fs7.existsSync(projectClaudeMd),
|
|
1005
1138
|
project_claude_local_md_chars: readCharsIfExists(projectClaudeLocalMd),
|
|
1006
|
-
project_claude_local_md_present:
|
|
1139
|
+
project_claude_local_md_present: fs7.existsSync(projectClaudeLocalMd),
|
|
1007
1140
|
user_claude_md_chars: readCharsIfExists(userClaudeMd),
|
|
1008
|
-
user_claude_md_present:
|
|
1141
|
+
user_claude_md_present: fs7.existsSync(userClaudeMd),
|
|
1009
1142
|
user_imports: parseClaudeMdImports(userClaudeMd)
|
|
1010
1143
|
};
|
|
1011
1144
|
}
|
|
@@ -1027,15 +1160,15 @@ function parseFrontmatter(text) {
|
|
|
1027
1160
|
}
|
|
1028
1161
|
}
|
|
1029
1162
|
function censusSkillsCatalog(skillsDir) {
|
|
1030
|
-
if (!
|
|
1163
|
+
if (!fs7.existsSync(skillsDir)) return { skills: 0, chars: 0 };
|
|
1031
1164
|
let skills = 0;
|
|
1032
1165
|
let chars = 0;
|
|
1033
|
-
for (const entry of
|
|
1166
|
+
for (const entry of fs7.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
1034
1167
|
if (!entry.isDirectory()) continue;
|
|
1035
|
-
const skillMd =
|
|
1168
|
+
const skillMd = path10.join(skillsDir, entry.name, "SKILL.md");
|
|
1036
1169
|
let text;
|
|
1037
1170
|
try {
|
|
1038
|
-
text =
|
|
1171
|
+
text = fs7.readFileSync(skillMd, "utf-8");
|
|
1039
1172
|
} catch {
|
|
1040
1173
|
continue;
|
|
1041
1174
|
}
|
|
@@ -1054,9 +1187,9 @@ function defaultOptions2() {
|
|
|
1054
1187
|
format: "text",
|
|
1055
1188
|
repoRoot: REPO_ROOT3,
|
|
1056
1189
|
userHome,
|
|
1057
|
-
userRulesDir:
|
|
1058
|
-
projectRulesDir:
|
|
1059
|
-
skillsDir:
|
|
1190
|
+
userRulesDir: path10.join(userHome, ".claude", "rules"),
|
|
1191
|
+
projectRulesDir: path10.join(REPO_ROOT3, "dist", "agent-src", "rules"),
|
|
1192
|
+
skillsDir: path10.join(REPO_ROOT3, "dist", "agent-src", "skills"),
|
|
1060
1193
|
root: DEFAULT_PROJECTS_ROOT,
|
|
1061
1194
|
maxAgeDays: 14
|
|
1062
1195
|
};
|
|
@@ -1272,7 +1405,7 @@ function main2(argv = process.argv.slice(2)) {
|
|
|
1272
1405
|
}
|
|
1273
1406
|
var _isBundled = true;
|
|
1274
1407
|
if (!_isBundled && process.argv[1] !== void 0) {
|
|
1275
|
-
const invokedUrl = pathToFileURL2(
|
|
1408
|
+
const invokedUrl = pathToFileURL2(path10.resolve(process.argv[1])).href;
|
|
1276
1409
|
if (import.meta.url === invokedUrl) process.exit(main2());
|
|
1277
1410
|
}
|
|
1278
1411
|
|
|
@@ -1288,13 +1421,13 @@ __export(dispatch_economy_report_exports, {
|
|
|
1288
1421
|
readAuditOrchestrations: () => readAuditOrchestrations,
|
|
1289
1422
|
renderText: () => renderText3
|
|
1290
1423
|
});
|
|
1291
|
-
import * as
|
|
1292
|
-
import * as
|
|
1424
|
+
import * as fs8 from "node:fs";
|
|
1425
|
+
import * as path11 from "node:path";
|
|
1293
1426
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL3 } from "node:url";
|
|
1294
1427
|
var _HERE4 = fileURLToPath4(import.meta.url);
|
|
1295
|
-
var REPO_ROOT4 =
|
|
1296
|
-
var REGISTRATION_FILE =
|
|
1297
|
-
var DEFAULT_AUDIT_DIR =
|
|
1428
|
+
var REPO_ROOT4 = path11.resolve(path11.dirname(_HERE4), "..", "..");
|
|
1429
|
+
var REGISTRATION_FILE = path11.join(REPO_ROOT4, "src", "config", "dispatch-economy-metrics.json");
|
|
1430
|
+
var DEFAULT_AUDIT_DIR = path11.join("agents", "runtime", "state", "audit");
|
|
1298
1431
|
var REVIEWER_TYPE_RE = /review|judge|validator/i;
|
|
1299
1432
|
function median2(values) {
|
|
1300
1433
|
if (values.length === 0) return null;
|
|
@@ -1340,19 +1473,19 @@ function isFiniteNonNegInt(v) {
|
|
|
1340
1473
|
return typeof v === "number" && Number.isInteger(v) && v >= 0;
|
|
1341
1474
|
}
|
|
1342
1475
|
function readAuditOrchestrations(auditDir, opts = {}) {
|
|
1343
|
-
if (!
|
|
1476
|
+
if (!fs8.existsSync(auditDir)) return [];
|
|
1344
1477
|
const out = [];
|
|
1345
1478
|
const cutoffMs = opts.maxAgeDays !== void 0 ? (opts.now ?? /* @__PURE__ */ new Date()).getTime() - opts.maxAgeDays * 24 * 60 * 60 * 1e3 : null;
|
|
1346
1479
|
let entries;
|
|
1347
1480
|
try {
|
|
1348
|
-
entries =
|
|
1481
|
+
entries = fs8.readdirSync(auditDir).filter((f) => f.endsWith(".jsonl")).sort();
|
|
1349
1482
|
} catch {
|
|
1350
1483
|
return [];
|
|
1351
1484
|
}
|
|
1352
1485
|
if (cutoffMs !== null) {
|
|
1353
1486
|
entries = entries.filter((f) => {
|
|
1354
1487
|
try {
|
|
1355
|
-
return
|
|
1488
|
+
return fs8.statSync(path11.join(auditDir, f)).mtimeMs >= cutoffMs;
|
|
1356
1489
|
} catch {
|
|
1357
1490
|
return false;
|
|
1358
1491
|
}
|
|
@@ -1361,7 +1494,7 @@ function readAuditOrchestrations(auditDir, opts = {}) {
|
|
|
1361
1494
|
for (const f of entries) {
|
|
1362
1495
|
let text;
|
|
1363
1496
|
try {
|
|
1364
|
-
text =
|
|
1497
|
+
text = fs8.readFileSync(path11.join(auditDir, f), "utf8");
|
|
1365
1498
|
} catch {
|
|
1366
1499
|
continue;
|
|
1367
1500
|
}
|
|
@@ -1383,7 +1516,7 @@ function readAuditOrchestrations(auditDir, opts = {}) {
|
|
|
1383
1516
|
return out;
|
|
1384
1517
|
}
|
|
1385
1518
|
function buildReport3(opts) {
|
|
1386
|
-
const registrationRaw =
|
|
1519
|
+
const registrationRaw = fs8.readFileSync(REGISTRATION_FILE, "utf8");
|
|
1387
1520
|
const registration = JSON.parse(registrationRaw);
|
|
1388
1521
|
const scanOpts = {
|
|
1389
1522
|
root: opts.root,
|
|
@@ -1521,7 +1654,7 @@ function renderText3(r) {
|
|
|
1521
1654
|
function main3(argv) {
|
|
1522
1655
|
let format = "text";
|
|
1523
1656
|
let root = DEFAULT_PROJECTS_ROOT;
|
|
1524
|
-
let auditDir =
|
|
1657
|
+
let auditDir = path11.join(process.cwd(), DEFAULT_AUDIT_DIR);
|
|
1525
1658
|
let maxAgeDays = 14;
|
|
1526
1659
|
for (let i = 0; i < argv.length; i++) {
|
|
1527
1660
|
const a = argv[i];
|
|
@@ -1544,10 +1677,10 @@ function main3(argv) {
|
|
|
1544
1677
|
function _isCliEntry() {
|
|
1545
1678
|
if (true) return false;
|
|
1546
1679
|
if (process.argv[1] === void 0) return false;
|
|
1547
|
-
const argvUrl = pathToFileURL3(
|
|
1680
|
+
const argvUrl = pathToFileURL3(path11.resolve(process.argv[1])).href;
|
|
1548
1681
|
if (import.meta.url === argvUrl) return true;
|
|
1549
1682
|
try {
|
|
1550
|
-
return
|
|
1683
|
+
return fs8.realpathSync(fileURLToPath4(import.meta.url)) === fs8.realpathSync(path11.resolve(process.argv[1]));
|
|
1551
1684
|
} catch {
|
|
1552
1685
|
return false;
|
|
1553
1686
|
}
|
|
@@ -1556,14 +1689,14 @@ if (_isCliEntry()) process.exit(main3(process.argv.slice(2)));
|
|
|
1556
1689
|
|
|
1557
1690
|
// src/scripts/_lib/environment_detector.ts
|
|
1558
1691
|
import { spawnSync } from "node:child_process";
|
|
1559
|
-
import * as
|
|
1692
|
+
import * as fs9 from "node:fs";
|
|
1560
1693
|
import * as os from "node:os";
|
|
1561
|
-
import * as
|
|
1694
|
+
import * as path12 from "node:path";
|
|
1562
1695
|
|
|
1563
1696
|
// src/install/toolDetection.ts
|
|
1564
1697
|
import { existsSync as existsSync6 } from "node:fs";
|
|
1565
1698
|
import { homedir as homedir3 } from "node:os";
|
|
1566
|
-
import { delimiter, join as
|
|
1699
|
+
import { delimiter, join as join12 } from "node:path";
|
|
1567
1700
|
var TOOL_SIGNALS = {
|
|
1568
1701
|
"claude-code": { bins: ["claude"], homePaths: [".claude", ".claude.json", ".config/claude"] },
|
|
1569
1702
|
"claude-desktop": { absPaths: ["/Applications/Claude.app"], homePaths: ["Library/Application Support/Claude", ".config/Claude"] },
|
|
@@ -1608,7 +1741,7 @@ function resolveBinaryPath(name, pathEnv) {
|
|
|
1608
1741
|
for (const dir of pathEnv.split(delimiter)) {
|
|
1609
1742
|
if (dir.length === 0) continue;
|
|
1610
1743
|
for (const candidate of [name, `${name}.exe`, `${name}.cmd`]) {
|
|
1611
|
-
const full =
|
|
1744
|
+
const full = join12(dir, candidate);
|
|
1612
1745
|
if (existsSync6(full)) return full;
|
|
1613
1746
|
}
|
|
1614
1747
|
}
|
|
@@ -1619,7 +1752,7 @@ function binOnPath(name, pathEnv) {
|
|
|
1619
1752
|
}
|
|
1620
1753
|
function isToolInstalled(signal, home, pathEnv) {
|
|
1621
1754
|
for (const rel of signal.homePaths ?? []) {
|
|
1622
|
-
if (existsSync6(
|
|
1755
|
+
if (existsSync6(join12(home, rel))) return true;
|
|
1623
1756
|
}
|
|
1624
1757
|
for (const abs of signal.absPaths ?? []) {
|
|
1625
1758
|
if (existsSync6(abs)) return true;
|
|
@@ -1681,7 +1814,7 @@ function classifyBilling(provider, source) {
|
|
|
1681
1814
|
function codexHome(env) {
|
|
1682
1815
|
const map = env ?? process.env;
|
|
1683
1816
|
const override = (map["CODEX_HOME"] ?? "").trim();
|
|
1684
|
-
return override !== "" ? override :
|
|
1817
|
+
return override !== "" ? override : path12.join(homeOf(env), ".codex");
|
|
1685
1818
|
}
|
|
1686
1819
|
function homeOf(env) {
|
|
1687
1820
|
const map = env ?? process.env;
|
|
@@ -1720,16 +1853,16 @@ ${res.stderr ?? ""}`;
|
|
|
1720
1853
|
return null;
|
|
1721
1854
|
}
|
|
1722
1855
|
}
|
|
1723
|
-
function
|
|
1856
|
+
function isFile3(p) {
|
|
1724
1857
|
try {
|
|
1725
|
-
return
|
|
1858
|
+
return fs9.statSync(p).isFile();
|
|
1726
1859
|
} catch {
|
|
1727
1860
|
return false;
|
|
1728
1861
|
}
|
|
1729
1862
|
}
|
|
1730
1863
|
function exists(p) {
|
|
1731
1864
|
try {
|
|
1732
|
-
return
|
|
1865
|
+
return fs9.existsSync(p);
|
|
1733
1866
|
} catch {
|
|
1734
1867
|
return false;
|
|
1735
1868
|
}
|
|
@@ -1737,7 +1870,7 @@ function exists(p) {
|
|
|
1737
1870
|
function classifyCodexAuth(authPath) {
|
|
1738
1871
|
let data;
|
|
1739
1872
|
try {
|
|
1740
|
-
data = JSON.parse(
|
|
1873
|
+
data = JSON.parse(fs9.readFileSync(authPath, "utf-8"));
|
|
1741
1874
|
} catch {
|
|
1742
1875
|
return "cli-api-key";
|
|
1743
1876
|
}
|
|
@@ -1754,8 +1887,8 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeyc
|
|
|
1754
1887
|
if (provider === "anthropic") {
|
|
1755
1888
|
const configDir = claudeConfigDir;
|
|
1756
1889
|
for (const rel of [".credentials.json", "credentials.json"]) {
|
|
1757
|
-
const p =
|
|
1758
|
-
if (
|
|
1890
|
+
const p = path12.join(configDir, rel);
|
|
1891
|
+
if (isFile3(p)) return { source: "cli-subscription", evidence: p };
|
|
1759
1892
|
}
|
|
1760
1893
|
if (probeKeychain(CLAUDE_KEYCHAIN_SERVICE)) {
|
|
1761
1894
|
return { source: "cli-subscription", evidence: `keychain:${CLAUDE_KEYCHAIN_SERVICE}` };
|
|
@@ -1763,13 +1896,13 @@ function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeyc
|
|
|
1763
1896
|
return null;
|
|
1764
1897
|
}
|
|
1765
1898
|
if (provider === "openai") {
|
|
1766
|
-
const p =
|
|
1767
|
-
if (
|
|
1899
|
+
const p = path12.join(codexHome(env), "auth.json");
|
|
1900
|
+
if (isFile3(p)) return { source: classifyCodexAuth(p), evidence: p };
|
|
1768
1901
|
return null;
|
|
1769
1902
|
}
|
|
1770
1903
|
if (provider === "gemini") {
|
|
1771
|
-
const p =
|
|
1772
|
-
if (
|
|
1904
|
+
const p = path12.join(home, ".gemini", "oauth_creds.json");
|
|
1905
|
+
if (isFile3(p)) return { source: "cli-subscription", evidence: p };
|
|
1773
1906
|
return null;
|
|
1774
1907
|
}
|
|
1775
1908
|
return null;
|
|
@@ -1800,7 +1933,7 @@ function detectHosts(opts) {
|
|
|
1800
1933
|
function detectAuth(opts) {
|
|
1801
1934
|
const env = opts.env ?? process.env;
|
|
1802
1935
|
const home = opts.home ?? homeOf(opts.env);
|
|
1803
|
-
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() ||
|
|
1936
|
+
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() || path12.join(home, ".claude");
|
|
1804
1937
|
const probeKeychain = opts.probeKeychain ?? defaultProbeKeychain;
|
|
1805
1938
|
const auth = [];
|
|
1806
1939
|
const keys = [];
|
|
@@ -1855,7 +1988,7 @@ function detectEnvironment(opts = {}) {
|
|
|
1855
1988
|
}
|
|
1856
1989
|
|
|
1857
1990
|
// src/scripts/_cli/detection_report.ts
|
|
1858
|
-
import * as
|
|
1991
|
+
import * as path13 from "node:path";
|
|
1859
1992
|
|
|
1860
1993
|
// src/scripts/ai_council/transport_resolver.ts
|
|
1861
1994
|
var VALID_TRANSPORT_MODES = /* @__PURE__ */ new Set([
|
|
@@ -2057,7 +2190,7 @@ function cliBinaryPresent(environment, provider, binaryOverride) {
|
|
|
2057
2190
|
const expected = PROVIDER_CLI_META[provider]?.[0];
|
|
2058
2191
|
if (expected === void 0) return false;
|
|
2059
2192
|
return environment.hosts.some(
|
|
2060
|
-
(h) => h.binary !== null && stripExe(
|
|
2193
|
+
(h) => h.binary !== null && stripExe(path13.basename(h.binary)) === expected
|
|
2061
2194
|
);
|
|
2062
2195
|
}
|
|
2063
2196
|
function stripExe(name) {
|
|
@@ -2218,9 +2351,9 @@ function absentCouncilFacts(configPath) {
|
|
|
2218
2351
|
|
|
2219
2352
|
// src/scripts/ai_team/review_gate.ts
|
|
2220
2353
|
import * as crypto from "node:crypto";
|
|
2221
|
-
import * as
|
|
2354
|
+
import * as fs10 from "node:fs";
|
|
2222
2355
|
import * as os2 from "node:os";
|
|
2223
|
-
import * as
|
|
2356
|
+
import * as path14 from "node:path";
|
|
2224
2357
|
|
|
2225
2358
|
// src/scripts/ai_team/config.ts
|
|
2226
2359
|
var AI_TEAM_REVIEW_GATE_DEFAULTS = Object.freeze({
|
|
@@ -2236,16 +2369,16 @@ var AI_TEAM_DEFAULTS = Object.freeze({
|
|
|
2236
2369
|
});
|
|
2237
2370
|
|
|
2238
2371
|
// src/scripts/ai_team/review_gate.ts
|
|
2239
|
-
var GATE_LEDGER_RELPATH =
|
|
2372
|
+
var GATE_LEDGER_RELPATH = path14.join("agents", "runtime", "team", "events.log");
|
|
2240
2373
|
var _CODEX_PLUGIN_DATA_DIRNAME = `${CODEX_PLUGIN_ID}-${CODEX_MARKETPLACE_NAME}`;
|
|
2241
2374
|
function _workspace_state_segment(workspace_root) {
|
|
2242
2375
|
let canonical = workspace_root;
|
|
2243
2376
|
try {
|
|
2244
|
-
canonical =
|
|
2377
|
+
canonical = fs10.realpathSync.native(workspace_root);
|
|
2245
2378
|
} catch {
|
|
2246
2379
|
canonical = workspace_root;
|
|
2247
2380
|
}
|
|
2248
|
-
const slug_source =
|
|
2381
|
+
const slug_source = path14.basename(workspace_root) || "workspace";
|
|
2249
2382
|
const slug = slug_source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
|
|
2250
2383
|
const hash = crypto.createHash("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
2251
2384
|
return `${slug}-${hash}`;
|
|
@@ -2255,19 +2388,19 @@ function upstream_state_dir_candidates(workspace_root) {
|
|
|
2255
2388
|
const candidates = [];
|
|
2256
2389
|
const env = (process.env["CLAUDE_PLUGIN_DATA"] ?? "").trim();
|
|
2257
2390
|
if (env !== "") {
|
|
2258
|
-
candidates.push(
|
|
2391
|
+
candidates.push(path14.join(env, "state", segment));
|
|
2259
2392
|
}
|
|
2260
2393
|
candidates.push(
|
|
2261
|
-
|
|
2394
|
+
path14.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
|
|
2262
2395
|
);
|
|
2263
|
-
candidates.push(
|
|
2396
|
+
candidates.push(path14.join(os2.tmpdir(), "codex-companion", segment));
|
|
2264
2397
|
return candidates;
|
|
2265
2398
|
}
|
|
2266
2399
|
function upstream_gate_enabled(workspace_root) {
|
|
2267
2400
|
for (const dir of upstream_state_dir_candidates(workspace_root)) {
|
|
2268
2401
|
let parsed;
|
|
2269
2402
|
try {
|
|
2270
|
-
parsed = JSON.parse(
|
|
2403
|
+
parsed = JSON.parse(fs10.readFileSync(path14.join(dir, "state.json"), "utf-8"));
|
|
2271
2404
|
} catch {
|
|
2272
2405
|
continue;
|
|
2273
2406
|
}
|
|
@@ -2327,41 +2460,41 @@ var ArgparseExit = class extends Error {
|
|
|
2327
2460
|
function expanduser(p) {
|
|
2328
2461
|
if (p === "~") return os3.homedir();
|
|
2329
2462
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
2330
|
-
return
|
|
2463
|
+
return path15.join(os3.homedir(), p.slice(2));
|
|
2331
2464
|
}
|
|
2332
2465
|
return p;
|
|
2333
2466
|
}
|
|
2334
2467
|
function pathExists(p) {
|
|
2335
2468
|
try {
|
|
2336
|
-
|
|
2469
|
+
fs11.statSync(p);
|
|
2337
2470
|
return true;
|
|
2338
2471
|
} catch {
|
|
2339
2472
|
return false;
|
|
2340
2473
|
}
|
|
2341
2474
|
}
|
|
2342
|
-
function
|
|
2475
|
+
function isFile4(p) {
|
|
2343
2476
|
try {
|
|
2344
|
-
return
|
|
2477
|
+
return fs11.statSync(p).isFile();
|
|
2345
2478
|
} catch {
|
|
2346
2479
|
return false;
|
|
2347
2480
|
}
|
|
2348
2481
|
}
|
|
2349
|
-
function
|
|
2482
|
+
function isDir3(p) {
|
|
2350
2483
|
try {
|
|
2351
|
-
return
|
|
2484
|
+
return fs11.statSync(p).isDirectory();
|
|
2352
2485
|
} catch {
|
|
2353
2486
|
return false;
|
|
2354
2487
|
}
|
|
2355
2488
|
}
|
|
2356
2489
|
function resolvePath(p) {
|
|
2357
2490
|
try {
|
|
2358
|
-
return
|
|
2491
|
+
return fs11.realpathSync(path15.resolve(p));
|
|
2359
2492
|
} catch {
|
|
2360
|
-
return
|
|
2493
|
+
return path15.resolve(p);
|
|
2361
2494
|
}
|
|
2362
2495
|
}
|
|
2363
2496
|
function readText(p) {
|
|
2364
|
-
return
|
|
2497
|
+
return fs11.readFileSync(p, "utf-8");
|
|
2365
2498
|
}
|
|
2366
2499
|
function _jsonStrAscii(s) {
|
|
2367
2500
|
let out = '"';
|
|
@@ -2472,8 +2605,8 @@ function _resolve_project_root(arg) {
|
|
|
2472
2605
|
}
|
|
2473
2606
|
var _INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
2474
2607
|
function _detect_install_mode(project_root) {
|
|
2475
|
-
const marker =
|
|
2476
|
-
if (
|
|
2608
|
+
const marker = path15.join(project_root, _INSTALL_MODE_MARKER_REL);
|
|
2609
|
+
if (isFile4(marker)) {
|
|
2477
2610
|
let value;
|
|
2478
2611
|
try {
|
|
2479
2612
|
value = readText(marker).trim();
|
|
@@ -2484,9 +2617,9 @@ function _detect_install_mode(project_root) {
|
|
|
2484
2617
|
return [value, "marker-file"];
|
|
2485
2618
|
}
|
|
2486
2619
|
}
|
|
2487
|
-
const has_agents_md = pathExists(
|
|
2620
|
+
const has_agents_md = pathExists(path15.join(project_root, "AGENTS.md"));
|
|
2488
2621
|
const has_copilot = pathExists(
|
|
2489
|
-
|
|
2622
|
+
path15.join(project_root, ".github", "copilot-instructions.md")
|
|
2490
2623
|
);
|
|
2491
2624
|
if (has_agents_md && has_copilot) {
|
|
2492
2625
|
return ["full", "heuristic"];
|
|
@@ -2496,17 +2629,17 @@ function _detect_install_mode(project_root) {
|
|
|
2496
2629
|
function _settings_layer_chain(project_root) {
|
|
2497
2630
|
const layers = [];
|
|
2498
2631
|
const user_global = resolve_with_fallback("agent-settings.yml");
|
|
2499
|
-
if (user_global !== null &&
|
|
2632
|
+
if (user_global !== null && isFile4(user_global)) {
|
|
2500
2633
|
layers.push(String(user_global));
|
|
2501
2634
|
}
|
|
2502
2635
|
const project_settings = project_settings_path(project_root);
|
|
2503
|
-
if (
|
|
2636
|
+
if (isFile4(project_settings)) {
|
|
2504
2637
|
layers.push(String(project_settings));
|
|
2505
2638
|
}
|
|
2506
2639
|
return layers;
|
|
2507
2640
|
}
|
|
2508
2641
|
function _detect_wrapper(project_root) {
|
|
2509
|
-
const wrapper =
|
|
2642
|
+
const wrapper = path15.join(project_root, "agent-config");
|
|
2510
2643
|
if (!pathExists(wrapper)) {
|
|
2511
2644
|
return { path: String(wrapper), exists: false, embedded_root: null };
|
|
2512
2645
|
}
|
|
@@ -2573,14 +2706,14 @@ function _emit_context_text(ctx) {
|
|
|
2573
2706
|
}
|
|
2574
2707
|
function _resolve_path(project_root, raw) {
|
|
2575
2708
|
let p = expanduser(raw);
|
|
2576
|
-
if (!
|
|
2577
|
-
p =
|
|
2709
|
+
if (!path15.isAbsolute(p)) {
|
|
2710
|
+
p = path15.join(project_root, p);
|
|
2578
2711
|
}
|
|
2579
2712
|
return p;
|
|
2580
2713
|
}
|
|
2581
2714
|
function _sha256(p) {
|
|
2582
2715
|
try {
|
|
2583
|
-
const data =
|
|
2716
|
+
const data = fs11.readFileSync(p);
|
|
2584
2717
|
return crypto2.createHash("sha256").update(data).digest("hex");
|
|
2585
2718
|
} catch {
|
|
2586
2719
|
return null;
|
|
@@ -2589,7 +2722,7 @@ function _sha256(p) {
|
|
|
2589
2722
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
2590
2723
|
var _FRONTMATTER_PACKAGE_RE = /^package:\s*(.+?)\s*$/m;
|
|
2591
2724
|
function _read_inline_package_tag(p) {
|
|
2592
|
-
if (
|
|
2725
|
+
if (path15.extname(p) !== ".md") {
|
|
2593
2726
|
return NO_FRONTMATTER;
|
|
2594
2727
|
}
|
|
2595
2728
|
let text;
|
|
@@ -2690,11 +2823,11 @@ function _scan_foreign(project_root, manifest, known) {
|
|
|
2690
2823
|
const seen = /* @__PURE__ */ new Set();
|
|
2691
2824
|
for (const root_rel of roots) {
|
|
2692
2825
|
const root = _resolve_path(project_root, String(root_rel));
|
|
2693
|
-
if (!pathExists(root) || !
|
|
2826
|
+
if (!pathExists(root) || !isDir3(root)) {
|
|
2694
2827
|
continue;
|
|
2695
2828
|
}
|
|
2696
2829
|
for (const child of rglob(root)) {
|
|
2697
|
-
if (!
|
|
2830
|
+
if (!isFile4(child)) {
|
|
2698
2831
|
continue;
|
|
2699
2832
|
}
|
|
2700
2833
|
let resolved;
|
|
@@ -2718,17 +2851,17 @@ function rglob(root) {
|
|
|
2718
2851
|
const walk = (dir) => {
|
|
2719
2852
|
let entries;
|
|
2720
2853
|
try {
|
|
2721
|
-
entries =
|
|
2854
|
+
entries = fs11.readdirSync(dir, { withFileTypes: true });
|
|
2722
2855
|
} catch {
|
|
2723
2856
|
return;
|
|
2724
2857
|
}
|
|
2725
2858
|
entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
2726
2859
|
for (const ent of entries) {
|
|
2727
|
-
const full =
|
|
2860
|
+
const full = path15.join(dir, ent.name);
|
|
2728
2861
|
out.push(full);
|
|
2729
2862
|
let dirLike = ent.isDirectory();
|
|
2730
2863
|
if (ent.isSymbolicLink()) {
|
|
2731
|
-
dirLike =
|
|
2864
|
+
dirLike = isDir3(full);
|
|
2732
2865
|
}
|
|
2733
2866
|
if (dirLike) {
|
|
2734
2867
|
walk(full);
|
|
@@ -2799,9 +2932,9 @@ function _foreign_records(project_root, foreign) {
|
|
|
2799
2932
|
return out;
|
|
2800
2933
|
}
|
|
2801
2934
|
function relativeTo(p, base) {
|
|
2802
|
-
const rel =
|
|
2935
|
+
const rel = path15.relative(base, p);
|
|
2803
2936
|
if (rel === "") return rel;
|
|
2804
|
-
if (rel.startsWith("..") ||
|
|
2937
|
+
if (rel.startsWith("..") || path15.isAbsolute(rel)) {
|
|
2805
2938
|
return null;
|
|
2806
2939
|
}
|
|
2807
2940
|
return rel;
|
|
@@ -2815,6 +2948,7 @@ var CHECK_IDS = [
|
|
|
2815
2948
|
"surface-state",
|
|
2816
2949
|
"hook-wiring",
|
|
2817
2950
|
"stale-orphans",
|
|
2951
|
+
"overrides",
|
|
2818
2952
|
"rule-scope-drift",
|
|
2819
2953
|
"manifest-integrity",
|
|
2820
2954
|
"lockfile-freshness",
|
|
@@ -2843,6 +2977,7 @@ var GLOBAL_CHECK_IDS = /* @__PURE__ */ new Set([
|
|
|
2843
2977
|
"surface-state",
|
|
2844
2978
|
"hook-wiring",
|
|
2845
2979
|
"stale-orphans",
|
|
2980
|
+
"overrides",
|
|
2846
2981
|
"rule-scope-drift",
|
|
2847
2982
|
"mcp-mode",
|
|
2848
2983
|
"mcp-beta-readiness",
|
|
@@ -2863,10 +2998,6 @@ var MANIFEST_REQUIRED_CHECK_IDS = /* @__PURE__ */ new Set([
|
|
|
2863
2998
|
"lockfile-freshness",
|
|
2864
2999
|
"unsupported-combos"
|
|
2865
3000
|
]);
|
|
2866
|
-
var INSTALL_MODE_MARKER_RELATIVE = "agents/.agent-state/install-mode.txt";
|
|
2867
|
-
function _is_global_only_consumer(project_root) {
|
|
2868
|
-
return isFile2(path13.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir(path13.join(project_root, "agents", "overrides"));
|
|
2869
|
-
}
|
|
2870
3001
|
var REPAIR_IDS = ["wizard-state"];
|
|
2871
3002
|
var MCP_BETA_GATES = [
|
|
2872
3003
|
["gate-1-external-client", "tests/mcp/external-clients"],
|
|
@@ -2885,7 +3016,7 @@ var STATUS_SYMBOLS = {
|
|
|
2885
3016
|
var MIN_PYTHON = [3, 10];
|
|
2886
3017
|
function _check_scope(project_root) {
|
|
2887
3018
|
for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
|
|
2888
|
-
if (pathExists(
|
|
3019
|
+
if (pathExists(path15.join(project_root, marker))) {
|
|
2889
3020
|
return {
|
|
2890
3021
|
id: "scope",
|
|
2891
3022
|
status: "warn",
|
|
@@ -2894,7 +3025,7 @@ function _check_scope(project_root) {
|
|
|
2894
3025
|
};
|
|
2895
3026
|
}
|
|
2896
3027
|
}
|
|
2897
|
-
const pkg =
|
|
3028
|
+
const pkg = path15.join(project_root, "package.json");
|
|
2898
3029
|
if (pathExists(pkg)) {
|
|
2899
3030
|
try {
|
|
2900
3031
|
const data = JSON.parse(readText(pkg));
|
|
@@ -2920,7 +3051,7 @@ var _PLACEHOLDER_EMAIL_RE = /^(t@t\.t|.*@example\.(com|org)|.*@localhost)$/i;
|
|
|
2920
3051
|
var _PLACEHOLDER_NAME_RE = /^(t|test|user|nobody|x)$/i;
|
|
2921
3052
|
function _git_config_path(project_root) {
|
|
2922
3053
|
const common = git_common_dir(project_root);
|
|
2923
|
-
return common === null ? null :
|
|
3054
|
+
return common === null ? null : path15.join(common, "config");
|
|
2924
3055
|
}
|
|
2925
3056
|
function _parse_git_user(configText) {
|
|
2926
3057
|
let inUser = false;
|
|
@@ -2950,7 +3081,7 @@ function _check_git_identity(project_root) {
|
|
|
2950
3081
|
}
|
|
2951
3082
|
let ident = _parse_git_user(readText(cfgPath));
|
|
2952
3083
|
if (ident.name === null && ident.email === null) {
|
|
2953
|
-
const globalCfg =
|
|
3084
|
+
const globalCfg = path15.join(os3.homedir(), ".gitconfig");
|
|
2954
3085
|
if (pathExists(globalCfg)) {
|
|
2955
3086
|
ident = _parse_git_user(readText(globalCfg));
|
|
2956
3087
|
}
|
|
@@ -3011,7 +3142,7 @@ function _package_root() {
|
|
|
3011
3142
|
}
|
|
3012
3143
|
function _current_package_version() {
|
|
3013
3144
|
try {
|
|
3014
|
-
const data = JSON.parse(readText(
|
|
3145
|
+
const data = JSON.parse(readText(path15.join(_package_root(), "package.json")));
|
|
3015
3146
|
const v = data["version"];
|
|
3016
3147
|
if (typeof v === "string" && v.trim()) {
|
|
3017
3148
|
return v.trim();
|
|
@@ -3055,7 +3186,7 @@ function _check_lockfile_freshness(manifest) {
|
|
|
3055
3186
|
};
|
|
3056
3187
|
}
|
|
3057
3188
|
function shutilWhich(name) {
|
|
3058
|
-
if (
|
|
3189
|
+
if (path15.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
|
|
3059
3190
|
return isExecutableFile(name) ? name : null;
|
|
3060
3191
|
}
|
|
3061
3192
|
const pathEnv = process2.env["PATH"] || "";
|
|
@@ -3068,12 +3199,12 @@ function shutilWhich(name) {
|
|
|
3068
3199
|
if (seenDirs.has(d)) continue;
|
|
3069
3200
|
seenDirs.add(d);
|
|
3070
3201
|
for (const ext of exts) {
|
|
3071
|
-
const candidate =
|
|
3202
|
+
const candidate = path15.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
|
|
3072
3203
|
if (isExecutableFile(candidate)) {
|
|
3073
3204
|
return candidate;
|
|
3074
3205
|
}
|
|
3075
3206
|
if (ext !== "") {
|
|
3076
|
-
const upper =
|
|
3207
|
+
const upper = path15.join(d, name + ext);
|
|
3077
3208
|
if (isExecutableFile(upper)) return upper;
|
|
3078
3209
|
}
|
|
3079
3210
|
}
|
|
@@ -3082,10 +3213,10 @@ function shutilWhich(name) {
|
|
|
3082
3213
|
}
|
|
3083
3214
|
function isExecutableFile(p) {
|
|
3084
3215
|
try {
|
|
3085
|
-
const st =
|
|
3216
|
+
const st = fs11.statSync(p);
|
|
3086
3217
|
if (!st.isFile()) return false;
|
|
3087
3218
|
if (process2.platform === "win32") return true;
|
|
3088
|
-
|
|
3219
|
+
fs11.accessSync(p, fs11.constants.X_OK);
|
|
3089
3220
|
return true;
|
|
3090
3221
|
} catch {
|
|
3091
3222
|
return false;
|
|
@@ -3149,8 +3280,8 @@ function _check_claude_plugin() {
|
|
|
3149
3280
|
remedy: ""
|
|
3150
3281
|
};
|
|
3151
3282
|
}
|
|
3152
|
-
const projection =
|
|
3153
|
-
const projection_present =
|
|
3283
|
+
const projection = path15.join(os3.homedir(), ".claude", "skills");
|
|
3284
|
+
const projection_present = isDir3(projection);
|
|
3154
3285
|
if (projection_present) {
|
|
3155
3286
|
return {
|
|
3156
3287
|
id: "claude-plugin",
|
|
@@ -3186,9 +3317,9 @@ function _check_claude_command_wrappers() {
|
|
|
3186
3317
|
remedy: ""
|
|
3187
3318
|
};
|
|
3188
3319
|
}
|
|
3189
|
-
const anchor =
|
|
3190
|
-
const commands_dir =
|
|
3191
|
-
if (!
|
|
3320
|
+
const anchor = path15.join(os3.homedir(), ".claude");
|
|
3321
|
+
const commands_dir = path15.join(anchor, "commands");
|
|
3322
|
+
if (!isDir3(commands_dir)) {
|
|
3192
3323
|
return {
|
|
3193
3324
|
id: "claude-command-wrappers",
|
|
3194
3325
|
status: "skipped",
|
|
@@ -3196,8 +3327,8 @@ function _check_claude_command_wrappers() {
|
|
|
3196
3327
|
remedy: ""
|
|
3197
3328
|
};
|
|
3198
3329
|
}
|
|
3199
|
-
const flat_probe =
|
|
3200
|
-
const wrapper_probe =
|
|
3330
|
+
const flat_probe = fs11.existsSync(path15.join(commands_dir, "commit.md"));
|
|
3331
|
+
const wrapper_probe = fs11.existsSync(path15.join(anchor, "skills", "commit", "SKILL.md"));
|
|
3201
3332
|
if (wrapper_probe) {
|
|
3202
3333
|
return {
|
|
3203
3334
|
id: "claude-command-wrappers",
|
|
@@ -3222,8 +3353,8 @@ function _check_claude_command_wrappers() {
|
|
|
3222
3353
|
};
|
|
3223
3354
|
}
|
|
3224
3355
|
function _check_surface_state() {
|
|
3225
|
-
const matrix_path =
|
|
3226
|
-
if (!
|
|
3356
|
+
const matrix_path = path15.join(_package_root(), "src", "config", "surface-matrix.yml");
|
|
3357
|
+
if (!isFile4(matrix_path)) {
|
|
3227
3358
|
return {
|
|
3228
3359
|
id: "surface-state",
|
|
3229
3360
|
status: "skipped",
|
|
@@ -3246,7 +3377,7 @@ function _check_surface_state() {
|
|
|
3246
3377
|
remedy: "agent-config upgrade (reinstalls the package data files)"
|
|
3247
3378
|
};
|
|
3248
3379
|
}
|
|
3249
|
-
const _expand = (p) => p.startsWith("~/") ?
|
|
3380
|
+
const _expand = (p) => p.startsWith("~/") ? path15.join(os3.homedir(), p.slice(2)) : path15.join(_package_root(), p);
|
|
3250
3381
|
const violations = [];
|
|
3251
3382
|
const remedies = [];
|
|
3252
3383
|
let checked = 0;
|
|
@@ -3288,7 +3419,7 @@ function _check_surface_state() {
|
|
|
3288
3419
|
}
|
|
3289
3420
|
function pathExistsAny(p) {
|
|
3290
3421
|
try {
|
|
3291
|
-
|
|
3422
|
+
fs11.statSync(p);
|
|
3292
3423
|
return true;
|
|
3293
3424
|
} catch {
|
|
3294
3425
|
return false;
|
|
@@ -3304,13 +3435,13 @@ function _check_hook_wiring() {
|
|
|
3304
3435
|
remedy: ""
|
|
3305
3436
|
};
|
|
3306
3437
|
}
|
|
3307
|
-
const settings_path =
|
|
3438
|
+
const settings_path = path15.join(os3.homedir(), ".claude", "settings.json");
|
|
3308
3439
|
let missing;
|
|
3309
3440
|
try {
|
|
3310
3441
|
const matrix = build_claude_hook_matrix(
|
|
3311
|
-
|
|
3442
|
+
path15.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
|
|
3312
3443
|
);
|
|
3313
|
-
const settings = pathExists(settings_path) ? JSON.parse(
|
|
3444
|
+
const settings = pathExists(settings_path) ? JSON.parse(fs11.readFileSync(settings_path, "utf8")) : {};
|
|
3314
3445
|
const hooks = (settings["hooks"] ?? {}) || {};
|
|
3315
3446
|
missing = Object.keys(matrix).filter((ev) => {
|
|
3316
3447
|
const groups = hooks[ev];
|
|
@@ -3385,7 +3516,7 @@ function _check_mcp_mode(project_root) {
|
|
|
3385
3516
|
];
|
|
3386
3517
|
const found = [];
|
|
3387
3518
|
for (const [rel, label] of candidates) {
|
|
3388
|
-
const p =
|
|
3519
|
+
const p = path15.join(project_root, rel);
|
|
3389
3520
|
if (!pathExists(p)) {
|
|
3390
3521
|
continue;
|
|
3391
3522
|
}
|
|
@@ -3417,7 +3548,7 @@ function _check_mcp_mode(project_root) {
|
|
|
3417
3548
|
};
|
|
3418
3549
|
}
|
|
3419
3550
|
function _check_offline_readiness() {
|
|
3420
|
-
const script =
|
|
3551
|
+
const script = path15.join(_package_root(), "src", "scripts", "hermetic-install.sh");
|
|
3421
3552
|
if (!pathExists(script)) {
|
|
3422
3553
|
return {
|
|
3423
3554
|
id: "offline-readiness",
|
|
@@ -3461,7 +3592,7 @@ function _check_stale_orphans() {
|
|
|
3461
3592
|
continue;
|
|
3462
3593
|
}
|
|
3463
3594
|
const anchor = expanduser(anchor_raw);
|
|
3464
|
-
if (!
|
|
3595
|
+
if (!isDir3(anchor)) {
|
|
3465
3596
|
continue;
|
|
3466
3597
|
}
|
|
3467
3598
|
const recorded_set = new Set(recorded.filter((r) => typeof r === "string"));
|
|
@@ -3475,12 +3606,12 @@ function _check_stale_orphans() {
|
|
|
3475
3606
|
(a, b) => a < b ? -1 : a > b ? 1 : 0
|
|
3476
3607
|
);
|
|
3477
3608
|
for (const root_name of ownedSorted) {
|
|
3478
|
-
const root =
|
|
3479
|
-
if (!
|
|
3609
|
+
const root = path15.join(anchor, root_name);
|
|
3610
|
+
if (!isDir3(root)) {
|
|
3480
3611
|
continue;
|
|
3481
3612
|
}
|
|
3482
3613
|
for (const md of rglob(root)) {
|
|
3483
|
-
if (
|
|
3614
|
+
if (isDir3(md)) {
|
|
3484
3615
|
continue;
|
|
3485
3616
|
}
|
|
3486
3617
|
if (!md.endsWith(".md")) {
|
|
@@ -3490,7 +3621,7 @@ function _check_stale_orphans() {
|
|
|
3490
3621
|
if (rel === null) {
|
|
3491
3622
|
continue;
|
|
3492
3623
|
}
|
|
3493
|
-
const relPosix = rel.split(
|
|
3624
|
+
const relPosix = rel.split(path15.sep).join("/");
|
|
3494
3625
|
if (recorded_set.has(relPosix)) {
|
|
3495
3626
|
continue;
|
|
3496
3627
|
}
|
|
@@ -3537,7 +3668,7 @@ function _check_rule_scope_drift(project_root) {
|
|
|
3537
3668
|
}
|
|
3538
3669
|
let scope = LEGACY_ALL;
|
|
3539
3670
|
const settings_file = project_settings_path(project_root);
|
|
3540
|
-
if (
|
|
3671
|
+
if (isFile4(settings_file)) {
|
|
3541
3672
|
const loaded = yamlSafeLoad(readText0(settings_file));
|
|
3542
3673
|
const raw = typeof loaded === "object" && loaded !== null && !Array.isArray(loaded) ? loaded : {};
|
|
3543
3674
|
scope = ruleScopeFromSettings(raw);
|
|
@@ -3545,14 +3676,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
3545
3676
|
let rules_dir = null;
|
|
3546
3677
|
let found = 0;
|
|
3547
3678
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
3548
|
-
const cand =
|
|
3549
|
-
if (!
|
|
3679
|
+
const cand = path15.join(project_root, rel);
|
|
3680
|
+
if (!isDir3(cand)) {
|
|
3550
3681
|
continue;
|
|
3551
3682
|
}
|
|
3552
3683
|
let count = 0;
|
|
3553
3684
|
try {
|
|
3554
|
-
for (const name of
|
|
3555
|
-
if (name.endsWith(".md") &&
|
|
3685
|
+
for (const name of fs11.readdirSync(cand)) {
|
|
3686
|
+
if (name.endsWith(".md") && isFile4(path15.join(cand, name))) {
|
|
3556
3687
|
count += 1;
|
|
3557
3688
|
}
|
|
3558
3689
|
}
|
|
@@ -3606,15 +3737,15 @@ function _check_rule_scope_drift(project_root) {
|
|
|
3606
3737
|
};
|
|
3607
3738
|
}
|
|
3608
3739
|
function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
|
|
3609
|
-
const user_rules_dir = userRulesDirOverride ??
|
|
3740
|
+
const user_rules_dir = userRulesDirOverride ?? path15.join(os3.homedir(), ".claude", "rules");
|
|
3610
3741
|
let project_rules_dir = null;
|
|
3611
3742
|
if (_is_source_repo(project_root)) {
|
|
3612
|
-
const cand =
|
|
3613
|
-
if (
|
|
3743
|
+
const cand = path15.join(project_root, "dist", "agent-src", "rules");
|
|
3744
|
+
if (isDir3(cand)) project_rules_dir = cand;
|
|
3614
3745
|
} else {
|
|
3615
3746
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
3616
|
-
const cand =
|
|
3617
|
-
if (
|
|
3747
|
+
const cand = path15.join(project_root, rel);
|
|
3748
|
+
if (isDir3(cand)) {
|
|
3618
3749
|
project_rules_dir = cand;
|
|
3619
3750
|
break;
|
|
3620
3751
|
}
|
|
@@ -3682,7 +3813,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
3682
3813
|
}
|
|
3683
3814
|
const pending = [];
|
|
3684
3815
|
for (const [gate_id, rel] of MCP_BETA_GATES) {
|
|
3685
|
-
if (!pathExists(
|
|
3816
|
+
if (!pathExists(path15.join(project_root, rel))) {
|
|
3686
3817
|
pending.push(`${gate_id} (${rel})`);
|
|
3687
3818
|
}
|
|
3688
3819
|
}
|
|
@@ -3703,9 +3834,9 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
3703
3834
|
}
|
|
3704
3835
|
function _check_tier_usage_readiness(project_root) {
|
|
3705
3836
|
const settings_file = project_settings_path(project_root);
|
|
3706
|
-
let log_path =
|
|
3837
|
+
let log_path = path15.join(project_root, ".agent-tier-usage.jsonl");
|
|
3707
3838
|
let enabled = false;
|
|
3708
|
-
if (
|
|
3839
|
+
if (isFile4(settings_file)) {
|
|
3709
3840
|
let raw;
|
|
3710
3841
|
const loaded = yamlSafeLoad(readText0(settings_file));
|
|
3711
3842
|
if (loaded === null) {
|
|
@@ -3722,7 +3853,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
3722
3853
|
const outputRaw = tu["output"];
|
|
3723
3854
|
const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
|
|
3724
3855
|
if (typeof output["path"] === "string" && output["path"].trim()) {
|
|
3725
|
-
log_path =
|
|
3856
|
+
log_path = path15.join(project_root, output["path"].trim());
|
|
3726
3857
|
}
|
|
3727
3858
|
const val = tu["enabled"];
|
|
3728
3859
|
if (typeof val === "boolean") {
|
|
@@ -3747,7 +3878,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
3747
3878
|
return {
|
|
3748
3879
|
id: "tier-usage-readiness",
|
|
3749
3880
|
status: "warn",
|
|
3750
|
-
message: `tier-usage telemetry on but ${
|
|
3881
|
+
message: `tier-usage telemetry on but ${path15.basename(log_path)} not yet written \u2014 no signal accumulated`,
|
|
3751
3882
|
remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
|
|
3752
3883
|
};
|
|
3753
3884
|
}
|
|
@@ -3762,7 +3893,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
3762
3893
|
return {
|
|
3763
3894
|
id: "tier-usage-readiness",
|
|
3764
3895
|
status: "fail",
|
|
3765
|
-
message: `cannot read ${
|
|
3896
|
+
message: `cannot read ${path15.basename(log_path)}: ${osErrorStr(exc)}`,
|
|
3766
3897
|
remedy: "fix permissions on the tier-usage log"
|
|
3767
3898
|
};
|
|
3768
3899
|
}
|
|
@@ -3793,7 +3924,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
3793
3924
|
return {
|
|
3794
3925
|
id: "tier-usage-readiness",
|
|
3795
3926
|
status: "fail",
|
|
3796
|
-
message: `${total} record(s) in ${
|
|
3927
|
+
message: `${total} record(s) in ${path15.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
|
|
3797
3928
|
remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
|
|
3798
3929
|
};
|
|
3799
3930
|
}
|
|
@@ -3801,19 +3932,19 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
3801
3932
|
return {
|
|
3802
3933
|
id: "tier-usage-readiness",
|
|
3803
3934
|
status: "warn",
|
|
3804
|
-
message: `${
|
|
3935
|
+
message: `${path15.basename(log_path)} present but empty \u2014 no signal yet`,
|
|
3805
3936
|
remedy: "run any tracked command to seed the log"
|
|
3806
3937
|
};
|
|
3807
3938
|
}
|
|
3808
3939
|
return {
|
|
3809
3940
|
id: "tier-usage-readiness",
|
|
3810
3941
|
status: "ok",
|
|
3811
|
-
message: `${valid} record(s) past the privacy floor in ${
|
|
3942
|
+
message: `${valid} record(s) past the privacy floor in ${path15.basename(log_path)} \u2014 retiering signal available`,
|
|
3812
3943
|
remedy: ""
|
|
3813
3944
|
};
|
|
3814
3945
|
}
|
|
3815
3946
|
function readText0(p) {
|
|
3816
|
-
return
|
|
3947
|
+
return fs11.readFileSync(p, "utf-8");
|
|
3817
3948
|
}
|
|
3818
3949
|
function osErrorStr(exc) {
|
|
3819
3950
|
if (exc && typeof exc === "object" && "message" in exc) {
|
|
@@ -3986,7 +4117,7 @@ function _epoch_seconds(value) {
|
|
|
3986
4117
|
function _codex_auth_expiry(auth_path) {
|
|
3987
4118
|
let data;
|
|
3988
4119
|
try {
|
|
3989
|
-
data = JSON.parse(
|
|
4120
|
+
data = JSON.parse(fs11.readFileSync(auth_path, "utf-8"));
|
|
3990
4121
|
} catch {
|
|
3991
4122
|
return null;
|
|
3992
4123
|
}
|
|
@@ -4007,7 +4138,7 @@ function _codex_auth_expiry(auth_path) {
|
|
|
4007
4138
|
}
|
|
4008
4139
|
function _read_ai_team_block(project_root) {
|
|
4009
4140
|
const settings_file = project_settings_path(project_root);
|
|
4010
|
-
if (!
|
|
4141
|
+
if (!isFile4(settings_file)) return {};
|
|
4011
4142
|
let content;
|
|
4012
4143
|
try {
|
|
4013
4144
|
content = readText0(settings_file);
|
|
@@ -4132,7 +4263,7 @@ function _check_team(project_root) {
|
|
|
4132
4263
|
if (binary_missing) {
|
|
4133
4264
|
remedies.push("install the codex CLI: `npm install -g @openai/codex`");
|
|
4134
4265
|
}
|
|
4135
|
-
const auth_path =
|
|
4266
|
+
const auth_path = path15.join(_codex_home(), "auth.json");
|
|
4136
4267
|
const authed = pathExists(auth_path);
|
|
4137
4268
|
let auth_str;
|
|
4138
4269
|
if (!authed) {
|
|
@@ -4220,7 +4351,7 @@ function _check_unsupported_combos(manifest) {
|
|
|
4220
4351
|
};
|
|
4221
4352
|
}
|
|
4222
4353
|
function _wizard_state_path() {
|
|
4223
|
-
return
|
|
4354
|
+
return path15.join(event4u_root(), "state", "wizard-state.json");
|
|
4224
4355
|
}
|
|
4225
4356
|
function _check_wizard_state() {
|
|
4226
4357
|
const state_pth = _wizard_state_path();
|
|
@@ -4300,7 +4431,7 @@ function _check_wizard_state() {
|
|
|
4300
4431
|
};
|
|
4301
4432
|
}
|
|
4302
4433
|
function _check_settings_review_pending() {
|
|
4303
|
-
const delta_pth =
|
|
4434
|
+
const delta_pth = path15.join(event4u_root(), "state", "settings-delta.json");
|
|
4304
4435
|
if (!pathExists(delta_pth)) {
|
|
4305
4436
|
return {
|
|
4306
4437
|
id: "settings-review-pending",
|
|
@@ -4326,7 +4457,7 @@ function _check_settings_review_pending() {
|
|
|
4326
4457
|
}
|
|
4327
4458
|
function _check_memory_merge_union(project_root) {
|
|
4328
4459
|
const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
|
|
4329
|
-
const target =
|
|
4460
|
+
const target = path15.join(project_root, DEFAULT_GITATTRIBUTES);
|
|
4330
4461
|
if (!pathExists(target)) {
|
|
4331
4462
|
return {
|
|
4332
4463
|
id: "memory-merge-union",
|
|
@@ -4444,6 +4575,7 @@ function _run_checks(project_root, manifest, drift, only = null) {
|
|
|
4444
4575
|
"surface-state": _check_surface_state,
|
|
4445
4576
|
"hook-wiring": _check_hook_wiring,
|
|
4446
4577
|
"stale-orphans": _check_stale_orphans,
|
|
4578
|
+
overrides: () => _check_overrides(project_root),
|
|
4447
4579
|
"rule-scope-drift": () => _check_rule_scope_drift(project_root),
|
|
4448
4580
|
"manifest-integrity": () => _check_manifest_integrity(manifest),
|
|
4449
4581
|
"lockfile-freshness": () => _check_lockfile_freshness(manifest),
|
|
@@ -4511,6 +4643,11 @@ function _run_checks_no_manifest(project_root, bridge_present, only = null) {
|
|
|
4511
4643
|
"surface-state": _check_surface_state,
|
|
4512
4644
|
"hook-wiring": _check_hook_wiring,
|
|
4513
4645
|
"stale-orphans": _check_stale_orphans,
|
|
4646
|
+
// BOTH registries need the id. Registering only the first one crashed with
|
|
4647
|
+
// `runners[cid] is not a function` on a global-only consumer, which is the
|
|
4648
|
+
// path that has no manifest — a loud failure rather than a silent skip, and
|
|
4649
|
+
// worth the comment because the duplication is easy to miss.
|
|
4650
|
+
overrides: () => _check_overrides(project_root),
|
|
4514
4651
|
"rule-scope-drift": () => _check_rule_scope_drift(project_root),
|
|
4515
4652
|
"manifest-integrity": () => _skipped_manifest_check("manifest-integrity"),
|
|
4516
4653
|
"lockfile-freshness": () => _skipped_manifest_check("lockfile-freshness"),
|
|
@@ -4808,7 +4945,7 @@ function _run_anatomy(opts) {
|
|
|
4808
4945
|
try {
|
|
4809
4946
|
economyReport = economy.buildReport({
|
|
4810
4947
|
root: economy.DEFAULT_PROJECTS_ROOT,
|
|
4811
|
-
auditDir:
|
|
4948
|
+
auditDir: path15.join(process2.cwd(), economy.DEFAULT_AUDIT_DIR),
|
|
4812
4949
|
maxAgeDays: 14
|
|
4813
4950
|
});
|
|
4814
4951
|
} catch (err) {
|
|
@@ -4847,7 +4984,7 @@ function _run_repair(opts) {
|
|
|
4847
4984
|
};
|
|
4848
4985
|
if (exists2) {
|
|
4849
4986
|
try {
|
|
4850
|
-
|
|
4987
|
+
fs11.unlinkSync(state_pth);
|
|
4851
4988
|
} catch (exc) {
|
|
4852
4989
|
payload["action"] = "error";
|
|
4853
4990
|
payload["error"] = osErrorStr(exc);
|
|
@@ -4951,17 +5088,17 @@ function _isCliEntry2() {
|
|
|
4951
5088
|
return false;
|
|
4952
5089
|
}
|
|
4953
5090
|
if (cliDelegate) {
|
|
4954
|
-
if (
|
|
5091
|
+
if (path15.basename(process2.argv[1], ".js") === "cmd_doctor") {
|
|
4955
5092
|
return true;
|
|
4956
5093
|
}
|
|
4957
5094
|
}
|
|
4958
|
-
const argvUrl = pathToFileURL4(
|
|
5095
|
+
const argvUrl = pathToFileURL4(path15.resolve(process2.argv[1])).href;
|
|
4959
5096
|
if (import.meta.url === argvUrl) {
|
|
4960
5097
|
return true;
|
|
4961
5098
|
}
|
|
4962
5099
|
try {
|
|
4963
|
-
const here =
|
|
4964
|
-
const argv =
|
|
5100
|
+
const here = fs11.realpathSync(fileURLToPath5(import.meta.url));
|
|
5101
|
+
const argv = fs11.realpathSync(path15.resolve(process2.argv[1]));
|
|
4965
5102
|
return here === argv;
|
|
4966
5103
|
} catch {
|
|
4967
5104
|
return false;
|
|
@@ -4985,6 +5122,8 @@ export {
|
|
|
4985
5122
|
proseEqual,
|
|
4986
5123
|
frontmatterPaths,
|
|
4987
5124
|
censusRuleDir,
|
|
5125
|
+
INSTALL_MODE_MARKER_RELATIVE,
|
|
5126
|
+
_is_global_only_consumer,
|
|
4988
5127
|
ArgparseExit,
|
|
4989
5128
|
_jsonDumpsIndentAscii,
|
|
4990
5129
|
NO_FRONTMATTER,
|
|
@@ -5002,8 +5141,6 @@ export {
|
|
|
5002
5141
|
CHECK_IDS,
|
|
5003
5142
|
GLOBAL_CHECK_IDS,
|
|
5004
5143
|
MANIFEST_REQUIRED_CHECK_IDS,
|
|
5005
|
-
INSTALL_MODE_MARKER_RELATIVE,
|
|
5006
|
-
_is_global_only_consumer,
|
|
5007
5144
|
REPAIR_IDS,
|
|
5008
5145
|
MCP_BETA_GATES,
|
|
5009
5146
|
STATUS_SYMBOLS,
|