@bonesofspring/ai-rules 0.2.63 → 0.2.64
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 +60 -0
- package/README.md +10 -3
- package/bin/cli.js +7 -5
- package/bin/lib/ai-local-drift.js +7 -6
- package/bin/lib/engine-scripts.js +4 -0
- package/bin/lib/engine-upgrade.js +10 -2
- package/bin/lib/manifest-schema.js +12 -0
- package/bin/lib/seed-ai-local-team.js +13 -0
- package/bin/mavis-install.js +4 -3
- package/bin/opencode-install.js +22 -6
- package/bin/zcode-install.js +4 -3
- package/docs/MCP-CATALOG.md +1 -1
- package/docs/OPENCODE-COMPATIBILITY.md +3 -2
- package/docs/OPENCODE.md +22 -2
- package/docs/PRESET-CONTRIBUTION.md +2 -2
- package/docs/TEAM-DB.md +71 -4
- package/docs/openapi/team-db.v1.json +4817 -2795
- package/mcp/defectdojo-mcp.mjs +41 -11
- package/mcp/lib/defectdojo.mjs +45 -2
- package/package.json +8 -2
- package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +279 -0
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +471 -7
- package/presets/_shared/ai-local/scripts/team-db-backlog.mjs +1366 -0
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +573 -7
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +288 -4
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +82 -10
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +83 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +69 -6
- package/presets/_shared/ai-local/scripts/upstream-research.mjs +3 -0
- package/presets/_shared/core/agent-team/agent-task-metrics.md +7 -2
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +225 -0
- package/presets/_shared/hooks/run-hook.mjs +2 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/android-kotlin/hooks/run-hook.mjs +2 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/go/hooks/run-hook.mjs +2 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/ios-swift/hooks/run-hook.mjs +2 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/java/hooks/run-hook.mjs +2 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/mcp-ts/hooks/run-hook.mjs +2 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/mol/hooks/run-hook.mjs +2 -1
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/next/agents/code-reviewer.md +1 -0
- package/presets/claude/next/agents/mockup-reviewer.md +2 -1
- package/presets/claude/next/agents/task-analyst.md +2 -0
- package/presets/claude/next/commands/task.md +7 -1
- package/presets/claude/next/commands/technical-retro.md +7 -1
- package/presets/claude/next/commands/upstream-research.md +1 -1
- package/presets/claude/next/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/next/hooks/run-hook.mjs +2 -1
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/claude/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/claude/next/team/README.md +5 -1
- package/presets/claude/next/team/upstream/jobs.json +34 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/nuxt/hooks/run-hook.mjs +2 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/php-hexagonal/hooks/run-hook.mjs +2 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/php-laravel/hooks/run-hook.mjs +2 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +225 -0
- package/presets/claude/svelte/hooks/run-hook.mjs +2 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/android-kotlin/hooks/run-hook.mjs +2 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/go/hooks/run-hook.mjs +2 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/ios-swift/hooks/run-hook.mjs +2 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/java/hooks/run-hook.mjs +2 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/mcp-ts/hooks/run-hook.mjs +2 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/mol/hooks/run-hook.mjs +2 -1
- package/presets/cursor/next/agents/code-reviewer.md +1 -0
- package/presets/cursor/next/agents/mockup-reviewer.md +2 -1
- package/presets/cursor/next/agents/task-analyst.md +2 -0
- package/presets/cursor/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -0
- package/presets/cursor/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/cursor/next/commands/task.md +7 -1
- package/presets/cursor/next/commands/technical-retro.md +7 -1
- package/presets/cursor/next/commands/upstream-research.md +1 -1
- package/presets/cursor/next/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/next/hooks/run-hook.mjs +2 -1
- package/presets/cursor/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/cursor/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/cursor/next/team/README.md +5 -1
- package/presets/cursor/next/team/upstream/jobs.json +34 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/nuxt/hooks/run-hook.mjs +2 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +2 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/php-laravel/hooks/run-hook.mjs +2 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +225 -0
- package/presets/cursor/svelte/hooks/run-hook.mjs +2 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/next/adapter-map.json +9 -1
- package/presets/mavis/next/agents/code-reviewer.md +1 -0
- package/presets/mavis/next/agents/mockup-reviewer.md +2 -1
- package/presets/mavis/next/agents/task-analyst.md +2 -0
- package/presets/mavis/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -0
- package/presets/mavis/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/mavis/next/commands/task.md +7 -1
- package/presets/mavis/next/commands/technical-retro.md +7 -1
- package/presets/mavis/next/commands/upstream-research.md +1 -1
- package/presets/mavis/next/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/mavis/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/mavis/next/team/README.md +5 -1
- package/presets/mavis/next/team/upstream/jobs.json +34 -0
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -0
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +225 -0
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/android-kotlin/OPENCODE.md +4 -1
- package/presets/opencode/android-kotlin/README.md +1 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/hooks/README.md +4 -2
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/go/OPENCODE.md +4 -1
- package/presets/opencode/go/README.md +1 -0
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/hooks/README.md +4 -2
- package/presets/opencode/go/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/ios-swift/OPENCODE.md +4 -1
- package/presets/opencode/ios-swift/README.md +1 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/hooks/README.md +4 -2
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/java/OPENCODE.md +4 -1
- package/presets/opencode/java/README.md +1 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/hooks/README.md +4 -2
- package/presets/opencode/java/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/mcp-ts/OPENCODE.md +4 -1
- package/presets/opencode/mcp-ts/README.md +1 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/hooks/README.md +4 -2
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/mol/OPENCODE.md +4 -1
- package/presets/opencode/mol/README.md +1 -0
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/hooks/README.md +4 -2
- package/presets/opencode/mol/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/next/OPENCODE.md +4 -1
- package/presets/opencode/next/README.md +1 -0
- package/presets/opencode/next/adapter-map.json +9 -1
- package/presets/opencode/next/agents/code-reviewer.md +1 -0
- package/presets/opencode/next/agents/mockup-reviewer.md +2 -1
- package/presets/opencode/next/agents/task-analyst.md +2 -0
- package/presets/opencode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -0
- package/presets/opencode/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/opencode/next/commands/task.md +7 -1
- package/presets/opencode/next/commands/technical-retro.md +7 -1
- package/presets/opencode/next/commands/upstream-research.md +1 -1
- package/presets/opencode/next/hooks/README.md +4 -2
- package/presets/opencode/next/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/opencode/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/opencode/next/team/README.md +5 -1
- package/presets/opencode/next/team/upstream/jobs.json +34 -0
- package/presets/opencode/nuxt/OPENCODE.md +4 -1
- package/presets/opencode/nuxt/README.md +1 -0
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/hooks/README.md +4 -2
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/php-hexagonal/OPENCODE.md +4 -1
- package/presets/opencode/php-hexagonal/README.md +1 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/hooks/README.md +4 -2
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/php-laravel/OPENCODE.md +4 -1
- package/presets/opencode/php-laravel/README.md +1 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/hooks/README.md +4 -2
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -0
- package/presets/opencode/platform-contract.json +6 -0
- package/presets/opencode/plugins/task-status/README.md +92 -0
- package/presets/opencode/plugins/task-status/details-data.ts +130 -0
- package/presets/opencode/plugins/task-status/details.tsx +84 -0
- package/presets/opencode/plugins/task-status/eta.ts +230 -0
- package/presets/opencode/plugins/task-status/index.ts +6 -0
- package/presets/opencode/plugins/task-status/package.json +10 -0
- package/presets/opencode/plugins/task-status/task-view.ts +606 -0
- package/presets/opencode/plugins/task-status/tui.tsx +139 -0
- package/presets/opencode/svelte/OPENCODE.md +4 -1
- package/presets/opencode/svelte/README.md +1 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/hooks/README.md +4 -2
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +225 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/go/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/java/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/next/adapter-map.json +9 -1
- package/presets/zcode/next/agents/code-reviewer.md +1 -0
- package/presets/zcode/next/agents/mockup-reviewer.md +2 -1
- package/presets/zcode/next/agents/task-analyst.md +2 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -0
- package/presets/zcode/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/zcode/next/commands/task.md +7 -1
- package/presets/zcode/next/commands/technical-retro.md +7 -1
- package/presets/zcode/next/commands/upstream-research.md +1 -1
- package/presets/zcode/next/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/next/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/next/skills/figma-fidelity/SKILL.md +4 -1
- package/presets/zcode/next/skills/mockup-review/SKILL.md +4 -0
- package/presets/zcode/next/team/README.md +5 -1
- package/presets/zcode/next/team/upstream/jobs.json +34 -0
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +1 -0
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +225 -0
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +1 -0
- package/scripts/aggregate-agent-task-metrics.mjs +48 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
### Upstream research
|
|
6
|
+
|
|
7
|
+
- **The weekly job actually ships.** `presets/cursor/next/team/upstream/jobs.json` is the preset-owned definition of the advertised `upstream-research` job (cron `0 9 * * 1` `Europe/Moscow`, pipeline payload over `upstream/prompt.md`, 75-minute timeout, `skip` concurrency, `run-once` misfire); `init`/`update` seed it into `.ai.local/team/scheduler/jobs.json` when the file is absent, and an operator-edited definition is never overwritten. `test-upstream-research.mjs` is reachable from its own `test:upstream` script and the preset-structure composite.
|
|
8
|
+
- **A clone target is bounded.** `projects[].fetchStrategy.path` is capped at 200 characters (`REGISTRY_BOUNDS.fetchPathMax`); a longer path is refused with `E_REGISTRY_FETCH` and the field name, so a registry entry cannot hand `git fetch` an unbounded target.
|
|
9
|
+
|
|
10
|
+
### Scheduler and pipeline
|
|
11
|
+
|
|
12
|
+
- **One exclusive create claims the scheduler lease.** `team-db.mjs schedule` read the lease and then wrote it, so two simultaneous starts could both see an empty root and both write one; the claim is now a single `wx` create, the loser exits `4` with `E_BUSY` exactly like a sequential second start, and a stale lease is re-read immediately before removal, so a lease another start reclaimed in the meantime is left standing.
|
|
13
|
+
- **Pipeline placeholders are a closed vocabulary.** `PROMPT_TOKENS` (`{{job.id}}`, `{{run.id}}`, `{{run.dir}}`, `{{team.root}}`, `{{now}}`) is the one list shared by `validateJob` and the render pass: a `payload.promptTemplate` with any other `{{token}}` is refused at definition time with the offending placeholder and the allowed list, so a run cannot start with a raw token left in the prompt. An absent template stays a runtime `E_PROMPT_MISSING`, not a definition error.
|
|
14
|
+
- **Bootstrap starts the first executable step.** The idempotent `bootstrap` action activated `steps[0]` even when that step was `skipIf`-matched, while the advance path skipped it; it now uses `findNextExecutableStep`, records that `pipelineIndex`, and reports a skip instead of a phantom attempt when every step is skipIf-matched.
|
|
15
|
+
- **Windows `.cmd` arguments keep embedded quotes.** `quoteWindowsArg` doubles a `"` as `""` per the cmd.exe convention; the previous `\"` ended the quoted argument instead of escaping the quote inside it.
|
|
16
|
+
|
|
17
|
+
### Preset tooling
|
|
18
|
+
|
|
19
|
+
- **The preset-tree lock is token-owned and reclaim-safe.** `owner.json` now carries a random `token`; `release` refuses a token that does not match, so a `--pid` override or a recycled pid cannot release a stolen lock. Reclaim runs under an exclusive `<lock>.reclaim` guard whose winner re-reads the owner, an owner-less directory younger than 30 s is held as warming instead of stolen (the old `mkdir` + separate `owner.json` write could lose a directory another process had just created), and a stale guard only delays the next reclaimer. `fix:generated`, `check:fast`, and `check:preset-structure` pass the token they acquired.
|
|
20
|
+
- **The generated-tree cache keys on the platform contract.** `presets/<platform>/platform-contract.json` is a generator input, so it joins `presets/cursor/<stack>`, `presets/_shared`, `scripts/lib`, and `package.json` in the cache digest; flipping a stack's release state now misses the cache instead of false-PASSing a stale subtree. `test-generated-cache.mjs` adds a real-generator equivalence check: a cold fill and a hit must byte-match a fresh `generateMavisStack` run.
|
|
21
|
+
|
|
22
|
+
### Install and upgrade
|
|
23
|
+
|
|
24
|
+
- **A record entry without a source is unattributable.** `.ai.local/.template-base.json` entries without `source` used to fall back to the rendered source, so `doctor` and `update --check` could report `current` — "matches the shipped template" — for bytes the package never attributed. They now report `no recorded source`, the rel is never planned for writing, and a module with no recorded base still takes the `unattributable` path.
|
|
25
|
+
- **One line per engine rel.** `update --fix` printed the write result and then let the drift pass classify the same rel again, producing a duplicate line; the engine plan now owns its rels on both `--check` and `--fix`, so each rel is reported once.
|
|
26
|
+
|
|
27
|
+
### DefectDojo import scan
|
|
28
|
+
|
|
29
|
+
- **`dd_import_scan` reads inside the project root only.** The report file must be repo-relative: an absolute path (POSIX, Windows drive, UNC), any `..` traversal (raw, percent-encoded, or backslash), and a symlink that leaves the real project root are refused before any read or upload; a malformed encoding is denied closed. Declared integer arguments (`id`, `product`, `engagement`) are validated at runtime, and an unexpected failure returns a generic message to the client while the stack goes to the server log, so a local path never reaches the model.
|
|
30
|
+
|
|
31
|
+
### Operator app
|
|
32
|
+
|
|
33
|
+
- **The job form runs on one resolver.** The private `apps/team-tasks-ui` create/edit form uses `react-hook-form` with a yup resolver (`mode: 'onTouched'`): submit stays disabled while the model is invalid, a field the API names is marked in place, a create-mode `409` names the duplicate id, and an edit-mode `409` renders the reload banner that re-reads the stored revision.
|
|
34
|
+
- **A lossy write is refused, not invented.** `toJobWrite` returns `null` when a stored definition lacks the field its own kind requires (cron `expression`, interval `everySeconds`, command `argv`, pipeline `promptTemplate`/`runner`); the job detail toggle rejects with `E_VALIDATION` and says to rewrite the definition instead of substituting `''`, `0`, or `[]` into a `PUT`.
|
|
35
|
+
- **Backlog actions validate in place.** The dialog renders a field error through the DS control (`errorMessage`/`note`) and takes `SLUG_PATTERN` from the API layer, so the client and the service share one slug grammar.
|
|
36
|
+
|
|
37
|
+
### Backlog tracker
|
|
38
|
+
|
|
39
|
+
- **The `backlog` verb family.** `team-db.mjs backlog` adds the file-authoritative plan store (`backlog/items/*.json` committed, `backlog/queue/` ignored): `add`, `set`, `show`, `list`, `ready`, `validate`, `import` (the versioned envelope, idempotent by id, `--dry-run`), `enqueue`, `cancel`, `drain --claim`, `recover` and `prune`. The stored status lattice is the decision; every operational status (`effectiveStatus`, `ready`, `waitingOn`) is derived from the items, the queue entries and the hook-owned task state. The deterministic total order is `priority` ascending (lower runs first, default 5) → `createdAt` → `id`.
|
|
40
|
+
- **The launch queue.** `backlog/config.json` carries `maxActive` (1…8, default 1); a task in a holding state (`in_progress`, `awaiting_artifact_receipt`, `blocked`) occupies a slot, one at a human gate does not. `backlog drain --claim` grants at most one claim and never starts a run; the hook stop seam consumes the claim, re-checks the graph at claim time, and `AI_RULES_TEAM_DB_BACKLOG_DRAIN_DISABLE=1` stops only the auto-drain. Claims older than 90 s with no task row are released on the next drain.
|
|
41
|
+
- **Seven backlog routes.** `GET/POST /api/v1/backlog`, `GET/POST /api/v1/backlog/queue` + `POST …/queue/{entryId}/cancel`, and `GET/PUT /api/v1/backlog/{id}` take the HTTP API from 32 to **39 operations**; migration `0003-backlog` projects the store, and the kill switch `AI_RULES_TEAM_DB_DISABLE=1` turns the projection off while the backlog file verbs stay usable.
|
|
42
|
+
- **Operator pages.** The private `apps/team-tasks-ui` app gains `/backlog` (the ordered list and the queue section of one snapshot, five states at three viewports) and `/backlog/[id]` (dependency state, queue history and the `stored` vs `task` completion source). The no-build `team-db-dashboard.mjs` is unchanged.
|
|
43
|
+
- **Gates.** `test-team-db-backlog.mjs`, `test-team-db-backlog-order.mjs`, `-project`, `-queue`, and `-import` join `yarn test:team-db`, and `test-team-db-schema.mjs` covers migration `0003-backlog`.
|
|
44
|
+
|
|
45
|
+
### Gates
|
|
46
|
+
|
|
47
|
+
- **The new seams are covered.** `test-team-db-scheduler.mjs` races two starts (one `E_BUSY`, exit `4`), refuses an unknown placeholder, and pins the cmd.exe quote convention; `test-preset-tree-lock.mjs` covers token-guarded release, the warming window, the guard re-read, and a two-contender race; `test-generated-cache.mjs` asserts real-generator equivalence; `test-engine-upgrade.mjs` covers the empty/missing source and the duplicate-line fix; `test-cli-mcp-registration.mjs` covers import containment and error sanitization; `test-cli-update.mjs` covers the seed-when-absent job; `test-chain-team-phases-coverage.mjs` covers bootstrap `skipIf`; `test-upstream-research.mjs` runs from `test:upstream` and the preset-structure composite. Platform smoke runs `doctor` on the five-platform multi install instead of a separate Cursor project.
|
|
48
|
+
|
|
49
|
+
## 0.2.64
|
|
50
|
+
|
|
51
|
+
### Composed-order gate, metrics bootstrap, and the shipped aggregator
|
|
52
|
+
|
|
53
|
+
- **Composed-order review.** A re-parenting change now freezes `hostCard.order[]` and per-node `order`/`siblingIndex` in `figma-contract.json`; `mockup-review`, `figma-fidelity` G4, `task-analyst`, `code-reviewer`, and the `ui-change-review-gate` seed require the host card's child order, not only the component subtree. A component-only review is incomplete.
|
|
54
|
+
- **Metrics bootstrap and profile revision.** The chain hook gains an idempotent `bootstrap` action that creates `task_started` and the first `attempt_started` before `steps[0]`; `/task` calls it. A plan revision records `profile_changed` and aligns `metrics.task.profile` with `pipeline.profile`.
|
|
55
|
+
- **Out-of-band accounting.** `out_of_band_start` / `out_of_band_end` record `out_of_band_started` / `out_of_band_finished` with `outOfBandId`, `agent`, `reason`, `durationMs`, `outcome` — reported separately from attempt duration and gate wait, without an invented `attemptId`.
|
|
56
|
+
- **Shipped metrics aggregator.** `aggregate-agent-task-metrics.mjs` ships to `.ai.local/scripts`; it adds `--slug`, per-task `taskReports[]` (`elapsedMs`, `activeMs`, `gateWaitMs`, `outOfBandMs`), and a top-level `outOfBand` summary. `technical-retro` uses it.
|
|
57
|
+
- **Narrow-width a11y sweep.** `figma-fidelity` checks the WCAG 1.4.10 320 px width plus the project's mobile frame widths and samples text-over-artwork pixels; artwork entering the text ink box is a blocker.
|
|
58
|
+
|
|
59
|
+
### OpenCode task-status plugin
|
|
60
|
+
|
|
61
|
+
- **Shipped TUI sidebar.** `init opencode` and `update` copy `presets/opencode/plugins/task-status/` to `.opencode/plugins/task-status/`; OpenCode auto-loads it from there, so no `opencode.json` `plugins` entry is needed. The plugin shows the active `/task` run in the TUI `sidebar.content` slot (slug, state, elapsed time, current step, soft-stop) and reads `.ai.local/team/` from the session directory. It is TUI-only; OpenCode Desktop does not render it, and the chain hook stays manual.
|
|
62
|
+
- **Managed install surface.** The plugin files join the OpenCode install manifest: `update` refreshes them, `doctor` reports missing/modified copies, and `clean opencode` removes unchanged ones.
|
|
63
|
+
- **Remaining-time estimate.** The sidebar row `eta` shows `~p50 · p90` for the remaining plan steps, from per-agent attempt medians and per-step retry rates across every `metrics.json` under the team root. Calibrated on 66 ledgers: 52% of runs finish below the p50, 89% below the p90; the row hides on a human gate, pause, stale run, or completion. It estimates agent work — gates and step parallelism stay out, so the real wait is often 20–25% shorter.
|
|
64
|
+
|
|
5
65
|
### Preset update notice
|
|
6
66
|
|
|
7
67
|
- **The `Shape:` sample carries the recorded version.** `check-preset-update.mjs` interpolated `latest` but left `<installed>` as a literal, so an agent that copied the sample verbatim printed the placeholder to the user instead of the installed version.
|
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ Run `init` from the **app root** (`--cwd` if needed). Default `--preset` is `nex
|
|
|
28
28
|
| Self-learning engine | **`.ai.local/scripts/`** (shared; sixteen scripts — the six self-learning engine modules, `manifest.mjs`, the seven `team-db*.mjs` projection and scheduler modules, the `upstream-research.mjs` review, and the read-only `check-write-scope.mjs` write audit; existing files never overwritten) | | | |
|
|
29
29
|
| Specs seed | `docs/specs/` copied only if the directory is **absent** | | | |
|
|
30
30
|
|
|
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.
|
|
32
|
+
|
|
31
33
|
### Project MCP catalog
|
|
32
34
|
|
|
33
35
|
`init mcp` writes the third-party servers this package ships plus Storybook, DefectDojo, and the packaged GitLab / GitHub / Yandex runtime entries into every installed client; `--tools` narrows the list to the clients you name. Entries render in each client's native shape and merge like `init`: extra servers, the consumer's `env` / `headers`, and other top-level keys stay. Names: `context7`, `playwright` (Claude's id is `playwright-test`), `chrome-devtools`, `next-devtools`, `semgrep`, `sentry`, `figma-desktop` (alias `figma`, the local `http://127.0.0.1:3845/mcp` server), `figma-cloud` (the remote `https://mcp.figma.com/mcp` server), `storybook` (`http://localhost:6200/mcp`), `defectdojo`, `gitlab`, `github`, `yandex-tracker`, and `yandex-wiki`; `--all` selects every one. The last five are packaged runtime entries: they are registered without credentials and need `mcp setup <provider>` once (DefectDojo reads `.env.defectdojo`). Next.js DevTools needs a running `next dev` on Next.js 16+; Semgrep needs the `semgrep` CLI; Sentry uses OAuth.
|
|
@@ -136,6 +138,9 @@ node .ai.local/scripts/team-db.mjs check # schema, fingerprint, i
|
|
|
136
138
|
node .ai.local/scripts/team-db.mjs serve # http://127.0.0.1:4178 + dashboard
|
|
137
139
|
node .ai.local/scripts/team-db.mjs schedule # the timer: claims, runs, captures, reconciles
|
|
138
140
|
node .ai.local/scripts/team-db.mjs jobs list # definitions + next fire, file-authoritative
|
|
141
|
+
node .ai.local/scripts/team-db.mjs backlog list # the ordered backlog: items, ready set, waiting-on
|
|
142
|
+
node .ai.local/scripts/team-db.mjs backlog enqueue --file <path|-> # record one launch request
|
|
143
|
+
node .ai.local/scripts/team-db.mjs backlog drain --claim # grant one claim, never start a run
|
|
139
144
|
AI_RULES_TEAM_DB_DISABLE=1 node .ai.local/scripts/team-db.mjs sync # no-op: file-only mode
|
|
140
145
|
```
|
|
141
146
|
|
|
@@ -143,8 +148,8 @@ Requires Node 22.13.0+ for `node:sqlite`; older runtimes stay file-only with one
|
|
|
143
148
|
`migrate-tasks` is the one-command path: it creates the database when it is absent and writes
|
|
144
149
|
only the delta against an existing one, so a fresh workspace and a populated database converge
|
|
145
150
|
in one invocation.
|
|
146
|
-
`team-db.mjs serve` binds loopback only, is read-only apart from the
|
|
147
|
-
(`POST /api/v1/sync`, the task delete,
|
|
151
|
+
`team-db.mjs serve` binds loopback only, is read-only apart from the ten documented mutations
|
|
152
|
+
(`POST /api/v1/sync`, the task delete, the four job writes and the four backlog writes), and serves the OpenAPI 3.1
|
|
148
153
|
document at `/openapi.json`. Details, environment names, retention, and rollback:
|
|
149
154
|
[`docs/TEAM-DB.md`](docs/TEAM-DB.md).
|
|
150
155
|
|
|
@@ -164,7 +169,9 @@ pre-v2 database is rebuilt from the files on the next `sync`.
|
|
|
164
169
|
### Upstream research
|
|
165
170
|
|
|
166
171
|
The `next` preset ships a weekly `upstream-research` job and a read-only `opencode` agent for
|
|
167
|
-
it.
|
|
172
|
+
it. `init`/`update` seed the job definition into `.ai.local/team/scheduler/jobs.json` when the
|
|
173
|
+
file is absent; an operator-edited definition is never overwritten. The runner
|
|
174
|
+
(`.ai.local/scripts/upstream-research.mjs`) probes `opencode`, loads
|
|
168
175
|
`upstream/projects.json` and `upstream/config.json`, fetches each due clone with
|
|
169
176
|
`git fetch --depth 1`, labels the window (`range`, `baseline`, `unprovable`, `no-change`),
|
|
170
177
|
validates the agent's marked JSON, re-checks every citation inside the clone, dedupes by
|
package/bin/cli.js
CHANGED
|
@@ -54,7 +54,7 @@ const {
|
|
|
54
54
|
process.on('exit', flushAllAiLocalDriftSummaries);
|
|
55
55
|
|
|
56
56
|
const FAIL_PHASE_ENV = 'AI_RULES_CLI_FAIL_PHASE';
|
|
57
|
-
const MANIFEST_SCHEMA_VERSION =
|
|
57
|
+
const { MANIFEST_SCHEMA_VERSION } = require('./lib/manifest-schema');
|
|
58
58
|
|
|
59
59
|
/** Single path segment: letters, digits, dot, underscore, hyphen; no separators or "..". */
|
|
60
60
|
const PRESET_NAME_RE = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
@@ -828,11 +828,13 @@ function cmdUpdate(cwdOption, opts) {
|
|
|
828
828
|
console.log(`update: reinstalling ${plan}`);
|
|
829
829
|
const packageRoot = getPackageRoot();
|
|
830
830
|
// One plan per command: the engine classifier reads the record before any pass
|
|
831
|
-
// can adopt a rel, and `applyEngineUpgrade` writes after the last pass.
|
|
832
|
-
//
|
|
833
|
-
//
|
|
831
|
+
// can adopt a rel, and `applyEngineUpgrade` writes after the last pass. The
|
|
832
|
+
// engine rels are owned on both output paths — `--check` previews the lines
|
|
833
|
+
// from this plan, `--fix` prints the write result — so the drift pass must
|
|
834
|
+
// not classify them a second time with a source that may not match the
|
|
835
|
+
// record (duplicate engine lines).
|
|
834
836
|
const enginePlan = fix || check ? planEngineUpgrade({ cwd, packageRoot }) : null;
|
|
835
|
-
if (
|
|
837
|
+
if (enginePlan) {
|
|
836
838
|
ownEngineCheck(cwd, new Set(enginePlan.entries.map((entry) => entry.rel)));
|
|
837
839
|
}
|
|
838
840
|
// One command, one tree, one summary: each tool's pass accumulates, this flushes.
|
|
@@ -375,15 +375,16 @@ const driftTotals = new Map();
|
|
|
375
375
|
const claimedRels = new Map();
|
|
376
376
|
|
|
377
377
|
/**
|
|
378
|
-
* Engine rels one command
|
|
379
|
-
*
|
|
380
|
-
* which is the source `--fix`
|
|
381
|
-
*
|
|
382
|
-
*
|
|
378
|
+
* Engine rels one command owns via its plan (`update --check` previews them,
|
|
379
|
+
* `update --fix` prints the write result). The plan already classifies every
|
|
380
|
+
* engine module with the recorded base `source`, which is the source `--fix`
|
|
381
|
+
* writes with; a second classification here would print a line from a
|
|
382
|
+
* different predicate (and none at all when the base names a tool that has
|
|
383
|
+
* since been cleaned). Command-scoped like {@link driftTotals}.
|
|
383
384
|
*/
|
|
384
385
|
const engineCheckOwners = new Map();
|
|
385
386
|
|
|
386
|
-
/** Hand the engine rels of one `update --check` command to its `planEngineUpgrade` result. */
|
|
387
|
+
/** Hand the engine rels of one `update --check`/`--fix` command to its `planEngineUpgrade` result. */
|
|
387
388
|
function ownEngineCheck(cwd, rels) {
|
|
388
389
|
engineCheckOwners.set(path.resolve(cwd), rels);
|
|
389
390
|
}
|
|
@@ -27,6 +27,7 @@ const ENGINE_SCRIPTS = [
|
|
|
27
27
|
'efficacy-oracle.mjs',
|
|
28
28
|
'manifest.mjs',
|
|
29
29
|
'team-db.mjs',
|
|
30
|
+
'team-db-backlog.mjs',
|
|
30
31
|
'team-db-schema.mjs',
|
|
31
32
|
'team-db-project.mjs',
|
|
32
33
|
'team-db-api.mjs',
|
|
@@ -39,6 +40,9 @@ const ENGINE_SCRIPTS = [
|
|
|
39
40
|
// Read-only post-step write-scope audit used by build-verifier and code-reviewer.
|
|
40
41
|
// Shells out to git, so it is not part of the self-learning loop module set.
|
|
41
42
|
'check-write-scope.mjs',
|
|
43
|
+
// Role/task metrics aggregation used by technical-retro; ships with the engine
|
|
44
|
+
// so a consumer can run it from `.ai.local/scripts/` without the package.
|
|
45
|
+
'aggregate-agent-task-metrics.mjs',
|
|
42
46
|
];
|
|
43
47
|
|
|
44
48
|
/** Package `presets/`-relative directory holding the engine source of truth. */
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* module is written only when its bytes still equal the digest the package
|
|
7
7
|
* recorded in `.ai.local/.template-base.json` for a previously shipped
|
|
8
8
|
* template. A consumer edit is reported `modified` and never touched; a module
|
|
9
|
-
* with no recorded base
|
|
9
|
+
* with no recorded base — or a record entry without a `source` — is reported
|
|
10
|
+
* unattributable and never written.
|
|
10
11
|
*
|
|
11
12
|
* The durable backup (`.ai.local/.rollback/engine-<stamp>/<rel>`, keep the last
|
|
12
13
|
* five runs) is a user-facing restore point. Failure atomicity is separate: the
|
|
@@ -69,7 +70,8 @@ function shippedEngineTemplates(packageRoot) {
|
|
|
69
70
|
* States: `current` (already at the template, or adoptable), `stale` (bytes
|
|
70
71
|
* still equal the recorded base and the template moved — the would-write set),
|
|
71
72
|
* `modified` (consumer bytes differ from the recorded base), `no-base` (no
|
|
72
|
-
* recorded base, so the bytes cannot be
|
|
73
|
+
* recorded base, or a base entry without a source, so the bytes cannot be
|
|
74
|
+
* attributed), `missing`, `symlink`.
|
|
73
75
|
*
|
|
74
76
|
* `checkOutcome` carries the row's `decide()` outcome in the shipped
|
|
75
77
|
* `check <outcome> <rel>` vocabulary, so `update --check` previews the engine
|
|
@@ -134,6 +136,12 @@ function planEngineUpgrade({ cwd, packageRoot }) {
|
|
|
134
136
|
detail = consumer.normSha256 === template.digest.normSha256
|
|
135
137
|
? `matches the shipped ${template.name} template`
|
|
136
138
|
: `${template.name} differs from the shipped template and ${reason}; bytes cannot be attributed (delete the module and re-run init)`;
|
|
139
|
+
} else if (base && !base.source) {
|
|
140
|
+
// A record entry without a source is never attributed (D-3): mapping it
|
|
141
|
+
// onto the fallback source would let decide() report `current` — doctor
|
|
142
|
+
// saying "matches the shipped template" — for bytes never attributed.
|
|
143
|
+
state = 'no-base';
|
|
144
|
+
detail = `${template.name} has no recorded source; bytes cannot be attributed (delete the module and re-run init)`;
|
|
137
145
|
} else {
|
|
138
146
|
const source = (base && base.source) || RECORDED_SOURCE_FALLBACK;
|
|
139
147
|
const outcome = decide({ consumer, base, template: template.digest, source });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema version of the per-tool install manifest (`manifest.json` under the
|
|
3
|
+
* tool root). One constant for every writer: `cli.js` reads and upgrades it
|
|
4
|
+
* and writes the cursor manifest, while the mavis/opencode/zcode installers
|
|
5
|
+
* write their own manifests — a bump cannot forget one of the four writers.
|
|
6
|
+
*
|
|
7
|
+
* A v2 manifest lists only preset files, so `doctor` and update pruning can
|
|
8
|
+
* trust it.
|
|
9
|
+
*/
|
|
10
|
+
const MANIFEST_SCHEMA_VERSION = 2;
|
|
11
|
+
|
|
12
|
+
module.exports = { MANIFEST_SCHEMA_VERSION };
|
|
@@ -357,6 +357,19 @@ function copyTemplates(presetTeamSrc, dest) {
|
|
|
357
357
|
copyFile(source, target);
|
|
358
358
|
written.push(`.ai.local/team/upstream/${name}`);
|
|
359
359
|
}
|
|
360
|
+
// The shipped weekly `upstream-research` job seeds only when absent, like the
|
|
361
|
+
// research data above: the template carries the definition the docs advertise,
|
|
362
|
+
// and an operator-edited `scheduler/jobs.json` (tracked on purpose — jobs as
|
|
363
|
+
// code) is never overwritten. The scheduler owns the file under
|
|
364
|
+
// `scheduler/`; the template lives beside the other upstream templates.
|
|
365
|
+
{
|
|
366
|
+
const jobsSource = path.join(upstreamSrc, 'jobs.json');
|
|
367
|
+
const jobsTarget = path.join(dest, 'scheduler', 'jobs.json');
|
|
368
|
+
if (fs.existsSync(jobsSource) && !fs.existsSync(jobsTarget)) {
|
|
369
|
+
copyFile(jobsSource, jobsTarget);
|
|
370
|
+
written.push('.ai.local/team/scheduler/jobs.json');
|
|
371
|
+
}
|
|
372
|
+
}
|
|
360
373
|
const gitkeepSrc = path.join(presetTeamSrc, 'tasks', '.gitkeep');
|
|
361
374
|
if (fs.existsSync(gitkeepSrc) && !hasConsumerTaskSlugs(path.join(dest, 'tasks'))) {
|
|
362
375
|
copyFile(gitkeepSrc, path.join(dest, 'tasks', '.gitkeep'));
|
package/bin/mavis-install.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const { assertSafeDest, escapesRoot, resolveManagedPath } = require('./lib/safe-path');
|
|
7
|
+
const { MANIFEST_SCHEMA_VERSION } = require('./lib/manifest-schema');
|
|
7
8
|
const {
|
|
8
9
|
createInstallTransaction,
|
|
9
10
|
isPlainObject,
|
|
@@ -269,9 +270,9 @@ function cmdInitMavis({ preset, cwdOption, helpers }) {
|
|
|
269
270
|
managedFiles[item.rel] = sha256File(item.dest);
|
|
270
271
|
}
|
|
271
272
|
const manifest = {
|
|
272
|
-
//
|
|
273
|
-
// files, so `doctor` and update pruning can trust it.
|
|
274
|
-
schemaVersion:
|
|
273
|
+
// Shared constant (bin/lib/manifest-schema.js): a v2 manifest lists only
|
|
274
|
+
// preset files, so `doctor` and update pruning can trust it.
|
|
275
|
+
schemaVersion: MANIFEST_SCHEMA_VERSION,
|
|
275
276
|
packageVersion: packageVersion(packageRoot),
|
|
276
277
|
platform: 'mavis',
|
|
277
278
|
preset: stack,
|
package/bin/opencode-install.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const { assertSafeDest, escapesRoot, resolveManagedPath } = require('./lib/safe-path');
|
|
7
|
+
const { MANIFEST_SCHEMA_VERSION } = require('./lib/manifest-schema');
|
|
7
8
|
const {
|
|
8
9
|
createInstallTransaction,
|
|
9
10
|
isPlainObject,
|
|
@@ -65,7 +66,7 @@ function packageVersion(packageRoot) {
|
|
|
65
66
|
return loadJson(path.join(packageRoot, 'package.json')).version;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
function buildPlan({ contract, sourceBase, cwd }) {
|
|
69
|
+
function buildPlan({ contract, sourceBase, sharedSourceBase, cwd }) {
|
|
69
70
|
const files = [];
|
|
70
71
|
const seen = new Set();
|
|
71
72
|
const addFile = (source, destRel) => {
|
|
@@ -97,6 +98,18 @@ function buildPlan({ contract, sourceBase, cwd }) {
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
// Shared platform assets (for example the TUI plugins) live beside the stack
|
|
102
|
+
// directories, so every released preset installs the same copy.
|
|
103
|
+
for (const mapping of contract.sharedDirectoryMappings || []) {
|
|
104
|
+
const sourceDir = path.join(sharedSourceBase, mapping.source);
|
|
105
|
+
if (!fs.existsSync(sourceDir)) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
for (const rel of walkFiles(sourceDir)) {
|
|
109
|
+
addFile(path.join(sourceDir, rel), `${mapping.destination}/${rel}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
const mcpMd = path.join(sourceBase, 'MCP.md');
|
|
101
114
|
if (fs.existsSync(mcpMd)) {
|
|
102
115
|
addFile(mcpMd, path.join(contract.managedRoot, 'MCP.md'));
|
|
@@ -403,7 +416,7 @@ function cmdInitOpencode({ preset, cwdOption, helpers }) {
|
|
|
403
416
|
|
|
404
417
|
try {
|
|
405
418
|
throwIfPhase('validate');
|
|
406
|
-
const plan = buildPlan({ contract, sourceBase, cwd });
|
|
419
|
+
const plan = buildPlan({ contract, sourceBase, sharedSourceBase: sourceRoot, cwd });
|
|
407
420
|
for (const item of plan.files) {
|
|
408
421
|
if (!fs.existsSync(item.source)) {
|
|
409
422
|
throw new Error(`Source missing: ${item.source}`);
|
|
@@ -466,16 +479,19 @@ function cmdInitOpencode({ preset, cwdOption, helpers }) {
|
|
|
466
479
|
managedFiles[item.rel] = sha256File(item.dest);
|
|
467
480
|
}
|
|
468
481
|
const manifest = {
|
|
469
|
-
//
|
|
470
|
-
// files, so `doctor` and update pruning can trust it.
|
|
471
|
-
schemaVersion:
|
|
482
|
+
// Shared constant (bin/lib/manifest-schema.js): a v2 manifest lists only
|
|
483
|
+
// preset files, so `doctor` and update pruning can trust it.
|
|
484
|
+
schemaVersion: MANIFEST_SCHEMA_VERSION,
|
|
472
485
|
packageVersion: packageVersion(packageRoot),
|
|
473
486
|
platform: 'opencode',
|
|
474
487
|
preset: stack,
|
|
475
488
|
installedAt: new Date().toISOString(),
|
|
476
489
|
managedFiles,
|
|
477
490
|
mergedConfigs,
|
|
478
|
-
managedDirectories:
|
|
491
|
+
managedDirectories: [
|
|
492
|
+
...(contract.directoryMappings || []).map((entry) => entry.destination),
|
|
493
|
+
...(contract.sharedDirectoryMappings || []).map((entry) => entry.destination),
|
|
494
|
+
],
|
|
479
495
|
shippedMcpServerIds: plan.mcp ? shippedMcpIds(plan.mcp.source) : [],
|
|
480
496
|
docsSeed: seeded
|
|
481
497
|
? { seeded: true }
|
package/bin/zcode-install.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
const fs = require('fs');
|
|
8
8
|
const path = require('path');
|
|
9
9
|
const { assertSafeDest, escapesRoot, resolveManagedPath } = require('./lib/safe-path');
|
|
10
|
+
const { MANIFEST_SCHEMA_VERSION } = require('./lib/manifest-schema');
|
|
10
11
|
const {
|
|
11
12
|
createInstallTransaction,
|
|
12
13
|
isPlainObject,
|
|
@@ -366,9 +367,9 @@ function cmdInitZcode({ preset, cwdOption, helpers }) {
|
|
|
366
367
|
managedFiles[item.rel] = sha256File(item.dest);
|
|
367
368
|
}
|
|
368
369
|
const manifest = {
|
|
369
|
-
//
|
|
370
|
-
// files, so `doctor` and update pruning can trust it.
|
|
371
|
-
schemaVersion:
|
|
370
|
+
// Shared constant (bin/lib/manifest-schema.js): a v2 manifest lists only
|
|
371
|
+
// preset files, so `doctor` and update pruning can trust it.
|
|
372
|
+
schemaVersion: MANIFEST_SCHEMA_VERSION,
|
|
372
373
|
packageVersion: packageVersion(packageRoot),
|
|
373
374
|
platform: 'zcode',
|
|
374
375
|
preset: stack,
|
package/docs/MCP-CATALOG.md
CHANGED
|
@@ -61,7 +61,7 @@ Only clients detected in the project are written (`mcp.json` exists, or the inst
|
|
|
61
61
|
| Yandex | `.ai-rules/mcp/config.env` or `YANDEX_ORG_ID` | `ai-rules mcp setup yandex` |
|
|
62
62
|
| DefectDojo | `.env.defectdojo` (project root, ignored) or `DEFECTDOJO_TOKEN` | `ai-rules mcp setup defectdojo` |
|
|
63
63
|
|
|
64
|
-
The DefectDojo token is never written by the package. `.env.defectdojo` holds `DEFECTDOJO_URL` and `DEFECTDOJO_TOKEN`; the file must be gitignored. `mcp setup defectdojo` proves the pair with `GET /api/v2/findings/` before registering.
|
|
64
|
+
The DefectDojo token is never written by the package. `.env.defectdojo` holds `DEFECTDOJO_URL` and `DEFECTDOJO_TOKEN`; the file must be gitignored. `mcp setup defectdojo` proves the pair with `GET /api/v2/findings/` before registering. `dd_import_scan` reads the report file only inside the project root — repo-relative paths; absolute paths, `..` traversal, and symlinks pointing outside the root are refused before any read or upload.
|
|
65
65
|
|
|
66
66
|
## Merge rules
|
|
67
67
|
|
|
@@ -35,7 +35,8 @@ Allowed status values are `confirmed`, `partial`, `unknown`, `manual`, and `no-e
|
|
|
35
35
|
| Workspace agent discovery | `confirmed` | opencode.ai/docs/agents | `.opencode/agents/` | Native |
|
|
36
36
|
| Workspace Skill discovery | `confirmed` | opencode.ai/docs/skills | `.opencode/skills/<name>/SKILL.md` | Native `skill` tool |
|
|
37
37
|
| Project MCP | `confirmed` | opencode.ai/docs/mcp-servers | `opencode.json` `mcp` | Merge on init |
|
|
38
|
-
|
|
|
38
|
+
| TUI plugin discovery | `confirmed` | opencode.ai/docs/plugins | `.opencode/plugins/<name>/` loads automatically | Ships `task-status` TUI sidebar |
|
|
39
|
+
| Project hooks (`hooks.json`) | `manual` | plugins exist; this preset ships a TUI viewer, not a hook plugin | No confirmed `subagentStop` analog was opened | Manual `chain-team-phases.sh` |
|
|
39
40
|
| Slash commands | `confirmed` | opencode.ai/docs/commands | `.opencode/commands/<name>.md` | Native `/task` |
|
|
40
41
|
| Plugin / skill / MCP combo | `confirmed` | skills + mcp docs | MCP inflates context | Gate unused servers in operator config |
|
|
41
42
|
| Native Team lifecycle | `partial` | file pipeline is ai-rules SoT | No native team runtime | Hook owns `status.json` / `metrics.json` |
|
|
@@ -45,7 +46,7 @@ Allowed status values are `confirmed`, `partial`, `unknown`, `manual`, and `no-e
|
|
|
45
46
|
|
|
46
47
|
- Cursor `alwaysApply` / `globs` on OpenCode
|
|
47
48
|
- Claude topic-folder twins as the OpenCode source
|
|
48
|
-
- Auto-registration of `hooks.json` or a
|
|
49
|
+
- Auto-registration of `hooks.json` or a hook plugin in v1
|
|
49
50
|
- `init opencode --dry-run` / manifest preview (v1 is apply + rollback only)
|
|
50
51
|
- Writes to `~/.config/opencode/**` or `~/.opencode/**`
|
|
51
52
|
|
package/docs/OPENCODE.md
CHANGED
|
@@ -78,10 +78,30 @@ printf '%s\n' '{"status":"completed","attemptId":"<from-status.json>"}' \
|
|
|
78
78
|
| TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
Human gates pause with `awaitingHumanGate: true`. Resume with `/task-continue`. There is **no** shipped `hooks.json` or
|
|
81
|
+
Human gates pause with `awaitingHumanGate: true`. Resume with `/task-continue`. There is **no** shipped `hooks.json` or hook plugin in v1.
|
|
82
82
|
|
|
83
83
|
Full team layout: `.ai.local/team/README.md`.
|
|
84
84
|
|
|
85
|
+
## Task status sidebar (TUI plugin)
|
|
86
|
+
|
|
87
|
+
`.opencode/plugins/task-status/` ships with every OpenCode preset. `init` and
|
|
88
|
+
`update` copy it as a managed file; OpenCode auto-loads every plugin under
|
|
89
|
+
`.opencode/plugins/`, so `opencode.json` needs no `plugins` entry.
|
|
90
|
+
|
|
91
|
+
- Reads the nearest `.ai.local/team/` above the session directory and maps the
|
|
92
|
+
active session to a task by its user messages.
|
|
93
|
+
- Renders slug, state, elapsed time, current step, and a soft-stop button in the
|
|
94
|
+
TUI `sidebar.content` slot. Toggle the sidebar with `ctrl+x b`.
|
|
95
|
+
- Shows a `~p50 · p90` estimate for the remaining steps, built from the attempt
|
|
96
|
+
durations of every ledger under the team root; hidden on a human gate, pause,
|
|
97
|
+
stale run, or completion. It estimates agent work, not wall-clock time.
|
|
98
|
+
- The stop button writes `.ai.local/STOP`; the in-flight attempt finishes and no
|
|
99
|
+
next step starts. Resume with `/task-continue <slug>`.
|
|
100
|
+
- TUI-only: OpenCode Desktop does not render TUI plugins.
|
|
101
|
+
|
|
102
|
+
`update` refreshes the installed copy; `clean opencode` removes unchanged files.
|
|
103
|
+
Do not edit the installed copy in place.
|
|
104
|
+
|
|
85
105
|
## MCP
|
|
86
106
|
|
|
87
107
|
Preset servers merge into project **`opencode.json`** `mcp`:
|
|
@@ -101,7 +121,7 @@ Labels from official OpenCode docs (live CLI probe not yet run). Full matrix: [`
|
|
|
101
121
|
| `.opencode/agents` / `skills` / `commands` | **confirmed** (docs) | Native discovery |
|
|
102
122
|
| `opencode.json` MCP | **confirmed** (docs) | Merge `mcp` |
|
|
103
123
|
| Glob / alwaysApply rules | **no-equivalent** | Lazy Read catalog under `.opencode/rules/` |
|
|
104
|
-
| `hooks.json` / subagentStop | **manual** | `TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh` after receipts;
|
|
124
|
+
| `hooks.json` / subagentStop | **manual** | `TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh` after receipts; the `task-status` TUI plugin is a viewer, not a hook |
|
|
105
125
|
| Native Team lifecycle | **partial** | File pipeline is SoT; hook is single lifecycle writer |
|
|
106
126
|
|
|
107
127
|
Do not pin OpenCode CLI or TUI versions in the contract.
|
|
@@ -173,7 +173,7 @@ Summary:
|
|
|
173
173
|
- [ ] Twin drift: after editing a Claude `commands/**` or `skills/**` file, `node scripts/check-preset-twin-drift.mjs` passes — mirror the change in the Cursor twin (delta and divergence unchanged) or record a deliberate divergence with `--update`. A deliberate divergence that **raises** an allowance needs `--update --widen`; dropping a baseline row needs `--update --prune`. A plain `--update` refuses both.
|
|
174
174
|
- [ ] Generated trees regenerated (`generate-mavis.mjs` + `generate-opencode.mjs`) and CLI goldens recaptured (`capture-cli-golden.mjs`) after any preset-installed file changes
|
|
175
175
|
|
|
176
|
-
Validation: `yarn check:fast` + the `preset-pr-checklist` rule; the full composite runs in `yarn release:gate
|
|
176
|
+
Validation: `yarn check:fast` + the `preset-pr-checklist` rule; the full composite runs in `yarn release:gate`. CI workflows: `preset-structure.yml` (`check`, `hooks`, `ai-local-engine-tests`), `platform-smoke.yml` (3-OS smoke: `init multi`/`update`/`doctor`, platform suites, script gate), `rule-eval.yml` (opt-in next rule-eval), and `release-gate.yml` (manual `yarn release:gate` run + report artifact).
|
|
177
177
|
|
|
178
178
|
## Release order
|
|
179
179
|
|
|
@@ -450,7 +450,7 @@ Iteration versus release:
|
|
|
450
450
|
|
|
451
451
|
`check-generated-drift` caches generated trees in the OS temp directory, keyed by a digest of the Cursor/`_shared` sources and the generator libraries. A source or generator edit misses the cache and regenerates; the cache is disposable and never hides drift.
|
|
452
452
|
|
|
453
|
-
CI: [`.github/workflows/preset-structure.yml`](../../../.github/workflows/preset-structure.yml) runs the orchestrator on PRs touching `packages/ai-rules/**`.
|
|
453
|
+
CI: [`.github/workflows/preset-structure.yml`](../../../.github/workflows/preset-structure.yml) runs the orchestrator on PRs touching `packages/ai-rules/**`. The other workflows in `.github/workflows/`: `platform-smoke.yml` (3-OS smoke: `init multi`, `update`, `doctor`, platform suites, script gate), `rule-eval.yml` (opt-in next rule-eval via `scripts/check-rule-eval.mjs`), and `release-gate.yml` (manual `yarn release:gate` run on a chosen ref; uploads the `.release-gate/` report as an artifact).
|
|
454
454
|
|
|
455
455
|
---
|
|
456
456
|
|
package/docs/TEAM-DB.md
CHANGED
|
@@ -8,7 +8,8 @@ The projection is installed by `init` as seven modules under `.ai.local/scripts/
|
|
|
8
8
|
|
|
9
9
|
| Module | Role |
|
|
10
10
|
|---|---|
|
|
11
|
-
| `team-db.mjs` | CLI: `init`, `sync`, `delete`, `migrate-tasks`, `check`, `serve`, `jobs`, `schedule` |
|
|
11
|
+
| `team-db.mjs` | CLI: `init`, `sync`, `delete`, `migrate-tasks`, `check`, `serve`, `jobs`, `schedule`, `backlog` |
|
|
12
|
+
| `team-db-backlog.mjs` | the file-authoritative backlog: items, the launch queue, eligibility order, import |
|
|
12
13
|
| `team-db-schema.mjs` | capability probe, embedded migrations, pragmas, fingerprint, integrity |
|
|
13
14
|
| `team-db-project.mjs` | parsers, idempotent projector, confirmed task deletion, retention, search |
|
|
14
15
|
| `team-db-api.mjs` | `node:http` server (reads plus the bounded mutations), query layer, security boundary |
|
|
@@ -116,13 +117,24 @@ node .ai.local/scripts/team-db.mjs jobs reconcile [--json]
|
|
|
116
117
|
node .ai.local/scripts/team-db.mjs jobs run --id <id> [--json]
|
|
117
118
|
node .ai.local/scripts/team-db.mjs schedule [--once] [--interval-ms <n>] [--grace-ms <n>]
|
|
118
119
|
[--drain-ms <n>] [--json] [--quiet]
|
|
120
|
+
node .ai.local/scripts/team-db.mjs backlog add --file <path|-> [--json] [--quiet]
|
|
121
|
+
node .ai.local/scripts/team-db.mjs backlog set <id> --file <path|-> [--json]
|
|
122
|
+
node .ai.local/scripts/team-db.mjs backlog show <id> | list [--status <csv>] [--ready] | ready | validate
|
|
123
|
+
[--json]
|
|
124
|
+
node .ai.local/scripts/team-db.mjs backlog import --file <path|-> [--dry-run] [--json]
|
|
125
|
+
node .ai.local/scripts/team-db.mjs backlog enqueue --file <path|-> | cancel <entryId> | drain [--claim]
|
|
126
|
+
| recover | prune [--older-than <days>] [--json] [--quiet]
|
|
119
127
|
```
|
|
120
128
|
|
|
121
129
|
Exit codes: `0` ok, `1` at least one task failed, a delete refusal (unknown slug, active
|
|
122
130
|
task, kill switch, folder-delete failure) or a migration checksum drifted, `2`
|
|
123
131
|
database-level failure — a `delete` without `node:sqlite` refuses here rather than deleting
|
|
124
132
|
the folder only, `3` usage, `4` deadline or busy database (the hook-shaped `sync --slug`
|
|
125
|
-
deadline, or a delete that meets a locked database).
|
|
133
|
+
deadline, or a delete that meets a locked database). The `backlog` verbs reuse the same
|
|
134
|
+
vocabulary: `0` ok, `1` a validation refusal carrying its named code (`E_BACKLOG_CYCLE`,
|
|
135
|
+
`E_BACKLOG_SELF_DEP`, `E_BACKLOG_UNKNOWN_DEP`, `E_BACKLOG_DUPLICATE_ID`, `E_ID_COLLISION`,
|
|
136
|
+
`E_BACKLOG_TRANSITION`, `E_BACKLOG_REVISION`, `E_SCHEMA`), `3` usage, `4` the tree lock was
|
|
137
|
+
contended (`E_BACKLOG_BUSY`).
|
|
126
138
|
|
|
127
139
|
`sync` is idempotent: a second run reports `inserted=0 updated=0 unchanged=<n>`. One changed
|
|
128
140
|
byte changes exactly one document hash and one task content hash. A removed task directory is
|
|
@@ -158,17 +170,58 @@ targets must be on the same host.
|
|
|
158
170
|
|
|
159
171
|
| Name | Effect |
|
|
160
172
|
|---|---|
|
|
161
|
-
| `AI_RULES_TEAM_DB_DISABLE` | truthy value
|
|
173
|
+
| `AI_RULES_TEAM_DB_DISABLE` | truthy value turns the **projection** off — the database write points and `serve` stop; the task files and the `backlog` file verbs stay usable (the backlog is not disabled by this switch, R3-7) |
|
|
162
174
|
| `AI_RULES_TEAM_DB_FORCE_FALLBACK` | truthy value forces the file-only path even on a supported runtime |
|
|
163
175
|
| `AI_RULES_TEAM_DB_ROOT` | team directory when `--root` is absent |
|
|
164
176
|
| `AI_RULES_TEAM_DB_PATH` | database file path (default `<teamRoot>/team.db`) |
|
|
165
177
|
| `AI_RULES_TEAM_DB_LOG` | error-log path (default `<cwd>/.ai.local/team/team-db-errors.log`) |
|
|
166
178
|
| `AI_RULES_TEAM_DB_SEAM` | phase label in the error log: `hook`, `receipt`, `cli`, `serve` |
|
|
179
|
+
| `AI_RULES_TEAM_DB_BACKLOG_DRAIN_DISABLE` | truthy value stops the hook stop-seam auto-drain only; the `backlog` file verbs stay usable |
|
|
167
180
|
|
|
168
181
|
No other environment value is read or persisted. The error log stores a timestamp, a code,
|
|
169
182
|
a phase, and a message; it never stores prompt content or an environment value, and it is
|
|
170
183
|
trimmed to the newest 200 lines / 64 KiB.
|
|
171
184
|
|
|
185
|
+
## Backlog
|
|
186
|
+
|
|
187
|
+
`team/backlog/` is a file-authoritative store with one writer: `team-db-backlog.mjs`.
|
|
188
|
+
`backlog/items/<id>.json` is committed (the plan the team executes); `backlog/queue/` is
|
|
189
|
+
runtime state and git-ignored. The stored status lattice is `planned|completed|cancelled|
|
|
190
|
+
superseded`; every operational status (`effectiveStatus`, `ready`, `waitingOn`) is derived
|
|
191
|
+
from the item files, the queue entries and the hook-owned `tasks/*/status.json` state, and
|
|
192
|
+
is never written to a file. The total order is `priority` ascending — **lower runs
|
|
193
|
+
first**, with the default priority 5 — then `createdAt`, then `id`; there is no `sort`
|
|
194
|
+
parameter, so the list, the drain and the ready set can never disagree.
|
|
195
|
+
|
|
196
|
+
An item's `id` matches the slug grammar, is immutable, and becomes the `/task` slug at
|
|
197
|
+
launch; creating an item whose id already names a `tasks/<id>/` folder is refused with
|
|
198
|
+
`E_ID_COLLISION`. Writes validate schema → identity → graph (first failure wins) and bump
|
|
199
|
+
the `revision` CAS token; `backlog set` refuses a stale `revision` with `E_BACKLOG_REVISION`.
|
|
200
|
+
|
|
201
|
+
The launch queue serializes task starts: `backlog enqueue` records a request (idempotent
|
|
202
|
+
per item — a duplicate appends its reason to the entry history), `backlog drain --claim`
|
|
203
|
+
grants at most one claim in drain order and never starts a run, and the hook stop seam
|
|
204
|
+
consumes the claim and bootstraps `tasks/<slug>/pipeline.json` (the recorded `command` is
|
|
205
|
+
never executed). `backlog/config.json` carries `maxActive` (1…8, default 1): a task in a
|
|
206
|
+
holding state (`in_progress`, `awaiting_artifact_receipt`, `blocked`) occupies a slot, a
|
|
207
|
+
task at a human gate does not. A claim older than 90 s with no task row is released on the
|
|
208
|
+
next drain or by `backlog recover`; `backlog prune --older-than <days>` deletes aged
|
|
209
|
+
terminal entry files only. The backlog module never writes `status.json`, `metrics.json`,
|
|
210
|
+
or `scheduler/jobs.json`.
|
|
211
|
+
|
|
212
|
+
**Import envelope (D-8).** `backlog import --file <path|->` reads a versioned envelope
|
|
213
|
+
`{ schemaVersion: 1, source: { task, generatedAt }, items: [...] }`, validates every item
|
|
214
|
+
as one transaction (a failure writes nothing), upserts by id, writes nothing on `--dry-run`,
|
|
215
|
+
and an idle re-import (content-hash equality over the envelope fields) writes nothing.
|
|
216
|
+
`revision` and `history` are store-owned and never part of that comparison.
|
|
217
|
+
|
|
218
|
+
**Kill switch.** `AI_RULES_TEAM_DB_DISABLE=1` disables the **projection**, not the backlog:
|
|
219
|
+
`backlog add|set|show|list|ready|validate|import|enqueue|cancel|drain|recover|prune` stay
|
|
220
|
+
usable because they are file writes to the authoritative tree; the projection child each
|
|
221
|
+
write verb spawns is skipped silently, and a runtime without `node:sqlite` keeps the store
|
|
222
|
+
file-only end to end. `AI_RULES_TEAM_DB_BACKLOG_DRAIN_DISABLE=1` stops only the hook's
|
|
223
|
+
automatic drain.
|
|
224
|
+
|
|
172
225
|
## Scheduled jobs
|
|
173
226
|
|
|
174
227
|
`scheduler/jobs.json` holds the definitions, sorted by `id` and rewritten atomically; it is
|
|
@@ -235,7 +288,11 @@ The `next` preset ships one `pipeline` job, `upstream-research`, and one engine
|
|
|
235
288
|
`.ai.local/scripts/upstream-research.mjs`. The job renders `upstream/prompt.md` and runs the
|
|
236
289
|
module with `--prompt {promptFile} --team-root . --repo-root ../..`; it is a normal
|
|
237
290
|
definition in `scheduler/jobs.json`, so `jobs list|get|put|enable|disable|run`, the dashboard
|
|
238
|
-
Jobs tab, and every job route work unchanged.
|
|
291
|
+
Jobs tab, and every job route work unchanged. `init`/`update` seed the definition into
|
|
292
|
+
`scheduler/jobs.json` when the file is absent (template:
|
|
293
|
+
`presets/cursor/next/team/upstream/jobs.json`; the validator supplies the
|
|
294
|
+
`createdAt`/`updatedAt`/`revision` defaults on read), and a definition the operator already
|
|
295
|
+
owns is never overwritten.
|
|
239
296
|
|
|
240
297
|
**Supervision.** `misfire: run-once` fires one missed Monday at the next tick, and
|
|
241
298
|
`concurrency: skip` consumes and drops a manual request while a weekly run is live (the drop
|
|
@@ -298,6 +355,16 @@ schema, so the next open moves the file aside as `team.db.mismatch-<stamp>`, reb
|
|
|
298
355
|
reprojects from the task files — database-only rows are discarded by design, which is why the
|
|
299
356
|
files are the source of truth. Run `sync` after an upgrade and the counters reconverge.
|
|
300
357
|
|
|
358
|
+
Migration `0003-backlog` adds the backlog projection — `backlog_items`, `backlog_item_deps`,
|
|
359
|
+
`backlog_queue`, `backlog_queue_events` — and five indexes, and moves `SCHEMA_VERSION` to 3.
|
|
360
|
+
It is additive and sha256-pinned like the first two: no `ALTER` of the `tasks` or scheduler
|
|
361
|
+
tables, so a wrong v3 costs a v4, never an edit. `active`/`done` are derived from the joined
|
|
362
|
+
task row, never stored; `backlog_item_deps` has no foreign key on `dep_id`, so a broken file
|
|
363
|
+
set projects as a recorded `parse_error` instead of aborting the run. The backlog walker runs
|
|
364
|
+
two bounded directory listings inside the existing sync deadline — 200 items measure well
|
|
365
|
+
under 250 ms — and is idempotent by `content_hash` with `absent_at` marking like the task
|
|
366
|
+
walker; `sync --prune` removes tombstoned backlog rows.
|
|
367
|
+
|
|
301
368
|
Each connection sets `journal_mode=WAL`, `busy_timeout=5000`, `foreign_keys=ON`, and
|
|
302
369
|
`synchronous=NORMAL`. One task is projected in one transaction; a `SIGKILL` mid-sync
|
|
303
370
|
rolls back the in-flight task and leaves `integrity_check` `ok`.
|