@bonesofspring/ai-rules 0.2.74 → 0.2.77
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/CHANGELOG.md +119 -0
- package/README.md +2 -2
- package/bin/lib/engine-scripts.js +4 -0
- package/docs/PRESET-CONTRIBUTION.md +6 -3
- package/docs/TEAM-DB.md +10 -0
- package/docs/TOKEN-ECONOMY.md +18 -5
- package/docs/ZCODE.md +1 -1
- package/package.json +6 -2
- package/presets/_shared/ai-local/scripts/check-write-scope.mjs +126 -34
- package/presets/_shared/ai-local/scripts/lock.mjs +103 -30
- package/presets/_shared/ai-local/scripts/rule-improver.mjs +4 -0
- package/presets/_shared/ai-local/scripts/run-compact.mjs +132 -0
- package/presets/_shared/ai-local/scripts/signals.mjs +3 -1
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +7 -2
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +276 -1
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +32 -2
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +99 -0
- package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +3 -1
- package/presets/_shared/core/agent-team/agent-task-metrics.md +29 -0
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
- package/presets/_shared/core/architecture/feature-delivery-workflow.md +1 -1
- package/presets/_shared/core/meta/preset-pr-checklist.md +2 -2
- package/presets/_shared/core/quality/context-and-iteration.md +1 -1
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +4 -1
- package/presets/_shared/hooks/compact-shell-output.mjs +68 -0
- package/presets/claude/android-kotlin/CLAUDE.md +1 -1
- package/presets/claude/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/claude/android-kotlin/agents/README.md +4 -0
- package/presets/claude/android-kotlin/agents/accessibility-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/claude/android-kotlin/agents/ci-investigator.md +0 -1
- package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/codebase-analyzer.md +1 -1
- package/presets/claude/android-kotlin/agents/debugger.md +0 -1
- package/presets/claude/android-kotlin/agents/feature-developer.md +0 -1
- package/presets/claude/android-kotlin/agents/migration-specialist.md +1 -1
- package/presets/claude/android-kotlin/agents/mockup-reviewer.md +1 -0
- package/presets/claude/android-kotlin/agents/openspec-author.md +2 -1
- package/presets/claude/android-kotlin/agents/performance-auditor.md +1 -1
- package/presets/claude/android-kotlin/agents/qa-tester.md +0 -1
- package/presets/claude/android-kotlin/agents/security-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/solution-architect.md +1 -1
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/agents/task-router.md +1 -1
- package/presets/claude/android-kotlin/agents/tech-writer.md +1 -1
- package/presets/claude/android-kotlin/agents/unit-test-generator.md +0 -1
- package/presets/claude/android-kotlin/agents/unit-test-healer.md +0 -1
- package/presets/claude/android-kotlin/agents/unit-test-planner.md +1 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/android-kotlin/rules/architecture/feature-delivery.md +66 -8
- package/presets/claude/android-kotlin/rules/architecture/reference-features.md +48 -2
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/android-kotlin/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/android-kotlin/team/README.md +1 -1
- package/presets/claude/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/go/CLAUDE.md +1 -1
- package/presets/claude/go/REPO_AGENTS.md +8 -0
- package/presets/claude/go/agents/README.md +4 -0
- package/presets/claude/go/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/go/agents/build-verifier.md +1 -1
- package/presets/claude/go/agents/ci-investigator.md +0 -1
- package/presets/claude/go/agents/code-reviewer.md +3 -3
- package/presets/claude/go/agents/codebase-analyzer.md +1 -1
- package/presets/claude/go/agents/debugger.md +0 -1
- package/presets/claude/go/agents/feature-developer.md +2 -3
- package/presets/claude/go/agents/integration-test-generator.md +1 -2
- package/presets/claude/go/agents/integration-test-healer.md +1 -2
- package/presets/claude/go/agents/integration-test-planner.md +1 -2
- package/presets/claude/go/agents/migration-specialist.md +1 -1
- package/presets/claude/go/agents/openspec-author.md +2 -1
- package/presets/claude/go/agents/performance-auditor.md +1 -1
- package/presets/claude/go/agents/qa-tester.md +0 -1
- package/presets/claude/go/agents/security-reviewer.md +2 -2
- package/presets/claude/go/agents/solution-architect.md +1 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/agents/task-router.md +1 -1
- package/presets/claude/go/agents/tech-writer.md +1 -1
- package/presets/claude/go/agents/unit-test-generator.md +1 -2
- package/presets/claude/go/agents/unit-test-healer.md +1 -2
- package/presets/claude/go/agents/unit-test-planner.md +1 -1
- package/presets/claude/go/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/go/rules/architecture/feature-delivery.md +50 -1
- package/presets/claude/go/rules/architecture/reference-features.md +22 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/go/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/go/team/README.md +1 -1
- package/presets/claude/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/ios-swift/CLAUDE.md +1 -1
- package/presets/claude/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/claude/ios-swift/agents/README.md +4 -0
- package/presets/claude/ios-swift/agents/accessibility-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
- package/presets/claude/ios-swift/agents/ci-investigator.md +0 -1
- package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/codebase-analyzer.md +1 -1
- package/presets/claude/ios-swift/agents/debugger.md +0 -1
- package/presets/claude/ios-swift/agents/feature-developer.md +0 -1
- package/presets/claude/ios-swift/agents/migration-specialist.md +1 -1
- package/presets/claude/ios-swift/agents/mockup-reviewer.md +1 -0
- package/presets/claude/ios-swift/agents/openspec-author.md +2 -1
- package/presets/claude/ios-swift/agents/performance-auditor.md +1 -1
- package/presets/claude/ios-swift/agents/qa-tester.md +0 -1
- package/presets/claude/ios-swift/agents/security-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/solution-architect.md +1 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/agents/task-router.md +1 -1
- package/presets/claude/ios-swift/agents/tech-writer.md +1 -1
- package/presets/claude/ios-swift/agents/unit-test-generator.md +0 -1
- package/presets/claude/ios-swift/agents/unit-test-healer.md +0 -1
- package/presets/claude/ios-swift/agents/unit-test-planner.md +1 -1
- package/presets/claude/ios-swift/agents/xcuitest-test-generator.md +0 -1
- package/presets/claude/ios-swift/agents/xcuitest-test-healer.md +0 -1
- package/presets/claude/ios-swift/agents/xcuitest-test-planner.md +0 -1
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +8 -8
- package/presets/claude/ios-swift/rules/architecture/reference-features.md +2 -21
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/ios-swift/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/ios-swift/team/README.md +1 -1
- package/presets/claude/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/java/CLAUDE.md +2 -2
- package/presets/claude/java/REPO_AGENTS.md +8 -0
- package/presets/claude/java/agents/README.md +4 -0
- package/presets/claude/java/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/java/agents/build-verifier.md +1 -1
- package/presets/claude/java/agents/ci-investigator.md +0 -1
- package/presets/claude/java/agents/code-reviewer.md +3 -3
- package/presets/claude/java/agents/codebase-analyzer.md +1 -1
- package/presets/claude/java/agents/debugger.md +0 -1
- package/presets/claude/java/agents/feature-developer.md +2 -3
- package/presets/claude/java/agents/integration-test-generator.md +1 -2
- package/presets/claude/java/agents/integration-test-healer.md +1 -2
- package/presets/claude/java/agents/integration-test-planner.md +1 -2
- package/presets/claude/java/agents/migration-specialist.md +1 -1
- package/presets/claude/java/agents/openspec-author.md +2 -1
- package/presets/claude/java/agents/performance-auditor.md +1 -1
- package/presets/claude/java/agents/qa-tester.md +0 -1
- package/presets/claude/java/agents/security-reviewer.md +2 -2
- package/presets/claude/java/agents/solution-architect.md +1 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/agents/task-router.md +1 -1
- package/presets/claude/java/agents/tech-writer.md +1 -1
- package/presets/claude/java/agents/unit-test-generator.md +1 -2
- package/presets/claude/java/agents/unit-test-healer.md +1 -2
- package/presets/claude/java/agents/unit-test-planner.md +1 -1
- package/presets/claude/java/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/java/rules/architecture/feature-delivery.md +51 -1
- package/presets/claude/java/rules/architecture/reference-features.md +22 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/java/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/java/team/README.md +1 -1
- package/presets/claude/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/mcp-ts/CLAUDE.md +1 -1
- package/presets/claude/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/claude/mcp-ts/agents/README.md +4 -0
- package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/claude/mcp-ts/agents/feature-developer.md +2 -3
- package/presets/claude/mcp-ts/agents/security-reviewer.md +2 -2
- package/presets/claude/mcp-ts/agents/solution-architect.md +1 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/agents/task-router.md +1 -1
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +47 -1
- package/presets/claude/mcp-ts/rules/architecture/reference-features.md +22 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/mcp-ts/skills/code-review/SKILL.md +1 -1
- package/presets/claude/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/mcp-ts/team/README.md +1 -1
- package/presets/claude/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/mol/CLAUDE.md +1 -1
- package/presets/claude/mol/REPO_AGENTS.md +8 -0
- package/presets/claude/mol/agents/README.md +2 -4
- package/presets/claude/mol/agents/accessibility-reviewer.md +1 -0
- package/presets/claude/mol/agents/api-contract-reviewer.md +1 -0
- package/presets/claude/mol/agents/build-verifier.md +1 -0
- package/presets/claude/mol/agents/code-reviewer.md +1 -0
- package/presets/claude/mol/agents/codebase-analyzer.md +1 -0
- package/presets/claude/mol/agents/migration-specialist.md +1 -0
- package/presets/claude/mol/agents/mockup-reviewer.md +1 -0
- package/presets/claude/mol/agents/openspec-author.md +1 -0
- package/presets/claude/mol/agents/performance-auditor.md +1 -0
- package/presets/claude/mol/agents/security-reviewer.md +1 -0
- package/presets/claude/mol/agents/solution-architect.md +1 -0
- package/presets/claude/mol/agents/task-analyst.md +1 -0
- package/presets/claude/mol/agents/task-router.md +1 -0
- package/presets/claude/mol/agents/tech-writer.md +1 -0
- package/presets/claude/mol/agents/unit-test-planner.md +1 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +10 -10
- package/presets/claude/mol/rules/architecture/reference-features.md +0 -19
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/mol/team/README.md +1 -1
- package/presets/claude/next/CLAUDE.md +3 -3
- package/presets/claude/next/REPO_AGENTS.md +8 -0
- package/presets/claude/next/agents/README.md +4 -0
- package/presets/claude/next/agents/accessibility-reviewer.md +1 -0
- package/presets/claude/next/agents/api-contract-reviewer.md +1 -0
- package/presets/claude/next/agents/build-verifier.md +2 -1
- package/presets/claude/next/agents/code-reviewer.md +3 -0
- package/presets/claude/next/agents/codebase-analyzer.md +1 -1
- package/presets/claude/next/agents/migration-specialist.md +1 -0
- package/presets/claude/next/agents/mockup-reviewer.md +1 -0
- package/presets/claude/next/agents/openspec-author.md +1 -0
- package/presets/claude/next/agents/performance-auditor.md +1 -0
- package/presets/claude/next/agents/security-reviewer.md +1 -0
- package/presets/claude/next/agents/solution-architect.md +1 -0
- package/presets/claude/next/agents/task-analyst.md +1 -0
- package/presets/claude/next/agents/task-router.md +12 -0
- package/presets/claude/next/agents/tech-writer.md +1 -0
- package/presets/claude/next/agents/unit-test-planner.md +1 -0
- package/presets/claude/next/ai-local/rules-library/agent-artifacts-no-local-paths.md +71 -0
- package/presets/claude/next/ai-local/rules-library/agent-pipeline-gates.md +19 -0
- package/presets/claude/next/ai-local/rules-library/analytics-events.md +18 -0
- package/presets/claude/next/ai-local/rules-library/api-contract-source.md +14 -0
- package/presets/claude/next/ai-local/rules-library/artifact-lifecycle.md +17 -0
- package/presets/claude/next/ai-local/rules-library/code-style.md +68 -0
- package/presets/claude/next/ai-local/rules-library/commit-hygiene.md +17 -0
- package/presets/claude/next/ai-local/rules-library/component-child-decomposition.md +81 -0
- package/presets/claude/next/ai-local/rules-library/feature-flags-experiments.md +15 -0
- package/presets/claude/next/ai-local/rules-library/mcp-required-for-ui-layout.md +45 -0
- package/presets/claude/next/ai-local/rules-library/no-react-fc.md +46 -0
- package/presets/claude/next/ai-local/rules-library/no-test-driven-behavior-change.md +14 -0
- package/presets/claude/next/ai-local/rules-library/pre-pr-checklist.md +16 -0
- package/presets/claude/next/ai-local/rules-library/pwa-service-worker.md +15 -0
- package/presets/claude/next/ai-local/rules-library/qa-test-cases.md +14 -0
- package/presets/claude/next/ai-local/rules-library/router-pages.md +25 -0
- package/presets/claude/next/ai-local/rules-library/single-source-copy-constants.md +18 -0
- package/presets/claude/next/ai-local/rules-library/storybook-catalog-structure.md +62 -0
- package/presets/claude/next/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
- package/presets/claude/next/ai-local/rules-library/storybook-csf-authoring.md +100 -0
- package/presets/claude/next/ai-local/rules-library/storybook-dev-compare-figma.md +72 -0
- package/presets/claude/next/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
- package/presets/claude/next/ai-local/rules-library/storybook-modals.md +64 -0
- package/presets/claude/next/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
- package/presets/claude/next/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
- package/presets/claude/next/ai-local/rules-library/ui-change-review-gate.md +16 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +13 -13
- package/presets/claude/next/rules/architecture/reference-features.md +0 -19
- package/presets/claude/next/rules/stack/next-app-core.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/next/team/README.md +1 -1
- package/presets/claude/next/team/fixtures/feature-l2-lite.json +27 -0
- package/presets/claude/nuxt/CLAUDE.md +3 -3
- package/presets/claude/nuxt/REPO_AGENTS.md +8 -0
- package/presets/claude/nuxt/agents/README.md +2 -4
- package/presets/claude/nuxt/agents/accessibility-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/api-contract-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/build-verifier.md +1 -0
- package/presets/claude/nuxt/agents/code-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/codebase-analyzer.md +1 -1
- package/presets/claude/nuxt/agents/migration-specialist.md +1 -0
- package/presets/claude/nuxt/agents/mockup-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/openspec-author.md +2 -1
- package/presets/claude/nuxt/agents/performance-auditor.md +1 -0
- package/presets/claude/nuxt/agents/playwright-test-generator.md +24 -68
- package/presets/claude/nuxt/agents/playwright-test-healer.md +28 -54
- package/presets/claude/nuxt/agents/playwright-test-planner.md +18 -51
- package/presets/claude/nuxt/agents/security-reviewer.md +1 -0
- package/presets/claude/nuxt/agents/solution-architect.md +1 -0
- package/presets/claude/nuxt/agents/task-analyst.md +12 -0
- package/presets/claude/nuxt/agents/task-router.md +1 -0
- package/presets/claude/nuxt/agents/tech-writer.md +1 -0
- package/presets/claude/nuxt/agents/unit-test-planner.md +1 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +9 -9
- package/presets/claude/nuxt/rules/architecture/reference-features.md +1 -20
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/nuxt/team/README.md +1 -1
- package/presets/claude/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/php-hexagonal/CLAUDE.md +2 -2
- package/presets/claude/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/claude/php-hexagonal/agents/README.md +4 -0
- package/presets/claude/php-hexagonal/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/claude/php-hexagonal/agents/ci-investigator.md +0 -1
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +3 -3
- package/presets/claude/php-hexagonal/agents/codebase-analyzer.md +1 -1
- package/presets/claude/php-hexagonal/agents/debugger.md +0 -1
- package/presets/claude/php-hexagonal/agents/feature-developer.md +2 -3
- package/presets/claude/php-hexagonal/agents/integration-test-generator.md +1 -2
- package/presets/claude/php-hexagonal/agents/integration-test-healer.md +1 -2
- package/presets/claude/php-hexagonal/agents/integration-test-planner.md +1 -2
- package/presets/claude/php-hexagonal/agents/migration-specialist.md +1 -1
- package/presets/claude/php-hexagonal/agents/openspec-author.md +2 -1
- package/presets/claude/php-hexagonal/agents/performance-auditor.md +1 -1
- package/presets/claude/php-hexagonal/agents/qa-tester.md +0 -1
- package/presets/claude/php-hexagonal/agents/security-reviewer.md +2 -2
- package/presets/claude/php-hexagonal/agents/solution-architect.md +1 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/agents/task-router.md +1 -1
- package/presets/claude/php-hexagonal/agents/tech-writer.md +1 -1
- package/presets/claude/php-hexagonal/agents/unit-test-generator.md +1 -2
- package/presets/claude/php-hexagonal/agents/unit-test-healer.md +1 -2
- package/presets/claude/php-hexagonal/agents/unit-test-planner.md +1 -1
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +51 -1
- package/presets/claude/php-hexagonal/rules/architecture/reference-features.md +25 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/php-hexagonal/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/php-hexagonal/team/README.md +1 -1
- package/presets/claude/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/php-laravel/CLAUDE.md +1 -1
- package/presets/claude/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/claude/php-laravel/agents/README.md +4 -0
- package/presets/claude/php-laravel/agents/api-contract-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
- package/presets/claude/php-laravel/agents/ci-investigator.md +0 -1
- package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/codebase-analyzer.md +1 -1
- package/presets/claude/php-laravel/agents/debugger.md +0 -1
- package/presets/claude/php-laravel/agents/feature-developer.md +2 -3
- package/presets/claude/php-laravel/agents/integration-test-generator.md +1 -2
- package/presets/claude/php-laravel/agents/integration-test-healer.md +1 -2
- package/presets/claude/php-laravel/agents/integration-test-planner.md +1 -2
- package/presets/claude/php-laravel/agents/migration-specialist.md +1 -1
- package/presets/claude/php-laravel/agents/openspec-author.md +2 -1
- package/presets/claude/php-laravel/agents/performance-auditor.md +1 -1
- package/presets/claude/php-laravel/agents/qa-tester.md +0 -1
- package/presets/claude/php-laravel/agents/security-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/solution-architect.md +1 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/agents/task-router.md +1 -1
- package/presets/claude/php-laravel/agents/tech-writer.md +1 -1
- package/presets/claude/php-laravel/agents/unit-test-generator.md +1 -2
- package/presets/claude/php-laravel/agents/unit-test-healer.md +1 -2
- package/presets/claude/php-laravel/agents/unit-test-planner.md +1 -1
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +54 -1
- package/presets/claude/php-laravel/rules/architecture/reference-features.md +27 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/php-laravel/skills/feature-delivery/SKILL.md +2 -2
- package/presets/claude/php-laravel/team/README.md +1 -1
- package/presets/claude/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/svelte/CLAUDE.md +3 -3
- package/presets/claude/svelte/REPO_AGENTS.md +8 -0
- package/presets/claude/svelte/agents/README.md +2 -4
- package/presets/claude/svelte/agents/accessibility-reviewer.md +1 -0
- package/presets/claude/svelte/agents/api-contract-reviewer.md +1 -0
- package/presets/claude/svelte/agents/build-verifier.md +1 -0
- package/presets/claude/svelte/agents/code-reviewer.md +1 -0
- package/presets/claude/svelte/agents/codebase-analyzer.md +1 -1
- package/presets/claude/svelte/agents/migration-specialist.md +1 -0
- package/presets/claude/svelte/agents/mockup-reviewer.md +1 -0
- package/presets/claude/svelte/agents/openspec-author.md +2 -1
- package/presets/claude/svelte/agents/performance-auditor.md +1 -0
- package/presets/claude/svelte/agents/playwright-test-generator.md +24 -68
- package/presets/claude/svelte/agents/playwright-test-healer.md +28 -54
- package/presets/claude/svelte/agents/playwright-test-planner.md +18 -51
- package/presets/claude/svelte/agents/security-reviewer.md +1 -0
- package/presets/claude/svelte/agents/solution-architect.md +1 -0
- package/presets/claude/svelte/agents/task-analyst.md +12 -0
- package/presets/claude/svelte/agents/task-router.md +1 -1
- package/presets/claude/svelte/agents/tech-writer.md +1 -0
- package/presets/claude/svelte/agents/unit-test-planner.md +1 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +4 -1
- package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +7 -7
- package/presets/claude/svelte/rules/architecture/reference-features.md +1 -20
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/svelte/team/README.md +1 -1
- package/presets/claude/svelte/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/android-kotlin/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/android-kotlin/hooks.json +7 -0
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +17 -5
- package/presets/cursor/android-kotlin/rules/feature-delivery-workflow.mdc +66 -8
- package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/android-kotlin/rules/reference-features.mdc +48 -2
- package/presets/cursor/android-kotlin/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/android-kotlin/team/README.md +1 -1
- package/presets/cursor/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/go/REPO_AGENTS.md +8 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/go/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/go/hooks.json +7 -0
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/go/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/go/rules/reference-features.mdc +46 -6
- package/presets/cursor/go/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/go/team/README.md +1 -1
- package/presets/cursor/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/ios-swift/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/ios-swift/hooks.json +7 -0
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +17 -5
- package/presets/cursor/ios-swift/rules/feature-delivery-workflow.mdc +64 -8
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/ios-swift/rules/reference-features.mdc +44 -21
- package/presets/cursor/ios-swift/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/ios-swift/team/README.md +1 -1
- package/presets/cursor/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/java/AGENTS.md +1 -1
- package/presets/cursor/java/REPO_AGENTS.md +8 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/java/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/java/hooks.json +7 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/java/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/java/rules/reference-features.mdc +46 -6
- package/presets/cursor/java/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/java/team/README.md +1 -1
- package/presets/cursor/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/mcp-ts/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/mcp-ts/hooks.json +7 -0
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +17 -6
- package/presets/cursor/mcp-ts/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/mcp-ts/rules/reference-features.mdc +46 -6
- package/presets/cursor/mcp-ts/skills/code-review/SKILL.md +1 -1
- package/presets/cursor/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/mcp-ts/team/README.md +1 -1
- package/presets/cursor/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/mol/REPO_AGENTS.md +8 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/mol/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/mol/hooks.json +7 -0
- package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/mol/rules/feature-delivery-workflow.mdc +65 -9
- package/presets/cursor/mol/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/mol/rules/reference-features.mdc +43 -20
- package/presets/cursor/mol/team/README.md +1 -1
- package/presets/cursor/next/README.md +2 -2
- package/presets/cursor/next/REPO_AGENTS.md +8 -0
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +2 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/next/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/next/hooks.json +7 -0
- package/presets/cursor/next/rules/README.md +2 -2
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/next/rules/feature-delivery-workflow.mdc +68 -12
- package/presets/cursor/next/rules/next-app-core.mdc +1 -1
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/next/rules/reference-features.mdc +42 -19
- package/presets/cursor/next/team/README.md +1 -1
- package/presets/cursor/nuxt/REPO_AGENTS.md +8 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/nuxt/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/nuxt/hooks.json +7 -0
- package/presets/cursor/nuxt/rules/README.md +2 -2
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/nuxt/rules/feature-delivery-workflow.mdc +64 -8
- package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/nuxt/rules/reference-features.mdc +37 -14
- package/presets/cursor/nuxt/team/README.md +1 -1
- package/presets/cursor/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/php-hexagonal/AGENTS.md +1 -1
- package/presets/cursor/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/php-hexagonal/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/php-hexagonal/hooks.json +7 -0
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/php-hexagonal/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/php-hexagonal/rules/reference-features.mdc +46 -6
- package/presets/cursor/php-hexagonal/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/php-hexagonal/team/README.md +1 -1
- package/presets/cursor/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/php-laravel/AGENTS.md +1 -1
- package/presets/cursor/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/php-laravel/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/php-laravel/hooks.json +7 -0
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/php-laravel/rules/feature-delivery-workflow.mdc +63 -5
- package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/php-laravel/rules/reference-features.mdc +46 -6
- package/presets/cursor/php-laravel/skills/feature-delivery/SKILL.md +2 -2
- package/presets/cursor/php-laravel/team/README.md +1 -1
- package/presets/cursor/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/svelte/REPO_AGENTS.md +8 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +4 -1
- package/presets/cursor/svelte/hooks/compact-shell-output.mjs +68 -0
- package/presets/cursor/svelte/hooks.json +7 -0
- package/presets/cursor/svelte/rules/README.md +1 -1
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +16 -5
- package/presets/cursor/svelte/rules/feature-delivery-workflow.mdc +62 -6
- package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/svelte/rules/reference-features.mdc +40 -17
- package/presets/cursor/svelte/team/README.md +1 -1
- package/presets/cursor/svelte/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/mavis/android-kotlin/adapter-map.json +19 -2
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/android-kotlin/rules/feature-delivery-workflow.md +66 -8
- package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/android-kotlin/rules/reference-features.md +48 -2
- package/presets/mavis/android-kotlin/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/android-kotlin/team/README.md +1 -1
- package/presets/mavis/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/go/REPO_AGENTS.md +8 -0
- package/presets/mavis/go/adapter-map.json +17 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/go/rules/feature-delivery-workflow.md +50 -1
- package/presets/mavis/go/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/go/rules/reference-features.md +22 -0
- package/presets/mavis/go/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/go/team/README.md +1 -1
- package/presets/mavis/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/mavis/ios-swift/adapter-map.json +17 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +8 -8
- package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/ios-swift/rules/reference-features.md +2 -21
- package/presets/mavis/ios-swift/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/ios-swift/team/README.md +1 -1
- package/presets/mavis/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/java/MAVIS.md +1 -1
- package/presets/mavis/java/REPO_AGENTS.md +8 -0
- package/presets/mavis/java/adapter-map.json +17 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/java/rules/feature-delivery-workflow.md +51 -1
- package/presets/mavis/java/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/java/rules/reference-features.md +22 -0
- package/presets/mavis/java/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/java/team/README.md +1 -1
- package/presets/mavis/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/mavis/mcp-ts/adapter-map.json +17 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +47 -1
- package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/mcp-ts/rules/reference-features.md +22 -0
- package/presets/mavis/mcp-ts/skills/code-review/SKILL.md +1 -1
- package/presets/mavis/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/mcp-ts/team/README.md +1 -1
- package/presets/mavis/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/mol/REPO_AGENTS.md +8 -0
- package/presets/mavis/mol/adapter-map.json +9 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/mol/rules/feature-delivery-workflow.md +10 -10
- package/presets/mavis/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/mol/rules/reference-features.md +0 -19
- package/presets/mavis/mol/team/README.md +1 -1
- package/presets/mavis/next/REPO_AGENTS.md +8 -0
- package/presets/mavis/next/adapter-map.json +9 -1
- package/presets/mavis/next/agents/build-verifier.md +1 -1
- package/presets/mavis/next/agents/code-reviewer.md +2 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/next/rules/feature-delivery-workflow.md +13 -13
- package/presets/mavis/next/rules/next-app-core.md +1 -1
- package/presets/mavis/next/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/next/rules/reference-features.md +0 -19
- package/presets/mavis/next/team/README.md +1 -1
- package/presets/mavis/nuxt/REPO_AGENTS.md +8 -0
- package/presets/mavis/nuxt/adapter-map.json +17 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +9 -9
- package/presets/mavis/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/nuxt/rules/reference-features.md +1 -20
- package/presets/mavis/nuxt/team/README.md +1 -1
- package/presets/mavis/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/php-hexagonal/MAVIS.md +1 -1
- package/presets/mavis/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +17 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +51 -1
- package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/php-hexagonal/rules/reference-features.md +25 -0
- package/presets/mavis/php-hexagonal/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/php-hexagonal/team/README.md +1 -1
- package/presets/mavis/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/php-laravel/MAVIS.md +1 -1
- package/presets/mavis/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/mavis/php-laravel/adapter-map.json +17 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +54 -1
- package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/php-laravel/rules/reference-features.md +27 -0
- package/presets/mavis/php-laravel/skills/feature-delivery/SKILL.md +2 -2
- package/presets/mavis/php-laravel/team/README.md +1 -1
- package/presets/mavis/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/svelte/REPO_AGENTS.md +8 -0
- package/presets/mavis/svelte/adapter-map.json +17 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +4 -1
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/svelte/rules/feature-delivery-workflow.md +7 -7
- package/presets/mavis/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/svelte/rules/reference-features.md +1 -20
- package/presets/mavis/svelte/team/README.md +1 -1
- package/presets/mavis/svelte/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/opencode/android-kotlin/adapter-map.json +19 -2
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/android-kotlin/rules/feature-delivery-workflow.md +66 -8
- package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/android-kotlin/rules/reference-features.md +48 -2
- package/presets/opencode/android-kotlin/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/android-kotlin/team/README.md +1 -1
- package/presets/opencode/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/go/REPO_AGENTS.md +8 -0
- package/presets/opencode/go/adapter-map.json +17 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/go/rules/feature-delivery-workflow.md +50 -1
- package/presets/opencode/go/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/go/rules/reference-features.md +22 -0
- package/presets/opencode/go/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/go/team/README.md +1 -1
- package/presets/opencode/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/opencode/ios-swift/adapter-map.json +17 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +8 -8
- package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/ios-swift/rules/reference-features.md +2 -21
- package/presets/opencode/ios-swift/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/ios-swift/team/README.md +1 -1
- package/presets/opencode/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/java/OPENCODE.md +1 -1
- package/presets/opencode/java/REPO_AGENTS.md +8 -0
- package/presets/opencode/java/adapter-map.json +17 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/java/rules/feature-delivery-workflow.md +51 -1
- package/presets/opencode/java/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/java/rules/reference-features.md +22 -0
- package/presets/opencode/java/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/java/team/README.md +1 -1
- package/presets/opencode/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/opencode/mcp-ts/adapter-map.json +17 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +47 -1
- package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/mcp-ts/rules/reference-features.md +22 -0
- package/presets/opencode/mcp-ts/skills/code-review/SKILL.md +1 -1
- package/presets/opencode/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/mcp-ts/team/README.md +1 -1
- package/presets/opencode/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/mol/REPO_AGENTS.md +8 -0
- package/presets/opencode/mol/adapter-map.json +9 -1
- package/presets/opencode/mol/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/mol/rules/feature-delivery-workflow.md +10 -10
- package/presets/opencode/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/mol/rules/reference-features.md +0 -19
- package/presets/opencode/mol/team/README.md +1 -1
- package/presets/opencode/next/REPO_AGENTS.md +8 -0
- package/presets/opencode/next/adapter-map.json +9 -1
- package/presets/opencode/next/agents/build-verifier.md +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +2 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/next/rules/feature-delivery-workflow.md +13 -13
- package/presets/opencode/next/rules/next-app-core.md +1 -1
- package/presets/opencode/next/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/next/rules/reference-features.md +0 -19
- package/presets/opencode/next/team/README.md +1 -1
- package/presets/opencode/nuxt/REPO_AGENTS.md +8 -0
- package/presets/opencode/nuxt/adapter-map.json +17 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +9 -9
- package/presets/opencode/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/nuxt/rules/reference-features.md +1 -20
- package/presets/opencode/nuxt/team/README.md +1 -1
- package/presets/opencode/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/php-hexagonal/OPENCODE.md +1 -1
- package/presets/opencode/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +17 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +51 -1
- package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/php-hexagonal/rules/reference-features.md +25 -0
- package/presets/opencode/php-hexagonal/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/php-hexagonal/team/README.md +1 -1
- package/presets/opencode/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/php-laravel/OPENCODE.md +1 -1
- package/presets/opencode/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/opencode/php-laravel/adapter-map.json +17 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +54 -1
- package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/php-laravel/rules/reference-features.md +27 -0
- package/presets/opencode/php-laravel/skills/feature-delivery/SKILL.md +2 -2
- package/presets/opencode/php-laravel/team/README.md +1 -1
- package/presets/opencode/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/plugins/output-guard/README.md +3 -2
- package/presets/opencode/plugins/output-guard/rewrite.ts +10 -1
- package/presets/opencode/svelte/REPO_AGENTS.md +8 -0
- package/presets/opencode/svelte/adapter-map.json +17 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +4 -1
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/svelte/rules/feature-delivery-workflow.md +7 -7
- package/presets/opencode/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/svelte/rules/reference-features.md +1 -20
- package/presets/opencode/svelte/team/README.md +1 -1
- package/presets/opencode/svelte/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/android-kotlin/REPO_AGENTS.md +8 -0
- package/presets/zcode/android-kotlin/adapter-map.json +19 -2
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/android-kotlin/rules/README.md +3 -3
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/android-kotlin/rules/feature-delivery-workflow.md +66 -8
- package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/android-kotlin/rules/reference-features.md +48 -2
- package/presets/zcode/android-kotlin/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/android-kotlin/team/README.md +1 -1
- package/presets/zcode/android-kotlin/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/go/REPO_AGENTS.md +8 -0
- package/presets/zcode/go/adapter-map.json +17 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/go/rules/README.md +3 -3
- package/presets/zcode/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/go/rules/feature-delivery-workflow.md +50 -1
- package/presets/zcode/go/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/go/rules/reference-features.md +22 -0
- package/presets/zcode/go/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/go/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/go/team/README.md +1 -1
- package/presets/zcode/go/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/ios-swift/REPO_AGENTS.md +8 -0
- package/presets/zcode/ios-swift/adapter-map.json +17 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/ios-swift/rules/README.md +3 -3
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +8 -8
- package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/ios-swift/rules/reference-features.md +2 -21
- package/presets/zcode/ios-swift/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/ios-swift/team/README.md +1 -1
- package/presets/zcode/ios-swift/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/java/REPO_AGENTS.md +8 -0
- package/presets/zcode/java/adapter-map.json +17 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/java/rules/README.md +3 -3
- package/presets/zcode/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/java/rules/feature-delivery-workflow.md +51 -1
- package/presets/zcode/java/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/java/rules/reference-features.md +22 -0
- package/presets/zcode/java/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/java/team/README.md +1 -1
- package/presets/zcode/java/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/mcp-ts/REPO_AGENTS.md +8 -0
- package/presets/zcode/mcp-ts/adapter-map.json +17 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/mcp-ts/rules/README.md +3 -3
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +47 -1
- package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/mcp-ts/rules/reference-features.md +22 -0
- package/presets/zcode/mcp-ts/skills/code-review/SKILL.md +1 -1
- package/presets/zcode/mcp-ts/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/mcp-ts/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/mcp-ts/team/README.md +1 -1
- package/presets/zcode/mcp-ts/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/mol/REPO_AGENTS.md +8 -0
- package/presets/zcode/mol/adapter-map.json +9 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/mol/rules/README.md +3 -3
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/mol/rules/feature-delivery-workflow.md +10 -10
- package/presets/zcode/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/mol/rules/reference-features.md +0 -19
- package/presets/zcode/mol/team/README.md +1 -1
- package/presets/zcode/next/REPO_AGENTS.md +8 -0
- package/presets/zcode/next/adapter-map.json +9 -1
- package/presets/zcode/next/agents/build-verifier.md +1 -1
- package/presets/zcode/next/agents/code-reviewer.md +2 -0
- package/presets/zcode/next/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/next/rules/README.md +3 -3
- package/presets/zcode/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/next/rules/feature-delivery-workflow.md +13 -13
- package/presets/zcode/next/rules/next-app-core.md +1 -1
- package/presets/zcode/next/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/next/rules/reference-features.md +0 -19
- package/presets/zcode/next/team/README.md +1 -1
- package/presets/zcode/nuxt/REPO_AGENTS.md +8 -0
- package/presets/zcode/nuxt/adapter-map.json +17 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/nuxt/rules/README.md +3 -3
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +9 -9
- package/presets/zcode/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/nuxt/rules/reference-features.md +1 -20
- package/presets/zcode/nuxt/team/README.md +1 -1
- package/presets/zcode/nuxt/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/php-hexagonal/REPO_AGENTS.md +8 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +17 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/php-hexagonal/rules/README.md +3 -3
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +51 -1
- package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/php-hexagonal/rules/reference-features.md +25 -0
- package/presets/zcode/php-hexagonal/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/php-hexagonal/team/README.md +1 -1
- package/presets/zcode/php-hexagonal/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/php-laravel/REPO_AGENTS.md +8 -0
- package/presets/zcode/php-laravel/adapter-map.json +17 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/php-laravel/rules/README.md +3 -3
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +54 -1
- package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/php-laravel/rules/reference-features.md +27 -0
- package/presets/zcode/php-laravel/skills/feature-delivery/SKILL.md +2 -2
- package/presets/zcode/php-laravel/team/README.md +1 -1
- package/presets/zcode/php-laravel/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/svelte/REPO_AGENTS.md +8 -0
- package/presets/zcode/svelte/adapter-map.json +17 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +4 -1
- package/presets/zcode/svelte/rules/README.md +3 -3
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/zcode/svelte/rules/feature-delivery-workflow.md +7 -7
- package/presets/zcode/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/svelte/rules/reference-features.md +1 -20
- package/presets/zcode/svelte/team/README.md +1 -1
- package/presets/zcode/svelte/team/fixtures/feature-parallel.json +84 -0
- package/scripts/close-agent-task-human-gate.mjs +3 -3
- package/scripts/report-context-cost.mjs +10 -3
- package/scripts/aggregate-agent-task-metrics.mjs +0 -480
|
@@ -10,10 +10,16 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Usage:
|
|
12
12
|
* node .ai.local/scripts/check-write-scope.mjs --slug <slug> [--step <id>] [--base <ref>] [--json]
|
|
13
|
-
* node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <id> --save-baseline
|
|
13
|
+
* node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <id> --save-baseline [--allow-empty]
|
|
14
14
|
* node .ai.local/scripts/check-write-scope.mjs --slug <slug> --paths a,b [--step <id>] [--json]
|
|
15
15
|
* node .ai.local/scripts/check-write-scope.mjs --slug <slug> --root <project> ...
|
|
16
16
|
*
|
|
17
|
+
* `--save-baseline` refuses a baseline that records 0 paths or every tracked
|
|
18
|
+
* path: neither can separate this step's writes from the rest of the tree, and
|
|
19
|
+
* both were live defects (7 empty baselines, 2 whole-tree ones). `--allow-empty`
|
|
20
|
+
* is the explicit opt-in. A baseline already saved in that state is read as
|
|
21
|
+
* `empty-baseline` and skipped, never as an attribution of the whole tree.
|
|
22
|
+
*
|
|
17
23
|
* `--root` is the project root (the directory holding `.ai.local/`), not
|
|
18
24
|
* necessarily the git top level; a nested project works because the git
|
|
19
25
|
* baseline is emitted relative to that root.
|
|
@@ -23,7 +29,12 @@
|
|
|
23
29
|
* 2. `--base <ref>` — a committed change-set.
|
|
24
30
|
* 3. The step baseline written by `--save-baseline` (agents never commit, so
|
|
25
31
|
* `HEAD` alone would attribute every earlier step to the current one).
|
|
26
|
-
* 4.
|
|
32
|
+
* 4. No step baseline — the whole uncommitted change-set cannot be attributed to
|
|
33
|
+
* this step, so the audit skips (exit `3`) and reports the change-set as
|
|
34
|
+
* suspects; an empty change-set reconciles to a pass.
|
|
35
|
+
*
|
|
36
|
+
* Automatic selection only considers steps with an `id`, because the baseline
|
|
37
|
+
* file is keyed by it; a scoped step without an id is a `no-step-ids` skip.
|
|
27
38
|
*
|
|
28
39
|
* A step baseline records every dirty path with its content hash; the audit
|
|
29
40
|
* keeps a path only when it is new since the baseline or when its content
|
|
@@ -41,7 +52,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
41
52
|
import fs from 'node:fs';
|
|
42
53
|
import path from 'node:path';
|
|
43
54
|
|
|
44
|
-
const USAGE = `Usage: node .ai.local/scripts/check-write-scope.mjs --slug <slug> [--step <id>] [--base <ref>] [--root <project>] [--paths a,b] [--save-baseline] [--json]`;
|
|
55
|
+
const USAGE = `Usage: node .ai.local/scripts/check-write-scope.mjs --slug <slug> [--step <id>] [--base <ref>] [--root <project>] [--paths a,b] [--save-baseline [--allow-empty]] [--json]`;
|
|
45
56
|
|
|
46
57
|
const REVIEW_AGENT_RE = /reviewer|auditor|verifier/i;
|
|
47
58
|
|
|
@@ -53,10 +64,20 @@ const EXIT_SKIP = 3;
|
|
|
53
64
|
const BASELINE_DIRECTORY = path.join('.ai.local', 'team', '.write-scope');
|
|
54
65
|
const BASELINE_PREFIX = `${BASELINE_DIRECTORY.split(path.sep).join('/')}/`;
|
|
55
66
|
|
|
67
|
+
/**
|
|
68
|
+
* "The whole tracked tree was dirty" is only a defect signal in a repository
|
|
69
|
+
* large enough for it to be unlikely: a fixture or a tiny project can be
|
|
70
|
+
* legitimately all-dirty, and the audit still works there (content hashes
|
|
71
|
+
* separate the step's writes). Below this size the tree-wide refusal stays off.
|
|
72
|
+
*/
|
|
73
|
+
const WHOLE_TREE_MIN_TRACKED = 20;
|
|
74
|
+
|
|
56
75
|
const SKIP_HINTS = {
|
|
57
76
|
'no-steps': 'pipeline.json has no steps; write the plan with task-router before auditing',
|
|
58
|
-
'no-step-ids': 'pipeline.json predates step ids;
|
|
77
|
+
'no-step-ids': 'pipeline.json predates step ids and the baseline is keyed by id; re-run the task-router to regenerate pipeline.json with steps[].id, then resume via /task-continue <slug>',
|
|
59
78
|
'no-write-scopes': 'pipeline.json predates writeScopes; only task-router can declare a step write surface, so this step is not auditable',
|
|
79
|
+
'no-baseline': 'the step wrote without a saved baseline, so no path can be attributed to it; the orchestrator saves it before the step writes (--step <id> --save-baseline), or pass the step paths (--paths a,b), then re-run',
|
|
80
|
+
'empty-baseline': 'the saved baseline records 0 paths (its tree was clean at save time), so it cannot attribute anything this step wrote; re-save it after the step is armed, or pass the step paths (--paths a,b)',
|
|
60
81
|
};
|
|
61
82
|
|
|
62
83
|
const DERIVED_RULES = [
|
|
@@ -93,6 +114,7 @@ function parseArgs(argv) {
|
|
|
93
114
|
else if (token === '--paths') args.paths = readValue();
|
|
94
115
|
else if (token === '--json') args.json = true;
|
|
95
116
|
else if (token === '--save-baseline') args.saveBaseline = true;
|
|
117
|
+
else if (token === '--allow-empty') args.allowEmpty = true;
|
|
96
118
|
else if (token === '--help' || token === '-h') {
|
|
97
119
|
console.log(USAGE);
|
|
98
120
|
process.exit(EXIT_PASS);
|
|
@@ -139,6 +161,10 @@ const skipResult = (reason, step = null) => ({ skip: { reason, step } });
|
|
|
139
161
|
* Pick the audited step. A legacy pipeline is a **skip**, not a failure: the
|
|
140
162
|
* audit cannot invent an id or a write surface, and a mandatory gate must not
|
|
141
163
|
* become unsatisfiable for work that predates the schema.
|
|
164
|
+
*
|
|
165
|
+
* A step baseline is keyed by `id`, so a step without one is never selected:
|
|
166
|
+
* selecting it made `--save-baseline` a usage error and left the whole
|
|
167
|
+
* uncommitted change-set unattributed.
|
|
142
168
|
*/
|
|
143
169
|
function chooseStep(pipeline, requested) {
|
|
144
170
|
const steps = Array.isArray(pipeline.steps) ? pipeline.steps : [];
|
|
@@ -150,12 +176,14 @@ function chooseStep(pipeline, requested) {
|
|
|
150
176
|
if (identified.length === 0) return skipResult('no-step-ids');
|
|
151
177
|
fail(`unknown step "${requested}" (available: ${identified.map((item) => item.id).join(', ')})`);
|
|
152
178
|
}
|
|
153
|
-
const
|
|
154
|
-
|
|
179
|
+
const scoped = identified.filter(hasWriteScopes);
|
|
180
|
+
const implementation = scoped.find((item) => agentsOf(item)
|
|
181
|
+
.some((agent) => /feature-developer|debugger|ci-investigator/i.test(agent)));
|
|
155
182
|
if (implementation) return { step: implementation };
|
|
156
|
-
const scoped = steps.filter(hasWriteScopes);
|
|
157
183
|
if (scoped.length === 1) return { step: scoped[0] };
|
|
158
|
-
if (scoped.length === 0)
|
|
184
|
+
if (scoped.length === 0) {
|
|
185
|
+
return steps.some(hasWriteScopes) ? skipResult('no-step-ids') : skipResult('no-write-scopes');
|
|
186
|
+
}
|
|
159
187
|
fail('cannot choose a step; pass --step <id>');
|
|
160
188
|
return null;
|
|
161
189
|
}
|
|
@@ -185,6 +213,18 @@ function contentHash(root, file) {
|
|
|
185
213
|
return value === '' ? null : value;
|
|
186
214
|
}
|
|
187
215
|
|
|
216
|
+
/** Tracked files under the project root — the denominator of "the whole tree". */
|
|
217
|
+
function trackedFileCount(root) {
|
|
218
|
+
const listed = spawnSync('git', ['-C', root, 'ls-files'], { encoding: 'utf8' });
|
|
219
|
+
if (listed.status !== 0) {
|
|
220
|
+
fail(`git ls-files failed: ${(listed.stderr || '').trim() || `exit ${listed.status}`}`);
|
|
221
|
+
}
|
|
222
|
+
return String(listed.stdout || '')
|
|
223
|
+
.split('\n')
|
|
224
|
+
.map(normalizePath)
|
|
225
|
+
.filter((file) => file && !file.startsWith(BASELINE_PREFIX)).length;
|
|
226
|
+
}
|
|
227
|
+
|
|
188
228
|
const baselineFile = (root, slug, stepId) => path.join(
|
|
189
229
|
root,
|
|
190
230
|
BASELINE_DIRECTORY,
|
|
@@ -220,18 +260,19 @@ function classify(changed, writeScopes, slug) {
|
|
|
220
260
|
});
|
|
221
261
|
}
|
|
222
262
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
263
|
+
const countRows = (rows) => ({
|
|
264
|
+
declared: rows.filter((row) => row.classification === 'declared').length,
|
|
265
|
+
derived: rows.filter((row) => row.classification === 'derived').length,
|
|
266
|
+
outOfScope: rows.filter((row) => row.classification === 'out-of-scope').length,
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
function renderReport({ slug, step, base, baseline, verdict, rows }) {
|
|
270
|
+
const counts = countRows(rows);
|
|
229
271
|
const lines = [
|
|
230
272
|
`Write-scope reconciliation — slug ${slug}, step ${step?.id ?? '(no id)'} (${agentsOf(step).join(', ')})`,
|
|
231
273
|
`base: ${base}${base === 'HEAD' ? ' (uncommitted change-set)' : ''}`,
|
|
232
274
|
];
|
|
233
275
|
if (baseline) lines.push(`baseline: ${baseline}`);
|
|
234
|
-
if (notice) lines.push(`notice: ${notice}`);
|
|
235
276
|
lines.push(`paths: ${rows.length} — declared ${counts.declared}, derived ${counts.derived}, out-of-scope ${counts.outOfScope}`);
|
|
236
277
|
for (const row of rows) {
|
|
237
278
|
lines.push(` ${row.classification.padEnd(12)} ${row.path} — ${row.source}`);
|
|
@@ -240,40 +281,65 @@ function renderReport({ slug, step, base, baseline, notice, verdict, rows }) {
|
|
|
240
281
|
return { counts, text: `${lines.join('\n')}\n` };
|
|
241
282
|
}
|
|
242
283
|
|
|
243
|
-
function reportSkip({ slug, skip, asJson }) {
|
|
284
|
+
function reportSkip({ slug, skip, asJson, rows = [], writeScopes = [] }) {
|
|
244
285
|
const hint = SKIP_HINTS[skip.reason] ?? 'the pipeline does not declare a write surface for this step';
|
|
245
286
|
const step = skip.step;
|
|
287
|
+
const counts = countRows(rows);
|
|
246
288
|
if (asJson) {
|
|
247
289
|
console.log(JSON.stringify({
|
|
248
290
|
schemaVersion: 1,
|
|
249
291
|
slug,
|
|
250
|
-
step: { id: step?.id ?? null, agent: step?.agent ?? null, writeScopes
|
|
292
|
+
step: { id: step?.id ?? null, agent: step?.agent ?? null, writeScopes },
|
|
251
293
|
base: null,
|
|
252
294
|
baseline: null,
|
|
253
295
|
verdict: 'skip',
|
|
254
296
|
skipped: true,
|
|
255
297
|
skipReason: skip.reason,
|
|
256
298
|
hint,
|
|
257
|
-
counts
|
|
258
|
-
paths:
|
|
299
|
+
counts,
|
|
300
|
+
paths: rows,
|
|
259
301
|
}, null, 2));
|
|
260
302
|
} else {
|
|
261
|
-
|
|
303
|
+
const lines = [
|
|
262
304
|
`Write-scope reconciliation — slug ${slug}, step ${step?.id ?? '(no id)'} (${agentsOf(step).join(', ')})`,
|
|
263
305
|
`skip: ${skip.reason}`,
|
|
264
306
|
`hint: ${hint}`,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
307
|
+
];
|
|
308
|
+
if (rows.length > 0) {
|
|
309
|
+
lines.push(`paths: ${rows.length} — declared ${counts.declared}, derived ${counts.derived}, out-of-scope ${counts.outOfScope} (unattributed: the whole uncommitted change-set)`);
|
|
310
|
+
for (const row of rows) {
|
|
311
|
+
lines.push(` ${row.classification.padEnd(12)} ${row.path} — ${row.source}`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
lines.push('verdict: SKIP', '');
|
|
315
|
+
process.stdout.write(lines.join('\n'));
|
|
268
316
|
}
|
|
269
317
|
process.exit(EXIT_SKIP);
|
|
270
318
|
}
|
|
271
319
|
|
|
272
|
-
function saveBaseline({ root, slug, step }) {
|
|
320
|
+
function saveBaseline({ root, slug, step, allowEmpty = false }) {
|
|
273
321
|
const file = baselineFile(root, slug, step.id);
|
|
322
|
+
const changed = gitChangedPaths(root, 'HEAD');
|
|
323
|
+
const tracked = trackedFileCount(root);
|
|
274
324
|
const paths = {};
|
|
275
|
-
for (const
|
|
276
|
-
paths[
|
|
325
|
+
for (const dirty of changed) {
|
|
326
|
+
paths[dirty] = contentHash(root, dirty);
|
|
327
|
+
}
|
|
328
|
+
// A baseline that records nothing attributing every later change to the step,
|
|
329
|
+
// and one that records every tracked file is the same failure with a full
|
|
330
|
+
// denominator: neither can separate this step's writes from anyone else's.
|
|
331
|
+
// Both are refused unless the caller says it knows (C-07/C-08).
|
|
332
|
+
if (!allowEmpty) {
|
|
333
|
+
if (changed.length === 0) {
|
|
334
|
+
fail(
|
|
335
|
+
'refusing to save an empty baseline (0 paths changed): the step would own every later change — pass --allow-empty if the tree is meant to be clean here',
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
if (tracked > 0 && tracked >= WHOLE_TREE_MIN_TRACKED && changed.length >= tracked) {
|
|
339
|
+
fail(
|
|
340
|
+
`refusing to save a tree-wide baseline (${changed.length} of ${tracked} tracked paths dirty): no path is attributable to the step — pass --allow-empty if that is intended`,
|
|
341
|
+
);
|
|
342
|
+
}
|
|
277
343
|
}
|
|
278
344
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
279
345
|
fs.writeFileSync(file, `${JSON.stringify({
|
|
@@ -284,7 +350,8 @@ function saveBaseline({ root, slug, step }) {
|
|
|
284
350
|
savedAt: new Date().toISOString(),
|
|
285
351
|
paths,
|
|
286
352
|
}, null, 2)}\n`);
|
|
287
|
-
|
|
353
|
+
const note = allowEmpty && (changed.length === 0 || changed.length >= tracked) ? ' (explicit --allow-empty)' : '';
|
|
354
|
+
process.stdout.write(`baseline saved: ${path.relative(root, file).replace(/\\/g, '/')} (${Object.keys(paths).length} path(s)${note})\n`);
|
|
288
355
|
return EXIT_PASS;
|
|
289
356
|
}
|
|
290
357
|
|
|
@@ -308,12 +375,11 @@ function main() {
|
|
|
308
375
|
|
|
309
376
|
if (args.saveBaseline) {
|
|
310
377
|
if (typeof step.id !== 'string' || step.id === '') fail('--save-baseline needs a step with an id; pass --step <id>');
|
|
311
|
-
process.exit(saveBaseline({ root, slug: args.slug, step }));
|
|
378
|
+
process.exit(saveBaseline({ root, slug: args.slug, step, allowEmpty: args.allowEmpty }));
|
|
312
379
|
}
|
|
313
380
|
|
|
314
381
|
let base = args.base ?? 'HEAD';
|
|
315
382
|
let baseline = null;
|
|
316
|
-
let notice = null;
|
|
317
383
|
let changed;
|
|
318
384
|
if (args.paths !== undefined) {
|
|
319
385
|
changed = String(args.paths).split(',').map(normalizePath).filter(Boolean);
|
|
@@ -322,13 +388,40 @@ function main() {
|
|
|
322
388
|
} else {
|
|
323
389
|
const file = typeof step.id === 'string' && step.id !== '' ? baselineFile(root, args.slug, step.id) : null;
|
|
324
390
|
const saved = file ? readBaseline(file) : null;
|
|
325
|
-
if (saved) {
|
|
391
|
+
if (saved && Object.keys(saved.paths).length === 0) {
|
|
392
|
+
// A baseline saved before the empty-baseline refusal existed records no
|
|
393
|
+
// path, so it would attribute the whole change-set to this step. Treat it
|
|
394
|
+
// as no baseline at all instead of silently blaming the step (C-08).
|
|
395
|
+
const wholeTree = gitChangedPaths(root, base);
|
|
396
|
+
if (wholeTree.length > 0) {
|
|
397
|
+
reportSkip({
|
|
398
|
+
slug: args.slug,
|
|
399
|
+
skip: { reason: 'empty-baseline', step },
|
|
400
|
+
asJson: args.json,
|
|
401
|
+
rows: classify(wholeTree, writeScopes, args.slug),
|
|
402
|
+
writeScopes,
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
changed = wholeTree;
|
|
406
|
+
} else if (saved) {
|
|
326
407
|
base = typeof saved.base === 'string' && saved.base !== '' ? saved.base : 'HEAD';
|
|
327
408
|
baseline = path.relative(root, file).replace(/\\/g, '/');
|
|
328
409
|
changed = baselineDelta(root, saved, base);
|
|
329
410
|
} else {
|
|
330
|
-
|
|
331
|
-
|
|
411
|
+
// No step baseline: the whole change-set may carry earlier steps and other
|
|
412
|
+
// tasks, so no path can be attributed to this step. The audit skips instead
|
|
413
|
+
// of failing a step on writes it cannot own.
|
|
414
|
+
const wholeTree = gitChangedPaths(root, base);
|
|
415
|
+
if (wholeTree.length > 0) {
|
|
416
|
+
reportSkip({
|
|
417
|
+
slug: args.slug,
|
|
418
|
+
skip: { reason: 'no-baseline', step },
|
|
419
|
+
asJson: args.json,
|
|
420
|
+
rows: classify(wholeTree, writeScopes, args.slug),
|
|
421
|
+
writeScopes,
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
changed = wholeTree;
|
|
332
425
|
}
|
|
333
426
|
}
|
|
334
427
|
|
|
@@ -336,7 +429,7 @@ function main() {
|
|
|
336
429
|
const outOfScope = rows.filter((row) => row.classification === 'out-of-scope');
|
|
337
430
|
const advisory = agentsOf(step).some((agent) => REVIEW_AGENT_RE.test(agent));
|
|
338
431
|
const verdict = outOfScope.length === 0 ? 'pass' : advisory ? 'advisory' : 'fail';
|
|
339
|
-
const { counts, text } = renderReport({ slug: args.slug, step, base, baseline,
|
|
432
|
+
const { counts, text } = renderReport({ slug: args.slug, step, base, baseline, verdict, rows });
|
|
340
433
|
|
|
341
434
|
if (args.json) {
|
|
342
435
|
console.log(JSON.stringify({
|
|
@@ -347,7 +440,6 @@ function main() {
|
|
|
347
440
|
baseline,
|
|
348
441
|
verdict,
|
|
349
442
|
skipped: false,
|
|
350
|
-
...(notice ? { notice } : {}),
|
|
351
443
|
counts,
|
|
352
444
|
paths: rows,
|
|
353
445
|
}, null, 2));
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
* inside an atomic `<lock>.d.reclaim` guard. The guard serialises the decision
|
|
11
11
|
* and the owner is re-read inside it, so a contender that judged the lock stale
|
|
12
12
|
* a moment earlier cannot delete the directory another process created since.
|
|
13
|
+
* The guard directory names its own owner. A contender removes a guard only
|
|
14
|
+
* when that pid is dead, or when the guard has no owner and has aged out; the
|
|
15
|
+
* removal renames that directory aside and deletes it only if the renamed
|
|
16
|
+
* inode and owner are the ones just evaluated. Age alone never drops a guard
|
|
17
|
+
* a live pid still holds.
|
|
13
18
|
*
|
|
14
19
|
* `releaseLock` only drops a lock this process acquired. A token from another
|
|
15
20
|
* process is ignored.
|
|
@@ -84,32 +89,86 @@ function removeOwnedDir(directory, token) {
|
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
91
|
|
|
92
|
+
/** dev/ino plus the owner record. `null` when the directory is already gone. */
|
|
93
|
+
function directoryIdentity(directory) {
|
|
94
|
+
let stat;
|
|
95
|
+
try {
|
|
96
|
+
stat = fs.statSync(directory, { bigint: true });
|
|
97
|
+
} catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
dev: stat.dev,
|
|
102
|
+
ino: stat.ino,
|
|
103
|
+
mtimeMs: Number(stat.mtimeMs),
|
|
104
|
+
owner: readOwner(directory),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
87
108
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
109
|
+
* The renamed directory is the one we evaluated. A path-only delete can move
|
|
110
|
+
* a guard another live reclaimer created after the age check.
|
|
90
111
|
*/
|
|
91
|
-
function
|
|
112
|
+
function sameInstance(observed, renamed) {
|
|
113
|
+
if (!observed || !renamed) return false;
|
|
114
|
+
if (observed.dev !== renamed.dev || observed.ino !== renamed.ino) return false;
|
|
115
|
+
const left = observed.owner;
|
|
116
|
+
const right = renamed.owner;
|
|
117
|
+
if (!left && !right) return true;
|
|
118
|
+
if (!left || !right) return false;
|
|
119
|
+
if (typeof left.token === 'string' || typeof right.token === 'string') {
|
|
120
|
+
return left.token === right.token;
|
|
121
|
+
}
|
|
122
|
+
return left.pid === right.pid;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function compareAndRemove(directory, observed) {
|
|
126
|
+
if (!observed) return false;
|
|
127
|
+
const trash = `${directory}.dead-${crypto.randomBytes(4).toString('hex')}`;
|
|
92
128
|
try {
|
|
93
|
-
|
|
94
|
-
|
|
129
|
+
fs.renameSync(directory, trash);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
return Boolean(error && error.code === 'ENOENT');
|
|
132
|
+
}
|
|
133
|
+
if (!sameInstance(observed, directoryIdentity(trash))) {
|
|
134
|
+
try { fs.renameSync(trash, directory); } catch { /* the path belongs to a successor */ }
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
fs.rmSync(trash, { recursive: true, force: true });
|
|
95
139
|
return true;
|
|
96
140
|
} catch {
|
|
97
141
|
return false;
|
|
98
142
|
}
|
|
99
143
|
}
|
|
100
144
|
|
|
101
|
-
|
|
102
|
-
|
|
145
|
+
/**
|
|
146
|
+
* A live owner pid holds the guard however old it is. A dead pid is abandoned
|
|
147
|
+
* immediately. An owner-less guard is the mkdir → owner.json window and is
|
|
148
|
+
* abandoned only after the stale window.
|
|
149
|
+
*/
|
|
150
|
+
function guardIsAbandoned(identity) {
|
|
151
|
+
if (!identity) return false;
|
|
152
|
+
const owner = identity.owner;
|
|
153
|
+
if (owner && Number.isInteger(owner.pid) && owner.pid > 0) {
|
|
154
|
+
return !isPidAlive(owner.pid);
|
|
155
|
+
}
|
|
156
|
+
return Date.now() - identity.mtimeMs > DEFAULT_STALE_MS;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function lockIdentityIsGone(identity) {
|
|
160
|
+
if (!identity) return false;
|
|
161
|
+
const owner = identity.owner;
|
|
103
162
|
if (owner) {
|
|
104
163
|
return Number.isInteger(owner.pid) && owner.pid > 0 && !isPidAlive(owner.pid);
|
|
105
164
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
165
|
+
return Date.now() - identity.mtimeMs > DEFAULT_STALE_MS;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function releaseOwnGuard(guard, token) {
|
|
169
|
+
const identity = directoryIdentity(guard);
|
|
170
|
+
if (!identity || !identity.owner || identity.owner.token !== token) return;
|
|
171
|
+
compareAndRemove(guard, identity);
|
|
113
172
|
}
|
|
114
173
|
|
|
115
174
|
/**
|
|
@@ -117,28 +176,42 @@ function ownerIsGone(directory) {
|
|
|
117
176
|
* serialisation point: only the winner judges and removes, and it re-reads the
|
|
118
177
|
* owner after taking the guard. A contender that decided "stale" before the
|
|
119
178
|
* winner re-created the directory therefore sees the new, live owner and backs
|
|
120
|
-
* off instead of deleting it.
|
|
179
|
+
* off instead of deleting it. An abandoned guard is removed and taken inside
|
|
180
|
+
* this call, so the decision and the delete stay on one guard instance.
|
|
121
181
|
*/
|
|
122
182
|
function reclaimStaleDir(directory) {
|
|
123
183
|
const guard = reclaimGuardDirectory(directory);
|
|
124
|
-
|
|
125
|
-
fs.mkdirSync(guard);
|
|
126
|
-
} catch (error) {
|
|
127
|
-
if (error.code !== 'EEXIST') throw error;
|
|
128
|
-
removeStaleGuard(guard);
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
try {
|
|
132
|
-
if (!ownerIsGone(directory)) return false;
|
|
184
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
133
185
|
try {
|
|
134
|
-
fs.
|
|
135
|
-
} catch {
|
|
136
|
-
|
|
186
|
+
fs.mkdirSync(guard);
|
|
187
|
+
} catch (error) {
|
|
188
|
+
if (error.code !== 'EEXIST') throw error;
|
|
189
|
+
const identity = directoryIdentity(guard);
|
|
190
|
+
if (!guardIsAbandoned(identity) || !compareAndRemove(guard, identity)) return false;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const token = newToken();
|
|
194
|
+
let wrote = false;
|
|
195
|
+
try {
|
|
196
|
+
fs.writeFileSync(
|
|
197
|
+
ownerFile(guard),
|
|
198
|
+
`${JSON.stringify({ pid: process.pid, token, at: new Date().toISOString() })}\n`,
|
|
199
|
+
{ encoding: 'utf8', mode: 0o600 },
|
|
200
|
+
);
|
|
201
|
+
wrote = true;
|
|
202
|
+
const identity = directoryIdentity(directory);
|
|
203
|
+
if (!lockIdentityIsGone(identity)) return false;
|
|
204
|
+
return compareAndRemove(directory, identity);
|
|
205
|
+
} catch (error) {
|
|
206
|
+
if (!wrote) {
|
|
207
|
+
try { fs.rmSync(guard, { recursive: true, force: true }); } catch { /* best effort */ }
|
|
208
|
+
}
|
|
209
|
+
throw error;
|
|
210
|
+
} finally {
|
|
211
|
+
if (wrote) releaseOwnGuard(guard, token);
|
|
137
212
|
}
|
|
138
|
-
return true;
|
|
139
|
-
} finally {
|
|
140
|
-
try { fs.rmSync(guard, { recursive: true, force: true }); } catch { /* best effort */ }
|
|
141
213
|
}
|
|
214
|
+
return false;
|
|
142
215
|
}
|
|
143
216
|
|
|
144
217
|
function enterDirectoryLock(lockPath, deadline, busyWaitMs) {
|
|
@@ -1887,6 +1887,10 @@ export function runImprover(options = {}) {
|
|
|
1887
1887
|
const visiblePending = [];
|
|
1888
1888
|
|
|
1889
1889
|
for (const group of enrichGroups(grouped.groups, signalsPath, canonical)) {
|
|
1890
|
+
if (typeof group.signature === 'string' && group.signature.startsWith('exemplar:')) {
|
|
1891
|
+
skipped.push({ signature: group.signature, reason: 'research exemplar' });
|
|
1892
|
+
continue;
|
|
1893
|
+
}
|
|
1890
1894
|
if (group.distinctSlugCount < 2) continue;
|
|
1891
1895
|
let decision;
|
|
1892
1896
|
try {
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Run a command, store its combined output, and print a short view.
|
|
3
|
+
// Exit with the child status so a passing store cannot hide a failing test.
|
|
4
|
+
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import os from 'node:os';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { resolveTeamRoot } from './dump-output.mjs';
|
|
11
|
+
|
|
12
|
+
const PASS_THROUGH_BYTES = 4096;
|
|
13
|
+
const HEAD_LINES = 40;
|
|
14
|
+
const HEAD_BYTES = 8 * 1024;
|
|
15
|
+
const CAPTURE_BYTES = 2 * 1024 * 1024;
|
|
16
|
+
const FAIL_LINE = /\b(FAIL|ERROR|Error|AssertionError)\b|✗|×/u;
|
|
17
|
+
|
|
18
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const dumpScript = path.join(here, 'dump-output.mjs');
|
|
20
|
+
|
|
21
|
+
const usageFail = (message) => {
|
|
22
|
+
const error = new Error(message);
|
|
23
|
+
error.exitCode = 2;
|
|
24
|
+
throw error;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const parseArgs = (argv) => {
|
|
28
|
+
const split = argv.indexOf('--');
|
|
29
|
+
if (split === -1) usageFail('missing -- before the command');
|
|
30
|
+
const child = argv.slice(split + 1);
|
|
31
|
+
if (child.length === 0) usageFail('missing command after --');
|
|
32
|
+
let task = '';
|
|
33
|
+
let root = '';
|
|
34
|
+
for (let index = 0; index < split; index += 1) {
|
|
35
|
+
const token = argv[index];
|
|
36
|
+
if (token !== '--task' && token !== '--root') usageFail(`unknown flag ${token}`);
|
|
37
|
+
const value = argv[index + 1];
|
|
38
|
+
if (value === undefined || value.startsWith('--')) usageFail(`flag ${token} needs a value`);
|
|
39
|
+
if (token === '--task') task = value;
|
|
40
|
+
else root = value;
|
|
41
|
+
index += 1;
|
|
42
|
+
}
|
|
43
|
+
if (task === '') usageFail('missing --task');
|
|
44
|
+
return { task, root, child };
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const footerOf = (dumpStdout) =>
|
|
48
|
+
dumpStdout
|
|
49
|
+
.split('\n')
|
|
50
|
+
.filter((line) => line.startsWith('bytes: ') || line.startsWith('path: ') || line.startsWith('grep -n '))
|
|
51
|
+
.join('\n');
|
|
52
|
+
|
|
53
|
+
const failureLines = (text) => {
|
|
54
|
+
const lines = text.split('\n');
|
|
55
|
+
if (lines.length > 0 && lines[lines.length - 1] === '') lines.pop();
|
|
56
|
+
const picked = [];
|
|
57
|
+
let used = 0;
|
|
58
|
+
for (let index = 0; index < lines.length && picked.length < HEAD_LINES; index += 1) {
|
|
59
|
+
if (!FAIL_LINE.test(lines[index])) continue;
|
|
60
|
+
const block = [lines[index]];
|
|
61
|
+
if (lines[index + 1]) block.push(lines[index + 1]);
|
|
62
|
+
for (const line of block) {
|
|
63
|
+
if (picked.length >= HEAD_LINES) break;
|
|
64
|
+
const size = Buffer.byteLength(line) + 1;
|
|
65
|
+
if (used + size > HEAD_BYTES) return picked;
|
|
66
|
+
picked.push(line);
|
|
67
|
+
used += size;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return picked;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const viewFor = ({ dumpStdout, storedText, storedBytes }) => {
|
|
74
|
+
if (storedBytes <= PASS_THROUGH_BYTES) return dumpStdout;
|
|
75
|
+
const picked = failureLines(storedText);
|
|
76
|
+
if (picked.length === 0) return dumpStdout;
|
|
77
|
+
const footer = footerOf(dumpStdout);
|
|
78
|
+
return `head:\n${picked.join('\n')}\n${footer}\n`;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const run = ({ task, root, child }) => {
|
|
82
|
+
const teamRoot = root ? path.resolve(root) : resolveTeamRoot(process.cwd());
|
|
83
|
+
if (!teamRoot) usageFail('no .ai.local/team found above the current directory; pass --root <team-dir>');
|
|
84
|
+
const captured = spawnSync(child[0], child.slice(1), {
|
|
85
|
+
cwd: process.cwd(),
|
|
86
|
+
maxBuffer: CAPTURE_BYTES,
|
|
87
|
+
});
|
|
88
|
+
const status = captured.status ?? 128;
|
|
89
|
+
const body = Buffer.concat([captured.stdout ?? Buffer.alloc(0), captured.stderr ?? Buffer.alloc(0)]);
|
|
90
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'run-compact-'));
|
|
91
|
+
const input = path.join(dir, 'output.bin');
|
|
92
|
+
try {
|
|
93
|
+
fs.writeFileSync(input, body);
|
|
94
|
+
const stored = spawnSync(
|
|
95
|
+
process.execPath,
|
|
96
|
+
[dumpScript, '--input', input, '--task', task, '--label', 'compact', '--root', teamRoot],
|
|
97
|
+
{ encoding: 'utf8' },
|
|
98
|
+
);
|
|
99
|
+
if (stored.status !== 0) {
|
|
100
|
+
process.stderr.write(stored.stderr || stored.stdout || '');
|
|
101
|
+
return status;
|
|
102
|
+
}
|
|
103
|
+
const storedBytesMatch = stored.stdout.match(/^bytes: (\d+)/m);
|
|
104
|
+
const storedBytes = storedBytesMatch ? Number(storedBytesMatch[1]) : body.length;
|
|
105
|
+
const storedText = body.subarray(0, CAPTURE_BYTES).toString('utf8');
|
|
106
|
+
const view = viewFor({ dumpStdout: stored.stdout, storedText, storedBytes });
|
|
107
|
+
const shownBytes = Buffer.byteLength(view);
|
|
108
|
+
process.stdout.write(view);
|
|
109
|
+
process.stdout.write(`stored_bytes: ${storedBytes} shown_bytes: ${shownBytes}\n`);
|
|
110
|
+
return status;
|
|
111
|
+
} finally {
|
|
112
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const invokedDirectly = (() => {
|
|
117
|
+
if (!process.argv[1]) return false;
|
|
118
|
+
try {
|
|
119
|
+
return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
|
|
120
|
+
} catch {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
})();
|
|
124
|
+
|
|
125
|
+
if (invokedDirectly) {
|
|
126
|
+
try {
|
|
127
|
+
process.exitCode = run(parseArgs(process.argv.slice(2)));
|
|
128
|
+
} catch (error) {
|
|
129
|
+
process.stderr.write(`run-compact: ${error.message}\n`);
|
|
130
|
+
process.exitCode = typeof error.exitCode === 'number' ? error.exitCode : 1;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -21,7 +21,9 @@ import { acquireLock, releaseLock } from './lock.mjs';
|
|
|
21
21
|
const SIGNALS_FILE = 'signals.jsonl';
|
|
22
22
|
export const DEFAULT_SIGNALS_PATH = path.join(process.cwd(), '.ai.local', SIGNALS_FILE);
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
// `exemplar` is a repeated clean path, not a wrong turn. The rule improver
|
|
25
|
+
// skips it; the efficacy oracle's wrong-turn list does not include it.
|
|
26
|
+
const KINDS = ['correction', 'retry', 'waste', 'reversal', 'dead-end', 'exemplar'];
|
|
25
27
|
const SEVERITIES = ['high', 'med', 'low'];
|
|
26
28
|
const SOURCES = ['self-review', 'gate', 'technical-retro', 'user'];
|
|
27
29
|
const STATUSES = ['proposed', 'staged', 'applied', 'rolled_back', 'rejected'];
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
isKillSwitchSet,
|
|
29
29
|
listAppliedMigrations,
|
|
30
30
|
openTeamDb,
|
|
31
|
+
readNewerSchemaModule,
|
|
31
32
|
readSchemaMeta,
|
|
32
33
|
readSearchMode,
|
|
33
34
|
readUserVersion,
|
|
@@ -3343,11 +3344,15 @@ const handle = async (req, res, settings) => {
|
|
|
3343
3344
|
if (params.slug !== undefined) params.slug = parseSlug(params.slug);
|
|
3344
3345
|
|
|
3345
3346
|
// The handler opens the connection lazily and the caller closes it, so a
|
|
3346
|
-
// static route never touches the database.
|
|
3347
|
+
// static route never touches the database. A schema file newer than the
|
|
3348
|
+
// module this process loaded is opened with that file, not the cached one.
|
|
3349
|
+
const freshSchema = await readNewerSchemaModule();
|
|
3347
3350
|
let opened = null;
|
|
3348
3351
|
const handleOnce = () => {
|
|
3349
3352
|
if (!opened) {
|
|
3350
|
-
opened =
|
|
3353
|
+
opened = freshSchema
|
|
3354
|
+
? freshSchema.openTeamDb({ teamRoot: settings.teamRoot, dbPath: settings.dbPath, readOnly: true })
|
|
3355
|
+
: (settings.services.openDb?.(settings) ?? openTeamDb({ teamRoot: settings.teamRoot, dbPath: settings.dbPath, readOnly: true }));
|
|
3351
3356
|
}
|
|
3352
3357
|
return opened;
|
|
3353
3358
|
};
|