squad-bmad 1.2.0
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/README.md +141 -0
- package/README.vi.md +139 -0
- package/bin/cli.js +276 -0
- package/package.json +34 -0
- package/template/.claude/hooks/notify-gemini.sh +26 -0
- package/template/.claude/hooks/wakeup-gemini.sh +42 -0
- package/template/.gemini/commands/withClaudeCodeTmux.toml +90 -0
- package/template/.gemini/commands/withClaudeCodeTmux.vi.toml +91 -0
- package/template/.gemini/scripts/setup-sessions.sh +93 -0
- package/template/.gemini/scripts/tmux-send.sh +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Squad BMAD: Automated Project Orchestration Assistant with Gemini & Claude Code
|
|
2
|
+
|
|
3
|
+
[](CHANGELOG.md)
|
|
4
|
+
[](https://www.npmjs.com/package/squad-bmad)
|
|
5
|
+
|
|
6
|
+
*Read this in other languages: [English](README.md), [TiαΊΏng Viα»t](README.vi.md).*
|
|
7
|
+
|
|
8
|
+
Welcome to **Squad BMAD** β a boilerplate/design solution to transform **Gemini CLI** into a true **Project Manager & Principal Tech Lead**. By combining Gemini's orchestration power with **Claude Code's** excellent coding and reasoning capabilities via **Tmux**, this project automates and optimizes the software development workflow based on the **BMAD** methodology.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## π Benefits
|
|
13
|
+
|
|
14
|
+
The BMAD (Build-Measure-Analyze-Deploy) methodology is known for maintaining strictness, clear structure, and being strongly **spec-driven**. However, its biggest drawback is that the operation process requires many steps and manual actions.
|
|
15
|
+
|
|
16
|
+
**Squad BMAD completely solves this problem:**
|
|
17
|
+
- **Seamless Automation:** Makes operating a project with the BMAD method smooth and continuous without requiring your intervention in every small step.
|
|
18
|
+
- **An Indefatigable Project Assistant:** This assistant will help you answer and handle BMAD steps, automatically operating and implementing all Epics and Stories.
|
|
19
|
+
- **Focus on Core Value:** You only need to talk to the Assistant (Gemini), make high-level decisions, and the Assistant will automatically delegate tasks and monitor the other Agents (Claude Code).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## π System Requirements
|
|
24
|
+
|
|
25
|
+
To run this system smoothly, you need to prepare:
|
|
26
|
+
|
|
27
|
+
- **Claude Code Account:** Required to launch the Execution (Implement) and Reasoning (Brainstorm) Agents.
|
|
28
|
+
- **Gemini Account (Gemini CLI):** Acts as the "Orchestrator" coordinating the entire workflow.
|
|
29
|
+
- **Tmux Environment:** Installed on your machine (MacOS/Linux) to manage multi-threaded work sessions.
|
|
30
|
+
- **Experience:** Have used or possess a basic understanding of the **BMAD** method.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## π§ Core Philosophy
|
|
35
|
+
|
|
36
|
+
Squad BMAD is built on immutable principles:
|
|
37
|
+
|
|
38
|
+
1. **Strict Adherence to BMAD Processes:** All tasks from ideation, writing specifications, to coding and reviewing strictly follow BMAD's workflows. This ensures the project always stays on track and technical documentation is always synchronized with the actual code.
|
|
39
|
+
2. **Fresh Chat & Context Isolation:** Before starting a new workflow, the system must clear the context (by sending the `/clear` command). This prevents the AI (Claude) from hallucinating due to carrying too much old information, keeping its reasoning sharp.
|
|
40
|
+
3. **Clear Agent Roles:** Applying the true spirit of BMAD, the system divides Agents into specialized "personas" (PM, Architect, Dev, QA) to optimize the performance of each AI Model.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## βοΈ System Architecture & Operation
|
|
45
|
+
|
|
46
|
+
The system operates based on the smooth coordination of **3 Tmux sessions**:
|
|
47
|
+
|
|
48
|
+
1. **Session 1: Gemini Orchestrator**
|
|
49
|
+
- The master operating the other 2 tmux sessions.
|
|
50
|
+
- Communicates directly with you, understands requirements, and maps them to BMAD workflows.
|
|
51
|
+
- Monitors, accepts the results, and makes transition decisions.
|
|
52
|
+
|
|
53
|
+
2. **Session 2: Claude Code - Implement**
|
|
54
|
+
- Acts as a **Developer**.
|
|
55
|
+
- Specialized in writing code, fixing bugs, and running tests.
|
|
56
|
+
- Uses the **Claude Sonnet** model to ensure fast speed, excellent coding, and cost savings.
|
|
57
|
+
|
|
58
|
+
3. **Session 3: Claude Code - Brainstorm**
|
|
59
|
+
- Acts as an **Architect / PM / QA**.
|
|
60
|
+
- Specialized in reasoning about architecture, solving complex problems, designing systems, and reviewing code.
|
|
61
|
+
- Uses the **Claude Opus** model for tasks requiring deep logical thinking.
|
|
62
|
+
|
|
63
|
+
### π Event-Driven System with Hooks
|
|
64
|
+
|
|
65
|
+
Instead of Gemini having to constantly poll the screen to see if Claude Code is done, this project uses an **Event-driven Hooks** mechanism via the `.claude/settings.json` file.
|
|
66
|
+
|
|
67
|
+
Whenever Claude Code (in tmux 2 or 3) completes a task or needs to stop, the system automatically triggers a bash script (like `.claude/hooks/wakeup-gemini.sh`). This script immediately sends a signal back to Gemini's Tmux Session, "waking up" Gemini to:
|
|
68
|
+
1. Read the work results.
|
|
69
|
+
2. Evaluate and accept the source code.
|
|
70
|
+
3. Report back to you or automatically proceed to the next step according to the BMAD process.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## π Workflow Summary
|
|
75
|
+
|
|
76
|
+
1. You open 3 Tmux sessions (1 for Gemini, 2 for Claude Code).
|
|
77
|
+
2. You chat with Gemini: *"Please implement Story #123 for me."*
|
|
78
|
+
3. Gemini receives the command, analyzes it according to the BMAD workflow, and sends the command (along with `/clear` to reset context) to `Claude Code - Implement` via a secure shell script.
|
|
79
|
+
4. Gemini goes into an "Idle" state, waiting.
|
|
80
|
+
5. `Claude Code - Implement` busily writes code. When done, it automatically triggers the Hook.
|
|
81
|
+
6. The Hook runs the bash script, sending an `Enter` keystroke and a notification message to Gemini's screen.
|
|
82
|
+
7. Gemini "wakes up", reads Claude Code's screen log, accepts the results, and reports back to you.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
With **Squad BMAD**, you are no longer a coder painstakingly typing every line of code; you are a true **Project Manager** commanding an elite AI squad!
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## π Setup & Usage
|
|
91
|
+
|
|
92
|
+
### 1. Install Squad BMAD
|
|
93
|
+
|
|
94
|
+
From your project directory, run:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx squad-bmad install
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
This will:
|
|
101
|
+
- Copy hook scripts, tmux utilities, and Gemini slash commands into your project.
|
|
102
|
+
- Automatically configure `.claude/settings.json` with the required hooks (or print instructions if you already have a custom hooks section).
|
|
103
|
+
- Remind you to install the BMAD Method (`npx bmad-method install`) if it's not already present.
|
|
104
|
+
|
|
105
|
+
> **Upgrading?** Run `npx squad-bmad upgrade` to overwrite existing files with the latest version.
|
|
106
|
+
|
|
107
|
+
### 2. Prepare the Tmux Environment
|
|
108
|
+
|
|
109
|
+
All 3 sessions follow a **project-aware naming convention** based on your folder name. Run the setup script from your project directory:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
bash .gemini/scripts/setup-sessions.sh
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
This will automatically create (or skip if already existing):
|
|
116
|
+
- `gemini-orchestrator-<folder>` β launches `gemini --yolo --model gemini-3-pro-preview`
|
|
117
|
+
- `claude-implement-<folder>` β launches `claude --dangerously-skip-permissions --model sonnet`
|
|
118
|
+
- `claude-brainstorm-<folder>` β launches `claude --dangerously-skip-permissions --model opus`
|
|
119
|
+
|
|
120
|
+
### 3. Start Gemini Orchestrator
|
|
121
|
+
|
|
122
|
+
Attach to the Gemini session for your project:
|
|
123
|
+
```bash
|
|
124
|
+
tmux attach -t gemini-orchestrator-<folder>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 4. Run the Slash Command
|
|
128
|
+
|
|
129
|
+
Inside Gemini, run the slash command β **no arguments needed**. Gemini will auto-detect the project folder and verify all sessions:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
/withClaudeCodeTmux
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 5. Start Working
|
|
136
|
+
The system is now ready. You simply communicate with Gemini like a project manager:
|
|
137
|
+
- *"Start this project for me using the generate-project-context flow."*
|
|
138
|
+
- *"Which Epic are we in? Create a new story for the login feature."*
|
|
139
|
+
- *"Implement Story #5 according to the dev-story process."*
|
|
140
|
+
|
|
141
|
+
Gemini will automatically analyze, clear the context (send `/clear`), route the command to the appropriate Claude session, and will automatically "wake up" to accept the work when it receives the Hook feedback signal from Claude.
|
package/README.vi.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Squad BMAD: Trợ LΓ½ αΊ’o Δiα»u Phα»i Dα»± Γn Tα»± Δα»ng Vα»i Gemini & Claude Code
|
|
2
|
+
|
|
3
|
+
[](CHANGELOG.md)
|
|
4
|
+
[](https://www.npmjs.com/package/squad-bmad)
|
|
5
|
+
|
|
6
|
+
ChΓ o mα»«ng bαΊ‘n ΔαΊΏn vα»i **Squad BMAD** β mα»t boilerplate/giαΊ£i phΓ‘p thiαΊΏt kαΊΏ Δα» biαΊΏn **Gemini CLI** trα» thΓ nh mα»t **Project Manager & Principal Tech Lead** thα»±c thα»₯. BαΊ±ng cΓ‘ch kαΊΏt hợp sα»©c mαΊ‘nh Δiα»u phα»i cα»§a Gemini vΓ khαΊ£ nΔng lαΊp trΓ¬nh/suy luαΊn xuαΊ₯t sαΊ―c cα»§a **Claude Code** thΓ΄ng qua mΓ΄i trΖ°α»ng **Tmux**, dα»± Γ‘n nΓ y tα»± Δα»ng hΓ³a vΓ tα»i Ζ°u hΓ³a luα»ng cΓ΄ng viα»c phΓ‘t triα»n phαΊ§n mα»m dα»±a trΓͺn nα»n tαΊ£ng phΖ°Ζ‘ng phΓ‘p luαΊn **BMAD**.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## π Lợi Γch Δem LαΊ‘i
|
|
11
|
+
|
|
12
|
+
PhΖ°Ζ‘ng phΓ‘p luαΊn BMAD (Build-Measure-Analyze-Deploy) nα»i tiαΊΏng vα»i khαΊ£ nΔng duy trΓ¬ tΓnh chαΊ·t chαΊ½, cαΊ₯u trΓΊc rΓ΅ rΓ ng vΓ luΓ΄n hΖ°α»ng tα»i **spec-driven** (lΓ m viα»c dα»±a trΓͺn ΔαΊ·c tαΊ£ kα»Ή thuαΊt). Tuy nhiΓͺn, nhược Δiα»m lα»n nhαΊ₯t lΓ quΓ‘ trΓ¬nh vαΊn hΓ nh tα»n khΓ‘ nhiα»u bΖ°α»c vΓ thao tΓ‘c thα»§ cΓ΄ng.
|
|
13
|
+
|
|
14
|
+
**Squad BMAD giαΊ£i quyαΊΏt triα»t Δα» vαΊ₯n Δα» ΔΓ³:**
|
|
15
|
+
- **Tα»± Δα»ng hΓ³a xuyΓͺn suα»t:** GiΓΊp quΓ‘ trΓ¬nh vαΊn hΓ nh project vα»i phΖ°Ζ‘ng phΓ‘p BMAD diα»
n ra trΖ‘n tru, liα»n mαΊ‘ch mΓ khΓ΄ng cαΊ§n bαΊ‘n phαΊ£i can thiα»p vΓ o tα»«ng bΖ°α»c nhα».
|
|
16
|
+
- **CΓ³ ngay mα»t trợ lΓ½ dα»± Γ‘n mαΊ«n cΓ‘n:** Trợ lΓ½ nΓ y sαΊ½ giΓΊp bαΊ‘n trαΊ£ lα»i, xα» lΓ½ cΓ‘c step cα»§a BMAD, tα»± Δα»ng vαΊn hΓ nh vΓ implement toΓ n bα» Epics, Stories.
|
|
17
|
+
- **TαΊp trung vΓ o giΓ‘ trα» cα»t lΓ΅i:** BαΊ‘n chα» cαΊ§n nΓ³i chuyα»n vα»i Trợ lΓ½ (Gemini), ΔΖ°a ra quyαΊΏt Δα»nh α» tαΊ§m cao, phαΊ§n cΓ²n lαΊ‘i Trợ lΓ½ sαΊ½ tα»± Δα»ng giao viα»c vΓ giΓ‘m sΓ‘t cΓ‘c Agent khΓ‘c (Claude Code).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## π YΓͺu CαΊ§u Hα» Thα»ng (Requirements)
|
|
22
|
+
|
|
23
|
+
Δα» vαΊn hΓ nh trΖ‘n tru hα» thα»ng nΓ y, bαΊ‘n cαΊ§n chuαΊ©n bα»:
|
|
24
|
+
|
|
25
|
+
- **TΓ i khoαΊ£n Claude Code:** CαΊ§n thiαΊΏt Δα» khα»i chαΊ‘y cΓ‘c Agent thα»±c thi (Implement) vΓ tΖ° duy (Brainstorm).
|
|
26
|
+
- **TΓ i khoαΊ£n Gemini (Gemini CLI):** ΔΓ³ng vai trΓ² lΓ "NhαΊ‘c trΖ°α»ng" Δiα»u phα»i toΓ n bα» luα»ng cΓ΄ng viα»c.
|
|
27
|
+
- **MΓ΄i trΖ°α»ng Tmux:** Δược cΓ i ΔαΊ·t sαΊ΅n trΓͺn mΓ‘y tΓnh (MacOS/Linux) Δα» quαΊ£n lΓ½ Δa luα»ng phiΓͺn lΓ m viα»c.
|
|
28
|
+
- **Kinh nghiα»m:** ΔΓ£ tα»«ng sα» dα»₯ng hoαΊ·c cΓ³ kiαΊΏn thα»©c nα»n tαΊ£ng vα» phΖ°Ζ‘ng phΓ‘p **BMAD**.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## π§ Hα» TΖ° TΖ°α»ng Cα»t LΓ΅i
|
|
33
|
+
|
|
34
|
+
Squad BMAD Δược xΓ’y dα»±ng dα»±a trΓͺn cΓ‘c nguyΓͺn tαΊ―c bαΊ₯t di bαΊ₯t dα»ch:
|
|
35
|
+
|
|
36
|
+
1. **BΓ‘m sΓ‘t quy trΓ¬nh BMAD:** Mα»i tΓ‘c vα»₯ tα»« lΓͺn Γ½ tΖ°α»ng, viαΊΏt ΔαΊ·c tαΊ£, ΔαΊΏn code vΓ review Δα»u tuΓ’n thα»§ nghiΓͺm ngαΊ·t cΓ‘c workflow cα»§a BMAD. Δiα»u nΓ y ΔαΊ£m bαΊ£o dα»± Γ‘n luΓ΄n Δi ΔΓΊng hΖ°α»ng vΓ tΓ i liα»u kα»Ή thuαΊt luΓ΄n Δα»ng bα» vα»i code thα»±c tαΊΏ.
|
|
37
|
+
2. **Fresh Chat & Context Isolation (CΓ‘ch ly Ngα»― cαΊ£nh):** TrΖ°α»c khi bαΊ―t ΔαΊ§u mα»t workflow mα»i, hα» thα»ng bαΊ―t buα»c phαΊ£i dα»n dαΊΉp ngα»― cαΊ£nh (gα»i lα»nh `/clear`). Viα»c nΓ y giΓΊp AI (Claude) khΓ΄ng bα» αΊ£o giΓ‘c (hallucination) do Γ΄m Δα»m quΓ‘ nhiα»u thΓ΄ng tin cΕ©, giα»― cho suy luαΊn luΓ΄n sαΊ―c bΓ©n.
|
|
38
|
+
3. **PhΓ’n chia vai trΓ² rΓ΅ rΓ ng (Agent Roles):** Γp dα»₯ng ΔΓΊng tinh thαΊ§n cα»§a BMAD, hα» thα»ng chia cΓ‘c Agent thΓ nh cΓ‘c "persona" chuyΓͺn biα»t (PM, Architect, Dev, QA) Δα» tα»i Ζ°u hΓ³a hiα»u suαΊ₯t cα»§a tα»«ng Model AI.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## βοΈ KiαΊΏn TrΓΊc Hα» Thα»ng & CΓ‘ch VαΊn HΓ nh
|
|
43
|
+
|
|
44
|
+
Hα» thα»ng hoαΊ‘t Δα»ng dα»±a trΓͺn sα»± phα»i hợp nhα»p nhΓ ng cα»§a **3 phiΓͺn lΓ m viα»c (sessions) Tmux**:
|
|
45
|
+
|
|
46
|
+
1. **Session 1: Gemini Orchestrator (NhαΊ‘c trΖ°α»ng)**
|
|
47
|
+
- LΓ ngΖ°α»i chα»§ vαΊn hΓ nh 2 tmux cΓ²n lαΊ‘i.
|
|
48
|
+
- Giao tiαΊΏp trα»±c tiαΊΏp vα»i bαΊ‘n, hiα»u yΓͺu cαΊ§u, Γ‘nh xαΊ‘ vΓ o workflow cα»§a BMAD.
|
|
49
|
+
- Theo dΓ΅i, nghiα»m thu kαΊΏt quαΊ£ vΓ ra quyαΊΏt Δα»nh chuyα»n tiαΊΏp.
|
|
50
|
+
|
|
51
|
+
2. **Session 2: Claude Code - Implement (Thα»±c thi)**
|
|
52
|
+
- ΔΓ³ng vai trΓ² lΓ mα»t **Developer**.
|
|
53
|
+
- ChuyΓͺn dΓΉng Δα» viαΊΏt code, sα»a lα»i, chαΊ‘y test.
|
|
54
|
+
- Sα» dα»₯ng model **Claude Sonnet** Δα» ΔαΊ£m bαΊ£o tα»c Δα» nhanh, code giα»i vΓ tiαΊΏt kiα»m chi phΓ.
|
|
55
|
+
|
|
56
|
+
3. **Session 3: Claude Code - Brainstorm (Suy luαΊn)**
|
|
57
|
+
- ΔΓ³ng vai trΓ² lΓ **Architect / PM / QA**.
|
|
58
|
+
- ChuyΓͺn dΓΉng Δα» suy luαΊn kiαΊΏn trΓΊc, giαΊ£i quyαΊΏt cΓ‘c bΓ i toΓ‘n phα»©c tαΊ‘p, thiαΊΏt kαΊΏ hα» thα»ng vΓ review code.
|
|
59
|
+
- Sα» dα»₯ng model **Claude Opus** cho cΓ‘c tΓ‘c vα»₯ cαΊ§n tΖ° duy logic sΓ’u.
|
|
60
|
+
|
|
61
|
+
### π Hα» Thα»ng Event-Driven bαΊ±ng Hooks
|
|
62
|
+
|
|
63
|
+
Thay vΓ¬ Δα» Gemini phαΊ£i liΓͺn tα»₯c kiα»m tra mΓ n hΓ¬nh xem Claude Code ΔΓ£ lΓ m xong chΖ°a (polling), dα»± Γ‘n nΓ y sα» dα»₯ng cΖ‘ chαΊΏ **Hooks Event-driven** thΓ΄ng qua file `.claude/settings.json`.
|
|
64
|
+
|
|
65
|
+
Mα»i khi Claude Code (α» tmux 2 hoαΊ·c 3) hoΓ n thΓ nh cΓ΄ng viα»c hoαΊ·c cαΊ§n dα»«ng lαΊ‘i, hα» thα»ng sαΊ½ tα»± Δα»ng kΓch hoαΊ‘t mα»t bash script (nhΖ° `.claude/hooks/wakeup-gemini.sh`). Script nΓ y sαΊ½ lαΊp tα»©c gα»i tΓn hiα»u ngược lαΊ‘i cho Session Tmux cα»§a Gemini, "ΔΓ‘nh thα»©c" Gemini dαΊy Δα»:
|
|
66
|
+
1. Δα»c kαΊΏt quαΊ£ cΓ΄ng viα»c.
|
|
67
|
+
2. ΔΓ‘nh giΓ‘ vΓ nghiα»m thu mΓ£ nguα»n.
|
|
68
|
+
3. BΓ‘o cΓ‘o lαΊ‘i cho bαΊ‘n hoαΊ·c tα»± Δα»ng Δi tiαΊΏp bΖ°α»c tiαΊΏp theo theo quy trΓ¬nh BMAD.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## π TΓ³m TαΊ―t Quy TrΓ¬nh HoαΊ‘t Δα»ng
|
|
73
|
+
|
|
74
|
+
1. BαΊ‘n mα» 3 session Tmux (1 cho Gemini, 2 cho Claude Code).
|
|
75
|
+
2. BαΊ‘n chat vα»i Gemini: *"HΓ£y implement Story #123 cho tΓ΄i."*
|
|
76
|
+
3. Gemini nhαΊn lα»nh, phΓ’n tΓch theo workflow BMAD vΓ gα»i lα»nh (kΓ¨m `/clear` Δα» reset context) sang cho `Claude Code - Implement` thΓ΄ng qua shell script an toΓ n.
|
|
77
|
+
4. Gemini rΖ‘i vΓ o trαΊ‘ng thΓ‘i "Idle" (nghα» ngΖ‘i), chα» Δợi.
|
|
78
|
+
5. `Claude Code - Implement` hΓ¬ hα»₯c viαΊΏt code. Khi xong, nΓ³ tα»± Δα»ng kΓch hoαΊ‘t Hook.
|
|
79
|
+
6. Hook chαΊ‘y bash script, gα»i phΓm `Enter` vΓ dΓ²ng thΓ΄ng bΓ‘o sang mΓ n hΓ¬nh cα»§a Gemini.
|
|
80
|
+
7. Gemini "tα»nh giαΊ₯c", Δα»c log mΓ n hΓ¬nh cα»§a Claude Code, nghiα»m thu kαΊΏt quαΊ£ vΓ bΓ‘o cΓ‘o lαΊ‘i cho bαΊ‘n.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
Vα»i **Squad BMAD**, bαΊ‘n khΓ΄ng cΓ²n lΓ mα»t coder cαΊ·m cα»₯i gΓ΅ tα»«ng dΓ²ng lα»nh, bαΊ‘n lΓ mα»t **NgΖ°α»i quαΊ£n lΓ½ dα»± Γ‘n** thα»±c thα»₯ Δiα»u hΓ nh mα»t Δα»i ngΕ© AI tinh nhuα»!
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## π CΓ‘ch CΓ i ΔαΊ·t & Sα» Dα»₯ng (How to use)
|
|
89
|
+
|
|
90
|
+
### 1. CΓ i ΔαΊ·t Squad BMAD
|
|
91
|
+
|
|
92
|
+
Tα»« thΖ° mα»₯c dα»± Γ‘n cα»§a bαΊ‘n, chαΊ‘y:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npx squad-bmad install
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Lα»nh nΓ y sαΊ½:
|
|
99
|
+
- Sao chΓ©p cΓ‘c hook script, tiα»n Γch tmux, vΓ Gemini slash command vΓ o dα»± Γ‘n cα»§a bαΊ‘n.
|
|
100
|
+
- Tα»± Δα»ng cαΊ₯u hΓ¬nh `.claude/settings.json` vα»i cΓ‘c hooks cαΊ§n thiαΊΏt (hoαΊ·c in hΖ°α»ng dαΊ«n nαΊΏu bαΊ‘n ΔΓ£ cΓ³ phαΊ§n hooks tΓΉy chα»nh).
|
|
101
|
+
- NhαΊ―c bαΊ‘n cΓ i ΔαΊ·t BMAD Method (`npx bmad-method install`) nαΊΏu chΖ°a cΓ³.
|
|
102
|
+
|
|
103
|
+
> **NΓ’ng cαΊ₯p?** ChαΊ‘y `npx squad-bmad upgrade` Δα» ghi ΔΓ¨ cΓ‘c file hiα»n cΓ³ bαΊ±ng phiΓͺn bαΊ£n mα»i nhαΊ₯t.
|
|
104
|
+
|
|
105
|
+
### 2. ChuαΊ©n Bα» MΓ΄i TrΖ°α»ng Tmux
|
|
106
|
+
|
|
107
|
+
TαΊ₯t cαΊ£ 3 sessions Δα»u Δược tαΊ‘o tα»± Δα»ng theo **quy chuαΊ©n ΔαΊ·t tΓͺn dα»±a trΓͺn tΓͺn folder dα»± Γ‘n**. ChαΊ‘y script setup tα»« thΖ° mα»₯c dα»± Γ‘n:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
bash .gemini/scripts/setup-sessions.sh
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Script sαΊ½ tα»± Δα»ng tαΊ‘o (hoαΊ·c bα» qua nαΊΏu ΔΓ£ tα»n tαΊ‘i):
|
|
114
|
+
- `gemini-orchestrator-<folder>` β khα»i chαΊ‘y `gemini --yolo --model gemini-3-pro-preview`
|
|
115
|
+
- `claude-implement-<folder>` β khα»i chαΊ‘y `claude --dangerously-skip-permissions --model sonnet`
|
|
116
|
+
- `claude-brainstorm-<folder>` β khα»i chαΊ‘y `claude --dangerously-skip-permissions --model opus`
|
|
117
|
+
|
|
118
|
+
### 3. Truy cαΊp Gemini Orchestrator
|
|
119
|
+
|
|
120
|
+
Attach vΓ o session Gemini cα»§a dα»± Γ‘n:
|
|
121
|
+
```bash
|
|
122
|
+
tmux attach -t gemini-orchestrator-<folder>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 4. ChαΊ‘y Slash Command
|
|
126
|
+
|
|
127
|
+
Trong Gemini, gΓ΅ slash command β **khΓ΄ng cαΊ§n truyα»n argument**. Gemini sαΊ½ tα»± detect folder vΓ kiα»m tra cαΊ£ 3 sessions:
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
/withClaudeCodeTmux
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 5. BαΊ―t ΔαΊ§u CΓ΄ng Viα»c
|
|
134
|
+
Giα» ΔΓ’y hα» thα»ng ΔΓ£ sαΊ΅n sΓ ng. BαΊ‘n chα» viα»c giao tiαΊΏp vα»i Gemini nhΖ° mα»t ngΖ°α»i quαΊ£n lΓ½ dα»± Γ‘n:
|
|
135
|
+
- *"BαΊ―t ΔαΊ§u project nΓ y giΓΊp tΓ΄i bαΊ±ng luα»ng generate-project-context."*
|
|
136
|
+
- *"ChΓΊng ta Δang α» Epic nΓ o? HΓ£y tαΊ‘o story mα»i cho tΓnh nΔng ΔΔng nhαΊp."*
|
|
137
|
+
- *"Hãy implement Story #5 theo quy trình dev-story."*
|
|
138
|
+
|
|
139
|
+
Gemini sαΊ½ tα»± Δα»ng phΓ’n tΓch, dα»n dαΊΉp ngα»― cαΊ£nh (gα»i lα»nh `/clear`), chuyα»n lα»nh ΔαΊΏn ΔΓΊng session Claude phΓΉ hợp vΓ sαΊ½ tα»± Δα»ng "thα»©c dαΊy" Δα» nghiα»m thu khi nhαΊn Δược tΓn hiα»u Hook phαΊ£n hα»i tα»« Claude.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* squad-bmad CLI
|
|
4
|
+
*
|
|
5
|
+
* Commands:
|
|
6
|
+
* npx squad-bmad install β Copy squad-bmad files into the current project
|
|
7
|
+
* npx squad-bmad upgrade β Update squad-bmad files to the latest version
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const https = require('https');
|
|
15
|
+
|
|
16
|
+
// ββ ANSI colour helpers ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
17
|
+
const c = {
|
|
18
|
+
reset: '\x1b[0m',
|
|
19
|
+
bold: '\x1b[1m',
|
|
20
|
+
green: '\x1b[32m',
|
|
21
|
+
yellow: '\x1b[33m',
|
|
22
|
+
cyan: '\x1b[36m',
|
|
23
|
+
red: '\x1b[31m',
|
|
24
|
+
dim: '\x1b[2m',
|
|
25
|
+
};
|
|
26
|
+
const ok = (s) => console.log(` ${c.green}β${c.reset} ${s}`);
|
|
27
|
+
const warn = (s) => console.log(` ${c.yellow}β ${c.reset} ${s}`);
|
|
28
|
+
const info = (s) => console.log(` ${c.cyan}β${c.reset} ${s}`);
|
|
29
|
+
const err = (s) => console.log(` ${c.red}β${c.reset} ${s}`);
|
|
30
|
+
const sep = () => console.log(`${c.dim}${'β'.repeat(60)}${c.reset}`);
|
|
31
|
+
|
|
32
|
+
// ββ Paths ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
33
|
+
const TEMPLATE_DIR = path.join(__dirname, '..', 'template');
|
|
34
|
+
const TARGET_DIR = process.cwd();
|
|
35
|
+
|
|
36
|
+
// ββ Hooks that squad-bmad requires in .claude/settings.json βββββββββββββββββ
|
|
37
|
+
const REQUIRED_HOOKS = {
|
|
38
|
+
Stop: [
|
|
39
|
+
{
|
|
40
|
+
matcher: '',
|
|
41
|
+
hooks: [{ type: 'command', command: 'bash .claude/hooks/wakeup-gemini.sh' }],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
Notification: [
|
|
45
|
+
{
|
|
46
|
+
matcher: 'permission_prompt',
|
|
47
|
+
hooks: [{ type: 'command', command: 'bash .claude/hooks/notify-gemini.sh "$CLAUDE_NOTIFICATION"' }],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// ββ Helper: recursively copy a directory, returning list of copied files βββββ
|
|
53
|
+
function copyDir(src, dest, { overwrite = false } = {}) {
|
|
54
|
+
const results = { copied: [], skipped: [] };
|
|
55
|
+
|
|
56
|
+
if (!fs.existsSync(src)) return results;
|
|
57
|
+
|
|
58
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
59
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
60
|
+
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
const srcPath = path.join(src, entry.name);
|
|
63
|
+
const destPath = path.join(dest, entry.name);
|
|
64
|
+
|
|
65
|
+
if (entry.isDirectory()) {
|
|
66
|
+
const sub = copyDir(srcPath, destPath, { overwrite });
|
|
67
|
+
results.copied.push(...sub.copied);
|
|
68
|
+
results.skipped.push(...sub.skipped);
|
|
69
|
+
} else {
|
|
70
|
+
const rel = path.relative(TARGET_DIR, destPath);
|
|
71
|
+
if (!overwrite && fs.existsSync(destPath)) {
|
|
72
|
+
results.skipped.push(rel);
|
|
73
|
+
} else {
|
|
74
|
+
fs.cpSync(srcPath, destPath, { force: true });
|
|
75
|
+
results.copied.push(rel);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return results;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ββ Helper: smart-merge squad-bmad hooks into .claude/settings.json ββββββββββ
|
|
84
|
+
function mergeSettings() {
|
|
85
|
+
const settingsPath = path.join(TARGET_DIR, '.claude', 'settings.json');
|
|
86
|
+
|
|
87
|
+
/* Case 1: file doesn't exist β create it */
|
|
88
|
+
if (!fs.existsSync(settingsPath)) {
|
|
89
|
+
fs.mkdirSync(path.join(TARGET_DIR, '.claude'), { recursive: true });
|
|
90
|
+
fs.writeFileSync(settingsPath, JSON.stringify({ hooks: REQUIRED_HOOKS }, null, 2) + '\n');
|
|
91
|
+
ok('.claude/settings.json created with hooks section.');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Case 2/3: file exists β read and inspect */
|
|
96
|
+
let settings;
|
|
97
|
+
try {
|
|
98
|
+
settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
|
99
|
+
} catch {
|
|
100
|
+
err('Could not parse .claude/settings.json β please check it is valid JSON.');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Case 2: no hooks key β safe to merge automatically */
|
|
105
|
+
if (!settings.hooks) {
|
|
106
|
+
settings.hooks = REQUIRED_HOOKS;
|
|
107
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
108
|
+
ok('.claude/settings.json β hooks section added automatically.');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Case 3: hooks key already exists β print instructions, don't touch */
|
|
113
|
+
warn('.claude/settings.json already has a "hooks" section.');
|
|
114
|
+
console.log(`\n Please ${c.bold}manually${c.reset} add the following entries:\n`);
|
|
115
|
+
console.log(`${c.dim} βββ .claude/settings.json ββββββββββββββββββββββββββββ${c.reset}`);
|
|
116
|
+
console.log(JSON.stringify({ hooks: REQUIRED_HOOKS }, null, 2)
|
|
117
|
+
.split('\n')
|
|
118
|
+
.map(l => ` ${c.cyan}${l}${c.reset}`)
|
|
119
|
+
.join('\n'));
|
|
120
|
+
console.log(`${c.dim} ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ${c.reset}\n`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ββ BMAD Knowledge URL ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
124
|
+
const BMAD_KNOWLEDGE_URL = 'https://docs.bmad-method.org/llms-full.txt';
|
|
125
|
+
const BMAD_KNOWLEDGE_DEST = path.join('references', 'bmad-knowledge', 'llm.md');
|
|
126
|
+
|
|
127
|
+
// ββ Helper: download BMAD knowledge file ββββββββββββββββββββββββββββββββββββ
|
|
128
|
+
function downloadBmadKnowledge() {
|
|
129
|
+
const destPath = path.join(TARGET_DIR, BMAD_KNOWLEDGE_DEST);
|
|
130
|
+
const destDir = path.dirname(destPath);
|
|
131
|
+
|
|
132
|
+
return new Promise((resolve) => {
|
|
133
|
+
info(`Downloading latest BMAD knowledge from:\n ${c.dim}${BMAD_KNOWLEDGE_URL}${c.reset}\n`);
|
|
134
|
+
|
|
135
|
+
https.get(BMAD_KNOWLEDGE_URL, (res) => {
|
|
136
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
137
|
+
// Follow one redirect
|
|
138
|
+
https.get(res.headers.location, (redirectRes) => {
|
|
139
|
+
handleResponse(redirectRes, destDir, destPath, resolve);
|
|
140
|
+
}).on('error', (e) => {
|
|
141
|
+
err(`Download failed: ${e.message}`);
|
|
142
|
+
warn('You can manually download it later from:');
|
|
143
|
+
console.log(` ${c.cyan}${BMAD_KNOWLEDGE_URL}${c.reset}`);
|
|
144
|
+
console.log(` Save to: ${c.cyan}${BMAD_KNOWLEDGE_DEST}${c.reset}\n`);
|
|
145
|
+
resolve(false);
|
|
146
|
+
});
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
handleResponse(res, destDir, destPath, resolve);
|
|
150
|
+
}).on('error', (e) => {
|
|
151
|
+
err(`Download failed: ${e.message}`);
|
|
152
|
+
warn('You can manually download it later from:');
|
|
153
|
+
console.log(` ${c.cyan}${BMAD_KNOWLEDGE_URL}${c.reset}`);
|
|
154
|
+
console.log(` Save to: ${c.cyan}${BMAD_KNOWLEDGE_DEST}${c.reset}\n`);
|
|
155
|
+
resolve(false);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function handleResponse(res, destDir, destPath, resolve) {
|
|
161
|
+
if (res.statusCode !== 200) {
|
|
162
|
+
err(`Download failed: HTTP ${res.statusCode}`);
|
|
163
|
+
warn('You can manually download it later from:');
|
|
164
|
+
console.log(` ${c.cyan}${BMAD_KNOWLEDGE_URL}${c.reset}`);
|
|
165
|
+
console.log(` Save to: ${c.cyan}${BMAD_KNOWLEDGE_DEST}${c.reset}\n`);
|
|
166
|
+
resolve(false);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
171
|
+
const file = fs.createWriteStream(destPath);
|
|
172
|
+
res.pipe(file);
|
|
173
|
+
file.on('finish', () => {
|
|
174
|
+
file.close();
|
|
175
|
+
ok(`${BMAD_KNOWLEDGE_DEST} ${c.dim}(latest)${c.reset}`);
|
|
176
|
+
resolve(true);
|
|
177
|
+
});
|
|
178
|
+
file.on('error', (e) => {
|
|
179
|
+
err(`Failed to write file: ${e.message}`);
|
|
180
|
+
resolve(false);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// ββ Helper: check if BMAD is installed βββββββββββββββββββββββββββββββββββββββ
|
|
185
|
+
function checkBmad() {
|
|
186
|
+
const bmadDir = path.join(TARGET_DIR, '_bmad');
|
|
187
|
+
if (!fs.existsSync(bmadDir)) {
|
|
188
|
+
console.log();
|
|
189
|
+
sep();
|
|
190
|
+
warn(`${c.bold}BMAD Method is not installed${c.reset} in this project.`);
|
|
191
|
+
info('Squad BMAD requires BMAD to function. Install it with:\n');
|
|
192
|
+
console.log(` ${c.bold}${c.cyan}npx bmad-method install${c.reset}\n`);
|
|
193
|
+
console.log(` ${c.dim}(Choose "Claude Code" as your AI tool when prompted)${c.reset}`);
|
|
194
|
+
sep();
|
|
195
|
+
console.log();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// ββ Command: install βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
200
|
+
async function install() {
|
|
201
|
+
console.log(`\n${c.bold} squad-bmad install${c.reset}\n`);
|
|
202
|
+
sep();
|
|
203
|
+
|
|
204
|
+
info('Copying files into your project...\n');
|
|
205
|
+
|
|
206
|
+
const { copied, skipped } = copyDir(TEMPLATE_DIR, TARGET_DIR, { overwrite: false });
|
|
207
|
+
|
|
208
|
+
copied.forEach(f => ok(f));
|
|
209
|
+
skipped.forEach(f => warn(`${f} ${c.dim}(already exists β skipped)${c.reset}`));
|
|
210
|
+
|
|
211
|
+
console.log();
|
|
212
|
+
sep();
|
|
213
|
+
info('Downloading BMAD knowledge...\n');
|
|
214
|
+
await downloadBmadKnowledge();
|
|
215
|
+
|
|
216
|
+
sep();
|
|
217
|
+
info('Configuring .claude/settings.json...\n');
|
|
218
|
+
mergeSettings();
|
|
219
|
+
|
|
220
|
+
sep();
|
|
221
|
+
console.log();
|
|
222
|
+
checkBmad();
|
|
223
|
+
|
|
224
|
+
console.log(`${c.green}${c.bold} β Installation complete!${c.reset}\n`);
|
|
225
|
+
info(`Run ${c.bold}.gemini/scripts/setup-sessions.sh${c.reset} to create your tmux sessions.`);
|
|
226
|
+
info(`Then attach: ${c.bold}tmux attach -t gemini-orchestrator-<folder>${c.reset}`);
|
|
227
|
+
console.log();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// ββ Command: upgrade βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
231
|
+
async function upgrade() {
|
|
232
|
+
console.log(`\n${c.bold} squad-bmad upgrade${c.reset}\n`);
|
|
233
|
+
sep();
|
|
234
|
+
|
|
235
|
+
info('Upgrading files (existing files will be overwritten)...\n');
|
|
236
|
+
|
|
237
|
+
const { copied, skipped } = copyDir(TEMPLATE_DIR, TARGET_DIR, { overwrite: true });
|
|
238
|
+
|
|
239
|
+
copied.forEach(f => ok(`${f} ${c.dim}(updated)${c.reset}`));
|
|
240
|
+
skipped.forEach(f => warn(`${f} ${c.dim}(skipped)${c.reset}`));
|
|
241
|
+
|
|
242
|
+
console.log();
|
|
243
|
+
sep();
|
|
244
|
+
info('Updating BMAD knowledge...\n');
|
|
245
|
+
await downloadBmadKnowledge();
|
|
246
|
+
|
|
247
|
+
sep();
|
|
248
|
+
info('Checking .claude/settings.json...\n');
|
|
249
|
+
mergeSettings();
|
|
250
|
+
|
|
251
|
+
sep();
|
|
252
|
+
console.log();
|
|
253
|
+
checkBmad();
|
|
254
|
+
|
|
255
|
+
console.log(`${c.green}${c.bold} β Upgrade complete!${c.reset}\n`);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// ββ Entry point βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
259
|
+
const command = process.argv[2];
|
|
260
|
+
|
|
261
|
+
if (command === 'install') {
|
|
262
|
+
install().catch(e => { err(e.message); process.exit(1); });
|
|
263
|
+
} else if (command === 'upgrade') {
|
|
264
|
+
upgrade().catch(e => { err(e.message); process.exit(1); });
|
|
265
|
+
} else {
|
|
266
|
+
console.log(`
|
|
267
|
+
${c.bold} squad-bmad${c.reset} β AI orchestration boilerplate for Gemini + Claude Code
|
|
268
|
+
|
|
269
|
+
${c.bold}Usage:${c.reset}
|
|
270
|
+
npx squad-bmad install Set up squad-bmad in the current project
|
|
271
|
+
npx squad-bmad upgrade Update squad-bmad files to the latest version
|
|
272
|
+
|
|
273
|
+
${c.bold}Docs:${c.reset} https://github.com/thientranhung/squad-bmad
|
|
274
|
+
`);
|
|
275
|
+
process.exit(1);
|
|
276
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "squad-bmad",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Automated project orchestration boilerplate with Gemini CLI & Claude Code via Tmux, following the BMAD methodology.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"gemini",
|
|
7
|
+
"claude",
|
|
8
|
+
"tmux",
|
|
9
|
+
"bmad",
|
|
10
|
+
"ai",
|
|
11
|
+
"orchestration",
|
|
12
|
+
"boilerplate"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/thientranhung/squad-bmad#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/thientranhung/squad-bmad/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/thientranhung/squad-bmad.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "thientranhung",
|
|
24
|
+
"bin": {
|
|
25
|
+
"squad-bmad": "./bin/cli.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"bin/",
|
|
29
|
+
"template/"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
MSG="$1"
|
|
5
|
+
if [ -z "$MSG" ]; then
|
|
6
|
+
MSG="Claude Code is waiting for confirmation/interaction."
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
# --- Dynamic Gemini session target ---
|
|
10
|
+
# Derive the tmux session name from the current project folder.
|
|
11
|
+
# Convention: gemini-orchestrator-<folder-name>
|
|
12
|
+
FOLDER_NAME=$(basename "$PWD")
|
|
13
|
+
GEMINI_SESSION="gemini-orchestrator-${FOLDER_NAME}"
|
|
14
|
+
|
|
15
|
+
# Check whether the target tmux session actually exists before sending
|
|
16
|
+
if ! tmux has-session -t "$GEMINI_SESSION" 2>/dev/null; then
|
|
17
|
+
echo "[notify-gemini] Tmux session '${GEMINI_SESSION}' not found. Skipping notification." >&2
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Send notification to the Gemini session
|
|
22
|
+
tmux send-keys -t "${GEMINI_SESSION}:0.0" "Claude Code Notification: $MSG . Please check and continue the work" C-m
|
|
23
|
+
sleep 3
|
|
24
|
+
tmux send-keys -t "${GEMINI_SESSION}:0.0" C-m
|
|
25
|
+
|
|
26
|
+
exit 0
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# Read the full JSON input from Claude Code
|
|
5
|
+
HOOK_INPUT=$(cat)
|
|
6
|
+
|
|
7
|
+
# Temporarily log to analyze the JSON structure of Agent Teams (helps improve the filter later)
|
|
8
|
+
echo "$HOOK_INPUT" >> /tmp/claude_stop_hook_debug.jsonl
|
|
9
|
+
|
|
10
|
+
# Extract the Agent name (if present in the Experimental Agent Teams payload)
|
|
11
|
+
AGENT_NAME=$(echo "$HOOK_INPUT" | jq -r '.agent // empty')
|
|
12
|
+
|
|
13
|
+
# Temporarily log to inspect the actual structure.
|
|
14
|
+
# Once /tmp/claude_stop_hook_debug.jsonl has been analysed, enable the Sub-agent filter logic here.
|
|
15
|
+
# Example: if [ -n "$AGENT_NAME" ] && [ "$AGENT_NAME" != "root" ]; then exit 0; fi
|
|
16
|
+
|
|
17
|
+
# --- Dynamic Gemini session target ---
|
|
18
|
+
# Derive the tmux session name from the project folder name in the hook's cwd.
|
|
19
|
+
# Convention: gemini-orchestrator-<folder-name> (e.g. cwd=/β¦/squad-bmad β gemini-orchestrator-squad-bmad)
|
|
20
|
+
CWD=$(echo "$HOOK_INPUT" | jq -r '.cwd // empty')
|
|
21
|
+
|
|
22
|
+
if [ -z "$CWD" ]; then
|
|
23
|
+
echo "[wakeup-gemini] Warning: cwd not found in hook payload. Skipping." >&2
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
FOLDER_NAME=$(basename "$CWD")
|
|
28
|
+
GEMINI_SESSION="gemini-orchestrator-${FOLDER_NAME}"
|
|
29
|
+
|
|
30
|
+
# Check whether the target tmux session actually exists before sending
|
|
31
|
+
if ! tmux has-session -t "$GEMINI_SESSION" 2>/dev/null; then
|
|
32
|
+
echo "[wakeup-gemini] Tmux session '${GEMINI_SESSION}' not found. Skipping wake-up signal." >&2
|
|
33
|
+
exit 0
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Send a wake-up signal to the Gemini session.
|
|
37
|
+
# We use C-m to ensure Enter is sent safely.
|
|
38
|
+
tmux send-keys -t "${GEMINI_SESSION}:0.0" "Claude Code has emitted a Stop signal (Task completed or Sub-agent completed). Please check and continue the work" C-m
|
|
39
|
+
sleep 5
|
|
40
|
+
tmux send-keys -t "${GEMINI_SESSION}:0.0" C-m
|
|
41
|
+
|
|
42
|
+
exit 0
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
description = "Set up AI PM & Tech Lead role to manage, evaluate, and monitor Claude Code via Tmux."
|
|
2
|
+
prompt = """
|
|
3
|
+
In this session, you act as the "AI Project Manager & Principal Tech Lead". You DO NOT directly write code or modify files. You COORDINATE, MONITOR QUALITY, and EVALUATE the AI Agent (Claude Code) on my behalf.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**INITIALIZATION β Must be completed before taking any tasks:**
|
|
8
|
+
|
|
9
|
+
> **PRE-FLIGHT (execute IMMEDIATELY, in parallel, before all other steps):**
|
|
10
|
+
> - [ ] **IMMEDIATE**: Read and fully internalize `references/bmad-knowledge/llm.md` β this is the foundational BMAD knowledge. Do not skip or skim.
|
|
11
|
+
> - [ ] **IMMEDIATE**: Read `GEMINI.md` β understand the current project architecture, tech stack, and conventions.
|
|
12
|
+
> - [ ] Only proceed with the steps below after both files have been read.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
1. **Detect session names from current project folder:**
|
|
16
|
+
- Run `basename "$PWD"` to get the folder name (e.g. `squad-bmad`).
|
|
17
|
+
- Derive the 3 session names from this folder name:
|
|
18
|
+
- **Gemini Orchestrator**: `gemini-orchestrator-<folder>`
|
|
19
|
+
- **Implement Session** (Sonnet): `claude-implement-<folder>`
|
|
20
|
+
- **Brainstorm Session** (Opus): `claude-brainstorm-<folder>`
|
|
21
|
+
- Run `.gemini/scripts/setup-sessions.sh` (no arguments needed β it auto-detects from `$PWD`). This script creates any missing sessions and starts the correct CLI commands inside each one. If a session already exists, it is reused as-is.
|
|
22
|
+
- After the script completes, verify all 3 sessions exist by running `tmux list-sessions`.
|
|
23
|
+
|
|
24
|
+
2. **Validate you are in the Gemini Orchestrator session:** Run `tmux display-message -p '#S'` β if the result is NOT `gemini-orchestrator-<folder>`, **STOP IMMEDIATELY** and report an error: *"Error: This command must be run from inside the 'gemini-orchestrator-<folder>' tmux session. Currently in session '[current session name]'."*
|
|
25
|
+
|
|
26
|
+
3. **Resolve your pane ID (Gemini):** Run `tmux display-message -p '#S:#I.#P'` to get the pane ID. **Save this value** and use it throughout the session for the ping mechanism. Do not ask again.
|
|
27
|
+
|
|
28
|
+
4. **Check git branch:** Run `git branch`. If currently on `develop` or `main/master`, remind the user to create a branch following the `epic/` or `feature/` standard before implementing.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
**1. Tmux Operations β Core Rules:**
|
|
33
|
+
|
|
34
|
+
- **Sending Principle (ALWAYS applies to ALL sends):**
|
|
35
|
+
- Use the `.gemini/scripts/tmux-send.sh` script to send any content to Claude Code:
|
|
36
|
+
```
|
|
37
|
+
.gemini/scripts/tmux-send.sh "<pane-target>" "content" [wait-seconds]
|
|
38
|
+
```
|
|
39
|
+
- `pane-target`: tmux target to the exact pane, e.g., `cc-implement:0` or `cc-implement:0.0`.
|
|
40
|
+
- `wait-seconds`: optional, default is **5 seconds** β decrease (e.g., `2`) for quick commands, keep or increase for long prompts.
|
|
41
|
+
- The script automatically handles the entire protocol: send text β wait β send `C-m`. **Do not manually call `tmux send-keys`.**
|
|
42
|
+
- **Language:** Always use English in every prompt sent to Claude Code.
|
|
43
|
+
- **Interrupt:** Send `tmux send-keys -t "<session>" Escape` to interrupt Claude Code processing (in this case, still use `send-keys` directly because only a key signal is needed, not Enter).
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
**2. Completion Notification (Automatic):**
|
|
48
|
+
|
|
49
|
+
Claude Code has been configured with a stop hook (`.claude/hooks/wakeup-gemini.sh`) β when Claude Code completes a task, the hook will **automatically send a signal** back to Gemini's pane. You **DO NOT need to**:
|
|
50
|
+
- Continuously poll `capture-pane` to track progress.
|
|
51
|
+
- Insert ping instructions into the prompt sent to Claude Code.
|
|
52
|
+
|
|
53
|
+
β After assigning a task, **wait for the hook signal**. Only proactively check (`capture-pane`) if you suspect Claude Code is stuck or unresponsive for too long.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
**3. Session Routing & Parallel Execution:**
|
|
58
|
+
|
|
59
|
+
- Based on the nature of the work, independently decide the correct session to assign:
|
|
60
|
+
- **Reasoning, architecture, review** β Brainstorm Session.
|
|
61
|
+
- **Coding, implement, fix** β Implement Session.
|
|
62
|
+
- **Parallelization:** Allowed to assign tasks to 2 sessions simultaneously **when tasks are independent** (e.g., Brainstorm reviews Story A while Implement codes Story B). **Do not parallelize** when the output of one session is the input of the other (e.g., Brainstorm finishes the plan β then Implement).
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
**4. BMAD Orchestration (Intelligent Orchestration):**
|
|
67
|
+
|
|
68
|
+
- **BMAD knowledge is ready:** You have already read `references/bmad-knowledge/llm.md` in the PRE-FLIGHT step. Apply it directly without reading again.
|
|
69
|
+
- **Independently decide command:** Analyze user requests β look up `.claude/commands/` β choose the most appropriate slash command. Do not wait for the user to specify.
|
|
70
|
+
- **Fresh Chat before each Workflow (`/clear`):** BMAD requires *"Always start a fresh chat for each workflow"* and *"each story, repeat this cycle with fresh chats"*. In Claude Code, fresh chat = `/clear` command. **Rule:**
|
|
71
|
+
- **Mandatory to send `/clear` before starting any new workflow** (e.g., switching from `create-story` to `dev-story`, or starting the next story).
|
|
72
|
+
- **Do not `/clear` mid-way** while a workflow is running β only clear when starting a completely new workflow.
|
|
73
|
+
- Use: `.gemini/scripts/tmux-send.sh "<pane-target>" "/clear" 2`
|
|
74
|
+
- **Follow BMAD suggested next steps:** After each task is completed, BMAD will suggest the next step. Gemini **reads and evaluates** that suggestion:
|
|
75
|
+
- If it fits the current scope β **send `/clear` β automatically continue** to the next workflow.
|
|
76
|
+
- If it requires a business decision or is out of scope β **report to the user** before proceeding.
|
|
77
|
+
- Absolutely do not create or modify existing workflows.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
**5. Monitoring & Acceptance (QA Gate):**
|
|
82
|
+
|
|
83
|
+
- **Acceptance after completion:** When Claude Code reports completion, read the output files, check test results, and evaluate alignment with the project architecture (`GEMINI.md`).
|
|
84
|
+
- **Handle mid-task errors:** If Claude Code reports an error or asks a technical question within the project architecture/context scope, you **answer it yourself** based on your understanding of the documentation. If the question exceeds your authority (changing requirements, business decisions), **forward it to the user**.
|
|
85
|
+
- **Reporting:** Only report progress summaries, acceptance results, or ask for opinions when there are issues exceeding your authority.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
If understood, execute all initialization steps (validate sessions, resolve pane ID, check branch), then confirm: "Ready. Implement Session: [name], Brainstorm Session: [name], Gemini pane: [ID]."
|
|
90
|
+
"""
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
description = "Set up AI PM & Tech Lead role to manage, evaluate, and monitor Claude Code via Tmux."
|
|
2
|
+
prompt = """
|
|
3
|
+
Trong phiΓͺn nΓ y, bαΊ‘n ΔΓ³ng vai "AI Project Manager & Principal Tech Lead". BαΊ‘n KHΓNG trα»±c tiαΊΏp viαΊΏt code hay sα»a file. BαΊ‘n ΔIα»U PHα»I, GIΓM SΓT CHαΊ€T LΖ―α»’NG vΓ ΔΓNH GIΓ Agent AI (Claude Code) thay mαΊ·t tΓ΄i.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**KHα»I TαΊ O β BαΊ―t buα»c hoΓ n thΓ nh trΖ°α»c khi nhαΊn task:**
|
|
8
|
+
|
|
9
|
+
> **PRE-FLIGHT (thα»±c hiα»n NGAY LαΊ¬P TỨC, song song, trΖ°α»c tαΊ₯t cαΊ£ cΓ‘c bΖ°α»c khΓ‘c):**
|
|
10
|
+
> - [ ] **NGAY LαΊ¬P TỨC**: Δα»c vΓ nαΊ―m toΓ n bα» `references/bmad-knowledge/llm.md` β ΔΓ’y lΓ nα»n tαΊ£ng kiαΊΏn thα»©c BMAD. KhΓ΄ng bα» qua hay Δα»c lΖ°α»t.
|
|
11
|
+
> - [ ] **NGAY LαΊ¬P TỨC**: Δα»c `GEMINI.md` β hiα»u kiαΊΏn trΓΊc dα»± Γ‘n, tech stack, vΓ cΓ‘c quy Ζ°α»c hiα»n tαΊ‘i.
|
|
12
|
+
> - [ ] Chα» tiαΊΏn hΓ nh cΓ‘c bΖ°α»c bΓͺn dΖ°α»i sau khi cαΊ£ hai file ΔΓ£ Δược Δα»c xong.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
1. **XΓ‘c Δα»nh tΓͺn session tα»« folder dα»± Γ‘n hiα»n tαΊ‘i:**
|
|
16
|
+
- ChαΊ‘y `basename "$PWD"` Δα» lαΊ₯y tΓͺn folder (vΓ dα»₯: `squad-bmad`).
|
|
17
|
+
- Tα»« tΓͺn folder ΔΓ³, suy ra 3 tΓͺn session theo quy chuαΊ©n:
|
|
18
|
+
- **Gemini Orchestrator**: `gemini-orchestrator-<folder>`
|
|
19
|
+
- **Session Implement** (Sonnet): `claude-implement-<folder>`
|
|
20
|
+
- **Session Brainstorm** (Opus): `claude-brainstorm-<folder>`
|
|
21
|
+
- ChαΊ‘y `.gemini/scripts/setup-sessions.sh` (khΓ΄ng cαΊ§n truyα»n argument β script tα»± detect tα»« `$PWD`). Script sαΊ½ tαΊ‘o cΓ‘c session cΓ²n thiαΊΏu vΓ khα»i chαΊ‘y ΔΓΊng lα»nh CLI bΓͺn trong. NαΊΏu session ΔΓ£ tα»n tαΊ‘i, script giα»― nguyΓͺn.
|
|
22
|
+
- Sau khi script chαΊ‘y xong, xΓ‘c minh cαΊ£ 3 session tα»n tαΊ‘i bαΊ±ng `tmux list-sessions`.
|
|
23
|
+
|
|
24
|
+
2. **Validate session hiα»n tαΊ‘i:** ChαΊ‘y `tmux display-message -p '#S'` β nαΊΏu kαΊΏt quαΊ£ KHΓNG phαΊ£i `gemini-orchestrator-<folder>`, **Dα»ͺNG NGAY** vΓ bΓ‘o lα»i: *"Lα»i: Command nΓ y phαΊ£i Δược chαΊ‘y tα»« bΓͺn trong tmux session 'gemini-orchestrator-<folder>'. Hiα»n Δang α» session '[tΓͺn session hiα»n tαΊ‘i]'."*
|
|
25
|
+
|
|
26
|
+
3. **Resolve pane ID cα»§a bαΊ‘n (Gemini):** ChαΊ‘y `tmux display-message -p '#S:#I.#P'` Δα» lαΊ₯y pane ID. **LΖ°u giΓ‘ trα» nΓ y** vΓ dΓΉng xuyΓͺn suα»t phiΓͺn cho ping mechanism. KhΓ΄ng hα»i lαΊ‘i.
|
|
27
|
+
|
|
28
|
+
4. **Kiα»m tra git branch:** ChαΊ‘y `git branch`. NαΊΏu Δang α» `develop` hoαΊ·c `main/master`, nhαΊ―c ngΖ°α»i dΓΉng tαΊ‘o branch theo chuαΊ©n `epic/` hoαΊ·c `feature/` trΖ°α»c khi implement.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
**1. Thao tΓ‘c Tmux β Quy tαΊ―c Cα»t lΓ΅i:**
|
|
33
|
+
|
|
34
|
+
- **NguyΓͺn tαΊ―c Gα»i (LUΓN Γ‘p dα»₯ng cho Mα»I lαΊ§n gα»i):**
|
|
35
|
+
- DΓΉng script `.gemini/scripts/tmux-send.sh` Δα» gα»i mα»i nα»i dung ΔαΊΏn Claude Code:
|
|
36
|
+
```
|
|
37
|
+
.gemini/scripts/tmux-send.sh "<pane-target>" "nα»i dung" [wait-seconds]
|
|
38
|
+
```
|
|
39
|
+
- `pane-target`: tmux target ΔαΊΏn ΔΓΊng pane, vΓ dα»₯ `cc-implement:0` hoαΊ·c `cc-implement:0.0`.
|
|
40
|
+
- `wait-seconds`: tΓΉy chα»n, mαΊ·c Δα»nh **5 giΓ’y** β giαΊ£m xuα»ng (vΓ dα»₯ `2`) cho lα»nh nhanh, giα»― hoαΊ·c tΔng cho prompt dΓ i.
|
|
41
|
+
- Script tα»± Δα»ng xα» lΓ½ toΓ n bα» protocol: gα»i text β chα» β gα»i `C-m`. **KhΓ΄ng tα»± gα»i `tmux send-keys` thα»§ cΓ΄ng.**
|
|
42
|
+
- **NgΓ΄n ngα»―:** LuΓ΄n dΓΉng tiαΊΏng Anh trong mα»i prompt gα»i ΔαΊΏn Claude Code.
|
|
43
|
+
- **Interrupt:** Gα»i `tmux send-keys -t "<session>" Escape` Δα» ngαΊ―t Claude Code Δang xα» lΓ½ (trΖ°α»ng hợp nΓ y vαΊ«n dΓΉng `send-keys` trα»±c tiαΊΏp vΓ¬ chα» cαΊ§n key signal, khΓ΄ng cαΊ§n Enter).
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
**2. ThΓ΄ng bΓ‘o hoΓ n thΓ nh (Tα»± Δα»ng):**
|
|
48
|
+
|
|
49
|
+
Claude Code ΔΓ£ Δược cαΊ₯u hΓ¬nh stop hook (`.claude/hooks/wakeup-gemini.sh`) β khi Claude Code hoΓ n thΓ nh task, hook sαΊ½ **tα»± Δα»ng gα»i tΓn hiα»u** vα» pane cα»§a Gemini. BαΊ‘n **KHΓNG cαΊ§n**:
|
|
50
|
+
- Poll `capture-pane` liΓͺn tα»₯c Δα» theo dΓ΅i tiαΊΏn Δα».
|
|
51
|
+
- ChΓ¨n ping instruction vΓ o prompt gα»i cho Claude Code.
|
|
52
|
+
|
|
53
|
+
β Sau khi giao task, **chα» tΓn hiα»u hook**. Chα» chα»§ Δα»ng kiα»m tra (`capture-pane`) khi nghi ngα» Claude Code bα» stuck hoαΊ·c quΓ‘ lΓ’u khΓ΄ng phαΊ£n hα»i.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
**3. PhΓ’n luα»ng Session & Thα»±c thi Song song:**
|
|
58
|
+
|
|
59
|
+
- Dα»±a vΓ o tΓnh chαΊ₯t cΓ΄ng viα»c, tα»± quyαΊΏt Δα»nh giao ΔΓΊng session:
|
|
60
|
+
- **Suy luαΊn, kiαΊΏn trΓΊc, review** β Session Brainstorm.
|
|
61
|
+
- **Coding, implement, fix** β Session Implement.
|
|
62
|
+
- **Song song hΓ³a:** Δược phΓ©p giao task cho 2 session Δα»ng thα»i **khi task Δα»c lαΊp** (vΓ dα»₯: Brainstorm review Story A trong khi Implement code Story B). **KhΓ΄ng song song** khi output cα»§a session nΓ y lΓ input cα»§a session kia (vΓ dα»₯: Brainstorm xong plan β mα»i Implement).
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
**4. Δiα»u phα»i theo BMAD (Intelligent Orchestration):**
|
|
67
|
+
|
|
68
|
+
- **KiαΊΏn thα»©c BMAD ΔΓ£ sαΊ΅n sΓ ng:** BαΊ‘n ΔΓ£ Δα»c `references/bmad-knowledge/llm.md` α» bΖ°α»c PRE-FLIGHT. Γp dα»₯ng trα»±c tiαΊΏp mΓ khΓ΄ng cαΊ§n Δα»c lαΊ‘i.
|
|
69
|
+
- **Tα»± quyαΊΏt Δα»nh command:** PhΓ’n tΓch yΓͺu cαΊ§u ngΖ°α»i dΓΉng β tra cα»©u `.claude/commands/` β chα»n slash command phΓΉ hợp nhαΊ₯t. KhΓ΄ng chα» ngΖ°α»i dΓΉng chα» Δα»nh.
|
|
70
|
+
- **Fresh Chat trΖ°α»c mα»i Workflow (`/clear`):** BMAD yΓͺu cαΊ§u *"Always start a fresh chat for each workflow"* vΓ *"each story, repeat this cycle with fresh chats"*. Trong Claude Code, fresh chat = lα»nh `/clear`. **Quy tαΊ―c:**
|
|
71
|
+
- **BαΊ―t buα»c gα»i `/clear` trΖ°α»c khi bαΊ―t ΔαΊ§u bαΊ₯t kα»³ workflow mα»i nΓ o** (vΓ dα»₯: chuyα»n tα»« `create-story` sang `dev-story`, hoαΊ·c bαΊ―t ΔαΊ§u story tiαΊΏp theo).
|
|
72
|
+
- **KhΓ΄ng `/clear` giα»―a chα»«ng** khi workflow Δang chαΊ‘y β chα» clear khi bαΊ―t ΔαΊ§u workflow mα»i hoΓ n toΓ n.
|
|
73
|
+
- Sα» dα»₯ng: `.gemini/scripts/tmux-send.sh "<pane-target>" "/clear" 2`
|
|
74
|
+
- **Follow BMAD suggested next steps:** Sau mα»i task hoΓ n thΓ nh, BMAD sαΊ½ suggest bΖ°α»c tiαΊΏp theo. Gemini **Δα»c vΓ ΔΓ‘nh giΓ‘** suggestion ΔΓ³:
|
|
75
|
+
- NαΊΏu phΓΉ hợp vα»i scope hiα»n tαΊ‘i β **gα»i `/clear` β tα»± Δα»ng tiαΊΏp tα»₯c** workflow tiαΊΏp theo.
|
|
76
|
+
- NαΊΏu cαΊ§n quyαΊΏt Δα»nh business hoαΊ·c ngoΓ i scope β **bΓ‘o ngΖ°α»i dΓΉng** trΖ°α»c khi tiαΊΏn hΓ nh.
|
|
77
|
+
- Tuyα»t Δα»i khΓ΄ng tα»± tαΊ‘o hay chα»nh sα»a workflow cΓ³ sαΊ΅n.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
**5. GiΓ‘m sΓ‘t & Nghiα»m thu (QA Gate):**
|
|
82
|
+
|
|
83
|
+
- **Nghiα»m thu sau hoΓ n thΓ nh:** Khi Claude Code bΓ‘o xong, Δα»c file output, kiα»m tra test results, vΓ ΔΓ‘nh giΓ‘ alignment vα»i kiαΊΏn trΓΊc dα»± Γ‘n (`GEMINI.md`).
|
|
84
|
+
- **Xα» lΓ½ lα»i mid-task:** NαΊΏu Claude Code bΓ‘o lα»i hoαΊ·c hα»i cΓ’u hα»i kα»Ή thuαΊt trong phαΊ‘m vi kiαΊΏn trΓΊc/context dα»± Γ‘n, bαΊ‘n **tα»± trαΊ£ lα»i** dα»±a trΓͺn hiα»u biαΊΏt tα»« tΓ i liα»u. NαΊΏu cΓ’u hα»i vượt thαΊ©m quyα»n (thay Δα»i yΓͺu cαΊ§u, quyαΊΏt Δα»nh business), **forward cho ngΖ°α»i dΓΉng**.
|
|
85
|
+
- **CαΊ§u nα»i ngΓ΄n ngα»―:** Claude Code lΓ m viα»c bαΊ±ng tiαΊΏng Anh. Khi bΓ‘o cΓ‘o lαΊ‘i cho ngΖ°α»i dΓΉng, Gemini **luΓ΄n giαΊ£i thΓch bαΊ±ng tiαΊΏng Viα»t** β tΓ³m tαΊ―t kαΊΏt quαΊ£, vαΊ₯n Δα», vΓ Δα» xuαΊ₯t tiαΊΏp theo.
|
|
86
|
+
- **BΓ‘o cΓ‘o:** Chα» bΓ‘o cΓ‘o tΓ³m tαΊ―t tiαΊΏn Δα», kαΊΏt quαΊ£ nghiα»m thu, hoαΊ·c xin Γ½ kiαΊΏn khi cΓ³ vαΊ₯n Δα» vượt thαΊ©m quyα»n.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
NαΊΏu ΔΓ£ hiα»u, hΓ£y thα»±c hiα»n toΓ n bα» bΖ°α»c khα»i tαΊ‘o (chαΊ‘y setup-sessions.sh, validate session, resolve pane ID, check branch), sau ΔΓ³ xΓ‘c nhαΊn: "SαΊ΅n sΓ ng. Session Implement: [tΓͺn], Session Brainstorm: [tΓͺn], Gemini pane: [ID]."
|
|
91
|
+
"""
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# setup-sessions.sh β Create (or reuse) the 3 standard tmux sessions for a project.
|
|
3
|
+
#
|
|
4
|
+
# CONVENTION:
|
|
5
|
+
# gemini-orchestrator-<folder> β Gemini CLI (yolo, gemini-3-pro-preview)
|
|
6
|
+
# claude-implement-<folder> β Claude Code (sonnet, bypass-permissions)
|
|
7
|
+
# claude-brainstorm-<folder> β Claude Code (opus, bypass-permissions)
|
|
8
|
+
#
|
|
9
|
+
# USAGE:
|
|
10
|
+
# .gemini/scripts/setup-sessions.sh [folder-name]
|
|
11
|
+
#
|
|
12
|
+
# If folder-name is omitted, the name of the current working directory is used.
|
|
13
|
+
#
|
|
14
|
+
# EXAMPLES:
|
|
15
|
+
# .gemini/scripts/setup-sessions.sh
|
|
16
|
+
# .gemini/scripts/setup-sessions.sh squad-bmad
|
|
17
|
+
|
|
18
|
+
set -e
|
|
19
|
+
|
|
20
|
+
# ββ Resolve folder name ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
21
|
+
if [ -n "$1" ]; then
|
|
22
|
+
FOLDER="$1"
|
|
23
|
+
else
|
|
24
|
+
FOLDER=$(basename "$PWD")
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# ββ Derive session names βββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
28
|
+
SESSION_GEMINI="gemini-orchestrator-${FOLDER}"
|
|
29
|
+
SESSION_IMPLEMENT="claude-implement-${FOLDER}"
|
|
30
|
+
SESSION_BRAINSTORM="claude-brainstorm-${FOLDER}"
|
|
31
|
+
|
|
32
|
+
# ββ Helper: create session only if it does not already exist βββββββββββββββββ
|
|
33
|
+
create_session_if_missing() {
|
|
34
|
+
local session_name="$1"
|
|
35
|
+
local start_cmd="$2" # command to run inside the new session
|
|
36
|
+
local label="$3"
|
|
37
|
+
|
|
38
|
+
if tmux has-session -t "$session_name" 2>/dev/null; then
|
|
39
|
+
echo " [SKIP] $label β session '${session_name}' already exists."
|
|
40
|
+
else
|
|
41
|
+
# -d : start detached
|
|
42
|
+
# -s : session name
|
|
43
|
+
# The shell command is passed via tmux's 'new-session' so it runs immediately
|
|
44
|
+
tmux new-session -d -s "$session_name" -x 220 -y 50
|
|
45
|
+
# Give the shell a moment to initialise before sending the startup command
|
|
46
|
+
sleep 0.5
|
|
47
|
+
tmux send-keys -t "${session_name}:0.0" "$start_cmd" C-m
|
|
48
|
+
echo " [CREATE] $label β session '${session_name}' created and command sent."
|
|
49
|
+
fi
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# ββ Print plan ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
53
|
+
echo ""
|
|
54
|
+
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
|
|
55
|
+
echo "β squad-bmad β’ Session Setup β"
|
|
56
|
+
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
|
|
57
|
+
echo ""
|
|
58
|
+
echo " Project folder : ${FOLDER}"
|
|
59
|
+
echo ""
|
|
60
|
+
echo " Sessions to create:"
|
|
61
|
+
echo " 1. ${SESSION_GEMINI}"
|
|
62
|
+
echo " 2. ${SESSION_IMPLEMENT}"
|
|
63
|
+
echo " 3. ${SESSION_BRAINSTORM}"
|
|
64
|
+
echo ""
|
|
65
|
+
|
|
66
|
+
# ββ 1. Gemini Orchestrator βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
67
|
+
create_session_if_missing \
|
|
68
|
+
"$SESSION_GEMINI" \
|
|
69
|
+
"gemini --yolo --model gemini-3-pro-preview" \
|
|
70
|
+
"Gemini Orchestrator"
|
|
71
|
+
|
|
72
|
+
# ββ 2. Claude Implement (Sonnet) βββββββββββββββββββββββββββββββββββββββββββββ
|
|
73
|
+
create_session_if_missing \
|
|
74
|
+
"$SESSION_IMPLEMENT" \
|
|
75
|
+
"claude --dangerously-skip-permissions --model sonnet" \
|
|
76
|
+
"Claude Implement (Sonnet)"
|
|
77
|
+
|
|
78
|
+
# ββ 3. Claude Brainstorm (Opus) ββββββββββββββββββββββββββββββββββββββββββββββ
|
|
79
|
+
create_session_if_missing \
|
|
80
|
+
"$SESSION_BRAINSTORM" \
|
|
81
|
+
"claude --dangerously-skip-permissions --model opus" \
|
|
82
|
+
"Claude Brainstorm (Opus)"
|
|
83
|
+
|
|
84
|
+
# ββ Summary βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
85
|
+
echo ""
|
|
86
|
+
echo "Done. Active tmux sessions:"
|
|
87
|
+
tmux list-sessions 2>/dev/null | sed 's/^/ /'
|
|
88
|
+
echo ""
|
|
89
|
+
echo "To attach:"
|
|
90
|
+
echo " tmux attach -t ${SESSION_GEMINI}"
|
|
91
|
+
echo " tmux attach -t ${SESSION_IMPLEMENT}"
|
|
92
|
+
echo " tmux attach -t ${SESSION_BRAINSTORM}"
|
|
93
|
+
echo ""
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# tmux-send.sh β Reliably send text to a tmux pane.
|
|
3
|
+
#
|
|
4
|
+
# USAGE:
|
|
5
|
+
# ./tmux-send.sh <pane-target> <message> [wait-seconds]
|
|
6
|
+
#
|
|
7
|
+
# ARGUMENTS:
|
|
8
|
+
# pane-target β tmux target, e.g.: gemini-orchestrator:0.0
|
|
9
|
+
# message β content to send (wrap in quotes if it contains spaces)
|
|
10
|
+
# wait-seconds β (optional) seconds to wait between text and Enter, default: 5
|
|
11
|
+
#
|
|
12
|
+
# EXAMPLES:
|
|
13
|
+
# .gemini/scripts/tmux-send.sh "gemini-orchestrator:0.0" "Hello from Claude Code"
|
|
14
|
+
# .gemini/scripts/tmux-send.sh "cc-implement:0" "/dev-story" 3
|
|
15
|
+
|
|
16
|
+
set -e
|
|
17
|
+
|
|
18
|
+
PANE_TARGET="$1"
|
|
19
|
+
MESSAGE="$2"
|
|
20
|
+
WAIT_SECONDS="${3:-5}"
|
|
21
|
+
|
|
22
|
+
# Validate required arguments
|
|
23
|
+
if [ -z "$PANE_TARGET" ] || [ -z "$MESSAGE" ]; then
|
|
24
|
+
echo "Error: Missing arguments." >&2
|
|
25
|
+
echo "Usage: $0 <pane-target> <message> [wait-seconds]" >&2
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Check that the pane exists
|
|
30
|
+
if ! tmux has-session -t "$PANE_TARGET" 2>/dev/null; then
|
|
31
|
+
echo "Error: Tmux target '$PANE_TARGET' does not exist." >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Send the content
|
|
36
|
+
tmux send-keys -t "$PANE_TARGET" "$MESSAGE"
|
|
37
|
+
|
|
38
|
+
# Wait for the pane to receive and render the text
|
|
39
|
+
sleep "$WAIT_SECONDS"
|
|
40
|
+
|
|
41
|
+
# Send Enter (C-m) β do NOT use 'Enter' or '\n'
|
|
42
|
+
tmux send-keys -t "$PANE_TARGET" C-m
|
|
43
|
+
|
|
44
|
+
echo "β Sent to '$PANE_TARGET': $MESSAGE"
|