@bonesofspring/ai-rules 0.2.9 → 0.2.11

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.
Files changed (192) hide show
  1. package/CHANGELOG.md +21 -3
  2. package/README.md +3 -1
  3. package/bin/cli.js +2 -0
  4. package/package.json +1 -1
  5. package/presets/_shared/core/meta/preset-no-cross-stack-leakage.md +15 -2
  6. package/presets/_shared/core/meta/preset-token-budget.md +1 -1
  7. package/presets/_shared/core/meta/preset-twin-sync.md +2 -0
  8. package/presets/claude/go/rules/api-and-data/persistence-adapters.md +10 -7
  9. package/presets/claude/go/rules/architecture/application-usecases.md +9 -5
  10. package/presets/claude/go/rules/architecture/boundaries.md +6 -1
  11. package/presets/claude/go/rules/architecture/composition-root.md +14 -9
  12. package/presets/claude/go/rules/testing/e2e.md +8 -6
  13. package/presets/claude/go/rules/testing/integration.md +11 -5
  14. package/presets/claude/go/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
  15. package/presets/claude/go/rules/tooling-and-review/preset-token-budget.md +1 -1
  16. package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +2 -0
  17. package/presets/claude/go/rules/tooling-and-review/security-go.md +17 -5
  18. package/presets/claude/ios-swift/README.md +1 -1
  19. package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
  20. package/presets/claude/ios-swift/rules/README.md +1 -1
  21. package/presets/claude/ios-swift/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
  22. package/presets/claude/ios-swift/rules/tooling-and-review/preset-token-budget.md +1 -1
  23. package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +2 -0
  24. package/presets/claude/java/agents/build-verifier.md +1 -1
  25. package/presets/claude/java/rules/README.md +1 -1
  26. package/presets/claude/java/rules/api-and-data/messaging-adapters.md +16 -9
  27. package/presets/claude/java/rules/architecture/boundaries.md +6 -1
  28. package/presets/claude/java/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
  29. package/presets/claude/java/rules/tooling-and-review/preset-token-budget.md +1 -1
  30. package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +2 -0
  31. package/presets/claude/mcp-ts/CLAUDE.md +13 -0
  32. package/presets/claude/mcp-ts/MCP.md +37 -0
  33. package/presets/claude/mcp-ts/README.md +11 -0
  34. package/presets/claude/mcp-ts/REPO_AGENTS.md +49 -0
  35. package/presets/claude/mcp-ts/agents/README.md +21 -0
  36. package/presets/claude/mcp-ts/agents/build-verifier.md +39 -0
  37. package/presets/claude/mcp-ts/agents/feature-developer.md +47 -0
  38. package/presets/claude/mcp-ts/agents/security-reviewer.md +21 -0
  39. package/presets/claude/mcp-ts/agents/solution-architect.md +23 -0
  40. package/presets/claude/mcp-ts/agents/task-analyst.md +25 -0
  41. package/presets/claude/mcp-ts/agents/task-router.md +73 -0
  42. package/presets/claude/mcp-ts/commands/README.md +11 -0
  43. package/presets/claude/mcp-ts/commands/feature-continue.md +19 -0
  44. package/presets/claude/mcp-ts/commands/feature-start.md +33 -0
  45. package/presets/claude/mcp-ts/commands/task-continue.md +49 -0
  46. package/presets/claude/mcp-ts/commands/task.md +49 -0
  47. package/presets/claude/mcp-ts/commands/technical-retro.md +81 -0
  48. package/presets/claude/mcp-ts/hooks/README.md +12 -0
  49. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +346 -0
  50. package/presets/claude/mcp-ts/hooks/examples/README.md +11 -0
  51. package/presets/claude/mcp-ts/hooks/examples/format-edited.example.sh +16 -0
  52. package/presets/claude/mcp-ts/hooks/examples/secret-guard.example.sh +10 -0
  53. package/presets/claude/mcp-ts/hooks/examples/test-on-save.example.sh +25 -0
  54. package/presets/claude/mcp-ts/hooks/guard-shell-command.sh +79 -0
  55. package/presets/claude/mcp-ts/mcp.json +11 -0
  56. package/presets/claude/mcp-ts/rules/README.md +52 -0
  57. package/presets/claude/mcp-ts/rules/api-and-data/README.md +3 -0
  58. package/presets/claude/mcp-ts/rules/api-and-data/mcp-auth-secrets.md +44 -0
  59. package/presets/claude/mcp-ts/rules/api-and-data/mcp-contract-testing.md +42 -0
  60. package/presets/claude/mcp-ts/rules/api-and-data/mcp-tool-design.md +37 -0
  61. package/presets/claude/mcp-ts/rules/api-and-data/mcp-transport-packaging.md +43 -0
  62. package/presets/claude/mcp-ts/rules/architecture/README.md +3 -0
  63. package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +45 -0
  64. package/presets/claude/mcp-ts/rules/architecture/mcp-server-boundaries.md +28 -0
  65. package/presets/claude/mcp-ts/rules/architecture/reference-features.md +33 -0
  66. package/presets/claude/mcp-ts/rules/stack/README.md +3 -0
  67. package/presets/claude/mcp-ts/rules/stack/mcp-ts-app-core.md +27 -0
  68. package/presets/claude/mcp-ts/rules/stack/mcp-ts-conventions.md +29 -0
  69. package/presets/claude/mcp-ts/rules/testing/README.md +3 -0
  70. package/presets/claude/mcp-ts/rules/testing/unit.md +30 -0
  71. package/presets/claude/mcp-ts/rules/tooling-and-review/README.md +3 -0
  72. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +23 -0
  73. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +161 -0
  74. package/presets/claude/mcp-ts/rules/tooling-and-review/anti-sycophancy-discipline.md +34 -0
  75. package/presets/claude/mcp-ts/rules/tooling-and-review/code-quality.md +52 -0
  76. package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +51 -0
  77. package/presets/claude/mcp-ts/rules/tooling-and-review/design-guidance.md +109 -0
  78. package/presets/claude/mcp-ts/rules/tooling-and-review/mcp-ts-tooling.md +31 -0
  79. package/presets/claude/mcp-ts/rules/tooling-and-review/post-change-test.md +30 -0
  80. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-layering.md +36 -0
  81. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-no-cross-stack-leakage.md +69 -0
  82. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +39 -0
  83. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-token-budget.md +41 -0
  84. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +46 -0
  85. package/presets/claude/mcp-ts/rules/tooling-and-review/security-mcp.md +52 -0
  86. package/presets/claude/mcp-ts/rules/tooling-and-review/technical-retro.md +20 -0
  87. package/presets/claude/mcp-ts/rules/ui-and-accessibility/README.md +3 -0
  88. package/presets/claude/mcp-ts/skills/README.md +12 -0
  89. package/presets/claude/mcp-ts/skills/code-review/SKILL.md +10 -0
  90. package/presets/claude/mcp-ts/skills/debug-investigation/SKILL.md +11 -0
  91. package/presets/claude/mcp-ts/skills/feature-delivery/SKILL.md +29 -0
  92. package/presets/claude/mcp-ts/skills/unit-testing/SKILL.md +16 -0
  93. package/presets/claude/mcp-ts/team/README.md +17 -0
  94. package/presets/claude/mcp-ts/team/conventions.md +14 -0
  95. package/presets/claude/mcp-ts/team/fixtures/bugfix-standard.json +32 -0
  96. package/presets/claude/mcp-ts/team/fixtures/feature-full.json +33 -0
  97. package/presets/claude/mcp-ts/team/fixtures/feature-light.json +34 -0
  98. package/presets/claude/next/agents/build-verifier.md +1 -1
  99. package/presets/claude/next/rules/tooling-and-review/preset-no-cross-stack-leakage.md +15 -2
  100. package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +1 -1
  101. package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +2 -0
  102. package/presets/cursor/go/rules/README.md +8 -8
  103. package/presets/cursor/go/rules/application-usecases.mdc +9 -5
  104. package/presets/cursor/go/rules/architecture-boundaries.mdc +6 -0
  105. package/presets/cursor/go/rules/composition-root.mdc +14 -9
  106. package/presets/cursor/go/rules/persistence-adapters.mdc +10 -7
  107. package/presets/cursor/go/rules/preset-no-cross-stack-leakage.mdc +15 -2
  108. package/presets/cursor/go/rules/preset-token-budget.mdc +1 -1
  109. package/presets/cursor/go/rules/preset-twin-sync.mdc +2 -0
  110. package/presets/cursor/go/rules/security-go.mdc +17 -5
  111. package/presets/cursor/go/rules/tests-e2e.mdc +8 -6
  112. package/presets/cursor/go/rules/tests-integration.mdc +11 -5
  113. package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
  114. package/presets/cursor/ios-swift/rules/README.md +1 -1
  115. package/presets/cursor/ios-swift/rules/preset-no-cross-stack-leakage.mdc +15 -2
  116. package/presets/cursor/ios-swift/rules/preset-token-budget.mdc +1 -1
  117. package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +2 -0
  118. package/presets/cursor/java/README.md +1 -1
  119. package/presets/cursor/java/agents/build-verifier.md +1 -1
  120. package/presets/cursor/java/rules/README.md +4 -4
  121. package/presets/cursor/java/rules/architecture-boundaries.mdc +6 -0
  122. package/presets/cursor/java/rules/messaging-adapters.mdc +16 -10
  123. package/presets/cursor/java/rules/preset-no-cross-stack-leakage.mdc +15 -2
  124. package/presets/cursor/java/rules/preset-token-budget.mdc +1 -1
  125. package/presets/cursor/java/rules/preset-twin-sync.mdc +2 -0
  126. package/presets/cursor/mcp-ts/AGENTS.md +25 -0
  127. package/presets/cursor/mcp-ts/BUGBOT.md +9 -0
  128. package/presets/cursor/mcp-ts/MCP.md +37 -0
  129. package/presets/cursor/mcp-ts/README.md +19 -0
  130. package/presets/cursor/mcp-ts/REPO_AGENTS.md +49 -0
  131. package/presets/cursor/mcp-ts/agents/README.md +21 -0
  132. package/presets/cursor/mcp-ts/agents/build-verifier.md +39 -0
  133. package/presets/cursor/mcp-ts/agents/feature-developer.md +47 -0
  134. package/presets/cursor/mcp-ts/agents/security-reviewer.md +21 -0
  135. package/presets/cursor/mcp-ts/agents/solution-architect.md +23 -0
  136. package/presets/cursor/mcp-ts/agents/task-analyst.md +25 -0
  137. package/presets/cursor/mcp-ts/agents/task-router.md +73 -0
  138. package/presets/cursor/mcp-ts/commands/README.md +11 -0
  139. package/presets/cursor/mcp-ts/commands/feature-continue.md +19 -0
  140. package/presets/cursor/mcp-ts/commands/feature-start.md +33 -0
  141. package/presets/cursor/mcp-ts/commands/task-continue.md +49 -0
  142. package/presets/cursor/mcp-ts/commands/task.md +49 -0
  143. package/presets/cursor/mcp-ts/commands/technical-retro.md +81 -0
  144. package/presets/cursor/mcp-ts/hooks/README.md +12 -0
  145. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +346 -0
  146. package/presets/cursor/mcp-ts/hooks/examples/README.md +11 -0
  147. package/presets/cursor/mcp-ts/hooks/examples/format-edited.example.sh +16 -0
  148. package/presets/cursor/mcp-ts/hooks/examples/secret-guard.example.sh +10 -0
  149. package/presets/cursor/mcp-ts/hooks/examples/test-on-save.example.sh +25 -0
  150. package/presets/cursor/mcp-ts/hooks/guard-shell-command.sh +79 -0
  151. package/presets/cursor/mcp-ts/hooks.json +17 -0
  152. package/presets/cursor/mcp-ts/mcp.json +11 -0
  153. package/presets/cursor/mcp-ts/rules/README.md +52 -0
  154. package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +21 -0
  155. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +159 -0
  156. package/presets/cursor/mcp-ts/rules/anti-sycophancy-discipline.mdc +35 -0
  157. package/presets/cursor/mcp-ts/rules/code-quality-and-refactoring.mdc +53 -0
  158. package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +50 -0
  159. package/presets/cursor/mcp-ts/rules/design-guidance.mdc +108 -0
  160. package/presets/cursor/mcp-ts/rules/feature-delivery-workflow.mdc +43 -0
  161. package/presets/cursor/mcp-ts/rules/mcp-auth-secrets.mdc +45 -0
  162. package/presets/cursor/mcp-ts/rules/mcp-contract-testing.mdc +43 -0
  163. package/presets/cursor/mcp-ts/rules/mcp-server-boundaries.mdc +29 -0
  164. package/presets/cursor/mcp-ts/rules/mcp-tool-design.mdc +38 -0
  165. package/presets/cursor/mcp-ts/rules/mcp-transport-packaging.mdc +44 -0
  166. package/presets/cursor/mcp-ts/rules/mcp-ts-app-core.mdc +28 -0
  167. package/presets/cursor/mcp-ts/rules/mcp-ts-conventions.mdc +30 -0
  168. package/presets/cursor/mcp-ts/rules/mcp-ts-tooling.mdc +32 -0
  169. package/presets/cursor/mcp-ts/rules/post-change-test.mdc +26 -0
  170. package/presets/cursor/mcp-ts/rules/preset-layering.mdc +36 -0
  171. package/presets/cursor/mcp-ts/rules/preset-no-cross-stack-leakage.mdc +69 -0
  172. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +39 -0
  173. package/presets/cursor/mcp-ts/rules/preset-token-budget.mdc +41 -0
  174. package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +46 -0
  175. package/presets/cursor/mcp-ts/rules/reference-features.mdc +34 -0
  176. package/presets/cursor/mcp-ts/rules/security-mcp.mdc +53 -0
  177. package/presets/cursor/mcp-ts/rules/technical-retro.mdc +18 -0
  178. package/presets/cursor/mcp-ts/rules/tests-unit.mdc +31 -0
  179. package/presets/cursor/mcp-ts/skills/README.md +12 -0
  180. package/presets/cursor/mcp-ts/skills/code-review/SKILL.md +10 -0
  181. package/presets/cursor/mcp-ts/skills/debug-investigation/SKILL.md +11 -0
  182. package/presets/cursor/mcp-ts/skills/feature-delivery/SKILL.md +29 -0
  183. package/presets/cursor/mcp-ts/skills/unit-testing/SKILL.md +16 -0
  184. package/presets/cursor/mcp-ts/team/README.md +17 -0
  185. package/presets/cursor/mcp-ts/team/conventions.md +14 -0
  186. package/presets/cursor/mcp-ts/team/fixtures/bugfix-standard.json +32 -0
  187. package/presets/cursor/mcp-ts/team/fixtures/feature-full.json +33 -0
  188. package/presets/cursor/mcp-ts/team/fixtures/feature-light.json +34 -0
  189. package/presets/cursor/next/agents/build-verifier.md +1 -1
  190. package/presets/cursor/next/rules/preset-no-cross-stack-leakage.mdc +15 -2
  191. package/presets/cursor/next/rules/preset-token-budget.mdc +1 -1
  192. package/presets/cursor/next/rules/preset-twin-sync.mdc +2 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### MCP TypeScript preset (`mcp-ts`)
