@event4u/agent-config 9.9.0 → 9.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +212 -194
- package/README.md +13 -16
- package/agents/templates/.ai-council.yml.example +481 -0
- package/agents/templates/.ai-video.xml.example +247 -0
- package/dist/agent-src/commands/agent-status.md +12 -11
- package/dist/agent-src/commands/agents/user/accept.md +115 -30
- package/dist/agent-src/commands/agents/user/delete.md +147 -0
- package/dist/agent-src/commands/agents/user/review.md +65 -28
- package/dist/agent-src/commands/agents/user/show.md +82 -29
- package/dist/agent-src/commands/agents/user/update.md +2 -2
- package/dist/agent-src/commands/agents/user.md +16 -3
- package/dist/agent-src/commands/check-current-md.md +0 -10
- package/dist/agent-src/commands/condense.md +28 -97
- package/dist/agent-src/commands/cost/report.md +7 -0
- package/dist/agent-src/commands/fix/portability.md +0 -8
- package/dist/agent-src/commands/fix/refs.md +0 -8
- package/dist/agent-src/commands/humanize.md +2 -2
- package/dist/agent-src/commands/jira-ticket.md +1 -1
- package/dist/agent-src/commands/memory/load.md +11 -0
- package/dist/agent-src/commands/optimize/skills.md +1 -1
- package/dist/agent-src/commands/pr/create.md +4 -4
- package/dist/agent-src/commands/profile/show.md +3 -3
- package/dist/agent-src/commands/rule-compliance-audit.md +5 -4
- package/dist/agent-src/commands/security-audit-config.md +1 -1
- package/dist/agent-src/commands/sync/gitignore/fix.md +1 -1
- package/dist/agent-src/commands/tdd.md +21 -0
- package/dist/agent-src/commands/team/delegate.md +2 -2
- package/dist/agent-src/commands/team-knowledge/bootstrap.md +9 -8
- package/dist/agent-src/commands/team-knowledge/consolidate.md +8 -7
- package/dist/agent-src/commands/team.md +4 -1
- package/dist/agent-src/commands/upstream-contribute.md +0 -1
- package/dist/agent-src/contexts/authority/commit-mechanics.md +7 -0
- package/dist/agent-src/contexts/authority/destructive-mechanics.md +16 -0
- package/dist/agent-src/contexts/authority/scope-mechanics.md +61 -0
- package/dist/agent-src/contexts/communication/rules-auto/reply-close-mechanics.md +20 -18
- package/dist/agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/source-of-truth-mechanics.md +9 -10
- package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +11 -0
- package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +26 -15
- package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +3 -0
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +67 -37
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +1 -1
- package/dist/agent-src/contexts/execution/autonomy-examples.md +1 -1
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +7 -6
- package/dist/agent-src/contexts/execution/evidence-discipline.md +92 -77
- package/dist/agent-src/contexts/execution/orchestration-benchmark-gate.md +22 -21
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +24 -0
- package/dist/agent-src/contexts/execution/project-intelligence.md +122 -103
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +23 -21
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +5 -5
- package/dist/agent-src/contexts/execution/subagent-routing.md +11 -0
- package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +13 -13
- package/dist/agent-src/contexts/execution/subagent-steering.md +36 -34
- package/dist/agent-src/contexts/execution/toolchain-resolver.md +1 -1
- package/dist/agent-src/contexts/execution/user-memory-channels.md +189 -0
- package/dist/agent-src/contexts/execution/verification-mechanics.md +9 -0
- package/dist/agent-src/contexts/model-recommendations.md +3 -2
- package/dist/agent-src/contexts/subagent-configuration.md +3 -3
- package/dist/agent-src/ghostwriter/README.md +2 -2
- package/dist/agent-src/packs/README.md +1 -1
- package/dist/agent-src/personas/README.md +5 -5
- package/dist/agent-src/personas/_template-specialist/persona.md +3 -3
- package/dist/agent-src/personas/backend-architect.md +24 -23
- package/dist/agent-src/personas/eloquent-tamer.md +30 -30
- package/dist/agent-src/personas/frontend-engineer.md +30 -30
- package/dist/agent-src/personas/product-owner.md +41 -38
- package/dist/agent-src/personas/qa.md +13 -13
- package/dist/agent-src/personas/security-engineer.md +22 -22
- package/dist/agent-src/presets/README.md +3 -3
- package/dist/agent-src/profiles/README.md +3 -3
- package/dist/agent-src/rules/active-remediation.md +2 -2
- package/dist/agent-src/rules/artifact-engagement-recording.md +4 -4
- package/dist/agent-src/rules/ask-when-uncertain.md +0 -4
- package/dist/agent-src/rules/augment-edit-discipline.md +1 -1
- package/dist/agent-src/rules/broken-access-control.md +4 -4
- package/dist/agent-src/rules/code-comment-discipline.md +1 -1
- package/dist/agent-src/rules/code-provenance.md +2 -2
- package/dist/agent-src/rules/commit-policy.md +4 -9
- package/dist/agent-src/rules/communication-through-line.md +5 -5
- package/dist/agent-src/rules/decision-revisit-gate.md +1 -1
- package/dist/agent-src/rules/design-fidelity.md +1 -1
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +1 -1
- package/dist/agent-src/rules/domain-adoption-policy.md +1 -1
- package/dist/agent-src/rules/domain-safety-pii.md +1 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +1 -1
- package/dist/agent-src/rules/fast-path-marker-visibility.md +43 -7
- package/dist/agent-src/rules/finance-safety-floor.md +1 -1
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +3 -3
- package/dist/agent-src/rules/history-discipline.md +1 -1
- package/dist/agent-src/rules/legal-safety-floor.md +1 -1
- package/dist/agent-src/rules/lethal-trifecta-guard.md +5 -5
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +10 -8
- package/dist/agent-src/rules/media-governance-routing.md +13 -13
- package/dist/agent-src/rules/media-sync-ground-truth.md +29 -11
- package/dist/agent-src/rules/no-cheap-questions.md +7 -7
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +29 -18
- package/dist/agent-src/rules/non-destructive-by-default.md +5 -23
- package/dist/agent-src/rules/onboarding-gate.md +14 -4
- package/dist/agent-src/rules/persona-governance.md +2 -2
- package/dist/agent-src/rules/prefer-enums-over-literals.md +9 -9
- package/dist/agent-src/rules/preservation-guard.md +10 -2
- package/dist/agent-src/rules/question-not-instruction.md +1 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +6 -6
- package/dist/agent-src/rules/rule-type-governance.md +1 -1
- package/dist/agent-src/rules/scale-discipline.md +1 -1
- package/dist/agent-src/rules/scope-control.md +1 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +1 -1
- package/dist/agent-src/rules/security-sensitive-stop.md +17 -11
- package/dist/agent-src/rules/senior-engineering-discipline.md +17 -17
- package/dist/agent-src/rules/session-canary.md +1 -1
- package/dist/agent-src/rules/skill-quality.md +1 -1
- package/dist/agent-src/rules/source-confidentiality.md +21 -19
- package/dist/agent-src/rules/source-of-truth.md +6 -5
- package/dist/agent-src/rules/spreadsheet-source-quality.md +2 -2
- package/dist/agent-src/rules/strategy-safety-floor.md +1 -1
- package/dist/agent-src/rules/think-before-action.md +5 -5
- package/dist/agent-src/rules/token-budget-discipline.md +5 -3
- package/dist/agent-src/rules/token-efficiency.md +2 -2
- package/dist/agent-src/rules/untrusted-input-defense.md +4 -4
- package/dist/agent-src/rules/user-interaction.md +12 -0
- package/dist/agent-src/rules/verify-before-complete.md +4 -24
- package/dist/agent-src/skills/adversarial-review/SKILL.md +2 -2
- package/dist/agent-src/skills/agent-security-review/SKILL.md +52 -45
- package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +2 -2
- package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +20 -20
- package/dist/agent-src/skills/ai-council/SKILL.md +185 -128
- package/dist/agent-src/skills/analysis-skill-router/SKILL.md +3 -3
- package/dist/agent-src/skills/api-endpoint/SKILL.md +2 -2
- package/dist/agent-src/skills/artisan-commands/SKILL.md +2 -2
- package/dist/agent-src/skills/async-python-patterns/SKILL.md +8 -7
- package/dist/agent-src/skills/authz-review/SKILL.md +16 -15
- package/dist/agent-src/skills/aws-infrastructure/SKILL.md +5 -5
- package/dist/agent-src/skills/blade-ui/SKILL.md +1 -1
- package/dist/agent-src/skills/bug-analyzer/SKILL.md +30 -12
- package/dist/agent-src/skills/code-intelligence/SKILL.md +0 -1
- package/dist/agent-src/skills/code-intelligence/evals/triggers.json +52 -0
- package/dist/agent-src/skills/code-review/SKILL.md +6 -6
- package/dist/agent-src/skills/command-routing/SKILL.md +5 -4
- package/dist/agent-src/skills/composer-packages/SKILL.md +2 -2
- package/dist/agent-src/skills/condense-memory/SKILL.md +43 -41
- package/dist/agent-src/skills/context-document/SKILL.md +23 -21
- package/dist/agent-src/skills/copilot-config/SKILL.md +6 -1
- package/dist/agent-src/skills/decision-record/SKILL.md +20 -18
- package/dist/agent-src/skills/design-intelligence/SKILL.md +4 -4
- package/dist/agent-src/skills/design-review/SKILL.md +15 -14
- package/dist/agent-src/skills/design-system-capture/reference/design-system-json.md +28 -25
- package/dist/agent-src/skills/devcontainer/SKILL.md +2 -2
- package/dist/agent-src/skills/docker/SKILL.md +1 -1
- package/dist/agent-src/skills/docx-authoring/evals/triggers.json +52 -0
- package/dist/agent-src/skills/emit-tickets/SKILL.md +2 -2
- package/dist/agent-src/skills/error-handling-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +2 -2
- package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +0 -1
- package/dist/agent-src/skills/evaluate-llm-feature/evals/triggers.json +52 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +21 -7
- package/dist/agent-src/skills/fe-design/SKILL.md +10 -0
- package/dist/agent-src/skills/feature-planning/SKILL.md +2 -2
- package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +3 -3
- package/dist/agent-src/skills/flux/SKILL.md +1 -1
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +13 -13
- package/dist/agent-src/skills/git-workflow/SKILL.md +33 -33
- package/dist/agent-src/skills/grafana/SKILL.md +5 -0
- package/dist/agent-src/skills/humanizer/SKILL.md +83 -66
- package/dist/agent-src/skills/humanizer/data/patterns.md +14 -14
- package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +4 -4
- package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +82 -37
- package/dist/agent-src/skills/judge-bug-hunter/SKILL.md +17 -5
- package/dist/agent-src/skills/judge-injection-defense/SKILL.md +63 -25
- package/dist/agent-src/skills/judge-security-auditor/SKILL.md +2 -0
- package/dist/agent-src/skills/judge-synthesis/SKILL.md +72 -28
- package/dist/agent-src/skills/laravel-horizon/SKILL.md +5 -0
- package/dist/agent-src/skills/laravel-mail/SKILL.md +5 -4
- package/dist/agent-src/skills/laravel-middleware/SKILL.md +5 -4
- package/dist/agent-src/skills/laravel-notifications/SKILL.md +10 -9
- package/dist/agent-src/skills/laravel-pennant/SKILL.md +1 -1
- package/dist/agent-src/skills/laravel-pulse/SKILL.md +9 -8
- package/dist/agent-src/skills/laravel-reverb/SKILL.md +6 -5
- package/dist/agent-src/skills/laravel-scheduling/SKILL.md +6 -1
- package/dist/agent-src/skills/laravel-validation/SKILL.md +12 -0
- package/dist/agent-src/skills/launch-readiness/SKILL.md +1 -1
- package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +7 -7
- package/dist/agent-src/skills/learning-tutor/SKILL.md +44 -43
- package/dist/agent-src/skills/learning-tutor/evals/triggers.json +52 -0
- package/dist/agent-src/skills/license-compliance-audit/SKILL.md +7 -7
- package/dist/agent-src/skills/license-compliance-borrow-check/SKILL.md +3 -3
- package/dist/agent-src/skills/license-compliance-credits/SKILL.md +4 -4
- package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +0 -1
- package/dist/agent-src/skills/memory-consolidation/SKILL.md +69 -64
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +6 -6
- package/dist/agent-src/skills/pdf-tools/evals/triggers.json +52 -0
- package/dist/agent-src/skills/performance-analysis/SKILL.md +7 -3
- package/dist/agent-src/skills/persona-improvement/SKILL.md +0 -2
- package/dist/agent-src/skills/persona-improvement/evals/triggers.json +52 -0
- package/dist/agent-src/skills/php-coder/SKILL.md +10 -0
- package/dist/agent-src/skills/prediction-pool-optimizer/SKILL.md +129 -120
- package/dist/agent-src/skills/prediction-pool-optimizer/reference/ev-fixtures.md +36 -35
- package/dist/agent-src/skills/prediction-pool-optimizer/reference/odds-and-bonus.md +45 -41
- package/dist/agent-src/skills/project-analysis-core/SKILL.md +4 -4
- package/dist/agent-src/skills/project-analysis-hypothesis-driven/SKILL.md +3 -3
- package/dist/agent-src/skills/project-analysis-react/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analysis-symfony/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analysis-zend-laminas/SKILL.md +2 -2
- package/dist/agent-src/skills/prompt-engineering-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/prompt-validator/SKILL.md +39 -39
- package/dist/agent-src/skills/quality-tools/SKILL.md +15 -15
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +55 -19
- package/dist/agent-src/skills/react-shadcn-ui/reference/registry.md +29 -27
- package/dist/agent-src/skills/readme-writing-package/SKILL.md +2 -2
- package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +25 -25
- package/dist/agent-src/skills/recursive-verification/SKILL.md +6 -5
- package/dist/agent-src/skills/refine-prompt/SKILL.md +1 -1
- package/dist/agent-src/skills/refine-ticket/SKILL.md +20 -2
- package/dist/agent-src/skills/repomix-packer/SKILL.md +1 -1
- package/dist/agent-src/skills/requesting-code-review/SKILL.md +2 -2
- package/dist/agent-src/skills/roadmap-management/SKILL.md +80 -66
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +84 -77
- package/dist/agent-src/skills/rule-refactor/SKILL.md +1 -1
- package/dist/agent-src/skills/screenshot-hygiene/evals/triggers.json +52 -0
- package/dist/agent-src/skills/security-audit/SKILL.md +26 -9
- package/dist/agent-src/skills/security-maturity-assessment/SKILL.md +38 -16
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +14 -11
- package/dist/agent-src/skills/skill-writing/SKILL.md +9 -8
- package/dist/agent-src/skills/song-to-script/SKILL.md +93 -85
- package/dist/agent-src/skills/sql-writing/SKILL.md +2 -2
- package/dist/agent-src/skills/stakeholder-tradeoff/SKILL.md +4 -3
- package/dist/agent-src/skills/standards-from-config/SKILL.md +61 -43
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +22 -8
- package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +28 -2
- package/dist/agent-src/skills/supply-chain-intake/SKILL.md +13 -13
- package/dist/agent-src/skills/systematic-debugging/SKILL.md +22 -21
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +1 -1
- package/dist/agent-src/skills/technical-specification/SKILL.md +5 -0
- package/dist/agent-src/skills/terraform/SKILL.md +2 -2
- package/dist/agent-src/skills/terragrunt/SKILL.md +8 -8
- package/dist/agent-src/skills/testing-anti-patterns/process-anti-patterns.md +1 -1
- package/dist/agent-src/skills/threat-modeling/SKILL.md +19 -13
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +0 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +9 -9
- package/dist/agent-src/skills/validate-feature-fit/SKILL.md +3 -1
- package/dist/agent-src/skills/verify-completion-evidence/SKILL.md +4 -6
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +67 -61
- package/dist/agent-src/skills/video-director/SKILL.md +7 -7
- package/dist/agent-src/skills/worktree-lifecycle/SKILL.md +3 -3
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/contexts/knowledge-pages.md +47 -45
- package/dist/agent-src/templates/contexts/lesson-card.md +2 -2
- package/dist/agent-src/templates/contexts/tenant-boundaries.md +2 -2
- package/dist/agent-src/templates/contexts.md +1 -1
- package/dist/agent-src/templates/features.md +1 -1
- package/dist/agent-src/templates/roadmaps.md +125 -116
- package/dist/agent-src/templates/rule.md +2 -1
- package/dist/agent-src/templates/scripts/pr_risk_review.ts +0 -0
- package/dist/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/dist/agent-src/templates/scripts/tier_usage_report.ts +2 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +30 -30
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +22 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +21 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +179 -0
- package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +155 -4
- package/dist/agent-src/templates/scripts/work_engine/state.ts +21 -4
- package/dist/agent-src/user-types/README.md +8 -8
- package/dist/agent-src/user-types/galabau-field-crew.md +34 -33
- package/dist/agent-src/user-types/metalworking-shop.md +35 -34
- package/dist/agent-src/user-types/truck-driver.md +22 -20
- package/dist/cli/initRouting.js +74 -11
- package/dist/cli/initRouting.js.map +1 -1
- package/dist/cli/main.js +14 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/python/workspace_roles.js +2 -2
- package/dist/cli/python/workspace_roles.js.map +1 -1
- package/dist/cli-delegate/chunk-4SV3XGFA.js +6910 -0
- package/dist/cli-delegate/chunk-736JCWLM.js +1104 -0
- package/dist/cli-delegate/chunk-7DSAMZFU.js +356 -0
- package/dist/cli-delegate/chunk-7HQ52DHU.js +74 -0
- package/dist/cli-delegate/chunk-BJGXZNPM.js +266 -0
- package/dist/cli-delegate/chunk-FTAISGDQ.js +117 -0
- package/dist/cli-delegate/chunk-GME3Q44L.js +82 -0
- package/dist/cli-delegate/chunk-GRRPEPRN.js +336 -0
- package/dist/cli-delegate/chunk-HJ6DAJHR.js +502 -0
- package/dist/cli-delegate/chunk-IR7P7JWA.js +872 -0
- package/dist/cli-delegate/chunk-J55WI3RR.js +47 -0
- package/dist/cli-delegate/chunk-MCJYCQPF.js +35 -0
- package/dist/cli-delegate/chunk-NDJLNC6Q.js +169 -0
- package/dist/cli-delegate/chunk-OMIVVCG2.js +26 -0
- package/dist/cli-delegate/chunk-OY53J6II.js +7336 -0
- package/dist/cli-delegate/chunk-RDGRHAAB.js +259 -0
- package/dist/cli-delegate/chunk-TFG57JJM.js +1969 -0
- package/dist/cli-delegate/chunk-XX6TOPD7.js +715 -0
- package/dist/cli-delegate/chunk-YMFO6FDN.js +10603 -0
- package/dist/cli-delegate/cmd_analyze_session.js +294 -0
- package/dist/cli-delegate/cmd_conformance.js +646 -0
- package/dist/cli-delegate/cmd_converge.js +326 -0
- package/dist/cli-delegate/cmd_doctor.js +144 -0
- package/dist/cli-delegate/cmd_explain.js +2508 -0
- package/dist/cli-delegate/cmd_export.js +296 -0
- package/dist/cli-delegate/cmd_fleet.js +332 -0
- package/dist/cli-delegate/cmd_memory_get.js +3878 -0
- package/dist/cli-delegate/cmd_migrate.js +11 -0
- package/dist/cli-delegate/cmd_preflight.js +270 -0
- package/dist/cli-delegate/cmd_prune.js +444 -0
- package/dist/cli-delegate/cmd_refresh.js +28 -0
- package/dist/cli-delegate/cmd_settings_check.js +574 -0
- package/dist/cli-delegate/cmd_settings_migrate.js +223 -0
- package/dist/cli-delegate/cmd_sync.js +264 -0
- package/dist/cli-delegate/cmd_uninstall.js +656 -0
- package/dist/cli-delegate/cmd_update.js +425 -0
- package/dist/cli-delegate/cmd_upgrade.js +444 -0
- package/dist/cli-delegate/cmd_validate.js +305 -0
- package/dist/cli-delegate/cmd_versions.js +370 -0
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +100 -67
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +4 -4
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +16 -10
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +7 -5
- package/dist/hooks/dispatch.js +186 -12
- package/dist/install/emit_host_rules_cli.js +2 -1
- package/dist/install/emit_host_rules_cli.js.map +1 -1
- package/dist/install/install.mjs +418 -378
- package/dist/install/rule_scope.js +5 -1
- package/dist/install/rule_scope.js.map +1 -1
- package/dist/install/toolDetection.js +40 -12
- package/dist/install/toolDetection.js.map +1 -1
- package/dist/install/wizard-plan.js +2 -2
- package/dist/install/wizard-plan.js.map +1 -1
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +2194 -1003
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/compile_time_toggles.js +48 -0
- package/dist/scripts/_lib/compile_time_toggles.js.map +1 -0
- package/dist/scripts/condense.js +234 -217
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +4 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/shared/userMd/utils.js +30 -0
- package/dist/shared/userMd/utils.js.map +1 -1
- package/dist/ui/assets/index-BpSQt5vm.js.map +1 -1
- package/docs/guidelines/agent-infra/api-cost-levers.md +56 -5
- package/docs/guidelines/agent-infra/simplicity-and-goal-demos.md +93 -33
- package/package.json +4 -2
- package/src/agent-src/templates/scripts/pr_risk_review.ts +0 -0
- package/src/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/src/agent-src/templates/scripts/tier_usage_report.ts +2 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +30 -30
- package/src/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
- package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +22 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +21 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +179 -0
- package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +155 -4
- package/src/agent-src/templates/scripts/work_engine/state.ts +21 -4
- package/src/config/agent-settings.template.yml +32 -2
- package/src/config/ci-local-parity.yml +142 -0
- package/src/config/discovery/packs.yml +7 -0
- package/src/config/evaluator-budgets.json +1 -1
- package/src/config/gate-coverage.yml +127 -0
- package/src/config/pack-size-budget.json +27 -0
- package/src/config/preamble-payload-budget.json +44 -0
- package/src/install/emit_host_rules_cli.ts +2 -1
- package/src/install/rule_scope.ts +5 -1
- package/src/install/toolDetection.ts +39 -8
- package/src/install/wizard-plan.ts +2 -2
- package/src/scripts/_cli/cmd_conformance.ts +2 -1
- package/src/scripts/_cli/cmd_converge.ts +2 -1
- package/src/scripts/_cli/cmd_doctor.ts +292 -15
- package/src/scripts/_cli/cmd_export.ts +2 -1
- package/src/scripts/_cli/cmd_fleet.ts +2 -1
- package/src/scripts/_cli/cmd_migrate.ts +2 -1
- package/src/scripts/_cli/cmd_preflight.ts +2 -1
- package/src/scripts/_cli/cmd_refresh.ts +2 -1
- package/src/scripts/_cli/cmd_update.ts +2 -1
- package/src/scripts/_cli/cmd_upgrade.ts +2 -1
- package/src/scripts/_cli/cmd_versions.ts +2 -1
- package/src/scripts/_cli/detection_report.ts +480 -0
- package/src/scripts/_dispatch.bash +52 -14
- package/src/scripts/_lib/agent_user_profile.ts +381 -0
- package/src/scripts/_lib/agents_overlay.ts +9 -0
- package/src/scripts/_lib/anchor_eval.ts +311 -0
- package/src/scripts/_lib/cc_transcript.ts +316 -0
- package/src/scripts/_lib/changelog_eras.ts +103 -9
- package/src/scripts/_lib/compile_time_toggles.ts +79 -0
- package/src/scripts/_lib/confusables.ts +101 -0
- package/src/scripts/_lib/duplicate_scope_census.ts +77 -0
- package/src/scripts/_lib/environment_detector.ts +441 -0
- package/src/scripts/_lib/managed_agents_folder.ts +181 -0
- package/src/scripts/_lib/package_root.ts +72 -0
- package/src/scripts/_lib/payload_hash_drift.ts +126 -0
- package/src/scripts/_lib/preservation_migration.ts +291 -0
- package/src/scripts/_lib/retrieval_sanitize.ts +166 -2
- package/src/scripts/_lib/scan_scope.ts +115 -0
- package/src/scripts/_lib/user_global_memory_audit.ts +187 -0
- package/src/scripts/_lib/user_global_observations.ts +830 -0
- package/src/scripts/_lib/user_global_revocations.ts +110 -0
- package/src/scripts/_lib/user_memory_gate_counters.ts +291 -0
- package/src/scripts/ai_council/blind_review.ts +0 -0
- package/src/scripts/ai_council/budget_guard.ts +90 -11
- package/src/scripts/ai_council/bundler.ts +2 -2
- package/src/scripts/ai_council/clients.ts +59 -3
- package/src/scripts/ai_council/config.ts +53 -7
- package/src/scripts/ai_council/modes.ts +68 -2
- package/src/scripts/ai_council/orchestrator.ts +54 -9
- package/src/scripts/ai_council/transport_resolver.ts +331 -0
- package/src/scripts/ai_team/team_dispatch.ts +17 -6
- package/src/scripts/anchor_eval_falsify.ts +198 -0
- package/src/scripts/anchor_scoring_run.ts +239 -0
- package/src/scripts/annotate_discovery.ts +1 -65
- package/src/scripts/bench_quality_run.ts +168 -4
- package/src/scripts/cache_realization_report.ts +782 -0
- package/src/scripts/check_artefact_count_messaging.ts +5 -1
- package/src/scripts/check_augment_description_cap.ts +15 -4
- package/src/scripts/check_bundle_path_leakage.ts +10 -4
- package/src/scripts/check_ci_local_parity.ts +317 -0
- package/src/scripts/check_condensation.ts +96 -191
- package/src/scripts/check_context_paths.ts +38 -9
- package/src/scripts/check_dependency_floors.ts +153 -0
- package/src/scripts/check_gate_coverage.ts +299 -0
- package/src/scripts/check_iron_law_prominence.ts +22 -1
- package/src/scripts/check_kernel_prefix_stability.ts +0 -0
- package/src/scripts/check_no_new_legacy_path.ts +16 -6
- package/src/scripts/check_no_roadmap_refs.ts +22 -9
- package/src/scripts/check_originality_freshness.ts +167 -0
- package/src/scripts/check_pack_size.ts +188 -0
- package/src/scripts/check_preamble_payload_budget.ts +130 -0
- package/src/scripts/check_proposal.ts +0 -0
- package/src/scripts/check_references.ts +0 -1
- package/src/scripts/check_safety_floor_untouched.ts +171 -24
- package/src/scripts/check_site_links.ts +62 -3
- package/src/scripts/ci_status.ts +0 -0
- package/src/scripts/cluster_near_miss_patterns.ts +0 -0
- package/src/scripts/code_graph/build.ts +0 -0
- package/src/scripts/command_suggester/types.ts +0 -0
- package/src/scripts/compile_router.ts +10 -14
- package/src/scripts/condense.sh +3 -4
- package/src/scripts/condense.ts +247 -228
- package/src/scripts/cost/track.mjs +168 -33
- package/src/scripts/cost_summary.ts +33 -1
- package/src/scripts/council_cli.ts +51 -5
- package/src/scripts/discovery_graph.ts +0 -0
- package/src/scripts/encoding_corpus.ts +500 -0
- package/src/scripts/encoding_corpus_report.ts +216 -0
- package/src/scripts/evaluator_umbrella.sh +34 -1
- package/src/scripts/generate_index.ts +19 -2
- package/src/scripts/install-hooks.sh +2 -2
- package/src/scripts/learning_sidecar.ts +0 -0
- package/src/scripts/lint_confusables.ts +10 -72
- package/src/scripts/lint_eval_fixture_citations.ts +113 -0
- package/src/scripts/lint_featured_skills.ts +0 -0
- package/src/scripts/lint_hidden_unicode.ts +208 -0
- package/src/scripts/lint_load_context.ts +17 -5
- package/src/scripts/lint_new_skill_gate.ts +9 -3
- package/src/scripts/lint_no_python_twin_rationale.ts +17 -2
- package/src/scripts/lint_originality.ts +1 -1
- package/src/scripts/lint_skill_originality.ts +1 -1
- package/src/scripts/lint_ticket_buildable.ts +1 -1
- package/src/scripts/lint_ui_stack_bundles.ts +170 -0
- package/src/scripts/mcp_server/tools.ts +4 -4
- package/src/scripts/measure_scope_dedup.ts +224 -0
- package/src/scripts/memory_lookup.ts +0 -0
- package/src/scripts/mine_session.ts +98 -0
- package/src/scripts/orchestration_payload_hash_drift.ts +145 -0
- package/src/scripts/preamble_byte_census.ts +574 -0
- package/src/scripts/probe_skill_registration.ts +2 -2
- package/src/scripts/redact_hook_capture.ts +13 -0
- package/src/scripts/release.ts +65 -10
- package/src/scripts/router_telemetry.ts +1 -1
- package/src/scripts/second_brain_retrieval.ts +14 -4
- package/src/scripts/skill_linter.ts +5 -0
- package/src/scripts/surface-tiers.yml +2 -0
- package/src/scripts/validate_pack_yaml.ts +0 -0
- package/src/server/schemas/settings.ts +8 -0
- package/src/shared/userMd/utils.ts +31 -0
- package/dist/agent-src/rules/telegraph-speak.md +0 -87
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_STATE_PATH,
|
|
4
|
+
_is_newer,
|
|
5
|
+
fetch_latest_from_npm
|
|
6
|
+
} from "./chunk-7HQ52DHU.js";
|
|
7
|
+
import {
|
|
8
|
+
lockfile_path,
|
|
9
|
+
lockfile_write_path,
|
|
10
|
+
read_lockfile,
|
|
11
|
+
write_lockfile
|
|
12
|
+
} from "./chunk-GRRPEPRN.js";
|
|
13
|
+
import {
|
|
14
|
+
DEFAULT_PROJECT_FILE,
|
|
15
|
+
LOCAL_PROJECT_FILE,
|
|
16
|
+
LOCAL_PROJECT_SUBDIR,
|
|
17
|
+
find_project_root,
|
|
18
|
+
resolve_project_root
|
|
19
|
+
} from "./chunk-HJ6DAJHR.js";
|
|
20
|
+
import "./chunk-NDJLNC6Q.js";
|
|
21
|
+
import {
|
|
22
|
+
resolvePackageRoot
|
|
23
|
+
} from "./chunk-MCJYCQPF.js";
|
|
24
|
+
import "./chunk-J55WI3RR.js";
|
|
25
|
+
|
|
26
|
+
// src/scripts/_cli/cmd_update.ts
|
|
27
|
+
import { spawnSync } from "node:child_process";
|
|
28
|
+
import { randomBytes } from "node:crypto";
|
|
29
|
+
import * as fs from "node:fs";
|
|
30
|
+
import * as path from "node:path";
|
|
31
|
+
import process from "node:process";
|
|
32
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
33
|
+
var PACKAGE_NAME = "@event4u/agent-config";
|
|
34
|
+
var PIN_KEY = "agent_config_version";
|
|
35
|
+
var REGISTRY_VERSION_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/{version}`;
|
|
36
|
+
var PIN_LINE_RE = /^(\s*agent_config_version\s*:\s*)(.*)$/m;
|
|
37
|
+
var _HERE = fileURLToPath(import.meta.url);
|
|
38
|
+
var _HERE_DIR = path.dirname(_HERE);
|
|
39
|
+
var ArgparseExit = class extends Error {
|
|
40
|
+
code;
|
|
41
|
+
constructor(code) {
|
|
42
|
+
super(`ArgparseExit(${code})`);
|
|
43
|
+
this.name = "ArgparseExit";
|
|
44
|
+
this.code = code;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var _stdout = { write: (t) => process.stdout.write(t) };
|
|
48
|
+
var _stderr = { write: (t) => process.stderr.write(t) };
|
|
49
|
+
function _print(out, line = "") {
|
|
50
|
+
out.write(line + "\n");
|
|
51
|
+
}
|
|
52
|
+
function _isFile(p) {
|
|
53
|
+
try {
|
|
54
|
+
return fs.statSync(p).isFile();
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function _splitlinesKeepends(text) {
|
|
60
|
+
const out = [];
|
|
61
|
+
let buf = "";
|
|
62
|
+
for (let i = 0; i < text.length; i++) {
|
|
63
|
+
const ch = text[i];
|
|
64
|
+
buf += ch;
|
|
65
|
+
if (ch === "\n") {
|
|
66
|
+
out.push(buf);
|
|
67
|
+
buf = "";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (buf) {
|
|
71
|
+
out.push(buf);
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
function _canonical_settings_path(project_root) {
|
|
76
|
+
return path.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
|
|
77
|
+
}
|
|
78
|
+
function _local_settings_path(project_root) {
|
|
79
|
+
return path.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
|
|
80
|
+
}
|
|
81
|
+
function _resolve(p) {
|
|
82
|
+
return path.resolve(p);
|
|
83
|
+
}
|
|
84
|
+
function _resolve_cascade_paths(cwd, project_path) {
|
|
85
|
+
if (cwd === null) {
|
|
86
|
+
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
87
|
+
const parent = path.dirname(legacy);
|
|
88
|
+
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
89
|
+
}
|
|
90
|
+
const root = find_project_root(cwd);
|
|
91
|
+
if (root === null) {
|
|
92
|
+
const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
|
|
93
|
+
const parent = path.dirname(legacy);
|
|
94
|
+
return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
|
|
95
|
+
}
|
|
96
|
+
const cwd_resolved = _resolve(cwd);
|
|
97
|
+
const chain = [];
|
|
98
|
+
let cursor = cwd_resolved;
|
|
99
|
+
for (; ; ) {
|
|
100
|
+
chain.push(cursor);
|
|
101
|
+
if (cursor === root) {
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
const parent = path.dirname(cursor);
|
|
105
|
+
if (parent === cursor) {
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
cursor = parent;
|
|
109
|
+
}
|
|
110
|
+
chain.reverse();
|
|
111
|
+
const out = [];
|
|
112
|
+
for (const dir of chain) {
|
|
113
|
+
out.push(path.join(dir, DEFAULT_PROJECT_FILE));
|
|
114
|
+
out.push(_canonical_settings_path(dir));
|
|
115
|
+
out.push(_local_settings_path(dir));
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
function _read_state(state_path) {
|
|
120
|
+
try {
|
|
121
|
+
const raw = fs.readFileSync(state_path, "utf-8");
|
|
122
|
+
const data = JSON.parse(raw);
|
|
123
|
+
if (data !== null && typeof data === "object" && !Array.isArray(data)) {
|
|
124
|
+
return data;
|
|
125
|
+
}
|
|
126
|
+
} catch {
|
|
127
|
+
}
|
|
128
|
+
return {};
|
|
129
|
+
}
|
|
130
|
+
function _write_state(state_path, payload) {
|
|
131
|
+
const parent = path.dirname(state_path);
|
|
132
|
+
fs.mkdirSync(parent, { recursive: true });
|
|
133
|
+
const tmp = path.join(parent, `.update-check-${randomBytes(8).toString("hex")}`);
|
|
134
|
+
try {
|
|
135
|
+
const sorted = {};
|
|
136
|
+
for (const key of Object.keys(payload).sort()) {
|
|
137
|
+
sorted[key] = payload[key];
|
|
138
|
+
}
|
|
139
|
+
fs.writeFileSync(tmp, JSON.stringify(sorted, null, 2), { encoding: "utf-8", mode: 384 });
|
|
140
|
+
fs.chmodSync(tmp, 384);
|
|
141
|
+
fs.renameSync(tmp, state_path);
|
|
142
|
+
} catch (err) {
|
|
143
|
+
try {
|
|
144
|
+
fs.unlinkSync(tmp);
|
|
145
|
+
} catch {
|
|
146
|
+
}
|
|
147
|
+
throw err;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function _normalize(version) {
|
|
151
|
+
return version.trim().replace(/^v+/, "");
|
|
152
|
+
}
|
|
153
|
+
async function _registry_has_version(version, timeout = 1) {
|
|
154
|
+
const url = REGISTRY_VERSION_URL.replace("{version}", _normalize(version));
|
|
155
|
+
try {
|
|
156
|
+
const resp = await fetch(url, {
|
|
157
|
+
headers: { Accept: "application/json" },
|
|
158
|
+
signal: AbortSignal.timeout(timeout * 1e3)
|
|
159
|
+
});
|
|
160
|
+
return resp.status === 200;
|
|
161
|
+
} catch {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function _find_pin_file(cwd) {
|
|
166
|
+
const cascade = _resolve_cascade_paths(cwd, null);
|
|
167
|
+
for (const p of [...cascade].reverse()) {
|
|
168
|
+
if (_isFile(p) && _read_pin_line(p) !== null) {
|
|
169
|
+
return p;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (cascade.length) {
|
|
173
|
+
return cascade[0];
|
|
174
|
+
}
|
|
175
|
+
return path.join(cwd, DEFAULT_PROJECT_FILE);
|
|
176
|
+
}
|
|
177
|
+
function _read_pin_line(p) {
|
|
178
|
+
let text;
|
|
179
|
+
try {
|
|
180
|
+
text = fs.readFileSync(p, { encoding: "utf-8" });
|
|
181
|
+
} catch {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
const lines = _splitlinesKeepends(text);
|
|
185
|
+
for (let idx = 0; idx < lines.length; idx++) {
|
|
186
|
+
if (PIN_LINE_RE.test(lines[idx])) {
|
|
187
|
+
return idx;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
function _write_pin(p, new_version) {
|
|
193
|
+
const target = `agent_config_version: "${_normalize(new_version)}"
|
|
194
|
+
`;
|
|
195
|
+
let lines;
|
|
196
|
+
try {
|
|
197
|
+
lines = _splitlinesKeepends(fs.readFileSync(p, { encoding: "utf-8" }));
|
|
198
|
+
} catch (err) {
|
|
199
|
+
const e = err;
|
|
200
|
+
if (e && e.code === "ENOENT") {
|
|
201
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
202
|
+
fs.writeFileSync(p, target, { encoding: "utf-8" });
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
throw err;
|
|
206
|
+
}
|
|
207
|
+
for (let idx = 0; idx < lines.length; idx++) {
|
|
208
|
+
if (PIN_LINE_RE.test(lines[idx])) {
|
|
209
|
+
if (lines[idx] === target) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
lines[idx] = target;
|
|
213
|
+
fs.writeFileSync(p, lines.join(""), { encoding: "utf-8" });
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (lines.length && !lines[lines.length - 1].endsWith("\n")) {
|
|
218
|
+
lines.push("\n");
|
|
219
|
+
}
|
|
220
|
+
lines.push(target);
|
|
221
|
+
fs.writeFileSync(p, lines.join(""), { encoding: "utf-8" });
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
function _warm_npx_cache(version, runner) {
|
|
225
|
+
const run = runner ?? ((argv) => {
|
|
226
|
+
spawnSync(argv[0], argv.slice(1), {
|
|
227
|
+
stdio: "ignore",
|
|
228
|
+
timeout: 120 * 1e3
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
try {
|
|
232
|
+
run(["npx", "--yes", `${PACKAGE_NAME}@${_normalize(version)}`, "--version"]);
|
|
233
|
+
} catch {
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function _refresh_state(installed, latest, state_path) {
|
|
237
|
+
const state = _read_state(state_path);
|
|
238
|
+
const payload = {
|
|
239
|
+
last_check_utc: _isoNowZ(),
|
|
240
|
+
last_seen_version: latest,
|
|
241
|
+
installed_version: installed
|
|
242
|
+
};
|
|
243
|
+
Object.assign(state, payload);
|
|
244
|
+
try {
|
|
245
|
+
_write_state(state_path, state);
|
|
246
|
+
} catch {
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function _isoNowZ() {
|
|
250
|
+
const d = /* @__PURE__ */ new Date();
|
|
251
|
+
const p = (n, w = 2) => String(n).padStart(w, "0");
|
|
252
|
+
return `${p(d.getUTCFullYear(), 4)}-${p(d.getUTCMonth() + 1)}-${p(d.getUTCDate())}T${p(d.getUTCHours())}:${p(d.getUTCMinutes())}:${p(d.getUTCSeconds())}Z`;
|
|
253
|
+
}
|
|
254
|
+
function _parse(argv) {
|
|
255
|
+
const prog = "agent-config update";
|
|
256
|
+
const usage = "usage: agent-config update [-h] [--check] [--to VERSION] [--offline]\n";
|
|
257
|
+
const emitError = (msg) => {
|
|
258
|
+
_stderr.write(usage);
|
|
259
|
+
_stderr.write(`${prog}: error: ${msg}
|
|
260
|
+
`);
|
|
261
|
+
throw new ArgparseExit(2);
|
|
262
|
+
};
|
|
263
|
+
const args = { check: false, to: null, offline: false };
|
|
264
|
+
let i = 0;
|
|
265
|
+
while (i < argv.length) {
|
|
266
|
+
const tok = argv[i];
|
|
267
|
+
const flag = tok.includes("=") ? tok.slice(0, tok.indexOf("=")) : tok;
|
|
268
|
+
if (flag === "-h" || flag === "--help") {
|
|
269
|
+
_stdout.write(usage);
|
|
270
|
+
throw new ArgparseExit(0);
|
|
271
|
+
} else if (flag === "--check") {
|
|
272
|
+
args.check = true;
|
|
273
|
+
i += 1;
|
|
274
|
+
} else if (flag === "--offline") {
|
|
275
|
+
args.offline = true;
|
|
276
|
+
i += 1;
|
|
277
|
+
} else if (flag === "--to") {
|
|
278
|
+
const eq = tok.indexOf("=");
|
|
279
|
+
if (eq >= 0) {
|
|
280
|
+
args.to = tok.slice(eq + 1);
|
|
281
|
+
i += 1;
|
|
282
|
+
} else {
|
|
283
|
+
const val = argv[i + 1];
|
|
284
|
+
if (val === void 0) {
|
|
285
|
+
emitError("argument --to: expected one argument");
|
|
286
|
+
}
|
|
287
|
+
args.to = val;
|
|
288
|
+
i += 2;
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
emitError(`unrecognized arguments: ${tok}`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return args;
|
|
295
|
+
}
|
|
296
|
+
async function main(argv = null, options = {}) {
|
|
297
|
+
const out = options.out ?? _stdout;
|
|
298
|
+
const err = options.err ?? _stderr;
|
|
299
|
+
const fetcher = options.fetcher ?? (() => fetch_latest_from_npm());
|
|
300
|
+
const version_checker = options.version_checker ?? _registry_has_version;
|
|
301
|
+
const cache_warmer = options.cache_warmer ?? ((v) => _warm_npx_cache(v));
|
|
302
|
+
const args = _parse(argv ?? process.argv.slice(2));
|
|
303
|
+
const [cwd] = resolve_project_root(null, { cwd: options.cwd ?? null });
|
|
304
|
+
const installed_version = options.installed_version || _detect_installed_version();
|
|
305
|
+
const state_path = options.state_path || DEFAULT_STATE_PATH;
|
|
306
|
+
const offline = args.offline || process.env["AGENT_CONFIG_OFFLINE"] === "1";
|
|
307
|
+
if (offline && !args.to) {
|
|
308
|
+
_print(
|
|
309
|
+
err,
|
|
310
|
+
"\u274C agent-config: --offline requires --to <version> (no registry, no 'latest' to fetch)."
|
|
311
|
+
);
|
|
312
|
+
return 1;
|
|
313
|
+
}
|
|
314
|
+
let latest;
|
|
315
|
+
if (args.to) {
|
|
316
|
+
const target = _normalize(args.to);
|
|
317
|
+
if (offline) {
|
|
318
|
+
latest = target;
|
|
319
|
+
} else if (!await version_checker(target)) {
|
|
320
|
+
_print(err, `\u274C agent-config: version ${target} not found on the npm registry.`);
|
|
321
|
+
return 1;
|
|
322
|
+
} else {
|
|
323
|
+
latest = target;
|
|
324
|
+
}
|
|
325
|
+
} else {
|
|
326
|
+
const fetched = await fetcher();
|
|
327
|
+
if (!fetched) {
|
|
328
|
+
_print(
|
|
329
|
+
err,
|
|
330
|
+
"\u274C agent-config: failed to fetch latest version from the npm registry."
|
|
331
|
+
);
|
|
332
|
+
return 1;
|
|
333
|
+
}
|
|
334
|
+
latest = _normalize(fetched);
|
|
335
|
+
}
|
|
336
|
+
if (args.check) {
|
|
337
|
+
if (_is_newer(latest, installed_version)) {
|
|
338
|
+
_print(out, `agent-config ${latest} available (you have ${installed_version}).`);
|
|
339
|
+
_print(out, `Update: npx ${PACKAGE_NAME} update`);
|
|
340
|
+
} else {
|
|
341
|
+
_print(out, `agent-config is up to date (${installed_version}).`);
|
|
342
|
+
}
|
|
343
|
+
return 0;
|
|
344
|
+
}
|
|
345
|
+
const pin_file = _find_pin_file(cwd);
|
|
346
|
+
const changed = _write_pin(pin_file, latest);
|
|
347
|
+
const rel = _relativeToOr(pin_file, cwd);
|
|
348
|
+
if (changed) {
|
|
349
|
+
_print(out, `\u2705 Pinned ${PACKAGE_NAME} to ${latest} in ${rel}.`);
|
|
350
|
+
} else {
|
|
351
|
+
_print(out, `\u2139\uFE0F ${rel} already pins to ${latest}.`);
|
|
352
|
+
}
|
|
353
|
+
if (!offline) {
|
|
354
|
+
cache_warmer(latest);
|
|
355
|
+
}
|
|
356
|
+
_refresh_state(latest, latest, state_path);
|
|
357
|
+
_refresh_global_lockfile(latest, out);
|
|
358
|
+
return 0;
|
|
359
|
+
}
|
|
360
|
+
function _relativeToOr(target, base) {
|
|
361
|
+
const rel = path.relative(base, target);
|
|
362
|
+
if (rel.startsWith("..") || path.isAbsolute(rel)) {
|
|
363
|
+
return target;
|
|
364
|
+
}
|
|
365
|
+
return rel;
|
|
366
|
+
}
|
|
367
|
+
function _refresh_global_lockfile(version, out) {
|
|
368
|
+
const read_path = lockfile_path();
|
|
369
|
+
const write_path = lockfile_write_path();
|
|
370
|
+
const existing = read_lockfile(read_path);
|
|
371
|
+
if (existing === null) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const recorded = existing["agent_config_version"];
|
|
375
|
+
const tools = [...existing.tools ?? []];
|
|
376
|
+
if (recorded === version && read_path === write_path) {
|
|
377
|
+
_print(out, `\u2139\uFE0F ${write_path} already records ${version}.`);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
write_lockfile(version, tools, { path: write_path });
|
|
381
|
+
_print(out, `\u2705 Refreshed global lockfile at ${write_path}.`);
|
|
382
|
+
}
|
|
383
|
+
function _detect_installed_version() {
|
|
384
|
+
const pkg_json = path.join(resolvePackageRoot(import.meta.url), "package.json");
|
|
385
|
+
try {
|
|
386
|
+
const data = JSON.parse(fs.readFileSync(pkg_json, { encoding: "utf-8" }));
|
|
387
|
+
const version = data["version"];
|
|
388
|
+
if (typeof version === "string" && version.trim()) {
|
|
389
|
+
return version.trim();
|
|
390
|
+
}
|
|
391
|
+
} catch {
|
|
392
|
+
}
|
|
393
|
+
return "0.0.0";
|
|
394
|
+
}
|
|
395
|
+
function _isCliEntry() {
|
|
396
|
+
if (process.argv[1] === void 0) {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
const argvUrl = pathToFileURL(path.resolve(process.argv[1])).href;
|
|
400
|
+
if (import.meta.url === argvUrl) {
|
|
401
|
+
return true;
|
|
402
|
+
}
|
|
403
|
+
try {
|
|
404
|
+
const here = fs.realpathSync(fileURLToPath(import.meta.url));
|
|
405
|
+
const argv = fs.realpathSync(path.resolve(process.argv[1]));
|
|
406
|
+
return here === argv;
|
|
407
|
+
} catch {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (_isCliEntry() || process.argv[1] === _HERE) {
|
|
412
|
+
main(process.argv.slice(2)).then((code) => {
|
|
413
|
+
process.exitCode = code;
|
|
414
|
+
}).catch((exc) => {
|
|
415
|
+
if (exc instanceof ArgparseExit) {
|
|
416
|
+
process.exitCode = exc.code;
|
|
417
|
+
} else {
|
|
418
|
+
throw exc;
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
export {
|
|
423
|
+
PIN_KEY,
|
|
424
|
+
main
|
|
425
|
+
};
|