@bonesofspring/ai-rules 0.2.52 → 0.2.55
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 +67 -0
- package/README.md +45 -16
- package/bin/cli.js +599 -69
- package/bin/lib/engine-scripts.js +10 -0
- package/bin/lib/mcp/clients.js +205 -0
- package/bin/lib/mcp/credentials.js +310 -0
- package/bin/lib/mcp/doctor.js +396 -0
- package/bin/lib/mcp/prompt.js +115 -0
- package/bin/lib/mcp/registry.js +171 -0
- package/bin/lib/mcp/run.js +125 -0
- package/bin/lib/merged-config.js +68 -2
- package/bin/lib/seed-ai-local-team.js +6 -1
- package/bin/lib/tool-installs.js +28 -0
- package/bin/opencode-install.js +18 -0
- package/bin/zcode-install.js +479 -0
- package/docs/MAVIS.md +3 -3
- package/docs/MCP-SETUP.md +62 -0
- package/docs/OPENCODE-COMPATIBILITY.md +1 -1
- package/docs/OPENCODE.md +3 -3
- package/docs/PRESET-CONTRIBUTION.md +25 -11
- package/docs/TEAM-DB.md +188 -0
- package/docs/ZCODE-COMPATIBILITY.md +143 -0
- package/docs/ZCODE.md +50 -0
- package/docs/openapi/team-db.v1.json +5085 -0
- package/mcp/gitlab.mjs +123 -0
- package/mcp/lib/envfile.mjs +126 -0
- package/mcp/lib/yandex.mjs +384 -0
- package/mcp/yandex-mcp-proxy.mjs +155 -0
- package/mcp/yandex-token-refresh.mjs +65 -0
- package/package.json +23 -3
- package/presets/_shared/ai-local/scripts/manifest.mjs +99 -0
- package/presets/_shared/ai-local/scripts/team-db-api.mjs +1275 -0
- package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +1067 -0
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +1301 -0
- package/presets/_shared/ai-local/scripts/team-db-project.mjs +1590 -0
- package/presets/_shared/ai-local/scripts/team-db-schema.mjs +831 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +297 -0
- package/presets/_shared/core/agent-team/agent-artifact-contracts.md +1 -1
- package/presets/_shared/core/meta/preset-pr-checklist.md +1 -1
- package/presets/_shared/core/meta/preset-twin-sync.md +2 -2
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +109 -0
- package/presets/claude/android-kotlin/REPO_AGENTS.md +15 -8
- package/presets/claude/android-kotlin/commands/README.md +1 -0
- package/presets/claude/android-kotlin/commands/migrate-tasks.md +41 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/android-kotlin/team/README.md +14 -2
- package/presets/claude/go/REPO_AGENTS.md +15 -8
- package/presets/claude/go/commands/README.md +1 -0
- package/presets/claude/go/commands/migrate-tasks.md +41 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/go/rules/README.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/go/team/README.md +14 -2
- package/presets/claude/ios-swift/REPO_AGENTS.md +15 -8
- package/presets/claude/ios-swift/commands/README.md +1 -0
- package/presets/claude/ios-swift/commands/migrate-tasks.md +41 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/ios-swift/rules/README.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/ios-swift/team/README.md +14 -2
- package/presets/claude/java/REPO_AGENTS.md +15 -8
- package/presets/claude/java/commands/README.md +1 -0
- package/presets/claude/java/commands/migrate-tasks.md +41 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/java/team/README.md +14 -2
- package/presets/claude/mcp-ts/REPO_AGENTS.md +15 -8
- package/presets/claude/mcp-ts/commands/README.md +1 -0
- package/presets/claude/mcp-ts/commands/migrate-tasks.md +41 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/mcp-ts/team/README.md +14 -2
- package/presets/claude/mol/CLAUDE.md +53 -0
- package/presets/claude/mol/MCP.md +38 -0
- package/presets/claude/mol/README.md +9 -0
- package/presets/claude/mol/REPO_AGENTS.md +107 -0
- package/presets/claude/mol/agents/README.md +97 -0
- package/presets/claude/mol/agents/accessibility-reviewer.md +86 -0
- package/presets/claude/mol/agents/api-contract-reviewer.md +81 -0
- package/presets/claude/mol/agents/build-verifier.md +111 -0
- package/presets/claude/mol/agents/ci-investigator.md +91 -0
- package/presets/claude/mol/agents/code-reviewer.md +133 -0
- package/presets/claude/mol/agents/codebase-analyzer.md +45 -0
- package/presets/claude/mol/agents/debugger.md +122 -0
- package/presets/claude/mol/agents/feature-developer.md +147 -0
- package/presets/claude/mol/agents/migration-specialist.md +91 -0
- package/presets/claude/mol/agents/mockup-reviewer.md +125 -0
- package/presets/claude/mol/agents/openspec-author.md +207 -0
- package/presets/claude/mol/agents/performance-auditor.md +92 -0
- package/presets/claude/mol/agents/playwright-test-generator.md +52 -0
- package/presets/claude/mol/agents/playwright-test-healer.md +53 -0
- package/presets/claude/mol/agents/playwright-test-planner.md +45 -0
- package/presets/claude/mol/agents/qa-tester.md +76 -0
- package/presets/claude/mol/agents/security-reviewer.md +83 -0
- package/presets/claude/mol/agents/solution-architect.md +93 -0
- package/presets/claude/mol/agents/task-analyst.md +249 -0
- package/presets/claude/mol/agents/task-router.md +261 -0
- package/presets/claude/mol/agents/tech-writer.md +82 -0
- package/presets/claude/mol/agents/unit-test-generator.md +55 -0
- package/presets/claude/mol/agents/unit-test-healer.md +56 -0
- package/presets/claude/mol/agents/unit-test-planner.md +78 -0
- package/presets/claude/mol/ai-local/conventions.md +49 -0
- package/presets/claude/mol/ai-local/rules/task-levels.md +40 -0
- package/presets/claude/mol/ai-local/rules-library/agent-artifacts-no-local-paths.md +71 -0
- package/presets/claude/mol/ai-local/rules-library/agent-pipeline-gates.md +19 -0
- package/presets/claude/mol/ai-local/rules-library/analytics-events.md +18 -0
- package/presets/claude/mol/ai-local/rules-library/api-contract-source.md +14 -0
- package/presets/claude/mol/ai-local/rules-library/artifact-lifecycle.md +17 -0
- package/presets/claude/mol/ai-local/rules-library/code-style.md +68 -0
- package/presets/claude/mol/ai-local/rules-library/commit-hygiene.md +17 -0
- package/presets/claude/mol/ai-local/rules-library/component-child-decomposition.md +81 -0
- package/presets/claude/mol/ai-local/rules-library/feature-flags-experiments.md +15 -0
- package/presets/claude/mol/ai-local/rules-library/mcp-required-for-ui-layout.md +45 -0
- package/presets/claude/mol/ai-local/rules-library/no-react-fc.md +46 -0
- package/presets/claude/mol/ai-local/rules-library/no-test-driven-behavior-change.md +14 -0
- package/presets/claude/mol/ai-local/rules-library/pre-pr-checklist.md +16 -0
- package/presets/claude/mol/ai-local/rules-library/pwa-service-worker.md +15 -0
- package/presets/claude/mol/ai-local/rules-library/qa-test-cases.md +14 -0
- package/presets/claude/mol/ai-local/rules-library/router-pages.md +25 -0
- package/presets/claude/mol/ai-local/rules-library/single-source-copy-constants.md +18 -0
- package/presets/claude/mol/ai-local/rules-library/storybook-catalog-structure.md +62 -0
- package/presets/claude/mol/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
- package/presets/claude/mol/ai-local/rules-library/storybook-csf-authoring.md +100 -0
- package/presets/claude/mol/ai-local/rules-library/storybook-dev-compare-figma.md +71 -0
- package/presets/claude/mol/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
- package/presets/claude/mol/ai-local/rules-library/storybook-modals.md +64 -0
- package/presets/claude/mol/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
- package/presets/claude/mol/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
- package/presets/claude/mol/ai-local/rules-library/ui-change-review-gate.md +15 -0
- package/presets/claude/mol/commands/README.md +56 -0
- package/presets/claude/mol/commands/migrate-tasks.md +41 -0
- package/presets/claude/mol/commands/spec-start.md +29 -0
- package/presets/claude/mol/commands/task-continue.md +72 -0
- package/presets/claude/mol/commands/task-evil.md +84 -0
- package/presets/claude/mol/commands/task.md +72 -0
- package/presets/claude/mol/commands/technical-retro.md +93 -0
- package/presets/claude/mol/commands/update.md +40 -0
- package/presets/claude/mol/hooks/chain-team-phases.sh +2783 -0
- package/presets/claude/mol/hooks/check-preset-update.mjs +232 -0
- package/presets/claude/mol/hooks/list-ai-local.mjs +299 -0
- package/presets/claude/mol/mcp.json +20 -0
- package/presets/claude/mol/rules/README.md +87 -0
- package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +149 -0
- package/presets/claude/mol/rules/architecture/mol-state.md +30 -0
- package/presets/claude/mol/rules/architecture/mol-theming.md +30 -0
- package/presets/claude/mol/rules/architecture/product-specs-authoring.md +124 -0
- package/presets/claude/mol/rules/architecture/product-specs.md +67 -0
- package/presets/claude/mol/rules/architecture/reference-features.md +87 -0
- package/presets/claude/mol/rules/stack/mol-app-core.md +34 -0
- package/presets/claude/mol/rules/stack/mol-components.md +36 -0
- package/presets/claude/mol/rules/stack/mol-reactivity.md +26 -0
- package/presets/claude/mol/rules/stack/mol-view-tree.md +32 -0
- package/presets/claude/mol/rules/stack/package-manager.md +12 -0
- package/presets/claude/mol/rules/testing/mol-build.md +29 -0
- package/presets/claude/mol/rules/testing/mol-testing.md +36 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +19 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +287 -0
- package/presets/claude/mol/rules/tooling-and-review/ai-local-overlay.md +23 -0
- package/presets/claude/mol/rules/tooling-and-review/anti-hallucination-contract.md +42 -0
- package/presets/claude/mol/rules/tooling-and-review/anti-sycophancy-discipline.md +28 -0
- package/presets/claude/mol/rules/tooling-and-review/code-quality.md +80 -0
- package/presets/claude/mol/rules/tooling-and-review/code-review-mr.md +100 -0
- package/presets/claude/mol/rules/tooling-and-review/design-guidance.md +109 -0
- package/presets/claude/mol/rules/tooling-and-review/interactive-questions.md +34 -0
- package/presets/claude/mol/rules/tooling-and-review/language-policy.md +59 -0
- package/presets/claude/mol/rules/tooling-and-review/mcp-usage.md +101 -0
- package/presets/claude/mol/rules/tooling-and-review/preset-goals.md +39 -0
- package/presets/claude/mol/rules/tooling-and-review/preset-layering.md +35 -0
- package/presets/claude/mol/rules/tooling-and-review/preset-no-cross-stack-leakage.md +97 -0
- package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +53 -0
- package/presets/claude/mol/rules/tooling-and-review/preset-token-budget.md +46 -0
- package/presets/claude/mol/rules/tooling-and-review/preset-twin-sync.md +49 -0
- package/presets/claude/mol/rules/tooling-and-review/preset-writing-style.md +50 -0
- package/presets/claude/mol/rules/tooling-and-review/technical-retro.md +18 -0
- package/presets/claude/mol/settings.json +52 -0
- package/presets/claude/mol/skills/README.md +17 -0
- package/presets/claude/mol/skills/ci-investigation/SKILL.md +44 -0
- package/presets/claude/mol/skills/code-review/SKILL.md +55 -0
- package/presets/claude/mol/skills/debug-investigation/SKILL.md +59 -0
- package/presets/claude/mol/skills/feature-delivery/SKILL.md +39 -0
- package/presets/claude/mol/skills/spec-authoring/SKILL.md +26 -0
- package/presets/claude/mol/skills/spec-discovery/SKILL.md +58 -0
- package/presets/claude/mol/skills/technical-retro/SKILL.md +67 -0
- package/presets/claude/mol/skills/unit-testing/SKILL.md +33 -0
- package/presets/claude/mol/skills/write-adr/SKILL.md +41 -0
- package/presets/claude/mol/team/README.md +135 -0
- package/presets/claude/mol/team/fixtures/artifact-manifest.example.json +80 -0
- package/presets/claude/mol/team/fixtures/bugfix-standard.json +25 -0
- package/presets/claude/mol/team/fixtures/feature-full.json +29 -0
- package/presets/claude/mol/team/fixtures/feature-light.json +28 -0
- package/presets/claude/mol/team/fixtures/feature-parallel.json +84 -0
- package/presets/claude/mol/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/claude/mol/team/fixtures/feature-with-figma-url.json +27 -0
- package/presets/claude/mol/team/fixtures/feature-with-ux-no-figma.json +26 -0
- package/presets/claude/mol/team/fixtures/memlog.example.md +9 -0
- package/presets/claude/mol/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
- package/presets/claude/mol/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
- package/presets/claude/mol/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
- package/presets/claude/mol/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
- package/presets/claude/mol/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
- package/presets/claude/mol/team/fixtures/metrics.example.json +54 -0
- package/presets/claude/mol/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/claude/mol/team/fixtures/mockup-review-standalone.json +23 -0
- package/presets/claude/mol/team/fixtures/ux-design-standalone.json +24 -0
- package/presets/claude/mol/team/tasks/.gitkeep +0 -0
- package/presets/claude/next/REPO_AGENTS.md +16 -9
- package/presets/claude/next/agents/task-analyst.md +11 -0
- package/presets/claude/next/agents/task-router.md +11 -0
- package/presets/claude/next/commands/README.md +4 -0
- package/presets/claude/next/commands/migrate-tasks.md +41 -0
- package/presets/claude/next/commands/task-evil.md +88 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/next/rules/README.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/next/settings.json +1 -6
- package/presets/claude/next/team/README.md +14 -2
- package/presets/claude/nuxt/REPO_AGENTS.md +15 -8
- package/presets/claude/nuxt/commands/README.md +1 -0
- package/presets/claude/nuxt/commands/migrate-tasks.md +41 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/nuxt/settings.json +1 -6
- package/presets/claude/nuxt/team/README.md +14 -2
- package/presets/claude/php-hexagonal/REPO_AGENTS.md +15 -8
- package/presets/claude/php-hexagonal/commands/README.md +1 -0
- package/presets/claude/php-hexagonal/commands/migrate-tasks.md +41 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/php-hexagonal/team/README.md +14 -2
- package/presets/claude/php-laravel/REPO_AGENTS.md +15 -8
- package/presets/claude/php-laravel/commands/README.md +1 -0
- package/presets/claude/php-laravel/commands/migrate-tasks.md +41 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/php-laravel/team/README.md +14 -2
- package/presets/claude/svelte/REPO_AGENTS.md +15 -8
- package/presets/claude/svelte/commands/README.md +1 -0
- package/presets/claude/svelte/commands/migrate-tasks.md +41 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/preset-twin-sync.md +2 -2
- package/presets/claude/svelte/settings.json +1 -6
- package/presets/claude/svelte/team/README.md +14 -2
- package/presets/cursor/android-kotlin/REPO_AGENTS.md +15 -8
- package/presets/cursor/android-kotlin/commands/README.md +1 -0
- package/presets/cursor/android-kotlin/commands/migrate-tasks.md +41 -0
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/android-kotlin/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/android-kotlin/team/README.md +14 -2
- package/presets/cursor/go/REPO_AGENTS.md +15 -8
- package/presets/cursor/go/commands/README.md +1 -0
- package/presets/cursor/go/commands/migrate-tasks.md +41 -0
- package/presets/cursor/go/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/go/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/go/team/README.md +14 -2
- package/presets/cursor/ios-swift/REPO_AGENTS.md +15 -8
- package/presets/cursor/ios-swift/commands/README.md +1 -0
- package/presets/cursor/ios-swift/commands/migrate-tasks.md +41 -0
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/ios-swift/team/README.md +14 -2
- package/presets/cursor/java/REPO_AGENTS.md +15 -8
- package/presets/cursor/java/commands/README.md +1 -0
- package/presets/cursor/java/commands/migrate-tasks.md +41 -0
- package/presets/cursor/java/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/java/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/java/team/README.md +14 -2
- package/presets/cursor/mcp-ts/REPO_AGENTS.md +15 -8
- package/presets/cursor/mcp-ts/commands/README.md +1 -0
- package/presets/cursor/mcp-ts/commands/migrate-tasks.md +41 -0
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/mcp-ts/team/README.md +14 -2
- package/presets/cursor/mol/AGENTS.md +40 -0
- package/presets/cursor/mol/BUGBOT.md +14 -0
- package/presets/cursor/mol/MCP.md +50 -0
- package/presets/cursor/mol/README.md +18 -0
- package/presets/cursor/mol/REPO_AGENTS.md +107 -0
- package/presets/cursor/mol/agents/README.md +97 -0
- package/presets/cursor/mol/agents/accessibility-reviewer.md +74 -0
- package/presets/cursor/mol/agents/api-contract-reviewer.md +69 -0
- package/presets/cursor/mol/agents/build-verifier.md +99 -0
- package/presets/cursor/mol/agents/ci-investigator.md +75 -0
- package/presets/cursor/mol/agents/code-reviewer.md +120 -0
- package/presets/cursor/mol/agents/codebase-analyzer.md +33 -0
- package/presets/cursor/mol/agents/debugger.md +106 -0
- package/presets/cursor/mol/agents/feature-developer.md +131 -0
- package/presets/cursor/mol/agents/migration-specialist.md +79 -0
- package/presets/cursor/mol/agents/mockup-reviewer.md +113 -0
- package/presets/cursor/mol/agents/openspec-author.md +195 -0
- package/presets/cursor/mol/agents/performance-auditor.md +80 -0
- package/presets/cursor/mol/agents/playwright-test-generator.md +40 -0
- package/presets/cursor/mol/agents/playwright-test-healer.md +41 -0
- package/presets/cursor/mol/agents/playwright-test-planner.md +33 -0
- package/presets/cursor/mol/agents/qa-tester.md +64 -0
- package/presets/cursor/mol/agents/security-reviewer.md +71 -0
- package/presets/cursor/mol/agents/solution-architect.md +81 -0
- package/presets/cursor/mol/agents/task-analyst.md +237 -0
- package/presets/cursor/mol/agents/task-router.md +249 -0
- package/presets/cursor/mol/agents/tech-writer.md +70 -0
- package/presets/cursor/mol/agents/unit-test-generator.md +43 -0
- package/presets/cursor/mol/agents/unit-test-healer.md +44 -0
- package/presets/cursor/mol/agents/unit-test-planner.md +66 -0
- package/presets/cursor/mol/ai-local/conventions.md +49 -0
- package/presets/cursor/mol/ai-local/rules/task-levels.md +40 -0
- package/presets/cursor/mol/ai-local/rules-library/agent-artifacts-no-local-paths.md +71 -0
- package/presets/cursor/mol/ai-local/rules-library/agent-pipeline-gates.md +19 -0
- package/presets/cursor/mol/ai-local/rules-library/analytics-events.md +18 -0
- package/presets/cursor/mol/ai-local/rules-library/api-contract-source.md +14 -0
- package/presets/cursor/mol/ai-local/rules-library/artifact-lifecycle.md +17 -0
- package/presets/cursor/mol/ai-local/rules-library/code-style.md +68 -0
- package/presets/cursor/mol/ai-local/rules-library/commit-hygiene.md +17 -0
- package/presets/cursor/mol/ai-local/rules-library/component-child-decomposition.md +81 -0
- package/presets/cursor/mol/ai-local/rules-library/feature-flags-experiments.md +15 -0
- package/presets/cursor/mol/ai-local/rules-library/mcp-required-for-ui-layout.md +45 -0
- package/presets/cursor/mol/ai-local/rules-library/no-react-fc.md +46 -0
- package/presets/cursor/mol/ai-local/rules-library/no-test-driven-behavior-change.md +14 -0
- package/presets/cursor/mol/ai-local/rules-library/pre-pr-checklist.md +16 -0
- package/presets/cursor/mol/ai-local/rules-library/pwa-service-worker.md +15 -0
- package/presets/cursor/mol/ai-local/rules-library/qa-test-cases.md +14 -0
- package/presets/cursor/mol/ai-local/rules-library/router-pages.md +25 -0
- package/presets/cursor/mol/ai-local/rules-library/single-source-copy-constants.md +18 -0
- package/presets/cursor/mol/ai-local/rules-library/storybook-catalog-structure.md +62 -0
- package/presets/cursor/mol/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
- package/presets/cursor/mol/ai-local/rules-library/storybook-csf-authoring.md +100 -0
- package/presets/cursor/mol/ai-local/rules-library/storybook-dev-compare-figma.md +71 -0
- package/presets/cursor/mol/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
- package/presets/cursor/mol/ai-local/rules-library/storybook-modals.md +64 -0
- package/presets/cursor/mol/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
- package/presets/cursor/mol/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
- package/presets/cursor/mol/ai-local/rules-library/ui-change-review-gate.md +15 -0
- package/presets/cursor/mol/commands/README.md +56 -0
- package/presets/cursor/mol/commands/migrate-tasks.md +41 -0
- package/presets/cursor/mol/commands/spec-start.md +29 -0
- package/presets/cursor/mol/commands/task-continue.md +72 -0
- package/presets/cursor/mol/commands/task-evil.md +88 -0
- package/presets/cursor/mol/commands/task.md +76 -0
- package/presets/cursor/mol/commands/technical-retro.md +93 -0
- package/presets/cursor/mol/commands/update.md +40 -0
- package/presets/cursor/mol/hooks/README.md +14 -0
- package/presets/cursor/mol/hooks/chain-team-phases.sh +2765 -0
- package/presets/cursor/mol/hooks/check-preset-update.mjs +232 -0
- package/presets/cursor/mol/hooks/examples/README.md +18 -0
- package/presets/cursor/mol/hooks/examples/format-edited.example.sh +11 -0
- package/presets/cursor/mol/hooks/examples/secret-guard.example.sh +10 -0
- package/presets/cursor/mol/hooks/examples/test-on-save.example.sh +8 -0
- package/presets/cursor/mol/hooks/guard-shell-command.sh +77 -0
- package/presets/cursor/mol/hooks/list-ai-local.mjs +299 -0
- package/presets/cursor/mol/hooks.json +27 -0
- package/presets/cursor/mol/mcp.json +19 -0
- package/presets/cursor/mol/rules/README.md +71 -0
- package/presets/cursor/mol/rules/agent-team-intake.mdc +19 -0
- package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +263 -0
- package/presets/cursor/mol/rules/ai-local-overlay.mdc +24 -0
- package/presets/cursor/mol/rules/anti-hallucination-contract.mdc +42 -0
- package/presets/cursor/mol/rules/anti-sycophancy-discipline.mdc +28 -0
- package/presets/cursor/mol/rules/code-quality-and-refactoring.mdc +81 -0
- package/presets/cursor/mol/rules/code-review-mr.mdc +100 -0
- package/presets/cursor/mol/rules/design-guidance.mdc +109 -0
- package/presets/cursor/mol/rules/feature-delivery-workflow.mdc +93 -0
- package/presets/cursor/mol/rules/interactive-questions.mdc +34 -0
- package/presets/cursor/mol/rules/language-policy.mdc +60 -0
- package/presets/cursor/mol/rules/mcp-usage.mdc +101 -0
- package/presets/cursor/mol/rules/mol-app-core.mdc +35 -0
- package/presets/cursor/mol/rules/mol-build.mdc +30 -0
- package/presets/cursor/mol/rules/mol-components.mdc +37 -0
- package/presets/cursor/mol/rules/mol-reactivity.mdc +27 -0
- package/presets/cursor/mol/rules/mol-state.mdc +31 -0
- package/presets/cursor/mol/rules/mol-testing.mdc +37 -0
- package/presets/cursor/mol/rules/mol-theming.mdc +31 -0
- package/presets/cursor/mol/rules/mol-view-tree.mdc +33 -0
- package/presets/cursor/mol/rules/package-manager.mdc +12 -0
- package/presets/cursor/mol/rules/preset-goals.mdc +40 -0
- package/presets/cursor/mol/rules/preset-layering.mdc +36 -0
- package/presets/cursor/mol/rules/preset-no-cross-stack-leakage.mdc +98 -0
- package/presets/cursor/mol/rules/preset-pr-checklist.mdc +54 -0
- package/presets/cursor/mol/rules/preset-token-budget.mdc +47 -0
- package/presets/cursor/mol/rules/preset-twin-sync.mdc +50 -0
- package/presets/cursor/mol/rules/preset-writing-style.mdc +51 -0
- package/presets/cursor/mol/rules/product-specs-authoring.mdc +125 -0
- package/presets/cursor/mol/rules/product-specs.mdc +68 -0
- package/presets/cursor/mol/rules/reference-features.mdc +45 -0
- package/presets/cursor/mol/rules/technical-retro.mdc +18 -0
- package/presets/cursor/mol/skills/README.md +17 -0
- package/presets/cursor/mol/skills/ci-investigation/SKILL.md +49 -0
- package/presets/cursor/mol/skills/code-review/SKILL.md +60 -0
- package/presets/cursor/mol/skills/debug-investigation/SKILL.md +63 -0
- package/presets/cursor/mol/skills/feature-delivery/SKILL.md +44 -0
- package/presets/cursor/mol/skills/spec-authoring/SKILL.md +31 -0
- package/presets/cursor/mol/skills/spec-discovery/SKILL.md +63 -0
- package/presets/cursor/mol/skills/technical-retro/SKILL.md +72 -0
- package/presets/cursor/mol/skills/unit-testing/SKILL.md +38 -0
- package/presets/cursor/mol/skills/write-adr/SKILL.md +46 -0
- package/presets/cursor/mol/team/README.md +135 -0
- package/presets/cursor/mol/team/fixtures/artifact-manifest.example.json +80 -0
- package/presets/cursor/mol/team/fixtures/bugfix-standard.json +25 -0
- package/presets/cursor/mol/team/fixtures/feature-full.json +29 -0
- package/presets/cursor/mol/team/fixtures/feature-light.json +28 -0
- package/presets/cursor/mol/team/fixtures/feature-parallel.json +84 -0
- package/presets/cursor/mol/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/cursor/mol/team/fixtures/feature-with-figma-url.json +27 -0
- package/presets/cursor/mol/team/fixtures/feature-with-ux-no-figma.json +26 -0
- package/presets/cursor/mol/team/fixtures/memlog.example.md +9 -0
- package/presets/cursor/mol/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
- package/presets/cursor/mol/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
- package/presets/cursor/mol/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
- package/presets/cursor/mol/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
- package/presets/cursor/mol/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
- package/presets/cursor/mol/team/fixtures/metrics.example.json +54 -0
- package/presets/cursor/mol/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/cursor/mol/team/fixtures/mockup-review-standalone.json +23 -0
- package/presets/cursor/mol/team/fixtures/ux-design-standalone.json +24 -0
- package/presets/cursor/mol/team/tasks/.gitkeep +0 -0
- package/presets/cursor/next/MCP.md +7 -0
- package/presets/cursor/next/REPO_AGENTS.md +16 -9
- package/presets/cursor/next/agents/task-analyst.md +11 -0
- package/presets/cursor/next/agents/task-router.md +11 -0
- package/presets/cursor/next/commands/README.md +6 -0
- package/presets/cursor/next/commands/migrate-tasks.md +41 -0
- package/presets/cursor/next/commands/task-evil.md +88 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/next/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/next/team/README.md +14 -2
- package/presets/cursor/nuxt/REPO_AGENTS.md +15 -8
- package/presets/cursor/nuxt/commands/README.md +1 -0
- package/presets/cursor/nuxt/commands/migrate-tasks.md +41 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/nuxt/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/nuxt/team/README.md +14 -2
- package/presets/cursor/php-hexagonal/REPO_AGENTS.md +15 -8
- package/presets/cursor/php-hexagonal/commands/README.md +1 -0
- package/presets/cursor/php-hexagonal/commands/migrate-tasks.md +41 -0
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/php-hexagonal/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/php-hexagonal/team/README.md +14 -2
- package/presets/cursor/php-laravel/REPO_AGENTS.md +15 -8
- package/presets/cursor/php-laravel/commands/README.md +1 -0
- package/presets/cursor/php-laravel/commands/migrate-tasks.md +41 -0
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/php-laravel/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/php-laravel/team/README.md +14 -2
- package/presets/cursor/svelte/REPO_AGENTS.md +15 -8
- package/presets/cursor/svelte/commands/README.md +1 -0
- package/presets/cursor/svelte/commands/migrate-tasks.md +41 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/svelte/rules/preset-twin-sync.mdc +2 -2
- package/presets/cursor/svelte/team/README.md +14 -2
- package/presets/mavis/README.md +1 -1
- package/presets/mavis/android-kotlin/REPO_AGENTS.md +15 -8
- package/presets/mavis/android-kotlin/adapter-map.json +9 -1
- package/presets/mavis/android-kotlin/commands/README.md +1 -0
- package/presets/mavis/android-kotlin/commands/migrate-tasks.md +36 -0
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/android-kotlin/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/android-kotlin/team/README.md +14 -2
- package/presets/mavis/go/REPO_AGENTS.md +15 -8
- package/presets/mavis/go/adapter-map.json +9 -1
- package/presets/mavis/go/commands/README.md +1 -0
- package/presets/mavis/go/commands/migrate-tasks.md +36 -0
- package/presets/mavis/go/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/go/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/go/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/go/team/README.md +14 -2
- package/presets/mavis/ios-swift/REPO_AGENTS.md +15 -8
- package/presets/mavis/ios-swift/adapter-map.json +9 -1
- package/presets/mavis/ios-swift/commands/README.md +1 -0
- package/presets/mavis/ios-swift/commands/migrate-tasks.md +36 -0
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/ios-swift/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/ios-swift/team/README.md +14 -2
- package/presets/mavis/java/REPO_AGENTS.md +15 -8
- package/presets/mavis/java/adapter-map.json +9 -1
- package/presets/mavis/java/commands/README.md +1 -0
- package/presets/mavis/java/commands/migrate-tasks.md +36 -0
- package/presets/mavis/java/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/java/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/java/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/java/team/README.md +14 -2
- package/presets/mavis/mcp-ts/REPO_AGENTS.md +15 -8
- package/presets/mavis/mcp-ts/adapter-map.json +9 -1
- package/presets/mavis/mcp-ts/commands/README.md +1 -0
- package/presets/mavis/mcp-ts/commands/migrate-tasks.md +36 -0
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/mcp-ts/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/mcp-ts/team/README.md +14 -2
- package/presets/mavis/mol/MAVIS.md +94 -0
- package/presets/mavis/mol/MCP.md +50 -0
- package/presets/mavis/mol/README.md +16 -0
- package/presets/mavis/mol/REPO_AGENTS.md +107 -0
- package/presets/mavis/mol/adapter-map.json +1122 -0
- package/presets/mavis/mol/agents/README.md +96 -0
- package/presets/mavis/mol/agents/accessibility-reviewer.md +85 -0
- package/presets/mavis/mol/agents/api-contract-reviewer.md +80 -0
- package/presets/mavis/mol/agents/build-verifier.md +110 -0
- package/presets/mavis/mol/agents/ci-investigator.md +90 -0
- package/presets/mavis/mol/agents/code-reviewer.md +132 -0
- package/presets/mavis/mol/agents/codebase-analyzer.md +44 -0
- package/presets/mavis/mol/agents/debugger.md +121 -0
- package/presets/mavis/mol/agents/feature-developer.md +146 -0
- package/presets/mavis/mol/agents/migration-specialist.md +90 -0
- package/presets/mavis/mol/agents/mockup-reviewer.md +124 -0
- package/presets/mavis/mol/agents/openspec-author.md +206 -0
- package/presets/mavis/mol/agents/performance-auditor.md +91 -0
- package/presets/mavis/mol/agents/playwright-test-generator.md +51 -0
- package/presets/mavis/mol/agents/playwright-test-healer.md +52 -0
- package/presets/mavis/mol/agents/playwright-test-planner.md +44 -0
- package/presets/mavis/mol/agents/qa-tester.md +75 -0
- package/presets/mavis/mol/agents/security-reviewer.md +82 -0
- package/presets/mavis/mol/agents/solution-architect.md +92 -0
- package/presets/mavis/mol/agents/task-analyst.md +248 -0
- package/presets/mavis/mol/agents/task-router.md +260 -0
- package/presets/mavis/mol/agents/tech-writer.md +81 -0
- package/presets/mavis/mol/agents/unit-test-generator.md +54 -0
- package/presets/mavis/mol/agents/unit-test-healer.md +55 -0
- package/presets/mavis/mol/agents/unit-test-planner.md +77 -0
- package/presets/mavis/mol/ai-local/conventions.md +49 -0
- package/presets/mavis/mol/ai-local/rules/task-levels.md +40 -0
- package/presets/mavis/mol/ai-local/rules-library/agent-artifacts-no-local-paths.md +71 -0
- package/presets/mavis/mol/ai-local/rules-library/agent-pipeline-gates.md +19 -0
- package/presets/mavis/mol/ai-local/rules-library/analytics-events.md +18 -0
- package/presets/mavis/mol/ai-local/rules-library/api-contract-source.md +14 -0
- package/presets/mavis/mol/ai-local/rules-library/artifact-lifecycle.md +17 -0
- package/presets/mavis/mol/ai-local/rules-library/code-style.md +68 -0
- package/presets/mavis/mol/ai-local/rules-library/commit-hygiene.md +17 -0
- package/presets/mavis/mol/ai-local/rules-library/component-child-decomposition.md +81 -0
- package/presets/mavis/mol/ai-local/rules-library/feature-flags-experiments.md +15 -0
- package/presets/mavis/mol/ai-local/rules-library/mcp-required-for-ui-layout.md +45 -0
- package/presets/mavis/mol/ai-local/rules-library/no-react-fc.md +46 -0
- package/presets/mavis/mol/ai-local/rules-library/no-test-driven-behavior-change.md +14 -0
- package/presets/mavis/mol/ai-local/rules-library/pre-pr-checklist.md +16 -0
- package/presets/mavis/mol/ai-local/rules-library/pwa-service-worker.md +15 -0
- package/presets/mavis/mol/ai-local/rules-library/qa-test-cases.md +14 -0
- package/presets/mavis/mol/ai-local/rules-library/router-pages.md +25 -0
- package/presets/mavis/mol/ai-local/rules-library/single-source-copy-constants.md +18 -0
- package/presets/mavis/mol/ai-local/rules-library/storybook-catalog-structure.md +62 -0
- package/presets/mavis/mol/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
- package/presets/mavis/mol/ai-local/rules-library/storybook-csf-authoring.md +100 -0
- package/presets/mavis/mol/ai-local/rules-library/storybook-dev-compare-figma.md +71 -0
- package/presets/mavis/mol/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
- package/presets/mavis/mol/ai-local/rules-library/storybook-modals.md +64 -0
- package/presets/mavis/mol/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
- package/presets/mavis/mol/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
- package/presets/mavis/mol/ai-local/rules-library/ui-change-review-gate.md +15 -0
- package/presets/mavis/mol/commands/README.md +56 -0
- package/presets/mavis/mol/commands/migrate-tasks.md +36 -0
- package/presets/mavis/mol/commands/spec-start.md +24 -0
- package/presets/mavis/mol/commands/task-continue.md +67 -0
- package/presets/mavis/mol/commands/task-evil.md +82 -0
- package/presets/mavis/mol/commands/task.md +71 -0
- package/presets/mavis/mol/commands/technical-retro.md +88 -0
- package/presets/mavis/mol/commands/update.md +35 -0
- package/presets/mavis/mol/hooks/README.md +27 -0
- package/presets/mavis/mol/hooks/chain-team-phases.sh +2765 -0
- package/presets/mavis/mol/hooks/check-preset-update.mjs +232 -0
- package/presets/mavis/mol/hooks/list-ai-local.mjs +299 -0
- package/presets/mavis/mol/mcp.json +19 -0
- package/presets/mavis/mol/rules/README.md +16 -0
- package/presets/mavis/mol/rules/agent-team-intake.md +14 -0
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +282 -0
- package/presets/mavis/mol/rules/ai-local-overlay.md +18 -0
- package/presets/mavis/mol/rules/anti-hallucination-contract.md +37 -0
- package/presets/mavis/mol/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/mavis/mol/rules/code-quality-and-refactoring.md +76 -0
- package/presets/mavis/mol/rules/code-review-mr.md +95 -0
- package/presets/mavis/mol/rules/design-guidance.md +104 -0
- package/presets/mavis/mol/rules/feature-delivery-workflow.md +144 -0
- package/presets/mavis/mol/rules/interactive-questions.md +29 -0
- package/presets/mavis/mol/rules/language-policy.md +51 -0
- package/presets/mavis/mol/rules/mcp-usage.md +96 -0
- package/presets/mavis/mol/rules/mol-app-core.md +29 -0
- package/presets/mavis/mol/rules/mol-build.md +19 -0
- package/presets/mavis/mol/rules/mol-components.md +31 -0
- package/presets/mavis/mol/rules/mol-reactivity.md +21 -0
- package/presets/mavis/mol/rules/mol-state.md +22 -0
- package/presets/mavis/mol/rules/mol-testing.md +28 -0
- package/presets/mavis/mol/rules/mol-theming.md +22 -0
- package/presets/mavis/mol/rules/mol-view-tree.md +27 -0
- package/presets/mavis/mol/rules/package-manager.md +7 -0
- package/presets/mavis/mol/rules/preset-goals.md +31 -0
- package/presets/mavis/mol/rules/preset-layering.md +27 -0
- package/presets/mavis/mol/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/mavis/mol/rules/preset-pr-checklist.md +45 -0
- package/presets/mavis/mol/rules/preset-token-budget.md +38 -0
- package/presets/mavis/mol/rules/preset-twin-sync.md +41 -0
- package/presets/mavis/mol/rules/preset-writing-style.md +42 -0
- package/presets/mavis/mol/rules/product-specs-authoring.md +118 -0
- package/presets/mavis/mol/rules/product-specs.md +61 -0
- package/presets/mavis/mol/rules/reference-features.md +82 -0
- package/presets/mavis/mol/rules/technical-retro.md +13 -0
- package/presets/mavis/mol/skills/README.md +17 -0
- package/presets/mavis/mol/skills/ci-investigation/SKILL.md +44 -0
- package/presets/mavis/mol/skills/code-review/SKILL.md +55 -0
- package/presets/mavis/mol/skills/debug-investigation/SKILL.md +58 -0
- package/presets/mavis/mol/skills/feature-delivery/SKILL.md +39 -0
- package/presets/mavis/mol/skills/spec-authoring/SKILL.md +26 -0
- package/presets/mavis/mol/skills/spec-discovery/SKILL.md +58 -0
- package/presets/mavis/mol/skills/technical-retro/SKILL.md +67 -0
- package/presets/mavis/mol/skills/unit-testing/SKILL.md +33 -0
- package/presets/mavis/mol/skills/write-adr/SKILL.md +41 -0
- package/presets/mavis/mol/team/README.md +135 -0
- package/presets/mavis/mol/team/fixtures/artifact-manifest.example.json +80 -0
- package/presets/mavis/mol/team/fixtures/bugfix-standard.json +25 -0
- package/presets/mavis/mol/team/fixtures/feature-full.json +29 -0
- package/presets/mavis/mol/team/fixtures/feature-light.json +28 -0
- package/presets/mavis/mol/team/fixtures/feature-parallel.json +84 -0
- package/presets/mavis/mol/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/mavis/mol/team/fixtures/feature-with-figma-url.json +27 -0
- package/presets/mavis/mol/team/fixtures/feature-with-ux-no-figma.json +26 -0
- package/presets/mavis/mol/team/fixtures/memlog.example.md +9 -0
- package/presets/mavis/mol/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
- package/presets/mavis/mol/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
- package/presets/mavis/mol/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
- package/presets/mavis/mol/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
- package/presets/mavis/mol/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
- package/presets/mavis/mol/team/fixtures/metrics.example.json +54 -0
- package/presets/mavis/mol/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/mavis/mol/team/fixtures/mockup-review-standalone.json +23 -0
- package/presets/mavis/mol/team/fixtures/ux-design-standalone.json +24 -0
- package/presets/mavis/mol/team/tasks/.gitkeep +0 -0
- package/presets/mavis/next/MCP.md +7 -0
- package/presets/mavis/next/REPO_AGENTS.md +16 -9
- package/presets/mavis/next/adapter-map.json +18 -1
- package/presets/mavis/next/agents/task-analyst.md +11 -0
- package/presets/mavis/next/agents/task-router.md +11 -0
- package/presets/mavis/next/commands/README.md +6 -0
- package/presets/mavis/next/commands/migrate-tasks.md +36 -0
- package/presets/mavis/next/commands/task-evil.md +82 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/next/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/next/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/next/team/README.md +14 -2
- package/presets/mavis/nuxt/REPO_AGENTS.md +15 -8
- package/presets/mavis/nuxt/adapter-map.json +9 -1
- package/presets/mavis/nuxt/commands/README.md +1 -0
- package/presets/mavis/nuxt/commands/migrate-tasks.md +36 -0
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/nuxt/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/nuxt/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/nuxt/team/README.md +14 -2
- package/presets/mavis/php-hexagonal/REPO_AGENTS.md +15 -8
- package/presets/mavis/php-hexagonal/adapter-map.json +9 -1
- package/presets/mavis/php-hexagonal/commands/README.md +1 -0
- package/presets/mavis/php-hexagonal/commands/migrate-tasks.md +36 -0
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/php-hexagonal/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/php-hexagonal/team/README.md +14 -2
- package/presets/mavis/php-laravel/REPO_AGENTS.md +15 -8
- package/presets/mavis/php-laravel/adapter-map.json +9 -1
- package/presets/mavis/php-laravel/commands/README.md +1 -0
- package/presets/mavis/php-laravel/commands/migrate-tasks.md +36 -0
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/php-laravel/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/php-laravel/team/README.md +14 -2
- package/presets/mavis/platform-contract.json +2 -1
- package/presets/mavis/svelte/REPO_AGENTS.md +15 -8
- package/presets/mavis/svelte/adapter-map.json +9 -1
- package/presets/mavis/svelte/commands/README.md +1 -0
- package/presets/mavis/svelte/commands/migrate-tasks.md +36 -0
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/mavis/svelte/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/svelte/rules/preset-twin-sync.md +2 -2
- package/presets/mavis/svelte/team/README.md +14 -2
- package/presets/opencode/android-kotlin/REPO_AGENTS.md +15 -8
- package/presets/opencode/android-kotlin/adapter-map.json +9 -1
- package/presets/opencode/android-kotlin/commands/README.md +1 -0
- package/presets/opencode/android-kotlin/commands/migrate-tasks.md +44 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/android-kotlin/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/android-kotlin/team/README.md +14 -2
- package/presets/opencode/go/REPO_AGENTS.md +15 -8
- package/presets/opencode/go/adapter-map.json +9 -1
- package/presets/opencode/go/commands/README.md +1 -0
- package/presets/opencode/go/commands/migrate-tasks.md +44 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/go/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/go/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/go/team/README.md +14 -2
- package/presets/opencode/ios-swift/REPO_AGENTS.md +15 -8
- package/presets/opencode/ios-swift/adapter-map.json +9 -1
- package/presets/opencode/ios-swift/commands/README.md +1 -0
- package/presets/opencode/ios-swift/commands/migrate-tasks.md +44 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/ios-swift/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/ios-swift/team/README.md +14 -2
- package/presets/opencode/java/REPO_AGENTS.md +15 -8
- package/presets/opencode/java/adapter-map.json +9 -1
- package/presets/opencode/java/commands/README.md +1 -0
- package/presets/opencode/java/commands/migrate-tasks.md +44 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/java/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/java/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/java/team/README.md +14 -2
- package/presets/opencode/mcp-ts/REPO_AGENTS.md +15 -8
- package/presets/opencode/mcp-ts/adapter-map.json +9 -1
- package/presets/opencode/mcp-ts/commands/README.md +1 -0
- package/presets/opencode/mcp-ts/commands/migrate-tasks.md +44 -0
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/mcp-ts/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/mcp-ts/team/README.md +14 -2
- package/presets/opencode/mol/MCP.md +50 -0
- package/presets/opencode/mol/OPENCODE.md +99 -0
- package/presets/opencode/mol/README.md +17 -0
- package/presets/opencode/mol/REPO_AGENTS.md +107 -0
- package/presets/opencode/mol/adapter-map.json +1122 -0
- package/presets/opencode/mol/agents/README.md +97 -0
- package/presets/opencode/mol/agents/accessibility-reviewer.md +97 -0
- package/presets/opencode/mol/agents/api-contract-reviewer.md +92 -0
- package/presets/opencode/mol/agents/build-verifier.md +122 -0
- package/presets/opencode/mol/agents/ci-investigator.md +98 -0
- package/presets/opencode/mol/agents/code-reviewer.md +144 -0
- package/presets/opencode/mol/agents/codebase-analyzer.md +56 -0
- package/presets/opencode/mol/agents/debugger.md +129 -0
- package/presets/opencode/mol/agents/feature-developer.md +154 -0
- package/presets/opencode/mol/agents/migration-specialist.md +102 -0
- package/presets/opencode/mol/agents/mockup-reviewer.md +136 -0
- package/presets/opencode/mol/agents/openspec-author.md +219 -0
- package/presets/opencode/mol/agents/performance-auditor.md +103 -0
- package/presets/opencode/mol/agents/playwright-test-generator.md +59 -0
- package/presets/opencode/mol/agents/playwright-test-healer.md +60 -0
- package/presets/opencode/mol/agents/playwright-test-planner.md +56 -0
- package/presets/opencode/mol/agents/qa-tester.md +83 -0
- package/presets/opencode/mol/agents/security-reviewer.md +94 -0
- package/presets/opencode/mol/agents/solution-architect.md +104 -0
- package/presets/opencode/mol/agents/task-analyst.md +260 -0
- package/presets/opencode/mol/agents/task-router.md +272 -0
- package/presets/opencode/mol/agents/tech-writer.md +99 -0
- package/presets/opencode/mol/agents/unit-test-generator.md +62 -0
- package/presets/opencode/mol/agents/unit-test-healer.md +63 -0
- package/presets/opencode/mol/agents/unit-test-planner.md +89 -0
- package/presets/opencode/mol/ai-local/conventions.md +49 -0
- package/presets/opencode/mol/ai-local/rules/task-levels.md +40 -0
- package/presets/opencode/mol/ai-local/rules-library/agent-artifacts-no-local-paths.md +71 -0
- package/presets/opencode/mol/ai-local/rules-library/agent-pipeline-gates.md +19 -0
- package/presets/opencode/mol/ai-local/rules-library/analytics-events.md +18 -0
- package/presets/opencode/mol/ai-local/rules-library/api-contract-source.md +14 -0
- package/presets/opencode/mol/ai-local/rules-library/artifact-lifecycle.md +17 -0
- package/presets/opencode/mol/ai-local/rules-library/code-style.md +68 -0
- package/presets/opencode/mol/ai-local/rules-library/commit-hygiene.md +17 -0
- package/presets/opencode/mol/ai-local/rules-library/component-child-decomposition.md +81 -0
- package/presets/opencode/mol/ai-local/rules-library/feature-flags-experiments.md +15 -0
- package/presets/opencode/mol/ai-local/rules-library/mcp-required-for-ui-layout.md +45 -0
- package/presets/opencode/mol/ai-local/rules-library/no-react-fc.md +46 -0
- package/presets/opencode/mol/ai-local/rules-library/no-test-driven-behavior-change.md +14 -0
- package/presets/opencode/mol/ai-local/rules-library/pre-pr-checklist.md +16 -0
- package/presets/opencode/mol/ai-local/rules-library/pwa-service-worker.md +15 -0
- package/presets/opencode/mol/ai-local/rules-library/qa-test-cases.md +14 -0
- package/presets/opencode/mol/ai-local/rules-library/router-pages.md +25 -0
- package/presets/opencode/mol/ai-local/rules-library/single-source-copy-constants.md +18 -0
- package/presets/opencode/mol/ai-local/rules-library/storybook-catalog-structure.md +62 -0
- package/presets/opencode/mol/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
- package/presets/opencode/mol/ai-local/rules-library/storybook-csf-authoring.md +100 -0
- package/presets/opencode/mol/ai-local/rules-library/storybook-dev-compare-figma.md +71 -0
- package/presets/opencode/mol/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
- package/presets/opencode/mol/ai-local/rules-library/storybook-modals.md +64 -0
- package/presets/opencode/mol/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
- package/presets/opencode/mol/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
- package/presets/opencode/mol/ai-local/rules-library/ui-change-review-gate.md +15 -0
- package/presets/opencode/mol/commands/README.md +56 -0
- package/presets/opencode/mol/commands/migrate-tasks.md +44 -0
- package/presets/opencode/mol/commands/spec-start.md +32 -0
- package/presets/opencode/mol/commands/task-continue.md +75 -0
- package/presets/opencode/mol/commands/task-evil.md +91 -0
- package/presets/opencode/mol/commands/task.md +79 -0
- package/presets/opencode/mol/commands/technical-retro.md +96 -0
- package/presets/opencode/mol/commands/update.md +43 -0
- package/presets/opencode/mol/hooks/README.md +27 -0
- package/presets/opencode/mol/hooks/chain-team-phases.sh +2765 -0
- package/presets/opencode/mol/hooks/check-preset-update.mjs +232 -0
- package/presets/opencode/mol/hooks/list-ai-local.mjs +299 -0
- package/presets/opencode/mol/opencode.json +78 -0
- package/presets/opencode/mol/rules/README.md +25 -0
- package/presets/opencode/mol/rules/agent-team-intake.md +14 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +282 -0
- package/presets/opencode/mol/rules/ai-local-overlay.md +18 -0
- package/presets/opencode/mol/rules/anti-hallucination-contract.md +37 -0
- package/presets/opencode/mol/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/opencode/mol/rules/code-quality-and-refactoring.md +76 -0
- package/presets/opencode/mol/rules/code-review-mr.md +95 -0
- package/presets/opencode/mol/rules/design-guidance.md +104 -0
- package/presets/opencode/mol/rules/feature-delivery-workflow.md +144 -0
- package/presets/opencode/mol/rules/interactive-questions.md +29 -0
- package/presets/opencode/mol/rules/language-policy.md +51 -0
- package/presets/opencode/mol/rules/mcp-usage.md +96 -0
- package/presets/opencode/mol/rules/mol-app-core.md +29 -0
- package/presets/opencode/mol/rules/mol-build.md +19 -0
- package/presets/opencode/mol/rules/mol-components.md +31 -0
- package/presets/opencode/mol/rules/mol-reactivity.md +21 -0
- package/presets/opencode/mol/rules/mol-state.md +22 -0
- package/presets/opencode/mol/rules/mol-testing.md +28 -0
- package/presets/opencode/mol/rules/mol-theming.md +22 -0
- package/presets/opencode/mol/rules/mol-view-tree.md +27 -0
- package/presets/opencode/mol/rules/package-manager.md +7 -0
- package/presets/opencode/mol/rules/preset-goals.md +31 -0
- package/presets/opencode/mol/rules/preset-layering.md +27 -0
- package/presets/opencode/mol/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/opencode/mol/rules/preset-pr-checklist.md +45 -0
- package/presets/opencode/mol/rules/preset-token-budget.md +38 -0
- package/presets/opencode/mol/rules/preset-twin-sync.md +41 -0
- package/presets/opencode/mol/rules/preset-writing-style.md +42 -0
- package/presets/opencode/mol/rules/product-specs-authoring.md +118 -0
- package/presets/opencode/mol/rules/product-specs.md +61 -0
- package/presets/opencode/mol/rules/reference-features.md +82 -0
- package/presets/opencode/mol/rules/technical-retro.md +13 -0
- package/presets/opencode/mol/skills/README.md +17 -0
- package/presets/opencode/mol/skills/ci-investigation/SKILL.md +49 -0
- package/presets/opencode/mol/skills/code-review/SKILL.md +60 -0
- package/presets/opencode/mol/skills/debug-investigation/SKILL.md +63 -0
- package/presets/opencode/mol/skills/feature-delivery/SKILL.md +44 -0
- package/presets/opencode/mol/skills/spec-authoring/SKILL.md +31 -0
- package/presets/opencode/mol/skills/spec-discovery/SKILL.md +63 -0
- package/presets/opencode/mol/skills/technical-retro/SKILL.md +72 -0
- package/presets/opencode/mol/skills/unit-testing/SKILL.md +38 -0
- package/presets/opencode/mol/skills/write-adr/SKILL.md +46 -0
- package/presets/opencode/mol/team/README.md +135 -0
- package/presets/opencode/mol/team/fixtures/artifact-manifest.example.json +80 -0
- package/presets/opencode/mol/team/fixtures/bugfix-standard.json +25 -0
- package/presets/opencode/mol/team/fixtures/feature-full.json +29 -0
- package/presets/opencode/mol/team/fixtures/feature-light.json +28 -0
- package/presets/opencode/mol/team/fixtures/feature-parallel.json +84 -0
- package/presets/opencode/mol/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/opencode/mol/team/fixtures/feature-with-figma-url.json +27 -0
- package/presets/opencode/mol/team/fixtures/feature-with-ux-no-figma.json +26 -0
- package/presets/opencode/mol/team/fixtures/memlog.example.md +9 -0
- package/presets/opencode/mol/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
- package/presets/opencode/mol/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
- package/presets/opencode/mol/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
- package/presets/opencode/mol/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
- package/presets/opencode/mol/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
- package/presets/opencode/mol/team/fixtures/metrics.example.json +54 -0
- package/presets/opencode/mol/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/opencode/mol/team/fixtures/mockup-review-standalone.json +23 -0
- package/presets/opencode/mol/team/fixtures/ux-design-standalone.json +24 -0
- package/presets/opencode/mol/team/tasks/.gitkeep +0 -0
- package/presets/opencode/next/MCP.md +7 -0
- package/presets/opencode/next/REPO_AGENTS.md +16 -9
- package/presets/opencode/next/adapter-map.json +18 -1
- package/presets/opencode/next/agents/task-analyst.md +11 -0
- package/presets/opencode/next/agents/task-router.md +11 -0
- package/presets/opencode/next/commands/README.md +6 -0
- package/presets/opencode/next/commands/migrate-tasks.md +44 -0
- package/presets/opencode/next/commands/task-evil.md +91 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/next/opencode.json +26 -4
- package/presets/opencode/next/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/next/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/next/team/README.md +14 -2
- package/presets/opencode/nuxt/REPO_AGENTS.md +15 -8
- package/presets/opencode/nuxt/adapter-map.json +9 -1
- package/presets/opencode/nuxt/commands/README.md +1 -0
- package/presets/opencode/nuxt/commands/migrate-tasks.md +44 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/nuxt/opencode.json +4 -4
- package/presets/opencode/nuxt/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/nuxt/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/nuxt/team/README.md +14 -2
- package/presets/opencode/php-hexagonal/REPO_AGENTS.md +15 -8
- package/presets/opencode/php-hexagonal/adapter-map.json +9 -1
- package/presets/opencode/php-hexagonal/commands/README.md +1 -0
- package/presets/opencode/php-hexagonal/commands/migrate-tasks.md +44 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/php-hexagonal/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/php-hexagonal/team/README.md +14 -2
- package/presets/opencode/php-laravel/REPO_AGENTS.md +15 -8
- package/presets/opencode/php-laravel/adapter-map.json +9 -1
- package/presets/opencode/php-laravel/commands/README.md +1 -0
- package/presets/opencode/php-laravel/commands/migrate-tasks.md +44 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/php-laravel/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/php-laravel/team/README.md +14 -2
- package/presets/opencode/platform-contract.json +2 -1
- package/presets/opencode/svelte/REPO_AGENTS.md +15 -8
- package/presets/opencode/svelte/adapter-map.json +9 -1
- package/presets/opencode/svelte/commands/README.md +1 -0
- package/presets/opencode/svelte/commands/migrate-tasks.md +44 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +109 -0
- package/presets/opencode/svelte/opencode.json +4 -4
- package/presets/opencode/svelte/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/svelte/rules/preset-twin-sync.md +2 -2
- package/presets/opencode/svelte/team/README.md +14 -2
- package/presets/zcode/README.md +17 -0
- package/presets/zcode/android-kotlin/MCP.md +35 -0
- package/presets/zcode/android-kotlin/README.md +20 -0
- package/presets/zcode/android-kotlin/REPO_AGENTS.md +100 -0
- package/presets/zcode/android-kotlin/adapter-map.json +925 -0
- package/presets/zcode/android-kotlin/agents/README.md +68 -0
- package/presets/zcode/android-kotlin/agents/accessibility-reviewer.md +87 -0
- package/presets/zcode/android-kotlin/agents/api-contract-reviewer.md +92 -0
- package/presets/zcode/android-kotlin/agents/build-verifier.md +87 -0
- package/presets/zcode/android-kotlin/agents/ci-investigator.md +114 -0
- package/presets/zcode/android-kotlin/agents/code-reviewer.md +133 -0
- package/presets/zcode/android-kotlin/agents/codebase-analyzer.md +49 -0
- package/presets/zcode/android-kotlin/agents/debugger.md +136 -0
- package/presets/zcode/android-kotlin/agents/feature-developer.md +154 -0
- package/presets/zcode/android-kotlin/agents/instrumentation-test-generator.md +43 -0
- package/presets/zcode/android-kotlin/agents/instrumentation-test-healer.md +43 -0
- package/presets/zcode/android-kotlin/agents/instrumentation-test-planner.md +45 -0
- package/presets/zcode/android-kotlin/agents/migration-specialist.md +101 -0
- package/presets/zcode/android-kotlin/agents/mockup-reviewer.md +81 -0
- package/presets/zcode/android-kotlin/agents/openspec-author.md +185 -0
- package/presets/zcode/android-kotlin/agents/performance-auditor.md +94 -0
- package/presets/zcode/android-kotlin/agents/qa-tester.md +91 -0
- package/presets/zcode/android-kotlin/agents/security-reviewer.md +86 -0
- package/presets/zcode/android-kotlin/agents/solution-architect.md +48 -0
- package/presets/zcode/android-kotlin/agents/task-analyst.md +152 -0
- package/presets/zcode/android-kotlin/agents/task-router.md +190 -0
- package/presets/zcode/android-kotlin/agents/tech-writer.md +91 -0
- package/presets/zcode/android-kotlin/agents/unit-test-generator.md +77 -0
- package/presets/zcode/android-kotlin/agents/unit-test-healer.md +76 -0
- package/presets/zcode/android-kotlin/agents/unit-test-planner.md +89 -0
- package/presets/zcode/android-kotlin/ai-local/conventions.md +25 -0
- package/presets/zcode/android-kotlin/commands/README.md +51 -0
- package/presets/zcode/android-kotlin/commands/migrate-tasks.md +44 -0
- package/presets/zcode/android-kotlin/commands/spec-start.md +32 -0
- package/presets/zcode/android-kotlin/commands/task-continue.md +75 -0
- package/presets/zcode/android-kotlin/commands/task.md +76 -0
- package/presets/zcode/android-kotlin/commands/technical-retro.md +96 -0
- package/presets/zcode/android-kotlin/commands/update.md +43 -0
- package/presets/zcode/android-kotlin/hooks/README.md +31 -0
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +2768 -0
- package/presets/zcode/android-kotlin/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/android-kotlin/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/android-kotlin/mcp.json +11 -0
- package/presets/zcode/android-kotlin/rules/README.md +25 -0
- package/presets/zcode/android-kotlin/rules/agent-team-intake.md +14 -0
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/android-kotlin/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/android-kotlin/rules/android-app-core.md +27 -0
- package/presets/zcode/android-kotlin/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/android-kotlin/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/android-kotlin/rules/architecture-boundaries.md +23 -0
- package/presets/zcode/android-kotlin/rules/code-quality-and-refactoring.md +77 -0
- package/presets/zcode/android-kotlin/rules/code-review-mr.md +109 -0
- package/presets/zcode/android-kotlin/rules/compose-ui.md +25 -0
- package/presets/zcode/android-kotlin/rules/design-guidance.md +104 -0
- package/presets/zcode/android-kotlin/rules/di-dagger-feature-holders.md +26 -0
- package/presets/zcode/android-kotlin/rules/feature-delivery-workflow.md +43 -0
- package/presets/zcode/android-kotlin/rules/gradle-tooling.md +22 -0
- package/presets/zcode/android-kotlin/rules/interactive-questions.md +29 -0
- package/presets/zcode/android-kotlin/rules/kotlin-anti-hallucination.md +27 -0
- package/presets/zcode/android-kotlin/rules/kotlin-conventions.md +24 -0
- package/presets/zcode/android-kotlin/rules/language-policy.md +51 -0
- package/presets/zcode/android-kotlin/rules/mcp-usage.md +94 -0
- package/presets/zcode/android-kotlin/rules/mockup-review.md +171 -0
- package/presets/zcode/android-kotlin/rules/module-public-api.md +22 -0
- package/presets/zcode/android-kotlin/rules/navigation-feature-launcher.md +23 -0
- package/presets/zcode/android-kotlin/rules/networking-data.md +23 -0
- package/presets/zcode/android-kotlin/rules/persistence-data.md +22 -0
- package/presets/zcode/android-kotlin/rules/post-change-build.md +25 -0
- package/presets/zcode/android-kotlin/rules/preset-goals.md +31 -0
- package/presets/zcode/android-kotlin/rules/preset-layering.md +27 -0
- package/presets/zcode/android-kotlin/rules/preset-no-cross-stack-leakage.md +93 -0
- package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/android-kotlin/rules/preset-token-budget.md +38 -0
- package/presets/zcode/android-kotlin/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/android-kotlin/rules/preset-writing-style.md +42 -0
- package/presets/zcode/android-kotlin/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/android-kotlin/rules/product-specs.md +61 -0
- package/presets/zcode/android-kotlin/rules/reference-features.md +22 -0
- package/presets/zcode/android-kotlin/rules/security-android.md +21 -0
- package/presets/zcode/android-kotlin/rules/state-and-viewmodels.md +21 -0
- package/presets/zcode/android-kotlin/rules/technical-retro.md +13 -0
- package/presets/zcode/android-kotlin/rules/tests-ui.md +22 -0
- package/presets/zcode/android-kotlin/rules/tests-unit.md +22 -0
- package/presets/zcode/android-kotlin/rules/ux-design.md +103 -0
- package/presets/zcode/android-kotlin/skills/README.md +18 -0
- package/presets/zcode/android-kotlin/skills/ci-investigation/SKILL.md +53 -0
- package/presets/zcode/android-kotlin/skills/code-review/SKILL.md +61 -0
- package/presets/zcode/android-kotlin/skills/debug-investigation/SKILL.md +72 -0
- package/presets/zcode/android-kotlin/skills/feature-delivery/SKILL.md +51 -0
- package/presets/zcode/android-kotlin/skills/instrumentation-ui-e2e/SKILL.md +23 -0
- package/presets/zcode/android-kotlin/skills/mockup-review/SKILL.md +34 -0
- package/presets/zcode/android-kotlin/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/android-kotlin/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/android-kotlin/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/android-kotlin/skills/unit-testing/SKILL.md +38 -0
- package/presets/zcode/android-kotlin/skills/ux-design/SKILL.md +41 -0
- package/presets/zcode/android-kotlin/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/android-kotlin/team/README.md +123 -0
- package/presets/zcode/android-kotlin/team/fixtures/artifact-manifest.example.json +26 -0
- package/presets/zcode/android-kotlin/team/fixtures/bugfix-standard.json +47 -0
- package/presets/zcode/android-kotlin/team/fixtures/feature-full.json +98 -0
- package/presets/zcode/android-kotlin/team/fixtures/feature-light.json +38 -0
- package/presets/zcode/android-kotlin/team/fixtures/feature-with-figma-url.json +17 -0
- package/presets/zcode/android-kotlin/team/fixtures/feature-with-ux-no-figma.json +17 -0
- package/presets/zcode/android-kotlin/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/android-kotlin/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/zcode/android-kotlin/team/fixtures/mockup-review-standalone.json +14 -0
- package/presets/zcode/android-kotlin/team/fixtures/ux-design-standalone.json +15 -0
- package/presets/zcode/go/MCP.md +37 -0
- package/presets/zcode/go/README.md +20 -0
- package/presets/zcode/go/REPO_AGENTS.md +100 -0
- package/presets/zcode/go/adapter-map.json +864 -0
- package/presets/zcode/go/agents/README.md +55 -0
- package/presets/zcode/go/agents/api-contract-reviewer.md +47 -0
- package/presets/zcode/go/agents/build-verifier.md +72 -0
- package/presets/zcode/go/agents/ci-investigator.md +66 -0
- package/presets/zcode/go/agents/code-reviewer.md +128 -0
- package/presets/zcode/go/agents/codebase-analyzer.md +49 -0
- package/presets/zcode/go/agents/debugger.md +98 -0
- package/presets/zcode/go/agents/feature-developer.md +144 -0
- package/presets/zcode/go/agents/integration-test-generator.md +46 -0
- package/presets/zcode/go/agents/integration-test-healer.md +46 -0
- package/presets/zcode/go/agents/integration-test-planner.md +48 -0
- package/presets/zcode/go/agents/migration-specialist.md +59 -0
- package/presets/zcode/go/agents/openspec-author.md +185 -0
- package/presets/zcode/go/agents/performance-auditor.md +50 -0
- package/presets/zcode/go/agents/qa-tester.md +53 -0
- package/presets/zcode/go/agents/security-reviewer.md +42 -0
- package/presets/zcode/go/agents/solution-architect.md +56 -0
- package/presets/zcode/go/agents/task-analyst.md +131 -0
- package/presets/zcode/go/agents/task-router.md +179 -0
- package/presets/zcode/go/agents/tech-writer.md +45 -0
- package/presets/zcode/go/agents/unit-test-generator.md +44 -0
- package/presets/zcode/go/agents/unit-test-healer.md +36 -0
- package/presets/zcode/go/agents/unit-test-planner.md +51 -0
- package/presets/zcode/go/ai-local/conventions.md +29 -0
- package/presets/zcode/go/commands/README.md +54 -0
- package/presets/zcode/go/commands/migrate-tasks.md +44 -0
- package/presets/zcode/go/commands/spec-start.md +32 -0
- package/presets/zcode/go/commands/task-continue.md +73 -0
- package/presets/zcode/go/commands/task.md +74 -0
- package/presets/zcode/go/commands/technical-retro.md +96 -0
- package/presets/zcode/go/commands/update.md +43 -0
- package/presets/zcode/go/hooks/README.md +31 -0
- package/presets/zcode/go/hooks/chain-team-phases.sh +2763 -0
- package/presets/zcode/go/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/go/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/go/mcp.json +11 -0
- package/presets/zcode/go/rules/README.md +25 -0
- package/presets/zcode/go/rules/adapters-driven.md +25 -0
- package/presets/zcode/go/rules/adapters-driving.md +26 -0
- package/presets/zcode/go/rules/agent-team-intake.md +18 -0
- package/presets/zcode/go/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/go/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/go/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/go/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/go/rules/api-grpc.md +20 -0
- package/presets/zcode/go/rules/api-http.md +25 -0
- package/presets/zcode/go/rules/application-usecases.md +26 -0
- package/presets/zcode/go/rules/architecture-boundaries.md +31 -0
- package/presets/zcode/go/rules/code-quality-and-refactoring.md +78 -0
- package/presets/zcode/go/rules/code-review-mr.md +77 -0
- package/presets/zcode/go/rules/composition-root.md +26 -0
- package/presets/zcode/go/rules/design-guidance.md +104 -0
- package/presets/zcode/go/rules/domain-layer.md +25 -0
- package/presets/zcode/go/rules/feature-delivery-workflow.md +59 -0
- package/presets/zcode/go/rules/go-anti-hallucination.md +27 -0
- package/presets/zcode/go/rules/go-app-core.md +31 -0
- package/presets/zcode/go/rules/go-conventions.md +46 -0
- package/presets/zcode/go/rules/go-tooling.md +28 -0
- package/presets/zcode/go/rules/interactive-questions.md +29 -0
- package/presets/zcode/go/rules/language-policy.md +51 -0
- package/presets/zcode/go/rules/mcp-usage.md +93 -0
- package/presets/zcode/go/rules/messaging-adapters.md +15 -0
- package/presets/zcode/go/rules/module-public-api.md +16 -0
- package/presets/zcode/go/rules/persistence-adapters.md +24 -0
- package/presets/zcode/go/rules/ports-interfaces.md +26 -0
- package/presets/zcode/go/rules/post-change-test.md +22 -0
- package/presets/zcode/go/rules/preset-goals.md +31 -0
- package/presets/zcode/go/rules/preset-layering.md +27 -0
- package/presets/zcode/go/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/go/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/go/rules/preset-token-budget.md +38 -0
- package/presets/zcode/go/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/go/rules/preset-writing-style.md +42 -0
- package/presets/zcode/go/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/go/rules/product-specs.md +62 -0
- package/presets/zcode/go/rules/reference-features.md +45 -0
- package/presets/zcode/go/rules/security-go.md +26 -0
- package/presets/zcode/go/rules/technical-retro.md +13 -0
- package/presets/zcode/go/rules/tests-e2e.md +13 -0
- package/presets/zcode/go/rules/tests-integration.md +22 -0
- package/presets/zcode/go/rules/tests-unit.md +18 -0
- package/presets/zcode/go/skills/README.md +5 -0
- package/presets/zcode/go/skills/ci-investigation/SKILL.md +24 -0
- package/presets/zcode/go/skills/code-review/SKILL.md +47 -0
- package/presets/zcode/go/skills/debug-investigation/SKILL.md +55 -0
- package/presets/zcode/go/skills/feature-delivery/SKILL.md +43 -0
- package/presets/zcode/go/skills/integration-testing/SKILL.md +21 -0
- package/presets/zcode/go/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/go/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/go/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/go/skills/unit-testing/SKILL.md +20 -0
- package/presets/zcode/go/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/go/team/README.md +123 -0
- package/presets/zcode/go/team/fixtures/bugfix-standard.json +37 -0
- package/presets/zcode/go/team/fixtures/feature-full.json +61 -0
- package/presets/zcode/go/team/fixtures/feature-light.json +17 -0
- package/presets/zcode/go/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/ios-swift/MCP.md +35 -0
- package/presets/zcode/ios-swift/README.md +20 -0
- package/presets/zcode/ios-swift/REPO_AGENTS.md +98 -0
- package/presets/zcode/ios-swift/adapter-map.json +918 -0
- package/presets/zcode/ios-swift/agents/README.md +86 -0
- package/presets/zcode/ios-swift/agents/accessibility-reviewer.md +85 -0
- package/presets/zcode/ios-swift/agents/api-contract-reviewer.md +85 -0
- package/presets/zcode/ios-swift/agents/build-verifier.md +103 -0
- package/presets/zcode/ios-swift/agents/ci-investigator.md +107 -0
- package/presets/zcode/ios-swift/agents/code-reviewer.md +133 -0
- package/presets/zcode/ios-swift/agents/codebase-analyzer.md +49 -0
- package/presets/zcode/ios-swift/agents/debugger.md +129 -0
- package/presets/zcode/ios-swift/agents/feature-developer.md +153 -0
- package/presets/zcode/ios-swift/agents/migration-specialist.md +95 -0
- package/presets/zcode/ios-swift/agents/mockup-reviewer.md +81 -0
- package/presets/zcode/ios-swift/agents/openspec-author.md +185 -0
- package/presets/zcode/ios-swift/agents/performance-auditor.md +94 -0
- package/presets/zcode/ios-swift/agents/qa-tester.md +85 -0
- package/presets/zcode/ios-swift/agents/security-reviewer.md +81 -0
- package/presets/zcode/ios-swift/agents/solution-architect.md +48 -0
- package/presets/zcode/ios-swift/agents/task-analyst.md +152 -0
- package/presets/zcode/ios-swift/agents/task-router.md +190 -0
- package/presets/zcode/ios-swift/agents/tech-writer.md +75 -0
- package/presets/zcode/ios-swift/agents/unit-test-generator.md +71 -0
- package/presets/zcode/ios-swift/agents/unit-test-healer.md +70 -0
- package/presets/zcode/ios-swift/agents/unit-test-planner.md +83 -0
- package/presets/zcode/ios-swift/agents/xcuitest-test-generator.md +59 -0
- package/presets/zcode/ios-swift/agents/xcuitest-test-healer.md +59 -0
- package/presets/zcode/ios-swift/agents/xcuitest-test-planner.md +79 -0
- package/presets/zcode/ios-swift/ai-local/conventions.md +29 -0
- package/presets/zcode/ios-swift/commands/README.md +51 -0
- package/presets/zcode/ios-swift/commands/migrate-tasks.md +44 -0
- package/presets/zcode/ios-swift/commands/spec-start.md +32 -0
- package/presets/zcode/ios-swift/commands/task-continue.md +75 -0
- package/presets/zcode/ios-swift/commands/task.md +76 -0
- package/presets/zcode/ios-swift/commands/technical-retro.md +96 -0
- package/presets/zcode/ios-swift/commands/update.md +43 -0
- package/presets/zcode/ios-swift/hooks/README.md +31 -0
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +2768 -0
- package/presets/zcode/ios-swift/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/ios-swift/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/ios-swift/mcp.json +11 -0
- package/presets/zcode/ios-swift/rules/README.md +25 -0
- package/presets/zcode/ios-swift/rules/agent-team-intake.md +14 -0
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/ios-swift/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/ios-swift/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/ios-swift/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/ios-swift/rules/architecture-boundaries.md +29 -0
- package/presets/zcode/ios-swift/rules/code-quality-and-refactoring.md +77 -0
- package/presets/zcode/ios-swift/rules/code-review-mr.md +109 -0
- package/presets/zcode/ios-swift/rules/design-guidance.md +104 -0
- package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +129 -0
- package/presets/zcode/ios-swift/rules/interactive-questions.md +29 -0
- package/presets/zcode/ios-swift/rules/ios-app-core.md +20 -0
- package/presets/zcode/ios-swift/rules/language-policy.md +51 -0
- package/presets/zcode/ios-swift/rules/mcp-usage.md +94 -0
- package/presets/zcode/ios-swift/rules/mockup-review.md +171 -0
- package/presets/zcode/ios-swift/rules/module-public-api.md +17 -0
- package/presets/zcode/ios-swift/rules/navigation-coordinators.md +18 -0
- package/presets/zcode/ios-swift/rules/networking-services.md +43 -0
- package/presets/zcode/ios-swift/rules/persistence-data.md +20 -0
- package/presets/zcode/ios-swift/rules/post-change-build.md +27 -0
- package/presets/zcode/ios-swift/rules/preset-goals.md +31 -0
- package/presets/zcode/ios-swift/rules/preset-layering.md +27 -0
- package/presets/zcode/ios-swift/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/ios-swift/rules/preset-token-budget.md +38 -0
- package/presets/zcode/ios-swift/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/ios-swift/rules/preset-writing-style.md +42 -0
- package/presets/zcode/ios-swift/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/ios-swift/rules/product-specs.md +61 -0
- package/presets/zcode/ios-swift/rules/reference-features.md +94 -0
- package/presets/zcode/ios-swift/rules/security-ios.md +24 -0
- package/presets/zcode/ios-swift/rules/state-and-viewmodels.md +37 -0
- package/presets/zcode/ios-swift/rules/swift-anti-hallucination.md +27 -0
- package/presets/zcode/ios-swift/rules/swift-conventions.md +55 -0
- package/presets/zcode/ios-swift/rules/swiftui-ui.md +70 -0
- package/presets/zcode/ios-swift/rules/technical-retro.md +13 -0
- package/presets/zcode/ios-swift/rules/tests-ui.md +37 -0
- package/presets/zcode/ios-swift/rules/tests-unit.md +35 -0
- package/presets/zcode/ios-swift/rules/ux-design.md +103 -0
- package/presets/zcode/ios-swift/rules/xcode-tooling.md +15 -0
- package/presets/zcode/ios-swift/skills/README.md +18 -0
- package/presets/zcode/ios-swift/skills/ci-investigation/SKILL.md +53 -0
- package/presets/zcode/ios-swift/skills/code-review/SKILL.md +61 -0
- package/presets/zcode/ios-swift/skills/debug-investigation/SKILL.md +72 -0
- package/presets/zcode/ios-swift/skills/feature-delivery/SKILL.md +51 -0
- package/presets/zcode/ios-swift/skills/mockup-review/SKILL.md +34 -0
- package/presets/zcode/ios-swift/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/ios-swift/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/ios-swift/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/ios-swift/skills/unit-testing/SKILL.md +38 -0
- package/presets/zcode/ios-swift/skills/ux-design/SKILL.md +41 -0
- package/presets/zcode/ios-swift/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/ios-swift/skills/xcuitest-e2e/SKILL.md +39 -0
- package/presets/zcode/ios-swift/team/README.md +123 -0
- package/presets/zcode/ios-swift/team/fixtures/artifact-manifest.example.json +26 -0
- package/presets/zcode/ios-swift/team/fixtures/bugfix-standard.json +33 -0
- package/presets/zcode/ios-swift/team/fixtures/feature-full.json +61 -0
- package/presets/zcode/ios-swift/team/fixtures/feature-light.json +17 -0
- package/presets/zcode/ios-swift/team/fixtures/feature-with-figma-url.json +17 -0
- package/presets/zcode/ios-swift/team/fixtures/feature-with-ux-no-figma.json +17 -0
- package/presets/zcode/ios-swift/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/ios-swift/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/zcode/ios-swift/team/fixtures/mockup-review-standalone.json +14 -0
- package/presets/zcode/ios-swift/team/fixtures/ux-design-standalone.json +15 -0
- package/presets/zcode/java/MCP.md +34 -0
- package/presets/zcode/java/README.md +20 -0
- package/presets/zcode/java/REPO_AGENTS.md +98 -0
- package/presets/zcode/java/adapter-map.json +864 -0
- package/presets/zcode/java/agents/README.md +55 -0
- package/presets/zcode/java/agents/api-contract-reviewer.md +47 -0
- package/presets/zcode/java/agents/build-verifier.md +72 -0
- package/presets/zcode/java/agents/ci-investigator.md +66 -0
- package/presets/zcode/java/agents/code-reviewer.md +128 -0
- package/presets/zcode/java/agents/codebase-analyzer.md +49 -0
- package/presets/zcode/java/agents/debugger.md +98 -0
- package/presets/zcode/java/agents/feature-developer.md +144 -0
- package/presets/zcode/java/agents/integration-test-generator.md +46 -0
- package/presets/zcode/java/agents/integration-test-healer.md +46 -0
- package/presets/zcode/java/agents/integration-test-planner.md +48 -0
- package/presets/zcode/java/agents/migration-specialist.md +59 -0
- package/presets/zcode/java/agents/openspec-author.md +185 -0
- package/presets/zcode/java/agents/performance-auditor.md +50 -0
- package/presets/zcode/java/agents/qa-tester.md +53 -0
- package/presets/zcode/java/agents/security-reviewer.md +42 -0
- package/presets/zcode/java/agents/solution-architect.md +56 -0
- package/presets/zcode/java/agents/task-analyst.md +131 -0
- package/presets/zcode/java/agents/task-router.md +179 -0
- package/presets/zcode/java/agents/tech-writer.md +45 -0
- package/presets/zcode/java/agents/unit-test-generator.md +44 -0
- package/presets/zcode/java/agents/unit-test-healer.md +36 -0
- package/presets/zcode/java/agents/unit-test-planner.md +51 -0
- package/presets/zcode/java/ai-local/conventions.md +29 -0
- package/presets/zcode/java/commands/README.md +54 -0
- package/presets/zcode/java/commands/migrate-tasks.md +44 -0
- package/presets/zcode/java/commands/spec-start.md +32 -0
- package/presets/zcode/java/commands/task-continue.md +73 -0
- package/presets/zcode/java/commands/task.md +74 -0
- package/presets/zcode/java/commands/technical-retro.md +96 -0
- package/presets/zcode/java/commands/update.md +43 -0
- package/presets/zcode/java/hooks/README.md +31 -0
- package/presets/zcode/java/hooks/chain-team-phases.sh +2763 -0
- package/presets/zcode/java/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/java/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/java/mcp.json +11 -0
- package/presets/zcode/java/rules/README.md +25 -0
- package/presets/zcode/java/rules/adapters-driven.md +30 -0
- package/presets/zcode/java/rules/adapters-driving.md +30 -0
- package/presets/zcode/java/rules/agent-team-intake.md +18 -0
- package/presets/zcode/java/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/java/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/java/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/java/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/java/rules/api-grpc.md +22 -0
- package/presets/zcode/java/rules/api-http.md +28 -0
- package/presets/zcode/java/rules/application-usecases.md +26 -0
- package/presets/zcode/java/rules/architecture-boundaries.md +31 -0
- package/presets/zcode/java/rules/code-quality-and-refactoring.md +78 -0
- package/presets/zcode/java/rules/code-review-mr.md +79 -0
- package/presets/zcode/java/rules/composition-root.md +25 -0
- package/presets/zcode/java/rules/design-guidance.md +105 -0
- package/presets/zcode/java/rules/domain-layer.md +32 -0
- package/presets/zcode/java/rules/feature-delivery-workflow.md +59 -0
- package/presets/zcode/java/rules/interactive-questions.md +29 -0
- package/presets/zcode/java/rules/java-anti-hallucination.md +27 -0
- package/presets/zcode/java/rules/java-app-core.md +32 -0
- package/presets/zcode/java/rules/java-conventions.md +48 -0
- package/presets/zcode/java/rules/java-tooling.md +24 -0
- package/presets/zcode/java/rules/language-policy.md +51 -0
- package/presets/zcode/java/rules/mcp-usage.md +92 -0
- package/presets/zcode/java/rules/messaging-adapters.md +23 -0
- package/presets/zcode/java/rules/module-public-api.md +23 -0
- package/presets/zcode/java/rules/persistence-adapters.md +25 -0
- package/presets/zcode/java/rules/ports-interfaces.md +27 -0
- package/presets/zcode/java/rules/post-change-test.md +20 -0
- package/presets/zcode/java/rules/preset-goals.md +31 -0
- package/presets/zcode/java/rules/preset-layering.md +27 -0
- package/presets/zcode/java/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/java/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/java/rules/preset-token-budget.md +38 -0
- package/presets/zcode/java/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/java/rules/preset-writing-style.md +42 -0
- package/presets/zcode/java/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/java/rules/product-specs.md +62 -0
- package/presets/zcode/java/rules/reference-features.md +45 -0
- package/presets/zcode/java/rules/security-java.md +21 -0
- package/presets/zcode/java/rules/technical-retro.md +13 -0
- package/presets/zcode/java/rules/tests-e2e.md +15 -0
- package/presets/zcode/java/rules/tests-integration.md +19 -0
- package/presets/zcode/java/rules/tests-unit.md +26 -0
- package/presets/zcode/java/skills/README.md +5 -0
- package/presets/zcode/java/skills/ci-investigation/SKILL.md +24 -0
- package/presets/zcode/java/skills/code-review/SKILL.md +47 -0
- package/presets/zcode/java/skills/debug-investigation/SKILL.md +55 -0
- package/presets/zcode/java/skills/feature-delivery/SKILL.md +43 -0
- package/presets/zcode/java/skills/integration-testing/SKILL.md +21 -0
- package/presets/zcode/java/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/java/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/java/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/java/skills/unit-testing/SKILL.md +20 -0
- package/presets/zcode/java/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/java/team/README.md +123 -0
- package/presets/zcode/java/team/fixtures/bugfix-standard.json +37 -0
- package/presets/zcode/java/team/fixtures/feature-full.json +61 -0
- package/presets/zcode/java/team/fixtures/feature-light.json +17 -0
- package/presets/zcode/java/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/mcp-ts/MCP.md +56 -0
- package/presets/zcode/mcp-ts/README.md +20 -0
- package/presets/zcode/mcp-ts/REPO_AGENTS.md +101 -0
- package/presets/zcode/mcp-ts/adapter-map.json +612 -0
- package/presets/zcode/mcp-ts/agents/README.md +53 -0
- package/presets/zcode/mcp-ts/agents/build-verifier.md +73 -0
- package/presets/zcode/mcp-ts/agents/feature-developer.md +138 -0
- package/presets/zcode/mcp-ts/agents/security-reviewer.md +43 -0
- package/presets/zcode/mcp-ts/agents/solution-architect.md +50 -0
- package/presets/zcode/mcp-ts/agents/task-analyst.md +134 -0
- package/presets/zcode/mcp-ts/agents/task-router.md +175 -0
- package/presets/zcode/mcp-ts/ai-local/conventions.md +22 -0
- package/presets/zcode/mcp-ts/commands/README.md +11 -0
- package/presets/zcode/mcp-ts/commands/migrate-tasks.md +44 -0
- package/presets/zcode/mcp-ts/commands/spec-start.md +32 -0
- package/presets/zcode/mcp-ts/commands/task-continue.md +73 -0
- package/presets/zcode/mcp-ts/commands/task.md +74 -0
- package/presets/zcode/mcp-ts/commands/technical-retro.md +96 -0
- package/presets/zcode/mcp-ts/commands/update.md +43 -0
- package/presets/zcode/mcp-ts/hooks/README.md +31 -0
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +2710 -0
- package/presets/zcode/mcp-ts/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/mcp-ts/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/mcp-ts/mcp.json +11 -0
- package/presets/zcode/mcp-ts/rules/README.md +25 -0
- package/presets/zcode/mcp-ts/rules/agent-team-intake.md +19 -0
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/mcp-ts/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/mcp-ts/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/mcp-ts/rules/anti-sycophancy-discipline.md +27 -0
- package/presets/zcode/mcp-ts/rules/code-quality-and-refactoring.md +78 -0
- package/presets/zcode/mcp-ts/rules/code-review-mr.md +76 -0
- package/presets/zcode/mcp-ts/rules/design-guidance.md +104 -0
- package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +59 -0
- package/presets/zcode/mcp-ts/rules/interactive-questions.md +29 -0
- package/presets/zcode/mcp-ts/rules/language-policy.md +51 -0
- package/presets/zcode/mcp-ts/rules/mcp-auth-secrets.md +35 -0
- package/presets/zcode/mcp-ts/rules/mcp-contract-testing.md +32 -0
- package/presets/zcode/mcp-ts/rules/mcp-server-boundaries.md +24 -0
- package/presets/zcode/mcp-ts/rules/mcp-tool-design.md +29 -0
- package/presets/zcode/mcp-ts/rules/mcp-transport-packaging.md +34 -0
- package/presets/zcode/mcp-ts/rules/mcp-ts-anti-hallucination.md +27 -0
- package/presets/zcode/mcp-ts/rules/mcp-ts-app-core.md +27 -0
- package/presets/zcode/mcp-ts/rules/mcp-ts-conventions.md +22 -0
- package/presets/zcode/mcp-ts/rules/mcp-ts-tooling.md +21 -0
- package/presets/zcode/mcp-ts/rules/mcp-usage.md +93 -0
- package/presets/zcode/mcp-ts/rules/post-change-test.md +21 -0
- package/presets/zcode/mcp-ts/rules/preset-goals.md +31 -0
- package/presets/zcode/mcp-ts/rules/preset-layering.md +27 -0
- package/presets/zcode/mcp-ts/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/mcp-ts/rules/preset-token-budget.md +38 -0
- package/presets/zcode/mcp-ts/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/mcp-ts/rules/preset-writing-style.md +42 -0
- package/presets/zcode/mcp-ts/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/mcp-ts/rules/product-specs.md +62 -0
- package/presets/zcode/mcp-ts/rules/reference-features.md +45 -0
- package/presets/zcode/mcp-ts/rules/security-mcp.md +43 -0
- package/presets/zcode/mcp-ts/rules/technical-retro.md +13 -0
- package/presets/zcode/mcp-ts/rules/tests-unit.md +23 -0
- package/presets/zcode/mcp-ts/skills/README.md +14 -0
- package/presets/zcode/mcp-ts/skills/code-review/SKILL.md +31 -0
- package/presets/zcode/mcp-ts/skills/debug-investigation/SKILL.md +51 -0
- package/presets/zcode/mcp-ts/skills/feature-delivery/SKILL.md +42 -0
- package/presets/zcode/mcp-ts/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/mcp-ts/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/mcp-ts/skills/unit-testing/SKILL.md +22 -0
- package/presets/zcode/mcp-ts/team/README.md +123 -0
- package/presets/zcode/mcp-ts/team/fixtures/bugfix-standard.json +32 -0
- package/presets/zcode/mcp-ts/team/fixtures/feature-full.json +36 -0
- package/presets/zcode/mcp-ts/team/fixtures/feature-light.json +34 -0
- package/presets/zcode/mcp-ts/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/mol/MCP.md +50 -0
- package/presets/zcode/mol/README.md +20 -0
- package/presets/zcode/mol/REPO_AGENTS.md +107 -0
- package/presets/zcode/mol/adapter-map.json +1122 -0
- package/presets/zcode/mol/agents/README.md +98 -0
- package/presets/zcode/mol/agents/accessibility-reviewer.md +92 -0
- package/presets/zcode/mol/agents/api-contract-reviewer.md +87 -0
- package/presets/zcode/mol/agents/build-verifier.md +117 -0
- package/presets/zcode/mol/agents/ci-investigator.md +95 -0
- package/presets/zcode/mol/agents/code-reviewer.md +139 -0
- package/presets/zcode/mol/agents/codebase-analyzer.md +51 -0
- package/presets/zcode/mol/agents/debugger.md +126 -0
- package/presets/zcode/mol/agents/feature-developer.md +151 -0
- package/presets/zcode/mol/agents/migration-specialist.md +97 -0
- package/presets/zcode/mol/agents/mockup-reviewer.md +131 -0
- package/presets/zcode/mol/agents/openspec-author.md +213 -0
- package/presets/zcode/mol/agents/performance-auditor.md +98 -0
- package/presets/zcode/mol/agents/playwright-test-generator.md +56 -0
- package/presets/zcode/mol/agents/playwright-test-healer.md +57 -0
- package/presets/zcode/mol/agents/playwright-test-planner.md +51 -0
- package/presets/zcode/mol/agents/qa-tester.md +80 -0
- package/presets/zcode/mol/agents/security-reviewer.md +89 -0
- package/presets/zcode/mol/agents/solution-architect.md +99 -0
- package/presets/zcode/mol/agents/task-analyst.md +255 -0
- package/presets/zcode/mol/agents/task-router.md +267 -0
- package/presets/zcode/mol/agents/tech-writer.md +88 -0
- package/presets/zcode/mol/agents/unit-test-generator.md +59 -0
- package/presets/zcode/mol/agents/unit-test-healer.md +60 -0
- package/presets/zcode/mol/agents/unit-test-planner.md +84 -0
- package/presets/zcode/mol/ai-local/conventions.md +49 -0
- package/presets/zcode/mol/ai-local/rules/task-levels.md +40 -0
- package/presets/zcode/mol/ai-local/rules-library/agent-artifacts-no-local-paths.md +71 -0
- package/presets/zcode/mol/ai-local/rules-library/agent-pipeline-gates.md +19 -0
- package/presets/zcode/mol/ai-local/rules-library/analytics-events.md +18 -0
- package/presets/zcode/mol/ai-local/rules-library/api-contract-source.md +14 -0
- package/presets/zcode/mol/ai-local/rules-library/artifact-lifecycle.md +17 -0
- package/presets/zcode/mol/ai-local/rules-library/code-style.md +68 -0
- package/presets/zcode/mol/ai-local/rules-library/commit-hygiene.md +17 -0
- package/presets/zcode/mol/ai-local/rules-library/component-child-decomposition.md +81 -0
- package/presets/zcode/mol/ai-local/rules-library/feature-flags-experiments.md +15 -0
- package/presets/zcode/mol/ai-local/rules-library/mcp-required-for-ui-layout.md +45 -0
- package/presets/zcode/mol/ai-local/rules-library/no-react-fc.md +46 -0
- package/presets/zcode/mol/ai-local/rules-library/no-test-driven-behavior-change.md +14 -0
- package/presets/zcode/mol/ai-local/rules-library/pre-pr-checklist.md +16 -0
- package/presets/zcode/mol/ai-local/rules-library/pwa-service-worker.md +15 -0
- package/presets/zcode/mol/ai-local/rules-library/qa-test-cases.md +14 -0
- package/presets/zcode/mol/ai-local/rules-library/router-pages.md +25 -0
- package/presets/zcode/mol/ai-local/rules-library/single-source-copy-constants.md +18 -0
- package/presets/zcode/mol/ai-local/rules-library/storybook-catalog-structure.md +62 -0
- package/presets/zcode/mol/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
- package/presets/zcode/mol/ai-local/rules-library/storybook-csf-authoring.md +100 -0
- package/presets/zcode/mol/ai-local/rules-library/storybook-dev-compare-figma.md +71 -0
- package/presets/zcode/mol/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
- package/presets/zcode/mol/ai-local/rules-library/storybook-modals.md +64 -0
- package/presets/zcode/mol/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
- package/presets/zcode/mol/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
- package/presets/zcode/mol/ai-local/rules-library/ui-change-review-gate.md +15 -0
- package/presets/zcode/mol/commands/README.md +56 -0
- package/presets/zcode/mol/commands/migrate-tasks.md +44 -0
- package/presets/zcode/mol/commands/spec-start.md +32 -0
- package/presets/zcode/mol/commands/task-continue.md +75 -0
- package/presets/zcode/mol/commands/task-evil.md +90 -0
- package/presets/zcode/mol/commands/task.md +79 -0
- package/presets/zcode/mol/commands/technical-retro.md +96 -0
- package/presets/zcode/mol/commands/update.md +43 -0
- package/presets/zcode/mol/hooks/README.md +31 -0
- package/presets/zcode/mol/hooks/chain-team-phases.sh +2765 -0
- package/presets/zcode/mol/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/mol/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/mol/mcp.json +19 -0
- package/presets/zcode/mol/rules/README.md +25 -0
- package/presets/zcode/mol/rules/agent-team-intake.md +14 -0
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/mol/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/mol/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/mol/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/mol/rules/code-quality-and-refactoring.md +76 -0
- package/presets/zcode/mol/rules/code-review-mr.md +95 -0
- package/presets/zcode/mol/rules/design-guidance.md +104 -0
- package/presets/zcode/mol/rules/feature-delivery-workflow.md +144 -0
- package/presets/zcode/mol/rules/interactive-questions.md +29 -0
- package/presets/zcode/mol/rules/language-policy.md +51 -0
- package/presets/zcode/mol/rules/mcp-usage.md +96 -0
- package/presets/zcode/mol/rules/mol-app-core.md +29 -0
- package/presets/zcode/mol/rules/mol-build.md +19 -0
- package/presets/zcode/mol/rules/mol-components.md +31 -0
- package/presets/zcode/mol/rules/mol-reactivity.md +21 -0
- package/presets/zcode/mol/rules/mol-state.md +22 -0
- package/presets/zcode/mol/rules/mol-testing.md +28 -0
- package/presets/zcode/mol/rules/mol-theming.md +22 -0
- package/presets/zcode/mol/rules/mol-view-tree.md +27 -0
- package/presets/zcode/mol/rules/package-manager.md +7 -0
- package/presets/zcode/mol/rules/preset-goals.md +31 -0
- package/presets/zcode/mol/rules/preset-layering.md +27 -0
- package/presets/zcode/mol/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/mol/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/mol/rules/preset-token-budget.md +38 -0
- package/presets/zcode/mol/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/mol/rules/preset-writing-style.md +42 -0
- package/presets/zcode/mol/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/mol/rules/product-specs.md +61 -0
- package/presets/zcode/mol/rules/reference-features.md +82 -0
- package/presets/zcode/mol/rules/technical-retro.md +13 -0
- package/presets/zcode/mol/skills/README.md +17 -0
- package/presets/zcode/mol/skills/ci-investigation/SKILL.md +49 -0
- package/presets/zcode/mol/skills/code-review/SKILL.md +60 -0
- package/presets/zcode/mol/skills/debug-investigation/SKILL.md +63 -0
- package/presets/zcode/mol/skills/feature-delivery/SKILL.md +44 -0
- package/presets/zcode/mol/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/mol/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/mol/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/mol/skills/unit-testing/SKILL.md +38 -0
- package/presets/zcode/mol/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/mol/team/README.md +135 -0
- package/presets/zcode/mol/team/fixtures/artifact-manifest.example.json +80 -0
- package/presets/zcode/mol/team/fixtures/bugfix-standard.json +25 -0
- package/presets/zcode/mol/team/fixtures/feature-full.json +29 -0
- package/presets/zcode/mol/team/fixtures/feature-light.json +28 -0
- package/presets/zcode/mol/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/mol/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/zcode/mol/team/fixtures/feature-with-figma-url.json +27 -0
- package/presets/zcode/mol/team/fixtures/feature-with-ux-no-figma.json +26 -0
- package/presets/zcode/mol/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/mol/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
- package/presets/zcode/mol/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
- package/presets/zcode/mol/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
- package/presets/zcode/mol/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
- package/presets/zcode/mol/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
- package/presets/zcode/mol/team/fixtures/metrics.example.json +54 -0
- package/presets/zcode/mol/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/zcode/mol/team/fixtures/mockup-review-standalone.json +23 -0
- package/presets/zcode/mol/team/fixtures/ux-design-standalone.json +24 -0
- package/presets/zcode/mol/team/tasks/.gitkeep +0 -0
- package/presets/zcode/next/MCP.md +50 -0
- package/presets/zcode/next/README.md +20 -0
- package/presets/zcode/next/REPO_AGENTS.md +110 -0
- package/presets/zcode/next/adapter-map.json +1347 -0
- package/presets/zcode/next/agents/README.md +98 -0
- package/presets/zcode/next/agents/accessibility-reviewer.md +92 -0
- package/presets/zcode/next/agents/api-contract-reviewer.md +89 -0
- package/presets/zcode/next/agents/build-verifier.md +119 -0
- package/presets/zcode/next/agents/ci-investigator.md +109 -0
- package/presets/zcode/next/agents/code-reviewer.md +141 -0
- package/presets/zcode/next/agents/codebase-analyzer.md +51 -0
- package/presets/zcode/next/agents/debugger.md +140 -0
- package/presets/zcode/next/agents/feature-developer.md +188 -0
- package/presets/zcode/next/agents/migration-specialist.md +97 -0
- package/presets/zcode/next/agents/mockup-reviewer.md +131 -0
- package/presets/zcode/next/agents/openspec-author.md +213 -0
- package/presets/zcode/next/agents/performance-auditor.md +98 -0
- package/presets/zcode/next/agents/playwright-test-generator.md +60 -0
- package/presets/zcode/next/agents/playwright-test-healer.md +61 -0
- package/presets/zcode/next/agents/playwright-test-planner.md +55 -0
- package/presets/zcode/next/agents/qa-tester.md +85 -0
- package/presets/zcode/next/agents/security-reviewer.md +89 -0
- package/presets/zcode/next/agents/solution-architect.md +99 -0
- package/presets/zcode/next/agents/task-analyst.md +272 -0
- package/presets/zcode/next/agents/task-router.md +267 -0
- package/presets/zcode/next/agents/tech-writer.md +88 -0
- package/presets/zcode/next/agents/unit-test-generator.md +62 -0
- package/presets/zcode/next/agents/unit-test-healer.md +63 -0
- package/presets/zcode/next/agents/unit-test-planner.md +87 -0
- package/presets/zcode/next/ai-local/conventions.md +49 -0
- package/presets/zcode/next/ai-local/rules/task-levels.md +40 -0
- package/presets/zcode/next/ai-local/rules-library/agent-artifacts-no-local-paths.md +71 -0
- package/presets/zcode/next/ai-local/rules-library/agent-pipeline-gates.md +19 -0
- package/presets/zcode/next/ai-local/rules-library/analytics-events.md +18 -0
- package/presets/zcode/next/ai-local/rules-library/api-contract-source.md +14 -0
- package/presets/zcode/next/ai-local/rules-library/artifact-lifecycle.md +17 -0
- package/presets/zcode/next/ai-local/rules-library/code-style.md +68 -0
- package/presets/zcode/next/ai-local/rules-library/commit-hygiene.md +17 -0
- package/presets/zcode/next/ai-local/rules-library/component-child-decomposition.md +81 -0
- package/presets/zcode/next/ai-local/rules-library/feature-flags-experiments.md +15 -0
- package/presets/zcode/next/ai-local/rules-library/mcp-required-for-ui-layout.md +45 -0
- package/presets/zcode/next/ai-local/rules-library/no-react-fc.md +46 -0
- package/presets/zcode/next/ai-local/rules-library/no-test-driven-behavior-change.md +14 -0
- package/presets/zcode/next/ai-local/rules-library/pre-pr-checklist.md +16 -0
- package/presets/zcode/next/ai-local/rules-library/pwa-service-worker.md +15 -0
- package/presets/zcode/next/ai-local/rules-library/qa-test-cases.md +14 -0
- package/presets/zcode/next/ai-local/rules-library/router-pages.md +25 -0
- package/presets/zcode/next/ai-local/rules-library/single-source-copy-constants.md +18 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-catalog-structure.md +62 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-csf-authoring.md +100 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-dev-compare-figma.md +71 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-modals.md +64 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
- package/presets/zcode/next/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
- package/presets/zcode/next/ai-local/rules-library/ui-change-review-gate.md +15 -0
- package/presets/zcode/next/commands/README.md +56 -0
- package/presets/zcode/next/commands/migrate-tasks.md +44 -0
- package/presets/zcode/next/commands/spec-start.md +32 -0
- package/presets/zcode/next/commands/task-continue.md +75 -0
- package/presets/zcode/next/commands/task-evil.md +90 -0
- package/presets/zcode/next/commands/task.md +79 -0
- package/presets/zcode/next/commands/technical-retro.md +96 -0
- package/presets/zcode/next/commands/update.md +43 -0
- package/presets/zcode/next/hooks/README.md +31 -0
- package/presets/zcode/next/hooks/chain-team-phases.sh +2766 -0
- package/presets/zcode/next/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/next/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/next/mcp.json +19 -0
- package/presets/zcode/next/rules/README.md +25 -0
- package/presets/zcode/next/rules/agent-team-intake.md +14 -0
- package/presets/zcode/next/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/next/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/next/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/next/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/next/rules/api-services.md +74 -0
- package/presets/zcode/next/rules/architecture-boundaries-ui.md +9 -0
- package/presets/zcode/next/rules/architecture-boundaries.md +86 -0
- package/presets/zcode/next/rules/arrow-functions.md +25 -0
- package/presets/zcode/next/rules/code-quality-and-refactoring.md +76 -0
- package/presets/zcode/next/rules/code-review-mr.md +95 -0
- package/presets/zcode/next/rules/component-catalog-gate.md +44 -0
- package/presets/zcode/next/rules/css-property-order-stylelint.md +13 -0
- package/presets/zcode/next/rules/design-guidance.md +104 -0
- package/presets/zcode/next/rules/design-tokens-binding.md +44 -0
- package/presets/zcode/next/rules/feature-delivery-workflow.md +166 -0
- package/presets/zcode/next/rules/forms-validation.md +38 -0
- package/presets/zcode/next/rules/http-client.md +55 -0
- package/presets/zcode/next/rules/interactive-questions.md +29 -0
- package/presets/zcode/next/rules/language-policy.md +51 -0
- package/presets/zcode/next/rules/layer-barrel-exports.md +68 -0
- package/presets/zcode/next/rules/mcp-usage.md +96 -0
- package/presets/zcode/next/rules/mockup-review.md +195 -0
- package/presets/zcode/next/rules/navigation-router-stack.md +68 -0
- package/presets/zcode/next/rules/navigation-router-ui.md +10 -0
- package/presets/zcode/next/rules/next-app-core.md +38 -0
- package/presets/zcode/next/rules/next-app-router.md +58 -0
- package/presets/zcode/next/rules/next-static-export.md +44 -0
- package/presets/zcode/next/rules/no-props-spread.md +31 -0
- package/presets/zcode/next/rules/no-type-assertion-as-import-export.md +51 -0
- package/presets/zcode/next/rules/package-manager.md +11 -0
- package/presets/zcode/next/rules/playwright-agents.md +67 -0
- package/presets/zcode/next/rules/post-change-lint.md +39 -0
- package/presets/zcode/next/rules/preset-goals.md +31 -0
- package/presets/zcode/next/rules/preset-layering.md +27 -0
- package/presets/zcode/next/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/next/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/next/rules/preset-token-budget.md +38 -0
- package/presets/zcode/next/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/next/rules/preset-writing-style.md +42 -0
- package/presets/zcode/next/rules/product-specs-authoring.md +119 -0
- package/presets/zcode/next/rules/product-specs.md +63 -0
- package/presets/zcode/next/rules/public-imports.md +50 -0
- package/presets/zcode/next/rules/react-a11y-coding.md +32 -0
- package/presets/zcode/next/rules/react-next-anti-hallucination.md +75 -0
- package/presets/zcode/next/rules/react-ui.md +154 -0
- package/presets/zcode/next/rules/reference-features.md +86 -0
- package/presets/zcode/next/rules/security-next.md +91 -0
- package/presets/zcode/next/rules/store-rtk.md +85 -0
- package/presets/zcode/next/rules/technical-retro.md +13 -0
- package/presets/zcode/next/rules/tests-e2e-structure.md +87 -0
- package/presets/zcode/next/rules/tests-unit.md +105 -0
- package/presets/zcode/next/rules/types-jsdoc.md +40 -0
- package/presets/zcode/next/rules/ux-design.md +103 -0
- package/presets/zcode/next/skills/README.md +22 -0
- package/presets/zcode/next/skills/ci-investigation/SKILL.md +50 -0
- package/presets/zcode/next/skills/code-review/SKILL.md +61 -0
- package/presets/zcode/next/skills/debug-investigation/SKILL.md +64 -0
- package/presets/zcode/next/skills/feature-delivery/SKILL.md +45 -0
- package/presets/zcode/next/skills/figma-fidelity/SKILL.md +128 -0
- package/presets/zcode/next/skills/mockup-review/SKILL.md +40 -0
- package/presets/zcode/next/skills/playwright-e2e/SKILL.md +39 -0
- package/presets/zcode/next/skills/react-performance/SKILL.md +49 -0
- package/presets/zcode/next/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/next/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/next/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/next/skills/unit-testing/SKILL.md +40 -0
- package/presets/zcode/next/skills/ux-design/SKILL.md +41 -0
- package/presets/zcode/next/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/next/team/README.md +135 -0
- package/presets/zcode/next/team/fixtures/artifact-manifest.example.json +80 -0
- package/presets/zcode/next/team/fixtures/bugfix-standard.json +25 -0
- package/presets/zcode/next/team/fixtures/feature-full.json +29 -0
- package/presets/zcode/next/team/fixtures/feature-light.json +28 -0
- package/presets/zcode/next/team/fixtures/feature-parallel.json +84 -0
- package/presets/zcode/next/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/zcode/next/team/fixtures/feature-with-figma-url.json +27 -0
- package/presets/zcode/next/team/fixtures/feature-with-ux-no-figma.json +26 -0
- package/presets/zcode/next/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/next/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
- package/presets/zcode/next/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
- package/presets/zcode/next/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
- package/presets/zcode/next/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
- package/presets/zcode/next/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
- package/presets/zcode/next/team/fixtures/metrics.example.json +54 -0
- package/presets/zcode/next/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/zcode/next/team/fixtures/mockup-review-standalone.json +23 -0
- package/presets/zcode/next/team/fixtures/ux-design-standalone.json +24 -0
- package/presets/zcode/next/team/tasks/.gitkeep +0 -0
- package/presets/zcode/nuxt/MCP.md +36 -0
- package/presets/zcode/nuxt/README.md +20 -0
- package/presets/zcode/nuxt/REPO_AGENTS.md +101 -0
- package/presets/zcode/nuxt/adapter-map.json +1065 -0
- package/presets/zcode/nuxt/agents/README.md +107 -0
- package/presets/zcode/nuxt/agents/accessibility-reviewer.md +91 -0
- package/presets/zcode/nuxt/agents/api-contract-reviewer.md +89 -0
- package/presets/zcode/nuxt/agents/build-verifier.md +106 -0
- package/presets/zcode/nuxt/agents/ci-investigator.md +109 -0
- package/presets/zcode/nuxt/agents/code-reviewer.md +124 -0
- package/presets/zcode/nuxt/agents/codebase-analyzer.md +51 -0
- package/presets/zcode/nuxt/agents/debugger.md +140 -0
- package/presets/zcode/nuxt/agents/feature-developer.md +161 -0
- package/presets/zcode/nuxt/agents/migration-specialist.md +97 -0
- package/presets/zcode/nuxt/agents/mockup-reviewer.md +83 -0
- package/presets/zcode/nuxt/agents/openspec-author.md +187 -0
- package/presets/zcode/nuxt/agents/performance-auditor.md +98 -0
- package/presets/zcode/nuxt/agents/playwright-test-generator.md +60 -0
- package/presets/zcode/nuxt/agents/playwright-test-healer.md +60 -0
- package/presets/zcode/nuxt/agents/playwright-test-planner.md +55 -0
- package/presets/zcode/nuxt/agents/qa-tester.md +85 -0
- package/presets/zcode/nuxt/agents/security-reviewer.md +84 -0
- package/presets/zcode/nuxt/agents/solution-architect.md +98 -0
- package/presets/zcode/nuxt/agents/task-analyst.md +239 -0
- package/presets/zcode/nuxt/agents/task-router.md +226 -0
- package/presets/zcode/nuxt/agents/tech-writer.md +87 -0
- package/presets/zcode/nuxt/agents/unit-test-generator.md +62 -0
- package/presets/zcode/nuxt/agents/unit-test-healer.md +63 -0
- package/presets/zcode/nuxt/agents/unit-test-planner.md +87 -0
- package/presets/zcode/nuxt/ai-local/conventions.md +29 -0
- package/presets/zcode/nuxt/commands/README.md +51 -0
- package/presets/zcode/nuxt/commands/migrate-tasks.md +44 -0
- package/presets/zcode/nuxt/commands/spec-start.md +32 -0
- package/presets/zcode/nuxt/commands/task-continue.md +75 -0
- package/presets/zcode/nuxt/commands/task.md +76 -0
- package/presets/zcode/nuxt/commands/technical-retro.md +96 -0
- package/presets/zcode/nuxt/commands/update.md +43 -0
- package/presets/zcode/nuxt/hooks/README.md +31 -0
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +2766 -0
- package/presets/zcode/nuxt/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/nuxt/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/nuxt/mcp.json +19 -0
- package/presets/zcode/nuxt/rules/README.md +25 -0
- package/presets/zcode/nuxt/rules/agent-team-intake.md +14 -0
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/nuxt/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/nuxt/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/nuxt/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/nuxt/rules/api-services.md +72 -0
- package/presets/zcode/nuxt/rules/architecture-boundaries-ui.md +9 -0
- package/presets/zcode/nuxt/rules/architecture-boundaries.md +90 -0
- package/presets/zcode/nuxt/rules/code-quality-and-refactoring.md +76 -0
- package/presets/zcode/nuxt/rules/code-review-mr.md +84 -0
- package/presets/zcode/nuxt/rules/css-property-order-stylelint.md +14 -0
- package/presets/zcode/nuxt/rules/design-guidance.md +104 -0
- package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +145 -0
- package/presets/zcode/nuxt/rules/http-client.md +9 -0
- package/presets/zcode/nuxt/rules/interactive-questions.md +29 -0
- package/presets/zcode/nuxt/rules/language-policy.md +51 -0
- package/presets/zcode/nuxt/rules/layer-barrel-exports.md +67 -0
- package/presets/zcode/nuxt/rules/mcp-usage.md +95 -0
- package/presets/zcode/nuxt/rules/mockup-review.md +171 -0
- package/presets/zcode/nuxt/rules/navigation-router-stack.md +55 -0
- package/presets/zcode/nuxt/rules/navigation-router-ui.md +10 -0
- package/presets/zcode/nuxt/rules/no-type-assertion-as-import-export.md +51 -0
- package/presets/zcode/nuxt/rules/no-v-bind-spread.md +7 -0
- package/presets/zcode/nuxt/rules/nuxt-app-core.md +44 -0
- package/presets/zcode/nuxt/rules/nuxt-pages-routing.md +31 -0
- package/presets/zcode/nuxt/rules/package-manager.md +13 -0
- package/presets/zcode/nuxt/rules/playwright-agents.md +74 -0
- package/presets/zcode/nuxt/rules/post-change-lint.md +37 -0
- package/presets/zcode/nuxt/rules/preset-goals.md +31 -0
- package/presets/zcode/nuxt/rules/preset-layering.md +27 -0
- package/presets/zcode/nuxt/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/nuxt/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/nuxt/rules/preset-token-budget.md +38 -0
- package/presets/zcode/nuxt/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/nuxt/rules/preset-writing-style.md +42 -0
- package/presets/zcode/nuxt/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/nuxt/rules/product-specs.md +61 -0
- package/presets/zcode/nuxt/rules/public-imports.md +50 -0
- package/presets/zcode/nuxt/rules/reference-features.md +81 -0
- package/presets/zcode/nuxt/rules/script-setup-conventions.md +7 -0
- package/presets/zcode/nuxt/rules/security-nuxt.md +28 -0
- package/presets/zcode/nuxt/rules/store-pinia.md +61 -0
- package/presets/zcode/nuxt/rules/technical-retro.md +13 -0
- package/presets/zcode/nuxt/rules/tests-e2e-structure.md +87 -0
- package/presets/zcode/nuxt/rules/tests-unit.md +82 -0
- package/presets/zcode/nuxt/rules/types-jsdoc.md +40 -0
- package/presets/zcode/nuxt/rules/ux-design.md +103 -0
- package/presets/zcode/nuxt/rules/vue-a11y-coding.md +9 -0
- package/presets/zcode/nuxt/rules/vue-nuxt-anti-hallucination.md +65 -0
- package/presets/zcode/nuxt/rules/vue-ui.md +34 -0
- package/presets/zcode/nuxt/skills/README.md +21 -0
- package/presets/zcode/nuxt/skills/ci-investigation/SKILL.md +50 -0
- package/presets/zcode/nuxt/skills/code-review/SKILL.md +60 -0
- package/presets/zcode/nuxt/skills/debug-investigation/SKILL.md +64 -0
- package/presets/zcode/nuxt/skills/feature-delivery/SKILL.md +52 -0
- package/presets/zcode/nuxt/skills/mockup-review/SKILL.md +34 -0
- package/presets/zcode/nuxt/skills/playwright-e2e/SKILL.md +43 -0
- package/presets/zcode/nuxt/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/nuxt/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/nuxt/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/nuxt/skills/unit-testing/SKILL.md +38 -0
- package/presets/zcode/nuxt/skills/ux-design/SKILL.md +41 -0
- package/presets/zcode/nuxt/skills/vue-performance/SKILL.md +58 -0
- package/presets/zcode/nuxt/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/nuxt/team/README.md +123 -0
- package/presets/zcode/nuxt/team/fixtures/artifact-manifest.example.json +80 -0
- package/presets/zcode/nuxt/team/fixtures/bugfix-standard.json +25 -0
- package/presets/zcode/nuxt/team/fixtures/feature-full.json +62 -0
- package/presets/zcode/nuxt/team/fixtures/feature-light.json +27 -0
- package/presets/zcode/nuxt/team/fixtures/feature-with-figma-url.json +17 -0
- package/presets/zcode/nuxt/team/fixtures/feature-with-ux-no-figma.json +17 -0
- package/presets/zcode/nuxt/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/nuxt/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
- package/presets/zcode/nuxt/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
- package/presets/zcode/nuxt/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
- package/presets/zcode/nuxt/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
- package/presets/zcode/nuxt/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
- package/presets/zcode/nuxt/team/fixtures/metrics.example.json +54 -0
- package/presets/zcode/nuxt/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/zcode/nuxt/team/fixtures/mockup-review-standalone.json +14 -0
- package/presets/zcode/nuxt/team/fixtures/ux-design-standalone.json +15 -0
- package/presets/zcode/nuxt/team/tasks/.gitkeep +0 -0
- package/presets/zcode/php-hexagonal/MCP.md +34 -0
- package/presets/zcode/php-hexagonal/README.md +20 -0
- package/presets/zcode/php-hexagonal/REPO_AGENTS.md +99 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +864 -0
- package/presets/zcode/php-hexagonal/agents/README.md +55 -0
- package/presets/zcode/php-hexagonal/agents/api-contract-reviewer.md +47 -0
- package/presets/zcode/php-hexagonal/agents/build-verifier.md +72 -0
- package/presets/zcode/php-hexagonal/agents/ci-investigator.md +66 -0
- package/presets/zcode/php-hexagonal/agents/code-reviewer.md +128 -0
- package/presets/zcode/php-hexagonal/agents/codebase-analyzer.md +49 -0
- package/presets/zcode/php-hexagonal/agents/debugger.md +98 -0
- package/presets/zcode/php-hexagonal/agents/feature-developer.md +144 -0
- package/presets/zcode/php-hexagonal/agents/integration-test-generator.md +46 -0
- package/presets/zcode/php-hexagonal/agents/integration-test-healer.md +46 -0
- package/presets/zcode/php-hexagonal/agents/integration-test-planner.md +48 -0
- package/presets/zcode/php-hexagonal/agents/migration-specialist.md +59 -0
- package/presets/zcode/php-hexagonal/agents/openspec-author.md +185 -0
- package/presets/zcode/php-hexagonal/agents/performance-auditor.md +50 -0
- package/presets/zcode/php-hexagonal/agents/qa-tester.md +53 -0
- package/presets/zcode/php-hexagonal/agents/security-reviewer.md +42 -0
- package/presets/zcode/php-hexagonal/agents/solution-architect.md +56 -0
- package/presets/zcode/php-hexagonal/agents/task-analyst.md +131 -0
- package/presets/zcode/php-hexagonal/agents/task-router.md +179 -0
- package/presets/zcode/php-hexagonal/agents/tech-writer.md +45 -0
- package/presets/zcode/php-hexagonal/agents/unit-test-generator.md +44 -0
- package/presets/zcode/php-hexagonal/agents/unit-test-healer.md +36 -0
- package/presets/zcode/php-hexagonal/agents/unit-test-planner.md +51 -0
- package/presets/zcode/php-hexagonal/ai-local/conventions.md +29 -0
- package/presets/zcode/php-hexagonal/commands/README.md +54 -0
- package/presets/zcode/php-hexagonal/commands/migrate-tasks.md +44 -0
- package/presets/zcode/php-hexagonal/commands/spec-start.md +32 -0
- package/presets/zcode/php-hexagonal/commands/task-continue.md +73 -0
- package/presets/zcode/php-hexagonal/commands/task.md +74 -0
- package/presets/zcode/php-hexagonal/commands/technical-retro.md +96 -0
- package/presets/zcode/php-hexagonal/commands/update.md +43 -0
- package/presets/zcode/php-hexagonal/hooks/README.md +31 -0
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +2764 -0
- package/presets/zcode/php-hexagonal/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/php-hexagonal/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/php-hexagonal/mcp.json +11 -0
- package/presets/zcode/php-hexagonal/rules/README.md +25 -0
- package/presets/zcode/php-hexagonal/rules/adapters-driven.md +30 -0
- package/presets/zcode/php-hexagonal/rules/adapters-driving.md +30 -0
- package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +18 -0
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/php-hexagonal/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/php-hexagonal/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/php-hexagonal/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/php-hexagonal/rules/api-grpc.md +22 -0
- package/presets/zcode/php-hexagonal/rules/api-http.md +28 -0
- package/presets/zcode/php-hexagonal/rules/application-usecases.md +25 -0
- package/presets/zcode/php-hexagonal/rules/architecture-boundaries.md +31 -0
- package/presets/zcode/php-hexagonal/rules/code-quality-and-refactoring.md +78 -0
- package/presets/zcode/php-hexagonal/rules/code-review-mr.md +79 -0
- package/presets/zcode/php-hexagonal/rules/composition-root.md +27 -0
- package/presets/zcode/php-hexagonal/rules/design-guidance.md +105 -0
- package/presets/zcode/php-hexagonal/rules/domain-layer.md +31 -0
- package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +59 -0
- package/presets/zcode/php-hexagonal/rules/interactive-questions.md +29 -0
- package/presets/zcode/php-hexagonal/rules/language-policy.md +51 -0
- package/presets/zcode/php-hexagonal/rules/mcp-usage.md +92 -0
- package/presets/zcode/php-hexagonal/rules/messaging-adapters.md +29 -0
- package/presets/zcode/php-hexagonal/rules/module-public-api.md +24 -0
- package/presets/zcode/php-hexagonal/rules/persistence-adapters.md +25 -0
- package/presets/zcode/php-hexagonal/rules/php-app-core.md +36 -0
- package/presets/zcode/php-hexagonal/rules/php-conventions.md +47 -0
- package/presets/zcode/php-hexagonal/rules/php-hexagonal-anti-hallucination.md +27 -0
- package/presets/zcode/php-hexagonal/rules/php-tooling.md +26 -0
- package/presets/zcode/php-hexagonal/rules/ports-interfaces.md +27 -0
- package/presets/zcode/php-hexagonal/rules/post-change-test.md +20 -0
- package/presets/zcode/php-hexagonal/rules/preset-goals.md +31 -0
- package/presets/zcode/php-hexagonal/rules/preset-layering.md +27 -0
- package/presets/zcode/php-hexagonal/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/php-hexagonal/rules/preset-token-budget.md +38 -0
- package/presets/zcode/php-hexagonal/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/php-hexagonal/rules/preset-writing-style.md +42 -0
- package/presets/zcode/php-hexagonal/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/php-hexagonal/rules/product-specs.md +62 -0
- package/presets/zcode/php-hexagonal/rules/reference-features.md +45 -0
- package/presets/zcode/php-hexagonal/rules/security-php.md +21 -0
- package/presets/zcode/php-hexagonal/rules/technical-retro.md +13 -0
- package/presets/zcode/php-hexagonal/rules/tests-e2e.md +26 -0
- package/presets/zcode/php-hexagonal/rules/tests-integration.md +23 -0
- package/presets/zcode/php-hexagonal/rules/tests-unit.md +25 -0
- package/presets/zcode/php-hexagonal/skills/README.md +5 -0
- package/presets/zcode/php-hexagonal/skills/ci-investigation/SKILL.md +24 -0
- package/presets/zcode/php-hexagonal/skills/code-review/SKILL.md +47 -0
- package/presets/zcode/php-hexagonal/skills/debug-investigation/SKILL.md +55 -0
- package/presets/zcode/php-hexagonal/skills/feature-delivery/SKILL.md +43 -0
- package/presets/zcode/php-hexagonal/skills/integration-testing/SKILL.md +21 -0
- package/presets/zcode/php-hexagonal/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/php-hexagonal/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/php-hexagonal/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/php-hexagonal/skills/unit-testing/SKILL.md +20 -0
- package/presets/zcode/php-hexagonal/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/php-hexagonal/team/README.md +123 -0
- package/presets/zcode/php-hexagonal/team/fixtures/bugfix-standard.json +37 -0
- package/presets/zcode/php-hexagonal/team/fixtures/feature-full.json +61 -0
- package/presets/zcode/php-hexagonal/team/fixtures/feature-light.json +17 -0
- package/presets/zcode/php-hexagonal/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/php-laravel/MCP.md +26 -0
- package/presets/zcode/php-laravel/README.md +20 -0
- package/presets/zcode/php-laravel/REPO_AGENTS.md +100 -0
- package/presets/zcode/php-laravel/adapter-map.json +864 -0
- package/presets/zcode/php-laravel/agents/README.md +55 -0
- package/presets/zcode/php-laravel/agents/api-contract-reviewer.md +48 -0
- package/presets/zcode/php-laravel/agents/build-verifier.md +72 -0
- package/presets/zcode/php-laravel/agents/ci-investigator.md +66 -0
- package/presets/zcode/php-laravel/agents/code-reviewer.md +128 -0
- package/presets/zcode/php-laravel/agents/codebase-analyzer.md +49 -0
- package/presets/zcode/php-laravel/agents/debugger.md +98 -0
- package/presets/zcode/php-laravel/agents/feature-developer.md +144 -0
- package/presets/zcode/php-laravel/agents/integration-test-generator.md +46 -0
- package/presets/zcode/php-laravel/agents/integration-test-healer.md +46 -0
- package/presets/zcode/php-laravel/agents/integration-test-planner.md +48 -0
- package/presets/zcode/php-laravel/agents/migration-specialist.md +59 -0
- package/presets/zcode/php-laravel/agents/openspec-author.md +185 -0
- package/presets/zcode/php-laravel/agents/performance-auditor.md +50 -0
- package/presets/zcode/php-laravel/agents/qa-tester.md +59 -0
- package/presets/zcode/php-laravel/agents/security-reviewer.md +54 -0
- package/presets/zcode/php-laravel/agents/solution-architect.md +57 -0
- package/presets/zcode/php-laravel/agents/task-analyst.md +131 -0
- package/presets/zcode/php-laravel/agents/task-router.md +195 -0
- package/presets/zcode/php-laravel/agents/tech-writer.md +45 -0
- package/presets/zcode/php-laravel/agents/unit-test-generator.md +44 -0
- package/presets/zcode/php-laravel/agents/unit-test-healer.md +36 -0
- package/presets/zcode/php-laravel/agents/unit-test-planner.md +51 -0
- package/presets/zcode/php-laravel/ai-local/conventions.md +29 -0
- package/presets/zcode/php-laravel/commands/README.md +54 -0
- package/presets/zcode/php-laravel/commands/migrate-tasks.md +44 -0
- package/presets/zcode/php-laravel/commands/spec-start.md +32 -0
- package/presets/zcode/php-laravel/commands/task-continue.md +73 -0
- package/presets/zcode/php-laravel/commands/task.md +74 -0
- package/presets/zcode/php-laravel/commands/technical-retro.md +96 -0
- package/presets/zcode/php-laravel/commands/update.md +43 -0
- package/presets/zcode/php-laravel/hooks/README.md +31 -0
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +2764 -0
- package/presets/zcode/php-laravel/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/php-laravel/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/php-laravel/mcp.json +11 -0
- package/presets/zcode/php-laravel/rules/README.md +25 -0
- package/presets/zcode/php-laravel/rules/actions-services.md +25 -0
- package/presets/zcode/php-laravel/rules/agent-team-intake.md +18 -0
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/php-laravel/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/php-laravel/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/php-laravel/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/php-laravel/rules/architecture-boundaries.md +32 -0
- package/presets/zcode/php-laravel/rules/code-quality-and-refactoring.md +78 -0
- package/presets/zcode/php-laravel/rules/code-review-mr.md +80 -0
- package/presets/zcode/php-laravel/rules/design-guidance.md +105 -0
- package/presets/zcode/php-laravel/rules/domain-layer.md +19 -0
- package/presets/zcode/php-laravel/rules/eloquent-persistence.md +24 -0
- package/presets/zcode/php-laravel/rules/events-listeners.md +24 -0
- package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +59 -0
- package/presets/zcode/php-laravel/rules/form-requests.md +24 -0
- package/presets/zcode/php-laravel/rules/http-layer.md +25 -0
- package/presets/zcode/php-laravel/rules/interactive-questions.md +29 -0
- package/presets/zcode/php-laravel/rules/jobs-queues.md +36 -0
- package/presets/zcode/php-laravel/rules/language-policy.md +51 -0
- package/presets/zcode/php-laravel/rules/laravel-anti-hallucination.md +27 -0
- package/presets/zcode/php-laravel/rules/laravel-app-core.md +34 -0
- package/presets/zcode/php-laravel/rules/laravel-conventions.md +34 -0
- package/presets/zcode/php-laravel/rules/mcp-usage.md +92 -0
- package/presets/zcode/php-laravel/rules/module-public-api.md +23 -0
- package/presets/zcode/php-laravel/rules/php-tooling.md +26 -0
- package/presets/zcode/php-laravel/rules/policies-authorization.md +24 -0
- package/presets/zcode/php-laravel/rules/post-change-test.md +20 -0
- package/presets/zcode/php-laravel/rules/preset-goals.md +31 -0
- package/presets/zcode/php-laravel/rules/preset-layering.md +27 -0
- package/presets/zcode/php-laravel/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/php-laravel/rules/preset-token-budget.md +38 -0
- package/presets/zcode/php-laravel/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/php-laravel/rules/preset-writing-style.md +42 -0
- package/presets/zcode/php-laravel/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/php-laravel/rules/product-specs.md +62 -0
- package/presets/zcode/php-laravel/rules/reference-features.md +45 -0
- package/presets/zcode/php-laravel/rules/routes-api.md +24 -0
- package/presets/zcode/php-laravel/rules/security-php.md +47 -0
- package/presets/zcode/php-laravel/rules/service-providers.md +23 -0
- package/presets/zcode/php-laravel/rules/technical-retro.md +13 -0
- package/presets/zcode/php-laravel/rules/tests-e2e.md +26 -0
- package/presets/zcode/php-laravel/rules/tests-integration.md +23 -0
- package/presets/zcode/php-laravel/rules/tests-unit.md +24 -0
- package/presets/zcode/php-laravel/skills/README.md +5 -0
- package/presets/zcode/php-laravel/skills/ci-investigation/SKILL.md +24 -0
- package/presets/zcode/php-laravel/skills/code-review/SKILL.md +47 -0
- package/presets/zcode/php-laravel/skills/debug-investigation/SKILL.md +55 -0
- package/presets/zcode/php-laravel/skills/feature-delivery/SKILL.md +43 -0
- package/presets/zcode/php-laravel/skills/integration-testing/SKILL.md +21 -0
- package/presets/zcode/php-laravel/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/php-laravel/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/php-laravel/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/php-laravel/skills/unit-testing/SKILL.md +20 -0
- package/presets/zcode/php-laravel/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/php-laravel/team/README.md +123 -0
- package/presets/zcode/php-laravel/team/fixtures/bugfix-standard.json +12 -0
- package/presets/zcode/php-laravel/team/fixtures/feature-full.json +44 -0
- package/presets/zcode/php-laravel/team/fixtures/feature-light.json +8 -0
- package/presets/zcode/php-laravel/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/platform-contract.json +135 -0
- package/presets/zcode/svelte/MCP.md +36 -0
- package/presets/zcode/svelte/README.md +20 -0
- package/presets/zcode/svelte/REPO_AGENTS.md +101 -0
- package/presets/zcode/svelte/adapter-map.json +1065 -0
- package/presets/zcode/svelte/agents/README.md +107 -0
- package/presets/zcode/svelte/agents/accessibility-reviewer.md +91 -0
- package/presets/zcode/svelte/agents/api-contract-reviewer.md +89 -0
- package/presets/zcode/svelte/agents/build-verifier.md +106 -0
- package/presets/zcode/svelte/agents/ci-investigator.md +109 -0
- package/presets/zcode/svelte/agents/code-reviewer.md +124 -0
- package/presets/zcode/svelte/agents/codebase-analyzer.md +51 -0
- package/presets/zcode/svelte/agents/debugger.md +140 -0
- package/presets/zcode/svelte/agents/feature-developer.md +161 -0
- package/presets/zcode/svelte/agents/migration-specialist.md +97 -0
- package/presets/zcode/svelte/agents/mockup-reviewer.md +83 -0
- package/presets/zcode/svelte/agents/openspec-author.md +187 -0
- package/presets/zcode/svelte/agents/performance-auditor.md +98 -0
- package/presets/zcode/svelte/agents/playwright-test-generator.md +60 -0
- package/presets/zcode/svelte/agents/playwright-test-healer.md +60 -0
- package/presets/zcode/svelte/agents/playwright-test-planner.md +55 -0
- package/presets/zcode/svelte/agents/qa-tester.md +85 -0
- package/presets/zcode/svelte/agents/security-reviewer.md +84 -0
- package/presets/zcode/svelte/agents/solution-architect.md +98 -0
- package/presets/zcode/svelte/agents/task-analyst.md +239 -0
- package/presets/zcode/svelte/agents/task-router.md +226 -0
- package/presets/zcode/svelte/agents/tech-writer.md +87 -0
- package/presets/zcode/svelte/agents/unit-test-generator.md +62 -0
- package/presets/zcode/svelte/agents/unit-test-healer.md +63 -0
- package/presets/zcode/svelte/agents/unit-test-planner.md +87 -0
- package/presets/zcode/svelte/ai-local/conventions.md +29 -0
- package/presets/zcode/svelte/commands/README.md +51 -0
- package/presets/zcode/svelte/commands/migrate-tasks.md +44 -0
- package/presets/zcode/svelte/commands/spec-start.md +32 -0
- package/presets/zcode/svelte/commands/task-continue.md +75 -0
- package/presets/zcode/svelte/commands/task.md +76 -0
- package/presets/zcode/svelte/commands/technical-retro.md +96 -0
- package/presets/zcode/svelte/commands/update.md +43 -0
- package/presets/zcode/svelte/hooks/README.md +31 -0
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +2766 -0
- package/presets/zcode/svelte/hooks/check-preset-update.mjs +232 -0
- package/presets/zcode/svelte/hooks/list-ai-local.mjs +299 -0
- package/presets/zcode/svelte/mcp.json +19 -0
- package/presets/zcode/svelte/rules/README.md +25 -0
- package/presets/zcode/svelte/rules/agent-team-intake.md +14 -0
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +282 -0
- package/presets/zcode/svelte/rules/ai-local-overlay.md +18 -0
- package/presets/zcode/svelte/rules/anti-hallucination-contract.md +37 -0
- package/presets/zcode/svelte/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/zcode/svelte/rules/api-services.md +39 -0
- package/presets/zcode/svelte/rules/architecture-boundaries-ui.md +9 -0
- package/presets/zcode/svelte/rules/architecture-boundaries.md +54 -0
- package/presets/zcode/svelte/rules/code-quality-and-refactoring.md +76 -0
- package/presets/zcode/svelte/rules/code-review-mr.md +84 -0
- package/presets/zcode/svelte/rules/css-property-order-stylelint.md +14 -0
- package/presets/zcode/svelte/rules/design-guidance.md +104 -0
- package/presets/zcode/svelte/rules/feature-delivery-workflow.md +117 -0
- package/presets/zcode/svelte/rules/http-client.md +10 -0
- package/presets/zcode/svelte/rules/interactive-questions.md +29 -0
- package/presets/zcode/svelte/rules/language-policy.md +51 -0
- package/presets/zcode/svelte/rules/layer-barrel-exports.md +67 -0
- package/presets/zcode/svelte/rules/mcp-usage.md +95 -0
- package/presets/zcode/svelte/rules/mockup-review.md +171 -0
- package/presets/zcode/svelte/rules/navigation-router-stack.md +34 -0
- package/presets/zcode/svelte/rules/navigation-router-ui.md +19 -0
- package/presets/zcode/svelte/rules/no-rest-props-spread.md +26 -0
- package/presets/zcode/svelte/rules/no-type-assertion-as-import-export.md +51 -0
- package/presets/zcode/svelte/rules/package-manager.md +13 -0
- package/presets/zcode/svelte/rules/playwright-agents.md +74 -0
- package/presets/zcode/svelte/rules/post-change-lint.md +37 -0
- package/presets/zcode/svelte/rules/preset-goals.md +31 -0
- package/presets/zcode/svelte/rules/preset-layering.md +27 -0
- package/presets/zcode/svelte/rules/preset-no-cross-stack-leakage.md +89 -0
- package/presets/zcode/svelte/rules/preset-pr-checklist.md +45 -0
- package/presets/zcode/svelte/rules/preset-token-budget.md +38 -0
- package/presets/zcode/svelte/rules/preset-twin-sync.md +41 -0
- package/presets/zcode/svelte/rules/preset-writing-style.md +42 -0
- package/presets/zcode/svelte/rules/product-specs-authoring.md +118 -0
- package/presets/zcode/svelte/rules/product-specs.md +61 -0
- package/presets/zcode/svelte/rules/public-imports.md +32 -0
- package/presets/zcode/svelte/rules/reference-features.md +82 -0
- package/presets/zcode/svelte/rules/security-sveltekit.md +32 -0
- package/presets/zcode/svelte/rules/store-svelte.md +59 -0
- package/presets/zcode/svelte/rules/svelte-a11y-coding.md +21 -0
- package/presets/zcode/svelte/rules/svelte-app-core.md +44 -0
- package/presets/zcode/svelte/rules/svelte-script-conventions.md +27 -0
- package/presets/zcode/svelte/rules/svelte-sveltekit-anti-hallucination.md +66 -0
- package/presets/zcode/svelte/rules/svelte-ui.md +38 -0
- package/presets/zcode/svelte/rules/sveltekit-routing.md +33 -0
- package/presets/zcode/svelte/rules/technical-retro.md +13 -0
- package/presets/zcode/svelte/rules/tests-e2e-structure.md +87 -0
- package/presets/zcode/svelte/rules/tests-unit.md +82 -0
- package/presets/zcode/svelte/rules/types-jsdoc.md +40 -0
- package/presets/zcode/svelte/rules/ux-design.md +103 -0
- package/presets/zcode/svelte/skills/README.md +21 -0
- package/presets/zcode/svelte/skills/ci-investigation/SKILL.md +50 -0
- package/presets/zcode/svelte/skills/code-review/SKILL.md +60 -0
- package/presets/zcode/svelte/skills/debug-investigation/SKILL.md +64 -0
- package/presets/zcode/svelte/skills/feature-delivery/SKILL.md +52 -0
- package/presets/zcode/svelte/skills/mockup-review/SKILL.md +34 -0
- package/presets/zcode/svelte/skills/playwright-e2e/SKILL.md +43 -0
- package/presets/zcode/svelte/skills/spec-authoring/SKILL.md +31 -0
- package/presets/zcode/svelte/skills/spec-discovery/SKILL.md +63 -0
- package/presets/zcode/svelte/skills/svelte-performance/SKILL.md +57 -0
- package/presets/zcode/svelte/skills/technical-retro/SKILL.md +72 -0
- package/presets/zcode/svelte/skills/unit-testing/SKILL.md +38 -0
- package/presets/zcode/svelte/skills/ux-design/SKILL.md +41 -0
- package/presets/zcode/svelte/skills/write-adr/SKILL.md +46 -0
- package/presets/zcode/svelte/team/README.md +123 -0
- package/presets/zcode/svelte/team/fixtures/artifact-manifest.example.json +80 -0
- package/presets/zcode/svelte/team/fixtures/bugfix-standard.json +25 -0
- package/presets/zcode/svelte/team/fixtures/feature-full.json +62 -0
- package/presets/zcode/svelte/team/fixtures/feature-light.json +27 -0
- package/presets/zcode/svelte/team/fixtures/feature-with-figma-url.json +17 -0
- package/presets/zcode/svelte/team/fixtures/feature-with-ux-no-figma.json +17 -0
- package/presets/zcode/svelte/team/fixtures/memlog.example.md +9 -0
- package/presets/zcode/svelte/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
- package/presets/zcode/svelte/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
- package/presets/zcode/svelte/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
- package/presets/zcode/svelte/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
- package/presets/zcode/svelte/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
- package/presets/zcode/svelte/team/fixtures/metrics.example.json +54 -0
- package/presets/zcode/svelte/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/zcode/svelte/team/fixtures/mockup-review-standalone.json +14 -0
- package/presets/zcode/svelte/team/fixtures/ux-design-standalone.json +15 -0
- package/presets/zcode/svelte/team/tasks/.gitkeep +0 -0
|
@@ -0,0 +1,1275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only HTTP API and dashboard host for the `.ai.local/team` projection.
|
|
3
|
+
*
|
|
4
|
+
* `node:http` only. The surface is loopback-only by default, sends no CORS
|
|
5
|
+
* header, reads files through SQLite rows (never through a request path), and
|
|
6
|
+
* the single non-GET operation re-runs the projector in a child process.
|
|
7
|
+
*
|
|
8
|
+
* Every SQL statement in this module is a static string with bound parameters.
|
|
9
|
+
* The only interpolated fragments are the module-level constants `TASK_FILTER`,
|
|
10
|
+
* `TASK_ORDER` and the `?N` placeholder lists built from a row count — never
|
|
11
|
+
* request data.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import fs from 'node:fs';
|
|
15
|
+
import http from 'node:http';
|
|
16
|
+
import path from 'node:path';
|
|
17
|
+
import { spawnSync } from 'node:child_process';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
DEFAULT_TEAM_ROOT,
|
|
22
|
+
TeamDbError,
|
|
23
|
+
isKillSwitchSet,
|
|
24
|
+
listAppliedMigrations,
|
|
25
|
+
openTeamDb,
|
|
26
|
+
readSchemaMeta,
|
|
27
|
+
readSearchMode,
|
|
28
|
+
readUserVersion,
|
|
29
|
+
computeSchemaFingerprint,
|
|
30
|
+
} from './team-db-schema.mjs';
|
|
31
|
+
import {
|
|
32
|
+
AGENT_PATTERN,
|
|
33
|
+
API_VERSION,
|
|
34
|
+
EVENT_TYPES,
|
|
35
|
+
INTENT_PATTERN,
|
|
36
|
+
OPENAPI_VERSION,
|
|
37
|
+
PROFILES,
|
|
38
|
+
SLUG_PATTERN,
|
|
39
|
+
SORT_VALUES,
|
|
40
|
+
TASK_STATES,
|
|
41
|
+
serializeOpenApiDocument,
|
|
42
|
+
} from './team-db-openapi.mjs';
|
|
43
|
+
import { DASHBOARD_CSS, DASHBOARD_HTML, DASHBOARD_JS } from './team-db-dashboard.mjs';
|
|
44
|
+
|
|
45
|
+
export const DEFAULT_HOST = '127.0.0.1';
|
|
46
|
+
export const DEFAULT_PORT = 4178;
|
|
47
|
+
export const DEFAULT_LIMIT = 50;
|
|
48
|
+
export const MAX_LIMIT = 200;
|
|
49
|
+
export const MAX_OFFSET = 1000000;
|
|
50
|
+
export const MAX_DOC_LIMIT = 1048576;
|
|
51
|
+
export const DEFAULT_DOC_LIMIT = 262144;
|
|
52
|
+
export const MAX_REQUEST_BODY_BYTES = 1024;
|
|
53
|
+
export const MAX_EXPORT_BYTES = 5 * 1024 * 1024;
|
|
54
|
+
export const SYNC_CHILD_TIMEOUT_MS = 30000;
|
|
55
|
+
export const SYNC_CHILD_DEADLINE_MS = 25000;
|
|
56
|
+
export const LOOPBACK_HOSTS = ['127.0.0.1', 'localhost', '::1'];
|
|
57
|
+
const CLIENT_HEADERS = {
|
|
58
|
+
'X-Content-Type-Options': 'nosniff',
|
|
59
|
+
'Referrer-Policy': 'no-referrer',
|
|
60
|
+
'Cross-Origin-Resource-Policy': 'same-origin',
|
|
61
|
+
'Cross-Origin-Opener-Policy': 'same-origin',
|
|
62
|
+
'Content-Security-Policy':
|
|
63
|
+
"default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src 'self' data:; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const moduleDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
67
|
+
const slugPattern = new RegExp(SLUG_PATTERN);
|
|
68
|
+
const agentPattern = new RegExp(AGENT_PATTERN);
|
|
69
|
+
const intentPattern = new RegExp(INTENT_PATTERN);
|
|
70
|
+
const SORT_VALUE_SET = new Set(SORT_VALUES);
|
|
71
|
+
const TASK_STATE_SET = new Set(TASK_STATES);
|
|
72
|
+
const PROFILE_SET = new Set(PROFILES);
|
|
73
|
+
const EVENT_TYPE_SET = new Set(EVENT_TYPES);
|
|
74
|
+
const OUTCOME_VALUES = new Set(['completed', 'blocked', 'changes_requested', 'validation_failed', 'skipped']);
|
|
75
|
+
const CODE_STATUS_ROWS = [
|
|
76
|
+
['E_BAD_REQUEST', 400],
|
|
77
|
+
['E_FORBIDDEN_HOST', 403],
|
|
78
|
+
['E_FORBIDDEN_ORIGIN', 403],
|
|
79
|
+
['E_NOT_FOUND', 404],
|
|
80
|
+
['E_METHOD_NOT_ALLOWED', 405],
|
|
81
|
+
['E_VALIDATION', 422],
|
|
82
|
+
['E_PAYLOAD_TOO_LARGE', 413],
|
|
83
|
+
['E_DOC_NOT_FOUND', 404],
|
|
84
|
+
['E_DOC_BINARY', 410],
|
|
85
|
+
['E_DOC_CONTENT_OMITTED', 409],
|
|
86
|
+
['E_RANGE', 416],
|
|
87
|
+
['E_DISABLED', 503],
|
|
88
|
+
['E_DB_MISSING', 503],
|
|
89
|
+
['E_DB_CORRUPT', 503],
|
|
90
|
+
['E_SCHEMA_MISMATCH', 503],
|
|
91
|
+
['E_SCHEMA_OUTDATED', 503],
|
|
92
|
+
['E_SCHEMA_NEWER', 503],
|
|
93
|
+
['E_BUSY', 503],
|
|
94
|
+
['E_INTERNAL', 500],
|
|
95
|
+
];
|
|
96
|
+
const CODE_STATUS = new Map(CODE_STATUS_ROWS);
|
|
97
|
+
|
|
98
|
+
export class ApiError extends Error {
|
|
99
|
+
constructor(code, status, message, details) {
|
|
100
|
+
super(message);
|
|
101
|
+
this.name = 'ApiError';
|
|
102
|
+
this.code = code;
|
|
103
|
+
this.status = status;
|
|
104
|
+
this.details = details;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const fail = (code, status, message, details) => {
|
|
109
|
+
throw new ApiError(code, status, message, details);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/* --------------------------------- filtering -------------------------------- */
|
|
113
|
+
|
|
114
|
+
const TASK_FILTER = `
|
|
115
|
+
(?1 = 1 OR t.absent_at IS NULL)
|
|
116
|
+
AND (json_array_length(?2) = 0 OR t.state IN (SELECT value FROM json_each(?2)))
|
|
117
|
+
AND (?3 = '' OR EXISTS (SELECT 1 FROM attempts a WHERE a.task_slug = t.slug AND a.agent = ?3))
|
|
118
|
+
AND (?4 = '' OR t.intent = ?4)
|
|
119
|
+
AND (?5 = '' OR t.profile = ?5)
|
|
120
|
+
AND (?6 = '' OR t.updated_at >= ?6)
|
|
121
|
+
AND (?7 = '' OR t.updated_at <= ?7)
|
|
122
|
+
AND (?8 = 0 OR t.slug IN (SELECT value FROM json_each(?9)))`;
|
|
123
|
+
|
|
124
|
+
const TASK_ORDER = `
|
|
125
|
+
ORDER BY
|
|
126
|
+
CASE ?10 WHEN 'slug' THEN t.slug END ASC NULLS LAST,
|
|
127
|
+
CASE ?10 WHEN '-slug' THEN t.slug END DESC NULLS LAST,
|
|
128
|
+
CASE ?10 WHEN 'updatedAt' THEN t.updated_at END ASC NULLS LAST,
|
|
129
|
+
CASE ?10 WHEN '-updatedAt' THEN t.updated_at END DESC NULLS LAST,
|
|
130
|
+
CASE ?10 WHEN 'startAt' THEN t.start_at END ASC NULLS LAST,
|
|
131
|
+
CASE ?10 WHEN '-startAt' THEN t.start_at END DESC NULLS LAST,
|
|
132
|
+
t.slug ASC`;
|
|
133
|
+
|
|
134
|
+
const ATTEMPT_ORDER = `
|
|
135
|
+
ORDER BY
|
|
136
|
+
CASE ?4 WHEN 'desc' THEN a.started_at END DESC NULLS LAST,
|
|
137
|
+
CASE ?4 WHEN 'asc' THEN a.started_at END ASC NULLS LAST,
|
|
138
|
+
a.step_index ASC,
|
|
139
|
+
a.attempt_no ASC`;
|
|
140
|
+
|
|
141
|
+
const EVENT_ORDER = `
|
|
142
|
+
ORDER BY
|
|
143
|
+
CASE ?5 WHEN 'desc' THEN e.at END DESC NULLS LAST,
|
|
144
|
+
CASE ?5 WHEN 'asc' THEN e.at END ASC NULLS LAST,
|
|
145
|
+
e.seq ASC`;
|
|
146
|
+
|
|
147
|
+
const SQL = {
|
|
148
|
+
listTasks: `SELECT
|
|
149
|
+
t.slug, t.title, t.intent, t.profile, t.spec_mode, t.state, t.phase,
|
|
150
|
+
t.pipeline_index, t.current_agent, t.awaiting_human_gate, t.updated_at,
|
|
151
|
+
t.start_at, t.end_at, t.projected_at, t.last_seen_at, t.absent_at,
|
|
152
|
+
t.content_hash, t.file_count, t.document_bytes, t.parse_error_count,
|
|
153
|
+
(SELECT count(*) FROM attempts a WHERE a.task_slug = t.slug) AS attempt_count,
|
|
154
|
+
(SELECT count(*) FROM artifacts r WHERE r.task_slug = t.slug) AS artifact_count,
|
|
155
|
+
(SELECT count(*) FROM gates g WHERE g.task_slug = t.slug AND g.ended_at IS NULL) AS open_gates,
|
|
156
|
+
(SELECT count(*) FROM gates g WHERE g.task_slug = t.slug) AS gate_count,
|
|
157
|
+
(SELECT CASE WHEN json_valid(d.content) THEN json_extract(d.content, '$.task.stack') END
|
|
158
|
+
FROM documents d WHERE d.task_slug = t.slug AND d.path = 'metrics.json') AS stack,
|
|
159
|
+
(SELECT CASE WHEN json_valid(d.content) THEN json_extract(d.content, '$.task.platform') END
|
|
160
|
+
FROM documents d WHERE d.task_slug = t.slug AND d.path = 'metrics.json') AS platform
|
|
161
|
+
FROM tasks t
|
|
162
|
+
WHERE ${TASK_FILTER}${TASK_ORDER}
|
|
163
|
+
LIMIT ?11 OFFSET ?12`,
|
|
164
|
+
countTasks: `SELECT count(*) AS total FROM tasks t WHERE ${TASK_FILTER}`,
|
|
165
|
+
getTask: `SELECT
|
|
166
|
+
t.slug, t.title, t.intent, t.profile, t.spec_mode, t.state, t.phase,
|
|
167
|
+
t.pipeline_index, t.current_agent, t.awaiting_human_gate, t.updated_at,
|
|
168
|
+
t.start_at, t.end_at, t.projected_at, t.last_seen_at, t.absent_at,
|
|
169
|
+
t.content_hash, t.file_count, t.document_bytes, t.parse_error_count,
|
|
170
|
+
t.routing_summary, t.routing_json, t.metrics_run_id,
|
|
171
|
+
(SELECT count(*) FROM attempts a WHERE a.task_slug = t.slug) AS attempt_count,
|
|
172
|
+
(SELECT count(*) FROM artifacts r WHERE r.task_slug = t.slug) AS artifact_count,
|
|
173
|
+
(SELECT count(*) FROM gates g WHERE g.task_slug = t.slug AND g.ended_at IS NULL) AS open_gates,
|
|
174
|
+
(SELECT count(*) FROM gates g WHERE g.task_slug = t.slug) AS gate_count,
|
|
175
|
+
(SELECT count(*) FROM events e WHERE e.task_slug = t.slug) AS event_count,
|
|
176
|
+
(SELECT count(*) FROM prompts p WHERE p.task_slug = t.slug) AS prompt_count,
|
|
177
|
+
(SELECT count(*) FROM documents d WHERE d.task_slug = t.slug) AS document_count,
|
|
178
|
+
(SELECT CASE WHEN json_valid(d.content) THEN json_extract(d.content, '$.task.stack') END
|
|
179
|
+
FROM documents d WHERE d.task_slug = t.slug AND d.path = 'metrics.json') AS stack,
|
|
180
|
+
(SELECT CASE WHEN json_valid(d.content) THEN json_extract(d.content, '$.task.platform') END
|
|
181
|
+
FROM documents d WHERE d.task_slug = t.slug AND d.path = 'metrics.json') AS platform
|
|
182
|
+
FROM tasks t WHERE t.slug = ?1`,
|
|
183
|
+
listSteps: `SELECT step_index, label, scope, model, skip_if, parallel, depends_on_json, task_ids_json, write_scopes_json
|
|
184
|
+
FROM pipeline_steps WHERE task_slug = ?1 ORDER BY step_index`,
|
|
185
|
+
listStepAgents: `SELECT step_index, agent FROM pipeline_step_agents WHERE task_slug = ?1 ORDER BY step_index, ordinal`,
|
|
186
|
+
countAttempts: `SELECT count(*) AS total FROM attempts a
|
|
187
|
+
WHERE a.task_slug = ?1 AND (?2 = '' OR a.agent = ?2) AND (?3 = '' OR a.outcome = ?3)`,
|
|
188
|
+
listAttempts: `SELECT a.* FROM attempts a
|
|
189
|
+
WHERE a.task_slug = ?1 AND (?2 = '' OR a.agent = ?2) AND (?3 = '' OR a.outcome = ?3)
|
|
190
|
+
${ATTEMPT_ORDER} LIMIT ?5 OFFSET ?6`,
|
|
191
|
+
countEvents: `SELECT count(*) AS total FROM events e
|
|
192
|
+
WHERE e.task_slug = ?1
|
|
193
|
+
AND (json_array_length(?2) = 0 OR e.type IN (SELECT value FROM json_each(?2)))
|
|
194
|
+
AND (?3 = '' OR e.at >= ?3) AND (?4 = '' OR e.at <= ?4)`,
|
|
195
|
+
listEvents: `SELECT e.* FROM events e
|
|
196
|
+
WHERE e.task_slug = ?1
|
|
197
|
+
AND (json_array_length(?2) = 0 OR e.type IN (SELECT value FROM json_each(?2)))
|
|
198
|
+
AND (?3 = '' OR e.at >= ?3) AND (?4 = '' OR e.at <= ?4)
|
|
199
|
+
${EVENT_ORDER} LIMIT ?6 OFFSET ?7`,
|
|
200
|
+
listArtifacts: `SELECT * FROM artifacts WHERE task_slug = ?1 ORDER BY artifact_id`,
|
|
201
|
+
listArtifactPaths: `SELECT artifact_id, kind, path FROM artifact_paths WHERE task_slug = ?1 ORDER BY artifact_id, kind, ordinal`,
|
|
202
|
+
countGates: 'SELECT count(*) AS total FROM gates WHERE task_slug = ?1',
|
|
203
|
+
listGates: `SELECT start_event_id, started_at, ended_at, duration_ms FROM gates
|
|
204
|
+
WHERE task_slug = ?1 ORDER BY started_at ASC, start_event_id ASC`,
|
|
205
|
+
countDocuments: `SELECT count(*) AS total FROM documents
|
|
206
|
+
WHERE task_slug = ?1 AND (?2 = 0 OR path LIKE ?3 ESCAPE '\\')`,
|
|
207
|
+
listDocuments: `SELECT path, sha256, bytes, media_type, is_text, content_omitted, parse_error, projected_at
|
|
208
|
+
FROM documents WHERE task_slug = ?1 AND (?2 = 0 OR path LIKE ?3 ESCAPE '\\')
|
|
209
|
+
ORDER BY path ASC LIMIT ?4 OFFSET ?5`,
|
|
210
|
+
getDocument: `SELECT path, sha256, bytes, media_type, is_text, content, content_omitted, parse_error, projected_at
|
|
211
|
+
FROM documents WHERE task_slug = ?1 AND path = ?2`,
|
|
212
|
+
countTimeline: `SELECT
|
|
213
|
+
(SELECT count(*) FROM attempts WHERE task_slug = ?1)
|
|
214
|
+
+ (SELECT count(*) FROM gates WHERE task_slug = ?1)
|
|
215
|
+
+ (SELECT count(*) FROM events WHERE task_slug = ?1) AS total`,
|
|
216
|
+
listTimeline: `WITH items AS (
|
|
217
|
+
SELECT started_at AS at, 'attempt' AS kind, COALESCE(agent, '') AS agent, attempt_id AS reference,
|
|
218
|
+
COALESCE(outcome, '') AS outcome, COALESCE(step_label, '') AS title, COALESCE(role, '') AS detail
|
|
219
|
+
FROM attempts WHERE task_slug = ?1
|
|
220
|
+
UNION ALL
|
|
221
|
+
SELECT started_at AS at, 'gate' AS kind, '' AS agent, start_event_id AS reference,
|
|
222
|
+
'' AS outcome, 'Human gate' AS title, COALESCE(ended_at, '') AS detail
|
|
223
|
+
FROM gates WHERE task_slug = ?1
|
|
224
|
+
UNION ALL
|
|
225
|
+
SELECT at, 'event' AS kind, COALESCE(agent, '') AS agent, event_id AS reference,
|
|
226
|
+
COALESCE(outcome, '') AS outcome, type AS title, COALESCE(step_label, '') AS detail
|
|
227
|
+
FROM events WHERE task_slug = ?1
|
|
228
|
+
)
|
|
229
|
+
SELECT * FROM items ORDER BY at ASC NULLS LAST LIMIT ?2 OFFSET ?3`,
|
|
230
|
+
listPrompts: `SELECT seq, source, command, captured_at, language, content, sha256, bytes
|
|
231
|
+
FROM prompts WHERE task_slug = ?1 ORDER BY seq ASC`,
|
|
232
|
+
eventCounts: `SELECT type, count(*) AS count FROM events WHERE task_slug = ?1 GROUP BY type ORDER BY type`,
|
|
233
|
+
attemptsByAgent: `SELECT agent, count(*) AS attempts, COALESCE(SUM(duration_ms), 0) AS duration
|
|
234
|
+
FROM attempts WHERE task_slug = ?1 GROUP BY agent ORDER BY duration DESC, agent ASC`,
|
|
235
|
+
attemptsByStep: `SELECT step_index, count(*) AS attempts, COALESCE(SUM(duration_ms), 0) AS duration
|
|
236
|
+
FROM attempts WHERE task_slug = ?1 GROUP BY step_index ORDER BY step_index ASC`,
|
|
237
|
+
statsTaskTotals: `SELECT
|
|
238
|
+
count(*) AS total,
|
|
239
|
+
COALESCE(SUM(CASE WHEN t.absent_at IS NULL THEN 1 ELSE 0 END), 0) AS active,
|
|
240
|
+
COALESCE(SUM(CASE WHEN t.absent_at IS NOT NULL THEN 1 ELSE 0 END), 0) AS absent
|
|
241
|
+
FROM tasks t WHERE ${TASK_FILTER}`,
|
|
242
|
+
statsByState: `SELECT t.state AS key, count(*) AS count FROM tasks t
|
|
243
|
+
WHERE ${TASK_FILTER} AND t.state IS NOT NULL GROUP BY t.state ORDER BY t.state`,
|
|
244
|
+
statsByIntent: `SELECT t.intent AS key, count(*) AS count FROM tasks t
|
|
245
|
+
WHERE ${TASK_FILTER} AND t.intent IS NOT NULL GROUP BY t.intent ORDER BY t.intent`,
|
|
246
|
+
statsByProfile: `SELECT t.profile AS key, count(*) AS count FROM tasks t
|
|
247
|
+
WHERE ${TASK_FILTER} AND t.profile IS NOT NULL GROUP BY t.profile ORDER BY t.profile`,
|
|
248
|
+
statsAttemptTotals: `SELECT count(*) AS total, COALESCE(SUM(a.duration_ms), 0) AS duration
|
|
249
|
+
FROM attempts a JOIN tasks t ON t.slug = a.task_slug WHERE ${TASK_FILTER}`,
|
|
250
|
+
statsByOutcome: `SELECT a.outcome AS key, count(*) AS count FROM attempts a
|
|
251
|
+
JOIN tasks t ON t.slug = a.task_slug WHERE ${TASK_FILTER} AND a.outcome IS NOT NULL
|
|
252
|
+
GROUP BY a.outcome ORDER BY a.outcome`,
|
|
253
|
+
statsByAgent: `SELECT a.agent AS key, count(*) AS count FROM attempts a
|
|
254
|
+
JOIN tasks t ON t.slug = a.task_slug WHERE ${TASK_FILTER} AND a.agent IS NOT NULL
|
|
255
|
+
GROUP BY a.agent ORDER BY count DESC, a.agent ASC`,
|
|
256
|
+
statsDurationAt: `SELECT a.duration_ms AS duration FROM attempts a
|
|
257
|
+
JOIN tasks t ON t.slug = a.task_slug
|
|
258
|
+
WHERE ${TASK_FILTER} AND a.duration_ms IS NOT NULL
|
|
259
|
+
ORDER BY a.duration_ms ASC LIMIT 1 OFFSET ?10`,
|
|
260
|
+
statsArtifacts: `SELECT count(*) AS total FROM artifacts r JOIN tasks t ON t.slug = r.task_slug WHERE ${TASK_FILTER}`,
|
|
261
|
+
statsArtifactsByStatus: `SELECT r.status AS key, count(*) AS count FROM artifacts r
|
|
262
|
+
JOIN tasks t ON t.slug = r.task_slug WHERE ${TASK_FILTER} AND r.status IS NOT NULL
|
|
263
|
+
GROUP BY r.status ORDER BY r.status`,
|
|
264
|
+
statsEventsByType: `SELECT e.type AS key, count(*) AS count FROM events e
|
|
265
|
+
JOIN tasks t ON t.slug = e.task_slug WHERE ${TASK_FILTER} GROUP BY e.type ORDER BY count DESC, e.type ASC`,
|
|
266
|
+
countSyncRuns: 'SELECT count(*) AS total FROM sync_runs',
|
|
267
|
+
listSyncRuns: `SELECT run_id, mode, started_at, finished_at, inserted, updated, unchanged, failed, absent, pruned, rebuilt, exit_code, error
|
|
268
|
+
FROM sync_runs ORDER BY started_at DESC, run_id DESC LIMIT ?1 OFFSET ?2`,
|
|
269
|
+
maxSyncRun: 'SELECT max(run_id) AS run_id FROM sync_runs',
|
|
270
|
+
healthTotals: 'SELECT count(*) AS total, COALESCE(SUM(CASE WHEN absent_at IS NOT NULL THEN 1 ELSE 0 END), 0) AS absent, max(projected_at) AS projected_at FROM tasks',
|
|
271
|
+
searchFts: `SELECT DISTINCT task_slug AS slug FROM search_fts WHERE search_fts MATCH ?1 LIMIT ?2`,
|
|
272
|
+
searchLike: `SELECT DISTINCT task_slug AS slug FROM documents
|
|
273
|
+
WHERE content LIKE ?1 ESCAPE '\\'
|
|
274
|
+
UNION
|
|
275
|
+
SELECT DISTINCT task_slug AS slug FROM prompts
|
|
276
|
+
WHERE content LIKE ?1 ESCAPE '\\'
|
|
277
|
+
UNION
|
|
278
|
+
SELECT DISTINCT slug FROM tasks
|
|
279
|
+
WHERE slug LIKE ?1 ESCAPE '\\' OR title LIKE ?1 ESCAPE '\\'
|
|
280
|
+
LIMIT ?2`,
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/* ------------------------------- validation -------------------------------- */
|
|
284
|
+
|
|
285
|
+
const parseInteger = (value, name, { min, max, fallback }) => {
|
|
286
|
+
if (value === null) return fallback;
|
|
287
|
+
if (!/^\d+$/.test(value)) fail('E_VALIDATION', 422, `${name} must be an integer between ${min} and ${max}`, { parameter: name });
|
|
288
|
+
const parsed = Number(value);
|
|
289
|
+
if (!Number.isSafeInteger(parsed) || parsed < min || parsed > max) {
|
|
290
|
+
fail('E_VALIDATION', 422, `${name} must be an integer between ${min} and ${max}`, { parameter: name });
|
|
291
|
+
}
|
|
292
|
+
return parsed;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const parseBoolean = (value, name, fallback) => {
|
|
296
|
+
if (value === null) return fallback;
|
|
297
|
+
if (value !== 'true' && value !== 'false') fail('E_VALIDATION', 422, `${name} must be true or false`, { parameter: name });
|
|
298
|
+
return value === 'true';
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
const parseEnum = (value, name, allowed, fallback) => {
|
|
302
|
+
if (value === null) return fallback;
|
|
303
|
+
if (!allowed.has(value)) {
|
|
304
|
+
fail('E_VALIDATION', 422, `${name} must be one of ${[...allowed].join(', ')}`, { parameter: name });
|
|
305
|
+
}
|
|
306
|
+
return value;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const parsePattern = (value, name, pattern, maxLength) => {
|
|
310
|
+
if (value === null) return '';
|
|
311
|
+
if (value.length > maxLength || !pattern.test(value)) fail('E_VALIDATION', 422, `${name} has an invalid shape`, { parameter: name });
|
|
312
|
+
return value;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const parseCsv = (value, name, allowed) => {
|
|
316
|
+
if (value === null || value.trim() === '') return [];
|
|
317
|
+
const values = [...new Set(value.split(',').map((entry) => entry.trim()).filter(Boolean))];
|
|
318
|
+
for (const entry of values) {
|
|
319
|
+
if (!allowed.has(entry)) fail('E_VALIDATION', 422, `${name} has an unknown value "${entry}"`, { parameter: name });
|
|
320
|
+
}
|
|
321
|
+
return values;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
const parseInstant = (value, name) => {
|
|
325
|
+
if (value === null || value === '') return '';
|
|
326
|
+
const parsed = Date.parse(value);
|
|
327
|
+
if (Number.isNaN(parsed)) fail('E_VALIDATION', 422, `${name} must be an ISO 8601 timestamp`, { parameter: name });
|
|
328
|
+
return new Date(parsed).toISOString();
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const parseQuery = (value, name) => {
|
|
332
|
+
if (value === null) return '';
|
|
333
|
+
if (value.length > 200) fail('E_VALIDATION', 422, `${name} must be at most 200 characters`, { parameter: name });
|
|
334
|
+
return value;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
const parseSlug = (value) => {
|
|
338
|
+
if (typeof value !== 'string' || !slugPattern.test(value)) fail('E_BAD_REQUEST', 400, 'slug must match ^[a-z0-9]+(?:-[a-z0-9]+)*$');
|
|
339
|
+
return value;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
const parseDocumentPath = (value) => {
|
|
343
|
+
if (typeof value !== 'string' || value.length === 0 || value.length > 512) {
|
|
344
|
+
fail('E_BAD_REQUEST', 400, 'path must be a task-relative document path of 1..512 characters');
|
|
345
|
+
}
|
|
346
|
+
if (value.includes('\0') || value.includes('\\') || path.posix.isAbsolute(value) || /^[a-zA-Z]:/.test(value)) {
|
|
347
|
+
fail('E_BAD_REQUEST', 400, 'path must be relative and must not contain a backslash or NUL');
|
|
348
|
+
}
|
|
349
|
+
if (value.split('/').some((segment) => segment === '..')) {
|
|
350
|
+
fail('E_BAD_REQUEST', 400, 'path must not contain a parent-directory segment');
|
|
351
|
+
}
|
|
352
|
+
// A single decode is the contract: a double-encoded payload stays a literal
|
|
353
|
+
// filename and cannot reach a filesystem path (there is no fs call at all).
|
|
354
|
+
if (/%2e|%2f|%5c/i.test(value)) fail('E_BAD_REQUEST', 400, 'path must be decoded once');
|
|
355
|
+
return value;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
/* -------------------------------- projections ------------------------------ */
|
|
359
|
+
|
|
360
|
+
const escapeLike = (value) => value.replace(/[\\%_]/g, '\\$&');
|
|
361
|
+
// A punctuation-only token (`'`, `--`) becomes an empty FTS phrase, and an
|
|
362
|
+
// empty phrase matches every row. Drop tokens without a letter or a digit so a
|
|
363
|
+
// payload cannot widen the result set.
|
|
364
|
+
const ftsTokens = (query) => query.split(/\s+/).filter((token) => /[\p{L}\p{N}]/u.test(token));
|
|
365
|
+
const toFtsQuery = (query) =>
|
|
366
|
+
ftsTokens(query)
|
|
367
|
+
.map((token) => `"${token.replace(/"/g, '""')}"`)
|
|
368
|
+
.join(' AND ');
|
|
369
|
+
|
|
370
|
+
const searchSlugs = (db, query) => {
|
|
371
|
+
if (!query || ftsTokens(query).length === 0) return [];
|
|
372
|
+
const mode = readSearchMode(db);
|
|
373
|
+
if (mode === 'fts5') {
|
|
374
|
+
try {
|
|
375
|
+
const rows = db.prepare(SQL.searchFts).all(toFtsQuery(query), MAX_OFFSET);
|
|
376
|
+
if (rows.length > 0) return rows.map((row) => row.slug);
|
|
377
|
+
} catch {
|
|
378
|
+
/* an FTS syntax edge falls back to LIKE instead of failing the query */
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return db.prepare(SQL.searchLike).all(`%${escapeLike(query)}%`, MAX_OFFSET).map((row) => row.slug);
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
const taskFilters = (db, query, includeAbsentDefault = false) => {
|
|
385
|
+
const includeAbsent = parseBoolean(query.get('includeAbsent'), 'includeAbsent', includeAbsentDefault);
|
|
386
|
+
const states = parseCsv(query.get('status'), 'status', TASK_STATE_SET);
|
|
387
|
+
const agent = parsePattern(query.get('agent'), 'agent', agentPattern, 64);
|
|
388
|
+
const intent = parsePattern(query.get('intent'), 'intent', intentPattern, 32);
|
|
389
|
+
const profile = parseEnum(query.get('profile'), 'profile', PROFILE_SET, '');
|
|
390
|
+
const from = parseInstant(query.get('from'), 'from');
|
|
391
|
+
const to = parseInstant(query.get('to'), 'to');
|
|
392
|
+
if (from && to && from > to) fail('E_VALIDATION', 422, 'from must not be later than to', { parameter: 'from' });
|
|
393
|
+
const q = parseQuery(query.get('q'), 'q');
|
|
394
|
+
// An active search with no matches is an empty result set, not "no filter".
|
|
395
|
+
const searchActive = q === '' ? 0 : 1;
|
|
396
|
+
const slugs = searchActive === 1 ? searchSlugs(db, q) : [];
|
|
397
|
+
return {
|
|
398
|
+
includeAbsent,
|
|
399
|
+
params: [includeAbsent ? 1 : 0, JSON.stringify(states), agent, intent, profile, from, to, searchActive, JSON.stringify(slugs)],
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const taskRow = (row) => {
|
|
404
|
+
const start = row.start_at ? Date.parse(row.start_at) : null;
|
|
405
|
+
const end = row.end_at ? Date.parse(row.end_at) : null;
|
|
406
|
+
const durationMs = start !== null && end !== null && !Number.isNaN(start) && !Number.isNaN(end) ? Math.max(0, end - start) : null;
|
|
407
|
+
return {
|
|
408
|
+
slug: row.slug,
|
|
409
|
+
title: row.title ?? null,
|
|
410
|
+
intent: row.intent ?? null,
|
|
411
|
+
profile: row.profile ?? null,
|
|
412
|
+
specMode: row.spec_mode ?? null,
|
|
413
|
+
state: row.state ?? null,
|
|
414
|
+
phase: row.phase ?? null,
|
|
415
|
+
pipelineIndex: row.pipeline_index ?? null,
|
|
416
|
+
currentAgent: row.current_agent ?? null,
|
|
417
|
+
awaitingHumanGate: row.awaiting_human_gate === 1,
|
|
418
|
+
stack: row.stack ?? null,
|
|
419
|
+
platform: row.platform ?? null,
|
|
420
|
+
updatedAt: row.updated_at ?? null,
|
|
421
|
+
startAt: row.start_at ?? null,
|
|
422
|
+
endAt: row.end_at ?? null,
|
|
423
|
+
durationMs,
|
|
424
|
+
attempts: row.attempt_count ?? 0,
|
|
425
|
+
artifacts: row.artifact_count ?? 0,
|
|
426
|
+
files: row.file_count ?? 0,
|
|
427
|
+
documentBytes: row.document_bytes ?? 0,
|
|
428
|
+
parseErrors: row.parse_error_count ?? 0,
|
|
429
|
+
gateState: (row.open_gates ?? 0) > 0 ? 'awaiting' : (row.gate_count ?? 0) > 0 ? 'closed' : 'none',
|
|
430
|
+
projectedAt: row.projected_at,
|
|
431
|
+
lastSeenAt: row.last_seen_at,
|
|
432
|
+
absentAt: row.absent_at ?? null,
|
|
433
|
+
contentHash: row.content_hash,
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
const page = (items, total, limit, offset) => ({
|
|
438
|
+
items,
|
|
439
|
+
total,
|
|
440
|
+
limit,
|
|
441
|
+
offset,
|
|
442
|
+
nextOffset: offset + items.length < total ? offset + items.length : null,
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
const getTaskRow = (db, slug) => {
|
|
446
|
+
const row = db.prepare(SQL.getTask).get(slug);
|
|
447
|
+
if (!row) fail('E_NOT_FOUND', 404, `no task "${slug}" in the projection`);
|
|
448
|
+
return row;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
const requireTask = (db, slug) => {
|
|
452
|
+
const row = db.prepare('SELECT slug FROM tasks WHERE slug = ?1').get(slug);
|
|
453
|
+
if (!row) fail('E_NOT_FOUND', 404, `no task "${slug}" in the projection`);
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
const listTasks = (db, query) => {
|
|
457
|
+
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: MAX_LIMIT, fallback: DEFAULT_LIMIT });
|
|
458
|
+
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
459
|
+
const sort = parseEnum(query.get('sort'), 'sort', SORT_VALUE_SET, '-updatedAt');
|
|
460
|
+
const { params } = taskFilters(db, query);
|
|
461
|
+
const rows = db.prepare(SQL.listTasks).all(...params, sort, limit, offset);
|
|
462
|
+
const total = Number(db.prepare(SQL.countTasks).get(...params).total);
|
|
463
|
+
return page(rows.map(taskRow), total, limit, offset);
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
const getTaskDetail = (db, slug) => {
|
|
467
|
+
const row = getTaskRow(db, slug);
|
|
468
|
+
let decision = {};
|
|
469
|
+
if (row.routing_json) {
|
|
470
|
+
try {
|
|
471
|
+
decision = JSON.parse(row.routing_json) ?? {};
|
|
472
|
+
} catch {
|
|
473
|
+
decision = {};
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
task: taskRow(row),
|
|
478
|
+
routing: { summary: row.routing_summary ?? null, decision },
|
|
479
|
+
counts: {
|
|
480
|
+
events: row.event_count ?? 0,
|
|
481
|
+
attempts: row.attempt_count ?? 0,
|
|
482
|
+
gates: row.gate_count ?? 0,
|
|
483
|
+
prompts: row.prompt_count ?? 0,
|
|
484
|
+
documents: row.document_count ?? 0,
|
|
485
|
+
},
|
|
486
|
+
hasPrompt: (row.prompt_count ?? 0) > 0,
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
const stepState = (index, row, { currentIndex, state }) => {
|
|
491
|
+
if (state === 'completed') return 'completed';
|
|
492
|
+
if (currentIndex === null || currentIndex === undefined) return 'pending';
|
|
493
|
+
if (index < currentIndex) return 'completed';
|
|
494
|
+
if (index === currentIndex) return 'in_progress';
|
|
495
|
+
return 'pending';
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
const getPipeline = (db, slug) => {
|
|
499
|
+
const task = getTaskRow(db, slug);
|
|
500
|
+
const steps = db.prepare(SQL.listSteps).all(slug);
|
|
501
|
+
const agents = db.prepare(SQL.listStepAgents).all(slug);
|
|
502
|
+
const byStep = new Map();
|
|
503
|
+
for (const entry of agents) {
|
|
504
|
+
if (!byStep.has(entry.step_index)) byStep.set(entry.step_index, []);
|
|
505
|
+
byStep.get(entry.step_index).push(entry.agent);
|
|
506
|
+
}
|
|
507
|
+
const currentIndex = task.pipeline_index ?? null;
|
|
508
|
+
return {
|
|
509
|
+
slug,
|
|
510
|
+
steps: steps.map((step) => ({
|
|
511
|
+
index: step.step_index,
|
|
512
|
+
label: step.label ?? null,
|
|
513
|
+
agents: byStep.get(step.step_index) ?? [],
|
|
514
|
+
scope: step.scope ?? null,
|
|
515
|
+
model: step.model ?? null,
|
|
516
|
+
skipIf: step.skip_if ?? null,
|
|
517
|
+
parallel: step.parallel === 1,
|
|
518
|
+
dependsOn: JSON.parse(step.depends_on_json ?? '[]'),
|
|
519
|
+
taskIds: JSON.parse(step.task_ids_json ?? '[]'),
|
|
520
|
+
writeScopes: JSON.parse(step.write_scopes_json ?? '[]'),
|
|
521
|
+
state: stepState(step.step_index, step, { currentIndex, state: task.state }),
|
|
522
|
+
})),
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
const attemptRow = (row) => ({
|
|
527
|
+
attemptId: row.attempt_id,
|
|
528
|
+
agent: row.agent ?? null,
|
|
529
|
+
role: row.role ?? null,
|
|
530
|
+
stepIndex: row.step_index ?? null,
|
|
531
|
+
stepLabel: row.step_label ?? null,
|
|
532
|
+
attempt: row.attempt_no ?? null,
|
|
533
|
+
startedAt: row.started_at ?? null,
|
|
534
|
+
finishedAt: row.finished_at ?? null,
|
|
535
|
+
durationMs: row.duration_ms ?? null,
|
|
536
|
+
outcome: row.outcome ?? null,
|
|
537
|
+
source: row.source ?? null,
|
|
538
|
+
attributionConfidence: row.attribution_confidence ?? null,
|
|
539
|
+
current: row.is_current === 1,
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
const listAttempts = (db, slug, query) => {
|
|
543
|
+
requireTask(db, slug);
|
|
544
|
+
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: MAX_LIMIT, fallback: DEFAULT_LIMIT });
|
|
545
|
+
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
546
|
+
const agent = parsePattern(query.get('agent'), 'agent', agentPattern, 64);
|
|
547
|
+
const outcome = parseEnum(query.get('outcome'), 'outcome', OUTCOME_VALUES, '');
|
|
548
|
+
const order = parseEnum(query.get('order'), 'order', new Set(['asc', 'desc']), 'asc');
|
|
549
|
+
const total = Number(db.prepare(SQL.countAttempts).get(slug, agent, outcome).total);
|
|
550
|
+
const rows = db.prepare(SQL.listAttempts).all(slug, agent, outcome, order, limit, offset);
|
|
551
|
+
return page(rows.map(attemptRow), total, limit, offset);
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
const eventRow = (row) => {
|
|
555
|
+
let payload = {};
|
|
556
|
+
try {
|
|
557
|
+
payload = JSON.parse(row.payload_json) ?? {};
|
|
558
|
+
} catch {
|
|
559
|
+
payload = {};
|
|
560
|
+
}
|
|
561
|
+
return {
|
|
562
|
+
eventId: row.event_id,
|
|
563
|
+
seq: row.seq,
|
|
564
|
+
type: row.type,
|
|
565
|
+
at: row.at ?? null,
|
|
566
|
+
attemptId: row.attempt_id ?? null,
|
|
567
|
+
stepIndex: row.step_index ?? null,
|
|
568
|
+
stepLabel: row.step_label ?? null,
|
|
569
|
+
agent: row.agent ?? null,
|
|
570
|
+
role: row.role ?? null,
|
|
571
|
+
attempt: row.attempt_no ?? null,
|
|
572
|
+
outcome: row.outcome ?? null,
|
|
573
|
+
waveId: row.wave_id ?? null,
|
|
574
|
+
parallelGroupId: row.parallel_group_id ?? null,
|
|
575
|
+
durationMs: row.duration_ms ?? null,
|
|
576
|
+
source: row.source ?? null,
|
|
577
|
+
attributionConfidence: row.attribution_confidence ?? null,
|
|
578
|
+
payload,
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
const listEvents = (db, slug, query) => {
|
|
583
|
+
requireTask(db, slug);
|
|
584
|
+
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: MAX_LIMIT, fallback: DEFAULT_LIMIT });
|
|
585
|
+
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
586
|
+
const types = parseCsv(query.get('type'), 'type', EVENT_TYPE_SET);
|
|
587
|
+
const from = parseInstant(query.get('from'), 'from');
|
|
588
|
+
const to = parseInstant(query.get('to'), 'to');
|
|
589
|
+
if (from && to && from > to) fail('E_VALIDATION', 422, 'from must not be later than to', { parameter: 'from' });
|
|
590
|
+
const order = parseEnum(query.get('order'), 'order', new Set(['asc', 'desc']), 'asc');
|
|
591
|
+
const total = Number(db.prepare(SQL.countEvents).get(slug, JSON.stringify(types), from, to).total);
|
|
592
|
+
const rows = db.prepare(SQL.listEvents).all(slug, JSON.stringify(types), from, to, order, limit, offset);
|
|
593
|
+
return page(rows.map(eventRow), total, limit, offset);
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
const getTimeline = (db, slug, query) => {
|
|
597
|
+
requireTask(db, slug);
|
|
598
|
+
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: MAX_LIMIT, fallback: DEFAULT_LIMIT });
|
|
599
|
+
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
600
|
+
const total = Number(db.prepare(SQL.countTimeline).get(slug).total);
|
|
601
|
+
const rows = db.prepare(SQL.listTimeline).all(slug, limit, offset);
|
|
602
|
+
const items = rows.map((row) => ({
|
|
603
|
+
at: row.at ?? null,
|
|
604
|
+
kind: row.kind,
|
|
605
|
+
title: row.title ?? null,
|
|
606
|
+
agent: row.agent === '' ? null : row.agent,
|
|
607
|
+
attemptId: row.kind === 'attempt' ? row.reference : null,
|
|
608
|
+
outcome: row.outcome === '' ? null : row.outcome,
|
|
609
|
+
detail: row.detail === '' ? null : row.detail,
|
|
610
|
+
}));
|
|
611
|
+
return page(items, total, limit, offset);
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
const listArtifacts = (db, slug) => {
|
|
615
|
+
requireTask(db, slug);
|
|
616
|
+
const rows = db.prepare(SQL.listArtifacts).all(slug);
|
|
617
|
+
const paths = db.prepare(SQL.listArtifactPaths).all(slug);
|
|
618
|
+
const byArtifact = new Map();
|
|
619
|
+
for (const entry of paths) {
|
|
620
|
+
if (!byArtifact.has(entry.artifact_id)) byArtifact.set(entry.artifact_id, { authoritative: [], evidence: [] });
|
|
621
|
+
byArtifact.get(entry.artifact_id)[entry.kind === 'authoritative' ? 'authoritative' : 'evidence'].push(entry.path);
|
|
622
|
+
}
|
|
623
|
+
const items = rows.map((row) => {
|
|
624
|
+
const own = byArtifact.get(row.artifact_id) ?? { authoritative: [], evidence: [] };
|
|
625
|
+
return {
|
|
626
|
+
id: row.artifact_id,
|
|
627
|
+
producer: row.producer ?? null,
|
|
628
|
+
status: row.status ?? null,
|
|
629
|
+
outcome: row.outcome ?? null,
|
|
630
|
+
summary: row.summary ?? null,
|
|
631
|
+
receiptAttemptId: row.receipt_attempt_id ?? null,
|
|
632
|
+
timestamps: {
|
|
633
|
+
createdAt: row.created_at ?? null,
|
|
634
|
+
updatedAt: row.updated_at ?? null,
|
|
635
|
+
completedAt: row.completed_at ?? null,
|
|
636
|
+
},
|
|
637
|
+
acceptanceCriteriaIds: JSON.parse(row.ac_ids_json ?? '[]'),
|
|
638
|
+
taskIds: JSON.parse(row.task_ids_json ?? '[]'),
|
|
639
|
+
paths: own,
|
|
640
|
+
};
|
|
641
|
+
});
|
|
642
|
+
return { items, total: items.length };
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
const listGates = (db, slug) => {
|
|
646
|
+
requireTask(db, slug);
|
|
647
|
+
const rows = db.prepare(SQL.listGates).all(slug);
|
|
648
|
+
const items = rows.map((row) => ({
|
|
649
|
+
startEventId: row.start_event_id,
|
|
650
|
+
startedAt: row.started_at ?? null,
|
|
651
|
+
endedAt: row.ended_at ?? null,
|
|
652
|
+
durationMs: row.duration_ms ?? null,
|
|
653
|
+
derived: true,
|
|
654
|
+
}));
|
|
655
|
+
return { items, total: items.length };
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
const getPrompts = (db, slug) => {
|
|
659
|
+
requireTask(db, slug);
|
|
660
|
+
const rows = db.prepare(SQL.listPrompts).all(slug);
|
|
661
|
+
const entries = rows.map((row) => ({
|
|
662
|
+
kind: row.seq === 0 ? 'prompt' : 'log',
|
|
663
|
+
seq: row.seq,
|
|
664
|
+
source: row.source ?? null,
|
|
665
|
+
command: row.command ?? null,
|
|
666
|
+
capturedAt: row.captured_at ?? null,
|
|
667
|
+
language: row.language ?? null,
|
|
668
|
+
content: row.content,
|
|
669
|
+
sha256: row.sha256,
|
|
670
|
+
bytes: row.bytes,
|
|
671
|
+
}));
|
|
672
|
+
return { prompt: entries.find((entry) => entry.seq === 0) ?? null, log: entries.filter((entry) => entry.seq > 0) };
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
const getMetrics = (db, slug) => {
|
|
676
|
+
const task = getTaskRow(db, slug);
|
|
677
|
+
const counts = {};
|
|
678
|
+
for (const row of db.prepare(SQL.eventCounts).all(slug)) counts[row.type] = Number(row.count);
|
|
679
|
+
const byAgent = db.prepare(SQL.attemptsByAgent).all(slug).map((row) => ({
|
|
680
|
+
agent: row.agent ?? null,
|
|
681
|
+
attempts: Number(row.attempts),
|
|
682
|
+
durationMs: Number(row.duration),
|
|
683
|
+
}));
|
|
684
|
+
const byStep = db.prepare(SQL.attemptsByStep).all(slug).map((row) => ({
|
|
685
|
+
stepIndex: row.step_index ?? null,
|
|
686
|
+
attempts: Number(row.attempts),
|
|
687
|
+
durationMs: Number(row.duration),
|
|
688
|
+
}));
|
|
689
|
+
return {
|
|
690
|
+
runId: task.metrics_run_id ?? null,
|
|
691
|
+
eventCounts: counts,
|
|
692
|
+
totalAttemptDurationMs: byAgent.reduce((sum, entry) => sum + entry.durationMs, 0),
|
|
693
|
+
byAgent,
|
|
694
|
+
byStep,
|
|
695
|
+
};
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
const documentSummary = (row) => ({
|
|
699
|
+
path: row.path,
|
|
700
|
+
sha256: row.sha256 ?? null,
|
|
701
|
+
bytes: row.bytes ?? null,
|
|
702
|
+
mediaType: row.media_type,
|
|
703
|
+
isText: row.is_text === 1,
|
|
704
|
+
contentOmitted: row.content_omitted ?? null,
|
|
705
|
+
parseError: row.parse_error ?? null,
|
|
706
|
+
projectedAt: row.projected_at,
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
const listDocuments = (db, slug, query) => {
|
|
710
|
+
requireTask(db, slug);
|
|
711
|
+
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: MAX_LIMIT, fallback: DEFAULT_LIMIT });
|
|
712
|
+
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
713
|
+
const q = parseQuery(query.get('q'), 'q');
|
|
714
|
+
const hasQuery = q === '' ? 0 : 1;
|
|
715
|
+
const pattern = `%${escapeLike(q)}%`;
|
|
716
|
+
const total = Number(db.prepare(SQL.countDocuments).get(slug, hasQuery, pattern).total);
|
|
717
|
+
const rows = db.prepare(SQL.listDocuments).all(slug, hasQuery, pattern, limit, offset);
|
|
718
|
+
return page(rows.map(documentSummary), total, limit, offset);
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Slice a text document by UTF-8 bytes. A boundary that lands inside a
|
|
723
|
+
* multi-byte character moves inward, so the response is always valid UTF-8.
|
|
724
|
+
*/
|
|
725
|
+
const sliceUtf8 = (content, offset, limit) => {
|
|
726
|
+
const buffer = Buffer.from(content, 'utf8');
|
|
727
|
+
const totalBytes = buffer.length;
|
|
728
|
+
if (offset > totalBytes) fail('E_RANGE', 416, `offset ${offset} is past the end of a ${totalBytes}-byte document`, { parameter: 'offset' });
|
|
729
|
+
let start = offset;
|
|
730
|
+
while (start < totalBytes && start > 0 && (buffer[start] & 0xc0) === 0x80) start += 1;
|
|
731
|
+
let end = Math.min(totalBytes, start + limit);
|
|
732
|
+
while (end > start && end < totalBytes && (buffer[end] & 0xc0) === 0x80) end -= 1;
|
|
733
|
+
return {
|
|
734
|
+
content: buffer.subarray(start, end).toString('utf8'),
|
|
735
|
+
offset,
|
|
736
|
+
limit,
|
|
737
|
+
totalBytes,
|
|
738
|
+
truncated: end < totalBytes,
|
|
739
|
+
};
|
|
740
|
+
};
|
|
741
|
+
|
|
742
|
+
const getDocument = (db, slug, query) => {
|
|
743
|
+
requireTask(db, slug);
|
|
744
|
+
const documentPath = parseDocumentPath(query.get('path'));
|
|
745
|
+
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: Number.MAX_SAFE_INTEGER, fallback: 0 });
|
|
746
|
+
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: MAX_DOC_LIMIT, fallback: DEFAULT_DOC_LIMIT });
|
|
747
|
+
const row = db.prepare(SQL.getDocument).get(slug, documentPath);
|
|
748
|
+
if (!row) fail('E_DOC_NOT_FOUND', 404, `no document "${documentPath}" for task "${slug}"`);
|
|
749
|
+
if (row.is_text !== 1) fail('E_DOC_BINARY', 410, `document "${documentPath}" is binary`, { path: documentPath });
|
|
750
|
+
if (row.content_omitted || row.content === null) {
|
|
751
|
+
fail('E_DOC_CONTENT_OMITTED', 409, `document "${documentPath}" content is omitted (${row.content_omitted ?? 'unavailable'})`, {
|
|
752
|
+
path: documentPath,
|
|
753
|
+
reason: row.content_omitted ?? 'unavailable',
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
const chunk = sliceUtf8(row.content, offset, limit);
|
|
757
|
+
return {
|
|
758
|
+
path: row.path,
|
|
759
|
+
sha256: row.sha256 ?? null,
|
|
760
|
+
bytes: row.bytes ?? null,
|
|
761
|
+
mediaType: row.media_type,
|
|
762
|
+
offset: chunk.offset,
|
|
763
|
+
limit: chunk.limit,
|
|
764
|
+
totalBytes: chunk.totalBytes,
|
|
765
|
+
truncated: chunk.truncated,
|
|
766
|
+
content: chunk.content,
|
|
767
|
+
};
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
const exportTask = (db, slug, query) => {
|
|
771
|
+
const includeAbsent = parseBoolean(query.get('includeAbsent'), 'includeAbsent', false);
|
|
772
|
+
const detail = getTaskDetail(db, slug);
|
|
773
|
+
if (!includeAbsent && detail.task.absentAt) {
|
|
774
|
+
fail('E_NOT_FOUND', 404, `task "${slug}" is absent; pass includeAbsent=true to export it`);
|
|
775
|
+
}
|
|
776
|
+
const pipeline = getPipeline(db, slug);
|
|
777
|
+
// The bundle is complete: the list endpoints' 200-row page bound does not
|
|
778
|
+
// truncate an export.
|
|
779
|
+
const attempts = db.prepare('SELECT * FROM attempts WHERE task_slug = ?1 ORDER BY step_index ASC, attempt_no ASC').all(slug).map(attemptRow);
|
|
780
|
+
const events = db.prepare('SELECT * FROM events WHERE task_slug = ?1 ORDER BY seq ASC').all(slug).map(eventRow);
|
|
781
|
+
const gates = listGates(db, slug);
|
|
782
|
+
const artifacts = listArtifacts(db, slug);
|
|
783
|
+
const prompts = getPrompts(db, slug);
|
|
784
|
+
const metrics = getMetrics(db, slug);
|
|
785
|
+
const documents = db
|
|
786
|
+
.prepare('SELECT path, sha256, bytes, media_type, is_text, content_omitted, parse_error, projected_at FROM documents WHERE task_slug = ?1 ORDER BY path ASC')
|
|
787
|
+
.all(slug)
|
|
788
|
+
.map(documentSummary);
|
|
789
|
+
const totalBytes = documents.reduce((sum, entry) => sum + (entry.bytes ?? 0), 0);
|
|
790
|
+
const documentsIncluded = totalBytes <= MAX_EXPORT_BYTES;
|
|
791
|
+
const documentContents = {};
|
|
792
|
+
if (documentsIncluded) {
|
|
793
|
+
const statement = db.prepare(SQL.getDocument);
|
|
794
|
+
for (const entry of documents) {
|
|
795
|
+
const row = statement.get(slug, entry.path);
|
|
796
|
+
if (row && row.is_text === 1 && row.content !== null) documentContents[entry.path] = row.content;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
return {
|
|
800
|
+
exportedAt: new Date().toISOString(),
|
|
801
|
+
apiVersion: API_VERSION,
|
|
802
|
+
detail,
|
|
803
|
+
pipeline,
|
|
804
|
+
attempts,
|
|
805
|
+
events,
|
|
806
|
+
gates: gates.items,
|
|
807
|
+
artifacts: artifacts.items,
|
|
808
|
+
prompts,
|
|
809
|
+
metrics,
|
|
810
|
+
documents,
|
|
811
|
+
documentContents,
|
|
812
|
+
documentsIncluded,
|
|
813
|
+
};
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
const countMap = (rows) => {
|
|
817
|
+
const map = {};
|
|
818
|
+
for (const row of rows) map[row.key] = Number(row.count);
|
|
819
|
+
return map;
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
const percentile = (db, params, total, fraction) => {
|
|
823
|
+
if (total === 0) return 0;
|
|
824
|
+
const index = Math.min(total - 1, Math.floor((total - 1) * fraction));
|
|
825
|
+
const row = db.prepare(SQL.statsDurationAt).get(...params, index);
|
|
826
|
+
return row ? Number(row.duration) : 0;
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
const getStats = (db, query) => {
|
|
830
|
+
const { params } = taskFilters(db, query);
|
|
831
|
+
// `total` spans the whole matching set so `active + absent === total`; the
|
|
832
|
+
// distributions and the attempt aggregates honour `includeAbsent`.
|
|
833
|
+
const allParams = [1, ...params.slice(1)];
|
|
834
|
+
const totals = db.prepare(SQL.statsTaskTotals).get(...allParams);
|
|
835
|
+
const attempts = db.prepare(SQL.statsAttemptTotals).get(...params);
|
|
836
|
+
const attemptTotal = Number(attempts.total);
|
|
837
|
+
return {
|
|
838
|
+
tasks: {
|
|
839
|
+
total: Number(totals.total),
|
|
840
|
+
active: Number(totals.active),
|
|
841
|
+
absent: Number(totals.absent),
|
|
842
|
+
byState: countMap(db.prepare(SQL.statsByState).all(...params)),
|
|
843
|
+
byIntent: countMap(db.prepare(SQL.statsByIntent).all(...params)),
|
|
844
|
+
byProfile: countMap(db.prepare(SQL.statsByProfile).all(...params)),
|
|
845
|
+
},
|
|
846
|
+
attempts: {
|
|
847
|
+
total: attemptTotal,
|
|
848
|
+
byOutcome: countMap(db.prepare(SQL.statsByOutcome).all(...params)),
|
|
849
|
+
byAgent: countMap(db.prepare(SQL.statsByAgent).all(...params)),
|
|
850
|
+
},
|
|
851
|
+
durations: {
|
|
852
|
+
totalAttemptMs: Number(attempts.duration),
|
|
853
|
+
p50Ms: percentile(db, params, attemptTotal, 0.5),
|
|
854
|
+
p95Ms: percentile(db, params, attemptTotal, 0.95),
|
|
855
|
+
},
|
|
856
|
+
artifacts: {
|
|
857
|
+
total: Number(db.prepare(SQL.statsArtifacts).get(...params).total),
|
|
858
|
+
byStatus: countMap(db.prepare(SQL.statsArtifactsByStatus).all(...params)),
|
|
859
|
+
},
|
|
860
|
+
events: { byType: countMap(db.prepare(SQL.statsEventsByType).all(...params)) },
|
|
861
|
+
};
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
const listSyncRuns = (db, query) => {
|
|
865
|
+
const limit = parseInteger(query.get('limit'), 'limit', { min: 1, max: MAX_LIMIT, fallback: DEFAULT_LIMIT });
|
|
866
|
+
const offset = parseInteger(query.get('offset'), 'offset', { min: 0, max: MAX_OFFSET, fallback: 0 });
|
|
867
|
+
const total = Number(db.prepare(SQL.countSyncRuns).get().total);
|
|
868
|
+
const rows = db.prepare(SQL.listSyncRuns).all(limit, offset);
|
|
869
|
+
const items = rows.map((row) => ({
|
|
870
|
+
runId: Number(row.run_id),
|
|
871
|
+
mode: row.mode,
|
|
872
|
+
startedAt: row.started_at,
|
|
873
|
+
finishedAt: row.finished_at ?? null,
|
|
874
|
+
inserted: Number(row.inserted),
|
|
875
|
+
updated: Number(row.updated),
|
|
876
|
+
unchanged: Number(row.unchanged),
|
|
877
|
+
failed: Number(row.failed),
|
|
878
|
+
absent: Number(row.absent),
|
|
879
|
+
pruned: Number(row.pruned),
|
|
880
|
+
rebuilt: row.rebuilt === 1,
|
|
881
|
+
exitCode: row.exit_code === null ? null : Number(row.exit_code),
|
|
882
|
+
error: row.error ?? null,
|
|
883
|
+
}));
|
|
884
|
+
return page(items, total, limit, offset);
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
const getHealth = (handle, settings) => {
|
|
888
|
+
const connection = handle.db;
|
|
889
|
+
const totals = connection.prepare(SQL.healthTotals).get();
|
|
890
|
+
const stored = readSchemaMeta(connection, 'fingerprint');
|
|
891
|
+
return {
|
|
892
|
+
status: 'ok',
|
|
893
|
+
db: {
|
|
894
|
+
file: path.basename(settings.dbPath),
|
|
895
|
+
present: true,
|
|
896
|
+
schemaVersion: readUserVersion(connection),
|
|
897
|
+
fingerprintOk: Boolean(stored) && stored === computeSchemaFingerprint(connection),
|
|
898
|
+
search: readSearchMode(connection),
|
|
899
|
+
},
|
|
900
|
+
tasks: { total: Number(totals.total), absent: Number(totals.absent) },
|
|
901
|
+
projectedAt: totals.projected_at ?? null,
|
|
902
|
+
};
|
|
903
|
+
};
|
|
904
|
+
|
|
905
|
+
const getMeta = (handle) => {
|
|
906
|
+
const connection = handle.db;
|
|
907
|
+
return {
|
|
908
|
+
apiVersion: API_VERSION,
|
|
909
|
+
openapiVersion: OPENAPI_VERSION,
|
|
910
|
+
schemaVersion: readUserVersion(connection),
|
|
911
|
+
migrations: listAppliedMigrations(connection).map((row) => ({
|
|
912
|
+
version: Number(row.version),
|
|
913
|
+
name: row.name,
|
|
914
|
+
checksum: row.checksum,
|
|
915
|
+
appliedAt: row.applied_at ?? null,
|
|
916
|
+
})),
|
|
917
|
+
features: {
|
|
918
|
+
fts5: readSearchMode(connection) === 'fts5',
|
|
919
|
+
search: readSearchMode(connection),
|
|
920
|
+
nodeSqlite: 'ok',
|
|
921
|
+
},
|
|
922
|
+
generatedAt: new Date().toISOString(),
|
|
923
|
+
};
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
/* --------------------------------- rescan ---------------------------------- */
|
|
927
|
+
|
|
928
|
+
const syncSettings = (settings) => ({
|
|
929
|
+
teamRoot: settings.teamRoot,
|
|
930
|
+
dbPath: settings.dbPath,
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
const runSyncChild = (db, settings) => {
|
|
934
|
+
if (isKillSwitchSet()) fail('E_DISABLED', 503, 'the projection is disabled by AI_RULES_TEAM_DB_DISABLE');
|
|
935
|
+
const script = path.join(moduleDirectory, 'team-db.mjs');
|
|
936
|
+
if (!fs.existsSync(script)) fail('E_DB_MISSING', 503, 'team-db.mjs is not installed next to the server');
|
|
937
|
+
const child = spawnSync(
|
|
938
|
+
process.execPath,
|
|
939
|
+
[script, 'sync', '--json', '--quiet', '--deadline-ms', String(SYNC_CHILD_DEADLINE_MS), '--root', settings.teamRoot],
|
|
940
|
+
{ cwd: settings.cwd, env: { ...process.env, AI_RULES_TEAM_DB_PATH: settings.dbPath }, encoding: 'utf8', timeout: SYNC_CHILD_TIMEOUT_MS, killSignal: 'SIGKILL', stdio: ['ignore', 'pipe', 'pipe'] },
|
|
941
|
+
);
|
|
942
|
+
if (child.error && child.error.code === 'ETIMEDOUT') fail('E_BUSY', 503, 'the rescan exceeded 30 s and was killed');
|
|
943
|
+
if (child.error) fail('E_INTERNAL', 500, 'the rescan child could not start');
|
|
944
|
+
let parsed = null;
|
|
945
|
+
try {
|
|
946
|
+
parsed = JSON.parse(String(child.stdout || '').trim());
|
|
947
|
+
} catch {
|
|
948
|
+
parsed = null;
|
|
949
|
+
}
|
|
950
|
+
if (!parsed) {
|
|
951
|
+
// One `path: reason` line, never prompt content, so an operator can act.
|
|
952
|
+
const detail = String(child.stderr || '')
|
|
953
|
+
.split('\n')
|
|
954
|
+
.map((line) => line.trim())
|
|
955
|
+
.find((line) => line.length > 0);
|
|
956
|
+
fail('E_INTERNAL', 500, `the rescan exited ${child.status} without a parseable result${detail ? ` (${detail.slice(0, 300)})` : ''}`);
|
|
957
|
+
}
|
|
958
|
+
const connection = db();
|
|
959
|
+
const row = connection.prepare(SQL.maxSyncRun).get();
|
|
960
|
+
const runId = row && row.run_id !== null ? Number(row.run_id) : null;
|
|
961
|
+
return {
|
|
962
|
+
runId,
|
|
963
|
+
mode: parsed.mode,
|
|
964
|
+
startedAt: parsed.startedAt ?? null,
|
|
965
|
+
finishedAt: new Date().toISOString(),
|
|
966
|
+
inserted: Number(parsed.inserted ?? 0),
|
|
967
|
+
updated: Number(parsed.updated ?? 0),
|
|
968
|
+
unchanged: Number(parsed.unchanged ?? 0),
|
|
969
|
+
failed: Number(parsed.failed ?? 0),
|
|
970
|
+
absent: Number(parsed.absent ?? 0),
|
|
971
|
+
pruned: Number(parsed.pruned ?? 0),
|
|
972
|
+
rebuilt: parsed.rebuilt === 1 || parsed.rebuilt === true,
|
|
973
|
+
exitCode: Number(parsed.exitCode ?? 0),
|
|
974
|
+
};
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
/* --------------------------------- routing -------------------------------- */
|
|
978
|
+
|
|
979
|
+
const route = (method, routePath, operationId, handler) => ({
|
|
980
|
+
method,
|
|
981
|
+
path: routePath,
|
|
982
|
+
operationId,
|
|
983
|
+
handler,
|
|
984
|
+
pattern: new RegExp(
|
|
985
|
+
`^${routePath
|
|
986
|
+
.split('/')
|
|
987
|
+
.map((segment) => (segment.startsWith('{') ? '([^/]+)' : segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')))
|
|
988
|
+
.join('/')}$`,
|
|
989
|
+
),
|
|
990
|
+
paramNames: routePath
|
|
991
|
+
.split('/')
|
|
992
|
+
.filter((segment) => segment.startsWith('{'))
|
|
993
|
+
.map((segment) => segment.slice(1, -1)),
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
const handleDashboard = () => ({ type: 'text/html; charset=utf-8', body: DASHBOARD_HTML, cache: 'no-store' });
|
|
997
|
+
const handleCss = () => ({ type: 'text/css; charset=utf-8', body: DASHBOARD_CSS, cache: 'no-cache' });
|
|
998
|
+
const handleJs = () => ({ type: 'text/javascript; charset=utf-8', body: DASHBOARD_JS, cache: 'no-cache' });
|
|
999
|
+
const handleOpenApi = () => ({ type: 'application/json; charset=utf-8', body: serializeOpenApiDocument(), cache: 'no-cache' });
|
|
1000
|
+
const handleHealth = (context) => ({ json: getHealth(context.handle(), context.settings) });
|
|
1001
|
+
const handleMeta = (context) => ({ json: getMeta(context.handle()) });
|
|
1002
|
+
|
|
1003
|
+
const taskRoute = (operationId, run) =>
|
|
1004
|
+
route('GET', `/api/v1/tasks/{slug}/${run.path}`, operationId, (context) => ({
|
|
1005
|
+
json: run.handler(context.db(), context.params.slug, context.query),
|
|
1006
|
+
}));
|
|
1007
|
+
|
|
1008
|
+
export const ROUTES = [
|
|
1009
|
+
route('GET', '/', 'getDashboard', handleDashboard),
|
|
1010
|
+
route('GET', '/assets/app.css', 'getDashboardCss', handleCss),
|
|
1011
|
+
route('GET', '/assets/app.js', 'getDashboardJs', handleJs),
|
|
1012
|
+
route('GET', '/openapi.json', 'getOpenApiDocument', handleOpenApi),
|
|
1013
|
+
route('GET', '/health', 'getHealth', handleHealth),
|
|
1014
|
+
route('GET', '/api/v1/meta', 'getMeta', handleMeta),
|
|
1015
|
+
route('GET', '/api/v1/tasks', 'listTasks', (context) => ({ json: listTasks(context.db(), context.query) })),
|
|
1016
|
+
route('GET', '/api/v1/tasks/{slug}', 'getTask', (context) => ({
|
|
1017
|
+
json: getTaskDetail(context.db(), context.params.slug),
|
|
1018
|
+
})),
|
|
1019
|
+
taskRoute('getTaskPipeline', { path: 'pipeline', handler: getPipeline }),
|
|
1020
|
+
taskRoute('listTaskAttempts', { path: 'attempts', handler: listAttempts }),
|
|
1021
|
+
taskRoute('listTaskEvents', { path: 'events', handler: listEvents }),
|
|
1022
|
+
taskRoute('getTaskTimeline', { path: 'timeline', handler: getTimeline }),
|
|
1023
|
+
taskRoute('listTaskArtifacts', { path: 'artifacts', handler: (db, slug) => listArtifacts(db, slug) }),
|
|
1024
|
+
taskRoute('getTaskPrompts', { path: 'prompts', handler: (db, slug) => getPrompts(db, slug) }),
|
|
1025
|
+
taskRoute('getTaskMetrics', { path: 'metrics', handler: (db, slug) => getMetrics(db, slug) }),
|
|
1026
|
+
taskRoute('listTaskGates', { path: 'gates', handler: (db, slug) => listGates(db, slug) }),
|
|
1027
|
+
taskRoute('listTaskDocuments', { path: 'documents', handler: listDocuments }),
|
|
1028
|
+
taskRoute('getTaskDocument', { path: 'document', handler: getDocument }),
|
|
1029
|
+
taskRoute('exportTask', { path: 'export', handler: exportTask }),
|
|
1030
|
+
route('GET', '/api/v1/stats', 'getStats', (context) => ({ json: getStats(context.db(), context.query) })),
|
|
1031
|
+
route('GET', '/api/v1/sync-runs', 'listSyncRuns', (context) => ({ json: listSyncRuns(context.db(), context.query) })),
|
|
1032
|
+
route('POST', '/api/v1/sync', 'triggerSync', (context) => ({ json: runSyncChild(context.db, context.settings) })),
|
|
1033
|
+
];
|
|
1034
|
+
|
|
1035
|
+
/** The documented `METHOD path` pairs, for the contract gate's route parity. */
|
|
1036
|
+
export const ROUTE_TABLE = ROUTES.map((entry) => ({ method: entry.method, path: entry.path, operationId: entry.operationId }));
|
|
1037
|
+
|
|
1038
|
+
/* ---------------------------------- server -------------------------------- */
|
|
1039
|
+
|
|
1040
|
+
const normalizeSettings = (options = {}) => {
|
|
1041
|
+
const teamRoot = path.resolve(options.teamRoot ?? process.env.AI_RULES_TEAM_DB_ROOT ?? DEFAULT_TEAM_ROOT);
|
|
1042
|
+
const dbPath = path.resolve(options.dbPath ?? process.env.AI_RULES_TEAM_DB_PATH ?? path.join(teamRoot, 'team.db'));
|
|
1043
|
+
return {
|
|
1044
|
+
host: options.host ?? DEFAULT_HOST,
|
|
1045
|
+
port: options.port ?? DEFAULT_PORT,
|
|
1046
|
+
teamRoot,
|
|
1047
|
+
dbPath,
|
|
1048
|
+
cwd: options.cwd ?? process.cwd(),
|
|
1049
|
+
allowRemote: Boolean(options.allowRemote),
|
|
1050
|
+
services: options.services ?? {},
|
|
1051
|
+
boundPort: options.port ?? DEFAULT_PORT,
|
|
1052
|
+
};
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
const isLoopbackHost = (host) => LOOPBACK_HOSTS.includes(host);
|
|
1056
|
+
|
|
1057
|
+
const hostLabel = (host) => (host.includes(':') ? `[${host}]` : host);
|
|
1058
|
+
|
|
1059
|
+
const allowedHosts = (settings) => {
|
|
1060
|
+
const port = settings.boundPort ?? settings.port;
|
|
1061
|
+
const hosts = new Set(LOOPBACK_HOSTS.map((host) => `${hostLabel(host)}:${port}`.toLowerCase()));
|
|
1062
|
+
if (settings.allowRemote && !isLoopbackHost(settings.host)) hosts.add(`${hostLabel(settings.host)}:${port}`.toLowerCase());
|
|
1063
|
+
return hosts;
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
const allowedOrigins = (settings) => {
|
|
1067
|
+
const port = settings.boundPort ?? settings.port;
|
|
1068
|
+
const origins = new Set(LOOPBACK_HOSTS.map((host) => `http://${hostLabel(host)}:${port}`.toLowerCase()));
|
|
1069
|
+
if (settings.allowRemote && !isLoopbackHost(settings.host)) origins.add(`http://${hostLabel(settings.host)}:${port}`.toLowerCase());
|
|
1070
|
+
return origins;
|
|
1071
|
+
};
|
|
1072
|
+
|
|
1073
|
+
const guardRequest = (req, settings) => {
|
|
1074
|
+
const host = typeof req.headers.host === 'string' ? req.headers.host.trim().toLowerCase() : '';
|
|
1075
|
+
if (!host || !allowedHosts(settings).has(host)) {
|
|
1076
|
+
fail('E_FORBIDDEN_HOST', 403, 'Host is not the loopback listener');
|
|
1077
|
+
}
|
|
1078
|
+
const origin = typeof req.headers.origin === 'string' ? req.headers.origin.trim().toLowerCase() : '';
|
|
1079
|
+
if (origin && !allowedOrigins(settings).has(origin)) {
|
|
1080
|
+
fail('E_FORBIDDEN_ORIGIN', 403, 'Origin is not the loopback listener');
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
const readBody = (req, limit) =>
|
|
1085
|
+
new Promise((resolve, reject) => {
|
|
1086
|
+
const chunks = [];
|
|
1087
|
+
let size = 0;
|
|
1088
|
+
let overflow = false;
|
|
1089
|
+
req.on('data', (chunk) => {
|
|
1090
|
+
size += chunk.length;
|
|
1091
|
+
if (size > limit) {
|
|
1092
|
+
overflow = true;
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
chunks.push(chunk);
|
|
1096
|
+
});
|
|
1097
|
+
req.on('end', () => {
|
|
1098
|
+
if (overflow) {
|
|
1099
|
+
reject(new ApiError('E_PAYLOAD_TOO_LARGE', 413, `request body exceeds ${limit} bytes`));
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
resolve(Buffer.concat(chunks));
|
|
1103
|
+
});
|
|
1104
|
+
req.on('error', () => reject(new ApiError('E_BAD_REQUEST', 400, 'the request body could not be read')));
|
|
1105
|
+
});
|
|
1106
|
+
|
|
1107
|
+
const send = (req, res, status, headers, body) => {
|
|
1108
|
+
const payload = typeof body === 'string' ? Buffer.from(body, 'utf8') : body;
|
|
1109
|
+
res.writeHead(status, {
|
|
1110
|
+
...CLIENT_HEADERS,
|
|
1111
|
+
...headers,
|
|
1112
|
+
'Content-Length': payload ? String(payload.length) : '0',
|
|
1113
|
+
});
|
|
1114
|
+
if (req.method === 'HEAD' || status === 204) {
|
|
1115
|
+
res.end();
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
res.end(payload);
|
|
1119
|
+
};
|
|
1120
|
+
|
|
1121
|
+
const sendJson = (req, res, status, value, extra = {}) =>
|
|
1122
|
+
send(req, res, status, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-store', ...extra }, JSON.stringify(value));
|
|
1123
|
+
|
|
1124
|
+
const sendError = (req, res, error) => {
|
|
1125
|
+
const code = error instanceof ApiError ? error.code : error instanceof TeamDbError ? mapTeamDbCode(error.code) : 'E_INTERNAL';
|
|
1126
|
+
const status = error instanceof ApiError ? error.status : error instanceof TeamDbError ? mapTeamDbCode(error.code, true) : 500;
|
|
1127
|
+
const message = error instanceof ApiError || error instanceof TeamDbError ? error.message.split(': ').slice(-1)[0] : 'unexpected server failure';
|
|
1128
|
+
const details = error instanceof ApiError && error.details ? { details: error.details } : {};
|
|
1129
|
+
sendJson(req, res, status, { error: { code, message, ...details } });
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1132
|
+
const mapTeamDbCode = (code, asStatus = false) => {
|
|
1133
|
+
if (code === 'E_DB_BUSY' || code === 'E_DEADLINE') return asStatus ? 503 : 'E_BUSY';
|
|
1134
|
+
if (code === 'E_SQLITE_UNAVAILABLE') return asStatus ? 503 : 'E_DB_MISSING';
|
|
1135
|
+
if (code === 'E_USAGE') return asStatus ? 500 : 'E_INTERNAL';
|
|
1136
|
+
if (CODE_STATUS.has(code)) return asStatus ? CODE_STATUS.get(code) : code;
|
|
1137
|
+
return asStatus ? 500 : 'E_INTERNAL';
|
|
1138
|
+
};
|
|
1139
|
+
|
|
1140
|
+
const routeFor = (method, pathname) => ROUTES.find((entry) => entry.method === method && entry.pattern.test(pathname));
|
|
1141
|
+
|
|
1142
|
+
const methodsFor = (pathname) => ROUTES.filter((entry) => entry.pattern.test(pathname)).map((entry) => entry.method);
|
|
1143
|
+
|
|
1144
|
+
const handle = async (req, res, settings) => {
|
|
1145
|
+
try {
|
|
1146
|
+
guardRequest(req, settings);
|
|
1147
|
+
const url = new URL(req.url ?? '/', `http://${settings.host}:${settings.boundPort}`);
|
|
1148
|
+
const pathname = url.pathname;
|
|
1149
|
+
const method = req.method ?? 'GET';
|
|
1150
|
+
const entry =
|
|
1151
|
+
method === 'HEAD'
|
|
1152
|
+
? ROUTES.find((candidate) => candidate.method === 'GET' && candidate.pattern.test(pathname))
|
|
1153
|
+
: routeFor(method, pathname);
|
|
1154
|
+
|
|
1155
|
+
if (!entry) {
|
|
1156
|
+
const allowed = methodsFor(pathname);
|
|
1157
|
+
if (allowed.length > 0) {
|
|
1158
|
+
const allow = allowed.includes('GET') ? 'GET, HEAD' : allowed.join(', ');
|
|
1159
|
+
sendJson(req, res, 405, { error: { code: 'E_METHOD_NOT_ALLOWED', message: `${method} is not allowed on ${pathname}` } }, { Allow: allow });
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
sendJson(req, res, 404, { error: { code: 'E_NOT_FOUND', message: `no route for ${method} ${pathname}` } });
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
if (entry.method === 'POST') {
|
|
1167
|
+
const body = await readBody(req, MAX_REQUEST_BODY_BYTES);
|
|
1168
|
+
const text = body.toString('utf8').trim();
|
|
1169
|
+
if (text !== '' && text !== '{}') {
|
|
1170
|
+
sendJson(req, res, 422, {
|
|
1171
|
+
error: { code: 'E_VALIDATION', message: 'the rescan accepts no request body', details: { parameter: 'body' } },
|
|
1172
|
+
});
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
const params = {};
|
|
1178
|
+
const match = entry.pattern.exec(pathname);
|
|
1179
|
+
entry.paramNames.forEach((name, index) => {
|
|
1180
|
+
const raw = match ? match[index + 1] : '';
|
|
1181
|
+
try {
|
|
1182
|
+
params[name] = decodeURIComponent(raw);
|
|
1183
|
+
} catch {
|
|
1184
|
+
fail('E_BAD_REQUEST', 400, 'path parameter is not valid percent-encoding');
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
if (params.slug !== undefined) params.slug = parseSlug(params.slug);
|
|
1188
|
+
|
|
1189
|
+
// The handler opens the connection lazily and the caller closes it, so a
|
|
1190
|
+
// static route never touches the database.
|
|
1191
|
+
let opened = null;
|
|
1192
|
+
const handleOnce = () => {
|
|
1193
|
+
if (!opened) {
|
|
1194
|
+
opened = settings.services.openDb?.(settings) ?? openTeamDb({ teamRoot: settings.teamRoot, dbPath: settings.dbPath, readOnly: true });
|
|
1195
|
+
}
|
|
1196
|
+
return opened;
|
|
1197
|
+
};
|
|
1198
|
+
const dbOnce = () => handleOnce().db;
|
|
1199
|
+
try {
|
|
1200
|
+
const result = entry.handler({ settings, params, query: url.searchParams, db: dbOnce, handle: handleOnce });
|
|
1201
|
+
if (result.json !== undefined) {
|
|
1202
|
+
sendJson(req, res, 200, result.json);
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
send(req, res, 200, { 'Content-Type': result.type, 'Cache-Control': result.cache }, result.body);
|
|
1206
|
+
} finally {
|
|
1207
|
+
if (opened) {
|
|
1208
|
+
try {
|
|
1209
|
+
opened.close();
|
|
1210
|
+
} catch {
|
|
1211
|
+
/* a close error after a read is not a request failure */
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
} catch (error) {
|
|
1216
|
+
sendError(req, res, error);
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
export const createRequestHandler = (settings) => (req, res) => {
|
|
1221
|
+
handle(req, res, settings).catch((error) => {
|
|
1222
|
+
try {
|
|
1223
|
+
sendJson(req, res, 500, { error: { code: 'E_INTERNAL', message: 'unexpected server failure' } });
|
|
1224
|
+
} catch {
|
|
1225
|
+
/* the response may already be gone */
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1230
|
+
export function makeServer(options = {}) {
|
|
1231
|
+
const settings = normalizeSettings(options);
|
|
1232
|
+
const server = http.createServer(createRequestHandler(settings));
|
|
1233
|
+
server.requestTimeout = 30000;
|
|
1234
|
+
server.headersTimeout = 10000;
|
|
1235
|
+
server.keepAliveTimeout = 5000;
|
|
1236
|
+
server.settings = settings;
|
|
1237
|
+
return server;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
export async function startServer(options = {}) {
|
|
1241
|
+
const server = makeServer(options);
|
|
1242
|
+
await new Promise((resolve, reject) => {
|
|
1243
|
+
const onError = (error) => {
|
|
1244
|
+
server.removeListener('listening', onListening);
|
|
1245
|
+
reject(error);
|
|
1246
|
+
};
|
|
1247
|
+
const onListening = () => {
|
|
1248
|
+
server.removeListener('error', onError);
|
|
1249
|
+
resolve();
|
|
1250
|
+
};
|
|
1251
|
+
server.once('error', onError);
|
|
1252
|
+
server.once('listening', onListening);
|
|
1253
|
+
server.listen(server.settings.port, server.settings.host);
|
|
1254
|
+
});
|
|
1255
|
+
const address = server.address();
|
|
1256
|
+
if (address && typeof address === 'object') {
|
|
1257
|
+
server.settings.boundPort = address.port;
|
|
1258
|
+
server.settings.boundHost = address.address;
|
|
1259
|
+
}
|
|
1260
|
+
const url = `http://${hostLabel(server.settings.boundHost ?? server.settings.host)}:${server.settings.boundPort}`;
|
|
1261
|
+
return {
|
|
1262
|
+
server,
|
|
1263
|
+
url,
|
|
1264
|
+
host: server.settings.boundHost ?? server.settings.host,
|
|
1265
|
+
port: server.settings.boundPort,
|
|
1266
|
+
settings: server.settings,
|
|
1267
|
+
close: () =>
|
|
1268
|
+
new Promise((resolve) => {
|
|
1269
|
+
server.close(() => resolve());
|
|
1270
|
+
}),
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/** One-line summary for the CLI. */
|
|
1275
|
+
export const describeServer = (info) => `team-db: serving ${info.url} (dashboard /, openapi /openapi.json)`;
|