@bonesofspring/ai-rules 0.2.66 → 0.2.68
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 +72 -0
- package/README.md +6 -4
- package/bin/cli.js +9 -1
- package/bin/lib/engine-scripts.js +3 -10
- package/bin/lib/seed-ai-local-team.js +27 -1
- package/docs/OPENCODE-COMPATIBILITY.md +1 -0
- package/docs/OPENCODE.md +14 -1
- package/docs/PRESET-CONTRIBUTION.md +15 -8
- package/docs/TEAM-DB.md +107 -106
- package/docs/TOKEN-ECONOMY.md +36 -3
- package/docs/openapi/team-db.v1.json +3910 -1471
- package/package.json +13 -5
- package/presets/_shared/ai-local/scripts/dump-output.mjs +63 -12
- package/presets/_shared/ai-local/scripts/processes.mjs +467 -55
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +564 -10
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +819 -50
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +659 -5
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +135 -0
- package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +11 -6
- package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +2 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +16 -54
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +5 -5
- package/presets/_shared/core/architecture/feature-delivery-workflow.md +3 -7
- package/presets/_shared/core/meta/preset-pr-checklist.md +2 -2
- package/presets/_shared/core/quality/code-quality-and-refactoring.md +2 -6
- package/presets/_shared/core/quality/verification-before-completion.md +20 -3
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +21 -5
- package/presets/_shared/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/android-kotlin/REPO_AGENTS.md +7 -47
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/android-kotlin/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/go/REPO_AGENTS.md +7 -47
- package/presets/claude/go/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/go/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/go/rules/architecture/feature-delivery.md +3 -7
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/go/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/ios-swift/REPO_AGENTS.md +7 -47
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +3 -7
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/ios-swift/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/java/REPO_AGENTS.md +7 -47
- package/presets/claude/java/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/java/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/java/rules/architecture/feature-delivery.md +3 -7
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/java/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/mcp-ts/REPO_AGENTS.md +7 -47
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +3 -7
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/mcp-ts/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/mol/REPO_AGENTS.md +9 -49
- package/presets/claude/mol/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +3 -7
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/mol/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/next/REPO_AGENTS.md +10 -50
- package/presets/claude/next/agents/accessibility-reviewer.md +0 -1
- package/presets/claude/next/agents/api-contract-reviewer.md +0 -1
- package/presets/claude/next/agents/build-verifier.md +12 -8
- package/presets/claude/next/agents/ci-investigator.md +5 -2
- package/presets/claude/next/agents/code-reviewer.md +1 -1
- package/presets/claude/next/agents/codebase-analyzer.md +0 -1
- package/presets/claude/next/agents/debugger.md +5 -2
- package/presets/claude/next/agents/feature-developer.md +11 -8
- package/presets/claude/next/agents/migration-specialist.md +0 -1
- package/presets/claude/next/agents/mockup-reviewer.md +0 -1
- package/presets/claude/next/agents/openspec-author.md +0 -1
- package/presets/claude/next/agents/performance-auditor.md +0 -1
- package/presets/claude/next/agents/playwright-test-generator.md +0 -1
- package/presets/claude/next/agents/playwright-test-healer.md +0 -1
- package/presets/claude/next/agents/playwright-test-planner.md +0 -1
- package/presets/claude/next/agents/qa-tester.md +3 -3
- package/presets/claude/next/agents/security-reviewer.md +0 -1
- package/presets/claude/next/agents/solution-architect.md +0 -1
- package/presets/claude/next/agents/task-analyst.md +0 -1
- package/presets/claude/next/agents/task-router.md +8 -7
- package/presets/claude/next/agents/tech-writer.md +0 -1
- package/presets/claude/next/agents/unit-test-generator.md +0 -1
- package/presets/claude/next/agents/unit-test-healer.md +0 -1
- package/presets/claude/next/agents/unit-test-planner.md +0 -1
- package/presets/claude/next/commands/README.md +0 -6
- package/presets/claude/next/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/next/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +9 -9
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/next/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +12 -16
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/next/skills/feature-delivery/SKILL.md +1 -1
- package/presets/claude/next/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/claude/next/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/nuxt/REPO_AGENTS.md +8 -48
- package/presets/claude/nuxt/agents/accessibility-reviewer.md +0 -1
- package/presets/claude/nuxt/agents/api-contract-reviewer.md +0 -1
- package/presets/claude/nuxt/agents/build-verifier.md +5 -3
- package/presets/claude/nuxt/agents/ci-investigator.md +1 -1
- package/presets/claude/nuxt/agents/code-reviewer.md +0 -1
- package/presets/claude/nuxt/agents/codebase-analyzer.md +0 -1
- package/presets/claude/nuxt/agents/debugger.md +1 -1
- package/presets/claude/nuxt/agents/feature-developer.md +6 -6
- package/presets/claude/nuxt/agents/migration-specialist.md +0 -1
- package/presets/claude/nuxt/agents/mockup-reviewer.md +0 -1
- package/presets/claude/nuxt/agents/openspec-author.md +0 -1
- package/presets/claude/nuxt/agents/performance-auditor.md +0 -1
- package/presets/claude/nuxt/agents/playwright-test-generator.md +0 -1
- package/presets/claude/nuxt/agents/playwright-test-healer.md +0 -1
- package/presets/claude/nuxt/agents/playwright-test-planner.md +0 -1
- package/presets/claude/nuxt/agents/qa-tester.md +3 -3
- package/presets/claude/nuxt/agents/security-reviewer.md +0 -1
- package/presets/claude/nuxt/agents/solution-architect.md +0 -1
- package/presets/claude/nuxt/agents/task-analyst.md +0 -1
- package/presets/claude/nuxt/agents/task-router.md +8 -7
- package/presets/claude/nuxt/agents/tech-writer.md +0 -1
- package/presets/claude/nuxt/agents/unit-test-generator.md +0 -1
- package/presets/claude/nuxt/agents/unit-test-healer.md +0 -1
- package/presets/claude/nuxt/agents/unit-test-planner.md +0 -1
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +3 -7
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/nuxt/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/nuxt/rules/tooling-and-review/post-change-lint.md +14 -14
- package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/nuxt/skills/feature-delivery/SKILL.md +1 -1
- package/presets/claude/nuxt/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/claude/nuxt/skills/unit-testing/SKILL.md +1 -1
- package/presets/claude/php-hexagonal/REPO_AGENTS.md +7 -47
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +3 -7
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/php-hexagonal/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/php-laravel/REPO_AGENTS.md +7 -47
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +3 -7
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/php-laravel/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/svelte/REPO_AGENTS.md +8 -48
- package/presets/claude/svelte/agents/accessibility-reviewer.md +0 -1
- package/presets/claude/svelte/agents/api-contract-reviewer.md +0 -1
- package/presets/claude/svelte/agents/build-verifier.md +5 -3
- package/presets/claude/svelte/agents/ci-investigator.md +1 -1
- package/presets/claude/svelte/agents/code-reviewer.md +0 -1
- package/presets/claude/svelte/agents/codebase-analyzer.md +0 -1
- package/presets/claude/svelte/agents/debugger.md +1 -1
- package/presets/claude/svelte/agents/feature-developer.md +6 -6
- package/presets/claude/svelte/agents/migration-specialist.md +0 -1
- package/presets/claude/svelte/agents/mockup-reviewer.md +0 -1
- package/presets/claude/svelte/agents/openspec-author.md +0 -1
- package/presets/claude/svelte/agents/performance-auditor.md +0 -1
- package/presets/claude/svelte/agents/playwright-test-generator.md +0 -1
- package/presets/claude/svelte/agents/playwright-test-healer.md +0 -1
- package/presets/claude/svelte/agents/playwright-test-planner.md +0 -1
- package/presets/claude/svelte/agents/qa-tester.md +3 -3
- package/presets/claude/svelte/agents/security-reviewer.md +0 -1
- package/presets/claude/svelte/agents/solution-architect.md +0 -1
- package/presets/claude/svelte/agents/task-analyst.md +0 -1
- package/presets/claude/svelte/agents/task-router.md +8 -7
- package/presets/claude/svelte/agents/tech-writer.md +0 -1
- package/presets/claude/svelte/agents/unit-test-generator.md +0 -1
- package/presets/claude/svelte/agents/unit-test-healer.md +0 -1
- package/presets/claude/svelte/agents/unit-test-planner.md +0 -1
- package/presets/claude/svelte/hooks/chain-team-phases.sh +21 -5
- package/presets/claude/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +3 -7
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +5 -5
- package/presets/claude/svelte/rules/tooling-and-review/code-quality.md +2 -6
- package/presets/claude/svelte/rules/tooling-and-review/post-change-lint.md +14 -14
- package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +2 -2
- package/presets/claude/svelte/skills/feature-delivery/SKILL.md +1 -1
- package/presets/claude/svelte/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/claude/svelte/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/android-kotlin/AGENTS.md +0 -10
- package/presets/cursor/android-kotlin/REPO_AGENTS.md +7 -47
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/android-kotlin/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/go/AGENTS.md +0 -8
- package/presets/cursor/go/REPO_AGENTS.md +7 -47
- package/presets/cursor/go/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/go/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/go/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/ios-swift/AGENTS.md +0 -10
- package/presets/cursor/ios-swift/REPO_AGENTS.md +7 -47
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/ios-swift/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/java/AGENTS.md +0 -8
- package/presets/cursor/java/REPO_AGENTS.md +7 -47
- package/presets/cursor/java/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/java/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/java/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/mcp-ts/AGENTS.md +0 -6
- package/presets/cursor/mcp-ts/REPO_AGENTS.md +7 -47
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/mcp-ts/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/mol/AGENTS.md +0 -11
- package/presets/cursor/mol/REPO_AGENTS.md +9 -49
- package/presets/cursor/mol/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/mol/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/mol/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/next/AGENTS.md +1 -12
- package/presets/cursor/next/REPO_AGENTS.md +10 -50
- package/presets/cursor/next/agents/build-verifier.md +11 -7
- package/presets/cursor/next/agents/code-reviewer.md +1 -0
- package/presets/cursor/next/agents/feature-developer.md +6 -6
- package/presets/cursor/next/agents/qa-tester.md +3 -2
- package/presets/cursor/next/agents/task-router.md +8 -6
- package/presets/cursor/next/commands/README.md +0 -6
- package/presets/cursor/next/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/next/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +4 -4
- package/presets/cursor/next/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/next/rules/feature-delivery-workflow.mdc +6 -2
- package/presets/cursor/next/rules/post-change-lint.mdc +12 -16
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/next/skills/feature-delivery/SKILL.md +1 -1
- package/presets/cursor/next/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/cursor/next/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/nuxt/AGENTS.md +1 -12
- package/presets/cursor/nuxt/REPO_AGENTS.md +8 -48
- package/presets/cursor/nuxt/agents/build-verifier.md +1 -1
- package/presets/cursor/nuxt/agents/feature-developer.md +2 -2
- package/presets/cursor/nuxt/agents/qa-tester.md +3 -2
- package/presets/cursor/nuxt/agents/task-router.md +8 -6
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/nuxt/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/nuxt/rules/post-change-lint.mdc +14 -14
- package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/nuxt/skills/feature-delivery/SKILL.md +1 -1
- package/presets/cursor/nuxt/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/cursor/nuxt/skills/unit-testing/SKILL.md +1 -1
- package/presets/cursor/php-hexagonal/AGENTS.md +0 -8
- package/presets/cursor/php-hexagonal/REPO_AGENTS.md +7 -47
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/php-hexagonal/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/php-laravel/AGENTS.md +0 -8
- package/presets/cursor/php-laravel/REPO_AGENTS.md +7 -47
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/php-laravel/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/svelte/AGENTS.md +1 -12
- package/presets/cursor/svelte/REPO_AGENTS.md +8 -48
- package/presets/cursor/svelte/agents/build-verifier.md +1 -1
- package/presets/cursor/svelte/agents/feature-developer.md +2 -2
- package/presets/cursor/svelte/agents/qa-tester.md +3 -2
- package/presets/cursor/svelte/agents/task-router.md +8 -6
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +21 -5
- package/presets/cursor/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/svelte/rules/code-quality-and-refactoring.mdc +2 -6
- package/presets/cursor/svelte/rules/post-change-lint.mdc +14 -14
- package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +2 -2
- package/presets/cursor/svelte/skills/feature-delivery/SKILL.md +1 -1
- package/presets/cursor/svelte/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/cursor/svelte/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/android-kotlin/MAVIS.md +0 -2
- package/presets/mavis/android-kotlin/REPO_AGENTS.md +7 -47
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/android-kotlin/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/go/MAVIS.md +8 -0
- package/presets/mavis/go/REPO_AGENTS.md +7 -47
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/go/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/go/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/go/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/go/rules/feature-delivery-workflow.md +3 -7
- package/presets/mavis/go/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/ios-swift/MAVIS.md +0 -2
- package/presets/mavis/ios-swift/REPO_AGENTS.md +7 -47
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/ios-swift/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +3 -7
- package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/java/MAVIS.md +14 -0
- package/presets/mavis/java/REPO_AGENTS.md +7 -47
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/java/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/java/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/java/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/java/rules/feature-delivery-workflow.md +3 -7
- package/presets/mavis/java/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/mcp-ts/MAVIS.md +6 -0
- package/presets/mavis/mcp-ts/REPO_AGENTS.md +7 -47
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/mcp-ts/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +3 -7
- package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/mol/MAVIS.md +1 -5
- package/presets/mavis/mol/REPO_AGENTS.md +9 -49
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/mol/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/mol/rules/feature-delivery-workflow.md +3 -7
- package/presets/mavis/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/next/MAVIS.md +2 -6
- package/presets/mavis/next/REPO_AGENTS.md +10 -50
- package/presets/mavis/next/adapter-map.json +1 -17
- package/presets/mavis/next/agents/accessibility-reviewer.md +0 -1
- package/presets/mavis/next/agents/api-contract-reviewer.md +0 -1
- package/presets/mavis/next/agents/build-verifier.md +12 -8
- package/presets/mavis/next/agents/ci-investigator.md +5 -2
- package/presets/mavis/next/agents/code-reviewer.md +1 -1
- package/presets/mavis/next/agents/codebase-analyzer.md +0 -1
- package/presets/mavis/next/agents/debugger.md +5 -2
- package/presets/mavis/next/agents/feature-developer.md +11 -8
- package/presets/mavis/next/agents/migration-specialist.md +0 -1
- package/presets/mavis/next/agents/mockup-reviewer.md +0 -1
- package/presets/mavis/next/agents/openspec-author.md +0 -1
- package/presets/mavis/next/agents/performance-auditor.md +0 -1
- package/presets/mavis/next/agents/playwright-test-generator.md +0 -1
- package/presets/mavis/next/agents/playwright-test-healer.md +0 -1
- package/presets/mavis/next/agents/playwright-test-planner.md +0 -1
- package/presets/mavis/next/agents/qa-tester.md +3 -3
- package/presets/mavis/next/agents/security-reviewer.md +0 -1
- package/presets/mavis/next/agents/solution-architect.md +0 -1
- package/presets/mavis/next/agents/task-analyst.md +0 -1
- package/presets/mavis/next/agents/task-router.md +8 -7
- package/presets/mavis/next/agents/tech-writer.md +0 -1
- package/presets/mavis/next/agents/unit-test-generator.md +0 -1
- package/presets/mavis/next/agents/unit-test-healer.md +0 -1
- package/presets/mavis/next/agents/unit-test-planner.md +0 -1
- package/presets/mavis/next/commands/README.md +0 -6
- package/presets/mavis/next/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/next/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/next/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/next/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/next/rules/feature-delivery-workflow.md +9 -9
- package/presets/mavis/next/rules/post-change-lint.md +11 -15
- package/presets/mavis/next/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/next/skills/feature-delivery/SKILL.md +1 -1
- package/presets/mavis/next/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/mavis/next/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/nuxt/MAVIS.md +2 -6
- package/presets/mavis/nuxt/REPO_AGENTS.md +8 -48
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/accessibility-reviewer.md +0 -1
- package/presets/mavis/nuxt/agents/api-contract-reviewer.md +0 -1
- package/presets/mavis/nuxt/agents/build-verifier.md +2 -2
- package/presets/mavis/nuxt/agents/ci-investigator.md +1 -1
- package/presets/mavis/nuxt/agents/code-reviewer.md +0 -1
- package/presets/mavis/nuxt/agents/codebase-analyzer.md +0 -1
- package/presets/mavis/nuxt/agents/debugger.md +1 -1
- package/presets/mavis/nuxt/agents/feature-developer.md +3 -3
- package/presets/mavis/nuxt/agents/migration-specialist.md +0 -1
- package/presets/mavis/nuxt/agents/mockup-reviewer.md +0 -1
- package/presets/mavis/nuxt/agents/openspec-author.md +0 -1
- package/presets/mavis/nuxt/agents/performance-auditor.md +0 -1
- package/presets/mavis/nuxt/agents/playwright-test-generator.md +0 -1
- package/presets/mavis/nuxt/agents/playwright-test-healer.md +0 -1
- package/presets/mavis/nuxt/agents/playwright-test-planner.md +0 -1
- package/presets/mavis/nuxt/agents/qa-tester.md +3 -3
- package/presets/mavis/nuxt/agents/security-reviewer.md +0 -1
- package/presets/mavis/nuxt/agents/solution-architect.md +0 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +0 -1
- package/presets/mavis/nuxt/agents/task-router.md +8 -7
- package/presets/mavis/nuxt/agents/tech-writer.md +0 -1
- package/presets/mavis/nuxt/agents/unit-test-generator.md +0 -1
- package/presets/mavis/nuxt/agents/unit-test-healer.md +0 -1
- package/presets/mavis/nuxt/agents/unit-test-planner.md +0 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/nuxt/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +3 -7
- package/presets/mavis/nuxt/rules/post-change-lint.md +13 -13
- package/presets/mavis/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/nuxt/skills/feature-delivery/SKILL.md +1 -1
- package/presets/mavis/nuxt/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/mavis/nuxt/skills/unit-testing/SKILL.md +1 -1
- package/presets/mavis/php-hexagonal/MAVIS.md +16 -0
- package/presets/mavis/php-hexagonal/REPO_AGENTS.md +7 -47
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/php-hexagonal/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +3 -7
- package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/php-laravel/MAVIS.md +16 -0
- package/presets/mavis/php-laravel/REPO_AGENTS.md +7 -47
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/php-laravel/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +3 -7
- package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/svelte/MAVIS.md +2 -6
- package/presets/mavis/svelte/REPO_AGENTS.md +8 -48
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/accessibility-reviewer.md +0 -1
- package/presets/mavis/svelte/agents/api-contract-reviewer.md +0 -1
- package/presets/mavis/svelte/agents/build-verifier.md +2 -2
- package/presets/mavis/svelte/agents/ci-investigator.md +1 -1
- package/presets/mavis/svelte/agents/code-reviewer.md +0 -1
- package/presets/mavis/svelte/agents/codebase-analyzer.md +0 -1
- package/presets/mavis/svelte/agents/debugger.md +1 -1
- package/presets/mavis/svelte/agents/feature-developer.md +3 -3
- package/presets/mavis/svelte/agents/migration-specialist.md +0 -1
- package/presets/mavis/svelte/agents/mockup-reviewer.md +0 -1
- package/presets/mavis/svelte/agents/openspec-author.md +0 -1
- package/presets/mavis/svelte/agents/performance-auditor.md +0 -1
- package/presets/mavis/svelte/agents/playwright-test-generator.md +0 -1
- package/presets/mavis/svelte/agents/playwright-test-healer.md +0 -1
- package/presets/mavis/svelte/agents/playwright-test-planner.md +0 -1
- package/presets/mavis/svelte/agents/qa-tester.md +3 -3
- package/presets/mavis/svelte/agents/security-reviewer.md +0 -1
- package/presets/mavis/svelte/agents/solution-architect.md +0 -1
- package/presets/mavis/svelte/agents/task-analyst.md +0 -1
- package/presets/mavis/svelte/agents/task-router.md +8 -7
- package/presets/mavis/svelte/agents/tech-writer.md +0 -1
- package/presets/mavis/svelte/agents/unit-test-generator.md +0 -1
- package/presets/mavis/svelte/agents/unit-test-healer.md +0 -1
- package/presets/mavis/svelte/agents/unit-test-planner.md +0 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +21 -5
- package/presets/mavis/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +5 -5
- package/presets/mavis/svelte/rules/code-quality-and-refactoring.md +2 -6
- package/presets/mavis/svelte/rules/feature-delivery-workflow.md +3 -7
- package/presets/mavis/svelte/rules/post-change-lint.md +13 -13
- package/presets/mavis/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/mavis/svelte/skills/feature-delivery/SKILL.md +1 -1
- package/presets/mavis/svelte/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/mavis/svelte/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/android-kotlin/OPENCODE.md +1 -43
- package/presets/opencode/android-kotlin/REPO_AGENTS.md +7 -47
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/android-kotlin/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/go/OPENCODE.md +7 -39
- package/presets/opencode/go/REPO_AGENTS.md +7 -47
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/go/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/go/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/go/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/go/rules/feature-delivery-workflow.md +3 -7
- package/presets/opencode/go/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/ios-swift/OPENCODE.md +1 -43
- package/presets/opencode/ios-swift/REPO_AGENTS.md +7 -47
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/ios-swift/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +3 -7
- package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/java/OPENCODE.md +12 -38
- package/presets/opencode/java/REPO_AGENTS.md +7 -47
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/java/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/java/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/java/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/java/rules/feature-delivery-workflow.md +3 -7
- package/presets/opencode/java/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/mcp-ts/OPENCODE.md +5 -39
- package/presets/opencode/mcp-ts/REPO_AGENTS.md +7 -47
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/mcp-ts/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +3 -7
- package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/mol/OPENCODE.md +1 -44
- package/presets/opencode/mol/REPO_AGENTS.md +9 -49
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/mol/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/mol/rules/feature-delivery-workflow.md +3 -7
- package/presets/opencode/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/next/OPENCODE.md +2 -45
- package/presets/opencode/next/REPO_AGENTS.md +10 -50
- package/presets/opencode/next/adapter-map.json +1 -17
- package/presets/opencode/next/agents/accessibility-reviewer.md +0 -1
- package/presets/opencode/next/agents/api-contract-reviewer.md +0 -1
- package/presets/opencode/next/agents/build-verifier.md +12 -8
- package/presets/opencode/next/agents/ci-investigator.md +5 -2
- package/presets/opencode/next/agents/code-reviewer.md +1 -1
- package/presets/opencode/next/agents/codebase-analyzer.md +0 -1
- package/presets/opencode/next/agents/debugger.md +5 -2
- package/presets/opencode/next/agents/feature-developer.md +11 -8
- package/presets/opencode/next/agents/migration-specialist.md +0 -1
- package/presets/opencode/next/agents/mockup-reviewer.md +0 -1
- package/presets/opencode/next/agents/openspec-author.md +0 -1
- package/presets/opencode/next/agents/performance-auditor.md +0 -1
- package/presets/opencode/next/agents/playwright-test-generator.md +0 -1
- package/presets/opencode/next/agents/playwright-test-healer.md +0 -1
- package/presets/opencode/next/agents/playwright-test-planner.md +0 -1
- package/presets/opencode/next/agents/qa-tester.md +3 -3
- package/presets/opencode/next/agents/security-reviewer.md +0 -1
- package/presets/opencode/next/agents/solution-architect.md +0 -1
- package/presets/opencode/next/agents/task-analyst.md +0 -1
- package/presets/opencode/next/agents/task-router.md +8 -7
- package/presets/opencode/next/agents/tech-writer.md +0 -1
- package/presets/opencode/next/agents/unit-test-generator.md +0 -1
- package/presets/opencode/next/agents/unit-test-healer.md +0 -1
- package/presets/opencode/next/agents/unit-test-planner.md +0 -1
- package/presets/opencode/next/commands/README.md +0 -6
- package/presets/opencode/next/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/next/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/next/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/next/rules/feature-delivery-workflow.md +9 -9
- package/presets/opencode/next/rules/post-change-lint.md +11 -15
- package/presets/opencode/next/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/next/skills/feature-delivery/SKILL.md +1 -1
- package/presets/opencode/next/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/opencode/next/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/nuxt/OPENCODE.md +2 -45
- package/presets/opencode/nuxt/REPO_AGENTS.md +8 -48
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/accessibility-reviewer.md +0 -1
- package/presets/opencode/nuxt/agents/api-contract-reviewer.md +0 -1
- package/presets/opencode/nuxt/agents/build-verifier.md +2 -2
- package/presets/opencode/nuxt/agents/ci-investigator.md +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +0 -1
- package/presets/opencode/nuxt/agents/codebase-analyzer.md +0 -1
- package/presets/opencode/nuxt/agents/debugger.md +1 -1
- package/presets/opencode/nuxt/agents/feature-developer.md +3 -3
- package/presets/opencode/nuxt/agents/migration-specialist.md +0 -1
- package/presets/opencode/nuxt/agents/mockup-reviewer.md +0 -1
- package/presets/opencode/nuxt/agents/openspec-author.md +0 -1
- package/presets/opencode/nuxt/agents/performance-auditor.md +0 -1
- package/presets/opencode/nuxt/agents/playwright-test-generator.md +0 -1
- package/presets/opencode/nuxt/agents/playwright-test-healer.md +0 -1
- package/presets/opencode/nuxt/agents/playwright-test-planner.md +0 -1
- package/presets/opencode/nuxt/agents/qa-tester.md +3 -3
- package/presets/opencode/nuxt/agents/security-reviewer.md +0 -1
- package/presets/opencode/nuxt/agents/solution-architect.md +0 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +0 -1
- package/presets/opencode/nuxt/agents/task-router.md +8 -7
- package/presets/opencode/nuxt/agents/tech-writer.md +0 -1
- package/presets/opencode/nuxt/agents/unit-test-generator.md +0 -1
- package/presets/opencode/nuxt/agents/unit-test-healer.md +0 -1
- package/presets/opencode/nuxt/agents/unit-test-planner.md +0 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/nuxt/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +3 -7
- package/presets/opencode/nuxt/rules/post-change-lint.md +13 -13
- package/presets/opencode/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/nuxt/skills/feature-delivery/SKILL.md +1 -1
- package/presets/opencode/nuxt/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/opencode/nuxt/skills/unit-testing/SKILL.md +1 -1
- package/presets/opencode/php-hexagonal/OPENCODE.md +14 -38
- package/presets/opencode/php-hexagonal/REPO_AGENTS.md +7 -47
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/php-hexagonal/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +3 -7
- package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/php-laravel/OPENCODE.md +14 -38
- package/presets/opencode/php-laravel/REPO_AGENTS.md +7 -47
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/php-laravel/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +3 -7
- package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/plugins/output-guard/README.md +43 -0
- package/presets/opencode/plugins/output-guard/index.ts +306 -0
- package/presets/opencode/plugins/output-guard/ledger.ts +43 -0
- package/presets/opencode/plugins/output-guard/package.json +9 -0
- package/presets/opencode/plugins/output-guard/rewrite.ts +149 -0
- package/presets/opencode/plugins/task-status/economy.ts +112 -0
- package/presets/opencode/plugins/task-status/task-view.ts +86 -20
- package/presets/opencode/plugins/task-status/tui.tsx +19 -5
- package/presets/opencode/plugins/task-status/types.ts +3 -1
- package/presets/opencode/svelte/OPENCODE.md +2 -45
- package/presets/opencode/svelte/REPO_AGENTS.md +8 -48
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/accessibility-reviewer.md +0 -1
- package/presets/opencode/svelte/agents/api-contract-reviewer.md +0 -1
- package/presets/opencode/svelte/agents/build-verifier.md +2 -2
- package/presets/opencode/svelte/agents/ci-investigator.md +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +0 -1
- package/presets/opencode/svelte/agents/codebase-analyzer.md +0 -1
- package/presets/opencode/svelte/agents/debugger.md +1 -1
- package/presets/opencode/svelte/agents/feature-developer.md +3 -3
- package/presets/opencode/svelte/agents/migration-specialist.md +0 -1
- package/presets/opencode/svelte/agents/mockup-reviewer.md +0 -1
- package/presets/opencode/svelte/agents/openspec-author.md +0 -1
- package/presets/opencode/svelte/agents/performance-auditor.md +0 -1
- package/presets/opencode/svelte/agents/playwright-test-generator.md +0 -1
- package/presets/opencode/svelte/agents/playwright-test-healer.md +0 -1
- package/presets/opencode/svelte/agents/playwright-test-planner.md +0 -1
- package/presets/opencode/svelte/agents/qa-tester.md +3 -3
- package/presets/opencode/svelte/agents/security-reviewer.md +0 -1
- package/presets/opencode/svelte/agents/solution-architect.md +0 -1
- package/presets/opencode/svelte/agents/task-analyst.md +0 -1
- package/presets/opencode/svelte/agents/task-router.md +8 -7
- package/presets/opencode/svelte/agents/tech-writer.md +0 -1
- package/presets/opencode/svelte/agents/unit-test-generator.md +0 -1
- package/presets/opencode/svelte/agents/unit-test-healer.md +0 -1
- package/presets/opencode/svelte/agents/unit-test-planner.md +0 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +21 -5
- package/presets/opencode/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +5 -5
- package/presets/opencode/svelte/rules/code-quality-and-refactoring.md +2 -6
- package/presets/opencode/svelte/rules/feature-delivery-workflow.md +3 -7
- package/presets/opencode/svelte/rules/post-change-lint.md +13 -13
- package/presets/opencode/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/opencode/svelte/skills/feature-delivery/SKILL.md +1 -1
- package/presets/opencode/svelte/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/opencode/svelte/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/android-kotlin/REPO_AGENTS.md +7 -47
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/android-kotlin/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/go/REPO_AGENTS.md +7 -47
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/go/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/go/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/go/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/go/rules/feature-delivery-workflow.md +3 -7
- package/presets/zcode/go/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/ios-swift/REPO_AGENTS.md +7 -47
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/ios-swift/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +3 -7
- package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/java/REPO_AGENTS.md +7 -47
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/java/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/java/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/java/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/java/rules/feature-delivery-workflow.md +3 -7
- package/presets/zcode/java/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/mcp-ts/REPO_AGENTS.md +7 -47
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/mcp-ts/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +3 -7
- package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/mol/REPO_AGENTS.md +9 -49
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/mol/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/mol/rules/feature-delivery-workflow.md +3 -7
- package/presets/zcode/mol/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/next/REPO_AGENTS.md +10 -50
- package/presets/zcode/next/adapter-map.json +1 -17
- package/presets/zcode/next/agents/accessibility-reviewer.md +0 -1
- package/presets/zcode/next/agents/api-contract-reviewer.md +0 -1
- package/presets/zcode/next/agents/build-verifier.md +12 -8
- package/presets/zcode/next/agents/ci-investigator.md +5 -2
- package/presets/zcode/next/agents/code-reviewer.md +1 -1
- package/presets/zcode/next/agents/codebase-analyzer.md +0 -1
- package/presets/zcode/next/agents/debugger.md +5 -2
- package/presets/zcode/next/agents/feature-developer.md +11 -8
- package/presets/zcode/next/agents/migration-specialist.md +0 -1
- package/presets/zcode/next/agents/mockup-reviewer.md +0 -1
- package/presets/zcode/next/agents/openspec-author.md +0 -1
- package/presets/zcode/next/agents/performance-auditor.md +0 -1
- package/presets/zcode/next/agents/playwright-test-generator.md +0 -1
- package/presets/zcode/next/agents/playwright-test-healer.md +0 -1
- package/presets/zcode/next/agents/playwright-test-planner.md +0 -1
- package/presets/zcode/next/agents/qa-tester.md +3 -3
- package/presets/zcode/next/agents/security-reviewer.md +0 -1
- package/presets/zcode/next/agents/solution-architect.md +0 -1
- package/presets/zcode/next/agents/task-analyst.md +0 -1
- package/presets/zcode/next/agents/task-router.md +8 -7
- package/presets/zcode/next/agents/tech-writer.md +0 -1
- package/presets/zcode/next/agents/unit-test-generator.md +0 -1
- package/presets/zcode/next/agents/unit-test-healer.md +0 -1
- package/presets/zcode/next/agents/unit-test-planner.md +0 -1
- package/presets/zcode/next/commands/README.md +0 -6
- package/presets/zcode/next/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/next/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/next/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/next/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/next/rules/feature-delivery-workflow.md +9 -9
- package/presets/zcode/next/rules/post-change-lint.md +11 -15
- package/presets/zcode/next/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/next/skills/feature-delivery/SKILL.md +1 -1
- package/presets/zcode/next/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/zcode/next/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/nuxt/REPO_AGENTS.md +8 -48
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/agents/accessibility-reviewer.md +0 -1
- package/presets/zcode/nuxt/agents/api-contract-reviewer.md +0 -1
- package/presets/zcode/nuxt/agents/build-verifier.md +2 -2
- package/presets/zcode/nuxt/agents/ci-investigator.md +1 -1
- package/presets/zcode/nuxt/agents/code-reviewer.md +0 -1
- package/presets/zcode/nuxt/agents/codebase-analyzer.md +0 -1
- package/presets/zcode/nuxt/agents/debugger.md +1 -1
- package/presets/zcode/nuxt/agents/feature-developer.md +3 -3
- package/presets/zcode/nuxt/agents/migration-specialist.md +0 -1
- package/presets/zcode/nuxt/agents/mockup-reviewer.md +0 -1
- package/presets/zcode/nuxt/agents/openspec-author.md +0 -1
- package/presets/zcode/nuxt/agents/performance-auditor.md +0 -1
- package/presets/zcode/nuxt/agents/playwright-test-generator.md +0 -1
- package/presets/zcode/nuxt/agents/playwright-test-healer.md +0 -1
- package/presets/zcode/nuxt/agents/playwright-test-planner.md +0 -1
- package/presets/zcode/nuxt/agents/qa-tester.md +3 -3
- package/presets/zcode/nuxt/agents/security-reviewer.md +0 -1
- package/presets/zcode/nuxt/agents/solution-architect.md +0 -1
- package/presets/zcode/nuxt/agents/task-analyst.md +0 -1
- package/presets/zcode/nuxt/agents/task-router.md +8 -7
- package/presets/zcode/nuxt/agents/tech-writer.md +0 -1
- package/presets/zcode/nuxt/agents/unit-test-generator.md +0 -1
- package/presets/zcode/nuxt/agents/unit-test-healer.md +0 -1
- package/presets/zcode/nuxt/agents/unit-test-planner.md +0 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/nuxt/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +3 -7
- package/presets/zcode/nuxt/rules/post-change-lint.md +13 -13
- package/presets/zcode/nuxt/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/nuxt/skills/feature-delivery/SKILL.md +1 -1
- package/presets/zcode/nuxt/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/zcode/nuxt/skills/unit-testing/SKILL.md +1 -1
- package/presets/zcode/php-hexagonal/REPO_AGENTS.md +7 -47
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/php-hexagonal/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +3 -7
- package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/php-laravel/REPO_AGENTS.md +7 -47
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/php-laravel/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +3 -7
- package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/svelte/REPO_AGENTS.md +8 -48
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/agents/accessibility-reviewer.md +0 -1
- package/presets/zcode/svelte/agents/api-contract-reviewer.md +0 -1
- package/presets/zcode/svelte/agents/build-verifier.md +2 -2
- package/presets/zcode/svelte/agents/ci-investigator.md +1 -1
- package/presets/zcode/svelte/agents/code-reviewer.md +0 -1
- package/presets/zcode/svelte/agents/codebase-analyzer.md +0 -1
- package/presets/zcode/svelte/agents/debugger.md +1 -1
- package/presets/zcode/svelte/agents/feature-developer.md +3 -3
- package/presets/zcode/svelte/agents/migration-specialist.md +0 -1
- package/presets/zcode/svelte/agents/mockup-reviewer.md +0 -1
- package/presets/zcode/svelte/agents/openspec-author.md +0 -1
- package/presets/zcode/svelte/agents/performance-auditor.md +0 -1
- package/presets/zcode/svelte/agents/playwright-test-generator.md +0 -1
- package/presets/zcode/svelte/agents/playwright-test-healer.md +0 -1
- package/presets/zcode/svelte/agents/playwright-test-planner.md +0 -1
- package/presets/zcode/svelte/agents/qa-tester.md +3 -3
- package/presets/zcode/svelte/agents/security-reviewer.md +0 -1
- package/presets/zcode/svelte/agents/solution-architect.md +0 -1
- package/presets/zcode/svelte/agents/task-analyst.md +0 -1
- package/presets/zcode/svelte/agents/task-router.md +8 -7
- package/presets/zcode/svelte/agents/tech-writer.md +0 -1
- package/presets/zcode/svelte/agents/unit-test-generator.md +0 -1
- package/presets/zcode/svelte/agents/unit-test-healer.md +0 -1
- package/presets/zcode/svelte/agents/unit-test-planner.md +0 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +21 -5
- package/presets/zcode/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +5 -5
- package/presets/zcode/svelte/rules/code-quality-and-refactoring.md +2 -6
- package/presets/zcode/svelte/rules/feature-delivery-workflow.md +3 -7
- package/presets/zcode/svelte/rules/post-change-lint.md +13 -13
- package/presets/zcode/svelte/rules/preset-pr-checklist.md +2 -2
- package/presets/zcode/svelte/skills/feature-delivery/SKILL.md +1 -1
- package/presets/zcode/svelte/skills/playwright-e2e/SKILL.md +1 -1
- package/presets/zcode/svelte/skills/unit-testing/SKILL.md +1 -1
- package/scripts/report-context-cost.mjs +432 -0
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +0 -2103
- package/presets/_shared/ai-local/scripts/team-db-ui.mjs +0 -750
- package/presets/claude/next/commands/ui-start.md +0 -78
- package/presets/claude/next/commands/ui-stop.md +0 -71
- package/presets/cursor/next/commands/ui-start.md +0 -78
- package/presets/cursor/next/commands/ui-stop.md +0 -71
- package/presets/mavis/next/commands/ui-start.md +0 -73
- package/presets/mavis/next/commands/ui-stop.md +0 -66
- package/presets/opencode/next/commands/ui-start.md +0 -81
- package/presets/opencode/next/commands/ui-stop.md +0 -74
- package/presets/zcode/next/commands/ui-start.md +0 -81
- package/presets/zcode/next/commands/ui-stop.md +0 -74
|
@@ -13,12 +13,18 @@
|
|
|
13
13
|
* scan [--json] [--known-only | --all]
|
|
14
14
|
* doctor [--json]
|
|
15
15
|
* stop --name <res> | --task <slug> [--force]
|
|
16
|
-
*
|
|
16
|
+
* kill --name <res> [--pid <n>] [--pid-start <s>] [--json]
|
|
17
|
+
* serve [--port 4179] [--host 127.0.0.1] (JSON + SSE; the UI is team-tasks-ui)
|
|
17
18
|
*
|
|
18
19
|
* The lease itself lives in `process-lease.mjs`. This module reads the six
|
|
19
20
|
* markers other tools already write into the same snapshot and never writes
|
|
20
21
|
* them; the only state it owns is `.processes/`.
|
|
21
22
|
*
|
|
23
|
+
* A live row also carries the resource use of its whole process tree: `%CPU`
|
|
24
|
+
* and RSS summed over the pid and every descendant, from the same `ps` table
|
|
25
|
+
* that resolves the OS parent. The manager spawns a shell for `start`, so the
|
|
26
|
+
* interesting server is a child; a single-pid reading would be near zero.
|
|
27
|
+
*
|
|
22
28
|
* `acquire` records the **parent** process (the shell) as the owner because this
|
|
23
29
|
* CLI exits immediately; `run` records the manager, which stays alive for the
|
|
24
30
|
* child. `--pid <n>` overrides either, and an owner that is not provably alive
|
|
@@ -48,7 +54,7 @@ import {
|
|
|
48
54
|
releaseLease,
|
|
49
55
|
} from './process-lease.mjs';
|
|
50
56
|
|
|
51
|
-
export const SNAPSHOT_SCHEMA_VERSION =
|
|
57
|
+
export const SNAPSHOT_SCHEMA_VERSION = 3;
|
|
52
58
|
export const DEFAULT_SERVE_PORT = 4179;
|
|
53
59
|
export const DEFAULT_SERVE_HOST = '127.0.0.1';
|
|
54
60
|
export const DEFAULT_WATCH_MS = 1000;
|
|
@@ -57,6 +63,10 @@ const SERVE_POLL_MS = 1000;
|
|
|
57
63
|
const SSE_RETRY_MS = 2000;
|
|
58
64
|
const TERMINATE_WAIT_MS = 5000;
|
|
59
65
|
const TERMINATE_POLL_MS = 100;
|
|
66
|
+
const KILL_WAIT_MS = 2000;
|
|
67
|
+
const KILL_POLL_MS = 50;
|
|
68
|
+
const PROMPT_EXCERPT_MAX = 280;
|
|
69
|
+
const KILL_BODY_MAX = 4096;
|
|
60
70
|
const SSE_MIN_INTERVAL_MS = 100;
|
|
61
71
|
const START_TIMEOUT_MS = 30000;
|
|
62
72
|
const START_POLL_MS = 200;
|
|
@@ -94,6 +104,7 @@ const VERB_FLAGS = {
|
|
|
94
104
|
scan: new Set(['json', 'known-only', 'all', 'root']),
|
|
95
105
|
doctor: new Set(['json', 'root']),
|
|
96
106
|
stop: new Set(['name', 'task', 'force', 'root', 'json']),
|
|
107
|
+
kill: new Set(['name', 'pid', 'pid-start', 'root', 'json']),
|
|
97
108
|
serve: new Set(['port', 'host', 'root']),
|
|
98
109
|
};
|
|
99
110
|
|
|
@@ -203,6 +214,15 @@ const listenPids = (port) => {
|
|
|
203
214
|
.filter((pid) => Number.isInteger(pid) && pid > 0);
|
|
204
215
|
};
|
|
205
216
|
|
|
217
|
+
/** The process-group id of a pid, or null on a host without `ps`. */
|
|
218
|
+
const processGroupId = (pid) => {
|
|
219
|
+
if (!Number.isInteger(pid) || pid <= 0) return null;
|
|
220
|
+
const result = spawnSync('ps', ['-o', 'pgid=', '-p', String(pid)], { encoding: 'utf8' });
|
|
221
|
+
if (result.error || result.status !== 0) return null;
|
|
222
|
+
const parsed = Number.parseInt(String(result.stdout ?? '').trim(), 10);
|
|
223
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
|
|
224
|
+
};
|
|
225
|
+
|
|
206
226
|
const signalPid = (pid, signal) => {
|
|
207
227
|
try {
|
|
208
228
|
process.kill(pid, signal);
|
|
@@ -363,6 +383,128 @@ const entry = ({
|
|
|
363
383
|
|
|
364
384
|
const aliveState = (pid) => (isPidAlive(pid) ? 'live' : 'stale');
|
|
365
385
|
|
|
386
|
+
/* ------------------------------- provenance ------------------------------- */
|
|
387
|
+
|
|
388
|
+
const TASK_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/u;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* One `ps` table per snapshot: the parent of every row, its resource counters
|
|
392
|
+
* and its command line. The manager never guesses a parent from a marker.
|
|
393
|
+
*
|
|
394
|
+
* `%cpu` follows the host locale: macOS prints `0,6` where Linux prints `0.6`,
|
|
395
|
+
* so the parser normalises the decimal comma before `Number.parseFloat`. It is
|
|
396
|
+
* the `ps` reading, not a fresh sample: macOS decays over a minute, Linux
|
|
397
|
+
* reports the lifetime ratio.
|
|
398
|
+
*/
|
|
399
|
+
export function parseProcessTable(output) {
|
|
400
|
+
const nodes = new Map();
|
|
401
|
+
for (const line of String(output ?? '').split('\n')) {
|
|
402
|
+
const match = /^\s*(\d+)\s+(\d+)\s+([\d.,]+)\s+(\d+)\s+(.+)$/u.exec(line);
|
|
403
|
+
if (!match) continue;
|
|
404
|
+
const pid = Number.parseInt(match[1], 10);
|
|
405
|
+
const ppid = Number.parseInt(match[2], 10);
|
|
406
|
+
const cpuPercent = Number.parseFloat(match[3].replaceAll(',', '.'));
|
|
407
|
+
const rssKb = Number.parseInt(match[4], 10);
|
|
408
|
+
if (!Number.isInteger(pid) || pid <= 0 || !Number.isFinite(cpuPercent) || !Number.isInteger(rssKb)) {
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
nodes.set(pid, { ppid, cpuPercent, rssKb, command: match[5].trim() });
|
|
412
|
+
}
|
|
413
|
+
const children = new Map();
|
|
414
|
+
for (const [pid, node] of nodes) {
|
|
415
|
+
if (node.ppid === pid) continue;
|
|
416
|
+
const siblings = children.get(node.ppid);
|
|
417
|
+
if (siblings) siblings.push(pid);
|
|
418
|
+
else children.set(node.ppid, [pid]);
|
|
419
|
+
}
|
|
420
|
+
return { nodes, children };
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const processTable = () => {
|
|
424
|
+
const result = spawnSync('ps', ['-axo', 'pid=,ppid=,%cpu=,rss=,command='], { encoding: 'utf8' });
|
|
425
|
+
if (result.error || result.status !== 0) return null;
|
|
426
|
+
return parseProcessTable(result.stdout);
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* `%CPU` and RSS of one pid plus every descendant. `null` means the pid is not
|
|
431
|
+
* in the table, never "zero use": a missing reading must not look like idle.
|
|
432
|
+
*/
|
|
433
|
+
export function sumProcessTree(table, pid) {
|
|
434
|
+
if (table === null || !Number.isInteger(pid) || !table.nodes.has(pid)) return null;
|
|
435
|
+
const seen = new Set();
|
|
436
|
+
const stack = [pid];
|
|
437
|
+
let cpuPercent = 0;
|
|
438
|
+
let rssKb = 0;
|
|
439
|
+
while (stack.length > 0) {
|
|
440
|
+
const current = stack.pop();
|
|
441
|
+
if (seen.has(current)) continue;
|
|
442
|
+
seen.add(current);
|
|
443
|
+
const node = table.nodes.get(current);
|
|
444
|
+
if (!node) continue;
|
|
445
|
+
cpuPercent += node.cpuPercent;
|
|
446
|
+
rssKb += node.rssKb;
|
|
447
|
+
for (const child of table.children.get(current) ?? []) stack.push(child);
|
|
448
|
+
}
|
|
449
|
+
return { cpuPercent, rssKb };
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
const roundTenth = (value) => Math.round(value * 10) / 10;
|
|
453
|
+
|
|
454
|
+
const parentOf = (table, pid) => {
|
|
455
|
+
if (table === null || !Number.isInteger(pid)) return null;
|
|
456
|
+
const self = table.nodes.get(pid);
|
|
457
|
+
if (!self || !Number.isInteger(self.ppid) || self.ppid <= 0) return null;
|
|
458
|
+
return { pid: self.ppid, command: table.nodes.get(self.ppid)?.command ?? null };
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* The verbatim user prompt of the task that owns a process, collapsed to one
|
|
463
|
+
* line and cut at `PROMPT_EXCERPT_MAX`. The file is read from this checkout
|
|
464
|
+
* only: a slug outside the task directory shape is ignored, never resolved.
|
|
465
|
+
*/
|
|
466
|
+
const promptForTask = (roots, task) => {
|
|
467
|
+
if (typeof task !== 'string' || !TASK_SLUG_PATTERN.test(task)) return null;
|
|
468
|
+
const file = path.join(roots.aiLocalRoot, 'team', 'tasks', task, 'prompt.md');
|
|
469
|
+
let text;
|
|
470
|
+
try {
|
|
471
|
+
text = fs.readFileSync(file, 'utf8');
|
|
472
|
+
} catch {
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
const collapsed = text.replace(/\s+/g, ' ').trim();
|
|
476
|
+
if (collapsed === '') return null;
|
|
477
|
+
return {
|
|
478
|
+
text: collapsed.slice(0, PROMPT_EXCERPT_MAX),
|
|
479
|
+
truncated: collapsed.length > PROMPT_EXCERPT_MAX,
|
|
480
|
+
path: path.relative(roots.repoRoot, file),
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
const enrichRow = (row, roots, table, startTimes, totalMemoryBytes) => {
|
|
485
|
+
const pid = Number.isInteger(row.pid) && row.pid > 0 ? row.pid : null;
|
|
486
|
+
let pidStart = null;
|
|
487
|
+
if (pid !== null) {
|
|
488
|
+
if (!startTimes.has(pid)) startTimes.set(pid, processStartTime(pid));
|
|
489
|
+
pidStart = startTimes.get(pid);
|
|
490
|
+
}
|
|
491
|
+
const usage = row.state === 'live' && pid !== null ? sumProcessTree(table, pid) : null;
|
|
492
|
+
const rssBytes = usage === null ? null : usage.rssKb * 1024;
|
|
493
|
+
const memoryPercent =
|
|
494
|
+
rssBytes === null || !Number.isFinite(totalMemoryBytes) || totalMemoryBytes <= 0
|
|
495
|
+
? null
|
|
496
|
+
: roundTenth((rssBytes / totalMemoryBytes) * 100);
|
|
497
|
+
return {
|
|
498
|
+
...row,
|
|
499
|
+
pidStart,
|
|
500
|
+
parent: parentOf(table, pid),
|
|
501
|
+
prompt: promptForTask(roots, row.task),
|
|
502
|
+
cpuPercent: usage === null ? null : roundTenth(usage.cpuPercent),
|
|
503
|
+
rssBytes,
|
|
504
|
+
memoryPercent,
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
|
|
366
508
|
const collectLeases = (roots, processes, warnings) => {
|
|
367
509
|
for (const lease of listLeases(roots.aiLocalRoot)) {
|
|
368
510
|
const record = lease.record;
|
|
@@ -616,11 +758,14 @@ export function buildSnapshot(roots) {
|
|
|
616
758
|
}
|
|
617
759
|
}
|
|
618
760
|
processes.sort((left, right) => left.name.localeCompare(right.name));
|
|
761
|
+
const table = processTable();
|
|
762
|
+
const startTimes = new Map();
|
|
763
|
+
const totalMemoryBytes = os.totalmem();
|
|
619
764
|
return {
|
|
620
765
|
schemaVersion: SNAPSHOT_SCHEMA_VERSION,
|
|
621
766
|
generatedAt: new Date().toISOString(),
|
|
622
767
|
root: roots.repoRoot,
|
|
623
|
-
processes,
|
|
768
|
+
processes: processes.map((item) => enrichRow(item, roots, table, startTimes, totalMemoryBytes)),
|
|
624
769
|
warnings,
|
|
625
770
|
};
|
|
626
771
|
}
|
|
@@ -649,6 +794,24 @@ const ageLabel = (ms) => {
|
|
|
649
794
|
return `${hours}h${String(minutes % 60).padStart(2, '0')}m`;
|
|
650
795
|
};
|
|
651
796
|
|
|
797
|
+
const formatBytes = (bytes) => {
|
|
798
|
+
if (!Number.isFinite(bytes) || bytes < 0) return '-';
|
|
799
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
800
|
+
let value = bytes;
|
|
801
|
+
let unit = 0;
|
|
802
|
+
while (value >= 1024 && unit < units.length - 1) {
|
|
803
|
+
value /= 1024;
|
|
804
|
+
unit += 1;
|
|
805
|
+
}
|
|
806
|
+
return `${value >= 100 ? Math.round(value) : value.toFixed(1)} ${units[unit]}`;
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
const memoryCell = (item) => {
|
|
810
|
+
if (item.rssBytes === null) return '-';
|
|
811
|
+
const bytes = formatBytes(item.rssBytes);
|
|
812
|
+
return item.memoryPercent === null ? bytes : `${bytes} · ${item.memoryPercent.toFixed(1)}%`;
|
|
813
|
+
};
|
|
814
|
+
|
|
652
815
|
const rowCells = (item) => [
|
|
653
816
|
item.name,
|
|
654
817
|
item.source,
|
|
@@ -657,11 +820,15 @@ const rowCells = (item) => [
|
|
|
657
820
|
item.state,
|
|
658
821
|
item.pid === null ? '-' : String(item.pid),
|
|
659
822
|
item.port === null ? '-' : String(item.port),
|
|
823
|
+
item.cpuPercent === null ? '-' : `${item.cpuPercent.toFixed(1)}%`,
|
|
824
|
+
memoryCell(item),
|
|
660
825
|
item.task ?? '-',
|
|
661
826
|
ageLabel(item.ageMs),
|
|
662
827
|
];
|
|
663
828
|
|
|
664
|
-
const TABLE_HEADER = [
|
|
829
|
+
const TABLE_HEADER = [
|
|
830
|
+
'NAME', 'SOURCE', 'ADAPTER', 'KIND', 'STATE', 'PID', 'PORT', 'CPU', 'MEM', 'TASK', 'AGE',
|
|
831
|
+
];
|
|
665
832
|
|
|
666
833
|
const renderTable = (snapshot) => {
|
|
667
834
|
const lines = [`processes — ${snapshot.root} — ${snapshot.generatedAt}`];
|
|
@@ -686,43 +853,50 @@ const renderTable = (snapshot) => {
|
|
|
686
853
|
|
|
687
854
|
const renderJson = (snapshot) => JSON.stringify(snapshot);
|
|
688
855
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
`<tr>${rowCells(item).map((cell) => `<td>${escapeHtml(cell)}</td>`).join('')}</tr>`,
|
|
703
|
-
)
|
|
704
|
-
.join('');
|
|
705
|
-
const warnings = hardWarnings(snapshot)
|
|
706
|
-
.map((warning) => `<p class="warn">${escapeHtml(warning.source)}: ${escapeHtml(warning.reason)}</p>`)
|
|
707
|
-
.join('');
|
|
708
|
-
return `<!doctype html>
|
|
709
|
-
<html lang="en"><head><meta charset="utf-8"><title>processes</title>
|
|
710
|
-
<style>
|
|
711
|
-
body{font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;margin:2rem;color:#111}
|
|
712
|
-
table{border-collapse:collapse}
|
|
713
|
-
th,td{padding:.25rem .75rem;border-bottom:1px solid #e3e3e3;text-align:left}
|
|
714
|
-
th{font-weight:600;background:#fafafa}
|
|
715
|
-
.warn{color:#a33}
|
|
716
|
-
</style></head>
|
|
717
|
-
<body>
|
|
718
|
-
<h1>processes</h1>
|
|
719
|
-
<p>${escapeHtml(snapshot.root)} — ${escapeHtml(snapshot.generatedAt)}</p>
|
|
720
|
-
${snapshot.processes.length === 0 ? '<p>nothing recorded</p>' : `<table><thead><tr>${TABLE_HEADER.map((cell) => `<th>${cell}</th>`).join('')}</tr></thead><tbody>${rows}</tbody></table>`}
|
|
721
|
-
${warnings}
|
|
722
|
-
</body></html>
|
|
723
|
-
`;
|
|
856
|
+
/**
|
|
857
|
+
* The response accepts loopback spellings and the Docker host gateway (the
|
|
858
|
+
* container's proxy reaches the loopback view through that name); any other
|
|
859
|
+
* Host is a rebound DNS name and is refused.
|
|
860
|
+
*/
|
|
861
|
+
const isLoopbackHostHeader = (value) =>
|
|
862
|
+
/^(?:127\.0\.0\.1|localhost|\[::1\]|host\.docker\.internal|gateway\.docker\.internal)(?::\d{1,5})?$/u.test(
|
|
863
|
+
String(value ?? ''),
|
|
864
|
+
);
|
|
865
|
+
|
|
866
|
+
const writeJson = (response, status, payload) => {
|
|
867
|
+
response.writeHead(status, { 'Content-Type': 'application/json; charset=utf-8' });
|
|
868
|
+
response.end(`${JSON.stringify(payload)}\n`);
|
|
724
869
|
};
|
|
725
870
|
|
|
871
|
+
/** A bounded read of the kill body; a stream that never ends must not hang the view. */
|
|
872
|
+
const readJsonBody = (request, limit) =>
|
|
873
|
+
new Promise((resolve) => {
|
|
874
|
+
const chunks = [];
|
|
875
|
+
let size = 0;
|
|
876
|
+
let tooLarge = false;
|
|
877
|
+
request.on('data', (chunk) => {
|
|
878
|
+
size += chunk.length;
|
|
879
|
+
if (size > limit) {
|
|
880
|
+
tooLarge = true;
|
|
881
|
+
chunks.length = 0;
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
if (!tooLarge) chunks.push(chunk);
|
|
885
|
+
});
|
|
886
|
+
request.on('end', () => {
|
|
887
|
+
if (tooLarge) {
|
|
888
|
+
resolve({ tooLarge: true });
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
try {
|
|
892
|
+
resolve({ value: JSON.parse(Buffer.concat(chunks).toString('utf8') || '{}') });
|
|
893
|
+
} catch {
|
|
894
|
+
resolve({ error: 'the kill body is not JSON' });
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
request.on('error', () => resolve({ error: 'the kill body could not be read' }));
|
|
898
|
+
});
|
|
899
|
+
|
|
726
900
|
/* ----------------------------------- cli ---------------------------------- */
|
|
727
901
|
|
|
728
902
|
const parseFlags = (verb, argv) => {
|
|
@@ -1212,8 +1386,15 @@ const proveOwnership = (record) => {
|
|
|
1212
1386
|
if (recorded !== '' && commandForProof(command).includes(recorded)) return { ok: true, by: 'command' };
|
|
1213
1387
|
}
|
|
1214
1388
|
const port = record?.port;
|
|
1215
|
-
if (Number.isInteger(port) && port > 0
|
|
1216
|
-
|
|
1389
|
+
if (Number.isInteger(port) && port > 0) {
|
|
1390
|
+
const listeners = listenPids(port);
|
|
1391
|
+
if (listeners.includes(owner.pid)) return { ok: true, by: 'port' };
|
|
1392
|
+
// A detached `start` spawns with `shell: true`: the lease records the group
|
|
1393
|
+
// leader, while the listener is its child. The group is proof only when the
|
|
1394
|
+
// owner leads it and the listener is inside it.
|
|
1395
|
+
if (processGroupId(owner.pid) === owner.pid && listeners.some((pid) => processGroupId(pid) === owner.pid)) {
|
|
1396
|
+
return { ok: true, by: 'port-group' };
|
|
1397
|
+
}
|
|
1217
1398
|
}
|
|
1218
1399
|
return { ok: false, reason: 'the live pid matches neither the recorded command nor the lease port' };
|
|
1219
1400
|
};
|
|
@@ -1240,7 +1421,11 @@ const stopOneLease = async (roots, name, record, { force = false } = {}) => {
|
|
|
1240
1421
|
return { name, stopped: false, refused: true, pid: record.owner.pid, reason: proof.reason };
|
|
1241
1422
|
}
|
|
1242
1423
|
const pid = record.owner.pid;
|
|
1243
|
-
|
|
1424
|
+
if (proof.by === 'port-group') {
|
|
1425
|
+
await terminateDetached(pid);
|
|
1426
|
+
} else {
|
|
1427
|
+
await terminate(pid, { force });
|
|
1428
|
+
}
|
|
1244
1429
|
// Re-read before unlinking: during the kill window a supervisor can restart
|
|
1245
1430
|
// the process, reclaim the lease and write a new token. Unlinking by path
|
|
1246
1431
|
// would delete the fresh holder's lease and let a third process in.
|
|
@@ -1294,6 +1479,155 @@ const stopVerb = async (flags) => {
|
|
|
1294
1479
|
return results.some((row) => row.refused) ? 4 : 0;
|
|
1295
1480
|
};
|
|
1296
1481
|
|
|
1482
|
+
/* ---------------------------------- kill ---------------------------------- */
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* SIGKILL is reserved for a row the fresh snapshot proves: the name exists, the
|
|
1486
|
+
* pid is live, the start time has not changed since the snapshot, and a lease
|
|
1487
|
+
* row still passes the full ownership proof. An adapter row is proven by the
|
|
1488
|
+
* marker that named it plus the live pid; a foreign listener is not in this
|
|
1489
|
+
* snapshot at all and is never a target.
|
|
1490
|
+
*/
|
|
1491
|
+
const killRefusal = (roots, row, { pid, pidStart }) => {
|
|
1492
|
+
if (!Number.isInteger(row.pid) || row.pid <= 0) return 'the row has no pid';
|
|
1493
|
+
if (row.state !== 'live') return `the row is ${row.state}, not live`;
|
|
1494
|
+
if (pid !== null && pid !== row.pid) return `pid ${pid} is not the current pid ${row.pid}`;
|
|
1495
|
+
if (pidStart !== null && row.pidStart !== null && pidStart !== row.pidStart) {
|
|
1496
|
+
return 'the pid start time changed since the snapshot';
|
|
1497
|
+
}
|
|
1498
|
+
if (!isPidAlive(row.pid)) return `pid ${row.pid} is not alive`;
|
|
1499
|
+
const liveStart = processStartTime(row.pid);
|
|
1500
|
+
if (row.pidStart !== null && liveStart !== null && liveStart !== row.pidStart) {
|
|
1501
|
+
return `pid ${row.pid} was reused (start time ${liveStart}, snapshot ${row.pidStart})`;
|
|
1502
|
+
}
|
|
1503
|
+
if (row.source === 'lease') {
|
|
1504
|
+
const record = readLease(roots.aiLocalRoot, row.name);
|
|
1505
|
+
if (record === null) return 'the lease disappeared';
|
|
1506
|
+
if (record.owner?.pid !== row.pid) return 'the lease owner changed since the snapshot';
|
|
1507
|
+
const proof = proveOwnership(record);
|
|
1508
|
+
if (!proof.ok) return proof.reason;
|
|
1509
|
+
}
|
|
1510
|
+
return null;
|
|
1511
|
+
};
|
|
1512
|
+
|
|
1513
|
+
const killOne = async (roots, { name, pid = null, pidStart = null }) => {
|
|
1514
|
+
const snapshot = buildSnapshot(roots);
|
|
1515
|
+
const row = snapshot.processes.find((item) => item.name === name) ?? null;
|
|
1516
|
+
if (row === null) {
|
|
1517
|
+
return {
|
|
1518
|
+
ok: false,
|
|
1519
|
+
status: 404,
|
|
1520
|
+
code: 'E_NOT_FOUND',
|
|
1521
|
+
name,
|
|
1522
|
+
message: `no process named ${name}`,
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
const refusal = killRefusal(roots, row, { pid, pidStart });
|
|
1526
|
+
if (refusal !== null) {
|
|
1527
|
+
return {
|
|
1528
|
+
ok: false,
|
|
1529
|
+
status: 409,
|
|
1530
|
+
code: 'E_CONFLICT',
|
|
1531
|
+
name,
|
|
1532
|
+
pid: row.pid,
|
|
1533
|
+
message: `kill refused: ${refusal}`,
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
const target = row.pid;
|
|
1537
|
+
const listeners = Number.isInteger(row.port) ? listenPids(row.port) : [];
|
|
1538
|
+
const groupKill =
|
|
1539
|
+
processGroupId(target) === target &&
|
|
1540
|
+
!listeners.includes(target) &&
|
|
1541
|
+
listeners.some((pid) => processGroupId(pid) === target);
|
|
1542
|
+
const signalled = groupKill
|
|
1543
|
+
? (() => {
|
|
1544
|
+
try {
|
|
1545
|
+
process.kill(-target, 'SIGKILL');
|
|
1546
|
+
return true;
|
|
1547
|
+
} catch {
|
|
1548
|
+
return signalPid(target, 'SIGKILL');
|
|
1549
|
+
}
|
|
1550
|
+
})()
|
|
1551
|
+
: signalPid(target, 'SIGKILL');
|
|
1552
|
+
if (!signalled) {
|
|
1553
|
+
return {
|
|
1554
|
+
ok: false,
|
|
1555
|
+
status: 409,
|
|
1556
|
+
code: 'E_CONFLICT',
|
|
1557
|
+
name,
|
|
1558
|
+
pid: target,
|
|
1559
|
+
message: `kill refused: could not signal pid ${target}`,
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
const stillAlive = () =>
|
|
1563
|
+
isPidAlive(target) ||
|
|
1564
|
+
(Number.isInteger(row.port) &&
|
|
1565
|
+
listenPids(row.port).some((pid) => pid === target || processGroupId(pid) === target));
|
|
1566
|
+
const deadline = Date.now() + KILL_WAIT_MS;
|
|
1567
|
+
while (stillAlive() && Date.now() < deadline) await sleep(KILL_POLL_MS);
|
|
1568
|
+
if (stillAlive()) {
|
|
1569
|
+
return {
|
|
1570
|
+
ok: false,
|
|
1571
|
+
status: 503,
|
|
1572
|
+
code: 'E_INTERNAL',
|
|
1573
|
+
name,
|
|
1574
|
+
pid: target,
|
|
1575
|
+
message: `pid ${target} is still alive after SIGKILL`,
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
// Only the manager's own lease is cleared here; an adapter marker belongs to
|
|
1579
|
+
// the tool that wrote it and is left for that tool (or `doctor`) to settle.
|
|
1580
|
+
let cleared = false;
|
|
1581
|
+
if (row.source === 'lease') {
|
|
1582
|
+
const record = readLease(roots.aiLocalRoot, name);
|
|
1583
|
+
if (record !== null) {
|
|
1584
|
+
const released = releaseLease({
|
|
1585
|
+
aiLocalRoot: roots.aiLocalRoot,
|
|
1586
|
+
name,
|
|
1587
|
+
token: record.owner?.token,
|
|
1588
|
+
pid: target,
|
|
1589
|
+
});
|
|
1590
|
+
cleared = released.released === true;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
appendEvent({
|
|
1594
|
+
aiLocalRoot: roots.aiLocalRoot,
|
|
1595
|
+
type: 'killed',
|
|
1596
|
+
name,
|
|
1597
|
+
pid: target,
|
|
1598
|
+
signal: 'SIGKILL',
|
|
1599
|
+
source: row.source,
|
|
1600
|
+
});
|
|
1601
|
+
return {
|
|
1602
|
+
ok: true,
|
|
1603
|
+
status: 200,
|
|
1604
|
+
code: null,
|
|
1605
|
+
name,
|
|
1606
|
+
pid: target,
|
|
1607
|
+
signal: 'SIGKILL',
|
|
1608
|
+
source: row.source,
|
|
1609
|
+
cleared,
|
|
1610
|
+
};
|
|
1611
|
+
};
|
|
1612
|
+
|
|
1613
|
+
const killVerb = async (flags) => {
|
|
1614
|
+
const roots = resolveRoots(flags);
|
|
1615
|
+
if (typeof flags.name !== 'string' || flags.name === '') fail('kill needs --name <res>');
|
|
1616
|
+
const pid = flags.pid === undefined ? null : positiveInt(flags.pid, '--pid');
|
|
1617
|
+
const pidStart = flags['pid-start'] === undefined ? null : String(flags['pid-start']);
|
|
1618
|
+
const result = await killOne(roots, { name: flags.name, pid, pidStart });
|
|
1619
|
+
if (flags.json) {
|
|
1620
|
+
out(renderJson(result));
|
|
1621
|
+
} else if (result.ok) {
|
|
1622
|
+
out(`processes: killed ${result.name} (pid ${result.pid}, SIGKILL)`);
|
|
1623
|
+
} else {
|
|
1624
|
+
err(`processes: kill: ${result.message}`);
|
|
1625
|
+
}
|
|
1626
|
+
if (result.ok) return 0;
|
|
1627
|
+
if (result.status === 404) return 1;
|
|
1628
|
+
return result.status === 503 ? 3 : 4;
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1297
1631
|
const parseReadyWait = (flags) => {
|
|
1298
1632
|
if (flags['wait-ms'] === undefined) return START_TIMEOUT_MS;
|
|
1299
1633
|
return positiveInt(flags['wait-ms'], '--wait-ms', { allowZero: true });
|
|
@@ -1497,11 +1831,90 @@ const serveVerb = (flags) => {
|
|
|
1497
1831
|
if (!LOOPBACK_HOSTS.has(host)) fail('serve binds a loopback host only (127.0.0.1, localhost, ::1)');
|
|
1498
1832
|
const port = parsePort(flags, DEFAULT_SERVE_PORT);
|
|
1499
1833
|
|
|
1500
|
-
const server = http.createServer((request, response) => {
|
|
1834
|
+
const server = http.createServer(async (request, response) => {
|
|
1501
1835
|
const pathname = new URL(request.url ?? '/', `http://${host}:${port}`).pathname;
|
|
1836
|
+
if (!isLoopbackHostHeader(request.headers.host)) {
|
|
1837
|
+
writeJson(response, 403, {
|
|
1838
|
+
error: { code: 'E_FORBIDDEN_HOST', message: 'the process view accepts a loopback or Docker gateway Host only' },
|
|
1839
|
+
});
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
if (request.method === 'POST' && pathname === '/api/v1/processes/kill') {
|
|
1843
|
+
const contentType = String(request.headers['content-type'] ?? '');
|
|
1844
|
+
if (!/^application\/json\b/iu.test(contentType)) {
|
|
1845
|
+
writeJson(response, 415, {
|
|
1846
|
+
error: { code: 'E_VALIDATION', message: 'the kill body must be application/json' },
|
|
1847
|
+
});
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
const body = await readJsonBody(request, KILL_BODY_MAX);
|
|
1851
|
+
if (body.tooLarge) {
|
|
1852
|
+
writeJson(response, 413, {
|
|
1853
|
+
error: { code: 'E_PAYLOAD_TOO_LARGE', message: `the kill body exceeds ${KILL_BODY_MAX} bytes` },
|
|
1854
|
+
});
|
|
1855
|
+
return;
|
|
1856
|
+
}
|
|
1857
|
+
if (body.error !== undefined) {
|
|
1858
|
+
writeJson(response, 400, { error: { code: 'E_BAD_REQUEST', message: body.error } });
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
const value = body.value;
|
|
1862
|
+
if (!isRecord(value) || typeof value.name !== 'string' || value.name === '') {
|
|
1863
|
+
writeJson(response, 400, {
|
|
1864
|
+
error: { code: 'E_VALIDATION', message: 'the kill body needs a "name" string' },
|
|
1865
|
+
});
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
if (value.pid !== undefined && (!Number.isInteger(value.pid) || value.pid <= 0)) {
|
|
1869
|
+
writeJson(response, 400, {
|
|
1870
|
+
error: { code: 'E_VALIDATION', message: 'pid must be a positive integer' },
|
|
1871
|
+
});
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
if (value.pidStart !== undefined && typeof value.pidStart !== 'string') {
|
|
1875
|
+
writeJson(response, 400, {
|
|
1876
|
+
error: { code: 'E_VALIDATION', message: 'pidStart must be a string' },
|
|
1877
|
+
});
|
|
1878
|
+
return;
|
|
1879
|
+
}
|
|
1880
|
+
let result;
|
|
1881
|
+
try {
|
|
1882
|
+
result = await killOne(roots, {
|
|
1883
|
+
name: value.name,
|
|
1884
|
+
pid: value.pid ?? null,
|
|
1885
|
+
pidStart: value.pidStart ?? null,
|
|
1886
|
+
});
|
|
1887
|
+
} catch (error) {
|
|
1888
|
+
writeJson(response, 500, {
|
|
1889
|
+
error: {
|
|
1890
|
+
code: 'E_INTERNAL',
|
|
1891
|
+
message: error instanceof Error ? error.message : String(error),
|
|
1892
|
+
},
|
|
1893
|
+
});
|
|
1894
|
+
return;
|
|
1895
|
+
}
|
|
1896
|
+
if (result.ok) {
|
|
1897
|
+
writeJson(response, 200, {
|
|
1898
|
+
ok: true,
|
|
1899
|
+
name: result.name,
|
|
1900
|
+
pid: result.pid,
|
|
1901
|
+
signal: result.signal,
|
|
1902
|
+
source: result.source,
|
|
1903
|
+
cleared: result.cleared,
|
|
1904
|
+
});
|
|
1905
|
+
} else {
|
|
1906
|
+
writeJson(response, result.status, {
|
|
1907
|
+
error: { code: result.code, message: result.message },
|
|
1908
|
+
name: result.name,
|
|
1909
|
+
pid: result.pid ?? null,
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1502
1914
|
if (request.method !== 'GET' && request.method !== 'HEAD') {
|
|
1503
|
-
response
|
|
1504
|
-
|
|
1915
|
+
writeJson(response, 405, {
|
|
1916
|
+
error: { code: 'E_METHOD_NOT_ALLOWED', message: 'the process view serves GET and POST /api/v1/processes/kill' },
|
|
1917
|
+
});
|
|
1505
1918
|
return;
|
|
1506
1919
|
}
|
|
1507
1920
|
if (pathname === '/api/v1/processes') {
|
|
@@ -1520,7 +1933,8 @@ const serveVerb = (flags) => {
|
|
|
1520
1933
|
let last = null;
|
|
1521
1934
|
const send = () => {
|
|
1522
1935
|
const snapshot = buildSnapshot(roots);
|
|
1523
|
-
// `generatedAt`
|
|
1936
|
+
// `generatedAt` is not a change; resource counters are, and a live
|
|
1937
|
+
// process makes them differ on most ticks.
|
|
1524
1938
|
const stable = renderJson({ ...snapshot, generatedAt: null });
|
|
1525
1939
|
if (stable === last) return;
|
|
1526
1940
|
last = stable;
|
|
@@ -1533,13 +1947,9 @@ const serveVerb = (flags) => {
|
|
|
1533
1947
|
response.on('close', stop);
|
|
1534
1948
|
return;
|
|
1535
1949
|
}
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
return;
|
|
1540
|
-
}
|
|
1541
|
-
response.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
1542
|
-
response.end('not found\n');
|
|
1950
|
+
writeJson(response, 404, {
|
|
1951
|
+
error: { code: 'E_NOT_FOUND', message: 'no HTML page: the process view is served by team-tasks-ui' },
|
|
1952
|
+
});
|
|
1543
1953
|
});
|
|
1544
1954
|
|
|
1545
1955
|
return new Promise((resolve) => {
|
|
@@ -1560,7 +1970,7 @@ const serveVerb = (flags) => {
|
|
|
1560
1970
|
/* ---------------------------------- entry --------------------------------- */
|
|
1561
1971
|
|
|
1562
1972
|
const USAGE = [
|
|
1563
|
-
'usage: processes.mjs <start|acquire|release|run|list|status|watch|scan|doctor|stop|serve> [flags]',
|
|
1973
|
+
'usage: processes.mjs <start|acquire|release|run|list|status|watch|scan|doctor|stop|kill|serve> [flags]',
|
|
1564
1974
|
' start --name <res> --command <cmd> [--port <n>] [--cwd <dir>] [--task <slug>]',
|
|
1565
1975
|
' [--label <l>] [--url <u>] [--wait-ms <n>] [--json] [--root <dir>]',
|
|
1566
1976
|
' acquire --name <res> [--kind exclusive|port|advisory] [--port <n>] [--label <l>] [--task <slug>]',
|
|
@@ -1574,7 +1984,8 @@ const USAGE = [
|
|
|
1574
1984
|
' scan [--json] [--known-only | --all] [--root <dir>]',
|
|
1575
1985
|
' doctor [--json] [--root <dir>]',
|
|
1576
1986
|
' stop (--name <res> | --task <slug>) [--force] [--root <dir>] [--json]',
|
|
1577
|
-
'
|
|
1987
|
+
' kill --name <res> [--pid <n>] [--pid-start <s>] [--root <dir>] [--json]',
|
|
1988
|
+
' serve [--port 4179] [--host 127.0.0.1] [--root <dir>] JSON + SSE; no HTML page',
|
|
1578
1989
|
].join('\n');
|
|
1579
1990
|
|
|
1580
1991
|
const main = async (argv) => {
|
|
@@ -1594,6 +2005,7 @@ const main = async (argv) => {
|
|
|
1594
2005
|
if (verb === 'scan') return scanVerb(flags);
|
|
1595
2006
|
if (verb === 'doctor') return doctorVerb(flags);
|
|
1596
2007
|
if (verb === 'stop') return stopVerb(flags);
|
|
2008
|
+
if (verb === 'kill') return killVerb(flags);
|
|
1597
2009
|
return serveVerb(flags);
|
|
1598
2010
|
};
|
|
1599
2011
|
|