@bonesofspring/ai-rules 0.2.78 → 0.2.80
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 +47 -0
- package/README.md +4 -2
- package/bin/lib/engine-scripts.js +6 -0
- package/bin/lib/seed-ai-local-team.js +2 -0
- package/docs/TEAM-DB.md +118 -15
- package/docs/openapi/team-db.v1.json +2879 -1858
- package/package.json +5 -1
- package/presets/_shared/ai-local/scripts/check-task-repositories.mjs +264 -0
- package/presets/_shared/ai-local/scripts/rr-migrate-repositories.mjs +481 -0
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +211 -12
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +289 -3
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +857 -1
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +68 -0
- package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +29 -10
- package/presets/_shared/ai-local/scripts/team-db.mjs +46 -1
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +69 -1
- package/presets/claude/android-kotlin/agents/task-router.md +2 -0
- package/presets/claude/android-kotlin/commands/README.md +1 -0
- package/presets/claude/android-kotlin/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/android-kotlin/commands/task.md +4 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/go/agents/task-router.md +2 -0
- package/presets/claude/go/commands/README.md +1 -0
- package/presets/claude/go/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/go/commands/task.md +4 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/ios-swift/agents/task-router.md +2 -0
- package/presets/claude/ios-swift/commands/README.md +1 -0
- package/presets/claude/ios-swift/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/ios-swift/commands/task.md +4 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/java/agents/task-router.md +2 -0
- package/presets/claude/java/commands/README.md +1 -0
- package/presets/claude/java/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/java/commands/task.md +4 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/mcp-ts/agents/task-router.md +2 -0
- package/presets/claude/mcp-ts/commands/README.md +1 -0
- package/presets/claude/mcp-ts/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/mcp-ts/commands/task.md +4 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/mol/agents/task-router.md +2 -0
- package/presets/claude/mol/commands/README.md +1 -0
- package/presets/claude/mol/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/mol/commands/task.md +4 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/next/agents/task-router.md +2 -0
- package/presets/claude/next/commands/README.md +1 -0
- package/presets/claude/next/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/next/commands/task.md +4 -0
- package/presets/claude/next/commands/ui-start.md +12 -4
- package/presets/claude/next/commands/ui-stop.md +5 -2
- package/presets/claude/next/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/nuxt/agents/task-router.md +2 -0
- package/presets/claude/nuxt/commands/README.md +1 -0
- package/presets/claude/nuxt/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/nuxt/commands/task.md +4 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/php-hexagonal/agents/task-router.md +2 -0
- package/presets/claude/php-hexagonal/commands/README.md +1 -0
- package/presets/claude/php-hexagonal/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/php-hexagonal/commands/task.md +4 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/php-laravel/agents/task-router.md +2 -0
- package/presets/claude/php-laravel/commands/README.md +1 -0
- package/presets/claude/php-laravel/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/php-laravel/commands/task.md +4 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +69 -1
- package/presets/claude/svelte/agents/task-router.md +2 -0
- package/presets/claude/svelte/commands/README.md +1 -0
- package/presets/claude/svelte/commands/rr-migrate-repositories.md +59 -0
- package/presets/claude/svelte/commands/task.md +4 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/android-kotlin/agents/task-router.md +2 -0
- package/presets/cursor/android-kotlin/commands/README.md +1 -0
- package/presets/cursor/android-kotlin/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/android-kotlin/commands/task.md +4 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/go/agents/task-router.md +2 -0
- package/presets/cursor/go/commands/README.md +1 -0
- package/presets/cursor/go/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/go/commands/task.md +4 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/ios-swift/agents/task-router.md +2 -0
- package/presets/cursor/ios-swift/commands/README.md +1 -0
- package/presets/cursor/ios-swift/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/ios-swift/commands/task.md +4 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/java/agents/task-router.md +2 -0
- package/presets/cursor/java/commands/README.md +1 -0
- package/presets/cursor/java/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/java/commands/task.md +4 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/mcp-ts/agents/task-router.md +2 -0
- package/presets/cursor/mcp-ts/commands/README.md +1 -0
- package/presets/cursor/mcp-ts/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/mcp-ts/commands/task.md +4 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/mol/agents/task-router.md +2 -0
- package/presets/cursor/mol/commands/README.md +1 -0
- package/presets/cursor/mol/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/mol/commands/task.md +4 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/next/agents/task-router.md +2 -0
- package/presets/cursor/next/commands/README.md +1 -0
- package/presets/cursor/next/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/next/commands/task.md +4 -0
- package/presets/cursor/next/commands/ui-start.md +12 -4
- package/presets/cursor/next/commands/ui-stop.md +5 -2
- package/presets/cursor/next/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/nuxt/agents/task-router.md +2 -0
- package/presets/cursor/nuxt/commands/README.md +1 -0
- package/presets/cursor/nuxt/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/nuxt/commands/task.md +4 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/php-hexagonal/agents/task-router.md +2 -0
- package/presets/cursor/php-hexagonal/commands/README.md +1 -0
- package/presets/cursor/php-hexagonal/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/php-hexagonal/commands/task.md +4 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/php-laravel/agents/task-router.md +2 -0
- package/presets/cursor/php-laravel/commands/README.md +1 -0
- package/presets/cursor/php-laravel/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/php-laravel/commands/task.md +4 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +69 -1
- package/presets/cursor/svelte/agents/task-router.md +2 -0
- package/presets/cursor/svelte/commands/README.md +1 -0
- package/presets/cursor/svelte/commands/rr-migrate-repositories.md +59 -0
- package/presets/cursor/svelte/commands/task.md +4 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/android-kotlin/adapter-map.json +9 -1
- package/presets/mavis/android-kotlin/agents/task-router.md +2 -0
- package/presets/mavis/android-kotlin/commands/README.md +1 -0
- package/presets/mavis/android-kotlin/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/android-kotlin/commands/task.md +4 -0
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/go/adapter-map.json +9 -1
- package/presets/mavis/go/agents/task-router.md +2 -0
- package/presets/mavis/go/commands/README.md +1 -0
- package/presets/mavis/go/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/go/commands/task.md +4 -0
- package/presets/mavis/go/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/ios-swift/adapter-map.json +9 -1
- package/presets/mavis/ios-swift/agents/task-router.md +2 -0
- package/presets/mavis/ios-swift/commands/README.md +1 -0
- package/presets/mavis/ios-swift/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/ios-swift/commands/task.md +4 -0
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/java/adapter-map.json +9 -1
- package/presets/mavis/java/agents/task-router.md +2 -0
- package/presets/mavis/java/commands/README.md +1 -0
- package/presets/mavis/java/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/java/commands/task.md +4 -0
- package/presets/mavis/java/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/mcp-ts/adapter-map.json +9 -1
- package/presets/mavis/mcp-ts/agents/task-router.md +2 -0
- package/presets/mavis/mcp-ts/commands/README.md +1 -0
- package/presets/mavis/mcp-ts/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/mcp-ts/commands/task.md +4 -0
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/mol/adapter-map.json +9 -1
- package/presets/mavis/mol/agents/task-router.md +2 -0
- package/presets/mavis/mol/commands/README.md +1 -0
- package/presets/mavis/mol/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/mol/commands/task.md +4 -0
- package/presets/mavis/mol/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/next/adapter-map.json +9 -1
- package/presets/mavis/next/agents/task-router.md +2 -0
- package/presets/mavis/next/commands/README.md +1 -0
- package/presets/mavis/next/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/next/commands/task.md +4 -0
- package/presets/mavis/next/commands/ui-start.md +12 -4
- package/presets/mavis/next/commands/ui-stop.md +5 -2
- package/presets/mavis/next/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/nuxt/adapter-map.json +9 -1
- package/presets/mavis/nuxt/agents/task-router.md +2 -0
- package/presets/mavis/nuxt/commands/README.md +1 -0
- package/presets/mavis/nuxt/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/nuxt/commands/task.md +4 -0
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +9 -1
- package/presets/mavis/php-hexagonal/agents/task-router.md +2 -0
- package/presets/mavis/php-hexagonal/commands/README.md +1 -0
- package/presets/mavis/php-hexagonal/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/php-hexagonal/commands/task.md +4 -0
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/php-laravel/adapter-map.json +9 -1
- package/presets/mavis/php-laravel/agents/task-router.md +2 -0
- package/presets/mavis/php-laravel/commands/README.md +1 -0
- package/presets/mavis/php-laravel/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/php-laravel/commands/task.md +4 -0
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +69 -1
- package/presets/mavis/svelte/adapter-map.json +9 -1
- package/presets/mavis/svelte/agents/task-router.md +2 -0
- package/presets/mavis/svelte/commands/README.md +1 -0
- package/presets/mavis/svelte/commands/rr-migrate-repositories.md +54 -0
- package/presets/mavis/svelte/commands/task.md +4 -0
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/android-kotlin/adapter-map.json +9 -1
- package/presets/opencode/android-kotlin/agents/task-router.md +2 -0
- package/presets/opencode/android-kotlin/commands/README.md +1 -0
- package/presets/opencode/android-kotlin/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/android-kotlin/commands/task.md +4 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/go/adapter-map.json +9 -1
- package/presets/opencode/go/agents/task-router.md +2 -0
- package/presets/opencode/go/commands/README.md +1 -0
- package/presets/opencode/go/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/go/commands/task.md +4 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/ios-swift/adapter-map.json +9 -1
- package/presets/opencode/ios-swift/agents/task-router.md +2 -0
- package/presets/opencode/ios-swift/commands/README.md +1 -0
- package/presets/opencode/ios-swift/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/ios-swift/commands/task.md +4 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/java/adapter-map.json +9 -1
- package/presets/opencode/java/agents/task-router.md +2 -0
- package/presets/opencode/java/commands/README.md +1 -0
- package/presets/opencode/java/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/java/commands/task.md +4 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/mcp-ts/adapter-map.json +9 -1
- package/presets/opencode/mcp-ts/agents/task-router.md +2 -0
- package/presets/opencode/mcp-ts/commands/README.md +1 -0
- package/presets/opencode/mcp-ts/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/mcp-ts/commands/task.md +4 -0
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/mol/adapter-map.json +9 -1
- package/presets/opencode/mol/agents/task-router.md +2 -0
- package/presets/opencode/mol/commands/README.md +1 -0
- package/presets/opencode/mol/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/mol/commands/task.md +4 -0
- package/presets/opencode/mol/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/next/adapter-map.json +9 -1
- package/presets/opencode/next/agents/task-router.md +2 -0
- package/presets/opencode/next/commands/README.md +1 -0
- package/presets/opencode/next/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/next/commands/task.md +4 -0
- package/presets/opencode/next/commands/ui-start.md +12 -4
- package/presets/opencode/next/commands/ui-stop.md +5 -2
- package/presets/opencode/next/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/nuxt/adapter-map.json +9 -1
- package/presets/opencode/nuxt/agents/task-router.md +2 -0
- package/presets/opencode/nuxt/commands/README.md +1 -0
- package/presets/opencode/nuxt/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/nuxt/commands/task.md +4 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/php-hexagonal/adapter-map.json +9 -1
- package/presets/opencode/php-hexagonal/agents/task-router.md +2 -0
- package/presets/opencode/php-hexagonal/commands/README.md +1 -0
- package/presets/opencode/php-hexagonal/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/php-hexagonal/commands/task.md +4 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/php-laravel/adapter-map.json +9 -1
- package/presets/opencode/php-laravel/agents/task-router.md +2 -0
- package/presets/opencode/php-laravel/commands/README.md +1 -0
- package/presets/opencode/php-laravel/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/php-laravel/commands/task.md +4 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +69 -1
- package/presets/opencode/plugins/task-status/README.md +15 -7
- package/presets/opencode/plugins/task-status/deepseek.ts +193 -0
- package/presets/opencode/plugins/task-status/details-data.ts +39 -2
- package/presets/opencode/plugins/task-status/prompt-text.ts +18 -8
- package/presets/opencode/plugins/task-status/task-view.ts +253 -63
- package/presets/opencode/plugins/task-status/tui.tsx +48 -11
- package/presets/opencode/svelte/adapter-map.json +9 -1
- package/presets/opencode/svelte/agents/task-router.md +2 -0
- package/presets/opencode/svelte/commands/README.md +1 -0
- package/presets/opencode/svelte/commands/rr-migrate-repositories.md +62 -0
- package/presets/opencode/svelte/commands/task.md +4 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/android-kotlin/adapter-map.json +9 -1
- package/presets/zcode/android-kotlin/agents/task-router.md +2 -0
- package/presets/zcode/android-kotlin/commands/README.md +1 -0
- package/presets/zcode/android-kotlin/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/android-kotlin/commands/task.md +4 -0
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/go/adapter-map.json +9 -1
- package/presets/zcode/go/agents/task-router.md +2 -0
- package/presets/zcode/go/commands/README.md +1 -0
- package/presets/zcode/go/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/go/commands/task.md +4 -0
- package/presets/zcode/go/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/ios-swift/adapter-map.json +9 -1
- package/presets/zcode/ios-swift/agents/task-router.md +2 -0
- package/presets/zcode/ios-swift/commands/README.md +1 -0
- package/presets/zcode/ios-swift/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/ios-swift/commands/task.md +4 -0
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/java/adapter-map.json +9 -1
- package/presets/zcode/java/agents/task-router.md +2 -0
- package/presets/zcode/java/commands/README.md +1 -0
- package/presets/zcode/java/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/java/commands/task.md +4 -0
- package/presets/zcode/java/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/mcp-ts/adapter-map.json +9 -1
- package/presets/zcode/mcp-ts/agents/task-router.md +2 -0
- package/presets/zcode/mcp-ts/commands/README.md +1 -0
- package/presets/zcode/mcp-ts/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/mcp-ts/commands/task.md +4 -0
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/mol/adapter-map.json +9 -1
- package/presets/zcode/mol/agents/task-router.md +2 -0
- package/presets/zcode/mol/commands/README.md +1 -0
- package/presets/zcode/mol/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/mol/commands/task.md +4 -0
- package/presets/zcode/mol/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/next/adapter-map.json +9 -1
- package/presets/zcode/next/agents/task-router.md +2 -0
- package/presets/zcode/next/commands/README.md +1 -0
- package/presets/zcode/next/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/next/commands/task.md +4 -0
- package/presets/zcode/next/commands/ui-start.md +12 -4
- package/presets/zcode/next/commands/ui-stop.md +5 -2
- package/presets/zcode/next/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/nuxt/adapter-map.json +9 -1
- package/presets/zcode/nuxt/agents/task-router.md +2 -0
- package/presets/zcode/nuxt/commands/README.md +1 -0
- package/presets/zcode/nuxt/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/nuxt/commands/task.md +4 -0
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/php-hexagonal/adapter-map.json +9 -1
- package/presets/zcode/php-hexagonal/agents/task-router.md +2 -0
- package/presets/zcode/php-hexagonal/commands/README.md +1 -0
- package/presets/zcode/php-hexagonal/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/php-hexagonal/commands/task.md +4 -0
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/php-laravel/adapter-map.json +9 -1
- package/presets/zcode/php-laravel/agents/task-router.md +2 -0
- package/presets/zcode/php-laravel/commands/README.md +1 -0
- package/presets/zcode/php-laravel/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/php-laravel/commands/task.md +4 -0
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +69 -1
- package/presets/zcode/svelte/adapter-map.json +9 -1
- package/presets/zcode/svelte/agents/task-router.md +2 -0
- package/presets/zcode/svelte/commands/README.md +1 -0
- package/presets/zcode/svelte/commands/rr-migrate-repositories.md +62 -0
- package/presets/zcode/svelte/commands/task.md +4 -0
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +69 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.80
|
|
4
|
+
|
|
5
|
+
### `opencode` — the task sidebar shows the session's own task
|
|
6
|
+
|
|
7
|
+
- **Match anchor.** The sidebar no longer matches by any user message: the index is `prompt.md` only (a `prompt-log.md` holds confirmations, not prompts) and the match anchors on the session's opening prompt. A later `делай` / `продолжай` / `подтверждаю` cannot map a tab to a newer task, and a confirmation-only session resolves to `no task`.
|
|
8
|
+
- **Tiers and binding.** An exact prompt match wins; the fallback substring tier is 40 characters and ignores confirmation words. A `/task-continue <slug>` resolves case-insensitively and an unknown slug falls back to the prompt match instead of hiding the task. The first successful mapping is pinned for the session, so a new message cannot flip the tab; only another explicit `/task-continue` re-binds it.
|
|
9
|
+
- **Prompt parser.** `prompt-text.ts` reads the legacy `# Original prompt` heading, list-style meta lines (`- source: ...`), a bare body, and fences, so `prompt.md` variants match exactly and the details excerpt no longer includes the meta block.
|
|
10
|
+
- **Resume authority.** A resume word clears only the pinned task's `STOP`; a repository-wide `.ai.local/STOP` needs an explicit `/task-continue <slug>`. A text match no longer carries that authority.
|
|
11
|
+
- **Tick cost.** The economy block parses only the appended bytes of `output-guard/results*.jsonl` and memoizes its totals (a 10 MB ledger cost ~44 ms per second before); the details dialog reuses its ETA index and its build until a task file changes; the prompt index no longer re-reads `prompt-log.md`.
|
|
12
|
+
- **Robustness.** A throw inside the tick keeps the last view instead of freezing it, an unreadable sentinel is absent rather than a phantom pause, a stale slot input stops following a closed tab, and parallel waves display the highest active step.
|
|
13
|
+
- **Fixtures.** `test-task-status-view` grows from 18 to 27 cases: confirmation words, prompt-log noise, the legacy prompt format, case-insensitive and unknown `/task-continue`, the pinned binding, the `/task` prefix, a re-used session, and details reuse. The `cli-golden` opencode fixtures carry the new plugin hashes.
|
|
14
|
+
|
|
15
|
+
## 0.2.79
|
|
16
|
+
|
|
17
|
+
### `engine` — a repository registry with task links and honest verdicts
|
|
18
|
+
|
|
19
|
+
- **File of record.** `.ai.local/team/repositories.json` holds `{ version, repositories[], links[], attributions[] }`, local-only and git-ignored, deterministically serialized (declared key order, records by `id`, links by `(taskSlug, repositoryId)`, attributions by `taskSlug`); an unchanged rewrite performs no write. An absent file is a valid empty store, so `init` seeds nothing. `/rr-migrate-repositories` scans the clones on disk (default: the parent of the repository root), creates the missing records, updates a changed name/locator/status with the stored revision, and projects the file, so a new machine is one command away.
|
|
20
|
+
- **One lock-guarded verb.** `team-db.mjs repositories apply|put|delete|list|project` holds `.repositories.lock` across the read-modify-write-projection, writes the file by temp file plus rename, then projects the touched rows; a projection throw is caught, logged once, and still answers `ok: true`. Record-level `revision` is the CAS token — a stale or missing one is `409 E_CONFLICT` — and `delete` on a linked record answers `409 E_REPOSITORY_IN_USE` with `linkedTasks`, while `--force` removes the record and its links in the same write.
|
|
21
|
+
- **Migrations `0009-repositories` and `0010-repository-attributions`.** `repositories` + `task_repositories` (`PRIMARY KEY (task_slug, repository_id)`, `ON DELETE CASCADE`, no foreign key on `task_slug`) and `task_repository_attributions` (the verdict only); schema v10, applied from v0 and from a v8 store, links and verdicts replaced together in one transaction.
|
|
22
|
+
- **Five operations over two paths.** `GET|POST /api/v1/repositories` and `GET|PUT|DELETE /api/v1/repositories/{id}`, the write body carrying its own required `id` (a duplicate is 409, a `PUT` body id that differs from the path is 409), plus `?repository=<id>` on the task list and a required `repositories`/`repositoriesInference` pair on the task detail where links outrank the attribution. Five contract counters move together (53 operations, 42 paths, 84 schemas, 53 served routes, 17 mutating routes).
|
|
23
|
+
- **Intake.** `/task` records `repositories` in `pipeline.json` — the array is mandatory — and an empty array is legal only beside `repositoriesInference: "unknown"`, which a non-empty list refuses. The field reaches all 55 preset carriers and the five host trees, and the router never defaults it. The chain hook gates the first receipt of every task — the router's, or the first step's when a pipeline runs without one, graph mode included: no `repositories` array, `[]` without `"unknown"`, `"unknown"` beside a non-empty list, an `repositoriesInference` outside the four verdicts, or an id the registry lacks answers `state: blocked` with the repair text, and the task does not advance. A task that already completed a step is never re-judged; `intakeExemption: { approvedBy, reason, at }` is the only escape hatch — a bare boolean is refused, and every exemption leaves an `intake_repositories_exempted` metric naming its approver. `check-task-repositories.mjs` ships to `<repo>/.ai.local/scripts/` and audits the store after the fact (a folder that omits the field, names an id the registry lacks, or disagrees with its `links[]`), dating the pre-invariant era from `2026-11-22`.
|
|
24
|
+
- **Backfill.** `backfill-repositories.mjs` (dry-run default, idempotent) walks the 227 folders that predate the field down the evidence ladder — 150 `evidence-paths`, 4 `repo-scope-only`, 68 `unknown`, 5 `ambiguous` — and prints each row's rung and evidence, an ambiguous row quoting the excerpt that made it so.
|
|
25
|
+
- **Fixtures.** `test-team-db-schema` pins the two migrations and their checksums plus the v8 → v10 path, `-project` the three-table rebuild from the file alone and a malformed file that tombstones nothing, `-api` the CRUD, both 409s, the delete guard and the verdict ladder, and `-concurrency` two registry writers serializing on the lock. `test-task-repositories` covers the intake presence rule and its cutoff, `test-backfill-repositories` the evidence ladder and a second idempotent run, and `test-rr-migrate-repositories` the remote normalisation, id reuse by locator, one-remote dedupe and the kill switch that leaves the file absent.
|
|
26
|
+
- **Docs.** `docs/TEAM-DB.md` gains § Repository registry and moves the mutation count to seventeen; ADR `0006-repository-registry.md` and `0007-repository-registry-local-only.md`.
|
|
27
|
+
|
|
28
|
+
### `team-tasks-ui` — a repository surface with task links
|
|
29
|
+
|
|
30
|
+
- **Pages.** `/repositories`, `/repositories/new`, `/repositories/[id]`, and `/repositories/[id]/edit`, plus a nav entry after Catalog. The list pages over `total`/`nextOffset`, the detail page pages its linked tasks over the same pair, the create/edit form requires `id` (read-only on edit), and delete runs a two-step dialog that names the N links before any request.
|
|
31
|
+
- **Task detail.** The link block renders each repository with its status badge and keeps `unknown` and `ambiguous` as different empty sentences, so a missing inference is never read as "no repository" — the ambiguous one names the backfill report in text, because no route serves it.
|
|
32
|
+
|
|
33
|
+
### `engine` — a closed tracker item leaves the launch queue
|
|
34
|
+
|
|
35
|
+
- **Queue.** `setTrackerItem` expires the item's open requests in the same transaction for every terminal status — `cancelled` → `item-cancelled`, `superseded` → `item-superseded`, now `completed` → `item-completed` — and only when the status actually changed, so a re-save cannot re-expire. `done` stays derived from the task row and is never stored.
|
|
36
|
+
- **Prune.** `pruneTrackerEntries` retires stored `cancelled`/`expired` and derived `done` alike; a derived-done entry ages from `finishedAt`, else `claimedAt`, else `requestedAt`, so a completed item's `claimed` entry can finally be pruned instead of lingering in the launch queue.
|
|
37
|
+
- **Docs and fixture.** `docs/TEAM-DB.md` § tracker queue states the lifecycle; `test-team-db-tracker-queue.mjs` pins the terminal transitions and the aged-entry prune.
|
|
38
|
+
|
|
39
|
+
### `engine` — a rejected tracker payload burns no id
|
|
40
|
+
|
|
41
|
+
- **Reserve, then commit.** `team-db-tracker.mjs` splits the sequence step: `peekItemId` computes the next id without writing, and `commitItemId` advances `tracker/sequence.json` only after `validateItemIdentity`, `validateItemGraph`, and `validateTransition` pass. A rejected `tracker add` leaves the sequence untouched and the next accepted item reuses the id, so the observed 23/24 gap cannot recur.
|
|
42
|
+
- **The contract is written down.** `docs/TEAM-DB.md` § tracker states the bounds the validator already enforced: `title` one trimmed line of 1–120 characters, `description` at most 2000, `labels` at most 8 of 1–32, `sourceRefs` at most 16 of 1–40, `priority` 0–9, and the `status`/`type` enumerations.
|
|
43
|
+
- **Fixture.** `test-team-db-tracker.mjs` adds "a rejected add never burns an id": a 41-character `sourceRef` exits `1` with `E_SCHEMA`, `sequence.json.nextId` is unchanged, and the next valid add takes that id.
|
|
44
|
+
|
|
45
|
+
### `team-tasks-ui` — `/ui-start` guarantees the process view
|
|
46
|
+
|
|
47
|
+
- **Stack script.** `apps/team-tasks-ui/scripts/stack.mjs` probes `http://127.0.0.1:4179/api/v1/processes` and, when nothing answers, starts `processes.mjs serve` through the process manager (`processes.mjs start --name process-view --port 4179`), so `/processes` no longer opens on `E_DISABLED: The process view is unreachable`. The manager's lease (`.ai.local/.processes/leases/process-view.json`) is the ownership record: an owned view that answers a non-200 is stopped and started once, a foreign listener is reported and left running, and `stop` calls `processes.mjs stop --name process-view` instead of signalling a pid. A missing `processes.mjs` is reported and does not block the UI.
|
|
48
|
+
- **Commands and docs.** `ui-start` quotes the new `processes:` line next to `ui:` and `api:`; `ui-stop` reports the view it stopped. The `apps/team-tasks-ui` README start/stop section and lifecycle matrix rows 1–3 carry the `:4179` expectations.
|
|
49
|
+
|
|
3
50
|
## 0.2.78
|
|
4
51
|
|
|
5
52
|
### `engine` — a follow-up must name a different task
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Run `init` from the **app root** (`--cwd` if needed). Default `--preset` is `nex
|
|
|
25
25
|
| Root agents | `REPO_AGENTS.md` → `AGENTS.md` (same file on all five; ZCode loads it natively) | | | | |
|
|
26
26
|
| `/task` artifacts | **`.ai.local/team/`** (shared; templates refreshed; `tasks/<slug>/` never overwritten) | | | |
|
|
27
27
|
| Template drift | **`.ai.local/.template-base.json`** (shared; one record per tree of files that hold a shipped template byte; `update` prints one drift line, `update --merge-ai-local` fast-forwards a file only when its recorded base still matches and reports the rest) | | | |
|
|
28
|
-
| Self-learning engine | **`.ai.local/scripts/`** (shared;
|
|
28
|
+
| Self-learning engine | **`.ai.local/scripts/`** (shared; thirty published scripts — the six self-learning engine modules, `manifest.mjs`, `dump-output.mjs`, `run-compact.mjs`, the eight `team-db*.mjs` modules, `action-signals.mjs`, `actions-report.mjs`, `check-write-scope.mjs`, `aggregate-agent-task-metrics.mjs`, `record-usage.mjs`, `verification.mjs`, `check-verification.mjs`, `incidents.mjs`, `processes.mjs`, `process-lease.mjs`, `rr-scheduler-start.mjs`, `rr-migrate-repositories.mjs`, and `tracker-planned-drain.mjs`; existing files never overwritten. The repository-only `upstream-research.mjs` is not published) | | | |
|
|
29
29
|
| Specs seed | `docs/specs/` copied only if the directory is **absent** | | | |
|
|
30
30
|
|
|
31
31
|
OpenCode also ships **`.opencode/plugins/task-status/`**, a TUI sidebar for the active `/task` run (slug, state, elapsed time, step, remaining-time estimate, soft-stop). OpenCode auto-loads it; it needs no `opencode.json` entry, is refreshed by `update`, and is a viewer only — the chain hook stays manual.
|
|
@@ -62,7 +62,8 @@ node .ai.local/scripts/run.mjs --dry-run # read-only preview: decision, target,
|
|
|
62
62
|
`--force`. The seeded tree is byte-identical to `presets/_shared/ai-local/scripts/`, and `.ai.local/.gitignore` (created
|
|
63
63
|
when absent, missing required lines appended to an existing file) ignores `*.lock`, `*.tmp`, `.rollback/`, `STOP`,
|
|
64
64
|
`ESTOP`, `team.db`, `team.db-wal`, `team.db-shm`, `team-db-errors.log`, `team.db.corrupt-*`,
|
|
65
|
-
`team.db.mismatch-*`, `team/scheduler/runs/`,
|
|
65
|
+
`team.db.mismatch-*`, `team/scheduler/runs/`, `team/scheduler/state.json`, and
|
|
66
|
+
`team/repositories.json`; the root `.gitignore` is never edited.
|
|
66
67
|
|
|
67
68
|
Upgrade a seeded module with `update --fix`: it writes a module only when its current bytes still match the shipped digest
|
|
68
69
|
recorded in `.ai.local/.template-base.json`. A module you edited is reported `kept modified` and stays byte-identical; a
|
|
@@ -134,6 +135,7 @@ failure is written to `team-db-errors.log` and never fails a file write.
|
|
|
134
135
|
```bash
|
|
135
136
|
node .ai.local/scripts/team-db.mjs init # create/migrate the database
|
|
136
137
|
node .ai.local/scripts/team-db.mjs migrate-tasks # create when absent, then write only the delta
|
|
138
|
+
node .ai.local/scripts/rr-migrate-repositories.mjs # scan local clones into the registry, then project
|
|
137
139
|
node .ai.local/scripts/team-db.mjs sync # full backfill + reconciliation
|
|
138
140
|
node .ai.local/scripts/team-db.mjs sync --slug <slug> # the bounded hook-shaped projection
|
|
139
141
|
node .ai.local/scripts/team-db.mjs check # schema, fingerprint, integrity
|
|
@@ -66,6 +66,9 @@ const ENGINE_SCRIPTS = [
|
|
|
66
66
|
// Read-only post-step write-scope audit used by build-verifier and code-reviewer.
|
|
67
67
|
// Shells out to git, so it is not part of the self-learning loop module set.
|
|
68
68
|
'check-write-scope.mjs',
|
|
69
|
+
// Retrospective audit of `pipeline.json.repositories` across the task store.
|
|
70
|
+
// The chain hook gates intake; this one judges the folders that already exist.
|
|
71
|
+
'check-task-repositories.mjs',
|
|
69
72
|
// Process leases and the one view over them (`start|acquire|run|list|watch|
|
|
70
73
|
// scan|doctor|stop|serve`). `processes.mjs` owns a detached dev-server start
|
|
71
74
|
// and reuses `process-lease.mjs` for the protocol; both spawn `ps`/`lsof` and
|
|
@@ -76,6 +79,9 @@ const ENGINE_SCRIPTS = [
|
|
|
76
79
|
// `/rr-scheduler-start`: stop a recorded scheduler, then start
|
|
77
80
|
// `team-db.mjs schedule` through the process manager.
|
|
78
81
|
'rr-scheduler-start.mjs',
|
|
82
|
+
// `/rr-migrate-repositories`: scan local clones and sync the repository
|
|
83
|
+
// registry through the lock-guarded `repositories apply|put|project` verbs.
|
|
84
|
+
'rr-migrate-repositories.mjs',
|
|
79
85
|
// Role/task metrics aggregation used by technical-retro; ships with the engine
|
|
80
86
|
// so a consumer can run it from `.ai.local/scripts/` without the package.
|
|
81
87
|
'aggregate-agent-task-metrics.mjs',
|
|
@@ -44,6 +44,8 @@ const AI_LOCAL_GITIGNORE = [
|
|
|
44
44
|
'# Tracker launch queue and opt-in runner runtime state; items and links stay tracked.',
|
|
45
45
|
'team/tracker/queue/',
|
|
46
46
|
'team/task-runs/',
|
|
47
|
+
'# Local-only repository registry: generated from this machine, never commit.',
|
|
48
|
+
'team/repositories.json',
|
|
47
49
|
'# Per-step write-scope baselines; derived from git, never a project input.',
|
|
48
50
|
'team/.write-scope/',
|
|
49
51
|
'team/upstream/cursor.json',
|
package/docs/TEAM-DB.md
CHANGED
|
@@ -21,7 +21,7 @@ The same seeded set is `ENGINE_SCRIPTS` in `bin/lib/engine-scripts.js`: the eigh
|
|
|
21
21
|
modules plus the self-learning engine, `manifest.mjs`, `dump-output.mjs`,
|
|
22
22
|
`check-write-scope.mjs`, `aggregate-agent-task-metrics.mjs`, `record-usage.mjs`,
|
|
23
23
|
`verification.mjs`, `check-verification.mjs`, `incidents.mjs`, `tracker-planned-drain.mjs`, and the `processes.mjs` +
|
|
24
|
-
`process-lease.mjs` process manager (thirty entries;
|
|
24
|
+
`process-lease.mjs` process manager (thirty-one entries;
|
|
25
25
|
`node -e "require('./bin/lib/engine-scripts.js').ENGINE_SCRIPTS.length"` prints the shipped
|
|
26
26
|
count). One further module, `upstream-research.mjs`, is declared in
|
|
27
27
|
`REPO_ONLY_ENGINE_SCRIPTS`: it exists in this repository's preset source and dogfood mirror but
|
|
@@ -45,16 +45,24 @@ is excluded from the published tarball, and a consumer install skips it without
|
|
|
45
45
|
envelope, or one stderr line on the CLI.
|
|
46
46
|
- **Bounded mutations.** `POST /api/v1/sync` re-runs the projector and `DELETE
|
|
47
47
|
/api/v1/tasks/{slug}` deletes one confirmed task (the folder first, then the rows); every
|
|
48
|
-
other route is `GET`/`HEAD` apart from the four job writes
|
|
49
|
-
asynchronous child process — the server never opens a writable
|
|
50
|
-
switch answers before a child is spawned. Job writes carry
|
|
51
|
-
64 KiB, run-now an absent body or `{}
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
other route is `GET`/`HEAD` apart from the four job writes and the three repository writes.
|
|
49
|
+
Each mutation runs as an asynchronous child process — the server never opens a writable
|
|
50
|
+
connection, and the kill switch answers before a child is spawned. Job writes carry
|
|
51
|
+
`application/json` and at most 64 KiB, run-now an absent body or `{}`; repository writes
|
|
52
|
+
carry `application/json` and at most 16 KiB. The rescan and delete children are bounded at
|
|
53
|
+
30 s, a job write or run-now at 10 s, a repository write at 10 s and a repository delete at
|
|
54
|
+
30 s. There is no write-back and no outbound call; the efficiency ledgers are local files
|
|
55
|
+
read by a full sync.
|
|
54
56
|
- **The scheduler writes files before rows.** `scheduler/jobs.json` is the definition of
|
|
55
57
|
record, `scheduler/runs/**` and `scheduler/state.json` are its runtime state, and the three
|
|
56
58
|
`scheduled_jobs` / `job_runs` / `job_run_events` tables are projections of those files. The
|
|
57
59
|
scheduler never writes `status.json`, `metrics.json`, or a receipt.
|
|
60
|
+
- **The repository registry writes files before rows.** `repositories.json` holds the
|
|
61
|
+
records, the resolved task→repository links and the unresolved attribution verdicts; the
|
|
62
|
+
`repositories` / `task_repositories` / `task_repository_attributions` tables are derived
|
|
63
|
+
from it alone and rebuild byte-identically. One lock-guarded verb serves both writers (the
|
|
64
|
+
API and `/task` intake or the backfill), and a projection failure never fails a file
|
|
65
|
+
write.
|
|
58
66
|
- **Local only.** The server binds loopback by default, checks `Host` and `Origin`, sends no
|
|
59
67
|
CORS header, and serves raw documents from SQLite by exact `(slug, path)` lookup.
|
|
60
68
|
|
|
@@ -162,6 +170,13 @@ vocabulary: `0` ok, `1` a validation refusal carrying its named code (`E_TRACKER
|
|
|
162
170
|
`E_TRACKER_TRANSITION`, `E_TRACKER_REVISION`, `E_SCHEMA`), `3` usage, `4` the tree lock was
|
|
163
171
|
contended (`E_TRACKER_BUSY`).
|
|
164
172
|
|
|
173
|
+
A tracker item payload is bounded, and a refusal burns no id: `title` is one trimmed line of
|
|
174
|
+
1–120 characters, `description` at most 2000 characters, `labels` at most 8 of 1–32 characters,
|
|
175
|
+
`sourceRefs` at most 16 of 1–40 characters, `priority` 0–9, `status` ∈ backlog | planned |
|
|
176
|
+
completed | cancelled | superseded, `type` ∈ feature | bugfix | spike | chore | docs | refactor.
|
|
177
|
+
`tracker add` validates the payload before it reserves the sequence: a rejected add leaves
|
|
178
|
+
`tracker/sequence.json` untouched and the next accepted item reuses that id.
|
|
179
|
+
|
|
165
180
|
A `--rebuild` of `init`, `sync` or `migrate-tasks` takes the team-root rebuild lock
|
|
166
181
|
(`.ai.local/team/.rebuild.lock.d`, a transient directory) before it touches the database: a
|
|
167
182
|
second rebuild that meets it fails fast with `E_REBUILD_BUSY` (exit 4) instead of moving
|
|
@@ -268,13 +283,16 @@ task in a holding state (`in_progress`, `awaiting_artifact_receipt`, `blocked`)
|
|
|
268
283
|
slot, a task at a human gate does not. `GET /api/v1/tracker/queue` includes that holding
|
|
269
284
|
task even when it has no tracker link and no queue file: the row is derived (`entryId` null,
|
|
270
285
|
`itemId` null, `status` `active`, reason `current task`) and is not cancellable. A
|
|
271
|
-
non-terminal queue entry for the same slug is the row that is shown instead.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
286
|
+
non-terminal queue entry for the same slug is the row that is shown instead. A claim older
|
|
287
|
+
than 90 s with no task row is released on the next drain or by `tracker recover`; `tracker
|
|
288
|
+
prune --older-than <days>` deletes aged terminal entry files only — stored
|
|
289
|
+
`cancelled`/`expired` and derived `done` alike, where a derived-done entry ages from its
|
|
290
|
+
`finishedAt`, else `claimedAt`, else `requestedAt`. A terminal item closes its open request
|
|
291
|
+
in the same transaction: `cancelled`/`superseded` write `expired` with
|
|
292
|
+
`item-cancelled`/`item-superseded`, and `completed` writes `expired` with `item-completed`,
|
|
293
|
+
so a `done` row (derived from the task row, never stored) cannot linger in the launch queue
|
|
294
|
+
after the item is closed. The tracker module never writes `status.json`, `metrics.json`, or
|
|
295
|
+
`scheduler/jobs.json`.
|
|
278
296
|
|
|
279
297
|
**Task control.** The tracker item detail can start a new linked task (link + queue
|
|
280
298
|
request), stop a link (cancel the queued request, write the per-task `tasks/<slug>/STOP`
|
|
@@ -380,6 +398,89 @@ own timeout, the result is recorded, exit 0. Supervision (launchd, systemd, Task
|
|
|
380
398
|
documented practice, never shipped as a second timer, and Windows process-group termination is
|
|
381
399
|
not supported in v1.
|
|
382
400
|
|
|
401
|
+
## Repository registry
|
|
402
|
+
|
|
403
|
+
`team/repositories.json` is **local-only and git-ignored**; it is the definition of record for the
|
|
404
|
+
repository records, the resolved task→repository links and the unresolved attribution verdicts:
|
|
405
|
+
|
|
406
|
+
```json
|
|
407
|
+
{
|
|
408
|
+
"version": 1,
|
|
409
|
+
"repositories": [ { "id": "ai-rules", "name": "…", "locator": "…", "description": null,
|
|
410
|
+
"labels": null, "status": "active", "revision": 1,
|
|
411
|
+
"createdAt": "…", "updatedAt": "…" } ],
|
|
412
|
+
"links": [ { "taskSlug": "…", "repositoryId": "ai-rules", "addedAt": "…",
|
|
413
|
+
"source": "intake", "inference": "evidence-paths", "evidence": "…" } ],
|
|
414
|
+
"attributions": [ { "taskSlug": "…", "verdict": "unknown", "evidence": "",
|
|
415
|
+
"recordedAt": "…", "source": "backfill" } ]
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
`version` must be `1`, an unknown top-level key or two records with one id is a parse error,
|
|
420
|
+
and an absent file is an empty valid store (the first write creates it — `init` seeds nothing).
|
|
421
|
+
The writer serializes deterministically: declared key order, records sorted by `id`, links by
|
|
422
|
+
`(taskSlug, repositoryId)`, attributions by `taskSlug`, two-space indent, one trailing newline;
|
|
423
|
+
an unchanged rewrite performs no write at all.
|
|
424
|
+
|
|
425
|
+
One lock-guarded verb serves both writers — the CRUD API and `/task` intake or the backfill:
|
|
426
|
+
|
|
427
|
+
```bash
|
|
428
|
+
node .ai.local/scripts/team-db.mjs repositories apply --file <path|-> [--dry-run]
|
|
429
|
+
node .ai.local/scripts/team-db.mjs repositories put --file <path|-> [--dry-run]
|
|
430
|
+
node .ai.local/scripts/team-db.mjs repositories delete <id> [--force] [--revision <n>]
|
|
431
|
+
node .ai.local/scripts/team-db.mjs repositories list [--json]
|
|
432
|
+
node .ai.local/scripts/team-db.mjs repositories project [--json]
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
The order is kill switch → `.repositories.lock` (5 s, `E_REPOSITORIES_BUSY` / 503 `E_BUSY`)
|
|
436
|
+
→ read → validate and CAS → file write by temp file plus rename → projection of the touched
|
|
437
|
+
rows → release in `finally`. `status` is validated on write (`active | archived`, 422 with
|
|
438
|
+
`parameter: "status"`) and is not a SQL `CHECK`: the projection serves whatever a hand-edited
|
|
439
|
+
file says. Update requires the stored `revision` and advances it by one; create writes `1`;
|
|
440
|
+
delete compares `revision` only when supplied — a stale or missing token is `409 E_CONFLICT`
|
|
441
|
+
and changes no bytes. `DELETE` on a record linked to N tasks answers `409
|
|
442
|
+
E_REPOSITORY_IN_USE` with `details.linkedTasks = N`; `force=true` removes the record and
|
|
443
|
+
every link in the same write and reports `linksRemoved` — the tasks stay.
|
|
444
|
+
|
|
445
|
+
`/rr-migrate-repositories` seeds and refreshes the records from the clones on this machine:
|
|
446
|
+
`node .ai.local/scripts/rr-migrate-repositories.mjs` walks the scan roots (default: the parent of
|
|
447
|
+
the repository root, or the root itself when that parent is `$HOME`), treats a directory with `.git` as one repository and stops descending there,
|
|
448
|
+
skips submodule checkouts and linked worktrees, and collapses several clones of one remote to the
|
|
449
|
+
shallowest path. A scan record whose locator already exists keeps its id; a new id is the slug of
|
|
450
|
+
the directory name, parent-prefixed on a collision. Missing records go through one `repositories
|
|
451
|
+
apply`, a changed `name`/`locator`/`status` through `repositories put` with the stored `revision`,
|
|
452
|
+
and the run finishes with `repositories project`, so the file and the database stay in step. The
|
|
453
|
+
script never deletes a record: a clone outside the scanned roots is not gone. `--dry-run` prints the
|
|
454
|
+
plan, `--scan <dir>` (repeatable) and `--depth <n>` widen or narrow the walk, `--team-root <dir>`
|
|
455
|
+
points at another store, and `AI_RULES_TEAM_DB_DISABLE` leaves the file untouched with exit 0.
|
|
456
|
+
|
|
457
|
+
The projection adds three tables through two migrations: `repositories` and
|
|
458
|
+
`task_repositories` (`0009-repositories`, `PRIMARY KEY (task_slug, repository_id)`,
|
|
459
|
+
`ON DELETE CASCADE` on the repository, **no foreign key on `task_slug`**) and
|
|
460
|
+
`task_repository_attributions` (`0010-repository-attributions`, the verdict only). Links and
|
|
461
|
+
verdicts are replaced together in one transaction, so a task that gains a link loses its
|
|
462
|
+
attribution row and vice versa. A malformed file records its error and tombstones nothing.
|
|
463
|
+
`rm team.db* && node .ai.local/scripts/team-db.mjs init --rebuild` reproduces all three
|
|
464
|
+
tables from the file alone.
|
|
465
|
+
|
|
466
|
+
Five operations, two paths: `GET|POST /api/v1/repositories`, and
|
|
467
|
+
`GET|PUT|DELETE /api/v1/repositories/{id}`; reads answer `RepositorySummary` (the record plus
|
|
468
|
+
`linkedTaskCount`, which the app never counts), writes answer `Repository`. `POST` creates the
|
|
469
|
+
body's `id` (a duplicate is 409) and `PUT` refuses a body id that differs from the path id
|
|
470
|
+
(409); neither route derives an id from `name`. The task list accepts `?repository=<id>` and
|
|
471
|
+
the task detail carries a required `repositories` array plus a required
|
|
472
|
+
`repositoriesInference` (`evidence-paths | repo-scope-only | unknown | ambiguous`), where a
|
|
473
|
+
link always outranks the attribution.
|
|
474
|
+
|
|
475
|
+
`/task` records the repositories a task touched: it sends one `repositories apply` payload
|
|
476
|
+
carrying a link row per touched repository, or — when the task names none — one `attributions`
|
|
477
|
+
row with `verdict: "unknown"`; `pipeline.json` carries the derived `repositories` echo. The
|
|
478
|
+
gate is `yarn check:task-repositories` (cutoff `2026-11-22`): a task folder without the field
|
|
479
|
+
fails, `[]` with `"unknown"` passes, and a folder whose own earliest artifact predates the
|
|
480
|
+
cutoff is counted as legacy — the chain hook rewrites `status.json` on every step, so a
|
|
481
|
+
rewritten status never makes a legacy folder new. The slug named by `active-task.json` is
|
|
482
|
+
excluded and printed, because its intake is still in flight; it is judged once the task closes.
|
|
483
|
+
|
|
383
484
|
## Start or restart
|
|
384
485
|
|
|
385
486
|
`/rr-scheduler-start` runs `node .ai.local/scripts/rr-scheduler-start.mjs`. `init` seeds that
|
|
@@ -668,7 +769,9 @@ no `Access-Control-*` header, hardened response headers, request bodies bounded
|
|
|
668
769
|
document chunks at 1 MiB, exports at 5 MiB, parameterized SQL only, and no outbound call.
|
|
669
770
|
`--allow-remote` also exposes the four job mutations — `POST /api/v1/jobs`,
|
|
670
771
|
`PUT /api/v1/jobs/{id}`, `DELETE /api/v1/jobs/{id}`, and `POST /api/v1/jobs/{id}/run` —
|
|
671
|
-
the
|
|
772
|
+
the three repository writes (`POST /api/v1/repositories`, `PUT /api/v1/repositories/{id}`,
|
|
773
|
+
`DELETE /api/v1/repositories/{id}`), the confirmed task delete and the rescan to the named
|
|
774
|
+
interface without authentication.
|
|
672
775
|
A job definition carries arbitrary `argv` and run-now enqueues it, so that surface
|
|
673
776
|
executes operator-supplied commands as the API user; see `## Scheduled jobs`.
|
|
674
777
|
|