@bonesofspring/ai-rules 0.2.60 → 0.2.61
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 +77 -0
- package/README.md +59 -26
- package/bin/cli.js +368 -59
- package/bin/lib/ai-local-drift.js +18 -0
- package/bin/lib/engine-scripts.js +22 -5
- package/bin/lib/engine-upgrade.js +279 -0
- package/bin/lib/mcp/catalog.js +66 -5
- package/bin/lib/mcp/clients.js +4 -4
- package/bin/lib/mcp/credentials.js +88 -0
- package/bin/lib/mcp/doctor.js +100 -8
- package/bin/lib/mcp/npx.js +17 -0
- package/bin/lib/mcp/registry.js +2 -0
- package/bin/lib/merged-config.js +38 -0
- package/bin/lib/seed-ai-local-team.js +29 -14
- package/docs/MCP-CATALOG.md +30 -2
- package/docs/MCP-SETUP.md +30 -6
- package/docs/OPENCODE.md +22 -2
- package/docs/PLATFORMS.md +38 -0
- package/docs/PRESET-CONTRIBUTION.md +11 -1
- package/docs/TEAM-DB.md +187 -20
- package/docs/openapi/team-db.v1.json +4443 -2083
- package/mcp/defectdojo-mcp.mjs +353 -0
- package/mcp/gitlab.mjs +5 -1
- package/mcp/lib/defectdojo.mjs +249 -0
- package/mcp/lib/yandex.mjs +39 -15
- package/package.json +9 -3
- package/presets/_shared/ai-local/scripts/lock.mjs +139 -19
- package/presets/_shared/ai-local/scripts/signals.mjs +17 -1
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +496 -67
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +816 -5
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +761 -6
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +10 -0
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +2360 -0
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +87 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +151 -9
- package/presets/_shared/ai-local/scripts/upstream-research.mjs +2961 -0
- package/presets/_shared/core/agent-team/agent-artifact-contracts.md +13 -0
- package/presets/_shared/hooks/README.md +23 -3
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +57 -3
- package/presets/{claude/nuxt/hooks/guard-shell-command.sh → _shared/hooks/guard-shell-command.mjs.tmpl} +29 -35
- package/presets/_shared/hooks/run-hook.mjs +102 -0
- package/presets/claude/android-kotlin/hooks/README.md +4 -3
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/android-kotlin/hooks/examples/README.md +2 -2
- package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +96 -0
- package/presets/claude/android-kotlin/hooks/run-hook.mjs +102 -0
- package/presets/claude/android-kotlin/settings.json +2 -2
- package/presets/claude/android-kotlin/team/README.md +5 -0
- package/presets/claude/go/hooks/README.md +4 -3
- package/presets/claude/go/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/go/hooks/examples/README.md +2 -2
- package/presets/claude/go/hooks/guard-shell-command.mjs +95 -0
- package/presets/claude/go/hooks/run-hook.mjs +102 -0
- package/presets/claude/go/settings.json +2 -2
- package/presets/claude/go/team/README.md +5 -0
- package/presets/claude/ios-swift/hooks/README.md +4 -3
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/ios-swift/hooks/examples/README.md +2 -2
- package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +95 -0
- package/presets/claude/ios-swift/hooks/run-hook.mjs +102 -0
- package/presets/claude/ios-swift/settings.json +2 -2
- package/presets/claude/ios-swift/team/README.md +5 -0
- package/presets/claude/java/hooks/README.md +4 -3
- package/presets/claude/java/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/java/hooks/examples/README.md +2 -2
- package/presets/claude/java/hooks/{guard-shell-command.sh → guard-shell-command.mjs} +31 -38
- package/presets/claude/java/hooks/run-hook.mjs +102 -0
- package/presets/claude/java/settings.json +2 -2
- package/presets/claude/java/team/README.md +5 -0
- package/presets/claude/mcp-ts/hooks/README.md +4 -3
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/mcp-ts/hooks/examples/README.md +1 -1
- package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +95 -0
- package/presets/claude/mcp-ts/hooks/run-hook.mjs +102 -0
- package/presets/claude/mcp-ts/settings.json +2 -2
- package/presets/claude/mcp-ts/team/README.md +5 -0
- package/presets/claude/mol/hooks/README.md +20 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/{svelte/hooks/guard-shell-command.sh → mol/hooks/guard-shell-command.mjs} +29 -35
- package/presets/claude/mol/hooks/run-hook.mjs +102 -0
- package/presets/claude/mol/settings.json +2 -2
- package/presets/claude/mol/team/README.md +5 -0
- package/presets/claude/next/agents/build-verifier.md +2 -0
- package/presets/claude/next/agents/code-reviewer.md +2 -0
- package/presets/claude/next/agents/feature-developer.md +1 -0
- package/presets/claude/next/agents/task-analyst.md +4 -0
- package/presets/claude/next/agents/task-router.md +5 -3
- package/presets/claude/next/commands/README.md +1 -0
- package/presets/claude/next/commands/task-continue.md +1 -1
- package/presets/claude/next/commands/upstream-research.md +23 -0
- package/presets/claude/next/hooks/README.md +4 -3
- package/presets/claude/next/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/next/hooks/examples/README.md +2 -2
- package/presets/claude/next/hooks/guard-shell-command.mjs +94 -0
- package/presets/claude/next/hooks/run-hook.mjs +102 -0
- package/presets/claude/next/settings.json +2 -2
- package/presets/claude/next/team/README.md +23 -0
- package/presets/claude/next/team/upstream/config.json +31 -0
- package/presets/claude/next/team/upstream/digest-template.md +55 -0
- package/presets/claude/next/team/upstream/opencode.json +34 -0
- package/presets/claude/next/team/upstream/projects.json +4 -0
- package/presets/claude/next/team/upstream/prompt.md +77 -0
- package/presets/claude/next/team/upstream/signatures.json +9 -0
- package/presets/claude/nuxt/hooks/README.md +4 -3
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/nuxt/hooks/examples/README.md +2 -2
- package/presets/claude/{ios-swift/hooks/guard-shell-command.sh → nuxt/hooks/guard-shell-command.mjs} +29 -37
- package/presets/claude/nuxt/hooks/run-hook.mjs +102 -0
- package/presets/claude/nuxt/settings.json +2 -2
- package/presets/claude/nuxt/team/README.md +5 -0
- package/presets/claude/php-hexagonal/hooks/README.md +4 -3
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/php-hexagonal/hooks/examples/README.md +2 -2
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
- package/presets/claude/php-hexagonal/hooks/run-hook.mjs +102 -0
- package/presets/claude/php-hexagonal/settings.json +2 -2
- package/presets/claude/php-hexagonal/team/README.md +5 -0
- package/presets/claude/php-laravel/hooks/README.md +4 -3
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/php-laravel/hooks/examples/README.md +2 -2
- package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +96 -0
- package/presets/claude/php-laravel/hooks/run-hook.mjs +102 -0
- package/presets/claude/php-laravel/settings.json +2 -2
- package/presets/claude/php-laravel/team/README.md +5 -0
- package/presets/claude/svelte/hooks/README.md +4 -3
- package/presets/claude/svelte/hooks/chain-team-phases.sh +57 -3
- package/presets/claude/svelte/hooks/examples/README.md +2 -2
- package/presets/claude/svelte/hooks/guard-shell-command.mjs +94 -0
- package/presets/claude/svelte/hooks/run-hook.mjs +102 -0
- package/presets/claude/svelte/settings.json +2 -2
- package/presets/claude/svelte/team/README.md +5 -0
- package/presets/cursor/android-kotlin/hooks/README.md +2 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/android-kotlin/hooks/examples/README.md +1 -1
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +96 -0
- package/presets/cursor/android-kotlin/hooks/run-hook.mjs +102 -0
- package/presets/cursor/android-kotlin/hooks.json +2 -2
- package/presets/cursor/android-kotlin/team/README.md +5 -0
- package/presets/cursor/go/hooks/README.md +2 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/go/hooks/examples/README.md +1 -1
- package/presets/cursor/go/hooks/guard-shell-command.mjs +95 -0
- package/presets/cursor/go/hooks/run-hook.mjs +102 -0
- package/presets/cursor/go/hooks.json +2 -2
- package/presets/cursor/go/team/README.md +5 -0
- package/presets/cursor/ios-swift/hooks/README.md +2 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/ios-swift/hooks/examples/README.md +1 -1
- package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +95 -0
- package/presets/cursor/ios-swift/hooks/run-hook.mjs +102 -0
- package/presets/cursor/ios-swift/hooks.json +2 -2
- package/presets/cursor/ios-swift/team/README.md +5 -0
- package/presets/cursor/java/hooks/README.md +2 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/java/hooks/examples/README.md +1 -1
- package/presets/cursor/java/hooks/guard-shell-command.mjs +96 -0
- package/presets/cursor/java/hooks/run-hook.mjs +102 -0
- package/presets/cursor/java/hooks.json +2 -2
- package/presets/cursor/java/team/README.md +5 -0
- package/presets/cursor/mcp-ts/hooks/README.md +2 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +95 -0
- package/presets/cursor/mcp-ts/hooks/run-hook.mjs +102 -0
- package/presets/cursor/mcp-ts/hooks.json +2 -2
- package/presets/cursor/mcp-ts/team/README.md +5 -0
- package/presets/cursor/mol/hooks/README.md +2 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/mol/hooks/examples/README.md +1 -1
- package/presets/{claude/next/hooks/guard-shell-command.sh → cursor/mol/hooks/guard-shell-command.mjs} +29 -35
- package/presets/cursor/mol/hooks/run-hook.mjs +102 -0
- package/presets/cursor/mol/hooks.json +2 -2
- package/presets/cursor/mol/team/README.md +5 -0
- package/presets/cursor/next/agents/build-verifier.md +2 -0
- package/presets/cursor/next/agents/code-reviewer.md +2 -0
- package/presets/cursor/next/agents/feature-developer.md +1 -0
- package/presets/cursor/next/agents/task-analyst.md +4 -0
- package/presets/cursor/next/agents/task-router.md +5 -3
- package/presets/cursor/next/commands/README.md +1 -0
- package/presets/cursor/next/commands/task-continue.md +1 -1
- package/presets/cursor/next/commands/upstream-research.md +23 -0
- package/presets/cursor/next/hooks/README.md +2 -1
- package/presets/cursor/next/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/next/hooks/examples/README.md +1 -1
- package/presets/cursor/next/hooks/guard-shell-command.mjs +94 -0
- package/presets/cursor/next/hooks/run-hook.mjs +102 -0
- package/presets/cursor/next/hooks.json +2 -2
- package/presets/cursor/next/team/README.md +23 -0
- package/presets/cursor/next/team/upstream/config.json +31 -0
- package/presets/cursor/next/team/upstream/digest-template.md +55 -0
- package/presets/cursor/next/team/upstream/opencode.json +34 -0
- package/presets/cursor/next/team/upstream/projects.json +4 -0
- package/presets/cursor/next/team/upstream/prompt.md +77 -0
- package/presets/cursor/next/team/upstream/signatures.json +9 -0
- package/presets/cursor/nuxt/hooks/README.md +2 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/nuxt/hooks/examples/README.md +1 -1
- package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +94 -0
- package/presets/cursor/nuxt/hooks/run-hook.mjs +102 -0
- package/presets/cursor/nuxt/hooks.json +2 -2
- package/presets/cursor/nuxt/team/README.md +5 -0
- package/presets/cursor/php-hexagonal/hooks/README.md +2 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/php-hexagonal/hooks/examples/README.md +1 -1
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +96 -0
- package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +102 -0
- package/presets/cursor/php-hexagonal/hooks.json +2 -2
- package/presets/cursor/php-hexagonal/team/README.md +5 -0
- package/presets/cursor/php-laravel/hooks/README.md +2 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/php-laravel/hooks/examples/README.md +1 -1
- package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +96 -0
- package/presets/cursor/php-laravel/hooks/run-hook.mjs +102 -0
- package/presets/cursor/php-laravel/hooks.json +2 -2
- package/presets/cursor/php-laravel/team/README.md +5 -0
- package/presets/cursor/svelte/hooks/README.md +2 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +57 -3
- package/presets/cursor/svelte/hooks/examples/README.md +1 -1
- package/presets/cursor/svelte/hooks/guard-shell-command.mjs +94 -0
- package/presets/cursor/svelte/hooks/run-hook.mjs +102 -0
- package/presets/cursor/svelte/hooks.json +2 -2
- package/presets/cursor/svelte/team/README.md +5 -0
- package/presets/mavis/android-kotlin/adapter-map.json +11 -3
- package/presets/mavis/android-kotlin/hooks/README.md +2 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/android-kotlin/team/README.md +5 -0
- package/presets/mavis/go/adapter-map.json +11 -3
- package/presets/mavis/go/hooks/README.md +2 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/go/team/README.md +5 -0
- package/presets/mavis/ios-swift/adapter-map.json +11 -3
- package/presets/mavis/ios-swift/hooks/README.md +2 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/ios-swift/team/README.md +5 -0
- package/presets/mavis/java/adapter-map.json +11 -3
- package/presets/mavis/java/hooks/README.md +2 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/java/team/README.md +5 -0
- package/presets/mavis/mcp-ts/adapter-map.json +11 -3
- package/presets/mavis/mcp-ts/hooks/README.md +2 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/mcp-ts/team/README.md +5 -0
- package/presets/mavis/mol/adapter-map.json +11 -3
- package/presets/mavis/mol/hooks/README.md +2 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/mol/team/README.md +5 -0
- package/presets/mavis/next/adapter-map.json +67 -3
- package/presets/mavis/next/agents/build-verifier.md +2 -0
- package/presets/mavis/next/agents/code-reviewer.md +2 -0
- package/presets/mavis/next/agents/feature-developer.md +1 -0
- package/presets/mavis/next/agents/task-analyst.md +4 -0
- package/presets/mavis/next/agents/task-router.md +5 -3
- package/presets/mavis/next/commands/README.md +1 -0
- package/presets/mavis/next/commands/task-continue.md +1 -1
- package/presets/mavis/next/commands/upstream-research.md +18 -0
- package/presets/mavis/next/hooks/README.md +2 -1
- package/presets/mavis/next/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/next/team/README.md +23 -0
- package/presets/mavis/next/team/upstream/config.json +31 -0
- package/presets/mavis/next/team/upstream/digest-template.md +55 -0
- package/presets/mavis/next/team/upstream/opencode.json +34 -0
- package/presets/mavis/next/team/upstream/projects.json +4 -0
- package/presets/mavis/next/team/upstream/prompt.md +77 -0
- package/presets/mavis/next/team/upstream/signatures.json +9 -0
- package/presets/mavis/nuxt/adapter-map.json +11 -3
- package/presets/mavis/nuxt/hooks/README.md +2 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/nuxt/team/README.md +5 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +11 -3
- package/presets/mavis/php-hexagonal/hooks/README.md +2 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/php-hexagonal/team/README.md +5 -0
- package/presets/mavis/php-laravel/adapter-map.json +11 -3
- package/presets/mavis/php-laravel/hooks/README.md +2 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/php-laravel/team/README.md +5 -0
- package/presets/mavis/svelte/adapter-map.json +11 -3
- package/presets/mavis/svelte/hooks/README.md +2 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +57 -3
- package/presets/mavis/svelte/team/README.md +5 -0
- package/presets/opencode/android-kotlin/OPENCODE.md +1 -1
- package/presets/opencode/android-kotlin/README.md +1 -1
- package/presets/opencode/android-kotlin/adapter-map.json +11 -3
- package/presets/opencode/android-kotlin/hooks/README.md +3 -2
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/android-kotlin/team/README.md +5 -0
- package/presets/opencode/go/OPENCODE.md +1 -1
- package/presets/opencode/go/README.md +1 -1
- package/presets/opencode/go/adapter-map.json +11 -3
- package/presets/opencode/go/hooks/README.md +3 -2
- package/presets/opencode/go/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/go/team/README.md +5 -0
- package/presets/opencode/ios-swift/OPENCODE.md +1 -1
- package/presets/opencode/ios-swift/README.md +1 -1
- package/presets/opencode/ios-swift/adapter-map.json +11 -3
- package/presets/opencode/ios-swift/hooks/README.md +3 -2
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/ios-swift/team/README.md +5 -0
- package/presets/opencode/java/OPENCODE.md +1 -1
- package/presets/opencode/java/README.md +1 -1
- package/presets/opencode/java/adapter-map.json +11 -3
- package/presets/opencode/java/hooks/README.md +3 -2
- package/presets/opencode/java/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/java/team/README.md +5 -0
- package/presets/opencode/mcp-ts/OPENCODE.md +1 -1
- package/presets/opencode/mcp-ts/README.md +1 -1
- package/presets/opencode/mcp-ts/adapter-map.json +11 -3
- package/presets/opencode/mcp-ts/hooks/README.md +3 -2
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/mcp-ts/team/README.md +5 -0
- package/presets/opencode/mol/OPENCODE.md +1 -1
- package/presets/opencode/mol/README.md +1 -1
- package/presets/opencode/mol/adapter-map.json +11 -3
- package/presets/opencode/mol/hooks/README.md +3 -2
- package/presets/opencode/mol/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/mol/team/README.md +5 -0
- package/presets/opencode/next/OPENCODE.md +1 -1
- package/presets/opencode/next/README.md +1 -1
- package/presets/opencode/next/adapter-map.json +67 -3
- package/presets/opencode/next/agents/build-verifier.md +2 -0
- package/presets/opencode/next/agents/code-reviewer.md +2 -0
- package/presets/opencode/next/agents/feature-developer.md +1 -0
- package/presets/opencode/next/agents/task-analyst.md +4 -0
- package/presets/opencode/next/agents/task-router.md +5 -3
- package/presets/opencode/next/commands/README.md +1 -0
- package/presets/opencode/next/commands/task-continue.md +1 -1
- package/presets/opencode/next/commands/upstream-research.md +26 -0
- package/presets/opencode/next/hooks/README.md +3 -2
- package/presets/opencode/next/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/next/team/README.md +23 -0
- package/presets/opencode/next/team/upstream/config.json +31 -0
- package/presets/opencode/next/team/upstream/digest-template.md +55 -0
- package/presets/opencode/next/team/upstream/opencode.json +34 -0
- package/presets/opencode/next/team/upstream/projects.json +4 -0
- package/presets/opencode/next/team/upstream/prompt.md +77 -0
- package/presets/opencode/next/team/upstream/signatures.json +9 -0
- package/presets/opencode/nuxt/OPENCODE.md +1 -1
- package/presets/opencode/nuxt/README.md +1 -1
- package/presets/opencode/nuxt/adapter-map.json +11 -3
- package/presets/opencode/nuxt/hooks/README.md +3 -2
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/nuxt/team/README.md +5 -0
- package/presets/opencode/php-hexagonal/OPENCODE.md +1 -1
- package/presets/opencode/php-hexagonal/README.md +1 -1
- package/presets/opencode/php-hexagonal/adapter-map.json +11 -3
- package/presets/opencode/php-hexagonal/hooks/README.md +3 -2
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/php-hexagonal/team/README.md +5 -0
- package/presets/opencode/php-laravel/OPENCODE.md +1 -1
- package/presets/opencode/php-laravel/README.md +1 -1
- package/presets/opencode/php-laravel/adapter-map.json +11 -3
- package/presets/opencode/php-laravel/hooks/README.md +3 -2
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/php-laravel/team/README.md +5 -0
- package/presets/opencode/svelte/OPENCODE.md +1 -1
- package/presets/opencode/svelte/README.md +1 -1
- package/presets/opencode/svelte/adapter-map.json +11 -3
- package/presets/opencode/svelte/hooks/README.md +3 -2
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +57 -3
- package/presets/opencode/svelte/team/README.md +5 -0
- package/presets/zcode/android-kotlin/adapter-map.json +11 -3
- package/presets/zcode/android-kotlin/hooks/README.md +2 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/android-kotlin/team/README.md +5 -0
- package/presets/zcode/go/adapter-map.json +11 -3
- package/presets/zcode/go/hooks/README.md +2 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/go/team/README.md +5 -0
- package/presets/zcode/ios-swift/adapter-map.json +11 -3
- package/presets/zcode/ios-swift/hooks/README.md +2 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/ios-swift/team/README.md +5 -0
- package/presets/zcode/java/adapter-map.json +11 -3
- package/presets/zcode/java/hooks/README.md +2 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/java/team/README.md +5 -0
- package/presets/zcode/mcp-ts/adapter-map.json +11 -3
- package/presets/zcode/mcp-ts/hooks/README.md +2 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/mcp-ts/team/README.md +5 -0
- package/presets/zcode/mol/adapter-map.json +11 -3
- package/presets/zcode/mol/hooks/README.md +2 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/mol/team/README.md +5 -0
- package/presets/zcode/next/adapter-map.json +67 -3
- package/presets/zcode/next/agents/build-verifier.md +2 -0
- package/presets/zcode/next/agents/code-reviewer.md +2 -0
- package/presets/zcode/next/agents/feature-developer.md +1 -0
- package/presets/zcode/next/agents/task-analyst.md +4 -0
- package/presets/zcode/next/agents/task-router.md +5 -3
- package/presets/zcode/next/commands/README.md +1 -0
- package/presets/zcode/next/commands/task-continue.md +1 -1
- package/presets/zcode/next/commands/upstream-research.md +26 -0
- package/presets/zcode/next/hooks/README.md +2 -1
- package/presets/zcode/next/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/next/team/README.md +23 -0
- package/presets/zcode/next/team/upstream/config.json +31 -0
- package/presets/zcode/next/team/upstream/digest-template.md +55 -0
- package/presets/zcode/next/team/upstream/opencode.json +34 -0
- package/presets/zcode/next/team/upstream/projects.json +4 -0
- package/presets/zcode/next/team/upstream/prompt.md +77 -0
- package/presets/zcode/next/team/upstream/signatures.json +9 -0
- package/presets/zcode/nuxt/adapter-map.json +11 -3
- package/presets/zcode/nuxt/hooks/README.md +2 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/nuxt/team/README.md +5 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +11 -3
- package/presets/zcode/php-hexagonal/hooks/README.md +2 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/php-hexagonal/team/README.md +5 -0
- package/presets/zcode/php-laravel/adapter-map.json +11 -3
- package/presets/zcode/php-laravel/hooks/README.md +2 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/php-laravel/team/README.md +5 -0
- package/presets/zcode/svelte/adapter-map.json +11 -3
- package/presets/zcode/svelte/hooks/README.md +2 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +57 -3
- package/presets/zcode/svelte/team/README.md +5 -0
- package/presets/claude/android-kotlin/hooks/guard-shell-command.sh +0 -103
- package/presets/claude/go/hooks/guard-shell-command.sh +0 -102
- package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +0 -102
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.sh +0 -103
- package/presets/claude/php-laravel/hooks/guard-shell-command.sh +0 -103
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.sh +0 -80
- package/presets/cursor/go/hooks/guard-shell-command.sh +0 -79
- package/presets/cursor/ios-swift/hooks/guard-shell-command.sh +0 -79
- package/presets/cursor/java/hooks/guard-shell-command.sh +0 -80
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +0 -79
- package/presets/cursor/mol/hooks/guard-shell-command.sh +0 -77
- package/presets/cursor/next/hooks/guard-shell-command.sh +0 -77
- package/presets/cursor/nuxt/hooks/guard-shell-command.sh +0 -77
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.sh +0 -80
- package/presets/cursor/php-laravel/hooks/guard-shell-command.sh +0 -80
- package/presets/cursor/svelte/hooks/guard-shell-command.sh +0 -77
package/docs/TEAM-DB.md
CHANGED
|
@@ -4,16 +4,17 @@
|
|
|
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 seven 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` |
|
|
11
|
+
| `team-db.mjs` | CLI: `init`, `sync`, `delete`, `migrate-tasks`, `check`, `serve`, `jobs`, `schedule` |
|
|
12
12
|
| `team-db-schema.mjs` | capability probe, embedded migrations, pragmas, fingerprint, integrity |
|
|
13
13
|
| `team-db-project.mjs` | parsers, idempotent projector, confirmed task deletion, retention, search |
|
|
14
|
-
| `team-db-api.mjs` | `node:http` server (reads plus
|
|
14
|
+
| `team-db-api.mjs` | `node:http` server (reads plus the bounded mutations), query layer, security boundary |
|
|
15
15
|
| `team-db-openapi.mjs` | the OpenAPI 3.1 document source |
|
|
16
16
|
| `team-db-dashboard.mjs` | the no-build dashboard (HTML, CSS, JS strings) |
|
|
17
|
+
| `team-db-scheduler.mjs` | job model, cron/interval math, the file store, the projection, and the timer |
|
|
17
18
|
|
|
18
19
|
## Behavior contract
|
|
19
20
|
|
|
@@ -27,11 +28,17 @@ The projection is installed by `init` as six modules under `.ai.local/scripts/`:
|
|
|
27
28
|
one line to `team-db-errors.log` on failure; the confirmed task delete runs its own
|
|
28
29
|
bounded child (30 s, `SIGKILL`), and its failure reaches the caller through the one error
|
|
29
30
|
envelope, or one stderr line on the CLI.
|
|
30
|
-
- **
|
|
31
|
-
/api/v1/tasks/{slug}` deletes one confirmed task (the folder first, then the rows)
|
|
32
|
-
other route is `GET`/`HEAD
|
|
33
|
-
|
|
34
|
-
child is spawned.
|
|
31
|
+
- **Bounded mutations.** `POST /api/v1/sync` re-runs the projector and `DELETE
|
|
32
|
+
/api/v1/tasks/{slug}` deletes one confirmed task (the folder first, then the rows); every
|
|
33
|
+
other route is `GET`/`HEAD` apart from the four job writes. Each mutation runs as an
|
|
34
|
+
asynchronous child process — the server never opens a writable connection, and the kill
|
|
35
|
+
switch answers before a child is spawned. Job writes carry `application/json` and at most
|
|
36
|
+
64 KiB, run-now an absent body or `{}`. The rescan and delete children are bounded at 30 s,
|
|
37
|
+
a job write or run-now at 10 s. There is no write-back, no telemetry, and no outbound call.
|
|
38
|
+
- **The scheduler writes files before rows.** `scheduler/jobs.json` is the definition of
|
|
39
|
+
record, `scheduler/runs/**` and `scheduler/state.json` are its runtime state, and the three
|
|
40
|
+
`scheduled_jobs` / `job_runs` / `job_run_events` tables are projections of those files. The
|
|
41
|
+
scheduler never writes `status.json`, `metrics.json`, or a receipt.
|
|
35
42
|
- **Local only.** The server binds loopback by default, checks `Host` and `Origin`, sends no
|
|
36
43
|
CORS header, and serves raw documents from SQLite by exact `(slug, path)` lookup.
|
|
37
44
|
|
|
@@ -45,9 +52,12 @@ team.db
|
|
|
45
52
|
team.db-wal
|
|
46
53
|
team.db-shm
|
|
47
54
|
team-db-errors.log
|
|
55
|
+
team/scheduler/runs/
|
|
56
|
+
team/scheduler/state.json
|
|
48
57
|
```
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
`team/scheduler/jobs.json` stays tracked: definitions are code, run output is not. The
|
|
60
|
+
consumer root `.gitignore` is never created or edited. Never commit the database even
|
|
51
61
|
for a demo: it contains copies of prompts and task documents.
|
|
52
62
|
|
|
53
63
|
## Node floor
|
|
@@ -56,7 +66,8 @@ The floor is Node 22.13.0. `node:sqlite` was unflagged in that release
|
|
|
56
66
|
([Node.js 22.13.0 release notes](https://nodejs.org/en/blog/release/v22.13.0), commit
|
|
57
67
|
`55239a48b6`, PR [#55890](https://github.com/nodejs/node/pull/55890)); the module is still
|
|
58
68
|
marked experimental. `MIN_NODE = '22.13.0'` in `team-db-schema.mjs` is the code constant
|
|
59
|
-
behind this sentence
|
|
69
|
+
behind this sentence. `engines` in `package.json` is the package runtime contract and is not
|
|
70
|
+
the SQLite floor; a runtime below `MIN_NODE`, or one without `node:sqlite`, stays file-only.
|
|
60
71
|
|
|
61
72
|
Measured surface: Node 24.21.0 with SQLite 3.54.1 (`DatabaseSync`, prepared statements,
|
|
62
73
|
`PRAGMA`, WAL, FTS5); re-verified on Node 26.13.0 / SQLite 3.54.1 for this release. A runtime
|
|
@@ -70,6 +81,15 @@ below the floor, or a build without `node:sqlite`, is detected at runtime:
|
|
|
70
81
|
| `team-db.mjs check` | one line, exit 1 | one line, exit 1 |
|
|
71
82
|
| `team-db.mjs delete` | one line, exit 2 | one line, exit 1 |
|
|
72
83
|
| `team-db.mjs serve` | one line, exit 0 | one line, exit 0 |
|
|
84
|
+
| `team-db.mjs jobs list\|get` | exit 0, file-only | exit 0, file-only |
|
|
85
|
+
| `team-db.mjs jobs put\|delete\|run\|enable\|disable` | exit 0, file-only, no row | exit 1, no write |
|
|
86
|
+
| `team-db.mjs jobs reconcile` | exit 0 | exit 0, no row written |
|
|
87
|
+
| `team-db.mjs schedule` | exit 0, no file | exit 0, no claim |
|
|
88
|
+
|
|
89
|
+
The scheduler reads a job's IANA zone through `Intl.DateTimeFormat`. On a build with small ICU
|
|
90
|
+
(`--with-intl=small-icu`) every zone name resolves, so a zone that needs full ICU data is
|
|
91
|
+
treated as UTC instead of being refused. The runtime stays supported and the projection still
|
|
92
|
+
works; check a job's next fire on such a build before trusting it.
|
|
73
93
|
|
|
74
94
|
The file-only pipeline is unchanged: `status.json` / `metrics.json` writes, manifest upserts,
|
|
75
95
|
and the pipeline run with exit 0.
|
|
@@ -87,6 +107,15 @@ node .ai.local/scripts/team-db.mjs migrate-tasks [--root <team-dir>] [--quiet] [
|
|
|
87
107
|
node .ai.local/scripts/team-db.mjs check [--root <team-dir>]
|
|
88
108
|
node .ai.local/scripts/team-db.mjs serve [--root <team-dir>] [--host <addr>] [--port <n>]
|
|
89
109
|
[--allow-remote] [--open]
|
|
110
|
+
node .ai.local/scripts/team-db.mjs jobs list [--enabled] [--sort <key>] [--json] [--quiet]
|
|
111
|
+
node .ai.local/scripts/team-db.mjs jobs get <id> [--json]
|
|
112
|
+
node .ai.local/scripts/team-db.mjs jobs put --file <path|-> [--dry-run] [--json]
|
|
113
|
+
node .ai.local/scripts/team-db.mjs jobs delete <id> [--keep-runs] [--json]
|
|
114
|
+
node .ai.local/scripts/team-db.mjs jobs enable|disable <id> [--json]
|
|
115
|
+
node .ai.local/scripts/team-db.mjs jobs reconcile [--json]
|
|
116
|
+
node .ai.local/scripts/team-db.mjs jobs run --id <id> [--json]
|
|
117
|
+
node .ai.local/scripts/team-db.mjs schedule [--once] [--interval-ms <n>] [--grace-ms <n>]
|
|
118
|
+
[--drain-ms <n>] [--json] [--quiet]
|
|
90
119
|
```
|
|
91
120
|
|
|
92
121
|
Exit codes: `0` ok, `1` at least one task failed, a delete refusal (unknown slug, active
|
|
@@ -140,6 +169,119 @@ No other environment value is read or persisted. The error log stores a timestam
|
|
|
140
169
|
a phase, and a message; it never stores prompt content or an environment value, and it is
|
|
141
170
|
trimmed to the newest 200 lines / 64 KiB.
|
|
142
171
|
|
|
172
|
+
## Scheduled jobs
|
|
173
|
+
|
|
174
|
+
`scheduler/jobs.json` holds the definitions, sorted by `id` and rewritten atomically; it is
|
|
175
|
+
meant to be **committed** ("jobs as code"), while run output and runtime state are ignored
|
|
176
|
+
(§ Location and ignore rules). A job carries `id`, `title`, `enabled`, a `schedule` (`cron`
|
|
177
|
+
five-field expression or `interval` with `everySeconds`), the IANA `timezone`, a `payload`,
|
|
178
|
+
`cwd`, `envPassthrough` (names only), `timeoutMs` (1 s – 12 h, default 15 min), `concurrency`
|
|
179
|
+
(`skip` / `queue` / `allow`), and `misfire` (`skip` / `run-once` / `catch-up`). The id is
|
|
180
|
+
immutable; a stale `revision` is `409 E_CONFLICT`.
|
|
181
|
+
|
|
182
|
+
**Payload kinds.** `command` runs `payload.argv` directly — `spawn(argv[0], argv.slice(1),
|
|
183
|
+
{ shell: false })`, never a shell string. `pipeline` lowers the same call after rendering
|
|
184
|
+
`payload.promptTemplate` into `<runDir>/prompt.md` (placeholders `{{job.id}}`, `{{run.id}}`,
|
|
185
|
+
`{{run.dir}}`, `{{team.root}}`, `{{now}}`) and substituting `{promptFile}` in
|
|
186
|
+
`payload.runner`. A `pipeline` job without `runner` is refused at validation; there is no
|
|
187
|
+
bundled agent runtime. The child environment is `PATH`, `HOME`, `TMPDIR`, `LANG`, `TZ` plus
|
|
188
|
+
the `envPassthrough` names; no `AI_RULES_TEAM_DB_*` value is forwarded, and `TZ` is the job's
|
|
189
|
+
timezone.
|
|
190
|
+
|
|
191
|
+
**Runs.** One tick claims each due occurrence inside `BEGIN IMMEDIATE` against `job_runs`, so
|
|
192
|
+
two racing firings produce one child and one `skipped` row. Children are spawned detached in
|
|
193
|
+
their own process group and bounded by `timeoutMs`: `SIGTERM`, a 5 s grace, then `SIGKILL` to
|
|
194
|
+
the group. `stdout` and `stderr` land in separate files capped at 1 MiB, the run manifest
|
|
195
|
+
carries the byte count, sha256, and truncation flag, and a run's state is one of `claimed`,
|
|
196
|
+
`running`, `succeeded`, `failed`, `timeout`, `skipped`, `interrupted`. The recorded sha256
|
|
197
|
+
covers exactly the capped bytes; the truncation marker is appended outside that scope, so a
|
|
198
|
+
capped stream projects clean instead of reporting `E_LOG_HASH`. A run-now request is durable:
|
|
199
|
+
`jobs run` appends it to `state.json`, the live timer re-reads and merges the queue at every
|
|
200
|
+
tick, and a request leaves the queue only when its run is claimed.
|
|
201
|
+
|
|
202
|
+
**Retention.** 1 MiB per stream per run, 200 runs per job, 30 days, and 2 GiB per team root,
|
|
203
|
+
enforced before the next write; an active run is never pruned, and a pruned run directory
|
|
204
|
+
takes its `job_runs` row with it. `state.json` keeps the last fire instant per job, which is
|
|
205
|
+
what makes `run-once` and `catch-up` survive downtime. `catch-up` replays at most five
|
|
206
|
+
occurrences per gap; when more were due, the replay is marked truncated (`catchUp.truncated`
|
|
207
|
+
on the manifest and an `E_CATCH_UP_TRUNCATED` event) and the remainder is dropped instead of
|
|
208
|
+
replaying five more on the next tick. A candidate fire must be later than the recorded one, so
|
|
209
|
+
a clock jump backwards never re-fires.
|
|
210
|
+
|
|
211
|
+
**There is no redaction.** A child's output is persisted verbatim in
|
|
212
|
+
`.ai.local/team/scheduler/runs/<jobId>/<runId>/`. Treat a job's output as secret-bearing: it
|
|
213
|
+
inherits the operator's environment through `envPassthrough`, the run directory is git-ignored
|
|
214
|
+
by the rule above, and retention bounds how long it is kept. `envPassthrough` carries names,
|
|
215
|
+
so `jobs.json` never holds a value.
|
|
216
|
+
|
|
217
|
+
**Recovery.** One scheduler per team root: the lease file `scheduler/scheduler.lock` refuses a
|
|
218
|
+
second `schedule` with exit 4, and a lease older than 90 s is stale, never deleted. A
|
|
219
|
+
`claimed`/`running` run whose process is gone is orphaned by definition: the next `schedule`
|
|
220
|
+
reconciles it before the first fire, and `jobs reconcile` does the same on demand — the
|
|
221
|
+
manifest and the row become `interrupted` with reason `E_ORPHANED`. `sync --rebuild` and
|
|
222
|
+
`sync --vacuum` refuse with `E_SCHEDULER_RUNNING` (exit 4) while a fresh lease exists. That
|
|
223
|
+
guard covers the explicit destructive flags only: a plain `init` or `sync` opens writable, and
|
|
224
|
+
a database whose recorded schema fingerprint no longer matches is moved aside as
|
|
225
|
+
`team.db.mismatch-<stamp>` and rebuilt (see § Schema) even while a scheduler holds the lease.
|
|
226
|
+
Stop the scheduler before any schema upgrade; the explicit flags are a backstop, not a
|
|
227
|
+
complete guard. The kill switch drains: no new claim, the in-flight child finishes inside its
|
|
228
|
+
own timeout, the result is recorded, exit 0. Supervision (launchd, systemd, Task Scheduler) is
|
|
229
|
+
documented practice, never shipped as a second timer, and Windows process-group termination is
|
|
230
|
+
not supported in v1.
|
|
231
|
+
|
|
232
|
+
## Upstream research job
|
|
233
|
+
|
|
234
|
+
The `next` preset ships one `pipeline` job, `upstream-research`, and one engine module,
|
|
235
|
+
`.ai.local/scripts/upstream-research.mjs`. The job renders `upstream/prompt.md` and runs the
|
|
236
|
+
module with `--prompt {promptFile} --team-root . --repo-root ../..`; it is a normal
|
|
237
|
+
definition in `scheduler/jobs.json`, so `jobs list|get|put|enable|disable|run`, the dashboard
|
|
238
|
+
Jobs tab, and every job route work unchanged.
|
|
239
|
+
|
|
240
|
+
**Supervision.** `misfire: run-once` fires one missed Monday at the next tick, and
|
|
241
|
+
`concurrency: skip` consumes and drops a manual request while a weekly run is live (the drop
|
|
242
|
+
is a `skipped` row with `E_CONCURRENCY_SKIP`). `jobs run` is durable: a request executes only
|
|
243
|
+
when a `schedule` tick claims it. Keep one supervisor (`launchd`, `systemd`, Task Scheduler)
|
|
244
|
+
running `node .ai.local/scripts/team-db.mjs schedule`; without one, `/upstream-research` adds
|
|
245
|
+
one `schedule --once` tick.
|
|
246
|
+
|
|
247
|
+
**Cursor.** Per-project scan state lives in the git-ignored
|
|
248
|
+
`.ai.local/team/upstream/cursor.json`. A lost cursor is rebuilt from the newest
|
|
249
|
+
`scheduler/runs/upstream-research/<runId>/report.json`, then degrades to a bounded baseline
|
|
250
|
+
when the run tree has been pruned. `upstream/projects.json`, `config.json`, `signatures.json`,
|
|
251
|
+
the prompt, the digest template, and the agent config are committed; `docs/upstream/digest-
|
|
252
|
+
<runId>.md` is committed and never pruned.
|
|
253
|
+
|
|
254
|
+
**Write allow-list.** A run writes only `scheduler/runs/upstream-research/<runId>/**`, the
|
|
255
|
+
cursor, and the committed digest. It never writes `status.json` or `metrics.json`, and the
|
|
256
|
+
scheduler keeps owning `run.json`, `stdout.log`, `stderr.log`, and `<runDir>/prompt.md`.
|
|
257
|
+
|
|
258
|
+
**Failure surface.** The scheduler's reason codes are a closed set, so a runner code such as
|
|
259
|
+
`E_OPENCODE_MISSING` lives in `report.json`, `stderr.log`, and the digest header; the job row
|
|
260
|
+
reports `E_EXIT_10` / `E_EXIT_11` / `E_EXIT_12` / `E_EXIT_13` / `E_EXIT_15` / `E_EXIT_16`.
|
|
261
|
+
`E_AGENT_CONFIG_INVALID` (12) means the resolved `upstream-researcher` no longer denies
|
|
262
|
+
every tool (the global `*` or a named action); reinstall `team/upstream/opencode.json` with
|
|
263
|
+
`init`/`update`.
|
|
264
|
+
|
|
265
|
+
**Commands.** Validate the registry with
|
|
266
|
+
`node .ai.local/scripts/upstream-research.mjs registry --check --team-root .`; refresh the
|
|
267
|
+
durable prior-art index with `signatures --write` (`--check` reports drift and writes
|
|
268
|
+
nothing). Adding a comparison project is one registry object plus a commit — no scheduler,
|
|
269
|
+
prompt, or code change.
|
|
270
|
+
|
|
271
|
+
**Model route.** `upstream/config.json` `agent.model` is `null` by default, so the agent runs
|
|
272
|
+
on whatever model the installed `opencode` resolves; set it to a `provider/model` id to pin
|
|
273
|
+
the route, which adds `--model` to the call with no code change.
|
|
274
|
+
|
|
275
|
+
## Upgrading an installed engine set
|
|
276
|
+
|
|
277
|
+
`update --fix` rewrites a seeded module only when its bytes still equal the digest recorded in
|
|
278
|
+
`.ai.local/.template-base.json`; the previous bytes go to `.ai.local/.rollback/engine-<stamp>/`
|
|
279
|
+
(the newest five runs are kept). `update --check` is the dry run: it names each eligible rel
|
|
280
|
+
and writes nothing. A module whose bytes differ from the recorded base is reported
|
|
281
|
+
`kept modified` and stays byte-identical — review the diff and delete the module to let the
|
|
282
|
+
next `update` seed it again. A module with no recorded base is `unattributable` and is never
|
|
283
|
+
written; delete it and re-run `init`. `doctor --fix` runs the same plan and writer.
|
|
284
|
+
|
|
143
285
|
## Schema
|
|
144
286
|
|
|
145
287
|
One embedded migration (`0001-init`, sha256-pinned) creates 15 row tables: `schema_migrations`,
|
|
@@ -148,6 +290,14 @@ One embedded migration (`0001-init`, sha256-pinned) creates 15 row tables: `sche
|
|
|
148
290
|
`sync_runs`; 19 indexes; and the `attempt_timeline` view. FTS5 (`search_fts`) is a runtime
|
|
149
291
|
capability created after migration, with an escaped `LIKE` fallback.
|
|
150
292
|
|
|
293
|
+
Migration `0002-scheduler` adds the scheduler's three tables — `scheduled_jobs`, `job_runs`,
|
|
294
|
+
`job_run_events` — and five indexes, and moves `SCHEMA_VERSION` to 2. It is additive and
|
|
295
|
+
sha256-pinned like the first one: a tampered literal aborts with `E_MIGRATION_CHECKSUM` before
|
|
296
|
+
any DDL. A v1 database is not read forward: its recorded fingerprint no longer describes the
|
|
297
|
+
schema, so the next open moves the file aside as `team.db.mismatch-<stamp>`, rebuilds, and
|
|
298
|
+
reprojects from the task files — database-only rows are discarded by design, which is why the
|
|
299
|
+
files are the source of truth. Run `sync` after an upgrade and the counters reconverge.
|
|
300
|
+
|
|
151
301
|
Each connection sets `journal_mode=WAL`, `busy_timeout=5000`, `foreign_keys=ON`, and
|
|
152
302
|
`synchronous=NORMAL`. One task is projected in one transaction; a `SIGKILL` mid-sync
|
|
153
303
|
rolls back the in-flight task and leaves `integrity_check` `ok`.
|
|
@@ -211,8 +361,11 @@ Security boundary: loopback bind by default (`--host` outside loopback needs
|
|
|
211
361
|
`--allow-remote`, and a wildcard address is refused), exact `Host`/`Origin` allow-list,
|
|
212
362
|
no `Access-Control-*` header, hardened response headers, request bodies bounded at 1 KiB,
|
|
213
363
|
document chunks at 1 MiB, exports at 5 MiB, parameterized SQL only, and no outbound call.
|
|
214
|
-
`--allow-remote` also exposes the
|
|
215
|
-
|
|
364
|
+
`--allow-remote` also exposes the four job mutations — `POST /api/v1/jobs`,
|
|
365
|
+
`PUT /api/v1/jobs/{id}`, `DELETE /api/v1/jobs/{id}`, and `POST /api/v1/jobs/{id}/run` —
|
|
366
|
+
the confirmed task delete and the rescan to the named interface without authentication.
|
|
367
|
+
A job definition carries arbitrary `argv` and run-now enqueues it, so that surface
|
|
368
|
+
executes operator-supplied commands as the API user; see `## Scheduled jobs`.
|
|
216
369
|
|
|
217
370
|
## Privacy and retention
|
|
218
371
|
|
|
@@ -221,16 +374,27 @@ and readable by the same OS user who can read the task folder; that is the trust
|
|
|
221
374
|
There is no upload, telemetry, or remote asset. `sync --maintain` nulls raw document content
|
|
222
375
|
for tasks absent longer than 90 days while keeping normalized rows and hashes.
|
|
223
376
|
|
|
377
|
+
Run output crosses the same boundary and is **not** redacted: `scheduler/runs/**` holds a
|
|
378
|
+
child's `stdout` and `stderr` verbatim, a job inherits the listed `envPassthrough` names, and
|
|
379
|
+
only the retention caps bound how long the bytes stay on disk.
|
|
380
|
+
|
|
224
381
|
## Rollback
|
|
225
382
|
|
|
226
383
|
1. Set `AI_RULES_TEAM_DB_DISABLE=1`. Every write point becomes a no-op: the hook,
|
|
227
|
-
`manifest.mjs`, `init`/`sync`/`migrate-tasks` and `serve` exit 0; `
|
|
228
|
-
exit 1 and
|
|
229
|
-
2.
|
|
230
|
-
|
|
231
|
-
|
|
384
|
+
`manifest.mjs`, `init`/`sync`/`migrate-tasks` and `serve` exit 0; `jobs` writes and
|
|
385
|
+
`delete` refuse with exit 1; `schedule` starts no claim and exits 0.
|
|
386
|
+
2. Stop the scheduler: send `SIGTERM` to the `schedule` process and let its in-flight run
|
|
387
|
+
finish, or let `--once` return. The lease is released on a clean exit; a lease left by a
|
|
388
|
+
killed process goes stale after 90 s, and `jobs reconcile` marks its runs `interrupted`.
|
|
389
|
+
3. Delete the projection: `rm -rf .ai.local/team/team.db .ai.local/team/team.db-wal
|
|
390
|
+
.ai.local/team/team.db-shm .ai.local/team/team-db-errors.log
|
|
391
|
+
.ai.local/team/scheduler/runs .ai.local/team/scheduler/state.json`. `scheduler/jobs.json`
|
|
392
|
+
is a definition file — keep it unless you are removing the feature. No task file is touched.
|
|
393
|
+
4. Revert the code: remove the hook region and the `projectAfterReceipt` call, delete the seven
|
|
232
394
|
modules from `ENGINE_SCRIPTS`, then run `yarn fix:generated` and recapture the goldens.
|
|
233
|
-
|
|
395
|
+
`update --fix` restores a module whose bytes still match the recorded base; `cp -R
|
|
396
|
+
.ai.local/.rollback/engine-<stamp>/.ai.local .` restores a whole previous set.
|
|
397
|
+
5. The ADR stays as history: mark it superseded instead of deleting it.
|
|
234
398
|
|
|
235
399
|
## Gates
|
|
236
400
|
|
|
@@ -246,6 +410,7 @@ node scripts/test-team-db-api.mjs
|
|
|
246
410
|
node scripts/test-team-db-security.mjs
|
|
247
411
|
node scripts/test-team-db-dashboard.mjs
|
|
248
412
|
node scripts/test-team-db-concurrency.mjs
|
|
413
|
+
node scripts/test-team-db-scheduler.mjs
|
|
249
414
|
node scripts/test-team-db-fixtures.mjs
|
|
250
415
|
```
|
|
251
416
|
|
|
@@ -253,5 +418,7 @@ node scripts/test-team-db-fixtures.mjs
|
|
|
253
418
|
planted defect, not only on the happy path.
|
|
254
419
|
|
|
255
420
|
Links: [`../README.md`](../README.md), [`PRESET-CONTRIBUTION.md`](PRESET-CONTRIBUTION.md),
|
|
256
|
-
the OpenSpec
|
|
257
|
-
|
|
421
|
+
the OpenSpec changes `openspec/changes/2026-11-06-agent-team-sqlite-dashboard/` and
|
|
422
|
+
`openspec/changes/2026-11-10-preset-task-scheduler-impl/`, and ADRs
|
|
423
|
+
`.ai.local/adr/0004-team-db-projection.md` and `.ai.local/adr/0005-team-db-scheduler.md` in
|
|
424
|
+
this repository.
|