@event4u/agent-config 14.12.0 → 14.14.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 +118 -155
- package/CONTRIBUTING.md +38 -0
- package/CREDITS.md +135 -0
- package/NOTICE +13 -0
- package/README.md +8 -6
- package/dist/agent-src/commands/analyze/inbox.md +145 -2
- package/dist/agent-src/commands/feature/dev.md +7 -2
- package/dist/agent-src/commands/ghostwriter/write.md +5 -1
- package/dist/agent-src/commands/implement-ticket.md +1 -1
- package/dist/agent-src/commands/mission/upgrade.md +1 -1
- package/dist/agent-src/commands/orchestrate.md +2 -2
- package/dist/agent-src/commands/post-as/me.md +5 -1
- package/dist/agent-src/commands/pr/merge.md +19 -6
- package/dist/agent-src/commands/roadmap/process-full.md +19 -5
- package/dist/agent-src/commands/tdd/red.md +12 -2
- package/dist/agent-src/commands/work.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +40 -0
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +5 -2
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +21 -0
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +1 -0
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +40 -0
- package/dist/agent-src/contexts/execution/subagent-steering.md +13 -1
- package/dist/agent-src/contexts/execution/terminal-states.md +96 -0
- package/dist/agent-src/rules/artifact-drafting-protocol.md +1 -1
- package/dist/agent-src/rules/broken-access-control.md +4 -0
- package/dist/agent-src/rules/code-comment-discipline.md +6 -0
- package/dist/agent-src/rules/code-provenance.md +4 -0
- package/dist/agent-src/rules/design-fidelity.md +1 -1
- package/dist/agent-src/rules/domain-safety-pii.md +4 -0
- package/dist/agent-src/rules/domain-safety-retention.md +4 -0
- package/dist/agent-src/rules/engineering-safety-floor.md +2 -0
- package/dist/agent-src/rules/external-code-graph-interop.md +14 -12
- package/dist/agent-src/rules/improve-before-implement.md +6 -8
- package/dist/agent-src/rules/laravel-routing.md +1 -1
- package/dist/agent-src/rules/lethal-trifecta-guard.md +4 -0
- package/dist/agent-src/rules/secret-vcs-guard.md +2 -0
- package/dist/agent-src/rules/security-sensitive-stop.md +2 -0
- package/dist/agent-src/rules/source-confidentiality.md +12 -34
- package/dist/agent-src/rules/symfony-routing.md +1 -1
- package/dist/agent-src/rules/token-efficiency.md +14 -0
- package/dist/agent-src/rules/tool-safety.md +4 -0
- package/dist/agent-src/rules/untrusted-input-defense.md +4 -0
- package/dist/agent-src/scripts/archive_completed_roadmaps.ts +252 -8
- package/dist/agent-src/scripts/guarded_baseline.ts +343 -0
- package/dist/agent-src/scripts/roadmap_set_step.ts +253 -0
- package/dist/agent-src/scripts/stub_queue.ts +82 -0
- package/dist/agent-src/scripts/stubs_due.ts +516 -0
- package/dist/agent-src/scripts/ticket_bundles.ts +84 -0
- package/dist/agent-src/scripts/update_roadmap_progress.ts +16 -12
- package/dist/agent-src/skills/brand-asset-generation/SKILL.md +17 -4
- package/dist/agent-src/skills/brand-audit/SKILL.md +33 -0
- package/dist/agent-src/skills/code-intelligence/SKILL.md +57 -0
- package/dist/agent-src/skills/database/SKILL.md +8 -0
- package/dist/agent-src/skills/dependency-upgrade/SKILL.md +27 -0
- package/dist/agent-src/skills/design-review/SKILL.md +1 -1
- package/dist/agent-src/skills/doc-coauthoring/SKILL.md +1 -1
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +17 -1
- package/dist/agent-src/skills/feature-planning/SKILL.md +9 -2
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +44 -0
- package/dist/agent-src/skills/git-workflow/SKILL.md +1 -1
- package/dist/agent-src/skills/js-library-packaging/scripts/check_package_surface.ts +38 -4
- package/dist/agent-src/skills/judge-artifact-completeness/rubrics/ticket-quality-score.json +2 -2
- package/dist/agent-src/skills/laravel/SKILL.md +35 -0
- package/dist/agent-src/skills/laravel-migration/SKILL.md +57 -3
- package/dist/agent-src/skills/monorepo-workspace/SKILL.md +26 -0
- package/dist/agent-src/skills/playbook-authoring/SKILL.md +28 -1
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +1 -1
- package/dist/agent-src/skills/skill-writing/references/procedure.md +5 -5
- package/dist/agent-src/skills/sql-writing/SKILL.md +7 -1
- package/dist/agent-src/skills/standards-from-config/SKILL.md +27 -4
- package/dist/agent-src/skills/supply-chain-intake/SKILL.md +11 -4
- package/dist/agent-src/skills/symfony-workflow/SKILL.md +35 -0
- package/dist/agent-src/skills/test-case-discovery/SKILL.md +85 -0
- package/dist/agent-src/skills/test-driven-development/SKILL.md +33 -9
- package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/testing-anti-patterns/process-anti-patterns.md +37 -0
- package/dist/agent-src/skills/ui-component-architect/SKILL.md +45 -2
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +38 -1
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +9 -4
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +97 -3
- package/dist/agent-src/templates/scripts/check_memory.ts +258 -17
- package/dist/agent-src/templates/scripts/check_memory_proposal.ts +9 -3
- package/dist/agent-src/templates/scripts/memory_lookup.ts +86 -0
- package/dist/agent-src/templates/scripts/memory_signal.ts +44 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/implement.ts +90 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/index.ts +11 -0
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/test.ts +23 -1
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +10 -1
- package/dist/agent-src/templates/scripts/work_engine/directives/mixed/stitch.ts +5 -1
- package/dist/agent-src/templates/scripts/work_engine/stack/runner.ts +102 -14
- package/dist/cli/commands/uiAudit.js +124 -5
- package/dist/cli/registry.js +2 -0
- package/dist/cli-delegate/{chunk-HYWSRNUX.js → chunk-2DK2VJWG.js} +3 -3
- package/dist/cli-delegate/{chunk-JCW7ZLHK.js → chunk-4FS4WRXP.js} +5 -0
- package/dist/cli-delegate/{chunk-OMIVVCG2.js → chunk-A4QJ6ENT.js} +24 -0
- package/dist/cli-delegate/{chunk-JJA2QEWA.js → chunk-AKJGUQNO.js} +466 -285
- package/dist/cli-delegate/{chunk-E46KPN6K.js → chunk-BTWUYDGN.js} +424 -363
- package/dist/cli-delegate/{chunk-K4FFODTS.js → chunk-ILMUPLGW.js} +1227 -316
- package/dist/cli-delegate/{chunk-FF7WAFMR.js → chunk-KPBWFOPZ.js} +5 -1
- package/dist/cli-delegate/cmd_adr_effective.js +102 -0
- package/dist/cli-delegate/cmd_conformance.js +80 -11
- package/dist/cli-delegate/cmd_doctor.js +3 -3
- package/dist/cli-delegate/cmd_export.js +3 -2
- package/dist/cli-delegate/cmd_fleet.js +2 -2
- 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 +3 -2
- package/dist/cli-delegate/cmd_settings_get.js +1 -1
- package/dist/cli-delegate/cmd_settings_migrate.js +3 -2
- package/dist/cli-delegate/cmd_settings_set.js +2 -2
- package/dist/cli-delegate/cmd_sync.js +3 -2
- package/dist/cli-delegate/cmd_uninstall.js +3 -2
- package/dist/cli-delegate/cmd_validate.js +3 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +58 -58
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +2900 -1049
- package/dist/install/claudeRuleRewrite.js +254 -0
- package/dist/install/detect.js +29 -16
- package/dist/install/detect_php_shape.js +159 -0
- package/dist/install/install.mjs +634 -428
- package/dist/mcp/awesome-mcp-servers.row.md +1 -1
- package/dist/mcp/mcp-cloudflare-catalogue.json +1 -1
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +3 -3
- package/dist/mcp/server.mjs +4895 -2627
- package/dist/server/schemas/settings.js +3 -0
- package/dist/ui/assets/index-D0jaCRPM.js +29 -0
- package/dist/ui/index.html +1 -1
- package/docs/MIGRATION.md +1 -1
- package/docs/THIRD-PARTY-NOTICES.md +25 -0
- package/docs/contracts/provider-lifecycle.md +1 -1
- package/docs/contracts/settings-classes.md +10 -4
- package/docs/guidelines/agent-infra/5w2h-analysis.md +3 -3
- package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +1 -0
- package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +58 -3
- package/docs/guidelines/agent-infra/ask-when-uncertain-demos.md +2 -2
- package/docs/guidelines/agent-infra/asking-and-brevity-examples.md +3 -3
- package/docs/guidelines/agent-infra/break-glass-usage.md +7 -7
- package/docs/guidelines/agent-infra/carve-out-predicates.md +3 -3
- package/docs/guidelines/agent-infra/comparison-matrix.md +1 -1
- package/docs/guidelines/agent-infra/critical-thinking.md +4 -4
- package/docs/guidelines/agent-infra/direct-answers-demos.md +2 -2
- package/docs/guidelines/agent-infra/domain-eval-anti-pattern.md +1 -1
- package/docs/guidelines/agent-infra/engineering-memory-data-format.md +3 -3
- package/docs/guidelines/agent-infra/existence-question-verdicts.md +80 -0
- package/docs/guidelines/agent-infra/first-principles.md +2 -2
- package/docs/guidelines/agent-infra/framework-neutrality-patterns.md +2 -2
- package/docs/guidelines/agent-infra/guarded-baseline.md +39 -0
- package/docs/guidelines/agent-infra/inversion-thinking.md +5 -5
- package/docs/guidelines/agent-infra/language-and-tone-examples.md +1 -1
- package/docs/guidelines/agent-infra/layered-settings.md +10 -10
- package/docs/guidelines/agent-infra/memory-access.md +1 -1
- package/docs/guidelines/agent-infra/mental-models.md +3 -3
- package/docs/guidelines/agent-infra/reuse-verdict-mechanics.md +71 -0
- package/docs/guidelines/agent-infra/review-routing-data-format.md +7 -7
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +13 -7
- package/docs/guidelines/agent-infra/role-contracts.md +2 -2
- package/docs/guidelines/agent-infra/role-mode-router.md +3 -3
- package/docs/guidelines/agent-infra/rule-type-governance.md +2 -2
- package/docs/guidelines/agent-infra/scqa-framework.md +5 -5
- package/docs/guidelines/agent-infra/self-improvement-pipeline.md +6 -6
- package/docs/guidelines/agent-infra/simplicity-and-goal-demos.md +2 -2
- package/docs/guidelines/agent-infra/six-hats.md +3 -3
- package/docs/guidelines/agent-infra/skill-quality-checklist.md +6 -6
- package/docs/guidelines/agent-infra/source-confidentiality-mechanics.md +109 -0
- package/docs/guidelines/agent-infra/systems-thinking.md +1 -1
- package/docs/guidelines/agent-infra/verify-before-complete-demos.md +2 -2
- package/docs/guidelines/augment-portability-patterns.md +6 -4
- package/docs/guidelines/code-clarity.md +18 -0
- package/docs/guidelines/component-oriented-and-oop-development.md +3 -2
- package/docs/guidelines/cross-role-handoff.md +2 -2
- package/docs/guidelines/design-fidelity-mechanics.md +1 -1
- package/docs/guidelines/docs/readme-size-and-splitting.md +3 -3
- package/docs/guidelines/php/database.md +90 -7
- package/docs/guidelines/prompt-templates.md +7 -7
- package/llms.txt +2 -2
- package/package.json +5 -2
- package/src/agent-src/scripts/archive_completed_roadmaps.ts +252 -8
- package/src/agent-src/scripts/guarded_baseline.ts +343 -0
- package/src/agent-src/scripts/roadmap_set_step.ts +253 -0
- package/src/agent-src/scripts/stub_queue.ts +82 -0
- package/src/agent-src/scripts/stubs_due.ts +516 -0
- package/src/agent-src/scripts/ticket_bundles.ts +84 -0
- package/src/agent-src/scripts/update_roadmap_progress.ts +16 -12
- package/src/agent-src/templates/scripts/check_memory.ts +258 -17
- package/src/agent-src/templates/scripts/check_memory_proposal.ts +9 -3
- package/src/agent-src/templates/scripts/memory_lookup.ts +86 -0
- package/src/agent-src/templates/scripts/memory_signal.ts +44 -0
- package/src/agent-src/templates/scripts/work_engine/directives/backend/implement.ts +90 -0
- package/src/agent-src/templates/scripts/work_engine/directives/backend/index.ts +11 -0
- package/src/agent-src/templates/scripts/work_engine/directives/backend/test.ts +23 -1
- package/src/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +10 -1
- package/src/agent-src/templates/scripts/work_engine/directives/mixed/stitch.ts +5 -1
- package/src/agent-src/templates/scripts/work_engine/stack/runner.ts +102 -14
- package/src/config/agent-settings.template.yml +32 -3
- package/src/config/assurance-capability-registry.json +21 -9
- package/src/config/canonical-terms.yml +119 -0
- package/src/config/capability-native-outcome-bars.json +81 -0
- package/src/config/ci-local-parity.yml +80 -0
- package/src/config/drafting-channels.yml +43 -0
- package/src/config/estate-count-budget.json +57 -36
- package/src/config/evaluator-budgets.json +14 -14
- package/src/config/gate-coverage.yml +729 -63
- package/src/config/gate-reachability-exemptions.json +21 -0
- package/src/config/gate-violation-baselines.json +42 -19
- package/src/config/harness-evolution-budget.json +25 -0
- package/src/config/lapsed-beta-baseline.json +96 -0
- package/src/config/memory-twin-verdicts.yml +129 -0
- package/src/config/metric-registry.yml +124 -0
- package/src/config/pack-size-budget.json +16 -15
- package/src/config/preamble-payload-budget.json +12 -4
- package/src/config/profiles/balanced.ini +27 -0
- package/src/config/profiles/full.ini +27 -0
- package/src/config/profiles/minimal.ini +27 -0
- package/src/config/publish-surface.json +9 -2
- package/src/config/routing-coverage-seed.json +16 -2
- package/src/config/rule-stub-ceilings.json +133 -112
- package/src/config/turnaround-budget.json +66 -0
- package/src/install/claudeRuleRewrite.ts +288 -0
- package/src/install/detect.ts +60 -17
- package/src/install/detect_php_shape.ts +191 -0
- package/src/scripts/_cli/cmd_doctor.ts +27 -112
- package/src/scripts/_dispatch.bash +23 -0
- package/src/scripts/_lib/activation_ladder.ts +255 -0
- package/src/scripts/_lib/activation_receipt_producer.ts +341 -0
- package/src/scripts/_lib/activation_states.ts +88 -0
- package/src/scripts/_lib/adherence_detectors.ts +143 -0
- package/src/scripts/_lib/adr_frontmatter.ts +26 -0
- package/src/scripts/_lib/arith_claims.ts +181 -0
- package/src/scripts/_lib/arm_ranking.ts +62 -0
- package/src/scripts/_lib/asset_delivery_ledger.ts +303 -0
- package/src/scripts/_lib/audit_field_provenance.ts +54 -0
- package/src/scripts/_lib/auto_dispatch.ts +32 -3
- package/src/scripts/_lib/bench_ab_size_claim.ts +98 -4
- package/src/scripts/_lib/benchmark_cache_fields.ts +158 -0
- package/src/scripts/_lib/candidate_pair_delta.ts +349 -0
- package/src/scripts/_lib/candidate_proposer.ts +402 -0
- package/src/scripts/_lib/candidate_record.ts +601 -0
- package/src/scripts/_lib/capture_rate.ts +319 -0
- package/src/scripts/_lib/carrier_status.ts +118 -0
- package/src/scripts/_lib/cascade_stage_enumeration.ts +92 -0
- package/src/scripts/_lib/collector_denominator.ts +771 -0
- package/src/scripts/_lib/collector_record.ts +340 -0
- package/src/scripts/_lib/collector_store.ts +664 -0
- package/src/scripts/_lib/collector_supervision.ts +827 -0
- package/src/scripts/_lib/concern_estate.ts +77 -0
- package/src/scripts/_lib/config_chain.ts +477 -0
- package/src/scripts/_lib/config_cost.ts +209 -0
- package/src/scripts/_lib/corpus_manifest.ts +726 -0
- package/src/scripts/_lib/council_settings_block.ts +6 -0
- package/src/scripts/_lib/curator_ops.ts +172 -0
- package/src/scripts/_lib/delivery_arm_experiment.ts +282 -0
- package/src/scripts/_lib/delivery_criticality.ts +126 -0
- package/src/scripts/_lib/doctor_runtime_checks.ts +70 -0
- package/src/scripts/_lib/empty_cycles.ts +88 -0
- package/src/scripts/_lib/estate_carrier_cases.ts +72 -0
- package/src/scripts/_lib/eval_publication.ts +354 -0
- package/src/scripts/_lib/evaluation_cascade.ts +452 -0
- package/src/scripts/_lib/evaluation_vector.ts +283 -0
- package/src/scripts/_lib/evaluator_promotion.ts +225 -0
- package/src/scripts/_lib/evidence_basis.ts +118 -0
- package/src/scripts/_lib/evolution_roi.ts +562 -0
- package/src/scripts/_lib/exec_evidence.ts +8 -0
- package/src/scripts/_lib/experience_card.ts +272 -0
- package/src/scripts/_lib/experience_report.ts +151 -0
- package/src/scripts/_lib/experiment_freeze.ts +112 -0
- package/src/scripts/_lib/generated_by.ts +66 -0
- package/src/scripts/_lib/harness_evolution_guards.ts +239 -0
- package/src/scripts/_lib/hook_effect_probe.ts +141 -0
- package/src/scripts/_lib/host_denominator.ts +687 -0
- package/src/scripts/_lib/host_projection_reach.ts +157 -0
- package/src/scripts/_lib/ignored_blocker.ts +148 -0
- package/src/scripts/_lib/install_reach_checks.ts +495 -0
- package/src/scripts/_lib/json_duplicate_keys.ts +150 -0
- package/src/scripts/_lib/judge_hygiene.ts +228 -0
- package/src/scripts/_lib/legacy_boundary_map.ts +228 -0
- package/src/scripts/_lib/lexical_shortlist.ts +215 -0
- package/src/scripts/_lib/llm_candidate_proposer.ts +461 -0
- package/src/scripts/_lib/llm_proposer_transport.ts +153 -0
- package/src/scripts/_lib/loop_guards.ts +299 -0
- package/src/scripts/_lib/loss_class.ts +129 -0
- package/src/scripts/_lib/machine_wake.ts +51 -0
- package/src/scripts/_lib/md_prose_lines.ts +177 -0
- package/src/scripts/_lib/minimality_tiebreak.ts +168 -0
- package/src/scripts/_lib/one_resolver_invariant.ts +449 -0
- package/src/scripts/_lib/orchestration_record.ts +253 -5
- package/src/scripts/_lib/outcome_envelope.ts +227 -0
- package/src/scripts/_lib/outcome_vocabularies.ts +125 -0
- package/src/scripts/_lib/paired_stats.ts +245 -0
- package/src/scripts/_lib/paired_verdict.ts +226 -0
- package/src/scripts/_lib/pathology_archive.ts +393 -0
- package/src/scripts/_lib/prefix_stable_surfaces.ts +123 -0
- package/src/scripts/_lib/privacy_class.ts +47 -0
- package/src/scripts/_lib/promotion_capability.ts +315 -0
- package/src/scripts/_lib/promotion_evidence.ts +414 -0
- package/src/scripts/_lib/promotion_review.ts +294 -0
- package/src/scripts/_lib/prompt_shape.ts +92 -0
- package/src/scripts/_lib/regression_neighbourhood.ts +259 -0
- package/src/scripts/_lib/release_highlights.ts +70 -1
- package/src/scripts/_lib/release_material.ts +125 -2
- package/src/scripts/_lib/repeated_failure.ts +105 -0
- package/src/scripts/_lib/repo_root.ts +111 -0
- package/src/scripts/_lib/review_skipped_record.ts +37 -0
- package/src/scripts/_lib/role_split.ts +338 -0
- package/src/scripts/_lib/routing_corpus.ts +307 -0
- package/src/scripts/_lib/routing_index_input.ts +104 -0
- package/src/scripts/_lib/rule_injection.ts +22 -1
- package/src/scripts/_lib/runtime_journal.ts +1499 -0
- package/src/scripts/_lib/runtime_wiring_checks.ts +430 -0
- package/src/scripts/_lib/semantic_noop.ts +167 -0
- package/src/scripts/_lib/skill_catalogue.ts +11 -1
- package/src/scripts/_lib/source_digest.ts +200 -0
- package/src/scripts/_lib/source_redact.ts +260 -0
- package/src/scripts/_lib/source_shape.ts +502 -0
- package/src/scripts/_lib/source_snapshot_dedup.ts +199 -0
- package/src/scripts/_lib/strip_comments.d.mts +8 -0
- package/src/scripts/_lib/strip_comments.mjs +65 -0
- package/src/scripts/_lib/test_red_state.ts +154 -0
- package/src/scripts/_lib/trigger_shift.ts +144 -0
- package/src/scripts/_lib/untrusted_content.ts +82 -7
- package/src/scripts/activation_receipt.ts +258 -0
- package/src/scripts/adoption_report.ts +1 -1
- package/src/scripts/adr/evidence_census.ts +1 -1
- package/src/scripts/adr/regenerate_index.ts +26 -2
- package/src/scripts/adr_cite_check.ts +164 -1
- package/src/scripts/ai_council/blind_review.ts +11 -1
- package/src/scripts/ai_council/clients.ts +4 -0
- package/src/scripts/ai_council/config.ts +3 -0
- package/src/scripts/ai_council/consensus.ts +28 -8
- package/src/scripts/ai_council/consensus_round.ts +226 -0
- package/src/scripts/ai_council/cross_exam.ts +128 -0
- package/src/scripts/ai_council/disagreement_signal.ts +338 -0
- package/src/scripts/ai_council/explain_route.ts +157 -0
- package/src/scripts/ai_council/information_gain.ts +293 -0
- package/src/scripts/ai_council/inline_findings.ts +340 -0
- package/src/scripts/ai_council/judge_position_bias.ts +197 -0
- package/src/scripts/ai_council/leakage_corpus.ts +385 -0
- package/src/scripts/ai_council/leakage_patterns.ts +453 -0
- package/src/scripts/ai_council/minority_retention.ts +171 -0
- package/src/scripts/ai_council/orchestrator.ts +16 -203
- package/src/scripts/ai_council/orchestrator_results.ts +23 -3
- package/src/scripts/ai_council/pricing.ts +106 -0
- package/src/scripts/ai_council/prompts.ts +74 -7
- package/src/scripts/ai_council/provider_leakage_bench.ts +327 -0
- package/src/scripts/ai_council/py_format.ts +14 -3
- package/src/scripts/ai_council/recouncil_guard.ts +293 -0
- package/src/scripts/ai_council/recouncil_savings.ts +299 -0
- package/src/scripts/ai_council/replay_route.ts +223 -0
- package/src/scripts/ai_council/response_record.ts +50 -0
- package/src/scripts/ai_council/reviewer_assignment.ts +279 -0
- package/src/scripts/ai_council/routing_training_row.ts +197 -0
- package/src/scripts/ai_council/synthesis_strategy.ts +159 -0
- package/src/scripts/ai_council/topology_bench_manifest.ts +860 -0
- package/src/scripts/ai_council/topology_vocabulary.ts +175 -0
- package/src/scripts/asset_delivery_ledger.ts +157 -0
- package/src/scripts/attest_artifact.ts +193 -0
- package/src/scripts/audit_auto_rules.ts +2 -1
- package/src/scripts/audit_command_surface.ts +1 -1
- package/src/scripts/audit_mcp_tools.ts +2 -2
- package/src/scripts/audit_skill_overlap_allowlist.json +6 -1
- package/src/scripts/audit_user_type_axis.ts +2 -1
- package/src/scripts/bench_ab_clone.ts +215 -10
- package/src/scripts/bench_ab_integrity.ts +119 -5
- package/src/scripts/bench_ab_v2_stats.ts +40 -213
- package/src/scripts/build_archive_index.ts +1 -1
- package/src/scripts/build_linear_digest.ts +1 -1
- package/src/scripts/build_proof.ts +11 -4
- package/src/scripts/build_rule_trigger_matrix.ts +1 -1
- package/src/scripts/build_source_digests.ts +157 -0
- package/src/scripts/cache_realization_report.ts +103 -0
- package/src/scripts/check_adr_frontmatter.ts +131 -10
- package/src/scripts/check_benchmark_report_fields.ts +207 -0
- package/src/scripts/check_beta_review_markers.ts +235 -6
- package/src/scripts/check_bundle_path_leakage.ts +34 -1
- package/src/scripts/check_claims.ts +576 -6
- package/src/scripts/check_composite_arming.ts +35 -0
- package/src/scripts/check_concern_admissions.ts +365 -0
- package/src/scripts/check_enforcement_coverage.ts +28 -0
- package/src/scripts/check_estate_count.ts +347 -25
- package/src/scripts/check_gate_reachability.ts +383 -0
- package/src/scripts/check_host_loadability.ts +104 -0
- package/src/scripts/check_loss_class_declared.ts +308 -0
- package/src/scripts/check_md_language.ts +15 -98
- package/src/scripts/check_memory_proposal.ts +18 -11
- package/src/scripts/check_no_currency_in_cost_surfaces.ts +225 -0
- package/src/scripts/check_no_external_sources.ts +281 -6
- package/src/scripts/check_pack_conformance_fixture.ts +11 -1
- package/src/scripts/check_pack_size.ts +59 -2
- package/src/scripts/check_preamble_payload_budget.ts +114 -3
- package/src/scripts/check_prefix_stable_mutation.ts +372 -0
- package/src/scripts/check_publish_surface.ts +10 -1
- package/src/scripts/check_references.ts +24 -1
- package/src/scripts/check_release_highlights.ts +96 -13
- package/src/scripts/check_roadmap_trackable.ts +17 -2
- package/src/scripts/check_rule_evidence_declaration.ts +316 -0
- package/src/scripts/check_rule_projection_integrity.ts +14 -4
- package/src/scripts/check_score_contract.ts +26 -3
- package/src/scripts/check_static_parity.ts +285 -0
- package/src/scripts/check_supervision_claim_atomicity.ts +498 -0
- package/src/scripts/check_suppression_hygiene.ts +15 -0
- package/src/scripts/ci_settle.ts +39 -2
- package/src/scripts/code_graph/build.ts +60 -3
- package/src/scripts/code_graph/extract.ts +44 -0
- package/src/scripts/code_graph/types.ts +24 -0
- package/src/scripts/collector_daemon.ts +714 -0
- package/src/scripts/config_cost_report.ts +302 -0
- package/src/scripts/consumer_matrix.ts +74 -1
- package/src/scripts/corpus_manifest.ts +235 -0
- package/src/scripts/cost/budget.mjs +10 -3
- package/src/scripts/cost/track.mjs +10 -3
- package/src/scripts/council_cli.ts +37 -54
- package/src/scripts/dispatch_r2_reviewer.ts +46 -5
- package/src/scripts/evolution_lab.ts +1153 -0
- package/src/scripts/external_sources_denylist.json +5 -18
- package/src/scripts/extract_audit_patterns.ts +21 -0
- package/src/scripts/fold_intake.ts +12 -1
- package/src/scripts/gen_discovery_baseline.ts +1 -1
- package/src/scripts/generate_capabilities_index.ts +12 -5
- package/src/scripts/generate_capability_matrix.ts +3 -3
- package/src/scripts/generate_command_flows.ts +2 -2
- package/src/scripts/generate_cookbook.ts +2 -2
- package/src/scripts/generate_index.ts +8 -1
- package/src/scripts/generate_knowledge_index.ts +2 -1
- package/src/scripts/generate_ownership_matrix.ts +2 -1
- package/src/scripts/generate_pack_manifests.ts +10 -2
- package/src/scripts/generate_role_experiences_catalog.ts +2 -2
- package/src/scripts/generate_settings_reference.ts +1 -1
- package/src/scripts/git_authorization_hook.ts +22 -1
- package/src/scripts/grade_target_readiness.ts +48 -5
- package/src/scripts/hook_effect_doctor.ts +261 -0
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +125 -16
- package/src/scripts/hooks/block_speaking_inbox_dir.ts +271 -0
- package/src/scripts/hooks/block_unauthorized_git.ts +18 -0
- package/src/scripts/hooks/comment_discipline_hook.ts +146 -0
- package/src/scripts/hooks/concern_registry.ts +6 -0
- package/src/scripts/hooks/dispatch_hook.ts +32 -0
- package/src/scripts/hooks/journal_record_hook.ts +345 -0
- package/src/scripts/hooks/prepush_metadata_sources.sh +110 -0
- package/src/scripts/hooks/run_continuation_hook.ts +44 -9
- package/src/scripts/hooks/shims/install.sh +61 -0
- package/src/scripts/hooks/shims/php +101 -0
- package/src/scripts/hooks/suggestion_capture_hook.ts +10 -0
- package/src/scripts/hooks/turn_end_gate_hook.ts +9 -1
- package/src/scripts/hot_context_hook.ts +16 -0
- package/src/scripts/install-hooks.sh +20 -5
- package/src/scripts/install.ts +17 -35
- package/src/scripts/inventory_frontmatter.ts +2 -1
- package/src/scripts/language_mirror_hook.ts +14 -2
- package/src/scripts/lint_adr_sweep_routing.ts +12 -0
- package/src/scripts/lint_canonical_terms.ts +604 -0
- package/src/scripts/lint_carrier_integrity.ts +820 -0
- package/src/scripts/lint_code_comments.ts +643 -0
- package/src/scripts/lint_composition_review.ts +619 -0
- package/src/scripts/lint_consolidation_lineage.ts +666 -0
- package/src/scripts/lint_eval_specs.ts +593 -0
- package/src/scripts/lint_hook_manifest.ts +19 -0
- package/src/scripts/lint_host_portability.ts +373 -0
- package/src/scripts/lint_judge_prompt_expectation.ts +27 -1
- package/src/scripts/lint_memory_twin_parity.ts +335 -0
- package/src/scripts/lint_metric_consumers.ts +355 -0
- package/src/scripts/lint_plan_risk_register.ts +39 -19
- package/src/scripts/lint_promotion_paths.ts +779 -0
- package/src/scripts/lint_skill_descriptions.ts +18 -1
- package/src/scripts/lint_skill_frontmatter_safety.ts +58 -0
- package/src/scripts/lint_skill_link_reach.ts +252 -0
- package/src/scripts/lint_skill_trigger_corpus.ts +426 -23
- package/src/scripts/lint_ticket_buildable.ts +17 -1
- package/src/scripts/llm_propose.ts +256 -0
- package/src/scripts/mcp_server/consumer_tool_catalog.json +1 -1
- package/src/scripts/mcp_server/tool_catalog_source.ts +1 -1
- package/src/scripts/measure_delivery_sets.ts +361 -0
- package/src/scripts/measure_docs_dead_links.ts +348 -0
- package/src/scripts/measure_host_capture.ts +461 -0
- package/src/scripts/measure_routing_signal.ts +307 -0
- package/src/scripts/migration_status.ts +3 -3
- package/src/scripts/model_rule_injection.ts +76 -0
- package/src/scripts/orchestration_record.ts +14 -0
- package/src/scripts/preamble_byte_census.ts +139 -10
- package/src/scripts/prepack-check.mjs +4 -1
- package/src/scripts/probe_council_retention.ts +495 -0
- package/src/scripts/probe_turnaround.ts +384 -0
- package/src/scripts/probe_unblocked_ask.ts +279 -0
- package/src/scripts/release.ts +21 -37
- package/src/scripts/release_drill.ts +143 -0
- package/src/scripts/release_env.ts +35 -0
- package/src/scripts/release_publication.ts +84 -0
- package/src/scripts/render_benchmark_md.ts +1 -1
- package/src/scripts/rule_activation_census.ts +70 -9
- package/src/scripts/rule_backlinks.ts +1 -1
- package/src/scripts/run_lifecycle_suite.ts +208 -0
- package/src/scripts/run_skill_evals.ts +40 -0
- package/src/scripts/schemas/delivery-manifest.schema.json +43 -0
- package/src/scripts/schemas/drafting-channels.schema.json +43 -0
- package/src/scripts/schemas/evals.schema.json +24 -1
- package/src/scripts/schemas/rule.schema.json +52 -1
- package/src/scripts/schemas/skill.schema.json +17 -2
- package/src/scripts/skill_overlap.ts +7 -1
- package/src/scripts/skill_tools/run_block_d_eval.ts +8 -1
- package/src/scripts/skill_tools/score_skill_relevance.ts +84 -3
- package/src/scripts/skill_tools/suggest_skill_for_task.ts +8 -1
- package/src/scripts/skill_usage_report.ts +2 -1
- package/src/scripts/stubs_due.ts +211 -0
- package/src/scripts/sweep_source_surfaces.ts +678 -0
- package/src/scripts/sync_pr_branch.ts +3 -3
- package/src/scripts/trigger_eval_grandfather.json +202 -222
- package/src/scripts/utilization_report.ts +22 -2
- package/src/server/schemas/settings.ts +5 -0
- package/src/templates/marketing-copy.yml +1 -1
- package/dist/ui/assets/index-Cxgy63kz.js +0 -26
|
@@ -2,13 +2,17 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
|
|
|
2
2
|
import {
|
|
3
3
|
ZodFirstPartyTypeKind,
|
|
4
4
|
settingsSchema
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4FS4WRXP.js";
|
|
6
6
|
import {
|
|
7
7
|
main
|
|
8
8
|
} from "./chunk-6RJA2F5A.js";
|
|
9
9
|
import {
|
|
10
10
|
RULE_SOURCE_REL
|
|
11
11
|
} from "./chunk-WOKWX5PL.js";
|
|
12
|
+
import {
|
|
13
|
+
SCOPE_DETECT_AI_DIRS,
|
|
14
|
+
SCOPE_DETECT_MANIFESTS
|
|
15
|
+
} from "./chunk-A4QJ6ENT.js";
|
|
12
16
|
import {
|
|
13
17
|
ScopeMismatchError,
|
|
14
18
|
build_claude_hook_matrix,
|
|
@@ -268,9 +272,9 @@ function subtract_pointers(doc, entries) {
|
|
|
268
272
|
// src/scripts/install.ts
|
|
269
273
|
import { spawn, spawnSync } from "node:child_process";
|
|
270
274
|
import * as crypto3 from "node:crypto";
|
|
271
|
-
import * as
|
|
275
|
+
import * as fs11 from "node:fs";
|
|
272
276
|
import * as os3 from "node:os";
|
|
273
|
-
import * as
|
|
277
|
+
import * as path9 from "node:path";
|
|
274
278
|
import process2 from "node:process";
|
|
275
279
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
276
280
|
|
|
@@ -1240,6 +1244,208 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
|
|
|
1240
1244
|
}
|
|
1241
1245
|
}
|
|
1242
1246
|
|
|
1247
|
+
// src/install/claudeRuleRewrite.ts
|
|
1248
|
+
import * as fs8 from "node:fs";
|
|
1249
|
+
import * as path7 from "node:path";
|
|
1250
|
+
|
|
1251
|
+
// src/install/claudePathsPlan.ts
|
|
1252
|
+
function derive_trigger_globs(meta) {
|
|
1253
|
+
const triggers = meta["triggers"];
|
|
1254
|
+
if (!Array.isArray(triggers)) {
|
|
1255
|
+
return [];
|
|
1256
|
+
}
|
|
1257
|
+
const globs = [];
|
|
1258
|
+
for (const t of triggers) {
|
|
1259
|
+
if (t === null || typeof t !== "object" || Array.isArray(t)) continue;
|
|
1260
|
+
const obj = t;
|
|
1261
|
+
if (typeof obj["file_pattern"] === "string" && obj["file_pattern"]) {
|
|
1262
|
+
globs.push(obj["file_pattern"]);
|
|
1263
|
+
} else if (typeof obj["path_prefix"] === "string" && obj["path_prefix"]) {
|
|
1264
|
+
const prefix = obj["path_prefix"];
|
|
1265
|
+
globs.push(prefix.endsWith("/") ? `${prefix}**` : `${prefix}**`);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
return [...new Set(globs)];
|
|
1269
|
+
}
|
|
1270
|
+
function _is_unresolved_placeholder(pattern) {
|
|
1271
|
+
for (const m of pattern.matchAll(/\{([^}]*)\}/g)) {
|
|
1272
|
+
if (!m[1].includes(",")) {
|
|
1273
|
+
return true;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
return false;
|
|
1277
|
+
}
|
|
1278
|
+
function _escape_claude_bracket(pattern) {
|
|
1279
|
+
return pattern.replace(/\[/g, "\\[");
|
|
1280
|
+
}
|
|
1281
|
+
function _expanded_pattern_count(pattern) {
|
|
1282
|
+
let n = 1;
|
|
1283
|
+
for (const m of pattern.matchAll(/\{([^}]*)\}/g)) {
|
|
1284
|
+
n *= m[1].split(",").length;
|
|
1285
|
+
}
|
|
1286
|
+
return n;
|
|
1287
|
+
}
|
|
1288
|
+
var CLAUDE_PATHS_PATTERN_BUDGET = 1e3;
|
|
1289
|
+
function _has_non_path_trigger(meta) {
|
|
1290
|
+
const triggers = meta["triggers"];
|
|
1291
|
+
if (!Array.isArray(triggers)) return false;
|
|
1292
|
+
for (const t of triggers) {
|
|
1293
|
+
if (t === null || typeof t !== "object" || Array.isArray(t)) continue;
|
|
1294
|
+
const obj = t;
|
|
1295
|
+
if (typeof obj["keyword"] === "string" && obj["keyword"]) return true;
|
|
1296
|
+
if (typeof obj["phrase"] === "string" && obj["phrase"]) return true;
|
|
1297
|
+
}
|
|
1298
|
+
return false;
|
|
1299
|
+
}
|
|
1300
|
+
function _claude_paths_plan(meta) {
|
|
1301
|
+
const always_apply = Boolean(meta["alwaysApply"] || meta["type"] === "always");
|
|
1302
|
+
if (always_apply) {
|
|
1303
|
+
return { globs: [], dropped: [] };
|
|
1304
|
+
}
|
|
1305
|
+
const globs = [];
|
|
1306
|
+
const dropped = [];
|
|
1307
|
+
if (_has_non_path_trigger(meta)) {
|
|
1308
|
+
for (const raw of derive_trigger_globs(meta)) {
|
|
1309
|
+
dropped.push({ pattern: raw, reason: "mixed-triggers" });
|
|
1310
|
+
}
|
|
1311
|
+
return { globs, dropped };
|
|
1312
|
+
}
|
|
1313
|
+
let spent = 0;
|
|
1314
|
+
for (const raw of derive_trigger_globs(meta)) {
|
|
1315
|
+
if (_is_unresolved_placeholder(raw)) {
|
|
1316
|
+
dropped.push({ pattern: raw, reason: "unresolved-placeholder" });
|
|
1317
|
+
continue;
|
|
1318
|
+
}
|
|
1319
|
+
const cost = _expanded_pattern_count(raw);
|
|
1320
|
+
if (spent + cost > CLAUDE_PATHS_PATTERN_BUDGET) {
|
|
1321
|
+
dropped.push({ pattern: raw, reason: "over-budget" });
|
|
1322
|
+
continue;
|
|
1323
|
+
}
|
|
1324
|
+
spent += cost;
|
|
1325
|
+
globs.push(_escape_claude_bracket(raw));
|
|
1326
|
+
}
|
|
1327
|
+
return { globs, dropped };
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
// src/install/claudeRuleRewrite.ts
|
|
1331
|
+
var PRESERVED_KEYS = ["package", "source_path"];
|
|
1332
|
+
function _withPreservedKeys(rendered, original) {
|
|
1333
|
+
const keep = [];
|
|
1334
|
+
if (original.startsWith("---")) {
|
|
1335
|
+
const end = original.indexOf("\n---", 3);
|
|
1336
|
+
if (end !== -1) {
|
|
1337
|
+
for (const line of original.slice(3, end).split("\n")) {
|
|
1338
|
+
if (PRESERVED_KEYS.some((k) => line.startsWith(`${k}:`))) keep.push(line);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
if (keep.length === 0) return rendered;
|
|
1343
|
+
if (rendered.startsWith("---\n")) {
|
|
1344
|
+
const end = rendered.indexOf("\n---", 3);
|
|
1345
|
+
if (end !== -1) {
|
|
1346
|
+
return rendered.slice(0, end) + "\n" + keep.join("\n") + rendered.slice(end);
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
return ["---", ...keep, "---", "", rendered].join("\n");
|
|
1350
|
+
}
|
|
1351
|
+
function rewriteAndReport(rulesDir, quiet, info2, warn2, wrappers) {
|
|
1352
|
+
const result = rewriteClaudeRules(rulesDir);
|
|
1353
|
+
if (wrappers && !quiet) {
|
|
1354
|
+
if (wrappers.wrapped.length > 0) {
|
|
1355
|
+
info2(
|
|
1356
|
+
` claude-code: ${wrappers.wrapped.length} visible flat command(s) projected as skill wrappers (Claude Code flat-command discovery workaround)`
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
if (wrappers.reserved.length > 0) {
|
|
1360
|
+
info2(
|
|
1361
|
+
` claude-code: ${wrappers.reserved.length} flat command(s) withheld \u2014 name is a Claude Code built-in (${wrappers.reserved.join(", ")}); nested /cluster:sub commands remain available`
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
if (result.rewritten > 0 && !quiet) {
|
|
1366
|
+
info2(
|
|
1367
|
+
` claude-code: ${result.rewritten} rule(s) rewritten to host form; ${result.scoped.length} path-scoped (${result.scoped.join(", ") || "none"})`
|
|
1368
|
+
);
|
|
1369
|
+
}
|
|
1370
|
+
if (result.dropped.length > 0 && !quiet) {
|
|
1371
|
+
const rules = [...new Set(result.dropped.map((d) => d.rule))];
|
|
1372
|
+
info2(
|
|
1373
|
+
` claude-code: ${rules.length} rule(s) keep unconditional activation (mixed path + keyword triggers; \`paths:\` is exclusive on this host)`
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
1376
|
+
for (const f of result.failed) {
|
|
1377
|
+
warn2(` claude-code: ${f.rule}: could not write host form \u2014 ${f.reason}`);
|
|
1378
|
+
}
|
|
1379
|
+
return result;
|
|
1380
|
+
}
|
|
1381
|
+
function pyRstrip(s) {
|
|
1382
|
+
return s.replace(/\s+$/u, "");
|
|
1383
|
+
}
|
|
1384
|
+
function yamlScalar(value) {
|
|
1385
|
+
return JSON.stringify(value);
|
|
1386
|
+
}
|
|
1387
|
+
function renderClaudeRule(sourceText) {
|
|
1388
|
+
const [meta, body] = parseFrontmatter(sourceText);
|
|
1389
|
+
const plan = _claude_paths_plan(meta);
|
|
1390
|
+
const lines = [];
|
|
1391
|
+
if (plan.globs.length > 0) {
|
|
1392
|
+
lines.push("---", "paths:");
|
|
1393
|
+
for (const g of plan.globs) {
|
|
1394
|
+
lines.push(` - ${yamlScalar(g)}`);
|
|
1395
|
+
}
|
|
1396
|
+
lines.push("---", "");
|
|
1397
|
+
}
|
|
1398
|
+
lines.push(pyRstrip(body) + "\n");
|
|
1399
|
+
return { text: lines.join("\n"), globs: plan.globs, dropped: plan.dropped };
|
|
1400
|
+
}
|
|
1401
|
+
function rewriteClaudeRules(rulesDir) {
|
|
1402
|
+
const result = { rewritten: 0, scoped: [], dropped: [], failed: [] };
|
|
1403
|
+
let entries;
|
|
1404
|
+
try {
|
|
1405
|
+
entries = fs8.readdirSync(rulesDir);
|
|
1406
|
+
} catch {
|
|
1407
|
+
return result;
|
|
1408
|
+
}
|
|
1409
|
+
for (const name of entries.filter((n) => n.endsWith(".md")).sort()) {
|
|
1410
|
+
const full = path7.join(rulesDir, name);
|
|
1411
|
+
let stat;
|
|
1412
|
+
try {
|
|
1413
|
+
stat = fs8.lstatSync(full);
|
|
1414
|
+
} catch {
|
|
1415
|
+
continue;
|
|
1416
|
+
}
|
|
1417
|
+
if (!stat.isFile() || stat.isSymbolicLink()) continue;
|
|
1418
|
+
let text;
|
|
1419
|
+
try {
|
|
1420
|
+
text = fs8.readFileSync(full, "utf-8");
|
|
1421
|
+
} catch {
|
|
1422
|
+
continue;
|
|
1423
|
+
}
|
|
1424
|
+
const [meta] = parseFrontmatter(text);
|
|
1425
|
+
if (meta["paths"] !== void 0 && meta["triggers"] === void 0) continue;
|
|
1426
|
+
const rendered = renderClaudeRule(text);
|
|
1427
|
+
const withOwnership = _withPreservedKeys(rendered.text, text);
|
|
1428
|
+
if (withOwnership !== text) {
|
|
1429
|
+
try {
|
|
1430
|
+
fs8.writeFileSync(full, withOwnership, "utf-8");
|
|
1431
|
+
} catch (e) {
|
|
1432
|
+
result.failed.push({
|
|
1433
|
+
rule: name.slice(0, -3),
|
|
1434
|
+
reason: e instanceof Error ? e.message : String(e)
|
|
1435
|
+
});
|
|
1436
|
+
continue;
|
|
1437
|
+
}
|
|
1438
|
+
result.rewritten += 1;
|
|
1439
|
+
}
|
|
1440
|
+
const stem = name.slice(0, -3);
|
|
1441
|
+
if (rendered.globs.length > 0) result.scoped.push(stem);
|
|
1442
|
+
for (const d of rendered.dropped) {
|
|
1443
|
+
result.dropped.push({ rule: stem, pattern: d.pattern, reason: d.reason });
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
return result;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1243
1449
|
// src/shared/settingsSurface.ts
|
|
1244
1450
|
function unwrapRef(root) {
|
|
1245
1451
|
if (root.$ref !== void 0 && root.definitions !== void 0) {
|
|
@@ -2595,8 +2801,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2595
2801
|
};
|
|
2596
2802
|
|
|
2597
2803
|
// src/scripts/_lib/module_detection.ts
|
|
2598
|
-
import * as
|
|
2599
|
-
import * as
|
|
2804
|
+
import * as fs9 from "node:fs";
|
|
2805
|
+
import * as path8 from "node:path";
|
|
2600
2806
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
2601
2807
|
var _RULES = [
|
|
2602
2808
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -2610,14 +2816,14 @@ var _RULES = [
|
|
|
2610
2816
|
];
|
|
2611
2817
|
function _isDir(p) {
|
|
2612
2818
|
try {
|
|
2613
|
-
return
|
|
2819
|
+
return fs9.statSync(p).isDirectory();
|
|
2614
2820
|
} catch {
|
|
2615
2821
|
return false;
|
|
2616
2822
|
}
|
|
2617
2823
|
}
|
|
2618
2824
|
function _isFile(p) {
|
|
2619
2825
|
try {
|
|
2620
|
-
return
|
|
2826
|
+
return fs9.statSync(p).isFile();
|
|
2621
2827
|
} catch {
|
|
2622
2828
|
return false;
|
|
2623
2829
|
}
|
|
@@ -2631,13 +2837,13 @@ function _isUpperChar(ch) {
|
|
|
2631
2837
|
function _list_module_subdirs(root) {
|
|
2632
2838
|
let entries;
|
|
2633
2839
|
try {
|
|
2634
|
-
entries =
|
|
2840
|
+
entries = fs9.readdirSync(root).sort();
|
|
2635
2841
|
} catch {
|
|
2636
2842
|
return [];
|
|
2637
2843
|
}
|
|
2638
2844
|
const out = [];
|
|
2639
2845
|
for (const name of entries) {
|
|
2640
|
-
if (!_isDir(
|
|
2846
|
+
if (!_isDir(path8.join(root, name))) {
|
|
2641
2847
|
continue;
|
|
2642
2848
|
}
|
|
2643
2849
|
if (name.startsWith(".")) {
|
|
@@ -2659,11 +2865,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
2659
2865
|
return capitalized.length > 0 ? "high" : "medium";
|
|
2660
2866
|
}
|
|
2661
2867
|
if (stack === "node-monorepo") {
|
|
2662
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
2868
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path8.join(root, name, "package.json")));
|
|
2663
2869
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
2664
2870
|
}
|
|
2665
2871
|
if (stack === "python-src") {
|
|
2666
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
2872
|
+
const withInit = subdirs.filter((name) => _isFile(path8.join(root, name, "__init__.py")));
|
|
2667
2873
|
return withInit.length > 0 ? "high" : "medium";
|
|
2668
2874
|
}
|
|
2669
2875
|
if (stack === "go-internal") {
|
|
@@ -2675,7 +2881,7 @@ function detect_module_roots(project_root) {
|
|
|
2675
2881
|
const high = [];
|
|
2676
2882
|
const medium = [];
|
|
2677
2883
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
2678
|
-
const abs_path =
|
|
2884
|
+
const abs_path = path8.join(project_root, rel_path);
|
|
2679
2885
|
if (!_isDir(abs_path)) {
|
|
2680
2886
|
continue;
|
|
2681
2887
|
}
|
|
@@ -2697,7 +2903,7 @@ function detect_module_roots(project_root) {
|
|
|
2697
2903
|
}
|
|
2698
2904
|
|
|
2699
2905
|
// src/scripts/_lib/model_tier.ts
|
|
2700
|
-
import
|
|
2906
|
+
import fs10 from "node:fs";
|
|
2701
2907
|
var TIER_TO_CLAUDE_MODEL = {
|
|
2702
2908
|
frontier: "fable",
|
|
2703
2909
|
high: "opus",
|
|
@@ -2706,8 +2912,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
2706
2912
|
};
|
|
2707
2913
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
2708
2914
|
function read_model_tier(skill_md) {
|
|
2709
|
-
if (!
|
|
2710
|
-
const text =
|
|
2915
|
+
if (!fs10.existsSync(skill_md)) return null;
|
|
2916
|
+
const text = fs10.readFileSync(skill_md).toString("utf-8");
|
|
2711
2917
|
if (!text.startsWith("---\n")) return null;
|
|
2712
2918
|
const end = text.indexOf("\n---\n", 4);
|
|
2713
2919
|
if (end === -1) return null;
|
|
@@ -2741,34 +2947,34 @@ var ArgparseExit = class extends Error {
|
|
|
2741
2947
|
function expanduser2(p) {
|
|
2742
2948
|
if (p === "~") return os3.homedir();
|
|
2743
2949
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
2744
|
-
return
|
|
2950
|
+
return path9.join(os3.homedir(), p.slice(2));
|
|
2745
2951
|
}
|
|
2746
2952
|
return p;
|
|
2747
2953
|
}
|
|
2748
2954
|
function resolvePath(p) {
|
|
2749
2955
|
try {
|
|
2750
|
-
return
|
|
2956
|
+
return fs11.realpathSync(path9.resolve(p));
|
|
2751
2957
|
} catch {
|
|
2752
|
-
return
|
|
2958
|
+
return path9.resolve(p);
|
|
2753
2959
|
}
|
|
2754
2960
|
}
|
|
2755
2961
|
function isFile(p) {
|
|
2756
2962
|
try {
|
|
2757
|
-
return
|
|
2963
|
+
return fs11.statSync(p).isFile();
|
|
2758
2964
|
} catch {
|
|
2759
2965
|
return false;
|
|
2760
2966
|
}
|
|
2761
2967
|
}
|
|
2762
2968
|
function isDir(p) {
|
|
2763
2969
|
try {
|
|
2764
|
-
return
|
|
2970
|
+
return fs11.statSync(p).isDirectory();
|
|
2765
2971
|
} catch {
|
|
2766
2972
|
return false;
|
|
2767
2973
|
}
|
|
2768
2974
|
}
|
|
2769
2975
|
function pathExists(p) {
|
|
2770
2976
|
try {
|
|
2771
|
-
|
|
2977
|
+
fs11.statSync(p);
|
|
2772
2978
|
return true;
|
|
2773
2979
|
} catch {
|
|
2774
2980
|
return false;
|
|
@@ -2776,24 +2982,24 @@ function pathExists(p) {
|
|
|
2776
2982
|
}
|
|
2777
2983
|
function isSymlink(p) {
|
|
2778
2984
|
try {
|
|
2779
|
-
return
|
|
2985
|
+
return fs11.lstatSync(p).isSymbolicLink();
|
|
2780
2986
|
} catch {
|
|
2781
2987
|
return false;
|
|
2782
2988
|
}
|
|
2783
2989
|
}
|
|
2784
2990
|
function readText(p) {
|
|
2785
|
-
return
|
|
2991
|
+
return fs11.readFileSync(p, "utf-8");
|
|
2786
2992
|
}
|
|
2787
2993
|
function writeText(p, content) {
|
|
2788
|
-
|
|
2994
|
+
fs11.writeFileSync(p, content, "utf-8");
|
|
2789
2995
|
}
|
|
2790
2996
|
function mkdirp(p) {
|
|
2791
|
-
|
|
2997
|
+
fs11.mkdirSync(p, { recursive: true });
|
|
2792
2998
|
}
|
|
2793
2999
|
function sortedGlobStems(directory, suffix) {
|
|
2794
3000
|
let entries;
|
|
2795
3001
|
try {
|
|
2796
|
-
entries =
|
|
3002
|
+
entries = fs11.readdirSync(directory);
|
|
2797
3003
|
} catch {
|
|
2798
3004
|
return [];
|
|
2799
3005
|
}
|
|
@@ -2813,7 +3019,7 @@ function sortedGlobStems(directory, suffix) {
|
|
|
2813
3019
|
function countZips(directory) {
|
|
2814
3020
|
if (!isDir(directory)) return 0;
|
|
2815
3021
|
let n = 0;
|
|
2816
|
-
for (const name of
|
|
3022
|
+
for (const name of fs11.readdirSync(directory)) {
|
|
2817
3023
|
if (name.endsWith(".zip")) n += 1;
|
|
2818
3024
|
}
|
|
2819
3025
|
return n;
|
|
@@ -2821,35 +3027,35 @@ function countZips(directory) {
|
|
|
2821
3027
|
function sha256OfFile(p) {
|
|
2822
3028
|
let data;
|
|
2823
3029
|
try {
|
|
2824
|
-
data =
|
|
3030
|
+
data = fs11.readFileSync(p);
|
|
2825
3031
|
} catch {
|
|
2826
3032
|
return null;
|
|
2827
3033
|
}
|
|
2828
3034
|
return crypto3.createHash("sha256").update(data).digest("hex");
|
|
2829
3035
|
}
|
|
2830
3036
|
function atomicWrite0644(target, body, prefix) {
|
|
2831
|
-
const dir =
|
|
2832
|
-
const tmpName =
|
|
3037
|
+
const dir = path9.dirname(target);
|
|
3038
|
+
const tmpName = path9.join(
|
|
2833
3039
|
dir,
|
|
2834
3040
|
`${prefix}${process2.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
|
|
2835
3041
|
);
|
|
2836
3042
|
let fd = null;
|
|
2837
3043
|
try {
|
|
2838
|
-
fd =
|
|
2839
|
-
|
|
2840
|
-
|
|
3044
|
+
fd = fs11.openSync(tmpName, "wx", 420);
|
|
3045
|
+
fs11.writeFileSync(fd, body, "utf-8");
|
|
3046
|
+
fs11.closeSync(fd);
|
|
2841
3047
|
fd = null;
|
|
2842
|
-
|
|
2843
|
-
|
|
3048
|
+
fs11.chmodSync(tmpName, 420);
|
|
3049
|
+
fs11.renameSync(tmpName, target);
|
|
2844
3050
|
} catch (err) {
|
|
2845
3051
|
if (fd !== null) {
|
|
2846
3052
|
try {
|
|
2847
|
-
|
|
3053
|
+
fs11.closeSync(fd);
|
|
2848
3054
|
} catch {
|
|
2849
3055
|
}
|
|
2850
3056
|
}
|
|
2851
3057
|
try {
|
|
2852
|
-
|
|
3058
|
+
fs11.unlinkSync(tmpName);
|
|
2853
3059
|
} catch {
|
|
2854
3060
|
}
|
|
2855
3061
|
throw err;
|
|
@@ -2973,12 +3179,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
2973
3179
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
2974
3180
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
2975
3181
|
function _canonical_settings_target(project_root) {
|
|
2976
|
-
return
|
|
3182
|
+
return path9.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
2977
3183
|
}
|
|
2978
3184
|
function _resolve_settings_read(project_root) {
|
|
2979
3185
|
const canonical = _canonical_settings_target(project_root);
|
|
2980
3186
|
if (pathExists(canonical)) return canonical;
|
|
2981
|
-
const legacy =
|
|
3187
|
+
const legacy = path9.join(project_root, SETTINGS_FILE);
|
|
2982
3188
|
if (pathExists(legacy)) return legacy;
|
|
2983
3189
|
return canonical;
|
|
2984
3190
|
}
|
|
@@ -3042,9 +3248,9 @@ function fail(msg) {
|
|
|
3042
3248
|
throw new SystemExitError(1);
|
|
3043
3249
|
}
|
|
3044
3250
|
function detect_package_root(project_root) {
|
|
3045
|
-
const npm_path =
|
|
3251
|
+
const npm_path = path9.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
3046
3252
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
3047
|
-
if (pathExists(
|
|
3253
|
+
if (pathExists(path9.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
3048
3254
|
return project_root;
|
|
3049
3255
|
}
|
|
3050
3256
|
fail(
|
|
@@ -3052,12 +3258,12 @@ function detect_package_root(project_root) {
|
|
|
3052
3258
|
);
|
|
3053
3259
|
}
|
|
3054
3260
|
function detect_package_type(package_root) {
|
|
3055
|
-
if (package_root.split(
|
|
3261
|
+
if (package_root.split(path9.sep).includes("node_modules")) return "npm";
|
|
3056
3262
|
return "local";
|
|
3057
3263
|
}
|
|
3058
3264
|
function detect_package_type_for_project(project_root, package_root) {
|
|
3059
3265
|
const npm_path = resolvePath(
|
|
3060
|
-
|
|
3266
|
+
path9.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
3061
3267
|
);
|
|
3062
3268
|
const package_resolved = resolvePath(package_root);
|
|
3063
3269
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -3077,7 +3283,7 @@ function ensure_directory(p) {
|
|
|
3077
3283
|
mkdirp(p);
|
|
3078
3284
|
}
|
|
3079
3285
|
function write_file(p, content) {
|
|
3080
|
-
ensure_directory(
|
|
3286
|
+
ensure_directory(path9.dirname(p));
|
|
3081
3287
|
writeText(p, content);
|
|
3082
3288
|
}
|
|
3083
3289
|
function read_json_file(p) {
|
|
@@ -3248,7 +3454,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
3248
3454
|
return rendered + "\n" + suffix;
|
|
3249
3455
|
}
|
|
3250
3456
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
3251
|
-
const legacy_target =
|
|
3457
|
+
const legacy_target = path9.join(project_root, LEGACY_SETTINGS_FILE);
|
|
3252
3458
|
if (!isFile(legacy_target)) return null;
|
|
3253
3459
|
const legacy_text = readText(legacy_target);
|
|
3254
3460
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -3263,9 +3469,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
3263
3469
|
}
|
|
3264
3470
|
}
|
|
3265
3471
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
3266
|
-
const backup_target =
|
|
3472
|
+
const backup_target = path9.join(project_root, LEGACY_BACKUP_FILE);
|
|
3267
3473
|
writeText(backup_target, legacy_text);
|
|
3268
|
-
|
|
3474
|
+
fs11.unlinkSync(legacy_target);
|
|
3269
3475
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
3270
3476
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
3271
3477
|
if (unknown.length > 0) {
|
|
@@ -3300,7 +3506,7 @@ function _render_template(template, profile_values) {
|
|
|
3300
3506
|
return body;
|
|
3301
3507
|
}
|
|
3302
3508
|
function _load_valid_user_types(package_root) {
|
|
3303
|
-
const directory =
|
|
3509
|
+
const directory = path9.join(package_root, USER_TYPES_DIR);
|
|
3304
3510
|
if (!isDir(directory)) return [];
|
|
3305
3511
|
return sortedGlobStems(directory, ".yml");
|
|
3306
3512
|
}
|
|
@@ -3357,8 +3563,8 @@ function splitlinesKeepends(text) {
|
|
|
3357
3563
|
}
|
|
3358
3564
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
3359
3565
|
const target = _canonical_settings_target(project_root);
|
|
3360
|
-
const profile_source =
|
|
3361
|
-
const template_source =
|
|
3566
|
+
const profile_source = path9.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
3567
|
+
const template_source = path9.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
3362
3568
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
3363
3569
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
3364
3570
|
const template = readText(template_source);
|
|
@@ -3372,21 +3578,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3372
3578
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
3373
3579
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
3374
3580
|
fail(
|
|
3375
|
-
`Profile preset ${
|
|
3581
|
+
`Profile preset ${path9.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
3376
3582
|
);
|
|
3377
3583
|
}
|
|
3378
3584
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
3379
3585
|
let template_body = _render_template(template, profile_values);
|
|
3380
3586
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
3381
|
-
const legacy_root =
|
|
3587
|
+
const legacy_root = path9.join(project_root, SETTINGS_FILE);
|
|
3382
3588
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
3383
|
-
mkdirp(
|
|
3589
|
+
mkdirp(path9.dirname(target));
|
|
3384
3590
|
writeText(target, readText(legacy_root));
|
|
3385
|
-
|
|
3591
|
+
fs11.unlinkSync(legacy_root);
|
|
3386
3592
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
3387
3593
|
return;
|
|
3388
3594
|
}
|
|
3389
|
-
const legacy_target =
|
|
3595
|
+
const legacy_target = path9.join(project_root, LEGACY_SETTINGS_FILE);
|
|
3390
3596
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
3391
3597
|
warn(
|
|
3392
3598
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -3403,7 +3609,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
3403
3609
|
skip(`${SETTINGS_FILE} already exists`);
|
|
3404
3610
|
return;
|
|
3405
3611
|
}
|
|
3406
|
-
mkdirp(
|
|
3612
|
+
mkdirp(path9.dirname(target));
|
|
3407
3613
|
write_file(target, template_body);
|
|
3408
3614
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
3409
3615
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -3416,7 +3622,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3416
3622
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
3417
3623
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
3418
3624
|
return merge_json_file(
|
|
3419
|
-
|
|
3625
|
+
path9.join(project_root, ".vscode", "settings.json"),
|
|
3420
3626
|
bridge,
|
|
3421
3627
|
force,
|
|
3422
3628
|
".vscode/settings.json"
|
|
@@ -3425,14 +3631,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
3425
3631
|
function ensure_augment_bridge(project_root, force) {
|
|
3426
3632
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
3427
3633
|
return merge_json_file(
|
|
3428
|
-
|
|
3634
|
+
path9.join(project_root, ".augment", "settings.json"),
|
|
3429
3635
|
bridge,
|
|
3430
3636
|
force,
|
|
3431
3637
|
".augment/settings.json"
|
|
3432
3638
|
);
|
|
3433
3639
|
}
|
|
3434
|
-
var AUGMENT_USER_DIR =
|
|
3435
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
3640
|
+
var AUGMENT_USER_DIR = path9.join(os3.homedir(), ".augment");
|
|
3641
|
+
var AUGMENT_USER_HOOKS_DIR = path9.join(AUGMENT_USER_DIR, "hooks");
|
|
3436
3642
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
3437
3643
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
3438
3644
|
"augment-chat-history.sh",
|
|
@@ -3448,29 +3654,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
|
|
|
3448
3654
|
["post_tool_use", "PostToolUse"]
|
|
3449
3655
|
];
|
|
3450
3656
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
3451
|
-
const src =
|
|
3657
|
+
const src = path9.join(package_root, "scripts", "hooks", name);
|
|
3452
3658
|
if (!pathExists(src)) {
|
|
3453
3659
|
skip(`augment trampoline missing in package: ${src}`);
|
|
3454
3660
|
return null;
|
|
3455
3661
|
}
|
|
3456
3662
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
3457
|
-
const dst =
|
|
3663
|
+
const dst = path9.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3458
3664
|
const src_text = readText(src);
|
|
3459
3665
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3460
3666
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
3461
3667
|
} else {
|
|
3462
3668
|
writeText(dst, src_text);
|
|
3463
|
-
|
|
3669
|
+
fs11.chmodSync(dst, 493);
|
|
3464
3670
|
success(`~/.augment/hooks/${name} installed`);
|
|
3465
3671
|
}
|
|
3466
3672
|
return dst;
|
|
3467
3673
|
}
|
|
3468
3674
|
function _remove_legacy_augment_trampolines() {
|
|
3469
3675
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
3470
|
-
const legacy =
|
|
3676
|
+
const legacy = path9.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
3471
3677
|
try {
|
|
3472
3678
|
if (isFile(legacy)) {
|
|
3473
|
-
|
|
3679
|
+
fs11.unlinkSync(legacy);
|
|
3474
3680
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
3475
3681
|
}
|
|
3476
3682
|
} catch (err) {
|
|
@@ -3490,7 +3696,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
3490
3696
|
}
|
|
3491
3697
|
const settings_patch = { hooks: per_event };
|
|
3492
3698
|
return merge_json_file(
|
|
3493
|
-
|
|
3699
|
+
path9.join(AUGMENT_USER_DIR, "settings.json"),
|
|
3494
3700
|
settings_patch,
|
|
3495
3701
|
force,
|
|
3496
3702
|
"~/.augment/settings.json"
|
|
@@ -3515,7 +3721,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
3515
3721
|
return removed;
|
|
3516
3722
|
}
|
|
3517
3723
|
function ensure_claude_bridge(project_root, force) {
|
|
3518
|
-
const target =
|
|
3724
|
+
const target = path9.join(project_root, ".claude", "settings.json");
|
|
3519
3725
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
3520
3726
|
for (const pid of healed) {
|
|
3521
3727
|
success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
@@ -3542,29 +3748,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
3542
3748
|
}
|
|
3543
3749
|
const bridge = { version: 1, hooks };
|
|
3544
3750
|
return merge_json_file(
|
|
3545
|
-
|
|
3751
|
+
path9.join(project_root, ".cursor", "hooks.json"),
|
|
3546
3752
|
bridge,
|
|
3547
3753
|
force,
|
|
3548
3754
|
".cursor/hooks.json"
|
|
3549
3755
|
);
|
|
3550
3756
|
}
|
|
3551
|
-
var CURSOR_USER_DIR =
|
|
3552
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
3757
|
+
var CURSOR_USER_DIR = path9.join(os3.homedir(), ".cursor");
|
|
3758
|
+
var CURSOR_USER_HOOKS_DIR = path9.join(CURSOR_USER_DIR, "hooks");
|
|
3553
3759
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
3554
3760
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
3555
|
-
const src =
|
|
3761
|
+
const src = path9.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3556
3762
|
if (!pathExists(src)) {
|
|
3557
3763
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
3558
3764
|
return [];
|
|
3559
3765
|
}
|
|
3560
3766
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
3561
|
-
const dst =
|
|
3767
|
+
const dst = path9.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
3562
3768
|
const src_text = readText(src);
|
|
3563
3769
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3564
3770
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3565
3771
|
} else {
|
|
3566
3772
|
writeText(dst, src_text);
|
|
3567
|
-
|
|
3773
|
+
fs11.chmodSync(dst, 493);
|
|
3568
3774
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
3569
3775
|
}
|
|
3570
3776
|
const hooks = {};
|
|
@@ -3573,7 +3779,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
3573
3779
|
}
|
|
3574
3780
|
const settings_patch = { version: 1, hooks };
|
|
3575
3781
|
return merge_json_file(
|
|
3576
|
-
|
|
3782
|
+
path9.join(CURSOR_USER_DIR, "hooks.json"),
|
|
3577
3783
|
settings_patch,
|
|
3578
3784
|
force,
|
|
3579
3785
|
"~/.cursor/hooks.json"
|
|
@@ -3616,12 +3822,12 @@ exit 0
|
|
|
3616
3822
|
`;
|
|
3617
3823
|
}
|
|
3618
3824
|
function ensure_cline_bridge(project_root, force) {
|
|
3619
|
-
const hooks_dir =
|
|
3825
|
+
const hooks_dir = path9.join(project_root, ".clinerules", "hooks");
|
|
3620
3826
|
mkdirp(hooks_dir);
|
|
3621
3827
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
3622
3828
|
let written = 0;
|
|
3623
3829
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
3624
|
-
const target =
|
|
3830
|
+
const target = path9.join(hooks_dir, native_event);
|
|
3625
3831
|
const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
|
|
3626
3832
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
3627
3833
|
continue;
|
|
@@ -3631,7 +3837,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
3631
3837
|
continue;
|
|
3632
3838
|
}
|
|
3633
3839
|
writeText(target, body);
|
|
3634
|
-
|
|
3840
|
+
fs11.chmodSync(target, 493);
|
|
3635
3841
|
written += 1;
|
|
3636
3842
|
}
|
|
3637
3843
|
if (written) {
|
|
@@ -3640,27 +3846,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
3640
3846
|
skip(".clinerules/hooks/ already up to date");
|
|
3641
3847
|
}
|
|
3642
3848
|
}
|
|
3643
|
-
var CLINE_USER_DIR =
|
|
3849
|
+
var CLINE_USER_DIR = path9.join(os3.homedir(), "Documents", "Cline", "Hooks");
|
|
3644
3850
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
3645
3851
|
function ensure_cline_user_hooks(package_root, force) {
|
|
3646
|
-
const src =
|
|
3852
|
+
const src = path9.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
3647
3853
|
if (!pathExists(src)) {
|
|
3648
3854
|
skip(`cline trampoline missing in package: ${src}`);
|
|
3649
3855
|
return;
|
|
3650
3856
|
}
|
|
3651
3857
|
mkdirp(CLINE_USER_DIR);
|
|
3652
|
-
const trampoline =
|
|
3858
|
+
const trampoline = path9.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
3653
3859
|
const src_text = readText(src);
|
|
3654
3860
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
3655
3861
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3656
3862
|
} else {
|
|
3657
3863
|
writeText(trampoline, src_text);
|
|
3658
|
-
|
|
3864
|
+
fs11.chmodSync(trampoline, 493);
|
|
3659
3865
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
3660
3866
|
}
|
|
3661
3867
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
3662
3868
|
for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
|
|
3663
|
-
const wrapper =
|
|
3869
|
+
const wrapper = path9.join(CLINE_USER_DIR, native_event);
|
|
3664
3870
|
const body = `#!/usr/bin/env bash
|
|
3665
3871
|
# Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
|
|
3666
3872
|
# User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
|
|
@@ -3670,7 +3876,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
|
|
|
3670
3876
|
continue;
|
|
3671
3877
|
}
|
|
3672
3878
|
writeText(wrapper, body);
|
|
3673
|
-
|
|
3879
|
+
fs11.chmodSync(wrapper, 493);
|
|
3674
3880
|
}
|
|
3675
3881
|
}
|
|
3676
3882
|
var WINDSURF_DISPATCHER_BINDINGS = [
|
|
@@ -3691,29 +3897,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
3691
3897
|
}
|
|
3692
3898
|
const bridge = { hooks };
|
|
3693
3899
|
return merge_json_file(
|
|
3694
|
-
|
|
3900
|
+
path9.join(project_root, ".windsurf", "hooks.json"),
|
|
3695
3901
|
bridge,
|
|
3696
3902
|
force,
|
|
3697
3903
|
".windsurf/hooks.json"
|
|
3698
3904
|
);
|
|
3699
3905
|
}
|
|
3700
|
-
var WINDSURF_USER_DIR =
|
|
3701
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
3906
|
+
var WINDSURF_USER_DIR = path9.join(os3.homedir(), ".codeium", "windsurf");
|
|
3907
|
+
var WINDSURF_USER_HOOKS_DIR = path9.join(WINDSURF_USER_DIR, "hooks");
|
|
3702
3908
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
3703
3909
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
3704
|
-
const src =
|
|
3910
|
+
const src = path9.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3705
3911
|
if (!pathExists(src)) {
|
|
3706
3912
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
3707
3913
|
return [];
|
|
3708
3914
|
}
|
|
3709
3915
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
3710
|
-
const dst =
|
|
3916
|
+
const dst = path9.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
3711
3917
|
const src_text = readText(src);
|
|
3712
3918
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3713
3919
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3714
3920
|
} else {
|
|
3715
3921
|
writeText(dst, src_text);
|
|
3716
|
-
|
|
3922
|
+
fs11.chmodSync(dst, 493);
|
|
3717
3923
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
3718
3924
|
}
|
|
3719
3925
|
const hooks = {};
|
|
@@ -3725,7 +3931,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
3725
3931
|
}
|
|
3726
3932
|
const settings_patch = { hooks };
|
|
3727
3933
|
return merge_json_file(
|
|
3728
|
-
|
|
3934
|
+
path9.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
3729
3935
|
settings_patch,
|
|
3730
3936
|
force,
|
|
3731
3937
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -3754,43 +3960,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
3754
3960
|
function ensure_gemini_bridge(project_root, force) {
|
|
3755
3961
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
3756
3962
|
return merge_json_file(
|
|
3757
|
-
|
|
3963
|
+
path9.join(project_root, ".gemini", "settings.json"),
|
|
3758
3964
|
bridge,
|
|
3759
3965
|
force,
|
|
3760
3966
|
".gemini/settings.json"
|
|
3761
3967
|
);
|
|
3762
3968
|
}
|
|
3763
|
-
var GEMINI_USER_DIR =
|
|
3764
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
3969
|
+
var GEMINI_USER_DIR = path9.join(os3.homedir(), ".gemini");
|
|
3970
|
+
var GEMINI_USER_HOOKS_DIR = path9.join(GEMINI_USER_DIR, "hooks");
|
|
3765
3971
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
3766
3972
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
3767
|
-
const src =
|
|
3973
|
+
const src = path9.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3768
3974
|
if (!pathExists(src)) {
|
|
3769
3975
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
3770
3976
|
return [];
|
|
3771
3977
|
}
|
|
3772
3978
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
3773
|
-
const dst =
|
|
3979
|
+
const dst = path9.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
3774
3980
|
const src_text = readText(src);
|
|
3775
3981
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
3776
3982
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
3777
3983
|
} else {
|
|
3778
3984
|
writeText(dst, src_text);
|
|
3779
|
-
|
|
3985
|
+
fs11.chmodSync(dst, 493);
|
|
3780
3986
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
3781
3987
|
}
|
|
3782
3988
|
const settings_patch = {
|
|
3783
3989
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
3784
3990
|
};
|
|
3785
3991
|
return merge_json_file(
|
|
3786
|
-
|
|
3992
|
+
path9.join(GEMINI_USER_DIR, "settings.json"),
|
|
3787
3993
|
settings_patch,
|
|
3788
3994
|
force,
|
|
3789
3995
|
"~/.gemini/settings.json"
|
|
3790
3996
|
);
|
|
3791
3997
|
}
|
|
3792
3998
|
function ensure_copilot_bridge(project_root, force) {
|
|
3793
|
-
const target =
|
|
3999
|
+
const target = path9.join(project_root, ".github", "plugin", "marketplace.json");
|
|
3794
4000
|
const bridge = {
|
|
3795
4001
|
marketplace: {
|
|
3796
4002
|
name: "event4u-agent-marketplace",
|
|
@@ -3833,7 +4039,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
3833
4039
|
Run \`./agent-config --help\` for available commands.
|
|
3834
4040
|
`;
|
|
3835
4041
|
function ensure_roocode_bridge(project_root, force) {
|
|
3836
|
-
const target =
|
|
4042
|
+
const target = path9.join(project_root, ".roo", "rules", "agent-config.md");
|
|
3837
4043
|
if (pathExists(target) && !force) {
|
|
3838
4044
|
skip(".roo/rules/agent-config.md already exists");
|
|
3839
4045
|
return;
|
|
@@ -3855,7 +4061,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
3855
4061
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3856
4062
|
`;
|
|
3857
4063
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
3858
|
-
const target =
|
|
4064
|
+
const target = path9.join(project_root, ".claude-desktop", "agent-config.md");
|
|
3859
4065
|
if (pathExists(target) && !force) {
|
|
3860
4066
|
skip(".claude-desktop/agent-config.md already exists");
|
|
3861
4067
|
return;
|
|
@@ -3880,7 +4086,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
3880
4086
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3881
4087
|
`;
|
|
3882
4088
|
function ensure_aider_bridge(project_root, force) {
|
|
3883
|
-
const target =
|
|
4089
|
+
const target = path9.join(project_root, ".aider", "agent-config.md");
|
|
3884
4090
|
if (pathExists(target) && !force) {
|
|
3885
4091
|
skip(".aider/agent-config.md already exists");
|
|
3886
4092
|
return;
|
|
@@ -3899,7 +4105,7 @@ developers where the rules and skills live.
|
|
|
3899
4105
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
3900
4106
|
`;
|
|
3901
4107
|
function ensure_codex_bridge(project_root, force) {
|
|
3902
|
-
const target =
|
|
4108
|
+
const target = path9.join(project_root, ".codex", "agent-config.md");
|
|
3903
4109
|
if (pathExists(target) && !force) {
|
|
3904
4110
|
skip(".codex/agent-config.md already exists");
|
|
3905
4111
|
return;
|
|
@@ -3917,7 +4123,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
3917
4123
|
orientation).
|
|
3918
4124
|
`;
|
|
3919
4125
|
function ensure_continue_bridge(project_root, force) {
|
|
3920
|
-
const target =
|
|
4126
|
+
const target = path9.join(project_root, ".continue", "rules", "agent-config.md");
|
|
3921
4127
|
if (pathExists(target) && !force) {
|
|
3922
4128
|
skip(".continue/rules/agent-config.md already exists");
|
|
3923
4129
|
return;
|
|
@@ -3948,7 +4154,7 @@ orientation).
|
|
|
3948
4154
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
3949
4155
|
`;
|
|
3950
4156
|
function ensure_kilocode_bridge(project_root, force) {
|
|
3951
|
-
const target =
|
|
4157
|
+
const target = path9.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
3952
4158
|
if (pathExists(target) && !force) {
|
|
3953
4159
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
3954
4160
|
return;
|
|
@@ -3975,7 +4181,7 @@ canonical source (or symlink it):
|
|
|
3975
4181
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3976
4182
|
`;
|
|
3977
4183
|
function ensure_zed_bridge(project_root, force) {
|
|
3978
|
-
const target =
|
|
4184
|
+
const target = path9.join(project_root, ".zed", "agent-config.md");
|
|
3979
4185
|
if (pathExists(target) && !force) {
|
|
3980
4186
|
skip(".zed/agent-config.md already exists");
|
|
3981
4187
|
return;
|
|
@@ -3996,7 +4202,7 @@ rules into your JetBrains profile.
|
|
|
3996
4202
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
3997
4203
|
`;
|
|
3998
4204
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
3999
|
-
const target =
|
|
4205
|
+
const target = path9.join(project_root, ".jetbrains", "agent-config.md");
|
|
4000
4206
|
if (pathExists(target) && !force) {
|
|
4001
4207
|
skip(".jetbrains/agent-config.md already exists");
|
|
4002
4208
|
return;
|
|
@@ -4027,7 +4233,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
4027
4233
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
4028
4234
|
`;
|
|
4029
4235
|
function ensure_kiro_bridge(project_root, force) {
|
|
4030
|
-
const target =
|
|
4236
|
+
const target = path9.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
4031
4237
|
if (pathExists(target) && !force) {
|
|
4032
4238
|
skip(".kiro/steering/agent-config.md already exists");
|
|
4033
4239
|
return;
|
|
@@ -4053,35 +4259,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
4053
4259
|
};
|
|
4054
4260
|
function dirHasEntries(p) {
|
|
4055
4261
|
try {
|
|
4056
|
-
return
|
|
4262
|
+
return fs11.readdirSync(p).length > 0;
|
|
4057
4263
|
} catch {
|
|
4058
4264
|
return false;
|
|
4059
4265
|
}
|
|
4060
4266
|
}
|
|
4061
4267
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
4062
4268
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
4063
|
-
let dir =
|
|
4269
|
+
let dir = path9.dirname(scriptPath);
|
|
4064
4270
|
for (; ; ) {
|
|
4065
|
-
const candidate =
|
|
4271
|
+
const candidate = path9.join(dir, "node_modules", ".bin", binName);
|
|
4066
4272
|
if (isFile(candidate)) {
|
|
4067
4273
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
4068
4274
|
}
|
|
4069
|
-
const parent =
|
|
4275
|
+
const parent = path9.dirname(dir);
|
|
4070
4276
|
if (parent === dir) break;
|
|
4071
4277
|
dir = parent;
|
|
4072
4278
|
}
|
|
4073
4279
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
4074
4280
|
}
|
|
4075
4281
|
function _smoke_test_hooks(project_root, package_root) {
|
|
4076
|
-
const dispatcher =
|
|
4077
|
-
const manifest =
|
|
4282
|
+
const dispatcher = path9.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
4283
|
+
const manifest = path9.join(package_root, "scripts", "hook_manifest.yaml");
|
|
4078
4284
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
4079
4285
|
const failed = [];
|
|
4080
4286
|
const skipped = [];
|
|
4081
4287
|
const passed = [];
|
|
4082
4288
|
for (const [platform, native] of SMOKE_PROBE_EVENTS) {
|
|
4083
4289
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
4084
|
-
const bridge_path = rel_bridge ?
|
|
4290
|
+
const bridge_path = rel_bridge ? path9.join(project_root, rel_bridge) : null;
|
|
4085
4291
|
const bridge_present = Boolean(
|
|
4086
4292
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
4087
4293
|
);
|
|
@@ -4281,9 +4487,9 @@ To remove this marker, delete this file.
|
|
|
4281
4487
|
`;
|
|
4282
4488
|
}
|
|
4283
4489
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
4284
|
-
var GLOBAL_ROOT =
|
|
4285
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
4286
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
4490
|
+
var GLOBAL_ROOT = path9.join(os3.homedir(), ".event4u", "agent-config");
|
|
4491
|
+
var GLOBAL_USER_SETTINGS_PATH = path9.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
4492
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path9.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
4287
4493
|
function _bridge_marker(tool_id, scope) {
|
|
4288
4494
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
4289
4495
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -4332,7 +4538,7 @@ function _load_yaml_doc(p) {
|
|
|
4332
4538
|
return _isPlainObject(data) ? data : {};
|
|
4333
4539
|
}
|
|
4334
4540
|
function _load_default_settings(package_root) {
|
|
4335
|
-
const template_source =
|
|
4541
|
+
const template_source = path9.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
4336
4542
|
if (!pathExists(template_source)) return {};
|
|
4337
4543
|
let text;
|
|
4338
4544
|
try {
|
|
@@ -4346,11 +4552,11 @@ function _load_default_settings(package_root) {
|
|
|
4346
4552
|
}
|
|
4347
4553
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
4348
4554
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
4349
|
-
const target =
|
|
4555
|
+
const target = path9.join(project_root, ".claude", "settings.local.json");
|
|
4350
4556
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
4351
4557
|
let real_dir = suppress_dir;
|
|
4352
4558
|
try {
|
|
4353
|
-
real_dir =
|
|
4559
|
+
real_dir = fs11.realpathSync(suppress_dir);
|
|
4354
4560
|
} catch {
|
|
4355
4561
|
real_dir = suppress_dir;
|
|
4356
4562
|
}
|
|
@@ -4361,8 +4567,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
|
|
|
4361
4567
|
success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
|
|
4362
4568
|
}
|
|
4363
4569
|
function _gate_rule_layer_overlap(project_root, layer, dry_run) {
|
|
4364
|
-
const global_dir =
|
|
4365
|
-
const project_dir =
|
|
4570
|
+
const global_dir = path9.join(os3.homedir(), ".claude", "rules");
|
|
4571
|
+
const project_dir = path9.join(project_root, ".claude", "rules");
|
|
4366
4572
|
const g = readRuleLayer(global_dir);
|
|
4367
4573
|
const p = readRuleLayer(project_dir);
|
|
4368
4574
|
if (g === null || p === null) return true;
|
|
@@ -4439,28 +4645,6 @@ function _run_scope_prompt(opts, reason, custom_path) {
|
|
|
4439
4645
|
if (!state.QUIET) info(`Custom destination: ${cp}`);
|
|
4440
4646
|
return "project";
|
|
4441
4647
|
}
|
|
4442
|
-
var SCOPE_DETECT_MANIFESTS = [
|
|
4443
|
-
"package.json",
|
|
4444
|
-
"composer.json",
|
|
4445
|
-
"pyproject.toml",
|
|
4446
|
-
"Cargo.toml",
|
|
4447
|
-
"go.mod",
|
|
4448
|
-
"Gemfile"
|
|
4449
|
-
];
|
|
4450
|
-
var SCOPE_DETECT_AI_DIRS = [
|
|
4451
|
-
".claude",
|
|
4452
|
-
".cursor",
|
|
4453
|
-
".windsurf",
|
|
4454
|
-
".augment",
|
|
4455
|
-
".clinerules",
|
|
4456
|
-
".copilot",
|
|
4457
|
-
".gemini",
|
|
4458
|
-
".codex",
|
|
4459
|
-
".aider",
|
|
4460
|
-
".continue",
|
|
4461
|
-
".roo",
|
|
4462
|
-
".kilocode"
|
|
4463
|
-
];
|
|
4464
4648
|
var SCOPE_DETECT_AI_FILES = [
|
|
4465
4649
|
"CLAUDE.md",
|
|
4466
4650
|
"AGENTS.md",
|
|
@@ -4472,9 +4656,9 @@ function detect_scope(cwd) {
|
|
|
4472
4656
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
4473
4657
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
4474
4658
|
}
|
|
4475
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
4476
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
4477
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
4659
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path9.join(cwd, m))) ?? null;
|
|
4660
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path9.join(cwd, d))) ?? null;
|
|
4661
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path9.join(cwd, f))) ?? null;
|
|
4478
4662
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
4479
4663
|
const marker = has_ai_dir || has_ai_file;
|
|
4480
4664
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -4495,7 +4679,7 @@ function readLineSyncRaw(promptText) {
|
|
|
4495
4679
|
for (; ; ) {
|
|
4496
4680
|
let n;
|
|
4497
4681
|
try {
|
|
4498
|
-
n =
|
|
4682
|
+
n = fs11.readSync(0, buf, 0, 1, null);
|
|
4499
4683
|
} catch (err) {
|
|
4500
4684
|
const code = err.code;
|
|
4501
4685
|
if (code === "EAGAIN") {
|
|
@@ -4570,8 +4754,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
|
|
|
4570
4754
|
const marker = _bridge_marker(tool_id, scope);
|
|
4571
4755
|
if (!marker) continue;
|
|
4572
4756
|
let marker_path = marker;
|
|
4573
|
-
if (!
|
|
4574
|
-
marker_path =
|
|
4757
|
+
if (!path9.isAbsolute(marker_path)) {
|
|
4758
|
+
marker_path = path9.join(project_root, marker_path);
|
|
4575
4759
|
}
|
|
4576
4760
|
out[tool_id] = [_file_entry(marker_path, "bridge", false)];
|
|
4577
4761
|
}
|
|
@@ -4610,26 +4794,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
4610
4794
|
}
|
|
4611
4795
|
write_manifest(target, version, entries);
|
|
4612
4796
|
if (!state.QUIET) {
|
|
4613
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
4797
|
+
const rel = isRelativeTo(target, project_root) ? path9.relative(project_root, target) : target;
|
|
4614
4798
|
info(`Manifest updated: ${rel}`);
|
|
4615
4799
|
}
|
|
4616
4800
|
return 0;
|
|
4617
4801
|
}
|
|
4618
4802
|
function isRelativeTo(child, parent) {
|
|
4619
|
-
const rel =
|
|
4620
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
4803
|
+
const rel = path9.relative(parent, child);
|
|
4804
|
+
return rel === "" || !rel.startsWith("..") && !path9.isAbsolute(rel);
|
|
4621
4805
|
}
|
|
4622
4806
|
function _resolve_package_root_for_global() {
|
|
4623
4807
|
const here = resolvePath(_HERE);
|
|
4624
|
-
const candidate =
|
|
4625
|
-
if (!pathExists(
|
|
4808
|
+
const candidate = path9.dirname(path9.dirname(path9.dirname(here)));
|
|
4809
|
+
if (!pathExists(path9.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
4626
4810
|
fail(
|
|
4627
4811
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
4628
4812
|
);
|
|
4629
4813
|
}
|
|
4630
4814
|
return candidate;
|
|
4631
4815
|
}
|
|
4632
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
4816
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path9.join("agents", ".event4u-bridge.yml");
|
|
4633
4817
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
4634
4818
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
4635
4819
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -4637,7 +4821,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4637
4821
|
if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
4638
4822
|
return [false, "consumer-mode-override"];
|
|
4639
4823
|
}
|
|
4640
|
-
const pkg_json =
|
|
4824
|
+
const pkg_json = path9.join(project_root, "package.json");
|
|
4641
4825
|
if (isFile(pkg_json)) {
|
|
4642
4826
|
let data = {};
|
|
4643
4827
|
try {
|
|
@@ -4649,18 +4833,18 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
4649
4833
|
return [true, "package.json:name"];
|
|
4650
4834
|
}
|
|
4651
4835
|
}
|
|
4652
|
-
if (isDir(
|
|
4836
|
+
if (isDir(path9.join(project_root, ".agent-src.uncondensed"))) {
|
|
4653
4837
|
return [true, ".agent-src.uncondensed/"];
|
|
4654
4838
|
}
|
|
4655
|
-
const packages_dir =
|
|
4839
|
+
const packages_dir = path9.join(project_root, "packages");
|
|
4656
4840
|
if (isDir(packages_dir)) {
|
|
4657
|
-
for (const child of
|
|
4658
|
-
if (isDir(
|
|
4841
|
+
for (const child of fs11.readdirSync(packages_dir)) {
|
|
4842
|
+
if (isDir(path9.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
4659
4843
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
4660
4844
|
}
|
|
4661
4845
|
}
|
|
4662
4846
|
}
|
|
4663
|
-
const installer_self =
|
|
4847
|
+
const installer_self = path9.join(project_root, "scripts", "install.py");
|
|
4664
4848
|
try {
|
|
4665
4849
|
if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE)) {
|
|
4666
4850
|
return [true, "src/scripts/install.py (self)"];
|
|
@@ -4680,17 +4864,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
4680
4864
|
}
|
|
4681
4865
|
return [];
|
|
4682
4866
|
}
|
|
4683
|
-
if (isFile(
|
|
4867
|
+
if (isFile(path9.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
4684
4868
|
const found = [];
|
|
4685
4869
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
4686
|
-
if (isFile(
|
|
4870
|
+
if (isFile(path9.join(project_root, name))) {
|
|
4687
4871
|
found.push(name);
|
|
4688
|
-
} else if (isFile(
|
|
4872
|
+
} else if (isFile(path9.join(project_root, "settings", name))) {
|
|
4689
4873
|
found.push(`settings/${name}`);
|
|
4690
4874
|
}
|
|
4691
4875
|
}
|
|
4692
4876
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
4693
|
-
const p =
|
|
4877
|
+
const p = path9.join(project_root, name);
|
|
4694
4878
|
if (isDir(p) && !isSymlink(p)) {
|
|
4695
4879
|
found.push(`${name}/`);
|
|
4696
4880
|
}
|
|
@@ -4702,7 +4886,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
4702
4886
|
process2.stdout.write("\n");
|
|
4703
4887
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
4704
4888
|
for (const rel of artefacts) {
|
|
4705
|
-
info(` ${
|
|
4889
|
+
info(` ${path9.join(project_root, rel)}`);
|
|
4706
4890
|
}
|
|
4707
4891
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
4708
4892
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -4733,20 +4917,20 @@ function _run_migrate_to_global(project_root) {
|
|
|
4733
4917
|
function _format_global_root_for_marker(global_root) {
|
|
4734
4918
|
const home = resolvePath(os3.homedir());
|
|
4735
4919
|
const resolved = resolvePath(global_root);
|
|
4736
|
-
const rel =
|
|
4737
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
4920
|
+
const rel = path9.relative(home, resolved);
|
|
4921
|
+
if (rel === "" || rel.startsWith("..") || path9.isAbsolute(rel)) {
|
|
4738
4922
|
return global_root;
|
|
4739
4923
|
}
|
|
4740
|
-
return `~/${rel.split(
|
|
4924
|
+
return `~/${rel.split(path9.sep).join("/")}`;
|
|
4741
4925
|
}
|
|
4742
4926
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
4743
4927
|
const env_map = env ?? process2.env;
|
|
4744
4928
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
4745
|
-
if (isDir(
|
|
4746
|
-
const target =
|
|
4929
|
+
if (isDir(path9.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
4930
|
+
const target = path9.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
4747
4931
|
if (!isFile(target)) return null;
|
|
4748
4932
|
try {
|
|
4749
|
-
|
|
4933
|
+
fs11.rmSync(target);
|
|
4750
4934
|
} catch {
|
|
4751
4935
|
return null;
|
|
4752
4936
|
}
|
|
@@ -4760,7 +4944,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
4760
4944
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
4761
4945
|
const env_map = env ?? process2.env;
|
|
4762
4946
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
4763
|
-
if (isDir(
|
|
4947
|
+
if (isDir(path9.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
4764
4948
|
const global_root_str = _format_global_root_for_marker(
|
|
4765
4949
|
event4u_root(env_map)
|
|
4766
4950
|
);
|
|
@@ -4769,8 +4953,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
4769
4953
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
4770
4954
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
4771
4955
|
if (!tools.has(tool_id)) continue;
|
|
4772
|
-
const target =
|
|
4773
|
-
mkdirp(
|
|
4956
|
+
const target = path9.join(project_root, rel_path);
|
|
4957
|
+
mkdirp(path9.dirname(target));
|
|
4774
4958
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
4775
4959
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
4776
4960
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -4788,7 +4972,7 @@ installed_at: ${stamp}
|
|
|
4788
4972
|
}
|
|
4789
4973
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
4790
4974
|
function _inject_package_tag(target, source, package_root) {
|
|
4791
|
-
if (
|
|
4975
|
+
if (path9.extname(target) !== ".md") return;
|
|
4792
4976
|
let text;
|
|
4793
4977
|
try {
|
|
4794
4978
|
text = readText(target);
|
|
@@ -4816,8 +5000,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
4816
5000
|
resolved_src = source;
|
|
4817
5001
|
}
|
|
4818
5002
|
if (package_root !== null) {
|
|
4819
|
-
const rel =
|
|
4820
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
5003
|
+
const rel = path9.relative(resolvePath(package_root), resolved_src);
|
|
5004
|
+
if (rel !== "" && !rel.startsWith("..") && !path9.isAbsolute(rel)) {
|
|
4821
5005
|
source_value = rel;
|
|
4822
5006
|
} else {
|
|
4823
5007
|
source_value = resolved_src;
|
|
@@ -4852,7 +5036,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
4852
5036
|
if (package_root === null) return false;
|
|
4853
5037
|
let root;
|
|
4854
5038
|
try {
|
|
4855
|
-
root =
|
|
5039
|
+
root = fs11.realpathSync(package_root);
|
|
4856
5040
|
} catch {
|
|
4857
5041
|
return false;
|
|
4858
5042
|
}
|
|
@@ -4867,7 +5051,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4867
5051
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
4868
5052
|
let resolved_src = src;
|
|
4869
5053
|
try {
|
|
4870
|
-
resolved_src =
|
|
5054
|
+
resolved_src = fs11.realpathSync(src);
|
|
4871
5055
|
} catch {
|
|
4872
5056
|
resolved_src = src;
|
|
4873
5057
|
}
|
|
@@ -4875,10 +5059,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4875
5059
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
4876
5060
|
return [0, 0, written_paths];
|
|
4877
5061
|
}
|
|
4878
|
-
mkdirp(
|
|
5062
|
+
mkdirp(path9.dirname(dest));
|
|
4879
5063
|
const decision = _resolve_file_conflict(dest, force);
|
|
4880
5064
|
if (decision === "skip") return [0, 1, written_paths];
|
|
4881
|
-
|
|
5065
|
+
fs11.copyFileSync(src, dest);
|
|
4882
5066
|
_inject_package_tag(dest, src, package_root);
|
|
4883
5067
|
written_paths.push(dest);
|
|
4884
5068
|
return [1, 0, written_paths];
|
|
@@ -4886,11 +5070,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4886
5070
|
mkdirp(dest);
|
|
4887
5071
|
const walk = (node) => {
|
|
4888
5072
|
const acc = [];
|
|
4889
|
-
const names =
|
|
5073
|
+
const names = fs11.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
4890
5074
|
for (const name of names) {
|
|
4891
|
-
const entry =
|
|
5075
|
+
const entry = path9.join(node, name);
|
|
4892
5076
|
acc.push(entry);
|
|
4893
|
-
const lst =
|
|
5077
|
+
const lst = fs11.lstatSync(entry);
|
|
4894
5078
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
4895
5079
|
acc.push(...walk(entry));
|
|
4896
5080
|
}
|
|
@@ -4898,9 +5082,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4898
5082
|
return acc;
|
|
4899
5083
|
};
|
|
4900
5084
|
for (const entry of walk(src)) {
|
|
4901
|
-
const rel =
|
|
4902
|
-
const target =
|
|
4903
|
-
const lst =
|
|
5085
|
+
const rel = path9.relative(src, entry);
|
|
5086
|
+
const target = path9.join(dest, rel);
|
|
5087
|
+
const lst = fs11.lstatSync(entry);
|
|
4904
5088
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
4905
5089
|
mkdirp(target);
|
|
4906
5090
|
continue;
|
|
@@ -4908,8 +5092,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4908
5092
|
let resolvedIsDir = false;
|
|
4909
5093
|
let resolved = entry;
|
|
4910
5094
|
try {
|
|
4911
|
-
resolved =
|
|
4912
|
-
resolvedIsDir =
|
|
5095
|
+
resolved = fs11.realpathSync(entry);
|
|
5096
|
+
resolvedIsDir = fs11.statSync(entry).isDirectory();
|
|
4913
5097
|
} catch {
|
|
4914
5098
|
resolvedIsDir = false;
|
|
4915
5099
|
}
|
|
@@ -4939,8 +5123,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
4939
5123
|
skipped += 1;
|
|
4940
5124
|
continue;
|
|
4941
5125
|
}
|
|
4942
|
-
mkdirp(
|
|
4943
|
-
|
|
5126
|
+
mkdirp(path9.dirname(target));
|
|
5127
|
+
fs11.copyFileSync(resolved, target);
|
|
4944
5128
|
_inject_package_tag(target, resolved, package_root);
|
|
4945
5129
|
written += 1;
|
|
4946
5130
|
written_paths.push(target);
|
|
@@ -4952,7 +5136,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
4952
5136
|
}
|
|
4953
5137
|
function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
|
|
4954
5138
|
const anchor = expanduser2(USER_SCOPE_PATHS["claude-desktop"]);
|
|
4955
|
-
const target =
|
|
5139
|
+
const target = path9.join(anchor, "agent-config.md");
|
|
4956
5140
|
mkdirp(anchor);
|
|
4957
5141
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
4958
5142
|
writeText(target, body);
|
|
@@ -4976,23 +5160,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
4976
5160
|
const wrapped = [];
|
|
4977
5161
|
const collisions = [];
|
|
4978
5162
|
const reserved = [];
|
|
4979
|
-
const commands_dir =
|
|
5163
|
+
const commands_dir = path9.join(anchor, "commands");
|
|
4980
5164
|
let flat_entries = [];
|
|
4981
5165
|
try {
|
|
4982
|
-
flat_entries =
|
|
5166
|
+
flat_entries = fs11.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
|
|
4983
5167
|
} catch {
|
|
4984
5168
|
}
|
|
4985
5169
|
for (const fname of flat_entries.sort()) {
|
|
4986
5170
|
const slug = fname.slice(0, -".md".length);
|
|
4987
5171
|
if (!is_claude_builtin_name(slug)) continue;
|
|
4988
|
-
|
|
5172
|
+
fs11.rmSync(path9.join(commands_dir, fname), { force: true });
|
|
4989
5173
|
current_files.delete(`commands/${fname}`);
|
|
4990
5174
|
reserved.push(slug);
|
|
4991
5175
|
}
|
|
4992
5176
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
4993
5177
|
try {
|
|
4994
5178
|
const manifest = JSON.parse(
|
|
4995
|
-
|
|
5179
|
+
fs11.readFileSync(path9.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
4996
5180
|
);
|
|
4997
5181
|
for (const a of manifest.artefacts ?? []) {
|
|
4998
5182
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -5003,22 +5187,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
5003
5187
|
}
|
|
5004
5188
|
for (const slug of [...eligible].sort()) {
|
|
5005
5189
|
const flat_rel = `commands/${slug}.md`;
|
|
5006
|
-
const flat_abs =
|
|
5007
|
-
if (!
|
|
5008
|
-
const skill_dir =
|
|
5009
|
-
if (
|
|
5190
|
+
const flat_abs = path9.join(anchor, "commands", `${slug}.md`);
|
|
5191
|
+
if (!fs11.existsSync(flat_abs)) continue;
|
|
5192
|
+
const skill_dir = path9.join(anchor, "skills", slug);
|
|
5193
|
+
if (fs11.existsSync(skill_dir)) {
|
|
5010
5194
|
collisions.push(slug);
|
|
5011
5195
|
continue;
|
|
5012
5196
|
}
|
|
5013
|
-
let body =
|
|
5197
|
+
let body = fs11.readFileSync(flat_abs, "utf8");
|
|
5014
5198
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
5015
5199
|
body = body.replace("---\n", `---
|
|
5016
5200
|
name: ${slug}
|
|
5017
5201
|
`);
|
|
5018
5202
|
}
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5203
|
+
fs11.mkdirSync(skill_dir, { recursive: true });
|
|
5204
|
+
fs11.writeFileSync(path9.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
5205
|
+
fs11.rmSync(flat_abs, { force: true });
|
|
5022
5206
|
current_files.delete(flat_rel);
|
|
5023
5207
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
5024
5208
|
wrapped.push(slug);
|
|
@@ -5050,8 +5234,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
5050
5234
|
const written_paths = [];
|
|
5051
5235
|
let current_files = /* @__PURE__ */ new Set();
|
|
5052
5236
|
for (const [src_rel, dest_sub] of plan) {
|
|
5053
|
-
const src =
|
|
5054
|
-
const dest = dest_sub ?
|
|
5237
|
+
const src = path9.join(package_root, src_rel);
|
|
5238
|
+
const dest = dest_sub ? path9.join(anchor, dest_sub) : anchor;
|
|
5055
5239
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
5056
5240
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
5057
5241
|
src,
|
|
@@ -5074,16 +5258,13 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
5074
5258
|
}
|
|
5075
5259
|
if (tool_id === "claude-code") {
|
|
5076
5260
|
const res = _apply_claude_flat_command_wrappers(anchor, package_root, current_files);
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
` claude-code: ${res.reserved.length} flat command(s) withheld \u2014 name is a Claude Code built-in (${res.reserved.join(", ")}); nested /cluster:sub commands remain available`
|
|
5085
|
-
);
|
|
5086
|
-
}
|
|
5261
|
+
rewriteAndReport(
|
|
5262
|
+
path9.join(anchor, "rules"),
|
|
5263
|
+
state.QUIET,
|
|
5264
|
+
info,
|
|
5265
|
+
warn,
|
|
5266
|
+
res
|
|
5267
|
+
);
|
|
5087
5268
|
}
|
|
5088
5269
|
const missing_targets = _verify_deploy_targets(anchor, plan);
|
|
5089
5270
|
if (missing_targets.length > 0) {
|
|
@@ -5125,10 +5306,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
5125
5306
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
5126
5307
|
if (tool_id === "claude-code") {
|
|
5127
5308
|
try {
|
|
5128
|
-
const manifest =
|
|
5309
|
+
const manifest = path9.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
5129
5310
|
const matrix = build_claude_hook_matrix(manifest);
|
|
5130
5311
|
const res = ensure_managed_hooks(
|
|
5131
|
-
|
|
5312
|
+
path9.join(anchor, "settings.json"),
|
|
5132
5313
|
matrix
|
|
5133
5314
|
);
|
|
5134
5315
|
if (!state.QUIET) {
|
|
@@ -5165,7 +5346,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
5165
5346
|
const anchor = expanduser2(anchor_raw);
|
|
5166
5347
|
let current_files = /* @__PURE__ */ new Set();
|
|
5167
5348
|
for (const [src_rel, dest_sub] of plan) {
|
|
5168
|
-
const src =
|
|
5349
|
+
const src = path9.join(package_root, src_rel);
|
|
5169
5350
|
current_files = setUnion(
|
|
5170
5351
|
current_files,
|
|
5171
5352
|
expected_deploy_files(
|
|
@@ -5199,14 +5380,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
5199
5380
|
function _verify_deploy_targets(anchor, plan) {
|
|
5200
5381
|
const missing = [];
|
|
5201
5382
|
for (const [, dest_sub] of plan) {
|
|
5202
|
-
const target = dest_sub ?
|
|
5383
|
+
const target = dest_sub ? path9.join(anchor, dest_sub) : anchor;
|
|
5203
5384
|
const label = dest_sub || ".";
|
|
5204
5385
|
if (!isDir(target)) {
|
|
5205
5386
|
missing.push(label);
|
|
5206
5387
|
continue;
|
|
5207
5388
|
}
|
|
5208
5389
|
try {
|
|
5209
|
-
const entries =
|
|
5390
|
+
const entries = fs11.readdirSync(target);
|
|
5210
5391
|
if (entries.length === 0) missing.push(label);
|
|
5211
5392
|
} catch {
|
|
5212
5393
|
missing.push(label);
|
|
@@ -5224,9 +5405,9 @@ function _resolve_global_settings_doc() {
|
|
|
5224
5405
|
}
|
|
5225
5406
|
function _resolve_global_settings_path() {
|
|
5226
5407
|
const root = event4u_root();
|
|
5227
|
-
const canonical =
|
|
5408
|
+
const canonical = path9.join(root, "settings", SETTINGS_FILE);
|
|
5228
5409
|
if (pathExists(canonical)) return canonical;
|
|
5229
|
-
const legacy =
|
|
5410
|
+
const legacy = path9.join(root, SETTINGS_FILE);
|
|
5230
5411
|
if (pathExists(legacy)) return legacy;
|
|
5231
5412
|
return null;
|
|
5232
5413
|
}
|
|
@@ -5337,7 +5518,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5337
5518
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
5338
5519
|
info(` tools=${merged_tools.join(",")}`);
|
|
5339
5520
|
}
|
|
5340
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5521
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path9.join(project_root, ".agent-src.uncondensed"))) {
|
|
5341
5522
|
const drift = collect_drift(project_root);
|
|
5342
5523
|
if (!state.QUIET) {
|
|
5343
5524
|
process2.stdout.write("\n");
|
|
@@ -5451,19 +5632,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5451
5632
|
}
|
|
5452
5633
|
}
|
|
5453
5634
|
}
|
|
5454
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
5635
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path9.join(project_root, ".agent-src.uncondensed"))) {
|
|
5455
5636
|
const files_by_tool = _files_by_tool_from_deploy(deploy_results);
|
|
5456
5637
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
5457
5638
|
if (rc !== 0) return rc;
|
|
5458
5639
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
5459
5640
|
if (removed_marker !== null && !state.QUIET) {
|
|
5460
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
5641
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path9.relative(project_root, removed_marker) : removed_marker;
|
|
5461
5642
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
5462
5643
|
}
|
|
5463
5644
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
5464
5645
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
5465
5646
|
for (const p of anchor_paths) {
|
|
5466
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
5647
|
+
const rel = isRelativeTo(p, project_root) ? path9.relative(project_root, p) : p;
|
|
5467
5648
|
info(`Project anchor written: ${rel}`);
|
|
5468
5649
|
}
|
|
5469
5650
|
}
|
|
@@ -5499,8 +5680,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
5499
5680
|
}
|
|
5500
5681
|
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
5501
5682
|
const log_candidates = [
|
|
5502
|
-
|
|
5503
|
-
...project_root ? [
|
|
5683
|
+
path9.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5684
|
+
...project_root ? [path9.join(project_root, OBSERVATION_LOG)] : []
|
|
5504
5685
|
];
|
|
5505
5686
|
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
5506
5687
|
if (records.length === 0) return [];
|
|
@@ -5523,13 +5704,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
|
5523
5704
|
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
5524
5705
|
if (!isInteractiveSession(probe)) return [];
|
|
5525
5706
|
const log_candidates = [
|
|
5526
|
-
|
|
5527
|
-
...project_root ? [
|
|
5707
|
+
path9.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
5708
|
+
...project_root ? [path9.join(project_root, OBSERVATION_LOG)] : []
|
|
5528
5709
|
];
|
|
5529
5710
|
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
5530
5711
|
if (limits.size === 0) return [];
|
|
5531
5712
|
const resolved = _resolve_scoped_projection(package_root);
|
|
5532
|
-
const settings_path = _resolve_global_settings_path() ??
|
|
5713
|
+
const settings_path = _resolve_global_settings_path() ?? path9.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
5533
5714
|
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
5534
5715
|
const [, , status] = deploy_results[tool_id];
|
|
5535
5716
|
if (status !== "deployed") continue;
|
|
@@ -5548,8 +5729,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
|
|
|
5548
5729
|
}
|
|
5549
5730
|
return [];
|
|
5550
5731
|
}
|
|
5551
|
-
var SETTINGS_SURFACE_REL =
|
|
5552
|
-
var SETTINGS_DELTA_REL =
|
|
5732
|
+
var SETTINGS_SURFACE_REL = path9.join("state", "settings-surface.json");
|
|
5733
|
+
var SETTINGS_DELTA_REL = path9.join("state", "settings-delta.json");
|
|
5553
5734
|
function _current_settings_surface(version) {
|
|
5554
5735
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
5555
5736
|
name: "AgentSettings",
|
|
@@ -5560,20 +5741,20 @@ function _current_settings_surface(version) {
|
|
|
5560
5741
|
}
|
|
5561
5742
|
function _write_settings_surface_snapshot(installed_version) {
|
|
5562
5743
|
const root = event4u_root();
|
|
5563
|
-
const surface_path =
|
|
5564
|
-
const delta_path =
|
|
5744
|
+
const surface_path = path9.join(root, SETTINGS_SURFACE_REL);
|
|
5745
|
+
const delta_path = path9.join(root, SETTINGS_DELTA_REL);
|
|
5565
5746
|
const next = _current_settings_surface(installed_version);
|
|
5566
5747
|
let previous = null;
|
|
5567
5748
|
try {
|
|
5568
|
-
const parsed = JSON.parse(
|
|
5749
|
+
const parsed = JSON.parse(fs11.readFileSync(surface_path, "utf8"));
|
|
5569
5750
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
5570
5751
|
} catch {
|
|
5571
5752
|
}
|
|
5572
5753
|
if (previous !== null && previous.version !== next.version) {
|
|
5573
5754
|
const delta = computeSurfaceDelta(previous, next);
|
|
5574
5755
|
if (delta.changes.length > 0) {
|
|
5575
|
-
|
|
5576
|
-
|
|
5756
|
+
fs11.mkdirSync(path9.dirname(delta_path), { recursive: true, mode: 448 });
|
|
5757
|
+
fs11.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
5577
5758
|
`, { mode: 384 });
|
|
5578
5759
|
if (!state.QUIET) {
|
|
5579
5760
|
const counts = {};
|
|
@@ -5585,8 +5766,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
5585
5766
|
}
|
|
5586
5767
|
}
|
|
5587
5768
|
}
|
|
5588
|
-
|
|
5589
|
-
|
|
5769
|
+
fs11.mkdirSync(path9.dirname(surface_path), { recursive: true, mode: 448 });
|
|
5770
|
+
fs11.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
5590
5771
|
`, { mode: 384 });
|
|
5591
5772
|
}
|
|
5592
5773
|
function arrayStrEqual(a, b) {
|
|
@@ -5806,13 +5987,13 @@ function _minimal_templates_root() {
|
|
|
5806
5987
|
const chain = [start];
|
|
5807
5988
|
let cur = start;
|
|
5808
5989
|
for (; ; ) {
|
|
5809
|
-
const parent =
|
|
5990
|
+
const parent = path9.dirname(cur);
|
|
5810
5991
|
if (parent === cur) break;
|
|
5811
5992
|
chain.push(parent);
|
|
5812
5993
|
cur = parent;
|
|
5813
5994
|
}
|
|
5814
5995
|
for (const ancestor of chain) {
|
|
5815
|
-
const candidate =
|
|
5996
|
+
const candidate = path9.join(ancestor, "src", "templates", "minimal");
|
|
5816
5997
|
if (isDir(candidate)) return candidate;
|
|
5817
5998
|
}
|
|
5818
5999
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -5820,9 +6001,9 @@ function _minimal_templates_root() {
|
|
|
5820
6001
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
5821
6002
|
function _write_install_mode_marker(project_root, mode) {
|
|
5822
6003
|
if (mode !== "minimal" && mode !== "full") return;
|
|
5823
|
-
const marker =
|
|
6004
|
+
const marker = path9.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
5824
6005
|
try {
|
|
5825
|
-
mkdirp(
|
|
6006
|
+
mkdirp(path9.dirname(marker));
|
|
5826
6007
|
writeText(marker, `${mode}
|
|
5827
6008
|
`);
|
|
5828
6009
|
} catch {
|
|
@@ -5831,7 +6012,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
5831
6012
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
5832
6013
|
let target_root = resolvePath(target_root_in);
|
|
5833
6014
|
mkdirp(target_root);
|
|
5834
|
-
const parent =
|
|
6015
|
+
const parent = path9.dirname(target_root);
|
|
5835
6016
|
if (parent !== target_root) {
|
|
5836
6017
|
const existing = find_project_root_with_anchor(parent);
|
|
5837
6018
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -5842,21 +6023,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
5842
6023
|
}
|
|
5843
6024
|
}
|
|
5844
6025
|
const templates = _minimal_templates_root();
|
|
5845
|
-
const settings_src =
|
|
5846
|
-
const overrides_gitkeep_src =
|
|
5847
|
-
const overrides_readme_src =
|
|
6026
|
+
const settings_src = path9.join(templates, SETTINGS_FILE);
|
|
6027
|
+
const overrides_gitkeep_src = path9.join(templates, "overrides-gitkeep");
|
|
6028
|
+
const overrides_readme_src = path9.join(templates, "agents-overrides-readme.md");
|
|
5848
6029
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
5849
6030
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
5850
6031
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
5851
6032
|
}
|
|
5852
6033
|
info(`Minimal init \u2192 ${target_root}`);
|
|
5853
|
-
const overrides_root =
|
|
6034
|
+
const overrides_root = path9.join(target_root, "agents", "overrides");
|
|
5854
6035
|
mkdirp(overrides_root);
|
|
5855
6036
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
5856
6037
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
5857
|
-
const sub_dir =
|
|
6038
|
+
const sub_dir = path9.join(overrides_root, sub);
|
|
5858
6039
|
mkdirp(sub_dir);
|
|
5859
|
-
const gitkeep_dst =
|
|
6040
|
+
const gitkeep_dst = path9.join(sub_dir, ".gitkeep");
|
|
5860
6041
|
if (pathExists(gitkeep_dst) && !force) {
|
|
5861
6042
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
5862
6043
|
} else {
|
|
@@ -5864,7 +6045,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
5864
6045
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
5865
6046
|
}
|
|
5866
6047
|
}
|
|
5867
|
-
const readme_dst =
|
|
6048
|
+
const readme_dst = path9.join(overrides_root, "README.md");
|
|
5868
6049
|
if (pathExists(readme_dst) && !force) {
|
|
5869
6050
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
5870
6051
|
} else {
|
|
@@ -5882,14 +6063,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
5882
6063
|
personal:
|
|
5883
6064
|
user_type: ${user_type}
|
|
5884
6065
|
`;
|
|
5885
|
-
mkdirp(
|
|
6066
|
+
mkdirp(path9.dirname(settings_dst));
|
|
5886
6067
|
writeText(settings_dst, body);
|
|
5887
6068
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
5888
6069
|
}
|
|
5889
6070
|
}
|
|
5890
6071
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
5891
6072
|
if (removed_marker !== null) {
|
|
5892
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
6073
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path9.relative(target_root, removed_marker) : removed_marker;
|
|
5893
6074
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
5894
6075
|
}
|
|
5895
6076
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -5963,7 +6144,7 @@ function run_interactive_init(project_root, force) {
|
|
|
5963
6144
|
);
|
|
5964
6145
|
return 0;
|
|
5965
6146
|
}
|
|
5966
|
-
const target =
|
|
6147
|
+
const target = path9.join(project_root, _LOCAL_CONFIG_FILE);
|
|
5967
6148
|
if (pathExists(target) && !force) {
|
|
5968
6149
|
warn(
|
|
5969
6150
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -5990,7 +6171,7 @@ function run_interactive_init(project_root, force) {
|
|
|
5990
6171
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
5991
6172
|
return 1;
|
|
5992
6173
|
}
|
|
5993
|
-
success(`Wrote ${
|
|
6174
|
+
success(`Wrote ${path9.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
5994
6175
|
return 0;
|
|
5995
6176
|
}
|
|
5996
6177
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -6008,12 +6189,12 @@ function _wizard_should_launch(opts) {
|
|
|
6008
6189
|
return [true, ""];
|
|
6009
6190
|
}
|
|
6010
6191
|
function _wizard_cli_dist(_project_root) {
|
|
6011
|
-
const package_root =
|
|
6012
|
-
const cli =
|
|
6192
|
+
const package_root = path9.dirname(path9.dirname(path9.dirname(resolvePath(_HERE))));
|
|
6193
|
+
const cli = path9.join(package_root, "dist", "cli", "agent-config.js");
|
|
6013
6194
|
return pathExists(cli) ? cli : null;
|
|
6014
6195
|
}
|
|
6015
6196
|
function _server_info_path() {
|
|
6016
|
-
return
|
|
6197
|
+
return path9.join(os3.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
6017
6198
|
}
|
|
6018
6199
|
function _pid_is_agent_config(pid) {
|
|
6019
6200
|
let res;
|
|
@@ -6030,7 +6211,7 @@ function _pid_is_agent_config(pid) {
|
|
|
6030
6211
|
}
|
|
6031
6212
|
function unlinkMissingOk(p) {
|
|
6032
6213
|
try {
|
|
6033
|
-
|
|
6214
|
+
fs11.unlinkSync(p);
|
|
6034
6215
|
} catch {
|
|
6035
6216
|
}
|
|
6036
6217
|
}
|
|
@@ -6108,14 +6289,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
6108
6289
|
}
|
|
6109
6290
|
function _wizard_run_sync(cmd, env, cli) {
|
|
6110
6291
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
6111
|
-
const log_path =
|
|
6292
|
+
const log_path = path9.join(
|
|
6112
6293
|
os3.tmpdir(),
|
|
6113
6294
|
`agent-config-wizard-${process2.pid}-${Date.now()}.log`
|
|
6114
6295
|
);
|
|
6115
6296
|
let child;
|
|
6116
6297
|
let log_fd = null;
|
|
6117
6298
|
try {
|
|
6118
|
-
log_fd =
|
|
6299
|
+
log_fd = fs11.openSync(log_path, "w");
|
|
6119
6300
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
6120
6301
|
env,
|
|
6121
6302
|
detached: true,
|
|
@@ -6133,7 +6314,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
6133
6314
|
} finally {
|
|
6134
6315
|
if (log_fd !== null) {
|
|
6135
6316
|
try {
|
|
6136
|
-
|
|
6317
|
+
fs11.closeSync(log_fd);
|
|
6137
6318
|
} catch {
|
|
6138
6319
|
}
|
|
6139
6320
|
}
|
|
@@ -6383,8 +6564,8 @@ function main2(argv) {
|
|
|
6383
6564
|
const target_root = resolvePath(
|
|
6384
6565
|
opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
|
|
6385
6566
|
);
|
|
6386
|
-
const minimal_package_root =
|
|
6387
|
-
|
|
6567
|
+
const minimal_package_root = path9.dirname(
|
|
6568
|
+
path9.dirname(path9.dirname(_minimal_templates_root()))
|
|
6388
6569
|
);
|
|
6389
6570
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
6390
6571
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -6416,7 +6597,7 @@ function main2(argv) {
|
|
|
6416
6597
|
return rc2;
|
|
6417
6598
|
}
|
|
6418
6599
|
const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
|
|
6419
|
-
const is_first_run = !pathExists(
|
|
6600
|
+
const is_first_run = !pathExists(path9.join(project_root, SETTINGS_FILE));
|
|
6420
6601
|
const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
6421
6602
|
if (rc === 0 && opts.interactive) {
|
|
6422
6603
|
run_interactive_init(project_root, opts.force);
|
|
@@ -6480,16 +6661,16 @@ function _team_setup_hint_line(project_root) {
|
|
|
6480
6661
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
6481
6662
|
}
|
|
6482
6663
|
function finalize_claude_model_tiers(project_root) {
|
|
6483
|
-
const claude_skills =
|
|
6484
|
-
const augment_skills =
|
|
6664
|
+
const claude_skills = path9.join(project_root, ".claude", "skills");
|
|
6665
|
+
const augment_skills = path9.join(project_root, ".augment", "skills");
|
|
6485
6666
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
6486
6667
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
6487
6668
|
let rendered = 0;
|
|
6488
|
-
const entries =
|
|
6669
|
+
const entries = fs11.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6489
6670
|
for (const name of entries) {
|
|
6490
|
-
const entry =
|
|
6491
|
-
const src_dir =
|
|
6492
|
-
const src_md =
|
|
6671
|
+
const entry = path9.join(claude_skills, name);
|
|
6672
|
+
const src_dir = path9.join(augment_skills, name);
|
|
6673
|
+
const src_md = path9.join(src_dir, "SKILL.md");
|
|
6493
6674
|
let tier;
|
|
6494
6675
|
try {
|
|
6495
6676
|
tier = read_model_tier(src_md);
|
|
@@ -6498,22 +6679,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
6498
6679
|
}
|
|
6499
6680
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
6500
6681
|
if (isSymlink(entry) || isFile(entry)) {
|
|
6501
|
-
|
|
6682
|
+
fs11.unlinkSync(entry);
|
|
6502
6683
|
} else if (isDir(entry)) {
|
|
6503
|
-
|
|
6684
|
+
fs11.rmSync(entry, { recursive: true, force: true });
|
|
6504
6685
|
}
|
|
6505
6686
|
mkdirp(entry);
|
|
6506
|
-
const srcFiles =
|
|
6687
|
+
const srcFiles = fs11.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6507
6688
|
for (const fname of srcFiles) {
|
|
6508
6689
|
if (fname === "SKILL.md") {
|
|
6509
6690
|
writeText(
|
|
6510
|
-
|
|
6691
|
+
path9.join(entry, "SKILL.md"),
|
|
6511
6692
|
render_native_model_md(readText(src_md), tier)
|
|
6512
6693
|
);
|
|
6513
6694
|
} else {
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6695
|
+
fs11.symlinkSync(
|
|
6696
|
+
path9.join("../../../.augment/skills", name, fname),
|
|
6697
|
+
path9.join(entry, fname)
|
|
6517
6698
|
);
|
|
6518
6699
|
}
|
|
6519
6700
|
}
|
|
@@ -6531,7 +6712,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6531
6712
|
let package_type;
|
|
6532
6713
|
if (opts.package) {
|
|
6533
6714
|
package_root = resolvePath(opts.package);
|
|
6534
|
-
if (!pathExists(
|
|
6715
|
+
if (!pathExists(path9.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
6535
6716
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
6536
6717
|
}
|
|
6537
6718
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -6675,9 +6856,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
6675
6856
|
function _resolvedArgv1() {
|
|
6676
6857
|
if (process2.argv[1] === void 0) return void 0;
|
|
6677
6858
|
try {
|
|
6678
|
-
return
|
|
6859
|
+
return fs11.realpathSync(path9.resolve(process2.argv[1]));
|
|
6679
6860
|
} catch {
|
|
6680
|
-
return
|
|
6861
|
+
return path9.resolve(process2.argv[1]);
|
|
6681
6862
|
}
|
|
6682
6863
|
}
|
|
6683
6864
|
var _argv1 = _resolvedArgv1();
|