@bonesofspring/ai-rules 0.2.80 → 0.2.86
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 +70 -0
- package/bin/lib/merged-config.js +49 -0
- package/bin/lib/seed-ai-local-team.js +2 -0
- package/bin/mavis-install.js +53 -3
- package/docs/MAVIS-COMPATIBILITY.md +136 -8
- package/docs/PRESET-CONTRIBUTION.md +25 -7
- package/docs/TEAM-DB.md +76 -3
- package/docs/openapi/team-db.v1.json +7069 -5895
- package/package.json +8 -2
- package/presets/_shared/ai-local/scripts/check-task-repositories.mjs +20 -2
- package/presets/_shared/ai-local/scripts/check-verification.mjs +13 -6
- package/presets/_shared/ai-local/scripts/rr-migrate-repositories.mjs +66 -16
- package/presets/_shared/ai-local/scripts/run-compact.mjs +38 -10
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +253 -15
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +310 -4
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +733 -8
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +44 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +43 -3
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -0
- package/presets/_shared/core/review/code-review-mr.md +19 -4
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +40 -0
- package/presets/_shared/hooks/compact-shell-output.mjs +16 -1
- package/presets/claude/android-kotlin/agents/code-reviewer.md +5 -1
- package/presets/claude/android-kotlin/commands/update.md +1 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/code-review.md +19 -4
- package/presets/claude/android-kotlin/skills/code-review/SKILL.md +2 -1
- package/presets/claude/go/agents/code-reviewer.md +5 -1
- package/presets/claude/go/commands/update.md +1 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/go/rules/tooling-and-review/code-review.md +19 -4
- package/presets/claude/go/skills/code-review/SKILL.md +2 -1
- package/presets/claude/ios-swift/agents/code-reviewer.md +5 -1
- package/presets/claude/ios-swift/commands/update.md +1 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +19 -4
- package/presets/claude/ios-swift/skills/code-review/SKILL.md +2 -1
- package/presets/claude/java/agents/code-reviewer.md +5 -1
- package/presets/claude/java/commands/update.md +1 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/java/rules/tooling-and-review/code-review.md +19 -4
- package/presets/claude/java/skills/code-review/SKILL.md +2 -1
- package/presets/claude/mcp-ts/commands/update.md +1 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +19 -4
- package/presets/claude/mol/REPO_AGENTS.md +1 -1
- package/presets/claude/mol/agents/code-reviewer.md +5 -1
- package/presets/claude/mol/agents/task-router.md +1 -1
- package/presets/claude/mol/commands/update.md +1 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/mol/rules/tooling-and-review/code-review-mr.md +19 -4
- package/presets/claude/mol/skills/code-review/SKILL.md +2 -1
- package/presets/claude/next/REPO_AGENTS.md +1 -1
- package/presets/claude/next/agents/build-verifier.md +2 -1
- package/presets/claude/next/agents/code-reviewer.md +5 -1
- package/presets/claude/next/agents/feature-developer.md +1 -1
- package/presets/claude/next/agents/task-router.md +1 -1
- package/presets/claude/next/commands/update.md +1 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +19 -4
- package/presets/claude/next/skills/code-review/SKILL.md +2 -1
- package/presets/claude/nuxt/agents/code-reviewer.md +5 -1
- package/presets/claude/nuxt/agents/task-router.md +1 -1
- package/presets/claude/nuxt/commands/update.md +1 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/nuxt/rules/tooling-and-review/code-review-mr.md +19 -4
- package/presets/claude/nuxt/skills/code-review/SKILL.md +2 -1
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +5 -1
- package/presets/claude/php-hexagonal/commands/update.md +1 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +19 -4
- package/presets/claude/php-hexagonal/skills/code-review/SKILL.md +2 -1
- package/presets/claude/php-laravel/agents/code-reviewer.md +5 -1
- package/presets/claude/php-laravel/commands/update.md +1 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +19 -4
- package/presets/claude/php-laravel/skills/code-review/SKILL.md +2 -1
- package/presets/claude/svelte/agents/code-reviewer.md +5 -1
- package/presets/claude/svelte/agents/task-router.md +1 -1
- package/presets/claude/svelte/commands/update.md +1 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +40 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/svelte/rules/tooling-and-review/code-review-mr.md +19 -4
- package/presets/claude/svelte/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/android-kotlin/agents/code-reviewer.md +5 -1
- package/presets/cursor/android-kotlin/commands/update.md +1 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/android-kotlin/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/android-kotlin/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/android-kotlin/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/go/agents/code-reviewer.md +5 -1
- package/presets/cursor/go/commands/update.md +1 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/go/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/go/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/go/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/ios-swift/agents/code-reviewer.md +5 -1
- package/presets/cursor/ios-swift/commands/update.md +1 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/ios-swift/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/ios-swift/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/ios-swift/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/java/agents/code-reviewer.md +5 -1
- package/presets/cursor/java/commands/update.md +1 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/java/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/java/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/java/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/mcp-ts/commands/update.md +1 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/mcp-ts/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/mol/REPO_AGENTS.md +1 -1
- package/presets/cursor/mol/agents/code-reviewer.md +5 -1
- package/presets/cursor/mol/agents/task-router.md +1 -1
- package/presets/cursor/mol/commands/update.md +1 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/mol/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/mol/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/mol/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/next/REPO_AGENTS.md +1 -1
- package/presets/cursor/next/agents/build-verifier.md +2 -1
- package/presets/cursor/next/agents/code-reviewer.md +5 -1
- package/presets/cursor/next/agents/feature-developer.md +1 -1
- package/presets/cursor/next/agents/task-router.md +1 -1
- package/presets/cursor/next/commands/update.md +1 -0
- package/presets/cursor/next/hooks/README.md +2 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/next/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/next/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/next/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/nuxt/agents/code-reviewer.md +5 -1
- package/presets/cursor/nuxt/agents/task-router.md +1 -1
- package/presets/cursor/nuxt/commands/update.md +1 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/nuxt/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/nuxt/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/nuxt/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/php-hexagonal/agents/code-reviewer.md +5 -1
- package/presets/cursor/php-hexagonal/commands/update.md +1 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/php-hexagonal/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/php-hexagonal/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/php-laravel/agents/code-reviewer.md +5 -1
- package/presets/cursor/php-laravel/commands/update.md +1 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/php-laravel/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/php-laravel/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/php-laravel/skills/code-review/SKILL.md +2 -1
- package/presets/cursor/svelte/agents/code-reviewer.md +5 -1
- package/presets/cursor/svelte/agents/task-router.md +1 -1
- package/presets/cursor/svelte/commands/update.md +1 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +40 -0
- package/presets/cursor/svelte/hooks/compact-shell-output.mjs +16 -1
- package/presets/cursor/svelte/rules/code-review-mr.mdc +19 -4
- package/presets/cursor/svelte/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/android-kotlin/MAVIS.md +9 -3
- package/presets/mavis/android-kotlin/README.md +3 -1
- package/presets/mavis/android-kotlin/adapter-map.json +104 -44
- package/presets/mavis/android-kotlin/agents/code-reviewer.md +5 -1
- package/presets/mavis/android-kotlin/commands/update.md +1 -0
- package/presets/mavis/android-kotlin/hooks/README.md +29 -7
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/android-kotlin/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/android-kotlin/hooks/run-hook.mjs +103 -0
- package/presets/mavis/android-kotlin/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/android-kotlin/native-skills/README.md +15 -0
- package/presets/mavis/android-kotlin/native-skills/ci-investigation/SKILL.md +53 -0
- package/presets/mavis/android-kotlin/native-skills/code-review/SKILL.md +62 -0
- package/presets/mavis/android-kotlin/native-skills/debug-investigation/SKILL.md +72 -0
- package/presets/mavis/android-kotlin/native-skills/feature-delivery/SKILL.md +51 -0
- package/presets/mavis/android-kotlin/native-skills/instrumentation-ui-e2e/SKILL.md +23 -0
- package/presets/mavis/android-kotlin/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/android-kotlin/native-skills/mockup-review/SKILL.md +34 -0
- package/presets/mavis/android-kotlin/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/android-kotlin/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/android-kotlin/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/android-kotlin/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/android-kotlin/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/android-kotlin/native-skills/task/SKILL.md +79 -0
- package/presets/mavis/android-kotlin/native-skills/task-continue/SKILL.md +74 -0
- package/presets/mavis/android-kotlin/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/android-kotlin/native-skills/unit-testing/SKILL.md +38 -0
- package/presets/mavis/android-kotlin/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/android-kotlin/native-skills/ux-design/SKILL.md +41 -0
- package/presets/mavis/android-kotlin/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/android-kotlin/rules/code-review-mr.md +19 -4
- package/presets/mavis/android-kotlin/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/go/MAVIS.md +9 -3
- package/presets/mavis/go/README.md +3 -1
- package/presets/mavis/go/adapter-map.json +94 -40
- package/presets/mavis/go/agents/code-reviewer.md +5 -1
- package/presets/mavis/go/commands/update.md +1 -0
- package/presets/mavis/go/hooks/README.md +29 -7
- package/presets/mavis/go/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/go/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/go/hooks/run-hook.mjs +103 -0
- package/presets/mavis/go/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/go/native-skills/README.md +15 -0
- package/presets/mavis/go/native-skills/ci-investigation/SKILL.md +24 -0
- package/presets/mavis/go/native-skills/code-review/SKILL.md +48 -0
- package/presets/mavis/go/native-skills/debug-investigation/SKILL.md +55 -0
- package/presets/mavis/go/native-skills/feature-delivery/SKILL.md +43 -0
- package/presets/mavis/go/native-skills/integration-testing/SKILL.md +21 -0
- package/presets/mavis/go/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/go/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/go/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/go/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/go/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/go/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/go/native-skills/task/SKILL.md +77 -0
- package/presets/mavis/go/native-skills/task-continue/SKILL.md +72 -0
- package/presets/mavis/go/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/go/native-skills/unit-testing/SKILL.md +20 -0
- package/presets/mavis/go/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/go/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/go/rules/code-review-mr.md +19 -4
- package/presets/mavis/go/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/ios-swift/MAVIS.md +9 -3
- package/presets/mavis/ios-swift/README.md +3 -1
- package/presets/mavis/ios-swift/adapter-map.json +104 -44
- package/presets/mavis/ios-swift/agents/code-reviewer.md +5 -1
- package/presets/mavis/ios-swift/commands/update.md +1 -0
- package/presets/mavis/ios-swift/hooks/README.md +29 -7
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/ios-swift/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/ios-swift/hooks/run-hook.mjs +103 -0
- package/presets/mavis/ios-swift/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/ios-swift/native-skills/README.md +15 -0
- package/presets/mavis/ios-swift/native-skills/ci-investigation/SKILL.md +53 -0
- package/presets/mavis/ios-swift/native-skills/code-review/SKILL.md +62 -0
- package/presets/mavis/ios-swift/native-skills/debug-investigation/SKILL.md +72 -0
- package/presets/mavis/ios-swift/native-skills/feature-delivery/SKILL.md +51 -0
- package/presets/mavis/ios-swift/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/ios-swift/native-skills/mockup-review/SKILL.md +34 -0
- package/presets/mavis/ios-swift/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/ios-swift/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/ios-swift/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/ios-swift/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/ios-swift/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/ios-swift/native-skills/task/SKILL.md +79 -0
- package/presets/mavis/ios-swift/native-skills/task-continue/SKILL.md +74 -0
- package/presets/mavis/ios-swift/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/ios-swift/native-skills/unit-testing/SKILL.md +38 -0
- package/presets/mavis/ios-swift/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/ios-swift/native-skills/ux-design/SKILL.md +41 -0
- package/presets/mavis/ios-swift/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/ios-swift/native-skills/xcuitest-e2e/SKILL.md +39 -0
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/ios-swift/rules/code-review-mr.md +19 -4
- package/presets/mavis/ios-swift/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/java/MAVIS.md +9 -3
- package/presets/mavis/java/README.md +3 -1
- package/presets/mavis/java/adapter-map.json +94 -40
- package/presets/mavis/java/agents/code-reviewer.md +5 -1
- package/presets/mavis/java/commands/update.md +1 -0
- package/presets/mavis/java/hooks/README.md +29 -7
- package/presets/mavis/java/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/java/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/java/hooks/run-hook.mjs +103 -0
- package/presets/mavis/java/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/java/native-skills/README.md +15 -0
- package/presets/mavis/java/native-skills/ci-investigation/SKILL.md +24 -0
- package/presets/mavis/java/native-skills/code-review/SKILL.md +48 -0
- package/presets/mavis/java/native-skills/debug-investigation/SKILL.md +55 -0
- package/presets/mavis/java/native-skills/feature-delivery/SKILL.md +43 -0
- package/presets/mavis/java/native-skills/integration-testing/SKILL.md +21 -0
- package/presets/mavis/java/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/java/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/java/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/java/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/java/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/java/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/java/native-skills/task/SKILL.md +77 -0
- package/presets/mavis/java/native-skills/task-continue/SKILL.md +72 -0
- package/presets/mavis/java/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/java/native-skills/unit-testing/SKILL.md +20 -0
- package/presets/mavis/java/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/java/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/java/rules/code-review-mr.md +19 -4
- package/presets/mavis/java/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/mcp-ts/MAVIS.md +9 -3
- package/presets/mavis/mcp-ts/README.md +3 -1
- package/presets/mavis/mcp-ts/adapter-map.json +77 -32
- package/presets/mavis/mcp-ts/commands/update.md +1 -0
- package/presets/mavis/mcp-ts/hooks/README.md +29 -7
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/mcp-ts/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/mcp-ts/hooks/run-hook.mjs +103 -0
- package/presets/mavis/mcp-ts/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/mcp-ts/native-skills/README.md +15 -0
- package/presets/mavis/mcp-ts/native-skills/code-review/SKILL.md +31 -0
- package/presets/mavis/mcp-ts/native-skills/debug-investigation/SKILL.md +51 -0
- package/presets/mavis/mcp-ts/native-skills/feature-delivery/SKILL.md +42 -0
- package/presets/mavis/mcp-ts/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/mcp-ts/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/mcp-ts/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/mcp-ts/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/mcp-ts/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/mcp-ts/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/mcp-ts/native-skills/task/SKILL.md +77 -0
- package/presets/mavis/mcp-ts/native-skills/task-continue/SKILL.md +72 -0
- package/presets/mavis/mcp-ts/native-skills/technical-retro/SKILL.md +95 -0
- package/presets/mavis/mcp-ts/native-skills/unit-testing/SKILL.md +22 -0
- package/presets/mavis/mcp-ts/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/mcp-ts/rules/code-review-mr.md +19 -4
- package/presets/mavis/mol/MAVIS.md +9 -3
- package/presets/mavis/mol/README.md +3 -1
- package/presets/mavis/mol/REPO_AGENTS.md +1 -1
- package/presets/mavis/mol/adapter-map.json +94 -40
- package/presets/mavis/mol/agents/code-reviewer.md +5 -1
- package/presets/mavis/mol/agents/task-router.md +1 -1
- package/presets/mavis/mol/commands/update.md +1 -0
- package/presets/mavis/mol/hooks/README.md +29 -7
- package/presets/mavis/mol/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/mol/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/mol/hooks/run-hook.mjs +103 -0
- package/presets/mavis/mol/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/mol/native-skills/README.md +15 -0
- package/presets/mavis/mol/native-skills/ci-investigation/SKILL.md +49 -0
- package/presets/mavis/mol/native-skills/code-review/SKILL.md +61 -0
- package/presets/mavis/mol/native-skills/debug-investigation/SKILL.md +63 -0
- package/presets/mavis/mol/native-skills/feature-delivery/SKILL.md +44 -0
- package/presets/mavis/mol/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/mol/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/mol/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/mol/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/mol/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/mol/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/mol/native-skills/task/SKILL.md +82 -0
- package/presets/mavis/mol/native-skills/task-continue/SKILL.md +74 -0
- package/presets/mavis/mol/native-skills/task-evil/SKILL.md +89 -0
- package/presets/mavis/mol/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/mol/native-skills/unit-testing/SKILL.md +38 -0
- package/presets/mavis/mol/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/mol/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/mol/rules/code-review-mr.md +19 -4
- package/presets/mavis/mol/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/next/MAVIS.md +9 -3
- package/presets/mavis/next/README.md +3 -1
- package/presets/mavis/next/REPO_AGENTS.md +1 -1
- package/presets/mavis/next/adapter-map.json +128 -53
- package/presets/mavis/next/agents/build-verifier.md +2 -1
- package/presets/mavis/next/agents/code-reviewer.md +5 -1
- package/presets/mavis/next/agents/feature-developer.md +1 -1
- package/presets/mavis/next/agents/task-router.md +1 -1
- package/presets/mavis/next/commands/update.md +1 -0
- package/presets/mavis/next/hooks/README.md +29 -7
- package/presets/mavis/next/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/next/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/next/hooks/run-hook.mjs +103 -0
- package/presets/mavis/next/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/next/native-skills/README.md +15 -0
- package/presets/mavis/next/native-skills/ci-investigation/SKILL.md +50 -0
- package/presets/mavis/next/native-skills/code-review/SKILL.md +62 -0
- package/presets/mavis/next/native-skills/debug-investigation/SKILL.md +64 -0
- package/presets/mavis/next/native-skills/feature-delivery/SKILL.md +45 -0
- package/presets/mavis/next/native-skills/figma-fidelity/SKILL.md +131 -0
- package/presets/mavis/next/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/next/native-skills/mockup-review/SKILL.md +44 -0
- package/presets/mavis/next/native-skills/playwright-e2e/SKILL.md +39 -0
- package/presets/mavis/next/native-skills/react-performance/SKILL.md +49 -0
- package/presets/mavis/next/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/next/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/next/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/next/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/next/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/next/native-skills/task/SKILL.md +88 -0
- package/presets/mavis/next/native-skills/task-continue/SKILL.md +87 -0
- package/presets/mavis/next/native-skills/task-evil/SKILL.md +89 -0
- package/presets/mavis/next/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/next/native-skills/ui-start/SKILL.md +64 -0
- package/presets/mavis/next/native-skills/ui-stop/SKILL.md +48 -0
- package/presets/mavis/next/native-skills/unit-testing/SKILL.md +40 -0
- package/presets/mavis/next/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/next/native-skills/ux-design/SKILL.md +41 -0
- package/presets/mavis/next/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/next/rules/code-review-mr.md +19 -4
- package/presets/mavis/next/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/nuxt/MAVIS.md +9 -3
- package/presets/mavis/nuxt/README.md +3 -1
- package/presets/mavis/nuxt/adapter-map.json +109 -46
- package/presets/mavis/nuxt/agents/code-reviewer.md +5 -1
- package/presets/mavis/nuxt/agents/task-router.md +1 -1
- package/presets/mavis/nuxt/commands/update.md +1 -0
- package/presets/mavis/nuxt/hooks/README.md +29 -7
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/nuxt/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/nuxt/hooks/run-hook.mjs +103 -0
- package/presets/mavis/nuxt/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/nuxt/native-skills/README.md +15 -0
- package/presets/mavis/nuxt/native-skills/ci-investigation/SKILL.md +50 -0
- package/presets/mavis/nuxt/native-skills/code-review/SKILL.md +61 -0
- package/presets/mavis/nuxt/native-skills/debug-investigation/SKILL.md +64 -0
- package/presets/mavis/nuxt/native-skills/feature-delivery/SKILL.md +52 -0
- package/presets/mavis/nuxt/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/nuxt/native-skills/mockup-review/SKILL.md +34 -0
- package/presets/mavis/nuxt/native-skills/playwright-e2e/SKILL.md +43 -0
- package/presets/mavis/nuxt/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/nuxt/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/nuxt/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/nuxt/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/nuxt/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/nuxt/native-skills/task/SKILL.md +79 -0
- package/presets/mavis/nuxt/native-skills/task-continue/SKILL.md +74 -0
- package/presets/mavis/nuxt/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/nuxt/native-skills/unit-testing/SKILL.md +38 -0
- package/presets/mavis/nuxt/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/nuxt/native-skills/ux-design/SKILL.md +41 -0
- package/presets/mavis/nuxt/native-skills/vue-performance/SKILL.md +58 -0
- package/presets/mavis/nuxt/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/nuxt/rules/code-review-mr.md +19 -4
- package/presets/mavis/nuxt/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/php-hexagonal/MAVIS.md +9 -3
- package/presets/mavis/php-hexagonal/README.md +3 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +94 -40
- package/presets/mavis/php-hexagonal/agents/code-reviewer.md +5 -1
- package/presets/mavis/php-hexagonal/commands/update.md +1 -0
- package/presets/mavis/php-hexagonal/hooks/README.md +29 -7
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/php-hexagonal/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/php-hexagonal/hooks/run-hook.mjs +103 -0
- package/presets/mavis/php-hexagonal/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/php-hexagonal/native-skills/README.md +15 -0
- package/presets/mavis/php-hexagonal/native-skills/ci-investigation/SKILL.md +24 -0
- package/presets/mavis/php-hexagonal/native-skills/code-review/SKILL.md +48 -0
- package/presets/mavis/php-hexagonal/native-skills/debug-investigation/SKILL.md +55 -0
- package/presets/mavis/php-hexagonal/native-skills/feature-delivery/SKILL.md +43 -0
- package/presets/mavis/php-hexagonal/native-skills/integration-testing/SKILL.md +21 -0
- package/presets/mavis/php-hexagonal/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/php-hexagonal/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/php-hexagonal/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/php-hexagonal/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/php-hexagonal/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/php-hexagonal/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/php-hexagonal/native-skills/task/SKILL.md +77 -0
- package/presets/mavis/php-hexagonal/native-skills/task-continue/SKILL.md +72 -0
- package/presets/mavis/php-hexagonal/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/php-hexagonal/native-skills/unit-testing/SKILL.md +20 -0
- package/presets/mavis/php-hexagonal/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/php-hexagonal/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/php-hexagonal/rules/code-review-mr.md +19 -4
- package/presets/mavis/php-hexagonal/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/php-laravel/MAVIS.md +9 -3
- package/presets/mavis/php-laravel/README.md +3 -1
- package/presets/mavis/php-laravel/adapter-map.json +94 -40
- package/presets/mavis/php-laravel/agents/code-reviewer.md +5 -1
- package/presets/mavis/php-laravel/commands/update.md +1 -0
- package/presets/mavis/php-laravel/hooks/README.md +29 -7
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/php-laravel/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/php-laravel/hooks/run-hook.mjs +103 -0
- package/presets/mavis/php-laravel/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/php-laravel/native-skills/README.md +15 -0
- package/presets/mavis/php-laravel/native-skills/ci-investigation/SKILL.md +24 -0
- package/presets/mavis/php-laravel/native-skills/code-review/SKILL.md +48 -0
- package/presets/mavis/php-laravel/native-skills/debug-investigation/SKILL.md +55 -0
- package/presets/mavis/php-laravel/native-skills/feature-delivery/SKILL.md +43 -0
- package/presets/mavis/php-laravel/native-skills/integration-testing/SKILL.md +21 -0
- package/presets/mavis/php-laravel/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/php-laravel/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/php-laravel/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/php-laravel/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/php-laravel/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/php-laravel/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/php-laravel/native-skills/task/SKILL.md +77 -0
- package/presets/mavis/php-laravel/native-skills/task-continue/SKILL.md +72 -0
- package/presets/mavis/php-laravel/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/php-laravel/native-skills/unit-testing/SKILL.md +20 -0
- package/presets/mavis/php-laravel/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/php-laravel/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/php-laravel/rules/code-review-mr.md +19 -4
- package/presets/mavis/php-laravel/skills/code-review/SKILL.md +2 -1
- package/presets/mavis/platform-contract.json +18 -5
- package/presets/mavis/svelte/MAVIS.md +9 -3
- package/presets/mavis/svelte/README.md +3 -1
- package/presets/mavis/svelte/adapter-map.json +109 -46
- package/presets/mavis/svelte/agents/code-reviewer.md +5 -1
- package/presets/mavis/svelte/agents/task-router.md +1 -1
- package/presets/mavis/svelte/commands/update.md +1 -0
- package/presets/mavis/svelte/hooks/README.md +29 -7
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +40 -0
- package/presets/mavis/svelte/hooks/mavis-chain-hook.mjs +143 -0
- package/presets/mavis/svelte/hooks/run-hook.mjs +103 -0
- package/presets/mavis/svelte/minimax-hooks/hooks.json +28 -0
- package/presets/mavis/svelte/native-skills/README.md +15 -0
- package/presets/mavis/svelte/native-skills/ci-investigation/SKILL.md +50 -0
- package/presets/mavis/svelte/native-skills/code-review/SKILL.md +61 -0
- package/presets/mavis/svelte/native-skills/debug-investigation/SKILL.md +64 -0
- package/presets/mavis/svelte/native-skills/feature-delivery/SKILL.md +52 -0
- package/presets/mavis/svelte/native-skills/migrate-tasks/SKILL.md +43 -0
- package/presets/mavis/svelte/native-skills/mockup-review/SKILL.md +34 -0
- package/presets/mavis/svelte/native-skills/playwright-e2e/SKILL.md +43 -0
- package/presets/mavis/svelte/native-skills/rr-migrate-repositories/SKILL.md +61 -0
- package/presets/mavis/svelte/native-skills/rr-scheduler-start/SKILL.md +34 -0
- package/presets/mavis/svelte/native-skills/spec-authoring/SKILL.md +31 -0
- package/presets/mavis/svelte/native-skills/spec-discovery/SKILL.md +63 -0
- package/presets/mavis/svelte/native-skills/spec-start/SKILL.md +31 -0
- package/presets/mavis/svelte/native-skills/svelte-performance/SKILL.md +57 -0
- package/presets/mavis/svelte/native-skills/task/SKILL.md +79 -0
- package/presets/mavis/svelte/native-skills/task-continue/SKILL.md +74 -0
- package/presets/mavis/svelte/native-skills/technical-retro/SKILL.md +72 -0
- package/presets/mavis/svelte/native-skills/unit-testing/SKILL.md +38 -0
- package/presets/mavis/svelte/native-skills/update/SKILL.md +44 -0
- package/presets/mavis/svelte/native-skills/ux-design/SKILL.md +41 -0
- package/presets/mavis/svelte/native-skills/write-adr/SKILL.md +46 -0
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/svelte/rules/code-review-mr.md +19 -4
- package/presets/mavis/svelte/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/code-reviewer.md +5 -1
- package/presets/opencode/android-kotlin/commands/update.md +1 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/android-kotlin/rules/code-review-mr.md +19 -4
- package/presets/opencode/android-kotlin/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/code-reviewer.md +5 -1
- package/presets/opencode/go/commands/update.md +1 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/go/rules/code-review-mr.md +19 -4
- package/presets/opencode/go/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/code-reviewer.md +5 -1
- package/presets/opencode/ios-swift/commands/update.md +1 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/ios-swift/rules/code-review-mr.md +19 -4
- package/presets/opencode/ios-swift/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/code-reviewer.md +5 -1
- package/presets/opencode/java/commands/update.md +1 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/java/rules/code-review-mr.md +19 -4
- package/presets/opencode/java/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/commands/update.md +1 -0
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/mcp-ts/rules/code-review-mr.md +19 -4
- package/presets/opencode/mol/REPO_AGENTS.md +1 -1
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/agents/code-reviewer.md +5 -1
- package/presets/opencode/mol/agents/task-router.md +1 -1
- package/presets/opencode/mol/commands/update.md +1 -0
- package/presets/opencode/mol/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/mol/rules/code-review-mr.md +19 -4
- package/presets/opencode/mol/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/next/REPO_AGENTS.md +1 -1
- package/presets/opencode/next/adapter-map.json +1 -1
- package/presets/opencode/next/agents/build-verifier.md +2 -1
- package/presets/opencode/next/agents/code-reviewer.md +5 -1
- package/presets/opencode/next/agents/feature-developer.md +1 -1
- package/presets/opencode/next/agents/task-router.md +1 -1
- package/presets/opencode/next/commands/update.md +1 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/next/rules/code-review-mr.md +19 -4
- package/presets/opencode/next/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +5 -1
- package/presets/opencode/nuxt/agents/task-router.md +1 -1
- package/presets/opencode/nuxt/commands/update.md +1 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/nuxt/rules/code-review-mr.md +19 -4
- package/presets/opencode/nuxt/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/code-reviewer.md +5 -1
- package/presets/opencode/php-hexagonal/commands/update.md +1 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/php-hexagonal/rules/code-review-mr.md +19 -4
- package/presets/opencode/php-hexagonal/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/code-reviewer.md +5 -1
- package/presets/opencode/php-laravel/commands/update.md +1 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/php-laravel/rules/code-review-mr.md +19 -4
- package/presets/opencode/php-laravel/skills/code-review/SKILL.md +2 -1
- package/presets/opencode/plugins/task-status/README.md +4 -3
- package/presets/opencode/plugins/task-status/deepseek.ts +68 -34
- package/presets/opencode/plugins/task-status/task-view.ts +4 -1
- package/presets/opencode/plugins/task-status/tui.tsx +16 -18
- package/presets/opencode/plugins/task-status/types.ts +5 -1
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +5 -1
- package/presets/opencode/svelte/agents/task-router.md +1 -1
- package/presets/opencode/svelte/commands/update.md +1 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +40 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/svelte/rules/code-review-mr.md +19 -4
- package/presets/opencode/svelte/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/agents/code-reviewer.md +5 -1
- package/presets/zcode/android-kotlin/commands/update.md +1 -0
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/android-kotlin/rules/code-review-mr.md +19 -4
- package/presets/zcode/android-kotlin/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/agents/code-reviewer.md +5 -1
- package/presets/zcode/go/commands/update.md +1 -0
- package/presets/zcode/go/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/go/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/go/rules/code-review-mr.md +19 -4
- package/presets/zcode/go/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/agents/code-reviewer.md +5 -1
- package/presets/zcode/ios-swift/commands/update.md +1 -0
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/ios-swift/rules/code-review-mr.md +19 -4
- package/presets/zcode/ios-swift/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/agents/code-reviewer.md +5 -1
- package/presets/zcode/java/commands/update.md +1 -0
- package/presets/zcode/java/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/java/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/java/rules/code-review-mr.md +19 -4
- package/presets/zcode/java/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/commands/update.md +1 -0
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/mcp-ts/rules/code-review-mr.md +19 -4
- package/presets/zcode/mol/REPO_AGENTS.md +1 -1
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/agents/code-reviewer.md +5 -1
- package/presets/zcode/mol/agents/task-router.md +1 -1
- package/presets/zcode/mol/commands/update.md +1 -0
- package/presets/zcode/mol/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/mol/rules/code-review-mr.md +19 -4
- package/presets/zcode/mol/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/next/REPO_AGENTS.md +1 -1
- package/presets/zcode/next/adapter-map.json +1 -1
- package/presets/zcode/next/agents/build-verifier.md +2 -1
- package/presets/zcode/next/agents/code-reviewer.md +5 -1
- package/presets/zcode/next/agents/feature-developer.md +1 -1
- package/presets/zcode/next/agents/task-router.md +1 -1
- package/presets/zcode/next/commands/update.md +1 -0
- package/presets/zcode/next/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/next/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/next/rules/code-review-mr.md +19 -4
- package/presets/zcode/next/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/agents/code-reviewer.md +5 -1
- package/presets/zcode/nuxt/agents/task-router.md +1 -1
- package/presets/zcode/nuxt/commands/update.md +1 -0
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/nuxt/rules/code-review-mr.md +19 -4
- package/presets/zcode/nuxt/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/agents/code-reviewer.md +5 -1
- package/presets/zcode/php-hexagonal/commands/update.md +1 -0
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/php-hexagonal/rules/code-review-mr.md +19 -4
- package/presets/zcode/php-hexagonal/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/agents/code-reviewer.md +5 -1
- package/presets/zcode/php-laravel/commands/update.md +1 -0
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/php-laravel/rules/code-review-mr.md +19 -4
- package/presets/zcode/php-laravel/skills/code-review/SKILL.md +2 -1
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/agents/code-reviewer.md +5 -1
- package/presets/zcode/svelte/agents/task-router.md +1 -1
- package/presets/zcode/svelte/commands/update.md +1 -0
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +40 -0
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/svelte/rules/code-review-mr.md +19 -4
- package/presets/zcode/svelte/skills/code-review/SKILL.md +2 -1
|
@@ -4012,14 +4012,54 @@ export function runRepositoriesCommand(subcommand, args, options = {}) {
|
|
|
4012
4012
|
if (json) return { exitCode: 0, output: renderJson({ ok: true, dryRun: true, id, linksRemoved }) };
|
|
4013
4013
|
return { exitCode: 0, output: `delete (dry run): ${id} linksRemoved=${linksRemoved}\n` };
|
|
4014
4014
|
}
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4015
|
+
// The project-registry cleanup (the resurrection guard): re-registering
|
|
4016
|
+
// a deleted repository id must never silently resurrect stale project
|
|
4017
|
+
// memberships, so the links naming this repository leave the projects
|
|
4018
|
+
// file in the same child. The nested projects lock is taken before
|
|
4019
|
+
// either file is written, still inside the repositories lock — the
|
|
4020
|
+
// frozen order `.repositories.lock` -> `.project-registry.lock` — so a
|
|
4021
|
+
// refusal here aborts the whole delete with both files untouched and
|
|
4022
|
+
// parseable.
|
|
4023
|
+
const projectPaths = projectsPaths(teamRoot);
|
|
4024
|
+
fs.mkdirSync(projectPaths.root, { recursive: true });
|
|
4025
|
+
let projectsToken = null;
|
|
4026
|
+
try {
|
|
4027
|
+
projectsToken = acquireLock(projectPaths.lock, { timeoutMs: 5000 });
|
|
4028
|
+
} catch (error) {
|
|
4029
|
+
teamDbFail(
|
|
4030
|
+
'E_PROJECTS_BUSY',
|
|
4031
|
+
`could not take the projects lock at ${projectPaths.lock}: ${error.message}`,
|
|
4032
|
+
4,
|
|
4033
|
+
);
|
|
4034
|
+
}
|
|
4035
|
+
try {
|
|
4036
|
+
const projectsDocument = readProjectsFile(teamRoot);
|
|
4037
|
+
const removedLinks = projectsDocument.links.filter((link) => link.repositoryId === id);
|
|
4038
|
+
const membersRemoved = removedLinks.length;
|
|
4039
|
+
const affectedProjectIds = [...new Set(removedLinks.map((link) => link.projectId))];
|
|
4040
|
+
writeProjectsFile(teamRoot, {
|
|
4041
|
+
...projectsDocument,
|
|
4042
|
+
links: projectsDocument.links.filter((link) => link.repositoryId !== id),
|
|
4043
|
+
});
|
|
4044
|
+
writeRepositoriesFile(teamRoot, {
|
|
4045
|
+
...file,
|
|
4046
|
+
repositories: file.repositories.filter((entry) => entry.id !== id),
|
|
4047
|
+
links: file.links.filter((link) => link.repositoryId !== id),
|
|
4048
|
+
});
|
|
4049
|
+
const projection = containProjection(() => projectRepositoriesInChild(teamRoot, { repositoryIds: [id], taskSlugs: [] }));
|
|
4050
|
+
const projectProjection = containProjectsProjection(() =>
|
|
4051
|
+
projectProjectsInChild(teamRoot, { projectIds: affectedProjectIds, repositoryIds: [id] }),
|
|
4052
|
+
);
|
|
4053
|
+
if (json) {
|
|
4054
|
+
return {
|
|
4055
|
+
exitCode: 0,
|
|
4056
|
+
output: renderJson({ ok: true, id, linksRemoved, membersRemoved, projection, projectProjection }),
|
|
4057
|
+
};
|
|
4058
|
+
}
|
|
4059
|
+
return { exitCode: 0, output: `delete: ${id} linksRemoved=${linksRemoved} membersRemoved=${membersRemoved}\n` };
|
|
4060
|
+
} finally {
|
|
4061
|
+
releaseLock(projectPaths.lock, projectsToken);
|
|
4062
|
+
}
|
|
4023
4063
|
});
|
|
4024
4064
|
}
|
|
4025
4065
|
|
|
@@ -4042,6 +4082,680 @@ const containProjection = (run) => {
|
|
|
4042
4082
|
}
|
|
4043
4083
|
};
|
|
4044
4084
|
|
|
4085
|
+
/* --------------------------- project-registry.json ------------------------- */
|
|
4086
|
+
|
|
4087
|
+
export const PROJECTS_FILE = 'project-registry.json';
|
|
4088
|
+
export const PROJECTS_LOCK = '.project-registry.lock';
|
|
4089
|
+
export const PROJECTS_FILE_VERSION = 1;
|
|
4090
|
+
/** The closed write-time `status` vocabulary. The reader accepts anything. */
|
|
4091
|
+
export const PROJECT_STATUSES = ['active', 'archived'];
|
|
4092
|
+
export const DECLARED_PROJECT_KEYS = [
|
|
4093
|
+
'id',
|
|
4094
|
+
'name',
|
|
4095
|
+
'description',
|
|
4096
|
+
'status',
|
|
4097
|
+
'revision',
|
|
4098
|
+
'createdAt',
|
|
4099
|
+
'updatedAt',
|
|
4100
|
+
];
|
|
4101
|
+
export const DECLARED_PROJECT_LINK_KEYS = ['projectId', 'repositoryId', 'addedAt'];
|
|
4102
|
+
|
|
4103
|
+
const MAX_PROJECT_DESCRIPTION_LENGTH = 2000;
|
|
4104
|
+
|
|
4105
|
+
/** Every path the project registry owns under one team root. */
|
|
4106
|
+
export function projectsPaths(teamRoot) {
|
|
4107
|
+
const root = resolveTeamRoot(teamRoot);
|
|
4108
|
+
return {
|
|
4109
|
+
root,
|
|
4110
|
+
file: path.join(root, PROJECTS_FILE),
|
|
4111
|
+
lock: path.join(root, PROJECTS_LOCK),
|
|
4112
|
+
};
|
|
4113
|
+
}
|
|
4114
|
+
|
|
4115
|
+
const failProjectField = (parameter, detail) => {
|
|
4116
|
+
const error = new TeamDbError('E_VALIDATION', `parameter "${parameter}": ${detail}`, 3);
|
|
4117
|
+
error.parameter = parameter;
|
|
4118
|
+
throw error;
|
|
4119
|
+
};
|
|
4120
|
+
|
|
4121
|
+
const projectsFileFailure = (detail) => teamDbFail('E_PROJECTS_PARSE', detail, 1);
|
|
4122
|
+
|
|
4123
|
+
const assertProjectKeys = (record, allowed, prefix) => {
|
|
4124
|
+
for (const key of Object.keys(record)) {
|
|
4125
|
+
if (!allowed.includes(key)) projectsFileFailure(`${prefix}${key}: unknown key`);
|
|
4126
|
+
}
|
|
4127
|
+
};
|
|
4128
|
+
|
|
4129
|
+
const projectText = (value, parameter, { min = 0, max } = {}) => {
|
|
4130
|
+
if (typeof value !== 'string' || value.length < min || (max !== undefined && value.length > max)) {
|
|
4131
|
+
projectsFileFailure(`"${parameter}" must be a string of ${min}-${max ?? 'unbounded'} characters`);
|
|
4132
|
+
}
|
|
4133
|
+
return value;
|
|
4134
|
+
};
|
|
4135
|
+
|
|
4136
|
+
const projectIso = (value, parameter) => {
|
|
4137
|
+
if (typeof value !== 'string' || Number.isNaN(Date.parse(value))) {
|
|
4138
|
+
projectsFileFailure(`"${parameter}" must be an ISO 8601 timestamp`);
|
|
4139
|
+
}
|
|
4140
|
+
return value;
|
|
4141
|
+
};
|
|
4142
|
+
|
|
4143
|
+
/**
|
|
4144
|
+
* Validate one stored project record and normalize it into the declared key
|
|
4145
|
+
* order. The reader is strict about shapes and permissive about `status`, the
|
|
4146
|
+
* same split as the repository record: the write verbs refuse an
|
|
4147
|
+
* out-of-vocabulary status with `E_VALIDATION`, the projection serves whatever
|
|
4148
|
+
* a hand-edited file says.
|
|
4149
|
+
*/
|
|
4150
|
+
const readProjectRecord = (entry, path_) => {
|
|
4151
|
+
if (!isRecord(entry)) projectsFileFailure(`${path_}: a project must be an object`);
|
|
4152
|
+
assertProjectKeys(entry, DECLARED_PROJECT_KEYS, `${path_}: `);
|
|
4153
|
+
const id = entry.id;
|
|
4154
|
+
if (
|
|
4155
|
+
typeof id !== 'string' ||
|
|
4156
|
+
!SLUG_RE.test(id) ||
|
|
4157
|
+
id.length < 1 ||
|
|
4158
|
+
id.length > MAX_REPOSITORY_ID_LENGTH
|
|
4159
|
+
) {
|
|
4160
|
+
projectsFileFailure(`${path_}: "id" must match ${SLUG_RE.source} and be 1-48 characters`);
|
|
4161
|
+
}
|
|
4162
|
+
const description = entry.description ?? null;
|
|
4163
|
+
if (description !== null) {
|
|
4164
|
+
projectText(description, 'description', { max: MAX_PROJECT_DESCRIPTION_LENGTH });
|
|
4165
|
+
}
|
|
4166
|
+
if (!Number.isInteger(entry.revision) || entry.revision < 1) {
|
|
4167
|
+
projectsFileFailure(`${path_}: "revision" must be an integer of at least 1`);
|
|
4168
|
+
}
|
|
4169
|
+
return {
|
|
4170
|
+
id,
|
|
4171
|
+
name: projectText(entry.name, 'name', { min: 1, max: MAX_REPOSITORY_NAME_LENGTH }),
|
|
4172
|
+
description,
|
|
4173
|
+
status: projectText(entry.status, 'status', { min: 1 }),
|
|
4174
|
+
revision: entry.revision,
|
|
4175
|
+
createdAt: projectIso(entry.createdAt, 'createdAt'),
|
|
4176
|
+
updatedAt: projectIso(entry.updatedAt, 'updatedAt'),
|
|
4177
|
+
};
|
|
4178
|
+
};
|
|
4179
|
+
|
|
4180
|
+
const readProjectLinkRecord = (entry, path_) => {
|
|
4181
|
+
if (!isRecord(entry)) projectsFileFailure(`${path_}: a link must be an object`);
|
|
4182
|
+
assertProjectKeys(entry, DECLARED_PROJECT_LINK_KEYS, `${path_}: `);
|
|
4183
|
+
return {
|
|
4184
|
+
projectId: projectText(entry.projectId, 'projectId', { min: 1 }),
|
|
4185
|
+
repositoryId: projectText(entry.repositoryId, 'repositoryId', { min: 1 }),
|
|
4186
|
+
addedAt: projectIso(entry.addedAt, 'addedAt'),
|
|
4187
|
+
};
|
|
4188
|
+
};
|
|
4189
|
+
|
|
4190
|
+
/**
|
|
4191
|
+
* Read `project-registry.json`. An absent file is an empty valid store; there
|
|
4192
|
+
* is no seed and no backfill from `repositories.json` in either direction.
|
|
4193
|
+
*
|
|
4194
|
+
* A malformed file is a named failure: the caller never writes over it, and
|
|
4195
|
+
* the projection records the error without tombstoning a row. A link naming
|
|
4196
|
+
* an unknown endpoint is the same refusal (I-1): the file is the definition
|
|
4197
|
+
* of record, so a dangling membership is a hand-edit bug, not a tolerable
|
|
4198
|
+
* state.
|
|
4199
|
+
*/
|
|
4200
|
+
export function readProjectsFile(teamRoot) {
|
|
4201
|
+
const paths = projectsPaths(teamRoot);
|
|
4202
|
+
let text;
|
|
4203
|
+
try {
|
|
4204
|
+
text = fs.readFileSync(paths.file, 'utf8');
|
|
4205
|
+
} catch (error) {
|
|
4206
|
+
if (error.code === 'ENOENT') {
|
|
4207
|
+
return { version: PROJECTS_FILE_VERSION, projects: [], links: [], present: false };
|
|
4208
|
+
}
|
|
4209
|
+
projectsFileFailure(`${paths.file}: ${error.message}`);
|
|
4210
|
+
}
|
|
4211
|
+
let parsed;
|
|
4212
|
+
try {
|
|
4213
|
+
parsed = JSON.parse(text);
|
|
4214
|
+
} catch (error) {
|
|
4215
|
+
projectsFileFailure(`${paths.file}: not valid JSON (${error.message})`);
|
|
4216
|
+
}
|
|
4217
|
+
if (!isRecord(parsed)) projectsFileFailure(`${paths.file}: top level must be an object`);
|
|
4218
|
+
for (const key of Object.keys(parsed)) {
|
|
4219
|
+
if (!['version', 'projects', 'links'].includes(key)) {
|
|
4220
|
+
projectsFileFailure(`${paths.file}: unknown top-level key "${key}"`);
|
|
4221
|
+
}
|
|
4222
|
+
}
|
|
4223
|
+
if (parsed.version !== PROJECTS_FILE_VERSION) {
|
|
4224
|
+
projectsFileFailure(
|
|
4225
|
+
`${paths.file}: version must be ${PROJECTS_FILE_VERSION}, got ${JSON.stringify(parsed.version)}`,
|
|
4226
|
+
);
|
|
4227
|
+
}
|
|
4228
|
+
if (!Array.isArray(parsed.projects)) projectsFileFailure(`${paths.file}: "projects" must be an array`);
|
|
4229
|
+
if (!Array.isArray(parsed.links)) projectsFileFailure(`${paths.file}: "links" must be an array`);
|
|
4230
|
+
|
|
4231
|
+
const seen = new Set();
|
|
4232
|
+
const projects = parsed.projects.map((entry) => {
|
|
4233
|
+
const record = readProjectRecord(entry, paths.file);
|
|
4234
|
+
if (seen.has(record.id)) projectsFileFailure(`${paths.file}: duplicate project id "${record.id}"`);
|
|
4235
|
+
seen.add(record.id);
|
|
4236
|
+
return record;
|
|
4237
|
+
});
|
|
4238
|
+
const repositoryIds = new Set(readRepositoriesFile(teamRoot).repositories.map((record) => record.id));
|
|
4239
|
+
const linkKeys = new Set();
|
|
4240
|
+
const links = parsed.links.map((entry) => {
|
|
4241
|
+
const link = readProjectLinkRecord(entry, paths.file);
|
|
4242
|
+
if (!seen.has(link.projectId)) {
|
|
4243
|
+
projectsFileFailure(`${paths.file}: link names the unknown project "${link.projectId}"`);
|
|
4244
|
+
}
|
|
4245
|
+
if (!repositoryIds.has(link.repositoryId)) {
|
|
4246
|
+
projectsFileFailure(`${paths.file}: link names the unknown repository "${link.repositoryId}"`);
|
|
4247
|
+
}
|
|
4248
|
+
const key = `${link.projectId}\u0000${link.repositoryId}`;
|
|
4249
|
+
if (linkKeys.has(key)) {
|
|
4250
|
+
projectsFileFailure(
|
|
4251
|
+
`${paths.file}: duplicate link "${link.projectId}" -> "${link.repositoryId}"`,
|
|
4252
|
+
);
|
|
4253
|
+
}
|
|
4254
|
+
linkKeys.add(key);
|
|
4255
|
+
return link;
|
|
4256
|
+
});
|
|
4257
|
+
return { version: PROJECTS_FILE_VERSION, projects, links, present: true };
|
|
4258
|
+
}
|
|
4259
|
+
|
|
4260
|
+
/**
|
|
4261
|
+
* Deterministic serialization: declared key order, projects sorted by id, links
|
|
4262
|
+
* by `(projectId, repositoryId)`, two-space indent, one trailing newline. An
|
|
4263
|
+
* unchanged rewrite is byte-identical.
|
|
4264
|
+
*/
|
|
4265
|
+
export function serializeProjectsFile(document) {
|
|
4266
|
+
const projects = [...document.projects]
|
|
4267
|
+
.sort((left, right) => byText(left.id, right.id))
|
|
4268
|
+
.map((record) => {
|
|
4269
|
+
const output = {};
|
|
4270
|
+
for (const key of DECLARED_PROJECT_KEYS) output[key] = record[key];
|
|
4271
|
+
return output;
|
|
4272
|
+
});
|
|
4273
|
+
const links = [...document.links]
|
|
4274
|
+
.sort((left, right) => byText(left.projectId, right.projectId) || byText(left.repositoryId, right.repositoryId))
|
|
4275
|
+
.map((record) => {
|
|
4276
|
+
const output = {};
|
|
4277
|
+
for (const key of DECLARED_PROJECT_LINK_KEYS) output[key] = record[key];
|
|
4278
|
+
return output;
|
|
4279
|
+
});
|
|
4280
|
+
return `${JSON.stringify({ version: PROJECTS_FILE_VERSION, projects, links }, null, 2)}\n`;
|
|
4281
|
+
}
|
|
4282
|
+
|
|
4283
|
+
/** Write the registry atomically; an identical rewrite performs no write. */
|
|
4284
|
+
export function writeProjectsFile(teamRoot, document) {
|
|
4285
|
+
const paths = projectsPaths(teamRoot);
|
|
4286
|
+
const content = serializeProjectsFile(document);
|
|
4287
|
+
try {
|
|
4288
|
+
if (fs.readFileSync(paths.file, 'utf8') === content) return false;
|
|
4289
|
+
} catch {
|
|
4290
|
+
/* absent or unreadable: write it */
|
|
4291
|
+
}
|
|
4292
|
+
writeAtomicRepositoriesFile(paths.file, content);
|
|
4293
|
+
return true;
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
const projectContentHash = (record) => sha256(canonicalJson(record));
|
|
4297
|
+
const projectLinkContentHash = (link) =>
|
|
4298
|
+
sha256(canonicalJson({ projectId: link.projectId, repositoryId: link.repositoryId }));
|
|
4299
|
+
|
|
4300
|
+
const UPSERT_PROJECT_SQL = `
|
|
4301
|
+
INSERT INTO projects(
|
|
4302
|
+
id, name, description, status, revision, created_at, updated_at,
|
|
4303
|
+
content_hash, parse_error, projected_at, first_seen_at, last_seen_at, absent_at
|
|
4304
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, NULL)
|
|
4305
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
4306
|
+
name = excluded.name,
|
|
4307
|
+
description = excluded.description,
|
|
4308
|
+
status = excluded.status,
|
|
4309
|
+
revision = excluded.revision,
|
|
4310
|
+
created_at = excluded.created_at,
|
|
4311
|
+
updated_at = excluded.updated_at,
|
|
4312
|
+
content_hash = excluded.content_hash,
|
|
4313
|
+
parse_error = NULL,
|
|
4314
|
+
projected_at = excluded.projected_at,
|
|
4315
|
+
last_seen_at = excluded.last_seen_at,
|
|
4316
|
+
absent_at = NULL
|
|
4317
|
+
`;
|
|
4318
|
+
|
|
4319
|
+
const INSERT_PROJECT_LINK_SQL = `
|
|
4320
|
+
INSERT INTO project_repositories(
|
|
4321
|
+
project_id, repository_id, added_at, content_hash, projected_at
|
|
4322
|
+
) VALUES (?, ?, ?, ?, ?)
|
|
4323
|
+
`;
|
|
4324
|
+
|
|
4325
|
+
const projectProjectRecord = (db, record, now) => {
|
|
4326
|
+
const hash = projectContentHash(record);
|
|
4327
|
+
const existing = db.prepare('SELECT content_hash, first_seen_at FROM projects WHERE id = ?1').get(record.id);
|
|
4328
|
+
if (existing && existing.content_hash === hash) {
|
|
4329
|
+
// An unchanged record only moves its inventory columns.
|
|
4330
|
+
db.prepare('UPDATE projects SET projected_at = ?2, last_seen_at = ?2, absent_at = NULL WHERE id = ?1').run(
|
|
4331
|
+
record.id,
|
|
4332
|
+
now,
|
|
4333
|
+
);
|
|
4334
|
+
return;
|
|
4335
|
+
}
|
|
4336
|
+
db.prepare(UPSERT_PROJECT_SQL).run(
|
|
4337
|
+
record.id,
|
|
4338
|
+
record.name,
|
|
4339
|
+
record.description,
|
|
4340
|
+
record.status,
|
|
4341
|
+
record.revision,
|
|
4342
|
+
record.createdAt,
|
|
4343
|
+
record.updatedAt,
|
|
4344
|
+
hash,
|
|
4345
|
+
now,
|
|
4346
|
+
existing ? existing.first_seen_at : now,
|
|
4347
|
+
now,
|
|
4348
|
+
);
|
|
4349
|
+
};
|
|
4350
|
+
|
|
4351
|
+
/**
|
|
4352
|
+
* Project the project registry into `team.db`.
|
|
4353
|
+
*
|
|
4354
|
+
* `scope` narrows a write child to the rows its payload touched: the named
|
|
4355
|
+
* project ids and the named repository ids. Without a scope the whole file is
|
|
4356
|
+
* projected, absent records are tombstoned and pruned, and the membership
|
|
4357
|
+
* table is replaced. A malformed file records the failure and touches no row.
|
|
4358
|
+
*/
|
|
4359
|
+
export function projectProjects(db, options = {}) {
|
|
4360
|
+
const teamRoot = resolveTeamRoot(options.teamRoot);
|
|
4361
|
+
const now = options.now ?? new Date().toISOString();
|
|
4362
|
+
const scope = options.scope ?? null;
|
|
4363
|
+
const result = { projects: 0, links: 0, absent: 0, pruned: 0, failed: 0, errors: [] };
|
|
4364
|
+
let file;
|
|
4365
|
+
try {
|
|
4366
|
+
file = readProjectsFile(teamRoot);
|
|
4367
|
+
} catch (error) {
|
|
4368
|
+
result.failed += 1;
|
|
4369
|
+
result.errors.push({ path: projectsPaths(teamRoot).file, reason: error.message });
|
|
4370
|
+
return result;
|
|
4371
|
+
}
|
|
4372
|
+
|
|
4373
|
+
const inProjectScope = (id) => scope === null || scope.projectIds.includes(id);
|
|
4374
|
+
const knownProjects = new Set(file.projects.map((record) => record.id));
|
|
4375
|
+
// The membership table may only name repositories that exist themselves; a
|
|
4376
|
+
// repository id the other registry does not know is skipped, never inserted.
|
|
4377
|
+
const knownRepositories = new Set(
|
|
4378
|
+
readRepositoriesFile(teamRoot).repositories.map((record) => record.id),
|
|
4379
|
+
);
|
|
4380
|
+
|
|
4381
|
+
db.exec('BEGIN IMMEDIATE');
|
|
4382
|
+
try {
|
|
4383
|
+
for (const record of file.projects) {
|
|
4384
|
+
if (!inProjectScope(record.id)) continue;
|
|
4385
|
+
projectProjectRecord(db, record, now);
|
|
4386
|
+
result.projects += 1;
|
|
4387
|
+
}
|
|
4388
|
+
|
|
4389
|
+
if (scope === null) {
|
|
4390
|
+
result.absent += db
|
|
4391
|
+
.prepare('UPDATE projects SET absent_at = ? WHERE absent_at IS NULL')
|
|
4392
|
+
.run(now).changes;
|
|
4393
|
+
const stale = db.prepare('SELECT id FROM projects WHERE absent_at IS NOT NULL').all();
|
|
4394
|
+
for (const row of stale) {
|
|
4395
|
+
if (knownProjects.has(row.id)) {
|
|
4396
|
+
db.prepare('UPDATE projects SET absent_at = NULL WHERE id = ?').run(row.id);
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
db.prepare('DELETE FROM project_repositories').run();
|
|
4400
|
+
} else {
|
|
4401
|
+
for (const projectId of scope.projectIds) {
|
|
4402
|
+
db.prepare('DELETE FROM project_repositories WHERE project_id = ?').run(projectId);
|
|
4403
|
+
}
|
|
4404
|
+
for (const repositoryId of scope.repositoryIds ?? []) {
|
|
4405
|
+
db.prepare('DELETE FROM project_repositories WHERE repository_id = ?').run(repositoryId);
|
|
4406
|
+
}
|
|
4407
|
+
}
|
|
4408
|
+
|
|
4409
|
+
for (const link of file.links) {
|
|
4410
|
+
if (scope !== null && !inProjectScope(link.projectId)) continue;
|
|
4411
|
+
if (!knownProjects.has(link.projectId)) continue;
|
|
4412
|
+
if (!knownRepositories.has(link.repositoryId)) continue;
|
|
4413
|
+
db.prepare(INSERT_PROJECT_LINK_SQL).run(
|
|
4414
|
+
link.projectId,
|
|
4415
|
+
link.repositoryId,
|
|
4416
|
+
link.addedAt,
|
|
4417
|
+
projectLinkContentHash(link),
|
|
4418
|
+
now,
|
|
4419
|
+
);
|
|
4420
|
+
result.links += 1;
|
|
4421
|
+
}
|
|
4422
|
+
|
|
4423
|
+
if (scope === null) {
|
|
4424
|
+
result.pruned += db.prepare('DELETE FROM projects WHERE absent_at IS NOT NULL').run().changes;
|
|
4425
|
+
} else {
|
|
4426
|
+
for (const id of scope.projectIds) {
|
|
4427
|
+
if (knownProjects.has(id)) continue;
|
|
4428
|
+
result.pruned += db.prepare('DELETE FROM projects WHERE id = ?').run(id).changes;
|
|
4429
|
+
}
|
|
4430
|
+
}
|
|
4431
|
+
db.exec('COMMIT');
|
|
4432
|
+
} catch (error) {
|
|
4433
|
+
try {
|
|
4434
|
+
db.exec('ROLLBACK');
|
|
4435
|
+
} catch {
|
|
4436
|
+
/* the primary failure is the finding */
|
|
4437
|
+
}
|
|
4438
|
+
throw error;
|
|
4439
|
+
}
|
|
4440
|
+
return result;
|
|
4441
|
+
}
|
|
4442
|
+
|
|
4443
|
+
const projectProjectsInChild = (teamRoot, scope, env = process.env) => {
|
|
4444
|
+
if (!isSqliteAvailable(env)) return null;
|
|
4445
|
+
const handle = openTeamDb({ teamRoot });
|
|
4446
|
+
try {
|
|
4447
|
+
return projectProjects(handle.db, { teamRoot: handle.teamRoot, scope });
|
|
4448
|
+
} finally {
|
|
4449
|
+
handle.db.close();
|
|
4450
|
+
}
|
|
4451
|
+
};
|
|
4452
|
+
|
|
4453
|
+
/**
|
|
4454
|
+
* A projection failure never fails a file write: one error-log line, and the
|
|
4455
|
+
* caller still reports `ok: true` with `failed >= 1`.
|
|
4456
|
+
*/
|
|
4457
|
+
const containProjectsProjection = (run) => {
|
|
4458
|
+
try {
|
|
4459
|
+
const result = run();
|
|
4460
|
+
if (result === null) return { skipped: true, failed: 0 };
|
|
4461
|
+
return result;
|
|
4462
|
+
} catch (error) {
|
|
4463
|
+
logProjectionFailure('E_PROJECTS_PROJECTION', error.message);
|
|
4464
|
+
return { failed: 1, errors: [{ path: PROJECTS_FILE, reason: error.message }] };
|
|
4465
|
+
}
|
|
4466
|
+
};
|
|
4467
|
+
|
|
4468
|
+
/**
|
|
4469
|
+
* The `ProjectSummary` the membership verbs answer: the projected record plus
|
|
4470
|
+
* its member refs, read from the projection inside the same child that wrote
|
|
4471
|
+
* the file, so the route returns it verbatim without a refetch.
|
|
4472
|
+
*/
|
|
4473
|
+
const readProjectedProjectSummary = (teamRoot, id) => {
|
|
4474
|
+
if (!isSqliteAvailable()) return null;
|
|
4475
|
+
const handle = openTeamDb({ teamRoot });
|
|
4476
|
+
try {
|
|
4477
|
+
const record = handle.db.prepare('SELECT * FROM projects WHERE id = ?1 AND absent_at IS NULL').get(id);
|
|
4478
|
+
if (!record) return null;
|
|
4479
|
+
const repositories = handle.db
|
|
4480
|
+
.prepare(
|
|
4481
|
+
`SELECT r.id, r.name, r.status
|
|
4482
|
+
FROM project_repositories pr JOIN repositories r ON r.id = pr.repository_id
|
|
4483
|
+
WHERE pr.project_id = ?1 AND r.absent_at IS NULL
|
|
4484
|
+
ORDER BY r.name COLLATE NOCASE, r.id`,
|
|
4485
|
+
)
|
|
4486
|
+
.all(id);
|
|
4487
|
+
return {
|
|
4488
|
+
id: record.id,
|
|
4489
|
+
name: record.name,
|
|
4490
|
+
description: record.description ?? null,
|
|
4491
|
+
status: record.status,
|
|
4492
|
+
revision: record.revision,
|
|
4493
|
+
createdAt: record.created_at,
|
|
4494
|
+
updatedAt: record.updated_at,
|
|
4495
|
+
repositories,
|
|
4496
|
+
};
|
|
4497
|
+
} finally {
|
|
4498
|
+
handle.db.close();
|
|
4499
|
+
}
|
|
4500
|
+
};
|
|
4501
|
+
|
|
4502
|
+
/**
|
|
4503
|
+
* Validate one `ProjectWrite` body and normalize it into the record shape.
|
|
4504
|
+
*
|
|
4505
|
+
* Membership is not a property of the record (I-3): an unknown key — including
|
|
4506
|
+
* a membership key — is refused here, and membership moves only through the
|
|
4507
|
+
* dedicated link verbs. `status` is the only closed vocabulary the write path
|
|
4508
|
+
* enforces; `createdAt` and `updatedAt` belong to the writer, not the client.
|
|
4509
|
+
*/
|
|
4510
|
+
export function validateProjectWrite(input) {
|
|
4511
|
+
if (!isRecord(input)) failProjectField('project', 'must be an object');
|
|
4512
|
+
// The route table answers 422 `E_VALIDATION` for a field outside the
|
|
4513
|
+
// documented set, so the write validator names the key itself instead of
|
|
4514
|
+
// the reader's parse refusal (which the transport maps to 500).
|
|
4515
|
+
for (const key of Object.keys(input)) {
|
|
4516
|
+
if (![...DECLARED_PROJECT_KEYS, 'revision'].includes(key)) {
|
|
4517
|
+
failProjectField(key, 'unknown key');
|
|
4518
|
+
}
|
|
4519
|
+
}
|
|
4520
|
+
const id = input.id;
|
|
4521
|
+
if (
|
|
4522
|
+
typeof id !== 'string' ||
|
|
4523
|
+
!SLUG_RE.test(id) ||
|
|
4524
|
+
id.length < 1 ||
|
|
4525
|
+
id.length > MAX_REPOSITORY_ID_LENGTH
|
|
4526
|
+
) {
|
|
4527
|
+
failProjectField('id', `must match ${SLUG_RE.source} and be 1-48 characters`);
|
|
4528
|
+
}
|
|
4529
|
+
const name = input.name;
|
|
4530
|
+
if (typeof name !== 'string' || name.trim().length < 1 || name.length > MAX_REPOSITORY_NAME_LENGTH) {
|
|
4531
|
+
failProjectField('name', `must be 1-${MAX_REPOSITORY_NAME_LENGTH} characters`);
|
|
4532
|
+
}
|
|
4533
|
+
const description = input.description ?? null;
|
|
4534
|
+
if (
|
|
4535
|
+
description !== null &&
|
|
4536
|
+
(typeof description !== 'string' || description.length > MAX_PROJECT_DESCRIPTION_LENGTH)
|
|
4537
|
+
) {
|
|
4538
|
+
failProjectField('description', `must be null or at most ${MAX_PROJECT_DESCRIPTION_LENGTH} characters`);
|
|
4539
|
+
}
|
|
4540
|
+
if (typeof input.status !== 'string' || !PROJECT_STATUSES.includes(input.status)) {
|
|
4541
|
+
failProjectField('status', `must be one of ${PROJECT_STATUSES.join(', ')}`);
|
|
4542
|
+
}
|
|
4543
|
+
if (input.revision !== undefined && (!Number.isInteger(input.revision) || input.revision < 1)) {
|
|
4544
|
+
failProjectField('revision', 'must be an integer of at least 1');
|
|
4545
|
+
}
|
|
4546
|
+
return {
|
|
4547
|
+
id,
|
|
4548
|
+
name: name.trim(),
|
|
4549
|
+
description: description === null ? null : description,
|
|
4550
|
+
status: input.status,
|
|
4551
|
+
revision: input.revision,
|
|
4552
|
+
};
|
|
4553
|
+
}
|
|
4554
|
+
|
|
4555
|
+
const withProjectsLock = (teamRoot, run) => {
|
|
4556
|
+
const paths = projectsPaths(teamRoot);
|
|
4557
|
+
fs.mkdirSync(paths.root, { recursive: true });
|
|
4558
|
+
let token = null;
|
|
4559
|
+
try {
|
|
4560
|
+
token = acquireLock(paths.lock, { timeoutMs: 5000 });
|
|
4561
|
+
} catch (error) {
|
|
4562
|
+
teamDbFail('E_PROJECTS_BUSY', `could not take the projects lock at ${paths.lock}: ${error.message}`, 4);
|
|
4563
|
+
}
|
|
4564
|
+
try {
|
|
4565
|
+
return run(paths);
|
|
4566
|
+
} finally {
|
|
4567
|
+
releaseLock(paths.lock, token);
|
|
4568
|
+
}
|
|
4569
|
+
};
|
|
4570
|
+
|
|
4571
|
+
/**
|
|
4572
|
+
* `projects put|delete|link|unlink|list|project` over the file of record.
|
|
4573
|
+
*
|
|
4574
|
+
* One lock spans the whole read-modify-write-projection: the definition lands
|
|
4575
|
+
* first, the projection follows and its failure never fails the write.
|
|
4576
|
+
*/
|
|
4577
|
+
export function runProjectsCommand(subcommand, args, options = {}) {
|
|
4578
|
+
const teamRoot = resolveTeamRoot(options.root);
|
|
4579
|
+
const json = Boolean(options.json);
|
|
4580
|
+
const quiet = Boolean(options.quiet);
|
|
4581
|
+
const now = new Date().toISOString();
|
|
4582
|
+
|
|
4583
|
+
if (isKillSwitchSet(process.env) && subcommand !== 'list') {
|
|
4584
|
+
teamDbFail('E_DISABLED', 'disabled by AI_RULES_TEAM_DB_DISABLE', 1);
|
|
4585
|
+
}
|
|
4586
|
+
|
|
4587
|
+
const readStdinOrFile = (label) => {
|
|
4588
|
+
const source = options.file;
|
|
4589
|
+
if (typeof source !== 'string' || source === '') teamDbFail('E_USAGE', `projects ${label} needs --file <path|->`, 3);
|
|
4590
|
+
const text = source === '-' ? fs.readFileSync(0, 'utf8') : fs.readFileSync(source, 'utf8');
|
|
4591
|
+
try {
|
|
4592
|
+
return JSON.parse(text);
|
|
4593
|
+
} catch (error) {
|
|
4594
|
+
failProjectField('payload', `the body is not JSON (${error.message})`);
|
|
4595
|
+
}
|
|
4596
|
+
return null;
|
|
4597
|
+
};
|
|
4598
|
+
|
|
4599
|
+
if (subcommand === 'list') {
|
|
4600
|
+
const file = readProjectsFile(teamRoot);
|
|
4601
|
+
if (json) return { exitCode: 0, output: renderJson({ ...file }) };
|
|
4602
|
+
if (quiet) return { exitCode: 0, output: '' };
|
|
4603
|
+
const lines = ['ID NAME STATUS MEMBERS'];
|
|
4604
|
+
for (const record of file.projects) {
|
|
4605
|
+
const members = file.links.filter((link) => link.projectId === record.id).length;
|
|
4606
|
+
lines.push(`${record.id} ${record.name} ${record.status} ${members}`);
|
|
4607
|
+
}
|
|
4608
|
+
return { exitCode: 0, output: `${lines.join('\n')}\n` };
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4611
|
+
if (subcommand === 'project') {
|
|
4612
|
+
return withProjectsLock(teamRoot, () => {
|
|
4613
|
+
const result = projectProjectsInChild(teamRoot, null);
|
|
4614
|
+
if (json) return { exitCode: 0, output: renderJson({ ok: true, projection: result }) };
|
|
4615
|
+
return { exitCode: 0, output: `project: projects=${result?.projects ?? 0} links=${result?.links ?? 0}\n` };
|
|
4616
|
+
});
|
|
4617
|
+
}
|
|
4618
|
+
|
|
4619
|
+
if (subcommand === 'put') {
|
|
4620
|
+
const payload = readStdinOrFile('put');
|
|
4621
|
+
return withProjectsLock(teamRoot, () => {
|
|
4622
|
+
const file = readProjectsFile(teamRoot);
|
|
4623
|
+
const written = validateProjectWrite(payload);
|
|
4624
|
+
const existing = file.projects.find((record) => record.id === written.id) ?? null;
|
|
4625
|
+
if (existing) {
|
|
4626
|
+
if (payload.revision === undefined) {
|
|
4627
|
+
teamDbFail(
|
|
4628
|
+
'E_CONFLICT',
|
|
4629
|
+
`project "${existing.id}" is at revision ${existing.revision}; an update must carry "revision"`,
|
|
4630
|
+
1,
|
|
4631
|
+
);
|
|
4632
|
+
}
|
|
4633
|
+
if (payload.revision !== existing.revision) {
|
|
4634
|
+
teamDbFail(
|
|
4635
|
+
'E_CONFLICT',
|
|
4636
|
+
`project "${existing.id}" is at revision ${existing.revision}, the body sent ${payload.revision}`,
|
|
4637
|
+
1,
|
|
4638
|
+
);
|
|
4639
|
+
}
|
|
4640
|
+
} else if (payload.revision !== undefined && payload.revision !== 1) {
|
|
4641
|
+
teamDbFail('E_CONFLICT', `project "${written.id}" does not exist; revision must be 1`, 1);
|
|
4642
|
+
}
|
|
4643
|
+
const record = {
|
|
4644
|
+
id: written.id,
|
|
4645
|
+
name: written.name,
|
|
4646
|
+
description: written.description,
|
|
4647
|
+
status: written.status,
|
|
4648
|
+
revision: existing ? existing.revision + 1 : 1,
|
|
4649
|
+
createdAt: existing ? existing.createdAt : now,
|
|
4650
|
+
updatedAt: now,
|
|
4651
|
+
};
|
|
4652
|
+
if (options.dryRun) {
|
|
4653
|
+
if (json) return { exitCode: 0, output: renderJson({ ok: true, dryRun: true, project: record }) };
|
|
4654
|
+
return { exitCode: 0, output: `${JSON.stringify(record, null, 2)}\n` };
|
|
4655
|
+
}
|
|
4656
|
+
const projects = existing
|
|
4657
|
+
? file.projects.map((entry) => (entry.id === record.id ? record : entry))
|
|
4658
|
+
: [...file.projects, record];
|
|
4659
|
+
writeProjectsFile(teamRoot, { ...file, projects });
|
|
4660
|
+
const projection = containProjectsProjection(() => projectProjectsInChild(teamRoot, { projectIds: [record.id], repositoryIds: [] }));
|
|
4661
|
+
if (json) return { exitCode: 0, output: renderJson({ ok: true, project: record, projection }) };
|
|
4662
|
+
return { exitCode: 0, output: `put: ${record.id} revision ${record.revision}\n` };
|
|
4663
|
+
});
|
|
4664
|
+
}
|
|
4665
|
+
|
|
4666
|
+
if (subcommand === 'delete') {
|
|
4667
|
+
const id = args[0] ?? options.id ?? null;
|
|
4668
|
+
if (!id) teamDbFail('E_USAGE', 'projects delete needs a project id', 3);
|
|
4669
|
+
return withProjectsLock(teamRoot, () => {
|
|
4670
|
+
const file = readProjectsFile(teamRoot);
|
|
4671
|
+
const record = file.projects.find((entry) => entry.id === id);
|
|
4672
|
+
if (!record) teamDbFail('E_NOT_FOUND', `no project "${id}"`, 1);
|
|
4673
|
+
if (options.revision !== undefined && options.revision !== record.revision) {
|
|
4674
|
+
teamDbFail(
|
|
4675
|
+
'E_CONFLICT',
|
|
4676
|
+
`project "${id}" is at revision ${record.revision}, the request sent ${options.revision}`,
|
|
4677
|
+
1,
|
|
4678
|
+
);
|
|
4679
|
+
}
|
|
4680
|
+
const membersRemoved = file.links.filter((link) => link.projectId === id).length;
|
|
4681
|
+
if (membersRemoved > 0 && !options.force) {
|
|
4682
|
+
const error = new TeamDbError(
|
|
4683
|
+
'E_PROJECT_IN_USE',
|
|
4684
|
+
`this project has ${membersRemoved} member repositor${membersRemoved === 1 ? 'y' : 'ies'}; delete it anyway?`,
|
|
4685
|
+
1,
|
|
4686
|
+
);
|
|
4687
|
+
error.memberRepositories = membersRemoved;
|
|
4688
|
+
throw error;
|
|
4689
|
+
}
|
|
4690
|
+
if (options.dryRun) {
|
|
4691
|
+
if (json) return { exitCode: 0, output: renderJson({ ok: true, dryRun: true, id, membersRemoved }) };
|
|
4692
|
+
return { exitCode: 0, output: `delete (dry run): ${id} membersRemoved=${membersRemoved}\n` };
|
|
4693
|
+
}
|
|
4694
|
+
writeProjectsFile(teamRoot, {
|
|
4695
|
+
...file,
|
|
4696
|
+
projects: file.projects.filter((entry) => entry.id !== id),
|
|
4697
|
+
links: file.links.filter((link) => link.projectId !== id),
|
|
4698
|
+
});
|
|
4699
|
+
const projection = containProjectsProjection(() =>
|
|
4700
|
+
projectProjectsInChild(teamRoot, { projectIds: [id], repositoryIds: [] }),
|
|
4701
|
+
);
|
|
4702
|
+
if (json) return { exitCode: 0, output: renderJson({ ok: true, id, membersRemoved, projection }) };
|
|
4703
|
+
return { exitCode: 0, output: `delete: ${id} membersRemoved=${membersRemoved}\n` };
|
|
4704
|
+
});
|
|
4705
|
+
}
|
|
4706
|
+
|
|
4707
|
+
if (subcommand === 'link' || subcommand === 'unlink') {
|
|
4708
|
+
const projectId = args[0] ?? null;
|
|
4709
|
+
const repositoryId = args[1] ?? null;
|
|
4710
|
+
if (!projectId || !repositoryId) {
|
|
4711
|
+
teamDbFail('E_USAGE', `projects ${subcommand} needs <projectId> <repositoryId>`, 3);
|
|
4712
|
+
}
|
|
4713
|
+
return withProjectsLock(teamRoot, () => {
|
|
4714
|
+
const file = readProjectsFile(teamRoot);
|
|
4715
|
+
if (!file.projects.some((record) => record.id === projectId)) {
|
|
4716
|
+
teamDbFail('E_NOT_FOUND', `no project "${projectId}"`, 1);
|
|
4717
|
+
}
|
|
4718
|
+
const repositories = readRepositoriesFile(teamRoot);
|
|
4719
|
+
if (!repositories.repositories.some((record) => record.id === repositoryId)) {
|
|
4720
|
+
teamDbFail('E_VALIDATION', `parameter "repositoryId": names the unknown repository "${repositoryId}"`, 3);
|
|
4721
|
+
}
|
|
4722
|
+
const existing = file.links.find(
|
|
4723
|
+
(link) => link.projectId === projectId && link.repositoryId === repositoryId,
|
|
4724
|
+
);
|
|
4725
|
+
if (subcommand === 'link') {
|
|
4726
|
+
// Idempotent: a second write of the same pair keeps `addedAt` and the
|
|
4727
|
+
// document unchanged, so no file write and no projection happen.
|
|
4728
|
+
if (existing) {
|
|
4729
|
+
const summary = readProjectedProjectSummary(teamRoot, projectId);
|
|
4730
|
+
if (json) return { exitCode: 0, output: renderJson({ ok: true, project: summary, projection: { skipped: true, failed: 0 } }) };
|
|
4731
|
+
return { exitCode: 0, output: `link: ${repositoryId} -> ${projectId} (already a member)\n` };
|
|
4732
|
+
}
|
|
4733
|
+
writeProjectsFile(teamRoot, {
|
|
4734
|
+
...file,
|
|
4735
|
+
links: [...file.links, { projectId, repositoryId, addedAt: now }],
|
|
4736
|
+
});
|
|
4737
|
+
} else {
|
|
4738
|
+
if (!existing) teamDbFail('E_NOT_FOUND', `"${repositoryId}" is not a member of "${projectId}"`, 1);
|
|
4739
|
+
writeProjectsFile(teamRoot, {
|
|
4740
|
+
...file,
|
|
4741
|
+
links: file.links.filter(
|
|
4742
|
+
(link) => !(link.projectId === projectId && link.repositoryId === repositoryId),
|
|
4743
|
+
),
|
|
4744
|
+
});
|
|
4745
|
+
}
|
|
4746
|
+
const projection = containProjectsProjection(() =>
|
|
4747
|
+
projectProjectsInChild(teamRoot, { projectIds: [projectId], repositoryIds: [] }),
|
|
4748
|
+
);
|
|
4749
|
+
const project = readProjectedProjectSummary(teamRoot, projectId);
|
|
4750
|
+
if (json) return { exitCode: 0, output: renderJson({ ok: true, project, projection }) };
|
|
4751
|
+
return { exitCode: 0, output: `${subcommand}: ${repositoryId} ${subcommand === 'link' ? '->' : 'x'} ${projectId}\n` };
|
|
4752
|
+
});
|
|
4753
|
+
}
|
|
4754
|
+
|
|
4755
|
+
teamDbFail('E_USAGE', `unknown projects subcommand "${subcommand}"`, 3);
|
|
4756
|
+
return null;
|
|
4757
|
+
}
|
|
4758
|
+
|
|
4045
4759
|
/**
|
|
4046
4760
|
* Project a tree (or one slug) into the database.
|
|
4047
4761
|
*
|
|
@@ -4194,6 +4908,17 @@ export function syncProjection(options = {}) {
|
|
|
4194
4908
|
result.errors.push({ path: REPOSITORIES_FILE, reason: error.message });
|
|
4195
4909
|
}
|
|
4196
4910
|
}
|
|
4911
|
+
if (!slug) {
|
|
4912
|
+
try {
|
|
4913
|
+
const projectProjection = projectProjects(db, { teamRoot: handle.teamRoot });
|
|
4914
|
+
result.failed += projectProjection.failed;
|
|
4915
|
+
for (const error of projectProjection.errors) result.errors.push(error);
|
|
4916
|
+
} catch (error) {
|
|
4917
|
+
// Same containment as the repository registry above.
|
|
4918
|
+
result.failed += 1;
|
|
4919
|
+
result.errors.push({ path: PROJECTS_FILE, reason: error.message });
|
|
4920
|
+
}
|
|
4921
|
+
}
|
|
4197
4922
|
if (!slug) {
|
|
4198
4923
|
const schedulerProjection = projectScheduler(db, { teamRoot: handle.teamRoot });
|
|
4199
4924
|
result.failed += schedulerProjection.failed;
|