mustard-claude 3.0.8 → 3.0.10

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 (64) hide show
  1. package/dist/services/npm.js +1 -1
  2. package/dist/services/npm.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/commands/mustard/feature/SKILL.md +1 -0
  5. package/templates/commands/mustard/git/SKILL.md +279 -244
  6. package/templates/commands/mustard/resume/SKILL.md +6 -0
  7. package/templates/hooks/__tests__/hooks.test.js +145 -0
  8. package/templates/hooks/guard-verify.js +8 -5
  9. package/templates/hooks/session-cleanup.js +5 -1
  10. package/templates/hooks/subagent-tracker.js +60 -3
  11. package/templates/scripts/memory-write.js +215 -0
  12. package/templates/scripts/package.json +1 -0
  13. package/templates/scripts/sync-detect.js +45 -5
  14. package/templates/skills/pipeline-execution/SKILL.md +1 -7
  15. package/templates/skills/react-best-practices/references/rules/_sections.md +62 -46
  16. package/templates/skills/react-best-practices/references/rules/{advanced-use-latest.md → advanced.md} +101 -49
  17. package/templates/skills/react-best-practices/references/rules/async.md +277 -0
  18. package/templates/skills/react-best-practices/references/rules/bundle.md +253 -0
  19. package/templates/skills/react-best-practices/references/rules/{client-event-listeners.md → client.md} +144 -74
  20. package/templates/skills/react-best-practices/references/rules/js.md +696 -0
  21. package/templates/skills/react-best-practices/references/rules/rendering.md +344 -0
  22. package/templates/skills/react-best-practices/references/rules/rerender.md +287 -0
  23. package/templates/skills/react-best-practices/references/rules/server.md +204 -0
  24. package/templates/skills/react-best-practices/references/rules/advanced-event-handler-refs.md +0 -38
  25. package/templates/skills/react-best-practices/references/rules/async-api-routes.md +0 -38
  26. package/templates/skills/react-best-practices/references/rules/async-defer-await.md +0 -80
  27. package/templates/skills/react-best-practices/references/rules/async-dependencies.md +0 -36
  28. package/templates/skills/react-best-practices/references/rules/async-parallel.md +0 -28
  29. package/templates/skills/react-best-practices/references/rules/async-suspense-boundaries.md +0 -66
  30. package/templates/skills/react-best-practices/references/rules/bundle-barrel-imports.md +0 -59
  31. package/templates/skills/react-best-practices/references/rules/bundle-conditional.md +0 -31
  32. package/templates/skills/react-best-practices/references/rules/bundle-defer-third-party.md +0 -49
  33. package/templates/skills/react-best-practices/references/rules/bundle-dynamic-imports.md +0 -35
  34. package/templates/skills/react-best-practices/references/rules/bundle-preload.md +0 -50
  35. package/templates/skills/react-best-practices/references/rules/client-swr-dedup.md +0 -56
  36. package/templates/skills/react-best-practices/references/rules/js-batch-dom-css.md +0 -82
  37. package/templates/skills/react-best-practices/references/rules/js-cache-function-results.md +0 -80
  38. package/templates/skills/react-best-practices/references/rules/js-cache-property-access.md +0 -28
  39. package/templates/skills/react-best-practices/references/rules/js-cache-storage.md +0 -68
  40. package/templates/skills/react-best-practices/references/rules/js-combine-iterations.md +0 -32
  41. package/templates/skills/react-best-practices/references/rules/js-early-exit.md +0 -50
  42. package/templates/skills/react-best-practices/references/rules/js-hoist-regexp.md +0 -43
  43. package/templates/skills/react-best-practices/references/rules/js-index-maps.md +0 -37
  44. package/templates/skills/react-best-practices/references/rules/js-length-check-first.md +0 -49
  45. package/templates/skills/react-best-practices/references/rules/js-min-max-loop.md +0 -82
  46. package/templates/skills/react-best-practices/references/rules/js-set-map-lookups.md +0 -24
  47. package/templates/skills/react-best-practices/references/rules/js-tosorted-immutable.md +0 -57
  48. package/templates/skills/react-best-practices/references/rules/rendering-activity.md +0 -26
  49. package/templates/skills/react-best-practices/references/rules/rendering-animate-svg-wrapper.md +0 -47
  50. package/templates/skills/react-best-practices/references/rules/rendering-conditional-render.md +0 -40
  51. package/templates/skills/react-best-practices/references/rules/rendering-content-visibility.md +0 -38
  52. package/templates/skills/react-best-practices/references/rules/rendering-hoist-jsx.md +0 -44
  53. package/templates/skills/react-best-practices/references/rules/rendering-hydration-no-flicker.md +0 -82
  54. package/templates/skills/react-best-practices/references/rules/rendering-svg-precision.md +0 -28
  55. package/templates/skills/react-best-practices/references/rules/rerender-defer-reads.md +0 -39
  56. package/templates/skills/react-best-practices/references/rules/rerender-dependencies.md +0 -45
  57. package/templates/skills/react-best-practices/references/rules/rerender-derived-state.md +0 -29
  58. package/templates/skills/react-best-practices/references/rules/rerender-lazy-state-init.md +0 -58
  59. package/templates/skills/react-best-practices/references/rules/rerender-memo.md +0 -42
  60. package/templates/skills/react-best-practices/references/rules/rerender-transitions.md +0 -40
  61. package/templates/skills/react-best-practices/references/rules/server-cache-lru.md +0 -37
  62. package/templates/skills/react-best-practices/references/rules/server-cache-react.md +0 -26
  63. package/templates/skills/react-best-practices/references/rules/server-parallel-fetching.md +0 -79
  64. package/templates/skills/react-best-practices/references/rules/server-serialization.md +0 -38
