@bonesofspring/ai-rules 0.2.36 → 0.2.38
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 +38 -0
- package/README.md +23 -2
- package/bin/cli.js +106 -1
- package/bin/lib/engine-scripts.js +22 -0
- package/bin/lib/fs-utils.js +78 -11
- package/bin/lib/merged-config.js +30 -16
- package/bin/lib/seed-ai-local-team.js +160 -12
- package/bin/opencode-install.js +37 -52
- package/docs/OPENCODE.md +4 -4
- package/docs/specs/INDEX.md +5 -2
- package/package.json +7 -1
- package/presets/_shared/ai-local/scripts/derive-gate-signals.mjs +173 -0
- package/presets/_shared/ai-local/scripts/efficacy-oracle.mjs +576 -0
- package/presets/_shared/ai-local/scripts/lock.mjs +118 -0
- package/presets/_shared/ai-local/scripts/rule-improver.mjs +795 -0
- package/presets/_shared/ai-local/scripts/run.mjs +309 -0
- package/presets/_shared/ai-local/scripts/signals.mjs +256 -0
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
- package/presets/_shared/core/quality/self-review-and-context-hygiene.md +8 -7
- package/presets/_shared/hooks/README.md +142 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +1377 -0
- package/presets/_shared/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/android-kotlin/CLAUDE.md +1 -1
- package/presets/claude/android-kotlin/MCP.md +2 -2
- package/presets/claude/android-kotlin/REPO_AGENTS.md +14 -0
- package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/debugger.md +1 -1
- package/presets/claude/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/commands/README.md +1 -0
- package/presets/claude/android-kotlin/commands/task-continue.md +9 -0
- package/presets/claude/android-kotlin/commands/technical-retro.md +8 -0
- package/presets/claude/android-kotlin/commands/update.md +39 -0
- package/presets/claude/android-kotlin/hooks/README.md +1 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +278 -28
- package/presets/claude/android-kotlin/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/android-kotlin/hooks/examples/README.md +1 -1
- package/presets/claude/android-kotlin/mcp.json +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +7 -154
- package/presets/claude/android-kotlin/settings.json +14 -1
- package/presets/claude/android-kotlin/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/android-kotlin/team/README.md +2 -6
- package/presets/claude/android-kotlin/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/claude/go/CLAUDE.md +1 -1
- package/presets/claude/go/MCP.md +2 -2
- package/presets/claude/go/REPO_AGENTS.md +14 -0
- package/presets/claude/go/agents/build-verifier.md +1 -1
- package/presets/claude/go/agents/code-reviewer.md +1 -1
- package/presets/claude/go/agents/debugger.md +1 -1
- package/presets/claude/go/agents/feature-developer.md +1 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/commands/README.md +1 -0
- package/presets/claude/go/commands/task-continue.md +9 -0
- package/presets/claude/go/commands/technical-retro.md +8 -0
- package/presets/claude/go/commands/update.md +39 -0
- package/presets/claude/go/hooks/README.md +1 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +290 -34
- package/presets/claude/go/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/go/hooks/examples/README.md +1 -1
- package/presets/claude/go/mcp.json +1 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +7 -12
- package/presets/claude/go/settings.json +14 -1
- package/presets/claude/go/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/go/team/README.md +2 -6
- package/presets/claude/ios-swift/CLAUDE.md +1 -1
- package/presets/claude/ios-swift/MCP.md +2 -2
- package/presets/claude/ios-swift/REPO_AGENTS.md +14 -0
- package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
- package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/debugger.md +1 -1
- package/presets/claude/ios-swift/agents/feature-developer.md +1 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/commands/README.md +1 -0
- package/presets/claude/ios-swift/commands/task-continue.md +9 -0
- package/presets/claude/ios-swift/commands/technical-retro.md +8 -0
- package/presets/claude/ios-swift/commands/update.md +39 -0
- package/presets/claude/ios-swift/hooks/README.md +1 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +285 -35
- package/presets/claude/ios-swift/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/ios-swift/hooks/examples/README.md +1 -1
- package/presets/claude/ios-swift/mcp.json +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +7 -154
- package/presets/claude/ios-swift/settings.json +14 -1
- package/presets/claude/ios-swift/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/ios-swift/team/README.md +2 -6
- package/presets/claude/ios-swift/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/claude/java/CLAUDE.md +2 -2
- package/presets/claude/java/REPO_AGENTS.md +14 -0
- package/presets/claude/java/agents/build-verifier.md +1 -1
- package/presets/claude/java/agents/code-reviewer.md +1 -1
- package/presets/claude/java/agents/debugger.md +1 -1
- package/presets/claude/java/agents/feature-developer.md +1 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/commands/README.md +1 -0
- package/presets/claude/java/commands/task-continue.md +9 -0
- package/presets/claude/java/commands/technical-retro.md +8 -0
- package/presets/claude/java/commands/update.md +39 -0
- package/presets/claude/java/hooks/README.md +1 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +290 -34
- package/presets/claude/java/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/java/hooks/examples/README.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +7 -29
- package/presets/claude/java/settings.json +14 -1
- package/presets/claude/java/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/java/team/README.md +2 -6
- package/presets/claude/mcp-ts/CLAUDE.md +1 -1
- package/presets/claude/mcp-ts/REPO_AGENTS.md +14 -0
- package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/claude/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/commands/README.md +1 -0
- package/presets/claude/mcp-ts/commands/task-continue.md +9 -0
- package/presets/claude/mcp-ts/commands/technical-retro.md +8 -0
- package/presets/claude/mcp-ts/commands/update.md +39 -0
- package/presets/claude/mcp-ts/hooks/README.md +1 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +289 -31
- package/presets/claude/mcp-ts/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +7 -15
- package/presets/claude/mcp-ts/settings.json +14 -1
- package/presets/claude/mcp-ts/team/README.md +2 -6
- package/presets/claude/next/CLAUDE.md +2 -1
- package/presets/claude/next/MCP.md +2 -2
- package/presets/claude/next/REPO_AGENTS.md +15 -1
- package/presets/claude/next/agents/build-verifier.md +1 -1
- package/presets/claude/next/agents/code-reviewer.md +1 -1
- package/presets/claude/next/agents/debugger.md +1 -1
- package/presets/claude/next/agents/feature-developer.md +1 -1
- package/presets/claude/next/agents/task-analyst.md +1 -1
- package/presets/claude/next/agents/task-router.md +1 -1
- package/presets/claude/next/commands/README.md +1 -0
- package/presets/claude/next/commands/task-continue.md +9 -0
- package/presets/claude/next/commands/technical-retro.md +8 -0
- package/presets/claude/next/commands/update.md +39 -0
- package/presets/claude/next/hooks/README.md +1 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +209 -24
- package/presets/claude/next/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/next/hooks/examples/README.md +1 -1
- package/presets/claude/next/mcp.json +1 -1
- package/presets/claude/next/rules/anti-hallucination/react-next-anti-hallucination.md +21 -18
- package/presets/claude/next/rules/stack/next-app-router.md +27 -0
- package/presets/claude/next/rules/stack/next-static-export.md +16 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +7 -227
- package/presets/claude/next/rules/tooling-and-review/security-next.md +16 -2
- package/presets/claude/next/rules/ui-and-accessibility/component-catalog-gate.md +13 -0
- package/presets/claude/next/rules/ui-and-accessibility/forms-validation.md +12 -0
- package/presets/claude/next/settings.json +13 -0
- package/presets/claude/next/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/next/team/README.md +2 -6
- package/presets/claude/next/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/claude/next/team/fixtures/feature-light.json +2 -1
- package/presets/claude/next/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/claude/nuxt/CLAUDE.md +2 -1
- package/presets/claude/nuxt/MCP.md +2 -2
- package/presets/claude/nuxt/REPO_AGENTS.md +14 -0
- package/presets/claude/nuxt/agents/build-verifier.md +1 -1
- package/presets/claude/nuxt/agents/code-reviewer.md +1 -1
- package/presets/claude/nuxt/agents/debugger.md +1 -1
- package/presets/claude/nuxt/agents/feature-developer.md +1 -1
- package/presets/claude/nuxt/agents/task-analyst.md +1 -1
- package/presets/claude/nuxt/commands/README.md +1 -0
- package/presets/claude/nuxt/commands/task-continue.md +9 -0
- package/presets/claude/nuxt/commands/technical-retro.md +8 -0
- package/presets/claude/nuxt/commands/update.md +39 -0
- package/presets/claude/nuxt/hooks/README.md +1 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +255 -25
- package/presets/claude/nuxt/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/nuxt/hooks/examples/README.md +1 -1
- package/presets/claude/nuxt/mcp.json +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +7 -224
- package/presets/claude/nuxt/settings.json +13 -0
- package/presets/claude/nuxt/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/nuxt/team/README.md +2 -6
- package/presets/claude/nuxt/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/claude/php-hexagonal/CLAUDE.md +2 -2
- package/presets/claude/php-hexagonal/REPO_AGENTS.md +14 -0
- package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/claude/php-hexagonal/agents/debugger.md +1 -1
- package/presets/claude/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/commands/README.md +1 -0
- package/presets/claude/php-hexagonal/commands/task-continue.md +9 -0
- package/presets/claude/php-hexagonal/commands/technical-retro.md +8 -0
- package/presets/claude/php-hexagonal/commands/update.md +39 -0
- package/presets/claude/php-hexagonal/hooks/README.md +1 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +290 -34
- package/presets/claude/php-hexagonal/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/php-hexagonal/hooks/examples/README.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +7 -29
- package/presets/claude/php-hexagonal/settings.json +14 -1
- package/presets/claude/php-hexagonal/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/php-hexagonal/team/README.md +2 -6
- package/presets/claude/php-laravel/CLAUDE.md +1 -1
- package/presets/claude/php-laravel/REPO_AGENTS.md +14 -0
- package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
- package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/debugger.md +1 -1
- package/presets/claude/php-laravel/agents/feature-developer.md +1 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/commands/README.md +1 -0
- package/presets/claude/php-laravel/commands/task-continue.md +9 -0
- package/presets/claude/php-laravel/commands/technical-retro.md +8 -0
- package/presets/claude/php-laravel/commands/update.md +39 -0
- package/presets/claude/php-laravel/hooks/README.md +1 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +290 -34
- package/presets/claude/php-laravel/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/php-laravel/hooks/examples/README.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +7 -30
- package/presets/claude/php-laravel/settings.json +14 -1
- package/presets/claude/php-laravel/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/php-laravel/team/README.md +2 -6
- package/presets/claude/svelte/CLAUDE.md +2 -1
- package/presets/claude/svelte/MCP.md +2 -2
- package/presets/claude/svelte/REPO_AGENTS.md +14 -0
- package/presets/claude/svelte/agents/build-verifier.md +1 -1
- package/presets/claude/svelte/agents/code-reviewer.md +1 -1
- package/presets/claude/svelte/agents/debugger.md +1 -1
- package/presets/claude/svelte/agents/feature-developer.md +1 -1
- package/presets/claude/svelte/agents/task-analyst.md +1 -1
- package/presets/claude/svelte/commands/README.md +1 -0
- package/presets/claude/svelte/commands/task-continue.md +9 -0
- package/presets/claude/svelte/commands/technical-retro.md +8 -0
- package/presets/claude/svelte/commands/update.md +39 -0
- package/presets/claude/svelte/hooks/README.md +1 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +255 -25
- package/presets/claude/svelte/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/svelte/hooks/examples/README.md +1 -1
- package/presets/claude/svelte/mcp.json +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +7 -224
- package/presets/claude/svelte/settings.json +13 -0
- package/presets/claude/svelte/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/svelte/team/README.md +2 -6
- package/presets/claude/svelte/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/cursor/android-kotlin/AGENTS.md +1 -0
- package/presets/cursor/android-kotlin/MCP.md +2 -2
- package/presets/cursor/android-kotlin/REPO_AGENTS.md +14 -0
- package/presets/cursor/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/cursor/android-kotlin/agents/debugger.md +1 -1
- package/presets/cursor/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/cursor/android-kotlin/commands/README.md +1 -0
- package/presets/cursor/android-kotlin/commands/task-continue.md +9 -0
- package/presets/cursor/android-kotlin/commands/technical-retro.md +8 -0
- package/presets/cursor/android-kotlin/commands/update.md +39 -0
- package/presets/cursor/android-kotlin/hooks/README.md +5 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +257 -25
- package/presets/cursor/android-kotlin/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/android-kotlin/hooks/examples/README.md +1 -1
- package/presets/cursor/android-kotlin/hooks.json +6 -0
- package/presets/cursor/android-kotlin/mcp.json +1 -1
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/android-kotlin/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/android-kotlin/team/README.md +2 -0
- package/presets/cursor/android-kotlin/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/cursor/go/MCP.md +2 -2
- package/presets/cursor/go/REPO_AGENTS.md +14 -0
- package/presets/cursor/go/agents/build-verifier.md +1 -1
- package/presets/cursor/go/agents/code-reviewer.md +1 -1
- package/presets/cursor/go/agents/debugger.md +1 -1
- package/presets/cursor/go/agents/feature-developer.md +1 -1
- package/presets/cursor/go/agents/task-analyst.md +1 -1
- package/presets/cursor/go/commands/README.md +1 -0
- package/presets/cursor/go/commands/task-continue.md +9 -0
- package/presets/cursor/go/commands/technical-retro.md +8 -0
- package/presets/cursor/go/commands/update.md +39 -0
- package/presets/cursor/go/hooks/README.md +5 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +282 -26
- package/presets/cursor/go/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/go/hooks/examples/README.md +1 -1
- package/presets/cursor/go/hooks.json +6 -0
- package/presets/cursor/go/mcp.json +1 -1
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/go/team/README.md +2 -0
- package/presets/cursor/ios-swift/AGENTS.md +1 -0
- package/presets/cursor/ios-swift/MCP.md +2 -2
- package/presets/cursor/ios-swift/REPO_AGENTS.md +14 -0
- package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
- package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/cursor/ios-swift/agents/debugger.md +1 -1
- package/presets/cursor/ios-swift/agents/feature-developer.md +1 -1
- package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
- package/presets/cursor/ios-swift/commands/README.md +1 -0
- package/presets/cursor/ios-swift/commands/task-continue.md +9 -0
- package/presets/cursor/ios-swift/commands/technical-retro.md +8 -0
- package/presets/cursor/ios-swift/commands/update.md +39 -0
- package/presets/cursor/ios-swift/hooks/README.md +5 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +257 -25
- package/presets/cursor/ios-swift/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/ios-swift/hooks/examples/README.md +1 -1
- package/presets/cursor/ios-swift/hooks.json +6 -0
- package/presets/cursor/ios-swift/mcp.json +1 -1
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/ios-swift/team/README.md +2 -0
- package/presets/cursor/ios-swift/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/cursor/java/AGENTS.md +1 -1
- package/presets/cursor/java/REPO_AGENTS.md +14 -0
- package/presets/cursor/java/agents/build-verifier.md +1 -1
- package/presets/cursor/java/agents/code-reviewer.md +1 -1
- package/presets/cursor/java/agents/debugger.md +1 -1
- package/presets/cursor/java/agents/feature-developer.md +1 -1
- package/presets/cursor/java/agents/task-analyst.md +1 -1
- package/presets/cursor/java/commands/README.md +1 -0
- package/presets/cursor/java/commands/task-continue.md +9 -0
- package/presets/cursor/java/commands/technical-retro.md +8 -0
- package/presets/cursor/java/commands/update.md +39 -0
- package/presets/cursor/java/hooks/README.md +5 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +282 -26
- package/presets/cursor/java/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/java/hooks/examples/README.md +1 -1
- package/presets/cursor/java/hooks.json +6 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/java/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/java/team/README.md +2 -0
- package/presets/cursor/mcp-ts/REPO_AGENTS.md +14 -0
- package/presets/cursor/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/cursor/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/cursor/mcp-ts/commands/README.md +1 -0
- package/presets/cursor/mcp-ts/commands/task-continue.md +9 -0
- package/presets/cursor/mcp-ts/commands/technical-retro.md +8 -0
- package/presets/cursor/mcp-ts/commands/update.md +39 -0
- package/presets/cursor/mcp-ts/hooks/README.md +5 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +286 -28
- package/presets/cursor/mcp-ts/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/mcp-ts/hooks.json +6 -0
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mcp-ts/team/README.md +2 -0
- package/presets/cursor/next/AGENTS.md +1 -0
- package/presets/cursor/next/MCP.md +2 -2
- package/presets/cursor/next/REPO_AGENTS.md +15 -1
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +1 -1
- package/presets/cursor/next/agents/debugger.md +1 -1
- package/presets/cursor/next/agents/feature-developer.md +1 -1
- package/presets/cursor/next/agents/task-analyst.md +1 -1
- package/presets/cursor/next/agents/task-router.md +1 -1
- package/presets/cursor/next/commands/README.md +1 -0
- package/presets/cursor/next/commands/task-continue.md +9 -0
- package/presets/cursor/next/commands/technical-retro.md +8 -0
- package/presets/cursor/next/commands/update.md +39 -0
- package/presets/cursor/next/hooks/README.md +6 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +206 -23
- package/presets/cursor/next/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/next/hooks/examples/README.md +1 -1
- package/presets/cursor/next/hooks.json +6 -0
- package/presets/cursor/next/mcp.json +1 -1
- package/presets/cursor/next/rules/README.md +3 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/rules/component-catalog-gate.mdc +13 -0
- package/presets/cursor/next/rules/forms-validation.mdc +12 -0
- package/presets/cursor/next/rules/next-app-router.mdc +27 -0
- package/presets/cursor/next/rules/next-static-export.mdc +16 -0
- package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +21 -18
- package/presets/cursor/next/rules/security-next.mdc +16 -2
- package/presets/cursor/next/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/next/team/README.md +2 -0
- package/presets/cursor/next/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/cursor/next/team/fixtures/feature-light.json +2 -1
- package/presets/cursor/next/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/cursor/nuxt/AGENTS.md +1 -0
- package/presets/cursor/nuxt/MCP.md +2 -2
- package/presets/cursor/nuxt/REPO_AGENTS.md +14 -0
- package/presets/cursor/nuxt/agents/build-verifier.md +1 -1
- package/presets/cursor/nuxt/agents/code-reviewer.md +1 -1
- package/presets/cursor/nuxt/agents/debugger.md +1 -1
- package/presets/cursor/nuxt/agents/feature-developer.md +1 -1
- package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
- package/presets/cursor/nuxt/commands/README.md +1 -0
- package/presets/cursor/nuxt/commands/task-continue.md +9 -0
- package/presets/cursor/nuxt/commands/technical-retro.md +8 -0
- package/presets/cursor/nuxt/commands/update.md +39 -0
- package/presets/cursor/nuxt/hooks/README.md +4 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +252 -24
- package/presets/cursor/nuxt/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/nuxt/hooks/examples/README.md +1 -1
- package/presets/cursor/nuxt/hooks.json +6 -0
- package/presets/cursor/nuxt/mcp.json +1 -1
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/nuxt/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/nuxt/team/README.md +2 -0
- package/presets/cursor/nuxt/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/cursor/php-hexagonal/AGENTS.md +1 -1
- package/presets/cursor/php-hexagonal/REPO_AGENTS.md +14 -0
- package/presets/cursor/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/cursor/php-hexagonal/agents/debugger.md +1 -1
- package/presets/cursor/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/cursor/php-hexagonal/commands/README.md +1 -0
- package/presets/cursor/php-hexagonal/commands/task-continue.md +9 -0
- package/presets/cursor/php-hexagonal/commands/technical-retro.md +8 -0
- package/presets/cursor/php-hexagonal/commands/update.md +39 -0
- package/presets/cursor/php-hexagonal/hooks/README.md +5 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +282 -26
- package/presets/cursor/php-hexagonal/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/php-hexagonal/hooks/examples/README.md +1 -1
- package/presets/cursor/php-hexagonal/hooks.json +6 -0
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-hexagonal/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/php-hexagonal/team/README.md +2 -0
- package/presets/cursor/php-laravel/AGENTS.md +1 -1
- package/presets/cursor/php-laravel/REPO_AGENTS.md +14 -0
- package/presets/cursor/php-laravel/agents/build-verifier.md +1 -1
- package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/cursor/php-laravel/agents/debugger.md +1 -1
- package/presets/cursor/php-laravel/agents/feature-developer.md +1 -1
- package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
- package/presets/cursor/php-laravel/commands/README.md +1 -0
- package/presets/cursor/php-laravel/commands/task-continue.md +9 -0
- package/presets/cursor/php-laravel/commands/technical-retro.md +8 -0
- package/presets/cursor/php-laravel/commands/update.md +39 -0
- package/presets/cursor/php-laravel/hooks/README.md +5 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +282 -26
- package/presets/cursor/php-laravel/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/php-laravel/hooks/examples/README.md +1 -1
- package/presets/cursor/php-laravel/hooks.json +6 -0
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-laravel/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/php-laravel/team/README.md +2 -0
- package/presets/cursor/svelte/AGENTS.md +1 -0
- package/presets/cursor/svelte/MCP.md +2 -2
- package/presets/cursor/svelte/REPO_AGENTS.md +14 -0
- package/presets/cursor/svelte/agents/build-verifier.md +1 -1
- package/presets/cursor/svelte/agents/code-reviewer.md +1 -1
- package/presets/cursor/svelte/agents/debugger.md +1 -1
- package/presets/cursor/svelte/agents/feature-developer.md +1 -1
- package/presets/cursor/svelte/agents/task-analyst.md +1 -1
- package/presets/cursor/svelte/commands/README.md +1 -0
- package/presets/cursor/svelte/commands/task-continue.md +9 -0
- package/presets/cursor/svelte/commands/technical-retro.md +8 -0
- package/presets/cursor/svelte/commands/update.md +39 -0
- package/presets/cursor/svelte/hooks/README.md +4 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +252 -24
- package/presets/cursor/svelte/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/svelte/hooks/examples/README.md +1 -1
- package/presets/cursor/svelte/hooks.json +6 -0
- package/presets/cursor/svelte/mcp.json +1 -1
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/svelte/team/README.md +2 -0
- package/presets/cursor/svelte/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/mavis/android-kotlin/MAVIS.md +1 -0
- package/presets/mavis/android-kotlin/MCP.md +2 -2
- package/presets/mavis/android-kotlin/REPO_AGENTS.md +14 -0
- package/presets/mavis/android-kotlin/adapter-map.json +17 -1
- package/presets/mavis/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/mavis/android-kotlin/agents/debugger.md +1 -1
- package/presets/mavis/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/mavis/android-kotlin/commands/README.md +1 -0
- package/presets/mavis/android-kotlin/commands/task-continue.md +9 -0
- package/presets/mavis/android-kotlin/commands/technical-retro.md +8 -0
- package/presets/mavis/android-kotlin/commands/update.md +34 -0
- package/presets/mavis/android-kotlin/hooks/README.md +3 -0
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +257 -25
- package/presets/mavis/android-kotlin/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/android-kotlin/mcp.json +1 -1
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/android-kotlin/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/android-kotlin/team/README.md +2 -0
- package/presets/mavis/android-kotlin/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/mavis/go/MCP.md +2 -2
- package/presets/mavis/go/REPO_AGENTS.md +14 -0
- package/presets/mavis/go/adapter-map.json +17 -1
- package/presets/mavis/go/agents/build-verifier.md +1 -1
- package/presets/mavis/go/agents/code-reviewer.md +1 -1
- package/presets/mavis/go/agents/debugger.md +1 -1
- package/presets/mavis/go/agents/feature-developer.md +1 -1
- package/presets/mavis/go/agents/task-analyst.md +1 -1
- package/presets/mavis/go/commands/README.md +1 -0
- package/presets/mavis/go/commands/task-continue.md +9 -0
- package/presets/mavis/go/commands/technical-retro.md +8 -0
- package/presets/mavis/go/commands/update.md +34 -0
- package/presets/mavis/go/hooks/README.md +3 -0
- package/presets/mavis/go/hooks/chain-team-phases.sh +282 -26
- package/presets/mavis/go/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/go/mcp.json +1 -1
- package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/go/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/go/team/README.md +2 -0
- package/presets/mavis/ios-swift/MAVIS.md +1 -0
- package/presets/mavis/ios-swift/MCP.md +2 -2
- package/presets/mavis/ios-swift/REPO_AGENTS.md +14 -0
- package/presets/mavis/ios-swift/adapter-map.json +17 -1
- package/presets/mavis/ios-swift/agents/build-verifier.md +1 -1
- package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/mavis/ios-swift/agents/debugger.md +1 -1
- package/presets/mavis/ios-swift/agents/feature-developer.md +1 -1
- package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
- package/presets/mavis/ios-swift/commands/README.md +1 -0
- package/presets/mavis/ios-swift/commands/task-continue.md +9 -0
- package/presets/mavis/ios-swift/commands/technical-retro.md +8 -0
- package/presets/mavis/ios-swift/commands/update.md +34 -0
- package/presets/mavis/ios-swift/hooks/README.md +3 -0
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +257 -25
- package/presets/mavis/ios-swift/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/ios-swift/mcp.json +1 -1
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/ios-swift/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/ios-swift/team/README.md +2 -0
- package/presets/mavis/ios-swift/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/mavis/java/REPO_AGENTS.md +14 -0
- package/presets/mavis/java/adapter-map.json +17 -1
- package/presets/mavis/java/agents/build-verifier.md +1 -1
- package/presets/mavis/java/agents/code-reviewer.md +1 -1
- package/presets/mavis/java/agents/debugger.md +1 -1
- package/presets/mavis/java/agents/feature-developer.md +1 -1
- package/presets/mavis/java/agents/task-analyst.md +1 -1
- package/presets/mavis/java/commands/README.md +1 -0
- package/presets/mavis/java/commands/task-continue.md +9 -0
- package/presets/mavis/java/commands/technical-retro.md +8 -0
- package/presets/mavis/java/commands/update.md +34 -0
- package/presets/mavis/java/hooks/README.md +3 -0
- package/presets/mavis/java/hooks/chain-team-phases.sh +282 -26
- package/presets/mavis/java/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/java/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/java/team/README.md +2 -0
- package/presets/mavis/mcp-ts/REPO_AGENTS.md +14 -0
- package/presets/mavis/mcp-ts/adapter-map.json +17 -1
- package/presets/mavis/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/mavis/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/mavis/mcp-ts/commands/README.md +1 -0
- package/presets/mavis/mcp-ts/commands/task-continue.md +9 -0
- package/presets/mavis/mcp-ts/commands/technical-retro.md +8 -0
- package/presets/mavis/mcp-ts/commands/update.md +34 -0
- package/presets/mavis/mcp-ts/hooks/README.md +3 -0
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +286 -28
- package/presets/mavis/mcp-ts/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/mcp-ts/team/README.md +2 -0
- package/presets/mavis/next/MAVIS.md +1 -0
- package/presets/mavis/next/MCP.md +2 -2
- package/presets/mavis/next/REPO_AGENTS.md +15 -1
- package/presets/mavis/next/adapter-map.json +25 -1
- package/presets/mavis/next/agents/build-verifier.md +1 -1
- package/presets/mavis/next/agents/code-reviewer.md +1 -1
- package/presets/mavis/next/agents/debugger.md +1 -1
- package/presets/mavis/next/agents/feature-developer.md +1 -1
- package/presets/mavis/next/agents/task-analyst.md +1 -1
- package/presets/mavis/next/agents/task-router.md +1 -1
- package/presets/mavis/next/commands/README.md +1 -0
- package/presets/mavis/next/commands/task-continue.md +9 -0
- package/presets/mavis/next/commands/technical-retro.md +8 -0
- package/presets/mavis/next/commands/update.md +34 -0
- package/presets/mavis/next/hooks/README.md +3 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +206 -23
- package/presets/mavis/next/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/next/mcp.json +1 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/next/rules/component-catalog-gate.md +13 -0
- package/presets/mavis/next/rules/forms-validation.md +12 -0
- package/presets/mavis/next/rules/next-app-router.md +27 -0
- package/presets/mavis/next/rules/next-static-export.md +16 -0
- package/presets/mavis/next/rules/react-next-anti-hallucination.md +20 -18
- package/presets/mavis/next/rules/security-next.md +13 -0
- package/presets/mavis/next/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/next/team/README.md +2 -0
- package/presets/mavis/next/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/mavis/next/team/fixtures/feature-light.json +2 -1
- package/presets/mavis/next/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/mavis/nuxt/MAVIS.md +1 -0
- package/presets/mavis/nuxt/MCP.md +2 -2
- package/presets/mavis/nuxt/REPO_AGENTS.md +14 -0
- package/presets/mavis/nuxt/adapter-map.json +17 -1
- package/presets/mavis/nuxt/agents/build-verifier.md +1 -1
- package/presets/mavis/nuxt/agents/code-reviewer.md +1 -1
- package/presets/mavis/nuxt/agents/debugger.md +1 -1
- package/presets/mavis/nuxt/agents/feature-developer.md +1 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
- package/presets/mavis/nuxt/commands/README.md +1 -0
- package/presets/mavis/nuxt/commands/task-continue.md +9 -0
- package/presets/mavis/nuxt/commands/technical-retro.md +8 -0
- package/presets/mavis/nuxt/commands/update.md +34 -0
- package/presets/mavis/nuxt/hooks/README.md +3 -0
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +252 -24
- package/presets/mavis/nuxt/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/nuxt/mcp.json +1 -1
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/nuxt/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/nuxt/team/README.md +2 -0
- package/presets/mavis/nuxt/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/mavis/php-hexagonal/REPO_AGENTS.md +14 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +17 -1
- package/presets/mavis/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/mavis/php-hexagonal/agents/debugger.md +1 -1
- package/presets/mavis/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/mavis/php-hexagonal/commands/README.md +1 -0
- package/presets/mavis/php-hexagonal/commands/task-continue.md +9 -0
- package/presets/mavis/php-hexagonal/commands/technical-retro.md +8 -0
- package/presets/mavis/php-hexagonal/commands/update.md +34 -0
- package/presets/mavis/php-hexagonal/hooks/README.md +3 -0
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +282 -26
- package/presets/mavis/php-hexagonal/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-hexagonal/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/php-hexagonal/team/README.md +2 -0
- package/presets/mavis/php-laravel/REPO_AGENTS.md +14 -0
- package/presets/mavis/php-laravel/adapter-map.json +17 -1
- package/presets/mavis/php-laravel/agents/build-verifier.md +1 -1
- package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/mavis/php-laravel/agents/debugger.md +1 -1
- package/presets/mavis/php-laravel/agents/feature-developer.md +1 -1
- package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
- package/presets/mavis/php-laravel/commands/README.md +1 -0
- package/presets/mavis/php-laravel/commands/task-continue.md +9 -0
- package/presets/mavis/php-laravel/commands/technical-retro.md +8 -0
- package/presets/mavis/php-laravel/commands/update.md +34 -0
- package/presets/mavis/php-laravel/hooks/README.md +3 -0
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +282 -26
- package/presets/mavis/php-laravel/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-laravel/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/php-laravel/team/README.md +2 -0
- package/presets/mavis/svelte/MAVIS.md +1 -0
- package/presets/mavis/svelte/MCP.md +2 -2
- package/presets/mavis/svelte/REPO_AGENTS.md +14 -0
- package/presets/mavis/svelte/adapter-map.json +17 -1
- package/presets/mavis/svelte/agents/build-verifier.md +1 -1
- package/presets/mavis/svelte/agents/code-reviewer.md +1 -1
- package/presets/mavis/svelte/agents/debugger.md +1 -1
- package/presets/mavis/svelte/agents/feature-developer.md +1 -1
- package/presets/mavis/svelte/agents/task-analyst.md +1 -1
- package/presets/mavis/svelte/commands/README.md +1 -0
- package/presets/mavis/svelte/commands/task-continue.md +9 -0
- package/presets/mavis/svelte/commands/technical-retro.md +8 -0
- package/presets/mavis/svelte/commands/update.md +34 -0
- package/presets/mavis/svelte/hooks/README.md +3 -0
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +252 -24
- package/presets/mavis/svelte/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/svelte/mcp.json +1 -1
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/svelte/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/svelte/team/README.md +2 -0
- package/presets/mavis/svelte/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/opencode/android-kotlin/MCP.md +2 -2
- package/presets/opencode/android-kotlin/OPENCODE.md +15 -6
- package/presets/opencode/android-kotlin/REPO_AGENTS.md +14 -0
- package/presets/opencode/android-kotlin/adapter-map.json +17 -1
- package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/opencode/android-kotlin/agents/debugger.md +1 -1
- package/presets/opencode/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/commands/README.md +1 -0
- package/presets/opencode/android-kotlin/commands/task-continue.md +9 -0
- package/presets/opencode/android-kotlin/commands/technical-retro.md +8 -0
- package/presets/opencode/android-kotlin/commands/update.md +42 -0
- package/presets/opencode/android-kotlin/hooks/README.md +3 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +257 -25
- package/presets/opencode/android-kotlin/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/android-kotlin/opencode.json +3 -13
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/android-kotlin/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/android-kotlin/team/README.md +2 -0
- package/presets/opencode/android-kotlin/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/opencode/go/MCP.md +2 -2
- package/presets/opencode/go/OPENCODE.md +14 -6
- package/presets/opencode/go/REPO_AGENTS.md +14 -0
- package/presets/opencode/go/adapter-map.json +17 -1
- package/presets/opencode/go/agents/build-verifier.md +1 -1
- package/presets/opencode/go/agents/code-reviewer.md +1 -1
- package/presets/opencode/go/agents/debugger.md +1 -1
- package/presets/opencode/go/agents/feature-developer.md +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/commands/README.md +1 -0
- package/presets/opencode/go/commands/task-continue.md +9 -0
- package/presets/opencode/go/commands/technical-retro.md +8 -0
- package/presets/opencode/go/commands/update.md +42 -0
- package/presets/opencode/go/hooks/README.md +3 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +282 -26
- package/presets/opencode/go/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/go/opencode.json +3 -13
- package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/go/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/go/team/README.md +2 -0
- package/presets/opencode/ios-swift/MCP.md +2 -2
- package/presets/opencode/ios-swift/OPENCODE.md +15 -6
- package/presets/opencode/ios-swift/REPO_AGENTS.md +14 -0
- package/presets/opencode/ios-swift/adapter-map.json +17 -1
- package/presets/opencode/ios-swift/agents/build-verifier.md +1 -1
- package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/opencode/ios-swift/agents/debugger.md +1 -1
- package/presets/opencode/ios-swift/agents/feature-developer.md +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/commands/README.md +1 -0
- package/presets/opencode/ios-swift/commands/task-continue.md +9 -0
- package/presets/opencode/ios-swift/commands/technical-retro.md +8 -0
- package/presets/opencode/ios-swift/commands/update.md +42 -0
- package/presets/opencode/ios-swift/hooks/README.md +3 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +257 -25
- package/presets/opencode/ios-swift/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/ios-swift/opencode.json +3 -13
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/ios-swift/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/ios-swift/team/README.md +2 -0
- package/presets/opencode/ios-swift/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/opencode/java/OPENCODE.md +14 -6
- package/presets/opencode/java/REPO_AGENTS.md +14 -0
- package/presets/opencode/java/adapter-map.json +17 -1
- package/presets/opencode/java/agents/build-verifier.md +1 -1
- package/presets/opencode/java/agents/code-reviewer.md +1 -1
- package/presets/opencode/java/agents/debugger.md +1 -1
- package/presets/opencode/java/agents/feature-developer.md +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/commands/README.md +1 -0
- package/presets/opencode/java/commands/task-continue.md +9 -0
- package/presets/opencode/java/commands/technical-retro.md +8 -0
- package/presets/opencode/java/commands/update.md +42 -0
- package/presets/opencode/java/hooks/README.md +3 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +282 -26
- package/presets/opencode/java/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/java/opencode.json +2 -12
- package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/java/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/java/team/README.md +2 -0
- package/presets/opencode/mcp-ts/OPENCODE.md +14 -6
- package/presets/opencode/mcp-ts/REPO_AGENTS.md +14 -0
- package/presets/opencode/mcp-ts/adapter-map.json +17 -1
- package/presets/opencode/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/opencode/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/commands/README.md +1 -0
- package/presets/opencode/mcp-ts/commands/task-continue.md +9 -0
- package/presets/opencode/mcp-ts/commands/technical-retro.md +8 -0
- package/presets/opencode/mcp-ts/commands/update.md +42 -0
- package/presets/opencode/mcp-ts/hooks/README.md +3 -0
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +286 -28
- package/presets/opencode/mcp-ts/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/mcp-ts/opencode.json +2 -12
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/mcp-ts/team/README.md +2 -0
- package/presets/opencode/next/MCP.md +2 -2
- package/presets/opencode/next/OPENCODE.md +15 -6
- package/presets/opencode/next/REPO_AGENTS.md +15 -1
- package/presets/opencode/next/adapter-map.json +25 -1
- package/presets/opencode/next/agents/build-verifier.md +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +1 -1
- package/presets/opencode/next/agents/debugger.md +1 -1
- package/presets/opencode/next/agents/feature-developer.md +1 -1
- package/presets/opencode/next/agents/task-analyst.md +1 -1
- package/presets/opencode/next/agents/task-router.md +1 -1
- package/presets/opencode/next/commands/README.md +1 -0
- package/presets/opencode/next/commands/task-continue.md +9 -0
- package/presets/opencode/next/commands/technical-retro.md +8 -0
- package/presets/opencode/next/commands/update.md +42 -0
- package/presets/opencode/next/hooks/README.md +3 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +206 -23
- package/presets/opencode/next/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/next/opencode.json +3 -13
- package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/next/rules/component-catalog-gate.md +13 -0
- package/presets/opencode/next/rules/forms-validation.md +12 -0
- package/presets/opencode/next/rules/next-app-router.md +27 -0
- package/presets/opencode/next/rules/next-static-export.md +16 -0
- package/presets/opencode/next/rules/react-next-anti-hallucination.md +20 -18
- package/presets/opencode/next/rules/security-next.md +13 -0
- package/presets/opencode/next/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/next/team/README.md +2 -0
- package/presets/opencode/next/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/opencode/next/team/fixtures/feature-light.json +2 -1
- package/presets/opencode/next/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/opencode/nuxt/MCP.md +2 -2
- package/presets/opencode/nuxt/OPENCODE.md +15 -6
- package/presets/opencode/nuxt/REPO_AGENTS.md +14 -0
- package/presets/opencode/nuxt/adapter-map.json +17 -1
- package/presets/opencode/nuxt/agents/build-verifier.md +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
- package/presets/opencode/nuxt/agents/debugger.md +1 -1
- package/presets/opencode/nuxt/agents/feature-developer.md +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/commands/README.md +1 -0
- package/presets/opencode/nuxt/commands/task-continue.md +9 -0
- package/presets/opencode/nuxt/commands/technical-retro.md +8 -0
- package/presets/opencode/nuxt/commands/update.md +42 -0
- package/presets/opencode/nuxt/hooks/README.md +3 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +252 -24
- package/presets/opencode/nuxt/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/nuxt/opencode.json +3 -13
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/nuxt/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/nuxt/team/README.md +2 -0
- package/presets/opencode/nuxt/team/fixtures/artifact-manifest.example.json +1 -0
- package/presets/opencode/php-hexagonal/OPENCODE.md +14 -6
- package/presets/opencode/php-hexagonal/REPO_AGENTS.md +14 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +17 -1
- package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/debugger.md +1 -1
- package/presets/opencode/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/commands/README.md +1 -0
- package/presets/opencode/php-hexagonal/commands/task-continue.md +9 -0
- package/presets/opencode/php-hexagonal/commands/technical-retro.md +8 -0
- package/presets/opencode/php-hexagonal/commands/update.md +42 -0
- package/presets/opencode/php-hexagonal/hooks/README.md +3 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +282 -26
- package/presets/opencode/php-hexagonal/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/php-hexagonal/opencode.json +2 -12
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-hexagonal/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/php-hexagonal/team/README.md +2 -0
- package/presets/opencode/php-laravel/OPENCODE.md +14 -6
- package/presets/opencode/php-laravel/REPO_AGENTS.md +14 -0
- package/presets/opencode/php-laravel/adapter-map.json +17 -1
- package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
- package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-laravel/agents/debugger.md +1 -1
- package/presets/opencode/php-laravel/agents/feature-developer.md +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/commands/README.md +1 -0
- package/presets/opencode/php-laravel/commands/task-continue.md +9 -0
- package/presets/opencode/php-laravel/commands/technical-retro.md +8 -0
- package/presets/opencode/php-laravel/commands/update.md +42 -0
- package/presets/opencode/php-laravel/hooks/README.md +3 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +282 -26
- package/presets/opencode/php-laravel/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/php-laravel/opencode.json +2 -12
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-laravel/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/php-laravel/team/README.md +2 -0
- package/presets/opencode/svelte/MCP.md +2 -2
- package/presets/opencode/svelte/OPENCODE.md +15 -6
- package/presets/opencode/svelte/REPO_AGENTS.md +14 -0
- package/presets/opencode/svelte/adapter-map.json +17 -1
- package/presets/opencode/svelte/agents/build-verifier.md +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
- package/presets/opencode/svelte/agents/debugger.md +1 -1
- package/presets/opencode/svelte/agents/feature-developer.md +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/commands/README.md +1 -0
- package/presets/opencode/svelte/commands/task-continue.md +9 -0
- package/presets/opencode/svelte/commands/technical-retro.md +8 -0
- package/presets/opencode/svelte/commands/update.md +42 -0
- package/presets/opencode/svelte/hooks/README.md +3 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +252 -24
- package/presets/opencode/svelte/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/svelte/opencode.json +3 -13
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/svelte/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/svelte/team/README.md +2 -0
- package/presets/opencode/svelte/team/fixtures/artifact-manifest.example.json +1 -0
- package/scripts/check-product-specs.sh +115 -9
|
@@ -154,7 +154,21 @@ function mutateMetrics(mutator) {
|
|
|
154
154
|
try { metrics = JSON.parse(fs.readFileSync(METRICS_PATH, 'utf8')); } catch {
|
|
155
155
|
const runId = status.metricsRunId || `${slug}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
156
156
|
status.metricsRunId = runId;
|
|
157
|
-
|
|
157
|
+
// Resolve profile from pipeline.json (preferred) or status.json, falling back to 'unknown'.
|
|
158
|
+
// The router/agent must never write profile into status.json — pipeline.json is the SoT.
|
|
159
|
+
let profile = 'unknown';
|
|
160
|
+
try {
|
|
161
|
+
if (fs.existsSync(pipelinePath)) {
|
|
162
|
+
const pipe = JSON.parse(fs.readFileSync(pipelinePath, 'utf8'));
|
|
163
|
+
if (pipe && (pipe.profile === 'light' || pipe.profile === 'standard' || pipe.profile === 'full')) {
|
|
164
|
+
profile = pipe.profile;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} catch {}
|
|
168
|
+
if (profile === 'unknown' && (status.profile === 'light' || status.profile === 'standard' || status.profile === 'full')) {
|
|
169
|
+
profile = status.profile;
|
|
170
|
+
}
|
|
171
|
+
metrics = { schemaVersion: 1, task: { runId, slug, preset: 'ai-rules', stack: STACK, platform: PLATFORM, intent: status.intent || 'unknown', profile }, events: [] };
|
|
158
172
|
metrics.events.push({ eventId: `${runId}:task_started`, type: 'task_started', at: now, source: 'hook', attributionConfidence: 'high' });
|
|
159
173
|
}
|
|
160
174
|
mutator(metrics);
|
|
@@ -227,21 +241,119 @@ function resolvedAttempt() {
|
|
|
227
241
|
const active = status.activeAttempts || {}; const entries = Object.entries(active);
|
|
228
242
|
const stableAttemptId = hookInput.attemptId;
|
|
229
243
|
if (stableAttemptId) {
|
|
230
|
-
return active[stableAttemptId]
|
|
244
|
+
return active[stableAttemptId]
|
|
245
|
+
? { attemptId: stableAttemptId, entry: active[stableAttemptId], confidence: 'high' }
|
|
246
|
+
: null;
|
|
231
247
|
}
|
|
232
248
|
if (entries.length === 1) return { attemptId: entries[0][0], entry: entries[0][1], confidence: 'high' };
|
|
233
249
|
try { const receipts = JSON.parse(fs.readFileSync(path.join(taskDir, '.metrics-receipts.json'), 'utf8')); const receipt = Array.isArray(receipts) ? receipts.find((item) => active[item.attemptId]) : null; if (receipt) return { attemptId: receipt.attemptId, entry: active[receipt.attemptId], confidence: 'fallback', source: 'agent' }; } catch {}
|
|
234
250
|
return null;
|
|
235
251
|
}
|
|
252
|
+
let artifactStallMessage = null;
|
|
253
|
+
|
|
254
|
+
// A1: seed the manifest a modern pipeline expects instead of advancing without
|
|
255
|
+
// one. Exclusive publish via hard link so a producer that wrote the file in the
|
|
256
|
+
// meantime is never overwritten; returns null on success (or when the file
|
|
257
|
+
// appeared) and the fs error otherwise.
|
|
258
|
+
function writeSkeletonManifest(manifestPath) {
|
|
259
|
+
const temporary = `${manifestPath}.${process.pid}.${Date.now()}.seed`;
|
|
260
|
+
const body = JSON.stringify({ schemaVersion: 1, slug, artifacts: [] }, null, 2) + '\n';
|
|
261
|
+
let descriptor = null;
|
|
262
|
+
try {
|
|
263
|
+
descriptor = fs.openSync(temporary, 'wx');
|
|
264
|
+
try { fs.writeSync(descriptor, body); try { fs.fsyncSync(descriptor); } catch {} } finally { fs.closeSync(descriptor); descriptor = null; }
|
|
265
|
+
fs.linkSync(temporary, manifestPath);
|
|
266
|
+
fs.unlinkSync(temporary);
|
|
267
|
+
return null;
|
|
268
|
+
} catch (error) {
|
|
269
|
+
if (descriptor !== null) { try { fs.closeSync(descriptor); } catch {} }
|
|
270
|
+
try { fs.unlinkSync(temporary); } catch {}
|
|
271
|
+
if (error && error.code === 'EEXIST' && fs.existsSync(manifestPath)) return null;
|
|
272
|
+
return String(error && error.message ? error.message : error);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// A2: a `completed` receipt must cite evidence the harness can inspect. Order is
|
|
277
|
+
// the message order — the first failing predicate wins, so the operator sees one
|
|
278
|
+
// actionable line. `authoritativePaths[]` stays task-dir-relative; external
|
|
279
|
+
// references belong in `evidencePaths[]`.
|
|
280
|
+
function validateCompletedArtifact(entry) {
|
|
281
|
+
const artifactId = entry && entry.id ? entry.id : '(unnamed)';
|
|
282
|
+
const entryStatus = entry && entry.status;
|
|
283
|
+
if (entryStatus !== 'completed') {
|
|
284
|
+
return `[chain-team-phases] ${slug}: receipt "${artifactId}" has receipt.outcome "completed" but entry status "${entryStatus}". Make entry.status and receipt.outcome agree, then resume with: /task-continue ${slug}`;
|
|
285
|
+
}
|
|
286
|
+
const authoritativePaths = entry && Array.isArray(entry.authoritativePaths) ? entry.authoritativePaths : [];
|
|
287
|
+
if (authoritativePaths.length === 0) {
|
|
288
|
+
return `[chain-team-phases] ${slug}: receipt "${artifactId}" is "completed" but authoritativePaths[] is empty. Record at least one file you produced under .ai.local/team/tasks/${slug}/, then resume with: /task-continue ${slug}`;
|
|
289
|
+
}
|
|
290
|
+
for (const cited of authoritativePaths) {
|
|
291
|
+
const value = typeof cited === 'string' ? cited.trim() : '';
|
|
292
|
+
const resolvedPath = value ? path.resolve(taskDir, value) : taskDir;
|
|
293
|
+
const relative = path.relative(taskDir, resolvedPath);
|
|
294
|
+
const escapes = !value || path.isAbsolute(value) || relative === '' || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative);
|
|
295
|
+
if (escapes) {
|
|
296
|
+
return `[chain-team-phases] ${slug}: receipt "${artifactId}" cites "${value}", which resolves outside .ai.local/team/tasks/${slug}/ (relative: "${relative}"). Cite a task-relative path; keep external references in evidencePaths[]. Then resume with: /task-continue ${slug}`;
|
|
297
|
+
}
|
|
298
|
+
let stat = null;
|
|
299
|
+
try { stat = fs.statSync(resolvedPath); } catch {}
|
|
300
|
+
if (!stat || !stat.isFile()) {
|
|
301
|
+
return `[chain-team-phases] ${slug}: receipt "${artifactId}" cites "${value}" but no such file exists under .ai.local/team/tasks/${slug}/. Write the file, then resume with: /task-continue ${slug}`;
|
|
302
|
+
}
|
|
303
|
+
if (/\.md[c]?$/i.test(value)) {
|
|
304
|
+
let content = '';
|
|
305
|
+
try { content = fs.readFileSync(resolvedPath, 'utf8'); } catch {}
|
|
306
|
+
if (!/\S/.test(content)) {
|
|
307
|
+
return `[chain-team-phases] ${slug}: receipt "${artifactId}" is "completed" but authoritative path "${value}" has no non-whitespace content. Produce the artifact, then resume with: /task-continue ${slug}`;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
|
|
236
314
|
function readBoundReceiptOutcome(agent, step, resolved) {
|
|
237
315
|
if (!agent || !resolved) return { outcome: null, receiptRequired: false };
|
|
238
316
|
const manifestPath = path.join(taskDir, 'artifact-manifest.json');
|
|
239
|
-
|
|
317
|
+
const expectedOutputId = artifactOutputIdFor(step, agent);
|
|
318
|
+
if (!fs.existsSync(manifestPath)) {
|
|
319
|
+
// A1: absent manifest + a parsed modern pipeline denies silent advancement.
|
|
320
|
+
// Legacy/step-less pipelines keep their previous behaviour (legacyFlow owns them).
|
|
321
|
+
if (!(Array.isArray(steps) && steps.length > 0)) return { outcome: null, receiptRequired: false };
|
|
322
|
+
const seeded = writeSkeletonManifest(manifestPath);
|
|
323
|
+
const stepIndex = typeof resolved.entry.stepIndex === 'number' ? resolved.entry.stepIndex : 0;
|
|
324
|
+
if (seeded) {
|
|
325
|
+
return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: artifact-manifest.json is missing and the skeleton could not be written (${seeded}). Create .ai.local/team/tasks/${slug}/artifact-manifest.json with {schemaVersion:1, slug, artifacts:[]}, add the receipt for artifactOutputId "${expectedOutputId}", then resume with: /task-continue ${slug}` };
|
|
326
|
+
}
|
|
327
|
+
return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: no artifact-manifest.json for step ${stepIndex} (${agent}). Wrote a skeleton {schemaVersion:1, slug, artifacts:[]}. Expected artifactOutputId "${expectedOutputId}". Write the artifact and its receipt, then resume with: /task-continue ${slug}` };
|
|
328
|
+
}
|
|
240
329
|
try {
|
|
241
330
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
331
|
+
// Guard: the schema key is `artifacts` (see agent-artifact-contracts.md). A top-level
|
|
332
|
+
// `entries` key is a silent bug — producer wrote to a wrong field, hook would not
|
|
333
|
+
// see the receipt, and the step hangs in `awaiting_artifact_receipt`. Warn loudly.
|
|
334
|
+
if (manifest && typeof manifest === 'object' && !Array.isArray(manifest.artifacts) && Array.isArray(manifest.entries)) {
|
|
335
|
+
process.stderr.write(`WARNING: ${manifestPath} has top-level "entries" but no "artifacts" array; reading only "artifacts" per schema. The producer likely upserted into the wrong key. See agent-artifact-contracts.md (Schema field name).` + '\n');
|
|
336
|
+
} else if (manifest && typeof manifest === 'object' && Array.isArray(manifest.entries) && Array.isArray(manifest.artifacts)) {
|
|
337
|
+
process.stderr.write(`WARNING: ${manifestPath} has both "artifacts" and "entries" keys; reading only "artifacts" per schema. Foreign "entries" content is ignored.` + '\n');
|
|
338
|
+
}
|
|
242
339
|
const artifacts = Array.isArray(manifest.artifacts) ? manifest.artifacts : [];
|
|
243
|
-
const expectedOutputId = artifactOutputIdFor(step, agent);
|
|
244
340
|
const attemptStartedAt = Date.parse(resolved.entry.startedAt);
|
|
341
|
+
// Pre-scan: warn on the silent-bug classes the filter below would otherwise drop.
|
|
342
|
+
// A receipt with a non-matching attemptId is dropped silently; without this warning,
|
|
343
|
+
// the step hangs in `awaiting_artifact_receipt` with no signal of why. Same for
|
|
344
|
+
// receipts whose terminal timestamp is older than the active attempt (stale retry).
|
|
345
|
+
const activeIds = new Set(Object.keys(status.activeAttempts || {}));
|
|
346
|
+
for (const entry of artifacts) {
|
|
347
|
+
if (!entry || entry.producer !== agent || !entry.receipt || typeof entry.receipt.outcome !== 'string') continue;
|
|
348
|
+
const rid = entry.receipt.attemptId;
|
|
349
|
+
if (typeof rid === 'string' && rid !== resolved.attemptId && !activeIds.has(rid)) {
|
|
350
|
+
process.stderr.write(`WARNING: ${manifestPath} receipt for producer "${agent}" id "${entry.id}" carries attemptId "${rid}" that does not match the active attempt "${resolved.attemptId}". The receipt is being dropped; step will hang in \`awaiting_artifact_receipt\` unless the producer retries. Common cause: agent reused an attemptId from a prior failed attempt. See agent-artifact-contracts.md (Receipt binding).` + '\n');
|
|
351
|
+
}
|
|
352
|
+
const terminalAt = Date.parse(entry.timestamps?.completedAt || entry.timestamps?.updatedAt || '');
|
|
353
|
+
if (Number.isFinite(attemptStartedAt) && Number.isFinite(terminalAt) && terminalAt < attemptStartedAt) {
|
|
354
|
+
process.stderr.write(`WARNING: ${manifestPath} receipt for producer "${agent}" id "${entry.id}" has timestamps.completedAt older than the active attempt's startedAt. Likely a stale receipt from a previous attempt; it is being dropped. See agent-artifact-contracts.md (Receipt binding).` + '\n');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
245
357
|
const owned = artifacts
|
|
246
358
|
.filter((entry) => {
|
|
247
359
|
if (!entry || entry.producer !== agent || !entry.receipt || typeof entry.receipt.outcome !== 'string') return false;
|
|
@@ -256,19 +368,33 @@ function readBoundReceiptOutcome(agent, step, resolved) {
|
|
|
256
368
|
const tb = Date.parse(b.timestamps?.completedAt || b.timestamps?.updatedAt || 0) || 0;
|
|
257
369
|
return tb - ta;
|
|
258
370
|
});
|
|
259
|
-
|
|
371
|
+
// Bonus: warn if the active attempt's receipts all lack attemptId in a non-parallel step.
|
|
372
|
+
// The orchestrator always provides attemptId, so a missing one means the agent dropped it
|
|
373
|
+
// (model output, JSON.stringify omission, etc.). boundByOutput still binds the receipt by
|
|
374
|
+
// expectedOutputId, so this is not fatal — but it is a contract violation worth flagging.
|
|
375
|
+
if (owned.length > 0 && owned[0].receipt.attemptId == null && !(step && step.parallel && Array.isArray(getStepAgents(step)) && getStepAgents(step).length > 1)) {
|
|
376
|
+
process.stderr.write(`WARNING: ${manifestPath} receipt for producer "${agent}" id "${owned[0].id}" lacks entry.receipt.attemptId on a non-parallel step. The receipt is bound by output-id fallback; the agent should always include the attemptId the orchestrator provides. See agent-artifact-contracts.md (Receipt binding).` + '\n');
|
|
377
|
+
}
|
|
378
|
+
const outcome = owned[0]?.receipt?.outcome || null;
|
|
379
|
+
if (outcome === 'completed') {
|
|
380
|
+
const stallMessage = validateCompletedArtifact(owned[0]);
|
|
381
|
+
if (stallMessage) return { outcome: null, receiptRequired: true, stallMessage };
|
|
382
|
+
}
|
|
383
|
+
return { outcome, receiptRequired: true };
|
|
260
384
|
} catch {
|
|
261
385
|
return { outcome: null, receiptRequired: false };
|
|
262
386
|
}
|
|
263
387
|
}
|
|
264
388
|
function reconcileStatusFromManifest(agent, step, resolved) {
|
|
265
389
|
const terminal = new Set(['completed', 'blocked', 'changes_requested', 'validation_failed']);
|
|
266
|
-
|
|
390
|
+
artifactStallMessage = null;
|
|
391
|
+
const { outcome, receiptRequired, stallMessage } = readBoundReceiptOutcome(agent, step, resolved);
|
|
267
392
|
if (terminal.has(outcome)) {
|
|
268
393
|
status.state = outcome;
|
|
269
394
|
return outcome;
|
|
270
395
|
}
|
|
271
396
|
if (receiptRequired) {
|
|
397
|
+
artifactStallMessage = stallMessage || null;
|
|
272
398
|
status.state = 'awaiting_artifact_receipt';
|
|
273
399
|
status.phase = 'blocked';
|
|
274
400
|
return status.state;
|
|
@@ -289,6 +415,34 @@ function finishActiveAttempt(forced) {
|
|
|
289
415
|
appendMetric({ type: 'attempt_finished', at: now, attemptId: resolved.attemptId, outcome, durationMs: Number.isFinite(durationMs) && durationMs >= 0 ? durationMs : null, retryAfterFix: status.retryAfterFix || null, source: resolved.source || 'hook', attributionConfidence: resolved.confidence });
|
|
290
416
|
const active = { ...(status.activeAttempts || {}) }; delete active[resolved.attemptId]; status.activeAttempts = active; status.lastCompletedAttempt = { attemptId: resolved.attemptId, completedAt: now }; return { ...resolved, outcome };
|
|
291
417
|
}
|
|
418
|
+
function missingConsumerArtifacts() {
|
|
419
|
+
const file = path.join(process.cwd(), '.ai.local', 'pipeline-gates.json');
|
|
420
|
+
if (!fs.existsSync(file)) return [];
|
|
421
|
+
let parsed;
|
|
422
|
+
try { parsed = JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return []; }
|
|
423
|
+
const required = Array.isArray(parsed && parsed.requireArtifacts) ? parsed.requireArtifacts : [];
|
|
424
|
+
const ids = required.filter((id) => typeof id === 'string' && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(id));
|
|
425
|
+
if (ids.length === 0) return [];
|
|
426
|
+
let manifest = { artifacts: [] };
|
|
427
|
+
try { manifest = JSON.parse(fs.readFileSync(path.join(taskDir, 'artifact-manifest.json'), 'utf8')); } catch {}
|
|
428
|
+
const done = new Set(
|
|
429
|
+
(manifest.artifacts || [])
|
|
430
|
+
.filter((artifact) => artifact && artifact.status === 'completed' && ids.includes(artifact.id))
|
|
431
|
+
.map((artifact) => artifact.id),
|
|
432
|
+
);
|
|
433
|
+
return ids.filter((id) => !done.has(id));
|
|
434
|
+
}
|
|
435
|
+
function completePipeline(statusPatch) {
|
|
436
|
+
const missing = missingConsumerArtifacts();
|
|
437
|
+
if (missing.length > 0) {
|
|
438
|
+
writeStatus({ ...statusPatch, phase: 'blocked', state: 'blocked', currentAgent: null, awaitingHumanGate: false });
|
|
439
|
+
out(`Pipeline blocked for "${slug}": .ai.local/pipeline-gates.json requireArtifacts missing completed receipt(s): ${missing.join(', ')}.`);
|
|
440
|
+
process.exit(0);
|
|
441
|
+
}
|
|
442
|
+
writeStatus(statusPatch);
|
|
443
|
+
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
444
|
+
process.exit(0);
|
|
445
|
+
}
|
|
292
446
|
function beginHumanGate() { const eventId = `${status.metricsRunId || slug}:gate:${Date.now()}`; appendMetric({ eventId, type: 'human_gate_started', at: now, source: 'hook', attributionConfidence: 'high' }); status.activeHumanGateEventId = eventId; }
|
|
293
447
|
function endHumanGateIfResumed() {
|
|
294
448
|
if (!status.activeHumanGateEventId || status.awaitingHumanGate || status.state === 'awaiting_approval') return;
|
|
@@ -327,6 +481,15 @@ function out(message) {
|
|
|
327
481
|
process.stdout.write(JSON.stringify({ followup_message: message }));
|
|
328
482
|
}
|
|
329
483
|
|
|
484
|
+
// The stall text always reaches stderr so a second, different rejection is never
|
|
485
|
+
// silent; `out()` fires only when the stop enters the stall, so the follow-up
|
|
486
|
+
// message cannot loop.
|
|
487
|
+
function emitArtifactStall(message, announce) {
|
|
488
|
+
if (message) process.stderr.write(message + '\n');
|
|
489
|
+
if (message && announce) out(message);
|
|
490
|
+
else process.stdout.write('{}');
|
|
491
|
+
}
|
|
492
|
+
|
|
330
493
|
function readArtifact(name) {
|
|
331
494
|
const p = path.join(taskDir, name);
|
|
332
495
|
if (!fs.existsSync(p)) return '';
|
|
@@ -792,9 +955,7 @@ if (hookInput.action === 'end_human_gate') {
|
|
|
792
955
|
if (pendingStepIndexes().length === 0) {
|
|
793
956
|
status.state = 'completed';
|
|
794
957
|
completeTaskMetrics();
|
|
795
|
-
|
|
796
|
-
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
797
|
-
process.exit(0);
|
|
958
|
+
completePipeline({ pipelineIndex: resumeSteps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
798
959
|
}
|
|
799
960
|
out(noProgressNotice());
|
|
800
961
|
process.exit(0);
|
|
@@ -820,15 +981,13 @@ if (hookInput.action === 'end_human_gate') {
|
|
|
820
981
|
// pipeline instead of leaving it in_progress forever.
|
|
821
982
|
status.state = 'completed';
|
|
822
983
|
completeTaskMetrics();
|
|
823
|
-
|
|
984
|
+
completePipeline({
|
|
824
985
|
pipelineIndex: resumeSteps.length,
|
|
825
986
|
phase: 'done',
|
|
826
987
|
state: 'completed',
|
|
827
988
|
currentAgent: null,
|
|
828
989
|
awaitingHumanGate: false,
|
|
829
990
|
});
|
|
830
|
-
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
831
|
-
process.exit(0);
|
|
832
991
|
}
|
|
833
992
|
}
|
|
834
993
|
// A2 (retro §8): if gate closes the final human gate of the pipeline
|
|
@@ -908,10 +1067,11 @@ const completingAgentHint = (() => {
|
|
|
908
1067
|
return getStepAgents(initialStep)[0];
|
|
909
1068
|
})();
|
|
910
1069
|
const reconcilingAttempt = resolvedAttempt();
|
|
1070
|
+
const wasWaitingForReceipt = status.state === 'awaiting_artifact_receipt';
|
|
911
1071
|
reconcileStatusFromManifest(completingAgentHint, initialStep, reconcilingAttempt);
|
|
912
1072
|
if (status.state === 'awaiting_artifact_receipt') {
|
|
913
1073
|
writeStatus({});
|
|
914
|
-
|
|
1074
|
+
emitArtifactStall(artifactStallMessage, !wasWaitingForReceipt);
|
|
915
1075
|
process.exit(0);
|
|
916
1076
|
}
|
|
917
1077
|
let finishedAttempt = finishActiveAttempt();
|
|
@@ -921,6 +1081,11 @@ if (!finishedAttempt && activeAttemptCountBeforeFinish > 0) {
|
|
|
921
1081
|
if (repaired) {
|
|
922
1082
|
appendMetric({ type: 'parallel_attribution_repair', at: now, attemptIds: [repaired.attemptId], source: 'hook', attributionConfidence: 'fallback' });
|
|
923
1083
|
reconcileStatusFromManifest(repaired.entry.agent, steps[repaired.entry.stepIndex], repaired);
|
|
1084
|
+
if (status.state === 'awaiting_artifact_receipt') {
|
|
1085
|
+
writeStatus({});
|
|
1086
|
+
emitArtifactStall(artifactStallMessage, true);
|
|
1087
|
+
process.exit(0);
|
|
1088
|
+
}
|
|
924
1089
|
finishedAttempt = finishActiveAttempt(repaired);
|
|
925
1090
|
} else {
|
|
926
1091
|
writeStatus({});
|
|
@@ -1014,6 +1179,7 @@ if (waveIndexes) {
|
|
|
1014
1179
|
process.stdout.write('{}');
|
|
1015
1180
|
process.exit(0);
|
|
1016
1181
|
}
|
|
1182
|
+
|
|
1017
1183
|
const blockedProducer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'blocked');
|
|
1018
1184
|
if (blockedProducer) {
|
|
1019
1185
|
if (isGraphMode()) {
|
|
@@ -1098,6 +1264,7 @@ if (waveIndexes) {
|
|
|
1098
1264
|
out(handoffForAgent('feature-developer', steps[developerIndex]?.scope, steps[developerIndex]) + ` After fixes, re-run ${retryReviewer}.`);
|
|
1099
1265
|
process.exit(0);
|
|
1100
1266
|
}
|
|
1267
|
+
|
|
1101
1268
|
if (isGraphMode()) {
|
|
1102
1269
|
const validationProducer = waveAgents.find((agent) => outcomes[agent]?.outcome === 'validation_failed');
|
|
1103
1270
|
if (validationProducer) {
|
|
@@ -1125,9 +1292,7 @@ if (waveIndexes) {
|
|
|
1125
1292
|
}
|
|
1126
1293
|
if (pendingStepIndexes().length === 0) {
|
|
1127
1294
|
completeTaskMetrics();
|
|
1128
|
-
|
|
1129
|
-
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1130
|
-
process.exit(0);
|
|
1295
|
+
completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
1131
1296
|
}
|
|
1132
1297
|
out(noProgressNotice());
|
|
1133
1298
|
process.exit(0);
|
|
@@ -1219,9 +1384,7 @@ if (status.state === 'completed' && status.retryAfterFix) {
|
|
|
1219
1384
|
}
|
|
1220
1385
|
|
|
1221
1386
|
if (!currentStep) {
|
|
1222
|
-
|
|
1223
|
-
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1224
|
-
process.exit(0);
|
|
1387
|
+
completePipeline({ phase: 'done', state: 'completed', currentAgent: null });
|
|
1225
1388
|
}
|
|
1226
1389
|
|
|
1227
1390
|
if (hasGateAfterStep(currentStep, pipeline.humanGates)) {
|
|
@@ -1243,9 +1406,7 @@ if (isGraphMode()) {
|
|
|
1243
1406
|
if (dispatchReadyWave()) process.exit(0);
|
|
1244
1407
|
if (pendingStepIndexes().length === 0) {
|
|
1245
1408
|
completeTaskMetrics();
|
|
1246
|
-
|
|
1247
|
-
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1248
|
-
process.exit(0);
|
|
1409
|
+
completePipeline({ pipelineIndex: steps.length, phase: 'done', state: 'completed', currentAgent: null, awaitingHumanGate: false });
|
|
1249
1410
|
}
|
|
1250
1411
|
out(noProgressNotice());
|
|
1251
1412
|
process.exit(0);
|
|
@@ -1254,15 +1415,13 @@ if (isGraphMode()) {
|
|
|
1254
1415
|
const next = findNextExecutableStep(steps, idx + 1, taskDir);
|
|
1255
1416
|
if (!next) {
|
|
1256
1417
|
completeTaskMetrics();
|
|
1257
|
-
|
|
1418
|
+
completePipeline({
|
|
1258
1419
|
pipelineIndex: steps.length,
|
|
1259
1420
|
phase: 'done',
|
|
1260
1421
|
state: 'completed',
|
|
1261
1422
|
currentAgent: null,
|
|
1262
1423
|
awaitingHumanGate: false,
|
|
1263
1424
|
});
|
|
1264
|
-
out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
|
|
1265
|
-
process.exit(0);
|
|
1266
1425
|
}
|
|
1267
1426
|
|
|
1268
1427
|
const { step: nextStep, index: nextIdx } = next;
|
|
@@ -1284,3 +1443,76 @@ if (nextStep.parallel && nextAgents.length > 1) {
|
|
|
1284
1443
|
out(handoffForAgent(nextAgents[0], nextStep.scope, nextStep));
|
|
1285
1444
|
}
|
|
1286
1445
|
NODE
|
|
1446
|
+
|
|
1447
|
+
# --- In-task self-learning postflight ----------------------------------------
|
|
1448
|
+
# One loop run per completed stop, as a second process: capture must not depend
|
|
1449
|
+
# on an agent remembering to run it. The child's stdout is forwarded to stderr
|
|
1450
|
+
# so the hook's own stdout contract (the JSON above) is untouched; `|| true`
|
|
1451
|
+
# plus an unconditional exit 0 keep a loop failure from failing the task; and
|
|
1452
|
+
# `--strict` is never passed — a gate must not live in a hook.
|
|
1453
|
+
INPUT="$input" node <<'POSTFLIGHT' || true
|
|
1454
|
+
const fs = require('fs');
|
|
1455
|
+
const path = require('path');
|
|
1456
|
+
const { spawnSync } = require('child_process');
|
|
1457
|
+
|
|
1458
|
+
let input;
|
|
1459
|
+
try {
|
|
1460
|
+
input = JSON.parse(process.env.INPUT || '');
|
|
1461
|
+
} catch {
|
|
1462
|
+
process.exit(0);
|
|
1463
|
+
}
|
|
1464
|
+
if (!input || input.status !== 'completed') {
|
|
1465
|
+
process.exit(0);
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
// Ratchet: off for `light` pipelines and `spike` intents. A policy skip is
|
|
1469
|
+
// silent on purpose — a warning on every light receipt would make the
|
|
1470
|
+
// containment warnings below unreadable.
|
|
1471
|
+
let pipeline = null;
|
|
1472
|
+
try {
|
|
1473
|
+
const teamRoot = path.join(process.cwd(), '.ai.local', 'team');
|
|
1474
|
+
const active = JSON.parse(fs.readFileSync(path.join(teamRoot, 'active-task.json'), 'utf8'));
|
|
1475
|
+
const pipelineSlug = typeof active.slug === 'string' ? active.slug : '';
|
|
1476
|
+
// Same pattern as `SLUG_RE` at the top of this file: `tasks/<slug>` is
|
|
1477
|
+
// re-derived from `active-task.json` here too, so an unchecked slug could
|
|
1478
|
+
// escape the tree on this path exactly as it could there.
|
|
1479
|
+
const POSTFLIGHT_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
1480
|
+
if (pipelineSlug.length <= 48 && POSTFLIGHT_SLUG_RE.test(pipelineSlug)) {
|
|
1481
|
+
pipeline = JSON.parse(fs.readFileSync(path.join(teamRoot, 'tasks', pipelineSlug, 'pipeline.json'), 'utf8'));
|
|
1482
|
+
}
|
|
1483
|
+
} catch {
|
|
1484
|
+
pipeline = null;
|
|
1485
|
+
}
|
|
1486
|
+
if (pipeline && (pipeline.profile === 'light' || pipeline.intent === 'spike')) {
|
|
1487
|
+
process.exit(0);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
if (!fs.existsSync(path.join(process.cwd(), '.ai.local', 'scripts', 'run.mjs'))) {
|
|
1491
|
+
process.stderr.write(
|
|
1492
|
+
'WARNING: self-learning loop skipped: .ai.local/scripts/run.mjs is missing (install it with `npx @bonesofspring/ai-rules init <tool> --preset <stack>`)\n',
|
|
1493
|
+
);
|
|
1494
|
+
process.exit(0);
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
// Relative argv[1] + `cwd` keeps `run.mjs`'s own entry guard (pathToFileURL
|
|
1498
|
+
// comparison) satisfied even when the project path traverses a symlink.
|
|
1499
|
+
// SIGKILL, not the SIGTERM default: a child that ignores SIGTERM would hold the
|
|
1500
|
+
// hook for its whole runtime while the warning below still reported 15 s.
|
|
1501
|
+
const result = spawnSync(process.execPath, ['.ai.local/scripts/run.mjs'], {
|
|
1502
|
+
cwd: process.cwd(),
|
|
1503
|
+
encoding: 'utf8',
|
|
1504
|
+
timeout: 15000,
|
|
1505
|
+
killSignal: 'SIGKILL',
|
|
1506
|
+
});
|
|
1507
|
+
if (result.stdout) process.stderr.write(result.stdout);
|
|
1508
|
+
if (result.stderr) process.stderr.write(result.stderr);
|
|
1509
|
+
if (result.error) {
|
|
1510
|
+
const timedOut = result.error.code === 'ETIMEDOUT';
|
|
1511
|
+
process.stderr.write(
|
|
1512
|
+
`WARNING: self-learning loop ${timedOut ? 'timed out after 15s' : `failed: ${result.error.message}`}\n`,
|
|
1513
|
+
);
|
|
1514
|
+
} else if (result.status !== 0) {
|
|
1515
|
+
process.stderr.write(`WARNING: self-learning loop exited ${result.status}\n`);
|
|
1516
|
+
}
|
|
1517
|
+
process.exit(0);
|
|
1518
|
+
POSTFLIGHT
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Shared preset hook. Edit this file only; `yarn fix:generated` copies it into every stack.
|
|
3
|
+
|
|
4
|
+
import crypto from 'node:crypto';
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import os from 'node:os';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
export const PACKAGE_NAME = '@bonesofspring/ai-rules';
|
|
11
|
+
export const REGISTRY_URL = 'https://registry.npmjs.org/@bonesofspring/ai-rules/latest';
|
|
12
|
+
export const CACHE_TTL_MS = 12 * 60 * 60 * 1000;
|
|
13
|
+
export const TOOL_ROOTS = ['.cursor', '.claude', '.mavis', '.opencode'];
|
|
14
|
+
|
|
15
|
+
const RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
16
|
+
|
|
17
|
+
export function isReleaseVersion(value) {
|
|
18
|
+
return typeof value === 'string' && RELEASE_VERSION.test(value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function versionParts(value) {
|
|
22
|
+
const core = String(value).trim().replace(/^v/, '').split('-')[0];
|
|
23
|
+
const parts = core.split('.').map((part) => {
|
|
24
|
+
const parsed = Number.parseInt(part, 10);
|
|
25
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
26
|
+
});
|
|
27
|
+
while (parts.length < 3) parts.push(0);
|
|
28
|
+
return parts.slice(0, 3);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Negative when `left` is older than `right`. */
|
|
32
|
+
export function compareVersions(left, right) {
|
|
33
|
+
const a = versionParts(left);
|
|
34
|
+
const b = versionParts(right);
|
|
35
|
+
for (let index = 0; index < 3; index += 1) {
|
|
36
|
+
if (a[index] !== b[index]) return a[index] < b[index] ? -1 : 1;
|
|
37
|
+
}
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function readInstalls(root) {
|
|
42
|
+
const installs = [];
|
|
43
|
+
for (const tool of TOOL_ROOTS) {
|
|
44
|
+
const file = path.join(root, tool, '.ai-rules-install.json');
|
|
45
|
+
if (!fs.existsSync(file)) continue;
|
|
46
|
+
let parsed;
|
|
47
|
+
try {
|
|
48
|
+
parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
49
|
+
} catch {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (!parsed || typeof parsed !== 'object') continue;
|
|
53
|
+
const version = typeof parsed.packageVersion === 'string' ? parsed.packageVersion.trim() : '';
|
|
54
|
+
installs.push({ tool, version: version || null });
|
|
55
|
+
}
|
|
56
|
+
return installs;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function formatInstalled(installs) {
|
|
60
|
+
const byVersion = new Map();
|
|
61
|
+
for (const item of installs) {
|
|
62
|
+
const label = item.version ?? 'not recorded';
|
|
63
|
+
const tools = byVersion.get(label) ?? [];
|
|
64
|
+
tools.push(item.tool);
|
|
65
|
+
byVersion.set(label, tools);
|
|
66
|
+
}
|
|
67
|
+
return [...byVersion.entries()]
|
|
68
|
+
.map(([version, tools]) => `${version} (${tools.join(', ')})`)
|
|
69
|
+
.join('; ');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function buildNotice(installs, latest) {
|
|
73
|
+
if (!isReleaseVersion(latest) || installs.length === 0) return '';
|
|
74
|
+
const behind = installs.filter(
|
|
75
|
+
(item) => item.version === null || compareVersions(item.version, latest) < 0,
|
|
76
|
+
);
|
|
77
|
+
if (behind.length === 0) return '';
|
|
78
|
+
return [
|
|
79
|
+
`Preset update available for ${PACKAGE_NAME}.`,
|
|
80
|
+
`Installed: ${formatInstalled(behind)}.`,
|
|
81
|
+
`Latest: ${latest}.`,
|
|
82
|
+
'Tell the user once in their native language before other work.',
|
|
83
|
+
'Name the installed version and the latest version, and ask them to run /update.',
|
|
84
|
+
'Do not run the update unless they ask.',
|
|
85
|
+
].join(' ');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function formatOutput(notice, format) {
|
|
89
|
+
if (format === 'cursor') {
|
|
90
|
+
return notice ? `${JSON.stringify({ additional_context: notice })}\n` : '{}\n';
|
|
91
|
+
}
|
|
92
|
+
if (format === 'claude') {
|
|
93
|
+
return notice
|
|
94
|
+
? `${JSON.stringify({
|
|
95
|
+
hookSpecificOutput: {
|
|
96
|
+
hookEventName: 'SessionStart',
|
|
97
|
+
additionalContext: notice,
|
|
98
|
+
},
|
|
99
|
+
additional_context: notice,
|
|
100
|
+
})}\n`
|
|
101
|
+
: '{}\n';
|
|
102
|
+
}
|
|
103
|
+
return notice ? `${notice}\n` : '';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function cacheFile(root, tmp) {
|
|
107
|
+
let resolved = path.resolve(root);
|
|
108
|
+
try {
|
|
109
|
+
resolved = fs.realpathSync(resolved);
|
|
110
|
+
} catch {
|
|
111
|
+
// Keep the unresolved path when the directory is not on disk yet.
|
|
112
|
+
}
|
|
113
|
+
const key = crypto.createHash('sha256').update(resolved).digest('hex').slice(0, 16);
|
|
114
|
+
return path.join(tmp, 'ai-rules-update-check', key, 'latest.json');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export async function resolveLatest({
|
|
118
|
+
root,
|
|
119
|
+
now = Date.now(),
|
|
120
|
+
fetchLatest,
|
|
121
|
+
tmp = os.tmpdir(),
|
|
122
|
+
ttl = CACHE_TTL_MS,
|
|
123
|
+
}) {
|
|
124
|
+
const file = cacheFile(root, tmp);
|
|
125
|
+
try {
|
|
126
|
+
const cached = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
127
|
+
if (
|
|
128
|
+
isReleaseVersion(cached.version) &&
|
|
129
|
+
typeof cached.checkedAt === 'number' &&
|
|
130
|
+
now - cached.checkedAt < ttl
|
|
131
|
+
) {
|
|
132
|
+
return cached.version;
|
|
133
|
+
}
|
|
134
|
+
} catch {
|
|
135
|
+
// Missing or unreadable cache is a miss.
|
|
136
|
+
}
|
|
137
|
+
const version = await fetchLatest();
|
|
138
|
+
if (!isReleaseVersion(version)) {
|
|
139
|
+
throw new Error('registry version missing');
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
143
|
+
fs.writeFileSync(file, `${JSON.stringify({ version, checkedAt: now })}\n`);
|
|
144
|
+
} catch {
|
|
145
|
+
// The check still returns the version when the cache directory is not writable.
|
|
146
|
+
}
|
|
147
|
+
return version;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export async function fetchRegistryLatest(url = REGISTRY_URL, timeoutMs = 2500) {
|
|
151
|
+
const response = await fetch(url, {
|
|
152
|
+
headers: { accept: 'application/json', 'user-agent': 'ai-rules-update-check' },
|
|
153
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
154
|
+
redirect: 'follow',
|
|
155
|
+
});
|
|
156
|
+
if (!response.ok) {
|
|
157
|
+
throw new Error(`registry status ${response.status}`);
|
|
158
|
+
}
|
|
159
|
+
const body = await response.json();
|
|
160
|
+
if (!isReleaseVersion(body?.version)) {
|
|
161
|
+
throw new Error('registry version missing');
|
|
162
|
+
}
|
|
163
|
+
return body.version;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function parseFormat(argv) {
|
|
167
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
168
|
+
const arg = argv[index];
|
|
169
|
+
if (arg === '--format') {
|
|
170
|
+
const next = argv[index + 1];
|
|
171
|
+
if (next === 'cursor' || next === 'claude' || next === 'text') return next;
|
|
172
|
+
} else if (arg.startsWith('--format=')) {
|
|
173
|
+
const value = arg.slice('--format='.length);
|
|
174
|
+
if (value === 'cursor' || value === 'claude' || value === 'text') return value;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return 'text';
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function projectRoot() {
|
|
181
|
+
const fromEnv = process.env.CURSOR_PROJECT_DIR || process.env.CLAUDE_PROJECT_DIR;
|
|
182
|
+
if (fromEnv) return path.resolve(fromEnv);
|
|
183
|
+
return process.cwd();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export async function runCheck({
|
|
187
|
+
root,
|
|
188
|
+
format = 'text',
|
|
189
|
+
now,
|
|
190
|
+
fetchLatest,
|
|
191
|
+
tmp,
|
|
192
|
+
ttl,
|
|
193
|
+
}) {
|
|
194
|
+
try {
|
|
195
|
+
const installs = readInstalls(root);
|
|
196
|
+
if (installs.length === 0) return formatOutput('', format);
|
|
197
|
+
const latest = await resolveLatest({ root, now, fetchLatest, tmp, ttl });
|
|
198
|
+
return formatOutput(buildNotice(installs, latest), format);
|
|
199
|
+
} catch {
|
|
200
|
+
return formatOutput('', format);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function main() {
|
|
205
|
+
const format = parseFormat(process.argv.slice(2));
|
|
206
|
+
const text = await runCheck({
|
|
207
|
+
root: projectRoot(),
|
|
208
|
+
format,
|
|
209
|
+
fetchLatest: () => fetchRegistryLatest(),
|
|
210
|
+
});
|
|
211
|
+
process.stdout.write(text);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const isDirect =
|
|
215
|
+
process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
216
|
+
|
|
217
|
+
if (isDirect) {
|
|
218
|
+
main()
|
|
219
|
+
.then(() => {
|
|
220
|
+
process.exitCode = 0;
|
|
221
|
+
})
|
|
222
|
+
.catch(() => {
|
|
223
|
+
const format = parseFormat(process.argv.slice(2));
|
|
224
|
+
process.stdout.write(format === 'text' ? '' : '{}\n');
|
|
225
|
+
process.exitCode = 0;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Hooks cookbook (examples)
|
|
2
2
|
|
|
3
|
-
Optional scripts under `hooks/examples/`. **Not** referenced from default `hooks.json` (only `guard-shell-command.sh
|
|
3
|
+
Optional scripts under `hooks/examples/`. **Not** referenced from default `hooks.json` (only `guard-shell-command.sh`, `chain-team-phases.sh`, and `check-preset-update.mjs`).
|
|
4
4
|
|
|
5
5
|
| Script | Purpose |
|
|
6
6
|
|--------|---------|
|