6
+
7
+ - New installable preset **`mcp-ts`** (Cursor + Claude twins): TypeScript MCP server authoring with `@modelcontextprotocol/sdk`, stdio-first transport, Context7-only MCP, package-manager–discovered typecheck/test via `mcp-ts-tooling` / `post-change-test`.
8
+ - Full mapped rule catalog (~25 stems); always-on trio `mcp-ts-app-core`, `mcp-server-boundaries`, `code-quality-and-refactoring` (session-start body budget ≤140).
9
+ - Agent-team surface (Phase 1): 6 agents (`task-router`, `task-analyst`, `solution-architect`, `feature-developer`, `build-verifier`, `security-reviewer`), 4 skills, 5 commands, hooks + team fixtures; no Playwright/XCUITest/a11y/`integration-test-*`.
10
+ - Structure scripts (`twin-map`, `token-budget`, `leakage`) include `mcp-ts`; leakage `MCP_TS_FORBIDDEN_*` + pairwise chain forks vs other stacks.
11
+ - Install: `npx @bonesofspring/ai-rules init cursor|claude --preset mcp-ts`.
12
+ - Dogfood: `dogfood/mcp-ts-sample` (scenarios M1–M3 in `reference-features`).
13
+ - Platform asymmetry: `BUGBOT.md` + `hooks.json` Cursor-only; `CLAUDE.md` Claude-only.
14
+
15
+ ### Go/Java stub thicken + session-start budget raise (`go-java-rules-thicken-dogfood`)
16
+
17
+ - **Session-start body cap:** **120 → 140** (stretch **≤120**); `alwaysApply` / Claude session-start count stays **exactly 3**. Checker `BODY_CAP=140`; policy core + embed adapters + build-verifier copy updated.
18
+ - **Go Must thickened to full** (Cursor SoT + Claude twins): `application-usecases`, `composition-root`, `persistence-adapters`, `tests-integration`, `security-go`. `tests-e2e` kept stub with scoped-smoke banner (≥15 body).
19
+ - **Always-on edit-bundle index** added to Go/Java `architecture-boundaries` (uses new headroom).
20
+ - **Java:** `messaging-adapters` expanded to **full** (J3); `api-grpc` remains documented stub.
21
+ - **Dogfood hosts:** dedicated samples under `dogfood/go-hexagonal` and `dogfood/java-spring-hexagonal` (A/B runs follow-up).
22
+
5
23
  ### React/Next anti-hallucination (P0-B / `preset-react-next-anti-hallucination`)
