@bonesofspring/ai-rules 0.2.51 → 0.2.53
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 +92 -0
- package/README.md +27 -3
- package/bin/cli.js +565 -61
- package/bin/lib/ai-local-drift.js +55 -14
- package/bin/lib/engine-scripts.js +10 -0
- package/bin/lib/mcp/clients.js +168 -0
- package/bin/lib/mcp/credentials.js +298 -0
- package/bin/lib/mcp/doctor.js +394 -0
- package/bin/lib/mcp/prompt.js +115 -0
- package/bin/lib/mcp/registry.js +170 -0
- package/bin/lib/mcp/run.js +123 -0
- package/bin/lib/merged-config.js +45 -0
- package/bin/lib/seed-ai-local-team.js +23 -7
- package/bin/lib/tool-installs.js +27 -0
- package/bin/mavis-install.js +2 -0
- package/bin/opencode-install.js +2 -0
- package/docs/LOCAL-OVERLAY.md +1 -1
- package/docs/MCP-SETUP.md +62 -0
- package/docs/PRESET-CONTRIBUTION.md +14 -10
- package/docs/TEAM-DB.md +173 -0
- package/docs/openapi/team-db.v1.json +5085 -0
- package/mcp/gitlab.mjs +123 -0
- package/mcp/lib/envfile.mjs +126 -0
- package/mcp/lib/yandex.mjs +384 -0
- package/mcp/yandex-mcp-proxy.mjs +155 -0
- package/mcp/yandex-token-refresh.mjs +65 -0
- package/package.json +18 -1
- package/presets/_shared/ai-local/scripts/manifest.mjs +112 -3
- package/presets/_shared/ai-local/scripts/rule-improver.mjs +428 -91
- package/presets/_shared/ai-local/scripts/run.mjs +22 -4
- package/presets/_shared/ai-local/scripts/signals.mjs +4 -1
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +1275 -0
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +1067 -0
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +1301 -0
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +1506 -0
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +831 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +251 -0
- package/presets/_shared/core/meta/preset-pr-checklist.md +1 -1
- package/presets/_shared/core/quality/interactive-questions.md +8 -8
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +109 -0
- package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/android-kotlin/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/android-kotlin/team/README.md +10 -0
- package/presets/claude/go/agents/code-reviewer.md +1 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/go/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/go/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/go/team/README.md +10 -0
- package/presets/claude/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/ios-swift/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/post-change-build.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/ios-swift/team/README.md +10 -0
- package/presets/claude/java/agents/code-reviewer.md +1 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/java/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/java/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/java/team/README.md +10 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/mcp-ts/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/mcp-ts/team/README.md +10 -0
- package/presets/claude/next/MCP.md +7 -0
- package/presets/claude/next/README.md +1 -1
- package/presets/claude/next/REPO_AGENTS.md +1 -1
- package/presets/claude/next/agents/README.md +3 -3
- package/presets/claude/next/agents/build-verifier.md +9 -3
- package/presets/claude/next/agents/code-reviewer.md +2 -1
- package/presets/claude/next/agents/codebase-analyzer.md +1 -1
- package/presets/claude/next/agents/feature-developer.md +18 -8
- package/presets/claude/next/agents/openspec-author.md +1 -1
- package/presets/claude/next/agents/playwright-test-generator.md +22 -68
- package/presets/claude/next/agents/playwright-test-healer.md +27 -54
- package/presets/claude/next/agents/playwright-test-planner.md +18 -51
- package/presets/claude/next/agents/task-analyst.md +25 -9
- package/presets/claude/next/agents/task-router.md +1 -1
- package/presets/claude/next/agents/tech-writer.md +1 -1
- package/presets/claude/next/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/next/mcp.json +3 -3
- package/presets/claude/next/rules/anti-hallucination/react-next-anti-hallucination.md +1 -1
- package/presets/claude/next/rules/architecture/layer-barrel-exports.md +1 -1
- package/presets/claude/next/rules/architecture/reference-features.md +1 -1
- package/presets/claude/next/rules/stack/navigation-router-ui.md +1 -1
- package/presets/claude/next/rules/stack/navigation-router.md +14 -0
- package/presets/claude/next/rules/stack/next-app-core.md +19 -17
- package/presets/claude/next/rules/stack/next-app-router.md +5 -17
- package/presets/claude/next/rules/stack/next-static-export.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/next/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/security-next.md +28 -3
- package/presets/claude/next/rules/ui-and-accessibility/css-property-order.md +1 -1
- package/presets/claude/next/rules/ui-and-accessibility/design-tokens-binding.md +4 -4
- package/presets/claude/next/rules/ui-and-accessibility/forms-validation.md +2 -2
- package/presets/claude/next/team/README.md +21 -0
- package/presets/claude/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/claude/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/claude/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/claude/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/claude/nuxt/agents/code-reviewer.md +1 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/nuxt/rules/architecture/layer-barrel-exports.md +1 -1
- package/presets/claude/nuxt/rules/stack/navigation-router-ui.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/nuxt/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/post-change-lint.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/nuxt/team/README.md +10 -0
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/php-hexagonal/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/php-hexagonal/team/README.md +10 -0
- package/presets/claude/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/php-laravel/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/php-laravel/team/README.md +10 -0
- package/presets/claude/svelte/agents/code-reviewer.md +1 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/svelte/rules/architecture/layer-barrel-exports.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/svelte/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/post-change-lint.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/svelte/team/README.md +10 -0
- package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/android-kotlin/rules/README.md +1 -0
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +3 -3
- package/presets/cursor/android-kotlin/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/android-kotlin/team/README.md +10 -0
- package/presets/cursor/go/agents/code-reviewer.md +1 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/go/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/go/team/README.md +10 -0
- package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/ios-swift/rules/README.md +1 -0
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +3 -3
- package/presets/cursor/ios-swift/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/ios-swift/team/README.md +10 -0
- package/presets/cursor/java/agents/code-reviewer.md +1 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/java/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/java/team/README.md +10 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/mcp-ts/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/mcp-ts/team/README.md +10 -0
- package/presets/cursor/next/MCP.md +14 -0
- package/presets/cursor/next/REPO_AGENTS.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +1 -0
- package/presets/cursor/next/agents/playwright-test-healer.md +1 -0
- package/presets/cursor/next/ai-local/rules-library/router-pages.md +5 -5
- package/presets/cursor/next/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/next/mcp.json +3 -3
- package/presets/cursor/next/rules/README.md +1 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/rules/css-property-order-stylelint.mdc +1 -1
- package/presets/cursor/next/rules/design-tokens-binding.mdc +4 -4
- package/presets/cursor/next/rules/forms-validation.mdc +2 -2
- package/presets/cursor/next/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/next/rules/navigation-router-stack.mdc +14 -1
- package/presets/cursor/next/rules/next-app-core.mdc +19 -17
- package/presets/cursor/next/rules/next-app-router.mdc +5 -17
- package/presets/cursor/next/rules/next-static-export.mdc +1 -1
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/next/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +1 -1
- package/presets/cursor/next/rules/reference-features.mdc +1 -1
- package/presets/cursor/next/rules/security-next.mdc +28 -3
- package/presets/cursor/next/team/README.md +21 -0
- package/presets/cursor/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/cursor/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/cursor/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/cursor/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/cursor/nuxt/agents/code-reviewer.md +1 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/nuxt/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/nuxt/team/README.md +10 -0
- package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/php-hexagonal/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/php-hexagonal/team/README.md +10 -0
- package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/php-laravel/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/php-laravel/team/README.md +10 -0
- package/presets/cursor/svelte/agents/code-reviewer.md +1 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/svelte/team/README.md +10 -0
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/android-kotlin/rules/interactive-questions.md +8 -8
- package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/android-kotlin/team/README.md +10 -0
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/agents/code-reviewer.md +1 -0
- package/presets/mavis/go/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/go/rules/interactive-questions.md +8 -8
- package/presets/mavis/go/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/go/team/README.md +10 -0
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/ios-swift/rules/interactive-questions.md +8 -8
- package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/ios-swift/team/README.md +10 -0
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/agents/code-reviewer.md +1 -0
- package/presets/mavis/java/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/java/rules/interactive-questions.md +8 -8
- package/presets/mavis/java/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/java/team/README.md +10 -0
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/mcp-ts/rules/interactive-questions.md +8 -8
- package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/mcp-ts/team/README.md +10 -0
- package/presets/mavis/next/MCP.md +14 -0
- package/presets/mavis/next/REPO_AGENTS.md +1 -1
- package/presets/mavis/next/adapter-map.json +1 -1
- package/presets/mavis/next/agents/code-reviewer.md +1 -0
- package/presets/mavis/next/agents/playwright-test-healer.md +1 -0
- package/presets/mavis/next/ai-local/rules-library/router-pages.md +5 -5
- package/presets/mavis/next/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/next/mcp.json +3 -3
- package/presets/mavis/next/rules/css-property-order-stylelint.md +1 -1
- package/presets/mavis/next/rules/design-tokens-binding.md +4 -4
- package/presets/mavis/next/rules/forms-validation.md +2 -2
- package/presets/mavis/next/rules/interactive-questions.md +8 -8
- package/presets/mavis/next/rules/navigation-router-stack.md +12 -0
- package/presets/mavis/next/rules/next-app-core.md +18 -17
- package/presets/mavis/next/rules/next-app-router.md +4 -17
- package/presets/mavis/next/rules/next-static-export.md +1 -1
- package/presets/mavis/next/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/next/rules/react-next-anti-hallucination.md +1 -1
- package/presets/mavis/next/rules/reference-features.md +1 -1
- package/presets/mavis/next/rules/security-next.md +24 -3
- package/presets/mavis/next/team/README.md +21 -0
- package/presets/mavis/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/mavis/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/mavis/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/mavis/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/code-reviewer.md +1 -0
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/nuxt/rules/interactive-questions.md +8 -8
- package/presets/mavis/nuxt/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/nuxt/team/README.md +10 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/php-hexagonal/rules/interactive-questions.md +8 -8
- package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/php-hexagonal/team/README.md +10 -0
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/php-laravel/rules/interactive-questions.md +8 -8
- package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/php-laravel/team/README.md +10 -0
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/code-reviewer.md +1 -0
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/svelte/rules/interactive-questions.md +8 -8
- package/presets/mavis/svelte/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/svelte/team/README.md +10 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/android-kotlin/rules/interactive-questions.md +8 -8
- package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/android-kotlin/team/README.md +10 -0
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/code-reviewer.md +1 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/go/rules/interactive-questions.md +8 -8
- package/presets/opencode/go/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/go/team/README.md +10 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/ios-swift/rules/interactive-questions.md +8 -8
- package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/ios-swift/team/README.md +10 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/code-reviewer.md +1 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/java/rules/interactive-questions.md +8 -8
- package/presets/opencode/java/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/java/team/README.md +10 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/mcp-ts/rules/interactive-questions.md +8 -8
- package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/mcp-ts/team/README.md +10 -0
- package/presets/opencode/next/MCP.md +14 -0
- package/presets/opencode/next/REPO_AGENTS.md +1 -1
- package/presets/opencode/next/adapter-map.json +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +1 -0
- package/presets/opencode/next/agents/playwright-test-healer.md +1 -0
- package/presets/opencode/next/ai-local/rules-library/router-pages.md +5 -5
- package/presets/opencode/next/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/next/opencode.json +3 -3
- package/presets/opencode/next/rules/css-property-order-stylelint.md +1 -1
- package/presets/opencode/next/rules/design-tokens-binding.md +4 -4
- package/presets/opencode/next/rules/forms-validation.md +2 -2
- package/presets/opencode/next/rules/interactive-questions.md +8 -8
- package/presets/opencode/next/rules/navigation-router-stack.md +12 -0
- package/presets/opencode/next/rules/next-app-core.md +18 -17
- package/presets/opencode/next/rules/next-app-router.md +4 -17
- package/presets/opencode/next/rules/next-static-export.md +1 -1
- package/presets/opencode/next/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/next/rules/react-next-anti-hallucination.md +1 -1
- package/presets/opencode/next/rules/reference-features.md +1 -1
- package/presets/opencode/next/rules/security-next.md +24 -3
- package/presets/opencode/next/team/README.md +21 -0
- package/presets/opencode/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/opencode/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/opencode/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/opencode/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +1 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/nuxt/rules/interactive-questions.md +8 -8
- package/presets/opencode/nuxt/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/nuxt/team/README.md +10 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/php-hexagonal/rules/interactive-questions.md +8 -8
- package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/php-hexagonal/team/README.md +10 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/php-laravel/rules/interactive-questions.md +8 -8
- package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/php-laravel/team/README.md +10 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +1 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/svelte/rules/interactive-questions.md +8 -8
- package/presets/opencode/svelte/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/svelte/team/README.md +10 -0
|
@@ -3,9 +3,13 @@ description: Next.js frontend security — secrets, auth, XSS, Server Actions, e
|
|
|
3
3
|
paths:
|
|
4
4
|
- "**/*Auth*.{ts,tsx}"
|
|
5
5
|
- "**/*Session*.{ts,tsx}"
|
|
6
|
+
- "**/auth*.{ts,tsx}"
|
|
7
|
+
- "**/session*.{ts,tsx}"
|
|
6
8
|
- "**/.env*"
|
|
7
9
|
- "app/**/middleware.ts"
|
|
8
10
|
- "app/src/**/*middleware*.{ts,tsx}"
|
|
11
|
+
- "app/**/proxy.ts"
|
|
12
|
+
- "app/src/**/proxy*.{ts,tsx}"
|
|
9
13
|
- "app/src/**/*action*.{ts,tsx}"
|
|
10
14
|
impact: CRITICAL
|
|
11
15
|
---
|
|
@@ -24,8 +28,9 @@ Coding-time checklist. Full audit → agent `security-reviewer` + skill `code-re
|
|
|
24
28
|
|
|
25
29
|
## Auth and session
|
|
26
30
|
|
|
27
|
-
- Enforce auth on the **server**
|
|
28
|
-
-
|
|
31
|
+
- Enforce auth on the **server** — in the page, Server Action, route handler, or data-access function that reads the data. That server check is the boundary.
|
|
32
|
+
- Token refresh may live in `middleware` or `proxy` (Next 16 renamed the `middleware` convention to `proxy`); neither is an authorisation boundary on its own.
|
|
33
|
+
- A layout-only check is not a reliable boundary: layouts do not guard route handlers or actions on their own — verify in the page, action, or data-access function.
|
|
29
34
|
- Prefer httpOnly secure cookies over `localStorage` for tokens when the repo pattern allows.
|
|
30
35
|
- Never trust client-only session claims without a server verify step used by the project.
|
|
31
36
|
- **Static-export / SPA repos:** there is no server session verify — use the repo's client route guard plus BFF-issued httpOnly cookies; do not invent a server verifier.
|
|
@@ -53,7 +58,7 @@ Coding-time checklist. Full audit → agent `security-reviewer` + skill `code-re
|
|
|
53
58
|
|---------|----------|
|
|
54
59
|
| Invented auth helpers not in `package.json` / codebase | Copy patterns from existing auth routes |
|
|
55
60
|
| Putting secrets in `NEXT_PUBLIC_*` | Server-only env + server modules |
|
|
56
|
-
| Auth only in middleware | Server `getUser` / session verify in
|
|
61
|
+
| Auth only in `middleware` / `proxy` | Server `getUser` / session verify in the page, action, or data-access function |
|
|
57
62
|
| Server session verifier / Server Action in a static-export repo | Client route guard + BFF-issued httpOnly cookie |
|
|
58
63
|
|
|
59
64
|
## Compliance / personal data (regulated apps)
|
|
@@ -80,3 +85,23 @@ const key = process.env.SECRET_KEY
|
|
|
80
85
|
// Secret stays on the BFF. The client reads only NEXT_PUBLIC_* through the repo config module.
|
|
81
86
|
const apiUrl = publicConfig.apiUrl
|
|
82
87
|
```
|
|
88
|
+
|
|
89
|
+
## Incorrect
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
// proxy.ts — treated as the only auth check
|
|
93
|
+
export function proxy(request: NextRequest) {
|
|
94
|
+
if (!request.cookies.has('session')) return NextResponse.redirect(new URL('/login', request.url))
|
|
95
|
+
return NextResponse.next()
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Correct
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
// app/orders/page.tsx — the server check that reads the data is the boundary
|
|
103
|
+
export default async function OrdersPage() {
|
|
104
|
+
const user = await requireUser()
|
|
105
|
+
return <OrdersTable orders={await ordersFor(user.id)} />
|
|
106
|
+
}
|
|
107
|
+
```
|
|
@@ -10,7 +10,7 @@ paths:
|
|
|
10
10
|
|
|
11
11
|
# CSS property order (as in Stylelint)
|
|
12
12
|
|
|
13
|
-
For CSS in `.css`, `styles.ts(x)`, `styled` / Linaria — property order matches **`app/.stylelintrc`**
|
|
13
|
+
For CSS in `.css`, `styles.ts(x)`, `styled` / Linaria — property order matches the repo's Stylelint config (this preset's stack: **`app/.stylelintrc`** with `@sh/stylelint-config-react` → `stylelint-config-idiomatic-order`).
|
|
14
14
|
|
|
15
15
|
Do not duplicate the property list by hand. Auto-fix from `app/`: **`yarn lint:css --fix`** (or the repo package manager). Full gate — **`tooling-and-review/post-change-lint.md`**.
|
|
16
16
|
|
|
@@ -21,25 +21,25 @@ The **binding baseline** is the frozen contract `.ai.local/team/tasks/<slug>/fig
|
|
|
21
21
|
## Typography
|
|
22
22
|
|
|
23
23
|
- Bind to the Figma **text style** used by the node — extract via Figma MCP `get_design_context` / `get_variable_defs` and the node metadata. Do not invent `font-size: 14px; line-height: 20px;` when a Figma text style exists.
|
|
24
|
-
- Repo mapping: font family, size, line-height, weight, letter-spacing → `@sds/tokens-typography
|
|
24
|
+
- Repo mapping when the repo ships this stack's DS: font family, size, line-height, weight, letter-spacing → `@sds/tokens-typography`; otherwise the project token module. In Linaria / styled: `font: var(--font-body-m, …)` / equivalent token.
|
|
25
25
|
- Prefer a typography variant / DS text component that already binds the token (e.g. `Text variant="body-m"`) over a styled wrapper with raw values.
|
|
26
26
|
|
|
27
27
|
## Color
|
|
28
28
|
|
|
29
29
|
- Bind to the Figma **fill / stroke variable** (`get_variable_defs`). Do not write raw `#…` or `rgb(…)`.
|
|
30
|
-
- Repo mapping: `@sds/tokens-colors`, `@sds/brand-colors`,
|
|
30
|
+
- Repo mapping when present: `@sds/tokens-colors`, `@sds/brand-colors`, else the project token module (`color: var(--text-primary, …)`).
|
|
31
31
|
- A raw value is allowed only with an inline `// token-pending: <Figma-variable-name>` comment and a follow-up to bind it. The reviewer treats unbound raw values as a finding.
|
|
32
32
|
|
|
33
33
|
## Spacing / radius / shadow
|
|
34
34
|
|
|
35
35
|
- Bind to Figma **spacing / radius / effect variables** or the repo spacing scale. Do not write raw `padding: 16px; gap: 12px;` if a token exists.
|
|
36
|
-
- Repo mapping: spacing tokens from `@sds/tokens
|
|
36
|
+
- Repo mapping when present: spacing tokens from `@sds/tokens`, else the project scale; Linaria `css\`…\`` uses `var(--space-…, …)`.
|
|
37
37
|
- **Auto-layout intent:** respect Figma auto-layout (direction, gap, padding, alignment). Switching to absolute positioning for a region that is the only responsive evidence is a finding. `display: flex` with the same gap/padding is the safe mirror; do not reflow to a different layout without a reason in the brief.
|
|
38
38
|
|
|
39
39
|
## Imagery & icons
|
|
40
40
|
|
|
41
41
|
- **Images:** use the Figma asset source from `get_design_context` / the node’s image fill. Repo: **the project’s image primitive** — check the nearest component in the same layer (often a plain `<img>` or a DS image component; `next/image` only where the config keeps the optimizer enabled). Derive `src`, `width`, `height` from Figma. Do not use a placeholder, do not invent a URL, do not change aspect ratio.
|
|
42
|
-
- **Icons:** use the `@sds/icon` (or
|
|
42
|
+
- **Icons:** use the `@sds/icon` (or the repo DS, e.g. `@sds/*`) symbol name from the Figma component instance / metadata. Do not invent icon names. The Figma node’s component name (e.g. `Icon / chevron-right`) maps to the DS symbol.
|
|
43
43
|
- `alt` text from the Figma node name when meaningful; otherwise from the design context copy.
|
|
44
44
|
|
|
45
45
|
## Font, effect, and asset availability
|
|
@@ -26,8 +26,8 @@ Use the form solution already in the repo (`package.json` + the nearest form com
|
|
|
26
26
|
|
|
27
27
|
## Stack notes
|
|
28
28
|
|
|
29
|
-
-
|
|
30
|
-
- DS fields
|
|
29
|
+
- When the repo ships this preset's stack: form library `react-hook-form` + `yup` resolver; `mode: 'onTouched'`; use the repo equivalents otherwise.
|
|
30
|
+
- DS fields `app/src/ui/components/_form/**`; shared validators `app/src/lib/utils/validations/**`; masks `imask` / `react-imask` — the repo's own paths and mask library when its stack differs.
|
|
31
31
|
|
|
32
32
|
## Related
|
|
33
33
|
|
|
@@ -32,6 +32,17 @@ Bootstrap a slug by **writing** `pipeline.json` (editor Write tool). Do not `mkd
|
|
|
32
32
|
"slug": "order-history-date-filter",
|
|
33
33
|
"intent": "feature",
|
|
34
34
|
"specMode": "consume",
|
|
35
|
+
"profile": "standard",
|
|
36
|
+
"routingDecision": {
|
|
37
|
+
"complexity": "moderate",
|
|
38
|
+
"riskFlags": ["cross-layer"],
|
|
39
|
+
"routingReasons": [
|
|
40
|
+
"The filter spans UI state and the API service, so implementation and validation stay separate steps.",
|
|
41
|
+
"One human gate after decomposition; no architecture or security specialist is required."
|
|
42
|
+
],
|
|
43
|
+
"estimatedWorkPackages": 1,
|
|
44
|
+
"openDecisionCount": 0
|
|
45
|
+
},
|
|
35
46
|
"summary": "Add date filter to Order History",
|
|
36
47
|
"steps": [
|
|
37
48
|
{ "agent": "task-analyst", "label": "Clarify and decompose" },
|
|
@@ -91,6 +102,16 @@ printf '%s\n' '{"status":"completed","action":"end_human_gate","activateNext":tr
|
|
|
91
102
|
|
|
92
103
|
Same JSON on Claude, Mavis, or OpenCode: `bash .<tool>/hooks/chain-team-phases.sh`.
|
|
93
104
|
|
|
105
|
+
## Database projection
|
|
106
|
+
|
|
107
|
+
`team-db.mjs` projects this tree into `.ai.local/team/team.db` (SQLite, WAL). The files remain authoritative: the database is rebuildable and git-ignored (`team.db`, `team.db-wal`, `team.db-shm`, `team-db-errors.log`).
|
|
108
|
+
|
|
109
|
+
- Write points: the chain hook after its file writes, and `manifest.mjs` after a receipt. Both run one bounded 5 s child; a failure logs one line and never fails the file write.
|
|
110
|
+
- No agent writes lifecycle fields through the database. `status.json` / `metrics.json` stay hook-owned.
|
|
111
|
+
- `AI_RULES_TEAM_DB_DISABLE=1` stops every write point and `serve`; a runtime without `node:sqlite` stays file-only with exit 0.
|
|
112
|
+
- Inspect: `node .ai.local/scripts/team-db.mjs sync`, then `check`; `serve` opens the read-only dashboard at `http://127.0.0.1:4178`.
|
|
113
|
+
- Never commit the database. Delete `team.db*` and run `sync` to rebuild.
|
|
114
|
+
|
|
94
115
|
## Contracts
|
|
95
116
|
|
|
96
117
|
- **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
"slug": "example-feature-with-figma",
|
|
3
3
|
"intent": "feature",
|
|
4
4
|
"profile": "full",
|
|
5
|
+
"routingDecision": {
|
|
6
|
+
"complexity": "high",
|
|
7
|
+
"riskFlags": ["cross-layer", "broad-test-surface"],
|
|
8
|
+
"routingReasons": [
|
|
9
|
+
"The Figma mockup adds a UI surface whose tokens and states must match a frozen contract, so `mockup-reviewer` runs before the architect.",
|
|
10
|
+
"The flow spans UI and data boundaries, so the full profile keeps architecture, implementation, validation, and review as separate checkpoints."
|
|
11
|
+
],
|
|
12
|
+
"estimatedWorkPackages": 2,
|
|
13
|
+
"openDecisionCount": 1
|
|
14
|
+
},
|
|
5
15
|
"summary": "Feature with Figma mockup URL — mockup-reviewer after analyst, before architect and developer",
|
|
6
16
|
"steps": [
|
|
7
17
|
{ "agent": "task-analyst", "label": "Clarify and decompose" },
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
"slug": "example-feature-with-ux-no-figma",
|
|
3
3
|
"intent": "feature",
|
|
4
4
|
"profile": "standard",
|
|
5
|
+
"routingDecision": {
|
|
6
|
+
"complexity": "moderate",
|
|
7
|
+
"riskFlags": ["cross-layer"],
|
|
8
|
+
"routingReasons": [
|
|
9
|
+
"Required-signal UX adds a behavioral design pass before decomposition even without a Figma URL.",
|
|
10
|
+
"UI scope forces `mockup-reviewer` against the AC and `ux-design.md`; validation and review stay separate."
|
|
11
|
+
],
|
|
12
|
+
"estimatedWorkPackages": 2,
|
|
13
|
+
"openDecisionCount": 1
|
|
14
|
+
},
|
|
5
15
|
"summary": "UI-scope feature with required-signal UX and no Figma URL — task-analyst loads skill ux-design; UI scope forces mockup-reviewer (reviewed against AC / ux-design.md)",
|
|
6
16
|
"steps": [
|
|
7
17
|
{ "agent": "task-analyst", "label": "Clarify, UX design, decompose" },
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
"slug": "example-mockup-review-standalone",
|
|
3
3
|
"intent": "mockup-review",
|
|
4
4
|
"profile": "light",
|
|
5
|
+
"routingDecision": {
|
|
6
|
+
"complexity": "low",
|
|
7
|
+
"riskFlags": [],
|
|
8
|
+
"routingReasons": [
|
|
9
|
+
"Report-only review of one frozen Figma surface: no production code changes, so a single specialist step is enough."
|
|
10
|
+
],
|
|
11
|
+
"estimatedWorkPackages": 1,
|
|
12
|
+
"openDecisionCount": 0
|
|
13
|
+
},
|
|
5
14
|
"summary": "Standalone Figma mockup review (report-only)",
|
|
6
15
|
"steps": [
|
|
7
16
|
{ "agent": "mockup-reviewer", "label": "Figma mockup review", "model": "strong" }
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
"slug": "example-ux-design-standalone",
|
|
3
3
|
"intent": "ux-design",
|
|
4
4
|
"profile": "light",
|
|
5
|
+
"routingDecision": {
|
|
6
|
+
"complexity": "low",
|
|
7
|
+
"riskFlags": [],
|
|
8
|
+
"routingReasons": [
|
|
9
|
+
"Behavioral UX synthesis with no Figma URL and no implementation step; the analyst owns the report."
|
|
10
|
+
],
|
|
11
|
+
"estimatedWorkPackages": 1,
|
|
12
|
+
"openDecisionCount": 0
|
|
13
|
+
},
|
|
5
14
|
"summary": "Standalone behavioral UX design (analyst + skill ux-design; report-only; no developer)",
|
|
6
15
|
"steps": [
|
|
7
16
|
{ "agent": "task-analyst", "label": "UX design (skill ux-design)" }
|
|
@@ -81,6 +81,7 @@ Findings carry `path:line`, severity, `confidence`, and a fix direction — rule
|
|
|
81
81
|
## Depth passes
|
|
82
82
|
| Pass | Outcome | Evidence or reason |
|
|
83
83
|
|------|---------|--------------------|
|
|
84
|
+
| Call-site sweep | `no finding` | what was searched or read |
|
|
84
85
|
|
|
85
86
|
## AC coverage
|
|
86
87
|
| Criterion | Status | Notes |
|
|
@@ -2616,6 +2616,115 @@ if (!input || input.status !== 'completed') {
|
|
|
2616
2616
|
process.exit(0);
|
|
2617
2617
|
}
|
|
2618
2618
|
|
|
2619
|
+
// --- TEAM_DB_PROJECTION -------------------------------------------------------
|
|
2620
|
+
// The status, metrics, compaction and focus writes are already durable when this
|
|
2621
|
+
// postflight starts. The projection is a bounded child process: it must never
|
|
2622
|
+
// fail this stop, never change hook stdout/stderr beyond the capability line,
|
|
2623
|
+
// and never write a task file. A disabled switch, a missing script, or a
|
|
2624
|
+
// runtime without `node:sqlite` is a skip; a child failure is one log line.
|
|
2625
|
+
// This is a plain region marker, not a `hook-slot`: the block is identical in
|
|
2626
|
+
// all 40 rendered bodies and needs no per-stack fragment.
|
|
2627
|
+
// <<<team-db-projection>>>
|
|
2628
|
+
function teamDbTruthy(value) {
|
|
2629
|
+
if (typeof value !== 'string') return false;
|
|
2630
|
+
const normalized = value.trim().toLowerCase();
|
|
2631
|
+
return normalized === '1' || normalized === 'true' || normalized === 'yes';
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
function teamDbLogPath(env) {
|
|
2635
|
+
const override = typeof env.AI_RULES_TEAM_DB_LOG === 'string' ? env.AI_RULES_TEAM_DB_LOG.trim() : '';
|
|
2636
|
+
if (override) return path.resolve(override);
|
|
2637
|
+
return path.join(process.cwd(), '.ai.local', 'team', 'team-db-errors.log');
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
function teamDbLogPhase(env) {
|
|
2641
|
+
const value = typeof env.AI_RULES_TEAM_DB_SEAM === 'string' ? env.AI_RULES_TEAM_DB_SEAM.trim() : '';
|
|
2642
|
+
return value === 'hook' || value === 'receipt' || value === 'cli' || value === 'serve' ? value : 'hook';
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
// One line per failure, newest 200 lines and at most 64 KiB. Never a prompt
|
|
2646
|
+
// body: only the code and the message this block owns.
|
|
2647
|
+
function teamDbLogFailure(env, code, message) {
|
|
2648
|
+
try {
|
|
2649
|
+
const target = teamDbLogPath(env);
|
|
2650
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
2651
|
+
const line = new Date().toISOString() + ' ' + code + ' ' + teamDbLogPhase(env) + ' ' + message;
|
|
2652
|
+
fs.appendFileSync(target, line + '\n');
|
|
2653
|
+
let content = fs.readFileSync(target, 'utf8');
|
|
2654
|
+
let lines = content.split('\n').filter(function (entry) { return entry.length > 0; });
|
|
2655
|
+
if (lines.length > 200) lines = lines.slice(lines.length - 200);
|
|
2656
|
+
while (Buffer.byteLength(lines.join('\n') + '\n', 'utf8') > 65536 && lines.length > 1) lines.shift();
|
|
2657
|
+
content = lines.join('\n') + (lines.length > 0 ? '\n' : '');
|
|
2658
|
+
fs.writeFileSync(target, content);
|
|
2659
|
+
} catch (error) {
|
|
2660
|
+
/* a log failure is not a stop failure */
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
function teamDbSqliteAvailable(env) {
|
|
2665
|
+
if (teamDbTruthy(env.AI_RULES_TEAM_DB_FORCE_FALLBACK)) return false;
|
|
2666
|
+
const match = /^(\d+)\.(\d+)\.(\d+)/.exec(String(process.versions.node || ''));
|
|
2667
|
+
if (!match) return false;
|
|
2668
|
+
const major = Number(match[1]);
|
|
2669
|
+
const minor = Number(match[2]);
|
|
2670
|
+
if (major < 22) return false;
|
|
2671
|
+
if (major === 22 && minor < 13) return false;
|
|
2672
|
+
try {
|
|
2673
|
+
const sqlite = require('node:sqlite');
|
|
2674
|
+
return typeof sqlite.DatabaseSync === 'function';
|
|
2675
|
+
} catch (error) {
|
|
2676
|
+
return false;
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
function teamDbProject() {
|
|
2681
|
+
try {
|
|
2682
|
+
const env = process.env;
|
|
2683
|
+
if (teamDbTruthy(env.AI_RULES_TEAM_DB_DISABLE)) return;
|
|
2684
|
+
// Same pattern as POSTFLIGHT_SLUG_RE above: the slug is re-derived from
|
|
2685
|
+
// `active-task.json` on this path too, so it cannot escape the tree.
|
|
2686
|
+
const slugPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
2687
|
+
let slug = '';
|
|
2688
|
+
try {
|
|
2689
|
+
const active = JSON.parse(fs.readFileSync(path.join(process.cwd(), '.ai.local', 'team', 'active-task.json'), 'utf8'));
|
|
2690
|
+
slug = typeof active.slug === 'string' ? active.slug : '';
|
|
2691
|
+
} catch (error) {
|
|
2692
|
+
return;
|
|
2693
|
+
}
|
|
2694
|
+
if (!slug || slug.length > 48 || !slugPattern.test(slug)) return;
|
|
2695
|
+
const taskDir = path.join(process.cwd(), '.ai.local', 'team', 'tasks', slug);
|
|
2696
|
+
if (!fs.existsSync(path.join(taskDir, 'status.json'))) return;
|
|
2697
|
+
const script = path.join(process.cwd(), '.ai.local', 'scripts', 'team-db.mjs');
|
|
2698
|
+
if (!fs.existsSync(script)) return;
|
|
2699
|
+
if (!teamDbSqliteAvailable(env)) {
|
|
2700
|
+
process.stderr.write('team-db: projection skipped (node:sqlite unavailable); file-only mode\n');
|
|
2701
|
+
return;
|
|
2702
|
+
}
|
|
2703
|
+
const result = spawnSync(
|
|
2704
|
+
process.execPath,
|
|
2705
|
+
['.ai.local/scripts/team-db.mjs', 'sync', '--slug', slug, '--quiet', '--no-rebuild', '--deadline-ms', '4500'],
|
|
2706
|
+
{ cwd: process.cwd(), env: env, encoding: 'utf8', timeout: 5000, killSignal: 'SIGKILL', stdio: ['ignore', 'pipe', 'pipe'] },
|
|
2707
|
+
);
|
|
2708
|
+
if (result.error && result.error.code === 'ETIMEDOUT') {
|
|
2709
|
+
teamDbLogFailure(env, 'E_PROJECTION_TIMEOUT', 'projection exceeded 5000 ms and was killed');
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2712
|
+
if (result.error) {
|
|
2713
|
+
teamDbLogFailure(env, 'E_PROJECTION_FAILED', 'projection could not start: ' + String(result.error.code || 'unknown'));
|
|
2714
|
+
return;
|
|
2715
|
+
}
|
|
2716
|
+
if (typeof result.status === 'number' && result.status !== 0) {
|
|
2717
|
+
teamDbLogFailure(env, 'E_PROJECTION_FAILED', 'projection exited ' + result.status);
|
|
2718
|
+
}
|
|
2719
|
+
} catch (error) {
|
|
2720
|
+
/* the seam never fails the stop */
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
teamDbProject();
|
|
2725
|
+
// <<<team-db-projection-end>>>
|
|
2726
|
+
// --- end TEAM_DB_PROJECTION ---------------------------------------------------
|
|
2727
|
+
|
|
2619
2728
|
// Ratchet: off for `light` pipelines and `spike` intents. A policy skip is
|
|
2620
2729
|
// silent on purpose — a warning on every light receipt would make the
|
|
2621
2730
|
// containment warnings below unreadable.
|
|
@@ -45,7 +45,7 @@ The module is **not ready** until the checklist passes.
|
|
|
45
45
|
|
|
46
46
|
## How to find regulated layers in the repository
|
|
47
47
|
|
|
48
|
-
1. `architecture/public-imports.md` rules in `.
|
|
48
|
+
1. `architecture/public-imports.md` rules in `.claude/rules/`.
|
|
49
49
|
2. ESLint `no-restricted-imports` — `@/<layer>/*` patterns with barrel exception.
|
|
50
50
|
3. `architecture/architecture-boundaries.md`, project README.
|
|
51
51
|
|
|
@@ -7,7 +7,7 @@ paths: []
|
|
|
7
7
|
|
|
8
8
|
# Interactive questions (requestable)
|
|
9
9
|
|
|
10
|
-
How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool
|
|
10
|
+
How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool. The always-on quality rule keeps the short preference; this file carries the full contract.
|
|
11
11
|
|
|
12
12
|
## When to ask
|
|
13
13
|
|
|
@@ -17,16 +17,16 @@ How to put a user-only decision to the user. Load when the answer blocks the wor
|
|
|
17
17
|
|
|
18
18
|
## Widget format
|
|
19
19
|
|
|
20
|
-
4. **Header** → a short label
|
|
21
|
-
5. **Option label** →
|
|
20
|
+
4. **Header** → a short label. Stay inside the host schema's length limit.
|
|
21
|
+
5. **Option label** → a few words, in the user's terms, inside the host schema's label limit.
|
|
22
22
|
6. **Option description** → the consequence or the trade-off, not a restatement of the label.
|
|
23
|
-
7. **
|
|
24
|
-
8. **Multi-select** only when the choices are not mutually exclusive.
|
|
23
|
+
7. **Option count** → the host schema's range. Put the option you recommend first and justify it in its description; do not pad the list with options you cannot defend.
|
|
24
|
+
8. **Multi-select** only when the choices are not mutually exclusive. A free-form entry the host adds itself does not count toward the range.
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## Free-form is a property of the host
|
|
27
27
|
|
|
28
|
-
9.
|
|
29
|
-
10. A host
|
|
28
|
+
9. Use the host's free-form channel. When that channel already accepts typed text, do not add an option labeled "Other": a plain option returns its label, and the typed text belongs in the host's free-form field.
|
|
29
|
+
10. A host with no free-form channel (an enum that returns only the selected label, a headless run) needs an explicit "Other" whose selection opens a text prompt — or prose when the answer cannot be enumerated.
|
|
30
30
|
|
|
31
31
|
## Fallback
|
|
32
32
|
|
|
@@ -11,7 +11,7 @@ paths: []
|
|
|
11
11
|
|
|
12
12
|
After **any** source change under `pages/**`, `components/**`, `composables/**`, `stores/**`, `api/**`, `lib/**`, `server/**`, `types/**`, `layouts/**`, `middleware/**` (Vue/TS/JS, CSS, scoped/CSS modules).
|
|
13
13
|
|
|
14
|
-
Exceptions: docs, CI configs, `.
|
|
14
|
+
Exceptions: docs, CI configs, `.claude/rules/**`, when application executable code did not change.
|
|
15
15
|
|
|
16
16
|
**Pipeline exception:** if the task goes through the agent team and the next step is `build-verifier`, the developer may limit lint/typecheck to **changed files**; the full run is `build-verifier`’s duty. In single-agent mode (no pipeline) — always a full run.
|
|
17
17
|
|
|
@@ -35,7 +35,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
35
35
|
- [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
|
|
36
36
|
- [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
|
|
37
37
|
- [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
|
|
38
|
-
- [ ] **Rule eval (
|
|
38
|
+
- [ ] **Rule eval (hard):** `node packages/ai-rules/scripts/check-rule-eval.mjs` runs inside `yarn check:preset-structure`; keep every registered golden stem paired
|
|
39
39
|
- [ ] **Anti-hallucination:** `check-anti-hallucination-coverage.mjs` is green inside `yarn check:preset-structure`. Every role loads `anti-hallucination-contract`. Writer roles, including `code-reviewer`, also load `STACK_FLOOR_STEMS`. Register a new skill family in `SKILL_CONTRACT_CLASS` (`writer` or `reader`) or the gate FAILs.
|
|
40
40
|
- [ ] **Gate:** `yarn check:preset-structure` from `packages/ai-rules/` (twin-map, token-budget, leakage, drift, i18n, local overlay, anti-hallucination coverage)
|
|
41
41
|
|
|
@@ -90,6 +90,16 @@ printf '%s\n' '{"status":"completed","action":"end_human_gate","activateNext":tr
|
|
|
90
90
|
|
|
91
91
|
Same JSON on Claude, Mavis, or OpenCode: `bash .<tool>/hooks/chain-team-phases.sh`.
|
|
92
92
|
|
|
93
|
+
## Database projection
|
|
94
|
+
|
|
95
|
+
`team-db.mjs` projects this tree into `.ai.local/team/team.db` (SQLite, WAL). The files remain authoritative: the database is rebuildable and git-ignored (`team.db`, `team.db-wal`, `team.db-shm`, `team-db-errors.log`).
|
|
96
|
+
|
|
97
|
+
- Write points: the chain hook after its file writes, and `manifest.mjs` after a receipt. Both run one bounded 5 s child; a failure logs one line and never fails the file write.
|
|
98
|
+
- No agent writes lifecycle fields through the database. `status.json` / `metrics.json` stay hook-owned.
|
|
99
|
+
- `AI_RULES_TEAM_DB_DISABLE=1` stops every write point and `serve`; a runtime without `node:sqlite` stays file-only with exit 0.
|
|
100
|
+
- Inspect: `node .ai.local/scripts/team-db.mjs sync`, then `check`; `serve` opens the read-only dashboard at `http://127.0.0.1:4178`.
|
|
101
|
+
- Never commit the database. Delete `team.db*` and run `sync` to rebuild.
|
|
102
|
+
|
|
93
103
|
## Contracts
|
|
94
104
|
|
|
95
105
|
- **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
|
|
@@ -90,6 +90,7 @@ Findings carry `path:line`, severity, `confidence`, and a fix direction — rule
|
|
|
90
90
|
## Depth passes
|
|
91
91
|
| Pass | Outcome | Evidence or reason |
|
|
92
92
|
|------|---------|--------------------|
|
|
93
|
+
| Call-site sweep | `no finding` | what was searched or read |
|
|
93
94
|
|
|
94
95
|
## AC coverage
|
|
95
96
|
| Criterion | Status | Notes |
|
|
@@ -2614,6 +2614,115 @@ if (!input || input.status !== 'completed') {
|
|
|
2614
2614
|
process.exit(0);
|
|
2615
2615
|
}
|
|
2616
2616
|
|
|
2617
|
+
// --- TEAM_DB_PROJECTION -------------------------------------------------------
|
|
2618
|
+
// The status, metrics, compaction and focus writes are already durable when this
|
|
2619
|
+
// postflight starts. The projection is a bounded child process: it must never
|
|
2620
|
+
// fail this stop, never change hook stdout/stderr beyond the capability line,
|
|
2621
|
+
// and never write a task file. A disabled switch, a missing script, or a
|
|
2622
|
+
// runtime without `node:sqlite` is a skip; a child failure is one log line.
|
|
2623
|
+
// This is a plain region marker, not a `hook-slot`: the block is identical in
|
|
2624
|
+
// all 40 rendered bodies and needs no per-stack fragment.
|
|
2625
|
+
// <<<team-db-projection>>>
|
|
2626
|
+
function teamDbTruthy(value) {
|
|
2627
|
+
if (typeof value !== 'string') return false;
|
|
2628
|
+
const normalized = value.trim().toLowerCase();
|
|
2629
|
+
return normalized === '1' || normalized === 'true' || normalized === 'yes';
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
function teamDbLogPath(env) {
|
|
2633
|
+
const override = typeof env.AI_RULES_TEAM_DB_LOG === 'string' ? env.AI_RULES_TEAM_DB_LOG.trim() : '';
|
|
2634
|
+
if (override) return path.resolve(override);
|
|
2635
|
+
return path.join(process.cwd(), '.ai.local', 'team', 'team-db-errors.log');
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
function teamDbLogPhase(env) {
|
|
2639
|
+
const value = typeof env.AI_RULES_TEAM_DB_SEAM === 'string' ? env.AI_RULES_TEAM_DB_SEAM.trim() : '';
|
|
2640
|
+
return value === 'hook' || value === 'receipt' || value === 'cli' || value === 'serve' ? value : 'hook';
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
// One line per failure, newest 200 lines and at most 64 KiB. Never a prompt
|
|
2644
|
+
// body: only the code and the message this block owns.
|
|
2645
|
+
function teamDbLogFailure(env, code, message) {
|
|
2646
|
+
try {
|
|
2647
|
+
const target = teamDbLogPath(env);
|
|
2648
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
2649
|
+
const line = new Date().toISOString() + ' ' + code + ' ' + teamDbLogPhase(env) + ' ' + message;
|
|
2650
|
+
fs.appendFileSync(target, line + '\n');
|
|
2651
|
+
let content = fs.readFileSync(target, 'utf8');
|
|
2652
|
+
let lines = content.split('\n').filter(function (entry) { return entry.length > 0; });
|
|
2653
|
+
if (lines.length > 200) lines = lines.slice(lines.length - 200);
|
|
2654
|
+
while (Buffer.byteLength(lines.join('\n') + '\n', 'utf8') > 65536 && lines.length > 1) lines.shift();
|
|
2655
|
+
content = lines.join('\n') + (lines.length > 0 ? '\n' : '');
|
|
2656
|
+
fs.writeFileSync(target, content);
|
|
2657
|
+
} catch (error) {
|
|
2658
|
+
/* a log failure is not a stop failure */
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
function teamDbSqliteAvailable(env) {
|
|
2663
|
+
if (teamDbTruthy(env.AI_RULES_TEAM_DB_FORCE_FALLBACK)) return false;
|
|
2664
|
+
const match = /^(\d+)\.(\d+)\.(\d+)/.exec(String(process.versions.node || ''));
|
|
2665
|
+
if (!match) return false;
|
|
2666
|
+
const major = Number(match[1]);
|
|
2667
|
+
const minor = Number(match[2]);
|
|
2668
|
+
if (major < 22) return false;
|
|
2669
|
+
if (major === 22 && minor < 13) return false;
|
|
2670
|
+
try {
|
|
2671
|
+
const sqlite = require('node:sqlite');
|
|
2672
|
+
return typeof sqlite.DatabaseSync === 'function';
|
|
2673
|
+
} catch (error) {
|
|
2674
|
+
return false;
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
|
|
2678
|
+
function teamDbProject() {
|
|
2679
|
+
try {
|
|
2680
|
+
const env = process.env;
|
|
2681
|
+
if (teamDbTruthy(env.AI_RULES_TEAM_DB_DISABLE)) return;
|
|
2682
|
+
// Same pattern as POSTFLIGHT_SLUG_RE above: the slug is re-derived from
|
|
2683
|
+
// `active-task.json` on this path too, so it cannot escape the tree.
|
|
2684
|
+
const slugPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
2685
|
+
let slug = '';
|
|
2686
|
+
try {
|
|
2687
|
+
const active = JSON.parse(fs.readFileSync(path.join(process.cwd(), '.ai.local', 'team', 'active-task.json'), 'utf8'));
|
|
2688
|
+
slug = typeof active.slug === 'string' ? active.slug : '';
|
|
2689
|
+
} catch (error) {
|
|
2690
|
+
return;
|
|
2691
|
+
}
|
|
2692
|
+
if (!slug || slug.length > 48 || !slugPattern.test(slug)) return;
|
|
2693
|
+
const taskDir = path.join(process.cwd(), '.ai.local', 'team', 'tasks', slug);
|
|
2694
|
+
if (!fs.existsSync(path.join(taskDir, 'status.json'))) return;
|
|
2695
|
+
const script = path.join(process.cwd(), '.ai.local', 'scripts', 'team-db.mjs');
|
|
2696
|
+
if (!fs.existsSync(script)) return;
|
|
2697
|
+
if (!teamDbSqliteAvailable(env)) {
|
|
2698
|
+
process.stderr.write('team-db: projection skipped (node:sqlite unavailable); file-only mode\n');
|
|
2699
|
+
return;
|
|
2700
|
+
}
|
|
2701
|
+
const result = spawnSync(
|
|
2702
|
+
process.execPath,
|
|
2703
|
+
['.ai.local/scripts/team-db.mjs', 'sync', '--slug', slug, '--quiet', '--no-rebuild', '--deadline-ms', '4500'],
|
|
2704
|
+
{ cwd: process.cwd(), env: env, encoding: 'utf8', timeout: 5000, killSignal: 'SIGKILL', stdio: ['ignore', 'pipe', 'pipe'] },
|
|
2705
|
+
);
|
|
2706
|
+
if (result.error && result.error.code === 'ETIMEDOUT') {
|
|
2707
|
+
teamDbLogFailure(env, 'E_PROJECTION_TIMEOUT', 'projection exceeded 5000 ms and was killed');
|
|
2708
|
+
return;
|
|
2709
|
+
}
|
|
2710
|
+
if (result.error) {
|
|
2711
|
+
teamDbLogFailure(env, 'E_PROJECTION_FAILED', 'projection could not start: ' + String(result.error.code || 'unknown'));
|
|
2712
|
+
return;
|
|
2713
|
+
}
|
|
2714
|
+
if (typeof result.status === 'number' && result.status !== 0) {
|
|
2715
|
+
teamDbLogFailure(env, 'E_PROJECTION_FAILED', 'projection exited ' + result.status);
|
|
2716
|
+
}
|
|
2717
|
+
} catch (error) {
|
|
2718
|
+
/* the seam never fails the stop */
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
teamDbProject();
|
|
2723
|
+
// <<<team-db-projection-end>>>
|
|
2724
|
+
// --- end TEAM_DB_PROJECTION ---------------------------------------------------
|
|
2725
|
+
|
|
2617
2726
|
// Ratchet: off for `light` pipelines and `spike` intents. A policy skip is
|
|
2618
2727
|
// silent on purpose — a warning on every light receipt would make the
|
|
2619
2728
|
// containment warnings below unreadable.
|
|
@@ -7,7 +7,7 @@ paths: []
|
|
|
7
7
|
|
|
8
8
|
# Interactive questions (requestable)
|
|
9
9
|
|
|
10
|
-
How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool
|
|
10
|
+
How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool. The always-on quality rule keeps the short preference; this file carries the full contract.
|
|
11
11
|
|
|
12
12
|
## When to ask
|
|
13
13
|
|
|
@@ -17,16 +17,16 @@ How to put a user-only decision to the user. Load when the answer blocks the wor
|
|
|
17
17
|
|
|
18
18
|
## Widget format
|
|
19
19
|
|
|
20
|
-
4. **Header** → a short label
|
|
21
|
-
5. **Option label** →
|
|
20
|
+
4. **Header** → a short label. Stay inside the host schema's length limit.
|
|
21
|
+
5. **Option label** → a few words, in the user's terms, inside the host schema's label limit.
|
|
22
22
|
6. **Option description** → the consequence or the trade-off, not a restatement of the label.
|
|
23
|
-
7. **
|
|
24
|
-
8. **Multi-select** only when the choices are not mutually exclusive.
|
|
23
|
+
7. **Option count** → the host schema's range. Put the option you recommend first and justify it in its description; do not pad the list with options you cannot defend.
|
|
24
|
+
8. **Multi-select** only when the choices are not mutually exclusive. A free-form entry the host adds itself does not count toward the range.
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## Free-form is a property of the host
|
|
27
27
|
|
|
28
|
-
9.
|
|
29
|
-
10. A host
|
|
28
|
+
9. Use the host's free-form channel. When that channel already accepts typed text, do not add an option labeled "Other": a plain option returns its label, and the typed text belongs in the host's free-form field.
|
|
29
|
+
10. A host with no free-form channel (an enum that returns only the selected label, a headless run) needs an explicit "Other" whose selection opens a text prompt — or prose when the answer cannot be enumerated.
|
|
30
30
|
|
|
31
31
|
## Fallback
|
|
32
32
|
|
|
@@ -35,7 +35,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
|
|
|
35
35
|
- [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
|
|
36
36
|
- [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
|
|
37
37
|
- [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
|
|
38
|
-
- [ ] **Rule eval (
|
|
38
|
+
- [ ] **Rule eval (hard):** `node packages/ai-rules/scripts/check-rule-eval.mjs` runs inside `yarn check:preset-structure`; keep every registered golden stem paired
|
|
39
39
|
- [ ] **Anti-hallucination:** `check-anti-hallucination-coverage.mjs` is green inside `yarn check:preset-structure`. Every role loads `anti-hallucination-contract`. Writer roles, including `code-reviewer`, also load `STACK_FLOOR_STEMS`. Register a new skill family in `SKILL_CONTRACT_CLASS` (`writer` or `reader`) or the gate FAILs.
|
|
40
40
|
- [ ] **Gate:** `yarn check:preset-structure` from `packages/ai-rules/` (twin-map, token-budget, leakage, drift, i18n, local overlay, anti-hallucination coverage)
|
|
41
41
|
|