@dv.nghiem/flowdeck 0.4.8 → 0.4.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.
- package/dist/agents/default-executor.d.ts +3 -0
- package/dist/agents/default-executor.d.ts.map +1 -0
- package/dist/agents/index.d.ts +2 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/orchestrator.d.ts.map +1 -1
- package/dist/agents/researcher.d.ts.map +1 -1
- package/dist/config/schema.d.ts +10 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/hooks/event-log-hook.d.ts +4 -3
- package/dist/hooks/event-log-hook.d.ts.map +1 -1
- package/dist/hooks/orchestrator-guard-hook.d.ts +12 -6
- package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1299 -198
- package/dist/lib/confirmation.d.ts +9 -1
- package/dist/lib/confirmation.d.ts.map +1 -1
- package/dist/mcp/index.d.ts +9 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/services/event-logger.d.ts +4 -1
- package/dist/services/event-logger.d.ts.map +1 -1
- package/dist/services/loop-detector.d.ts +47 -0
- package/dist/services/loop-detector.d.ts.map +1 -0
- package/dist/tools/merge-assist.d.ts +54 -0
- package/dist/tools/merge-assist.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/commands/fd-execute.md +6 -0
- package/src/commands/fd-fix-bug.md +7 -1
- package/src/commands/fd-merge-assist.md +180 -0
- package/src/commands/fd-plan.md +7 -1
- package/src/rules/common/agent-orchestration.md +88 -30
- package/src/skills/merge-assist/SKILL.md +232 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: merge-assist
|
|
3
|
+
description: Human-in-the-loop selective branch integration. Helps bring a specific feature from one branch to another using cherry-pick or manual port, with mandatory confirmation gates.
|
|
4
|
+
origin: FlowDeck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Merge Assist Skill
|
|
8
|
+
|
|
9
|
+
Selective, human-approved branch integration. Never auto-merge. Never auto-push.
|
|
10
|
+
|
|
11
|
+
## When to Activate
|
|
12
|
+
|
|
13
|
+
Activate when:
|
|
14
|
+
- The user wants to move a specific feature from one branch to another
|
|
15
|
+
- The user asks to cherry-pick selectively from a branch
|
|
16
|
+
- The user wants to avoid merging an entire branch (e.g., avoid bringing in unrelated changes)
|
|
17
|
+
- The user needs help porting commits across diverged branches
|
|
18
|
+
- The user says things like "bring this feature to main", "cherry-pick these changes", "port this PR"
|
|
19
|
+
|
|
20
|
+
## Core Principles
|
|
21
|
+
|
|
22
|
+
1. **Human approval is mandatory** — Every gate requires explicit y/n confirmation. No silent execution.
|
|
23
|
+
2. **Never assume feature boundaries** — Ask the user which commits represent the feature. Do not guess.
|
|
24
|
+
3. **Prefer selective methods** — Cherry-pick over full merge. Manual port over blind cherry-pick when conflicts are likely.
|
|
25
|
+
4. **Ask on every ambiguity** — If commit history is unclear, stop and ask. Do not proceed on assumptions.
|
|
26
|
+
5. **No autonomous merge authority** — The agent MUST NOT run `git merge`, `git cherry-pick`, `git push`, `git commit`, `git checkout`, `git branch -D`, `git reset`, or `git revert` without human confirmation.
|
|
27
|
+
6. **Never ask for credentials** — The agent MUST NOT ask for GitHub tokens, passwords, SSH keys, or any authentication secrets. If a remote action requires authentication, explain this and offer options: stop, defer, or let the human perform that step manually.
|
|
28
|
+
|
|
29
|
+
## Workflow Steps
|
|
30
|
+
|
|
31
|
+
### Step 1: Clarification
|
|
32
|
+
|
|
33
|
+
Ask the user to confirm:
|
|
34
|
+
- **Target branch** — where the feature should land (e.g., `main`)
|
|
35
|
+
- **Source branch** — where the feature currently lives (e.g., `feature/auth-refactor`)
|
|
36
|
+
- **Feature description** — one-sentence summary of what is being moved
|
|
37
|
+
|
|
38
|
+
If the user only provides a branch name, infer the other branch from context or ask.
|
|
39
|
+
|
|
40
|
+
Use the `merge-assist` tool with action `start` to create the session.
|
|
41
|
+
|
|
42
|
+
### Step 2: Branch Verification
|
|
43
|
+
|
|
44
|
+
The tool verifies both branches exist. If not, report the error and stop.
|
|
45
|
+
|
|
46
|
+
Confirmation gate: `branch_selection`
|
|
47
|
+
|
|
48
|
+
Prompt example:
|
|
49
|
+
> "Confirm: integrate feature 'OAuth login' from `feature/oauth` into `main`? (y/n)"
|
|
50
|
+
|
|
51
|
+
### Step 3: Inspection
|
|
52
|
+
|
|
53
|
+
Use the `merge-assist` tool with action `inspect` to analyze the source branch history.
|
|
54
|
+
|
|
55
|
+
The tool returns:
|
|
56
|
+
- Candidate commits (SHA, subject, author, date, files)
|
|
57
|
+
- Heuristic confidence for whether each commit is part of the feature
|
|
58
|
+
- Dependent commits detected via shared files or message keywords
|
|
59
|
+
|
|
60
|
+
Present the candidate commits to the user in a clear table:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
SHA | Subject | Author | Confidence | Feature?
|
|
64
|
+
--------|----------------------------|-----------|------------|----------
|
|
65
|
+
abc1234 | feat(auth): add OAuth flow | alice | high | yes
|
|
66
|
+
def5678 | refactor(auth): extract | alice | medium | maybe
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Step 4: Commit Selection
|
|
70
|
+
|
|
71
|
+
Ask the user to identify which commits represent the feature.
|
|
72
|
+
|
|
73
|
+
Confirmation gate: `commit_selection`
|
|
74
|
+
|
|
75
|
+
Prompt example:
|
|
76
|
+
> "Which commits represent the OAuth feature? Provide SHAs (space-separated) or say 'all'.
|
|
77
|
+
> Dependent commits detected: def5678. Include them? (y/n)"
|
|
78
|
+
|
|
79
|
+
### Step 5: Plan Creation
|
|
80
|
+
|
|
81
|
+
Use the `merge-assist` tool with action `plan` with the selected commits.
|
|
82
|
+
|
|
83
|
+
The tool builds a merge plan including:
|
|
84
|
+
- Recommended method: `cherry-pick`, `cherry-pick-range`, `manual-port`, or `abort`
|
|
85
|
+
- Integration branch name (default: `merge-assist/<source>-to-<target>`)
|
|
86
|
+
- Risk assessment
|
|
87
|
+
- Recommended commands (as strings — NOT executed)
|
|
88
|
+
|
|
89
|
+
### Step 6: Planning Confirmations
|
|
90
|
+
|
|
91
|
+
Three gates must be confirmed before proceeding:
|
|
92
|
+
|
|
93
|
+
1. **integration_branch** — Confirm the integration branch name
|
|
94
|
+
2. **method_selection** — Confirm the merge method
|
|
95
|
+
3. **dependency_inclusion** — Confirm whether to include dependent commits
|
|
96
|
+
|
|
97
|
+
Prompt example:
|
|
98
|
+
> "Integration branch: `merge-assist/feature-oauth-to-main`. OK? (y/n)"
|
|
99
|
+
> "Method: cherry-pick-range (commits abc1234..def5678). OK? (y/n)"
|
|
100
|
+
> "Include dependent commit def5678 (refactor prep)? (y/n)"
|
|
101
|
+
|
|
102
|
+
### Step 7: Execute Confirmation
|
|
103
|
+
|
|
104
|
+
Confirmation gate: `execute_plan`
|
|
105
|
+
|
|
106
|
+
Present the recommended commands to the user. Do NOT run them.
|
|
107
|
+
|
|
108
|
+
Prompt example:
|
|
109
|
+
> "Ready to execute. Recommended commands:
|
|
110
|
+
> ```
|
|
111
|
+
> git fetch origin
|
|
112
|
+
> git checkout -b merge-assist/feature-oauth-to-main main
|
|
113
|
+
> git cherry-pick abc1234^..def5678
|
|
114
|
+
> git push -u origin merge-assist/feature-oauth-to-main
|
|
115
|
+
> ```
|
|
116
|
+
> Execute these commands? (y/n)"
|
|
117
|
+
|
|
118
|
+
### Step 8: Human Execution
|
|
119
|
+
|
|
120
|
+
If approved, the human (or agent with explicit permission) runs the commands.
|
|
121
|
+
|
|
122
|
+
**The agent MUST NOT run these commands autonomously.**
|
|
123
|
+
|
|
124
|
+
### Step 9: Push / PR Confirmation
|
|
125
|
+
|
|
126
|
+
After successful execution, confirm pushing and PR creation.
|
|
127
|
+
|
|
128
|
+
Confirmation gate: `push_pr`
|
|
129
|
+
|
|
130
|
+
Prompt example:
|
|
131
|
+
> "Push branch and open PR? (y/n)"
|
|
132
|
+
|
|
133
|
+
## Confirmation Gates
|
|
134
|
+
|
|
135
|
+
Every gate requires human approval. The tool tracks each gate in the session state.
|
|
136
|
+
|
|
137
|
+
| # | Gate | Trigger | Prompt Style |
|
|
138
|
+
|---|------|---------|-------------|
|
|
139
|
+
| 1 | `branch_selection` | After start | y/n |
|
|
140
|
+
| 2 | `commit_selection` | After inspect | Provide SHAs + y/n on deps |
|
|
141
|
+
| 3 | `integration_branch` | During plan | y/n |
|
|
142
|
+
| 4 | `method_selection` | During plan | y/n |
|
|
143
|
+
| 5 | `dependency_inclusion` | During plan | y/n |
|
|
144
|
+
| 6 | `execute_plan` | After plan approved | y/n |
|
|
145
|
+
| 7 | `push_pr` | After execute | y/n |
|
|
146
|
+
|
|
147
|
+
If any gate is rejected:
|
|
148
|
+
- Stop the workflow
|
|
149
|
+
- Offer to `abort` the session or revise the selection
|
|
150
|
+
|
|
151
|
+
## Conflict Handling
|
|
152
|
+
|
|
153
|
+
If a conflict occurs during human execution:
|
|
154
|
+
|
|
155
|
+
1. **Stop immediately** — Do not proceed past the conflict.
|
|
156
|
+
2. **Explain the conflict** — File path, commit SHA, and what changed.
|
|
157
|
+
3. **Propose options** — Use `multiChoiceConfirm` with choices like:
|
|
158
|
+
- "Show conflict details"
|
|
159
|
+
- "Attempt resolution"
|
|
160
|
+
- "Abort and try manual port"
|
|
161
|
+
- "Abort session"
|
|
162
|
+
4. **Wait for human decision** — Do not auto-resolve. Do not guess.
|
|
163
|
+
|
|
164
|
+
Update the session with conflict info if available:
|
|
165
|
+
```
|
|
166
|
+
conflicts: [
|
|
167
|
+
{ file: "src/auth.ts", commitSha: "abc1234", description: "Both branches modified login() signature" }
|
|
168
|
+
]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Anti-Patterns
|
|
172
|
+
|
|
173
|
+
The following are explicitly forbidden:
|
|
174
|
+
|
|
175
|
+
- **Auto-merge** — Never run `git merge` without confirmation
|
|
176
|
+
- **Auto-push** — Never run `git push` without confirmation
|
|
177
|
+
- **Assume commits** — Never guess which commits belong to a feature
|
|
178
|
+
- **Silent cherry-pick** — Never cherry-pick without showing the user what will happen
|
|
179
|
+
- **Ignore conflicts** — Never proceed past a conflict without human input
|
|
180
|
+
- **Skip confirmation gates** — Every gate must be explicitly approved or rejected
|
|
181
|
+
- **Execute state-changing git commands in the tool** — The tool only READS git history
|
|
182
|
+
- **Ask for credentials** — Never request GitHub tokens, passwords, SSH keys, or other secrets from the user
|
|
183
|
+
|
|
184
|
+
## Examples
|
|
185
|
+
|
|
186
|
+
### Example 1: Simple cherry-pick
|
|
187
|
+
|
|
188
|
+
User: "Bring the OAuth feature from feature/oauth to main"
|
|
189
|
+
|
|
190
|
+
Agent:
|
|
191
|
+
> "Starting merge-assist workflow. Target: `main`, Source: `feature/oauth`, Feature: OAuth login.
|
|
192
|
+
> Confirm: integrate from `feature/oauth` into `main`? (y/n)"
|
|
193
|
+
|
|
194
|
+
[User confirms]
|
|
195
|
+
|
|
196
|
+
Agent:
|
|
197
|
+
> "Found 3 candidate commits:
|
|
198
|
+
> - abc1234 feat(auth): add OAuth flow (high confidence)
|
|
199
|
+
> - def5678 refactor(auth): extract auth module (medium — shared files)
|
|
200
|
+
> - ghi9012 test(auth): add OAuth tests (medium — test only)
|
|
201
|
+
> Which commits represent the feature? (provide SHAs or 'all')"
|
|
202
|
+
|
|
203
|
+
[User selects abc1234 def5678]
|
|
204
|
+
|
|
205
|
+
Agent:
|
|
206
|
+
> "Plan: cherry-pick-range `abc1234^..def5678` into `merge-assist/feature-oauth-to-main`.
|
|
207
|
+
> Risks: refactor prep commit included.
|
|
208
|
+
> Execute? (y/n)"
|
|
209
|
+
|
|
210
|
+
### Example 2: Conflict detected
|
|
211
|
+
|
|
212
|
+
User: "It conflicted on src/auth.ts"
|
|
213
|
+
|
|
214
|
+
Agent:
|
|
215
|
+
> "Conflict detected in `src/auth.ts` during cherry-pick of `abc1234`.
|
|
216
|
+
> Options:
|
|
217
|
+
> 1. Show conflict details
|
|
218
|
+
> 2. Attempt resolution
|
|
219
|
+
> 3. Abort and try manual port
|
|
220
|
+
> 4. Abort session
|
|
221
|
+
> What would you like to do?"
|
|
222
|
+
|
|
223
|
+
## Tool Reference
|
|
224
|
+
|
|
225
|
+
Use the `merge-assist` tool with these actions:
|
|
226
|
+
- `start` — Initialize session
|
|
227
|
+
- `inspect` — Analyze git history
|
|
228
|
+
- `plan` — Build merge plan from selected commits
|
|
229
|
+
- `confirm` — Record approval/rejection for a step
|
|
230
|
+
- `abort` — Abort session
|
|
231
|
+
- `status` — Get current session state
|
|
232
|
+
- `list` — List all sessions
|