6
24
 
7
25
  - New **requestable** next-only rule `react-next-anti-hallucination` (Cursor `.mdc` + Claude twin under `anti-hallucination/`) — ≥15 ❌/✅ banlist rows for phantom Next/React/RTK imports, RSC boundaries, navigation, version drift.
@@ -13,20 +31,20 @@
13
31
  - Slimmed always-on `quality/code-quality-and-refactoring` (Principles + condensed Agent discipline essentials + pointer).
14
32
  - New requestable shared-core `quality/anti-sycophancy-discipline` (~17 procedural rules) + Cursor/Claude adapters ×4 stacks (`alwaysApply: false` / `paths:`).
15
33
  - Wired `feature-developer` / `debugger` / `ci-investigator` (Cursor + Claude ×4) to load `anti-sycophancy-discipline` when writing/changing code.
16
- - Session-start alwaysApply trio body sum target ≤120 (prefer ≤110); still exactly 3 always-on per stack.
34
+ - Session-start alwaysApply trio body sum target was ≤120 (prefer ≤110) at ship time; **superseded** by Unreleased budget raise to ≤140 (prefer ≤120).
17
35
 
18
36
  ### Review follow-ups (core sharing / structure)
19
37
 
20
38
  - **Shared-core drift is a hard gate** in `check:preset-structure` / CI (`AI_RULES_DRIFT_FAIL=1`).
21
39
  - **build-verifier** agents (next/ios-swift/go/java × Cursor+Claude): twin / REPO_AGENTS / react-performance gates list all four stacks.
22
40
  - **Leakage core DRY:** merged go+java forbidden blocks in `meta/preset-no-cross-stack-leakage` (+8 embed adapters).
23
- - **ios-swift session-start:** trimmed `ios-app-core` toward stretch ≤100 body sum.
41
+ - **ios-swift session-start:** trimmed `ios-app-core` toward stretch ≤100 body sum (at ship; stretch target now ≤120 with hard cap 140).
24
42
  - **Docs:** leakage soft-WARN baseline + drift hardgate in `PRESET-CONTRIBUTION.md`; go/java `feature-full` fixtures drop Playwright/XCUITest skipped noise.
25
43
 
26
44
  ### Java preset
27
45
 
28
46
  - New installable preset **`java`** (Cursor + Claude twins): Spring Boot hexagonal default, layer-first single-module layout, Context7-only MCP, Maven/Gradle detection via `java-tooling` / `post-change-test`.
29
- - Full mapped rule catalog (~32 stems); always-on trio `java-app-core`, `architecture-boundaries`, `code-quality-and-refactoring` (≤120 body lines).
47
+ - Full mapped rule catalog (~32 stems); always-on trio `java-app-core`, `architecture-boundaries`, `code-quality-and-refactoring` (body budget now ≤140).
30
48
  - Agent-team surface: 21 agents, 8 skills, 5 commands, hooks + team fixtures; `integration-test-*` (no Playwright/XCUITest/a11y).
31
49
  - Structure scripts (`twin-map`, `token-budget`, `leakage`) include `java`; meta cores list four stacks (8 adapters per embed stem).
32
50
  - Install: `npx @bonesofspring/ai-rules init cursor|claude --preset java`.
package/README.md CHANGED
@@ -53,7 +53,7 @@ Where things go on `init`:
53
53
 
54
54
  Skills of note: `write-adr` (all stacks); `react-performance` (**next only**). Living gotchas: `team/conventions.md`. Opt-in rule samples eval: `yarn check:rule-eval` (workflow `rule-eval.yml`; not part of `check:preset-structure`).
55
55
 
