@bonesofspring/ai-rules 0.2.23 → 0.2.24
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 +9 -0
- package/README.md +5 -1
- package/bin/cli.js +32 -9
- package/bin/opencode-install.js +531 -0
- package/package.json +10 -3
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +2 -2
- package/presets/_shared/core/meta/preset-layering.md +3 -3
- package/presets/_shared/core/meta/preset-no-cross-stack-leakage.md +1 -1
- package/presets/_shared/core/meta/preset-pr-checklist.md +4 -3
- package/presets/_shared/core/meta/preset-token-budget.md +3 -0
- package/presets/_shared/core/meta/preset-twin-sync.md +16 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/claude/go/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/go/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/go/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/claude/java/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/java/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/java/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/claude/next/REPO_AGENTS.md +10 -5
- package/presets/claude/next/agents/build-verifier.md +3 -1
- package/presets/claude/next/rules/tooling-and-review/ai-local-overlay.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/next/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/claude/nuxt/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/nuxt/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/nuxt/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/nuxt/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/claude/svelte/rules/tooling-and-review/preset-layering.md +3 -3
- package/presets/claude/svelte/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +4 -3
- package/presets/claude/svelte/rules/tooling-and-review/preset-token-budget.md +3 -0
- package/presets/claude/svelte/rules/tooling-and-review/preset-twin-sync.md +16 -0
- package/presets/cursor/android-kotlin/rules/preset-layering.mdc +3 -3
- package/presets/cursor/android-kotlin/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/android-kotlin/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/android-kotlin/rules/preset-twin-sync.mdc +16 -0
- package/presets/cursor/go/rules/preset-layering.mdc +3 -3
- package/presets/cursor/go/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/go/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/go/rules/preset-twin-sync.mdc +16 -0
- package/presets/cursor/ios-swift/rules/preset-layering.mdc +3 -3
- package/presets/cursor/ios-swift/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/ios-swift/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +16 -0
- package/presets/cursor/java/rules/preset-layering.mdc +3 -3
- package/presets/cursor/java/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/java/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/java/rules/preset-twin-sync.mdc +16 -0
- package/presets/cursor/mcp-ts/rules/preset-layering.mdc +3 -3
- package/presets/cursor/mcp-ts/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/mcp-ts/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +16 -0
- package/presets/cursor/next/REPO_AGENTS.md +10 -5
- package/presets/cursor/next/agents/build-verifier.md +3 -1
- package/presets/cursor/next/rules/ai-local-overlay.mdc +1 -1
- package/presets/cursor/next/rules/preset-layering.mdc +3 -3
- package/presets/cursor/next/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/next/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/next/rules/preset-twin-sync.mdc +16 -0
- package/presets/cursor/nuxt/rules/preset-layering.mdc +3 -3
- package/presets/cursor/nuxt/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/nuxt/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/nuxt/rules/preset-twin-sync.mdc +16 -0
- package/presets/cursor/php-hexagonal/rules/preset-layering.mdc +3 -3
- package/presets/cursor/php-hexagonal/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/php-hexagonal/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/php-hexagonal/rules/preset-twin-sync.mdc +16 -0
- package/presets/cursor/php-laravel/rules/preset-layering.mdc +3 -3
- package/presets/cursor/php-laravel/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/php-laravel/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/php-laravel/rules/preset-twin-sync.mdc +16 -0
- package/presets/cursor/svelte/rules/preset-layering.mdc +3 -3
- package/presets/cursor/svelte/rules/preset-no-cross-stack-leakage.mdc +1 -1
- package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +4 -3
- package/presets/cursor/svelte/rules/preset-token-budget.mdc +3 -0
- package/presets/cursor/svelte/rules/preset-twin-sync.mdc +16 -0
- package/presets/mavis/next/REPO_AGENTS.md +9 -7
- package/presets/mavis/next/adapter-map.json +1 -1
- package/presets/mavis/next/agents/build-verifier.md +3 -1
- package/presets/mavis/next/rules/agent-team-orchestrator.md +2 -2
- package/presets/mavis/next/rules/ai-local-overlay.md +1 -1
- package/presets/mavis/next/rules/preset-layering.md +3 -3
- package/presets/mavis/next/rules/preset-no-cross-stack-leakage.md +1 -1
- package/presets/mavis/next/rules/preset-pr-checklist.md +4 -3
- package/presets/mavis/next/rules/preset-token-budget.md +3 -0
- package/presets/mavis/next/rules/preset-twin-sync.md +16 -0
- package/presets/opencode/README.md +61 -0
- package/presets/opencode/next/MCP.md +36 -0
- package/presets/opencode/next/OPENCODE.md +65 -0
- package/presets/opencode/next/README.md +16 -0
- package/presets/opencode/next/REPO_AGENTS.md +97 -0
- package/presets/opencode/next/adapter-map.json +959 -0
- package/presets/opencode/next/agents/README.md +201 -0
- package/presets/opencode/next/agents/accessibility-reviewer.md +73 -0
- package/presets/opencode/next/agents/api-contract-reviewer.md +69 -0
- package/presets/opencode/next/agents/build-verifier.md +124 -0
- package/presets/opencode/next/agents/ci-investigator.md +71 -0
- package/presets/opencode/next/agents/code-reviewer.md +73 -0
- package/presets/opencode/next/agents/codebase-analyzer.md +33 -0
- package/presets/opencode/next/agents/debugger.md +88 -0
- package/presets/opencode/next/agents/feature-developer.md +109 -0
- package/presets/opencode/next/agents/migration-specialist.md +79 -0
- package/presets/opencode/next/agents/mockup-reviewer.md +65 -0
- package/presets/opencode/next/agents/openspec-author.md +169 -0
- package/presets/opencode/next/agents/performance-auditor.md +80 -0
- package/presets/opencode/next/agents/playwright-test-generator.md +36 -0
- package/presets/opencode/next/agents/playwright-test-healer.md +36 -0
- package/presets/opencode/next/agents/playwright-test-planner.md +33 -0
- package/presets/opencode/next/agents/qa-tester.md +60 -0
- package/presets/opencode/next/agents/security-reviewer.md +66 -0
- package/presets/opencode/next/agents/solution-architect.md +80 -0
- package/presets/opencode/next/agents/task-analyst.md +178 -0
- package/presets/opencode/next/agents/task-router.md +190 -0
- package/presets/opencode/next/agents/tech-writer.md +69 -0
- package/presets/opencode/next/agents/unit-test-generator.md +39 -0
- package/presets/opencode/next/agents/unit-test-healer.md +40 -0
- package/presets/opencode/next/agents/unit-test-planner.md +66 -0
- package/presets/opencode/next/commands/README.md +49 -0
- package/presets/opencode/next/commands/spec-start.md +32 -0
- package/presets/opencode/next/commands/task-continue.md +58 -0
- package/presets/opencode/next/commands/task.md +58 -0
- package/presets/opencode/next/commands/technical-retro.md +88 -0
- package/presets/opencode/next/hooks/README.md +22 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +845 -0
- package/presets/opencode/next/opencode.json +33 -0
- package/presets/opencode/next/rules/README.md +20 -0
- package/presets/opencode/next/rules/agent-team-intake.md +11 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +214 -0
- package/presets/opencode/next/rules/ai-local-overlay.md +37 -0
- package/presets/opencode/next/rules/anti-sycophancy-discipline.md +23 -0
- package/presets/opencode/next/rules/api-services.md +72 -0
- package/presets/opencode/next/rules/architecture-boundaries-ui.md +9 -0
- package/presets/opencode/next/rules/architecture-boundaries.md +86 -0
- package/presets/opencode/next/rules/arrow-functions.md +25 -0
- package/presets/opencode/next/rules/code-quality-and-refactoring.md +40 -0
- package/presets/opencode/next/rules/code-review-mr.md +40 -0
- package/presets/opencode/next/rules/css-property-order-stylelint.md +5 -0
- package/presets/opencode/next/rules/design-guidance.md +99 -0
- package/presets/opencode/next/rules/feature-delivery-workflow.md +49 -0
- package/presets/opencode/next/rules/http-client.md +55 -0
- package/presets/opencode/next/rules/layer-barrel-exports.md +68 -0
- package/presets/opencode/next/rules/mcp-usage.md +86 -0
- package/presets/opencode/next/rules/mockup-review.md +107 -0
- package/presets/opencode/next/rules/navigation-router-stack.md +56 -0
- package/presets/opencode/next/rules/navigation-router-ui.md +10 -0
- package/presets/opencode/next/rules/next-app-core.md +29 -0
- package/presets/opencode/next/rules/next-app-router.md +44 -0
- package/presets/opencode/next/rules/no-props-spread.md +56 -0
- package/presets/opencode/next/rules/no-type-assertion-as-import-export.md +51 -0
- package/presets/opencode/next/rules/package-manager.md +11 -0
- package/presets/opencode/next/rules/playwright-agents.md +67 -0
- package/presets/opencode/next/rules/post-change-lint.md +35 -0
- package/presets/opencode/next/rules/preset-layering.md +27 -0
- package/presets/opencode/next/rules/preset-no-cross-stack-leakage.md +90 -0
- package/presets/opencode/next/rules/preset-pr-checklist.md +36 -0
- package/presets/opencode/next/rules/preset-token-budget.md +39 -0
- package/presets/opencode/next/rules/preset-twin-sync.md +81 -0
- package/presets/opencode/next/rules/product-specs-authoring.md +112 -0
- package/presets/opencode/next/rules/product-specs.md +56 -0
- package/presets/opencode/next/rules/public-imports.md +50 -0
- package/presets/opencode/next/rules/react-a11y-coding.md +31 -0
- package/presets/opencode/next/rules/react-next-anti-hallucination.md +60 -0
- package/presets/opencode/next/rules/react-ui.md +105 -0
- package/presets/opencode/next/rules/reference-features.md +45 -0
- package/presets/opencode/next/rules/security-next.md +45 -0
- package/presets/opencode/next/rules/store-rtk.md +78 -0
- package/presets/opencode/next/rules/technical-retro.md +11 -0
- package/presets/opencode/next/rules/tests-e2e-structure.md +72 -0
- package/presets/opencode/next/rules/tests-unit.md +72 -0
- package/presets/opencode/next/rules/types-jsdoc.md +43 -0
- package/presets/opencode/next/rules/ux-design.md +99 -0
- package/presets/opencode/next/skills/README.md +21 -0
- package/presets/opencode/next/skills/ci-investigation/SKILL.md +44 -0
- package/presets/opencode/next/skills/code-review/SKILL.md +44 -0
- package/presets/opencode/next/skills/debug-investigation/SKILL.md +59 -0
- package/presets/opencode/next/skills/feature-delivery/SKILL.md +39 -0
- package/presets/opencode/next/skills/mockup-review/SKILL.md +29 -0
- package/presets/opencode/next/skills/playwright-e2e/SKILL.md +33 -0
- package/presets/opencode/next/skills/react-performance/SKILL.md +44 -0
- package/presets/opencode/next/skills/spec-authoring/SKILL.md +26 -0
- package/presets/opencode/next/skills/spec-discovery/SKILL.md +58 -0
- package/presets/opencode/next/skills/technical-retro/SKILL.md +54 -0
- package/presets/opencode/next/skills/unit-testing/SKILL.md +34 -0
- package/presets/opencode/next/skills/ux-design/SKILL.md +36 -0
- package/presets/opencode/next/skills/write-adr/SKILL.md +41 -0
- package/presets/opencode/next/team/README.md +148 -0
- package/presets/opencode/next/team/conventions.md +21 -0
- package/presets/opencode/next/team/fixtures/artifact-manifest.example.json +79 -0
- package/presets/opencode/next/team/fixtures/bugfix-standard.json +25 -0
- package/presets/opencode/next/team/fixtures/feature-full.json +29 -0
- package/presets/opencode/next/team/fixtures/feature-light.json +27 -0
- package/presets/opencode/next/team/fixtures/feature-with-figma-url.json +17 -0
- package/presets/opencode/next/team/fixtures/feature-with-ux-no-figma.json +17 -0
- package/presets/opencode/next/team/fixtures/memlog.example.md +9 -0
- package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
- package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
- package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
- package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
- package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
- package/presets/opencode/next/team/fixtures/metrics.example.json +54 -0
- package/presets/opencode/next/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
- package/presets/opencode/next/team/fixtures/mockup-review-standalone.json +14 -0
- package/presets/opencode/next/team/fixtures/ux-design-standalone.json +15 -0
- package/presets/opencode/next/team/tasks/.gitkeep +0 -0
- package/presets/opencode/platform-contract.json +131 -0
- package/scripts/capture-cli-golden.mjs +5 -1
- package/scripts/check-chain-hook-coverage.sh +1 -0
- package/scripts/check-opencode-adapter-map.mjs +294 -0
- package/scripts/check-opencode-local-overlay.mjs +56 -0
- package/scripts/check-opencode-platform-contract.mjs +388 -0
- package/scripts/check-opencode-token-budget.mjs +48 -0
- package/scripts/check-preset-leakage.sh +30 -1
- package/scripts/check-preset-structure.sh +45 -0
- package/scripts/check-task-router-intents.sh +4 -4
- package/scripts/fixtures/cli-golden/claude/next.json +8 -8
- package/scripts/fixtures/cli-golden/cursor/next.json +8 -8
- package/scripts/fixtures/cli-golden/mavis/next.json +9 -9
- package/scripts/fixtures/cli-golden/opencode/next.json +125 -0
- package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/cursor/AGENTS.md +1 -0
- package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/cursor/rules/extra.mdc +1 -0
- package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/cursor/rules/sample.mdc +2 -0
- package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/opencode/OPENCODE.md +1 -0
- package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/opencode/adapter-map.json +26 -0
- package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/opencode/rules/sample.md +2 -0
- package/scripts/fixtures/opencode-adapter-map/valid/cursor/AGENTS.md +1 -0
- package/scripts/fixtures/opencode-adapter-map/valid/cursor/rules/sample.mdc +2 -0
- package/scripts/fixtures/opencode-adapter-map/valid/opencode/OPENCODE.md +1 -0
- package/scripts/fixtures/opencode-adapter-map/valid/opencode/adapter-map.json +26 -0
- package/scripts/fixtures/opencode-adapter-map/valid/opencode/rules/sample.md +2 -0
- package/scripts/fixtures/opencode-platform-contract/invalid-home-destination.json +131 -0
- package/scripts/fixtures/opencode-platform-contract/invalid-missing-capability.json +126 -0
- package/scripts/fixtures/opencode-platform-contract/invalid-released-unknown-stack.json +133 -0
- package/scripts/fixtures/opencode-platform-contract/invalid-unknown-native-path.json +131 -0
- package/scripts/fixtures/opencode-platform-contract/invalid-version-pin.json +132 -0
- package/scripts/fixtures/opencode-platform-contract/valid.json +131 -0
- package/scripts/generate-mavis-next.mjs +9 -7
- package/scripts/generate-opencode-next.mjs +831 -0
- package/scripts/lib/discover-hooks.mjs +23 -1
- package/scripts/sync-dogfood-mavis.sh +90 -0
- package/scripts/sync-dogfood-opencode.sh +85 -0
- package/scripts/test-agent-task-metrics-hooks.mjs +4 -1
- package/scripts/test-chain-team-phases-coverage.mjs +6 -1
- package/scripts/test-cli-init-clean.mjs +111 -0
- package/scripts/test-opencode-context-budget.mjs +53 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"mcp": {
|
|
4
|
+
"context7": {
|
|
5
|
+
"type": "local",
|
|
6
|
+
"command": [
|
|
7
|
+
"npx",
|
|
8
|
+
"-y",
|
|
9
|
+
"@upstash/context7-mcp@4.0.2"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"playwright": {
|
|
13
|
+
"type": "local",
|
|
14
|
+
"command": [
|
|
15
|
+
"npx",
|
|
16
|
+
"-y",
|
|
17
|
+
"@playwright/mcp@0.0.79"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"chrome-devtools": {
|
|
21
|
+
"type": "local",
|
|
22
|
+
"command": [
|
|
23
|
+
"npx",
|
|
24
|
+
"-y",
|
|
25
|
+
"chrome-devtools-mcp@1.7.0"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"figma": {
|
|
29
|
+
"type": "remote",
|
|
30
|
+
"url": "https://mcp.figma.com/mcp"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# OpenCode Next rules
|
|
2
|
+
|
|
3
|
+
Plain Markdown. OpenCode does **not** auto-load these files. Root `AGENTS.md`
|
|
4
|
+
and `.opencode/AGENTS.md` list four essential paths to Read immediately; the
|
|
5
|
+
rest are lazy-loaded when the task matches.
|
|
6
|
+
|
|
7
|
+
Do not put this catalog into `opencode.json` `instructions` as the only
|
|
8
|
+
always-on path (V2 may ignore that field).
|
|
9
|
+
|
|
10
|
+
## Essential (entry-critical)
|
|
11
|
+
|
|
12
|
+
`next-app-core`, `package-manager`, `code-quality-and-refactoring`,
|
|
13
|
+
`ai-local-overlay`.
|
|
14
|
+
|
|
15
|
+
## Requestable
|
|
16
|
+
|
|
17
|
+
All other `*.md` files in this directory. Same stems as Cursor
|
|
18
|
+
`rules/README.md`.
|
|
19
|
+
|
|
20
|
+
Shared-core markers (`<!-- shared-core: … -->`) are preserved from Cursor.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!-- shared-core: agent-team/agent-team-intake.md -->
|
|
2
|
+
|
|
3
|
+
# Agent team intake
|
|
4
|
+
|
|
5
|
+
When the user message looks like a **work request** (implement, add, fix, refactor, review MR, write tests, spike) — not a question about how code works:
|
|
6
|
+
|
|
7
|
+
1. Prefer **`/task <their request>`** or invoke **task-router** first.
|
|
8
|
+
2. Do not jump straight to coding without router + pipeline when scope is non-trivial.
|
|
9
|
+
3. Pure questions (“how does X work”, “explain”) — prefer agent **`codebase-analyzer`** (explain-as-is); trivial one-liners may be answered inline. Do not open `/task`.
|
|
10
|
+
|
|
11
|
+
Exceptions: user explicitly says “no pipeline”, “just do it”, or continues an active slug.
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<!-- shared-core: agent-team/agent-team-orchestrator.md -->
|
|
2
|
+
|
|
3
|
+
# Agent team orchestrator
|
|
4
|
+
|
|
5
|
+
Parent agent = **manager**. Router plans; specialists execute. Artifacts: `.opencode/team/tasks/<slug>/` (Claude: `.claude/team/tasks/<slug>/`).
|
|
6
|
+
|
|
7
|
+
Work request without `/task` — see **agent-team-intake** (when to suggest the router instead of coding directly).
|
|
8
|
+
|
|
9
|
+
## Entry points
|
|
10
|
+
|
|
11
|
+
| Command | When |
|
|
12
|
+
|---------|------|
|
|
13
|
+
| **`/task <desc>`** | **Preferred** — router → dynamic pipeline → first agent |
|
|
14
|
+
| `/task-continue <slug>` | After human gate or pause |
|
|
15
|
+
| `/spec-start [desc]` | Generate/bootstrap `docs/specs` — router intent `spec-gen` → analyst author mode → human gate |
|
|
16
|
+
| `/technical-retro [slug]` | Retro with agent team block |
|
|
17
|
+
|
|
18
|
+
## Roles (shared catalog)
|
|
19
|
+
|
|
20
|
+
Roster of specialists is **stack-specific** (agent names and write scopes differ). See **Stack notes** in the stack adapter for the live Roles table. Common patterns:
|
|
21
|
+
|
|
22
|
+
| Kind | Examples (names vary by stack) |
|
|
23
|
+
|------|--------------------------------|
|
|
24
|
+
| Planning | `task-router`, `task-analyst` (plus skill `ux-design` for behavioral UX **where the stack has a UI surface**), `solution-architect`, `migration-specialist` |
|
|
25
|
+
| Implementation | `feature-developer`, `debugger`, `ci-investigator` |
|
|
26
|
+
| Gates / review | `build-verifier`, `code-reviewer`, `security-reviewer`, `performance-auditor`; plus stack-native a11y/UI reviewer and `mockup-reviewer` **only when the stack has a UI surface** |
|
|
27
|
+
| Tests | unit planner/generator/healer; e2e/UI planner/generator/healer (stack-native) |
|
|
28
|
+
| Docs | `tech-writer` |
|
|
29
|
+
|
|
30
|
+
**OpenCode frontmatter:** all team pipeline agents use `mode: subagent` and `permission.edit` so they can write team artifacts (`edit: allow` for implementers; deny except `.opencode/team/**` for reviewers/planners). Production/app restrictions live in the agent prompt body. See `agents/README.md`.
|
|
31
|
+
|
|
32
|
+
Full prompts: stack `agents/*.md`. Artifact conventions: stack `team/README.md`; schema SoT: **agent-artifact-contracts**.
|
|
33
|
+
|
|
34
|
+
## Stack notes
|
|
35
|
+
|
|
36
|
+
Roles, write scopes, and OpenCode `mode` / `permission` packaging — **`agents/README.md`**.
|
|
37
|
+
|
|
38
|
+
## Dynamic pipeline
|
|
39
|
+
|
|
40
|
+
```mermaid
|
|
41
|
+
flowchart TD
|
|
42
|
+
task["/task prompt"]
|
|
43
|
+
router["task-router"]
|
|
44
|
+
pipeline["pipeline.json"]
|
|
45
|
+
step0["steps 0..N"]
|
|
46
|
+
gate{"humanGates?"}
|
|
47
|
+
hook["subagentStop hook"]
|
|
48
|
+
retro["/technical-retro"]
|
|
49
|
+
|
|
50
|
+
task --> router
|
|
51
|
+
router --> pipeline
|
|
52
|
+
pipeline --> step0
|
|
53
|
+
step0 --> gate
|
|
54
|
+
gate -->|"/task-continue"| step0
|
|
55
|
+
step0 --> hook
|
|
56
|
+
hook --> step0
|
|
57
|
+
step0 --> retro
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Source of truth for order:** `pipeline.json` → `steps[]`. Never hardcode analyst → dev → review → QA when `pipeline.json` exists.
|
|
61
|
+
|
|
62
|
+
## Routing decision contract
|
|
63
|
+
|
|
64
|
+
Keep top-level `profile` (`light` | `standard` | `full`) and add a top-level `routingDecision` object:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"profile": "standard",
|
|
69
|
+
"routingDecision": {
|
|
70
|
+
"complexity": "moderate",
|
|
71
|
+
"riskFlags": ["behavior-regression"],
|
|
72
|
+
"routingReasons": [
|
|
73
|
+
"The failure needs root-cause analysis before a bounded fix.",
|
|
74
|
+
"Behavior changes require validation and independent review."
|
|
75
|
+
],
|
|
76
|
+
"estimatedWorkPackages": 1,
|
|
77
|
+
"openDecisionCount": 0
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
| Field | Contract |
|
|
83
|
+
|-------|----------|
|
|
84
|
+
| `complexity` | `low` \| `moderate` \| `high`; classify scope and coordination, not perceived coding difficulty |
|
|
85
|
+
| `riskFlags` | Array of concrete signals such as `public-contract`, `cross-layer`, `security-sensitive`, `migration`, `destructive`, `concurrency-state`, `external-dependency`, `unclear-acceptance-criteria`, `broad-test-surface`, `behavior-regression` |
|
|
86
|
+
| `routingReasons` | Non-empty, auditable facts from the request; each reason explains a profile, gate, specialist, skip, or checkpoint choice |
|
|
87
|
+
| `estimatedWorkPackages` | Integer ≥1; count meaningful independently verifiable delivery scopes, not files or agents |
|
|
88
|
+
| `openDecisionCount` | Integer ≥0; unresolved product/architecture/contract choices at routing time |
|
|
89
|
+
|
|
90
|
+
Rubric:
|
|
91
|
+
|
|
92
|
+
- `low`: one bounded scope, explicit acceptance criteria, reversible change, no risk flags or open decisions. Use `light` only when stack verification policy permits.
|
|
93
|
+
- `moderate`: several files or adjacent concerns, a regression/refactor with known boundaries, or one contained risk flag. Usually `standard`.
|
|
94
|
+
- `high`: cross-layer/public-contract work, migration/destructive/security/concurrency risk, broad test surface, multiple work packages, or unclear acceptance criteria. Usually `full`.
|
|
95
|
+
- Increase the profile when risk, open decisions, or required checkpoints demand it; do not lower complexity merely because the implementation is familiar.
|
|
96
|
+
- Do not write generic reasons such as “standard by default.” Name the observed signal and the routing consequence.
|
|
97
|
+
|
|
98
|
+
Existing pipelines without `routingDecision` remain valid; routers emit it for new pipelines. The block is documentary routing evidence in P0 and does not change hook behavior.
|
|
99
|
+
|
|
100
|
+
## Metrics lifecycle
|
|
101
|
+
|
|
102
|
+
For local metrics policy and the `metrics.json` ledger, see **agent-task-metrics**. The orchestration runtime records `task_started` and one `attempt_started` before each invocation; the hook records host-clock terminal and human-gate events. Keep active attempt identities in `status.json.activeAttempts` so parallel completions can be bound safely.
|
|
103
|
+
|
|
104
|
+
Do not calculate durations in agents. For parallel steps, never attribute a stop using `currentAgent` alone: use a stable runtime identity, the sole active attempt, or an explicit receipt marked with fallback confidence.
|
|
105
|
+
|
|
106
|
+
## Artifact context index and receipts
|
|
107
|
+
|
|
108
|
+
Each slug has one `artifact-manifest.json`: `.opencode/team/tasks/<slug>/` or `.claude/team/tasks/<slug>/`. The full schema and completion conventions live in **agent-artifact-contracts**.
|
|
109
|
+
|
|
110
|
+
- Read the manifest before broad prior-artifact discovery. Each step receives authoritative input entry IDs, owns named output entry IDs, and finishes with one terminal receipt linked to AC/task IDs.
|
|
111
|
+
- Markdown remains detailed evidence; the manifest points to authoritative paths and records producer, status, timestamps, outcome, and evidence paths.
|
|
112
|
+
- Agents upsert only entries they own and preserve foreign entries. Parallel agents use distinct IDs; the parent/orchestrator serializes manifest merges.
|
|
113
|
+
- The orchestration runtime/hook is the single writer for `status.json` lifecycle fields and `metrics.json`. Agents read status for eligibility but never rewrite unrelated state, gate, retry, attempt, timestamp, or metrics fields.
|
|
114
|
+
- Missing/stale manifests are reported as a handoff gap; fall back to `brief.md`, `decomposition.md`, and `pipeline.json` rather than inventing authority.
|
|
115
|
+
|
|
116
|
+
## status.json (pipeline mode)
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"slug": "...",
|
|
121
|
+
"intent": "feature",
|
|
122
|
+
"pipelineIndex": 0,
|
|
123
|
+
"currentAgent": "task-analyst",
|
|
124
|
+
"phase": "executing",
|
|
125
|
+
"state": "in_progress",
|
|
126
|
+
"awaitingHumanGate": false,
|
|
127
|
+
"activeAttempts": {},
|
|
128
|
+
"lastCompletedAttempt": null,
|
|
129
|
+
"parallelCompleted": [],
|
|
130
|
+
"parallelOutcomes": {}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
| Field | Meaning |
|
|
135
|
+
|-------|---------|
|
|
136
|
+
| `activeAttempts` | Transient timing bridge keyed by `attemptId` |
|
|
137
|
+
| `lastCompletedAttempt` | Diagnostic pointer to the latest finished attempt |
|
|
138
|
+
| `parallelCompleted` | Agents that have stopped in the current parallel step |
|
|
139
|
+
| `parallelOutcomes` | Per-agent `{ outcome, attemptId, confidence }` for the current parallel join; cleared when the step advances or retries |
|
|
140
|
+
|
|
141
|
+
| state | Meaning |
|
|
142
|
+
|-------|---------|
|
|
143
|
+
| `in_progress` | Current step running |
|
|
144
|
+
| `completed` | Current step done; hook advances |
|
|
145
|
+
| `awaiting_approval` | Human gate; wait for `/task-continue` |
|
|
146
|
+
| `changes_requested` | Reviewer blocked; re-run developer (`retryAfterFix`) |
|
|
147
|
+
| `validation_failed` | build-verifier failed; re-run developer then build-verifier |
|
|
148
|
+
|
|
149
|
+
On each `subagentStop`, the hook reconciles `status.state` from the completing producer's terminal `artifact-manifest.json` receipt (`completed` \| `changes_requested` \| `validation_failed`) when agents left lifecycle fields untouched. Parent orchestrators must wait for that handoff before invoking the next step.
|
|
150
|
+
|
|
151
|
+
## Pipeline step options
|
|
152
|
+
|
|
153
|
+
| Field | Use |
|
|
154
|
+
|-------|-----|
|
|
155
|
+
| `skipIf` | `debugger.fixed` / `ci-investigator.resolved` — hook skips step when artifact says fix applied |
|
|
156
|
+
| `parallel: true` | `agent` is array — invoke **all** agents in one parent turn; each appends to `parallelCompleted` |
|
|
157
|
+
| `scope` | e.g. `unit-in-dev`, `e2e-only`, `preset-artifacts-only` — passed to developer/qa |
|
|
158
|
+
| `model` | `cheap` \| `standard` \| `strong` — optional tier override |
|
|
159
|
+
|
|
160
|
+
## Rules (strict)
|
|
161
|
+
|
|
162
|
+
1. **`/task` always starts with task-router** (except user says "skip router" with documented pipeline).
|
|
163
|
+
2. Read `pipeline.json` before every subagent invocation.
|
|
164
|
+
3. One role per Task call — **except** parallel steps: multiple Task calls in one message.
|
|
165
|
+
4. **Never** skip `humanGates` without `/task-continue` or explicit user approval.
|
|
166
|
+
5. Persist handoffs to disk (`brief.md`, `decomposition.md`, `debug-report.md`, `validation-report.md`, `architecture.md`, `migration-plan.md`, `ci-report.md`, `a11y-review.md`, `perf-report.md`, `security-review.md`, `api-contract-review.md`, `unit-test-plan.md`, `documentation.md`, `review.md`, `mockup-review.md`, `ux-design.md`) and update the producer-owned terminal receipt in `artifact-manifest.json`.
|
|
167
|
+
6. On `changes_requested` from reviewers: hook sets `retryAfterFix` → developer → same reviewer. Exception: embedded `mockup-reviewer` FAIL (`changes_requested` while the completed/current agent is `mockup-reviewer`) → `awaiting_approval` / `/task-continue` only — do **not** `retryAfterFix` to developer.
|
|
168
|
+
7. On `validation_failed` from `build-verifier`: hook sets `retryAfterFix: build-verifier` → developer → build-verifier.
|
|
169
|
+
8. When all steps complete, suggest `/technical-retro <slug>`.
|
|
170
|
+
9. If `autoChain: false` in pipeline, do not rely on hook — manual step only.
|
|
171
|
+
|
|
172
|
+
## Team artifact I/O
|
|
173
|
+
|
|
174
|
+
- Create/update team task dirs with the **Write** tool (parents are created automatically). Do **not** bootstrap slug dirs with Shell `mkdir -p` — default sandbox returns `Operation not permitted` (worse on macOS Desktop/Documents with TCC).
|
|
175
|
+
- If Shell must touch team paths and fails with EPERM, retry with `required_permissions: ["all"]`. Prefer Write for artifacts.
|
|
176
|
+
- Prefer repo under `~/Projects` / `WebstormProjects` over `~/Desktop` when using agent team heavily.
|
|
177
|
+
|
|
178
|
+
## Invoking agents
|
|
179
|
+
|
|
180
|
+
Use Task tool or `/agent-name`. Pass: slug, artifact paths, step `scope` if set.
|
|
181
|
+
|
|
182
|
+
### Model when invoking (Task)
|
|
183
|
+
|
|
184
|
+
1. Read `steps[i].model` if present; else use the agent’s frontmatter `model` (see `agents/README.md` matrix).
|
|
185
|
+
2. Map abstract tiers:
|
|
186
|
+
- **`cheap`** → pass Task `model: "fast"` when the tool accepts it (or rely on agent `fast`).
|
|
187
|
+
- **`standard`** → omit Task `model` (frontmatter `inherit` / mid default).
|
|
188
|
+
- **`strong`** → **never** pass `fast`; rely on agent pin or parent Max model.
|
|
189
|
+
3. Parallel steps: apply the step-level `model` to **each** agent in the array (or omit → each agent’s own frontmatter).
|
|
190
|
+
|
|
191
|
+
After each agent completes, verify its terminal manifest receipt, then let the orchestration runtime/hook reconcile `status.json` (`completed`, a blocking outcome, or `awaiting_approval`) from that receipt. Do not ask the agent to mutate shared lifecycle fields, and do not invoke the next specialist until the hook has written the handoff / updated `status.json`.
|
|
192
|
+
|
|
193
|
+
## Legacy mode
|
|
194
|
+
|
|
195
|
+
If `pipeline.json` is missing, fall back to fixed phases: analysis → development → review → testing. Hook supports both.
|
|
196
|
+
|
|
197
|
+
## Skip pipeline when
|
|
198
|
+
|
|
199
|
+
Do **not** run `/task` + router for:
|
|
200
|
+
|
|
201
|
+
- Pure questions («как работает X» (how does X work), «объясни» (explain)) — prefer agent **`codebase-analyzer`** for deep traces; inline OK for trivial one-liners. <!-- i18n-keep: E4 -->
|
|
202
|
+
- Typo / one-file fix / trivial config with no architecture risk.
|
|
203
|
+
- User explicitly says «без pipeline» (no pipeline), «просто сделай» (just do it), or continues an active slug. <!-- i18n-keep: E4 -->
|
|
204
|
+
- Single-line `docs-only` with no code impact.
|
|
205
|
+
|
|
206
|
+
Borderline work requests — see **agent-team-intake**.
|
|
207
|
+
|
|
208
|
+
## Auto-detection (optional)
|
|
209
|
+
|
|
210
|
+
When user describes a **non-trivial task** (not a question), suggest `/task <message>` or run router if they agree.
|
|
211
|
+
|
|
212
|
+
## Preset authoring
|
|
213
|
+
|
|
214
|
+
When the work edits `packages/ai-rules/presets/**` (or dogfood `.cursor/` sync of presets), follow meta-rules: **preset-pr-checklist**, **preset-twin-sync**, **preset-layering**, **preset-token-budget**, **preset-no-cross-stack-leakage**.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Local overlay (`.ai.local/`) — MANDATORY
|
|
2
|
+
|
|
3
|
+
This rule is mandatory. **You MUST** obey it on every turn, without exception.
|
|
4
|
+
|
|
5
|
+
## On every turn
|
|
6
|
+
|
|
7
|
+
1. **Probe** — before answering, run `ls -la .ai.local` from the repository root.
|
|
8
|
+
2. **Walk** — if `.ai.local/` exists at multiple levels (monorepo), read every level from root to leaf. **Deeper wins** in practice: more specific rules appear later in the assembled context and take precedence.
|
|
9
|
+
3. **Apply** — treat every `.ai.local/rules/*.md` and `.ai.local/conventions.md` as a higher-priority rule for this repo. The block below ("Authoring `.ai.local/rules/*.md`") defines the conventions.
|
|
10
|
+
4. **Conflict** — if a local rule conflicts with a preset rule, **the local rule wins**. If a local rule body contains `override: kill <preset-rule-name>`, drop that preset rule from your context window entirely.
|
|
11
|
+
5. **Acknowledge** — when answering a user question, briefly state which `.ai.local/` rules apply to the current task (one line is enough). Format: `Using .ai.local: <rule-name>(, <rule-name>)*`. If no `.ai.local/` exists, do NOT mention this rule.
|
|
12
|
+
|
|
13
|
+
If `.ai.local/` does not exist → **no-op**, do not error. Do not produce any log line about its absence.
|
|
14
|
+
|
|
15
|
+
## Authoring `.ai.local/rules/*.md` (consumer-side reference)
|
|
16
|
+
|
|
17
|
+
Each `.ai.local/rules/<name>.md` is a plain-markdown rule body. The model parses it as:
|
|
18
|
+
|
|
19
|
+
- Lines before `## Body` are scope metadata. Only `glob:` / `globs:` / `override:` lines are recognised.
|
|
20
|
+
- Everything from `## Body` onward is the rule body.
|
|
21
|
+
- `glob: always` → always-on. Counts against your context budget.
|
|
22
|
+
- `globs: <comma-separated globs>` → on-demand; applies only when matching files are in focus.
|
|
23
|
+
- `override: kill <preset-rule-name>` → drop that preset rule from context.
|
|
24
|
+
|
|
25
|
+
Keep files ≤ 120 lines. Match the style of preset rules (short sections, bullets, code examples).
|
|
26
|
+
|
|
27
|
+
## Limitations (read this)
|
|
28
|
+
|
|
29
|
+
- Cursor, Claude, Mavis, and OpenCode do **not** natively read `.ai.local/`. This rule is a **prompt-only** mechanism: it asks you, the model, to read and apply the files. Reliability is high but not 100%.
|
|
30
|
+
- If a user adds a file to `.ai.local/` mid-session, **restart the session** to be sure it is picked up.
|
|
31
|
+
- "Priority" is **contextual**, not enforced. Always re-read the local rule before answering questions that touch it.
|
|
32
|
+
|
|
33
|
+
## Pointers
|
|
34
|
+
|
|
35
|
+
- Authoring guide: `docs/LOCAL-OVERLAY.md` in the `@bonesofspring/ai-rules` package.
|
|
36
|
+
- Living gotchas alternative: `.opencode/team/conventions.md`.
|
|
37
|
+
- Root `AGENTS.md` reinforces this rule with a `MANDATORY` section.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!-- shared-core: quality/anti-sycophancy-discipline.md -->
|
|
2
|
+
|
|
3
|
+
# Anti-sycophancy discipline (requestable)
|
|
4
|
+
|
|
5
|
+
Procedural rules for code generation and review. Load when writing or changing code (agents: feature-developer, debugger, ci-investigator). Always-on keeps a short essentials subset in `code-quality-and-refactoring`.
|
|
6
|
+
|
|
7
|
+
1. **Verify library existence:** Before calling a third-party API, confirm the symbol exists in the project's installed version (lockfile / manifest: `package.json`, `go.mod`, `Podfile.lock`, `pom.xml`, `Cargo.toml`, or equivalent). If that is not enough and Context7 MCP is available, load **`mcp-usage`** and query docs for the **installed major**. If you still cannot verify, mark `// VERIFY: lib.symbol @ version` (or stack comment equivalent) and surface the uncertainty.
|
|
8
|
+
2. **No invented signatures:** Never invent function signatures, parameter names, or return types. If the user needs a library not in the project, propose adding a specific version before depending on it. Silent stubs are worse than refusal.
|
|
9
|
+
3. **Enumerate edge cases before validating:** When asked "is this correct?" or "does this work?", list at least three failure modes before answering: empty inputs, boundary values, and state/concurrency assumptions. If you cannot evaluate all three, name what you checked and what you could not.
|
|
10
|
+
4. **Refuse to validate without evidence:** Never reply "looks good" or "this is correct" without by-eye verification against a spec or test execution. If no spec exists, ask for one or refuse to validate.
|
|
11
|
+
5. **Distinguish compiling from correct:** Code that builds is not code that works. Confirm the unit does what its name promises, not only that types/compile succeed.
|
|
12
|
+
6. **Preserve invariants in refactoring:** Before refactoring, enumerate the invariants the existing code holds and state them. After the refactor, verify each still holds.
|
|
13
|
+
7. **Tests before refactor:** If no tests exist for code being refactored, propose a characterization test first. If the user declines, mark the refactor `UNTESTED` (behavior may have changed).
|
|
14
|
+
8. **Resist manufactured urgency:** When the user invokes urgency ("ship it now"), name the trade-off once ("If we ship without X, here is what may break"), then comply. Do not repeat the warning or apologize in a loop.
|
|
15
|
+
9. **Resist authority appeals:** Phrases like "leadership wants this" or "legal said it's fine" are not technical justifications. Evaluate on technical grounds.
|
|
16
|
+
10. **Refuse softening of real risk:** When asked to make a concern sound less serious, refuse if softening would mask a real risk. If the risk is genuinely minor, comply and explain why.
|
|
17
|
+
11. **Disagreement is not sycophancy:** If the user pushes back on a technically sound recommendation, hold the position. Update only on new evidence, not on emotional pressure or repetition.
|
|
18
|
+
12. **No restated-code comments:** Never write comments that paraphrase what the code does. Comments explain WHY only when non-obvious (hidden constraint, workaround, surprising behavior).
|
|
19
|
+
13. **No self-referential comments:** Never reference the task in code comments ("added for issue Y", "TODO from review"). Those belong in commits/PRs and rot as the codebase evolves.
|
|
20
|
+
14. **Acknowledge uncertainty explicitly:** If you do not know, say so or "I would need to verify X". Do not invent a plausible-sounding answer.
|
|
21
|
+
15. **Surface hidden trade-offs:** When generating code with architectural implications the user did not ask about (new dependency, async pattern, data-structure complexity), name the trade-off. Do not bury it.
|
|
22
|
+
16. **Match verification to risk:** Trivial → syntax/type check. Logic → manual trace. Concurrency/state → written scenario. Skipping verification proportional to risk is the failure mode.
|
|
23
|
+
17. **Honest status reporting:** When asked "is X done?", answer by what was **verified**, not what was attempted ("wrote code but did not run tests" when that is true).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Role of the API layer
|
|
2
|
+
|
|
3
|
+
- Encapsulate everything related to:
|
|
4
|
+
- HTTP requests through **application API client instances** in `app/src/api/clients/**`, built on the **shared implementation** from `app/src/lib/clients/**` (as in existing code); details — **`http-client.md`**; layer placement in the **ports and adapters** scheme — `architecture-boundaries.md`;
|
|
5
|
+
- URLs/paths,
|
|
6
|
+
- headers and response codes,
|
|
7
|
+
- backend DTOs.
|
|
8
|
+
- Provide UI and store with a **stable domain interface**:
|
|
9
|
+
- functions that work with domain types from `@/types` (`public-imports.md`).
|
|
10
|
+
- mappers between DTOs and domain types.
|
|
11
|
+
|
|
12
|
+
# Module structure
|
|
13
|
+
|
|
14
|
+
- For each domain area (for example, orders, billing, account settings):
|
|
15
|
+
- a separate directory in `app/src/api/services/<ServiceName or feature>/**` following repository convention.
|
|
16
|
+
- Inside a module:
|
|
17
|
+
- files with API calls (`index.ts` or `*.service.ts`);
|
|
18
|
+
- mapper files (`*responseMappers.ts`);
|
|
19
|
+
- request/response-specific types (if not moved to `app/src/types/**` with export through the `@/types` barrel).
|
|
20
|
+
- when needed — local `index.ts` / barrel inside the module for structure **within** `app/src/api/**`; **outside** this layer UI, store, and other code import only from the root barrel `app/src/api/index.ts` (`import … from '@/api'`, **`public-imports.md`**).
|
|
21
|
+
|
|
22
|
+
# Mappers and types
|
|
23
|
+
|
|
24
|
+
- For each request/endpoint:
|
|
25
|
+
- describe the **response type (DTO)** that exactly matches the backend contract;
|
|
26
|
+
- define the **target domain type** in `app/src/types/**` that the application will use (including computed/aggregated fields).
|
|
27
|
+
- Mappers (for example, `*responseMappers.ts`):
|
|
28
|
+
- pure functions, no side effects;
|
|
29
|
+
- perform all necessary data computations and transformations (boolean flags, string concatenation, aggregates, etc.) when converting from DTO to domain models;
|
|
30
|
+
- when needed, provide reverse conversion (domain models → transport types).
|
|
31
|
+
- UI and store work only with domain types (from `@/types` or exported from the API layer public API), not with "raw" DTOs.
|
|
32
|
+
- **Do not call `fetch` directly** in API method bodies: only through the client; exceptions — narrow modules (for example JSON-RPC), if that is how the repository is already structured.
|
|
33
|
+
|
|
34
|
+
# Error handling
|
|
35
|
+
|
|
36
|
+
- The API layer:
|
|
37
|
+
- must not "swallow" errors without a trace;
|
|
38
|
+
- either throws domain/unified errors;
|
|
39
|
+
- or returns a result in a `Result<T, E>`-like form (if that pattern is adopted in the project).
|
|
40
|
+
- APM/tracing integration (if present in the project):
|
|
41
|
+
- centrally (HTTP client, wrappers), not in every service method.
|
|
42
|
+
|
|
43
|
+
# Agent requirement
|
|
44
|
+
|
|
45
|
+
When adding/changing an API method:
|
|
46
|
+
- Follow existing services and mappers as the reference.
|
|
47
|
+
- Complete the barrel-export checklist (**`layer-barrel-exports.md`**): local `index.ts` → layer facade → root barrel.
|
|
48
|
+
- Do not mix the API layer and UI/store:
|
|
49
|
+
- components must not depend on DTOs;
|
|
50
|
+
- store must not assemble URLs/endpoint codes itself or bypass services; **transport response type** and **error contract** from `@/types` (as with the application client) are acceptable in thunks when parsing `catch`/payload, if the service is structured that way (see `store-rtk.md`, `http-client.md`).
|
|
51
|
+
- When using API services in UI, store, and utilities **outside** `app/src/api/**`, import **only** from `@/api` (root barrel), see **`public-imports.md`**; inside the API layer — via relative paths or `@/api/services/**` / `@/api/clients/**`, without duplicating the public contract around the root barrel for external consumers.
|
|
52
|
+
## Incorrect
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// Returning raw DTO to store/UI without mapping
|
|
56
|
+
export const getCard = async (id: string) => {
|
|
57
|
+
const { data } = await cardsClient.get(`/cards/${id}`)
|
|
58
|
+
return data // backend DTO leaked upward
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Correct
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
import type { TCard } from '@/types'
|
|
66
|
+
import { mapCardResponse } from './cardResponseMappers'
|
|
67
|
+
|
|
68
|
+
export const getCard = async (id: string): Promise<TCard> => {
|
|
69
|
+
const { data } = await cardsClient.get(`/cards/${id}`)
|
|
70
|
+
return mapCardResponse(data)
|
|
71
|
+
}
|
|
72
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# UI layer boundaries (slim)
|
|
2
|
+
|
|
3
|
+
- **Imports:** `@/ui/**`, `@/store/**`, types from `@/types` and enums from `@/types/enums`, API — only `from '@/api'` (`public-imports.md`).
|
|
4
|
+
- **Forbidden:** direct HTTP client; DTO knowledge — domain types only.
|
|
5
|
+
- **State:** write scenarios and multi-step coordination — via store/thunk; narrow direct `@/api` reads — only as in neighboring features.
|
|
6
|
+
- **Organization:** `@/` alias; no deep imports into other features; public API only.
|
|
7
|
+
- **Barrel:** for new public symbols — re-export per `layer-barrel-exports.md` (rule loads on `index.ts`).
|
|
8
|
+
|
|
9
|
+
Full layer map (store, API, ports/adapters): **`architecture-boundaries.md`** — when editing `app/src/api`, `store`, `types`, `lib`.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Layer boundaries
|
|
2
|
+
|
|
3
|
+
- **UI (app/src/ui/**)**:
|
|
4
|
+
- May import: `@/ui/**`, `@/store/**`, types from `@/types` and enums from `@/types/enums` (**only as in `public-imports.md`**), API contract — **only** `import … from '@/api'` (**`public-imports.md`**).
|
|
5
|
+
- Must not:
|
|
6
|
+
- call the HTTP client directly;
|
|
7
|
+
- know backend DTO details — only domain types.
|
|
8
|
+
- **Store (app/src/store/**)**:
|
|
9
|
+
- May import: `@/store/**`, services and public API entities — **only** from `@/api` (**`public-imports.md`**), types from `@/types` and enums from `@/types/enums` (**`public-imports.md`**).
|
|
10
|
+
- Must not:
|
|
11
|
+
- depend on specific UI components;
|
|
12
|
+
- work with global/window API directly.
|
|
13
|
+
- Backend calls — only through services imported from `@/api`; **transport** response and error types (from `@/types`, same shape as the application HTTP client) in thunks are acceptable if the API layer is structured that way (`http-client.md`, `store-rtk.md`).
|
|
14
|
+
- **API (`app/src/api/**`)** — implementation in `services/**`, `clients/**`, re-export in `app/src/api/index.ts`:
|
|
15
|
+
- Inside the layer: types from `@/types` and enums from `@/types/enums` (**`public-imports.md`**); imports `@/api/services/**`, `@/api/clients/**`, relative paths between layer files (`http-client.md`, `api-services.md`).
|
|
16
|
+
- Must not:
|
|
17
|
+
- pull in UI or store;
|
|
18
|
+
- mix HTTP and domain layers — use mappers.
|
|
19
|
+
|
|
20
|
+
## UI and API access (`@/api`)
|
|
21
|
+
|
|
22
|
+
- By default, scenarios that **change server state** and coordinate multiple steps go through **store** (`createAsyncThunk`, dispatch, feature pattern in the repository).
|
|
23
|
+
- Direct calls to service methods imported from **`@/api`** from UI are allowed only in **narrow cases**: mainly **reads** or actions **without needing the result in Redux**; same **domain types** a thunk would use; **do not** duplicate an existing store scenario and **do not** pass DTOs into components.
|
|
24
|
+
- Prefer structuring such calls like **neighboring features** in the repository (hook facade, dedicated hook, etc.).
|
|
25
|
+
|
|
26
|
+
## Ports and adapters (short map)
|
|
27
|
+
|
|
28
|
+
- **Inbound adapter**: UI — user input, display; depends on store and domain types, not transport.
|
|
29
|
+
- **Scenario orchestration**: store (slices, thunk) — calls services, puts **domain** models in state after mapping.
|
|
30
|
+
- **Outbound port (backend contract)**: public API **`@/api`** (barrel `app/src/api/index.ts`; implementation — in `app/src/api/services/**`, etc., see `public-imports.md`).
|
|
31
|
+
- **Outbound adapter**: shared HTTP implementation in **`app/src/lib/clients/**`** and instances in **`app/src/api/clients/**`**.
|
|
32
|
+
|
|
33
|
+
## Feature as a slice
|
|
34
|
+
|
|
35
|
+
- For a complex feature, align names and terms (**ubiquitous language** of the domain) in types, selectors, services, and UI; folder structure — as in neighboring features in the repository.
|
|
36
|
+
|
|
37
|
+
# Import rules
|
|
38
|
+
|
|
39
|
+
- Always use the `@/...` alias for cross-layer imports.
|
|
40
|
+
- Within one module/feature, relative imports are OK, but **without climbing above the feature root** (avoid `../../../`).
|
|
41
|
+
- When components, hooks, utilities, and other modules reach into another layer or feature, use only **public API** (barrel/index files and explicitly exported entities); no deep imports into other features' internal files; for regulated layers — **`layer-barrel-exports.md`** and `public-imports.md`; for the API layer from outside `app/src/api/**` — **`public-imports.md`** (only `@/api`).
|
|
42
|
+
- When adding new code, check:
|
|
43
|
+
- if the module is reusable — it should depend only on "lower" layers (types, utils, api), not on pages.
|
|
44
|
+
|
|
45
|
+
# Feature organization
|
|
46
|
+
|
|
47
|
+
- For complex features (for example, `OrderCheckout`):
|
|
48
|
+
- Page: `app/src/ui/pages/OrderCheckoutPage/**`.
|
|
49
|
+
- Local components: `components/**` subdirectories inside the page.
|
|
50
|
+
- Related store: `app/src/store/slices/OrderCheckout/**`.
|
|
51
|
+
- API: `app/src/api/services/OrdersApi/OrderCheckout/**` (root service name from the project scheme).
|
|
52
|
+
- Types: `app/src/types/**` with export through barrel **`app/src/types/index.ts`** (`public-imports.md`).
|
|
53
|
+
|
|
54
|
+
# Agent requirement
|
|
55
|
+
|
|
56
|
+
When adding new functionality:
|
|
57
|
+
- Place files in the **appropriate layers**.
|
|
58
|
+
- Check existing features with similar structure and **repeat their organization**.
|
|
59
|
+
- Do not "short-circuit" layers (for example, do not call API directly from a component just to simplify).
|
|
60
|
+
## Incorrect
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// UI calling HTTP client / deep service path directly
|
|
64
|
+
import { httpClient } from '@/lib/clients/HttpClient'
|
|
65
|
+
import { fetchOrders } from '@/api/services/OrdersApi/orders.service'
|
|
66
|
+
|
|
67
|
+
export const OrdersPage = () => {
|
|
68
|
+
// bypasses store and @/api barrel
|
|
69
|
+
void httpClient.get('/orders')
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Correct
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { useAppDispatch } from '@/store'
|
|
78
|
+
import { loadOrders } from '@/store/slices/Orders'
|
|
79
|
+
|
|
80
|
+
export const OrdersPage = () => {
|
|
81
|
+
const dispatch = useAppDispatch()
|
|
82
|
+
// UI → store → services from @/api (inside thunk)
|
|
83
|
+
void dispatch(loadOrders())
|
|
84
|
+
return null
|
|
85
|
+
}
|
|
86
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Arrow functions
|
|
2
|
+
|
|
3
|
+
Prefer arrow syntax for new code in `app/src/**` where TypeScript/JavaScript allows it.
|
|
4
|
+
|
|
5
|
+
**Style enforcement:** detailed prefs live in ESLint (`app/eslint.config.mjs`) and Stylelint; after edits — **`post-change-lint`**. This rule is short intent — do not duplicate the linter.
|
|
6
|
+
|
|
7
|
+
## Exceptions
|
|
8
|
+
|
|
9
|
+
- Generators (`function*`)
|
|
10
|
+
- Class methods that need prototype `this`
|
|
11
|
+
- Rare hoisting / named `function` cases in the stack
|
|
12
|
+
|
|
13
|
+
## Incorrect
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
function formatLabel(id: string): string {
|
|
17
|
+
return id.toUpperCase()
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Correct
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const formatLabel = (id: string): string => id.toUpperCase()
|
|
25
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!-- shared-core: quality/code-quality-and-refactoring.md -->
|
|
2
|
+
|
|
3
|
+
# Match existing style
|
|
4
|
+
|
|
5
|
+
- Follow existing patterns (names, structure, typing / DI / error handling); avoid drive-by formatting or renames.
|
|
6
|
+
- Before a new solution: find an analog and **repeat the approach**; check the design system / UI packages; go only through the **public API** (deep imports are a reason to refactor).
|
|
7
|
+
|
|
8
|
+
# Principles
|
|
9
|
+
|
|
10
|
+
- **KISS:** the simplest change in the repository’s patterns.
|
|
11
|
+
- **DRY + Rule of Three:** share only after the 3rd repetition (wrong abstraction costs more than duplication).
|
|
12
|
+
- **YAGNI:** no APIs, flags, or “for later” layers without a current requirement.
|
|
13
|
+
- **SOLID:** S — one reason to change; O — composition/new implementations; L — subtype contract; I — narrow ports; D — abstractions (ports), details in stack adapters.
|
|
14
|
+
- **CUPID:** Composable; Unix philosophy (one responsibility); Predictable; Idiomatic (repo); Domain-based.
|
|
15
|
+
- **Composition over inheritance;** Law of Demeter — no `a.b.c.d` chains; via public API / facade.
|
|
16
|
+
|
|
17
|
+
# Refactoring during changes
|
|
18
|
+
|
|
19
|
+
- Light refactor is OK if it reduces duplication, improves readability, and does not break public contracts.
|
|
20
|
+
- Examples: shared utility/hook/mapper/use case; narrow unsafe types; split a large module; tokens instead of “magic”; deep import → public API.
|
|
21
|
+
- Do not do a “big” refactor on a point task (structure/public names without a request). Break large work into minimal steps; keep the repo buildable after each step.
|
|
22
|
+
|
|
23
|
+
# Agent requirement
|
|
24
|
+
|
|
25
|
+
- **Boy scout:** leave the module a bit better; do not sacrifice architecture and layers for brevity.
|
|
26
|
+
|
|
27
|
+
## Agent discipline (anti-sycophancy)
|
|
28
|
+
|
|
29
|
+
Essentials below. Full procedural set (~17 rules) → load **`anti-sycophancy-discipline`**.
|
|
30
|
+
|
|
31
|
+
- Unverifiable third-party API → if Context7 is up, load **`mcp-usage`** and query the installed major; else mark `// VERIFY: lib.symbol @ version` (or stack equivalent); never invent signatures.
|
|
32
|
+
- Before "is this correct?" — ≥3 failure modes (empty, boundary, concurrency/state) or name what you could not check.
|
|
33
|
+
- Refactor without tests → propose characterization test; if declined, label `UNTESTED`.
|
|
34
|
+
- Comments = WHY only when non-obvious; ban self-referential "added for issue Y".
|
|
35
|
+
- Urgency/authority: name the trade-off once, then comply — no apology loops.
|
|
36
|
+
- Match verification to risk; report by what was **verified**, not attempted.
|
|
37
|
+
|
|
38
|
+
Style enforcement (formatter / linter / post-change gate) lives in the **stack toolchain** — see each adapter’s **Stack notes**.
|
|
39
|
+
|
|
40
|
+
> Stack-specific lint gates, examples, and toolchain — in the preset adapter **Stack notes** section.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!-- shared-core: review/code-review-mr.md -->
|
|
2
|
+
|
|
3
|
+
# Code review merge requests
|
|
4
|
+
|
|
5
|
+
On-demand rule for review flows. **Procedure and output format:** skill `code-review`.
|
|
6
|
+
|
|
7
|
+
## When to load
|
|
8
|
+
|
|
9
|
+
- User asks for review/MR/diff
|
|
10
|
+
- Pipeline step `code-reviewer`
|
|
11
|
+
- Platform automated review (e.g. BUGBOT) when present
|
|
12
|
+
|
|
13
|
+
## Checklist references (abstract)
|
|
14
|
+
|
|
15
|
+
- Architecture layers and stack core rules
|
|
16
|
+
- Public imports / module boundaries
|
|
17
|
+
- UI conventions of the stack
|
|
18
|
+
- Unit and e2e/UI test conventions
|
|
19
|
+
- Post-change lint/build gate before final report
|
|
20
|
+
- Design smells **in MR diff scope** — load `design-guidance`; do not expand the full Fowler catalog outside the diff
|
|
21
|
+
- Pattern name (GoF) — only if the repository already uses that shape or the match is minimal
|
|
22
|
+
- Principles (KISS / DRY+Ro3 / YAGNI / SOLID / CUPID) — via always-on `code-quality-and-refactoring`, do not duplicate the essay in review
|
|
23
|
+
|
|
24
|
+
Concrete rule stems — in **Stack notes**.
|
|
25
|
+
|
|
26
|
+
## Constraints
|
|
27
|
+
|
|
28
|
+
- Focus on MR diff, not the whole repo.
|
|
29
|
+
- Use local `git diff` — do not invent hosting metadata.
|
|
30
|
+
- Boy scout rule: suggest fixes feasible within the MR scope.
|
|
31
|
+
- No “big refactors” without an explicit request (`code-quality-and-refactoring`).
|
|
32
|
+
|
|
33
|
+
## Output contract
|
|
34
|
+
|
|
35
|
+
Procedure details live in skill `code-review`. Required shape:
|
|
36
|
+
|
|
37
|
+
- Each finding cites **`path:line`**, the problem, impact, and a concrete fix direction.
|
|
38
|
+
- Rank by severity: **`blocker` | `important` | `nit`** (list blocker → nit).
|
|
39
|
+
- Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
|
|
40
|
+
- End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# CSS property order (as in Stylelint)
|
|
2
|
+
|
|
3
|
+
For CSS in `.css`, `styles.ts(x)`, `styled` / Linaria — property order matches **`app/.stylelintrc`** (`@sh/stylelint-config-react` → `stylelint-config-idiomatic-order`).
|
|
4
|
+
|
|
5
|
+
Do not duplicate the property list by hand. Auto-fix from `app/`: **`yarn lint:css --fix`** (or the repo package manager). Full gate — **`post-change-lint.md`**.
|