@bonesofspring/ai-rules 0.2.63 → 0.2.65
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 +96 -1
- package/README.md +11 -4
- package/bin/cli.js +7 -5
- package/bin/lib/ai-local-drift.js +7 -6
- package/bin/lib/engine-scripts.js +17 -4
- package/bin/lib/engine-upgrade.js +10 -2
- package/bin/lib/manifest-schema.js +12 -0
- package/bin/lib/seed-ai-local-team.js +20 -0
- package/bin/mavis-install.js +4 -3
- package/bin/opencode-install.js +22 -6
- package/bin/zcode-install.js +4 -3
- package/docs/MCP-CATALOG.md +1 -1
- package/docs/OPENCODE-COMPATIBILITY.md +3 -2
- package/docs/OPENCODE.md +22 -2
- package/docs/PRESET-CONTRIBUTION.md +43 -2
- package/docs/TEAM-DB.md +213 -5
- package/docs/openapi/team-db.v1.json +5928 -3045
- package/mcp/defectdojo-mcp.mjs +44 -12
- package/mcp/lib/defectdojo.mjs +57 -2
- package/package.json +27 -15
- package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +279 -0
- package/presets/_shared/ai-local/scripts/process-lease.mjs +576 -0
- package/presets/_shared/ai-local/scripts/processes.mjs +1618 -0
- package/presets/_shared/ai-local/scripts/run.mjs +5 -5
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +784 -7
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +235 -10
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +813 -7
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +397 -4
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +86 -10
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +221 -0
- package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +567 -0
- package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +2069 -0
- package/presets/_shared/ai-local/scripts/team-db-ui.mjs +750 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +151 -7
- package/presets/_shared/ai-local/scripts/upstream-research.mjs +3 -0
- package/presets/_shared/core/agent-team/agent-task-metrics.md +7 -2
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +2 -1
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +314 -1
- package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +40 -2
- package/presets/_shared/hooks/run-hook.mjs +2 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/android-kotlin/hooks/run-hook.mjs +2 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/android-kotlin/settings.json +6 -1
- package/presets/claude/go/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/go/hooks/run-hook.mjs +2 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/go/settings.json +6 -1
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/ios-swift/hooks/run-hook.mjs +2 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/ios-swift/settings.json +6 -1
- package/presets/claude/java/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/java/hooks/run-hook.mjs +2 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/java/settings.json +6 -1
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mcp-ts/hooks/run-hook.mjs +2 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/mcp-ts/settings.json +6 -1
- package/presets/claude/mol/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mol/hooks/run-hook.mjs +2 -1
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/mol/settings.json +6 -1
- package/presets/claude/next/MCP.md +2 -0
- package/presets/claude/next/REPO_AGENTS.md +2 -0
- package/presets/claude/next/agents/build-verifier.md +1 -1
- package/presets/claude/next/agents/ci-investigator.md +3 -0
- package/presets/claude/next/agents/code-reviewer.md +1 -0
- package/presets/claude/next/agents/debugger.md +3 -0
- package/presets/claude/next/agents/feature-developer.md +3 -0
- package/presets/claude/next/agents/mockup-reviewer.md +4 -1
- package/presets/claude/next/agents/performance-auditor.md +2 -0
- package/presets/claude/next/agents/playwright-test-generator.md +3 -0
- package/presets/claude/next/agents/playwright-test-healer.md +3 -0
- package/presets/claude/next/agents/playwright-test-planner.md +3 -0
- package/presets/claude/next/agents/qa-tester.md +3 -0
- package/presets/claude/next/agents/task-analyst.md +2 -0
- package/presets/claude/next/commands/README.md +6 -0
- package/presets/claude/next/commands/task.md +7 -1
- package/presets/claude/next/commands/technical-retro.md +7 -1
- package/presets/claude/next/commands/ui-start.md +78 -0
- package/presets/claude/next/commands/ui-stop.md +71 -0
- package/presets/claude/next/commands/upstream-research.md +1 -1
- package/presets/claude/next/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/next/hooks/run-hook.mjs +2 -1
- package/presets/claude/next/rules/README.md +2 -1
- package/presets/claude/next/rules/stack/next-app-core.md +1 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/next/rules/tooling-and-review/dev-process-lifecycle.md +43 -0
- package/presets/claude/next/settings.json +6 -1
- package/presets/claude/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/claude/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/claude/next/team/README.md +5 -1
- package/presets/claude/next/team/upstream/jobs.json +34 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/nuxt/hooks/run-hook.mjs +2 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/nuxt/settings.json +6 -1
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-hexagonal/hooks/run-hook.mjs +2 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/php-hexagonal/settings.json +6 -1
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +315 -2
- package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-laravel/hooks/run-hook.mjs +2 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/php-laravel/settings.json +6 -1
- package/presets/claude/svelte/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/svelte/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/svelte/hooks/run-hook.mjs +2 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/svelte/settings.json +6 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/android-kotlin/hooks/run-hook.mjs +2 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/go/hooks/run-hook.mjs +2 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/ios-swift/hooks/run-hook.mjs +2 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/java/hooks/run-hook.mjs +2 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mcp-ts/hooks/run-hook.mjs +2 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mol/hooks/run-hook.mjs +2 -1
- package/presets/cursor/next/MCP.md +2 -0
- package/presets/cursor/next/REPO_AGENTS.md +2 -0
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/ci-investigator.md +2 -0
- package/presets/cursor/next/agents/code-reviewer.md +1 -0
- package/presets/cursor/next/agents/debugger.md +2 -0
- package/presets/cursor/next/agents/feature-developer.md +2 -0
- package/presets/cursor/next/agents/mockup-reviewer.md +4 -1
- package/presets/cursor/next/agents/performance-auditor.md +2 -0
- package/presets/cursor/next/agents/playwright-test-generator.md +2 -0
- package/presets/cursor/next/agents/playwright-test-healer.md +2 -0
- package/presets/cursor/next/agents/playwright-test-planner.md +2 -0
- package/presets/cursor/next/agents/qa-tester.md +2 -0
- package/presets/cursor/next/agents/task-analyst.md +2 -0
- package/presets/cursor/next/ai-local/rules-library/storybook-dev-compare-figma.md +2 -1
- package/presets/cursor/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/cursor/next/commands/README.md +6 -0
- package/presets/cursor/next/commands/task.md +7 -1
- package/presets/cursor/next/commands/technical-retro.md +7 -1
- package/presets/cursor/next/commands/ui-start.md +78 -0
- package/presets/cursor/next/commands/ui-stop.md +71 -0
- package/presets/cursor/next/commands/upstream-research.md +1 -1
- package/presets/cursor/next/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/next/hooks/run-hook.mjs +2 -1
- package/presets/cursor/next/rules/README.md +2 -1
- package/presets/cursor/next/rules/dev-process-lifecycle.mdc +43 -0
- package/presets/cursor/next/rules/next-app-core.mdc +1 -0
- package/presets/cursor/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/cursor/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/cursor/next/team/README.md +5 -1
- package/presets/cursor/next/team/upstream/jobs.json +34 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/nuxt/hooks/run-hook.mjs +2 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +2 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +315 -2
- package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-laravel/hooks/run-hook.mjs +2 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/svelte/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/svelte/hooks/run-hook.mjs +2 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/go/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/java/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/next/MCP.md +2 -0
- package/presets/mavis/next/REPO_AGENTS.md +2 -0
- package/presets/mavis/next/adapter-map.json +33 -1
- package/presets/mavis/next/agents/build-verifier.md +1 -1
- package/presets/mavis/next/agents/ci-investigator.md +3 -0
- package/presets/mavis/next/agents/code-reviewer.md +1 -0
- package/presets/mavis/next/agents/debugger.md +3 -0
- package/presets/mavis/next/agents/feature-developer.md +3 -0
- package/presets/mavis/next/agents/mockup-reviewer.md +4 -1
- package/presets/mavis/next/agents/performance-auditor.md +2 -0
- package/presets/mavis/next/agents/playwright-test-generator.md +3 -0
- package/presets/mavis/next/agents/playwright-test-healer.md +3 -0
- package/presets/mavis/next/agents/playwright-test-planner.md +3 -0
- package/presets/mavis/next/agents/qa-tester.md +3 -0
- package/presets/mavis/next/agents/task-analyst.md +2 -0
- package/presets/mavis/next/ai-local/rules-library/storybook-dev-compare-figma.md +2 -1
- package/presets/mavis/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/mavis/next/commands/README.md +6 -0
- package/presets/mavis/next/commands/task.md +7 -1
- package/presets/mavis/next/commands/technical-retro.md +7 -1
- package/presets/mavis/next/commands/ui-start.md +73 -0
- package/presets/mavis/next/commands/ui-stop.md +66 -0
- package/presets/mavis/next/commands/upstream-research.md +1 -1
- package/presets/mavis/next/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/mavis/next/rules/next-app-core.md +1 -0
- package/presets/mavis/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/mavis/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/mavis/next/team/README.md +5 -1
- package/presets/mavis/next/team/upstream/jobs.json +34 -0
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +315 -2
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/android-kotlin/OPENCODE.md +4 -1
- package/presets/opencode/android-kotlin/README.md +1 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/hooks/README.md +4 -2
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/android-kotlin/opencode.json +5 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/go/OPENCODE.md +4 -1
- package/presets/opencode/go/README.md +1 -0
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/hooks/README.md +4 -2
- package/presets/opencode/go/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/go/opencode.json +5 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/ios-swift/OPENCODE.md +4 -1
- package/presets/opencode/ios-swift/README.md +1 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/hooks/README.md +4 -2
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/ios-swift/opencode.json +5 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/java/OPENCODE.md +4 -1
- package/presets/opencode/java/README.md +1 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/hooks/README.md +4 -2
- package/presets/opencode/java/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/java/opencode.json +5 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/mcp-ts/OPENCODE.md +4 -1
- package/presets/opencode/mcp-ts/README.md +1 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/hooks/README.md +4 -2
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/mcp-ts/opencode.json +5 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/mol/OPENCODE.md +4 -1
- package/presets/opencode/mol/README.md +1 -0
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/hooks/README.md +4 -2
- package/presets/opencode/mol/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/mol/opencode.json +4 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/next/MCP.md +2 -0
- package/presets/opencode/next/OPENCODE.md +4 -1
- package/presets/opencode/next/README.md +1 -0
- package/presets/opencode/next/REPO_AGENTS.md +2 -0
- package/presets/opencode/next/adapter-map.json +33 -1
- package/presets/opencode/next/agents/build-verifier.md +1 -1
- package/presets/opencode/next/agents/ci-investigator.md +3 -0
- package/presets/opencode/next/agents/code-reviewer.md +1 -0
- package/presets/opencode/next/agents/debugger.md +3 -0
- package/presets/opencode/next/agents/feature-developer.md +3 -0
- package/presets/opencode/next/agents/mockup-reviewer.md +4 -1
- package/presets/opencode/next/agents/performance-auditor.md +2 -0
- package/presets/opencode/next/agents/playwright-test-generator.md +3 -0
- package/presets/opencode/next/agents/playwright-test-healer.md +3 -0
- package/presets/opencode/next/agents/playwright-test-planner.md +3 -0
- package/presets/opencode/next/agents/qa-tester.md +3 -0
- package/presets/opencode/next/agents/task-analyst.md +2 -0
- package/presets/opencode/next/ai-local/rules-library/storybook-dev-compare-figma.md +2 -1
- package/presets/opencode/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/opencode/next/commands/README.md +6 -0
- package/presets/opencode/next/commands/task.md +7 -1
- package/presets/opencode/next/commands/technical-retro.md +7 -1
- package/presets/opencode/next/commands/ui-start.md +81 -0
- package/presets/opencode/next/commands/ui-stop.md +74 -0
- package/presets/opencode/next/commands/upstream-research.md +1 -1
- package/presets/opencode/next/hooks/README.md +4 -2
- package/presets/opencode/next/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/next/opencode.json +4 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/opencode/next/rules/next-app-core.md +1 -0
- package/presets/opencode/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/opencode/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/opencode/next/team/README.md +5 -1
- package/presets/opencode/next/team/upstream/jobs.json +34 -0
- package/presets/opencode/nuxt/OPENCODE.md +4 -1
- package/presets/opencode/nuxt/README.md +1 -0
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/hooks/README.md +4 -2
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/nuxt/opencode.json +4 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/php-hexagonal/OPENCODE.md +4 -1
- package/presets/opencode/php-hexagonal/README.md +1 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/hooks/README.md +4 -2
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/php-hexagonal/opencode.json +5 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/php-laravel/OPENCODE.md +4 -1
- package/presets/opencode/php-laravel/README.md +1 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/hooks/README.md +4 -2
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +315 -2
- package/presets/opencode/php-laravel/opencode.json +5 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/platform-contract.json +6 -0
- package/presets/opencode/plugins/task-status/README.md +92 -0
- package/presets/opencode/plugins/task-status/details-data.ts +130 -0
- package/presets/opencode/plugins/task-status/details.tsx +84 -0
- package/presets/opencode/plugins/task-status/eta.ts +230 -0
- package/presets/opencode/plugins/task-status/index.ts +6 -0
- package/presets/opencode/plugins/task-status/package.json +10 -0
- package/presets/opencode/plugins/task-status/task-view.ts +606 -0
- package/presets/opencode/plugins/task-status/tui.tsx +139 -0
- package/presets/opencode/svelte/OPENCODE.md +4 -1
- package/presets/opencode/svelte/README.md +1 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/hooks/README.md +4 -2
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +314 -1
- package/presets/opencode/svelte/opencode.json +4 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/go/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/java/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/next/MCP.md +2 -0
- package/presets/zcode/next/REPO_AGENTS.md +2 -0
- package/presets/zcode/next/adapter-map.json +33 -1
- package/presets/zcode/next/agents/build-verifier.md +1 -1
- package/presets/zcode/next/agents/ci-investigator.md +3 -0
- package/presets/zcode/next/agents/code-reviewer.md +1 -0
- package/presets/zcode/next/agents/debugger.md +3 -0
- package/presets/zcode/next/agents/feature-developer.md +3 -0
- package/presets/zcode/next/agents/mockup-reviewer.md +4 -1
- package/presets/zcode/next/agents/performance-auditor.md +2 -0
- package/presets/zcode/next/agents/playwright-test-generator.md +3 -0
- package/presets/zcode/next/agents/playwright-test-healer.md +3 -0
- package/presets/zcode/next/agents/playwright-test-planner.md +3 -0
- package/presets/zcode/next/agents/qa-tester.md +3 -0
- package/presets/zcode/next/agents/task-analyst.md +2 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-dev-compare-figma.md +2 -1
- package/presets/zcode/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/zcode/next/commands/README.md +6 -0
- package/presets/zcode/next/commands/task.md +7 -1
- package/presets/zcode/next/commands/technical-retro.md +7 -1
- package/presets/zcode/next/commands/ui-start.md +81 -0
- package/presets/zcode/next/commands/ui-stop.md +74 -0
- package/presets/zcode/next/commands/upstream-research.md +1 -1
- package/presets/zcode/next/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/next/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/zcode/next/rules/next-app-core.md +1 -0
- package/presets/zcode/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/zcode/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/zcode/next/team/README.md +5 -1
- package/presets/zcode/next/team/upstream/jobs.json +34 -0
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +315 -2
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +2 -1
- package/scripts/aggregate-agent-task-metrics.mjs +48 -4
|
@@ -173,7 +173,7 @@ Summary:
|
|
|
173
173
|
- [ ] Twin drift: after editing a Claude `commands/**` or `skills/**` file, `node scripts/check-preset-twin-drift.mjs` passes — mirror the change in the Cursor twin (delta and divergence unchanged) or record a deliberate divergence with `--update`. A deliberate divergence that **raises** an allowance needs `--update --widen`; dropping a baseline row needs `--update --prune`. A plain `--update` refuses both.
|
|
174
174
|
- [ ] Generated trees regenerated (`generate-mavis.mjs` + `generate-opencode.mjs`) and CLI goldens recaptured (`capture-cli-golden.mjs`) after any preset-installed file changes
|
|
175
175
|
|
|
176
|
-
Validation: `yarn check:fast` + the `preset-pr-checklist` rule; the full composite runs in `yarn release:gate
|
|
176
|
+
Validation: `yarn check:fast` + the `preset-pr-checklist` rule; the full composite runs in `yarn release:gate`. CI workflows: `preset-structure.yml` (`check`, `hooks`, `ai-local-engine-tests`), `platform-smoke.yml` (3-OS smoke: `init multi`/`update`/`doctor`, platform suites, script gate), `rule-eval.yml` (opt-in next rule-eval), and `release-gate.yml` (manual `yarn release:gate` run + report artifact).
|
|
177
177
|
|
|
178
178
|
## Release order
|
|
179
179
|
|
|
@@ -429,6 +429,7 @@ Load these when editing files under `packages/ai-rules/presets/**`, `.cursor/**`
|
|
|
429
429
|
| `scripts/check-rule-eval.mjs` / `yarn check:rule-eval` | **Hard gate** inside `check-preset-structure.sh`: validates Incorrect/Correct pairs + `impact:` on **next-only** golden stems (`eval/next/manifest.json`). Backend / ios / php-hexagonal / php-laravel stems are out of scope until a stack adds `eval/<stack>/`. |
|
|
430
430
|
| `scripts/check-release-consistency.mjs` / `yarn check:release-consistency` | **FAIL** when `packages/ai-rules/package.json` version and the newest `## <version>` heading in `CHANGELOG.md` disagree — a tag must not ship the previous release's notes. Wired into `check-preset-structure.sh`; fixture `test-release-consistency.mjs`. |
|
|
431
431
|
| `scripts/check-team-db-contract.mjs` / `yarn check:team-db-contract` | **FAIL** when the checked-in OpenAPI 3.1 document (`docs/openapi/team-db.v1.json`) drifts from `team-db-openapi.mjs`, fails the vendored 3.1 meta-schema (sha256-pinned), loses an `operationId`, diverges from `ROUTE_TABLE` in either direction, carries an invalid example, or leaves a `$ref` unresolved. `--write` is the only writer; no network at gate time. Wired into `check-preset-structure.sh`. |
|
|
432
|
+
| `presets/_shared/hooks/guard-shell-command.mjs.tmpl` + `<stack>/guard-ports.json` | The shell guard asks before a server start whose port already listens: `startCommands` names the stack's dev-server command shape, `defaultPorts` the ports to probe when the command has no `--port`, and an explicit `--port` probes that port only. `pkill`, `killall`, and `xargs kill` always ask. Fixture `test-guard-shell-command.mjs`; rendered into every `hooks/guard-shell-command.mjs` by `generate-hooks.mjs`. |
|
|
432
433
|
| `presets/_shared/ai-local/scripts/team-db-scheduler.mjs` | The scheduled-jobs module, shipped to consumers as `.ai.local/scripts/team-db-scheduler.mjs` (`ENGINE_SCRIPTS`): the job validator, a dependency-free five-field cron parser and next-fire on `Intl` zone math (both DST transitions are fixtures), the deterministic atomic `scheduler/jobs.json` store, the run-manifest and capped-capture helpers (the recorded sha256 covers exactly the pre-marker bytes, so a capped stream is not reported `E_LOG_HASH`), the projection into `scheduled_jobs` / `job_runs` / `job_run_events`, retention (1 MiB per stream, 200 runs, 30 days, 2 GiB; a pruned run directory takes its row with it; an active run is never pruned), restart reconciliation to `interrupted`, and `runScheduler` — the lease, the `BEGIN IMMEDIATE` claim, a durable run-now queue the timer re-reads and merges at every tick, the detached child with a process-group kill, `catch-up` bounded to five occurrences per gap with the truncation recorded (`E_CATCH_UP_TRUNCATED`), and the kill-switch drain. Fixture `test-team-db-scheduler.mjs`; concurrency fixtures live in `test-team-db-concurrency.mjs`. |
|
|
433
434
|
| `scripts/test-team-db-*.mjs` | The team-db suite family: schema (17), project (18), migrate-tasks (5), dual-write (13), API (27), security (17), dashboard (10), concurrency (10), scheduler (34), and FAIL-direction fixtures (22). The fixtures prove each gate fails on its planted defect; `test-team-db-concurrency.mjs` covers first-creation races, a mixed writer/reader load, `SIGKILL` recovery, a held lock, the 5 s hook budget, and the scheduler's four seams (scheduler versus projector on one database, a `SIGKILL`ed scheduler reconciled to one `interrupted` row, 50 finalized runs inside the WAL bound, and a held exclusive lock that neither hangs nor leaves a lease). Wired into `check-preset-structure.sh`; `yarn test:team-db` runs the family. |
|
|
434
435
|
|
|
@@ -450,7 +451,47 @@ Iteration versus release:
|
|
|
450
451
|
|
|
451
452
|
`check-generated-drift` caches generated trees in the OS temp directory, keyed by a digest of the Cursor/`_shared` sources and the generator libraries. A source or generator edit misses the cache and regenerates; the cache is disposable and never hides drift.
|
|
452
453
|
|
|
453
|
-
CI: [`.github/workflows/preset-structure.yml`](../../../.github/workflows/preset-structure.yml) runs the orchestrator on PRs touching `packages/ai-rules/**`.
|
|
454
|
+
CI: [`.github/workflows/preset-structure.yml`](../../../.github/workflows/preset-structure.yml) runs the orchestrator on PRs touching `packages/ai-rules/**`. The other workflows in `.github/workflows/`: `platform-smoke.yml` (3-OS smoke: `init multi`, `update`, `doctor`, platform suites, script gate), `rule-eval.yml` (opt-in next rule-eval via `scripts/check-rule-eval.mjs`), and `release-gate.yml` (manual `yarn release:gate` run on a chosen ref; uploads the `.release-gate/` report as an artifact).
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
## Preset-tree lock and the loop
|
|
459
|
+
|
|
460
|
+
`yarn fix:generated` deletes and rebuilds every platform stack, so the writer and every gate that reads `presets/**` take one exclusive lock (`scripts/lib/preset-tree-lock.mjs`; lock directory `.preset-tree-lock/` with `owner.json` pid + token). From `packages/ai-rules/`:
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
yarn preset:loop # fix:generated && check:changed && check:fast, in series
|
|
464
|
+
yarn fix:generated --wait 600000 # opt in to waiting for a live holder
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
- **Fail closed.** A fatal reason (`unwritable`, `reclaim-failed`) stops the generator and both shell gates with exit 1 before any work. `--allow-unlocked` (generator, `run-locked.mjs`) or `AI_RULES_ALLOW_UNLOCKED=1` (both gates) proceeds with a loud `warn:` line. Read `fatal` before `skipped` in a caller: `skipped` is only the explicit opt-in.
|
|
468
|
+
- **Fail fast by default.** A live holder returns exit 1 with the held owner; `--wait <ms>` (or `AI_RULES_LOCK_WAIT_MS`) polls every 500 ms, `0` is the default. `--wait` is read by `fix:generated` and `run-locked.mjs`; the shell gates read only `AI_RULES_ALLOW_UNLOCKED` and stay fail-fast. A dead named owner is reclaimed on the first attempt, never waited on.
|
|
469
|
+
- **One holder per process chain.** A process that already holds the lock must not run a command that acquires it again: the owner pid is alive, so the child never goes stale and either fails fast or burns the whole wait budget. `fix:generated`, `check:fast`, `check:preset-structure`, `preset:loop`, and `release:gate` are never wrapped; `check:changed` / `check:preset-delta` stay usable while diagnosing a stuck lock.
|
|
470
|
+
- **Locked readers.** `scripts/run-locked.mjs [--label <l>] [--wait <ms>] [--allow-unlocked] [--root <dir>] -- <command> [args…]` acquires, runs with inherited stdio, releases in `finally`, and exits with the child's status (`128 + signo` on signal death). The package scripts wrap `check:generated-drift`, `check:preset-twin-map`, `check:preset-twin-drift`, `check:preset-token-budget`, `check:preset-leakage`, `check:frontmatter`, `check:consumer-links`, `check:shared-core-drift`, `check:preset-reachability`, `check:preset-i18n`, and `test:cli-init-clean`.
|
|
471
|
+
- **Residual unlocked readers.** Other `check:*` scripts and `.husky/pre-commit` call scripts directly; the composites and CI reach them through the lock. Inspect a blocked run with `cat .preset-tree-lock/owner.json` — a dead pid is reclaimed by the next run.
|
|
472
|
+
- **Atomic engine mirror.** `scripts/lib/engine-mirror.mjs` writes a same-directory temp file and `fs.renameSync`s it into `.ai.local/scripts/`, so a live engine process never reads a torn `run.mjs`; the mirror stays outside this lock (it copies the same bytes from a different root).
|
|
473
|
+
- **Announcing work.** `processes.mjs run --name <res> -- <command>` holds a manager lease for the child's lifetime and `processes.mjs watch` lists every holder; that lease is separate from the lock above — see § Agent process manager.
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## Agent process manager
|
|
478
|
+
|
|
479
|
+
`processes.mjs` (with `process-lease.mjs`) is the one place that answers "who is doing what in this checkout". It owns `.ai.local/.processes/` (`leases/<name>.json`, a single-line `events.jsonl`, a `.reclaim/` guard per lease) and reads the markers other tools already write. `start` spawns a detached dev server and records a lease; `stop` / `status` / `list` prove ownership over the same record. From the repo root:
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
node .ai.local/scripts/processes.mjs run --name preset-tree -- node scripts/fix-generated.mjs
|
|
483
|
+
node .ai.local/scripts/processes.mjs watch # live table, 1 s refresh
|
|
484
|
+
node .ai.local/scripts/processes.mjs list --json # one snapshot per line
|
|
485
|
+
node .ai.local/scripts/processes.mjs scan # listening ports + known shapes
|
|
486
|
+
node .ai.local/scripts/processes.mjs doctor # stale lease, dead marker, empty lease port
|
|
487
|
+
node .ai.local/scripts/processes.mjs serve # 127.0.0.1:4179 — JSON, SSE, HTML
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
- **One protocol.** `acquire` creates `leases/<name>.json` with an exclusive `open(…, 'wx')` and records the **parent** process as the owner, because the CLI exits immediately — `--pid <n>` overrides it, and an owner that is not provably alive is refused with exit 2 (`acquire: a lease needs a live owner; pass --pid $$ (or use run)`); a second acquire is `held` (exit 1) unless `--wait <ms>`. `run` acquires, spawns with inherited stdio, releases in `finally`, and exits with the child's status (`128 + signo` on a signal death).
|
|
491
|
+
- **Liveness is pid + start time.** `pidStart` (`ps -o lstart=`, `/proc/<pid>/stat` on a host without `ps`) defeats pid reuse, and a heartbeat never makes a live holder stale. A stale lease is reclaimed on the first attempt inside `.processes/.reclaim/<name>`; `release` refuses a token that is not the owner's.
|
|
492
|
+
- **One snapshot, three surfaces.** `list` / `watch` / `serve` read own leases plus `preset-tree` (`.preset-tree-lock/owner.json`), `dev:<name>` (`.ai.local/.dev/*.json`), `team-db-serve` (`.ai.local/.ui/api.json`), `scheduler`, `runner:<slug>` (active runs only), and `git-index`. A missing source is skipped, a malformed one is a `warnings[]` entry; the snapshot never crashes.
|
|
493
|
+
- **Foreign is a label, never a kill.** `scan` reports listening TCP ports and the known command shapes (`fix-generated.mjs`, `check-preset-*.sh`, `team-db.mjs serve`, `storybook`, `next dev`, Playwright browsers); `--known-only` is the default. `stop --name <res>` or `stop --task <slug>` signals only a lease whose owner it can prove (live pid + matching `pidStart` + command line or lease port) and exits 4 with `stop: refused: …` otherwise; a stale lease is cleared without a signal.
|
|
494
|
+
- **Exit codes.** 0 ok · 1 held/timeout · 2 usage · 3 fatal (state directory unwritable, no `--allow-unlocked`) · 4 refused. `serve` binds a loopback host only.
|
|
454
495
|
|
|
455
496
|
---
|
|
456
497
|
|
package/docs/TEAM-DB.md
CHANGED
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
The task files remain the source of truth; the database exists so an operator or a tool can
|
|
5
5
|
query history without walking JSON on every request.
|
|
6
6
|
|
|
7
|
-
The projection is installed by `init` as
|
|
7
|
+
The projection is installed by `init` as ten `team-db*.mjs` modules under `.ai.local/scripts/`:
|
|
8
8
|
|
|
9
9
|
| Module | Role |
|
|
10
10
|
|---|---|
|
|
11
|
-
| `team-db.mjs` | CLI: `init`, `sync`, `delete`, `migrate-tasks`, `check`, `serve`, `jobs`, `schedule` |
|
|
11
|
+
| `team-db.mjs` | CLI: `init`, `sync`, `delete`, `migrate-tasks`, `check`, `serve`, `jobs`, `schedule`, `tracker`, `task-run`, `ui` |
|
|
12
|
+
| `team-db-ui.mjs` | the `ui` supervisor: probe-first `start`, `stop`, `status`, `restart`, the ownership marker, leader-only termination |
|
|
13
|
+
| `team-db-tracker.mjs` | the file-authoritative tracker: items, links, the launch queue, eligibility order, import |
|
|
14
|
+
| `team-db-task-runner.mjs` | the opt-in `team/runner.json` supervisor behind tracker Continue |
|
|
12
15
|
| `team-db-schema.mjs` | capability probe, embedded migrations, pragmas, fingerprint, integrity |
|
|
13
16
|
| `team-db-project.mjs` | parsers, idempotent projector, confirmed task deletion, retention, search |
|
|
14
17
|
| `team-db-api.mjs` | `node:http` server (reads plus the bounded mutations), query layer, security boundary |
|
|
@@ -16,6 +19,12 @@ The projection is installed by `init` as seven modules under `.ai.local/scripts/
|
|
|
16
19
|
| `team-db-dashboard.mjs` | the no-build dashboard (HTML, CSS, JS strings) |
|
|
17
20
|
| `team-db-scheduler.mjs` | job model, cron/interval math, the file store, the projection, and the timer |
|
|
18
21
|
|
|
22
|
+
The same seeded set is `ENGINE_SCRIPTS` in `bin/lib/engine-scripts.js`: the ten `team-db*.mjs`
|
|
23
|
+
modules plus the self-learning engine, `manifest.mjs`, `upstream-research.mjs`,
|
|
24
|
+
`check-write-scope.mjs`, `aggregate-agent-task-metrics.mjs`, and the `processes.mjs` + `process-lease.mjs` process manager
|
|
25
|
+
(twenty-two entries; `node -e "require('./bin/lib/engine-scripts.js').ENGINE_SCRIPTS.length"`
|
|
26
|
+
prints the shipped count).
|
|
27
|
+
|
|
19
28
|
## Behavior contract
|
|
20
29
|
|
|
21
30
|
- **Files are authoritative.** `status.json`, `pipeline.json`, `metrics.json`,
|
|
@@ -107,6 +116,9 @@ node .ai.local/scripts/team-db.mjs migrate-tasks [--root <team-dir>] [--quiet] [
|
|
|
107
116
|
node .ai.local/scripts/team-db.mjs check [--root <team-dir>]
|
|
108
117
|
node .ai.local/scripts/team-db.mjs serve [--root <team-dir>] [--host <addr>] [--port <n>]
|
|
109
118
|
[--allow-remote] [--open]
|
|
119
|
+
node .ai.local/scripts/team-db.mjs ui start|restart [--root <team-dir>] [--json] [--quiet]
|
|
120
|
+
[--host <loopback>] [--port <n>] [--open]
|
|
121
|
+
node .ai.local/scripts/team-db.mjs ui stop|status [--root <team-dir>] [--json] [--quiet]
|
|
110
122
|
node .ai.local/scripts/team-db.mjs jobs list [--enabled] [--sort <key>] [--json] [--quiet]
|
|
111
123
|
node .ai.local/scripts/team-db.mjs jobs get <id> [--json]
|
|
112
124
|
node .ai.local/scripts/team-db.mjs jobs put --file <path|-> [--dry-run] [--json]
|
|
@@ -116,13 +128,25 @@ node .ai.local/scripts/team-db.mjs jobs reconcile [--json]
|
|
|
116
128
|
node .ai.local/scripts/team-db.mjs jobs run --id <id> [--json]
|
|
117
129
|
node .ai.local/scripts/team-db.mjs schedule [--once] [--interval-ms <n>] [--grace-ms <n>]
|
|
118
130
|
[--drain-ms <n>] [--json] [--quiet]
|
|
131
|
+
node .ai.local/scripts/team-db.mjs tracker add --file <path|-> [--json] [--quiet]
|
|
132
|
+
node .ai.local/scripts/team-db.mjs tracker set <id> --file <path|-> [--json]
|
|
133
|
+
node .ai.local/scripts/team-db.mjs tracker show <id> | list [--status <csv>] [--ready] | ready | validate
|
|
134
|
+
[--json]
|
|
135
|
+
node .ai.local/scripts/team-db.mjs tracker import --file <path|-> [--dry-run] [--json]
|
|
136
|
+
node .ai.local/scripts/team-db.mjs tracker migrate-ids [--json] [--quiet]
|
|
137
|
+
node .ai.local/scripts/team-db.mjs tracker enqueue --file <path|-> | cancel <entryId> | drain [--claim]
|
|
138
|
+
| recover | prune [--older-than <days>] [--json] [--quiet]
|
|
119
139
|
```
|
|
120
140
|
|
|
121
141
|
Exit codes: `0` ok, `1` at least one task failed, a delete refusal (unknown slug, active
|
|
122
142
|
task, kill switch, folder-delete failure) or a migration checksum drifted, `2`
|
|
123
143
|
database-level failure — a `delete` without `node:sqlite` refuses here rather than deleting
|
|
124
144
|
the folder only, `3` usage, `4` deadline or busy database (the hook-shaped `sync --slug`
|
|
125
|
-
deadline, or a delete that meets a locked database).
|
|
145
|
+
deadline, or a delete that meets a locked database). The `tracker` verbs reuse the same
|
|
146
|
+
vocabulary: `0` ok, `1` a validation refusal carrying its named code (`E_TRACKER_CYCLE`,
|
|
147
|
+
`E_TRACKER_SELF_DEP`, `E_TRACKER_UNKNOWN_DEP`, `E_TRACKER_DUPLICATE_ID`, `E_ID_COLLISION`,
|
|
148
|
+
`E_TRACKER_TRANSITION`, `E_TRACKER_REVISION`, `E_SCHEMA`), `3` usage, `4` the tree lock was
|
|
149
|
+
contended (`E_TRACKER_BUSY`).
|
|
126
150
|
|
|
127
151
|
`sync` is idempotent: a second run reports `inserted=0 updated=0 unchanged=<n>`. One changed
|
|
128
152
|
byte changes exactly one document hash and one task content hash. A removed task directory is
|
|
@@ -158,17 +182,97 @@ targets must be on the same host.
|
|
|
158
182
|
|
|
159
183
|
| Name | Effect |
|
|
160
184
|
|---|---|
|
|
161
|
-
| `AI_RULES_TEAM_DB_DISABLE` | truthy value
|
|
185
|
+
| `AI_RULES_TEAM_DB_DISABLE` | truthy value turns the **projection** off — the database write points, the `task-run ensure` seed and `serve` stop; `ui start`/`ui restart` refuse with `E_DISABLED` before any probe, write or signal; the task files and the `tracker` file verbs stay usable (the tracker is not disabled by this switch, R3-7) |
|
|
162
186
|
| `AI_RULES_TEAM_DB_FORCE_FALLBACK` | truthy value forces the file-only path even on a supported runtime |
|
|
163
187
|
| `AI_RULES_TEAM_DB_ROOT` | team directory when `--root` is absent |
|
|
164
188
|
| `AI_RULES_TEAM_DB_PATH` | database file path (default `<teamRoot>/team.db`) |
|
|
165
189
|
| `AI_RULES_TEAM_DB_LOG` | error-log path (default `<cwd>/.ai.local/team/team-db-errors.log`) |
|
|
166
190
|
| `AI_RULES_TEAM_DB_SEAM` | phase label in the error log: `hook`, `receipt`, `cli`, `serve` |
|
|
191
|
+
| `AI_RULES_TEAM_DB_TRACKER_DRAIN_DISABLE` | truthy value stops the hook stop-seam auto-drain only; the `tracker` file verbs stay usable |
|
|
167
192
|
|
|
168
193
|
No other environment value is read or persisted. The error log stores a timestamp, a code,
|
|
169
194
|
a phase, and a message; it never stores prompt content or an environment value, and it is
|
|
170
195
|
trimmed to the newest 200 lines / 64 KiB.
|
|
171
196
|
|
|
197
|
+
## Tracker
|
|
198
|
+
|
|
199
|
+
`team/tracker/` is a file-authoritative store with one writer: `team-db-tracker.mjs`.
|
|
200
|
+
`tracker/items/<id>.json` is committed (the plan the team executes); `tracker/links/` is
|
|
201
|
+
committed (one relation record and prompt per item ↔ task pair); `tracker/queue/` and
|
|
202
|
+
`team/task-runs/` are runtime state and git-ignored. The stored status lattice is
|
|
203
|
+
`backlog|planned|completed|cancelled|superseded`; **backlog is the captured state** and is
|
|
204
|
+
not launchable until promoted to `planned`. Every operational status (`effectiveStatus`,
|
|
205
|
+
`ready`, `waitingOn`) is derived from the item files, the links, the queue entries and the
|
|
206
|
+
hook-owned `tasks/*/status.json` state, and is never written to a file. The total order is
|
|
207
|
+
`priority` ascending — **lower runs first**, with the default priority 5 — then
|
|
208
|
+
`createdAt`, then `id`; there is no `sort` parameter, so the list, the drain and the ready
|
|
209
|
+
set can never disagree.
|
|
210
|
+
|
|
211
|
+
An item's `id` is a positive integer assigned by the store and immutable. The store keeps
|
|
212
|
+
`tracker/sequence.json` (`{schemaVersion, nextId}`) and falls back to the highest existing
|
|
213
|
+
item file, so ids are monotonic and never reused. The id is **not** the team-task slug:
|
|
214
|
+
`tracker/link add` writes `tracker/links/<itemId>--<taskSlug>.json` plus its prompt, and one
|
|
215
|
+
item may carry several linked tasks. A task started from an item without an explicit slug
|
|
216
|
+
defaults to `tracker-<itemId>`. The link stores only the operator decision
|
|
217
|
+
(`requested|stopped|unlinked`); its effective state (`requested|claimed|active|paused|
|
|
218
|
+
stopped|completed|failed|unlinked`) is derived from the queue entry and the task row. A
|
|
219
|
+
legacy `tasks/<itemId>/` without a link file is shown as an implicit primary link;
|
|
220
|
+
`tracker link adopt` materializes it. `tracker delete <id>` removes the item, its links and
|
|
221
|
+
prompts, but never the team tasks; it refuses while a linked task is active or a queue
|
|
222
|
+
entry is non-terminal. Writes validate schema → identity → graph (first failure wins) and
|
|
223
|
+
bump the `revision` CAS token; `tracker set` refuses a stale `revision` with
|
|
224
|
+
`E_TRACKER_REVISION`.
|
|
225
|
+
|
|
226
|
+
The launch queue serializes task starts: `tracker enqueue` records a request with its own
|
|
227
|
+
`taskSlug` and `linkId` (a duplicate for the same task appends its reason to the entry
|
|
228
|
+
history), `tracker drain --claim` grants at most one claim in drain order and never starts
|
|
229
|
+
a run, and the hook stop seam consumes the claim and bootstraps `tasks/<taskSlug>/` with a
|
|
230
|
+
`pipeline.json` naming `trackerItemId`/`trackerLinkId` and the link prompt (the recorded
|
|
231
|
+
`command` is never executed). `tracker/config.json` carries `maxActive` (1…8, default 1): a
|
|
232
|
+
task in a holding state (`in_progress`, `awaiting_artifact_receipt`, `blocked`) occupies a
|
|
233
|
+
slot, a task at a human gate does not. A claim older than 90 s with no task row is released
|
|
234
|
+
on the next drain or by `tracker recover`; `tracker prune --older-than <days>` deletes aged
|
|
235
|
+
terminal entry files only. The tracker module never writes `status.json`, `metrics.json`,
|
|
236
|
+
or `scheduler/jobs.json`.
|
|
237
|
+
|
|
238
|
+
**Task control.** The tracker item detail can start a new linked task (link + queue
|
|
239
|
+
request), stop a link (cancel the queued request, write the per-task `tasks/<slug>/STOP`
|
|
240
|
+
sentinel, and terminate the active runner process group), and continue a paused/stopped
|
|
241
|
+
link. Continue uses the committed `team/runner.json`; `team-db.mjs task-run ensure` seeds it
|
|
242
|
+
with the OpenCode default when absent (the `ui` verbs never write it, and the kill switch
|
|
243
|
+
skips the seed), so an operator never edits the file by hand. The runner is supervised by
|
|
244
|
+
`team-db-task-runner.mjs` with an argv array, no shell, a repository-confined cwd, an env
|
|
245
|
+
allow-list, a timeout, capped logs and a process-group kill. A missing file still answers
|
|
246
|
+
`409 E_RUNNER_OFFLINE` and the UI disables Continue. The runner never writes `status.json`
|
|
247
|
+
or `metrics.json`. The seeded config is:
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"schemaVersion": 1,
|
|
252
|
+
"runner": ["opencode", "run", "--format", "json", "/task-continue", "{taskSlug}"],
|
|
253
|
+
"cwd": "../..",
|
|
254
|
+
"timeoutMs": 1800000,
|
|
255
|
+
"envPassthrough": []
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Replace `runner` only when the host CLI differs; the argv array may use `{promptFile}`,
|
|
260
|
+
`{taskSlug}` or `{teamRoot}`, never a shell string.
|
|
261
|
+
|
|
262
|
+
**Import envelope (D-8).** `tracker import --file <path|->` reads a versioned envelope
|
|
263
|
+
`{ schemaVersion: 1, source: { task, generatedAt }, items: [...] }`, validates every item
|
|
264
|
+
as one transaction (a failure writes nothing), upserts by id, writes nothing on `--dry-run`,
|
|
265
|
+
and an idle re-import (content-hash equality over the envelope fields) writes nothing.
|
|
266
|
+
`revision` and `history` are store-owned and never part of that comparison.
|
|
267
|
+
|
|
268
|
+
**Kill switch.** `AI_RULES_TEAM_DB_DISABLE=1` disables the **projection**, not the tracker:
|
|
269
|
+
`tracker add|set|show|list|ready|validate|import|enqueue|cancel|drain|recover|prune|link|delete|adopt`
|
|
270
|
+
stay usable because they are file writes to the authoritative tree; the projection child
|
|
271
|
+
each write verb spawns is skipped silently, and a runtime without `node:sqlite` keeps the
|
|
272
|
+
store file-only end to end. `AI_RULES_TEAM_DB_TRACKER_DRAIN_DISABLE=1` stops only the hook's
|
|
273
|
+
automatic drain. The API's `E_DISABLED` guard refuses every tracker mutation, including
|
|
274
|
+
`task-run`, before a child is spawned.
|
|
275
|
+
|
|
172
276
|
## Scheduled jobs
|
|
173
277
|
|
|
174
278
|
`scheduler/jobs.json` holds the definitions, sorted by `id` and rewritten atomically; it is
|
|
@@ -235,7 +339,11 @@ The `next` preset ships one `pipeline` job, `upstream-research`, and one engine
|
|
|
235
339
|
`.ai.local/scripts/upstream-research.mjs`. The job renders `upstream/prompt.md` and runs the
|
|
236
340
|
module with `--prompt {promptFile} --team-root . --repo-root ../..`; it is a normal
|
|
237
341
|
definition in `scheduler/jobs.json`, so `jobs list|get|put|enable|disable|run`, the dashboard
|
|
238
|
-
Jobs tab, and every job route work unchanged.
|
|
342
|
+
Jobs tab, and every job route work unchanged. `init`/`update` seed the definition into
|
|
343
|
+
`scheduler/jobs.json` when the file is absent (template:
|
|
344
|
+
`presets/cursor/next/team/upstream/jobs.json`; the validator supplies the
|
|
345
|
+
`createdAt`/`updatedAt`/`revision` defaults on read), and a definition the operator already
|
|
346
|
+
owns is never overwritten.
|
|
239
347
|
|
|
240
348
|
**Supervision.** `misfire: run-once` fires one missed Monday at the next tick, and
|
|
241
349
|
`concurrency: skip` consumes and drops a manual request while a weekly run is live (the drop
|
|
@@ -298,6 +406,23 @@ schema, so the next open moves the file aside as `team.db.mismatch-<stamp>`, reb
|
|
|
298
406
|
reprojects from the task files — database-only rows are discarded by design, which is why the
|
|
299
407
|
files are the source of truth. Run `sync` after an upgrade and the counters reconverge.
|
|
300
408
|
|
|
409
|
+
Migration `0003-backlog` stays immutable; migration `0004-tracker` creates the tracker
|
|
410
|
+
tables (`tracker_items`, `tracker_item_deps`, `tracker_queue`, `tracker_queue_events`,
|
|
411
|
+
`tracker_item_tasks`) with **INTEGER** item ids, adds the queue task/link columns, drops the
|
|
412
|
+
backlog tables and moves `SCHEMA_VERSION` to 4. The projection is derived, so v4 does not
|
|
413
|
+
copy backlog rows: the next `sync` rebuilds the tracker rows from the files. On a tree that
|
|
414
|
+
still has the shipped slug store, run `tracker migrate-ids` once before that sync — it moves
|
|
415
|
+
`backlog/items` and `backlog/queue` into `tracker/`, converts every slug id to the integer
|
|
416
|
+
sequence, rewrites dependencies, links and queue entries, and records the reserved mapping
|
|
417
|
+
in `tracker/id-migration.json` until the conversion completes.
|
|
418
|
+
It is additive and sha256-pinned like the first two: no `ALTER` of the `tasks` or scheduler
|
|
419
|
+
tables, so a wrong v3 costs a v4, never an edit. `active`/`done` are derived from the joined
|
|
420
|
+
task row, never stored; `tracker_item_deps` has no foreign key on `dep_id`, so a broken file
|
|
421
|
+
set projects as a recorded `parse_error` instead of aborting the run. The tracker walker runs
|
|
422
|
+
two bounded directory listings inside the existing sync deadline — 200 items measure well
|
|
423
|
+
under 250 ms — and is idempotent by `content_hash` with `absent_at` marking like the task
|
|
424
|
+
walker; `sync --prune` removes tombstoned tracker rows.
|
|
425
|
+
|
|
301
426
|
Each connection sets `journal_mode=WAL`, `busy_timeout=5000`, `foreign_keys=ON`, and
|
|
302
427
|
`synchronous=NORMAL`. One task is projected in one transaction; a `SIGKILL` mid-sync
|
|
303
428
|
rolls back the in-flight task and leaves `integrity_check` `ok`.
|
|
@@ -367,6 +492,89 @@ the confirmed task delete and the rescan to the named interface without authenti
|
|
|
367
492
|
A job definition carries arbitrary `argv` and run-now enqueues it, so that surface
|
|
368
493
|
executes operator-supplied commands as the API user; see `## Scheduled jobs`.
|
|
369
494
|
|
|
495
|
+
## Dashboard lifecycle
|
|
496
|
+
|
|
497
|
+
`ui` runs the same server `serve` does, detached, with a marker the next call can prove:
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
node .ai.local/scripts/team-db.mjs ui start [--host <loopback>] [--port <n>] [--open] [--json] [--quiet]
|
|
501
|
+
node .ai.local/scripts/team-db.mjs ui status [--json]
|
|
502
|
+
node .ai.local/scripts/team-db.mjs ui stop [--json]
|
|
503
|
+
node .ai.local/scripts/team-db.mjs ui restart [--host <loopback>] [--port <n>] [--open] [--json] [--quiet]
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
Exit codes: `0` started, already running, stopped, or nothing running; `1` a refusal
|
|
507
|
+
(`E_UI_OTHER_ROOT`, `E_UI_PORT_FOREIGN`, `E_UI_DISABLED`, `E_UI_UNAVAILABLE`, `E_UI_DB_MISSING`),
|
|
508
|
+
or a leader that outlived `SIGKILL` (the marker is kept); `2` a start failure
|
|
509
|
+
(`E_UI_START_TIMEOUT`, `E_UI_CHILD_EXIT`, `E_UI_MARKER_UNWRITABLE`, `E_UI_PORT_IN_USE`); `3` usage.
|
|
510
|
+
|
|
511
|
+
The bind address is loopback (`127.0.0.1` by default): `--allow-remote` and any non-loopback
|
|
512
|
+
`--host` are usage errors, so the verb never exposes the dashboard.
|
|
513
|
+
|
|
514
|
+
**`start` is probe-first.** A server that already answers `200` on the requested target with this
|
|
515
|
+
repository's `rootId` is the no-op: the command prints the same pid, leaves `startedAt` untouched
|
|
516
|
+
and writes nothing. A live marker for this root on another port is reused the same way instead of
|
|
517
|
+
starting a second server. Only a free port leads to a detached `serve` and the marker; `restart` is
|
|
518
|
+
the verb that stops and replaces an owned server. The `ui` path writes the marker plus at most one
|
|
519
|
+
bounded `sync` — the missing-projection repair (`503 E_DB_MISSING` → one `team-db.mjs sync`, 30 s
|
|
520
|
+
cap) — and nothing under `team/`: no `migrate-tasks`, no `runner.json`. The `E_DISABLED` and
|
|
521
|
+
`E_UI_UNAVAILABLE` preflights run before any probe, write or signal, so a disabled runtime never
|
|
522
|
+
stops a live server.
|
|
523
|
+
|
|
524
|
+
The marker is `.ai.local/.ui/api.json` —
|
|
525
|
+
`{schemaVersion,pid,host,port,root,rootId,startedAt,command}` — written `0600` through
|
|
526
|
+
`api.json.tmp` + rename, with `rootId = sha256(realpath(resolved team root)).slice(0, 12)`: a hash,
|
|
527
|
+
never a path, and never transmitted. A marker whose `host` is outside `LOOPBACK_HOSTS`, or whose
|
|
528
|
+
port is not an integer in `0..65535`, is treated as unreadable: no probe ever targets it, and `stop`
|
|
529
|
+
removes it as stale.
|
|
530
|
+
|
|
531
|
+
**Ownership is the authorization.** A signal needs the marker pid alive **and**
|
|
532
|
+
`ps -p <pid> -o command=` matching `/team-db\.mjs\s+serve\b/`; the marker alone never authorizes one.
|
|
533
|
+
`stop` re-proves ownership immediately before each signal, signals that leader pid only — never the
|
|
534
|
+
process group, because `serve` spawns bounded delete children — sends `SIGTERM`, polls every 100 ms
|
|
535
|
+
for at most 5 000 ms, then `SIGKILL`s and verifies the pid is gone. A process that survives keeps its
|
|
536
|
+
marker and the command exits `1`. A live pid whose command does not match is left running with its
|
|
537
|
+
marker intact. A server answering with a different `rootId` is `E_UI_OTHER_ROOT`; a port answered by
|
|
538
|
+
something that is not a team-db health document is `E_UI_PORT_FOREIGN`; neither writes a marker.
|
|
539
|
+
|
|
540
|
+
**Platform.** `ui` is POSIX only: the ownership proof reads `ps`, and no equivalent command-line
|
|
541
|
+
reader exists on Windows, so no signal is ever sent there and `stop` reports the pid as unowned.
|
|
542
|
+
Use the foreground `serve` on Windows.
|
|
543
|
+
|
|
544
|
+
**The root override.** `--root <team-dir>` wins; otherwise `AI_RULES_TEAM_DB_ROOT`; otherwise
|
|
545
|
+
`<cwd>/.ai.local/team` — the same precedence as the projection layers, so `ui status` and `ui stop`
|
|
546
|
+
find a server started through the environment variable.
|
|
547
|
+
|
|
548
|
+
**The timer stays separate.** `ui start` never starts `team-db.mjs schedule`: the timer is one
|
|
549
|
+
foreground process holding a lease, and it is started explicitly. `ui start` and `ui status --json`
|
|
550
|
+
report the read-only `/health.scheduler` block instead.
|
|
551
|
+
|
|
552
|
+
A consumer tree installed from an older release needs `ai-rules update --fix`. A plain `update`
|
|
553
|
+
refreshes the command files but leaves an existing engine module alone, so a stale `team-db.mjs`
|
|
554
|
+
answers `ui` with exit `3`. A fork whose engine predates the verb uses the foreground
|
|
555
|
+
`node .ai.local/scripts/team-db.mjs serve`.
|
|
556
|
+
|
|
557
|
+
### Dashboard parity
|
|
558
|
+
|
|
559
|
+
| Surface | Dashboard | Excluded, with the reason |
|
|
560
|
+
|---|---|---|
|
|
561
|
+
| Tasks | list, detail, rescan, confirmed delete | — |
|
|
562
|
+
| Task delete | `DELETE /api/v1/tasks/{slug}` behind `confirm()`; the `200` success is announced in the page-level live region and focus returns to the list heading; `409 E_ACTIVE_TASK` names `activeSlug` in the detail live region | — |
|
|
563
|
+
| Tracker | read-only list, item panel (dependencies, dependents, linked tasks), queue section | create, update, enqueue and cancel stay in `team-db.mjs tracker` and the API: the dashboard is a read-plus-two-mutations operator surface, and the four writes carry graph and lease rules a browser page must not own |
|
|
564
|
+
| Jobs | definitions, next fire, run-now, runs, logs | unchanged |
|
|
565
|
+
| Mutating calls | exactly two on the task surface: `POST /api/v1/sync`, `DELETE /api/v1/tasks/{slug}` | pinned by `test-team-db-dashboard.mjs`, which also enumerates the four pre-existing jobs writes (`POST`/`PUT`/`DELETE /api/v1/jobs*`, run-now) and fails on a seventh `method:` site; together with no inline style or handler, no absolute URL, and the unchanged CSP |
|
|
566
|
+
|
|
567
|
+
### Delivery surface
|
|
568
|
+
|
|
569
|
+
| Platform | `next` commands | Other stacks |
|
|
570
|
+
|---|---|---|
|
|
571
|
+
| cursor | `ui-start.md`, `ui-stop.md` (authored) | — |
|
|
572
|
+
| claude, mavis, opencode, zcode | the same two files (generated twins) | — |
|
|
573
|
+
| every released stack | — | the verb: `node .ai.local/scripts/team-db.mjs ui start\|status\|stop\|restart` |
|
|
574
|
+
|
|
575
|
+
Ten twins across five platforms: `find presets -path '*/next/commands/ui-start.md' | wc -l` prints 5,
|
|
576
|
+
and the same for `ui-stop.md`. The verb is the contract on every stack; the command is discoverability.
|
|
577
|
+
|
|
370
578
|
## Prompt capture
|
|
371
579
|
|
|
372
580
|
`prompt.md` and `prompt-log.md` are read by the existing projection. An inline work request calls `sync --slug <slug>` once after writing `prompt.md`; a post-terminal entry calls the same once after appending to `prompt-log.md`. Both are bounded, off the critical path, and never fail the file write. A missed projection is staleness, not data loss — the next full sync rebuilds the row.
|