56
- The package ships presets including **`next`** (Next.js stack), **`ios-swift`** (iOS apps on Swift / SwiftUI), **`go`** (Go backends with hexagonal architecture), and **`java`** (Java / Spring Boot hexagonal backends). Other preset names: see `presets/` in the [repo](https://github.com/bonesofspring/ai-rules). Name is a single path segment, no `/` or `..`.
56
+ The package ships presets including **`next`** (Next.js stack), **`ios-swift`** (iOS apps on Swift / SwiftUI), **`go`** (Go backends with hexagonal architecture), **`java`** (Java / Spring Boot hexagonal backends), and **`mcp-ts`** (TypeScript MCP servers with `@modelcontextprotocol/sdk`). Other preset names: see `presets/` in the [repo](https://github.com/bonesofspring/ai-rules). Name is a single path segment, no `/` or `..`.
57
57
 
58
58
  ```bash
59
59
  npx @bonesofspring/ai-rules init cursor --preset ios-swift
@@ -62,6 +62,8 @@ npx @bonesofspring/ai-rules init cursor --preset go
62
62
  npx @bonesofspring/ai-rules init claude --preset go
63
63
  npx @bonesofspring/ai-rules init cursor --preset java
64
64
  npx @bonesofspring/ai-rules init claude --preset java
65
+ npx @bonesofspring/ai-rules init cursor --preset mcp-ts
66
+ npx @bonesofspring/ai-rules init claude --preset mcp-ts
65
67
  ```
66
68
 
67
69
  Help: `ai-rules --help`.
package/bin/cli.js CHANGED
@@ -73,10 +73,12 @@ Examples:
73
73
  npx @bonesofspring/ai-rules init cursor --preset ios-swift
74
74
  npx @bonesofspring/ai-rules init cursor --preset go
75
75
  npx @bonesofspring/ai-rules init cursor --preset java
76
+ npx @bonesofspring/ai-rules init cursor --preset mcp-ts
76
77
  npx @bonesofspring/ai-rules init claude
77
78
  npx @bonesofspring/ai-rules init claude --preset ios-swift
78
79
  npx @bonesofspring/ai-rules init claude --preset go
79
80
  npx @bonesofspring/ai-rules init claude --preset java
81
+ npx @bonesofspring/ai-rules init claude --preset mcp-ts
80
82
  npx @bonesofspring/ai-rules clean cursor
81
83
  `);
82
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonesofspring/ai-rules",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Presets of Cursor and Claude rules/commands for Revy Ross personal use",
5
5
  "license": "MIT",
6
6
  "author": "Revy Ross",
@@ -6,7 +6,8 @@
6
6
 
7
7
  - `next` must not require iOS-only agents/tooling (`xcuitest-*`, `xcodebuild` as required handoff, Keychain-only rules).
8
8
  - `ios-swift` must not ship Playwright handoffs or Next lint recipes as required commands.
9
- - `go` / `java` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
9
+ - `go` / `java` / `mcp-ts` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
10
+ - `mcp-ts` must not ship Go tool commands (`go test`, `go vet`, `golangci-lint`) or `integration-test-*` agents as required delivery gates.
10
11
  - Shared core must not embed stack paths (`app/src/**`, `Features/**`, `playwright`, `xcodebuild`).
11
12
 
12
13
  ## Forbidden in ios-swift hooks/agents (FAIL)
@@ -35,6 +36,18 @@ Shared backend-stack bans (both `go` and `java`):
35
36
 
36
37
  Required instead: `integration-test-*`; build-verifier / `post-change-test` plus stack tooling — `go-tooling` (`go test`, `go vet`) or `java-tooling` (`mvn test` / `./gradlew test`).
37
38
 
39
+ ## Forbidden in mcp-ts hooks/agents (FAIL)
40
+
41
+ Same UI/mobile bans as backend stacks, plus:
42
+
43
+ - `playwright-test-`, `playwright-agents`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`
44
+ - Positive yarn recipes `lint:js` / `lint:css` as required gates
45
+ - `xcuitest-test-`, `xcodebuild`, `SwiftLint` as required handoffs
46
+ - Go tool commands as required MCP delivery gates: `go test`, `go vet`, `golangci-lint`
47
+ - Agent files: `playwright-test-*`, `xcuitest-test-*`, `integration-test-*`, `accessibility-reviewer`
48
+
49
+ Required instead: package-manager–discovered typecheck/test (`mcp-ts-tooling`, `post-change-test`); Phase 1 gates `build-verifier` + `security-reviewer`.
50
+
38
51
  ## Soft / document
39
52
 
40
53
  - Mentioning the other stack in **docs** comparing presets is OK.
@@ -42,4 +55,4 @@ Required instead: `integration-test-*`; build-verifier / `post-change-test` plus
42
55
 
43
56
  ## Chain fork
44
57
 
45
- `hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, and `java` (per platform).
58
+ `hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, `java`, and `mcp-ts` (per platform).
@@ -11,7 +11,7 @@
11
11
 
12
12
  **Claude Option A (README exclusion):** when counting Claude rules without `paths:` / session-start, **exclude `**/README.md`** (topic indexes are not session-start rules). The intended session-start trio remains **exactly 3**; body budget sums **only those 3** rules.
13
13
 
14
- Session-start body budget (где задокументировано): ≤120 строк суммарно (stretch ≤100).
14
+ Session-start body budget (где задокументировано): ≤140 строк суммарно (stretch ≤120).
15
15
 
16
16
  ## Meta / author rules
17
17
 
@@ -10,6 +10,7 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
10
10
  | `ios-swift` | `presets/cursor/ios-swift/rules/*.mdc` | `presets/claude/ios-swift/rules/<topic>/` | Keep in `claude/ios-swift/rules/README.md` |
11
11
  | `go` | `presets/cursor/go/rules/*.mdc` | `presets/claude/go/rules/<topic>/` | Keep in `claude/go/rules/README.md` |
12
12
  | `java` | `presets/cursor/java/rules/*.mdc` | `presets/claude/java/rules/<topic>/` | Keep in `claude/java/rules/README.md` |
13
+ | `mcp-ts` | `presets/cursor/mcp-ts/rules/*.mdc` | `presets/claude/mcp-ts/rules/<topic>/` | Keep in `claude/mcp-ts/rules/README.md` |
13
14
 
14
15
  ## Same-PR checklist
15
16
 
@@ -29,5 +30,6 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
29
30
  - **ios-swift:** missing Claude twin for a changed Cursor rule → **FAIL**.
30
31
  - **go:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift; mapping table required).
31
32
  - **java:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go; mapping table required).
33
+ - **mcp-ts:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go / java; mapping table required).
32
34
 
33
35
  Dogfood: sync packages → root `.cursor/` after Cursor SoT changes (not the reverse). Use `packages/ai-rules/scripts/sync-dogfood-cursor.sh`.
@@ -5,24 +5,27 @@ paths:
5
5
  - **/*repository*.go
6
6
  ---
7
7
 
8
-
9
8
  # Persistence adapters
10
9
 
11
10
  - Implement outbound repository ports from application.
12
- - Use parameterized queries; map rows → domain entities inside the adapter.
11
+ - Use **parameterized** queries; map rows → domain entities **inside** the adapter.
13
12
  - Transactions: expose via port (`Transactional`, `UnitOfWork`) implemented here — use cases call the port, not `*sql.Tx` directly.
14
- - Migrations live with infra (separate package/dir) — not in domain.
13
+ - Migrations live with infra (separate package/dir) — not in domain or application.
15
14
 
16
15
  ## Mapping
17
16
 
18
17
  - Persistence models (db tags) stay private to the adapter package when possible.
19
- - Nullability and DB defaults converted to domain values explicitly.
18
+ - Nullability, zero values, and DB defaults convert to domain values explicitly (no silent zero-value domain objects).
19
+ - Port methods return domain/application errors — never leak driver-specific types through the port.
20
20
 
21
21
  ## Forbidden
22
22
 
23
- - Importing persistence from domain or leaking `*sql.DB` through port APIs.
24
- - Building SQL strings in use cases.
23
+ - Importing persistence from domain or leaking `*sql.DB` / ORM handles through port APIs.
24
+ - Building SQL strings in use cases or handlers.
25
+ - Returning scan structs / `sql.Null*` types across the port boundary.
25
26
 
26
27
  ## Tests
27
28
 
28
- - Integration tests with testcontainers / test DB preferred for repos; unit-test mappers with fixtures.
29
+ - Integration: repository **contract** round-trip (save load error/not-found) against testcontainers / repo-standard test DB.
30
+ - Unit-test mappers with fixtures; do **not** substitute `httptest` for a repository contract.
31
+ - Agents: `integration-test-{planner,generator,healer}` + skill `integration-testing`; then `post-change-test`.
@@ -5,25 +5,29 @@ paths:
5
5
  - **/application/**/*
6
6
  ---
7
7
 
8
-
9
8
  # Application / use cases
10
9
 
11
10
  - One use case ≈ one application service method (command/query).
12
11
  - Depend on **outbound ports** (interfaces), not concrete repos/clients.
13
12
  - Orchestrate domain; transaction boundaries via ports (`UnitOfWork`) when needed — still no SQL here.
14
13
  - Accept `context.Context` on public methods; propagate to ports.
14
+ - Input/output types stay in application or domain — never handler DTOs, `http.Request`, or SQL row types.
15
15
 
16
16
  ## Forbidden
17
17
 
18
- - Importing `adapters/*`, SQL drivers, HTTP frameworks.
19
- - Embedding `*sql.DB`, Redis clients, or handler types in use-case structs.
20
- - Business rules that belong in domain entities (keep use cases thin).
18
+ - Importing `adapters/*`, SQL drivers, HTTP/gRPC frameworks, broker clients.
19
+ - Embedding `*sql.DB`, Redis/Kafka clients, or handler types in use-case structs.
20
+ - Business rules that belong in domain entities (keep use cases thin orchestrators).
21
+ - Starting DB transactions with concrete `*sql.Tx` — call a port (`UnitOfWork` / `Transactional`).
21
22
 
22
23
  ## Structure
23
24
 
24
25
  - Prefer `application/<usecase>.go` + `ports.go` (or `ports/`) colocated.
25
26
  - Inbound port = interface the driving adapter calls (optional if use-case struct is the API).
27
+ - Map transport/persistence errors at adapters; use cases return domain/application errors.
26
28
 
27
29
  ## Tests
28
30
 
29
- - Mock outbound ports; assert domain outcomes and port interactions — no real DB.
31
+ - Fake/mock **outbound ports** only; assert domain outcomes and port interactions — no real DB.
32
+ - Table-driven cases for validation/branching; inject clock/ID seams when time/IDs matter.
33
+ - After edits: `post-change-test` (+ `go-tooling`).
@@ -2,7 +2,6 @@
2
2
  description: Hexagonal layer boundaries for Go backends (domain, application, ports, adapters)
3
3
  ---
4
4
 
5
-
6
5
  # Границы слоёв (hexagonal)
7
6
 
8
7
  - **Domain** (`internal/domain`, `**/domain`):
@@ -23,6 +22,12 @@ description: Hexagonal layer boundaries for Go backends (domain, application, po
23
22
  - Domain never imports adapters or frameworks.
24
23
  - Cross-feature access — only via public ports / `pkg` API, not deep imports of another feature's internals.
25
24
 
25
+ # Edit bundles (load on matching paths)
26
+
27
+ - `**/domain/**` → `domain-layer`; `**/application/**` → `application-usecases` + `ports-interfaces`
28
+ - Driving HTTP/gRPC → `adapters-driving` + `api-http` / `api-grpc`; persistence/messaging → `adapters-driven` + matching `*-adapters`
29
+ - `cmd/**`, `internal/app/**` → `composition-root`; after `*.go` edits → `post-change-test` (+ `go-tooling`)
30
+
26
31
  # Требование к агенту
27
32
 
28
33
  - Класть файлы в правильный слой; не «коротить» слои ради скорости.
@@ -5,24 +5,29 @@ paths:
5
5
  - internal/app/**/*
6
6
  ---
7
7
 
8
-
9
8
  # Composition root
10
9
 
11
- - Construct adapters, use cases, and servers in `cmd/<service>` and/or `internal/app`.
12
- - Wire interfaces to implementations explicitly (manual DI preferred unless repo already uses a container).
13
- - Load config once; fail fast on missing required settings.
14
- - Lifecycle: graceful shutdown via `context` cancel + server `Shutdown`.
10
+ - Construct adapters use cases servers in `cmd/<service>` and/or `internal/app`.
11
+ - Wire interfaces to implementations explicitly (manual DI preferred unless the repo already uses a container).
12
+ - Load config once; **fail fast** on missing required settings before opening listeners or connections.
13
+ - Lifecycle: cancel root `context` drain in-flight work → `Shutdown` servers → close driven adapters (DB/pool/clients) in reverse wire order.
15
14
 
16
15
  ## Allowed here
17
16
 
18
- - Import all layers for wiring only.
19
- - Process-wide loggers/metrics providers.
17
+ - Import all layers **for wiring only**.
18
+ - Process-wide loggers/metrics providers constructed once and injected.
20
19
 
21
20
  ## Forbidden
22
21
 
23
22
  - Business rules, SQL queries, HTTP routing tables with domain logic.
24
- - Global mutable singletons for repos without clear init (prefer explicit deps).
23
+ - Global mutable singletons for repos without clear init (prefer explicit constructor deps).
24
+ - Starting background workers without tying them to the root context / shutdown path.
25
+
26
+ ## Agent handoffs
27
+
28
+ - After wiring changes: `post-change-test` (+ `go-tooling`) — at least compile / construction smoke.
29
+ - Layer checklist: `feature-delivery-workflow` (domain → ports → adapters → wire).
25
30
 
26
31
  ## Tests
27
32
 
28
- - Optional smoke that wiring builds (compile-time / construction test); heavy logic stays in unit/integration tests.
33
+ - Optional construction/smoke test that `NewApp`/`main` wiring builds; heavy logic stays in unit/integration tests.
@@ -5,14 +5,16 @@ paths:
5
5
  - **/*_e2e_test.go
6
6
  ---
7
7
 
8
-
9
8
  # E2E / HTTP smoke
10
9
 
11
- - Black-box against a running server (httptest with full composition root, or localhost in CI).
12
- - Cover critical paths only; prefer integration + unit for breadth.
13
- - Stable test data; avoid depending on wall-clock flakiness.
14
- - Do not use browser/Playwright tooling in this preset.
10
+ > **Documented stub / scoped smoke:** Prefer `tests-integration` + `integration-test-*` for breadth. Expand this rule only when the consumer repo keeps a dedicated black-box smoke suite.
11
+
12
+ - Black-box against a running server (`httptest` with full composition root, or localhost in CI).
13
+ - Cover critical paths only; prefer integration + unit for most coverage.
14
+ - Stable test data; avoid wall-clock flakiness and shared mutable fixtures.
15
+ - Do **not** use browser/Playwright tooling in this preset (`preset-no-cross-stack-leakage`).
15
16
 
16
17
  ## Placement
17
18
 
18
- - `e2e/` package or `*_e2e_test.go` with build tags if needed.
19
+ - `e2e/` package or `*_e2e_test.go` with build tags if the repo already separates smoke CI.
20
+ - If smoke overlaps repository contracts, put the contract under `tests-integration` instead.
@@ -5,19 +5,25 @@ paths:
5
5
  - **/*_integration_test.go
6
6
  ---
7
7
 
8
-
9
8
  # Integration tests
10
9
 
11
10
  - Exercise driven adapters against real infra doubles (testcontainers, docker compose test DB, miniredis, etc.).
12
11
  - Or exercise HTTP adapter with `httptest` + wired use case + fake/real ports — still no full prod cluster required.
13
- - Build tags (`//go:build integration`) if the repo separates CI jobs.
14
- - Keep fixtures deterministic; clean up data between tests.
12
+ - Build tags (`//go:build integration`) when the repo separates CI jobs — discover the existing CI entrypoint; do not invent a second runner.
13
+ - Keep fixtures deterministic; clean up / isolate data between tests (truncate, transaction rollback, or unique prefixes).
15
14
 
16
15
  ## Scope
17
16
 
18
- - Contract of a port implementation (repo save/load roundtrip).
19
- - Not a substitute for domain unit tests.
17
+ - **Contract of a port implementation** (repo save/load/error round-trip) — assert semantics at the port, not only SQL rows.
18
+ - HTTP adapter contract with `httptest` is valid **adapter** integration — it is **not** a substitute for a repository contract test.
19
+ - Not a substitute for domain unit tests (table-driven domain logic stays in `tests-unit`).
20
+
21
+ ## Forbidden shortcuts
22
+
23
+ - Fake-only “integration” that never crosses the adapter↔infra boundary for the port under test.
24
+ - Skipping isolation so tests pass only in isolation or only on a dirty DB.
20
25
 
21
26
  ## Agents
22
27
 
23
28
  - Planning/generation: `integration-test-{planner,generator,healer}` + skill `integration-testing`.
29
+ - After green tests: `post-change-test` (+ `go-tooling`).
@@ -17,7 +17,8 @@ paths:
17
17
 
18
18
  - `next` must not require iOS-only agents/tooling (`xcuitest-*`, `xcodebuild` as required handoff, Keychain-only rules).
19
19
  - `ios-swift` must not ship Playwright handoffs or Next lint recipes as required commands.
20
- - `go` / `java` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
20
+ - `go` / `java` / `mcp-ts` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
21
+ - `mcp-ts` must not ship Go tool commands (`go test`, `go vet`, `golangci-lint`) or `integration-test-*` agents as required delivery gates.
21
22
  - Shared core must not embed stack paths (`app/src/**`, `Features/**`, `playwright`, `xcodebuild`).
22
23
 
23
24
  ## Forbidden in ios-swift hooks/agents (FAIL)
@@ -46,6 +47,18 @@ Shared backend-stack bans (both `go` and `java`):
46
47
 
47
48
  Required instead: `integration-test-*`; build-verifier / `post-change-test` plus stack tooling — `go-tooling` (`go test`, `go vet`) or `java-tooling` (`mvn test` / `./gradlew test`).
48
49
 
50
+ ## Forbidden in mcp-ts hooks/agents (FAIL)
51
+
52
+ Same UI/mobile bans as backend stacks, plus:
53
+
54
+ - `playwright-test-`, `playwright-agents`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`
55
+ - Positive yarn recipes `lint:js` / `lint:css` as required gates
56
+ - `xcuitest-test-`, `xcodebuild`, `SwiftLint` as required handoffs
57
+ - Go tool commands as required MCP delivery gates: `go test`, `go vet`, `golangci-lint`
58
+ - Agent files: `playwright-test-*`, `xcuitest-test-*`, `integration-test-*`, `accessibility-reviewer`
59
+
60
+ Required instead: package-manager–discovered typecheck/test (`mcp-ts-tooling`, `post-change-test`); Phase 1 gates `build-verifier` + `security-reviewer`.
61
+
49
62
  ## Soft / document
50
63
 
51
64
  - Mentioning the other stack in **docs** comparing presets is OK.
@@ -53,4 +66,4 @@ Required instead: `integration-test-*`; build-verifier / `post-change-test` plus
53
66
 
54
67
  ## Chain fork
55
68
 
56
- `hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, and `java` (per platform).
69
+ `hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, `java`, and `mcp-ts` (per platform).
@@ -22,7 +22,7 @@ paths:
22
22
 
23
23
  **Claude Option A (README exclusion):** when counting Claude rules without `paths:` / session-start, **exclude `**/README.md`** (topic indexes are not session-start rules). The intended session-start trio remains **exactly 3**; body budget sums **only those 3** rules.
24
24
 
25
- Session-start body budget (где задокументировано): ≤120 строк суммарно (stretch ≤100).
25
+ Session-start body budget (где задокументировано): ≤140 строк суммарно (stretch ≤120).
26
26
 
27
27
  ## Meta / author rules
28
28
 
@@ -21,6 +21,7 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
21
21
  | `ios-swift` | `presets/cursor/ios-swift/rules/*.mdc` | `presets/claude/ios-swift/rules/<topic>/` | Keep in `claude/ios-swift/rules/README.md` |
22
22
  | `go` | `presets/cursor/go/rules/*.mdc` | `presets/claude/go/rules/<topic>/` | Keep in `claude/go/rules/README.md` |
23
23
  | `java` | `presets/cursor/java/rules/*.mdc` | `presets/claude/java/rules/<topic>/` | Keep in `claude/java/rules/README.md` |
24
+ | `mcp-ts` | `presets/cursor/mcp-ts/rules/*.mdc` | `presets/claude/mcp-ts/rules/<topic>/` | Keep in `claude/mcp-ts/rules/README.md` |
24
25
 
25
26
  ## Same-PR checklist
26
27
 
@@ -40,5 +41,6 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
40
41
  - **ios-swift:** missing Claude twin for a changed Cursor rule → **FAIL**.
41
42
  - **go:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift; mapping table required).
42
43
  - **java:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go; mapping table required).
44
+ - **mcp-ts:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go / java; mapping table required).
43
45
 
44
46
  Dogfood: sync packages → root `.cursor/` after Cursor SoT changes (not the reverse). Use `packages/ai-rules/scripts/sync-dogfood-cursor.sh`.
@@ -6,17 +6,29 @@ paths:
6
6
  - **/config/**/*
7
7
  ---
8
8
 
9
-
10
9
  # Security (Go)
11
10
 
12
- - Secrets from env/secret manager — never commit keys; do not log tokens/passwords.
11
+ - Secrets from env/secret manager — never commit keys; **never log** tokens, passwords, raw `Authorization` headers, or cookie values.
13
12
  - Validate and canonicalize untrusted input at the driving adapter edge.
14
13
  - Prefer prepared statements / parameterized queries in persistence adapters.
15
14
  - TLS and secure cookie/header defaults when exposing HTTP.
16
15
  - AuthN/AuthZ in middleware or driving adapters; pass identity into use cases as domain value (user ID / claims), not raw headers.
17
- - Minimize PII in logs; redact where needed.
16
+ - Minimize PII in structured logs; redact known sensitive fields by default.
18
17
 
19
18
  ## Config
20
19
 
21
- - Distinguish public vs secret config fields in types.
22
- - Fail closed when auth is misconfigured in production builds.
20
+ - Distinguish public vs secret config fields in types (separate structs or tagged fields).
21
+ - **Fail closed** when auth is misconfigured in production builds (missing issuer/JWKS/secret → refuse to start or reject requests).
22
+ - Sample configs and README snippets must use placeholders — never real-looking secrets.
23
+
24
+ ## Forbidden
25
+
26
+ - Hardcoded API keys/tokens in source or committed `.env` examples with live values.
27
+ - Logging request/response bodies that may contain credentials without an explicit redact step.
28
+ - Fail-open auth middleware when required validators are nil/empty in prod.
29
+
30
+ ## Tests
31
+
32
+ - Negative assertions: logs/metrics fixtures must not contain bearer tokens or secret config values.
33
+ - Missing/invalid auth config fails closed in a construction or middleware test.
34
+ - Agents: `security-reviewer` on auth/config/logging changes; then `post-change-test`.
@@ -29,7 +29,7 @@ npx @bonesofspring/ai-rules init claude --preset ios-swift
29
29
 
30
30
  ## Session-start (= Cursor alwaysApply)
31
31
 
32
- Ровно **3** файла без `paths:`: `stack/ios-app-core.md`, `architecture/boundaries.md`, `tooling-and-review/code-quality.md`. Бюджет тела ≤120 строк суммарно.
32
+ Ровно **3** файла без `paths:`: `stack/ios-app-core.md`, `architecture/boundaries.md`, `tooling-and-review/code-quality.md`. Бюджет тела ≤140 строк суммарно.
33
33
 
34
34
  ## Parity with Cursor
35
35
 
@@ -38,7 +38,7 @@ When validating **ios-swift preset** changes (or `scope: preset-structure-valida
38
38
  6. **Twin presence (hard):** Cursor rule change → Claude twin same PR — **FAIL** if missing (next, ios-swift, go, and java).
39
39
  7. **Mapping / README:** Cursor→Claude mapping table present; core→stack mapping when `_shared` consumers exist.
40
40
  8. **shared-core consumers:** if `_shared/core/**` changed, update all `<!-- shared-core: … -->` consumers (or document intentional fork).
41
- 9. **Session-start body budget:** sum of the **3** intended session-start rule bodies ≤ **120** lines (stretch ≤100); do **not** include `**/README.md` — record in report.
41
+ 9. **Session-start body budget:** sum of the **3** intended session-start rule bodies ≤ **140** lines (stretch ≤120); do **not** include `**/README.md` — record in report.
42
42
  10. **Embed drift (hard in `check:preset-structure`):** `packages/ai-rules/scripts/check-shared-core-drift.sh` with `AI_RULES_DRIFT_FAIL=1`.
43
43
  11. **Dogfood (monorepo soft):** `packages/ai-rules/scripts/sync-dogfood-cursor.sh`; mass deletion without migration doc → risk / FAIL for maintainers.
44
44
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  ## Loading budget
15
15
 
16
- - **Session-start (no `paths:`):** ровно **3** — `ios-app-core`, `boundaries`, `code-quality` (≤120 body lines total)
16
+ - **Session-start (no `paths:`):** ровно **3** — `ios-app-core`, `boundaries`, `code-quality` (≤140 body lines total)
17
17
  - **Все остальные** — с `paths:` (commands/team/agents и/или Feature/Swift globs)
18
18
  - **Soft twin depth:** domain rules ≥15 body lines; thin aliases (`agent-team-intake`, `technical-retro`) могут быть короче (как next)
19
19
 
@@ -17,7 +17,8 @@ paths:
17
17
 
18
18
  - `next` must not require iOS-only agents/tooling (`xcuitest-*`, `xcodebuild` as required handoff, Keychain-only rules).
19
19
  - `ios-swift` must not ship Playwright handoffs or Next lint recipes as required commands.
20
- - `go` / `java` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
20
+ - `go` / `java` / `mcp-ts` must not ship Playwright, XCUITest, Next lint recipes, or `xcodebuild`/`SwiftLint` as required handoffs.
21
+ - `mcp-ts` must not ship Go tool commands (`go test`, `go vet`, `golangci-lint`) or `integration-test-*` agents as required delivery gates.
21
22
  - Shared core must not embed stack paths (`app/src/**`, `Features/**`, `playwright`, `xcodebuild`).
22
23
 
23
24
  ## Forbidden in ios-swift hooks/agents (FAIL)
@@ -46,6 +47,18 @@ Shared backend-stack bans (both `go` and `java`):
46
47
 
47
48
  Required instead: `integration-test-*`; build-verifier / `post-change-test` plus stack tooling — `go-tooling` (`go test`, `go vet`) or `java-tooling` (`mvn test` / `./gradlew test`).
48
49
 
50
+ ## Forbidden in mcp-ts hooks/agents (FAIL)
51
+
52
+ Same UI/mobile bans as backend stacks, plus:
53
+
54
+ - `playwright-test-`, `playwright-agents`, `playwright-e2e`, `user-playwright`, `app/__tests__/e2e`
55
+ - Positive yarn recipes `lint:js` / `lint:css` as required gates
56
+ - `xcuitest-test-`, `xcodebuild`, `SwiftLint` as required handoffs
57
+ - Go tool commands as required MCP delivery gates: `go test`, `go vet`, `golangci-lint`
58
+ - Agent files: `playwright-test-*`, `xcuitest-test-*`, `integration-test-*`, `accessibility-reviewer`
59
+
60
+ Required instead: package-manager–discovered typecheck/test (`mcp-ts-tooling`, `post-change-test`); Phase 1 gates `build-verifier` + `security-reviewer`.
61
+
49
62
  ## Soft / document
50
63
 
51
64
  - Mentioning the other stack in **docs** comparing presets is OK.
@@ -53,4 +66,4 @@ Required instead: `integration-test-*`; build-verifier / `post-change-test` plus
53
66
 
54
67
  ## Chain fork
55
68
 
56
- `hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, and `java` (per platform).
69
+ `hooks/chain-team-phases.sh` must differ **byte-wise** pairwise among `next`, `ios-swift`, `go`, `java`, and `mcp-ts` (per platform).
@@ -22,7 +22,7 @@ paths:
22
22
 
23
23
  **Claude Option A (README exclusion):** when counting Claude rules without `paths:` / session-start, **exclude `**/README.md`** (topic indexes are not session-start rules). The intended session-start trio remains **exactly 3**; body budget sums **only those 3** rules.
24
24
 
25
- Session-start body budget (где задокументировано): ≤120 строк суммарно (stretch ≤100).
25
+ Session-start body budget (где задокументировано): ≤140 строк суммарно (stretch ≤120).
26
26
 
27
27
  ## Meta / author rules
28
28
 
@@ -21,6 +21,7 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
21
21
  | `ios-swift` | `presets/cursor/ios-swift/rules/*.mdc` | `presets/claude/ios-swift/rules/<topic>/` | Keep in `claude/ios-swift/rules/README.md` |
22
22
  | `go` | `presets/cursor/go/rules/*.mdc` | `presets/claude/go/rules/<topic>/` | Keep in `claude/go/rules/README.md` |
23
23
  | `java` | `presets/cursor/java/rules/*.mdc` | `presets/claude/java/rules/<topic>/` | Keep in `claude/java/rules/README.md` |
24
+ | `mcp-ts` | `presets/cursor/mcp-ts/rules/*.mdc` | `presets/claude/mcp-ts/rules/<topic>/` | Keep in `claude/mcp-ts/rules/README.md` |
24
25
 
25
26
  ## Same-PR checklist
26
27
 
@@ -40,5 +41,6 @@ Cursor `.mdc` — **SoT per stack**. Claude topic `.md` — derived twin.
40
41
  - **ios-swift:** missing Claude twin for a changed Cursor rule → **FAIL**.
41
42
  - **go:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift; mapping table required).
42
43
  - **java:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go; mapping table required).
44
+ - **mcp-ts:** missing Claude twin for a changed Cursor rule → **FAIL** (same as next / ios-swift / go / java; mapping table required).
43
45
 
44
46
  Dogfood: sync packages → root `.cursor/` after Cursor SoT changes (not the reverse). Use `packages/ai-rules/scripts/sync-dogfood-cursor.sh`.
@@ -30,7 +30,7 @@ Hard gates for the **java** stack:
30
30
  | Gate | FAIL when |
31
31
  |------|-----------|
32
32
  | **twin-map** | `java` missing from `STACKS`, or Cursor↔Claude orphan/missing twins |
33
- | **token-budget** | Cursor `alwaysApply` ≠ 3 or Claude session-start (excl. README) ≠ 3, or trio body sum > 120 |
33
+ | **token-budget** | Cursor `alwaysApply` ≠ 3 or Claude session-start (excl. README) ≠ 3, or trio body sum > 140 |
34
34
  | **leakage** | `JAVA_FORBIDDEN_*` hits (Playwright/XCUITest/`lint:js`/`accessibility-reviewer` as required handoffs) |
35
35
  | **chain fork** | `hooks/chain-team-phases.sh` byte-identical to **next**, **ios-swift**, or **go** (same platform) |
36
36
 
@@ -14,7 +14,7 @@ Claude topic `.md` files are **derived** from Cursor SoT `presets/cursor/java/ru
14
14
 
15
15
  - **Session-start (no `paths:`):** exactly **3** — `java-app-core`, `boundaries`, `code-quality`
16
16
  - All others — with `paths:`
17
- - **Twin depth:** domain rules target ≥15 body lines; thin aliases: `agent-team-intake`, `technical-retro`; **documented stubs** (v1): `api-grpc`, `messaging-adapters` — see Cursor `presets/cursor/java/rules/README.md` Catalog (Depth column)
17
+ - **Twin depth:** domain rules target ≥15 body lines; thin aliases: `agent-team-intake`, `technical-retro`; **documented stub** (v1): `api-grpc`; `messaging-adapters` is **full** — see Cursor `presets/cursor/java/rules/README.md` Catalog (Depth column)
18
18
 
19
19
  ## Cursor → Claude mapping
20
20
 
@@ -6,19 +6,26 @@ paths:
6
6
  - "**/adapters/messaging/**/*"
7
7
  ---
8
8
 
9
- # Messaging adapters (documented stub)
9
+ # Messaging adapters
10
10
 
11
- > **Stub (v1):** Light guidance only not a full Kafka/Rabbit/JMS cookbook. **When to use:** editing `adapters/**/messaging/**` or adding broker publishers/consumers. Prefer expanding this rule when the consumer repo standardizes on a broker.
12
-
13
- - **Publisher** (driven): implements outbound port; serializes domain events / integration events.
14
- - **Consumer** (driving): deserializes calls use case / inbound port; ack/nack policy here.
15
- - Idempotency keys and retry/DLQ are adapter concerns; document at-least-once assumptions.
16
- - Do not put broker client types (`KafkaTemplate`, JMS sessions, etc.) in domain or application signatures.
11
+ - **Publisher** (driven): implements an outbound port; serializes application/domain events to wire format inside the adapter.
12
+ - **Consumer** (driving): deserializes → maps to application/domain types → calls inbound port / use case; **ack/nack** (and commit) stays in the adapter.
13
+ - Idempotency keys, retry, and DLQ/parking-lot policy are adapter (or infra) concerns document at-least-once vs exactly-once assumptions at the port.
14
+ - Use the broker client already present in the repo (`KafkaTemplate`, JMS, Spring Cloud Stream, etc.) do not invent a second stack.
17
15
 
18
16
  ## Event shapes
19
17
 
20
- - Prefer explicit event types in application or a small `events` package used by ports — map to wire format in the adapter.
18
+ - Prefer explicit event types in application or a small `events` package used by ports.
19
+ - Map wire DTOs ↔ application events **only** in the adapter; never pass `ConsumerRecord` / broker payloads into domain.
20
+
21
+ ## Forbidden
22
+
23
+ - Broker client types (`KafkaTemplate`, JMS sessions, `MessageListener`) in domain or application signatures.
24
+ - Business rules inside listeners beyond mapping + calling one use case.
25
+ - Silent catch-and-ack that drops poison messages without DLQ/metrics policy.
21
26
 
22
27
  ## Tests
23
28
 
24
- - Unit-test mapping with fakes; integration against embedded/broker Testcontainers when the repo has them.
29
+ - Unit-test mapping and idempotency branches with fakes.
30
+ - Integration against embedded broker / Testcontainers **when the repo already has that setup**.
31
+ - After edits: `post-change-test` (+ `java-tooling`); agents `integration-test-*` when adding consumer contracts.
@@ -2,7 +2,6 @@
2
2
  description: Hexagonal layer boundaries for Java backends (domain, application, ports, adapters)
3
3
  ---
4
4
 
5
-
6
5
  # Границы слоёв (hexagonal)
7
6
 
8
7
  - **Domain** (`**/domain`):
@@ -23,6 +22,12 @@ description: Hexagonal layer boundaries for Java backends (domain, application,
23
22
  - Domain never imports adapters or frameworks.
24
23
  - Cross-feature access — only via public ports / module API, not deep imports of another feature's internals.
25
24
 
25
+ # Edit bundles (load on matching paths)
26
+
27
+ - `**/domain/**` → `domain-layer`; `**/application/**` → `application-usecases` + `ports-interfaces`
28
+ - Inbound HTTP/gRPC → `adapters-driving` + `api-http` / `api-grpc`; outbound persistence/messaging → `adapters-driven` + matching `*-adapters`
29
+ - `**/configuration/**`, `*Application.java` → `composition-root`; after `*.java` edits → `post-change-test` (+ `java-tooling`)
30
+
26
31
  # Требование к агенту
27
32
 
28
33
  - Класть файлы в правильный слой; не «коротить» слои ради скорости.