@bonesofspring/ai-rules 0.2.63 → 0.2.65
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 +96 -1
- package/README.md +11 -4
- package/bin/cli.js +7 -5
- package/bin/lib/ai-local-drift.js +7 -6
- package/bin/lib/engine-scripts.js +17 -4
- package/bin/lib/engine-upgrade.js +10 -2
- package/bin/lib/manifest-schema.js +12 -0
- package/bin/lib/seed-ai-local-team.js +20 -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 +43 -2
- package/docs/TEAM-DB.md +213 -5
- package/docs/openapi/team-db.v1.json +5928 -3045
- package/mcp/defectdojo-mcp.mjs +44 -12
- package/mcp/lib/defectdojo.mjs +57 -2
- package/package.json +27 -15
- package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +279 -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 +784 -7
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +235 -10
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +813 -7
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +397 -4
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +86 -10
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +221 -0
- package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +567 -0
- package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +2069 -0
- package/presets/_shared/ai-local/scripts/team-db-ui.mjs +750 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +151 -7
- 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 +2 -1
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +314 -1
- package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +40 -2
- package/presets/_shared/hooks/run-hook.mjs +2 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/android-kotlin/hooks/run-hook.mjs +2 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/android-kotlin/settings.json +6 -1
- package/presets/claude/go/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/go/hooks/run-hook.mjs +2 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/go/settings.json +6 -1
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/ios-swift/hooks/run-hook.mjs +2 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/ios-swift/settings.json +6 -1
- package/presets/claude/java/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/java/hooks/run-hook.mjs +2 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/java/settings.json +6 -1
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mcp-ts/hooks/run-hook.mjs +2 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/mcp-ts/settings.json +6 -1
- package/presets/claude/mol/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mol/hooks/run-hook.mjs +2 -1
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- 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/code-reviewer.md +1 -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 +4 -1
- 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 +2 -0
- package/presets/claude/next/commands/README.md +6 -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/ui-start.md +78 -0
- package/presets/claude/next/commands/ui-stop.md +71 -0
- package/presets/claude/next/commands/upstream-research.md +1 -1
- package/presets/claude/next/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/next/hooks/run-hook.mjs +2 -1
- package/presets/claude/next/rules/README.md +2 -1
- package/presets/claude/next/rules/stack/next-app-core.md +1 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- 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/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 +314 -1
- package/presets/claude/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/nuxt/hooks/run-hook.mjs +2 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/nuxt/settings.json +6 -1
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-hexagonal/hooks/run-hook.mjs +2 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/php-hexagonal/settings.json +6 -1
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +315 -2
- package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-laravel/hooks/run-hook.mjs +2 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/php-laravel/settings.json +6 -1
- package/presets/claude/svelte/hooks/chain-team-phases.sh +314 -1
- package/presets/claude/svelte/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/svelte/hooks/run-hook.mjs +2 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +2 -1
- package/presets/claude/svelte/settings.json +6 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/android-kotlin/hooks/run-hook.mjs +2 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/go/hooks/run-hook.mjs +2 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/ios-swift/hooks/run-hook.mjs +2 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/java/hooks/run-hook.mjs +2 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mcp-ts/hooks/run-hook.mjs +2 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mol/hooks/run-hook.mjs +2 -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/code-reviewer.md +1 -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 +4 -1
- 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 +2 -0
- package/presets/cursor/next/ai-local/rules-library/storybook-dev-compare-figma.md +2 -1
- package/presets/cursor/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/cursor/next/commands/README.md +6 -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/ui-start.md +78 -0
- package/presets/cursor/next/commands/ui-stop.md +71 -0
- package/presets/cursor/next/commands/upstream-research.md +1 -1
- package/presets/cursor/next/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/next/hooks/run-hook.mjs +2 -1
- package/presets/cursor/next/rules/README.md +2 -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/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 +314 -1
- package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/nuxt/hooks/run-hook.mjs +2 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +2 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +315 -2
- package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-laravel/hooks/run-hook.mjs +2 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +314 -1
- package/presets/cursor/svelte/hooks/guard-shell-command.mjs +41 -2
- 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 +314 -1
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/go/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/java/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +2 -1
- 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/code-reviewer.md +1 -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 +4 -1
- 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 +2 -0
- package/presets/mavis/next/ai-local/rules-library/storybook-dev-compare-figma.md +2 -1
- package/presets/mavis/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/mavis/next/commands/README.md +6 -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/ui-start.md +73 -0
- package/presets/mavis/next/commands/ui-stop.md +66 -0
- package/presets/mavis/next/commands/upstream-research.md +1 -1
- package/presets/mavis/next/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/mavis/next/rules/next-app-core.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 +314 -1
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +315 -2
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +2 -1
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +314 -1
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +2 -1
- 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 +314 -1
- package/presets/opencode/android-kotlin/opencode.json +5 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +2 -1
- 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 +314 -1
- package/presets/opencode/go/opencode.json +5 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +2 -1
- 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 +314 -1
- package/presets/opencode/ios-swift/opencode.json +5 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +2 -1
- 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 +314 -1
- package/presets/opencode/java/opencode.json +5 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +2 -1
- 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 +314 -1
- package/presets/opencode/mcp-ts/opencode.json +5 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +2 -1
- 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 +314 -1
- package/presets/opencode/mol/opencode.json +4 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/next/MCP.md +2 -0
- package/presets/opencode/next/OPENCODE.md +4 -1
- package/presets/opencode/next/README.md +1 -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/code-reviewer.md +1 -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 +4 -1
- 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 +2 -0
- package/presets/opencode/next/ai-local/rules-library/storybook-dev-compare-figma.md +2 -1
- package/presets/opencode/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/opencode/next/commands/README.md +6 -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/ui-start.md +81 -0
- package/presets/opencode/next/commands/ui-stop.md +74 -0
- 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 +314 -1
- package/presets/opencode/next/opencode.json +4 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +2 -1
- package/presets/opencode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/opencode/next/rules/next-app-core.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 +314 -1
- package/presets/opencode/nuxt/opencode.json +4 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +2 -1
- 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 +314 -1
- package/presets/opencode/php-hexagonal/opencode.json +5 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +2 -1
- 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 +315 -2
- package/presets/opencode/php-laravel/opencode.json +5 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +2 -1
- 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 +314 -1
- package/presets/opencode/svelte/opencode.json +4 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/go/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/java/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +2 -1
- 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/code-reviewer.md +1 -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 +4 -1
- 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 +2 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-dev-compare-figma.md +2 -1
- package/presets/zcode/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
- package/presets/zcode/next/commands/README.md +6 -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/ui-start.md +81 -0
- package/presets/zcode/next/commands/ui-stop.md +74 -0
- package/presets/zcode/next/commands/upstream-research.md +1 -1
- package/presets/zcode/next/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/next/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/zcode/next/rules/next-app-core.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 +314 -1
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +315 -2
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +2 -1
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +314 -1
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +2 -1
- package/scripts/aggregate-agent-task-metrics.mjs +48 -4
package/mcp/defectdojo-mcp.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* `.env.defectdojo`; the token is never written by this package.
|
|
9
9
|
*/
|
|
10
10
|
import { readFileSync } from 'node:fs';
|
|
11
|
-
import { basename
|
|
11
|
+
import { basename } from 'node:path';
|
|
12
12
|
import { createInterface } from 'node:readline';
|
|
13
13
|
import {
|
|
14
14
|
ApiError,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
isAllowedPath,
|
|
17
17
|
loadDefectDojoConfig,
|
|
18
18
|
request,
|
|
19
|
+
resolveImportPath,
|
|
19
20
|
} from './lib/defectdojo.mjs';
|
|
20
21
|
|
|
21
22
|
const PROTOCOL_VERSION = '2025-06-18';
|
|
@@ -141,7 +142,7 @@ const TOOLS = [
|
|
|
141
142
|
properties: {
|
|
142
143
|
engagement: { type: 'integer', minimum: 1 },
|
|
143
144
|
scan_type: { type: 'string' },
|
|
144
|
-
file: { type: 'string', description: 'Repo-relative
|
|
145
|
+
file: { type: 'string', description: 'Repo-relative path to the report file, read inside the project root.' },
|
|
145
146
|
minimum_severity: { type: 'string', enum: ['Info', 'Low', 'Medium', 'High', 'Critical'] },
|
|
146
147
|
active: { type: 'boolean' },
|
|
147
148
|
verified: { type: 'boolean' },
|
|
@@ -178,18 +179,44 @@ function jsonResult(payload) {
|
|
|
178
179
|
return { content: [{ type: 'text', text: clipped }] };
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Known error classes carry crafted messages without local paths; anything
|
|
184
|
+
* else is sanitized: the client gets a short generic message, the stack (and
|
|
185
|
+
* any local paths in it) goes to stderr for the operator only.
|
|
186
|
+
*/
|
|
181
187
|
function errorResult(error) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
if (error instanceof ConfigError || error instanceof ApiError) {
|
|
189
|
+
return { content: [{ type: 'text', text: error.message }], isError: true };
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const detail = error instanceof Error
|
|
193
|
+
? error.stack ?? `${error.name}: ${error.message}`
|
|
194
|
+
: String(error);
|
|
187
195
|
|
|
188
|
-
|
|
196
|
+
process.stderr.write(`defectdojo-mcp: unexpected tool failure\n${detail}\n`);
|
|
197
|
+
|
|
198
|
+
return { content: [{ type: 'text', text: 'unexpected tool failure (details in the server log)' }], isError: true };
|
|
189
199
|
}
|
|
190
200
|
|
|
191
|
-
|
|
192
|
-
|
|
201
|
+
/** Declared-integer args are validated at runtime before they reach a path or payload. */
|
|
202
|
+
function requireInteger(value, name) {
|
|
203
|
+
if (!Number.isInteger(value)) {
|
|
204
|
+
throw new ConfigError(`${name} must be an integer`);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return value;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function readFileForImport(root, file) {
|
|
211
|
+
// Read the resolved path, never re-resolve the raw argument: the validated
|
|
212
|
+
// object and the uploaded object must be the same filesystem entry.
|
|
213
|
+
const absolute = resolveImportPath(root, file);
|
|
214
|
+
|
|
215
|
+
if (absolute === null) {
|
|
216
|
+
throw new ConfigError(
|
|
217
|
+
'file must be a repo-relative path inside the project root; absolute paths, ".." traversal and symlink escapes are refused',
|
|
218
|
+
);
|
|
219
|
+
}
|
|
193
220
|
|
|
194
221
|
return { buffer: readFileSync(absolute), name: basename(absolute) };
|
|
195
222
|
}
|
|
@@ -205,15 +232,19 @@ async function callTool(name, args) {
|
|
|
205
232
|
});
|
|
206
233
|
|
|
207
234
|
case 'dd_finding':
|
|
208
|
-
return request(config, { path: `findings/${args.id}/` });
|
|
235
|
+
return request(config, { path: `findings/${requireInteger(args.id, 'id')}/` });
|
|
209
236
|
|
|
210
237
|
case 'dd_products':
|
|
211
238
|
return request(config, { path: 'products/', query: asQuery(args, ['name', 'prod_type', 'limit', 'offset']) });
|
|
212
239
|
|
|
213
240
|
case 'dd_product':
|
|
214
|
-
return request(config, { path: `products/${args.id}/` });
|
|
241
|
+
return request(config, { path: `products/${requireInteger(args.id, 'id')}/` });
|
|
215
242
|
|
|
216
243
|
case 'dd_engagements':
|
|
244
|
+
if (args.product !== undefined && args.product !== null) {
|
|
245
|
+
requireInteger(args.product, 'product');
|
|
246
|
+
}
|
|
247
|
+
|
|
217
248
|
return request(config, { path: 'engagements/', query: asQuery(args, ['product', 'status', 'limit', 'offset']) });
|
|
218
249
|
|
|
219
250
|
case 'dd_test_types':
|
|
@@ -228,6 +259,7 @@ async function callTool(name, args) {
|
|
|
228
259
|
}
|
|
229
260
|
|
|
230
261
|
case 'dd_import_scan': {
|
|
262
|
+
requireInteger(args.engagement, 'engagement');
|
|
231
263
|
const { buffer, name: filename } = readFileForImport(config.root, args.file);
|
|
232
264
|
const formData = new FormData();
|
|
233
265
|
|
package/mcp/lib/defectdojo.mjs
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* `.env.defectdojo` file. Unlike GitLab, the token is not validated with a
|
|
8
8
|
* provider endpoint at setup time only — the same probe powers the doctor.
|
|
9
9
|
*/
|
|
10
|
-
import { existsSync } from 'node:fs';
|
|
11
|
-
import { join } from 'node:path';
|
|
10
|
+
import { existsSync, realpathSync } from 'node:fs';
|
|
11
|
+
import { isAbsolute, join, resolve, sep } from 'node:path';
|
|
12
12
|
import run from '../../bin/lib/mcp/run.js';
|
|
13
13
|
import { ConfigError, readEnvFile } from './envfile.mjs';
|
|
14
14
|
|
|
@@ -157,6 +157,61 @@ export function isAllowedPath(path, baseUrl) {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
/**
|
|
161
|
+
* `dd_import_scan` may read the report file inside the project root only —
|
|
162
|
+
* the local-file twin of {@link isAllowedPath}: a prompt-injected upload must
|
|
163
|
+
* not become a read of arbitrary local files. Absolute paths (POSIX, Windows
|
|
164
|
+
* drive or UNC) and any `..` traversal form — raw, percent-encoded, or
|
|
165
|
+
* backslash — are refused outright, and the resolved file must really exist
|
|
166
|
+
* under the *real* project root: a symlink that leaves the root is an escape,
|
|
167
|
+
* not a read. Deny closed: an unreadable, unresolvable, or malformed-encoding
|
|
168
|
+
* path is a refusal, never a best-effort read.
|
|
169
|
+
*
|
|
170
|
+
* Returns the real path the caller must read. Resolving the name once is
|
|
171
|
+
* deliberate: a validator that trims and a reader that resolves the raw input
|
|
172
|
+
* can approve one filesystem object and read another (a whitespace-padded
|
|
173
|
+
* symlink alias is a distinct directory entry on POSIX). Padded names are
|
|
174
|
+
* refused, never trimmed, for the same reason.
|
|
175
|
+
*/
|
|
176
|
+
export function resolveImportPath(root, input) {
|
|
177
|
+
if (typeof root !== 'string' || root === '' || typeof input !== 'string' || input === '') {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
if (input.trim() === '' || input !== input.trim()) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (isAbsolute(input) || /^[a-zA-Z]:[/\\]/.test(input) || input.startsWith('\\\\')) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const forms = [input];
|
|
189
|
+
try {
|
|
190
|
+
forms.push(decodeURIComponent(input));
|
|
191
|
+
} catch {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
for (const form of forms) {
|
|
196
|
+
if (form.split(/[\\/]/).includes('..')) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
try {
|
|
202
|
+
const realRoot = realpathSync(root);
|
|
203
|
+
const realFile = realpathSync(resolve(root, input));
|
|
204
|
+
return realFile === realRoot || realFile.startsWith(realRoot + sep) ? realFile : null;
|
|
205
|
+
} catch {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** Boolean form of {@link resolveImportPath} for callers that only gate. */
|
|
211
|
+
export function isAllowedImportPath(root, input) {
|
|
212
|
+
return resolveImportPath(root, input) !== null;
|
|
213
|
+
}
|
|
214
|
+
|
|
160
215
|
export function buildUrl(baseUrl, path, query = {}) {
|
|
161
216
|
const url = /^https?:\/\//.test(path) ? new URL(path) : new URL(`${baseUrl}/${apiPath(path)}`);
|
|
162
217
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonesofspring/ai-rules",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.65",
|
|
4
4
|
"description": "Presets of Cursor, Claude, Mavis, OpenCode, and ZCode rules/commands for Revy Ross personal use",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Revy Ross",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"scripts": {
|
|
38
38
|
"check:fast": "bash scripts/check-preset-fast.sh",
|
|
39
39
|
"check:changed": "node scripts/check-preset-delta.mjs --base HEAD",
|
|
40
|
-
"test:hooks": "node scripts/test-chain-team-phases-coverage.mjs && node scripts/test-agent-task-metrics-hooks.mjs",
|
|
40
|
+
"test:hooks": "node scripts/test-chain-team-phases-coverage.mjs && node scripts/test-agent-task-metrics-hooks.mjs && node scripts/test-chain-team-phases-dev-cleanup.mjs",
|
|
41
41
|
"check:preset-structure": "bash scripts/check-preset-structure.sh",
|
|
42
42
|
"release:gate": "bash scripts/release-gate.sh",
|
|
43
43
|
"check:platform-scripts": "node scripts/check-platform-scripts.mjs",
|
|
@@ -49,27 +49,27 @@
|
|
|
49
49
|
"check:claude-agent-blocks": "node scripts/check-claude-agent-blocks.mjs",
|
|
50
50
|
"check:claude-agent-parity": "node scripts/check-claude-agent-parity.mjs",
|
|
51
51
|
"test:claude-agent-parity": "node scripts/test-claude-agent-parity.mjs",
|
|
52
|
-
"check:consumer-links": "node scripts/check-consumer-links.mjs",
|
|
52
|
+
"check:consumer-links": "node scripts/run-locked.mjs --label check:consumer-links -- node scripts/check-consumer-links.mjs",
|
|
53
53
|
"test:consumer-links": "node scripts/test-consumer-links.mjs",
|
|
54
|
-
"check:preset-twin-map": "bash scripts/check-preset-twin-map.sh",
|
|
55
|
-
"check:preset-twin-drift": "node scripts/check-preset-twin-drift.mjs",
|
|
54
|
+
"check:preset-twin-map": "node scripts/run-locked.mjs --label check:preset-twin-map -- bash scripts/check-preset-twin-map.sh",
|
|
55
|
+
"check:preset-twin-drift": "node scripts/run-locked.mjs --label check:preset-twin-drift -- node scripts/check-preset-twin-drift.mjs",
|
|
56
56
|
"test:twin-drift-fixtures": "node scripts/test-preset-twin-drift.mjs",
|
|
57
|
-
"check:preset-token-budget": "bash scripts/check-preset-token-budget.sh",
|
|
58
|
-
"check:preset-leakage": "bash scripts/check-preset-leakage.sh",
|
|
57
|
+
"check:preset-token-budget": "node scripts/run-locked.mjs --label check:preset-token-budget -- bash scripts/check-preset-token-budget.sh",
|
|
58
|
+
"check:preset-leakage": "node scripts/run-locked.mjs --label check:preset-leakage -- bash scripts/check-preset-leakage.sh",
|
|
59
59
|
"check:figma-contract": "bash scripts/check-figma-contract-presence.sh",
|
|
60
60
|
"check:hook-only-lifecycle": "bash scripts/check-hook-only-lifecycle.sh",
|
|
61
|
-
"check:preset-reachability": "bash scripts/check-preset-reachability.sh",
|
|
61
|
+
"check:preset-reachability": "node scripts/run-locked.mjs --label check:preset-reachability -- bash scripts/check-preset-reachability.sh",
|
|
62
62
|
"check:local-overlay": "bash scripts/check-local-overlay.sh",
|
|
63
|
-
"check:preset-i18n": "AI_RULES_I18N_FAIL=1 AI_RULES_I18N_SOFT=0 bash scripts/check-preset-i18n.sh",
|
|
64
|
-
"check:frontmatter": "node scripts/check-frontmatter.mjs",
|
|
65
|
-
"check:shared-core-drift": "bash scripts/check-shared-core-drift.sh",
|
|
63
|
+
"check:preset-i18n": "node scripts/run-locked.mjs --label check:preset-i18n -- env AI_RULES_I18N_FAIL=1 AI_RULES_I18N_SOFT=0 bash scripts/check-preset-i18n.sh",
|
|
64
|
+
"check:frontmatter": "node scripts/run-locked.mjs --label check:frontmatter -- node scripts/check-frontmatter.mjs",
|
|
65
|
+
"check:shared-core-drift": "node scripts/run-locked.mjs --label check:shared-core-drift -- bash scripts/check-shared-core-drift.sh",
|
|
66
66
|
"check:product-specs": "bash scripts/check-product-specs.sh",
|
|
67
67
|
"check:product-specs:self-test": "bash scripts/check-product-specs.sh --self-test",
|
|
68
68
|
"check:product-specs:dogfood": "bash scripts/check-product-specs.sh ../../dogfood/mcp-ts-sample",
|
|
69
69
|
"check:rule-eval": "node scripts/check-rule-eval.mjs",
|
|
70
70
|
"check:next-attached-budget": "node scripts/check-next-attached-budget.mjs",
|
|
71
71
|
"check:release-consistency": "node scripts/check-release-consistency.mjs",
|
|
72
|
-
"check:generated-drift": "node scripts/check-generated-drift.mjs",
|
|
72
|
+
"check:generated-drift": "node scripts/run-locked.mjs --label check:generated-drift -- node scripts/check-generated-drift.mjs",
|
|
73
73
|
"check:hook-body-parity": "node scripts/check-hook-body-parity.mjs",
|
|
74
74
|
"test:hook-body-parity-fixtures": "node scripts/test-hook-body-parity-fixtures.mjs",
|
|
75
75
|
"test:shared-core-drift-lineage-fixtures": "node scripts/test-shared-core-drift-lineage-fixtures.mjs",
|
|
@@ -77,8 +77,10 @@
|
|
|
77
77
|
"test:generate-claude-fixtures": "node scripts/test-generate-claude-fixtures.mjs",
|
|
78
78
|
"test:generated-drift-claude-fixtures": "node scripts/test-generated-drift-claude-fixtures.mjs",
|
|
79
79
|
"test:rule-improver": "node scripts/test-rule-improver-ledger.mjs",
|
|
80
|
+
"test:guard-shell-command": "node scripts/test-guard-shell-command.mjs",
|
|
81
|
+
"check:processes": "node scripts/test-process-lease.mjs && node scripts/test-process-adapters.mjs && node scripts/test-process-scan.mjs",
|
|
80
82
|
"test:cli-mcp-merge": "node scripts/test-cli-mcp-merge.mjs",
|
|
81
|
-
"test:cli-init-clean": "node scripts/test-cli-init-clean.mjs",
|
|
83
|
+
"test:cli-init-clean": "node scripts/run-locked.mjs --label test:cli-init-clean -- node scripts/test-cli-init-clean.mjs",
|
|
82
84
|
"test:cli-update": "node scripts/test-cli-update.mjs",
|
|
83
85
|
"test:cli-install-doctor": "node scripts/test-install-doctor.mjs",
|
|
84
86
|
"test:engine-upgrade": "node scripts/test-engine-upgrade.mjs",
|
|
@@ -87,6 +89,7 @@
|
|
|
87
89
|
"test:mcp-pack-tarball": "node scripts/test-mcp-pack-tarball.mjs",
|
|
88
90
|
"test:chain-coverage": "node scripts/test-chain-team-phases-coverage.mjs",
|
|
89
91
|
"test:agent-task-metrics-hooks": "node scripts/test-agent-task-metrics-hooks.mjs",
|
|
92
|
+
"test:upstream": "node scripts/test-upstream-research.mjs",
|
|
90
93
|
"test:team-db:schema": "node scripts/test-team-db-schema.mjs",
|
|
91
94
|
"test:team-db:project": "node scripts/test-team-db-project.mjs",
|
|
92
95
|
"test:team-db:migrate-tasks": "node scripts/test-team-db-migrate-tasks.mjs",
|
|
@@ -94,10 +97,17 @@
|
|
|
94
97
|
"test:team-db:api": "node scripts/test-team-db-api.mjs",
|
|
95
98
|
"test:team-db:security": "node scripts/test-team-db-security.mjs",
|
|
96
99
|
"test:team-db:dashboard": "node scripts/test-team-db-dashboard.mjs",
|
|
100
|
+
"test:team-db:ui": "node scripts/test-team-db-ui.mjs",
|
|
97
101
|
"test:team-db:concurrency": "node scripts/test-team-db-concurrency.mjs",
|
|
102
|
+
"test:team-db:tracker": "node scripts/test-team-db-tracker.mjs",
|
|
103
|
+
"test:team-db:tracker-order": "node scripts/test-team-db-tracker-order.mjs",
|
|
104
|
+
"test:team-db:tracker-project": "node scripts/test-team-db-tracker-project.mjs",
|
|
105
|
+
"test:team-db:tracker-queue": "node scripts/test-team-db-tracker-queue.mjs",
|
|
106
|
+
"test:team-db:tracker-import": "node scripts/test-team-db-tracker-import.mjs",
|
|
107
|
+
"test:team-db:task-runner": "node scripts/test-team-db-task-runner.mjs",
|
|
98
108
|
"test:team-db:scheduler": "node scripts/test-team-db-scheduler.mjs",
|
|
99
109
|
"test:team-db:fixtures": "node scripts/test-team-db-fixtures.mjs",
|
|
100
|
-
"test:team-db": "node scripts/test-team-db-schema.mjs && node scripts/test-team-db-project.mjs && node scripts/test-team-db-migrate-tasks.mjs && node scripts/test-team-db-dualwrite.mjs && node scripts/check-team-db-contract.mjs && node scripts/test-team-db-api.mjs && node scripts/test-team-db-security.mjs && node scripts/test-team-db-dashboard.mjs && node scripts/test-team-db-concurrency.mjs && node scripts/test-team-db-scheduler.mjs && node scripts/test-team-db-fixtures.mjs",
|
|
110
|
+
"test:team-db": "node scripts/test-team-db-schema.mjs && node scripts/test-team-db-project.mjs && node scripts/test-team-db-migrate-tasks.mjs && node scripts/test-team-db-dualwrite.mjs && node scripts/check-team-db-contract.mjs && node scripts/test-team-db-api.mjs && node scripts/test-team-db-security.mjs && node scripts/test-team-db-dashboard.mjs && node scripts/test-team-db-ui.mjs && node scripts/test-team-db-concurrency.mjs && node scripts/test-team-db-tracker.mjs && node scripts/test-team-db-tracker-order.mjs && node scripts/test-team-db-tracker-project.mjs && node scripts/test-team-db-tracker-queue.mjs && node scripts/test-team-db-tracker-import.mjs && node scripts/test-team-db-task-runner.mjs && node scripts/test-team-db-scheduler.mjs && node scripts/test-team-db-fixtures.mjs",
|
|
101
111
|
"check:team-db-contract": "node scripts/check-team-db-contract.mjs",
|
|
102
112
|
"check:mavis-platform-contract": "node scripts/check-mavis-platform-contract.mjs --self-test",
|
|
103
113
|
"check:mavis-adapter-map": "node scripts/check-mavis-adapter-map.mjs --self-test",
|
|
@@ -115,11 +125,13 @@
|
|
|
115
125
|
"check:zcode-local-overlay": "node scripts/check-zcode-local-overlay.mjs",
|
|
116
126
|
"test:opencode-context-budget": "node scripts/test-opencode-context-budget.mjs",
|
|
117
127
|
"test:probe-mavis-capabilities": "node scripts/test-probe-mavis-capabilities.mjs",
|
|
128
|
+
"preset:loop": "yarn fix:generated && yarn check:changed && yarn check:fast",
|
|
118
129
|
"fix:generated": "node scripts/fix-generated.mjs",
|
|
119
130
|
"generate:claude": "node scripts/generate-claude.mjs",
|
|
120
131
|
"generate:mavis": "node scripts/generate-mavis.mjs",
|
|
121
132
|
"generate:opencode": "node scripts/generate-opencode.mjs",
|
|
122
|
-
"generate:zcode": "node scripts/generate-zcode.mjs"
|
|
133
|
+
"generate:zcode": "node scripts/generate-zcode.mjs",
|
|
134
|
+
"test:dev-processes": "node scripts/test-dev-processes.mjs"
|
|
123
135
|
},
|
|
124
136
|
"engines": {
|
|
125
137
|
"node": ">=20"
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Aggregate `metrics.json` ledgers across `.ai.local/team/tasks/*` and emit a JSON report.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node scripts/aggregate-agent-task-metrics.mjs [--team-root <dir>] [--help]
|
|
7
|
+
*
|
|
8
|
+
* Defaults to `<cwd>/.ai.local/team` when --team-root is omitted.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import fs from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
|
|
14
|
+
const args = process.argv.slice(2);
|
|
15
|
+
|
|
16
|
+
if (args.includes('-h') || args.includes('--help')) {
|
|
17
|
+
console.log(`Aggregate agent-task metrics ledgers.
|
|
18
|
+
|
|
19
|
+
Usage:
|
|
20
|
+
node scripts/aggregate-agent-task-metrics.mjs [--team-root <dir>] [--slug <slug>]
|
|
21
|
+
|
|
22
|
+
Options:
|
|
23
|
+
--team-root <dir> Directory containing a 'tasks/' subfolder with *.metrics.json ledgers
|
|
24
|
+
(default: <cwd>/.ai.local/team)
|
|
25
|
+
--slug <slug> Only aggregate the named task directory
|
|
26
|
+
|
|
27
|
+
Output: JSON report on stdout (machine-readable).`);
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const teamRootIndex = args.indexOf('--team-root');
|
|
32
|
+
const teamRoot =
|
|
33
|
+
teamRootIndex >= 0
|
|
34
|
+
? path.resolve(args[teamRootIndex + 1] ?? '')
|
|
35
|
+
: path.join(process.cwd(), '.ai.local', 'team');
|
|
36
|
+
const slugIndex = args.indexOf('--slug');
|
|
37
|
+
const slugFilter = slugIndex >= 0 ? args[slugIndex + 1] ?? null : null;
|
|
38
|
+
const tasksDir = path.join(teamRoot, 'tasks');
|
|
39
|
+
const incomplete = [];
|
|
40
|
+
const attempts = [];
|
|
41
|
+
const tasks = [];
|
|
42
|
+
const taskReports = [];
|
|
43
|
+
const gateWaits = [];
|
|
44
|
+
const outOfBandDurations = [];
|
|
45
|
+
const attributionConfidenceCounts = new Map();
|
|
46
|
+
let unmatchedAttemptCount = 0;
|
|
47
|
+
let duplicateTerminalAttemptCount = 0;
|
|
48
|
+
let duplicateAttemptIdCount = 0;
|
|
49
|
+
let missingLedgerCount = 0;
|
|
50
|
+
let malformedLedgerCount = 0;
|
|
51
|
+
let invalidLedgerCount = 0;
|
|
52
|
+
let unterminatedAttemptCount = 0;
|
|
53
|
+
|
|
54
|
+
function readMetrics(filePath) {
|
|
55
|
+
if (!fs.existsSync(filePath)) {
|
|
56
|
+
incomplete.push({ file: filePath, category: 'missing_ledger', reason: 'missing ledger' });
|
|
57
|
+
missingLedgerCount += 1;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
let parsed;
|
|
61
|
+
try {
|
|
62
|
+
parsed = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
63
|
+
} catch {
|
|
64
|
+
incomplete.push({ file: filePath, category: 'malformed_json', reason: 'malformed JSON' });
|
|
65
|
+
malformedLedgerCount += 1;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (parsed.schemaVersion !== 1 || !parsed.task || !Array.isArray(parsed.events)) {
|
|
69
|
+
incomplete.push({ file: filePath, category: 'unsupported_schema', reason: 'unsupported schema' });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
collect(parsed, filePath);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
incomplete.push({
|
|
76
|
+
file: filePath,
|
|
77
|
+
category: 'invalid_ledger',
|
|
78
|
+
reason: error instanceof Error ? error.message : 'invalid ledger structure',
|
|
79
|
+
});
|
|
80
|
+
invalidLedgerCount += 1;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function collect(metrics, filePath) {
|
|
85
|
+
const starts = new Map();
|
|
86
|
+
const gateStarts = new Map();
|
|
87
|
+
const terminalAttempts = new Set();
|
|
88
|
+
const attemptDurations = [];
|
|
89
|
+
let taskCompleted = false;
|
|
90
|
+
let ledgerIncomplete = false;
|
|
91
|
+
let taskStartedAt = null;
|
|
92
|
+
let taskCompletedAt = null;
|
|
93
|
+
let taskGateWaitMs = 0;
|
|
94
|
+
let taskOutOfBandMs = 0;
|
|
95
|
+
let taskOutOfBandCount = 0;
|
|
96
|
+
|
|
97
|
+
for (const event of metrics.events) {
|
|
98
|
+
if (event.type === 'task_started') taskStartedAt = event.at;
|
|
99
|
+
if (event.type === 'out_of_band_finished' && Number.isFinite(event.durationMs)) {
|
|
100
|
+
outOfBandDurations.push(event.durationMs);
|
|
101
|
+
taskOutOfBandMs += event.durationMs;
|
|
102
|
+
taskOutOfBandCount += 1;
|
|
103
|
+
}
|
|
104
|
+
if (event.type === 'attempt_started' && event.attemptId) {
|
|
105
|
+
if (starts.has(event.attemptId)) {
|
|
106
|
+
incomplete.push({
|
|
107
|
+
file: filePath,
|
|
108
|
+
category: 'duplicate_attempt_id',
|
|
109
|
+
reason: `duplicate attempt ID ${event.attemptId}`,
|
|
110
|
+
});
|
|
111
|
+
duplicateAttemptIdCount += 1;
|
|
112
|
+
ledgerIncomplete = true;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
starts.set(event.attemptId, event);
|
|
116
|
+
}
|
|
117
|
+
if (event.type === 'attempt_finished' && event.attemptId) {
|
|
118
|
+
const start = starts.get(event.attemptId);
|
|
119
|
+
if (!start) {
|
|
120
|
+
incomplete.push({
|
|
121
|
+
file: filePath,
|
|
122
|
+
category: 'unmatched_attempt',
|
|
123
|
+
reason: `unmatched attempt ${event.attemptId}`,
|
|
124
|
+
});
|
|
125
|
+
unmatchedAttemptCount += 1;
|
|
126
|
+
ledgerIncomplete = true;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (terminalAttempts.has(event.attemptId)) {
|
|
130
|
+
incomplete.push({
|
|
131
|
+
file: filePath,
|
|
132
|
+
category: 'duplicate_terminal_attempt',
|
|
133
|
+
reason: `duplicate terminal attempt ${event.attemptId}`,
|
|
134
|
+
});
|
|
135
|
+
duplicateTerminalAttemptCount += 1;
|
|
136
|
+
ledgerIncomplete = true;
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
terminalAttempts.add(event.attemptId);
|
|
140
|
+
const attributionConfidence = event.attributionConfidence ?? 'unknown';
|
|
141
|
+
attributionConfidenceCounts.set(
|
|
142
|
+
attributionConfidence,
|
|
143
|
+
(attributionConfidenceCounts.get(attributionConfidence) ?? 0) + 1,
|
|
144
|
+
);
|
|
145
|
+
if (Number.isFinite(event.durationMs)) attemptDurations.push(event.durationMs);
|
|
146
|
+
attempts.push({
|
|
147
|
+
...metrics.task,
|
|
148
|
+
agent: start.agent ?? 'unknown',
|
|
149
|
+
role: start.role ?? 'unknown',
|
|
150
|
+
durationMs: Number.isFinite(event.durationMs) ? event.durationMs : null,
|
|
151
|
+
outcome: event.outcome ?? 'unknown',
|
|
152
|
+
attributionConfidence,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
if (event.type === 'human_gate_started' && event.eventId) {
|
|
156
|
+
gateStarts.set(event.eventId, event);
|
|
157
|
+
}
|
|
158
|
+
if (event.type === 'human_gate_ended') {
|
|
159
|
+
const start = event.gateStartedEventId ? gateStarts.get(event.gateStartedEventId) : undefined;
|
|
160
|
+
const elapsed = start ? Date.parse(event.at) - Date.parse(start.at) : NaN;
|
|
161
|
+
if (Number.isFinite(elapsed) && elapsed >= 0) {
|
|
162
|
+
gateWaits.push(elapsed);
|
|
163
|
+
taskGateWaitMs += elapsed;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (event.type === 'task_completed') {
|
|
167
|
+
taskCompleted = true;
|
|
168
|
+
taskCompletedAt = event.at;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
for (const attemptId of starts.keys()) {
|
|
173
|
+
if (terminalAttempts.has(attemptId)) continue;
|
|
174
|
+
incomplete.push({
|
|
175
|
+
file: filePath,
|
|
176
|
+
category: 'unterminated_attempt',
|
|
177
|
+
reason: `unterminated attempt ${attemptId}`,
|
|
178
|
+
});
|
|
179
|
+
unterminatedAttemptCount += 1;
|
|
180
|
+
ledgerIncomplete = true;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (taskCompleted && !ledgerIncomplete) tasks.push(metrics.task);
|
|
184
|
+
if (taskStartedAt) {
|
|
185
|
+
taskReports.push({
|
|
186
|
+
...metrics.task,
|
|
187
|
+
elapsedMs: taskCompletedAt ? Date.parse(taskCompletedAt) - Date.parse(taskStartedAt) : null,
|
|
188
|
+
activeMs: attemptDurations.reduce((sum, value) => sum + value, 0),
|
|
189
|
+
gateWaitMs: taskGateWaitMs,
|
|
190
|
+
outOfBandMs: taskOutOfBandMs,
|
|
191
|
+
outOfBandCount: taskOutOfBandCount,
|
|
192
|
+
attemptCount: terminalAttempts.size,
|
|
193
|
+
completed: taskCompleted,
|
|
194
|
+
incomplete: ledgerIncomplete,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function groupBy(items, keyFor) {
|
|
200
|
+
const groups = new Map();
|
|
201
|
+
for (const item of items) {
|
|
202
|
+
const key = keyFor(item);
|
|
203
|
+
groups.set(key, [...(groups.get(key) ?? []), item]);
|
|
204
|
+
}
|
|
205
|
+
return [...groups.values()];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!fs.existsSync(tasksDir)) {
|
|
209
|
+
console.error(`Task directory does not exist: ${tasksDir}`);
|
|
210
|
+
process.exit(1);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
for (const entry of fs.readdirSync(tasksDir, { withFileTypes: true })) {
|
|
214
|
+
if (!entry.isDirectory()) continue;
|
|
215
|
+
if (slugFilter && entry.name !== slugFilter) continue;
|
|
216
|
+
readMetrics(path.join(tasksDir, entry.name, 'metrics.json'));
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const byAgentRole = groupBy(
|
|
220
|
+
attempts,
|
|
221
|
+
(item) => `${item.platform}|${item.stack}|${item.preset}|${item.agent}|${item.role}`,
|
|
222
|
+
).map((group) => {
|
|
223
|
+
const sample = group[0];
|
|
224
|
+
const durations = group.map((item) => item.durationMs).filter((value) => value !== null);
|
|
225
|
+
const sumDurationMs = durations.reduce((sum, value) => sum + value, 0);
|
|
226
|
+
return {
|
|
227
|
+
platform: sample.platform,
|
|
228
|
+
stack: sample.stack,
|
|
229
|
+
preset: sample.preset,
|
|
230
|
+
agent: sample.agent,
|
|
231
|
+
role: sample.role,
|
|
232
|
+
count: group.length,
|
|
233
|
+
completedCount: group.filter((item) => item.outcome === 'completed').length,
|
|
234
|
+
sumDurationMs,
|
|
235
|
+
avgDurationMs: durations.length ? sumDurationMs / durations.length : null,
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
const taskCountsByRunId = [...new Map(tasks.map((task) => [task.runId, task])).values()].map((task) => ({
|
|
240
|
+
runId: task.runId,
|
|
241
|
+
slug: task.slug,
|
|
242
|
+
platform: task.platform,
|
|
243
|
+
stack: task.stack,
|
|
244
|
+
preset: task.preset,
|
|
245
|
+
intent: task.intent,
|
|
246
|
+
}));
|
|
247
|
+
|
|
248
|
+
process.stdout.write(
|
|
249
|
+
`${JSON.stringify(
|
|
250
|
+
{
|
|
251
|
+
schemaVersion: 1,
|
|
252
|
+
teamRoot,
|
|
253
|
+
agentRole: byAgentRole,
|
|
254
|
+
taskCountsByRunId,
|
|
255
|
+
taskReports,
|
|
256
|
+
humanGateWait: {
|
|
257
|
+
count: gateWaits.length,
|
|
258
|
+
sumDurationMs: gateWaits.reduce((sum, value) => sum + value, 0),
|
|
259
|
+
},
|
|
260
|
+
outOfBand: {
|
|
261
|
+
count: outOfBandDurations.length,
|
|
262
|
+
sumDurationMs: outOfBandDurations.reduce((sum, value) => sum + value, 0),
|
|
263
|
+
},
|
|
264
|
+
attributionConfidence: Object.fromEntries(attributionConfidenceCounts),
|
|
265
|
+
completeness: {
|
|
266
|
+
missingLedgerCount,
|
|
267
|
+
malformedLedgerCount,
|
|
268
|
+
invalidLedgerCount,
|
|
269
|
+
duplicateAttemptIdCount,
|
|
270
|
+
unterminatedAttemptCount,
|
|
271
|
+
unmatchedAttemptCount,
|
|
272
|
+
duplicateTerminalAttemptCount,
|
|
273
|
+
},
|
|
274
|
+
incomplete,
|
|
275
|
+
},
|
|
276
|
+
null,
|
|
277
|
+
2,
|
|
278
|
+
)}\n`,
|
|
279
|
+
);
|