@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
package/dist/install/install.mjs
CHANGED
|
@@ -117,17 +117,17 @@ var require_visit = __commonJS({
|
|
|
117
117
|
visit.BREAK = BREAK;
|
|
118
118
|
visit.SKIP = SKIP;
|
|
119
119
|
visit.REMOVE = REMOVE;
|
|
120
|
-
function visit_(key, node, visitor,
|
|
121
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
120
|
+
function visit_(key, node, visitor, path20) {
|
|
121
|
+
const ctrl = callVisitor(key, node, visitor, path20);
|
|
122
122
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
123
|
-
replaceNode(key,
|
|
124
|
-
return visit_(key, ctrl, visitor,
|
|
123
|
+
replaceNode(key, path20, ctrl);
|
|
124
|
+
return visit_(key, ctrl, visitor, path20);
|
|
125
125
|
}
|
|
126
126
|
if (typeof ctrl !== "symbol") {
|
|
127
127
|
if (identity.isCollection(node)) {
|
|
128
|
-
|
|
128
|
+
path20 = Object.freeze(path20.concat(node));
|
|
129
129
|
for (let i = 0; i < node.items.length; ++i) {
|
|
130
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
130
|
+
const ci = visit_(i, node.items[i], visitor, path20);
|
|
131
131
|
if (typeof ci === "number")
|
|
132
132
|
i = ci - 1;
|
|
133
133
|
else if (ci === BREAK)
|
|
@@ -138,13 +138,13 @@ var require_visit = __commonJS({
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
} else if (identity.isPair(node)) {
|
|
141
|
-
|
|
142
|
-
const ck = visit_("key", node.key, visitor,
|
|
141
|
+
path20 = Object.freeze(path20.concat(node));
|
|
142
|
+
const ck = visit_("key", node.key, visitor, path20);
|
|
143
143
|
if (ck === BREAK)
|
|
144
144
|
return BREAK;
|
|
145
145
|
else if (ck === REMOVE)
|
|
146
146
|
node.key = null;
|
|
147
|
-
const cv = visit_("value", node.value, visitor,
|
|
147
|
+
const cv = visit_("value", node.value, visitor, path20);
|
|
148
148
|
if (cv === BREAK)
|
|
149
149
|
return BREAK;
|
|
150
150
|
else if (cv === REMOVE)
|
|
@@ -165,17 +165,17 @@ var require_visit = __commonJS({
|
|
|
165
165
|
visitAsync.BREAK = BREAK;
|
|
166
166
|
visitAsync.SKIP = SKIP;
|
|
167
167
|
visitAsync.REMOVE = REMOVE;
|
|
168
|
-
async function visitAsync_(key, node, visitor,
|
|
169
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
168
|
+
async function visitAsync_(key, node, visitor, path20) {
|
|
169
|
+
const ctrl = await callVisitor(key, node, visitor, path20);
|
|
170
170
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
171
|
-
replaceNode(key,
|
|
172
|
-
return visitAsync_(key, ctrl, visitor,
|
|
171
|
+
replaceNode(key, path20, ctrl);
|
|
172
|
+
return visitAsync_(key, ctrl, visitor, path20);
|
|
173
173
|
}
|
|
174
174
|
if (typeof ctrl !== "symbol") {
|
|
175
175
|
if (identity.isCollection(node)) {
|
|
176
|
-
|
|
176
|
+
path20 = Object.freeze(path20.concat(node));
|
|
177
177
|
for (let i = 0; i < node.items.length; ++i) {
|
|
178
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
178
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path20);
|
|
179
179
|
if (typeof ci === "number")
|
|
180
180
|
i = ci - 1;
|
|
181
181
|
else if (ci === BREAK)
|
|
@@ -186,13 +186,13 @@ var require_visit = __commonJS({
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
} else if (identity.isPair(node)) {
|
|
189
|
-
|
|
190
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
189
|
+
path20 = Object.freeze(path20.concat(node));
|
|
190
|
+
const ck = await visitAsync_("key", node.key, visitor, path20);
|
|
191
191
|
if (ck === BREAK)
|
|
192
192
|
return BREAK;
|
|
193
193
|
else if (ck === REMOVE)
|
|
194
194
|
node.key = null;
|
|
195
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
195
|
+
const cv = await visitAsync_("value", node.value, visitor, path20);
|
|
196
196
|
if (cv === BREAK)
|
|
197
197
|
return BREAK;
|
|
198
198
|
else if (cv === REMOVE)
|
|
@@ -219,23 +219,23 @@ var require_visit = __commonJS({
|
|
|
219
219
|
}
|
|
220
220
|
return visitor;
|
|
221
221
|
}
|
|
222
|
-
function callVisitor(key, node, visitor,
|
|
222
|
+
function callVisitor(key, node, visitor, path20) {
|
|
223
223
|
if (typeof visitor === "function")
|
|
224
|
-
return visitor(key, node,
|
|
224
|
+
return visitor(key, node, path20);
|
|
225
225
|
if (identity.isMap(node))
|
|
226
|
-
return visitor.Map?.(key, node,
|
|
226
|
+
return visitor.Map?.(key, node, path20);
|
|
227
227
|
if (identity.isSeq(node))
|
|
228
|
-
return visitor.Seq?.(key, node,
|
|
228
|
+
return visitor.Seq?.(key, node, path20);
|
|
229
229
|
if (identity.isPair(node))
|
|
230
|
-
return visitor.Pair?.(key, node,
|
|
230
|
+
return visitor.Pair?.(key, node, path20);
|
|
231
231
|
if (identity.isScalar(node))
|
|
232
|
-
return visitor.Scalar?.(key, node,
|
|
232
|
+
return visitor.Scalar?.(key, node, path20);
|
|
233
233
|
if (identity.isAlias(node))
|
|
234
|
-
return visitor.Alias?.(key, node,
|
|
234
|
+
return visitor.Alias?.(key, node, path20);
|
|
235
235
|
return void 0;
|
|
236
236
|
}
|
|
237
|
-
function replaceNode(key,
|
|
238
|
-
const parent =
|
|
237
|
+
function replaceNode(key, path20, node) {
|
|
238
|
+
const parent = path20[path20.length - 1];
|
|
239
239
|
if (identity.isCollection(parent)) {
|
|
240
240
|
parent.items[key] = node;
|
|
241
241
|
} else if (identity.isPair(parent)) {
|
|
@@ -845,10 +845,10 @@ var require_Collection = __commonJS({
|
|
|
845
845
|
var createNode = require_createNode();
|
|
846
846
|
var identity = require_identity();
|
|
847
847
|
var Node = require_Node();
|
|
848
|
-
function collectionFromPath(schema,
|
|
848
|
+
function collectionFromPath(schema, path20, value) {
|
|
849
849
|
let v = value;
|
|
850
|
-
for (let i =
|
|
851
|
-
const k =
|
|
850
|
+
for (let i = path20.length - 1; i >= 0; --i) {
|
|
851
|
+
const k = path20[i];
|
|
852
852
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
853
853
|
const a = [];
|
|
854
854
|
a[k] = v;
|
|
@@ -867,7 +867,7 @@ var require_Collection = __commonJS({
|
|
|
867
867
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
868
868
|
});
|
|
869
869
|
}
|
|
870
|
-
var isEmptyPath = (
|
|
870
|
+
var isEmptyPath = (path20) => path20 == null || typeof path20 === "object" && !!path20[Symbol.iterator]().next().done;
|
|
871
871
|
var Collection = class extends Node.NodeBase {
|
|
872
872
|
constructor(type, schema) {
|
|
873
873
|
super(type);
|
|
@@ -897,11 +897,11 @@ var require_Collection = __commonJS({
|
|
|
897
897
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
898
898
|
* that already exists in the map.
|
|
899
899
|
*/
|
|
900
|
-
addIn(
|
|
901
|
-
if (isEmptyPath(
|
|
900
|
+
addIn(path20, value) {
|
|
901
|
+
if (isEmptyPath(path20))
|
|
902
902
|
this.add(value);
|
|
903
903
|
else {
|
|
904
|
-
const [key, ...rest] =
|
|
904
|
+
const [key, ...rest] = path20;
|
|
905
905
|
const node = this.get(key, true);
|
|
906
906
|
if (identity.isCollection(node))
|
|
907
907
|
node.addIn(rest, value);
|
|
@@ -915,8 +915,8 @@ var require_Collection = __commonJS({
|
|
|
915
915
|
* Removes a value from the collection.
|
|
916
916
|
* @returns `true` if the item was found and removed.
|
|
917
917
|
*/
|
|
918
|
-
deleteIn(
|
|
919
|
-
const [key, ...rest] =
|
|
918
|
+
deleteIn(path20) {
|
|
919
|
+
const [key, ...rest] = path20;
|
|
920
920
|
if (rest.length === 0)
|
|
921
921
|
return this.delete(key);
|
|
922
922
|
const node = this.get(key, true);
|
|
@@ -930,8 +930,8 @@ var require_Collection = __commonJS({
|
|
|
930
930
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
931
931
|
* `true` (collections are always returned intact).
|
|
932
932
|
*/
|
|
933
|
-
getIn(
|
|
934
|
-
const [key, ...rest] =
|
|
933
|
+
getIn(path20, keepScalar) {
|
|
934
|
+
const [key, ...rest] = path20;
|
|
935
935
|
const node = this.get(key, true);
|
|
936
936
|
if (rest.length === 0)
|
|
937
937
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -949,8 +949,8 @@ var require_Collection = __commonJS({
|
|
|
949
949
|
/**
|
|
950
950
|
* Checks if the collection includes a value with the key `key`.
|
|
951
951
|
*/
|
|
952
|
-
hasIn(
|
|
953
|
-
const [key, ...rest] =
|
|
952
|
+
hasIn(path20) {
|
|
953
|
+
const [key, ...rest] = path20;
|
|
954
954
|
if (rest.length === 0)
|
|
955
955
|
return this.has(key);
|
|
956
956
|
const node = this.get(key, true);
|
|
@@ -960,8 +960,8 @@ var require_Collection = __commonJS({
|
|
|
960
960
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
961
961
|
* boolean to add/remove the item from the set.
|
|
962
962
|
*/
|
|
963
|
-
setIn(
|
|
964
|
-
const [key, ...rest] =
|
|
963
|
+
setIn(path20, value) {
|
|
964
|
+
const [key, ...rest] = path20;
|
|
965
965
|
if (rest.length === 0) {
|
|
966
966
|
this.set(key, value);
|
|
967
967
|
} else {
|
|
@@ -3476,9 +3476,9 @@ var require_Document = __commonJS({
|
|
|
3476
3476
|
this.contents.add(value);
|
|
3477
3477
|
}
|
|
3478
3478
|
/** Adds a value to the document. */
|
|
3479
|
-
addIn(
|
|
3479
|
+
addIn(path20, value) {
|
|
3480
3480
|
if (assertCollection(this.contents))
|
|
3481
|
-
this.contents.addIn(
|
|
3481
|
+
this.contents.addIn(path20, value);
|
|
3482
3482
|
}
|
|
3483
3483
|
/**
|
|
3484
3484
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3553,14 +3553,14 @@ var require_Document = __commonJS({
|
|
|
3553
3553
|
* Removes a value from the document.
|
|
3554
3554
|
* @returns `true` if the item was found and removed.
|
|
3555
3555
|
*/
|
|
3556
|
-
deleteIn(
|
|
3557
|
-
if (Collection.isEmptyPath(
|
|
3556
|
+
deleteIn(path20) {
|
|
3557
|
+
if (Collection.isEmptyPath(path20)) {
|
|
3558
3558
|
if (this.contents == null)
|
|
3559
3559
|
return false;
|
|
3560
3560
|
this.contents = null;
|
|
3561
3561
|
return true;
|
|
3562
3562
|
}
|
|
3563
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3563
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path20) : false;
|
|
3564
3564
|
}
|
|
3565
3565
|
/**
|
|
3566
3566
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3575,10 +3575,10 @@ var require_Document = __commonJS({
|
|
|
3575
3575
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3576
3576
|
* `true` (collections are always returned intact).
|
|
3577
3577
|
*/
|
|
3578
|
-
getIn(
|
|
3579
|
-
if (Collection.isEmptyPath(
|
|
3578
|
+
getIn(path20, keepScalar) {
|
|
3579
|
+
if (Collection.isEmptyPath(path20))
|
|
3580
3580
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3581
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3581
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path20, keepScalar) : void 0;
|
|
3582
3582
|
}
|
|
3583
3583
|
/**
|
|
3584
3584
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3589,10 +3589,10 @@ var require_Document = __commonJS({
|
|
|
3589
3589
|
/**
|
|
3590
3590
|
* Checks if the document includes a value at `path`.
|
|
3591
3591
|
*/
|
|
3592
|
-
hasIn(
|
|
3593
|
-
if (Collection.isEmptyPath(
|
|
3592
|
+
hasIn(path20) {
|
|
3593
|
+
if (Collection.isEmptyPath(path20))
|
|
3594
3594
|
return this.contents !== void 0;
|
|
3595
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3595
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path20) : false;
|
|
3596
3596
|
}
|
|
3597
3597
|
/**
|
|
3598
3598
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3609,13 +3609,13 @@ var require_Document = __commonJS({
|
|
|
3609
3609
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3610
3610
|
* boolean to add/remove the item from the set.
|
|
3611
3611
|
*/
|
|
3612
|
-
setIn(
|
|
3613
|
-
if (Collection.isEmptyPath(
|
|
3612
|
+
setIn(path20, value) {
|
|
3613
|
+
if (Collection.isEmptyPath(path20)) {
|
|
3614
3614
|
this.contents = value;
|
|
3615
3615
|
} else if (this.contents == null) {
|
|
3616
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3616
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path20), value);
|
|
3617
3617
|
} else if (assertCollection(this.contents)) {
|
|
3618
|
-
this.contents.setIn(
|
|
3618
|
+
this.contents.setIn(path20, value);
|
|
3619
3619
|
}
|
|
3620
3620
|
}
|
|
3621
3621
|
/**
|
|
@@ -4001,10 +4001,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
4001
4001
|
let offset = bm.offset;
|
|
4002
4002
|
let commentEnd = null;
|
|
4003
4003
|
for (const collItem of bm.items) {
|
|
4004
|
-
const { start, key, sep:
|
|
4004
|
+
const { start, key, sep: sep6, value } = collItem;
|
|
4005
4005
|
const keyProps = resolveProps.resolveProps(start, {
|
|
4006
4006
|
indicator: "explicit-key-ind",
|
|
4007
|
-
next: key ??
|
|
4007
|
+
next: key ?? sep6?.[0],
|
|
4008
4008
|
offset,
|
|
4009
4009
|
onError,
|
|
4010
4010
|
parentIndent: bm.indent,
|
|
@@ -4018,7 +4018,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4018
4018
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
4019
4019
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
4020
4020
|
}
|
|
4021
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
4021
|
+
if (!keyProps.anchor && !keyProps.tag && !sep6) {
|
|
4022
4022
|
commentEnd = keyProps.end;
|
|
4023
4023
|
if (keyProps.comment) {
|
|
4024
4024
|
if (map.comment)
|
|
@@ -4042,7 +4042,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4042
4042
|
ctx.atKey = false;
|
|
4043
4043
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
4044
4044
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4045
|
-
const valueProps = resolveProps.resolveProps(
|
|
4045
|
+
const valueProps = resolveProps.resolveProps(sep6 ?? [], {
|
|
4046
4046
|
indicator: "map-value-ind",
|
|
4047
4047
|
next: value,
|
|
4048
4048
|
offset: keyNode.range[2],
|
|
@@ -4058,7 +4058,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
4058
4058
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
4059
4059
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
4060
4060
|
}
|
|
4061
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
4061
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep6, null, valueProps, onError);
|
|
4062
4062
|
if (ctx.schema.compat)
|
|
4063
4063
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
4064
4064
|
offset = valueNode.range[2];
|
|
@@ -4149,7 +4149,7 @@ var require_resolve_end = __commonJS({
|
|
|
4149
4149
|
let comment = "";
|
|
4150
4150
|
if (end) {
|
|
4151
4151
|
let hasSpace = false;
|
|
4152
|
-
let
|
|
4152
|
+
let sep6 = "";
|
|
4153
4153
|
for (const token of end) {
|
|
4154
4154
|
const { source, type } = token;
|
|
4155
4155
|
switch (type) {
|
|
@@ -4163,13 +4163,13 @@ var require_resolve_end = __commonJS({
|
|
|
4163
4163
|
if (!comment)
|
|
4164
4164
|
comment = cb;
|
|
4165
4165
|
else
|
|
4166
|
-
comment +=
|
|
4167
|
-
|
|
4166
|
+
comment += sep6 + cb;
|
|
4167
|
+
sep6 = "";
|
|
4168
4168
|
break;
|
|
4169
4169
|
}
|
|
4170
4170
|
case "newline":
|
|
4171
4171
|
if (comment)
|
|
4172
|
-
|
|
4172
|
+
sep6 += source;
|
|
4173
4173
|
hasSpace = true;
|
|
4174
4174
|
break;
|
|
4175
4175
|
default:
|
|
@@ -4212,18 +4212,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4212
4212
|
let offset = fc.offset + fc.start.source.length;
|
|
4213
4213
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
4214
4214
|
const collItem = fc.items[i];
|
|
4215
|
-
const { start, key, sep:
|
|
4215
|
+
const { start, key, sep: sep6, value } = collItem;
|
|
4216
4216
|
const props = resolveProps.resolveProps(start, {
|
|
4217
4217
|
flow: fcName,
|
|
4218
4218
|
indicator: "explicit-key-ind",
|
|
4219
|
-
next: key ??
|
|
4219
|
+
next: key ?? sep6?.[0],
|
|
4220
4220
|
offset,
|
|
4221
4221
|
onError,
|
|
4222
4222
|
parentIndent: fc.indent,
|
|
4223
4223
|
startOnNewline: false
|
|
4224
4224
|
});
|
|
4225
4225
|
if (!props.found) {
|
|
4226
|
-
if (!props.anchor && !props.tag && !
|
|
4226
|
+
if (!props.anchor && !props.tag && !sep6 && !value) {
|
|
4227
4227
|
if (i === 0 && props.comma)
|
|
4228
4228
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
4229
4229
|
else if (i < fc.items.length - 1)
|
|
@@ -4277,8 +4277,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4277
4277
|
}
|
|
4278
4278
|
}
|
|
4279
4279
|
}
|
|
4280
|
-
if (!isMap && !
|
|
4281
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
4280
|
+
if (!isMap && !sep6 && !props.found) {
|
|
4281
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep6, null, props, onError);
|
|
4282
4282
|
coll.items.push(valueNode);
|
|
4283
4283
|
offset = valueNode.range[2];
|
|
4284
4284
|
if (isBlock(value))
|
|
@@ -4290,7 +4290,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4290
4290
|
if (isBlock(key))
|
|
4291
4291
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
4292
4292
|
ctx.atKey = false;
|
|
4293
|
-
const valueProps = resolveProps.resolveProps(
|
|
4293
|
+
const valueProps = resolveProps.resolveProps(sep6 ?? [], {
|
|
4294
4294
|
flow: fcName,
|
|
4295
4295
|
indicator: "map-value-ind",
|
|
4296
4296
|
next: value,
|
|
@@ -4301,8 +4301,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4301
4301
|
});
|
|
4302
4302
|
if (valueProps.found) {
|
|
4303
4303
|
if (!isMap && !props.found && ctx.options.strict) {
|
|
4304
|
-
if (
|
|
4305
|
-
for (const st of
|
|
4304
|
+
if (sep6)
|
|
4305
|
+
for (const st of sep6) {
|
|
4306
4306
|
if (st === valueProps.found)
|
|
4307
4307
|
break;
|
|
4308
4308
|
if (st.type === "newline") {
|
|
@@ -4319,7 +4319,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4319
4319
|
else
|
|
4320
4320
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
4321
4321
|
}
|
|
4322
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
4322
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep6, null, valueProps, onError) : null;
|
|
4323
4323
|
if (valueNode) {
|
|
4324
4324
|
if (isBlock(value))
|
|
4325
4325
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -4499,7 +4499,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4499
4499
|
chompStart = i + 1;
|
|
4500
4500
|
}
|
|
4501
4501
|
let value = "";
|
|
4502
|
-
let
|
|
4502
|
+
let sep6 = "";
|
|
4503
4503
|
let prevMoreIndented = false;
|
|
4504
4504
|
for (let i = 0; i < contentStart; ++i)
|
|
4505
4505
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -4516,24 +4516,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
4516
4516
|
indent = "";
|
|
4517
4517
|
}
|
|
4518
4518
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
4519
|
-
value +=
|
|
4520
|
-
|
|
4519
|
+
value += sep6 + indent.slice(trimIndent) + content;
|
|
4520
|
+
sep6 = "\n";
|
|
4521
4521
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
4522
|
-
if (
|
|
4523
|
-
|
|
4524
|
-
else if (!prevMoreIndented &&
|
|
4525
|
-
|
|
4526
|
-
value +=
|
|
4527
|
-
|
|
4522
|
+
if (sep6 === " ")
|
|
4523
|
+
sep6 = "\n";
|
|
4524
|
+
else if (!prevMoreIndented && sep6 === "\n")
|
|
4525
|
+
sep6 = "\n\n";
|
|
4526
|
+
value += sep6 + indent.slice(trimIndent) + content;
|
|
4527
|
+
sep6 = "\n";
|
|
4528
4528
|
prevMoreIndented = true;
|
|
4529
4529
|
} else if (content === "") {
|
|
4530
|
-
if (
|
|
4530
|
+
if (sep6 === "\n")
|
|
4531
4531
|
value += "\n";
|
|
4532
4532
|
else
|
|
4533
|
-
|
|
4533
|
+
sep6 = "\n";
|
|
4534
4534
|
} else {
|
|
4535
|
-
value +=
|
|
4536
|
-
|
|
4535
|
+
value += sep6 + content;
|
|
4536
|
+
sep6 = " ";
|
|
4537
4537
|
prevMoreIndented = false;
|
|
4538
4538
|
}
|
|
4539
4539
|
}
|
|
@@ -4715,25 +4715,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
4715
4715
|
if (!match)
|
|
4716
4716
|
return source;
|
|
4717
4717
|
let res = match[1];
|
|
4718
|
-
let
|
|
4718
|
+
let sep6 = " ";
|
|
4719
4719
|
let pos = first.lastIndex;
|
|
4720
4720
|
line.lastIndex = pos;
|
|
4721
4721
|
while (match = line.exec(source)) {
|
|
4722
4722
|
if (match[1] === "") {
|
|
4723
|
-
if (
|
|
4724
|
-
res +=
|
|
4723
|
+
if (sep6 === "\n")
|
|
4724
|
+
res += sep6;
|
|
4725
4725
|
else
|
|
4726
|
-
|
|
4726
|
+
sep6 = "\n";
|
|
4727
4727
|
} else {
|
|
4728
|
-
res +=
|
|
4729
|
-
|
|
4728
|
+
res += sep6 + match[1];
|
|
4729
|
+
sep6 = " ";
|
|
4730
4730
|
}
|
|
4731
4731
|
pos = line.lastIndex;
|
|
4732
4732
|
}
|
|
4733
4733
|
const last = /[ \t]*(.*)/sy;
|
|
4734
4734
|
last.lastIndex = pos;
|
|
4735
4735
|
match = last.exec(source);
|
|
4736
|
-
return res +
|
|
4736
|
+
return res + sep6 + (match?.[1] ?? "");
|
|
4737
4737
|
}
|
|
4738
4738
|
function doubleQuotedValue(source, onError) {
|
|
4739
4739
|
let res = "";
|
|
@@ -5543,14 +5543,14 @@ var require_cst_stringify = __commonJS({
|
|
|
5543
5543
|
}
|
|
5544
5544
|
}
|
|
5545
5545
|
}
|
|
5546
|
-
function stringifyItem({ start, key, sep:
|
|
5546
|
+
function stringifyItem({ start, key, sep: sep6, value }) {
|
|
5547
5547
|
let res = "";
|
|
5548
5548
|
for (const st of start)
|
|
5549
5549
|
res += st.source;
|
|
5550
5550
|
if (key)
|
|
5551
5551
|
res += stringifyToken(key);
|
|
5552
|
-
if (
|
|
5553
|
-
for (const st of
|
|
5552
|
+
if (sep6)
|
|
5553
|
+
for (const st of sep6)
|
|
5554
5554
|
res += st.source;
|
|
5555
5555
|
if (value)
|
|
5556
5556
|
res += stringifyToken(value);
|
|
@@ -5575,9 +5575,9 @@ var require_cst_visit = __commonJS({
|
|
|
5575
5575
|
visit.BREAK = BREAK;
|
|
5576
5576
|
visit.SKIP = SKIP;
|
|
5577
5577
|
visit.REMOVE = REMOVE;
|
|
5578
|
-
visit.itemAtPath = (cst,
|
|
5578
|
+
visit.itemAtPath = (cst, path20) => {
|
|
5579
5579
|
let item = cst;
|
|
5580
|
-
for (const [field, index] of
|
|
5580
|
+
for (const [field, index] of path20) {
|
|
5581
5581
|
const tok = item?.[field];
|
|
5582
5582
|
if (tok && "items" in tok) {
|
|
5583
5583
|
item = tok.items[index];
|
|
@@ -5586,23 +5586,23 @@ var require_cst_visit = __commonJS({
|
|
|
5586
5586
|
}
|
|
5587
5587
|
return item;
|
|
5588
5588
|
};
|
|
5589
|
-
visit.parentCollection = (cst,
|
|
5590
|
-
const parent = visit.itemAtPath(cst,
|
|
5591
|
-
const field =
|
|
5589
|
+
visit.parentCollection = (cst, path20) => {
|
|
5590
|
+
const parent = visit.itemAtPath(cst, path20.slice(0, -1));
|
|
5591
|
+
const field = path20[path20.length - 1][0];
|
|
5592
5592
|
const coll = parent?.[field];
|
|
5593
5593
|
if (coll && "items" in coll)
|
|
5594
5594
|
return coll;
|
|
5595
5595
|
throw new Error("Parent collection not found");
|
|
5596
5596
|
};
|
|
5597
|
-
function _visit(
|
|
5598
|
-
let ctrl = visitor(item,
|
|
5597
|
+
function _visit(path20, item, visitor) {
|
|
5598
|
+
let ctrl = visitor(item, path20);
|
|
5599
5599
|
if (typeof ctrl === "symbol")
|
|
5600
5600
|
return ctrl;
|
|
5601
5601
|
for (const field of ["key", "value"]) {
|
|
5602
5602
|
const token = item[field];
|
|
5603
5603
|
if (token && "items" in token) {
|
|
5604
5604
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5605
|
-
const ci = _visit(Object.freeze(
|
|
5605
|
+
const ci = _visit(Object.freeze(path20.concat([[field, i]])), token.items[i], visitor);
|
|
5606
5606
|
if (typeof ci === "number")
|
|
5607
5607
|
i = ci - 1;
|
|
5608
5608
|
else if (ci === BREAK)
|
|
@@ -5613,10 +5613,10 @@ var require_cst_visit = __commonJS({
|
|
|
5613
5613
|
}
|
|
5614
5614
|
}
|
|
5615
5615
|
if (typeof ctrl === "function" && field === "key")
|
|
5616
|
-
ctrl = ctrl(item,
|
|
5616
|
+
ctrl = ctrl(item, path20);
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5619
|
+
return typeof ctrl === "function" ? ctrl(item, path20) : ctrl;
|
|
5620
5620
|
}
|
|
5621
5621
|
exports.visit = visit;
|
|
5622
5622
|
}
|
|
@@ -6717,18 +6717,18 @@ var require_parser = __commonJS({
|
|
|
6717
6717
|
if (this.type === "map-value-ind") {
|
|
6718
6718
|
const prev = getPrevProps(this.peek(2));
|
|
6719
6719
|
const start = getFirstKeyStartProps(prev);
|
|
6720
|
-
let
|
|
6720
|
+
let sep6;
|
|
6721
6721
|
if (scalar.end) {
|
|
6722
|
-
|
|
6723
|
-
|
|
6722
|
+
sep6 = scalar.end;
|
|
6723
|
+
sep6.push(this.sourceToken);
|
|
6724
6724
|
delete scalar.end;
|
|
6725
6725
|
} else
|
|
6726
|
-
|
|
6726
|
+
sep6 = [this.sourceToken];
|
|
6727
6727
|
const map = {
|
|
6728
6728
|
type: "block-map",
|
|
6729
6729
|
offset: scalar.offset,
|
|
6730
6730
|
indent: scalar.indent,
|
|
6731
|
-
items: [{ start, key: scalar, sep:
|
|
6731
|
+
items: [{ start, key: scalar, sep: sep6 }]
|
|
6732
6732
|
};
|
|
6733
6733
|
this.onKeyLine = true;
|
|
6734
6734
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -6881,15 +6881,15 @@ var require_parser = __commonJS({
|
|
|
6881
6881
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
6882
6882
|
const start2 = getFirstKeyStartProps(it.start);
|
|
6883
6883
|
const key = it.key;
|
|
6884
|
-
const
|
|
6885
|
-
|
|
6884
|
+
const sep6 = it.sep;
|
|
6885
|
+
sep6.push(this.sourceToken);
|
|
6886
6886
|
delete it.key;
|
|
6887
6887
|
delete it.sep;
|
|
6888
6888
|
this.stack.push({
|
|
6889
6889
|
type: "block-map",
|
|
6890
6890
|
offset: this.offset,
|
|
6891
6891
|
indent: this.indent,
|
|
6892
|
-
items: [{ start: start2, key, sep:
|
|
6892
|
+
items: [{ start: start2, key, sep: sep6 }]
|
|
6893
6893
|
});
|
|
6894
6894
|
} else if (start.length > 0) {
|
|
6895
6895
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -6918,14 +6918,14 @@ var require_parser = __commonJS({
|
|
|
6918
6918
|
case "scalar":
|
|
6919
6919
|
case "single-quoted-scalar":
|
|
6920
6920
|
case "double-quoted-scalar": {
|
|
6921
|
-
const
|
|
6921
|
+
const fs23 = this.flowScalar(this.type);
|
|
6922
6922
|
if (atNextItem || it.value) {
|
|
6923
|
-
map.items.push({ start, key:
|
|
6923
|
+
map.items.push({ start, key: fs23, sep: [] });
|
|
6924
6924
|
this.onKeyLine = true;
|
|
6925
6925
|
} else if (it.sep) {
|
|
6926
|
-
this.stack.push(
|
|
6926
|
+
this.stack.push(fs23);
|
|
6927
6927
|
} else {
|
|
6928
|
-
Object.assign(it, { key:
|
|
6928
|
+
Object.assign(it, { key: fs23, sep: [] });
|
|
6929
6929
|
this.onKeyLine = true;
|
|
6930
6930
|
}
|
|
6931
6931
|
return;
|
|
@@ -7053,13 +7053,13 @@ var require_parser = __commonJS({
|
|
|
7053
7053
|
case "scalar":
|
|
7054
7054
|
case "single-quoted-scalar":
|
|
7055
7055
|
case "double-quoted-scalar": {
|
|
7056
|
-
const
|
|
7056
|
+
const fs23 = this.flowScalar(this.type);
|
|
7057
7057
|
if (!it || it.value)
|
|
7058
|
-
fc.items.push({ start: [], key:
|
|
7058
|
+
fc.items.push({ start: [], key: fs23, sep: [] });
|
|
7059
7059
|
else if (it.sep)
|
|
7060
|
-
this.stack.push(
|
|
7060
|
+
this.stack.push(fs23);
|
|
7061
7061
|
else
|
|
7062
|
-
Object.assign(it, { key:
|
|
7062
|
+
Object.assign(it, { key: fs23, sep: [] });
|
|
7063
7063
|
return;
|
|
7064
7064
|
}
|
|
7065
7065
|
case "flow-map-end":
|
|
@@ -7083,13 +7083,13 @@ var require_parser = __commonJS({
|
|
|
7083
7083
|
const prev = getPrevProps(parent);
|
|
7084
7084
|
const start = getFirstKeyStartProps(prev);
|
|
7085
7085
|
fixFlowSeqItems(fc);
|
|
7086
|
-
const
|
|
7087
|
-
|
|
7086
|
+
const sep6 = fc.end.splice(1, fc.end.length);
|
|
7087
|
+
sep6.push(this.sourceToken);
|
|
7088
7088
|
const map = {
|
|
7089
7089
|
type: "block-map",
|
|
7090
7090
|
offset: fc.offset,
|
|
7091
7091
|
indent: fc.indent,
|
|
7092
|
-
items: [{ start, key: fc, sep:
|
|
7092
|
+
items: [{ start, key: fc, sep: sep6 }]
|
|
7093
7093
|
};
|
|
7094
7094
|
this.onKeyLine = true;
|
|
7095
7095
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -7370,9 +7370,9 @@ var require_dist = __commonJS({
|
|
|
7370
7370
|
// src/scripts/install.ts
|
|
7371
7371
|
import { spawn, spawnSync as spawnSync2 } from "node:child_process";
|
|
7372
7372
|
import * as crypto3 from "node:crypto";
|
|
7373
|
-
import * as
|
|
7373
|
+
import * as fs22 from "node:fs";
|
|
7374
7374
|
import * as os8 from "node:os";
|
|
7375
|
-
import * as
|
|
7375
|
+
import * as path19 from "node:path";
|
|
7376
7376
|
import process3 from "node:process";
|
|
7377
7377
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
7378
7378
|
|
|
@@ -7873,8 +7873,8 @@ function lockfile_write_path(env) {
|
|
|
7873
7873
|
}
|
|
7874
7874
|
return write_target("installed.lock", { env: env ?? null });
|
|
7875
7875
|
}
|
|
7876
|
-
function read_lockfile(
|
|
7877
|
-
const target =
|
|
7876
|
+
function read_lockfile(path20) {
|
|
7877
|
+
const target = path20 ?? lockfile_path();
|
|
7878
7878
|
let text;
|
|
7879
7879
|
try {
|
|
7880
7880
|
text = fs2.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -8127,21 +8127,78 @@ function current_package_version(repo_root) {
|
|
|
8127
8127
|
return _find_package_version_upward(here) ?? "0.0.0";
|
|
8128
8128
|
}
|
|
8129
8129
|
|
|
8130
|
+
// src/scripts/_lib/mcp_bridge.ts
|
|
8131
|
+
import * as fs3 from "node:fs";
|
|
8132
|
+
import * as path3 from "node:path";
|
|
8133
|
+
var MCP_SERVER_KEY = "agent-config";
|
|
8134
|
+
var MCP_BRIDGE_ENTRY = {
|
|
8135
|
+
mcpServers: {
|
|
8136
|
+
[MCP_SERVER_KEY]: {
|
|
8137
|
+
command: "npx",
|
|
8138
|
+
args: ["-y", "@event4u/agent-config", "mcp-server"]
|
|
8139
|
+
}
|
|
8140
|
+
}
|
|
8141
|
+
};
|
|
8142
|
+
function makeEnsureMcpBridge(mergeJsonFile) {
|
|
8143
|
+
return (projectRoot, force) => mergeJsonFile(path3.join(projectRoot, ".mcp.json"), MCP_BRIDGE_ENTRY, force, ".mcp.json");
|
|
8144
|
+
}
|
|
8145
|
+
function projectionModeOf(raw) {
|
|
8146
|
+
return raw === "scoped" ? "scoped" : raw === "tiered" ? "tiered" : "legacy-all";
|
|
8147
|
+
}
|
|
8148
|
+
function resolveTierB(packageRoot) {
|
|
8149
|
+
const p = path3.join(packageRoot, "agents", "runtime", "state", "skill-tiers.json");
|
|
8150
|
+
if (!fs3.existsSync(p)) return null;
|
|
8151
|
+
try {
|
|
8152
|
+
const parsed = JSON.parse(fs3.readFileSync(p, "utf-8"));
|
|
8153
|
+
if (!Array.isArray(parsed.tier_b)) return null;
|
|
8154
|
+
return new Set(parsed.tier_b.filter((n) => typeof n === "string"));
|
|
8155
|
+
} catch {
|
|
8156
|
+
return null;
|
|
8157
|
+
}
|
|
8158
|
+
}
|
|
8159
|
+
function tierBPrunePredicate(tierB) {
|
|
8160
|
+
return (mdPath) => tierB.has(path3.basename(path3.dirname(mdPath)));
|
|
8161
|
+
}
|
|
8162
|
+
function tierBAdvisory(packageRoot) {
|
|
8163
|
+
const tierB = resolveTierB(packageRoot);
|
|
8164
|
+
if (tierB === null || tierB.size === 0) return null;
|
|
8165
|
+
return `\u2139\uFE0F ${tierB.size} skill(s) are predicted to reach the model WITHOUT their description on a default 200k window.
|
|
8166
|
+
Two levers, neither applied for you:
|
|
8167
|
+
\u2022 raise \`skillListingBudgetFraction\` in your Claude Code settings \u2014 restores descriptions at a token cost (100% delivery of this catalogue measures ~13,003 tok)
|
|
8168
|
+
\u2022 or set \`projection.mode: tiered\` to withhold them from the catalogue and reach them via the MCP server instead (opt-in, still unproven \u2014 see docs/mcp-server.md)`;
|
|
8169
|
+
}
|
|
8170
|
+
function applyTieredPrune(deployResults, packageRoot, pruneBy) {
|
|
8171
|
+
const tierB = resolveTierB(packageRoot);
|
|
8172
|
+
if (tierB === null || tierB.size === 0) {
|
|
8173
|
+
return {
|
|
8174
|
+
deployResults,
|
|
8175
|
+
level: "warn",
|
|
8176
|
+
message: "projection.mode: tiered but no skill-tier split exists (agents/runtime/state/skill-tiers.json) \u2014 shipping the full surface. Compute one with `./scripts-run src/scripts/compute_skill_tiers` first."
|
|
8177
|
+
};
|
|
8178
|
+
}
|
|
8179
|
+
const [pruned, adjusted] = pruneBy(deployResults, tierBPrunePredicate(tierB));
|
|
8180
|
+
return {
|
|
8181
|
+
deployResults: adjusted,
|
|
8182
|
+
level: "info",
|
|
8183
|
+
message: `\u{1F9F9} Tiered install: pruned ${pruned} Tier-B skill artefact(s) \u2014 still reachable via the MCP server's suggest_skill_for_task / read_skill. Set projection.mode: legacy-all to restore the full surface.`
|
|
8184
|
+
};
|
|
8185
|
+
}
|
|
8186
|
+
|
|
8130
8187
|
// src/scripts/_lib/scoped_projection.ts
|
|
8131
|
-
import * as
|
|
8188
|
+
import * as fs5 from "node:fs";
|
|
8132
8189
|
import { createRequire } from "node:module";
|
|
8133
|
-
import * as
|
|
8190
|
+
import * as path5 from "node:path";
|
|
8134
8191
|
|
|
8135
8192
|
// src/scripts/_lib/surface_tiers.ts
|
|
8136
|
-
import * as
|
|
8137
|
-
import * as
|
|
8193
|
+
import * as fs4 from "node:fs";
|
|
8194
|
+
import * as path4 from "node:path";
|
|
8138
8195
|
var _LAB_FALLBACK = /* @__PURE__ */ new Set(["ai-video", "ai-image", "fun"]);
|
|
8139
8196
|
function load_lab_pack_ids(repo_root) {
|
|
8140
|
-
const vocab =
|
|
8197
|
+
const vocab = path4.join(repo_root, "src", "config", "discovery", "packs.yml");
|
|
8141
8198
|
const ids = /* @__PURE__ */ new Set();
|
|
8142
8199
|
try {
|
|
8143
8200
|
const YAML3 = require_dist();
|
|
8144
|
-
const data = YAML3.parse(
|
|
8201
|
+
const data = YAML3.parse(fs4.readFileSync(vocab, "utf-8"), { version: "1.1" });
|
|
8145
8202
|
for (const entry of data ?? []) {
|
|
8146
8203
|
if (entry && typeof entry === "object" && !Array.isArray(entry)) {
|
|
8147
8204
|
const rec = entry;
|
|
@@ -8161,7 +8218,7 @@ function load_lab_pack_ids(repo_root) {
|
|
|
8161
8218
|
function frontmatter_packs(md_path) {
|
|
8162
8219
|
let text;
|
|
8163
8220
|
try {
|
|
8164
|
-
text =
|
|
8221
|
+
text = fs4.readFileSync(md_path, "utf-8");
|
|
8165
8222
|
} catch {
|
|
8166
8223
|
return /* @__PURE__ */ new Set();
|
|
8167
8224
|
}
|
|
@@ -8244,10 +8301,10 @@ function yamlSafeLoad(text) {
|
|
|
8244
8301
|
return null;
|
|
8245
8302
|
}
|
|
8246
8303
|
}
|
|
8247
|
-
var PACKS_YML_REL =
|
|
8304
|
+
var PACKS_YML_REL = path5.join("src", "config", "discovery", "packs.yml");
|
|
8248
8305
|
function load_packs_registry(package_root) {
|
|
8249
|
-
const vocab_path =
|
|
8250
|
-
const data = yamlSafeLoad(
|
|
8306
|
+
const vocab_path = path5.join(package_root, PACKS_YML_REL);
|
|
8307
|
+
const data = yamlSafeLoad(fs5.readFileSync(vocab_path, "utf-8"));
|
|
8251
8308
|
if (!Array.isArray(data)) {
|
|
8252
8309
|
throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
|
|
8253
8310
|
}
|
|
@@ -8318,12 +8375,67 @@ function resolve_rule_pack_scope(raw, package_root, runtime_active_packs = []) {
|
|
|
8318
8375
|
}
|
|
8319
8376
|
return null;
|
|
8320
8377
|
}
|
|
8378
|
+
function prune_modules_by(deploy_results, is_pruned) {
|
|
8379
|
+
let pruned = 0;
|
|
8380
|
+
const adjusted = {};
|
|
8381
|
+
for (const tool_id of Object.keys(deploy_results)) {
|
|
8382
|
+
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
8383
|
+
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
8384
|
+
for (const p of paths) {
|
|
8385
|
+
const parts = p.split(path5.sep);
|
|
8386
|
+
if (parts.includes("skills")) {
|
|
8387
|
+
const i = parts.indexOf("skills");
|
|
8388
|
+
if (i + 1 < parts.length) {
|
|
8389
|
+
const skill_root = parts.slice(0, i + 2).join(path5.sep);
|
|
8390
|
+
if (!pruned_skill_dirs.has(skill_root)) {
|
|
8391
|
+
const skillmd = path5.join(skill_root, "SKILL.md");
|
|
8392
|
+
if (fs5.existsSync(skillmd) && is_pruned(skillmd)) {
|
|
8393
|
+
pruned_skill_dirs.add(skill_root);
|
|
8394
|
+
}
|
|
8395
|
+
}
|
|
8396
|
+
}
|
|
8397
|
+
}
|
|
8398
|
+
}
|
|
8399
|
+
const keep = [];
|
|
8400
|
+
const delete_files = [];
|
|
8401
|
+
for (const p of paths) {
|
|
8402
|
+
const parts = p.split(path5.sep);
|
|
8403
|
+
let is_target = false;
|
|
8404
|
+
if (parts.includes("skills")) {
|
|
8405
|
+
const i = parts.indexOf("skills");
|
|
8406
|
+
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path5.sep))) {
|
|
8407
|
+
is_target = true;
|
|
8408
|
+
}
|
|
8409
|
+
} else if (parts.includes("commands") && path5.extname(p) === ".md" && is_pruned(p)) {
|
|
8410
|
+
is_target = true;
|
|
8411
|
+
}
|
|
8412
|
+
(is_target ? delete_files : keep).push(p);
|
|
8413
|
+
}
|
|
8414
|
+
for (const d of pruned_skill_dirs) {
|
|
8415
|
+
fs5.rmSync(d, { recursive: true, force: true });
|
|
8416
|
+
}
|
|
8417
|
+
for (const p of delete_files) {
|
|
8418
|
+
if (p.split(path5.sep).includes("commands") && fs5.existsSync(p)) {
|
|
8419
|
+
try {
|
|
8420
|
+
fs5.unlinkSync(p);
|
|
8421
|
+
} catch {
|
|
8422
|
+
}
|
|
8423
|
+
}
|
|
8424
|
+
}
|
|
8425
|
+
pruned += delete_files.length;
|
|
8426
|
+
adjusted[tool_id] = [Math.max(0, written - delete_files.length), skipped, status, keep];
|
|
8427
|
+
}
|
|
8428
|
+
return [pruned, adjusted];
|
|
8429
|
+
}
|
|
8430
|
+
function prune_lab_modules(deploy_results, lab_ids) {
|
|
8431
|
+
return prune_modules_by(deploy_results, (p) => is_lab_artefact(p, lab_ids));
|
|
8432
|
+
}
|
|
8321
8433
|
|
|
8322
8434
|
// src/scripts/_lib/global_deploy_inventory.ts
|
|
8323
8435
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
8324
|
-
import * as
|
|
8436
|
+
import * as fs6 from "node:fs";
|
|
8325
8437
|
import * as os3 from "node:os";
|
|
8326
|
-
import * as
|
|
8438
|
+
import * as path6 from "node:path";
|
|
8327
8439
|
var SCHEMA_VERSION2 = 1;
|
|
8328
8440
|
var INVENTORY_BASENAME = "deployed-files.json";
|
|
8329
8441
|
var INVENTORY_ENV = "AGENT_CONFIG_DEPLOY_INVENTORY";
|
|
@@ -8332,22 +8444,22 @@ function expanduser3(p) {
|
|
|
8332
8444
|
return os3.homedir();
|
|
8333
8445
|
}
|
|
8334
8446
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
8335
|
-
return
|
|
8447
|
+
return path6.join(os3.homedir(), p.slice(2));
|
|
8336
8448
|
}
|
|
8337
8449
|
return p;
|
|
8338
8450
|
}
|
|
8339
8451
|
function resolve_path(p) {
|
|
8340
8452
|
try {
|
|
8341
|
-
return
|
|
8453
|
+
return fs6.realpathSync(p);
|
|
8342
8454
|
} catch {
|
|
8343
|
-
const abs =
|
|
8344
|
-
const parts = abs.split(
|
|
8455
|
+
const abs = path6.resolve(p);
|
|
8456
|
+
const parts = abs.split(path6.sep);
|
|
8345
8457
|
for (let i = parts.length; i > 0; i -= 1) {
|
|
8346
|
-
const prefix = parts.slice(0, i).join(
|
|
8458
|
+
const prefix = parts.slice(0, i).join(path6.sep) || path6.sep;
|
|
8347
8459
|
try {
|
|
8348
|
-
const real =
|
|
8460
|
+
const real = fs6.realpathSync(prefix);
|
|
8349
8461
|
const rest = parts.slice(i);
|
|
8350
|
-
return rest.length > 0 ?
|
|
8462
|
+
return rest.length > 0 ? path6.join(real, ...rest) : real;
|
|
8351
8463
|
} catch {
|
|
8352
8464
|
continue;
|
|
8353
8465
|
}
|
|
@@ -8357,7 +8469,7 @@ function resolve_path(p) {
|
|
|
8357
8469
|
}
|
|
8358
8470
|
function path_exists(p) {
|
|
8359
8471
|
try {
|
|
8360
|
-
|
|
8472
|
+
fs6.statSync(p);
|
|
8361
8473
|
return true;
|
|
8362
8474
|
} catch {
|
|
8363
8475
|
return false;
|
|
@@ -8375,7 +8487,7 @@ function load_inventory(p) {
|
|
|
8375
8487
|
const target = p ?? inventory_path();
|
|
8376
8488
|
let data;
|
|
8377
8489
|
try {
|
|
8378
|
-
data = JSON.parse(
|
|
8490
|
+
data = JSON.parse(fs6.readFileSync(target, { encoding: "utf-8" }));
|
|
8379
8491
|
} catch {
|
|
8380
8492
|
return { schema_version: SCHEMA_VERSION2, tools: {} };
|
|
8381
8493
|
}
|
|
@@ -8386,15 +8498,15 @@ function load_inventory(p) {
|
|
|
8386
8498
|
}
|
|
8387
8499
|
function save_inventory(data, p) {
|
|
8388
8500
|
const target = p ?? inventory_path();
|
|
8389
|
-
|
|
8501
|
+
fs6.mkdirSync(path6.dirname(target), { recursive: true });
|
|
8390
8502
|
const payload = json_dumps_sorted(data, 2) + "\n";
|
|
8391
|
-
const parent =
|
|
8503
|
+
const parent = path6.dirname(target);
|
|
8392
8504
|
let fd = null;
|
|
8393
8505
|
let tmp_name = "";
|
|
8394
8506
|
for (let attempt = 0; attempt < 32; attempt += 1) {
|
|
8395
|
-
tmp_name =
|
|
8507
|
+
tmp_name = path6.join(parent, `${path6.basename(target)}.${randomBytes2(6).toString("hex")}`);
|
|
8396
8508
|
try {
|
|
8397
|
-
fd =
|
|
8509
|
+
fd = fs6.openSync(tmp_name, "wx", 384);
|
|
8398
8510
|
break;
|
|
8399
8511
|
} catch (err) {
|
|
8400
8512
|
if (err.code === "EEXIST") {
|
|
@@ -8407,16 +8519,16 @@ function save_inventory(data, p) {
|
|
|
8407
8519
|
throw new Error("save_inventory: could not create a unique temp file");
|
|
8408
8520
|
}
|
|
8409
8521
|
try {
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8522
|
+
fs6.writeFileSync(fd, payload, { encoding: "utf-8" });
|
|
8523
|
+
fs6.closeSync(fd);
|
|
8524
|
+
fs6.renameSync(tmp_name, target);
|
|
8413
8525
|
} catch (err) {
|
|
8414
8526
|
try {
|
|
8415
|
-
|
|
8527
|
+
fs6.closeSync(fd);
|
|
8416
8528
|
} catch {
|
|
8417
8529
|
}
|
|
8418
8530
|
try {
|
|
8419
|
-
|
|
8531
|
+
fs6.unlinkSync(tmp_name);
|
|
8420
8532
|
} catch {
|
|
8421
8533
|
}
|
|
8422
8534
|
throw err;
|
|
@@ -8475,7 +8587,7 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
|
|
|
8475
8587
|
const out = /* @__PURE__ */ new Set();
|
|
8476
8588
|
let src_stat;
|
|
8477
8589
|
try {
|
|
8478
|
-
src_stat =
|
|
8590
|
+
src_stat = fs6.statSync(src);
|
|
8479
8591
|
} catch {
|
|
8480
8592
|
return out;
|
|
8481
8593
|
}
|
|
@@ -8487,23 +8599,23 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
|
|
|
8487
8599
|
return out;
|
|
8488
8600
|
}
|
|
8489
8601
|
const _walk = (node, prefix) => {
|
|
8490
|
-
const entries =
|
|
8602
|
+
const entries = fs6.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
8491
8603
|
for (const name of entries) {
|
|
8492
|
-
const entry =
|
|
8604
|
+
const entry = path6.join(node, name);
|
|
8493
8605
|
const rel = join_rel(prefix, name);
|
|
8494
|
-
const lst =
|
|
8606
|
+
const lst = fs6.lstatSync(entry);
|
|
8495
8607
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
8496
8608
|
_walk(entry, rel);
|
|
8497
8609
|
continue;
|
|
8498
8610
|
}
|
|
8499
8611
|
let resolved_is_dir = false;
|
|
8500
8612
|
try {
|
|
8501
|
-
resolved_is_dir =
|
|
8613
|
+
resolved_is_dir = fs6.statSync(entry).isDirectory();
|
|
8502
8614
|
} catch {
|
|
8503
8615
|
resolved_is_dir = false;
|
|
8504
8616
|
}
|
|
8505
8617
|
if (resolved_is_dir) {
|
|
8506
|
-
_walk(
|
|
8618
|
+
_walk(fs6.realpathSync(entry), rel);
|
|
8507
8619
|
continue;
|
|
8508
8620
|
}
|
|
8509
8621
|
if (file_filter !== null && !file_filter(entry)) {
|
|
@@ -8516,13 +8628,13 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
|
|
|
8516
8628
|
return out;
|
|
8517
8629
|
}
|
|
8518
8630
|
function join_rel(prefix, name) {
|
|
8519
|
-
return prefix ?
|
|
8631
|
+
return prefix ? path6.join(prefix, name) : name;
|
|
8520
8632
|
}
|
|
8521
8633
|
function as_posix(p) {
|
|
8522
8634
|
if (p === "") {
|
|
8523
8635
|
return ".";
|
|
8524
8636
|
}
|
|
8525
|
-
return p.split(
|
|
8637
|
+
return p.split(path6.sep).join("/");
|
|
8526
8638
|
}
|
|
8527
8639
|
function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false) {
|
|
8528
8640
|
const tools = inventory["tools"] ?? {};
|
|
@@ -8547,15 +8659,15 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
|
|
|
8547
8659
|
if (typeof rel !== "string" || !rel || rel.startsWith("/") || rel.startsWith("..")) {
|
|
8548
8660
|
continue;
|
|
8549
8661
|
}
|
|
8550
|
-
const target =
|
|
8662
|
+
const target = path6.join(anchor_resolved, rel);
|
|
8551
8663
|
try {
|
|
8552
|
-
relative_to(resolve_path(
|
|
8664
|
+
relative_to(resolve_path(path6.dirname(target)), anchor_resolved);
|
|
8553
8665
|
} catch {
|
|
8554
8666
|
continue;
|
|
8555
8667
|
}
|
|
8556
8668
|
let lst = null;
|
|
8557
8669
|
try {
|
|
8558
|
-
lst =
|
|
8670
|
+
lst = fs6.lstatSync(target);
|
|
8559
8671
|
} catch {
|
|
8560
8672
|
lst = null;
|
|
8561
8673
|
}
|
|
@@ -8569,12 +8681,12 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
|
|
|
8569
8681
|
continue;
|
|
8570
8682
|
}
|
|
8571
8683
|
try {
|
|
8572
|
-
|
|
8684
|
+
fs6.unlinkSync(target);
|
|
8573
8685
|
} catch {
|
|
8574
8686
|
continue;
|
|
8575
8687
|
}
|
|
8576
8688
|
deleted.push(target);
|
|
8577
|
-
prune_candidates.add(
|
|
8689
|
+
prune_candidates.add(path6.dirname(target));
|
|
8578
8690
|
}
|
|
8579
8691
|
prune_empty_dirs(prune_candidates, anchor_resolved);
|
|
8580
8692
|
return deleted;
|
|
@@ -8585,10 +8697,10 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
|
|
|
8585
8697
|
const prune_candidates = /* @__PURE__ */ new Set();
|
|
8586
8698
|
const needle = `package: ${package_tag}`;
|
|
8587
8699
|
for (const dest_sub of dest_subs) {
|
|
8588
|
-
const root = dest_sub ?
|
|
8700
|
+
const root = dest_sub ? path6.join(anchor_resolved, dest_sub) : anchor_resolved;
|
|
8589
8701
|
let root_stat;
|
|
8590
8702
|
try {
|
|
8591
|
-
root_stat =
|
|
8703
|
+
root_stat = fs6.statSync(root);
|
|
8592
8704
|
} catch {
|
|
8593
8705
|
continue;
|
|
8594
8706
|
}
|
|
@@ -8598,7 +8710,7 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
|
|
|
8598
8710
|
for (const md of rglob_md(root)) {
|
|
8599
8711
|
let md_lst;
|
|
8600
8712
|
try {
|
|
8601
|
-
md_lst =
|
|
8713
|
+
md_lst = fs6.lstatSync(md);
|
|
8602
8714
|
} catch {
|
|
8603
8715
|
continue;
|
|
8604
8716
|
}
|
|
@@ -8610,13 +8722,13 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
|
|
|
8610
8722
|
continue;
|
|
8611
8723
|
}
|
|
8612
8724
|
try {
|
|
8613
|
-
relative_to(resolve_path(
|
|
8725
|
+
relative_to(resolve_path(path6.dirname(md)), anchor_resolved);
|
|
8614
8726
|
} catch {
|
|
8615
8727
|
continue;
|
|
8616
8728
|
}
|
|
8617
8729
|
let head;
|
|
8618
8730
|
try {
|
|
8619
|
-
head =
|
|
8731
|
+
head = fs6.readFileSync(md, { encoding: "utf-8" });
|
|
8620
8732
|
} catch {
|
|
8621
8733
|
continue;
|
|
8622
8734
|
}
|
|
@@ -8634,12 +8746,12 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
|
|
|
8634
8746
|
continue;
|
|
8635
8747
|
}
|
|
8636
8748
|
try {
|
|
8637
|
-
|
|
8749
|
+
fs6.unlinkSync(md);
|
|
8638
8750
|
} catch {
|
|
8639
8751
|
continue;
|
|
8640
8752
|
}
|
|
8641
8753
|
deleted.push(md);
|
|
8642
|
-
prune_candidates.add(
|
|
8754
|
+
prune_candidates.add(path6.dirname(md));
|
|
8643
8755
|
}
|
|
8644
8756
|
}
|
|
8645
8757
|
prune_empty_dirs(prune_candidates, anchor_resolved);
|
|
@@ -8659,51 +8771,51 @@ function record_deploy(tool_id, anchor, current_files, inventory) {
|
|
|
8659
8771
|
}
|
|
8660
8772
|
function prune_empty_dirs(prune_candidates, anchor_resolved) {
|
|
8661
8773
|
const ordered = [...prune_candidates].sort(
|
|
8662
|
-
(a, b) => b.split(
|
|
8774
|
+
(a, b) => b.split(path6.sep).length - a.split(path6.sep).length
|
|
8663
8775
|
);
|
|
8664
8776
|
for (const start of ordered) {
|
|
8665
8777
|
let node = start;
|
|
8666
8778
|
while (node !== anchor_resolved && is_ancestor(anchor_resolved, node)) {
|
|
8667
8779
|
try {
|
|
8668
|
-
|
|
8780
|
+
fs6.rmdirSync(node);
|
|
8669
8781
|
} catch {
|
|
8670
8782
|
break;
|
|
8671
8783
|
}
|
|
8672
|
-
node =
|
|
8784
|
+
node = path6.dirname(node);
|
|
8673
8785
|
}
|
|
8674
8786
|
}
|
|
8675
8787
|
}
|
|
8676
8788
|
function is_ancestor(anchor, node) {
|
|
8677
|
-
const rel =
|
|
8678
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
8789
|
+
const rel = path6.relative(anchor, node);
|
|
8790
|
+
return rel !== "" && !rel.startsWith("..") && !path6.isAbsolute(rel);
|
|
8679
8791
|
}
|
|
8680
8792
|
function relative_to(child, parent) {
|
|
8681
8793
|
if (child === parent) {
|
|
8682
8794
|
return "";
|
|
8683
8795
|
}
|
|
8684
|
-
const rel =
|
|
8685
|
-
if (rel.startsWith("..") ||
|
|
8796
|
+
const rel = path6.relative(parent, child);
|
|
8797
|
+
if (rel.startsWith("..") || path6.isAbsolute(rel)) {
|
|
8686
8798
|
throw new Error(`'${child}' is not in the subpath of '${parent}'`);
|
|
8687
8799
|
}
|
|
8688
8800
|
return rel;
|
|
8689
8801
|
}
|
|
8690
8802
|
function relative_to_posix(child, parent) {
|
|
8691
|
-
return
|
|
8803
|
+
return path6.relative(parent, child).split(path6.sep).join("/");
|
|
8692
8804
|
}
|
|
8693
8805
|
function rglob_md(root) {
|
|
8694
8806
|
const out = [];
|
|
8695
8807
|
const walk = (dir) => {
|
|
8696
8808
|
let names;
|
|
8697
8809
|
try {
|
|
8698
|
-
names =
|
|
8810
|
+
names = fs6.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
8699
8811
|
} catch {
|
|
8700
8812
|
return;
|
|
8701
8813
|
}
|
|
8702
8814
|
for (const name of names) {
|
|
8703
|
-
const full =
|
|
8815
|
+
const full = path6.join(dir, name);
|
|
8704
8816
|
let lst;
|
|
8705
8817
|
try {
|
|
8706
|
-
lst =
|
|
8818
|
+
lst = fs6.lstatSync(full);
|
|
8707
8819
|
} catch {
|
|
8708
8820
|
continue;
|
|
8709
8821
|
}
|
|
@@ -8744,8 +8856,8 @@ function splitlines2(text) {
|
|
|
8744
8856
|
}
|
|
8745
8857
|
|
|
8746
8858
|
// src/scripts/_lib/rule_layer_overlap.ts
|
|
8747
|
-
import * as
|
|
8748
|
-
import * as
|
|
8859
|
+
import * as fs7 from "node:fs";
|
|
8860
|
+
import * as path7 from "node:path";
|
|
8749
8861
|
var INSTALLER_PROVENANCE_KEYS = ["package", "source_path"];
|
|
8750
8862
|
function stripProvenance(text) {
|
|
8751
8863
|
const lines = text.split("\n");
|
|
@@ -8799,14 +8911,14 @@ function compareLayers(global_layer, project_layer) {
|
|
|
8799
8911
|
function readRuleLayer(dir) {
|
|
8800
8912
|
let names;
|
|
8801
8913
|
try {
|
|
8802
|
-
names =
|
|
8914
|
+
names = fs7.readdirSync(dir);
|
|
8803
8915
|
} catch {
|
|
8804
8916
|
return null;
|
|
8805
8917
|
}
|
|
8806
8918
|
const files = /* @__PURE__ */ new Map();
|
|
8807
8919
|
for (const name of names.filter((n) => n.endsWith(".md")).sort()) {
|
|
8808
8920
|
try {
|
|
8809
|
-
files.set(name,
|
|
8921
|
+
files.set(name, fs7.readFileSync(path7.join(dir, name), "utf-8"));
|
|
8810
8922
|
} catch {
|
|
8811
8923
|
continue;
|
|
8812
8924
|
}
|
|
@@ -8814,7 +8926,7 @@ function readRuleLayer(dir) {
|
|
|
8814
8926
|
return { dir, files };
|
|
8815
8927
|
}
|
|
8816
8928
|
function claudeMdExcludesGlob(dir) {
|
|
8817
|
-
return `${
|
|
8929
|
+
return `${path7.resolve(dir).replace(/\/+$/, "")}/**`;
|
|
8818
8930
|
}
|
|
8819
8931
|
function mergeClaudeMdExcludes(existing, entry) {
|
|
8820
8932
|
if (!Array.isArray(existing)) return [entry];
|
|
@@ -8843,13 +8955,13 @@ function decideLayerAction(report, choice, global_dir, project_dir) {
|
|
|
8843
8955
|
}
|
|
8844
8956
|
|
|
8845
8957
|
// src/scripts/_lib/installed_tools.ts
|
|
8846
|
-
import * as
|
|
8958
|
+
import * as fs9 from "node:fs";
|
|
8847
8959
|
import * as os4 from "node:os";
|
|
8848
8960
|
import * as fsPath from "node:path";
|
|
8849
8961
|
|
|
8850
8962
|
// src/scripts/_lib/fs_atomic.ts
|
|
8851
|
-
import
|
|
8852
|
-
import
|
|
8963
|
+
import fs8 from "node:fs";
|
|
8964
|
+
import path8 from "node:path";
|
|
8853
8965
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
8854
8966
|
function _normalize_encoding(encoding) {
|
|
8855
8967
|
const compact = encoding.toLowerCase().replace(/[-_\s]/g, "");
|
|
@@ -8865,9 +8977,9 @@ function _normalize_encoding(encoding) {
|
|
|
8865
8977
|
}
|
|
8866
8978
|
function write_atomic(p, data, options = {}) {
|
|
8867
8979
|
const encoding = options.encoding ?? "utf-8";
|
|
8868
|
-
const target =
|
|
8869
|
-
const parent =
|
|
8870
|
-
|
|
8980
|
+
const target = path8.normalize(p);
|
|
8981
|
+
const parent = path8.dirname(target);
|
|
8982
|
+
fs8.mkdirSync(parent, { recursive: true });
|
|
8871
8983
|
let payload;
|
|
8872
8984
|
if (typeof data === "string") {
|
|
8873
8985
|
payload = Buffer.from(data, _normalize_encoding(encoding));
|
|
@@ -8881,12 +8993,12 @@ function write_atomic(p, data, options = {}) {
|
|
|
8881
8993
|
let fd = null;
|
|
8882
8994
|
let tmp_path = "";
|
|
8883
8995
|
for (let attempt = 0; attempt < 32; attempt += 1) {
|
|
8884
|
-
tmp_path =
|
|
8996
|
+
tmp_path = path8.join(
|
|
8885
8997
|
parent,
|
|
8886
|
-
`.${
|
|
8998
|
+
`.${path8.basename(target)}.tmp.${randomBytes3(6).toString("hex")}`
|
|
8887
8999
|
);
|
|
8888
9000
|
try {
|
|
8889
|
-
fd =
|
|
9001
|
+
fd = fs8.openSync(tmp_path, "wx", 384);
|
|
8890
9002
|
break;
|
|
8891
9003
|
} catch (err) {
|
|
8892
9004
|
if (err.code === "EEXIST") continue;
|
|
@@ -8900,24 +9012,24 @@ function write_atomic(p, data, options = {}) {
|
|
|
8900
9012
|
try {
|
|
8901
9013
|
let offset = 0;
|
|
8902
9014
|
while (offset < payload.length) {
|
|
8903
|
-
offset +=
|
|
9015
|
+
offset += fs8.writeSync(fd, payload, offset, payload.length - offset);
|
|
8904
9016
|
}
|
|
8905
9017
|
try {
|
|
8906
|
-
|
|
9018
|
+
fs8.fsyncSync(fd);
|
|
8907
9019
|
} catch {
|
|
8908
9020
|
}
|
|
8909
|
-
|
|
9021
|
+
fs8.closeSync(fd);
|
|
8910
9022
|
closed = true;
|
|
8911
|
-
|
|
9023
|
+
fs8.renameSync(tmp_path, target);
|
|
8912
9024
|
} catch (err) {
|
|
8913
9025
|
if (!closed) {
|
|
8914
9026
|
try {
|
|
8915
|
-
|
|
9027
|
+
fs8.closeSync(fd);
|
|
8916
9028
|
} catch {
|
|
8917
9029
|
}
|
|
8918
9030
|
}
|
|
8919
9031
|
try {
|
|
8920
|
-
|
|
9032
|
+
fs8.unlinkSync(tmp_path);
|
|
8921
9033
|
} catch {
|
|
8922
9034
|
}
|
|
8923
9035
|
throw err;
|
|
@@ -8928,17 +9040,17 @@ function write_atomic(p, data, options = {}) {
|
|
|
8928
9040
|
function _fsync_dir(directory) {
|
|
8929
9041
|
let dir_fd;
|
|
8930
9042
|
try {
|
|
8931
|
-
dir_fd =
|
|
9043
|
+
dir_fd = fs8.openSync(directory, fs8.constants.O_RDONLY);
|
|
8932
9044
|
} catch {
|
|
8933
9045
|
return;
|
|
8934
9046
|
}
|
|
8935
9047
|
try {
|
|
8936
9048
|
try {
|
|
8937
|
-
|
|
9049
|
+
fs8.fsyncSync(dir_fd);
|
|
8938
9050
|
} catch {
|
|
8939
9051
|
}
|
|
8940
9052
|
} finally {
|
|
8941
|
-
|
|
9053
|
+
fs8.closeSync(dir_fd);
|
|
8942
9054
|
}
|
|
8943
9055
|
}
|
|
8944
9056
|
|
|
@@ -8967,18 +9079,18 @@ function manifest_path(project_root, env) {
|
|
|
8967
9079
|
var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8968
9080
|
var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
|
|
8969
9081
|
var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
|
|
8970
|
-
function read_manifest(
|
|
9082
|
+
function read_manifest(path20) {
|
|
8971
9083
|
let text;
|
|
8972
9084
|
try {
|
|
8973
|
-
text = require_read_text(
|
|
9085
|
+
text = require_read_text(path20);
|
|
8974
9086
|
} catch {
|
|
8975
9087
|
return null;
|
|
8976
9088
|
}
|
|
8977
9089
|
const data = _parse_manual(text);
|
|
8978
9090
|
return _normalise_v2_shape(data);
|
|
8979
9091
|
}
|
|
8980
|
-
function require_read_text(
|
|
8981
|
-
return
|
|
9092
|
+
function require_read_text(path20) {
|
|
9093
|
+
return fs9.readFileSync(path20, { encoding: "utf-8" });
|
|
8982
9094
|
}
|
|
8983
9095
|
function _normalise_v2_shape(data) {
|
|
8984
9096
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -9159,9 +9271,9 @@ function stable_sort(items, key) {
|
|
|
9159
9271
|
return a.index - b.index;
|
|
9160
9272
|
}).map((entry) => entry.item);
|
|
9161
9273
|
}
|
|
9162
|
-
function write_manifest(
|
|
9274
|
+
function write_manifest(path20, version, tools, options = {}) {
|
|
9163
9275
|
const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
9164
|
-
return write_atomic(
|
|
9276
|
+
return write_atomic(path20, rendered);
|
|
9165
9277
|
}
|
|
9166
9278
|
var ScopeMismatchError = class extends Error {
|
|
9167
9279
|
name_;
|
|
@@ -9252,25 +9364,25 @@ function _today() {
|
|
|
9252
9364
|
// src/scripts/_lib/install_drift.ts
|
|
9253
9365
|
var import_yaml = __toESM(require_dist(), 1);
|
|
9254
9366
|
import * as crypto from "node:crypto";
|
|
9255
|
-
import * as
|
|
9367
|
+
import * as fs10 from "node:fs";
|
|
9256
9368
|
import * as os5 from "node:os";
|
|
9257
|
-
import * as
|
|
9369
|
+
import * as path9 from "node:path";
|
|
9258
9370
|
function expanduser5(p) {
|
|
9259
9371
|
if (p === "~") {
|
|
9260
9372
|
return os5.homedir();
|
|
9261
9373
|
}
|
|
9262
9374
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
9263
|
-
return
|
|
9375
|
+
return path9.join(os5.homedir(), p.slice(2));
|
|
9264
9376
|
}
|
|
9265
9377
|
return p;
|
|
9266
9378
|
}
|
|
9267
9379
|
function resolve_entry_path(project_root, raw) {
|
|
9268
9380
|
const p = expanduser5(raw);
|
|
9269
|
-
return
|
|
9381
|
+
return path9.isAbsolute(p) ? p : path9.join(project_root, p);
|
|
9270
9382
|
}
|
|
9271
9383
|
function sha256_of_file(p) {
|
|
9272
9384
|
try {
|
|
9273
|
-
return crypto.createHash("sha256").update(
|
|
9385
|
+
return crypto.createHash("sha256").update(fs10.readFileSync(p)).digest("hex");
|
|
9274
9386
|
} catch {
|
|
9275
9387
|
return null;
|
|
9276
9388
|
}
|
|
@@ -9279,7 +9391,7 @@ function collect_drift(project_root, env) {
|
|
|
9279
9391
|
const target = manifest_path(project_root, env);
|
|
9280
9392
|
let text;
|
|
9281
9393
|
try {
|
|
9282
|
-
text =
|
|
9394
|
+
text = fs10.readFileSync(target, "utf-8");
|
|
9283
9395
|
} catch {
|
|
9284
9396
|
return null;
|
|
9285
9397
|
}
|
|
@@ -9324,7 +9436,7 @@ function collect_drift(project_root, env) {
|
|
|
9324
9436
|
continue;
|
|
9325
9437
|
}
|
|
9326
9438
|
const resolved = resolve_entry_path(project_root, raw_path);
|
|
9327
|
-
if (!
|
|
9439
|
+
if (!fs10.existsSync(resolved)) {
|
|
9328
9440
|
out.push({
|
|
9329
9441
|
tool_id,
|
|
9330
9442
|
path: resolved,
|
|
@@ -9377,9 +9489,9 @@ function format_drift_report(entries) {
|
|
|
9377
9489
|
}
|
|
9378
9490
|
|
|
9379
9491
|
// src/scripts/_lib/skill_catalogue.ts
|
|
9380
|
-
import * as
|
|
9381
|
-
import * as
|
|
9382
|
-
var OBSERVATION_LOG =
|
|
9492
|
+
import * as fs11 from "node:fs";
|
|
9493
|
+
import * as path10 from "node:path";
|
|
9494
|
+
var OBSERVATION_LOG = path10.join(
|
|
9383
9495
|
"agents",
|
|
9384
9496
|
"evidence",
|
|
9385
9497
|
"metrics",
|
|
@@ -9423,9 +9535,9 @@ function descriptionOf(frontmatter) {
|
|
|
9423
9535
|
return "";
|
|
9424
9536
|
}
|
|
9425
9537
|
function readProjectedCatalogue(root) {
|
|
9426
|
-
const names =
|
|
9538
|
+
const names = fs11.readdirSync(root).filter((n) => fs11.existsSync(path10.join(root, n, "SKILL.md"))).sort();
|
|
9427
9539
|
return names.map((name, index) => {
|
|
9428
|
-
const content =
|
|
9540
|
+
const content = fs11.readFileSync(path10.join(root, name, "SKILL.md"), "utf-8");
|
|
9429
9541
|
const frontmatter = frontmatterOf(content);
|
|
9430
9542
|
const description = descriptionOf(frontmatter);
|
|
9431
9543
|
return {
|
|
@@ -9442,12 +9554,12 @@ function truncationModeOf(record) {
|
|
|
9442
9554
|
return record.truncation_mode ?? "per-entry";
|
|
9443
9555
|
}
|
|
9444
9556
|
function markdownFilesUnder(root) {
|
|
9445
|
-
if (!
|
|
9557
|
+
if (!fs11.existsSync(root)) return [];
|
|
9446
9558
|
const out = [];
|
|
9447
9559
|
const walk = (dir) => {
|
|
9448
|
-
for (const entry of
|
|
9449
|
-
const full =
|
|
9450
|
-
if (
|
|
9560
|
+
for (const entry of fs11.readdirSync(dir, { withFileTypes: true })) {
|
|
9561
|
+
const full = path10.join(dir, entry.name);
|
|
9562
|
+
if (fs11.statSync(full).isDirectory()) walk(full);
|
|
9451
9563
|
else if (entry.name.endsWith(".md")) out.push(full);
|
|
9452
9564
|
}
|
|
9453
9565
|
};
|
|
@@ -9455,9 +9567,9 @@ function markdownFilesUnder(root) {
|
|
|
9455
9567
|
return out;
|
|
9456
9568
|
}
|
|
9457
9569
|
function measureCatalogueVolume(host, root) {
|
|
9458
|
-
const skillsRoot =
|
|
9459
|
-
const skills =
|
|
9460
|
-
const commandEntries = markdownFilesUnder(
|
|
9570
|
+
const skillsRoot = path10.join(root, "skills");
|
|
9571
|
+
const skills = fs11.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
|
|
9572
|
+
const commandEntries = markdownFilesUnder(path10.join(root, "commands")).length;
|
|
9461
9573
|
return {
|
|
9462
9574
|
host,
|
|
9463
9575
|
root,
|
|
@@ -9501,6 +9613,7 @@ function catalogueLimitWarning(volume, limit) {
|
|
|
9501
9613
|
}
|
|
9502
9614
|
function migrationEligibility(host, resolvedMode, currentSkillCount, limits) {
|
|
9503
9615
|
if (resolvedMode === "scoped") return { eligible: false, reason: "already-scoped" };
|
|
9616
|
+
if (resolvedMode === "tiered") return { eligible: false, reason: "already-tiered" };
|
|
9504
9617
|
const limit = limits.get(host);
|
|
9505
9618
|
if (limit === void 0) return { eligible: false, reason: "no-observation-for-host" };
|
|
9506
9619
|
if (limit.projectedSkills === null) return { eligible: false, reason: "observation-not-comparable" };
|
|
@@ -9534,9 +9647,9 @@ function migrationPromptLines(host, eligibility, settingsPath) {
|
|
|
9534
9647
|
];
|
|
9535
9648
|
}
|
|
9536
9649
|
function readObservationLog(logPath) {
|
|
9537
|
-
if (!
|
|
9650
|
+
if (!fs11.existsSync(logPath)) return [];
|
|
9538
9651
|
const out = [];
|
|
9539
|
-
for (const line of
|
|
9652
|
+
for (const line of fs11.readFileSync(logPath, "utf-8").split("\n")) {
|
|
9540
9653
|
const trimmed = line.trim();
|
|
9541
9654
|
if (trimmed.length === 0) continue;
|
|
9542
9655
|
try {
|
|
@@ -9577,8 +9690,8 @@ function isInteractiveSession(probe) {
|
|
|
9577
9690
|
|
|
9578
9691
|
// src/scripts/_lib/claude_desktop_bundler.ts
|
|
9579
9692
|
import * as crypto2 from "node:crypto";
|
|
9580
|
-
import * as
|
|
9581
|
-
import * as
|
|
9693
|
+
import * as fs12 from "node:fs";
|
|
9694
|
+
import * as path11 from "node:path";
|
|
9582
9695
|
|
|
9583
9696
|
// src/scripts/_lib/zip_min.ts
|
|
9584
9697
|
import * as zlib from "node:zlib";
|
|
@@ -9685,7 +9798,7 @@ function _is_excluded(rel_parts) {
|
|
|
9685
9798
|
}
|
|
9686
9799
|
function _is_dir(p) {
|
|
9687
9800
|
try {
|
|
9688
|
-
return
|
|
9801
|
+
return fs12.statSync(p).isDirectory();
|
|
9689
9802
|
} catch {
|
|
9690
9803
|
return false;
|
|
9691
9804
|
}
|
|
@@ -9697,12 +9810,12 @@ function _compare_rel_parts(a, b) {
|
|
|
9697
9810
|
}
|
|
9698
9811
|
function _walk_skill_files(skill_dir) {
|
|
9699
9812
|
const out = [];
|
|
9700
|
-
const resolved =
|
|
9813
|
+
const resolved = fs12.realpathSync(skill_dir);
|
|
9701
9814
|
const walk = (root, relRoot) => {
|
|
9702
9815
|
const dirNames = [];
|
|
9703
9816
|
const fileNames = [];
|
|
9704
|
-
for (const dirent of
|
|
9705
|
-
const full =
|
|
9817
|
+
for (const dirent of fs12.readdirSync(root, { withFileTypes: true })) {
|
|
9818
|
+
const full = path11.join(root, dirent.name);
|
|
9706
9819
|
const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
|
|
9707
9820
|
if (isDir2) {
|
|
9708
9821
|
dirNames.push(dirent.name);
|
|
@@ -9715,13 +9828,13 @@ function _walk_skill_files(skill_dir) {
|
|
|
9715
9828
|
if (_is_excluded(rel_parts)) {
|
|
9716
9829
|
continue;
|
|
9717
9830
|
}
|
|
9718
|
-
out.push([
|
|
9831
|
+
out.push([path11.join(root, fname), rel_parts]);
|
|
9719
9832
|
}
|
|
9720
9833
|
for (const dname of dirNames) {
|
|
9721
9834
|
if (_is_excluded([dname])) {
|
|
9722
9835
|
continue;
|
|
9723
9836
|
}
|
|
9724
|
-
walk(
|
|
9837
|
+
walk(path11.join(root, dname), [...relRoot, dname]);
|
|
9725
9838
|
}
|
|
9726
9839
|
};
|
|
9727
9840
|
walk(resolved, []);
|
|
@@ -9734,53 +9847,53 @@ function _manifest_digest(files) {
|
|
|
9734
9847
|
const rel = rel_parts.join("/");
|
|
9735
9848
|
h.update(Buffer.from(rel, "utf-8"));
|
|
9736
9849
|
h.update(Buffer.from([0]));
|
|
9737
|
-
h.update(crypto2.createHash("sha256").update(
|
|
9850
|
+
h.update(crypto2.createHash("sha256").update(fs12.readFileSync(abs_path)).digest());
|
|
9738
9851
|
h.update(Buffer.from([0]));
|
|
9739
9852
|
}
|
|
9740
9853
|
return h.digest("hex");
|
|
9741
9854
|
}
|
|
9742
9855
|
function _atomic_write_zip(zip_path, files) {
|
|
9743
|
-
|
|
9744
|
-
const stem =
|
|
9745
|
-
const tmp_path =
|
|
9746
|
-
|
|
9856
|
+
fs12.mkdirSync(path11.dirname(zip_path), { recursive: true });
|
|
9857
|
+
const stem = path11.basename(zip_path, path11.extname(zip_path));
|
|
9858
|
+
const tmp_path = path11.join(
|
|
9859
|
+
path11.dirname(zip_path),
|
|
9747
9860
|
`.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
|
|
9748
9861
|
);
|
|
9749
9862
|
try {
|
|
9750
9863
|
const entries = files.map(([abs_path, rel_parts]) => ({
|
|
9751
9864
|
name: rel_parts.join("/"),
|
|
9752
|
-
data:
|
|
9865
|
+
data: fs12.readFileSync(abs_path)
|
|
9753
9866
|
}));
|
|
9754
|
-
|
|
9755
|
-
|
|
9867
|
+
fs12.writeFileSync(tmp_path, zip_write_sync(entries));
|
|
9868
|
+
fs12.renameSync(tmp_path, zip_path);
|
|
9756
9869
|
} finally {
|
|
9757
|
-
if (
|
|
9758
|
-
|
|
9870
|
+
if (fs12.existsSync(tmp_path)) {
|
|
9871
|
+
fs12.unlinkSync(tmp_path);
|
|
9759
9872
|
}
|
|
9760
9873
|
}
|
|
9761
9874
|
}
|
|
9762
9875
|
function _write_if_changed(dest_dir, slug, files, force, written) {
|
|
9763
9876
|
const digest = _manifest_digest(files);
|
|
9764
|
-
const zip_path =
|
|
9765
|
-
const digest_path =
|
|
9766
|
-
const recorded =
|
|
9767
|
-
if (!force && recorded === digest &&
|
|
9877
|
+
const zip_path = path11.join(dest_dir, `${slug}.zip`);
|
|
9878
|
+
const digest_path = path11.join(dest_dir, `${slug}.sha256`);
|
|
9879
|
+
const recorded = fs12.existsSync(digest_path) ? fs12.readFileSync(digest_path, "utf-8").trim() : "";
|
|
9880
|
+
if (!force && recorded === digest && fs12.existsSync(zip_path)) {
|
|
9768
9881
|
return;
|
|
9769
9882
|
}
|
|
9770
9883
|
_atomic_write_zip(zip_path, files);
|
|
9771
|
-
|
|
9884
|
+
fs12.writeFileSync(digest_path, digest + "\n", "utf-8");
|
|
9772
9885
|
written.push(zip_path);
|
|
9773
9886
|
}
|
|
9774
9887
|
function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
9775
|
-
const skills_root =
|
|
9888
|
+
const skills_root = path11.join(package_root, "dist/agent-src", "skills");
|
|
9776
9889
|
if (!_is_dir(skills_root)) {
|
|
9777
9890
|
return [];
|
|
9778
9891
|
}
|
|
9779
|
-
|
|
9892
|
+
fs12.mkdirSync(dest_dir, { recursive: true });
|
|
9780
9893
|
const written = [];
|
|
9781
|
-
for (const name of
|
|
9782
|
-
const entry =
|
|
9783
|
-
const isSymlink2 =
|
|
9894
|
+
for (const name of fs12.readdirSync(skills_root).sort()) {
|
|
9895
|
+
const entry = path11.join(skills_root, name);
|
|
9896
|
+
const isSymlink2 = fs12.lstatSync(entry).isSymbolicLink();
|
|
9784
9897
|
if (!(_is_dir(entry) || isSymlink2)) {
|
|
9785
9898
|
continue;
|
|
9786
9899
|
}
|
|
@@ -9788,8 +9901,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
9788
9901
|
if (curation !== null && !curation.includes(skill_name)) {
|
|
9789
9902
|
continue;
|
|
9790
9903
|
}
|
|
9791
|
-
const skill_md =
|
|
9792
|
-
if (!
|
|
9904
|
+
const skill_md = path11.join(entry, "SKILL.md");
|
|
9905
|
+
if (!fs12.existsSync(skill_md)) {
|
|
9793
9906
|
continue;
|
|
9794
9907
|
}
|
|
9795
9908
|
const files = _walk_skill_files(entry);
|
|
@@ -9801,15 +9914,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
|
|
|
9801
9914
|
return written;
|
|
9802
9915
|
}
|
|
9803
9916
|
function _command_slug(source_file, commands_root) {
|
|
9804
|
-
const rel =
|
|
9805
|
-
const noExt = rel.slice(0, rel.length -
|
|
9806
|
-
return noExt.split(
|
|
9917
|
+
const rel = path11.relative(commands_root, source_file);
|
|
9918
|
+
const noExt = rel.slice(0, rel.length - path11.extname(rel).length);
|
|
9919
|
+
return noExt.split(path11.sep).join("-");
|
|
9807
9920
|
}
|
|
9808
9921
|
function _iter_command_files(commands_root) {
|
|
9809
9922
|
const found = [];
|
|
9810
9923
|
const walk = (dir) => {
|
|
9811
|
-
for (const dirent of
|
|
9812
|
-
const full =
|
|
9924
|
+
for (const dirent of fs12.readdirSync(dir, { withFileTypes: true })) {
|
|
9925
|
+
const full = path11.join(dir, dirent.name);
|
|
9813
9926
|
if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
|
|
9814
9927
|
walk(full);
|
|
9815
9928
|
} else if (dirent.name.endsWith(".md")) {
|
|
@@ -9819,21 +9932,21 @@ function _iter_command_files(commands_root) {
|
|
|
9819
9932
|
};
|
|
9820
9933
|
walk(commands_root);
|
|
9821
9934
|
found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9822
|
-
return found.filter((source_file) =>
|
|
9935
|
+
return found.filter((source_file) => path11.basename(source_file) !== "AGENTS.md");
|
|
9823
9936
|
}
|
|
9824
9937
|
function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
|
|
9825
|
-
const commands_root =
|
|
9938
|
+
const commands_root = path11.join(package_root, "dist/agent-src", "commands");
|
|
9826
9939
|
if (!_is_dir(commands_root)) {
|
|
9827
9940
|
return [];
|
|
9828
9941
|
}
|
|
9829
|
-
const skills_root =
|
|
9942
|
+
const skills_root = path11.join(package_root, "dist/agent-src", "skills");
|
|
9830
9943
|
let skill_names = /* @__PURE__ */ new Set();
|
|
9831
9944
|
if (_is_dir(skills_root)) {
|
|
9832
9945
|
skill_names = new Set(
|
|
9833
|
-
|
|
9946
|
+
fs12.readdirSync(skills_root).filter((name) => _is_dir(path11.join(skills_root, name)))
|
|
9834
9947
|
);
|
|
9835
9948
|
}
|
|
9836
|
-
|
|
9949
|
+
fs12.mkdirSync(dest_dir, { recursive: true });
|
|
9837
9950
|
const written = [];
|
|
9838
9951
|
for (const source_file of _iter_command_files(commands_root)) {
|
|
9839
9952
|
const slug = _command_slug(source_file, commands_root);
|
|
@@ -9843,7 +9956,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
9843
9956
|
if (curation !== null && !curation.includes(slug)) {
|
|
9844
9957
|
continue;
|
|
9845
9958
|
}
|
|
9846
|
-
const files = [[
|
|
9959
|
+
const files = [[fs12.realpathSync(source_file), ["SKILL.md"]]];
|
|
9847
9960
|
_write_if_changed(dest_dir, slug, files, force, written);
|
|
9848
9961
|
}
|
|
9849
9962
|
return written;
|
|
@@ -9851,8 +9964,8 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
|
|
|
9851
9964
|
|
|
9852
9965
|
// src/scripts/_lib/claude_settings_hooks.ts
|
|
9853
9966
|
var YAML = __toESM(require_dist(), 1);
|
|
9854
|
-
import * as
|
|
9855
|
-
import * as
|
|
9967
|
+
import * as fs13 from "node:fs";
|
|
9968
|
+
import * as path12 from "node:path";
|
|
9856
9969
|
|
|
9857
9970
|
// src/install/atomic.ts
|
|
9858
9971
|
import {
|
|
@@ -9860,17 +9973,17 @@ import {
|
|
|
9860
9973
|
fsyncSync,
|
|
9861
9974
|
mkdirSync as mkdirSync5,
|
|
9862
9975
|
openSync as openSync3,
|
|
9863
|
-
readFileSync as
|
|
9976
|
+
readFileSync as readFileSync11,
|
|
9864
9977
|
renameSync as renameSync5,
|
|
9865
|
-
unlinkSync as
|
|
9978
|
+
unlinkSync as unlinkSync5,
|
|
9866
9979
|
writeSync
|
|
9867
9980
|
} from "node:fs";
|
|
9868
|
-
import { dirname as
|
|
9981
|
+
import { dirname as dirname5, join as join12 } from "node:path";
|
|
9869
9982
|
function atomicWriteFile(target, data, options = {}) {
|
|
9870
9983
|
const mode = options.mode ?? 420;
|
|
9871
|
-
const parent =
|
|
9984
|
+
const parent = dirname5(target);
|
|
9872
9985
|
mkdirSync5(parent, { recursive: true });
|
|
9873
|
-
const tmp =
|
|
9986
|
+
const tmp = join12(parent, `.tmp.${process.pid}.${randSuffix()}`);
|
|
9874
9987
|
let fd = null;
|
|
9875
9988
|
try {
|
|
9876
9989
|
fd = openSync3(tmp, "w", mode);
|
|
@@ -9888,7 +10001,7 @@ function atomicWriteFile(target, data, options = {}) {
|
|
|
9888
10001
|
}
|
|
9889
10002
|
}
|
|
9890
10003
|
try {
|
|
9891
|
-
|
|
10004
|
+
unlinkSync5(tmp);
|
|
9892
10005
|
} catch {
|
|
9893
10006
|
}
|
|
9894
10007
|
throw err;
|
|
@@ -9920,7 +10033,7 @@ var SettingsLockError = class extends Error {
|
|
|
9920
10033
|
}
|
|
9921
10034
|
};
|
|
9922
10035
|
function build_claude_hook_matrix(manifest_path2) {
|
|
9923
|
-
const raw =
|
|
10036
|
+
const raw = fs13.readFileSync(manifest_path2, "utf8");
|
|
9924
10037
|
const manifest = _yaml_parse(raw) ?? {};
|
|
9925
10038
|
const hook_spec = manifest["schema_version"] ?? 1;
|
|
9926
10039
|
const platforms = manifest["platforms"] ?? {};
|
|
@@ -9950,8 +10063,8 @@ function _is_managed_group(group) {
|
|
|
9950
10063
|
);
|
|
9951
10064
|
}
|
|
9952
10065
|
function _read_settings(settings_path) {
|
|
9953
|
-
if (!
|
|
9954
|
-
const raw =
|
|
10066
|
+
if (!fs13.existsSync(settings_path)) return {};
|
|
10067
|
+
const raw = fs13.readFileSync(settings_path, "utf8");
|
|
9955
10068
|
if (raw.trim() === "") return {};
|
|
9956
10069
|
let parsed;
|
|
9957
10070
|
try {
|
|
@@ -9966,18 +10079,18 @@ function _read_settings(settings_path) {
|
|
|
9966
10079
|
}
|
|
9967
10080
|
function _with_lock(settings_path, fn) {
|
|
9968
10081
|
const lockPath = settings_path + ".agent-config.lock";
|
|
9969
|
-
|
|
10082
|
+
fs13.mkdirSync(path12.dirname(lockPath), { recursive: true });
|
|
9970
10083
|
let fd;
|
|
9971
10084
|
try {
|
|
9972
|
-
fd =
|
|
10085
|
+
fd = fs13.openSync(lockPath, "wx");
|
|
9973
10086
|
} catch {
|
|
9974
10087
|
throw new SettingsLockError(lockPath);
|
|
9975
10088
|
}
|
|
9976
10089
|
try {
|
|
9977
10090
|
return fn();
|
|
9978
10091
|
} finally {
|
|
9979
|
-
|
|
9980
|
-
|
|
10092
|
+
fs13.closeSync(fd);
|
|
10093
|
+
fs13.rmSync(lockPath, { force: true });
|
|
9981
10094
|
}
|
|
9982
10095
|
}
|
|
9983
10096
|
function ensure_managed_hooks(settings_path, matrix) {
|
|
@@ -10008,9 +10121,9 @@ function ensure_managed_hooks(settings_path, matrix) {
|
|
|
10008
10121
|
|
|
10009
10122
|
// src/scripts/_lib/agent_settings.ts
|
|
10010
10123
|
import { createRequire as createRequire2 } from "node:module";
|
|
10011
|
-
import * as
|
|
10124
|
+
import * as fs14 from "node:fs";
|
|
10012
10125
|
import * as os6 from "node:os";
|
|
10013
|
-
import * as
|
|
10126
|
+
import * as path13 from "node:path";
|
|
10014
10127
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
10015
10128
|
|
|
10016
10129
|
// src/shared/settingsCarveOut.ts
|
|
@@ -10108,10 +10221,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
|
|
|
10108
10221
|
var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
|
|
10109
10222
|
var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
|
|
10110
10223
|
function _local_settings_path(project_root) {
|
|
10111
|
-
return
|
|
10224
|
+
return path13.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
|
|
10112
10225
|
}
|
|
10113
10226
|
function _canonical_settings_path(project_root) {
|
|
10114
|
-
return
|
|
10227
|
+
return path13.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
|
|
10115
10228
|
}
|
|
10116
10229
|
var USER_GLOBAL_FILENAME = "agent-settings.yml";
|
|
10117
10230
|
function DEFAULT_USER_GLOBAL_FILE() {
|
|
@@ -10165,10 +10278,10 @@ var MERGEABLE_KEYS = [
|
|
|
10165
10278
|
"knowledge.global_sharing.freshness.hypothesis_after_days",
|
|
10166
10279
|
"knowledge.global_sharing.freshness.stale_after_days"
|
|
10167
10280
|
];
|
|
10168
|
-
var TEMPLATE_RELATIVE =
|
|
10169
|
-
var _PACKAGE_ROOT =
|
|
10281
|
+
var TEMPLATE_RELATIVE = path13.join("src", "config", "agent-settings.template.yml");
|
|
10282
|
+
var _PACKAGE_ROOT = path13.resolve(path13.dirname(fileURLToPath2(import.meta.url)), "..", "..", "..");
|
|
10170
10283
|
function default_template_path() {
|
|
10171
|
-
return
|
|
10284
|
+
return path13.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
|
|
10172
10285
|
}
|
|
10173
10286
|
function _is_placeholder(value) {
|
|
10174
10287
|
return typeof value === "string" && /^__[A-Z0-9_]+__$/.test(value);
|
|
@@ -10219,8 +10332,8 @@ var _AGENTS_DIR_MARKERS = [
|
|
|
10219
10332
|
var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
|
|
10220
10333
|
function _exists(p) {
|
|
10221
10334
|
try {
|
|
10222
|
-
|
|
10223
|
-
|
|
10335
|
+
fs14.lstatSync(p);
|
|
10336
|
+
fs14.statSync(p);
|
|
10224
10337
|
return true;
|
|
10225
10338
|
} catch {
|
|
10226
10339
|
return false;
|
|
@@ -10228,22 +10341,22 @@ function _exists(p) {
|
|
|
10228
10341
|
}
|
|
10229
10342
|
function _is_dir2(p) {
|
|
10230
10343
|
try {
|
|
10231
|
-
return
|
|
10344
|
+
return fs14.statSync(p).isDirectory();
|
|
10232
10345
|
} catch {
|
|
10233
10346
|
return false;
|
|
10234
10347
|
}
|
|
10235
10348
|
}
|
|
10236
10349
|
function _is_file(p) {
|
|
10237
10350
|
try {
|
|
10238
|
-
return
|
|
10351
|
+
return fs14.statSync(p).isFile();
|
|
10239
10352
|
} catch {
|
|
10240
10353
|
return false;
|
|
10241
10354
|
}
|
|
10242
10355
|
}
|
|
10243
10356
|
function _resolve(p) {
|
|
10244
|
-
const absolute =
|
|
10357
|
+
const absolute = path13.resolve(p);
|
|
10245
10358
|
try {
|
|
10246
|
-
return
|
|
10359
|
+
return fs14.realpathSync(absolute);
|
|
10247
10360
|
} catch {
|
|
10248
10361
|
return absolute;
|
|
10249
10362
|
}
|
|
@@ -10253,7 +10366,7 @@ function _ancestor_chain(start) {
|
|
|
10253
10366
|
let cursor = start;
|
|
10254
10367
|
for (; ; ) {
|
|
10255
10368
|
chain.push(cursor);
|
|
10256
|
-
const parent =
|
|
10369
|
+
const parent = path13.dirname(cursor);
|
|
10257
10370
|
if (parent === cursor) {
|
|
10258
10371
|
break;
|
|
10259
10372
|
}
|
|
@@ -10262,15 +10375,15 @@ function _ancestor_chain(start) {
|
|
|
10262
10375
|
return chain;
|
|
10263
10376
|
}
|
|
10264
10377
|
function _boundary_anchor_at(dir) {
|
|
10265
|
-
const agents_dir =
|
|
10378
|
+
const agents_dir = path13.join(dir, "agents");
|
|
10266
10379
|
if (_is_dir2(agents_dir)) {
|
|
10267
10380
|
for (const marker of _AGENTS_DIR_MARKERS) {
|
|
10268
|
-
if (_exists(
|
|
10381
|
+
if (_exists(path13.join(agents_dir, marker))) {
|
|
10269
10382
|
return ANCHOR_AGENTS_DIR;
|
|
10270
10383
|
}
|
|
10271
10384
|
}
|
|
10272
10385
|
}
|
|
10273
|
-
if (_exists(
|
|
10386
|
+
if (_exists(path13.join(dir, ".git"))) {
|
|
10274
10387
|
return ANCHOR_GIT;
|
|
10275
10388
|
}
|
|
10276
10389
|
return null;
|
|
@@ -10281,7 +10394,7 @@ function find_project_root_with_anchor(start) {
|
|
|
10281
10394
|
const chain = _ancestor_chain(current);
|
|
10282
10395
|
if (legacy) {
|
|
10283
10396
|
for (const candidate of chain) {
|
|
10284
|
-
if (_exists(
|
|
10397
|
+
if (_exists(path13.join(candidate, ".git"))) {
|
|
10285
10398
|
return [candidate, ANCHOR_GIT];
|
|
10286
10399
|
}
|
|
10287
10400
|
}
|
|
@@ -10295,7 +10408,7 @@ function find_project_root_with_anchor(start) {
|
|
|
10295
10408
|
}
|
|
10296
10409
|
let outermost = null;
|
|
10297
10410
|
for (const candidate of chain) {
|
|
10298
|
-
if (_exists(
|
|
10411
|
+
if (_exists(path13.join(candidate, DEFAULT_PROJECT_FILE))) {
|
|
10299
10412
|
outermost = candidate;
|
|
10300
10413
|
}
|
|
10301
10414
|
}
|
|
@@ -10339,7 +10452,7 @@ function _expanduser(p) {
|
|
|
10339
10452
|
return os6.homedir();
|
|
10340
10453
|
}
|
|
10341
10454
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
10342
|
-
return
|
|
10455
|
+
return path13.join(os6.homedir(), p.slice(2));
|
|
10343
10456
|
}
|
|
10344
10457
|
return p;
|
|
10345
10458
|
}
|
|
@@ -10368,13 +10481,13 @@ function resolve_project_root(arg, options = {}) {
|
|
|
10368
10481
|
function _resolve_cascade_paths(cwd, project_path) {
|
|
10369
10482
|
if (cwd === null) {
|
|
10370
10483
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
10371
|
-
const parent =
|
|
10484
|
+
const parent = path13.dirname(legacy);
|
|
10372
10485
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
10373
10486
|
}
|
|
10374
10487
|
const root = find_project_root(cwd);
|
|
10375
10488
|
if (root === null) {
|
|
10376
10489
|
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
10377
|
-
const parent =
|
|
10490
|
+
const parent = path13.dirname(legacy);
|
|
10378
10491
|
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
10379
10492
|
}
|
|
10380
10493
|
const cwd_resolved = _resolve(cwd);
|
|
@@ -10385,7 +10498,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
10385
10498
|
if (cursor === root) {
|
|
10386
10499
|
break;
|
|
10387
10500
|
}
|
|
10388
|
-
const parent =
|
|
10501
|
+
const parent = path13.dirname(cursor);
|
|
10389
10502
|
if (parent === cursor) {
|
|
10390
10503
|
break;
|
|
10391
10504
|
}
|
|
@@ -10393,7 +10506,7 @@ function _resolve_cascade_paths(cwd, project_path) {
|
|
|
10393
10506
|
}
|
|
10394
10507
|
chain.reverse();
|
|
10395
10508
|
return [
|
|
10396
|
-
...chain.map((d) =>
|
|
10509
|
+
...chain.map((d) => path13.join(d, DEFAULT_PROJECT_FILE)),
|
|
10397
10510
|
_canonical_settings_path(root),
|
|
10398
10511
|
_local_settings_path(root)
|
|
10399
10512
|
];
|
|
@@ -10480,7 +10593,7 @@ function _read_yaml(p) {
|
|
|
10480
10593
|
}
|
|
10481
10594
|
let data;
|
|
10482
10595
|
try {
|
|
10483
|
-
const text =
|
|
10596
|
+
const text = fs14.readFileSync(p, "utf-8");
|
|
10484
10597
|
data = YAML3.parse(text, { version: "1.1" });
|
|
10485
10598
|
if (data === null || data === void 0) {
|
|
10486
10599
|
data = {};
|
|
@@ -10580,11 +10693,11 @@ function _is_plain_dict(value) {
|
|
|
10580
10693
|
}
|
|
10581
10694
|
|
|
10582
10695
|
// src/install/rule_scope.ts
|
|
10583
|
-
import * as
|
|
10696
|
+
import * as path14 from "node:path";
|
|
10584
10697
|
|
|
10585
10698
|
// src/install/ruleInScope.ts
|
|
10586
10699
|
var YAML2 = __toESM(require_dist(), 1);
|
|
10587
|
-
import * as
|
|
10700
|
+
import * as fs15 from "node:fs";
|
|
10588
10701
|
function parseYaml2(text) {
|
|
10589
10702
|
try {
|
|
10590
10703
|
const data = YAML2.parse(text, { version: "1.1" });
|
|
@@ -10622,7 +10735,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
|
|
|
10622
10735
|
if (scope === null && pack_scope === null && role_scope === null) {
|
|
10623
10736
|
return true;
|
|
10624
10737
|
}
|
|
10625
|
-
const [meta] = parseFrontmatter(
|
|
10738
|
+
const [meta] = parseFrontmatter(fs15.readFileSync(source_path, "utf-8"));
|
|
10626
10739
|
if (meta["type"] === "always" || meta["alwaysApply"] === true) {
|
|
10627
10740
|
return true;
|
|
10628
10741
|
}
|
|
@@ -10673,34 +10786,34 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
10673
10786
|
if (!sourcePath.endsWith(".md")) {
|
|
10674
10787
|
return true;
|
|
10675
10788
|
}
|
|
10676
|
-
const
|
|
10677
|
-
if (COMPAT_ALWAYS_EXCLUDED.includes(
|
|
10789
|
+
const basename7 = path14.basename(sourcePath);
|
|
10790
|
+
if (COMPAT_ALWAYS_EXCLUDED.includes(basename7)) {
|
|
10678
10791
|
return false;
|
|
10679
10792
|
}
|
|
10680
10793
|
return rule_in_scope(sourcePath, scope.workspaces, scope.packs, scope.roles ?? null);
|
|
10681
10794
|
}
|
|
10682
10795
|
|
|
10683
10796
|
// src/install/partitionEligibility.ts
|
|
10684
|
-
import * as
|
|
10797
|
+
import * as fs17 from "node:fs";
|
|
10685
10798
|
import * as os7 from "node:os";
|
|
10686
10799
|
|
|
10687
10800
|
// src/install/hostLayerFingerprint.ts
|
|
10688
10801
|
import { createHash as createHash4 } from "node:crypto";
|
|
10689
|
-
import * as
|
|
10690
|
-
import * as
|
|
10802
|
+
import * as fs16 from "node:fs";
|
|
10803
|
+
import * as path15 from "node:path";
|
|
10691
10804
|
var FINGERPRINT_SCHEMA = 1;
|
|
10692
10805
|
function collectFiles(dir) {
|
|
10693
10806
|
const out = [];
|
|
10694
10807
|
const walk = (d) => {
|
|
10695
10808
|
let entries;
|
|
10696
10809
|
try {
|
|
10697
|
-
entries =
|
|
10810
|
+
entries = fs16.readdirSync(d, { withFileTypes: true });
|
|
10698
10811
|
} catch {
|
|
10699
10812
|
return;
|
|
10700
10813
|
}
|
|
10701
10814
|
const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
10702
10815
|
for (const e of sorted) {
|
|
10703
|
-
const p =
|
|
10816
|
+
const p = path15.join(d, e.name);
|
|
10704
10817
|
if (e.isDirectory()) {
|
|
10705
10818
|
walk(p);
|
|
10706
10819
|
} else if (e.isFile()) {
|
|
@@ -10717,10 +10830,10 @@ function fingerprintLayers(layers) {
|
|
|
10717
10830
|
for (const layer of layers) {
|
|
10718
10831
|
h.update(`layer:${layer.label}\0`);
|
|
10719
10832
|
for (const file of collectFiles(layer.root)) {
|
|
10720
|
-
h.update(
|
|
10833
|
+
h.update(path15.relative(layer.root, file));
|
|
10721
10834
|
h.update("\0");
|
|
10722
10835
|
try {
|
|
10723
|
-
h.update(
|
|
10836
|
+
h.update(fs16.readFileSync(file));
|
|
10724
10837
|
} catch {
|
|
10725
10838
|
h.update("\0unreadable\0");
|
|
10726
10839
|
}
|
|
@@ -10730,11 +10843,11 @@ function fingerprintLayers(layers) {
|
|
|
10730
10843
|
return h.digest("hex");
|
|
10731
10844
|
}
|
|
10732
10845
|
function hostLayerInputs(userHome) {
|
|
10733
|
-
const claude =
|
|
10846
|
+
const claude = path15.join(userHome, ".claude");
|
|
10734
10847
|
return [
|
|
10735
|
-
{ label: "rules", root:
|
|
10736
|
-
{ label: "skills", root:
|
|
10737
|
-
{ label: "commands", root:
|
|
10848
|
+
{ label: "rules", root: path15.join(claude, "rules") },
|
|
10849
|
+
{ label: "skills", root: path15.join(claude, "skills") },
|
|
10850
|
+
{ label: "commands", root: path15.join(claude, "commands") }
|
|
10738
10851
|
];
|
|
10739
10852
|
}
|
|
10740
10853
|
|
|
@@ -10743,7 +10856,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
|
|
|
10743
10856
|
function isExclusivelyPackageOnly(source_path) {
|
|
10744
10857
|
let meta;
|
|
10745
10858
|
try {
|
|
10746
|
-
[meta] = parseFrontmatter(
|
|
10859
|
+
[meta] = parseFrontmatter(fs17.readFileSync(source_path, "utf-8"));
|
|
10747
10860
|
} catch {
|
|
10748
10861
|
return false;
|
|
10749
10862
|
}
|
|
@@ -11324,8 +11437,8 @@ function getErrorMap() {
|
|
|
11324
11437
|
|
|
11325
11438
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
11326
11439
|
var makeIssue = (params) => {
|
|
11327
|
-
const { data, path:
|
|
11328
|
-
const fullPath = [...
|
|
11440
|
+
const { data, path: path20, errorMaps, issueData } = params;
|
|
11441
|
+
const fullPath = [...path20, ...issueData.path || []];
|
|
11329
11442
|
const fullIssue = {
|
|
11330
11443
|
...issueData,
|
|
11331
11444
|
path: fullPath
|
|
@@ -11441,11 +11554,11 @@ var errorUtil;
|
|
|
11441
11554
|
|
|
11442
11555
|
// node_modules/zod/v3/types.js
|
|
11443
11556
|
var ParseInputLazyPath = class {
|
|
11444
|
-
constructor(parent, value,
|
|
11557
|
+
constructor(parent, value, path20, key) {
|
|
11445
11558
|
this._cachedPath = [];
|
|
11446
11559
|
this.parent = parent;
|
|
11447
11560
|
this.data = value;
|
|
11448
|
-
this._path =
|
|
11561
|
+
this._path = path20;
|
|
11449
11562
|
this._key = key;
|
|
11450
11563
|
}
|
|
11451
11564
|
get path() {
|
|
@@ -15378,6 +15491,11 @@ var settingsSchema = external_exports.object({
|
|
|
15378
15491
|
"PreToolUse anti-slop nudge (road-to-anti-slop-detector Phase 3). Default off. When on, runs the lint_design_slop registry against about-to-be-written UI content and WARNS (never blocks) on P0/P1 aesthetic tells (side-stripe, gradient-text, magic z-index, \u2026). Flags are rebuttable via DESIGN.md / design-slop-disable. Anti-loop: a file::rule signature surfaced 3x goes silent. Host-limited convenience layer; the universal gate is the lint_design_slop linter/CI."
|
|
15379
15492
|
)
|
|
15380
15493
|
}).default({}),
|
|
15494
|
+
design_pass: external_exports.object({
|
|
15495
|
+
enabled: external_exports.boolean().default(false).describe(
|
|
15496
|
+
"PostToolUse + stop design pass (road-to-frontend-power E1.1/E1.2/E1.3). Default off. One concern on two slots: on post_tool_use a write to a UI surface delivers the design findings as context and never blocks; on stop the same pass runs over every UI file touched this session, deduped against what the post pass surfaced, and a P0 objective floor (contrast, font size, heading skip, focus) blocks with a continuation. P1-P3 never block. post_tool_use rather than pre_tool_use for two measured reasons: pre_tool_use is declared by three hosts and honoured by one while post_tool_use is declared by six, and _lib/ui_surface.ts is a path predicate, so a pre-write gate cannot fire on the first write of a new surface. A pass that could not fully run reports verification: degraded with a reason rather than passing silently. Does not replace design_slop: two design keys is the honest state until the tiering experiment has a number."
|
|
15497
|
+
)
|
|
15498
|
+
}).default({}),
|
|
15381
15499
|
ui_route_nudge: external_exports.object({
|
|
15382
15500
|
enabled: external_exports.boolean().default(false).describe(
|
|
15383
15501
|
"PreToolUse UI-route nudge (road-to-frontend-skill-application Phase 4). Default off. When on, a Write/Edit to a UI surface with no design consultation latched this session WARNS (never blocks) naming the route \u2014 run existing-ui-audit, then the fe-design loop. A read or search touching fe-design / existing-ui-audit / design-review / design-intelligence latches consultation and silences it for the session. Anti-loop: at most 2 nudges per session. It does not read the rules: the UI-surface decision comes from _lib/ui_surface.ts and no code parses rule frontmatter, so this runs parallel to the two UI rules rather than consuming their triggers, and a test keeps the sets from drifting. It is a nudge, so their enforced_by: none stays accurate."
|
|
@@ -15387,6 +15505,11 @@ var settingsSchema = external_exports.object({
|
|
|
15387
15505
|
enabled: external_exports.boolean().default(false).describe(
|
|
15388
15506
|
"PreToolUse code-graph nudge (ADR-124 Phase 4). Default off. When on AND a native code-graph cache or a consumer-shipped graph.json/SCIP index is present, warns once per session (never blocks) as the agent is about to Grep/Glob or Read a source file \u2014 query the graph first for who-calls/where-used/impact questions (or rebuild if stale, build if absent). Source G\u2019s strict block-first-read mode is deliberately un-ported."
|
|
15389
15507
|
)
|
|
15508
|
+
}).default({}),
|
|
15509
|
+
suggestion_capture: external_exports.object({
|
|
15510
|
+
enabled: external_exports.boolean().default(false).describe(
|
|
15511
|
+
'Suggestion-block capture (road-to-suggestion-block-capture Phase 2). Default off. Two slots: `stop` reads `last_assistant_message` \u2014 a payload field, so no transcript file is read \u2014 and latches that the assistant turn carried a numbered-options block; `user_prompt_submit` CONSUMES that latch and classifies the answering turn as option_n / as_is / other / stale_block. Consume-once is the correctness guard: the latch is deleted on read, so a bare "1" three turns later meets no latch and classifies `other`, and a latch past its TTL or unparseable is `stale_block` rather than a guess. Writes COUNTS ONLY to agents/runtime/state/audit/suggestion-capture.jsonl \u2014 the record type has no field able to hold a prompt, an option label or a command name, and a test asserts the written key set against src/config/suggestion-capture.json. Off by default because this is an INSTRUMENT rather than a feature: it exists so a capture rate can be measured on a maintainer workspace over a fixed soak window, and there is nothing in it for a consumer to gain.'
|
|
15512
|
+
)
|
|
15390
15513
|
}).default({})
|
|
15391
15514
|
// `turn_end_gate` is deliberately ABSENT. The stop-slot turn-end gate is
|
|
15392
15515
|
// always armed (2026-08-12) and has no settings surface: whether it
|
|
@@ -16723,8 +16846,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
16723
16846
|
};
|
|
16724
16847
|
|
|
16725
16848
|
// src/scripts/_lib/module_detection.ts
|
|
16726
|
-
import * as
|
|
16727
|
-
import * as
|
|
16849
|
+
import * as fs18 from "node:fs";
|
|
16850
|
+
import * as path16 from "node:path";
|
|
16728
16851
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
16729
16852
|
var _RULES = [
|
|
16730
16853
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -16738,14 +16861,14 @@ var _RULES = [
|
|
|
16738
16861
|
];
|
|
16739
16862
|
function _isDir(p) {
|
|
16740
16863
|
try {
|
|
16741
|
-
return
|
|
16864
|
+
return fs18.statSync(p).isDirectory();
|
|
16742
16865
|
} catch {
|
|
16743
16866
|
return false;
|
|
16744
16867
|
}
|
|
16745
16868
|
}
|
|
16746
16869
|
function _isFile(p) {
|
|
16747
16870
|
try {
|
|
16748
|
-
return
|
|
16871
|
+
return fs18.statSync(p).isFile();
|
|
16749
16872
|
} catch {
|
|
16750
16873
|
return false;
|
|
16751
16874
|
}
|
|
@@ -16759,13 +16882,13 @@ function _isUpperChar(ch) {
|
|
|
16759
16882
|
function _list_module_subdirs(root) {
|
|
16760
16883
|
let entries;
|
|
16761
16884
|
try {
|
|
16762
|
-
entries =
|
|
16885
|
+
entries = fs18.readdirSync(root).sort();
|
|
16763
16886
|
} catch {
|
|
16764
16887
|
return [];
|
|
16765
16888
|
}
|
|
16766
16889
|
const out = [];
|
|
16767
16890
|
for (const name of entries) {
|
|
16768
|
-
if (!_isDir(
|
|
16891
|
+
if (!_isDir(path16.join(root, name))) {
|
|
16769
16892
|
continue;
|
|
16770
16893
|
}
|
|
16771
16894
|
if (name.startsWith(".")) {
|
|
@@ -16787,11 +16910,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
16787
16910
|
return capitalized.length > 0 ? "high" : "medium";
|
|
16788
16911
|
}
|
|
16789
16912
|
if (stack === "node-monorepo") {
|
|
16790
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
16913
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path16.join(root, name, "package.json")));
|
|
16791
16914
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
16792
16915
|
}
|
|
16793
16916
|
if (stack === "python-src") {
|
|
16794
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
16917
|
+
const withInit = subdirs.filter((name) => _isFile(path16.join(root, name, "__init__.py")));
|
|
16795
16918
|
return withInit.length > 0 ? "high" : "medium";
|
|
16796
16919
|
}
|
|
16797
16920
|
if (stack === "go-internal") {
|
|
@@ -16803,7 +16926,7 @@ function detect_module_roots(project_root) {
|
|
|
16803
16926
|
const high = [];
|
|
16804
16927
|
const medium = [];
|
|
16805
16928
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
16806
|
-
const abs_path =
|
|
16929
|
+
const abs_path = path16.join(project_root, rel_path);
|
|
16807
16930
|
if (!_isDir(abs_path)) {
|
|
16808
16931
|
continue;
|
|
16809
16932
|
}
|
|
@@ -16825,7 +16948,7 @@ function detect_module_roots(project_root) {
|
|
|
16825
16948
|
}
|
|
16826
16949
|
|
|
16827
16950
|
// src/scripts/_lib/model_tier.ts
|
|
16828
|
-
import
|
|
16951
|
+
import fs19 from "node:fs";
|
|
16829
16952
|
var TIER_TO_CLAUDE_MODEL = {
|
|
16830
16953
|
frontier: "fable",
|
|
16831
16954
|
high: "opus",
|
|
@@ -16834,8 +16957,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
16834
16957
|
};
|
|
16835
16958
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
16836
16959
|
function read_model_tier(skill_md) {
|
|
16837
|
-
if (!
|
|
16838
|
-
const text =
|
|
16960
|
+
if (!fs19.existsSync(skill_md)) return null;
|
|
16961
|
+
const text = fs19.readFileSync(skill_md).toString("utf-8");
|
|
16839
16962
|
if (!text.startsWith("---\n")) return null;
|
|
16840
16963
|
const end = text.indexOf("\n---\n", 4);
|
|
16841
16964
|
if (end === -1) return null;
|
|
@@ -16852,39 +16975,39 @@ function render_native_model_md(text, tier) {
|
|
|
16852
16975
|
|
|
16853
16976
|
// src/scripts/_cli/cmd_migrate.ts
|
|
16854
16977
|
import { spawnSync } from "node:child_process";
|
|
16855
|
-
import * as
|
|
16856
|
-
import * as
|
|
16978
|
+
import * as fs21 from "node:fs";
|
|
16979
|
+
import * as path18 from "node:path";
|
|
16857
16980
|
import process2 from "node:process";
|
|
16858
16981
|
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
|
|
16859
16982
|
|
|
16860
16983
|
// src/scripts/_lib/package_root.ts
|
|
16861
|
-
import * as
|
|
16862
|
-
import * as
|
|
16984
|
+
import * as fs20 from "node:fs";
|
|
16985
|
+
import * as path17 from "node:path";
|
|
16863
16986
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
16864
16987
|
var PACKAGE_NAME = "@event4u/agent-config";
|
|
16865
16988
|
var MAX_ASCENT = 16;
|
|
16866
16989
|
function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
|
|
16867
16990
|
const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath3(fromUrlOrPath) : fromUrlOrPath;
|
|
16868
|
-
const startDir =
|
|
16991
|
+
const startDir = path17.dirname(start);
|
|
16869
16992
|
let dir = startDir;
|
|
16870
16993
|
for (let i = 0; i < MAX_ASCENT; i++) {
|
|
16871
|
-
const manifest =
|
|
16872
|
-
if (
|
|
16994
|
+
const manifest = path17.join(dir, "package.json");
|
|
16995
|
+
if (fs20.existsSync(manifest)) {
|
|
16873
16996
|
try {
|
|
16874
|
-
const parsed = JSON.parse(
|
|
16997
|
+
const parsed = JSON.parse(fs20.readFileSync(manifest, "utf8"));
|
|
16875
16998
|
if (parsed.name === PACKAGE_NAME) {
|
|
16876
16999
|
return dir;
|
|
16877
17000
|
}
|
|
16878
17001
|
} catch {
|
|
16879
17002
|
}
|
|
16880
17003
|
}
|
|
16881
|
-
const parent =
|
|
17004
|
+
const parent = path17.dirname(dir);
|
|
16882
17005
|
if (parent === dir) {
|
|
16883
17006
|
break;
|
|
16884
17007
|
}
|
|
16885
17008
|
dir = parent;
|
|
16886
17009
|
}
|
|
16887
|
-
return
|
|
17010
|
+
return path17.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
|
|
16888
17011
|
}
|
|
16889
17012
|
|
|
16890
17013
|
// src/scripts/_cli/cmd_migrate.ts
|
|
@@ -16905,7 +17028,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
|
16905
17028
|
var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
|
|
16906
17029
|
var LEGACY_STATE_V1_FILENAME = ".work-state.json";
|
|
16907
17030
|
var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
|
|
16908
|
-
var _HERE_DIR =
|
|
17031
|
+
var _HERE_DIR = path18.dirname(fileURLToPath4(import.meta.url));
|
|
16909
17032
|
var ArgparseExit = class extends Error {
|
|
16910
17033
|
code;
|
|
16911
17034
|
constructor(code) {
|
|
@@ -17004,38 +17127,38 @@ function _jsonDumpsIndentAscii(value, indent) {
|
|
|
17004
17127
|
}
|
|
17005
17128
|
function _isFile2(p) {
|
|
17006
17129
|
try {
|
|
17007
|
-
return
|
|
17130
|
+
return fs21.statSync(p).isFile();
|
|
17008
17131
|
} catch {
|
|
17009
17132
|
return false;
|
|
17010
17133
|
}
|
|
17011
17134
|
}
|
|
17012
17135
|
function _isDir2(p) {
|
|
17013
17136
|
try {
|
|
17014
|
-
return
|
|
17137
|
+
return fs21.statSync(p).isDirectory();
|
|
17015
17138
|
} catch {
|
|
17016
17139
|
return false;
|
|
17017
17140
|
}
|
|
17018
17141
|
}
|
|
17019
17142
|
function _isSymlink(p) {
|
|
17020
17143
|
try {
|
|
17021
|
-
return
|
|
17144
|
+
return fs21.lstatSync(p).isSymbolicLink();
|
|
17022
17145
|
} catch {
|
|
17023
17146
|
return false;
|
|
17024
17147
|
}
|
|
17025
17148
|
}
|
|
17026
17149
|
function _exists2(p) {
|
|
17027
17150
|
try {
|
|
17028
|
-
|
|
17151
|
+
fs21.lstatSync(p);
|
|
17029
17152
|
return true;
|
|
17030
17153
|
} catch {
|
|
17031
17154
|
return false;
|
|
17032
17155
|
}
|
|
17033
17156
|
}
|
|
17034
17157
|
function _readText(p) {
|
|
17035
|
-
return
|
|
17158
|
+
return fs21.readFileSync(p, { encoding: "utf-8" });
|
|
17036
17159
|
}
|
|
17037
17160
|
function _writeText(p, text) {
|
|
17038
|
-
|
|
17161
|
+
fs21.writeFileSync(p, text, { encoding: "utf-8" });
|
|
17039
17162
|
}
|
|
17040
17163
|
function _jsonLoadFile(p) {
|
|
17041
17164
|
return JSON.parse(_readText(p));
|
|
@@ -17091,7 +17214,7 @@ function _classify_symlink(link) {
|
|
|
17091
17214
|
}
|
|
17092
17215
|
let target;
|
|
17093
17216
|
try {
|
|
17094
|
-
target =
|
|
17217
|
+
target = fs21.readlinkSync(link);
|
|
17095
17218
|
} catch {
|
|
17096
17219
|
return null;
|
|
17097
17220
|
}
|
|
@@ -17102,16 +17225,16 @@ function _classify_symlink(link) {
|
|
|
17102
17225
|
return "user";
|
|
17103
17226
|
}
|
|
17104
17227
|
function _detect_legacy_state(project) {
|
|
17105
|
-
return _isFile2(
|
|
17228
|
+
return _isFile2(path18.join(project, LEGACY_STATE_FILENAME));
|
|
17106
17229
|
}
|
|
17107
17230
|
function _detect_legacy_settings(project) {
|
|
17108
17231
|
const found = [];
|
|
17109
17232
|
for (const name of LEGACY_SETTINGS_FILES) {
|
|
17110
|
-
const flat =
|
|
17233
|
+
const flat = path18.join(project, name);
|
|
17111
17234
|
if (_isFile2(flat)) {
|
|
17112
17235
|
found.push(flat);
|
|
17113
17236
|
}
|
|
17114
|
-
const typed =
|
|
17237
|
+
const typed = path18.join(project, "settings", name);
|
|
17115
17238
|
if (_isFile2(typed)) {
|
|
17116
17239
|
found.push(typed);
|
|
17117
17240
|
}
|
|
@@ -17119,25 +17242,25 @@ function _detect_legacy_settings(project) {
|
|
|
17119
17242
|
return found;
|
|
17120
17243
|
}
|
|
17121
17244
|
function _detect_empty_shell(project) {
|
|
17122
|
-
const shell =
|
|
17245
|
+
const shell = path18.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
17123
17246
|
if (!_isDir2(shell) || _isSymlink(shell)) {
|
|
17124
17247
|
return false;
|
|
17125
17248
|
}
|
|
17126
17249
|
try {
|
|
17127
|
-
return
|
|
17250
|
+
return fs21.readdirSync(shell).length === 0;
|
|
17128
17251
|
} catch {
|
|
17129
17252
|
return false;
|
|
17130
17253
|
}
|
|
17131
17254
|
}
|
|
17132
17255
|
function _detect_already_migrated(project) {
|
|
17133
|
-
if (_detect_npm(
|
|
17256
|
+
if (_detect_npm(path18.join(project, "package.json"))) {
|
|
17134
17257
|
return false;
|
|
17135
17258
|
}
|
|
17136
|
-
if (_detect_composer(
|
|
17259
|
+
if (_detect_composer(path18.join(project, "composer.json"))) {
|
|
17137
17260
|
return false;
|
|
17138
17261
|
}
|
|
17139
17262
|
for (const name of MANAGED_SYMLINKS) {
|
|
17140
|
-
if (_classify_symlink(
|
|
17263
|
+
if (_classify_symlink(path18.join(project, name)) === "legacy") {
|
|
17141
17264
|
return false;
|
|
17142
17265
|
}
|
|
17143
17266
|
}
|
|
@@ -17208,11 +17331,11 @@ function _purge_legacy_symlinks(project) {
|
|
|
17208
17331
|
const removed = [];
|
|
17209
17332
|
const preserved = [];
|
|
17210
17333
|
for (const name of MANAGED_SYMLINKS) {
|
|
17211
|
-
const link =
|
|
17334
|
+
const link = path18.join(project, name);
|
|
17212
17335
|
const kind = _classify_symlink(link);
|
|
17213
17336
|
if (kind === "legacy") {
|
|
17214
17337
|
try {
|
|
17215
|
-
|
|
17338
|
+
fs21.unlinkSync(link);
|
|
17216
17339
|
removed.push(name);
|
|
17217
17340
|
} catch {
|
|
17218
17341
|
preserved.push(name);
|
|
@@ -17224,14 +17347,14 @@ function _purge_legacy_symlinks(project) {
|
|
|
17224
17347
|
return [removed, preserved];
|
|
17225
17348
|
}
|
|
17226
17349
|
function _migrate_state_file(project) {
|
|
17227
|
-
const source =
|
|
17350
|
+
const source = path18.join(project, LEGACY_STATE_FILENAME);
|
|
17228
17351
|
if (!_isFile2(source)) {
|
|
17229
17352
|
return null;
|
|
17230
17353
|
}
|
|
17231
|
-
const target =
|
|
17354
|
+
const target = path18.join(project, LEGACY_STATE_V1_FILENAME);
|
|
17232
17355
|
if (_exists2(target)) {
|
|
17233
17356
|
try {
|
|
17234
|
-
|
|
17357
|
+
fs21.unlinkSync(source);
|
|
17235
17358
|
return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
|
|
17236
17359
|
} catch {
|
|
17237
17360
|
return null;
|
|
@@ -17246,7 +17369,7 @@ function _migrate_state_file(project) {
|
|
|
17246
17369
|
}
|
|
17247
17370
|
function _load_state_migrator() {
|
|
17248
17371
|
const pkg_root = resolvePackageRoot(import.meta.url);
|
|
17249
|
-
const rel =
|
|
17372
|
+
const rel = path18.join(
|
|
17250
17373
|
"agent-src",
|
|
17251
17374
|
"templates",
|
|
17252
17375
|
"scripts",
|
|
@@ -17254,8 +17377,8 @@ function _load_state_migrator() {
|
|
|
17254
17377
|
"migration",
|
|
17255
17378
|
"v0_to_v1.ts"
|
|
17256
17379
|
);
|
|
17257
|
-
const driver = [
|
|
17258
|
-
(p) =>
|
|
17380
|
+
const driver = [path18.join(pkg_root, "dist", rel), path18.join(pkg_root, "src", rel)].find(
|
|
17381
|
+
(p) => fs21.existsSync(p)
|
|
17259
17382
|
) ?? null;
|
|
17260
17383
|
if (driver === null) {
|
|
17261
17384
|
return null;
|
|
@@ -17263,12 +17386,12 @@ function _load_state_migrator() {
|
|
|
17263
17386
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
17264
17387
|
let tsxBin = null;
|
|
17265
17388
|
for (let dir = pkg_root; ; ) {
|
|
17266
|
-
const cand =
|
|
17267
|
-
if (
|
|
17389
|
+
const cand = path18.join(dir, "node_modules", ".bin", binName);
|
|
17390
|
+
if (fs21.existsSync(cand)) {
|
|
17268
17391
|
tsxBin = cand;
|
|
17269
17392
|
break;
|
|
17270
17393
|
}
|
|
17271
|
-
const parent =
|
|
17394
|
+
const parent = path18.dirname(dir);
|
|
17272
17395
|
if (parent === dir) break;
|
|
17273
17396
|
dir = parent;
|
|
17274
17397
|
}
|
|
@@ -17295,17 +17418,17 @@ function _delete_legacy_settings(project) {
|
|
|
17295
17418
|
const removed = [];
|
|
17296
17419
|
for (const p of _detect_legacy_settings(project)) {
|
|
17297
17420
|
try {
|
|
17298
|
-
|
|
17299
|
-
removed.push(
|
|
17421
|
+
fs21.unlinkSync(p);
|
|
17422
|
+
removed.push(path18.relative(project, p));
|
|
17300
17423
|
} catch {
|
|
17301
17424
|
continue;
|
|
17302
17425
|
}
|
|
17303
17426
|
}
|
|
17304
|
-
const settings_dir =
|
|
17427
|
+
const settings_dir = path18.join(project, "settings");
|
|
17305
17428
|
if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
|
|
17306
17429
|
try {
|
|
17307
|
-
if (
|
|
17308
|
-
|
|
17430
|
+
if (fs21.readdirSync(settings_dir).length === 0) {
|
|
17431
|
+
fs21.rmdirSync(settings_dir);
|
|
17309
17432
|
removed.push("settings/");
|
|
17310
17433
|
}
|
|
17311
17434
|
} catch {
|
|
@@ -17314,12 +17437,12 @@ function _delete_legacy_settings(project) {
|
|
|
17314
17437
|
return removed;
|
|
17315
17438
|
}
|
|
17316
17439
|
function _remove_empty_shell(project) {
|
|
17317
|
-
const shell =
|
|
17440
|
+
const shell = path18.join(project, LEGACY_AGENT_CONFIG_SHELL);
|
|
17318
17441
|
if (!_detect_empty_shell(project)) {
|
|
17319
17442
|
return false;
|
|
17320
17443
|
}
|
|
17321
17444
|
try {
|
|
17322
|
-
|
|
17445
|
+
fs21.rmdirSync(shell);
|
|
17323
17446
|
} catch {
|
|
17324
17447
|
return false;
|
|
17325
17448
|
}
|
|
@@ -17329,7 +17452,7 @@ function _reEscape(s) {
|
|
|
17329
17452
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
17330
17453
|
}
|
|
17331
17454
|
function _update_gitignore(project) {
|
|
17332
|
-
const gitignore =
|
|
17455
|
+
const gitignore = path18.join(project, ".gitignore");
|
|
17333
17456
|
const block = `${GITIGNORE_BLOCK_START}
|
|
17334
17457
|
${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
17335
17458
|
`;
|
|
@@ -17360,16 +17483,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
|
|
|
17360
17483
|
}
|
|
17361
17484
|
function _build_plan(project) {
|
|
17362
17485
|
return {
|
|
17363
|
-
npm: _detect_npm(
|
|
17364
|
-
composer: _detect_composer(
|
|
17486
|
+
npm: _detect_npm(path18.join(project, "package.json")),
|
|
17487
|
+
composer: _detect_composer(path18.join(project, "composer.json")),
|
|
17365
17488
|
symlinks_legacy: MANAGED_SYMLINKS.filter(
|
|
17366
|
-
(name) => _classify_symlink(
|
|
17489
|
+
(name) => _classify_symlink(path18.join(project, name)) === "legacy"
|
|
17367
17490
|
),
|
|
17368
17491
|
symlinks_user: MANAGED_SYMLINKS.filter(
|
|
17369
|
-
(name) => _classify_symlink(
|
|
17492
|
+
(name) => _classify_symlink(path18.join(project, name)) === "user"
|
|
17370
17493
|
),
|
|
17371
|
-
state_file: _isFile2(
|
|
17372
|
-
settings_files: _detect_legacy_settings(project).map((p) =>
|
|
17494
|
+
state_file: _isFile2(path18.join(project, LEGACY_STATE_FILENAME)),
|
|
17495
|
+
settings_files: _detect_legacy_settings(project).map((p) => path18.relative(project, p)),
|
|
17373
17496
|
empty_shell: _detect_empty_shell(project)
|
|
17374
17497
|
};
|
|
17375
17498
|
}
|
|
@@ -17433,10 +17556,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
|
|
|
17433
17556
|
}
|
|
17434
17557
|
function _apply(project, out, err) {
|
|
17435
17558
|
const summary = [];
|
|
17436
|
-
if (_strip_npm_entry(
|
|
17559
|
+
if (_strip_npm_entry(path18.join(project, "package.json"))) {
|
|
17437
17560
|
summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
|
|
17438
17561
|
}
|
|
17439
|
-
if (_strip_composer_entry(
|
|
17562
|
+
if (_strip_composer_entry(path18.join(project, "composer.json"))) {
|
|
17440
17563
|
summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
|
|
17441
17564
|
}
|
|
17442
17565
|
const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
|
|
@@ -17563,17 +17686,17 @@ function _isCliEntry() {
|
|
|
17563
17686
|
return false;
|
|
17564
17687
|
}
|
|
17565
17688
|
if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__) {
|
|
17566
|
-
if (
|
|
17689
|
+
if (path18.basename(process2.argv[1], ".js") === "cmd_migrate") {
|
|
17567
17690
|
return true;
|
|
17568
17691
|
}
|
|
17569
17692
|
}
|
|
17570
|
-
const argvUrl = pathToFileURL(
|
|
17693
|
+
const argvUrl = pathToFileURL(path18.resolve(process2.argv[1])).href;
|
|
17571
17694
|
if (import.meta.url === argvUrl) {
|
|
17572
17695
|
return true;
|
|
17573
17696
|
}
|
|
17574
17697
|
try {
|
|
17575
|
-
const here =
|
|
17576
|
-
const argv =
|
|
17698
|
+
const here = fs21.realpathSync(fileURLToPath4(import.meta.url));
|
|
17699
|
+
const argv = fs21.realpathSync(path18.resolve(process2.argv[1]));
|
|
17577
17700
|
return here === argv;
|
|
17578
17701
|
} catch {
|
|
17579
17702
|
return false;
|
|
@@ -17610,34 +17733,34 @@ var ArgparseExit2 = class extends Error {
|
|
|
17610
17733
|
function expanduser6(p) {
|
|
17611
17734
|
if (p === "~") return os8.homedir();
|
|
17612
17735
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
17613
|
-
return
|
|
17736
|
+
return path19.join(os8.homedir(), p.slice(2));
|
|
17614
17737
|
}
|
|
17615
17738
|
return p;
|
|
17616
17739
|
}
|
|
17617
17740
|
function resolvePath(p) {
|
|
17618
17741
|
try {
|
|
17619
|
-
return
|
|
17742
|
+
return fs22.realpathSync(path19.resolve(p));
|
|
17620
17743
|
} catch {
|
|
17621
|
-
return
|
|
17744
|
+
return path19.resolve(p);
|
|
17622
17745
|
}
|
|
17623
17746
|
}
|
|
17624
17747
|
function isFile(p) {
|
|
17625
17748
|
try {
|
|
17626
|
-
return
|
|
17749
|
+
return fs22.statSync(p).isFile();
|
|
17627
17750
|
} catch {
|
|
17628
17751
|
return false;
|
|
17629
17752
|
}
|
|
17630
17753
|
}
|
|
17631
17754
|
function isDir(p) {
|
|
17632
17755
|
try {
|
|
17633
|
-
return
|
|
17756
|
+
return fs22.statSync(p).isDirectory();
|
|
17634
17757
|
} catch {
|
|
17635
17758
|
return false;
|
|
17636
17759
|
}
|
|
17637
17760
|
}
|
|
17638
17761
|
function pathExists(p) {
|
|
17639
17762
|
try {
|
|
17640
|
-
|
|
17763
|
+
fs22.statSync(p);
|
|
17641
17764
|
return true;
|
|
17642
17765
|
} catch {
|
|
17643
17766
|
return false;
|
|
@@ -17645,24 +17768,24 @@ function pathExists(p) {
|
|
|
17645
17768
|
}
|
|
17646
17769
|
function isSymlink(p) {
|
|
17647
17770
|
try {
|
|
17648
|
-
return
|
|
17771
|
+
return fs22.lstatSync(p).isSymbolicLink();
|
|
17649
17772
|
} catch {
|
|
17650
17773
|
return false;
|
|
17651
17774
|
}
|
|
17652
17775
|
}
|
|
17653
17776
|
function readText(p) {
|
|
17654
|
-
return
|
|
17777
|
+
return fs22.readFileSync(p, "utf-8");
|
|
17655
17778
|
}
|
|
17656
17779
|
function writeText(p, content) {
|
|
17657
|
-
|
|
17780
|
+
fs22.writeFileSync(p, content, "utf-8");
|
|
17658
17781
|
}
|
|
17659
17782
|
function mkdirp(p) {
|
|
17660
|
-
|
|
17783
|
+
fs22.mkdirSync(p, { recursive: true });
|
|
17661
17784
|
}
|
|
17662
17785
|
function sortedGlobStems(directory, suffix) {
|
|
17663
17786
|
let entries;
|
|
17664
17787
|
try {
|
|
17665
|
-
entries =
|
|
17788
|
+
entries = fs22.readdirSync(directory);
|
|
17666
17789
|
} catch {
|
|
17667
17790
|
return [];
|
|
17668
17791
|
}
|
|
@@ -17682,7 +17805,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
17682
17805
|
function countZips(directory) {
|
|
17683
17806
|
if (!isDir(directory)) return 0;
|
|
17684
17807
|
let n = 0;
|
|
17685
|
-
for (const name of
|
|
17808
|
+
for (const name of fs22.readdirSync(directory)) {
|
|
17686
17809
|
if (name.endsWith(".zip")) n += 1;
|
|
17687
17810
|
}
|
|
17688
17811
|
return n;
|
|
@@ -17690,35 +17813,35 @@ function countZips(directory) {
|
|
|
17690
17813
|
function sha256OfFile(p) {
|
|
17691
17814
|
let data;
|
|
17692
17815
|
try {
|
|
17693
|
-
data =
|
|
17816
|
+
data = fs22.readFileSync(p);
|
|
17694
17817
|
} catch {
|
|
17695
17818
|
return null;
|
|
17696
17819
|
}
|
|
17697
17820
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
17698
17821
|
}
|
|
17699
17822
|
function atomicWrite0644(target, body, prefix) {
|
|
17700
|
-
const dir =
|
|
17701
|
-
const tmpName =
|
|
17823
|
+
const dir = path19.dirname(target);
|
|
17824
|
+
const tmpName = path19.join(
|
|
17702
17825
|
dir,
|
|
17703
17826
|
`${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
17704
17827
|
);
|
|
17705
17828
|
let fd = null;
|
|
17706
17829
|
try {
|
|
17707
|
-
fd =
|
|
17708
|
-
|
|
17709
|
-
|
|
17830
|
+
fd = fs22.openSync(tmpName, "wx", 420);
|
|
17831
|
+
fs22.writeFileSync(fd, body, "utf-8");
|
|
17832
|
+
fs22.closeSync(fd);
|
|
17710
17833
|
fd = null;
|
|
17711
|
-
|
|
17712
|
-
|
|
17834
|
+
fs22.chmodSync(tmpName, 420);
|
|
17835
|
+
fs22.renameSync(tmpName, target);
|
|
17713
17836
|
} catch (err) {
|
|
17714
17837
|
if (fd !== null) {
|
|
17715
17838
|
try {
|
|
17716
|
-
|
|
17839
|
+
fs22.closeSync(fd);
|
|
17717
17840
|
} catch {
|
|
17718
17841
|
}
|
|
17719
17842
|
}
|
|
17720
17843
|
try {
|
|
17721
|
-
|
|
17844
|
+
fs22.unlinkSync(tmpName);
|
|
17722
17845
|
} catch {
|
|
17723
17846
|
}
|
|
17724
17847
|
throw err;
|
|
@@ -17842,12 +17965,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
17842
17965
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
17843
17966
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
17844
17967
|
function _canonical_settings_target(project_root) {
|
|
17845
|
-
return
|
|
17968
|
+
return path19.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
17846
17969
|
}
|
|
17847
17970
|
function _resolve_settings_read(project_root) {
|
|
17848
17971
|
const canonical = _canonical_settings_target(project_root);
|
|
17849
17972
|
if (pathExists(canonical)) return canonical;
|
|
17850
|
-
const legacy =
|
|
17973
|
+
const legacy = path19.join(project_root, SETTINGS_FILE);
|
|
17851
17974
|
if (pathExists(legacy)) return legacy;
|
|
17852
17975
|
return canonical;
|
|
17853
17976
|
}
|
|
@@ -17911,9 +18034,9 @@ function fail(msg) {
|
|
|
17911
18034
|
throw new SystemExitError(1);
|
|
17912
18035
|
}
|
|
17913
18036
|
function detect_package_root(project_root) {
|
|
17914
|
-
const npm_path =
|
|
18037
|
+
const npm_path = path19.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
17915
18038
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
17916
|
-
if (pathExists(
|
|
18039
|
+
if (pathExists(path19.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
17917
18040
|
return project_root;
|
|
17918
18041
|
}
|
|
17919
18042
|
fail(
|
|
@@ -17921,12 +18044,12 @@ function detect_package_root(project_root) {
|
|
|
17921
18044
|
);
|
|
17922
18045
|
}
|
|
17923
18046
|
function detect_package_type(package_root) {
|
|
17924
|
-
if (package_root.split(
|
|
18047
|
+
if (package_root.split(path19.sep).includes("node_modules")) return "npm";
|
|
17925
18048
|
return "local";
|
|
17926
18049
|
}
|
|
17927
18050
|
function detect_package_type_for_project(project_root, package_root) {
|
|
17928
18051
|
const npm_path = resolvePath(
|
|
17929
|
-
|
|
18052
|
+
path19.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
17930
18053
|
);
|
|
17931
18054
|
const package_resolved = resolvePath(package_root);
|
|
17932
18055
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -17946,7 +18069,7 @@ function ensure_directory(p) {
|
|
|
17946
18069
|
mkdirp(p);
|
|
17947
18070
|
}
|
|
17948
18071
|
function write_file(p, content) {
|
|
17949
|
-
ensure_directory(
|
|
18072
|
+
ensure_directory(path19.dirname(p));
|
|
17950
18073
|
writeText(p, content);
|
|
17951
18074
|
}
|
|
17952
18075
|
function read_json_file(p) {
|
|
@@ -18117,7 +18240,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
18117
18240
|
return rendered + "\n" + suffix;
|
|
18118
18241
|
}
|
|
18119
18242
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
18120
|
-
const legacy_target =
|
|
18243
|
+
const legacy_target = path19.join(project_root, LEGACY_SETTINGS_FILE);
|
|
18121
18244
|
if (!isFile(legacy_target)) return null;
|
|
18122
18245
|
const legacy_text = readText(legacy_target);
|
|
18123
18246
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -18132,9 +18255,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
18132
18255
|
}
|
|
18133
18256
|
}
|
|
18134
18257
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
18135
|
-
const backup_target =
|
|
18258
|
+
const backup_target = path19.join(project_root, LEGACY_BACKUP_FILE);
|
|
18136
18259
|
writeText(backup_target, legacy_text);
|
|
18137
|
-
|
|
18260
|
+
fs22.unlinkSync(legacy_target);
|
|
18138
18261
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
18139
18262
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
18140
18263
|
if (unknown.length > 0) {
|
|
@@ -18169,7 +18292,7 @@ function _render_template(template, profile_values) {
|
|
|
18169
18292
|
return body;
|
|
18170
18293
|
}
|
|
18171
18294
|
function _load_valid_user_types(package_root) {
|
|
18172
|
-
const directory =
|
|
18295
|
+
const directory = path19.join(package_root, USER_TYPES_DIR);
|
|
18173
18296
|
if (!isDir(directory)) return [];
|
|
18174
18297
|
return sortedGlobStems(directory, ".yml");
|
|
18175
18298
|
}
|
|
@@ -18226,8 +18349,8 @@ function splitlinesKeepends(text) {
|
|
|
18226
18349
|
}
|
|
18227
18350
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
18228
18351
|
const target = _canonical_settings_target(project_root);
|
|
18229
|
-
const profile_source =
|
|
18230
|
-
const template_source =
|
|
18352
|
+
const profile_source = path19.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
18353
|
+
const template_source = path19.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
18231
18354
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
18232
18355
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
18233
18356
|
const template = readText(template_source);
|
|
@@ -18241,21 +18364,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
18241
18364
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
18242
18365
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
18243
18366
|
fail(
|
|
18244
|
-
`Profile preset ${
|
|
18367
|
+
`Profile preset ${path19.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
18245
18368
|
);
|
|
18246
18369
|
}
|
|
18247
18370
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
18248
18371
|
let template_body = _render_template(template, profile_values);
|
|
18249
18372
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
18250
|
-
const legacy_root =
|
|
18373
|
+
const legacy_root = path19.join(project_root, SETTINGS_FILE);
|
|
18251
18374
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
18252
|
-
mkdirp(
|
|
18375
|
+
mkdirp(path19.dirname(target));
|
|
18253
18376
|
writeText(target, readText(legacy_root));
|
|
18254
|
-
|
|
18377
|
+
fs22.unlinkSync(legacy_root);
|
|
18255
18378
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
18256
18379
|
return;
|
|
18257
18380
|
}
|
|
18258
|
-
const legacy_target =
|
|
18381
|
+
const legacy_target = path19.join(project_root, LEGACY_SETTINGS_FILE);
|
|
18259
18382
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
18260
18383
|
warn(
|
|
18261
18384
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -18272,7 +18395,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
18272
18395
|
skip(`${SETTINGS_FILE} already exists`);
|
|
18273
18396
|
return;
|
|
18274
18397
|
}
|
|
18275
|
-
mkdirp(
|
|
18398
|
+
mkdirp(path19.dirname(target));
|
|
18276
18399
|
write_file(target, template_body);
|
|
18277
18400
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
18278
18401
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -18285,7 +18408,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
18285
18408
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
18286
18409
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
18287
18410
|
return merge_json_file(
|
|
18288
|
-
|
|
18411
|
+
path19.join(project_root, ".vscode", "settings.json"),
|
|
18289
18412
|
bridge,
|
|
18290
18413
|
force,
|
|
18291
18414
|
".vscode/settings.json"
|
|
@@ -18294,14 +18417,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
18294
18417
|
function ensure_augment_bridge(project_root, force) {
|
|
18295
18418
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
18296
18419
|
return merge_json_file(
|
|
18297
|
-
|
|
18420
|
+
path19.join(project_root, ".augment", "settings.json"),
|
|
18298
18421
|
bridge,
|
|
18299
18422
|
force,
|
|
18300
18423
|
".augment/settings.json"
|
|
18301
18424
|
);
|
|
18302
18425
|
}
|
|
18303
|
-
var AUGMENT_USER_DIR =
|
|
18304
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
18426
|
+
var AUGMENT_USER_DIR = path19.join(os8.homedir(), ".augment");
|
|
18427
|
+
var AUGMENT_USER_HOOKS_DIR = path19.join(AUGMENT_USER_DIR, "hooks");
|
|
18305
18428
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
18306
18429
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
18307
18430
|
"augment-chat-history.sh",
|
|
@@ -18317,29 +18440,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
18317
18440
|
["post_tool_use", "PostToolUse"]
|
|
18318
18441
|
];
|
|
18319
18442
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
18320
|
-
const src =
|
|
18443
|
+
const src = path19.join(package_root, "scripts", "hooks", name);
|
|
18321
18444
|
if (!pathExists(src)) {
|
|
18322
18445
|
skip(`augment trampoline missing in package: ${src}`);
|
|
18323
18446
|
return null;
|
|
18324
18447
|
}
|
|
18325
18448
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
18326
|
-
const dst =
|
|
18449
|
+
const dst = path19.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
18327
18450
|
const src_text = readText(src);
|
|
18328
18451
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18329
18452
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
18330
18453
|
} else {
|
|
18331
18454
|
writeText(dst, src_text);
|
|
18332
|
-
|
|
18455
|
+
fs22.chmodSync(dst, 493);
|
|
18333
18456
|
success(`~/.augment/hooks/${name} installed`);
|
|
18334
18457
|
}
|
|
18335
18458
|
return dst;
|
|
18336
18459
|
}
|
|
18337
18460
|
function _remove_legacy_augment_trampolines() {
|
|
18338
18461
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
18339
|
-
const legacy =
|
|
18462
|
+
const legacy = path19.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
18340
18463
|
try {
|
|
18341
18464
|
if (isFile(legacy)) {
|
|
18342
|
-
|
|
18465
|
+
fs22.unlinkSync(legacy);
|
|
18343
18466
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
18344
18467
|
}
|
|
18345
18468
|
} catch (err) {
|
|
@@ -18359,7 +18482,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
18359
18482
|
}
|
|
18360
18483
|
const settings_patch = { hooks: per_event };
|
|
18361
18484
|
return merge_json_file(
|
|
18362
|
-
|
|
18485
|
+
path19.join(AUGMENT_USER_DIR, "settings.json"),
|
|
18363
18486
|
settings_patch,
|
|
18364
18487
|
force,
|
|
18365
18488
|
"~/.augment/settings.json"
|
|
@@ -18384,7 +18507,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
18384
18507
|
return removed;
|
|
18385
18508
|
}
|
|
18386
18509
|
function ensure_claude_bridge(project_root, force) {
|
|
18387
|
-
const target =
|
|
18510
|
+
const target = path19.join(project_root, ".claude", "settings.json");
|
|
18388
18511
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
18389
18512
|
for (const pid of healed) {
|
|
18390
18513
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -18392,6 +18515,10 @@ function ensure_claude_bridge(project_root, force) {
|
|
|
18392
18515
|
const bridge = { enabledPlugins: { [CLAUDE_PLUGIN_ID]: true } };
|
|
18393
18516
|
return merge_json_file(target, bridge, force || healed.length > 0, ".claude/settings.json");
|
|
18394
18517
|
}
|
|
18518
|
+
var ensure_mcp_bridge = makeEnsureMcpBridge(merge_json_file);
|
|
18519
|
+
var _resolve_tier_b = resolveTierB;
|
|
18520
|
+
var _tier_b_advisory = tierBAdvisory;
|
|
18521
|
+
var _prune_tier_b_modules = (dr, tier_b) => _prune_modules_by(dr, tierBPrunePredicate(tier_b));
|
|
18395
18522
|
var CURSOR_DISPATCHER_BINDINGS = [
|
|
18396
18523
|
["session_start", "sessionStart"],
|
|
18397
18524
|
["session_end", "sessionEnd"],
|
|
@@ -18409,29 +18536,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
18409
18536
|
}
|
|
18410
18537
|
const bridge = { version: 1, hooks };
|
|
18411
18538
|
return merge_json_file(
|
|
18412
|
-
|
|
18539
|
+
path19.join(project_root, ".cursor", "hooks.json"),
|
|
18413
18540
|
bridge,
|
|
18414
18541
|
force,
|
|
18415
18542
|
".cursor/hooks.json"
|
|
18416
18543
|
);
|
|
18417
18544
|
}
|
|
18418
|
-
var CURSOR_USER_DIR =
|
|
18419
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
18545
|
+
var CURSOR_USER_DIR = path19.join(os8.homedir(), ".cursor");
|
|
18546
|
+
var CURSOR_USER_HOOKS_DIR = path19.join(CURSOR_USER_DIR, "hooks");
|
|
18420
18547
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
18421
18548
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
18422
|
-
const src =
|
|
18549
|
+
const src = path19.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
18423
18550
|
if (!pathExists(src)) {
|
|
18424
18551
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
18425
18552
|
return [];
|
|
18426
18553
|
}
|
|
18427
18554
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
18428
|
-
const dst =
|
|
18555
|
+
const dst = path19.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
18429
18556
|
const src_text = readText(src);
|
|
18430
18557
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18431
18558
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18432
18559
|
} else {
|
|
18433
18560
|
writeText(dst, src_text);
|
|
18434
|
-
|
|
18561
|
+
fs22.chmodSync(dst, 493);
|
|
18435
18562
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
18436
18563
|
}
|
|
18437
18564
|
const hooks = {};
|
|
@@ -18440,7 +18567,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
18440
18567
|
}
|
|
18441
18568
|
const settings_patch = { version: 1, hooks };
|
|
18442
18569
|
return merge_json_file(
|
|
18443
|
-
|
|
18570
|
+
path19.join(CURSOR_USER_DIR, "hooks.json"),
|
|
18444
18571
|
settings_patch,
|
|
18445
18572
|
force,
|
|
18446
18573
|
"~/.cursor/hooks.json"
|
|
@@ -18483,12 +18610,12 @@ exit 0
|
|
|
18483
18610
|
`;
|
|
18484
18611
|
}
|
|
18485
18612
|
function ensure_cline_bridge(project_root, force) {
|
|
18486
|
-
const hooks_dir =
|
|
18613
|
+
const hooks_dir = path19.join(project_root, ".clinerules", "hooks");
|
|
18487
18614
|
mkdirp(hooks_dir);
|
|
18488
18615
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
18489
18616
|
let written = 0;
|
|
18490
18617
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
18491
|
-
const target =
|
|
18618
|
+
const target = path19.join(hooks_dir, native_event);
|
|
18492
18619
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
18493
18620
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
18494
18621
|
continue;
|
|
@@ -18498,7 +18625,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
18498
18625
|
continue;
|
|
18499
18626
|
}
|
|
18500
18627
|
writeText(target, body);
|
|
18501
|
-
|
|
18628
|
+
fs22.chmodSync(target, 493);
|
|
18502
18629
|
written += 1;
|
|
18503
18630
|
}
|
|
18504
18631
|
if (written) {
|
|
@@ -18507,27 +18634,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
18507
18634
|
skip(".clinerules/hooks/ already up to date");
|
|
18508
18635
|
}
|
|
18509
18636
|
}
|
|
18510
|
-
var CLINE_USER_DIR =
|
|
18637
|
+
var CLINE_USER_DIR = path19.join(os8.homedir(), "Documents", "Cline", "Hooks");
|
|
18511
18638
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
18512
18639
|
function ensure_cline_user_hooks(package_root, force) {
|
|
18513
|
-
const src =
|
|
18640
|
+
const src = path19.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
18514
18641
|
if (!pathExists(src)) {
|
|
18515
18642
|
skip(`cline trampoline missing in package: ${src}`);
|
|
18516
18643
|
return;
|
|
18517
18644
|
}
|
|
18518
18645
|
mkdirp(CLINE_USER_DIR);
|
|
18519
|
-
const trampoline =
|
|
18646
|
+
const trampoline = path19.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
18520
18647
|
const src_text = readText(src);
|
|
18521
18648
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
18522
18649
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18523
18650
|
} else {
|
|
18524
18651
|
writeText(trampoline, src_text);
|
|
18525
|
-
|
|
18652
|
+
fs22.chmodSync(trampoline, 493);
|
|
18526
18653
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
18527
18654
|
}
|
|
18528
18655
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
18529
18656
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
18530
|
-
const wrapper =
|
|
18657
|
+
const wrapper = path19.join(CLINE_USER_DIR, native_event);
|
|
18531
18658
|
const body = `#!/usr/bin/env bash
|
|
18532
18659
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
18533
18660
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -18537,7 +18664,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
18537
18664
|
continue;
|
|
18538
18665
|
}
|
|
18539
18666
|
writeText(wrapper, body);
|
|
18540
|
-
|
|
18667
|
+
fs22.chmodSync(wrapper, 493);
|
|
18541
18668
|
}
|
|
18542
18669
|
}
|
|
18543
18670
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -18558,29 +18685,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
18558
18685
|
}
|
|
18559
18686
|
const bridge = { hooks };
|
|
18560
18687
|
return merge_json_file(
|
|
18561
|
-
|
|
18688
|
+
path19.join(project_root, ".windsurf", "hooks.json"),
|
|
18562
18689
|
bridge,
|
|
18563
18690
|
force,
|
|
18564
18691
|
".windsurf/hooks.json"
|
|
18565
18692
|
);
|
|
18566
18693
|
}
|
|
18567
|
-
var WINDSURF_USER_DIR =
|
|
18568
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
18694
|
+
var WINDSURF_USER_DIR = path19.join(os8.homedir(), ".codeium", "windsurf");
|
|
18695
|
+
var WINDSURF_USER_HOOKS_DIR = path19.join(WINDSURF_USER_DIR, "hooks");
|
|
18569
18696
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
18570
18697
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
18571
|
-
const src =
|
|
18698
|
+
const src = path19.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
18572
18699
|
if (!pathExists(src)) {
|
|
18573
18700
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
18574
18701
|
return [];
|
|
18575
18702
|
}
|
|
18576
18703
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
18577
|
-
const dst =
|
|
18704
|
+
const dst = path19.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
18578
18705
|
const src_text = readText(src);
|
|
18579
18706
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18580
18707
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18581
18708
|
} else {
|
|
18582
18709
|
writeText(dst, src_text);
|
|
18583
|
-
|
|
18710
|
+
fs22.chmodSync(dst, 493);
|
|
18584
18711
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
18585
18712
|
}
|
|
18586
18713
|
const hooks = {};
|
|
@@ -18592,7 +18719,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
18592
18719
|
}
|
|
18593
18720
|
const settings_patch = { hooks };
|
|
18594
18721
|
return merge_json_file(
|
|
18595
|
-
|
|
18722
|
+
path19.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
18596
18723
|
settings_patch,
|
|
18597
18724
|
force,
|
|
18598
18725
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -18621,43 +18748,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
18621
18748
|
function ensure_gemini_bridge(project_root, force) {
|
|
18622
18749
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
18623
18750
|
return merge_json_file(
|
|
18624
|
-
|
|
18751
|
+
path19.join(project_root, ".gemini", "settings.json"),
|
|
18625
18752
|
bridge,
|
|
18626
18753
|
force,
|
|
18627
18754
|
".gemini/settings.json"
|
|
18628
18755
|
);
|
|
18629
18756
|
}
|
|
18630
|
-
var GEMINI_USER_DIR =
|
|
18631
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
18757
|
+
var GEMINI_USER_DIR = path19.join(os8.homedir(), ".gemini");
|
|
18758
|
+
var GEMINI_USER_HOOKS_DIR = path19.join(GEMINI_USER_DIR, "hooks");
|
|
18632
18759
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
18633
18760
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
18634
|
-
const src =
|
|
18761
|
+
const src = path19.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18635
18762
|
if (!pathExists(src)) {
|
|
18636
18763
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
18637
18764
|
return [];
|
|
18638
18765
|
}
|
|
18639
18766
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
18640
|
-
const dst =
|
|
18767
|
+
const dst = path19.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
18641
18768
|
const src_text = readText(src);
|
|
18642
18769
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
18643
18770
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
18644
18771
|
} else {
|
|
18645
18772
|
writeText(dst, src_text);
|
|
18646
|
-
|
|
18773
|
+
fs22.chmodSync(dst, 493);
|
|
18647
18774
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
18648
18775
|
}
|
|
18649
18776
|
const settings_patch = {
|
|
18650
18777
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
18651
18778
|
};
|
|
18652
18779
|
return merge_json_file(
|
|
18653
|
-
|
|
18780
|
+
path19.join(GEMINI_USER_DIR, "settings.json"),
|
|
18654
18781
|
settings_patch,
|
|
18655
18782
|
force,
|
|
18656
18783
|
"~/.gemini/settings.json"
|
|
18657
18784
|
);
|
|
18658
18785
|
}
|
|
18659
18786
|
function ensure_copilot_bridge(project_root, force) {
|
|
18660
|
-
const target =
|
|
18787
|
+
const target = path19.join(project_root, ".github", "plugin", "marketplace.json");
|
|
18661
18788
|
const bridge = {
|
|
18662
18789
|
marketplace: {
|
|
18663
18790
|
name: "event4u-agent-marketplace",
|
|
@@ -18700,7 +18827,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
18700
18827
|
Run \`./agent-config --help\` for available commands.
|
|
18701
18828
|
`;
|
|
18702
18829
|
function ensure_roocode_bridge(project_root, force) {
|
|
18703
|
-
const target =
|
|
18830
|
+
const target = path19.join(project_root, ".roo", "rules", "agent-config.md");
|
|
18704
18831
|
if (pathExists(target) && !force) {
|
|
18705
18832
|
skip(".roo/rules/agent-config.md already exists");
|
|
18706
18833
|
return;
|
|
@@ -18722,7 +18849,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
18722
18849
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18723
18850
|
`;
|
|
18724
18851
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
18725
|
-
const target =
|
|
18852
|
+
const target = path19.join(project_root, ".claude-desktop", "agent-config.md");
|
|
18726
18853
|
if (pathExists(target) && !force) {
|
|
18727
18854
|
skip(".claude-desktop/agent-config.md already exists");
|
|
18728
18855
|
return;
|
|
@@ -18747,7 +18874,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
18747
18874
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18748
18875
|
`;
|
|
18749
18876
|
function ensure_aider_bridge(project_root, force) {
|
|
18750
|
-
const target =
|
|
18877
|
+
const target = path19.join(project_root, ".aider", "agent-config.md");
|
|
18751
18878
|
if (pathExists(target) && !force) {
|
|
18752
18879
|
skip(".aider/agent-config.md already exists");
|
|
18753
18880
|
return;
|
|
@@ -18766,7 +18893,7 @@ developers where the rules and skills live.
|
|
|
18766
18893
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
18767
18894
|
`;
|
|
18768
18895
|
function ensure_codex_bridge(project_root, force) {
|
|
18769
|
-
const target =
|
|
18896
|
+
const target = path19.join(project_root, ".codex", "agent-config.md");
|
|
18770
18897
|
if (pathExists(target) && !force) {
|
|
18771
18898
|
skip(".codex/agent-config.md already exists");
|
|
18772
18899
|
return;
|
|
@@ -18784,7 +18911,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
18784
18911
|
orientation).
|
|
18785
18912
|
`;
|
|
18786
18913
|
function ensure_continue_bridge(project_root, force) {
|
|
18787
|
-
const target =
|
|
18914
|
+
const target = path19.join(project_root, ".continue", "rules", "agent-config.md");
|
|
18788
18915
|
if (pathExists(target) && !force) {
|
|
18789
18916
|
skip(".continue/rules/agent-config.md already exists");
|
|
18790
18917
|
return;
|
|
@@ -18815,7 +18942,7 @@ orientation).
|
|
|
18815
18942
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
18816
18943
|
`;
|
|
18817
18944
|
function ensure_kilocode_bridge(project_root, force) {
|
|
18818
|
-
const target =
|
|
18945
|
+
const target = path19.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
18819
18946
|
if (pathExists(target) && !force) {
|
|
18820
18947
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
18821
18948
|
return;
|
|
@@ -18842,7 +18969,7 @@ canonical source (or symlink it):
|
|
|
18842
18969
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18843
18970
|
`;
|
|
18844
18971
|
function ensure_zed_bridge(project_root, force) {
|
|
18845
|
-
const target =
|
|
18972
|
+
const target = path19.join(project_root, ".zed", "agent-config.md");
|
|
18846
18973
|
if (pathExists(target) && !force) {
|
|
18847
18974
|
skip(".zed/agent-config.md already exists");
|
|
18848
18975
|
return;
|
|
@@ -18863,7 +18990,7 @@ rules into your JetBrains profile.
|
|
|
18863
18990
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
18864
18991
|
`;
|
|
18865
18992
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
18866
|
-
const target =
|
|
18993
|
+
const target = path19.join(project_root, ".jetbrains", "agent-config.md");
|
|
18867
18994
|
if (pathExists(target) && !force) {
|
|
18868
18995
|
skip(".jetbrains/agent-config.md already exists");
|
|
18869
18996
|
return;
|
|
@@ -18894,7 +19021,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
18894
19021
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
18895
19022
|
`;
|
|
18896
19023
|
function ensure_kiro_bridge(project_root, force) {
|
|
18897
|
-
const target =
|
|
19024
|
+
const target = path19.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
18898
19025
|
if (pathExists(target) && !force) {
|
|
18899
19026
|
skip(".kiro/steering/agent-config.md already exists");
|
|
18900
19027
|
return;
|
|
@@ -18920,35 +19047,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
18920
19047
|
};
|
|
18921
19048
|
function dirHasEntries(p) {
|
|
18922
19049
|
try {
|
|
18923
|
-
return
|
|
19050
|
+
return fs22.readdirSync(p).length > 0;
|
|
18924
19051
|
} catch {
|
|
18925
19052
|
return false;
|
|
18926
19053
|
}
|
|
18927
19054
|
}
|
|
18928
19055
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
18929
19056
|
const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
18930
|
-
let dir =
|
|
19057
|
+
let dir = path19.dirname(scriptPath);
|
|
18931
19058
|
for (; ; ) {
|
|
18932
|
-
const candidate =
|
|
19059
|
+
const candidate = path19.join(dir, "node_modules", ".bin", binName);
|
|
18933
19060
|
if (isFile(candidate)) {
|
|
18934
19061
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
18935
19062
|
}
|
|
18936
|
-
const parent =
|
|
19063
|
+
const parent = path19.dirname(dir);
|
|
18937
19064
|
if (parent === dir) break;
|
|
18938
19065
|
dir = parent;
|
|
18939
19066
|
}
|
|
18940
19067
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
18941
19068
|
}
|
|
18942
19069
|
function _smoke_test_hooks(project_root, package_root) {
|
|
18943
|
-
const dispatcher =
|
|
18944
|
-
const manifest =
|
|
19070
|
+
const dispatcher = path19.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
19071
|
+
const manifest = path19.join(package_root, "scripts", "hook_manifest.yaml");
|
|
18945
19072
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
18946
19073
|
const failed = [];
|
|
18947
19074
|
const skipped = [];
|
|
18948
19075
|
const passed = [];
|
|
18949
19076
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
18950
19077
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
18951
|
-
const bridge_path = rel_bridge ?
|
|
19078
|
+
const bridge_path = rel_bridge ? path19.join(project_root, rel_bridge) : null;
|
|
18952
19079
|
const bridge_present = Boolean(
|
|
18953
19080
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
18954
19081
|
);
|
|
@@ -19148,9 +19275,9 @@ To remove this marker, delete this file.
|
|
|
19148
19275
|
`;
|
|
19149
19276
|
}
|
|
19150
19277
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
19151
|
-
var GLOBAL_ROOT =
|
|
19152
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
19153
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
19278
|
+
var GLOBAL_ROOT = path19.join(os8.homedir(), ".event4u", "agent-config");
|
|
19279
|
+
var GLOBAL_USER_SETTINGS_PATH = path19.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
19280
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path19.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
19154
19281
|
function _bridge_marker(tool_id, scope) {
|
|
19155
19282
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
19156
19283
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -19199,7 +19326,7 @@ function _load_yaml_doc(p) {
|
|
|
19199
19326
|
return _isPlainObject2(data) ? data : {};
|
|
19200
19327
|
}
|
|
19201
19328
|
function _load_default_settings(package_root) {
|
|
19202
|
-
const template_source =
|
|
19329
|
+
const template_source = path19.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
19203
19330
|
if (!pathExists(template_source)) return {};
|
|
19204
19331
|
let text;
|
|
19205
19332
|
try {
|
|
@@ -19213,11 +19340,11 @@ function _load_default_settings(package_root) {
|
|
|
19213
19340
|
}
|
|
19214
19341
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
19215
19342
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
19216
|
-
const target =
|
|
19343
|
+
const target = path19.join(project_root, ".claude", "settings.local.json");
|
|
19217
19344
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
19218
19345
|
let real_dir = suppress_dir;
|
|
19219
19346
|
try {
|
|
19220
|
-
real_dir =
|
|
19347
|
+
real_dir = fs22.realpathSync(suppress_dir);
|
|
19221
19348
|
} catch {
|
|
19222
19349
|
real_dir = suppress_dir;
|
|
19223
19350
|
}
|
|
@@ -19228,8 +19355,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
19228
19355
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
19229
19356
|
}
|
|
19230
19357
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
19231
|
-
const global_dir =
|
|
19232
|
-
const project_dir =
|
|
19358
|
+
const global_dir = path19.join(os8.homedir(), ".claude", "rules");
|
|
19359
|
+
const project_dir = path19.join(project_root, ".claude", "rules");
|
|
19233
19360
|
const g = readRuleLayer(global_dir);
|
|
19234
19361
|
const p = readRuleLayer(project_dir);
|
|
19235
19362
|
if (g === null || p === null) return true;
|
|
@@ -19339,9 +19466,9 @@ function detect_scope(cwd) {
|
|
|
19339
19466
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
19340
19467
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
19341
19468
|
}
|
|
19342
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
19343
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
19344
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
19469
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path19.join(cwd, m))) ?? null;
|
|
19470
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path19.join(cwd, d))) ?? null;
|
|
19471
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path19.join(cwd, f))) ?? null;
|
|
19345
19472
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
19346
19473
|
const marker = has_ai_dir || has_ai_file;
|
|
19347
19474
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -19362,7 +19489,7 @@ function readLineSyncRaw(promptText) {
|
|
|
19362
19489
|
for (; ; ) {
|
|
19363
19490
|
let n;
|
|
19364
19491
|
try {
|
|
19365
|
-
n =
|
|
19492
|
+
n = fs22.readSync(0, buf, 0, 1, null);
|
|
19366
19493
|
} catch (err) {
|
|
19367
19494
|
const code = err.code;
|
|
19368
19495
|
if (code === "EAGAIN") {
|
|
@@ -19437,8 +19564,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
19437
19564
|
const marker = _bridge_marker(tool_id, scope);
|
|
19438
19565
|
if (!marker) continue;
|
|
19439
19566
|
let marker_path = marker;
|
|
19440
|
-
if (!
|
|
19441
|
-
marker_path =
|
|
19567
|
+
if (!path19.isAbsolute(marker_path)) {
|
|
19568
|
+
marker_path = path19.join(project_root, marker_path);
|
|
19442
19569
|
}
|
|
19443
19570
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
19444
19571
|
}
|
|
@@ -19477,26 +19604,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
19477
19604
|
}
|
|
19478
19605
|
write_manifest(target, version, entries);
|
|
19479
19606
|
if (!state.QUIET) {
|
|
19480
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
19607
|
+
const rel = isRelativeTo(target, project_root) ? path19.relative(project_root, target) : target;
|
|
19481
19608
|
info(`Manifest updated: ${rel}`);
|
|
19482
19609
|
}
|
|
19483
19610
|
return 0;
|
|
19484
19611
|
}
|
|
19485
19612
|
function isRelativeTo(child, parent) {
|
|
19486
|
-
const rel =
|
|
19487
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
19613
|
+
const rel = path19.relative(parent, child);
|
|
19614
|
+
return rel === "" || !rel.startsWith("..") && !path19.isAbsolute(rel);
|
|
19488
19615
|
}
|
|
19489
19616
|
function _resolve_package_root_for_global() {
|
|
19490
19617
|
const here = resolvePath(_HERE2);
|
|
19491
|
-
const candidate =
|
|
19492
|
-
if (!pathExists(
|
|
19618
|
+
const candidate = path19.dirname(path19.dirname(path19.dirname(here)));
|
|
19619
|
+
if (!pathExists(path19.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
19493
19620
|
fail(
|
|
19494
19621
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
19495
19622
|
);
|
|
19496
19623
|
}
|
|
19497
19624
|
return candidate;
|
|
19498
19625
|
}
|
|
19499
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
19626
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path19.join("agents", ".event4u-bridge.yml");
|
|
19500
19627
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
19501
19628
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
19502
19629
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -19504,7 +19631,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
19504
19631
|
if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
19505
19632
|
return [false, "consumer-mode-override"];
|
|
19506
19633
|
}
|
|
19507
|
-
const pkg_json =
|
|
19634
|
+
const pkg_json = path19.join(project_root, "package.json");
|
|
19508
19635
|
if (isFile(pkg_json)) {
|
|
19509
19636
|
let data = {};
|
|
19510
19637
|
try {
|
|
@@ -19516,18 +19643,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
19516
19643
|
return [true, "package.json:name"];
|
|
19517
19644
|
}
|
|
19518
19645
|
}
|
|
19519
|
-
if (isDir(
|
|
19646
|
+
if (isDir(path19.join(project_root, ".agent-src.uncondensed"))) {
|
|
19520
19647
|
return [true, ".agent-src.uncondensed/"];
|
|
19521
19648
|
}
|
|
19522
|
-
const packages_dir =
|
|
19649
|
+
const packages_dir = path19.join(project_root, "packages");
|
|
19523
19650
|
if (isDir(packages_dir)) {
|
|
19524
|
-
for (const child of
|
|
19525
|
-
if (isDir(
|
|
19651
|
+
for (const child of fs22.readdirSync(packages_dir)) {
|
|
19652
|
+
if (isDir(path19.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
19526
19653
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
19527
19654
|
}
|
|
19528
19655
|
}
|
|
19529
19656
|
}
|
|
19530
|
-
const installer_self =
|
|
19657
|
+
const installer_self = path19.join(project_root, "scripts", "install.py");
|
|
19531
19658
|
try {
|
|
19532
19659
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
|
|
19533
19660
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -19547,17 +19674,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
19547
19674
|
}
|
|
19548
19675
|
return [];
|
|
19549
19676
|
}
|
|
19550
|
-
if (isFile(
|
|
19677
|
+
if (isFile(path19.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
19551
19678
|
const found = [];
|
|
19552
19679
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
19553
|
-
if (isFile(
|
|
19680
|
+
if (isFile(path19.join(project_root, name))) {
|
|
19554
19681
|
found.push(name);
|
|
19555
|
-
} else if (isFile(
|
|
19682
|
+
} else if (isFile(path19.join(project_root, "settings", name))) {
|
|
19556
19683
|
found.push(`settings/${name}`);
|
|
19557
19684
|
}
|
|
19558
19685
|
}
|
|
19559
19686
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
19560
|
-
const p =
|
|
19687
|
+
const p = path19.join(project_root, name);
|
|
19561
19688
|
if (isDir(p) && !isSymlink(p)) {
|
|
19562
19689
|
found.push(`${name}/`);
|
|
19563
19690
|
}
|
|
@@ -19569,7 +19696,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
19569
19696
|
process3.stdout.write("\n");
|
|
19570
19697
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
19571
19698
|
for (const rel of artefacts) {
|
|
19572
|
-
info(` ${
|
|
19699
|
+
info(` ${path19.join(project_root, rel)}`);
|
|
19573
19700
|
}
|
|
19574
19701
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
19575
19702
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -19600,20 +19727,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
19600
19727
|
function _format_global_root_for_marker(global_root) {
|
|
19601
19728
|
const home = resolvePath(os8.homedir());
|
|
19602
19729
|
const resolved = resolvePath(global_root);
|
|
19603
|
-
const rel =
|
|
19604
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
19730
|
+
const rel = path19.relative(home, resolved);
|
|
19731
|
+
if (rel === "" || rel.startsWith("..") || path19.isAbsolute(rel)) {
|
|
19605
19732
|
return global_root;
|
|
19606
19733
|
}
|
|
19607
|
-
return `~/${rel.split(
|
|
19734
|
+
return `~/${rel.split(path19.sep).join("/")}`;
|
|
19608
19735
|
}
|
|
19609
19736
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
19610
19737
|
const env_map = env ?? process3.env;
|
|
19611
19738
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
19612
|
-
if (isDir(
|
|
19613
|
-
const target =
|
|
19739
|
+
if (isDir(path19.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
19740
|
+
const target = path19.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
19614
19741
|
if (!isFile(target)) return null;
|
|
19615
19742
|
try {
|
|
19616
|
-
|
|
19743
|
+
fs22.rmSync(target);
|
|
19617
19744
|
} catch {
|
|
19618
19745
|
return null;
|
|
19619
19746
|
}
|
|
@@ -19627,7 +19754,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
19627
19754
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
19628
19755
|
const env_map = env ?? process3.env;
|
|
19629
19756
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
19630
|
-
if (isDir(
|
|
19757
|
+
if (isDir(path19.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
19631
19758
|
const global_root_str = _format_global_root_for_marker(
|
|
19632
19759
|
event4u_root(env_map)
|
|
19633
19760
|
);
|
|
@@ -19636,8 +19763,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
19636
19763
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
19637
19764
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
19638
19765
|
if (!tools.has(tool_id)) continue;
|
|
19639
|
-
const target =
|
|
19640
|
-
mkdirp(
|
|
19766
|
+
const target = path19.join(project_root, rel_path);
|
|
19767
|
+
mkdirp(path19.dirname(target));
|
|
19641
19768
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
19642
19769
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
19643
19770
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -19655,7 +19782,7 @@ installed_at: ${stamp}
|
|
|
19655
19782
|
}
|
|
19656
19783
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
19657
19784
|
function _inject_package_tag(target, source, package_root) {
|
|
19658
|
-
if (
|
|
19785
|
+
if (path19.extname(target) !== ".md") return;
|
|
19659
19786
|
let text;
|
|
19660
19787
|
try {
|
|
19661
19788
|
text = readText(target);
|
|
@@ -19683,8 +19810,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
19683
19810
|
resolved_src = source;
|
|
19684
19811
|
}
|
|
19685
19812
|
if (package_root !== null) {
|
|
19686
|
-
const rel =
|
|
19687
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
19813
|
+
const rel = path19.relative(resolvePath(package_root), resolved_src);
|
|
19814
|
+
if (rel !== "" && !rel.startsWith("..") && !path19.isAbsolute(rel)) {
|
|
19688
19815
|
source_value = rel;
|
|
19689
19816
|
} else {
|
|
19690
19817
|
source_value = resolved_src;
|
|
@@ -19719,7 +19846,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
19719
19846
|
if (package_root === null) return false;
|
|
19720
19847
|
let root;
|
|
19721
19848
|
try {
|
|
19722
|
-
root =
|
|
19849
|
+
root = fs22.realpathSync(package_root);
|
|
19723
19850
|
} catch {
|
|
19724
19851
|
return false;
|
|
19725
19852
|
}
|
|
@@ -19734,7 +19861,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19734
19861
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
19735
19862
|
let resolved_src = src;
|
|
19736
19863
|
try {
|
|
19737
|
-
resolved_src =
|
|
19864
|
+
resolved_src = fs22.realpathSync(src);
|
|
19738
19865
|
} catch {
|
|
19739
19866
|
resolved_src = src;
|
|
19740
19867
|
}
|
|
@@ -19742,10 +19869,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19742
19869
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
19743
19870
|
return [0, 0, written_paths];
|
|
19744
19871
|
}
|
|
19745
|
-
mkdirp(
|
|
19872
|
+
mkdirp(path19.dirname(dest));
|
|
19746
19873
|
const decision = _resolve_file_conflict(dest, force);
|
|
19747
19874
|
if (decision === "skip") return [0, 1, written_paths];
|
|
19748
|
-
|
|
19875
|
+
fs22.copyFileSync(src, dest);
|
|
19749
19876
|
_inject_package_tag(dest, src, package_root);
|
|
19750
19877
|
written_paths.push(dest);
|
|
19751
19878
|
return [1, 0, written_paths];
|
|
@@ -19753,11 +19880,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19753
19880
|
mkdirp(dest);
|
|
19754
19881
|
const walk = (node) => {
|
|
19755
19882
|
const acc = [];
|
|
19756
|
-
const names =
|
|
19883
|
+
const names = fs22.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
19757
19884
|
for (const name of names) {
|
|
19758
|
-
const entry =
|
|
19885
|
+
const entry = path19.join(node, name);
|
|
19759
19886
|
acc.push(entry);
|
|
19760
|
-
const lst =
|
|
19887
|
+
const lst = fs22.lstatSync(entry);
|
|
19761
19888
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19762
19889
|
acc.push(...walk(entry));
|
|
19763
19890
|
}
|
|
@@ -19765,9 +19892,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19765
19892
|
return acc;
|
|
19766
19893
|
};
|
|
19767
19894
|
for (const entry of walk(src)) {
|
|
19768
|
-
const rel =
|
|
19769
|
-
const target =
|
|
19770
|
-
const lst =
|
|
19895
|
+
const rel = path19.relative(src, entry);
|
|
19896
|
+
const target = path19.join(dest, rel);
|
|
19897
|
+
const lst = fs22.lstatSync(entry);
|
|
19771
19898
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
19772
19899
|
mkdirp(target);
|
|
19773
19900
|
continue;
|
|
@@ -19775,8 +19902,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19775
19902
|
let resolvedIsDir = false;
|
|
19776
19903
|
let resolved = entry;
|
|
19777
19904
|
try {
|
|
19778
|
-
resolved =
|
|
19779
|
-
resolvedIsDir =
|
|
19905
|
+
resolved = fs22.realpathSync(entry);
|
|
19906
|
+
resolvedIsDir = fs22.statSync(entry).isDirectory();
|
|
19780
19907
|
} catch {
|
|
19781
19908
|
resolvedIsDir = false;
|
|
19782
19909
|
}
|
|
@@ -19806,8 +19933,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
19806
19933
|
skipped += 1;
|
|
19807
19934
|
continue;
|
|
19808
19935
|
}
|
|
19809
|
-
mkdirp(
|
|
19810
|
-
|
|
19936
|
+
mkdirp(path19.dirname(target));
|
|
19937
|
+
fs22.copyFileSync(resolved, target);
|
|
19811
19938
|
_inject_package_tag(target, resolved, package_root);
|
|
19812
19939
|
written += 1;
|
|
19813
19940
|
written_paths.push(target);
|
|
@@ -19819,7 +19946,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
19819
19946
|
}
|
|
19820
19947
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
19821
19948
|
const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
|
|
19822
|
-
const target =
|
|
19949
|
+
const target = path19.join(anchor, "agent-config.md");
|
|
19823
19950
|
mkdirp(anchor);
|
|
19824
19951
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
19825
19952
|
writeText(target, body);
|
|
@@ -19843,23 +19970,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19843
19970
|
const wrapped = [];
|
|
19844
19971
|
const collisions = [];
|
|
19845
19972
|
const reserved = [];
|
|
19846
|
-
const commands_dir =
|
|
19973
|
+
const commands_dir = path19.join(anchor, "commands");
|
|
19847
19974
|
let flat_entries = [];
|
|
19848
19975
|
try {
|
|
19849
|
-
flat_entries =
|
|
19976
|
+
flat_entries = fs22.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
19850
19977
|
} catch {
|
|
19851
19978
|
}
|
|
19852
19979
|
for (const fname of flat_entries.sort()) {
|
|
19853
19980
|
const slug = fname.slice(0, -".md".length);
|
|
19854
19981
|
if (!is_claude_builtin_name(slug)) continue;
|
|
19855
|
-
|
|
19982
|
+
fs22.rmSync(path19.join(commands_dir, fname), { force: true });
|
|
19856
19983
|
current_files.delete(`commands/${fname}`);
|
|
19857
19984
|
reserved.push(slug);
|
|
19858
19985
|
}
|
|
19859
19986
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
19860
19987
|
try {
|
|
19861
19988
|
const manifest = JSON.parse(
|
|
19862
|
-
|
|
19989
|
+
fs22.readFileSync(path19.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
19863
19990
|
);
|
|
19864
19991
|
for (const a of manifest.artefacts ?? []) {
|
|
19865
19992
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -19870,22 +19997,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
19870
19997
|
}
|
|
19871
19998
|
for (const slug of [...eligible].sort()) {
|
|
19872
19999
|
const flat_rel = `commands/${slug}.md`;
|
|
19873
|
-
const flat_abs =
|
|
19874
|
-
if (!
|
|
19875
|
-
const skill_dir =
|
|
19876
|
-
if (
|
|
20000
|
+
const flat_abs = path19.join(anchor, "commands", `${slug}.md`);
|
|
20001
|
+
if (!fs22.existsSync(flat_abs)) continue;
|
|
20002
|
+
const skill_dir = path19.join(anchor, "skills", slug);
|
|
20003
|
+
if (fs22.existsSync(skill_dir)) {
|
|
19877
20004
|
collisions.push(slug);
|
|
19878
20005
|
continue;
|
|
19879
20006
|
}
|
|
19880
|
-
let body =
|
|
20007
|
+
let body = fs22.readFileSync(flat_abs, "utf8");
|
|
19881
20008
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
19882
20009
|
body = body.replace("---\n", `---
|
|
19883
20010
|
name: ${slug}
|
|
19884
20011
|
`);
|
|
19885
20012
|
}
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
20013
|
+
fs22.mkdirSync(skill_dir, { recursive: true });
|
|
20014
|
+
fs22.writeFileSync(path19.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
20015
|
+
fs22.rmSync(flat_abs, { force: true });
|
|
19889
20016
|
current_files.delete(flat_rel);
|
|
19890
20017
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
19891
20018
|
wrapped.push(slug);
|
|
@@ -19917,8 +20044,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19917
20044
|
const written_paths = [];
|
|
19918
20045
|
let current_files = /* @__PURE__ */ new Set();
|
|
19919
20046
|
for (const [src_rel, dest_sub] of plan) {
|
|
19920
|
-
const src =
|
|
19921
|
-
const dest = dest_sub ?
|
|
20047
|
+
const src = path19.join(package_root, src_rel);
|
|
20048
|
+
const dest = dest_sub ? path19.join(anchor, dest_sub) : anchor;
|
|
19922
20049
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
19923
20050
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
19924
20051
|
src,
|
|
@@ -19992,10 +20119,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
19992
20119
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
19993
20120
|
if (tool_id === "claude-code") {
|
|
19994
20121
|
try {
|
|
19995
|
-
const manifest =
|
|
20122
|
+
const manifest = path19.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
19996
20123
|
const matrix = build_claude_hook_matrix(manifest);
|
|
19997
20124
|
const res = ensure_managed_hooks(
|
|
19998
|
-
|
|
20125
|
+
path19.join(anchor, "settings.json"),
|
|
19999
20126
|
matrix
|
|
20000
20127
|
);
|
|
20001
20128
|
if (!state.QUIET) {
|
|
@@ -20032,7 +20159,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
20032
20159
|
const anchor = expanduser6(anchor_raw);
|
|
20033
20160
|
let current_files = /* @__PURE__ */ new Set();
|
|
20034
20161
|
for (const [src_rel, dest_sub] of plan) {
|
|
20035
|
-
const src =
|
|
20162
|
+
const src = path19.join(package_root, src_rel);
|
|
20036
20163
|
current_files = setUnion(
|
|
20037
20164
|
current_files,
|
|
20038
20165
|
expected_deploy_files(
|
|
@@ -20066,14 +20193,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
20066
20193
|
function _verify_deploy_targets(anchor, plan) {
|
|
20067
20194
|
const missing = [];
|
|
20068
20195
|
for (const [, dest_sub] of plan) {
|
|
20069
|
-
const target = dest_sub ?
|
|
20196
|
+
const target = dest_sub ? path19.join(anchor, dest_sub) : anchor;
|
|
20070
20197
|
const label = dest_sub || ".";
|
|
20071
20198
|
if (!isDir(target)) {
|
|
20072
20199
|
missing.push(label);
|
|
20073
20200
|
continue;
|
|
20074
20201
|
}
|
|
20075
20202
|
try {
|
|
20076
|
-
const entries =
|
|
20203
|
+
const entries = fs22.readdirSync(target);
|
|
20077
20204
|
if (entries.length === 0) missing.push(label);
|
|
20078
20205
|
} catch {
|
|
20079
20206
|
missing.push(label);
|
|
@@ -20081,61 +20208,8 @@ function _verify_deploy_targets(anchor, plan) {
|
|
|
20081
20208
|
}
|
|
20082
20209
|
return missing;
|
|
20083
20210
|
}
|
|
20084
|
-
|
|
20085
|
-
|
|
20086
|
-
const adjusted = {};
|
|
20087
|
-
for (const tool_id of Object.keys(deploy_results)) {
|
|
20088
|
-
const [written, skipped, status, paths] = deploy_results[tool_id];
|
|
20089
|
-
const pruned_skill_dirs = /* @__PURE__ */ new Set();
|
|
20090
|
-
for (const p of paths) {
|
|
20091
|
-
const parts = p.split(path18.sep);
|
|
20092
|
-
if (parts.includes("skills")) {
|
|
20093
|
-
const i = parts.indexOf("skills");
|
|
20094
|
-
if (i + 1 < parts.length) {
|
|
20095
|
-
const skill_root = parts.slice(0, i + 2).join(path18.sep);
|
|
20096
|
-
if (!pruned_skill_dirs.has(skill_root)) {
|
|
20097
|
-
const skillmd = path18.join(skill_root, "SKILL.md");
|
|
20098
|
-
if (pathExists(skillmd) && is_pruned(skillmd)) {
|
|
20099
|
-
pruned_skill_dirs.add(skill_root);
|
|
20100
|
-
}
|
|
20101
|
-
}
|
|
20102
|
-
}
|
|
20103
|
-
}
|
|
20104
|
-
}
|
|
20105
|
-
const keep = [];
|
|
20106
|
-
const delete_files = [];
|
|
20107
|
-
for (const p of paths) {
|
|
20108
|
-
const parts = p.split(path18.sep);
|
|
20109
|
-
let is_target = false;
|
|
20110
|
-
if (parts.includes("skills")) {
|
|
20111
|
-
const i = parts.indexOf("skills");
|
|
20112
|
-
if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path18.sep))) {
|
|
20113
|
-
is_target = true;
|
|
20114
|
-
}
|
|
20115
|
-
} else if (parts.includes("commands") && path18.extname(p) === ".md" && is_pruned(p)) {
|
|
20116
|
-
is_target = true;
|
|
20117
|
-
}
|
|
20118
|
-
(is_target ? delete_files : keep).push(p);
|
|
20119
|
-
}
|
|
20120
|
-
for (const d of pruned_skill_dirs) {
|
|
20121
|
-
fs21.rmSync(d, { recursive: true, force: true });
|
|
20122
|
-
}
|
|
20123
|
-
for (const p of delete_files) {
|
|
20124
|
-
if (p.split(path18.sep).includes("commands") && pathExists(p)) {
|
|
20125
|
-
try {
|
|
20126
|
-
fs21.unlinkSync(p);
|
|
20127
|
-
} catch {
|
|
20128
|
-
}
|
|
20129
|
-
}
|
|
20130
|
-
}
|
|
20131
|
-
pruned += delete_files.length;
|
|
20132
|
-
adjusted[tool_id] = [Math.max(0, written - delete_files.length), skipped, status, keep];
|
|
20133
|
-
}
|
|
20134
|
-
return [pruned, adjusted];
|
|
20135
|
-
}
|
|
20136
|
-
function _prune_lab_modules(deploy_results, lab_ids) {
|
|
20137
|
-
return _prune_modules_by(deploy_results, (p) => is_lab_artefact(p, lab_ids));
|
|
20138
|
-
}
|
|
20211
|
+
var _prune_modules_by = prune_modules_by;
|
|
20212
|
+
var _prune_lab_modules = prune_lab_modules;
|
|
20139
20213
|
var _load_packs_registry = load_packs_registry;
|
|
20140
20214
|
var _compute_active_pack_ids = compute_active_pack_ids;
|
|
20141
20215
|
function _resolve_global_settings_doc() {
|
|
@@ -20144,16 +20218,16 @@ function _resolve_global_settings_doc() {
|
|
|
20144
20218
|
}
|
|
20145
20219
|
function _resolve_global_settings_path() {
|
|
20146
20220
|
const root = event4u_root();
|
|
20147
|
-
const canonical =
|
|
20221
|
+
const canonical = path19.join(root, "settings", SETTINGS_FILE);
|
|
20148
20222
|
if (pathExists(canonical)) return canonical;
|
|
20149
|
-
const legacy =
|
|
20223
|
+
const legacy = path19.join(root, SETTINGS_FILE);
|
|
20150
20224
|
if (pathExists(legacy)) return legacy;
|
|
20151
20225
|
return null;
|
|
20152
20226
|
}
|
|
20153
20227
|
function _resolve_scoped_projection(package_root) {
|
|
20154
20228
|
const doc = _resolve_global_settings_doc() ?? _load_default_settings(package_root);
|
|
20155
20229
|
const projection = _isPlainObject2(doc["projection"]) ? doc["projection"] : {};
|
|
20156
|
-
const mode = projection["mode"]
|
|
20230
|
+
const mode = projectionModeOf(projection["mode"]);
|
|
20157
20231
|
const runtime = _isPlainObject2(doc["runtime"]) ? doc["runtime"] : {};
|
|
20158
20232
|
const active_packs_raw = runtime["active_packs"];
|
|
20159
20233
|
const active_packs = Array.isArray(active_packs_raw) ? active_packs_raw.filter((v) => typeof v === "string") : [];
|
|
@@ -20257,7 +20331,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20257
20331
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
20258
20332
|
info(` tools=${merged_tools.join(",")}`);
|
|
20259
20333
|
}
|
|
20260
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
20334
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path19.join(project_root, ".agent-src.uncondensed"))) {
|
|
20261
20335
|
const drift = collect_drift(project_root);
|
|
20262
20336
|
if (!state.QUIET) {
|
|
20263
20337
|
process3.stdout.write("\n");
|
|
@@ -20280,6 +20354,13 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20280
20354
|
}
|
|
20281
20355
|
try {
|
|
20282
20356
|
const { mode, active_packs } = _resolve_scoped_projection(package_root);
|
|
20357
|
+
if (mode === "tiered") {
|
|
20358
|
+
const outcome = applyTieredPrune(deploy_results, package_root, _prune_modules_by);
|
|
20359
|
+
deploy_results = outcome.deployResults;
|
|
20360
|
+
if (!state.QUIET && outcome.message !== null) {
|
|
20361
|
+
(outcome.level === "warn" ? warn : info)(outcome.message);
|
|
20362
|
+
}
|
|
20363
|
+
}
|
|
20283
20364
|
if (mode === "scoped") {
|
|
20284
20365
|
const packs_registry = _load_packs_registry(package_root);
|
|
20285
20366
|
const active_ids = _compute_active_pack_ids(packs_registry, active_packs);
|
|
@@ -20364,19 +20445,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20364
20445
|
}
|
|
20365
20446
|
}
|
|
20366
20447
|
}
|
|
20367
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
20448
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path19.join(project_root, ".agent-src.uncondensed"))) {
|
|
20368
20449
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
20369
20450
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
20370
20451
|
if (rc !== 0) return rc;
|
|
20371
20452
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
20372
20453
|
if (removed_marker !== null && !state.QUIET) {
|
|
20373
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
20454
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path19.relative(project_root, removed_marker) : removed_marker;
|
|
20374
20455
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
20375
20456
|
}
|
|
20376
20457
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
20377
20458
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
20378
20459
|
for (const p of anchor_paths) {
|
|
20379
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
20460
|
+
const rel = isRelativeTo(p, project_root) ? path19.relative(project_root, p) : p;
|
|
20380
20461
|
info(`Project anchor written: ${rel}`);
|
|
20381
20462
|
}
|
|
20382
20463
|
}
|
|
@@ -20412,8 +20493,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
20412
20493
|
}
|
|
20413
20494
|
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
20414
20495
|
const log_candidates = [
|
|
20415
|
-
|
|
20416
|
-
...project_root ? [
|
|
20496
|
+
path19.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
20497
|
+
...project_root ? [path19.join(project_root, OBSERVATION_LOG)] : []
|
|
20417
20498
|
];
|
|
20418
20499
|
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
20419
20500
|
if (records.length === 0) return [];
|
|
@@ -20436,13 +20517,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
|
20436
20517
|
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
20437
20518
|
if (!isInteractiveSession(probe)) return [];
|
|
20438
20519
|
const log_candidates = [
|
|
20439
|
-
|
|
20440
|
-
...project_root ? [
|
|
20520
|
+
path19.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
20521
|
+
...project_root ? [path19.join(project_root, OBSERVATION_LOG)] : []
|
|
20441
20522
|
];
|
|
20442
20523
|
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
20443
20524
|
if (limits.size === 0) return [];
|
|
20444
20525
|
const resolved = _resolve_scoped_projection(package_root);
|
|
20445
|
-
const settings_path = _resolve_global_settings_path() ??
|
|
20526
|
+
const settings_path = _resolve_global_settings_path() ?? path19.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
20446
20527
|
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
20447
20528
|
const [, , status] = deploy_results[tool_id];
|
|
20448
20529
|
if (status !== "deployed") continue;
|
|
@@ -20461,8 +20542,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
|
|
|
20461
20542
|
}
|
|
20462
20543
|
return [];
|
|
20463
20544
|
}
|
|
20464
|
-
var SETTINGS_SURFACE_REL =
|
|
20465
|
-
var SETTINGS_DELTA_REL =
|
|
20545
|
+
var SETTINGS_SURFACE_REL = path19.join("state", "settings-surface.json");
|
|
20546
|
+
var SETTINGS_DELTA_REL = path19.join("state", "settings-delta.json");
|
|
20466
20547
|
function _current_settings_surface(version) {
|
|
20467
20548
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
20468
20549
|
name: "AgentSettings",
|
|
@@ -20473,20 +20554,20 @@ function _current_settings_surface(version) {
|
|
|
20473
20554
|
}
|
|
20474
20555
|
function _write_settings_surface_snapshot(installed_version) {
|
|
20475
20556
|
const root = event4u_root();
|
|
20476
|
-
const surface_path =
|
|
20477
|
-
const delta_path =
|
|
20557
|
+
const surface_path = path19.join(root, SETTINGS_SURFACE_REL);
|
|
20558
|
+
const delta_path = path19.join(root, SETTINGS_DELTA_REL);
|
|
20478
20559
|
const next = _current_settings_surface(installed_version);
|
|
20479
20560
|
let previous = null;
|
|
20480
20561
|
try {
|
|
20481
|
-
const parsed = JSON.parse(
|
|
20562
|
+
const parsed = JSON.parse(fs22.readFileSync(surface_path, "utf8"));
|
|
20482
20563
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
20483
20564
|
} catch {
|
|
20484
20565
|
}
|
|
20485
20566
|
if (previous !== null && previous.version !== next.version) {
|
|
20486
20567
|
const delta = computeSurfaceDelta(previous, next);
|
|
20487
20568
|
if (delta.changes.length > 0) {
|
|
20488
|
-
|
|
20489
|
-
|
|
20569
|
+
fs22.mkdirSync(path19.dirname(delta_path), { recursive: true, mode: 448 });
|
|
20570
|
+
fs22.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
20490
20571
|
`, { mode: 384 });
|
|
20491
20572
|
if (!state.QUIET) {
|
|
20492
20573
|
const counts = {};
|
|
@@ -20498,8 +20579,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
20498
20579
|
}
|
|
20499
20580
|
}
|
|
20500
20581
|
}
|
|
20501
|
-
|
|
20502
|
-
|
|
20582
|
+
fs22.mkdirSync(path19.dirname(surface_path), { recursive: true, mode: 448 });
|
|
20583
|
+
fs22.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
20503
20584
|
`, { mode: 384 });
|
|
20504
20585
|
}
|
|
20505
20586
|
function arrayStrEqual(a, b) {
|
|
@@ -20719,13 +20800,13 @@ function _minimal_templates_root() {
|
|
|
20719
20800
|
const chain = [start];
|
|
20720
20801
|
let cur = start;
|
|
20721
20802
|
for (; ; ) {
|
|
20722
|
-
const parent =
|
|
20803
|
+
const parent = path19.dirname(cur);
|
|
20723
20804
|
if (parent === cur) break;
|
|
20724
20805
|
chain.push(parent);
|
|
20725
20806
|
cur = parent;
|
|
20726
20807
|
}
|
|
20727
20808
|
for (const ancestor of chain) {
|
|
20728
|
-
const candidate =
|
|
20809
|
+
const candidate = path19.join(ancestor, "src", "templates", "minimal");
|
|
20729
20810
|
if (isDir(candidate)) return candidate;
|
|
20730
20811
|
}
|
|
20731
20812
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -20733,9 +20814,9 @@ function _minimal_templates_root() {
|
|
|
20733
20814
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
20734
20815
|
function _write_install_mode_marker(project_root, mode) {
|
|
20735
20816
|
if (mode !== "minimal" && mode !== "full") return;
|
|
20736
|
-
const marker =
|
|
20817
|
+
const marker = path19.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
20737
20818
|
try {
|
|
20738
|
-
mkdirp(
|
|
20819
|
+
mkdirp(path19.dirname(marker));
|
|
20739
20820
|
writeText(marker, `${mode}
|
|
20740
20821
|
`);
|
|
20741
20822
|
} catch {
|
|
@@ -20744,7 +20825,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
20744
20825
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
20745
20826
|
let target_root = resolvePath(target_root_in);
|
|
20746
20827
|
mkdirp(target_root);
|
|
20747
|
-
const parent =
|
|
20828
|
+
const parent = path19.dirname(target_root);
|
|
20748
20829
|
if (parent !== target_root) {
|
|
20749
20830
|
const existing = find_project_root_with_anchor(parent);
|
|
20750
20831
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -20755,21 +20836,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20755
20836
|
}
|
|
20756
20837
|
}
|
|
20757
20838
|
const templates = _minimal_templates_root();
|
|
20758
|
-
const settings_src =
|
|
20759
|
-
const overrides_gitkeep_src =
|
|
20760
|
-
const overrides_readme_src =
|
|
20839
|
+
const settings_src = path19.join(templates, SETTINGS_FILE);
|
|
20840
|
+
const overrides_gitkeep_src = path19.join(templates, "overrides-gitkeep");
|
|
20841
|
+
const overrides_readme_src = path19.join(templates, "agents-overrides-readme.md");
|
|
20761
20842
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
20762
20843
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
20763
20844
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
20764
20845
|
}
|
|
20765
20846
|
info(`Minimal init \u2192 ${target_root}`);
|
|
20766
|
-
const overrides_root =
|
|
20847
|
+
const overrides_root = path19.join(target_root, "agents", "overrides");
|
|
20767
20848
|
mkdirp(overrides_root);
|
|
20768
20849
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
20769
20850
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
20770
|
-
const sub_dir =
|
|
20851
|
+
const sub_dir = path19.join(overrides_root, sub);
|
|
20771
20852
|
mkdirp(sub_dir);
|
|
20772
|
-
const gitkeep_dst =
|
|
20853
|
+
const gitkeep_dst = path19.join(sub_dir, ".gitkeep");
|
|
20773
20854
|
if (pathExists(gitkeep_dst) && !force) {
|
|
20774
20855
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
20775
20856
|
} else {
|
|
@@ -20777,7 +20858,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20777
20858
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
20778
20859
|
}
|
|
20779
20860
|
}
|
|
20780
|
-
const readme_dst =
|
|
20861
|
+
const readme_dst = path19.join(overrides_root, "README.md");
|
|
20781
20862
|
if (pathExists(readme_dst) && !force) {
|
|
20782
20863
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
20783
20864
|
} else {
|
|
@@ -20795,14 +20876,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
20795
20876
|
personal:
|
|
20796
20877
|
user_type: ${user_type}
|
|
20797
20878
|
`;
|
|
20798
|
-
mkdirp(
|
|
20879
|
+
mkdirp(path19.dirname(settings_dst));
|
|
20799
20880
|
writeText(settings_dst, body);
|
|
20800
20881
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
20801
20882
|
}
|
|
20802
20883
|
}
|
|
20803
20884
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
20804
20885
|
if (removed_marker !== null) {
|
|
20805
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
20886
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path19.relative(target_root, removed_marker) : removed_marker;
|
|
20806
20887
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
20807
20888
|
}
|
|
20808
20889
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -20876,7 +20957,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20876
20957
|
);
|
|
20877
20958
|
return 0;
|
|
20878
20959
|
}
|
|
20879
|
-
const target =
|
|
20960
|
+
const target = path19.join(project_root, _LOCAL_CONFIG_FILE);
|
|
20880
20961
|
if (pathExists(target) && !force) {
|
|
20881
20962
|
warn(
|
|
20882
20963
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -20903,7 +20984,7 @@ function run_interactive_init(project_root, force) {
|
|
|
20903
20984
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
20904
20985
|
return 1;
|
|
20905
20986
|
}
|
|
20906
|
-
success(`Wrote ${
|
|
20987
|
+
success(`Wrote ${path19.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
20907
20988
|
return 0;
|
|
20908
20989
|
}
|
|
20909
20990
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -20921,12 +21002,12 @@ function _wizard_should_launch(opts) {
|
|
|
20921
21002
|
return [true, ""];
|
|
20922
21003
|
}
|
|
20923
21004
|
function _wizard_cli_dist(_project_root) {
|
|
20924
|
-
const package_root =
|
|
20925
|
-
const cli =
|
|
21005
|
+
const package_root = path19.dirname(path19.dirname(path19.dirname(resolvePath(_HERE2))));
|
|
21006
|
+
const cli = path19.join(package_root, "dist", "cli", "agent-config.js");
|
|
20926
21007
|
return pathExists(cli) ? cli : null;
|
|
20927
21008
|
}
|
|
20928
21009
|
function _server_info_path() {
|
|
20929
|
-
return
|
|
21010
|
+
return path19.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
20930
21011
|
}
|
|
20931
21012
|
function _pid_is_agent_config(pid) {
|
|
20932
21013
|
let res;
|
|
@@ -20943,7 +21024,7 @@ function _pid_is_agent_config(pid) {
|
|
|
20943
21024
|
}
|
|
20944
21025
|
function unlinkMissingOk(p) {
|
|
20945
21026
|
try {
|
|
20946
|
-
|
|
21027
|
+
fs22.unlinkSync(p);
|
|
20947
21028
|
} catch {
|
|
20948
21029
|
}
|
|
20949
21030
|
}
|
|
@@ -21021,14 +21102,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
21021
21102
|
}
|
|
21022
21103
|
function _wizard_run_sync(cmd, env, cli) {
|
|
21023
21104
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
21024
|
-
const log_path =
|
|
21105
|
+
const log_path = path19.join(
|
|
21025
21106
|
os8.tmpdir(),
|
|
21026
21107
|
`agent-config-wizard-${process3.pid}-${Date.now()}.log`
|
|
21027
21108
|
);
|
|
21028
21109
|
let child;
|
|
21029
21110
|
let log_fd = null;
|
|
21030
21111
|
try {
|
|
21031
|
-
log_fd =
|
|
21112
|
+
log_fd = fs22.openSync(log_path, "w");
|
|
21032
21113
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
21033
21114
|
env,
|
|
21034
21115
|
detached: true,
|
|
@@ -21046,7 +21127,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
21046
21127
|
} finally {
|
|
21047
21128
|
if (log_fd !== null) {
|
|
21048
21129
|
try {
|
|
21049
|
-
|
|
21130
|
+
fs22.closeSync(log_fd);
|
|
21050
21131
|
} catch {
|
|
21051
21132
|
}
|
|
21052
21133
|
}
|
|
@@ -21296,8 +21377,8 @@ function main2(argv) {
|
|
|
21296
21377
|
const target_root = resolvePath(
|
|
21297
21378
|
opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
|
|
21298
21379
|
);
|
|
21299
|
-
const minimal_package_root =
|
|
21300
|
-
|
|
21380
|
+
const minimal_package_root = path19.dirname(
|
|
21381
|
+
path19.dirname(path19.dirname(_minimal_templates_root()))
|
|
21301
21382
|
);
|
|
21302
21383
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
21303
21384
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -21329,7 +21410,7 @@ function main2(argv) {
|
|
|
21329
21410
|
return rc2;
|
|
21330
21411
|
}
|
|
21331
21412
|
const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
|
|
21332
|
-
const is_first_run = !pathExists(
|
|
21413
|
+
const is_first_run = !pathExists(path19.join(project_root, SETTINGS_FILE));
|
|
21333
21414
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
21334
21415
|
if (rc === 0 && opts.interactive) {
|
|
21335
21416
|
run_interactive_init(project_root, opts.force);
|
|
@@ -21393,16 +21474,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
21393
21474
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
21394
21475
|
}
|
|
21395
21476
|
function finalize_claude_model_tiers(project_root) {
|
|
21396
|
-
const claude_skills =
|
|
21397
|
-
const augment_skills =
|
|
21477
|
+
const claude_skills = path19.join(project_root, ".claude", "skills");
|
|
21478
|
+
const augment_skills = path19.join(project_root, ".augment", "skills");
|
|
21398
21479
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
21399
21480
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
21400
21481
|
let rendered = 0;
|
|
21401
|
-
const entries =
|
|
21482
|
+
const entries = fs22.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
21402
21483
|
for (const name of entries) {
|
|
21403
|
-
const entry =
|
|
21404
|
-
const src_dir =
|
|
21405
|
-
const src_md =
|
|
21484
|
+
const entry = path19.join(claude_skills, name);
|
|
21485
|
+
const src_dir = path19.join(augment_skills, name);
|
|
21486
|
+
const src_md = path19.join(src_dir, "SKILL.md");
|
|
21406
21487
|
let tier;
|
|
21407
21488
|
try {
|
|
21408
21489
|
tier = read_model_tier(src_md);
|
|
@@ -21411,22 +21492,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
21411
21492
|
}
|
|
21412
21493
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
21413
21494
|
if (isSymlink(entry) || isFile(entry)) {
|
|
21414
|
-
|
|
21495
|
+
fs22.unlinkSync(entry);
|
|
21415
21496
|
} else if (isDir(entry)) {
|
|
21416
|
-
|
|
21497
|
+
fs22.rmSync(entry, { recursive: true, force: true });
|
|
21417
21498
|
}
|
|
21418
21499
|
mkdirp(entry);
|
|
21419
|
-
const srcFiles =
|
|
21500
|
+
const srcFiles = fs22.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
21420
21501
|
for (const fname of srcFiles) {
|
|
21421
21502
|
if (fname === "SKILL.md") {
|
|
21422
21503
|
writeText(
|
|
21423
|
-
|
|
21504
|
+
path19.join(entry, "SKILL.md"),
|
|
21424
21505
|
render_native_model_md(readText(src_md), tier)
|
|
21425
21506
|
);
|
|
21426
21507
|
} else {
|
|
21427
|
-
|
|
21428
|
-
|
|
21429
|
-
|
|
21508
|
+
fs22.symlinkSync(
|
|
21509
|
+
path19.join("../../../.augment/skills", name, fname),
|
|
21510
|
+
path19.join(entry, fname)
|
|
21430
21511
|
);
|
|
21431
21512
|
}
|
|
21432
21513
|
}
|
|
@@ -21444,7 +21525,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21444
21525
|
let package_type;
|
|
21445
21526
|
if (opts.package) {
|
|
21446
21527
|
package_root = resolvePath(opts.package);
|
|
21447
|
-
if (!pathExists(
|
|
21528
|
+
if (!pathExists(path19.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
21448
21529
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
21449
21530
|
}
|
|
21450
21531
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -21472,7 +21553,10 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21472
21553
|
...ensure_augment_bridge(project_root, opts.force)
|
|
21473
21554
|
];
|
|
21474
21555
|
if (_is_tool_enabled(tools, "claude-code")) {
|
|
21475
|
-
merged_keys_by_tool["claude-code"] =
|
|
21556
|
+
merged_keys_by_tool["claude-code"] = [
|
|
21557
|
+
...ensure_claude_bridge(project_root, opts.force),
|
|
21558
|
+
...ensure_mcp_bridge(project_root, opts.force)
|
|
21559
|
+
];
|
|
21476
21560
|
}
|
|
21477
21561
|
if (_is_tool_enabled(tools, "cursor")) {
|
|
21478
21562
|
merged_keys_by_tool["cursor"] = ensure_cursor_bridge(project_root, opts.force);
|
|
@@ -21495,6 +21579,10 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21495
21579
|
if (_is_tool_enabled(tools, "jetbrains")) ensure_jetbrains_bridge(project_root, opts.force);
|
|
21496
21580
|
if (_is_tool_enabled(tools, "kiro")) ensure_kiro_bridge(project_root, opts.force);
|
|
21497
21581
|
}
|
|
21582
|
+
const tier_advisory = _tier_b_advisory(package_root);
|
|
21583
|
+
if (tier_advisory !== null && !state.QUIET) {
|
|
21584
|
+
info(tier_advisory);
|
|
21585
|
+
}
|
|
21498
21586
|
if (opts.augment_user_hooks) {
|
|
21499
21587
|
(merged_keys_by_tool["augment"] ??= []).push(...ensure_augment_user_hooks(package_root, opts.force));
|
|
21500
21588
|
}
|
|
@@ -21581,9 +21669,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
21581
21669
|
function _resolvedArgv1() {
|
|
21582
21670
|
if (process3.argv[1] === void 0) return void 0;
|
|
21583
21671
|
try {
|
|
21584
|
-
return
|
|
21672
|
+
return fs22.realpathSync(path19.resolve(process3.argv[1]));
|
|
21585
21673
|
} catch {
|
|
21586
|
-
return
|
|
21674
|
+
return path19.resolve(process3.argv[1]);
|
|
21587
21675
|
}
|
|
21588
21676
|
}
|
|
21589
21677
|
var _argv1 = _resolvedArgv1();
|
|
@@ -21652,6 +21740,7 @@ export {
|
|
|
21652
21740
|
_prune_lab_modules,
|
|
21653
21741
|
_prune_modules_by,
|
|
21654
21742
|
_prune_scoped_modules,
|
|
21743
|
+
_prune_tier_b_modules,
|
|
21655
21744
|
_render_template,
|
|
21656
21745
|
_replace_template_value,
|
|
21657
21746
|
_replace_template_value_raw,
|
|
@@ -21660,9 +21749,11 @@ export {
|
|
|
21660
21749
|
_resolve_scope,
|
|
21661
21750
|
_resolve_scoped_projection,
|
|
21662
21751
|
_resolve_settings_read,
|
|
21752
|
+
_resolve_tier_b,
|
|
21663
21753
|
_rule_filter_for_source,
|
|
21664
21754
|
_scoped_migration_notice,
|
|
21665
21755
|
_team_setup_hint_line,
|
|
21756
|
+
_tier_b_advisory,
|
|
21666
21757
|
_tools_was_all,
|
|
21667
21758
|
_validate_scope,
|
|
21668
21759
|
_verify_deploy_targets,
|
|
@@ -21676,6 +21767,7 @@ export {
|
|
|
21676
21767
|
ensure_cline_bridge,
|
|
21677
21768
|
ensure_cursor_bridge,
|
|
21678
21769
|
ensure_gemini_bridge,
|
|
21770
|
+
ensure_mcp_bridge,
|
|
21679
21771
|
ensure_windsurf_bridge,
|
|
21680
21772
|
finalize_claude_model_tiers,
|
|
21681
21773
|
jsonDumpsCompact,
|