@bonesofspring/ai-rules 0.2.64 → 0.2.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -11
- package/README.md +24 -16
- package/bin/lib/engine-scripts.js +52 -12
- package/bin/lib/engine-upgrade.js +5 -2
- package/bin/lib/seed-ai-local-team.js +13 -3
- package/docs/OPENCODE.md +17 -9
- package/docs/PRESET-CONTRIBUTION.md +41 -0
- package/docs/TEAM-DB.md +240 -60
- package/docs/TOKEN-ECONOMY.md +79 -0
- package/docs/openapi/team-db.v1.json +1238 -377
- package/mcp/defectdojo-mcp.mjs +7 -5
- package/mcp/lib/defectdojo.mjs +26 -14
- package/package.json +31 -20
- package/presets/_shared/ai-local/scripts/dump-output.mjs +371 -0
- package/presets/_shared/ai-local/scripts/process-lease.mjs +576 -0
- package/presets/_shared/ai-local/scripts/processes.mjs +1618 -0
- package/presets/_shared/ai-local/scripts/run.mjs +5 -5
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +465 -152
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +235 -10
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +416 -176
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +171 -62
- package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +4 -0
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +143 -5
- package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +567 -0
- package/presets/_shared/ai-local/scripts/{team-db-backlog.mjs → team-db-tracker.mjs} +900 -197
- package/presets/_shared/ai-local/scripts/team-db-ui.mjs +750 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +184 -23
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +4 -2
- package/presets/_shared/core/architecture/feature-delivery-workflow.md +4 -0
- package/presets/_shared/core/quality/context-and-iteration.md +1 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +105 -17
- package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +40 -2
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/android-kotlin/settings.json +6 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/go/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/go/settings.json +6 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/ios-swift/settings.json +6 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/java/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/java/settings.json +6 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/mcp-ts/settings.json +6 -1
- package/presets/claude/mol/agents/task-analyst.md +1 -1
- package/presets/claude/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/mol/settings.json +6 -1
- package/presets/claude/next/MCP.md +2 -0
- package/presets/claude/next/REPO_AGENTS.md +2 -0
- package/presets/claude/next/agents/build-verifier.md +1 -1
- package/presets/claude/next/agents/ci-investigator.md +3 -0
- package/presets/claude/next/agents/debugger.md +3 -0
- package/presets/claude/next/agents/feature-developer.md +3 -0
- package/presets/claude/next/agents/mockup-reviewer.md +2 -0
- package/presets/claude/next/agents/performance-auditor.md +2 -0
- package/presets/claude/next/agents/playwright-test-generator.md +3 -0
- package/presets/claude/next/agents/playwright-test-healer.md +3 -0
- package/presets/claude/next/agents/playwright-test-planner.md +3 -0
- package/presets/claude/next/agents/qa-tester.md +3 -0
- package/presets/claude/next/agents/task-analyst.md +1 -1
- package/presets/claude/next/commands/README.md +7 -1
- package/presets/claude/next/commands/task.md +1 -1
- package/presets/claude/next/commands/ui-start.md +78 -0
- package/presets/claude/next/commands/ui-stop.md +71 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/next/rules/README.md +2 -1
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/next/rules/stack/next-app-core.md +1 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/next/rules/tooling-and-review/dev-process-lifecycle.md +43 -0
- package/presets/claude/next/settings.json +6 -1
- package/presets/claude/next/team/README.md +7 -3
- package/presets/claude/nuxt/agents/task-analyst.md +1 -1
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/nuxt/settings.json +6 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/php-hexagonal/settings.json +6 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/php-laravel/settings.json +6 -1
- package/presets/claude/svelte/agents/task-analyst.md +1 -1
- package/presets/claude/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/claude/svelte/hooks/guard-shell-command.mjs +41 -2
- package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +4 -2
- package/presets/claude/svelte/settings.json +6 -1
- package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/agents/task-analyst.md +1 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/go/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/java/agents/task-analyst.md +1 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/java/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mol/agents/task-analyst.md +1 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/mol/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/MCP.md +2 -0
- package/presets/cursor/next/REPO_AGENTS.md +2 -0
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/ci-investigator.md +2 -0
- package/presets/cursor/next/agents/debugger.md +2 -0
- package/presets/cursor/next/agents/feature-developer.md +2 -0
- package/presets/cursor/next/agents/mockup-reviewer.md +2 -0
- package/presets/cursor/next/agents/performance-auditor.md +2 -0
- package/presets/cursor/next/agents/playwright-test-generator.md +2 -0
- package/presets/cursor/next/agents/playwright-test-healer.md +2 -0
- package/presets/cursor/next/agents/playwright-test-planner.md +2 -0
- package/presets/cursor/next/agents/qa-tester.md +2 -0
- package/presets/cursor/next/agents/task-analyst.md +1 -1
- package/presets/cursor/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/cursor/next/commands/README.md +7 -1
- package/presets/cursor/next/commands/task.md +1 -1
- package/presets/cursor/next/commands/ui-start.md +78 -0
- package/presets/cursor/next/commands/ui-stop.md +71 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/next/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/next/rules/README.md +2 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +3 -1
- package/presets/cursor/next/rules/dev-process-lifecycle.mdc +43 -0
- package/presets/cursor/next/rules/next-app-core.mdc +1 -0
- package/presets/cursor/next/team/README.md +7 -3
- package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/agents/task-analyst.md +1 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/cursor/svelte/hooks/guard-shell-command.mjs +41 -2
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/agents/task-analyst.md +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/go/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/agents/task-analyst.md +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/java/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/agents/task-analyst.md +1 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/next/MCP.md +2 -0
- package/presets/mavis/next/REPO_AGENTS.md +2 -0
- package/presets/mavis/next/adapter-map.json +33 -1
- package/presets/mavis/next/agents/build-verifier.md +1 -1
- package/presets/mavis/next/agents/ci-investigator.md +3 -0
- package/presets/mavis/next/agents/debugger.md +3 -0
- package/presets/mavis/next/agents/feature-developer.md +3 -0
- package/presets/mavis/next/agents/mockup-reviewer.md +2 -0
- package/presets/mavis/next/agents/performance-auditor.md +2 -0
- package/presets/mavis/next/agents/playwright-test-generator.md +3 -0
- package/presets/mavis/next/agents/playwright-test-healer.md +3 -0
- package/presets/mavis/next/agents/playwright-test-planner.md +3 -0
- package/presets/mavis/next/agents/qa-tester.md +3 -0
- package/presets/mavis/next/agents/task-analyst.md +1 -1
- package/presets/mavis/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/mavis/next/commands/README.md +7 -1
- package/presets/mavis/next/commands/task.md +1 -1
- package/presets/mavis/next/commands/ui-start.md +73 -0
- package/presets/mavis/next/commands/ui-stop.md +66 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/next/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/mavis/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/next/rules/next-app-core.md +1 -0
- package/presets/mavis/next/team/README.md +7 -3
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/task-analyst.md +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +4 -2
- package/presets/mavis/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/android-kotlin/opencode.json +5 -1
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/go/opencode.json +5 -1
- package/presets/opencode/go/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/ios-swift/opencode.json +5 -1
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/java/opencode.json +5 -1
- package/presets/opencode/java/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/mcp-ts/opencode.json +5 -1
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/agents/task-analyst.md +1 -1
- package/presets/opencode/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/mol/opencode.json +4 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/next/MCP.md +2 -0
- package/presets/opencode/next/REPO_AGENTS.md +2 -0
- package/presets/opencode/next/adapter-map.json +33 -1
- package/presets/opencode/next/agents/build-verifier.md +1 -1
- package/presets/opencode/next/agents/ci-investigator.md +3 -0
- package/presets/opencode/next/agents/debugger.md +3 -0
- package/presets/opencode/next/agents/feature-developer.md +3 -0
- package/presets/opencode/next/agents/mockup-reviewer.md +2 -0
- package/presets/opencode/next/agents/performance-auditor.md +2 -0
- package/presets/opencode/next/agents/playwright-test-generator.md +3 -0
- package/presets/opencode/next/agents/playwright-test-healer.md +3 -0
- package/presets/opencode/next/agents/playwright-test-planner.md +3 -0
- package/presets/opencode/next/agents/qa-tester.md +3 -0
- package/presets/opencode/next/agents/task-analyst.md +1 -1
- package/presets/opencode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/opencode/next/commands/README.md +7 -1
- package/presets/opencode/next/commands/task.md +1 -1
- package/presets/opencode/next/commands/ui-start.md +81 -0
- package/presets/opencode/next/commands/ui-stop.md +74 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/next/opencode.json +4 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/opencode/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/next/rules/next-app-core.md +1 -0
- package/presets/opencode/next/team/README.md +7 -3
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/nuxt/opencode.json +4 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/php-hexagonal/opencode.json +5 -1
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/opencode/php-laravel/opencode.json +5 -1
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/plugins/task-status/README.md +23 -11
- package/presets/opencode/plugins/task-status/details-data.ts +64 -46
- package/presets/opencode/plugins/task-status/details.tsx +12 -2
- package/presets/opencode/plugins/task-status/format.ts +16 -0
- package/presets/opencode/plugins/task-status/prompt-text.ts +37 -0
- package/presets/opencode/plugins/task-status/task-view.ts +241 -177
- package/presets/opencode/plugins/task-status/tui.tsx +57 -15
- package/presets/opencode/plugins/task-status/types.ts +74 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/opencode/svelte/opencode.json +4 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +4 -2
- package/presets/opencode/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/agents/task-analyst.md +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/go/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/agents/task-analyst.md +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/java/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/agents/task-analyst.md +1 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/next/MCP.md +2 -0
- package/presets/zcode/next/REPO_AGENTS.md +2 -0
- package/presets/zcode/next/adapter-map.json +33 -1
- package/presets/zcode/next/agents/build-verifier.md +1 -1
- package/presets/zcode/next/agents/ci-investigator.md +3 -0
- package/presets/zcode/next/agents/debugger.md +3 -0
- package/presets/zcode/next/agents/feature-developer.md +3 -0
- package/presets/zcode/next/agents/mockup-reviewer.md +2 -0
- package/presets/zcode/next/agents/performance-auditor.md +2 -0
- package/presets/zcode/next/agents/playwright-test-generator.md +3 -0
- package/presets/zcode/next/agents/playwright-test-healer.md +3 -0
- package/presets/zcode/next/agents/playwright-test-planner.md +3 -0
- package/presets/zcode/next/agents/qa-tester.md +3 -0
- package/presets/zcode/next/agents/task-analyst.md +1 -1
- package/presets/zcode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -1
- package/presets/zcode/next/commands/README.md +7 -1
- package/presets/zcode/next/commands/task.md +1 -1
- package/presets/zcode/next/commands/ui-start.md +81 -0
- package/presets/zcode/next/commands/ui-stop.md +74 -0
- package/presets/zcode/next/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/next/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/next/rules/dev-process-lifecycle.md +38 -0
- package/presets/zcode/next/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/next/rules/next-app-core.md +1 -0
- package/presets/zcode/next/team/README.md +7 -3
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +106 -18
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/agents/task-analyst.md +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +105 -17
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +4 -2
- package/presets/zcode/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/_shared/ai-local/scripts/upstream-research.mjs +0 -2964
- package/presets/claude/next/commands/upstream-research.md +0 -23
- package/presets/claude/next/team/upstream/config.json +0 -31
- package/presets/claude/next/team/upstream/digest-template.md +0 -55
- package/presets/claude/next/team/upstream/jobs.json +0 -34
- package/presets/claude/next/team/upstream/opencode.json +0 -34
- package/presets/claude/next/team/upstream/projects.json +0 -4
- package/presets/claude/next/team/upstream/prompt.md +0 -77
- package/presets/claude/next/team/upstream/signatures.json +0 -9
- package/presets/cursor/next/commands/upstream-research.md +0 -23
- package/presets/cursor/next/team/upstream/config.json +0 -31
- package/presets/cursor/next/team/upstream/digest-template.md +0 -55
- package/presets/cursor/next/team/upstream/jobs.json +0 -34
- package/presets/cursor/next/team/upstream/opencode.json +0 -34
- package/presets/cursor/next/team/upstream/projects.json +0 -4
- package/presets/cursor/next/team/upstream/prompt.md +0 -77
- package/presets/cursor/next/team/upstream/signatures.json +0 -9
- package/presets/mavis/next/commands/upstream-research.md +0 -18
- package/presets/mavis/next/team/upstream/config.json +0 -31
- package/presets/mavis/next/team/upstream/digest-template.md +0 -55
- package/presets/mavis/next/team/upstream/jobs.json +0 -34
- package/presets/mavis/next/team/upstream/opencode.json +0 -34
- package/presets/mavis/next/team/upstream/projects.json +0 -4
- package/presets/mavis/next/team/upstream/prompt.md +0 -77
- package/presets/mavis/next/team/upstream/signatures.json +0 -9
- package/presets/opencode/next/commands/upstream-research.md +0 -26
- package/presets/opencode/next/team/upstream/config.json +0 -31
- package/presets/opencode/next/team/upstream/digest-template.md +0 -55
- package/presets/opencode/next/team/upstream/jobs.json +0 -34
- package/presets/opencode/next/team/upstream/opencode.json +0 -34
- package/presets/opencode/next/team/upstream/projects.json +0 -4
- package/presets/opencode/next/team/upstream/prompt.md +0 -77
- package/presets/opencode/next/team/upstream/signatures.json +0 -9
- package/presets/zcode/next/commands/upstream-research.md +0 -26
- package/presets/zcode/next/team/upstream/config.json +0 -31
- package/presets/zcode/next/team/upstream/digest-template.md +0 -55
- package/presets/zcode/next/team/upstream/jobs.json +0 -34
- package/presets/zcode/next/team/upstream/opencode.json +0 -34
- package/presets/zcode/next/team/upstream/projects.json +0 -4
- package/presets/zcode/next/team/upstream/prompt.md +0 -77
- package/presets/zcode/next/team/upstream/signatures.json +0 -9
package/mcp/defectdojo-mcp.mjs
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
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,
|
|
15
15
|
ConfigError,
|
|
16
|
-
isAllowedImportPath,
|
|
17
16
|
isAllowedPath,
|
|
18
17
|
loadDefectDojoConfig,
|
|
19
18
|
request,
|
|
19
|
+
resolveImportPath,
|
|
20
20
|
} from './lib/defectdojo.mjs';
|
|
21
21
|
|
|
22
22
|
const PROTOCOL_VERSION = '2025-06-18';
|
|
@@ -208,14 +208,16 @@ function requireInteger(value, name) {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
function readFileForImport(root, file) {
|
|
211
|
-
|
|
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) {
|
|
212
216
|
throw new ConfigError(
|
|
213
217
|
'file must be a repo-relative path inside the project root; absolute paths, ".." traversal and symlink escapes are refused',
|
|
214
218
|
);
|
|
215
219
|
}
|
|
216
220
|
|
|
217
|
-
const absolute = resolve(root, file);
|
|
218
|
-
|
|
219
221
|
return { buffer: readFileSync(absolute), name: basename(absolute) };
|
|
220
222
|
}
|
|
221
223
|
|
package/mcp/lib/defectdojo.mjs
CHANGED
|
@@ -166,40 +166,52 @@ export function isAllowedPath(path, baseUrl) {
|
|
|
166
166
|
* under the *real* project root: a symlink that leaves the root is an escape,
|
|
167
167
|
* not a read. Deny closed: an unreadable, unresolvable, or malformed-encoding
|
|
168
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.
|
|
169
175
|
*/
|
|
170
|
-
export function
|
|
171
|
-
if (typeof root !== 'string' || root === '' || typeof input !== 'string' || input
|
|
172
|
-
return
|
|
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;
|
|
173
182
|
}
|
|
174
183
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (isAbsolute(trimmed) || /^[a-zA-Z]:[/\\]/.test(trimmed) || trimmed.startsWith('\\\\')) {
|
|
178
|
-
return false;
|
|
184
|
+
if (isAbsolute(input) || /^[a-zA-Z]:[/\\]/.test(input) || input.startsWith('\\\\')) {
|
|
185
|
+
return null;
|
|
179
186
|
}
|
|
180
187
|
|
|
181
|
-
const forms = [
|
|
188
|
+
const forms = [input];
|
|
182
189
|
try {
|
|
183
|
-
forms.push(decodeURIComponent(
|
|
190
|
+
forms.push(decodeURIComponent(input));
|
|
184
191
|
} catch {
|
|
185
|
-
return
|
|
192
|
+
return null;
|
|
186
193
|
}
|
|
187
194
|
|
|
188
195
|
for (const form of forms) {
|
|
189
196
|
if (form.split(/[\\/]/).includes('..')) {
|
|
190
|
-
return
|
|
197
|
+
return null;
|
|
191
198
|
}
|
|
192
199
|
}
|
|
193
200
|
|
|
194
201
|
try {
|
|
195
202
|
const realRoot = realpathSync(root);
|
|
196
|
-
const realFile = realpathSync(resolve(root,
|
|
197
|
-
return realFile === realRoot || realFile.startsWith(realRoot + sep);
|
|
203
|
+
const realFile = realpathSync(resolve(root, input));
|
|
204
|
+
return realFile === realRoot || realFile.startsWith(realRoot + sep) ? realFile : null;
|
|
198
205
|
} catch {
|
|
199
|
-
return
|
|
206
|
+
return null;
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
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
|
+
|
|
203
215
|
export function buildUrl(baseUrl, path, query = {}) {
|
|
204
216
|
const url = /^https?:\/\//.test(path) ? new URL(path) : new URL(`${baseUrl}/${apiPath(path)}`);
|
|
205
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.66",
|
|
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",
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"mcp",
|
|
30
30
|
"docs",
|
|
31
31
|
"presets",
|
|
32
|
+
"!presets/_shared/ai-local/scripts/upstream-research.mjs",
|
|
33
|
+
"!presets/*/next/commands/upstream-research.md",
|
|
34
|
+
"!presets/*/next/team/upstream/**",
|
|
32
35
|
"presets/_shared/ai-local/scripts/check-write-scope.mjs",
|
|
33
36
|
"scripts/check-product-specs.sh",
|
|
34
37
|
"scripts/aggregate-agent-task-metrics.mjs",
|
|
@@ -37,7 +40,7 @@
|
|
|
37
40
|
"scripts": {
|
|
38
41
|
"check:fast": "bash scripts/check-preset-fast.sh",
|
|
39
42
|
"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",
|
|
43
|
+
"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
44
|
"check:preset-structure": "bash scripts/check-preset-structure.sh",
|
|
42
45
|
"release:gate": "bash scripts/release-gate.sh",
|
|
43
46
|
"check:platform-scripts": "node scripts/check-platform-scripts.mjs",
|
|
@@ -49,27 +52,27 @@
|
|
|
49
52
|
"check:claude-agent-blocks": "node scripts/check-claude-agent-blocks.mjs",
|
|
50
53
|
"check:claude-agent-parity": "node scripts/check-claude-agent-parity.mjs",
|
|
51
54
|
"test:claude-agent-parity": "node scripts/test-claude-agent-parity.mjs",
|
|
52
|
-
"check:consumer-links": "node scripts/check-consumer-links.mjs",
|
|
55
|
+
"check:consumer-links": "node scripts/run-locked.mjs --label check:consumer-links -- node scripts/check-consumer-links.mjs",
|
|
53
56
|
"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",
|
|
57
|
+
"check:preset-twin-map": "node scripts/run-locked.mjs --label check:preset-twin-map -- bash scripts/check-preset-twin-map.sh",
|
|
58
|
+
"check:preset-twin-drift": "node scripts/run-locked.mjs --label check:preset-twin-drift -- node scripts/check-preset-twin-drift.mjs",
|
|
56
59
|
"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",
|
|
60
|
+
"check:preset-token-budget": "node scripts/run-locked.mjs --label check:preset-token-budget -- bash scripts/check-preset-token-budget.sh",
|
|
61
|
+
"check:preset-leakage": "node scripts/run-locked.mjs --label check:preset-leakage -- bash scripts/check-preset-leakage.sh",
|
|
59
62
|
"check:figma-contract": "bash scripts/check-figma-contract-presence.sh",
|
|
60
63
|
"check:hook-only-lifecycle": "bash scripts/check-hook-only-lifecycle.sh",
|
|
61
|
-
"check:preset-reachability": "bash scripts/check-preset-reachability.sh",
|
|
64
|
+
"check:preset-reachability": "node scripts/run-locked.mjs --label check:preset-reachability -- bash scripts/check-preset-reachability.sh",
|
|
62
65
|
"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",
|
|
66
|
+
"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",
|
|
67
|
+
"check:frontmatter": "node scripts/run-locked.mjs --label check:frontmatter -- node scripts/check-frontmatter.mjs",
|
|
68
|
+
"check:shared-core-drift": "node scripts/run-locked.mjs --label check:shared-core-drift -- bash scripts/check-shared-core-drift.sh",
|
|
66
69
|
"check:product-specs": "bash scripts/check-product-specs.sh",
|
|
67
70
|
"check:product-specs:self-test": "bash scripts/check-product-specs.sh --self-test",
|
|
68
71
|
"check:product-specs:dogfood": "bash scripts/check-product-specs.sh ../../dogfood/mcp-ts-sample",
|
|
69
72
|
"check:rule-eval": "node scripts/check-rule-eval.mjs",
|
|
70
73
|
"check:next-attached-budget": "node scripts/check-next-attached-budget.mjs",
|
|
71
74
|
"check:release-consistency": "node scripts/check-release-consistency.mjs",
|
|
72
|
-
"check:generated-drift": "node scripts/check-generated-drift.mjs",
|
|
75
|
+
"check:generated-drift": "node scripts/run-locked.mjs --label check:generated-drift -- node scripts/check-generated-drift.mjs",
|
|
73
76
|
"check:hook-body-parity": "node scripts/check-hook-body-parity.mjs",
|
|
74
77
|
"test:hook-body-parity-fixtures": "node scripts/test-hook-body-parity-fixtures.mjs",
|
|
75
78
|
"test:shared-core-drift-lineage-fixtures": "node scripts/test-shared-core-drift-lineage-fixtures.mjs",
|
|
@@ -77,14 +80,17 @@
|
|
|
77
80
|
"test:generate-claude-fixtures": "node scripts/test-generate-claude-fixtures.mjs",
|
|
78
81
|
"test:generated-drift-claude-fixtures": "node scripts/test-generated-drift-claude-fixtures.mjs",
|
|
79
82
|
"test:rule-improver": "node scripts/test-rule-improver-ledger.mjs",
|
|
83
|
+
"test:guard-shell-command": "node scripts/test-guard-shell-command.mjs",
|
|
84
|
+
"check:processes": "node scripts/test-process-lease.mjs && node scripts/test-process-adapters.mjs && node scripts/test-process-scan.mjs",
|
|
80
85
|
"test:cli-mcp-merge": "node scripts/test-cli-mcp-merge.mjs",
|
|
81
|
-
"test:cli-init-clean": "node scripts/test-cli-init-clean.mjs",
|
|
86
|
+
"test:cli-init-clean": "node scripts/run-locked.mjs --label test:cli-init-clean -- node scripts/test-cli-init-clean.mjs",
|
|
82
87
|
"test:cli-update": "node scripts/test-cli-update.mjs",
|
|
83
88
|
"test:cli-install-doctor": "node scripts/test-install-doctor.mjs",
|
|
84
89
|
"test:engine-upgrade": "node scripts/test-engine-upgrade.mjs",
|
|
85
90
|
"test:cli-mcp-registration": "node scripts/test-cli-mcp-registration.mjs",
|
|
86
91
|
"test:cli-mcp-catalog": "node scripts/test-cli-mcp-catalog.mjs",
|
|
87
92
|
"test:mcp-pack-tarball": "node scripts/test-mcp-pack-tarball.mjs",
|
|
93
|
+
"test:pack-repo-only": "node scripts/test-pack-repo-only.mjs",
|
|
88
94
|
"test:chain-coverage": "node scripts/test-chain-team-phases-coverage.mjs",
|
|
89
95
|
"test:agent-task-metrics-hooks": "node scripts/test-agent-task-metrics-hooks.mjs",
|
|
90
96
|
"test:upstream": "node scripts/test-upstream-research.mjs",
|
|
@@ -95,15 +101,17 @@
|
|
|
95
101
|
"test:team-db:api": "node scripts/test-team-db-api.mjs",
|
|
96
102
|
"test:team-db:security": "node scripts/test-team-db-security.mjs",
|
|
97
103
|
"test:team-db:dashboard": "node scripts/test-team-db-dashboard.mjs",
|
|
104
|
+
"test:team-db:ui": "node scripts/test-team-db-ui.mjs",
|
|
98
105
|
"test:team-db:concurrency": "node scripts/test-team-db-concurrency.mjs",
|
|
99
|
-
"test:team-db:
|
|
100
|
-
"test:team-db:
|
|
101
|
-
"test:team-db:
|
|
102
|
-
"test:team-db:
|
|
103
|
-
"test:team-db:
|
|
106
|
+
"test:team-db:tracker": "node scripts/test-team-db-tracker.mjs",
|
|
107
|
+
"test:team-db:tracker-order": "node scripts/test-team-db-tracker-order.mjs",
|
|
108
|
+
"test:team-db:tracker-project": "node scripts/test-team-db-tracker-project.mjs",
|
|
109
|
+
"test:team-db:tracker-queue": "node scripts/test-team-db-tracker-queue.mjs",
|
|
110
|
+
"test:team-db:tracker-import": "node scripts/test-team-db-tracker-import.mjs",
|
|
111
|
+
"test:team-db:task-runner": "node scripts/test-team-db-task-runner.mjs",
|
|
104
112
|
"test:team-db:scheduler": "node scripts/test-team-db-scheduler.mjs",
|
|
105
113
|
"test:team-db:fixtures": "node scripts/test-team-db-fixtures.mjs",
|
|
106
|
-
"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-
|
|
114
|
+
"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",
|
|
107
115
|
"check:team-db-contract": "node scripts/check-team-db-contract.mjs",
|
|
108
116
|
"check:mavis-platform-contract": "node scripts/check-mavis-platform-contract.mjs --self-test",
|
|
109
117
|
"check:mavis-adapter-map": "node scripts/check-mavis-adapter-map.mjs --self-test",
|
|
@@ -121,11 +129,14 @@
|
|
|
121
129
|
"check:zcode-local-overlay": "node scripts/check-zcode-local-overlay.mjs",
|
|
122
130
|
"test:opencode-context-budget": "node scripts/test-opencode-context-budget.mjs",
|
|
123
131
|
"test:probe-mavis-capabilities": "node scripts/test-probe-mavis-capabilities.mjs",
|
|
132
|
+
"preset:loop": "yarn fix:generated && yarn check:changed && yarn check:fast",
|
|
124
133
|
"fix:generated": "node scripts/fix-generated.mjs",
|
|
125
134
|
"generate:claude": "node scripts/generate-claude.mjs",
|
|
126
135
|
"generate:mavis": "node scripts/generate-mavis.mjs",
|
|
127
136
|
"generate:opencode": "node scripts/generate-opencode.mjs",
|
|
128
|
-
"generate:zcode": "node scripts/generate-zcode.mjs"
|
|
137
|
+
"generate:zcode": "node scripts/generate-zcode.mjs",
|
|
138
|
+
"test:dev-processes": "node scripts/test-dev-processes.mjs",
|
|
139
|
+
"test:task-status-view": "node scripts/test-task-status-view.mjs"
|
|
129
140
|
},
|
|
130
141
|
"engines": {
|
|
131
142
|
"node": ">=20"
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Externalize a command's output into the task directory.
|
|
3
|
+
*
|
|
4
|
+
* Reads stdin (or `--input <file>`), writes the bytes to
|
|
5
|
+
* `.ai.local/team/tasks/<slug>/outputs/<id>.txt` under a 2 097 152-byte cap,
|
|
6
|
+
* and prints a bounded head plus the path and one `grep -n` hint. The full
|
|
7
|
+
* output stays on disk, where the team-db projection indexes it, so an agent
|
|
8
|
+
* searches the stored file instead of reading it or re-running the command.
|
|
9
|
+
*
|
|
10
|
+
* The cap is applied while streaming: memory stays at one chunk plus the 8 KiB
|
|
11
|
+
* head, whatever the input size. The bytes are copied raw — no decode, no
|
|
12
|
+
* re-encode — so a binary dump is stored as-is (and skipped by the projection).
|
|
13
|
+
*
|
|
14
|
+
* Invocation: dump-output.mjs [--task <slug>] [--label <text>] [--input <file>]
|
|
15
|
+
* [--root <team-dir>]
|
|
16
|
+
*
|
|
17
|
+
* Exit codes: 0 ok (including empty or truncated input), 2 usage or containment
|
|
18
|
+
* refusal, 1 write failure. The task comes from `--task`, else TEAM_TASK_SLUG.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import fs from 'node:fs';
|
|
22
|
+
import path from 'node:path';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
24
|
+
|
|
25
|
+
export const MAX_BYTES = 2 * 1024 * 1024;
|
|
26
|
+
|
|
27
|
+
const HEAD_LINES = 40;
|
|
28
|
+
const HEAD_BYTES = 8 * 1024;
|
|
29
|
+
const HEAD_LINE_BYTES = 400;
|
|
30
|
+
const LABEL_MAX = 32;
|
|
31
|
+
const SLUG_MAX = 48;
|
|
32
|
+
const CHUNK_BYTES = 64 * 1024;
|
|
33
|
+
const COLLISION_SCAN_LIMIT = 1000;
|
|
34
|
+
const CREATE_ATTEMPTS = COLLISION_SCAN_LIMIT + 1;
|
|
35
|
+
const TERM_MAX = 64;
|
|
36
|
+
const SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
37
|
+
/** A token a shell can carry inside single quotes: no `'`, `"`, `$`, or backtick. */
|
|
38
|
+
const GREP_TOKEN_RE = /^[\p{L}\p{N}][\p{L}\p{N}_-]*$/u;
|
|
39
|
+
|
|
40
|
+
const USAGE = `usage:
|
|
41
|
+
dump-output.mjs [--task <slug>] [--label <text>] [--input <file>] [--root <team-dir>]
|
|
42
|
+
|
|
43
|
+
Reads a command's stdout (or --input) and writes it to
|
|
44
|
+
.ai.local/team/tasks/<slug>/outputs/<id>.txt under a ${MAX_BYTES}-byte cap, then prints
|
|
45
|
+
at most ${HEAD_LINES} head lines, the byte count, the path, and one grep hint.
|
|
46
|
+
|
|
47
|
+
--task <slug> task slug; defaults to TEAM_TASK_SLUG
|
|
48
|
+
--label <text> suffix in the output name (lowercased, [^a-z0-9]+ -> -)
|
|
49
|
+
--input <file> read this file instead of stdin
|
|
50
|
+
--root <dir> team root; defaults to .ai.local/team under the current directory
|
|
51
|
+
|
|
52
|
+
Exit codes: 0 ok (including empty or truncated input), 2 usage or containment
|
|
53
|
+
refusal, 1 write failure.`;
|
|
54
|
+
|
|
55
|
+
const usageFail = (message) => {
|
|
56
|
+
const error = new Error(message);
|
|
57
|
+
error.exitCode = 2;
|
|
58
|
+
throw error;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Filename-safe label: lowercase, every non-alphanumeric run becomes `-`, no
|
|
63
|
+
* leading/trailing `-`, capped so the id stays a readable filename.
|
|
64
|
+
*/
|
|
65
|
+
export function sanitizeLabel(value) {
|
|
66
|
+
if (typeof value !== 'string') return '';
|
|
67
|
+
return value
|
|
68
|
+
.toLowerCase()
|
|
69
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
70
|
+
.replace(/^-+/, '')
|
|
71
|
+
.slice(0, LABEL_MAX)
|
|
72
|
+
.replace(/-+$/, '');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const sanitizeSlug = (value) => {
|
|
76
|
+
if (typeof value !== 'string') return '';
|
|
77
|
+
if (/[/\\]/.test(value) || value.includes('..') || value.startsWith('.')) return '';
|
|
78
|
+
const slug = value
|
|
79
|
+
.toLowerCase()
|
|
80
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
81
|
+
.replace(/^-+|-+$/g, '');
|
|
82
|
+
if (slug.length === 0 || slug.length > SLUG_MAX || !SLUG_RE.test(slug)) return '';
|
|
83
|
+
return slug;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** The first free `<id>.txt`, `<id>-2.txt`, `<id>-3.txt`, … — never an existing file. */
|
|
87
|
+
export function resolveOutputPath({ outputsDir, id }) {
|
|
88
|
+
const first = path.join(outputsDir, `${id}.txt`);
|
|
89
|
+
if (!fs.existsSync(first)) return first;
|
|
90
|
+
for (let suffix = 2; suffix <= COLLISION_SCAN_LIMIT; suffix += 1) {
|
|
91
|
+
const candidate = path.join(outputsDir, `${id}-${suffix}.txt`);
|
|
92
|
+
if (!fs.existsSync(candidate)) return candidate;
|
|
93
|
+
}
|
|
94
|
+
throw new Error(`no free name for ${id}.txt in ${outputsDir}`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const utcStamp = () =>
|
|
98
|
+
new Date()
|
|
99
|
+
.toISOString()
|
|
100
|
+
.replace(/[-:]/g, '')
|
|
101
|
+
.replace(/\.\d{3}Z$/, 'Z');
|
|
102
|
+
|
|
103
|
+
const parseArgs = (argv) => {
|
|
104
|
+
const flags = {};
|
|
105
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
106
|
+
const token = argv[index];
|
|
107
|
+
if (token === '--help' || token === '-h') return { help: true, flags };
|
|
108
|
+
if (!token.startsWith('--')) usageFail(`unexpected argument "${token}"`);
|
|
109
|
+
const [name, inline] = token.slice(2).split('=');
|
|
110
|
+
if (!['task', 'label', 'input', 'root'].includes(name)) usageFail(`unknown flag --${name}`);
|
|
111
|
+
if (inline !== undefined) {
|
|
112
|
+
flags[name] = inline;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const next = argv[index + 1];
|
|
116
|
+
if (next === undefined || next.startsWith('--')) usageFail(`flag --${name} needs a value`);
|
|
117
|
+
flags[name] = next;
|
|
118
|
+
index += 1;
|
|
119
|
+
}
|
|
120
|
+
return { help: false, flags };
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const assertNotSymlink = (target, label) => {
|
|
124
|
+
let stats;
|
|
125
|
+
try {
|
|
126
|
+
stats = fs.lstatSync(target);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (error.code === 'ENOENT') return;
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
// The projection walk skips symlinks, so anything written through one is
|
|
132
|
+
// invisible to `team-db search` — refuse instead of dumping into a dead end.
|
|
133
|
+
if (stats.isSymbolicLink()) usageFail(`refusing a symlinked ${label}: ${target}`);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const assertReadableFile = (file) => {
|
|
137
|
+
let stats;
|
|
138
|
+
try {
|
|
139
|
+
stats = fs.statSync(file);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
return usageFail(`--input ${file} is not readable (${error.code ?? error.message})`);
|
|
142
|
+
}
|
|
143
|
+
if (!stats.isFile()) return usageFail(`--input ${file} is not a regular file`);
|
|
144
|
+
try {
|
|
145
|
+
fs.accessSync(file, fs.constants.R_OK);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
return usageFail(`--input ${file} is not readable (${error.code ?? error.message})`);
|
|
148
|
+
}
|
|
149
|
+
return undefined;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const assertContained = (outputsDir, file) => {
|
|
153
|
+
const resolvedDir = path.resolve(outputsDir);
|
|
154
|
+
const resolvedFile = path.resolve(file);
|
|
155
|
+
const expected = path.join(resolvedDir, path.basename(file));
|
|
156
|
+
if (resolvedFile !== expected || !resolvedFile.startsWith(`${resolvedDir}${path.sep}`)) {
|
|
157
|
+
usageFail(`refusing to write outside ${resolvedDir}: ${file}`);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const createOutput = (outputsDir, baseId) => {
|
|
162
|
+
for (let attempt = 0; attempt < CREATE_ATTEMPTS; attempt += 1) {
|
|
163
|
+
const file = resolveOutputPath({ outputsDir, id: baseId });
|
|
164
|
+
assertContained(outputsDir, file);
|
|
165
|
+
try {
|
|
166
|
+
// `wx` closes the race between resolveOutputPath and the create: a file
|
|
167
|
+
// that appeared in between is a collision, never an overwrite.
|
|
168
|
+
return { file, fd: fs.openSync(file, 'wx') };
|
|
169
|
+
} catch (error) {
|
|
170
|
+
if (error.code !== 'EEXIST') throw error;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
throw new Error(
|
|
174
|
+
`could not create a unique name for ${baseId}.txt in ${outputsDir} after ${CREATE_ATTEMPTS} attempts (every candidate was taken by a concurrent writer)`,
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const writeAll = (fd, buffer) => {
|
|
179
|
+
let offset = 0;
|
|
180
|
+
while (offset < buffer.length) {
|
|
181
|
+
offset += fs.writeSync(fd, buffer, offset, buffer.length - offset);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Stream the source into the file: the head is collected up to 8 KiB and 40
|
|
187
|
+
* lines, the body stops at the cap. Reading stops at the first chunk past the
|
|
188
|
+
* cap, so a 1 GB dump costs one chunk of extra work, not 1 GB of I/O.
|
|
189
|
+
*/
|
|
190
|
+
async function copyInto(source, fd) {
|
|
191
|
+
let written = 0;
|
|
192
|
+
let truncated = false;
|
|
193
|
+
let headBytes = 0;
|
|
194
|
+
let headNewlines = 0;
|
|
195
|
+
let headCut = false;
|
|
196
|
+
const headChunks = [];
|
|
197
|
+
for await (const chunk of source) {
|
|
198
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk), 'utf8');
|
|
199
|
+
if (buffer.length === 0) continue;
|
|
200
|
+
if (headNewlines < HEAD_LINES) {
|
|
201
|
+
const room = HEAD_BYTES - headBytes;
|
|
202
|
+
if (room > 0) {
|
|
203
|
+
const slice = buffer.subarray(0, room);
|
|
204
|
+
headChunks.push(slice);
|
|
205
|
+
headBytes += slice.length;
|
|
206
|
+
for (let index = 0; index < slice.length; index += 1) {
|
|
207
|
+
if (slice[index] === 0x0a) headNewlines += 1;
|
|
208
|
+
}
|
|
209
|
+
if (slice.length < buffer.length && headNewlines < HEAD_LINES) headCut = true;
|
|
210
|
+
} else {
|
|
211
|
+
headCut = true;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (written >= MAX_BYTES) {
|
|
215
|
+
truncated = true;
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
const slice = buffer.subarray(0, MAX_BYTES - written);
|
|
219
|
+
writeAll(fd, slice);
|
|
220
|
+
written += slice.length;
|
|
221
|
+
if (slice.length < buffer.length) {
|
|
222
|
+
truncated = true;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return { written, truncated, head: Buffer.concat(headChunks), headCut };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Drop a code point the cap split, so the head never shows a replacement char. */
|
|
230
|
+
const trimPartialUtf8 = (buffer) => {
|
|
231
|
+
let index = buffer.length;
|
|
232
|
+
let trailing = 0;
|
|
233
|
+
while (index > 0 && trailing < 3 && (buffer[index - 1] & 0xc0) === 0x80) {
|
|
234
|
+
index -= 1;
|
|
235
|
+
trailing += 1;
|
|
236
|
+
}
|
|
237
|
+
if (index === 0) return buffer;
|
|
238
|
+
const lead = buffer[index - 1];
|
|
239
|
+
const expected = lead >= 0xf0 ? 4 : lead >= 0xe0 ? 3 : lead >= 0xc0 ? 2 : 1;
|
|
240
|
+
return buffer.length - (index - 1) < expected ? buffer.subarray(0, index - 1) : buffer;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const cutLine = (text, partial) => {
|
|
244
|
+
const buffer = Buffer.from(text, 'utf8');
|
|
245
|
+
if (!partial && buffer.length <= HEAD_LINE_BYTES) return { text, bytes: buffer.length };
|
|
246
|
+
let end = Math.min(buffer.length, HEAD_LINE_BYTES - 3);
|
|
247
|
+
while (end > 0 && (buffer[end] & 0xc0) === 0x80) end -= 1;
|
|
248
|
+
return { text: `${buffer.subarray(0, end).toString('utf8')}…`, bytes: end + 3 };
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const formatHead = ({ head, headCut }) => {
|
|
252
|
+
const text = (headCut ? trimPartialUtf8(head) : head).toString('utf8');
|
|
253
|
+
const partialTail = headCut && !text.endsWith('\n');
|
|
254
|
+
const lines = text.split('\n');
|
|
255
|
+
if (lines.length > 0 && lines[lines.length - 1] === '') lines.pop();
|
|
256
|
+
const printed = [];
|
|
257
|
+
let total = 0;
|
|
258
|
+
for (let index = 0; index < lines.length && printed.length < HEAD_LINES; index += 1) {
|
|
259
|
+
const line = cutLine(lines[index].replace(/\r$/, ''), partialTail && index === lines.length - 1);
|
|
260
|
+
if (total + line.bytes + 1 > HEAD_BYTES) break;
|
|
261
|
+
printed.push(line.text);
|
|
262
|
+
total += line.bytes + 1;
|
|
263
|
+
}
|
|
264
|
+
return printed;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/** A usable first search term: the first head token a shell cannot break on. */
|
|
268
|
+
const grepTerm = (lines, fallback) => {
|
|
269
|
+
for (const line of lines) {
|
|
270
|
+
for (const token of line.split(/\s+/)) {
|
|
271
|
+
if (token.length >= 2 && GREP_TOKEN_RE.test(token)) return token.slice(0, TERM_MAX);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return fallback;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const realpathOr = (value) => {
|
|
278
|
+
try {
|
|
279
|
+
return fs.realpathSync(value);
|
|
280
|
+
} catch {
|
|
281
|
+
return value;
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const displayPath = (file) => {
|
|
286
|
+
// Both sides go through realpath: a `--root` under a symlinked prefix (`/var`
|
|
287
|
+
// on macOS) is the same directory as the physical cwd, not "outside" it.
|
|
288
|
+
const target = path.resolve(file);
|
|
289
|
+
const relative = path.relative(realpathOr(path.resolve(process.cwd())), realpathOr(target));
|
|
290
|
+
const inside = relative !== '' && !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
291
|
+
return (inside ? relative : target).split(path.sep).join('/');
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
async function main(argv) {
|
|
295
|
+
const { help, flags } = parseArgs(argv);
|
|
296
|
+
if (help) {
|
|
297
|
+
process.stdout.write(`${USAGE}\n`);
|
|
298
|
+
return 0;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const slug = sanitizeSlug(flags.task ?? process.env.TEAM_TASK_SLUG ?? '');
|
|
302
|
+
if (slug === '') {
|
|
303
|
+
usageFail('a task slug is required: --task <slug> or TEAM_TASK_SLUG (letters, digits, "-", max 48 chars)');
|
|
304
|
+
}
|
|
305
|
+
const root = flags.root ? path.resolve(flags.root) : path.join(process.cwd(), '.ai.local', 'team');
|
|
306
|
+
const inputPath = typeof flags.input === 'string' && flags.input !== '' ? path.resolve(flags.input) : null;
|
|
307
|
+
// Validate before touching the tree, so a usage refusal writes nothing.
|
|
308
|
+
if (inputPath) assertReadableFile(inputPath);
|
|
309
|
+
|
|
310
|
+
const taskDir = path.join(root, 'tasks', slug);
|
|
311
|
+
const outputsDir = path.join(taskDir, 'outputs');
|
|
312
|
+
assertNotSymlink(taskDir, 'task directory');
|
|
313
|
+
assertNotSymlink(outputsDir, 'outputs directory');
|
|
314
|
+
fs.mkdirSync(outputsDir, { recursive: true });
|
|
315
|
+
|
|
316
|
+
const baseId = [utcStamp(), sanitizeLabel(flags.label)].filter(Boolean).join('-');
|
|
317
|
+
const { file, fd } = createOutput(outputsDir, baseId);
|
|
318
|
+
let result;
|
|
319
|
+
try {
|
|
320
|
+
result = await copyInto(
|
|
321
|
+
inputPath ? fs.createReadStream(inputPath, { highWaterMark: CHUNK_BYTES }) : process.stdin,
|
|
322
|
+
fd,
|
|
323
|
+
);
|
|
324
|
+
} catch (error) {
|
|
325
|
+
try {
|
|
326
|
+
fs.closeSync(fd);
|
|
327
|
+
} catch {
|
|
328
|
+
/* the write failure is the finding */
|
|
329
|
+
}
|
|
330
|
+
try {
|
|
331
|
+
fs.unlinkSync(file);
|
|
332
|
+
} catch {
|
|
333
|
+
/* a partial file is already the failure being reported */
|
|
334
|
+
}
|
|
335
|
+
throw error;
|
|
336
|
+
}
|
|
337
|
+
fs.closeSync(fd);
|
|
338
|
+
|
|
339
|
+
const printed = displayPath(file);
|
|
340
|
+
if (result.written === 0) {
|
|
341
|
+
process.stdout.write('empty input; nothing to externalize\n');
|
|
342
|
+
process.stdout.write(`path: ${printed}\n`);
|
|
343
|
+
return 0;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const head = formatHead(result);
|
|
347
|
+
process.stdout.write('head:\n');
|
|
348
|
+
for (const line of head) process.stdout.write(`${line}\n`);
|
|
349
|
+
process.stdout.write(`bytes: ${result.written} (cap ${MAX_BYTES}, truncated: ${result.truncated ? 'yes' : 'no'})\n`);
|
|
350
|
+
process.stdout.write(`path: ${printed}\n`);
|
|
351
|
+
process.stdout.write(`grep -n '${grepTerm(head, baseId)}' ${printed}\n`);
|
|
352
|
+
return 0;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const invokedDirectly = (() => {
|
|
356
|
+
if (!process.argv[1]) return false;
|
|
357
|
+
try {
|
|
358
|
+
return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
|
|
359
|
+
} catch {
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
})();
|
|
363
|
+
|
|
364
|
+
if (invokedDirectly) {
|
|
365
|
+
try {
|
|
366
|
+
process.exitCode = await main(process.argv.slice(2));
|
|
367
|
+
} catch (error) {
|
|
368
|
+
process.stderr.write(`dump-output: ${error.message}\n`);
|
|
369
|
+
process.exitCode = typeof error.exitCode === 'number' ? error.exitCode : 1;
|
|
370
|
+
}
|
|
371
|
+
}
|