@@ -4,7 +4,7 @@ import { readFile } from 'fs/promises';
4
4
  import { join, dirname } from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
  const execAsync = promisify(exec);
7
- const PACKAGE_NAME = '@atiz/mustard';
7
+ const PACKAGE_NAME = 'mustard-claude';
8
8
  /**
9
9
  * Get the latest version of mustard-claude from npm registry
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"npm.js","sourceRoot":"","sources":["../../src/services/npm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC,MAAM,YAAY,GAAG,eAAe,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,YAAY,YAAY,UAAU,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC,IA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AAK;YAAE,OAAO,CAAC,CAAC,CAAC;QAC7B,IAAI,KAAK,GAAG,KAAK;YAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,OAAO,GAAG,MAAM,iBAAiB,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACxC,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAEvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,kBAAkB,YAAY,SAAS,CAAC,CAAC;IAC3D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mustard-claude",
3
- "version": "3.0.8",
3
+ "version": "3.0.10",
4
4
  "description": "Framework-agnostic CLI for Claude Code project setup",
5
5
  "type": "module",
6
6
  "bin": {
@@ -106,6 +106,7 @@ When user chooses "Approve and implement now":
106
106
  6. Dispatch agents (wave rules: DB+Backend parallel, Frontend after Backend). Agent prompt includes `{recommended_skills}` as skill hints — agents read SKILL.md of relevant skills before implementing
107
107
  7. Wave transitions between waves (from `pipeline-config.md`)
108
108
  8. On return: validate (build/type-check), update spec `[ ]` → `[x]` (line-by-line edits, NEVER copy entire spec blocks as old_string)
109
+ 8b. **Agent Memory:** After agents return and spec is updated, write agent memory: `echo '{"agent_type":"{type}","wave":{N},"pipeline":"{spec-name}","summary":"{what agent did}","details":{...}}' | node .claude/scripts/memory-write.js` — one per agent. Skip if single-wave pipeline (no downstream agents to benefit).
109
110
  9. **REVIEW** — dispatch review agent for each affected subproject (reads guards + relevant skills, runs 7-category checklist: SOLID, Design System, Patterns, i18n, Integration, Build, Elegance). REJECTED → fix + re-review (max 2 loops)
110
111
  10. All passed + APPROVED → CLOSE flow inline (sync registry, move spec, cleanup state)
111
112
  11. Failed → max 2 retries, then STOP + report
@@ -1,244 +1,279 @@
1
- # /git - Git Operations
2
-
3
- > Commit, push, sync, PR, and deploy. Reads `mustard.json` for branch flow. Handles monorepo (submodules) and single repo automatically.
4
-
5
- ## Trigger
6
-
7
- `/git <action>`
8
-
9
- ## Actions
10
-
11
- | Action | Description |
12
- |--------|-------------|
13
- | `sync` | Pull parent branch into current branch |
14
- | `commit` | Create commit (no push) |
15
- | `push` | Sync + commit + push to remote |
16
- | `merge` | Promote current parent (creates PR) |
17
- | `deploy` | Push + merge + inform about cascade |
18
-
19
- ## Configuration
20
-
21
- Reads `mustard.json` from the **project root**. If not found, falls back to defaults.
22
-
23
- ```json
24
- {
25
- "git": {
26
- "flow": {
27
- "dev_*": "dev",
28
- "dev": "main"
29
- },
30
- "provider": "github",
31
- "submodules": true
32
- }
33
- }
34
- ```
35
-
36
- ### Flow Resolution
37
-
38
- Match current branch against `flow` keys (glob patterns). First match wins.
39
-
40
- | Current branch | Pattern matched | Parent resolved |
41
- |---------------|----------------|-----------------|
42
- | `dev_rubens` | `dev_*` | `dev` |
43
- | `dev` | `dev` | `main` |
44
- | `feature/xyz` | no match | **error**: no parent configured |
45
-
46
- **Fallback** (no `mustard.json`): parent = default branch (`main` or `master`).
47
-
48
- ### Provider CLI
49
-
50
- | Provider | CLI | PR command |
51
- |----------|-----|------------|
52
- | `github` | `gh` | `gh pr create` |
53
- | `gitlab` | `glab` | `glab mr create` |
54
- | `bitbucket` | `bb` | `bb pr create` (manual) |
55
-
56
- ## Behavior
57
-
58
- - **ZERO confirmations** — analyze, execute, done. NEVER ask for approval.
59
- - **ZERO questions** — do NOT ask what to commit or whether to proceed.
60
- - **Minimize Bash calls** — chain EVERYTHING with `&&`. One Bash call per repo max.
61
- - **No investigation** — if a submodule is dirty, commit it.
62
- - Submodules BEFORE parent (always).
63
- - **Single repo**: skip all submodule steps — just operate on the root.
64
-
65
- ---
66
-
67
- ## Step 0 — Resolve Parent (all actions except commit)
68
-
69
- ```bash
70
- cat mustard.json 2>/dev/null
71
- git rev-parse --abbrev-ref HEAD
72
- ```
73
-
74
- Match the current branch against `git.flow` patterns. Store as `$PARENT`.
75
- If no match and no `mustard.json`: `$PARENT` = default branch (detect via `git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null || echo main`).
76
-
77
- Read `git.provider` from `mustard.json`. Fallback: read `git.pr.provider` (old format). Default: `github`.
78
-
79
- ---
80
-
81
- ## sync
82
-
83
- Pull the parent branch changes into the current branch.
84
-
85
- ### Single repo / Parent repo
86
-
87
- ```bash
88
- git fetch origin $PARENT && git rebase origin/$PARENT
89
- ```
90
-
91
- ### Monorepo — submodules FIRST (PARALLEL, one Bash call each)
92
-
93
- ```bash
94
- cd <SUBMODULE_ABSOLUTE_PATH> && git fetch origin $PARENT && git rebase origin/$PARENT
95
- ```
96
-
97
- Then parent repo (same command at root).
98
-
99
- If rebase has conflicts → abort rebase, report to user, STOP.
100
-
101
- ---
102
-
103
- ## commit
104
-
105
- ### 1. Analyze all changes (single parallel batch)
106
-
107
- Run in **one parallel batch**:
108
- - `git status`
109
- - `git submodule status` (skip if no `.gitmodules`)
110
- - `git diff`
111
- - `git log --oneline -5`
112
-
113
- ### 2. Commit dirty submodules (if any — monorepo only)
114
-
115
- Launch **ONE parallel Task agent per dirty submodule** (`model: "haiku"`). Each agent runs ONE chained Bash command:
116
-
117
- ```bash
118
- cd <SUBMODULE_ABSOLUTE_PATH> && git add -A && git diff --cached --stat && git commit -m "<message>"
119
- ```
120
-
121
- ### 3. Commit parent repo
122
-
123
- ```bash
124
- git add -A && git diff --cached --stat && git commit -m "<message>"
125
- ```
126
-
127
- ### Message Format
128
-
129
- ```
130
- <type>: <short description>
131
-
132
- <detailed description if needed>
133
-
134
- Co-Authored-By: Claude <noreply@anthropic.com>
135
- ```
136
-
137
- Types: feat, fix, refactor, docs, chore, test
138
-
139
- ---
140
-
141
- ## push
142
-
143
- Sequential: **sync first**, then commit + push.
144
-
145
- ### Phase 1 — Sync
146
-
147
- Execute `sync` action. If conflicts → STOP.
148
-
149
- ### Phase 2 — Commit & Push
150
-
151
- #### Submodules (PARALLEL — monorepo only, one Bash call each)
152
-
153
- ```bash
154
- cd <SUBMODULE_ABSOLUTE_PATH> && git add -A && git commit -m "<message>" && git push origin <branch>
155
- ```
156
-
157
- #### Parent / Root (ONE Bash call)
158
-
159
- ```bash
160
- git add -A && git commit -m "<message>" && git push origin <branch>
161
- ```
162
-
163
- ---
164
-
165
- ## merge
166
-
167
- Promote current branch into its parent via Pull Request.
168
-
169
- ### Step 1 — Ensure pushed
170
-
171
- Check if local is ahead of remote. If yes, execute `push` first.
172
-
173
- ### Step 2 — Create PR
174
-
175
- Create a Pull Request from current parent branch.
176
-
177
- #### GitHub (`gh`)
178
-
179
- ```bash
180
- gh pr create --base $PARENT --title "<title>" --body "<body>"
181
- ```
182
-
183
- #### GitLab (`glab`)
184
-
185
- ```bash
186
- glab mr create --target-branch $PARENT --title "<title>" --description "<body>"
187
- ```
188
-
189
- #### PR Title & Body
190
-
191
- - Title: conventional commit style `<type>: <short description>`
192
- - Body: auto-generated from commit log since divergence from parent:
193
-
194
- ```bash
195
- git log $PARENT..HEAD --oneline
196
- ```
197
-
198
- #### Monorepo Note
199
-
200
- PRs are created at the **parent repo level only**. Submodules are committed and pushed, but PRs are not created per submodule (submodules follow parent via ref update).
201
-
202
- After PR is created, output:
203
-
204
- > PR created: {url}. Run /review to review it.
205
-
206
- ---
207
-
208
- ## deploy
209
-
210
- Sequential phases. Each phase must complete before the next.
211
-
212
- ### Phase 1 — Push
213
-
214
- Execute `push` action (includes sync).
215
-
216
- ### Phase 2 — Merge to parent
217
-
218
- Execute `merge` action (current → parent).
219
-
220
- ### Phase 3 — Cascade (if parent ≠ production)
221
-
222
- If `$PARENT` also has a parent in the flow (e.g., `dev` → `main`), inform the user:
223
-
224
- > PR created: `dev_rubens → dev`. To promote `dev → main`, switch to `dev` and run `/git deploy` again.
225
-
226
- Do NOT auto-cascade — each promotion is a deliberate decision.
227
-
228
- ---
229
-
230
- ## Cautions
231
-
232
- - Aborts if ANY repo has merge conflicts (sync or push)
233
- - Submodules BEFORE parent (in sync, push, and commit)
234
- - NEVER use `git add .` — use `git add -A` from the correct directory
235
- - If any operation fails, stop and report
236
- - PR creation requires the provider CLI to be installed and authenticated
237
-
238
- ## Performance Budget
239
-
240
- - **Max Task agents**: 1 per dirty submodule
241
- - **Max Bash calls per agent**: 1 (all commands chained)
242
- - **Max API calls total**: ≤ 12
243
-
244
- ULTRATHINK
1
+ # /git - Git Operations
2
+
3
+ > Commit, push, sync, PR, and deploy. Reads `mustard.json` for branch flow. Handles monorepo (submodules) and single repo automatically.
4
+
5
+ ## Trigger
6
+
7
+ `/git <action>`
8
+
9
+ ## Actions
10
+
11
+ | Action | Description |
12
+ |--------|-------------|
13
+ | `sync` | Pull parent branch into current branch |
14
+ | `commit` | Create commit (no push) |
15
+ | `push` | Commit + push to remote |
16
+ | `merge` | Push + cascade PRs to parent (dev_rubens → dev) |
17
+ | `merge main` | Cascade PRs from dev main (explicit, when ready) |
18
+
19
+ ## Configuration
20
+
21
+ Reads `mustard.json` from the **project root**. If not found, falls back to defaults.
22
+
23
+ ```json
24
+ {
25
+ "git": {
26
+ "flow": {
27
+ "dev_*": "dev",
28
+ "dev": "main"
29
+ },
30
+ "provider": "github",
31
+ "submodules": true
32
+ }
33
+ }
34
+ ```
35
+
36
+ ### Flow Resolution
37
+
38
+ Match current branch against `flow` keys (glob patterns). First match wins.
39
+
40
+ | Current branch | Pattern matched | Parent resolved |
41
+ |---------------|----------------|-----------------|
42
+ | `dev_rubens` | `dev_*` | `dev` |
43
+ | `dev` | `dev` | `main` |
44
+ | `feature/xyz` | no match | **error**: no parent configured |
45
+
46
+ **Fallback** (no `mustard.json`): parent = default branch (`main` or `master`).
47
+
48
+ ### Provider CLI
49
+
50
+ | Provider | CLI | PR command |
51
+ |----------|-----|------------|
52
+ | `github` | `gh` | `gh pr create` |
53
+ | `gitlab` | `glab` | `glab mr create` |
54
+ | `bitbucket` | `bb` | `bb pr create` (manual) |
55
+
56
+ ## Behavior
57
+
58
+ - **ZERO confirmations** — analyze, execute, done. NEVER ask for approval.
59
+ - **ZERO questions** — do NOT ask what to commit or whether to proceed.
60
+ - **Minimize Bash calls** — chain EVERYTHING with `&&`. One Bash call per repo max.
61
+ - **No investigation** — if a submodule is dirty, commit it.
62
+ - Submodules BEFORE parent (always).
63
+ - **Single repo**: skip all submodule steps — just operate on the root.
64
+
65
+ ---
66
+
67
+ ## Step 0 — Resolve Parent (all actions except commit)
68
+
69
+ ```bash
70
+ cat mustard.json 2>/dev/null
71
+ git rev-parse --abbrev-ref HEAD
72
+ ```
73
+
74
+ Match the current branch against `git.flow` patterns. Store as `$PARENT`.
75
+ If no match and no `mustard.json`: `$PARENT` = default branch (detect via `git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null || echo main`).
76
+
77
+ Read `git.provider` from `mustard.json`. Fallback: read `git.pr.provider` (old format). Default: `github`.
78
+
79
+ ---
80
+
81
+ ## sync
82
+
83
+ Pull the parent branch changes into the current branch.
84
+
85
+ ### Single repo / Parent repo
86
+
87
+ ```bash
88
+ git fetch origin $PARENT && git rebase origin/$PARENT
89
+ ```
90
+
91
+ ### Monorepo — submodules FIRST (PARALLEL, one Bash call each)
92
+
93
+ ```bash
94
+ cd <SUBMODULE_ABSOLUTE_PATH> && git fetch origin $PARENT && git rebase origin/$PARENT
95
+ ```
96
+
97
+ Then parent repo (same command at root).
98
+
99
+ If rebase has conflicts → abort rebase, report to user, STOP.
100
+
101
+ ---
102
+
103
+ ## commit
104
+
105
+ ### 1. Analyze all changes (single parallel batch)
106
+
107
+ Run in **one parallel batch**:
108
+ - `git status`
109
+ - `git submodule status` (skip if no `.gitmodules`)
110
+ - `git diff`
111
+ - `git log --oneline -5`
112
+
113
+ ### 2. Commit dirty submodules (if any — monorepo only)
114
+
115
+ Launch **ONE parallel Task agent per dirty submodule** (`model: "haiku"`). Each agent runs ONE chained Bash command:
116
+
117
+ ```bash
118
+ cd <SUBMODULE_ABSOLUTE_PATH> && git add -A && git diff --cached --stat && git commit -m "<message>"
119
+ ```
120
+
121
+ ### 3. Commit parent repo
122
+
123
+ ```bash
124
+ git add -A && git diff --cached --stat && git commit -m "<message>"
125
+ ```
126
+
127
+ ### Message Format
128
+
129
+ ```
130
+ <type>: <short description>
131
+
132
+ <detailed description if needed>
133
+
134
+ Co-Authored-By: Claude <noreply@anthropic.com>
135
+ ```
136
+
137
+ Types: feat, fix, refactor, docs, chore, test
138
+
139
+ ---
140
+
141
+ ## push
142
+
143
+ Sequential: **sync first**, then commit + push.
144
+
145
+ ### Phase 1 — Sync
146
+
147
+ Execute `sync` action. If conflicts → STOP.
148
+
149
+ ### Phase 2 — Commit & Push
150
+
151
+ #### Submodules (PARALLEL — monorepo only, one Bash call each)
152
+
153
+ ```bash
154
+ cd <SUBMODULE_ABSOLUTE_PATH> && git add -A && git commit -m "<message>" && git push origin <branch>
155
+ ```
156
+
157
+ #### Parent / Root (ONE Bash call)
158
+
159
+ ```bash
160
+ git add -A && git commit -m "<message>" && git push origin <branch>
161
+ ```
162
+
163
+ ---
164
+
165
+ ## merge
166
+
167
+ Promote current branch into its parent via Pull Request — **recursively through the entire flow chain**, including all submodules.
168
+
169
+ ### Step 1 — Ensure pushed
170
+
171
+ Check if local is ahead of remote. If yes, execute `push` first.
172
+
173
+ ### Step 2 — Cascade merge (recursive)
174
+
175
+ Resolve the **full flow chain** from the current branch to the terminal branch (the one with no parent in the flow). Example: `dev_rubens` → `dev` → `main` = 2 hops.
176
+
177
+ **For each hop** (e.g., first `dev_rubens → dev`, then `dev → main`):
178
+
179
+ #### 2a. Submodules FIRST (PARALLEL — monorepo only)
180
+
181
+ For each submodule that has commits ahead of `$TARGET`:
182
+
183
+ ```bash
184
+ cd <SUBMODULE_ABSOLUTE_PATH> && git fetch origin && git log origin/$TARGET..origin/$SOURCE --oneline
185
+ ```
186
+
187
+ If commits exist, create PR and merge immediately:
188
+
189
+ ```bash
190
+ # GitHub
191
+ cd <SUBMODULE_ABSOLUTE_PATH> && gh pr create --head $SOURCE --base $TARGET --title "<title>" --body "<body>"
192
+ cd <SUBMODULE_ABSOLUTE_PATH> && gh pr merge --merge
193
+ ```
194
+
195
+ ```bash
196
+ # GitLab
197
+ cd <SUBMODULE_ABSOLUTE_PATH> && glab mr create --source-branch $SOURCE --target-branch $TARGET --title "<title>" --description "<body>" --remove-source-branch=false
198
+ cd <SUBMODULE_ABSOLUTE_PATH> && glab mr merge
199
+ ```
200
+
201
+ Skip submodules with no commits ahead (nothing to merge).
202
+
203
+ #### 2b. Parent repo
204
+
205
+ Same as submodules — create PR + merge for this hop:
206
+
207
+ ```bash
208
+ # GitHub
209
+ gh pr create --head $SOURCE --base $TARGET --title "<title>" --body "<body>"
210
+ gh pr merge --merge
211
+ ```
212
+
213
+ #### 2c. Next hop
214
+
215
+ After all PRs are merged for this hop, advance to the next hop in the chain. Repeat 2a–2b.
216
+
217
+ **Auto-merge stops at the first parent** (e.g., `dev_rubens → dev`). The final promotion to the terminal branch (e.g., `dev → main`) is **never automatic** — it requires a separate explicit `/git merge main` call.
218
+
219
+ ### PR Title & Body
220
+
221
+ - Title: conventional commit style — `<type>: <short description>`
222
+ - Body: auto-generated from commit log since divergence:
223
+
224
+ ```bash
225
+ git log $TARGET..$SOURCE --oneline
226
+ ```
227
+
228
+ ### Example: `/git merge` from `dev_rubens`
229
+
230
+ ```
231
+ dev_rubens → dev (auto)
232
+ ├── Competi.Backend: PR #N created + merged
233
+ ├── Competi.Frontend: PR #N created + merged
234
+ ├── Competi.Libs: PR #N created + merged
235
+ ├── Competi.Admin: (skipped no commits ahead)
236
+ └── Competi.CRM: PR #N created + merged
237
+ ```
238
+
239
+ ### Example: `/git merge main` (explicit — when ready for production)
240
+
241
+ ```
242
+ dev main
243
+ ├── Competi.Backend: PR #N created + merged
244
+ ├── Competi.Frontend: PR #N created + merged
245
+ ├── Competi.Libs: PR #N created + merged
246
+ └── Competi.CRM: PR #N created + merged
247
+ ```
248
+
249
+ ### Output
250
+
251
+ Print a summary table at the end:
252
+
253
+ ```
254
+ | Repo | Status |
255
+ |-----------------|-----------------|
256
+ | Backend | PR #1 merged |
257
+ | Frontend | PR #1 merged |
258
+ | Libs | PR #1 merged |
259
+ | Admin | skipped |
260
+ | CRM (parent) | PR #3 merged |
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Cautions
266
+
267
+ - Aborts if ANY repo has merge conflicts (sync or push)
268
+ - Submodules BEFORE parent (in sync, push, and commit)
269
+ - NEVER use `git add .` — use `git add -A` from the correct directory
270
+ - If any operation fails, stop and report
271
+ - PR creation requires the provider CLI to be installed and authenticated
272
+
273
+ ## Performance Budget
274
+
275
+ - **Max Task agents**: 1 per dirty submodule
276
+ - **Max Bash calls per agent**: 1 (all commands chained)
277
+ - **Max API calls total**: ≤ 12
278
+
279
+ ULTRATHINK
@@ -72,6 +72,12 @@ Resumes an interrupted pipeline. The main context BECOMES the Pipeline Runner
72
72
 
73
73
  17. **Dispatch:** TaskUpdate(in_progress) + pipeline state. ALL agents in same wave → SINGLE message (multiple Task invocations). **Pass `model` from pipeline state** (e.g. `model: "opus"`) in each Task tool call — this overrides the agent YAML default. On return: pipeline state update, spec `[ ]` → `[x]` (use `replace_all` per section header, or line-by-line — NEVER copy entire spec blocks as old_string), TaskUpdate(completed), advance wave.
74
74
 
75
+ 17b. **Agent Memory:** After each wave completes and spec checkboxes are updated, write agent memories for downstream waves:
76
+ ```bash
77
+ echo '{"agent_type":"{agent_type}","wave":{N},"pipeline":"{spec-name}","summary":"{1-line summary of what agent did}","details":{"files_modified":[...],"decisions":[...]}}' | node .claude/scripts/memory-write.js
78
+ ```
79
+ One call per agent in the completed wave. Summary ≤300 chars (key facts: files created, patterns used, endpoints added). Skip if no downstream waves remain.
80
+
75
81
  ### Step 4: Validate, Review & Complete
76
82
 
77
83
  18. **VALIDATE** — Parse agent results: Backend→`dotnet build`, Frontend→`pnpm build`, Mobile→`fvm flutter analyze`. All passed → next. Failed → **granular retry** (see below).