@event4u/agent-config 16.3.0 → 16.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +178 -78
- package/README.md +2 -2
- package/agents/templates/.ai-council.yml.example +26 -8
- package/dist/agent-src/commands/analyze/inbox.md +10 -7
- package/dist/agent-src/commands/bug/investigate.md +1 -1
- package/dist/agent-src/commands/commit/in-chunks.md +40 -31
- package/dist/agent-src/commands/commit.md +72 -33
- package/dist/agent-src/commands/condense.md +2 -8
- package/dist/agent-src/commands/council/debate.md +11 -7
- package/dist/agent-src/commands/council/default.md +10 -9
- package/dist/agent-src/commands/council.md +1 -1
- package/dist/agent-src/commands/design.md +1 -1
- package/dist/agent-src/commands/estimate-ticket.md +1 -1
- package/dist/agent-src/commands/feature/explore.md +3 -3
- package/dist/agent-src/commands/feature/plan.md +1 -1
- package/dist/agent-src/commands/fix/ci.md +17 -3
- package/dist/agent-src/commands/fix/commit-messages.md +48 -23
- package/dist/agent-src/commands/fix/pr-comments.md +3 -6
- package/dist/agent-src/commands/implement-ticket.md +3 -3
- package/dist/agent-src/commands/memory/add.md +4 -16
- package/dist/agent-src/commands/memory/load.md +5 -6
- package/dist/agent-src/commands/memory/promote.md +3 -16
- package/dist/agent-src/commands/mission/upgrade.md +3 -2
- package/dist/agent-src/commands/optimize/agents-dir.md +2 -2
- package/dist/agent-src/commands/optimize/deep.md +4 -2
- package/dist/agent-src/commands/optimize/rtk.md +4 -26
- package/dist/agent-src/commands/pr/create/description-only.md +18 -15
- package/dist/agent-src/commands/pr/create.md +42 -34
- package/dist/agent-src/commands/pr/merge.md +136 -9
- package/dist/agent-src/commands/prepare-for-review.md +13 -11
- package/dist/agent-src/commands/project/analyze.md +7 -35
- package/dist/agent-src/commands/refine-ticket.md +1 -1
- package/dist/agent-src/commands/review/changes.md +14 -19
- package/dist/agent-src/commands/roadmap/next.md +10 -1
- package/dist/agent-src/commands/roadmap/process-full.md +52 -38
- package/dist/agent-src/commands/roadmap/resolve-blockers.md +64 -14
- package/dist/agent-src/commands/worktree/create.md +7 -3
- package/dist/agent-src/commands/worktree/verify.md +2 -1
- package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +5 -3
- package/dist/agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +7 -9
- package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +8 -6
- package/dist/agent-src/contexts/contracts/frugality-charter.md +8 -5
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +1 -1
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +0 -1
- package/dist/agent-src/contexts/execution/evidence-discipline.md +2 -2
- package/dist/agent-src/contexts/execution/non-interactive-contract.md +5 -8
- package/dist/agent-src/contexts/execution/rdp-gate.md +4 -4
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +9 -8
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +67 -52
- package/dist/agent-src/contexts/execution/subagent-routing.md +8 -8
- package/dist/agent-src/contexts/execution/subagent-steering.md +6 -4
- package/dist/agent-src/contexts/execution/terminal-states.md +2 -2
- package/dist/agent-src/contexts/execution/toolchain-resolver.md +4 -10
- package/dist/agent-src/contexts/subagent-configuration.md +1 -1
- package/dist/agent-src/guidelines/agent-infra/active-remediation-mechanics.md +39 -0
- package/dist/agent-src/guidelines/agent-infra/context-hygiene-mechanics.md +1 -1
- package/dist/agent-src/guidelines/agent-infra/cross-source-consistency-mechanics.md +8 -10
- package/dist/agent-src/guidelines/agent-infra/frontier-reasoning-operating-profile.md +3 -2
- package/dist/agent-src/guidelines/agent-infra/layered-settings.md +13 -1
- package/dist/agent-src/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/dist/agent-src/guidelines/agent-infra/self-improvement-pipeline.md +10 -3
- package/dist/agent-src/guidelines/agent-infra/size-and-scope.md +36 -0
- package/dist/agent-src/guidelines/design-antipatterns.md +1 -1
- package/dist/agent-src/guidelines/php/git.md +15 -2
- package/dist/agent-src/rules/active-remediation.md +0 -1
- package/dist/agent-src/rules/analysis-skill-routing.md +0 -1
- package/dist/agent-src/rules/architecture.md +0 -1
- package/dist/agent-src/rules/artifact-drafting-protocol.md +0 -1
- package/dist/agent-src/rules/artifact-engagement-recording.md +0 -1
- package/dist/agent-src/rules/augment-edit-discipline.md +0 -1
- package/dist/agent-src/rules/autonomous-execution.md +0 -1
- package/dist/agent-src/rules/brand-consistency.md +0 -1
- package/dist/agent-src/rules/brand-source-of-truth.md +0 -1
- package/dist/agent-src/rules/broken-access-control.md +0 -1
- package/dist/agent-src/rules/cli-output-handling.md +0 -1
- package/dist/agent-src/rules/code-comment-discipline.md +0 -1
- package/dist/agent-src/rules/code-provenance.md +0 -1
- package/dist/agent-src/rules/command-suggestion-policy.md +0 -1
- package/dist/agent-src/rules/commit-conventions.md +1 -2
- package/dist/agent-src/rules/communication-through-line.md +1 -2
- package/dist/agent-src/rules/content-quoting-floor.md +1 -2
- package/dist/agent-src/rules/context-hygiene.md +5 -5
- package/dist/agent-src/rules/copilot-routing.md +1 -2
- package/dist/agent-src/rules/council-availability.md +4 -4
- package/dist/agent-src/rules/cross-source-consistency.md +4 -6
- package/dist/agent-src/rules/decision-revisit-gate.md +2 -3
- package/dist/agent-src/rules/delegation-policy.md +2 -3
- package/dist/agent-src/rules/design-fidelity.md +0 -1
- package/dist/agent-src/rules/design-review-after-ui-write.md +3 -3
- package/dist/agent-src/rules/devcontainer-routing.md +1 -2
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +0 -1
- package/dist/agent-src/rules/docker-commands.md +0 -1
- package/dist/agent-src/rules/domain-adoption-policy.md +0 -1
- package/dist/agent-src/rules/domain-safety-disclaimer.md +0 -1
- package/dist/agent-src/rules/domain-safety-pii.md +0 -1
- package/dist/agent-src/rules/domain-safety-retention.md +0 -1
- package/dist/agent-src/rules/downstream-changes.md +0 -1
- package/dist/agent-src/rules/engineering-safety-floor.md +0 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +0 -1
- package/dist/agent-src/rules/external-reference-deep-dive.md +0 -1
- package/dist/agent-src/rules/fast-path-marker-visibility.md +1 -2
- package/dist/agent-src/rules/finance-safety-floor.md +0 -1
- package/dist/agent-src/rules/fix-what-you-see.md +6 -32
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +0 -1
- package/dist/agent-src/rules/git-history-discipline.md +1 -2
- package/dist/agent-src/rules/guidelines.md +0 -1
- package/dist/agent-src/rules/history-discipline.md +0 -1
- package/dist/agent-src/rules/icon-consistency.md +0 -1
- package/dist/agent-src/rules/image-likeness-and-rights.md +0 -1
- package/dist/agent-src/rules/improve-before-implement.md +0 -1
- package/dist/agent-src/rules/invite-challenge.md +0 -1
- package/dist/agent-src/rules/laravel-routing.md +1 -2
- package/dist/agent-src/rules/laravel-translations.md +0 -1
- package/dist/agent-src/rules/legal-safety-floor.md +0 -1
- package/dist/agent-src/rules/lethal-trifecta-guard.md +0 -1
- package/dist/agent-src/rules/linked-projects-onboarding-gate.md +0 -1
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +0 -1
- package/dist/agent-src/rules/markdown-safe-codeblocks.md +0 -1
- package/dist/agent-src/rules/media-governance-routing.md +1 -2
- package/dist/agent-src/rules/media-sync-ground-truth.md +0 -1
- package/dist/agent-src/rules/minimal-safe-diff.md +0 -1
- package/dist/agent-src/rules/missing-skill-recovery.md +0 -1
- package/dist/agent-src/rules/missing-tool-handling.md +0 -1
- package/dist/agent-src/rules/model-recommendation.md +0 -1
- package/dist/agent-src/rules/neighbour-precedence.md +64 -0
- package/dist/agent-src/rules/no-attribution-footers.md +0 -1
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +0 -1
- package/dist/agent-src/rules/no-pr-progress-comments.md +0 -1
- package/dist/agent-src/rules/no-roadmap-references.md +0 -1
- package/dist/agent-src/rules/notes-first-reasoning.md +0 -1
- package/dist/agent-src/rules/onboarding-gate.md +0 -1
- package/dist/agent-src/rules/output-discipline.md +0 -1
- package/dist/agent-src/rules/package-ci-checks.md +0 -1
- package/dist/agent-src/rules/persona-governance.md +2 -3
- package/dist/agent-src/rules/php-coding.md +0 -1
- package/dist/agent-src/rules/prefer-enums-over-literals.md +0 -1
- package/dist/agent-src/rules/preservation-guard.md +0 -1
- package/dist/agent-src/rules/provider-lifecycle-discipline.md +2 -3
- package/dist/agent-src/rules/question-not-instruction.md +0 -1
- package/dist/agent-src/rules/reviewer-awareness.md +0 -1
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +0 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +3 -6
- package/dist/agent-src/rules/role-mode-adherence.md +0 -1
- package/dist/agent-src/rules/rule-type-governance.md +0 -1
- package/dist/agent-src/rules/runtime-safety.md +0 -1
- package/dist/agent-src/rules/scale-discipline.md +0 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +0 -1
- package/dist/agent-src/rules/security-sensitive-stop.md +0 -1
- package/dist/agent-src/rules/self-repair-loop.md +0 -1
- package/dist/agent-src/rules/senior-engineering-discipline.md +0 -1
- package/dist/agent-src/rules/session-canary.md +0 -1
- package/dist/agent-src/rules/settings-ask-protocol.md +5 -6
- package/dist/agent-src/rules/size-enforcement.md +0 -1
- package/dist/agent-src/rules/skill-improvement-trigger.md +2 -3
- package/dist/agent-src/rules/skill-quality.md +0 -1
- package/dist/agent-src/rules/slash-command-routing-policy.md +0 -1
- package/dist/agent-src/rules/source-confidentiality.md +0 -1
- package/dist/agent-src/rules/source-discovery-gate.md +0 -1
- package/dist/agent-src/rules/source-of-truth.md +0 -1
- package/dist/agent-src/rules/spreadsheet-source-quality.md +1 -2
- package/dist/agent-src/rules/strategy-safety-floor.md +0 -1
- package/dist/agent-src/rules/symfony-routing.md +1 -2
- package/dist/agent-src/rules/think-before-action.md +0 -1
- package/dist/agent-src/rules/token-budget-discipline.md +14 -48
- package/dist/agent-src/rules/token-efficiency.md +0 -1
- package/dist/agent-src/rules/token-optimizer-maintenance.md +0 -1
- package/dist/agent-src/rules/tool-safety.md +0 -1
- package/dist/agent-src/rules/ui-audit-gate.md +1 -2
- package/dist/agent-src/rules/untrusted-input-defense.md +0 -1
- package/dist/agent-src/rules/upstream-proposal.md +0 -1
- package/dist/agent-src/rules/user-interaction.md +0 -1
- package/dist/agent-src/rules/user-interrupt-priority.md +0 -1
- package/dist/agent-src/scripts/gate_budget.ts +47 -23
- package/dist/agent-src/scripts/gate_execute.ts +12 -4
- package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +2 -0
- package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
- package/dist/agent-src/skills/ai-council/SKILL.md +7 -4
- package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +21 -11
- package/dist/agent-src/skills/ai-council/references/procedure.md +12 -6
- package/dist/agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
- package/dist/agent-src/skills/bug-analyzer/SKILL.md +1 -1
- package/dist/agent-src/skills/canvas-design/SKILL.md +4 -2
- package/dist/agent-src/skills/command-routing/SKILL.md +3 -4
- package/dist/agent-src/skills/conventional-commits-writing/SKILL.md +127 -139
- package/dist/agent-src/skills/corpus-grounding/ATTRIBUTION.md +39 -0
- package/dist/agent-src/skills/corpus-grounding/SKILL.md +8 -2
- package/dist/agent-src/skills/database/data/manifest.json +2 -2
- package/dist/agent-src/skills/database/data/query-tuning.csv +13 -13
- package/dist/agent-src/skills/design-intelligence/references/integration-mapping.md +13 -10
- package/dist/agent-src/skills/design-system-capture/SKILL.md +0 -3
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +1 -1
- package/dist/agent-src/skills/fe-design/references/design-patterns.md +49 -2
- package/dist/agent-src/skills/feature-planning/SKILL.md +1 -1
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +9 -0
- package/dist/agent-src/skills/git-workflow/SKILL.md +44 -44
- package/dist/agent-src/skills/git-workflow/references/branch-update.md +312 -0
- package/dist/agent-src/skills/git-workflow/references/commit-subject.md +205 -0
- package/dist/agent-src/skills/iconography/SKILL.md +4 -2
- package/dist/agent-src/skills/image-provider-routing/SKILL.md +16 -5
- package/dist/agent-src/skills/jira-integration/SKILL.md +3 -3
- package/dist/agent-src/skills/logo-generation/SKILL.md +12 -8
- package/dist/agent-src/skills/merge-conflicts/SKILL.md +10 -4
- package/dist/agent-src/skills/po-discovery/SKILL.md +1 -1
- package/dist/agent-src/skills/refine-ticket/SKILL.md +4 -4
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +2 -2
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +4 -2
- package/dist/agent-src/skills/source-discovery/SKILL.md +1 -1
- package/dist/agent-src/skills/svg-authoring/SKILL.md +318 -0
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +3 -1
- package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +1 -1
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +2 -2
- package/dist/agent-src/skills/wireframe/SKILL.md +5 -2
- package/dist/agent-src/templates/AGENTS.md +1 -1
- package/dist/agent-src/templates/agent-settings.md +46 -129
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +3 -3
- package/dist/agent-src/templates/command.md +2 -2
- package/dist/agent-src/templates/roadmaps.md +6 -1
- package/dist/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +0 -6
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +11 -7
- package/dist/agent-src/templates/scripts/work_engine/hooks/builtin/decision_trace.ts +3 -2
- package/dist/agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.ts +2 -1
- package/dist/agent-src/templates/scripts/work_engine/hooks/settings.ts +0 -6
- package/dist/agent-src/templates/scripts/work_engine/scoring/decision_engine.ts +9 -12
- package/dist/agent-src/templates/scripts/work_engine/scoring/memory_visibility.ts +2 -1
- package/dist/agent-src/templates/skill.md +1 -1
- package/dist/cli/commands/uiRender.js +201 -4
- package/dist/cli/commands/uiRenderAsset.js +1308 -0
- package/dist/cli/commands/uiRenderAssetCompare.js +752 -0
- package/dist/cli/commands/uiRenderAssetGrid.js +265 -0
- package/dist/cli/commands/uiRenderAssetGrounds.js +323 -0
- package/dist/cli/commands/uiRenderAssetIsolation.js +85 -0
- package/dist/cli/commands/uiRenderAssetTypes.js +145 -0
- package/dist/cli/main.js +47 -1
- package/dist/cli/registry.js +2 -1
- package/dist/cli-delegate/check_update_banner.js +195 -119
- package/dist/cli-delegate/{chunk-S4UMZNES.js → chunk-4DBG5K7M.js} +5 -5
- package/dist/cli-delegate/{chunk-TRI6DQZ6.js → chunk-5GPULQBE.js} +60 -42
- package/dist/cli-delegate/{chunk-JQVYKIZA.js → chunk-6SRJTYJS.js} +33 -177
- package/dist/cli-delegate/chunk-6V5FMA3P.js +186 -0
- package/dist/cli-delegate/chunk-6YQC2HLF.js +415 -0
- package/dist/cli-delegate/{chunk-E4XIZDIB.js → chunk-7HKRE54K.js} +1 -64
- package/dist/cli-delegate/{chunk-7HQ52DHU.js → chunk-AL3RZ22D.js} +1 -1
- package/dist/cli-delegate/{chunk-DBH4AHDK.js → chunk-ED7KCMLB.js} +9 -11
- package/dist/cli-delegate/{chunk-NXEILF2K.js → chunk-F3QDG2GT.js} +481 -72
- package/dist/cli-delegate/{chunk-CQWX336L.js → chunk-G5VVIZRC.js} +3 -3
- package/dist/cli-delegate/{chunk-JY2I2DXV.js → chunk-H76PHZBI.js} +137 -60
- package/dist/cli-delegate/chunk-IAYTIIQW.js +67 -0
- package/dist/cli-delegate/{chunk-LIYTLH6O.js → chunk-KXXWJTDO.js} +5 -10
- package/dist/cli-delegate/{chunk-T7L2QK3K.js → chunk-LQOCRFWT.js} +1 -1
- package/dist/cli-delegate/{chunk-S4YWNRKO.js → chunk-MDPPKQCQ.js} +34 -1
- package/dist/cli-delegate/chunk-OAFSJBHH.js +272 -0
- package/dist/cli-delegate/{chunk-GKE7ZVFA.js → chunk-PWX7CKMD.js} +1 -1
- package/dist/cli-delegate/{chunk-NDJLNC6Q.js → chunk-T6BP34WI.js} +1 -0
- package/dist/cli-delegate/{chunk-RQNNW7IF.js → chunk-T7XSJSUQ.js} +433 -632
- package/dist/cli-delegate/{chunk-NQ7WT43P.js → chunk-TMWYUOK4.js} +75 -12
- package/dist/cli-delegate/{chunk-EEHDXSYD.js → chunk-WQWXGIWB.js} +12 -273
- package/dist/cli-delegate/{chunk-QLDHIPWR.js → chunk-XQTPXKFA.js} +1 -1
- package/dist/cli-delegate/cmd_analyze_session.js +223 -43
- package/dist/cli-delegate/cmd_brand_status.js +3 -2
- package/dist/cli-delegate/cmd_conformance.js +489 -238
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +15 -12
- package/dist/cli-delegate/cmd_doctor_neighbours.js +11 -4
- package/dist/cli-delegate/cmd_explain.js +43 -19
- package/dist/cli-delegate/cmd_export.js +10 -10
- package/dist/cli-delegate/cmd_git_convention.js +1851 -0
- package/dist/cli-delegate/cmd_handoff.js +40 -21
- package/dist/cli-delegate/cmd_mcp_available.js +3 -2
- package/dist/cli-delegate/cmd_migrate.js +3 -3
- package/dist/cli-delegate/cmd_packs_active.js +4 -3
- package/dist/cli-delegate/cmd_prune.js +10 -10
- package/dist/cli-delegate/cmd_route_audit.js +7 -7
- package/dist/cli-delegate/cmd_route_explain.js +5 -5
- package/dist/cli-delegate/cmd_session_recycle.js +9 -7
- package/dist/cli-delegate/cmd_settings_check.js +54 -7
- package/dist/cli-delegate/cmd_settings_get.js +18 -8
- package/dist/cli-delegate/cmd_settings_migrate.js +10 -10
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +10 -10
- package/dist/cli-delegate/cmd_uninstall.js +10 -10
- package/dist/cli-delegate/cmd_update.js +7 -7
- package/dist/cli-delegate/cmd_upgrade.js +7 -7
- package/dist/cli-delegate/cmd_validate.js +10 -10
- package/dist/cli-delegate/cmd_versions.js +5 -5
- package/dist/cli-delegate/gate_budget.js +1 -1
- package/dist/cli-delegate/gate_execute.js +2 -2
- package/dist/cli-delegate/roadmap_gates.js +2 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +171 -107
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +7 -7
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +41 -22
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +16 -11
- package/dist/hooks/dispatch.js +2520 -1924
- package/dist/hooks/dispatch.sha256 +1 -1
- package/dist/hooks/svg_rules.chunk.cjs +1626 -0
- package/dist/hooks/svg_rules.chunk.cjs.sha256 +1 -0
- package/dist/install/install.mjs +462 -431
- package/dist/install/installThinLayer.js +40 -12
- package/dist/install/installedRuleLinks.js +105 -19
- package/dist/mcp/awesome-mcp-servers.row.md +1 -1
- package/dist/mcp/mcp-cloudflare-catalogue.json +2 -2
- package/dist/mcp/registry-manifest.json +5 -5
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +3063 -2160
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_settings.js +15 -120
- package/dist/scripts/_lib/compile_time_toggles.js +12 -21
- package/dist/scripts/_lib/git_convention.js +232 -0
- package/dist/scripts/_lib/global_deploy_inventory.js +730 -0
- package/dist/scripts/_lib/installed_layer.js +344 -18
- package/dist/scripts/_lib/package_root.js +68 -0
- package/dist/scripts/_lib/rule_law_section.js +1 -1
- package/dist/scripts/_lib/scan_scope.js +105 -0
- package/dist/scripts/_lib/settings_removed_keys.js +168 -0
- package/dist/scripts/_lib/svg_dom.js +284 -0
- package/dist/scripts/_lib/svg_geometry.js +477 -0
- package/dist/scripts/_lib/svg_motion.js +179 -0
- package/dist/scripts/_lib/svg_rules.js +1337 -0
- package/dist/scripts/_lib/svg_urls.js +67 -0
- package/dist/scripts/_lib/thin_rules.js +80 -3
- package/dist/scripts/lint_svg_asset.js +324 -0
- package/dist/server/app.js +2 -1
- package/dist/server/gitKeysGate.js +105 -0
- package/dist/server/routes/settings.js +67 -8
- package/dist/server/routes/wizard.js +4 -0
- package/dist/server/schemas/settings.js +23 -81
- package/dist/shared/skillRanking.js +30 -4
- package/dist/ui/assets/{index-Cwq4d0hX.js → index-C3djEJah.js} +2 -2
- package/dist/ui/index.html +1 -1
- package/docs/MIGRATION.md +72 -1
- package/docs/contracts/settings-classes.md +35 -65
- package/docs/guidelines/agent-infra/active-remediation-mechanics.md +39 -0
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/cross-source-consistency-mechanics.md +8 -10
- package/docs/guidelines/agent-infra/frontier-reasoning-operating-profile.md +3 -2
- package/docs/guidelines/agent-infra/layered-settings.md +13 -1
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/self-improvement-pipeline.md +10 -3
- package/docs/guidelines/agent-infra/size-and-scope.md +36 -0
- package/docs/guidelines/design-antipatterns.md +1 -1
- package/docs/guidelines/php/git.md +15 -2
- package/package.json +4 -3
- package/src/agent-src/scripts/gate_budget.ts +47 -23
- package/src/agent-src/scripts/gate_execute.ts +12 -4
- package/src/agent-src/templates/AGENTS.md +1 -1
- package/src/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +0 -6
- package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +11 -7
- package/src/agent-src/templates/scripts/work_engine/hooks/builtin/decision_trace.ts +3 -2
- package/src/agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.ts +2 -1
- package/src/agent-src/templates/scripts/work_engine/hooks/settings.ts +0 -6
- package/src/agent-src/templates/scripts/work_engine/scoring/decision_engine.ts +9 -12
- package/src/agent-src/templates/scripts/work_engine/scoring/memory_visibility.ts +2 -1
- package/src/config/agent-settings.template.yml +79 -312
- package/src/config/agents-paths.yml +16 -0
- package/src/config/assurance-capability-registry.json +7 -3
- package/src/config/ci-local-parity.yml +3 -0
- package/src/config/continuity-surface.json +3 -3
- package/src/config/discovery/packs.yml +17 -1
- package/src/config/evaluator-budgets.json +19 -6
- package/src/config/gate-coverage.yml +65 -23
- package/src/config/gate-violation-baselines.json +56 -16
- package/src/config/gitignore-block.txt +19 -0
- package/src/config/hook-bundle-budget.json +1 -1
- package/src/config/release-gate-locality.yml +2 -1
- package/src/config/routing-coverage-seed.json +55 -6
- package/src/config/rule-law-ceilings.json +12 -6
- package/src/config/rule-obligations.json +833 -0
- package/src/install/installThinLayer.ts +76 -10
- package/src/install/installedRuleLinks.ts +105 -17
- package/src/scripts/_cli/cmd_analyze_session.ts +9 -15
- package/src/scripts/_cli/cmd_conformance.ts +13 -2
- package/src/scripts/_cli/cmd_doctor.ts +10 -10
- package/src/scripts/_cli/cmd_doctor_neighbours.ts +133 -0
- package/src/scripts/_cli/cmd_explain.ts +72 -14
- package/src/scripts/_cli/cmd_git_convention.ts +637 -0
- package/src/scripts/_cli/cmd_settings_check.ts +66 -8
- package/src/scripts/_cli/cmd_settings_get.ts +18 -3
- package/src/scripts/_cli/doctor_execution.ts +72 -1
- package/src/scripts/_dispatch.bash +37 -2
- package/src/scripts/_lib/agent_settings.ts +15 -124
- package/src/scripts/_lib/blocked_by_marker.ts +1 -1
- package/src/scripts/_lib/compile_time_toggles.ts +12 -21
- package/src/scripts/_lib/dispatch_import_closure.ts +163 -0
- package/src/scripts/_lib/git_base_ref.ts +92 -0
- package/src/scripts/_lib/git_convention.ts +291 -0
- package/src/scripts/_lib/git_convention_carrier.ts +389 -0
- package/src/scripts/_lib/git_convention_grammar.ts +246 -0
- package/src/scripts/_lib/git_convention_measure.ts +344 -0
- package/src/scripts/_lib/global_deploy_inventory.ts +74 -0
- package/src/scripts/_lib/graph_feeder_record.ts +236 -13
- package/src/scripts/_lib/installed_layer.ts +448 -23
- package/src/scripts/_lib/knowledge_global.ts +14 -1
- package/src/scripts/_lib/module_reach.ts +456 -0
- package/src/scripts/_lib/neighbour_contradictions.ts +236 -0
- package/src/scripts/_lib/neighbour_tool_use.ts +8 -10
- package/src/scripts/_lib/ratification_artifact.ts +220 -1
- package/src/scripts/_lib/ratification_subject.ts +92 -0
- package/src/scripts/_lib/release_findings_ingest.ts +15 -7
- package/src/scripts/_lib/release_highlights.ts +5 -0
- package/src/scripts/_lib/rule_law_section.ts +1 -1
- package/src/scripts/_lib/rule_obligations.ts +205 -0
- package/src/scripts/_lib/self_repair.ts +1 -1
- package/src/scripts/_lib/settings_removed_keys.ts +173 -0
- package/src/scripts/_lib/svg_dom.ts +318 -0
- package/src/scripts/_lib/svg_geometry.ts +480 -0
- package/src/scripts/_lib/svg_motion.ts +208 -0
- package/src/scripts/_lib/svg_rules.ts +1453 -0
- package/src/scripts/_lib/svg_urls.ts +72 -0
- package/src/scripts/_lib/test_red_state.ts +5 -0
- package/src/scripts/_lib/thin_rules.ts +83 -3
- package/src/scripts/_lib/touched_file_quality.ts +142 -6
- package/src/scripts/_lib/verification_command.ts +59 -0
- package/src/scripts/_lib/verify_clause.ts +27 -17
- package/src/scripts/_lib/worker_budget.ts +1 -1
- package/src/scripts/adr/regenerate_index.ts +16 -1
- package/src/scripts/ai_council/config.ts +7 -7
- package/src/scripts/ai_council/modification_review.ts +100 -0
- package/src/scripts/ai_council/modification_review_questions.ts +90 -0
- package/src/scripts/ai_council/orchestrator.ts +5 -5
- package/src/scripts/ai_council/spend_gate.ts +18 -7
- package/src/scripts/ai_team/config.ts +11 -16
- package/src/scripts/audit_user_type_axis.ts +20 -8
- package/src/scripts/bench_ab_clone.ts +1 -2
- package/src/scripts/bench_concern_spawn_path.ts +129 -0
- package/src/scripts/bench_graph_feeder_latency.ts +584 -0
- package/src/scripts/check_agent_artifact_location.ts +36 -0
- package/src/scripts/check_branch_freshness.ts +147 -24
- package/src/scripts/check_enforcement_coverage.ts +130 -0
- package/src/scripts/check_evaluator_budgets.ts +4 -0
- package/src/scripts/check_finding_dispositions.ts +88 -25
- package/src/scripts/check_gate_coverage.ts +4 -3
- package/src/scripts/check_gate_reachability.ts +48 -1
- package/src/scripts/check_generator_sync.ts +48 -0
- package/src/scripts/check_hook_bundle_composition.ts +107 -0
- package/src/scripts/check_kernel_edit_ratified.ts +86 -6
- package/src/scripts/check_pack_size.ts +1 -1
- package/src/scripts/check_release_manifest_content.ts +189 -0
- package/src/scripts/check_standing_rule_delivery.ts +96 -0
- package/src/scripts/check_suppression_hygiene.ts +2 -5
- package/src/scripts/ci_settle.ts +42 -5
- package/src/scripts/classify_merge_risk.ts +320 -0
- package/src/scripts/closure_scan.ts +91 -1
- package/src/scripts/command_suggester/settings.ts +8 -108
- package/src/scripts/command_suggester/types.ts +4 -5
- package/src/scripts/consumer_matrix.ts +102 -0
- package/src/scripts/context_hygiene_hook.ts +13 -23
- package/src/scripts/cost/preflight.mjs +12 -1
- package/src/scripts/council_cli.ts +7 -7
- package/src/scripts/dispatch_r2_reviewer.ts +24 -11
- package/src/scripts/explain_run.ts +8 -13
- package/src/scripts/generate_git_convention_grammar.ts +127 -0
- package/src/scripts/generate_host_cost_table.ts +20 -3
- package/src/scripts/handoff_context_hook.ts +86 -37
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +25 -6
- package/src/scripts/hooks/block_config_weakening.ts +48 -5
- package/src/scripts/hooks/block_plumbing_writes.ts +8 -4
- package/src/scripts/hooks/block_speaking_inbox_dir.ts +16 -1
- package/src/scripts/hooks/concern_registry.ts +2 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +2 -3
- package/src/scripts/hooks/design_pass_hook.ts +157 -3
- package/src/scripts/hooks/evidence_independence.ts +12 -4
- package/src/scripts/hooks/mcp_usage_observation_hook.ts +121 -0
- package/src/scripts/hooks/push_settle_hook.ts +4 -3
- package/src/scripts/hooks/rule_inject_hook.ts +44 -3
- package/src/scripts/hooks/state_io.ts +8 -4
- package/src/scripts/hooks/svg_obligation.ts +497 -0
- package/src/scripts/hooks/svg_rules_loader.ts +133 -0
- package/src/scripts/hooks/telemetry_usage_hook.ts +7 -46
- package/src/scripts/hooks/turn_end_gate_hook.ts +6 -3
- package/src/scripts/install-hooks.sh +42 -14
- package/src/scripts/install.ts +7 -31
- package/src/scripts/lint_blocker_citations.ts +198 -0
- package/src/scripts/lint_consolidation_lineage.ts +6 -3
- package/src/scripts/lint_design_quality.ts +60 -12
- package/src/scripts/lint_evidence_artifacts.ts +9 -0
- package/src/scripts/lint_hook_concern_budget.ts +10 -21
- package/src/scripts/lint_motion_authority_drift.ts +27 -0
- package/src/scripts/lint_pack_boundaries.ts +406 -28
- package/src/scripts/lint_roadmap_blockers.ts +282 -29
- package/src/scripts/lint_roadmap_complexity.ts +4 -2
- package/src/scripts/lint_rule_law_section.ts +151 -21
- package/src/scripts/lint_rule_skill_pack_reach.ts +17 -0
- package/src/scripts/lint_settings_classes.ts +1 -1
- package/src/scripts/lint_svg_asset.ts +365 -0
- package/src/scripts/lint_ticked_unmet_criteria.ts +165 -0
- package/src/scripts/lint_workflow_security.ts +12 -1
- package/src/scripts/measure_skill_ranker_baseline.ts +5 -0
- package/src/scripts/model_rule_injection.ts +3 -3
- package/src/scripts/onboarding_gate_hook.ts +7 -6
- package/src/scripts/print_required_checks.ts +15 -3
- package/src/scripts/probe_host_compliance.ts +33 -5
- package/src/scripts/probe_turnaround.ts +183 -3
- package/src/scripts/ratification_header.ts +77 -0
- package/src/scripts/refusal_envelope.ts +138 -0
- package/src/scripts/release_publication.ts +29 -3
- package/src/scripts/report_dispatch_import_closure.ts +76 -0
- package/src/scripts/report_installed_rule_links.ts +118 -1
- package/src/scripts/report_module_reach.ts +212 -0
- package/src/scripts/report_obligation_mechanism.ts +16 -18
- package/src/scripts/report_parked_blockers.ts +222 -0
- package/src/scripts/report_required_checks_drift.ts +196 -0
- package/src/scripts/report_skill_ranker_confusion.ts +103 -2
- package/src/scripts/report_standing_payload_by_host.ts +1 -1
- package/src/scripts/routing_doctor.ts +2 -2
- package/src/scripts/schemas/agent-settings.schema.json +17 -31
- package/src/scripts/schemas/command.schema.json +1 -1
- package/src/scripts/schemas/skill.schema.json +1 -1
- package/src/scripts/self_review_gate.ts +39 -2
- package/src/scripts/skill_tools/score_skill_relevance.ts +28 -19
- package/src/scripts/sync_pr_branch.ts +403 -132
- package/src/scripts/trigger_eval_grandfather.json +0 -16
- package/src/server/schemas/settings.ts +33 -177
- package/src/shared/skillRanking.ts +53 -4
- package/dist/cli-delegate/chunk-NYX3L2PZ.js +0 -99
- package/src/scripts/_lib/config_chain.ts +0 -477
- package/src/scripts/_lib/conformance_report.ts +0 -403
- package/src/scripts/_lib/eval_discrimination.ts +0 -95
- package/src/scripts/_lib/evaluator_promotion.ts +0 -225
- package/src/scripts/_lib/file_slicer.ts +0 -117
- package/src/scripts/_lib/legacy_boundary_map.ts +0 -228
- package/src/scripts/_lib/minimality_tiebreak.ts +0 -168
- package/src/scripts/_lib/overbuild_lens_contract.ts +0 -196
- package/src/scripts/_lib/role_split.ts +0 -338
|
@@ -2,25 +2,32 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
|
|
|
2
2
|
import {
|
|
3
3
|
ZodFirstPartyTypeKind,
|
|
4
4
|
settingsSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
main
|
|
8
|
-
} from "./chunk-CQWX336L.js";
|
|
5
|
+
} from "./chunk-6SRJTYJS.js";
|
|
9
6
|
import {
|
|
10
7
|
GLOBAL_DEPLOY_SOURCES,
|
|
11
8
|
RULE_SOURCE_REL
|
|
12
9
|
} from "./chunk-WOKWX5PL.js";
|
|
13
10
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
11
|
+
main
|
|
12
|
+
} from "./chunk-G5VVIZRC.js";
|
|
13
|
+
import {
|
|
14
|
+
absoluteBodyLinkPrefix,
|
|
15
|
+
appendTxLog,
|
|
16
|
+
build_thin,
|
|
17
|
+
ruleBody,
|
|
18
|
+
splitFrontmatter,
|
|
19
|
+
split_frontmatter
|
|
20
|
+
} from "./chunk-6YQC2HLF.js";
|
|
16
21
|
import {
|
|
17
22
|
SCOPE_DETECT_AI_DIRS,
|
|
18
23
|
SCOPE_DETECT_MANIFESTS
|
|
19
24
|
} from "./chunk-A4QJ6ENT.js";
|
|
20
25
|
import {
|
|
26
|
+
INVENTORY_BASENAME,
|
|
21
27
|
build_claude_hook_matrix,
|
|
22
28
|
ensure_managed_hooks,
|
|
23
29
|
expected_deploy_files,
|
|
30
|
+
inventory_path,
|
|
24
31
|
is_ancestor,
|
|
25
32
|
load_inventory,
|
|
26
33
|
printResiduals,
|
|
@@ -28,22 +35,10 @@ import {
|
|
|
28
35
|
reap_stale,
|
|
29
36
|
reap_tagged_orphans,
|
|
30
37
|
record_deploy,
|
|
38
|
+
recorded_absolute_files,
|
|
31
39
|
recorded_rel_files,
|
|
32
40
|
save_inventory
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import {
|
|
35
|
-
write_managed_block
|
|
36
|
-
} from "./chunk-ULQRUR23.js";
|
|
37
|
-
import {
|
|
38
|
-
check_version,
|
|
39
|
-
classify_mismatch,
|
|
40
|
-
current_package_version,
|
|
41
|
-
lockfile_path,
|
|
42
|
-
lockfile_write_path,
|
|
43
|
-
migrate_layout,
|
|
44
|
-
read_lockfile,
|
|
45
|
-
write_lockfile
|
|
46
|
-
} from "./chunk-T7L2QK3K.js";
|
|
41
|
+
} from "./chunk-MDPPKQCQ.js";
|
|
47
42
|
import {
|
|
48
43
|
LEGACY_ALL,
|
|
49
44
|
compute_active_pack_ids,
|
|
@@ -56,6 +51,19 @@ import {
|
|
|
56
51
|
ruleFileArrives,
|
|
57
52
|
ruleScopeFromSettings
|
|
58
53
|
} from "./chunk-DMSZHXZS.js";
|
|
54
|
+
import {
|
|
55
|
+
write_managed_block
|
|
56
|
+
} from "./chunk-ULQRUR23.js";
|
|
57
|
+
import {
|
|
58
|
+
check_version,
|
|
59
|
+
classify_mismatch,
|
|
60
|
+
current_package_version,
|
|
61
|
+
lockfile_path,
|
|
62
|
+
lockfile_write_path,
|
|
63
|
+
migrate_layout,
|
|
64
|
+
read_lockfile,
|
|
65
|
+
write_lockfile
|
|
66
|
+
} from "./chunk-LQOCRFWT.js";
|
|
59
67
|
import {
|
|
60
68
|
HOOK_SIGNATURES,
|
|
61
69
|
deepMerge,
|
|
@@ -81,13 +89,14 @@ import {
|
|
|
81
89
|
import {
|
|
82
90
|
find_project_root_with_anchor,
|
|
83
91
|
load_agent_settings
|
|
84
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-H76PHZBI.js";
|
|
85
93
|
import {
|
|
94
|
+
DEFAULT_EVENT4U_ROOT_RELATIVE,
|
|
86
95
|
event4u_root,
|
|
87
96
|
legacy_xdg_root,
|
|
88
97
|
migrate_legacy_namespace,
|
|
89
98
|
write_target
|
|
90
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-T6BP34WI.js";
|
|
91
100
|
import {
|
|
92
101
|
__toESM
|
|
93
102
|
} from "./chunk-J55WI3RR.js";
|
|
@@ -338,11 +347,11 @@ function subtract_pointers(doc, entries) {
|
|
|
338
347
|
// src/scripts/install.ts
|
|
339
348
|
import { spawn, spawnSync } from "node:child_process";
|
|
340
349
|
import * as crypto5 from "node:crypto";
|
|
341
|
-
import * as
|
|
342
|
-
import * as
|
|
343
|
-
import * as
|
|
350
|
+
import * as fs18 from "node:fs";
|
|
351
|
+
import * as os7 from "node:os";
|
|
352
|
+
import * as path18 from "node:path";
|
|
344
353
|
import process2 from "node:process";
|
|
345
|
-
import { fileURLToPath as
|
|
354
|
+
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
346
355
|
|
|
347
356
|
// src/scripts/_lib/reserved_name_sweep.ts
|
|
348
357
|
import * as fs from "node:fs";
|
|
@@ -2242,12 +2251,13 @@ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
|
|
|
2242
2251
|
}
|
|
2243
2252
|
|
|
2244
2253
|
// src/install/installThinLayer.ts
|
|
2245
|
-
import * as
|
|
2246
|
-
import * as
|
|
2247
|
-
import * as
|
|
2254
|
+
import * as fs15 from "node:fs";
|
|
2255
|
+
import * as path15 from "node:path";
|
|
2256
|
+
import * as os6 from "node:os";
|
|
2248
2257
|
|
|
2249
2258
|
// src/scripts/_lib/installed_layer.ts
|
|
2250
2259
|
import * as fs14 from "node:fs";
|
|
2260
|
+
import * as os5 from "node:os";
|
|
2251
2261
|
import * as path14 from "node:path";
|
|
2252
2262
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
2253
2263
|
|
|
@@ -2268,69 +2278,16 @@ function globalRuleLayerPath(toolId, home = process.env["HOME"] ?? os4.homedir()
|
|
|
2268
2278
|
return rel === void 0 ? null : path13.join(home, rel);
|
|
2269
2279
|
}
|
|
2270
2280
|
|
|
2271
|
-
// src/scripts/_lib/rule_law_section.ts
|
|
2272
|
-
var IRON_LAW_RE = /\biron\s+laws?\b/i;
|
|
2273
|
-
var HEADING_RE = /^(#{1,6})\s+(.+?)\s*$/;
|
|
2274
|
-
var FENCE_RE = /^\s*```/;
|
|
2275
|
-
function splitFrontmatter(text) {
|
|
2276
|
-
if (text.startsWith("---\n")) {
|
|
2277
|
-
const end = text.indexOf("\n---\n", 4);
|
|
2278
|
-
if (end !== -1) {
|
|
2279
|
-
return [text.slice(0, end + 5), text.slice(end + 5)];
|
|
2280
|
-
}
|
|
2281
|
-
}
|
|
2282
|
-
return ["", text];
|
|
2283
|
-
}
|
|
2284
|
-
function ruleBody(text) {
|
|
2285
|
-
const [, body] = splitFrontmatter(text);
|
|
2286
|
-
return body.replace(/<!--[\s\S]*?-->/g, "").trim();
|
|
2287
|
-
}
|
|
2288
|
-
function lawSections(body) {
|
|
2289
|
-
const lines = body.split("\n");
|
|
2290
|
-
let inFence = false;
|
|
2291
|
-
const headings = [];
|
|
2292
|
-
for (let i = 0; i < lines.length; i += 1) {
|
|
2293
|
-
const raw = lines[i];
|
|
2294
|
-
if (FENCE_RE.test(raw)) {
|
|
2295
|
-
inFence = !inFence;
|
|
2296
|
-
continue;
|
|
2297
|
-
}
|
|
2298
|
-
if (inFence) continue;
|
|
2299
|
-
const m = HEADING_RE.exec(raw);
|
|
2300
|
-
if (m) headings.push({ i, depth: m[1].length, title: m[2].trim() });
|
|
2301
|
-
}
|
|
2302
|
-
const out = [];
|
|
2303
|
-
for (let k = 0; k < headings.length; k += 1) {
|
|
2304
|
-
const h = headings[k];
|
|
2305
|
-
if (!IRON_LAW_RE.test(h.title)) continue;
|
|
2306
|
-
let end = lines.length;
|
|
2307
|
-
for (let j = k + 1; j < headings.length; j += 1) {
|
|
2308
|
-
const n = headings[j];
|
|
2309
|
-
if (n.depth <= h.depth) {
|
|
2310
|
-
end = n.i;
|
|
2311
|
-
break;
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
out.push({
|
|
2315
|
-
title: h.title,
|
|
2316
|
-
depth: h.depth,
|
|
2317
|
-
line: h.i + 1,
|
|
2318
|
-
text: lines.slice(h.i, end).join("\n").trim()
|
|
2319
|
-
});
|
|
2320
|
-
}
|
|
2321
|
-
return out;
|
|
2322
|
-
}
|
|
2323
|
-
function lawText(body) {
|
|
2324
|
-
const sections = lawSections(body);
|
|
2325
|
-
if (sections.length === 0) return null;
|
|
2326
|
-
return sections.map((s) => s.text).join("\n\n");
|
|
2327
|
-
}
|
|
2328
|
-
|
|
2329
2281
|
// src/scripts/_lib/installed_layer.ts
|
|
2330
2282
|
var TOP_FILES = 20;
|
|
2331
2283
|
var LIMIT_WARN_FRACTION = 0.8;
|
|
2332
2284
|
function isUnconditional(text) {
|
|
2333
|
-
|
|
2285
|
+
const [frontmatter] = splitFrontmatter(text);
|
|
2286
|
+
const emptyBlock = /^---\n---(\n|$)/.test(text);
|
|
2287
|
+
if (frontmatter === "" && !emptyBlock && /^\uFEFF?[\s]*---/.test(text)) {
|
|
2288
|
+
return !/^paths:/m.test(text);
|
|
2289
|
+
}
|
|
2290
|
+
return !/^paths:/m.test(frontmatter);
|
|
2334
2291
|
}
|
|
2335
2292
|
function readLayer(host, scope, dir, recorded) {
|
|
2336
2293
|
const empty = {
|
|
@@ -2341,6 +2298,8 @@ function readLayer(host, scope, dir, recorded) {
|
|
|
2341
2298
|
foreign: 0,
|
|
2342
2299
|
package_owned_chars: 0,
|
|
2343
2300
|
foreign_chars: 0,
|
|
2301
|
+
unconditional_chars: 0,
|
|
2302
|
+
scoped_chars: 0,
|
|
2344
2303
|
top: []
|
|
2345
2304
|
};
|
|
2346
2305
|
let names;
|
|
@@ -2386,6 +2345,8 @@ function readLayer(host, scope, dir, recorded) {
|
|
|
2386
2345
|
foreign: readings.filter((r) => !r.package_owned).length,
|
|
2387
2346
|
package_owned_chars: readings.reduce((n, r) => n + (r.package_owned ? r.chars : 0), 0),
|
|
2388
2347
|
foreign_chars: readings.reduce((n, r) => n + (r.package_owned ? 0 : r.chars), 0),
|
|
2348
|
+
unconditional_chars: readings.reduce((n, r) => n + (r.unconditional ? r.chars : 0), 0),
|
|
2349
|
+
scoped_chars: readings.reduce((n, r) => n + (r.unconditional ? 0 : r.chars), 0),
|
|
2389
2350
|
top
|
|
2390
2351
|
};
|
|
2391
2352
|
}
|
|
@@ -2451,275 +2412,111 @@ function buildHostLimitRows(layers, limits) {
|
|
|
2451
2412
|
}
|
|
2452
2413
|
return rows;
|
|
2453
2414
|
}
|
|
2454
|
-
function
|
|
2455
|
-
|
|
2456
|
-
"host instruction budgets \u2014 package-owned + foreign against the published limit"
|
|
2457
|
-
];
|
|
2458
|
-
for (const r of rows) {
|
|
2459
|
-
const split = `${String(r.package_owned_chars)} package-owned + ${String(r.foreign_chars)} foreign = ${String(r.chars)} chars`;
|
|
2460
|
-
if (r.limit === null) {
|
|
2461
|
-
out.push(` ${r.host} \u2014 ${split}; no published limit recorded \u2014 not measured`);
|
|
2462
|
-
continue;
|
|
2463
|
-
}
|
|
2464
|
-
const pct = (r.fraction * 100).toFixed(1);
|
|
2465
|
-
out.push(
|
|
2466
|
-
` ${r.host} \u2014 ${split}; ${pct}% of ${String(r.limit)} (${r.kind})` + (r.warn ? ` \u2014 WARNING: at or past ${String(Math.round(LIMIT_WARN_FRACTION * 100))}% of the published limit` : "")
|
|
2467
|
-
);
|
|
2468
|
-
}
|
|
2469
|
-
return out;
|
|
2470
|
-
}
|
|
2471
|
-
|
|
2472
|
-
// src/scripts/_lib/thin_rules.ts
|
|
2473
|
-
import { createHash as createHash7 } from "node:crypto";
|
|
2474
|
-
import * as fs16 from "node:fs";
|
|
2475
|
-
import * as path16 from "node:path";
|
|
2476
|
-
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
2477
|
-
|
|
2478
|
-
// src/scripts/_lib/rule_consequence_class.ts
|
|
2479
|
-
import * as fs15 from "node:fs";
|
|
2480
|
-
import * as path15 from "node:path";
|
|
2481
|
-
var CLASS_CONFIG_REL = "src/config/rule-consequence-class.json";
|
|
2482
|
-
function readConsequenceClass(repoRoot) {
|
|
2483
|
-
const raw = JSON.parse(fs15.readFileSync(path15.join(repoRoot, CLASS_CONFIG_REL), "utf-8"));
|
|
2484
|
-
return {
|
|
2485
|
-
criterion_ref: raw.criterion_ref ?? "",
|
|
2486
|
-
members: raw.members ?? {},
|
|
2487
|
-
no_stub: raw.no_stub ?? {},
|
|
2488
|
-
excluded: raw.excluded ?? {}
|
|
2489
|
-
};
|
|
2490
|
-
}
|
|
2491
|
-
function stubLawIds(cfg) {
|
|
2492
|
-
return new Set(Object.keys(cfg.members).filter((id) => cfg.no_stub[id] === void 0));
|
|
2493
|
-
}
|
|
2494
|
-
|
|
2495
|
-
// src/scripts/_lib/rule_injection.ts
|
|
2496
|
-
var PATH_TRIGGER_KINDS = ["path_prefix", "file_pattern"];
|
|
2497
|
-
function tierEntries(router, tier) {
|
|
2498
|
-
const raw = router[tier];
|
|
2499
|
-
if (!Array.isArray(raw)) return [];
|
|
2500
|
-
return raw.map((r) => ({
|
|
2501
|
-
id: String(r["id"] ?? ""),
|
|
2502
|
-
triggers: Array.isArray(r["triggers"]) ? r["triggers"] : []
|
|
2503
|
-
}));
|
|
2504
|
-
}
|
|
2505
|
-
function allTierRules(router) {
|
|
2506
|
-
const out = [];
|
|
2507
|
-
for (const tier of ["tier_1", "tier_2"]) {
|
|
2508
|
-
for (const e of tierEntries(router, tier)) out.push({ ...e, tier });
|
|
2509
|
-
}
|
|
2510
|
-
return out;
|
|
2511
|
-
}
|
|
2512
|
-
function pathOnlyRuleIds(router) {
|
|
2513
|
-
const ids = /* @__PURE__ */ new Set();
|
|
2514
|
-
for (const r of allTierRules(router)) {
|
|
2515
|
-
if (r.triggers.length === 0) continue;
|
|
2516
|
-
const allPath = r.triggers.every(
|
|
2517
|
-
(t) => PATH_TRIGGER_KINDS.some((k) => k in t)
|
|
2518
|
-
);
|
|
2519
|
-
if (allPath) ids.add(r.id);
|
|
2520
|
-
}
|
|
2521
|
-
return ids;
|
|
2522
|
-
}
|
|
2523
|
-
function triggerlessRuleIds(router) {
|
|
2524
|
-
return allTierRules(router).filter((r) => r.triggers.length === 0).map((r) => r.id);
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
// src/scripts/_lib/thin_rules.ts
|
|
2528
|
-
var _HERE = fileURLToPath3(import.meta.url);
|
|
2529
|
-
var REPO_ROOT = path16.resolve(path16.dirname(_HERE), "..", "..", "..");
|
|
2530
|
-
var RULES_SOURCE = path16.join(REPO_ROOT, "dist/agent-src", "rules");
|
|
2531
|
-
var ROUTER = path16.join(REPO_ROOT, "dist", "router.json");
|
|
2532
|
-
function _globSortedMd(dir) {
|
|
2533
|
-
let names;
|
|
2415
|
+
function defaultInventoryPath(home) {
|
|
2416
|
+
if (home === void 0 || home === null || home === "") return inventory_path();
|
|
2534
2417
|
try {
|
|
2535
|
-
|
|
2418
|
+
const real = (q) => {
|
|
2419
|
+
try {
|
|
2420
|
+
return fs14.realpathSync(q);
|
|
2421
|
+
} catch {
|
|
2422
|
+
return path14.resolve(q);
|
|
2423
|
+
}
|
|
2424
|
+
};
|
|
2425
|
+
const mine = os5.homedir();
|
|
2426
|
+
if (path14.resolve(home) === path14.resolve(mine) || real(home) === real(mine)) {
|
|
2427
|
+
return inventory_path();
|
|
2428
|
+
}
|
|
2536
2429
|
} catch {
|
|
2537
|
-
return [];
|
|
2538
|
-
}
|
|
2539
|
-
const out = names.filter((n) => n.endsWith(".md")).map((n) => path16.join(dir, n));
|
|
2540
|
-
out.sort();
|
|
2541
|
-
return out;
|
|
2542
|
-
}
|
|
2543
|
-
function kernel_ids(routerPath = ROUTER) {
|
|
2544
|
-
const data = JSON.parse(fs16.readFileSync(routerPath, "utf-8"));
|
|
2545
|
-
const kernel = data.kernel;
|
|
2546
|
-
if (Array.isArray(kernel)) {
|
|
2547
|
-
return new Set(kernel.map((x) => String(x)));
|
|
2548
2430
|
}
|
|
2549
|
-
return
|
|
2550
|
-
}
|
|
2551
|
-
function _router(routerPath = ROUTER) {
|
|
2552
|
-
return JSON.parse(fs16.readFileSync(routerPath, "utf-8"));
|
|
2431
|
+
return path14.join(home, DEFAULT_EVENT4U_ROOT_RELATIVE, INVENTORY_BASENAME);
|
|
2553
2432
|
}
|
|
2554
|
-
function
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
for (const e of entries) {
|
|
2567
|
-
const obj = e;
|
|
2568
|
-
const ws = Array.isArray(obj.workspaces) ? obj.workspaces.map((w) => String(w)) : [];
|
|
2569
|
-
map.set(String(obj.id), ws);
|
|
2433
|
+
function resolveLayerOwnership(opts) {
|
|
2434
|
+
const recorded = /* @__PURE__ */ new Map();
|
|
2435
|
+
const sources = [];
|
|
2436
|
+
if (opts.inventoryPath !== null) {
|
|
2437
|
+
let n = 0;
|
|
2438
|
+
try {
|
|
2439
|
+
const inv = load_inventory(opts.inventoryPath ?? defaultInventoryPath(opts.home));
|
|
2440
|
+
for (const abs of recorded_absolute_files(inv, opts.home ?? null)) {
|
|
2441
|
+
if (!recorded.has(abs)) n += 1;
|
|
2442
|
+
recorded.set(abs, null);
|
|
2443
|
+
}
|
|
2444
|
+
} catch {
|
|
2570
2445
|
}
|
|
2446
|
+
if (n > 0) sources.push("global-inventory");
|
|
2571
2447
|
}
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
return ws.some((w) => scope.includes(w));
|
|
2583
|
-
}
|
|
2584
|
-
function fm_workspaces(text) {
|
|
2585
|
-
const [fm] = split_frontmatter(text);
|
|
2586
|
-
const flow = /^workspaces:[ \t]*\[([^\]]*)\]/m.exec(fm);
|
|
2587
|
-
if (flow) {
|
|
2588
|
-
return flow[1].split(",").map((s) => s.trim().replace(/^["']|["']$/g, "")).filter((s) => s.length > 0);
|
|
2589
|
-
}
|
|
2590
|
-
const m = /^workspaces:[ \t]*\n((?:[ \t]+-[ \t]+.*(?:\n|$))+)/m.exec(fm);
|
|
2591
|
-
if (!m) {
|
|
2592
|
-
return [];
|
|
2593
|
-
}
|
|
2594
|
-
return [...m[1].matchAll(/-[ \t]+(\S+)/g)].map((x) => x[1]);
|
|
2595
|
-
}
|
|
2596
|
-
function split_frontmatter(text) {
|
|
2597
|
-
if (text.startsWith("---\n")) {
|
|
2598
|
-
const end = text.indexOf("\n---\n", 4);
|
|
2599
|
-
if (end !== -1) {
|
|
2600
|
-
return [text.slice(0, end + 5), text.slice(end + 5)];
|
|
2448
|
+
let fromDeploy = 0;
|
|
2449
|
+
for (const [anchor, rels] of opts.thisDeploy ?? /* @__PURE__ */ new Map()) {
|
|
2450
|
+
for (const rel of rels) {
|
|
2451
|
+
const abs = path14.resolve(anchor, rel);
|
|
2452
|
+
if (!recorded.has(abs)) fromDeploy += 1;
|
|
2453
|
+
recorded.set(abs, null);
|
|
2454
|
+
try {
|
|
2455
|
+
recorded.set(fs14.realpathSync(abs), null);
|
|
2456
|
+
} catch {
|
|
2457
|
+
}
|
|
2601
2458
|
}
|
|
2602
2459
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
const re = /^\s*-\s*(?:keyword|phrase):\s*"?(.+?)"?\s*$/gm;
|
|
2613
|
-
let m;
|
|
2614
|
-
while ((m = re.exec(fm)) !== null) {
|
|
2615
|
-
hits.push(m[1].trim());
|
|
2616
|
-
if (hits.length >= _TRIGGER_HINT_LIMIT) {
|
|
2617
|
-
break;
|
|
2460
|
+
if (fromDeploy > 0) sources.push("this-deploy");
|
|
2461
|
+
const manifestPath = opts.manifestPath ?? null;
|
|
2462
|
+
if (manifestPath !== null && fs14.existsSync(manifestPath)) {
|
|
2463
|
+
let n = 0;
|
|
2464
|
+
let recordedHashes;
|
|
2465
|
+
try {
|
|
2466
|
+
recordedHashes = readRecordedHashes(manifestPath, opts.projectRoot);
|
|
2467
|
+
} catch {
|
|
2468
|
+
recordedHashes = NO_RECORDED_HASHES;
|
|
2618
2469
|
}
|
|
2470
|
+
for (const [abs, hash] of recordedHashes) {
|
|
2471
|
+
n += 1;
|
|
2472
|
+
recorded.set(abs, hash);
|
|
2473
|
+
}
|
|
2474
|
+
if (n > 0) sources.push("manifest");
|
|
2619
2475
|
}
|
|
2620
|
-
|
|
2621
|
-
}
|
|
2622
|
-
function _title(s) {
|
|
2623
|
-
return s.replace(/[A-Za-z]+/g, (w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase());
|
|
2624
|
-
}
|
|
2625
|
-
var THIN_ENTRY_MARKER = "> Routed rule \u2014 load the body on trigger-match.";
|
|
2626
|
-
var BODY_LINK_PREFIX = "../../dist/agent-src/rules/";
|
|
2627
|
-
function absoluteBodyLinkPrefix(packageRoot) {
|
|
2628
|
-
return `${path16.join(path16.resolve(packageRoot), "dist", "agent-src", "rules")}${path16.sep}`;
|
|
2629
|
-
}
|
|
2630
|
-
function thin_entry(rule_id, text, bodyLinkPrefix = BODY_LINK_PREFIX) {
|
|
2631
|
-
const [fm] = split_frontmatter(text);
|
|
2632
|
-
const desc = _description(fm);
|
|
2633
|
-
const hint = _trigger_hint(fm);
|
|
2634
|
-
const title = _title(rule_id.replace(/-/g, " "));
|
|
2635
|
-
const fires = hint ? ` Fires on: ${hint}.` : "";
|
|
2636
|
-
return `## ${title}
|
|
2637
|
-
${THIN_ENTRY_MARKER}${fires} ${desc} Body: [\`${rule_id}\`](${bodyLinkPrefix}${rule_id}.md)
|
|
2638
|
-
`;
|
|
2639
|
-
}
|
|
2640
|
-
var STUB_LAW_OPEN = "<!-- law: byte-copied from the rule, sha256 ";
|
|
2641
|
-
var STUB_LAW_CLOSE = "<!-- /law -->";
|
|
2642
|
-
function lawDigest(law) {
|
|
2643
|
-
return createHash7("sha256").update(law, "utf-8").digest("hex").slice(0, 16);
|
|
2644
|
-
}
|
|
2645
|
-
var StubLawError = class extends Error {
|
|
2646
|
-
ruleId;
|
|
2647
|
-
constructor(ruleId, message) {
|
|
2648
|
-
super(message);
|
|
2649
|
-
this.name = "StubLawError";
|
|
2650
|
-
this.ruleId = ruleId;
|
|
2651
|
-
}
|
|
2652
|
-
};
|
|
2653
|
-
var STUB_LAW_MAX_CHARS = 2e3;
|
|
2654
|
-
function thin_entry_with_law(rule_id, text, bodyLinkPrefix = BODY_LINK_PREFIX) {
|
|
2655
|
-
const law = lawText(ruleBody(text));
|
|
2656
|
-
if (law === null) {
|
|
2657
|
-
throw new StubLawError(
|
|
2658
|
-
rule_id,
|
|
2659
|
-
`${rule_id} is a high-consequence class member with no law section \u2014 write one, or record it under \`no_stub\` in src/config/rule-consequence-class.json with the reason`
|
|
2660
|
-
);
|
|
2476
|
+
if (recorded.size === 0) {
|
|
2477
|
+
return { recorded: NO_RECORDED_HASHES, sources: [], source: "none" };
|
|
2661
2478
|
}
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2479
|
+
const primary = sources.includes("manifest") ? "manifest" : sources.includes("global-inventory") ? "global-inventory" : "this-deploy";
|
|
2480
|
+
return { recorded, sources, source: primary };
|
|
2481
|
+
}
|
|
2482
|
+
function ownershipLine(sources) {
|
|
2483
|
+
const list = (Array.isArray(sources) ? sources : [sources]).filter(
|
|
2484
|
+
(s) => s !== "none"
|
|
2485
|
+
);
|
|
2486
|
+
if (list.length === 0) {
|
|
2487
|
+
return "ownership: NO manifest and NO deploy inventory resolved \u2014 every file reads foreign, which is no evidence rather than a finding";
|
|
2667
2488
|
}
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2489
|
+
const phrases = {
|
|
2490
|
+
manifest: "the installed-tools manifest",
|
|
2491
|
+
"global-inventory": "the global deploy inventory (deployed-files.json)",
|
|
2492
|
+
"this-deploy": "the file set this install just wrote"
|
|
2493
|
+
};
|
|
2494
|
+
const named = list.map((s) => phrases[s]);
|
|
2495
|
+
const joined = named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named[named.length - 1]}`;
|
|
2496
|
+
return `ownership: read from ${joined}`;
|
|
2673
2497
|
}
|
|
2674
|
-
function
|
|
2675
|
-
const
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
const lawInStub = stubLawIds(cls);
|
|
2683
|
-
const wsMap = scope !== null ? rule_workspaces_map(routerPath) : /* @__PURE__ */ new Map();
|
|
2684
|
-
const out = /* @__PURE__ */ new Map();
|
|
2685
|
-
for (const p of _globSortedMd(rules_dir)) {
|
|
2686
|
-
const text = fs16.readFileSync(p, "utf-8");
|
|
2687
|
-
const stem = path16.basename(p).replace(/\.md$/, "");
|
|
2688
|
-
if (!id_in_scope(stem, scope, kernel, wsMap, fm_workspaces(text))) {
|
|
2689
|
-
continue;
|
|
2690
|
-
}
|
|
2691
|
-
const noStub = cls.no_stub[stem] !== void 0;
|
|
2692
|
-
const full = kernel.has(stem) || noTrigger.has(stem) || pathOnly.has(stem) || noStub;
|
|
2693
|
-
if (announce !== null && noTrigger.has(stem) && !kernel.has(stem)) {
|
|
2694
|
-
announce(`D3: trigger-less auto rule ${path16.basename(p)} \u2014 kept full-bodied, never thinned`);
|
|
2695
|
-
}
|
|
2696
|
-
if (announce !== null && pathOnly.has(stem) && !kernel.has(stem) && !noTrigger.has(stem)) {
|
|
2697
|
-
announce(
|
|
2698
|
-
`E2: path-only auto rule ${path16.basename(p)} \u2014 kept full-bodied; its only triggers are path-shaped and the delivery concern is not bound on pre_tool_use`
|
|
2699
|
-
);
|
|
2700
|
-
}
|
|
2701
|
-
if (full) {
|
|
2702
|
-
out.set(path16.basename(p), text);
|
|
2703
|
-
continue;
|
|
2704
|
-
}
|
|
2705
|
-
if (lawInStub.has(stem)) {
|
|
2706
|
-
if (announce !== null) {
|
|
2707
|
-
announce(
|
|
2708
|
-
`LAW: high-consequence rule ${path16.basename(p)} \u2014 stub carries its own law section, byte-copied`
|
|
2709
|
-
);
|
|
2710
|
-
}
|
|
2711
|
-
out.set(path16.basename(p), thin_entry_with_law(stem, text, bodyLinkPrefix));
|
|
2498
|
+
function renderHostLimitRows(rows) {
|
|
2499
|
+
const out = [
|
|
2500
|
+
"host instruction budgets \u2014 package-owned + foreign against the published limit"
|
|
2501
|
+
];
|
|
2502
|
+
for (const r of rows) {
|
|
2503
|
+
const split = `${String(r.package_owned_chars)} package-owned + ${String(r.foreign_chars)} foreign = ${String(r.chars)} chars`;
|
|
2504
|
+
if (r.limit === null) {
|
|
2505
|
+
out.push(` ${r.host} \u2014 ${split}; no published limit recorded \u2014 not measured`);
|
|
2712
2506
|
continue;
|
|
2713
2507
|
}
|
|
2714
|
-
|
|
2508
|
+
const pct = (r.fraction * 100).toFixed(1);
|
|
2509
|
+
out.push(
|
|
2510
|
+
` ${r.host} \u2014 ${split}; ${pct}% of ${String(r.limit)} (${r.kind})` + (r.warn ? ` \u2014 WARNING: at or past ${String(Math.round(LIMIT_WARN_FRACTION * 100))}% of the published limit` : "")
|
|
2511
|
+
);
|
|
2715
2512
|
}
|
|
2716
2513
|
return out;
|
|
2717
2514
|
}
|
|
2718
2515
|
|
|
2719
2516
|
// src/install/installThinLayer.ts
|
|
2720
2517
|
function thinInstalledRuleLayer(opts) {
|
|
2721
|
-
const packageRoot =
|
|
2722
|
-
const bodySourceDir =
|
|
2518
|
+
const packageRoot = path15.resolve(opts.packageRoot);
|
|
2519
|
+
const bodySourceDir = path15.join(packageRoot, "dist", "agent-src", "rules");
|
|
2723
2520
|
const bodyLinkPrefix = absoluteBodyLinkPrefix(packageRoot);
|
|
2724
2521
|
const preserved = opts.preserved ?? /* @__PURE__ */ new Set();
|
|
2725
2522
|
const stubs = build_thin(bodySourceDir, null, null, null, { packageRoot, bodyLinkPrefix });
|
|
@@ -2732,10 +2529,10 @@ function thinInstalledRuleLayer(opts) {
|
|
|
2732
2529
|
const absent = [];
|
|
2733
2530
|
const failed = [];
|
|
2734
2531
|
for (const [name, stubText] of stubs) {
|
|
2735
|
-
const target =
|
|
2532
|
+
const target = path15.join(opts.rulesDir, name);
|
|
2736
2533
|
let installed;
|
|
2737
2534
|
try {
|
|
2738
|
-
installed =
|
|
2535
|
+
installed = fs15.readFileSync(target, "utf-8");
|
|
2739
2536
|
} catch (e) {
|
|
2740
2537
|
if (e.code === "ENOENT") absent.push(name);
|
|
2741
2538
|
else failed.push({ rule: name, reason: String(e) });
|
|
@@ -2743,7 +2540,7 @@ function thinInstalledRuleLayer(opts) {
|
|
|
2743
2540
|
}
|
|
2744
2541
|
let sourceText;
|
|
2745
2542
|
try {
|
|
2746
|
-
sourceText =
|
|
2543
|
+
sourceText = fs15.readFileSync(path15.join(bodySourceDir, name), "utf-8");
|
|
2747
2544
|
} catch {
|
|
2748
2545
|
sourceText = null;
|
|
2749
2546
|
}
|
|
@@ -2753,7 +2550,7 @@ function thinInstalledRuleLayer(opts) {
|
|
|
2753
2550
|
charsAfter += installed.length;
|
|
2754
2551
|
continue;
|
|
2755
2552
|
}
|
|
2756
|
-
if (preserved.has(
|
|
2553
|
+
if (preserved.has(path15.resolve(target))) {
|
|
2757
2554
|
preservedHits.push(name);
|
|
2758
2555
|
charsBefore += installed.length;
|
|
2759
2556
|
charsAfter += installed.length;
|
|
@@ -2772,7 +2569,7 @@ function thinInstalledRuleLayer(opts) {
|
|
|
2772
2569
|
const next = `${frontmatter}${stubText}`;
|
|
2773
2570
|
try {
|
|
2774
2571
|
if (next !== installed) {
|
|
2775
|
-
|
|
2572
|
+
fs15.writeFileSync(target, next, "utf-8");
|
|
2776
2573
|
rewritten += 1;
|
|
2777
2574
|
}
|
|
2778
2575
|
thinned += 1;
|
|
@@ -2815,15 +2612,36 @@ function describeThinInstalledLayer(res) {
|
|
|
2815
2612
|
}
|
|
2816
2613
|
return out;
|
|
2817
2614
|
}
|
|
2818
|
-
function installReceiptBudgetLines(packageRoot, home =
|
|
2615
|
+
function installReceiptBudgetLines(packageRoot, home = os6.homedir(), opts = {}) {
|
|
2819
2616
|
try {
|
|
2820
|
-
const recorded = (
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2617
|
+
const { recorded, sources } = resolveLayerOwnership({
|
|
2618
|
+
manifestPath: opts.manifestPath === void 0 ? manifest_path(packageRoot) : opts.manifestPath,
|
|
2619
|
+
projectRoot: packageRoot,
|
|
2620
|
+
// The same home the layers below are read from — the inventory's
|
|
2621
|
+
// anchor is tilde-relative, so the two must agree or the receipt
|
|
2622
|
+
// measures one install and claims ownership of another.
|
|
2623
|
+
home,
|
|
2624
|
+
// THE RECEIPT IS THE "ASKING PROCESS" CASE, so it names no home
|
|
2625
|
+
// here. It runs inside the install that WROTE the inventory, and
|
|
2626
|
+
// that writer resolves the path through `inventory_path()` —
|
|
2627
|
+
// honouring `AGENT_CONFIG_DEPLOY_INVENTORY`, which names a FILE
|
|
2628
|
+
// rather than a home, and `EVENT4U_CONFIG_HOME`. Passing `home`
|
|
2629
|
+
// would take `defaultInventoryPath`'s stated-home branch and read
|
|
2630
|
+
// `<home>/.event4u/...`, a file nothing wrote under either
|
|
2631
|
+
// override, and the inventory evidence would be silently lost.
|
|
2632
|
+
// UNDEFINED IS LEFT UNDEFINED so `resolveLayerOwnership` applies
|
|
2633
|
+
// `defaultInventoryPath(home)` — the SAME resolution the report
|
|
2634
|
+
// uses. Hardcoding `inventory_path()` here made the two readers
|
|
2635
|
+
// step 1.2 exists to reconcile disagree for any home that is not
|
|
2636
|
+
// the asking process's: the receipt read one install's inventory
|
|
2637
|
+
// and then expanded its tilde-relative anchors against the OTHER
|
|
2638
|
+
// home, which is the cross-home misattribution two docstrings in
|
|
2639
|
+
// the resolver forbid. `defaultInventoryPath` already returns
|
|
2640
|
+
// `inventory_path()` when the stated home IS this process's, which
|
|
2641
|
+
// is the case that motivated the hardcode.
|
|
2642
|
+
inventoryPath: opts.inventoryPath,
|
|
2643
|
+
thisDeploy: opts.thisDeploy
|
|
2644
|
+
});
|
|
2827
2645
|
const layers = [];
|
|
2828
2646
|
for (const host of Object.keys(GLOBAL_RULE_DIRS).sort()) {
|
|
2829
2647
|
const dir = globalRuleLayerPath(host, home);
|
|
@@ -2831,7 +2649,8 @@ function installReceiptBudgetLines(packageRoot, home = os5.homedir()) {
|
|
|
2831
2649
|
layers.push(readLayer(host, "global", dir, recorded));
|
|
2832
2650
|
}
|
|
2833
2651
|
const rows = buildHostLimitRows(layers, loadHostInstructionLimits());
|
|
2834
|
-
|
|
2652
|
+
if (rows.length === 0) return [];
|
|
2653
|
+
return [` ${ownershipLine(sources)}`, ...renderHostLimitRows(rows).map((l) => ` ${l}`)];
|
|
2835
2654
|
} catch {
|
|
2836
2655
|
return [];
|
|
2837
2656
|
}
|
|
@@ -2878,7 +2697,7 @@ function resolveGlobalRuleScope(inputs) {
|
|
|
2878
2697
|
}
|
|
2879
2698
|
|
|
2880
2699
|
// src/scripts/_lib/lean_projection_mode.ts
|
|
2881
|
-
import * as
|
|
2700
|
+
import * as path16 from "node:path";
|
|
2882
2701
|
var DEFAULT_LEAN_PROJECTION_MODE = "eager-all";
|
|
2883
2702
|
function normalizeLeanProjectionMode(raw) {
|
|
2884
2703
|
const v = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
@@ -2926,8 +2745,8 @@ function thinsHost(mode, hosts, hostId) {
|
|
|
2926
2745
|
return writesThinFiles(mode) && hosts.includes(hostId);
|
|
2927
2746
|
}
|
|
2928
2747
|
function resolveLeanProjection(opts = {}) {
|
|
2929
|
-
const file = opts.settingsPath ??
|
|
2930
|
-
const tpl = opts.packageRoot == null ? null :
|
|
2748
|
+
const file = opts.settingsPath ?? path16.join(opts.projectRoot ?? process.cwd(), ".agent-settings.yml");
|
|
2749
|
+
const tpl = opts.packageRoot == null ? null : path16.join(opts.packageRoot, "src", "config", "agent-settings.template.yml");
|
|
2931
2750
|
let lean;
|
|
2932
2751
|
try {
|
|
2933
2752
|
lean = load_agent_settings(
|
|
@@ -2952,9 +2771,9 @@ function resolveLeanProjection(opts = {}) {
|
|
|
2952
2771
|
}
|
|
2953
2772
|
};
|
|
2954
2773
|
}
|
|
2955
|
-
var NO_TEMPLATE_LAYER =
|
|
2774
|
+
var NO_TEMPLATE_LAYER = path16.join(path16.sep, "dev", "null", "agent-config-absent-template.yml");
|
|
2956
2775
|
function rawExplicitLeanProjectionMode(opts = {}) {
|
|
2957
|
-
const file = opts.settingsPath ??
|
|
2776
|
+
const file = opts.settingsPath ?? path16.join(opts.projectRoot ?? process.cwd(), ".agent-settings.yml");
|
|
2958
2777
|
let lean;
|
|
2959
2778
|
try {
|
|
2960
2779
|
lean = load_agent_settings({ project_path: file, template_path: NO_TEMPLATE_LAYER })["lean_projection"];
|
|
@@ -2972,8 +2791,8 @@ function installerThinsHost(hostId, opts = {}) {
|
|
|
2972
2791
|
});
|
|
2973
2792
|
return modeExplicit && thinsHost(mode, hosts.hosts, hostId);
|
|
2974
2793
|
}
|
|
2975
|
-
var NO_PROJECT_LAYER =
|
|
2976
|
-
|
|
2794
|
+
var NO_PROJECT_LAYER = path16.join(
|
|
2795
|
+
path16.sep,
|
|
2977
2796
|
"dev",
|
|
2978
2797
|
"null",
|
|
2979
2798
|
"agent-config-absent-project-settings.yml"
|
|
@@ -4334,8 +4153,8 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
4334
4153
|
};
|
|
4335
4154
|
|
|
4336
4155
|
// src/scripts/_lib/module_detection.ts
|
|
4337
|
-
import * as
|
|
4338
|
-
import * as
|
|
4156
|
+
import * as fs16 from "node:fs";
|
|
4157
|
+
import * as path17 from "node:path";
|
|
4339
4158
|
var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
|
|
4340
4159
|
var _RULES = [
|
|
4341
4160
|
["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
|
|
@@ -4349,14 +4168,14 @@ var _RULES = [
|
|
|
4349
4168
|
];
|
|
4350
4169
|
function _isDir(p) {
|
|
4351
4170
|
try {
|
|
4352
|
-
return
|
|
4171
|
+
return fs16.statSync(p).isDirectory();
|
|
4353
4172
|
} catch {
|
|
4354
4173
|
return false;
|
|
4355
4174
|
}
|
|
4356
4175
|
}
|
|
4357
4176
|
function _isFile(p) {
|
|
4358
4177
|
try {
|
|
4359
|
-
return
|
|
4178
|
+
return fs16.statSync(p).isFile();
|
|
4360
4179
|
} catch {
|
|
4361
4180
|
return false;
|
|
4362
4181
|
}
|
|
@@ -4370,13 +4189,13 @@ function _isUpperChar(ch) {
|
|
|
4370
4189
|
function _list_module_subdirs(root) {
|
|
4371
4190
|
let entries;
|
|
4372
4191
|
try {
|
|
4373
|
-
entries =
|
|
4192
|
+
entries = fs16.readdirSync(root).sort();
|
|
4374
4193
|
} catch {
|
|
4375
4194
|
return [];
|
|
4376
4195
|
}
|
|
4377
4196
|
const out = [];
|
|
4378
4197
|
for (const name of entries) {
|
|
4379
|
-
if (!_isDir(
|
|
4198
|
+
if (!_isDir(path17.join(root, name))) {
|
|
4380
4199
|
continue;
|
|
4381
4200
|
}
|
|
4382
4201
|
if (name.startsWith(".")) {
|
|
@@ -4398,11 +4217,11 @@ function _score_confidence(stack, root, subdirs) {
|
|
|
4398
4217
|
return capitalized.length > 0 ? "high" : "medium";
|
|
4399
4218
|
}
|
|
4400
4219
|
if (stack === "node-monorepo") {
|
|
4401
|
-
const withPkgJson = subdirs.filter((name) => _isFile(
|
|
4220
|
+
const withPkgJson = subdirs.filter((name) => _isFile(path17.join(root, name, "package.json")));
|
|
4402
4221
|
return withPkgJson.length > 0 ? "high" : "medium";
|
|
4403
4222
|
}
|
|
4404
4223
|
if (stack === "python-src") {
|
|
4405
|
-
const withInit = subdirs.filter((name) => _isFile(
|
|
4224
|
+
const withInit = subdirs.filter((name) => _isFile(path17.join(root, name, "__init__.py")));
|
|
4406
4225
|
return withInit.length > 0 ? "high" : "medium";
|
|
4407
4226
|
}
|
|
4408
4227
|
if (stack === "go-internal") {
|
|
@@ -4414,7 +4233,7 @@ function detect_module_roots(project_root) {
|
|
|
4414
4233
|
const high = [];
|
|
4415
4234
|
const medium = [];
|
|
4416
4235
|
for (const [rel_path, stack, namespace_template] of _RULES) {
|
|
4417
|
-
const abs_path =
|
|
4236
|
+
const abs_path = path17.join(project_root, rel_path);
|
|
4418
4237
|
if (!_isDir(abs_path)) {
|
|
4419
4238
|
continue;
|
|
4420
4239
|
}
|
|
@@ -4436,7 +4255,7 @@ function detect_module_roots(project_root) {
|
|
|
4436
4255
|
}
|
|
4437
4256
|
|
|
4438
4257
|
// src/scripts/_lib/model_tier.ts
|
|
4439
|
-
import
|
|
4258
|
+
import fs17 from "node:fs";
|
|
4440
4259
|
var TIER_TO_CLAUDE_MODEL = {
|
|
4441
4260
|
frontier: "fable",
|
|
4442
4261
|
high: "opus",
|
|
@@ -4445,8 +4264,8 @@ var TIER_TO_CLAUDE_MODEL = {
|
|
|
4445
4264
|
};
|
|
4446
4265
|
var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
|
|
4447
4266
|
function read_model_tier(skill_md) {
|
|
4448
|
-
if (!
|
|
4449
|
-
const text =
|
|
4267
|
+
if (!fs17.existsSync(skill_md)) return null;
|
|
4268
|
+
const text = fs17.readFileSync(skill_md).toString("utf-8");
|
|
4450
4269
|
if (!text.startsWith("---\n")) return null;
|
|
4451
4270
|
const end = text.indexOf("\n---\n", 4);
|
|
4452
4271
|
if (end === -1) return null;
|
|
@@ -4462,15 +4281,15 @@ function render_native_model_md(text, tier) {
|
|
|
4462
4281
|
}
|
|
4463
4282
|
|
|
4464
4283
|
// src/install/paths.ts
|
|
4465
|
-
import { homedir as
|
|
4466
|
-
import { join as
|
|
4284
|
+
import { homedir as homedir8, tmpdir } from "node:os";
|
|
4285
|
+
import { join as join18 } from "node:path";
|
|
4467
4286
|
var INSTALL_ROOT_SUBPATH = ".event4u/agent-config";
|
|
4468
4287
|
var INSTALL_LOG_FILENAME = "install-log.jsonl";
|
|
4469
4288
|
function resolveHome(home) {
|
|
4470
4289
|
if (home && home.length > 0) {
|
|
4471
4290
|
return home;
|
|
4472
4291
|
}
|
|
4473
|
-
const fromOs =
|
|
4292
|
+
const fromOs = homedir8();
|
|
4474
4293
|
if (!fromOs) {
|
|
4475
4294
|
throw new Error(
|
|
4476
4295
|
"Cannot resolve home directory \u2014 both $HOME (POSIX) and $USERPROFILE (Windows) are unset."
|
|
@@ -4479,14 +4298,14 @@ function resolveHome(home) {
|
|
|
4479
4298
|
return fromOs;
|
|
4480
4299
|
}
|
|
4481
4300
|
function getInstallRoot(home) {
|
|
4482
|
-
return
|
|
4301
|
+
return join18(resolveHome(home), INSTALL_ROOT_SUBPATH);
|
|
4483
4302
|
}
|
|
4484
4303
|
function getLogPath(home) {
|
|
4485
|
-
return
|
|
4304
|
+
return join18(getInstallRoot(home), INSTALL_LOG_FILENAME);
|
|
4486
4305
|
}
|
|
4487
4306
|
|
|
4488
4307
|
// src/scripts/install.ts
|
|
4489
|
-
var
|
|
4308
|
+
var _HERE = fileURLToPath3(import.meta.url);
|
|
4490
4309
|
var SystemExitError = class extends Error {
|
|
4491
4310
|
constructor(code) {
|
|
4492
4311
|
super(`system-exit-${code}`);
|
|
@@ -4502,43 +4321,43 @@ var ArgparseExit = class extends Error {
|
|
|
4502
4321
|
code;
|
|
4503
4322
|
};
|
|
4504
4323
|
function expanduser3(p) {
|
|
4505
|
-
if (p === "~") return
|
|
4324
|
+
if (p === "~") return os7.homedir();
|
|
4506
4325
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
4507
|
-
return
|
|
4326
|
+
return path18.join(os7.homedir(), p.slice(2));
|
|
4508
4327
|
}
|
|
4509
4328
|
return p;
|
|
4510
4329
|
}
|
|
4511
4330
|
function isFile(p) {
|
|
4512
4331
|
try {
|
|
4513
|
-
return
|
|
4332
|
+
return fs18.statSync(p).isFile();
|
|
4514
4333
|
} catch {
|
|
4515
4334
|
return false;
|
|
4516
4335
|
}
|
|
4517
4336
|
}
|
|
4518
4337
|
function isDir(p) {
|
|
4519
4338
|
try {
|
|
4520
|
-
return
|
|
4339
|
+
return fs18.statSync(p).isDirectory();
|
|
4521
4340
|
} catch {
|
|
4522
4341
|
return false;
|
|
4523
4342
|
}
|
|
4524
4343
|
}
|
|
4525
4344
|
function isSymlink(p) {
|
|
4526
4345
|
try {
|
|
4527
|
-
return
|
|
4346
|
+
return fs18.lstatSync(p).isSymbolicLink();
|
|
4528
4347
|
} catch {
|
|
4529
4348
|
return false;
|
|
4530
4349
|
}
|
|
4531
4350
|
}
|
|
4532
4351
|
function readText(p) {
|
|
4533
|
-
return
|
|
4352
|
+
return fs18.readFileSync(p, "utf-8");
|
|
4534
4353
|
}
|
|
4535
4354
|
function writeText(p, content) {
|
|
4536
|
-
|
|
4355
|
+
fs18.writeFileSync(p, content, "utf-8");
|
|
4537
4356
|
}
|
|
4538
4357
|
function sortedGlobStems(directory, suffix) {
|
|
4539
4358
|
let entries;
|
|
4540
4359
|
try {
|
|
4541
|
-
entries =
|
|
4360
|
+
entries = fs18.readdirSync(directory);
|
|
4542
4361
|
} catch {
|
|
4543
4362
|
return [];
|
|
4544
4363
|
}
|
|
@@ -4558,34 +4377,34 @@ function sortedGlobStems(directory, suffix) {
|
|
|
4558
4377
|
function countZips(directory) {
|
|
4559
4378
|
if (!isDir(directory)) return 0;
|
|
4560
4379
|
let n = 0;
|
|
4561
|
-
for (const name of
|
|
4380
|
+
for (const name of fs18.readdirSync(directory)) {
|
|
4562
4381
|
if (name.endsWith(".zip")) n += 1;
|
|
4563
4382
|
}
|
|
4564
4383
|
return n;
|
|
4565
4384
|
}
|
|
4566
4385
|
function atomicWrite0644(target, body, prefix) {
|
|
4567
|
-
const dir =
|
|
4568
|
-
const tmpName =
|
|
4386
|
+
const dir = path18.dirname(target);
|
|
4387
|
+
const tmpName = path18.join(
|
|
4569
4388
|
dir,
|
|
4570
4389
|
`${prefix}${process2.pid}.${crypto5.randomBytes(6).toString("hex")}.yml.tmp`
|
|
4571
4390
|
);
|
|
4572
4391
|
let fd = null;
|
|
4573
4392
|
try {
|
|
4574
|
-
fd =
|
|
4575
|
-
|
|
4576
|
-
|
|
4393
|
+
fd = fs18.openSync(tmpName, "wx", 420);
|
|
4394
|
+
fs18.writeFileSync(fd, body, "utf-8");
|
|
4395
|
+
fs18.closeSync(fd);
|
|
4577
4396
|
fd = null;
|
|
4578
|
-
|
|
4579
|
-
|
|
4397
|
+
fs18.chmodSync(tmpName, 420);
|
|
4398
|
+
fs18.renameSync(tmpName, target);
|
|
4580
4399
|
} catch (err) {
|
|
4581
4400
|
if (fd !== null) {
|
|
4582
4401
|
try {
|
|
4583
|
-
|
|
4402
|
+
fs18.closeSync(fd);
|
|
4584
4403
|
} catch {
|
|
4585
4404
|
}
|
|
4586
4405
|
}
|
|
4587
4406
|
try {
|
|
4588
|
-
|
|
4407
|
+
fs18.unlinkSync(tmpName);
|
|
4589
4408
|
} catch {
|
|
4590
4409
|
}
|
|
4591
4410
|
throw err;
|
|
@@ -4620,12 +4439,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
|
|
|
4620
4439
|
var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
|
|
4621
4440
|
var SETTINGS_SUBDIR = ["agents", "settings"];
|
|
4622
4441
|
function _canonical_settings_target(project_root) {
|
|
4623
|
-
return
|
|
4442
|
+
return path18.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
|
|
4624
4443
|
}
|
|
4625
4444
|
function _resolve_settings_read(project_root) {
|
|
4626
4445
|
const canonical = _canonical_settings_target(project_root);
|
|
4627
4446
|
if (pathExists(canonical)) return canonical;
|
|
4628
|
-
const legacy =
|
|
4447
|
+
const legacy = path18.join(project_root, SETTINGS_FILE);
|
|
4629
4448
|
if (pathExists(legacy)) return legacy;
|
|
4630
4449
|
return canonical;
|
|
4631
4450
|
}
|
|
@@ -4635,15 +4454,10 @@ var LEGACY_RENAME_MAP = {
|
|
|
4635
4454
|
open_edited_files: "personal.open_edited_files",
|
|
4636
4455
|
user_name: "personal.user_name",
|
|
4637
4456
|
rtk_installed: "personal.rtk_installed",
|
|
4638
|
-
minimal_output: "personal.minimal_output",
|
|
4639
|
-
play_by_play: "personal.play_by_play",
|
|
4640
|
-
pr_comment_bot_icon: "project.pr_comment_bot_icon",
|
|
4641
|
-
pr_template: "project.pr_template",
|
|
4642
4457
|
upstream_repo: "project.upstream_repo",
|
|
4643
4458
|
improvement_pr_branch_prefix: "project.improvement_pr_branch_prefix",
|
|
4644
4459
|
github_pr_reply_method: "github.pr_reply_method",
|
|
4645
4460
|
eloquent_access_style: "eloquent.access_style",
|
|
4646
|
-
skill_improvement_pipeline: "pipelines.skill_improvement",
|
|
4647
4461
|
subagent_implementer_model: "subagents.implementer_model",
|
|
4648
4462
|
subagent_judge_model: "subagents.judge_model",
|
|
4649
4463
|
subagent_max_parallel: "subagents.max_parallel"
|
|
@@ -4691,9 +4505,9 @@ function fail(msg) {
|
|
|
4691
4505
|
throw new SystemExitError(1);
|
|
4692
4506
|
}
|
|
4693
4507
|
function detect_package_root(project_root) {
|
|
4694
|
-
const npm_path =
|
|
4508
|
+
const npm_path = path18.join(project_root, "node_modules", "@event4u", "agent-config");
|
|
4695
4509
|
if (isDir(npm_path)) return resolvePath(npm_path);
|
|
4696
|
-
if (pathExists(
|
|
4510
|
+
if (pathExists(path18.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
4697
4511
|
return project_root;
|
|
4698
4512
|
}
|
|
4699
4513
|
fail(
|
|
@@ -4701,12 +4515,12 @@ function detect_package_root(project_root) {
|
|
|
4701
4515
|
);
|
|
4702
4516
|
}
|
|
4703
4517
|
function detect_package_type(package_root) {
|
|
4704
|
-
if (package_root.split(
|
|
4518
|
+
if (package_root.split(path18.sep).includes("node_modules")) return "npm";
|
|
4705
4519
|
return "local";
|
|
4706
4520
|
}
|
|
4707
4521
|
function detect_package_type_for_project(project_root, package_root) {
|
|
4708
4522
|
const npm_path = resolvePath(
|
|
4709
|
-
|
|
4523
|
+
path18.join(project_root, "node_modules", "@event4u", "agent-config")
|
|
4710
4524
|
);
|
|
4711
4525
|
const package_resolved = resolvePath(package_root);
|
|
4712
4526
|
if (package_resolved === npm_path) return "npm";
|
|
@@ -4730,7 +4544,7 @@ function ensure_directory(p) {
|
|
|
4730
4544
|
mkdirp(p);
|
|
4731
4545
|
}
|
|
4732
4546
|
function write_file(p, content) {
|
|
4733
|
-
ensure_directory(
|
|
4547
|
+
ensure_directory(path18.dirname(p));
|
|
4734
4548
|
writeText(p, content);
|
|
4735
4549
|
}
|
|
4736
4550
|
function read_json_file(p) {
|
|
@@ -4857,7 +4671,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
|
|
|
4857
4671
|
return rendered + "\n" + suffix;
|
|
4858
4672
|
}
|
|
4859
4673
|
function _migrate_legacy_if_present(project_root, template_body) {
|
|
4860
|
-
const legacy_target =
|
|
4674
|
+
const legacy_target = path18.join(project_root, LEGACY_SETTINGS_FILE);
|
|
4861
4675
|
if (!isFile(legacy_target)) return null;
|
|
4862
4676
|
const legacy_text = readText(legacy_target);
|
|
4863
4677
|
const [values, unknown] = _parse_legacy_settings(legacy_text);
|
|
@@ -4872,9 +4686,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
|
|
|
4872
4686
|
}
|
|
4873
4687
|
}
|
|
4874
4688
|
rendered = _append_unknown_legacy(rendered, values, unknown);
|
|
4875
|
-
const backup_target =
|
|
4689
|
+
const backup_target = path18.join(project_root, LEGACY_BACKUP_FILE);
|
|
4876
4690
|
writeText(backup_target, legacy_text);
|
|
4877
|
-
|
|
4691
|
+
fs18.unlinkSync(legacy_target);
|
|
4878
4692
|
info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
|
|
4879
4693
|
info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
|
|
4880
4694
|
if (unknown.length > 0) {
|
|
@@ -4909,7 +4723,7 @@ function _render_template(template, profile_values) {
|
|
|
4909
4723
|
return body;
|
|
4910
4724
|
}
|
|
4911
4725
|
function _load_valid_user_types(package_root) {
|
|
4912
|
-
const directory =
|
|
4726
|
+
const directory = path18.join(package_root, USER_TYPES_DIR);
|
|
4913
4727
|
if (!isDir(directory)) return [];
|
|
4914
4728
|
return sortedGlobStems(directory, ".yml");
|
|
4915
4729
|
}
|
|
@@ -4966,8 +4780,8 @@ function splitlinesKeepends(text) {
|
|
|
4966
4780
|
}
|
|
4967
4781
|
function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
|
|
4968
4782
|
const target = _canonical_settings_target(project_root);
|
|
4969
|
-
const profile_source =
|
|
4970
|
-
const template_source =
|
|
4783
|
+
const profile_source = path18.join(package_root, "src", "config", "profiles", `${profile}.ini`);
|
|
4784
|
+
const template_source = path18.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
4971
4785
|
if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
|
|
4972
4786
|
if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
|
|
4973
4787
|
const template = readText(template_source);
|
|
@@ -4981,21 +4795,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
4981
4795
|
if (profile_values["rule_loading_tier"] !== profile) {
|
|
4982
4796
|
const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
|
|
4983
4797
|
fail(
|
|
4984
|
-
`Profile preset ${
|
|
4798
|
+
`Profile preset ${path18.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
|
|
4985
4799
|
);
|
|
4986
4800
|
}
|
|
4987
4801
|
profile_values["user_type"] = _validate_user_type(package_root, user_type);
|
|
4988
4802
|
let template_body = _render_template(template, profile_values);
|
|
4989
4803
|
template_body = _inject_packs(template_body, packs ?? []);
|
|
4990
|
-
const legacy_root =
|
|
4804
|
+
const legacy_root = path18.join(project_root, SETTINGS_FILE);
|
|
4991
4805
|
if (isFile(legacy_root) && !pathExists(target)) {
|
|
4992
|
-
mkdirp(
|
|
4806
|
+
mkdirp(path18.dirname(target));
|
|
4993
4807
|
writeText(target, readText(legacy_root));
|
|
4994
|
-
|
|
4808
|
+
fs18.unlinkSync(legacy_root);
|
|
4995
4809
|
success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
|
|
4996
4810
|
return;
|
|
4997
4811
|
}
|
|
4998
|
-
const legacy_target =
|
|
4812
|
+
const legacy_target = path18.join(project_root, LEGACY_SETTINGS_FILE);
|
|
4999
4813
|
if (isFile(legacy_target) && pathExists(target)) {
|
|
5000
4814
|
warn(
|
|
5001
4815
|
`Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
|
|
@@ -5012,7 +4826,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
|
|
|
5012
4826
|
skip(`${SETTINGS_FILE} already exists`);
|
|
5013
4827
|
return;
|
|
5014
4828
|
}
|
|
5015
|
-
mkdirp(
|
|
4829
|
+
mkdirp(path18.dirname(target));
|
|
5016
4830
|
write_file(target, template_body);
|
|
5017
4831
|
const user_type_value = profile_values["user_type"] ?? "";
|
|
5018
4832
|
const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
|
|
@@ -5025,7 +4839,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
5025
4839
|
const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
|
|
5026
4840
|
const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
|
|
5027
4841
|
return merge_json_file(
|
|
5028
|
-
|
|
4842
|
+
path18.join(project_root, ".vscode", "settings.json"),
|
|
5029
4843
|
bridge,
|
|
5030
4844
|
force,
|
|
5031
4845
|
".vscode/settings.json"
|
|
@@ -5034,14 +4848,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
|
|
|
5034
4848
|
function ensure_augment_bridge(project_root, force) {
|
|
5035
4849
|
const bridge = { enabledPlugins: { "agent-config@event4u": true } };
|
|
5036
4850
|
return merge_json_file(
|
|
5037
|
-
|
|
4851
|
+
path18.join(project_root, ".augment", "settings.json"),
|
|
5038
4852
|
bridge,
|
|
5039
4853
|
force,
|
|
5040
4854
|
".augment/settings.json"
|
|
5041
4855
|
);
|
|
5042
4856
|
}
|
|
5043
|
-
var AUGMENT_USER_DIR =
|
|
5044
|
-
var AUGMENT_USER_HOOKS_DIR =
|
|
4857
|
+
var AUGMENT_USER_DIR = path18.join(os7.homedir(), ".augment");
|
|
4858
|
+
var AUGMENT_USER_HOOKS_DIR = path18.join(AUGMENT_USER_DIR, "hooks");
|
|
5045
4859
|
var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
|
|
5046
4860
|
var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
5047
4861
|
"augment-chat-history.sh",
|
|
@@ -5050,29 +4864,29 @@ var AUGMENT_LEGACY_TRAMPOLINES = [
|
|
|
5050
4864
|
"augment-context-hygiene.sh"
|
|
5051
4865
|
];
|
|
5052
4866
|
function _deploy_augment_trampoline(package_root, name, force) {
|
|
5053
|
-
const src =
|
|
4867
|
+
const src = path18.join(package_root, "scripts", "hooks", name);
|
|
5054
4868
|
if (!pathExists(src)) {
|
|
5055
4869
|
skip(`augment trampoline missing in package: ${src}`);
|
|
5056
4870
|
return null;
|
|
5057
4871
|
}
|
|
5058
4872
|
mkdirp(AUGMENT_USER_HOOKS_DIR);
|
|
5059
|
-
const dst =
|
|
4873
|
+
const dst = path18.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
5060
4874
|
const src_text = readText(src);
|
|
5061
4875
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
5062
4876
|
skip(`~/.augment/hooks/${name} already up to date`);
|
|
5063
4877
|
} else {
|
|
5064
4878
|
writeText(dst, src_text);
|
|
5065
|
-
|
|
4879
|
+
fs18.chmodSync(dst, 493);
|
|
5066
4880
|
success(`~/.augment/hooks/${name} installed`);
|
|
5067
4881
|
}
|
|
5068
4882
|
return dst;
|
|
5069
4883
|
}
|
|
5070
4884
|
function _remove_legacy_augment_trampolines() {
|
|
5071
4885
|
for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
|
|
5072
|
-
const legacy =
|
|
4886
|
+
const legacy = path18.join(AUGMENT_USER_HOOKS_DIR, name);
|
|
5073
4887
|
try {
|
|
5074
4888
|
if (isFile(legacy)) {
|
|
5075
|
-
|
|
4889
|
+
fs18.unlinkSync(legacy);
|
|
5076
4890
|
skip(`removed legacy ~/.augment/hooks/${name}`);
|
|
5077
4891
|
}
|
|
5078
4892
|
} catch (err) {
|
|
@@ -5092,7 +4906,7 @@ function ensure_augment_user_hooks(package_root, force) {
|
|
|
5092
4906
|
}
|
|
5093
4907
|
const settings_patch = { hooks: per_event };
|
|
5094
4908
|
return merge_json_file(
|
|
5095
|
-
|
|
4909
|
+
path18.join(AUGMENT_USER_DIR, "settings.json"),
|
|
5096
4910
|
settings_patch,
|
|
5097
4911
|
force,
|
|
5098
4912
|
"~/.augment/settings.json"
|
|
@@ -5117,7 +4931,7 @@ function _heal_legacy_claude_plugin_ids(p) {
|
|
|
5117
4931
|
return removed;
|
|
5118
4932
|
}
|
|
5119
4933
|
function ensure_claude_bridge(project_root, force) {
|
|
5120
|
-
const target =
|
|
4934
|
+
const target = path18.join(project_root, ".claude", "settings.json");
|
|
5121
4935
|
const healed = _heal_legacy_claude_plugin_ids(target);
|
|
5122
4936
|
for (const pid of healed) success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
|
|
5123
4937
|
const bridge = withHostEnv({ enabledPlugins: { [CLAUDE_PLUGIN_ID]: true } }, project_root, success);
|
|
@@ -5135,29 +4949,29 @@ function ensure_cursor_bridge(project_root, force) {
|
|
|
5135
4949
|
}
|
|
5136
4950
|
const bridge = { version: 1, hooks };
|
|
5137
4951
|
return merge_json_file(
|
|
5138
|
-
|
|
4952
|
+
path18.join(project_root, ".cursor", "hooks.json"),
|
|
5139
4953
|
bridge,
|
|
5140
4954
|
force,
|
|
5141
4955
|
".cursor/hooks.json"
|
|
5142
4956
|
);
|
|
5143
4957
|
}
|
|
5144
|
-
var CURSOR_USER_DIR =
|
|
5145
|
-
var CURSOR_USER_HOOKS_DIR =
|
|
4958
|
+
var CURSOR_USER_DIR = path18.join(os7.homedir(), ".cursor");
|
|
4959
|
+
var CURSOR_USER_HOOKS_DIR = path18.join(CURSOR_USER_DIR, "hooks");
|
|
5146
4960
|
var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
|
|
5147
4961
|
function ensure_cursor_user_hooks(package_root, force) {
|
|
5148
|
-
const src =
|
|
4962
|
+
const src = path18.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
|
|
5149
4963
|
if (!pathExists(src)) {
|
|
5150
4964
|
skip(`cursor trampoline missing in package: ${src}`);
|
|
5151
4965
|
return [];
|
|
5152
4966
|
}
|
|
5153
4967
|
mkdirp(CURSOR_USER_HOOKS_DIR);
|
|
5154
|
-
const dst =
|
|
4968
|
+
const dst = path18.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
|
|
5155
4969
|
const src_text = readText(src);
|
|
5156
4970
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
5157
4971
|
skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
5158
4972
|
} else {
|
|
5159
4973
|
writeText(dst, src_text);
|
|
5160
|
-
|
|
4974
|
+
fs18.chmodSync(dst, 493);
|
|
5161
4975
|
success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
|
|
5162
4976
|
}
|
|
5163
4977
|
const hooks = {};
|
|
@@ -5166,7 +4980,7 @@ function ensure_cursor_user_hooks(package_root, force) {
|
|
|
5166
4980
|
}
|
|
5167
4981
|
const settings_patch = { version: 1, hooks };
|
|
5168
4982
|
return merge_json_file(
|
|
5169
|
-
|
|
4983
|
+
path18.join(CURSOR_USER_DIR, "hooks.json"),
|
|
5170
4984
|
settings_patch,
|
|
5171
4985
|
force,
|
|
5172
4986
|
"~/.cursor/hooks.json"
|
|
@@ -5201,12 +5015,12 @@ exit 0
|
|
|
5201
5015
|
`;
|
|
5202
5016
|
}
|
|
5203
5017
|
function ensure_cline_bridge(project_root, force) {
|
|
5204
|
-
const hooks_dir =
|
|
5018
|
+
const hooks_dir = path18.join(project_root, ".clinerules", "hooks");
|
|
5205
5019
|
mkdirp(hooks_dir);
|
|
5206
5020
|
const workspace_quoted = shlexQuote(resolvePath(project_root));
|
|
5207
5021
|
let written = 0;
|
|
5208
5022
|
for (const { slot, native } of hostBindings("cline")) {
|
|
5209
|
-
const target =
|
|
5023
|
+
const target = path18.join(hooks_dir, native);
|
|
5210
5024
|
const body = clineProjectHookBody(native, slot, workspace_quoted);
|
|
5211
5025
|
if (pathExists(target) && readText(target) === body && !force) {
|
|
5212
5026
|
continue;
|
|
@@ -5216,7 +5030,7 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
5216
5030
|
continue;
|
|
5217
5031
|
}
|
|
5218
5032
|
writeText(target, body);
|
|
5219
|
-
|
|
5033
|
+
fs18.chmodSync(target, 493);
|
|
5220
5034
|
written += 1;
|
|
5221
5035
|
}
|
|
5222
5036
|
if (written) {
|
|
@@ -5225,27 +5039,27 @@ function ensure_cline_bridge(project_root, force) {
|
|
|
5225
5039
|
skip(".clinerules/hooks/ already up to date");
|
|
5226
5040
|
}
|
|
5227
5041
|
}
|
|
5228
|
-
var CLINE_USER_DIR =
|
|
5042
|
+
var CLINE_USER_DIR = path18.join(os7.homedir(), "Documents", "Cline", "Hooks");
|
|
5229
5043
|
var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
|
|
5230
5044
|
function ensure_cline_user_hooks(package_root, force) {
|
|
5231
|
-
const src =
|
|
5045
|
+
const src = path18.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
|
|
5232
5046
|
if (!pathExists(src)) {
|
|
5233
5047
|
skip(`cline trampoline missing in package: ${src}`);
|
|
5234
5048
|
return;
|
|
5235
5049
|
}
|
|
5236
5050
|
mkdirp(CLINE_USER_DIR);
|
|
5237
|
-
const trampoline =
|
|
5051
|
+
const trampoline = path18.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
|
|
5238
5052
|
const src_text = readText(src);
|
|
5239
5053
|
if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
|
|
5240
5054
|
skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
5241
5055
|
} else {
|
|
5242
5056
|
writeText(trampoline, src_text);
|
|
5243
|
-
|
|
5057
|
+
fs18.chmodSync(trampoline, 493);
|
|
5244
5058
|
success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
|
|
5245
5059
|
}
|
|
5246
5060
|
const trampoline_quoted = shlexQuote(trampoline);
|
|
5247
5061
|
for (const { slot, native } of hostBindings("cline")) {
|
|
5248
|
-
const wrapper =
|
|
5062
|
+
const wrapper = path18.join(CLINE_USER_DIR, native);
|
|
5249
5063
|
const body = `#!/usr/bin/env bash
|
|
5250
5064
|
# Generated by event4u/agent-config \u2014 DO NOT EDIT.
|
|
5251
5065
|
# User-scope Cline hook for ${native} \u2192 agent-config ${slot}.
|
|
@@ -5255,7 +5069,7 @@ exec ${trampoline_quoted} ${slot} ${native}
|
|
|
5255
5069
|
continue;
|
|
5256
5070
|
}
|
|
5257
5071
|
writeText(wrapper, body);
|
|
5258
|
-
|
|
5072
|
+
fs18.chmodSync(wrapper, 493);
|
|
5259
5073
|
}
|
|
5260
5074
|
}
|
|
5261
5075
|
function _windsurf_dispatch_command(ac_event, native) {
|
|
@@ -5271,29 +5085,29 @@ function ensure_windsurf_bridge(project_root, force) {
|
|
|
5271
5085
|
}
|
|
5272
5086
|
const bridge = { hooks };
|
|
5273
5087
|
return merge_json_file(
|
|
5274
|
-
|
|
5088
|
+
path18.join(project_root, ".windsurf", "hooks.json"),
|
|
5275
5089
|
bridge,
|
|
5276
5090
|
force,
|
|
5277
5091
|
".windsurf/hooks.json"
|
|
5278
5092
|
);
|
|
5279
5093
|
}
|
|
5280
|
-
var WINDSURF_USER_DIR =
|
|
5281
|
-
var WINDSURF_USER_HOOKS_DIR =
|
|
5094
|
+
var WINDSURF_USER_DIR = path18.join(os7.homedir(), ".codeium", "windsurf");
|
|
5095
|
+
var WINDSURF_USER_HOOKS_DIR = path18.join(WINDSURF_USER_DIR, "hooks");
|
|
5282
5096
|
var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
|
|
5283
5097
|
function ensure_windsurf_user_hooks(package_root, force) {
|
|
5284
|
-
const src =
|
|
5098
|
+
const src = path18.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
5285
5099
|
if (!pathExists(src)) {
|
|
5286
5100
|
skip(`windsurf trampoline missing in package: ${src}`);
|
|
5287
5101
|
return [];
|
|
5288
5102
|
}
|
|
5289
5103
|
mkdirp(WINDSURF_USER_HOOKS_DIR);
|
|
5290
|
-
const dst =
|
|
5104
|
+
const dst = path18.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
|
|
5291
5105
|
const src_text = readText(src);
|
|
5292
5106
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
5293
5107
|
skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
5294
5108
|
} else {
|
|
5295
5109
|
writeText(dst, src_text);
|
|
5296
|
-
|
|
5110
|
+
fs18.chmodSync(dst, 493);
|
|
5297
5111
|
success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
|
|
5298
5112
|
}
|
|
5299
5113
|
const hooks = {};
|
|
@@ -5305,7 +5119,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
|
|
|
5305
5119
|
}
|
|
5306
5120
|
const settings_patch = { hooks };
|
|
5307
5121
|
return merge_json_file(
|
|
5308
|
-
|
|
5122
|
+
path18.join(WINDSURF_USER_DIR, "hooks.json"),
|
|
5309
5123
|
settings_patch,
|
|
5310
5124
|
force,
|
|
5311
5125
|
"~/.codeium/windsurf/hooks.json"
|
|
@@ -5327,43 +5141,43 @@ function _gemini_hooks_dict(command_factory) {
|
|
|
5327
5141
|
function ensure_gemini_bridge(project_root, force) {
|
|
5328
5142
|
const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
|
|
5329
5143
|
return merge_json_file(
|
|
5330
|
-
|
|
5144
|
+
path18.join(project_root, ".gemini", "settings.json"),
|
|
5331
5145
|
bridge,
|
|
5332
5146
|
force,
|
|
5333
5147
|
".gemini/settings.json"
|
|
5334
5148
|
);
|
|
5335
5149
|
}
|
|
5336
|
-
var GEMINI_USER_DIR =
|
|
5337
|
-
var GEMINI_USER_HOOKS_DIR =
|
|
5150
|
+
var GEMINI_USER_DIR = path18.join(os7.homedir(), ".gemini");
|
|
5151
|
+
var GEMINI_USER_HOOKS_DIR = path18.join(GEMINI_USER_DIR, "hooks");
|
|
5338
5152
|
var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
|
|
5339
5153
|
function ensure_gemini_user_hooks(package_root, force) {
|
|
5340
|
-
const src =
|
|
5154
|
+
const src = path18.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
|
|
5341
5155
|
if (!pathExists(src)) {
|
|
5342
5156
|
skip(`gemini trampoline missing in package: ${src}`);
|
|
5343
5157
|
return [];
|
|
5344
5158
|
}
|
|
5345
5159
|
mkdirp(GEMINI_USER_HOOKS_DIR);
|
|
5346
|
-
const dst =
|
|
5160
|
+
const dst = path18.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
|
|
5347
5161
|
const src_text = readText(src);
|
|
5348
5162
|
if (pathExists(dst) && readText(dst) === src_text && !force) {
|
|
5349
5163
|
skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
|
|
5350
5164
|
} else {
|
|
5351
5165
|
writeText(dst, src_text);
|
|
5352
|
-
|
|
5166
|
+
fs18.chmodSync(dst, 493);
|
|
5353
5167
|
success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
|
|
5354
5168
|
}
|
|
5355
5169
|
const settings_patch = {
|
|
5356
5170
|
hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
|
|
5357
5171
|
};
|
|
5358
5172
|
return merge_json_file(
|
|
5359
|
-
|
|
5173
|
+
path18.join(GEMINI_USER_DIR, "settings.json"),
|
|
5360
5174
|
settings_patch,
|
|
5361
5175
|
force,
|
|
5362
5176
|
"~/.gemini/settings.json"
|
|
5363
5177
|
);
|
|
5364
5178
|
}
|
|
5365
5179
|
function ensure_copilot_bridge(project_root, force) {
|
|
5366
|
-
const target =
|
|
5180
|
+
const target = path18.join(project_root, ".github", "plugin", "marketplace.json");
|
|
5367
5181
|
const bridge = {
|
|
5368
5182
|
marketplace: {
|
|
5369
5183
|
name: "event4u-agent-marketplace",
|
|
@@ -5406,7 +5220,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
|
|
|
5406
5220
|
Run \`./agent-config --help\` for available commands.
|
|
5407
5221
|
`;
|
|
5408
5222
|
function ensure_roocode_bridge(project_root, force) {
|
|
5409
|
-
const target =
|
|
5223
|
+
const target = path18.join(project_root, ".roo", "rules", "agent-config.md");
|
|
5410
5224
|
if (pathExists(target) && !force) {
|
|
5411
5225
|
skip(".roo/rules/agent-config.md already exists");
|
|
5412
5226
|
return;
|
|
@@ -5428,7 +5242,7 @@ To wire Claude Desktop to this project's rules, run:
|
|
|
5428
5242
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
5429
5243
|
`;
|
|
5430
5244
|
function ensure_claude_desktop_bridge(project_root, force) {
|
|
5431
|
-
const target =
|
|
5245
|
+
const target = path18.join(project_root, ".claude-desktop", "agent-config.md");
|
|
5432
5246
|
if (pathExists(target) && !force) {
|
|
5433
5247
|
skip(".claude-desktop/agent-config.md already exists");
|
|
5434
5248
|
return;
|
|
@@ -5453,7 +5267,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
|
|
|
5453
5267
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
5454
5268
|
`;
|
|
5455
5269
|
function ensure_aider_bridge(project_root, force) {
|
|
5456
|
-
const target =
|
|
5270
|
+
const target = path18.join(project_root, ".aider", "agent-config.md");
|
|
5457
5271
|
if (pathExists(target) && !force) {
|
|
5458
5272
|
skip(".aider/agent-config.md already exists");
|
|
5459
5273
|
return;
|
|
@@ -5472,7 +5286,7 @@ developers where the rules and skills live.
|
|
|
5472
5286
|
Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
|
|
5473
5287
|
`;
|
|
5474
5288
|
function ensure_codex_bridge(project_root, force) {
|
|
5475
|
-
const target =
|
|
5289
|
+
const target = path18.join(project_root, ".codex", "agent-config.md");
|
|
5476
5290
|
if (pathExists(target) && !force) {
|
|
5477
5291
|
skip(".codex/agent-config.md already exists");
|
|
5478
5292
|
return;
|
|
@@ -5490,7 +5304,7 @@ rules per session. The canonical rule and skill source lives under
|
|
|
5490
5304
|
orientation).
|
|
5491
5305
|
`;
|
|
5492
5306
|
function ensure_continue_bridge(project_root, force) {
|
|
5493
|
-
const target =
|
|
5307
|
+
const target = path18.join(project_root, ".continue", "rules", "agent-config.md");
|
|
5494
5308
|
if (pathExists(target) && !force) {
|
|
5495
5309
|
skip(".continue/rules/agent-config.md already exists");
|
|
5496
5310
|
return;
|
|
@@ -5521,7 +5335,7 @@ orientation).
|
|
|
5521
5335
|
See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
|
|
5522
5336
|
`;
|
|
5523
5337
|
function ensure_kilocode_bridge(project_root, force) {
|
|
5524
|
-
const target =
|
|
5338
|
+
const target = path18.join(project_root, ".kilocode", "rules", "agent-config.md");
|
|
5525
5339
|
if (pathExists(target) && !force) {
|
|
5526
5340
|
skip(".kilocode/rules/agent-config.md already exists");
|
|
5527
5341
|
return;
|
|
@@ -5548,7 +5362,7 @@ canonical source (or symlink it):
|
|
|
5548
5362
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
5549
5363
|
`;
|
|
5550
5364
|
function ensure_zed_bridge(project_root, force) {
|
|
5551
|
-
const target =
|
|
5365
|
+
const target = path18.join(project_root, ".zed", "agent-config.md");
|
|
5552
5366
|
if (pathExists(target) && !force) {
|
|
5553
5367
|
skip(".zed/agent-config.md already exists");
|
|
5554
5368
|
return;
|
|
@@ -5569,7 +5383,7 @@ rules into your JetBrains profile.
|
|
|
5569
5383
|
Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
|
|
5570
5384
|
`;
|
|
5571
5385
|
function ensure_jetbrains_bridge(project_root, force) {
|
|
5572
|
-
const target =
|
|
5386
|
+
const target = path18.join(project_root, ".jetbrains", "agent-config.md");
|
|
5573
5387
|
if (pathExists(target) && !force) {
|
|
5574
5388
|
skip(".jetbrains/agent-config.md already exists");
|
|
5575
5389
|
return;
|
|
@@ -5600,7 +5414,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
|
|
|
5600
5414
|
See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
|
|
5601
5415
|
`;
|
|
5602
5416
|
function ensure_kiro_bridge(project_root, force) {
|
|
5603
|
-
const target =
|
|
5417
|
+
const target = path18.join(project_root, ".kiro", "steering", "agent-config.md");
|
|
5604
5418
|
if (pathExists(target) && !force) {
|
|
5605
5419
|
skip(".kiro/steering/agent-config.md already exists");
|
|
5606
5420
|
return;
|
|
@@ -5637,35 +5451,35 @@ var SMOKE_BRIDGE_PATHS = {
|
|
|
5637
5451
|
};
|
|
5638
5452
|
function dirHasEntries(p) {
|
|
5639
5453
|
try {
|
|
5640
|
-
return
|
|
5454
|
+
return fs18.readdirSync(p).length > 0;
|
|
5641
5455
|
} catch {
|
|
5642
5456
|
return false;
|
|
5643
5457
|
}
|
|
5644
5458
|
}
|
|
5645
5459
|
function _resolve_tsx_invocation(scriptPath, scriptArgs) {
|
|
5646
5460
|
const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
|
|
5647
|
-
let dir =
|
|
5461
|
+
let dir = path18.dirname(scriptPath);
|
|
5648
5462
|
for (; ; ) {
|
|
5649
|
-
const candidate =
|
|
5463
|
+
const candidate = path18.join(dir, "node_modules", ".bin", binName);
|
|
5650
5464
|
if (isFile(candidate)) {
|
|
5651
5465
|
return { command: candidate, args: [scriptPath, ...scriptArgs] };
|
|
5652
5466
|
}
|
|
5653
|
-
const parent =
|
|
5467
|
+
const parent = path18.dirname(dir);
|
|
5654
5468
|
if (parent === dir) break;
|
|
5655
5469
|
dir = parent;
|
|
5656
5470
|
}
|
|
5657
5471
|
return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
|
|
5658
5472
|
}
|
|
5659
5473
|
function _smoke_test_hooks(project_root, package_root) {
|
|
5660
|
-
const dispatcher =
|
|
5661
|
-
const manifest =
|
|
5474
|
+
const dispatcher = path18.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
|
|
5475
|
+
const manifest = path18.join(package_root, "scripts", "hook_manifest.yaml");
|
|
5662
5476
|
if (!isFile(dispatcher) || !isFile(manifest)) return 0;
|
|
5663
5477
|
const failed = [];
|
|
5664
5478
|
const skipped = [];
|
|
5665
5479
|
const passed = [];
|
|
5666
5480
|
for (const [platform, native] of smokeProbeEvents()) {
|
|
5667
5481
|
const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
|
|
5668
|
-
const bridge_path = rel_bridge ?
|
|
5482
|
+
const bridge_path = rel_bridge ? path18.join(project_root, rel_bridge) : null;
|
|
5669
5483
|
const bridge_present = Boolean(
|
|
5670
5484
|
bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
|
|
5671
5485
|
);
|
|
@@ -5824,9 +5638,9 @@ To remove this marker, delete this file.
|
|
|
5824
5638
|
`;
|
|
5825
5639
|
}
|
|
5826
5640
|
var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
|
|
5827
|
-
var GLOBAL_ROOT =
|
|
5828
|
-
var GLOBAL_USER_SETTINGS_PATH =
|
|
5829
|
-
var GLOBAL_AGENT_SETTINGS_PATH =
|
|
5641
|
+
var GLOBAL_ROOT = path18.join(os7.homedir(), ".event4u", "agent-config");
|
|
5642
|
+
var GLOBAL_USER_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-user.yml");
|
|
5643
|
+
var GLOBAL_AGENT_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-settings.yml");
|
|
5830
5644
|
function _bridge_marker(tool_id, scope) {
|
|
5831
5645
|
if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
|
|
5832
5646
|
return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
|
|
@@ -5875,7 +5689,7 @@ function _load_yaml_doc(p) {
|
|
|
5875
5689
|
return isPlainObject(data) ? data : {};
|
|
5876
5690
|
}
|
|
5877
5691
|
function _load_default_settings(package_root) {
|
|
5878
|
-
const template_source =
|
|
5692
|
+
const template_source = path18.join(package_root, "src", "config", "agent-settings.template.yml");
|
|
5879
5693
|
if (!pathExists(template_source)) return {};
|
|
5880
5694
|
let text;
|
|
5881
5695
|
try {
|
|
@@ -5889,11 +5703,11 @@ function _load_default_settings(package_root) {
|
|
|
5889
5703
|
}
|
|
5890
5704
|
var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
|
|
5891
5705
|
function _suppress_rule_layer(project_root, suppress_dir) {
|
|
5892
|
-
const target =
|
|
5706
|
+
const target = path18.join(project_root, ".claude", "settings.local.json");
|
|
5893
5707
|
const existing = pathExists(target) ? read_json_file(target) : {};
|
|
5894
5708
|
let real_dir = suppress_dir;
|
|
5895
5709
|
try {
|
|
5896
|
-
real_dir =
|
|
5710
|
+
real_dir = fs18.realpathSync(suppress_dir);
|
|
5897
5711
|
} catch {
|
|
5898
5712
|
real_dir = suppress_dir;
|
|
5899
5713
|
}
|
|
@@ -5992,9 +5806,9 @@ function detect_scope(cwd) {
|
|
|
5992
5806
|
if (pathExists(_resolve_settings_read(cwd))) {
|
|
5993
5807
|
return ["project", `existing ${SETTINGS_FILE}`];
|
|
5994
5808
|
}
|
|
5995
|
-
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(
|
|
5996
|
-
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(
|
|
5997
|
-
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(
|
|
5809
|
+
const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path18.join(cwd, m))) ?? null;
|
|
5810
|
+
const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path18.join(cwd, d))) ?? null;
|
|
5811
|
+
const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path18.join(cwd, f))) ?? null;
|
|
5998
5812
|
if (has_manifest && (has_ai_dir || has_ai_file)) {
|
|
5999
5813
|
const marker = has_ai_dir || has_ai_file;
|
|
6000
5814
|
return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
|
|
@@ -6015,7 +5829,7 @@ function readLineSyncRaw(promptText) {
|
|
|
6015
5829
|
for (; ; ) {
|
|
6016
5830
|
let n;
|
|
6017
5831
|
try {
|
|
6018
|
-
n =
|
|
5832
|
+
n = fs18.readSync(0, buf, 0, 1, null);
|
|
6019
5833
|
} catch (err) {
|
|
6020
5834
|
const code = err.code;
|
|
6021
5835
|
if (code === "EAGAIN") {
|
|
@@ -6098,26 +5912,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
|
|
|
6098
5912
|
}
|
|
6099
5913
|
write_manifest(target, version, entries);
|
|
6100
5914
|
if (!state.QUIET) {
|
|
6101
|
-
const rel = isRelativeTo(target, project_root) ?
|
|
5915
|
+
const rel = isRelativeTo(target, project_root) ? path18.relative(project_root, target) : target;
|
|
6102
5916
|
info(`Manifest updated: ${rel}`);
|
|
6103
5917
|
}
|
|
6104
5918
|
return 0;
|
|
6105
5919
|
}
|
|
6106
5920
|
function isRelativeTo(child, parent) {
|
|
6107
|
-
const rel =
|
|
6108
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
5921
|
+
const rel = path18.relative(parent, child);
|
|
5922
|
+
return rel === "" || !rel.startsWith("..") && !path18.isAbsolute(rel);
|
|
6109
5923
|
}
|
|
6110
5924
|
function _resolve_package_root_for_global() {
|
|
6111
|
-
const here = resolvePath(
|
|
6112
|
-
const candidate =
|
|
6113
|
-
if (!pathExists(
|
|
5925
|
+
const here = resolvePath(_HERE);
|
|
5926
|
+
const candidate = path18.dirname(path18.dirname(path18.dirname(here)));
|
|
5927
|
+
if (!pathExists(path18.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
|
|
6114
5928
|
fail(
|
|
6115
5929
|
`Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
|
|
6116
5930
|
);
|
|
6117
5931
|
}
|
|
6118
5932
|
return candidate;
|
|
6119
5933
|
}
|
|
6120
|
-
var CONSUMER_BRIDGE_MARKER_RELPATH =
|
|
5934
|
+
var CONSUMER_BRIDGE_MARKER_RELPATH = path18.join("agents", ".event4u-bridge.yml");
|
|
6121
5935
|
var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
|
|
6122
5936
|
var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
|
|
6123
5937
|
var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
|
|
@@ -6125,7 +5939,7 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
6125
5939
|
if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
|
|
6126
5940
|
return [false, "consumer-mode-override"];
|
|
6127
5941
|
}
|
|
6128
|
-
const pkg_json =
|
|
5942
|
+
const pkg_json = path18.join(project_root, "package.json");
|
|
6129
5943
|
if (isFile(pkg_json)) {
|
|
6130
5944
|
let data = {};
|
|
6131
5945
|
try {
|
|
@@ -6137,13 +5951,13 @@ function _is_agent_config_source_repo(project_root) {
|
|
|
6137
5951
|
return [true, "package.json:name"];
|
|
6138
5952
|
}
|
|
6139
5953
|
}
|
|
6140
|
-
if (isDir(
|
|
5954
|
+
if (isDir(path18.join(project_root, ".agent-src.uncondensed"))) {
|
|
6141
5955
|
return [true, ".agent-src.uncondensed/"];
|
|
6142
5956
|
}
|
|
6143
|
-
const packages_dir =
|
|
5957
|
+
const packages_dir = path18.join(project_root, "packages");
|
|
6144
5958
|
if (isDir(packages_dir)) {
|
|
6145
|
-
for (const child of
|
|
6146
|
-
if (isDir(
|
|
5959
|
+
for (const child of fs18.readdirSync(packages_dir)) {
|
|
5960
|
+
if (isDir(path18.join(packages_dir, child, ".agent-src.uncondensed"))) {
|
|
6147
5961
|
return [true, `packages/${child}/.agent-src.uncondensed/`];
|
|
6148
5962
|
}
|
|
6149
5963
|
}
|
|
@@ -6161,17 +5975,17 @@ function _detect_legacy_for_migration(project_root) {
|
|
|
6161
5975
|
}
|
|
6162
5976
|
return [];
|
|
6163
5977
|
}
|
|
6164
|
-
if (isFile(
|
|
5978
|
+
if (isFile(path18.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
|
|
6165
5979
|
const found = [];
|
|
6166
5980
|
for (const name of MIGRATE_LEGACY_YAML_FILES) {
|
|
6167
|
-
if (isFile(
|
|
5981
|
+
if (isFile(path18.join(project_root, name))) {
|
|
6168
5982
|
found.push(name);
|
|
6169
|
-
} else if (isFile(
|
|
5983
|
+
} else if (isFile(path18.join(project_root, "settings", name))) {
|
|
6170
5984
|
found.push(`settings/${name}`);
|
|
6171
5985
|
}
|
|
6172
5986
|
}
|
|
6173
5987
|
for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
|
|
6174
|
-
const p =
|
|
5988
|
+
const p = path18.join(project_root, name);
|
|
6175
5989
|
if (isDir(p) && !isSymlink(p)) {
|
|
6176
5990
|
found.push(`${name}/`);
|
|
6177
5991
|
}
|
|
@@ -6183,7 +5997,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
|
|
|
6183
5997
|
process2.stdout.write("\n");
|
|
6184
5998
|
warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
|
|
6185
5999
|
for (const rel of artefacts) {
|
|
6186
|
-
info(` ${
|
|
6000
|
+
info(` ${path18.join(project_root, rel)}`);
|
|
6187
6001
|
}
|
|
6188
6002
|
info("The unified `agent-config migrate` sweeps these in one pass.");
|
|
6189
6003
|
info("The wizard recreates fresh config afterwards.");
|
|
@@ -6212,22 +6026,22 @@ function _run_migrate_to_global(project_root) {
|
|
|
6212
6026
|
}
|
|
6213
6027
|
}
|
|
6214
6028
|
function _format_global_root_for_marker(global_root) {
|
|
6215
|
-
const home = resolvePath(
|
|
6029
|
+
const home = resolvePath(os7.homedir());
|
|
6216
6030
|
const resolved = resolvePath(global_root);
|
|
6217
|
-
const rel =
|
|
6218
|
-
if (rel === "" || rel.startsWith("..") ||
|
|
6031
|
+
const rel = path18.relative(home, resolved);
|
|
6032
|
+
if (rel === "" || rel.startsWith("..") || path18.isAbsolute(rel)) {
|
|
6219
6033
|
return global_root;
|
|
6220
6034
|
}
|
|
6221
|
-
return `~/${rel.split(
|
|
6035
|
+
return `~/${rel.split(path18.sep).join("/")}`;
|
|
6222
6036
|
}
|
|
6223
6037
|
function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
6224
6038
|
const env_map = env ?? process2.env;
|
|
6225
6039
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
|
|
6226
|
-
if (isDir(
|
|
6227
|
-
const target =
|
|
6040
|
+
if (isDir(path18.join(project_root, ".agent-src.uncondensed"))) return null;
|
|
6041
|
+
const target = path18.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
|
|
6228
6042
|
if (!isFile(target)) return null;
|
|
6229
6043
|
try {
|
|
6230
|
-
|
|
6044
|
+
fs18.rmSync(target);
|
|
6231
6045
|
} catch {
|
|
6232
6046
|
return null;
|
|
6233
6047
|
}
|
|
@@ -6241,7 +6055,7 @@ var PROJECT_ANCHOR_TOOLS = {
|
|
|
6241
6055
|
function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
|
|
6242
6056
|
const env_map = env ?? process2.env;
|
|
6243
6057
|
if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
|
|
6244
|
-
if (isDir(
|
|
6058
|
+
if (isDir(path18.join(project_root, ".agent-src.uncondensed"))) return [];
|
|
6245
6059
|
const global_root_str = _format_global_root_for_marker(
|
|
6246
6060
|
event4u_root(env_map)
|
|
6247
6061
|
);
|
|
@@ -6250,8 +6064,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
|
|
|
6250
6064
|
for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
|
|
6251
6065
|
const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
|
|
6252
6066
|
if (!tools.has(tool_id)) continue;
|
|
6253
|
-
const target =
|
|
6254
|
-
mkdirp(
|
|
6067
|
+
const target = path18.join(project_root, rel_path);
|
|
6068
|
+
mkdirp(path18.dirname(target));
|
|
6255
6069
|
const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
|
|
6256
6070
|
# Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
|
|
6257
6071
|
# Tool: ${tool_id}. Resolves the global install directly \u2014 no
|
|
@@ -6269,7 +6083,7 @@ installed_at: ${stamp}
|
|
|
6269
6083
|
}
|
|
6270
6084
|
var PACKAGE_TAG_ID = "event4u/agent-config";
|
|
6271
6085
|
function _inject_package_tag(target, source, package_root) {
|
|
6272
|
-
if (
|
|
6086
|
+
if (path18.extname(target) !== ".md") return;
|
|
6273
6087
|
let text;
|
|
6274
6088
|
try {
|
|
6275
6089
|
text = readText(target);
|
|
@@ -6297,8 +6111,8 @@ function _inject_package_tag(target, source, package_root) {
|
|
|
6297
6111
|
resolved_src = source;
|
|
6298
6112
|
}
|
|
6299
6113
|
if (package_root !== null) {
|
|
6300
|
-
const rel =
|
|
6301
|
-
if (rel !== "" && !rel.startsWith("..") && !
|
|
6114
|
+
const rel = path18.relative(resolvePath(package_root), resolved_src);
|
|
6115
|
+
if (rel !== "" && !rel.startsWith("..") && !path18.isAbsolute(rel)) {
|
|
6302
6116
|
source_value = rel;
|
|
6303
6117
|
} else {
|
|
6304
6118
|
source_value = resolved_src;
|
|
@@ -6333,7 +6147,7 @@ function _escapes_package_root(resolved, package_root) {
|
|
|
6333
6147
|
if (package_root === null) return false;
|
|
6334
6148
|
let root;
|
|
6335
6149
|
try {
|
|
6336
|
-
root =
|
|
6150
|
+
root = fs18.realpathSync(package_root);
|
|
6337
6151
|
} catch {
|
|
6338
6152
|
return false;
|
|
6339
6153
|
}
|
|
@@ -6359,7 +6173,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
6359
6173
|
if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
|
|
6360
6174
|
let resolved_src = src;
|
|
6361
6175
|
try {
|
|
6362
|
-
resolved_src =
|
|
6176
|
+
resolved_src = fs18.realpathSync(src);
|
|
6363
6177
|
} catch {
|
|
6364
6178
|
resolved_src = src;
|
|
6365
6179
|
}
|
|
@@ -6367,14 +6181,14 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
6367
6181
|
warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
|
|
6368
6182
|
return [0, 0, written_paths];
|
|
6369
6183
|
}
|
|
6370
|
-
mkdirp(
|
|
6184
|
+
mkdirp(path18.dirname(dest));
|
|
6371
6185
|
const decision = tracker.resolve(dest, force);
|
|
6372
6186
|
if (decision === "preserve") {
|
|
6373
6187
|
tracker.preserve(dest, resolved_src, package_root);
|
|
6374
6188
|
_log_tx_entry("skip", dest);
|
|
6375
6189
|
return [0, 1, written_paths];
|
|
6376
6190
|
}
|
|
6377
|
-
|
|
6191
|
+
fs18.copyFileSync(src, dest);
|
|
6378
6192
|
_inject_package_tag(dest, src, package_root);
|
|
6379
6193
|
_log_tx_entry("write", dest);
|
|
6380
6194
|
written_paths.push(dest);
|
|
@@ -6383,11 +6197,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
6383
6197
|
mkdirp(dest);
|
|
6384
6198
|
const walk = (node) => {
|
|
6385
6199
|
const acc = [];
|
|
6386
|
-
const names =
|
|
6200
|
+
const names = fs18.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
6387
6201
|
for (const name of names) {
|
|
6388
|
-
const entry =
|
|
6202
|
+
const entry = path18.join(node, name);
|
|
6389
6203
|
acc.push(entry);
|
|
6390
|
-
const lst =
|
|
6204
|
+
const lst = fs18.lstatSync(entry);
|
|
6391
6205
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
6392
6206
|
acc.push(...walk(entry));
|
|
6393
6207
|
}
|
|
@@ -6395,9 +6209,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
6395
6209
|
return acc;
|
|
6396
6210
|
};
|
|
6397
6211
|
for (const entry of walk(src)) {
|
|
6398
|
-
const rel =
|
|
6399
|
-
const target =
|
|
6400
|
-
const lst =
|
|
6212
|
+
const rel = path18.relative(src, entry);
|
|
6213
|
+
const target = path18.join(dest, rel);
|
|
6214
|
+
const lst = fs18.lstatSync(entry);
|
|
6401
6215
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
6402
6216
|
mkdirp(target);
|
|
6403
6217
|
continue;
|
|
@@ -6405,8 +6219,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
6405
6219
|
let resolvedIsDir = false;
|
|
6406
6220
|
let resolved = entry;
|
|
6407
6221
|
try {
|
|
6408
|
-
resolved =
|
|
6409
|
-
resolvedIsDir =
|
|
6222
|
+
resolved = fs18.realpathSync(entry);
|
|
6223
|
+
resolvedIsDir = fs18.statSync(entry).isDirectory();
|
|
6410
6224
|
} catch {
|
|
6411
6225
|
resolvedIsDir = false;
|
|
6412
6226
|
}
|
|
@@ -6438,8 +6252,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
|
|
|
6438
6252
|
_log_tx_entry("skip", target);
|
|
6439
6253
|
continue;
|
|
6440
6254
|
}
|
|
6441
|
-
mkdirp(
|
|
6442
|
-
|
|
6255
|
+
mkdirp(path18.dirname(target));
|
|
6256
|
+
fs18.copyFileSync(resolved, target);
|
|
6443
6257
|
_inject_package_tag(target, resolved, package_root);
|
|
6444
6258
|
_log_tx_entry("write", target);
|
|
6445
6259
|
written += 1;
|
|
@@ -6452,7 +6266,7 @@ function _claude_desktop_bundles_dir() {
|
|
|
6452
6266
|
}
|
|
6453
6267
|
function _write_claude_desktop_marker(force, lockfile_path2, bundles_dir, bundle_count) {
|
|
6454
6268
|
const anchor = expanduser3(USER_SCOPE_PATHS["claude-desktop"]);
|
|
6455
|
-
const target =
|
|
6269
|
+
const target = path18.join(anchor, "agent-config.md");
|
|
6456
6270
|
mkdirp(anchor);
|
|
6457
6271
|
const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
|
|
6458
6272
|
if (tracker.resolve(target, force) === "preserve") {
|
|
@@ -6480,12 +6294,12 @@ var _CLAUDE_FLAT_WRAPPER_EXTRA = /* @__PURE__ */ new Set(["commit"]);
|
|
|
6480
6294
|
function _apply_claude_flat_command_wrappers(anchor, package_root, current_files, recorded_files = /* @__PURE__ */ new Set()) {
|
|
6481
6295
|
const wrapped = [];
|
|
6482
6296
|
const collisions = [];
|
|
6483
|
-
const commands_dir =
|
|
6297
|
+
const commands_dir = path18.join(anchor, "commands");
|
|
6484
6298
|
const { reserved, foreign } = sweepReservedNames(commands_dir, current_files, is_claude_builtin_name, recorded_files);
|
|
6485
6299
|
const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
|
|
6486
6300
|
try {
|
|
6487
6301
|
const manifest = JSON.parse(
|
|
6488
|
-
|
|
6302
|
+
fs18.readFileSync(path18.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
|
|
6489
6303
|
);
|
|
6490
6304
|
for (const a of manifest.artefacts ?? []) {
|
|
6491
6305
|
if (a.category !== "command" || typeof a.slug !== "string") continue;
|
|
@@ -6496,22 +6310,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
|
|
|
6496
6310
|
}
|
|
6497
6311
|
for (const slug of [...eligible].sort()) {
|
|
6498
6312
|
const flat_rel = `commands/${slug}.md`;
|
|
6499
|
-
const flat_abs =
|
|
6500
|
-
if (!
|
|
6501
|
-
const skill_dir =
|
|
6502
|
-
if (
|
|
6313
|
+
const flat_abs = path18.join(anchor, "commands", `${slug}.md`);
|
|
6314
|
+
if (!fs18.existsSync(flat_abs)) continue;
|
|
6315
|
+
const skill_dir = path18.join(anchor, "skills", slug);
|
|
6316
|
+
if (fs18.existsSync(skill_dir)) {
|
|
6503
6317
|
collisions.push(slug);
|
|
6504
6318
|
continue;
|
|
6505
6319
|
}
|
|
6506
|
-
let body =
|
|
6320
|
+
let body = fs18.readFileSync(flat_abs, "utf8");
|
|
6507
6321
|
if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
|
|
6508
6322
|
body = body.replace("---\n", `---
|
|
6509
6323
|
name: ${slug}
|
|
6510
6324
|
`);
|
|
6511
6325
|
}
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6326
|
+
fs18.mkdirSync(skill_dir, { recursive: true });
|
|
6327
|
+
fs18.writeFileSync(path18.join(skill_dir, "SKILL.md"), body, "utf8");
|
|
6328
|
+
fs18.rmSync(flat_abs, { force: true });
|
|
6515
6329
|
current_files.delete(flat_rel);
|
|
6516
6330
|
current_files.add(`skills/${slug}/SKILL.md`);
|
|
6517
6331
|
wrapped.push(slug);
|
|
@@ -6543,8 +6357,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
6543
6357
|
const written_paths = [];
|
|
6544
6358
|
let current_files = /* @__PURE__ */ new Set();
|
|
6545
6359
|
for (const [src_rel, dest_sub] of plan) {
|
|
6546
|
-
const src =
|
|
6547
|
-
const dest = dest_sub ?
|
|
6360
|
+
const src = path18.join(package_root, src_rel);
|
|
6361
|
+
const dest = dest_sub ? path18.join(anchor, dest_sub) : anchor;
|
|
6548
6362
|
const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
|
|
6549
6363
|
const [w, s, paths] = _copy_dir_dereferencing_symlinks(
|
|
6550
6364
|
src,
|
|
@@ -6568,10 +6382,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
6568
6382
|
if (tool_id === "claude-code") {
|
|
6569
6383
|
const res = _apply_claude_flat_command_wrappers(anchor, package_root, current_files, recorded_rel_files(tool_id, anchor));
|
|
6570
6384
|
const preserved_now = new Set(
|
|
6571
|
-
tracker.conflictState.preserved.map((p) =>
|
|
6385
|
+
tracker.conflictState.preserved.map((p) => path18.resolve(p))
|
|
6572
6386
|
);
|
|
6573
6387
|
rewriteAndReport(
|
|
6574
|
-
|
|
6388
|
+
path18.join(anchor, "rules"),
|
|
6575
6389
|
state.QUIET,
|
|
6576
6390
|
info,
|
|
6577
6391
|
warn,
|
|
@@ -6581,7 +6395,7 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
6581
6395
|
if (installerThinsHost(tool_id, { packageRoot: package_root })) {
|
|
6582
6396
|
try {
|
|
6583
6397
|
const thin = thinInstalledRuleLayer({
|
|
6584
|
-
rulesDir:
|
|
6398
|
+
rulesDir: path18.join(anchor, "rules"),
|
|
6585
6399
|
packageRoot: package_root,
|
|
6586
6400
|
preserved: preserved_now
|
|
6587
6401
|
});
|
|
@@ -6590,7 +6404,7 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
6590
6404
|
warn(`claude-code: thinned rule layer not written \u2014 ${String(e)}`);
|
|
6591
6405
|
}
|
|
6592
6406
|
}
|
|
6593
|
-
if (!state.QUIET) for (const l of installReceiptBudgetLines(package_root)) info(l);
|
|
6407
|
+
if (!state.QUIET) for (const l of installReceiptBudgetLines(package_root, void 0, { thisDeploy: /* @__PURE__ */ new Map([[anchor, current_files]]) })) info(l);
|
|
6594
6408
|
}
|
|
6595
6409
|
const missing_targets = _verify_deploy_targets(anchor, plan);
|
|
6596
6410
|
if (missing_targets.length > 0) {
|
|
@@ -6632,10 +6446,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
|
|
|
6632
6446
|
results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
|
|
6633
6447
|
if (tool_id === "claude-code") {
|
|
6634
6448
|
try {
|
|
6635
|
-
const manifest =
|
|
6449
|
+
const manifest = path18.join(package_root, "src", "scripts", "hook_manifest.yaml");
|
|
6636
6450
|
const matrix = build_claude_hook_matrix(manifest);
|
|
6637
6451
|
const res = ensure_managed_hooks(
|
|
6638
|
-
|
|
6452
|
+
path18.join(anchor, "settings.json"),
|
|
6639
6453
|
matrix
|
|
6640
6454
|
);
|
|
6641
6455
|
if (!state.QUIET) {
|
|
@@ -6672,7 +6486,7 @@ function _preview_global_reap(tools, package_root) {
|
|
|
6672
6486
|
const anchor = expanduser3(anchor_raw);
|
|
6673
6487
|
let current_files = /* @__PURE__ */ new Set();
|
|
6674
6488
|
for (const [src_rel, dest_sub] of plan) {
|
|
6675
|
-
const src =
|
|
6489
|
+
const src = path18.join(package_root, src_rel);
|
|
6676
6490
|
current_files = setUnion(
|
|
6677
6491
|
current_files,
|
|
6678
6492
|
expected_deploy_files(
|
|
@@ -6706,14 +6520,14 @@ function _preview_global_reap(tools, package_root) {
|
|
|
6706
6520
|
function _verify_deploy_targets(anchor, plan) {
|
|
6707
6521
|
const missing = [];
|
|
6708
6522
|
for (const [, dest_sub] of plan) {
|
|
6709
|
-
const target = dest_sub ?
|
|
6523
|
+
const target = dest_sub ? path18.join(anchor, dest_sub) : anchor;
|
|
6710
6524
|
const label = dest_sub || ".";
|
|
6711
6525
|
if (!isDir(target)) {
|
|
6712
6526
|
missing.push(label);
|
|
6713
6527
|
continue;
|
|
6714
6528
|
}
|
|
6715
6529
|
try {
|
|
6716
|
-
const entries =
|
|
6530
|
+
const entries = fs18.readdirSync(target);
|
|
6717
6531
|
if (entries.length === 0) missing.push(label);
|
|
6718
6532
|
} catch {
|
|
6719
6533
|
missing.push(label);
|
|
@@ -6731,9 +6545,9 @@ function _resolve_global_settings_doc() {
|
|
|
6731
6545
|
}
|
|
6732
6546
|
function _resolve_global_settings_path() {
|
|
6733
6547
|
const root = event4u_root();
|
|
6734
|
-
const canonical =
|
|
6548
|
+
const canonical = path18.join(root, "settings", SETTINGS_FILE);
|
|
6735
6549
|
if (pathExists(canonical)) return canonical;
|
|
6736
|
-
const legacy =
|
|
6550
|
+
const legacy = path18.join(root, SETTINGS_FILE);
|
|
6737
6551
|
if (pathExists(legacy)) return legacy;
|
|
6738
6552
|
return null;
|
|
6739
6553
|
}
|
|
@@ -6820,7 +6634,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
6820
6634
|
info(` schema_version=1, agent_config_version=${installed_version}`);
|
|
6821
6635
|
info(` tools=${merged_tools.join(",")}`);
|
|
6822
6636
|
}
|
|
6823
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
6637
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path18.join(project_root, ".agent-src.uncondensed"))) {
|
|
6824
6638
|
const drift = collect_drift(project_root);
|
|
6825
6639
|
if (!state.QUIET) {
|
|
6826
6640
|
process2.stdout.write("\n");
|
|
@@ -6934,19 +6748,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
6934
6748
|
}
|
|
6935
6749
|
}
|
|
6936
6750
|
}
|
|
6937
|
-
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(
|
|
6751
|
+
if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path18.join(project_root, ".agent-src.uncondensed"))) {
|
|
6938
6752
|
const files_by_tool = filesByToolFromDeploy(deploy_results);
|
|
6939
6753
|
const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
|
|
6940
6754
|
if (rc !== 0) return rc;
|
|
6941
6755
|
const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
|
|
6942
6756
|
if (removed_marker !== null && !state.QUIET) {
|
|
6943
|
-
const rel = isRelativeTo(removed_marker, project_root) ?
|
|
6757
|
+
const rel = isRelativeTo(removed_marker, project_root) ? path18.relative(project_root, removed_marker) : removed_marker;
|
|
6944
6758
|
info(`Removed legacy bridge marker: ${rel}`);
|
|
6945
6759
|
}
|
|
6946
6760
|
const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
|
|
6947
6761
|
if (anchor_paths.length > 0 && !state.QUIET) {
|
|
6948
6762
|
for (const p of anchor_paths) {
|
|
6949
|
-
const rel = isRelativeTo(p, project_root) ?
|
|
6763
|
+
const rel = isRelativeTo(p, project_root) ? path18.relative(project_root, p) : p;
|
|
6950
6764
|
info(`Project anchor written: ${rel}`);
|
|
6951
6765
|
}
|
|
6952
6766
|
}
|
|
@@ -6982,8 +6796,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
|
|
|
6982
6796
|
}
|
|
6983
6797
|
function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
6984
6798
|
const log_candidates = [
|
|
6985
|
-
|
|
6986
|
-
...project_root ? [
|
|
6799
|
+
path18.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
6800
|
+
...project_root ? [path18.join(project_root, OBSERVATION_LOG)] : []
|
|
6987
6801
|
];
|
|
6988
6802
|
const records = log_candidates.flatMap((p) => readObservationLog(p));
|
|
6989
6803
|
if (records.length === 0) return [];
|
|
@@ -7006,13 +6820,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
|
|
|
7006
6820
|
function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
|
|
7007
6821
|
if (!isInteractiveSession(probe)) return [];
|
|
7008
6822
|
const log_candidates = [
|
|
7009
|
-
|
|
7010
|
-
...project_root ? [
|
|
6823
|
+
path18.join(event4u_root(), "state", "skill-catalogue.jsonl"),
|
|
6824
|
+
...project_root ? [path18.join(project_root, OBSERVATION_LOG)] : []
|
|
7011
6825
|
];
|
|
7012
6826
|
const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
|
|
7013
6827
|
if (limits.size === 0) return [];
|
|
7014
6828
|
const resolved = _resolve_scoped_projection(package_root);
|
|
7015
|
-
const settings_path = _resolve_global_settings_path() ??
|
|
6829
|
+
const settings_path = _resolve_global_settings_path() ?? path18.join(event4u_root(), "settings", SETTINGS_FILE);
|
|
7016
6830
|
for (const tool_id of Object.keys(deploy_results).sort()) {
|
|
7017
6831
|
const [, , status] = deploy_results[tool_id];
|
|
7018
6832
|
if (status !== "deployed") continue;
|
|
@@ -7031,8 +6845,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
|
|
|
7031
6845
|
}
|
|
7032
6846
|
return [];
|
|
7033
6847
|
}
|
|
7034
|
-
var SETTINGS_SURFACE_REL =
|
|
7035
|
-
var SETTINGS_DELTA_REL =
|
|
6848
|
+
var SETTINGS_SURFACE_REL = path18.join("state", "settings-surface.json");
|
|
6849
|
+
var SETTINGS_DELTA_REL = path18.join("state", "settings-delta.json");
|
|
7036
6850
|
function _current_settings_surface(version) {
|
|
7037
6851
|
const jsonSchema = zodToJsonSchema(settingsSchema, {
|
|
7038
6852
|
name: "AgentSettings",
|
|
@@ -7043,20 +6857,20 @@ function _current_settings_surface(version) {
|
|
|
7043
6857
|
}
|
|
7044
6858
|
function _write_settings_surface_snapshot(installed_version) {
|
|
7045
6859
|
const root = event4u_root();
|
|
7046
|
-
const surface_path =
|
|
7047
|
-
const delta_path =
|
|
6860
|
+
const surface_path = path18.join(root, SETTINGS_SURFACE_REL);
|
|
6861
|
+
const delta_path = path18.join(root, SETTINGS_DELTA_REL);
|
|
7048
6862
|
const next = _current_settings_surface(installed_version);
|
|
7049
6863
|
let previous = null;
|
|
7050
6864
|
try {
|
|
7051
|
-
const parsed = JSON.parse(
|
|
6865
|
+
const parsed = JSON.parse(fs18.readFileSync(surface_path, "utf8"));
|
|
7052
6866
|
if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
|
|
7053
6867
|
} catch {
|
|
7054
6868
|
}
|
|
7055
6869
|
if (previous !== null && previous.version !== next.version) {
|
|
7056
6870
|
const delta = computeSurfaceDelta(previous, next);
|
|
7057
6871
|
if (delta.changes.length > 0) {
|
|
7058
|
-
|
|
7059
|
-
|
|
6872
|
+
fs18.mkdirSync(path18.dirname(delta_path), { recursive: true, mode: 448 });
|
|
6873
|
+
fs18.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
|
|
7060
6874
|
`, { mode: 384 });
|
|
7061
6875
|
if (!state.QUIET) {
|
|
7062
6876
|
const counts = {};
|
|
@@ -7068,8 +6882,8 @@ function _write_settings_surface_snapshot(installed_version) {
|
|
|
7068
6882
|
}
|
|
7069
6883
|
}
|
|
7070
6884
|
}
|
|
7071
|
-
|
|
7072
|
-
|
|
6885
|
+
fs18.mkdirSync(path18.dirname(surface_path), { recursive: true, mode: 448 });
|
|
6886
|
+
fs18.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
|
|
7073
6887
|
`, { mode: 384 });
|
|
7074
6888
|
}
|
|
7075
6889
|
function arrayStrEqual(a, b) {
|
|
@@ -7285,17 +7099,17 @@ function _is_tool_enabled(tools, tool_id) {
|
|
|
7285
7099
|
return tools.has(tool_id);
|
|
7286
7100
|
}
|
|
7287
7101
|
function _minimal_templates_root() {
|
|
7288
|
-
const start = resolvePath(
|
|
7102
|
+
const start = resolvePath(_HERE);
|
|
7289
7103
|
const chain = [start];
|
|
7290
7104
|
let cur = start;
|
|
7291
7105
|
for (; ; ) {
|
|
7292
|
-
const parent =
|
|
7106
|
+
const parent = path18.dirname(cur);
|
|
7293
7107
|
if (parent === cur) break;
|
|
7294
7108
|
chain.push(parent);
|
|
7295
7109
|
cur = parent;
|
|
7296
7110
|
}
|
|
7297
7111
|
for (const ancestor of chain) {
|
|
7298
|
-
const candidate =
|
|
7112
|
+
const candidate = path18.join(ancestor, "src", "templates", "minimal");
|
|
7299
7113
|
if (isDir(candidate)) return candidate;
|
|
7300
7114
|
}
|
|
7301
7115
|
fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
|
|
@@ -7303,9 +7117,9 @@ function _minimal_templates_root() {
|
|
|
7303
7117
|
var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
|
|
7304
7118
|
function _write_install_mode_marker(project_root, mode) {
|
|
7305
7119
|
if (mode !== "minimal" && mode !== "full") return;
|
|
7306
|
-
const marker =
|
|
7120
|
+
const marker = path18.join(project_root, INSTALL_MODE_MARKER_REL);
|
|
7307
7121
|
try {
|
|
7308
|
-
mkdirp(
|
|
7122
|
+
mkdirp(path18.dirname(marker));
|
|
7309
7123
|
writeText(marker, `${mode}
|
|
7310
7124
|
`);
|
|
7311
7125
|
} catch {
|
|
@@ -7314,7 +7128,7 @@ function _write_install_mode_marker(project_root, mode) {
|
|
|
7314
7128
|
function install_minimal(target_root_in, force, user_type = "") {
|
|
7315
7129
|
let target_root = resolvePath(target_root_in);
|
|
7316
7130
|
mkdirp(target_root);
|
|
7317
|
-
const parent =
|
|
7131
|
+
const parent = path18.dirname(target_root);
|
|
7318
7132
|
if (parent !== target_root) {
|
|
7319
7133
|
const existing = find_project_root_with_anchor(parent);
|
|
7320
7134
|
if (existing !== null && existing[0] !== target_root) {
|
|
@@ -7325,21 +7139,21 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
7325
7139
|
}
|
|
7326
7140
|
}
|
|
7327
7141
|
const templates = _minimal_templates_root();
|
|
7328
|
-
const settings_src =
|
|
7329
|
-
const overrides_gitkeep_src =
|
|
7330
|
-
const overrides_readme_src =
|
|
7142
|
+
const settings_src = path18.join(templates, SETTINGS_FILE);
|
|
7143
|
+
const overrides_gitkeep_src = path18.join(templates, "overrides-gitkeep");
|
|
7144
|
+
const overrides_readme_src = path18.join(templates, "agents-overrides-readme.md");
|
|
7331
7145
|
if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
|
|
7332
7146
|
if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
|
|
7333
7147
|
fail(`Bundled overrides scaffold templates missing under ${templates}`);
|
|
7334
7148
|
}
|
|
7335
7149
|
info(`Minimal init \u2192 ${target_root}`);
|
|
7336
|
-
const overrides_root =
|
|
7150
|
+
const overrides_root = path18.join(target_root, "agents", "overrides");
|
|
7337
7151
|
mkdirp(overrides_root);
|
|
7338
7152
|
const gitkeep_body = readText(overrides_gitkeep_src);
|
|
7339
7153
|
for (const sub of ["rules", "skills", "commands"]) {
|
|
7340
|
-
const sub_dir =
|
|
7154
|
+
const sub_dir = path18.join(overrides_root, sub);
|
|
7341
7155
|
mkdirp(sub_dir);
|
|
7342
|
-
const gitkeep_dst =
|
|
7156
|
+
const gitkeep_dst = path18.join(sub_dir, ".gitkeep");
|
|
7343
7157
|
if (pathExists(gitkeep_dst) && !force) {
|
|
7344
7158
|
skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
|
|
7345
7159
|
} else {
|
|
@@ -7347,7 +7161,7 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
7347
7161
|
success(`Wrote agents/overrides/${sub}/.gitkeep`);
|
|
7348
7162
|
}
|
|
7349
7163
|
}
|
|
7350
|
-
const readme_dst =
|
|
7164
|
+
const readme_dst = path18.join(overrides_root, "README.md");
|
|
7351
7165
|
if (pathExists(readme_dst) && !force) {
|
|
7352
7166
|
skip("agents/overrides/README.md already exists (use --force to overwrite)");
|
|
7353
7167
|
} else {
|
|
@@ -7365,14 +7179,14 @@ function install_minimal(target_root_in, force, user_type = "") {
|
|
|
7365
7179
|
personal:
|
|
7366
7180
|
user_type: ${user_type}
|
|
7367
7181
|
`;
|
|
7368
|
-
mkdirp(
|
|
7182
|
+
mkdirp(path18.dirname(settings_dst));
|
|
7369
7183
|
writeText(settings_dst, body);
|
|
7370
7184
|
success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
|
|
7371
7185
|
}
|
|
7372
7186
|
}
|
|
7373
7187
|
const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
|
|
7374
7188
|
if (removed_marker !== null) {
|
|
7375
|
-
const rel = isRelativeTo(removed_marker, target_root) ?
|
|
7189
|
+
const rel = isRelativeTo(removed_marker, target_root) ? path18.relative(target_root, removed_marker) : removed_marker;
|
|
7376
7190
|
success(`Removed legacy bridge marker: ${rel}`);
|
|
7377
7191
|
}
|
|
7378
7192
|
_write_install_mode_marker(target_root, "minimal");
|
|
@@ -7446,7 +7260,7 @@ function run_interactive_init(project_root, force) {
|
|
|
7446
7260
|
);
|
|
7447
7261
|
return 0;
|
|
7448
7262
|
}
|
|
7449
|
-
const target =
|
|
7263
|
+
const target = path18.join(project_root, _LOCAL_CONFIG_FILE);
|
|
7450
7264
|
if (pathExists(target) && !force) {
|
|
7451
7265
|
warn(
|
|
7452
7266
|
`${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
|
|
@@ -7473,7 +7287,7 @@ function run_interactive_init(project_root, force) {
|
|
|
7473
7287
|
warn(`Could not write ${target}: ${String(exc)}`);
|
|
7474
7288
|
return 1;
|
|
7475
7289
|
}
|
|
7476
|
-
success(`Wrote ${
|
|
7290
|
+
success(`Wrote ${path18.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
|
|
7477
7291
|
return 0;
|
|
7478
7292
|
}
|
|
7479
7293
|
var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
|
|
@@ -7491,12 +7305,12 @@ function _wizard_should_launch(opts) {
|
|
|
7491
7305
|
return [true, ""];
|
|
7492
7306
|
}
|
|
7493
7307
|
function _wizard_cli_dist(_project_root) {
|
|
7494
|
-
const package_root =
|
|
7495
|
-
const cli =
|
|
7308
|
+
const package_root = path18.dirname(path18.dirname(path18.dirname(resolvePath(_HERE))));
|
|
7309
|
+
const cli = path18.join(package_root, "dist", "cli", "agent-config.js");
|
|
7496
7310
|
return pathExists(cli) ? cli : null;
|
|
7497
7311
|
}
|
|
7498
7312
|
function _server_info_path() {
|
|
7499
|
-
return
|
|
7313
|
+
return path18.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
|
|
7500
7314
|
}
|
|
7501
7315
|
function _pid_is_agent_config(pid) {
|
|
7502
7316
|
let res;
|
|
@@ -7513,7 +7327,7 @@ function _pid_is_agent_config(pid) {
|
|
|
7513
7327
|
}
|
|
7514
7328
|
function unlinkMissingOk(p) {
|
|
7515
7329
|
try {
|
|
7516
|
-
|
|
7330
|
+
fs18.unlinkSync(p);
|
|
7517
7331
|
} catch {
|
|
7518
7332
|
}
|
|
7519
7333
|
}
|
|
@@ -7591,14 +7405,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
|
|
|
7591
7405
|
}
|
|
7592
7406
|
function _wizard_run_sync(cmd, env, cli) {
|
|
7593
7407
|
const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
|
|
7594
|
-
const log_path =
|
|
7595
|
-
|
|
7408
|
+
const log_path = path18.join(
|
|
7409
|
+
os7.tmpdir(),
|
|
7596
7410
|
`agent-config-wizard-${process2.pid}-${Date.now()}.log`
|
|
7597
7411
|
);
|
|
7598
7412
|
let child;
|
|
7599
7413
|
let log_fd = null;
|
|
7600
7414
|
try {
|
|
7601
|
-
log_fd =
|
|
7415
|
+
log_fd = fs18.openSync(log_path, "w");
|
|
7602
7416
|
child = spawn(cmd[0], cmd.slice(1), {
|
|
7603
7417
|
env,
|
|
7604
7418
|
detached: true,
|
|
@@ -7616,7 +7430,7 @@ function _wizard_run_sync(cmd, env, cli) {
|
|
|
7616
7430
|
} finally {
|
|
7617
7431
|
if (log_fd !== null) {
|
|
7618
7432
|
try {
|
|
7619
|
-
|
|
7433
|
+
fs18.closeSync(log_fd);
|
|
7620
7434
|
} catch {
|
|
7621
7435
|
}
|
|
7622
7436
|
}
|
|
@@ -7866,8 +7680,8 @@ function main2(argv) {
|
|
|
7866
7680
|
const target_root = resolvePath(
|
|
7867
7681
|
opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
|
|
7868
7682
|
);
|
|
7869
|
-
const minimal_package_root =
|
|
7870
|
-
|
|
7683
|
+
const minimal_package_root = path18.dirname(
|
|
7684
|
+
path18.dirname(path18.dirname(_minimal_templates_root()))
|
|
7871
7685
|
);
|
|
7872
7686
|
const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
|
|
7873
7687
|
return install_minimal(target_root, opts.force, validated_user_type);
|
|
@@ -7903,7 +7717,7 @@ function main2(argv) {
|
|
|
7903
7717
|
return rc2;
|
|
7904
7718
|
}
|
|
7905
7719
|
const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
|
|
7906
|
-
const is_first_run = !pathExists(
|
|
7720
|
+
const is_first_run = !pathExists(path18.join(project_root, SETTINGS_FILE));
|
|
7907
7721
|
tracker.begin(project_root);
|
|
7908
7722
|
let rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
|
|
7909
7723
|
if (rc === 0 && opts.interactive) {
|
|
@@ -7955,30 +7769,20 @@ function _read_consumer_auto_switch(project_root) {
|
|
|
7955
7769
|
}
|
|
7956
7770
|
return "suggest";
|
|
7957
7771
|
}
|
|
7958
|
-
function _team_setup_hint_line(
|
|
7959
|
-
let data;
|
|
7960
|
-
try {
|
|
7961
|
-
data = load_agent_settings({ project_path: _resolve_settings_read(project_root) });
|
|
7962
|
-
} catch {
|
|
7963
|
-
data = {};
|
|
7964
|
-
}
|
|
7965
|
-
const ai_team = isPlainObject(data) ? data["ai_team"] : null;
|
|
7966
|
-
const flag = isPlainObject(ai_team) ? ai_team["suppress_setup_hint"] : null;
|
|
7967
|
-
const suppressed = flag === true || typeof flag === "string" && ["true", "yes", "on", "1"].includes(flag.trim().toLowerCase());
|
|
7968
|
-
if (suppressed) return null;
|
|
7772
|
+
function _team_setup_hint_line() {
|
|
7969
7773
|
return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
|
|
7970
7774
|
}
|
|
7971
7775
|
function finalize_claude_model_tiers(project_root) {
|
|
7972
|
-
const claude_skills =
|
|
7973
|
-
const augment_skills =
|
|
7776
|
+
const claude_skills = path18.join(project_root, ".claude", "skills");
|
|
7777
|
+
const augment_skills = path18.join(project_root, ".augment", "skills");
|
|
7974
7778
|
if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
|
|
7975
7779
|
if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
|
|
7976
7780
|
let rendered = 0;
|
|
7977
|
-
const entries =
|
|
7781
|
+
const entries = fs18.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
7978
7782
|
for (const name of entries) {
|
|
7979
|
-
const entry =
|
|
7980
|
-
const src_dir =
|
|
7981
|
-
const src_md =
|
|
7783
|
+
const entry = path18.join(claude_skills, name);
|
|
7784
|
+
const src_dir = path18.join(augment_skills, name);
|
|
7785
|
+
const src_md = path18.join(src_dir, "SKILL.md");
|
|
7982
7786
|
let tier;
|
|
7983
7787
|
try {
|
|
7984
7788
|
tier = read_model_tier(src_md);
|
|
@@ -7987,22 +7791,22 @@ function finalize_claude_model_tiers(project_root) {
|
|
|
7987
7791
|
}
|
|
7988
7792
|
if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
|
|
7989
7793
|
if (isSymlink(entry) || isFile(entry)) {
|
|
7990
|
-
|
|
7794
|
+
fs18.unlinkSync(entry);
|
|
7991
7795
|
} else if (isDir(entry)) {
|
|
7992
|
-
|
|
7796
|
+
fs18.rmSync(entry, { recursive: true, force: true });
|
|
7993
7797
|
}
|
|
7994
7798
|
mkdirp(entry);
|
|
7995
|
-
const srcFiles =
|
|
7799
|
+
const srcFiles = fs18.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
7996
7800
|
for (const fname of srcFiles) {
|
|
7997
7801
|
if (fname === "SKILL.md") {
|
|
7998
7802
|
writeText(
|
|
7999
|
-
|
|
7803
|
+
path18.join(entry, "SKILL.md"),
|
|
8000
7804
|
render_native_model_md(readText(src_md), tier)
|
|
8001
7805
|
);
|
|
8002
7806
|
} else {
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
7807
|
+
fs18.symlinkSync(
|
|
7808
|
+
path18.join("../../../.augment/skills", name, fname),
|
|
7809
|
+
path18.join(entry, fname)
|
|
8006
7810
|
);
|
|
8007
7811
|
}
|
|
8008
7812
|
}
|
|
@@ -8020,7 +7824,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
8020
7824
|
let package_type;
|
|
8021
7825
|
if (opts.package) {
|
|
8022
7826
|
package_root = resolvePath(opts.package);
|
|
8023
|
-
if (!pathExists(
|
|
7827
|
+
if (!pathExists(path18.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
|
|
8024
7828
|
fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
|
|
8025
7829
|
}
|
|
8026
7830
|
package_type = detect_package_type_for_project(project_root, package_root);
|
|
@@ -8146,11 +7950,8 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
8146
7950
|
}
|
|
8147
7951
|
printResiduals(tools, state.QUIET);
|
|
8148
7952
|
if (_is_tool_enabled(tools, "claude-code")) {
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
process2.stdout.write(team_hint + "\n");
|
|
8152
|
-
process2.stdout.write("\n");
|
|
8153
|
-
}
|
|
7953
|
+
process2.stdout.write(_team_setup_hint_line() + "\n");
|
|
7954
|
+
process2.stdout.write("\n");
|
|
8154
7955
|
}
|
|
8155
7956
|
}
|
|
8156
7957
|
_propose_modules_config(project_root, is_first_run);
|
|
@@ -8165,14 +7966,14 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
|
|
|
8165
7966
|
function _resolvedArgv1() {
|
|
8166
7967
|
if (process2.argv[1] === void 0) return void 0;
|
|
8167
7968
|
try {
|
|
8168
|
-
return
|
|
7969
|
+
return fs18.realpathSync(path18.resolve(process2.argv[1]));
|
|
8169
7970
|
} catch {
|
|
8170
|
-
return
|
|
7971
|
+
return path18.resolve(process2.argv[1]);
|
|
8171
7972
|
}
|
|
8172
7973
|
}
|
|
8173
7974
|
var _argv1 = _resolvedArgv1();
|
|
8174
7975
|
var _isCliEntry = _argv1 !== void 0 && import.meta.url === pathToFileURL(_argv1).href;
|
|
8175
|
-
if (_isCliEntry || _argv1 ===
|
|
7976
|
+
if (_isCliEntry || _argv1 === _HERE) {
|
|
8176
7977
|
try {
|
|
8177
7978
|
process2.exitCode = main2(process2.argv.slice(2));
|
|
8178
7979
|
} catch (e) {
|