@bonesofspring/ai-rules 0.2.64 → 0.2.66
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 +80 -11
- package/README.md +24 -16
- package/bin/lib/engine-scripts.js +52 -12
- package/bin/lib/engine-upgrade.js +5 -2
- package/bin/lib/seed-ai-local-team.js +13 -3
- package/docs/OPENCODE.md +17 -9
- package/docs/PRESET-CONTRIBUTION.md +41 -0
- package/docs/TEAM-DB.md +240 -60
- package/docs/TOKEN-ECONOMY.md +79 -0
- package/docs/openapi/team-db.v1.json +1238 -377
- package/mcp/defectdojo-mcp.mjs +7 -5
- package/mcp/lib/defectdojo.mjs +26 -14
- package/package.json +31 -20
- package/presets/_shared/ai-local/scripts/dump-output.mjs +371 -0
- package/presets/_shared/ai-local/scripts/process-lease.mjs +576 -0
- package/presets/_shared/ai-local/scripts/processes.mjs +1618 -0
- package/presets/_shared/ai-local/scripts/run.mjs +5 -5
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +465 -152
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +235 -10
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +416 -176
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +171 -62
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +4 -0
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +143 -5
- package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +567 -0
- package/presets/_shared/ai-local/scripts/{team-db-backlog.mjs → team-db-tracker.mjs} +900 -197
- package/presets/_shared/ai-local/scripts/team-db-ui.mjs +750 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +184 -23
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +4 -2
- package/presets/_shared/core/architecture/feature-delivery-workflow.md +4 -0
- package/presets/_shared/core/quality/context-and-iteration.md +1 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +105 -17
- package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +40 -2
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/android-kotlin/settings.json +6 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/go/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/go/settings.json +6 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/ios-swift/settings.json +6 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/java/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/java/settings.json +6 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/mcp-ts/settings.json +6 -1
- package/presets/claude/mol/agents/task-analyst.md +1 -1
- package/presets/claude/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/mol/settings.json +6 -1
- package/presets/claude/next/MCP.md +2 -0
- package/presets/claude/next/REPO_AGENTS.md +2 -0
- package/presets/claude/next/agents/build-verifier.md +1 -1
- package/presets/claude/next/agents/ci-investigator.md +3 -0
- package/presets/claude/next/agents/debugger.md +3 -0
- package/presets/claude/next/agents/feature-developer.md +3 -0
- package/presets/claude/next/agents/mockup-reviewer.md +2 -0
- package/presets/claude/next/agents/performance-auditor.md +2 -0
- package/presets/claude/next/agents/playwright-test-generator.md +3 -0
- package/presets/claude/next/agents/playwright-test-healer.md +3 -0
- package/presets/claude/next/agents/playwright-test-planner.md +3 -0
- package/presets/claude/next/agents/qa-tester.md +3 -0
- package/presets/claude/next/agents/task-analyst.md +1 -1
- package/presets/claude/next/commands/README.md +7 -1
- package/presets/claude/next/commands/task.md +1 -1
- package/presets/claude/next/commands/ui-start.md +78 -0
- package/presets/claude/next/commands/ui-stop.md +71 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/next/rules/README.md +2 -1
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/next/rules/stack/next-app-core.md +1 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/next/rules/tooling-and-review/dev-process-lifecycle.md +43 -0
- package/presets/claude/next/settings.json +6 -1
- package/presets/claude/next/team/README.md +7 -3
- package/presets/claude/nuxt/agents/task-analyst.md +1 -1
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/nuxt/settings.json +6 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/php-hexagonal/settings.json +6 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/php-laravel/settings.json +6 -1
- package/presets/claude/svelte/agents/task-analyst.md +1 -1
- package/presets/claude/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/svelte/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/svelte/settings.json +6 -1
- package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/agents/task-analyst.md +1 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/java/agents/task-analyst.md +1 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mol/agents/task-analyst.md +1 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/MCP.md +2 -0
- package/presets/cursor/next/REPO_AGENTS.md +2 -0
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/ci-investigator.md +2 -0
- package/presets/cursor/next/agents/debugger.md +2 -0
- package/presets/cursor/next/agents/feature-developer.md +2 -0
- package/presets/cursor/next/agents/mockup-reviewer.md +2 -0
- package/presets/cursor/next/agents/performance-auditor.md +2 -0
- package/presets/cursor/next/agents/playwright-test-generator.md +2 -0
- package/presets/cursor/next/agents/playwright-test-healer.md +2 -0
- package/presets/cursor/next/agents/playwright-test-planner.md +2 -0
- package/presets/cursor/next/agents/qa-tester.md +2 -0
- package/presets/cursor/next/agents/task-analyst.md +1 -1
- package/presets/cursor/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/cursor/next/commands/README.md +7 -1
- package/presets/cursor/next/commands/task.md +1 -1
- package/presets/cursor/next/commands/ui-start.md +78 -0
- package/presets/cursor/next/commands/ui-stop.md +71 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/next/rules/README.md +2 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +3 -1
- package/presets/cursor/next/rules/dev-process-lifecycle.mdc +43 -0
- package/presets/cursor/next/rules/next-app-core.mdc +1 -0
- package/presets/cursor/next/team/README.md +7 -3
- package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/agents/task-analyst.md +1 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/svelte/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/agents/task-analyst.md +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/go/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/agents/task-analyst.md +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/java/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/agents/task-analyst.md +1 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/next/MCP.md +2 -0
- package/presets/mavis/next/REPO_AGENTS.md +2 -0
- package/presets/mavis/next/adapter-map.json +33 -1
- package/presets/mavis/next/agents/build-verifier.md +1 -1
- package/presets/mavis/next/agents/ci-investigator.md +3 -0
- package/presets/mavis/next/agents/debugger.md +3 -0
- package/presets/mavis/next/agents/feature-developer.md +3 -0
- package/presets/mavis/next/agents/mockup-reviewer.md +2 -0
- package/presets/mavis/next/agents/performance-auditor.md +2 -0
- package/presets/mavis/next/agents/playwright-test-generator.md +3 -0
- package/presets/mavis/next/agents/playwright-test-healer.md +3 -0
- package/presets/mavis/next/agents/playwright-test-planner.md +3 -0
- package/presets/mavis/next/agents/qa-tester.md +3 -0
- package/presets/mavis/next/agents/task-analyst.md +1 -1
- package/presets/mavis/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/mavis/next/commands/README.md +7 -1
- package/presets/mavis/next/commands/task.md +1 -1
- package/presets/mavis/next/commands/ui-start.md +73 -0
- package/presets/mavis/next/commands/ui-stop.md +66 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/next/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/mavis/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/next/rules/next-app-core.md +1 -0
- package/presets/mavis/next/team/README.md +7 -3
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/task-analyst.md +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/android-kotlin/opencode.json +5 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/go/opencode.json +5 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/ios-swift/opencode.json +5 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/java/opencode.json +5 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/mcp-ts/opencode.json +5 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/agents/task-analyst.md +1 -1
- package/presets/opencode/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/mol/opencode.json +4 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/next/MCP.md +2 -0
- package/presets/opencode/next/REPO_AGENTS.md +2 -0
- package/presets/opencode/next/adapter-map.json +33 -1
- package/presets/opencode/next/agents/build-verifier.md +1 -1
- package/presets/opencode/next/agents/ci-investigator.md +3 -0
- package/presets/opencode/next/agents/debugger.md +3 -0
- package/presets/opencode/next/agents/feature-developer.md +3 -0
- package/presets/opencode/next/agents/mockup-reviewer.md +2 -0
- package/presets/opencode/next/agents/performance-auditor.md +2 -0
- package/presets/opencode/next/agents/playwright-test-generator.md +3 -0
- package/presets/opencode/next/agents/playwright-test-healer.md +3 -0
- package/presets/opencode/next/agents/playwright-test-planner.md +3 -0
- package/presets/opencode/next/agents/qa-tester.md +3 -0
- package/presets/opencode/next/agents/task-analyst.md +1 -1
- package/presets/opencode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/opencode/next/commands/README.md +7 -1
- package/presets/opencode/next/commands/task.md +1 -1
- package/presets/opencode/next/commands/ui-start.md +81 -0
- package/presets/opencode/next/commands/ui-stop.md +74 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/next/opencode.json +4 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/opencode/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/next/rules/next-app-core.md +1 -0
- package/presets/opencode/next/team/README.md +7 -3
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/nuxt/opencode.json +4 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/php-hexagonal/opencode.json +5 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/opencode/php-laravel/opencode.json +5 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/plugins/task-status/README.md +23 -11
- package/presets/opencode/plugins/task-status/details-data.ts +64 -46
- package/presets/opencode/plugins/task-status/details.tsx +12 -2
- package/presets/opencode/plugins/task-status/format.ts +16 -0
- package/presets/opencode/plugins/task-status/prompt-text.ts +37 -0
- package/presets/opencode/plugins/task-status/task-view.ts +241 -177
- package/presets/opencode/plugins/task-status/tui.tsx +57 -15
- package/presets/opencode/plugins/task-status/types.ts +74 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/svelte/opencode.json +4 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/agents/task-analyst.md +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/go/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/agents/task-analyst.md +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/java/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/agents/task-analyst.md +1 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/next/MCP.md +2 -0
- package/presets/zcode/next/REPO_AGENTS.md +2 -0
- package/presets/zcode/next/adapter-map.json +33 -1
- package/presets/zcode/next/agents/build-verifier.md +1 -1
- package/presets/zcode/next/agents/ci-investigator.md +3 -0
- package/presets/zcode/next/agents/debugger.md +3 -0
- package/presets/zcode/next/agents/feature-developer.md +3 -0
- package/presets/zcode/next/agents/mockup-reviewer.md +2 -0
- package/presets/zcode/next/agents/performance-auditor.md +2 -0
- package/presets/zcode/next/agents/playwright-test-generator.md +3 -0
- package/presets/zcode/next/agents/playwright-test-healer.md +3 -0
- package/presets/zcode/next/agents/playwright-test-planner.md +3 -0
- package/presets/zcode/next/agents/qa-tester.md +3 -0
- package/presets/zcode/next/agents/task-analyst.md +1 -1
- package/presets/zcode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/zcode/next/commands/README.md +7 -1
- package/presets/zcode/next/commands/task.md +1 -1
- package/presets/zcode/next/commands/ui-start.md +81 -0
- package/presets/zcode/next/commands/ui-stop.md +74 -0
- package/presets/zcode/next/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/next/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/zcode/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/next/rules/next-app-core.md +1 -0
- package/presets/zcode/next/team/README.md +7 -3
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/agents/task-analyst.md +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/_shared/ai-local/scripts/upstream-research.mjs +0 -2964
- package/presets/claude/next/commands/upstream-research.md +0 -23
- package/presets/claude/next/team/upstream/config.json +0 -31
- package/presets/claude/next/team/upstream/digest-template.md +0 -55
- package/presets/claude/next/team/upstream/jobs.json +0 -34
- package/presets/claude/next/team/upstream/opencode.json +0 -34
- package/presets/claude/next/team/upstream/projects.json +0 -4
- package/presets/claude/next/team/upstream/prompt.md +0 -77
- package/presets/claude/next/team/upstream/signatures.json +0 -9
- package/presets/cursor/next/commands/upstream-research.md +0 -23
- package/presets/cursor/next/team/upstream/config.json +0 -31
- package/presets/cursor/next/team/upstream/digest-template.md +0 -55
- package/presets/cursor/next/team/upstream/jobs.json +0 -34
- package/presets/cursor/next/team/upstream/opencode.json +0 -34
- package/presets/cursor/next/team/upstream/projects.json +0 -4
- package/presets/cursor/next/team/upstream/prompt.md +0 -77
- package/presets/cursor/next/team/upstream/signatures.json +0 -9
- package/presets/mavis/next/commands/upstream-research.md +0 -18
- package/presets/mavis/next/team/upstream/config.json +0 -31
- package/presets/mavis/next/team/upstream/digest-template.md +0 -55
- package/presets/mavis/next/team/upstream/jobs.json +0 -34
- package/presets/mavis/next/team/upstream/opencode.json +0 -34
- package/presets/mavis/next/team/upstream/projects.json +0 -4
- package/presets/mavis/next/team/upstream/prompt.md +0 -77
- package/presets/mavis/next/team/upstream/signatures.json +0 -9
- package/presets/opencode/next/commands/upstream-research.md +0 -26
- package/presets/opencode/next/team/upstream/config.json +0 -31
- package/presets/opencode/next/team/upstream/digest-template.md +0 -55
- package/presets/opencode/next/team/upstream/jobs.json +0 -34
- package/presets/opencode/next/team/upstream/opencode.json +0 -34
- package/presets/opencode/next/team/upstream/projects.json +0 -4
- package/presets/opencode/next/team/upstream/prompt.md +0 -77
- package/presets/opencode/next/team/upstream/signatures.json +0 -9
- package/presets/zcode/next/commands/upstream-research.md +0 -26
- package/presets/zcode/next/team/upstream/config.json +0 -31
- package/presets/zcode/next/team/upstream/digest-template.md +0 -55
- package/presets/zcode/next/team/upstream/jobs.json +0 -34
- package/presets/zcode/next/team/upstream/opencode.json +0 -34
- package/presets/zcode/next/team/upstream/projects.json +0 -4
- package/presets/zcode/next/team/upstream/prompt.md +0 -77
- package/presets/zcode/next/team/upstream/signatures.json +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,83 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.2.66
|
|
4
|
+
|
|
5
|
+
### Repository-only upstream research payload
|
|
6
|
+
|
|
7
|
+
- **The npm package no longer carries the `upstream-research` workflow.** `package.json` excludes the runner, the `/upstream-research` command, and every `presets/<tool>/next/team/upstream/**` template from the published tarball. `REPO_ONLY_ENGINE_SCRIPTS` names the runner: `init`, `update`, and `doctor` skip it silently when the installed preset has no source, while the repository checkout keeps seeding and mirroring it.
|
|
8
|
+
- **Packaging proof.** `test-pack-repo-only.mjs` packs the tarball, installs it into a scratch consumer, and asserts no job, runner, command, or `team/upstream/` file appears, the 22 published engine modules seed, and `doctor` reports no missing-engine finding.
|
|
9
|
+
|
|
10
|
+
### Upstream research plans into the tracker backlog
|
|
11
|
+
|
|
12
|
+
- **A second read-only call turns proposals into an ordered plan.** After ranking, the runner composes `plan-prompt.md` from the digest proposals and the target-repository sketch, calls the shipped `upstream-planner` agent once (one retry on a validation failure), and validates coverage, keys, `dependsOn` edges, and the acyclicity before any write.
|
|
13
|
+
- **Plan steps become `backlog` tracker items, blockers first.** Each item carries its mechanism, evidence, signature, and run; dependencies reference the generated ids. The idempotency map `upstream/tracker.json` reuses an id on a retry and never re-creates an idea imported by an earlier run.
|
|
14
|
+
- **A failed plan or tracker write is a digest gap.** Research evidence and the cursor stay the record; `report.plan` and the digest `Plan:` header name the state. `tracker.enabled` (default `true`) and `tracker.maxItems` (default 12) are data in `upstream/config.json`.
|
|
15
|
+
- **Seeding.** `init`/`update` refresh `upstream/plan-prompt.md` beside the prompt and agent config; the sealed `upstream-planner` permission map denies every tool like the researcher, and both are asserted before a project runs.
|
|
16
|
+
|
|
17
|
+
### Task-status sidebar: session source, pause scope, and thin-status rows
|
|
18
|
+
|
|
19
|
+
- **The sidebar reads the session from the `sidebar.content` slot input.** The router is only a fallback, so a session tab keeps its own task while a background subagent runs in another tab; a subagent tab still maps through `data.session.root`.
|
|
20
|
+
- **Stop and resume are task-scoped.** `■ stop` writes `tasks/<slug>/STOP` (repo-wide `.ai.local/STOP` only as a fallback), a paused task shows `▶ resume`, and the resume intent clears a sentinel only when the session maps to that task — a bare `дальше` in an unrelated session no longer releases a repo-wide pause. The view recognises the task-scoped sentinel the tracker writes.
|
|
21
|
+
- **A bootstrap or stale `status.json` keeps its rows.** `role`/`agent` fall back to `currentAgent` and then to the planned step, an `in_progress` task without an attempt reads `2/3 · no attempt started`, and the `eta` row survives a `stale` marker. `stale` now uses the agent's p90 as a floor, so a genuinely long step is not called stale after six hours.
|
|
22
|
+
- **State semantics match the hook.** `blocked` hides stop and ETA, `awaiting_artifact_receipt` hides ETA, a human gate hides stop and ETA, and an unknown agent reads `—` instead of a fabricated `implementation` role.
|
|
23
|
+
- **Matching is deterministic and cheap.** An exact prompt match outranks a newer substring match, matching is memoized per index generation and message fingerprint, normalized texts live in the session cache, and `message.list` follows up to five cursor pages so a late `/task-continue` is seen.
|
|
24
|
+
- **Fewer redundant reads.** `findTeamRoot` is cached for 30s, the session cache keeps the last four tabs (no `no task` flash on tab switch), a failed fetch keeps the last view and marks it `offline` for a minute, and the error is logged under the debug flag.
|
|
25
|
+
- **The details dialog reads the manifest.** Artifacts come from `artifact-manifest.json` (producer + outcome + path, last eight) with the known file names as a fallback, and the header adds the last update age, the ETA with its ledger count, and the run id.
|
|
26
|
+
- **Shared modules.** `types.ts`, `prompt-text.ts`, and `format.ts` replace the duplicated status types and two divergent `prompt.md` parsers.
|
|
27
|
+
- **Diagnostics without UI noise.** `OPENCODE_TASK_STATUS_DEBUG=1` appends the slot/route session IDs, message count, matched slug, rendered summary, fetch errors, and cleared pauses to `<tmpdir>/ai-rules-task-status-debug.log`.
|
|
28
|
+
- **Fixtures.** `test-task-status-view.mjs` grows to 14 cases (matched, no match, bootstrap, stale, repo stop, task stop, completed, gate, blocked, receipt, exact-vs-newer, unknown agent, note, details) and runs from `check-preset-structure.sh` and as `test:task-status-view`; it needs Node's built-in type stripping and skips on older runtimes.
|
|
29
|
+
- **Explicit import extensions.** The plugin's relative imports carry `.ts` / `.tsx`, so a local plugin directory resolves them (the loader skips extensionless `.tsx` imports silently).
|
|
30
|
+
- **Orchestrator contract.** The shared rule and `/task` now say a returned session handle has only **started** the specialist: the step stays open until the agent reports back and the hook records the receipt.
|
|
31
|
+
|
|
32
|
+
### Context output externalization
|
|
33
|
+
|
|
34
|
+
- **`dump-output.mjs` keeps a large command output out of the context window.** New shipped engine module: reads stdin or `--input`, writes `.ai.local/team/tasks/<slug>/outputs/<id>.txt` under a hard 2 097 152 B cap applied while streaming (a 0-byte file and a notice for empty input, a `-2`/`-3` suffix instead of an overwrite, a symlinked task or `outputs/` directory refused), then prints at most 40 head lines (≤8 KiB, ≤400 B per line), the byte count, the path, and one `grep -n` hint.
|
|
35
|
+
- **`team-db.mjs search <query>` reads the existing FTS5 projection.** Default 5 hits, `--limit` clamped to 1…20, snippets collapsed to single spaces and cut at 800 B on a UTF-8 boundary, `--json` one array with `snippetBytes`/`snippetTruncated`, and no hit is `team-db: no matches` with exit 0. Read-only: no schema, migration, route or `searchProjection` change. One requestable line in `context-and-iteration.md` names the dump → head → `grep`/`search` flow.
|
|
36
|
+
|
|
37
|
+
## 0.2.65
|
|
38
|
+
|
|
39
|
+
### Agent process manager
|
|
40
|
+
|
|
41
|
+
- **`processes.mjs` gives a checkout one view and one lease protocol.** New engine modules `processes.mjs` and `process-lease.mjs` (both in `ENGINE_SCRIPTS`, mirrored to `.ai.local/scripts/`) own `.ai.local/.processes/`: `leases/<name>.json` created with `open(…, 'wx')`, a single-line `events.jsonl`, and a `.reclaim/` guard per lease. `acquire` / `release` / `run` / `list` / `status` / `watch` / `scan` / `doctor` / `stop` / `serve`; exit codes are `0` ok, `1` held/timeout, `2` usage, `3` fatal, `4` refused.
|
|
42
|
+
- **Liveness defeats pid reuse; release is token-owned.** A holder is live only while its pid is alive **and** the recorded `pidStart` (`ps -o lstart=`, `/proc/<pid>/stat` without `ps`) still matches; a heartbeat never makes a live holder stale, and a different start time is reclaimed on the first attempt inside `.reclaim/<name>`. `release` refuses a foreign token, and `run` releases in `finally` and exits with the child's status (`128 + signo`).
|
|
43
|
+
- **One snapshot over the markers that already exist.** `list` / `watch` / `serve` read own leases plus `preset-tree` (`.preset-tree-lock/owner.json`), `dev:<name>` (`.ai.local/.dev/*.json`), `team-db-serve` (`.ai.local/.ui/api.json`), `scheduler`, `runner:<slug>` (active runs only), and `git-index`; a missing source is skipped and a malformed one is a `warnings[]` entry. `watch` refreshes every second (`--once`, `--json`, `--no-color`), and `serve` answers `GET /api/v1/processes`, an SSE `/api/v1/processes/stream` (initial snapshot, then one event per change), and a minimal HTML table on `127.0.0.1:4179`.
|
|
44
|
+
- **`scan` shows what bypasses the leases, `doctor` reports what is broken.** `scan` reads listening TCP ports (`lsof`, `ss` fallback) and the known command shapes (`fix-generated.mjs`, `check-preset-*.sh`, `team-db.mjs serve`, `storybook`, `next dev`, Playwright browsers), labels a lease-covered pid `leased` and everything else `foreign`; `doctor` exits non-zero on a stale lease, a dead marker, or a lease port with no listener. `stop` re-proves ownership (live pid + matching `pidStart` + command line or lease port) and never signals an unproven pid.
|
|
45
|
+
- **One lifecycle CLI.** `processes.mjs start` spawns a detached child, records a `port` lease, and reuses a live lease or a foreign listener; `list` / `status` / `stop` are the same CLI. `stop --task <slug>` filters leases by task, and the chain postflight calls it directly.
|
|
46
|
+
- **Wiring and fixtures.** `check:processes` runs `test-process-lease.mjs`, `test-process-adapters.mjs`, and `test-process-scan.mjs`; the composite gains the `process lease fixtures` and `process view fixtures` rows; `docs/PRESET-CONTRIBUTION.md` gains an "Agent process manager" section and the `dev-process-lifecycle` rule tells agents to start and inspect work through the manager.
|
|
47
|
+
|
|
48
|
+
### Preset-tree lock and the loop
|
|
49
|
+
|
|
50
|
+
- **The preset-tree lock fails closed and can wait.** A fatal lock reason (`unwritable` / `reclaim-failed`) now stops `fix:generated` and both shell gates with exit 1 before any work instead of "continuing unlocked"; `--allow-unlocked` / `AI_RULES_ALLOW_UNLOCKED=1` is the loud opt-in. `--wait <ms>` / `AI_RULES_LOCK_WAIT_MS` polls every 500 ms (default fail-fast) in `fix:generated` and `run-locked.mjs` only — the shell gates stay fail-fast — and a dead named owner is still reclaimed on the first attempt. Every acquire result carries `fatal` and `code`; read `fatal` before `skipped`.
|
|
51
|
+
- **Read-side gates take the lock.** New `run-locked.mjs` acquires, runs the child with inherited stdio, releases in `finally`, and exits with the child's status (`128 + signo` on a signal death). Eleven package gates (generated drift, twin map, twin drift, token budget, leakage, frontmatter, consumer links, shared-core drift, reachability, i18n, CLI init clean) run through it; the composites and `preset:loop` are never wrapped.
|
|
52
|
+
- **`yarn preset:loop`** runs `fix:generated && check:changed && check:fast` in series and holds no lock across phases.
|
|
53
|
+
- **The delta classifier names four preset domains.** `check-preset-delta.mjs` splits the old `preset-core` into `preset-content`, `preset-generator`, `preset-install` and `preset-tooling`: a generator change demands `fix-generated` + drift + twin drift + init-clean, an install change demands init-clean + drift, a tooling change demands only the classifier `--self-test`, and `.ai.local/**` no longer counts as `docs`. `release:gate` is reserved for `preset-content`, `preset-generator` and release changes.
|
|
54
|
+
- **The engine mirror replaces atomically.** `mirrorEngineScripts` writes a same-directory temp file and renames it over `.ai.local/scripts/<name>`, so a live engine process never reads a torn `run.mjs` / `lock.mjs`.
|
|
55
|
+
|
|
56
|
+
### Dev process lifecycle
|
|
57
|
+
|
|
58
|
+
- **`processes.mjs start` owns long-lived local servers.** It reuses a live lease or a foreign listener and spawns only on a free port, detached in its own process group; the lease `.ai.local/.processes/leases/<name>.json` records pid + start time, port, command, cwd, and task. `stop` proves ownership, clears stale leases, and offers `--task` cleanup.
|
|
59
|
+
- **The `dev-process-lifecycle` rule (next).** Reuse before start, own what you start, stop when done, never mass-kill unowned processes; the browser section covers the single-instance Playwright MCP profile, `--isolated` for one-off work, and the shared-Chrome CDP recipe launched through `processes.mjs start` so task-end cleanup closes only that instance. Wired into the implementer and e2e zone rules, the Storybook Figma-compare seed, `playwright-agents`, the five `MCP.md` files, and the root `AGENTS.md` entry. The description names the trigger so the main session can pull the rule on demand.
|
|
60
|
+
- **The chain postflight stops the task's servers.** When `status.json` reaches `completed` or `blocked`, the postflight runs `processes.mjs stop --task <slug>` in a bounded 8 s child; ownership refusal is a warning, never a hook failure. Manual sessions keep the rule.
|
|
61
|
+
- **The shell guard probes the port and always asks on mass-kill.** A per-stack `guard-ports.json` names the dev-server command shape and the ports to probe; an explicit `--port` probes that port only, and `pkill` / `killall` / `xargs kill` always ask. OpenCode enforces the same mass-kill family through `permission.bash` (`ask`); Mavis and ZCode have no shell hook, so the rule remains their only control.
|
|
62
|
+
- **Fixtures.** `test-dev-processes.mjs` (9 cases) and `test-guard-shell-command.mjs` (8 cases) run from `check-preset-structure.sh`; the engine mirror and CLI goldens are regenerated.
|
|
63
|
+
|
|
64
|
+
### Dashboard lifecycle
|
|
65
|
+
|
|
66
|
+
- **`team-db.mjs ui start|stop|status|restart`.** The shipped no-build dashboard gets a lifecycle. `start` is probe-first and idempotent: a healthy server for this repository is a no-op with the same pid, and only a free port spawns a detached `serve` and writes `.ai.local/.ui/api.json` atomically with a hashed `rootId`. `stop` re-proves ownership from the live command line (pid **and** a `team-db.mjs serve` match), signals that leader pid only, escalates to `SIGKILL` after the 5 s `SIGTERM` window, and keeps the marker with exit 1 if the process survives. Exit codes are `0` ok/no-op, `1` refusal, `2` start failure, `3` usage; `--allow-remote` is refused, and the scheduler timer stays a separate foreground process. No Docker, no build step, no new runtime dependency.
|
|
67
|
+
- **Two `next` commands.** `/ui-start` and `/ui-stop` ship on the `next` stack — one authored pair, ten generated twins — while every other stack runs the verb directly, with `team-db.mjs serve` as the fallback for a fork that predates it. `ai-rules update --fix` is the upgrade step; a plain `update` leaves a stale engine module that answers `ui` with exit 3.
|
|
68
|
+
- **The dashboard closes task delete and a read-only tracker view.** The delete sits behind a confirmation, announces the `200` in the page-level live region with focus back on the list heading, and surfaces `409 E_ACTIVE_TASK` with its `activeSlug` in the detail live region; a third nav tab lists tracker items with the item panel and the queue, and carries no create, update, enqueue or cancel control. The task surface keeps a named two-call mutating allowlist (`POST /api/v1/sync`, `DELETE /api/v1/tasks/{slug}`) beside the four enumerated jobs writes, and the shipped seeder git-ignores `.ui/`.
|
|
69
|
+
- **`/health.rootId`.** One additive, optional field — `sha256(resolved team root).slice(0, 12)` — turns the cross-root case into `E_UI_OTHER_ROOT`. The contract document is regenerated by the checker; no route, operation, or error code changes.
|
|
70
|
+
|
|
71
|
+
### Tracker
|
|
72
|
+
|
|
73
|
+
- **The tracker replaces the backlog module and renames its paths.** `.ai.local/team/tracker/` (`items/`, `queue/`, `links/`), `/api/v1/tracker*`, the `tracker` CLI verb family, the `tracker_items`/`tracker_queue`/`tracker_item_tasks` projection tables and the `/tracker` operator pages replace every `backlog` name. **Backlog is now one stored status** (`backlog`), the captured state that is not launchable until promoted to `planned`.
|
|
74
|
+
- **The file-authoritative plan store.** `tracker/items/<id>.json` and `tracker/links/` are committed; `tracker/queue/` and `team/task-runs/` are runtime state. `team-db.mjs tracker` ships the verb family `add`, `set`, `show`, `list`, `ready`, `validate`, `import` (the versioned envelope, idempotent by id, `--dry-run`), `enqueue`, `cancel`, `drain --claim`, `recover`, `prune`, `link`, `delete`, `adopt` and `migrate-ids`. Every operational status (`effectiveStatus`, `ready`, `waitingOn`) is derived from the items, links, queue entries and the hook-owned task state, never written; the deterministic total order is `priority` ascending (lower runs first, default 5) → `createdAt` → `id`.
|
|
75
|
+
- **The launch queue.** `tracker/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. `tracker 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_TRACKER_DRAIN_DISABLE=1` stops only the auto-drain. A claim older than 90 s with no task row is released on the next drain or by `tracker recover`.
|
|
76
|
+
- **Tracker CRUD.** The item id is an opaque tracker key, the UI gains `/tracker/new`, `/tracker/[id]/edit`, a hard delete with active-link/live-queue protection, and the full item form; the API gains `DELETE /api/v1/tracker/{id}`. The item id no longer becomes the team-task slug.
|
|
77
|
+
- **Item ↔ task links.** `tracker/links/<itemId>--<taskSlug>.json` plus its prompt is the file-authoritative relation; one item may be closed by several tasks. A new `tracker_item_tasks` table, a link walker, `tracker link add|set|remove|list|adopt`, and the item detail `tasks[]` expose the relation. Legacy `tasks/<itemId>/` folders remain readable as implicit links.
|
|
78
|
+
- **Start/stop/continue.** The item detail starts a new task as one link + queue request (the queue entry carries its own `taskSlug`/`linkId`); the hook bootstrap copies the link prompt into `tasks/<taskSlug>/` and records the tracker provenance. Stop cancels a request and writes a per-task `STOP` sentinel; Continue starts the seeded `team/runner.json` supervisor (`task-run` verbs) with no shell, a confined cwd, an env allow-list, a timeout and a process-group kill.
|
|
79
|
+
- **`ui start` is probe-first.** A server that already answers `/health` for this repository is the no-op: same pid, untouched `startedAt`, nothing spawned. Only a free port leads to a detached `serve` and the marker; the path writes the marker plus at most one bounded `sync` (the missing-projection repair), never `migrate-tasks` and never `team/runner.json`. `ui restart` is the explicit stop-then-start verb.
|
|
80
|
+
- **Contract and projection.** The OpenAPI document moves to 43 operations and 14 mutations, migration `0004-tracker` renames the backlog tables and carries `tracker_item_tasks`, and the app operations table/DTO/mappers/service/store/forms follow the tracker schemas.
|
|
4
81
|
|
|
5
82
|
### Upstream research
|
|
6
83
|
|
|
@@ -32,19 +109,11 @@
|
|
|
32
109
|
|
|
33
110
|
- **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
111
|
- **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
|
-
- **
|
|
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`.
|
|
112
|
+
- **Tracker actions validate in place.** The dialog renders a field error through the DS control (`errorMessage`/`note`) and takes `ITEM_ID_PATTERN` from the API layer, so the client and the service share one item-id grammar.
|
|
44
113
|
|
|
45
114
|
### Gates
|
|
46
115
|
|
|
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.
|
|
116
|
+
- **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. The tracker family (`test-team-db-tracker.mjs`, `-tracker-order`, `-tracker-project`, `-tracker-queue`, `-tracker-import`, `-task-runner`) and `test-team-db-ui.mjs` join `yarn test:team-db`, and `test-team-db-schema.mjs` covers migration `0004-tracker`. Platform smoke runs `doctor` on the five-platform multi install instead of a separate Cursor project.
|
|
48
117
|
|
|
49
118
|
## 0.2.64
|
|
50
119
|
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Run `init` from the **app root** (`--cwd` if needed). Default `--preset` is `nex
|
|
|
25
25
|
| Root agents | `REPO_AGENTS.md` → `AGENTS.md` (same file on all five; ZCode loads it natively) | | | | |
|
|
26
26
|
| `/task` artifacts | **`.ai.local/team/`** (shared; templates refreshed; `tasks/<slug>/` never overwritten) | | | |
|
|
27
27
|
| Template drift | **`.ai.local/.template-base.json`** (shared; one record per tree of files that hold a shipped template byte; `update` prints one drift line, `update --merge-ai-local` fast-forwards a file only when its recorded base still matches and reports the rest) | | | |
|
|
28
|
-
| Self-learning engine | **`.ai.local/scripts/`** (shared;
|
|
28
|
+
| Self-learning engine | **`.ai.local/scripts/`** (shared; twenty-two scripts — the six self-learning engine modules, `manifest.mjs`, the `dump-output.mjs` output externalizer, the ten `team-db*.mjs` projection, scheduler and lifecycle modules, the read-only `check-write-scope.mjs` write audit, the `aggregate-agent-task-metrics.mjs` aggregator, and the `processes.mjs` + `process-lease.mjs` process manager; existing files never overwritten. The repository-only `upstream-research.mjs` is not published) | | | |
|
|
29
29
|
| Specs seed | `docs/specs/` copied only if the directory is **absent** | | | |
|
|
30
30
|
|
|
31
31
|
OpenCode also ships **`.opencode/plugins/task-status/`**, a TUI sidebar for the active `/task` run (slug, state, elapsed time, step, remaining-time estimate, soft-stop). OpenCode auto-loads it; it needs no `opencode.json` entry, is refreshed by `update`, and is a viewer only — the chain hook stays manual.
|
|
@@ -138,9 +138,9 @@ node .ai.local/scripts/team-db.mjs check # schema, fingerprint, i
|
|
|
138
138
|
node .ai.local/scripts/team-db.mjs serve # http://127.0.0.1:4178 + dashboard
|
|
139
139
|
node .ai.local/scripts/team-db.mjs schedule # the timer: claims, runs, captures, reconciles
|
|
140
140
|
node .ai.local/scripts/team-db.mjs jobs list # definitions + next fire, file-authoritative
|
|
141
|
-
node .ai.local/scripts/team-db.mjs
|
|
142
|
-
node .ai.local/scripts/team-db.mjs
|
|
143
|
-
node .ai.local/scripts/team-db.mjs
|
|
141
|
+
node .ai.local/scripts/team-db.mjs tracker list # the ordered tracker: items, ready set, waiting-on
|
|
142
|
+
node .ai.local/scripts/team-db.mjs tracker enqueue --file <path|-> # record one launch request
|
|
143
|
+
node .ai.local/scripts/team-db.mjs tracker drain --claim # grant one claim, never start a run
|
|
144
144
|
AI_RULES_TEAM_DB_DISABLE=1 node .ai.local/scripts/team-db.mjs sync # no-op: file-only mode
|
|
145
145
|
```
|
|
146
146
|
|
|
@@ -148,8 +148,8 @@ Requires Node 22.13.0+ for `node:sqlite`; older runtimes stay file-only with one
|
|
|
148
148
|
`migrate-tasks` is the one-command path: it creates the database when it is absent and writes
|
|
149
149
|
only the delta against an existing one, so a fresh workspace and a populated database converge
|
|
150
150
|
in one invocation.
|
|
151
|
-
`team-db.mjs serve` binds loopback only, is read-only apart from the
|
|
152
|
-
(`POST /api/v1/sync`, the task delete, the four job writes and the
|
|
151
|
+
`team-db.mjs serve` binds loopback only, is read-only apart from the fourteen documented mutations
|
|
152
|
+
(`POST /api/v1/sync`, the task delete, the four job writes and the eight tracker writes), and serves the OpenAPI 3.1
|
|
153
153
|
document at `/openapi.json`. Details, environment names, retention, and rollback:
|
|
154
154
|
[`docs/TEAM-DB.md`](docs/TEAM-DB.md).
|
|
155
155
|
|
|
@@ -168,16 +168,24 @@ pre-v2 database is rebuilt from the files on the next `sync`.
|
|
|
168
168
|
|
|
169
169
|
### Upstream research
|
|
170
170
|
|
|
171
|
-
The `
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
171
|
+
**Repository-only.** The `upstream-research` job, the `/upstream-research` command, the runner
|
|
172
|
+
(`.ai.local/scripts/upstream-research.mjs`), and the `team/upstream/` templates are not part of
|
|
173
|
+
the published npm package; they are used only in the `@bonesofspring/ai-rules` repository
|
|
174
|
+
itself. A consumer install seeds no job and no runner.
|
|
175
|
+
|
|
176
|
+
In this repository the `next` preset carries a weekly `upstream-research` job and a read-only
|
|
177
|
+
`opencode` agent for it. `init`/`update` seed the job definition into
|
|
178
|
+
`.ai.local/team/scheduler/jobs.json` when the file is absent; an operator-edited definition is
|
|
179
|
+
never overwritten. The runner probes `opencode`, loads `upstream/projects.json` and
|
|
180
|
+
`upstream/config.json`, fetches each due clone with `git fetch --depth 1`, labels the window
|
|
181
|
+
(`range`, `baseline`, `unprovable`, `no-change`), validates the agent's marked JSON, re-checks
|
|
182
|
+
every citation inside the clone, dedupes by mechanism against the committed
|
|
183
|
+
`upstream/signatures.json`, and writes one ranked digest to `docs/upstream/digest-<runId>.md`.
|
|
184
|
+
A second read-only planner call decomposes the ranked proposals into ordered steps, and the
|
|
185
|
+
runner imports them into `team/tracker` as `backlog` items with `dependsOn` edges (blockers
|
|
186
|
+
first) and an idempotency map in `upstream/tracker.json`. The cursor is git-ignored; the caps
|
|
187
|
+
are data. `/upstream-research` queues a run and adds one `schedule --once` tick when no timer
|
|
188
|
+
is online. Details:
|
|
181
189
|
[`docs/TEAM-DB.md`](docs/TEAM-DB.md#upstream-research-job) and
|
|
182
190
|
[`docs/OPENCODE.md`](docs/OPENCODE.md#upstream-research-agent).
|
|
183
191
|
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
4
|
+
* The engine `.ai.local/scripts/` set, declared once.
|
|
5
5
|
*
|
|
6
|
-
* `init` seeds
|
|
7
|
-
*
|
|
8
|
-
* `scripts/lib/engine-mirror.mjs`. An explicit
|
|
9
|
-
* repo-local tooling (the `*.test.mjs` suites
|
|
10
|
-
* the shipped set.
|
|
6
|
+
* `init` seeds these files into a consumer's `.ai.local/scripts/` when their
|
|
7
|
+
* source exists in the installed preset, and the monorepo dogfood copy is
|
|
8
|
+
* mirrored from the same source by `scripts/lib/engine-mirror.mjs`. An explicit
|
|
9
|
+
* list — never a glob — keeps the repo-local tooling (the `*.test.mjs` suites
|
|
10
|
+
* and `requirements-*.mjs`) out of the shipped set.
|
|
11
11
|
*
|
|
12
12
|
* `manifest.mjs` is the deterministic writer for
|
|
13
13
|
* `.ai.local/team/tasks/<slug>/artifact-manifest.json`; producers call it
|
|
14
14
|
* instead of patching the JSON, which is a whole-file merge target.
|
|
15
15
|
*
|
|
16
|
-
* The
|
|
17
|
-
* read-only dashboard,
|
|
18
|
-
* are loaded by it on demand, so a runtime
|
|
19
|
-
* them.
|
|
16
|
+
* The `team-db*.mjs` modules are the rebuildable SQLite projection, its
|
|
17
|
+
* read-only dashboard, the scheduler, and the `ui` lifecycle supervisor.
|
|
18
|
+
* `team-db.mjs` is the CLI; the others are loaded by it on demand, so a runtime
|
|
19
|
+
* without `node:sqlite` never imports them.
|
|
20
|
+
*
|
|
21
|
+
* `REPO_ONLY_ENGINE_SCRIPTS` stay in the preset source and the monorepo dogfood
|
|
22
|
+
* mirror, but the published tarball excludes their sources. A consumer install
|
|
23
|
+
* sees no source for them, so `init`, `update`, and `doctor` skip them without
|
|
24
|
+
* warning; a source that exists (this repository) is seeded and upgraded as
|
|
25
|
+
* usual.
|
|
20
26
|
*/
|
|
27
|
+
const REPO_ONLY_ENGINE_SCRIPTS = [
|
|
28
|
+
// The weekly upstream evolution review is a personal workflow: the job,
|
|
29
|
+
// prompt, agent config, and runner live only in this repository.
|
|
30
|
+
'upstream-research.mjs',
|
|
31
|
+
];
|
|
32
|
+
|
|
21
33
|
const ENGINE_SCRIPTS = [
|
|
22
34
|
'run.mjs',
|
|
23
35
|
'signals.mjs',
|
|
@@ -26,8 +38,14 @@ const ENGINE_SCRIPTS = [
|
|
|
26
38
|
'derive-gate-signals.mjs',
|
|
27
39
|
'efficacy-oracle.mjs',
|
|
28
40
|
'manifest.mjs',
|
|
41
|
+
// Command-output externalizer: stdin (or `--input`) becomes a capped
|
|
42
|
+
// `.ai.local/team/tasks/<slug>/outputs/` file plus a head, so a large dump
|
|
43
|
+
// never enters the context window. Reads no network and spawns nothing.
|
|
44
|
+
'dump-output.mjs',
|
|
29
45
|
'team-db.mjs',
|
|
30
|
-
'team-db-
|
|
46
|
+
'team-db-ui.mjs',
|
|
47
|
+
'team-db-tracker.mjs',
|
|
48
|
+
'team-db-task-runner.mjs',
|
|
31
49
|
'team-db-schema.mjs',
|
|
32
50
|
'team-db-project.mjs',
|
|
33
51
|
'team-db-api.mjs',
|
|
@@ -40,6 +58,13 @@ const ENGINE_SCRIPTS = [
|
|
|
40
58
|
// Read-only post-step write-scope audit used by build-verifier and code-reviewer.
|
|
41
59
|
// Shells out to git, so it is not part of the self-learning loop module set.
|
|
42
60
|
'check-write-scope.mjs',
|
|
61
|
+
// Process leases and the one view over them (`start|acquire|run|list|watch|
|
|
62
|
+
// scan|doctor|stop|serve`). `processes.mjs` owns a detached dev-server start
|
|
63
|
+
// and reuses `process-lease.mjs` for the protocol; both spawn `ps`/`lsof` and
|
|
64
|
+
// `processes.mjs` listens on loopback, so they are process tooling, not part
|
|
65
|
+
// of the self-learning loop modules.
|
|
66
|
+
'process-lease.mjs',
|
|
67
|
+
'processes.mjs',
|
|
43
68
|
// Role/task metrics aggregation used by technical-retro; ships with the engine
|
|
44
69
|
// so a consumer can run it from `.ai.local/scripts/` without the package.
|
|
45
70
|
'aggregate-agent-task-metrics.mjs',
|
|
@@ -48,6 +73,9 @@ const ENGINE_SCRIPTS = [
|
|
|
48
73
|
/** Package `presets/`-relative directory holding the engine source of truth. */
|
|
49
74
|
const ENGINE_SOURCE_RELATIVE = '_shared/ai-local/scripts';
|
|
50
75
|
|
|
76
|
+
/** The `ENGINE_SCRIPTS` subset whose sources ship in the published tarball. */
|
|
77
|
+
const SHIPPED_ENGINE_SCRIPTS = ENGINE_SCRIPTS.filter((name) => !isRepoOnlyEngineScript(name));
|
|
78
|
+
|
|
51
79
|
/**
|
|
52
80
|
* Absolute shipped engine directory for a package.
|
|
53
81
|
*
|
|
@@ -58,4 +86,16 @@ function engineSourceDir(presetsRoot) {
|
|
|
58
86
|
return path.join(presetsRoot, ...ENGINE_SOURCE_RELATIVE.split('/'));
|
|
59
87
|
}
|
|
60
88
|
|
|
61
|
-
module
|
|
89
|
+
/** True when the module is source-only in this repository and never published. */
|
|
90
|
+
function isRepoOnlyEngineScript(name) {
|
|
91
|
+
return REPO_ONLY_ENGINE_SCRIPTS.includes(name);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
module.exports = {
|
|
95
|
+
ENGINE_SCRIPTS,
|
|
96
|
+
SHIPPED_ENGINE_SCRIPTS,
|
|
97
|
+
REPO_ONLY_ENGINE_SCRIPTS,
|
|
98
|
+
ENGINE_SOURCE_RELATIVE,
|
|
99
|
+
engineSourceDir,
|
|
100
|
+
isRepoOnlyEngineScript,
|
|
101
|
+
};
|
|
@@ -27,7 +27,7 @@ const {
|
|
|
27
27
|
serialiseRecord,
|
|
28
28
|
} = require('./ai-local-drift');
|
|
29
29
|
const { runStamp } = require('./fs-utils');
|
|
30
|
-
const { ENGINE_SCRIPTS, ENGINE_SOURCE_RELATIVE, engineSourceDir } = require('./engine-scripts');
|
|
30
|
+
const { ENGINE_SCRIPTS, ENGINE_SOURCE_RELATIVE, engineSourceDir, isRepoOnlyEngineScript } = require('./engine-scripts');
|
|
31
31
|
|
|
32
32
|
const ENGINE_ROOT_REL = '.ai.local/scripts';
|
|
33
33
|
const BACKUP_PREFIX = 'engine-';
|
|
@@ -54,7 +54,10 @@ function shippedEngineTemplates(packageRoot) {
|
|
|
54
54
|
const abs = path.join(sourceDir, name);
|
|
55
55
|
const stat = lstatOrNull(abs);
|
|
56
56
|
if (!stat || !stat.isFile()) {
|
|
57
|
-
|
|
57
|
+
// A repo-only module is intentionally absent from the published tarball.
|
|
58
|
+
if (!isRepoOnlyEngineScript(name)) {
|
|
59
|
+
warn(`engine source ${name} is missing from presets/${ENGINE_SOURCE_RELATIVE}; skipped`);
|
|
60
|
+
}
|
|
58
61
|
continue;
|
|
59
62
|
}
|
|
60
63
|
const content = fs.readFileSync(abs);
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
const fs = require('fs');
|
|
11
11
|
const path = require('path');
|
|
12
12
|
const { assertSafeDest } = require('./safe-path');
|
|
13
|
-
const { ENGINE_SCRIPTS, engineSourceDir } = require('./engine-scripts');
|
|
13
|
+
const { ENGINE_SCRIPTS, engineSourceDir, isRepoOnlyEngineScript } = require('./engine-scripts');
|
|
14
14
|
const { runTemplateDrift } = require('./ai-local-drift');
|
|
15
15
|
|
|
16
16
|
const LEGACY_TOOLS = ['cursor', 'claude', 'mavis', 'opencode', 'zcode'];
|
|
@@ -37,9 +37,16 @@ const AI_LOCAL_GITIGNORE = [
|
|
|
37
37
|
'# Scheduler runtime state; jobs.json stays tracked (jobs as code).',
|
|
38
38
|
'team/scheduler/runs/',
|
|
39
39
|
'team/scheduler/state.json',
|
|
40
|
+
'# Tracker launch queue and opt-in runner runtime state; items and links stay tracked.',
|
|
41
|
+
'team/tracker/queue/',
|
|
42
|
+
'team/task-runs/',
|
|
40
43
|
'# Per-step write-scope baselines; derived from git, never a project input.',
|
|
41
44
|
'team/.write-scope/',
|
|
42
45
|
'team/upstream/cursor.json',
|
|
46
|
+
'# Dashboard lifecycle marker (`.ai.local/.ui/api.json`); local runtime state, never commit.',
|
|
47
|
+
'.ui/',
|
|
48
|
+
'# Dev-server lifecycle markers (`.ai.local/.dev/<name>.json`); local runtime state, never commit.',
|
|
49
|
+
'.dev/',
|
|
43
50
|
'',
|
|
44
51
|
].join('\n');
|
|
45
52
|
const POINTER_README = `# Agent team artifacts moved
|
|
@@ -294,7 +301,10 @@ function seedEngineScripts({ cwd, presetTeamSrc }) {
|
|
|
294
301
|
const source = path.join(sourceDir, name);
|
|
295
302
|
const dest = path.join(destDir, name);
|
|
296
303
|
if (!fs.existsSync(source)) {
|
|
297
|
-
|
|
304
|
+
// A repo-only module is absent from the published tarball by design.
|
|
305
|
+
if (!isRepoOnlyEngineScript(name)) {
|
|
306
|
+
warn(`.ai.local/scripts: engine source ${name} is missing from the preset; skipped`);
|
|
307
|
+
}
|
|
298
308
|
continue;
|
|
299
309
|
}
|
|
300
310
|
if (fs.existsSync(dest)) {
|
|
@@ -341,7 +351,7 @@ function copyTemplates(presetTeamSrc, dest) {
|
|
|
341
351
|
// Preset-owned upstream templates refresh on every init/update: a consumer edit
|
|
342
352
|
// to the permission map or the prompt must not silently defeat the contract.
|
|
343
353
|
const upstreamSrc = path.join(presetTeamSrc, 'upstream');
|
|
344
|
-
for (const name of ['prompt.md', 'digest-template.md', 'opencode.json']) {
|
|
354
|
+
for (const name of ['prompt.md', 'plan-prompt.md', 'digest-template.md', 'opencode.json']) {
|
|
345
355
|
const source = path.join(upstreamSrc, name);
|
|
346
356
|
if (!fs.existsSync(source)) continue;
|
|
347
357
|
copyFile(source, path.join(dest, 'upstream', name));
|
package/docs/OPENCODE.md
CHANGED
|
@@ -128,24 +128,32 @@ Do not pin OpenCode CLI or TUI versions in the contract.
|
|
|
128
128
|
|
|
129
129
|
## Upstream research agent
|
|
130
130
|
|
|
131
|
-
The `
|
|
131
|
+
**Repository-only.** The `upstream-research` job and its `team/upstream/` payload are not part
|
|
132
|
+
of the published npm package; this section documents the workflow used in the
|
|
133
|
+
`@bonesofspring/ai-rules` repository itself. A consumer install does not include the agent
|
|
134
|
+
config, the command, or the runner.
|
|
135
|
+
|
|
136
|
+
The `next` preset carries a read-only agent for the `upstream-research` job at
|
|
132
137
|
`.ai.local/team/upstream/opencode.json` (source:
|
|
133
|
-
`presets/cursor/next/team/upstream/opencode.json`). It is refreshed on every `init`/`update
|
|
134
|
-
so
|
|
138
|
+
`presets/cursor/next/team/upstream/opencode.json`). It is refreshed on every `init`/`update`
|
|
139
|
+
in this repository, so the installed copy cannot be widened by editing it.
|
|
135
140
|
|
|
136
|
-
- `agent.upstream-researcher`
|
|
137
|
-
- `permission` starts with `"*": "deny"`, so
|
|
138
|
-
- Before phase 1 the runner resolves
|
|
141
|
+
- `agent.upstream-researcher` and `agent.upstream-planner` have `mode: "subagent"`.
|
|
142
|
+
- `permission` starts with `"*": "deny"`, so an agent has no tool at all: MCP servers installed by the same project (`chrome-devtools`, `playwright`, `context7`, `figma`) and custom tools resolve as `<server>_<tool>` and are denied by the same wildcard. The named rows stay as a second line of defence: `edit`/`bash`/`read`/`glob`/`grep`/`list` are `{"*": "deny"}`; `webfetch`, `websearch`, `task`, and `external_directory` are `deny`. The shell deny stops a write around the edit deny; the wildcard and the read/fetch/subagent denies keep untrusted upstream content from reaching a secret or a network destination. Neither agent needs a tool: the prompt arrives as an attached `--file` message and the runner verifies evidence itself.
|
|
143
|
+
- Before phase 1 the runner resolves both installed agents with `opencode debug agents` and refuses to start a project unless the global `*` and every named action still resolve to `deny` on resource `*` under last-match-wins (`E_AGENT_CONFIG_INVALID`, exit 12). The probe also asserts a synthetic non-built-in name, so a config that enumerates only the ten built-ins fails. A discovered config that appends an allow after the preset deny is caught here, not by a file grep.
|
|
139
144
|
- The job invokes `opencode run --agent upstream-researcher --format json --archived --auto`
|
|
140
145
|
with the child `cwd` set to the team `upstream/` directory; that nested config is the only
|
|
141
|
-
selector, because this build has no `--dir`.
|
|
146
|
+
selector, because this build has no `--dir`. After ranking, one
|
|
147
|
+
`--agent upstream-planner` call over the same `cwd` decomposes the proposals into ordered
|
|
148
|
+
backlog steps; it reads only the attached `plan-prompt.md`.
|
|
142
149
|
- `--worktree` is never passed: the research is read-only.
|
|
143
150
|
- `--auto` cannot widen an explicit `deny`; the runner also compares `git status --porcelain`
|
|
144
151
|
in the repository before and after each call (`E_WORKTREE_CHANGED`) and inside the reviewed
|
|
145
152
|
clone (`E_UPSTREAM_DIRTY`).
|
|
146
153
|
|
|
147
|
-
The
|
|
148
|
-
row; the job asserts
|
|
154
|
+
The agents are not first-class preset agents: they have no `agents/**` mirror and no
|
|
155
|
+
adapter-map row; the job asserts their resolved rules with `opencode debug agents` before the
|
|
156
|
+
first project.
|
|
149
157
|
## Local overlay
|
|
150
158
|
|
|
151
159
|
`.ai.local/rules/*.md` at repo root (or monorepo parents) override preset rules. See [`LOCAL-OVERLAY.md`](./LOCAL-OVERLAY.md).
|
|
@@ -429,6 +429,7 @@ Load these when editing files under `packages/ai-rules/presets/**`, `.cursor/**`
|
|
|
429
429
|
| `scripts/check-rule-eval.mjs` / `yarn check:rule-eval` | **Hard gate** inside `check-preset-structure.sh`: validates Incorrect/Correct pairs + `impact:` on **next-only** golden stems (`eval/next/manifest.json`). Backend / ios / php-hexagonal / php-laravel stems are out of scope until a stack adds `eval/<stack>/`. |
|
|
430
430
|
| `scripts/check-release-consistency.mjs` / `yarn check:release-consistency` | **FAIL** when `packages/ai-rules/package.json` version and the newest `## <version>` heading in `CHANGELOG.md` disagree — a tag must not ship the previous release's notes. Wired into `check-preset-structure.sh`; fixture `test-release-consistency.mjs`. |
|
|
431
431
|
| `scripts/check-team-db-contract.mjs` / `yarn check:team-db-contract` | **FAIL** when the checked-in OpenAPI 3.1 document (`docs/openapi/team-db.v1.json`) drifts from `team-db-openapi.mjs`, fails the vendored 3.1 meta-schema (sha256-pinned), loses an `operationId`, diverges from `ROUTE_TABLE` in either direction, carries an invalid example, or leaves a `$ref` unresolved. `--write` is the only writer; no network at gate time. Wired into `check-preset-structure.sh`. |
|
|
432
|
+
| `presets/_shared/hooks/guard-shell-command.mjs.tmpl` + `<stack>/guard-ports.json` | The shell guard asks before a server start whose port already listens: `startCommands` names the stack's dev-server command shape, `defaultPorts` the ports to probe when the command has no `--port`, and an explicit `--port` probes that port only. `pkill`, `killall`, and `xargs kill` always ask. Fixture `test-guard-shell-command.mjs`; rendered into every `hooks/guard-shell-command.mjs` by `generate-hooks.mjs`. |
|
|
432
433
|
| `presets/_shared/ai-local/scripts/team-db-scheduler.mjs` | The scheduled-jobs module, shipped to consumers as `.ai.local/scripts/team-db-scheduler.mjs` (`ENGINE_SCRIPTS`): the job validator, a dependency-free five-field cron parser and next-fire on `Intl` zone math (both DST transitions are fixtures), the deterministic atomic `scheduler/jobs.json` store, the run-manifest and capped-capture helpers (the recorded sha256 covers exactly the pre-marker bytes, so a capped stream is not reported `E_LOG_HASH`), the projection into `scheduled_jobs` / `job_runs` / `job_run_events`, retention (1 MiB per stream, 200 runs, 30 days, 2 GiB; a pruned run directory takes its row with it; an active run is never pruned), restart reconciliation to `interrupted`, and `runScheduler` — the lease, the `BEGIN IMMEDIATE` claim, a durable run-now queue the timer re-reads and merges at every tick, the detached child with a process-group kill, `catch-up` bounded to five occurrences per gap with the truncation recorded (`E_CATCH_UP_TRUNCATED`), and the kill-switch drain. Fixture `test-team-db-scheduler.mjs`; concurrency fixtures live in `test-team-db-concurrency.mjs`. |
|
|
433
434
|
| `scripts/test-team-db-*.mjs` | The team-db suite family: schema (17), project (18), migrate-tasks (5), dual-write (13), API (27), security (17), dashboard (10), concurrency (10), scheduler (34), and FAIL-direction fixtures (22). The fixtures prove each gate fails on its planted defect; `test-team-db-concurrency.mjs` covers first-creation races, a mixed writer/reader load, `SIGKILL` recovery, a held lock, the 5 s hook budget, and the scheduler's four seams (scheduler versus projector on one database, a `SIGKILL`ed scheduler reconciled to one `interrupted` row, 50 finalized runs inside the WAL bound, and a held exclusive lock that neither hangs nor leaves a lease). Wired into `check-preset-structure.sh`; `yarn test:team-db` runs the family. |
|
|
434
435
|
|
|
@@ -454,6 +455,46 @@ CI: [`.github/workflows/preset-structure.yml`](../../../.github/workflows/preset
|
|
|
454
455
|
|
|
455
456
|
---
|
|
456
457
|
|
|
458
|
+
## Preset-tree lock and the loop
|
|
459
|
+
|
|
460
|
+
`yarn fix:generated` deletes and rebuilds every platform stack, so the writer and every gate that reads `presets/**` take one exclusive lock (`scripts/lib/preset-tree-lock.mjs`; lock directory `.preset-tree-lock/` with `owner.json` pid + token). From `packages/ai-rules/`:
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
yarn preset:loop # fix:generated && check:changed && check:fast, in series
|
|
464
|
+
yarn fix:generated --wait 600000 # opt in to waiting for a live holder
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
- **Fail closed.** A fatal reason (`unwritable`, `reclaim-failed`) stops the generator and both shell gates with exit 1 before any work. `--allow-unlocked` (generator, `run-locked.mjs`) or `AI_RULES_ALLOW_UNLOCKED=1` (both gates) proceeds with a loud `warn:` line. Read `fatal` before `skipped` in a caller: `skipped` is only the explicit opt-in.
|
|
468
|
+
- **Fail fast by default.** A live holder returns exit 1 with the held owner; `--wait <ms>` (or `AI_RULES_LOCK_WAIT_MS`) polls every 500 ms, `0` is the default. `--wait` is read by `fix:generated` and `run-locked.mjs`; the shell gates read only `AI_RULES_ALLOW_UNLOCKED` and stay fail-fast. A dead named owner is reclaimed on the first attempt, never waited on.
|
|
469
|
+
- **One holder per process chain.** A process that already holds the lock must not run a command that acquires it again: the owner pid is alive, so the child never goes stale and either fails fast or burns the whole wait budget. `fix:generated`, `check:fast`, `check:preset-structure`, `preset:loop`, and `release:gate` are never wrapped; `check:changed` / `check:preset-delta` stay usable while diagnosing a stuck lock.
|
|
470
|
+
- **Locked readers.** `scripts/run-locked.mjs [--label <l>] [--wait <ms>] [--allow-unlocked] [--root <dir>] -- <command> [args…]` acquires, runs with inherited stdio, releases in `finally`, and exits with the child's status (`128 + signo` on signal death). The package scripts wrap `check:generated-drift`, `check:preset-twin-map`, `check:preset-twin-drift`, `check:preset-token-budget`, `check:preset-leakage`, `check:frontmatter`, `check:consumer-links`, `check:shared-core-drift`, `check:preset-reachability`, `check:preset-i18n`, and `test:cli-init-clean`.
|
|
471
|
+
- **Residual unlocked readers.** Other `check:*` scripts and `.husky/pre-commit` call scripts directly; the composites and CI reach them through the lock. Inspect a blocked run with `cat .preset-tree-lock/owner.json` — a dead pid is reclaimed by the next run.
|
|
472
|
+
- **Atomic engine mirror.** `scripts/lib/engine-mirror.mjs` writes a same-directory temp file and `fs.renameSync`s it into `.ai.local/scripts/`, so a live engine process never reads a torn `run.mjs`; the mirror stays outside this lock (it copies the same bytes from a different root).
|
|
473
|
+
- **Announcing work.** `processes.mjs run --name <res> -- <command>` holds a manager lease for the child's lifetime and `processes.mjs watch` lists every holder; that lease is separate from the lock above — see § Agent process manager.
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## Agent process manager
|
|
478
|
+
|
|
479
|
+
`processes.mjs` (with `process-lease.mjs`) is the one place that answers "who is doing what in this checkout". It owns `.ai.local/.processes/` (`leases/<name>.json`, a single-line `events.jsonl`, a `.reclaim/` guard per lease) and reads the markers other tools already write. `start` spawns a detached dev server and records a lease; `stop` / `status` / `list` prove ownership over the same record. From the repo root:
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
node .ai.local/scripts/processes.mjs run --name preset-tree -- node scripts/fix-generated.mjs
|
|
483
|
+
node .ai.local/scripts/processes.mjs watch # live table, 1 s refresh
|
|
484
|
+
node .ai.local/scripts/processes.mjs list --json # one snapshot per line
|
|
485
|
+
node .ai.local/scripts/processes.mjs scan # listening ports + known shapes
|
|
486
|
+
node .ai.local/scripts/processes.mjs doctor # stale lease, dead marker, empty lease port
|
|
487
|
+
node .ai.local/scripts/processes.mjs serve # 127.0.0.1:4179 — JSON, SSE, HTML
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
- **One protocol.** `acquire` creates `leases/<name>.json` with an exclusive `open(…, 'wx')` and records the **parent** process as the owner, because the CLI exits immediately — `--pid <n>` overrides it, and an owner that is not provably alive is refused with exit 2 (`acquire: a lease needs a live owner; pass --pid $$ (or use run)`); a second acquire is `held` (exit 1) unless `--wait <ms>`. `run` acquires, spawns with inherited stdio, releases in `finally`, and exits with the child's status (`128 + signo` on a signal death).
|
|
491
|
+
- **Liveness is pid + start time.** `pidStart` (`ps -o lstart=`, `/proc/<pid>/stat` on a host without `ps`) defeats pid reuse, and a heartbeat never makes a live holder stale. A stale lease is reclaimed on the first attempt inside `.processes/.reclaim/<name>`; `release` refuses a token that is not the owner's.
|
|
492
|
+
- **One snapshot, three surfaces.** `list` / `watch` / `serve` read own leases plus `preset-tree` (`.preset-tree-lock/owner.json`), `dev:<name>` (`.ai.local/.dev/*.json`), `team-db-serve` (`.ai.local/.ui/api.json`), `scheduler`, `runner:<slug>` (active runs only), and `git-index`. A missing source is skipped, a malformed one is a `warnings[]` entry; the snapshot never crashes.
|
|
493
|
+
- **Foreign is a label, never a kill.** `scan` reports listening TCP ports and the known command shapes (`fix-generated.mjs`, `check-preset-*.sh`, `team-db.mjs serve`, `storybook`, `next dev`, Playwright browsers); `--known-only` is the default. `stop --name <res>` or `stop --task <slug>` signals only a lease whose owner it can prove (live pid + matching `pidStart` + command line or lease port) and exits 4 with `stop: refused: …` otherwise; a stale lease is cleared without a signal.
|
|
494
|
+
- **Exit codes.** 0 ok · 1 held/timeout · 2 usage · 3 fatal (state directory unwritable, no `--allow-unlocked`) · 4 refused. `serve` binds a loopback host only.
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
457
498
|
## Building blocks — what to add where
|
|
458
499
|
|
|
459
500
|
When packaging a new habit for agents, pick **one** primary artifact. Prefer the lightest option that fits.
|