Skip to content

Commit ff4e0ac

Browse files
Merge pull request #104 from gemini-cli-extensions/feat/ask-user-tool-integration
Refactor interactive flows to use the `AskUser` tool
2 parents 232c08b + f025c7d commit ff4e0ac

5 files changed

Lines changed: 574 additions & 389 deletions

File tree

commands/conductor/implement.toml

Lines changed: 79 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,29 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
3535
4. **Select Track:**
3636
- **If a track name was provided:**
3737
1. Perform an exact, case-insensitive match for the provided name against the track descriptions you parsed.
38-
2. If a unique match is found, confirm the selection with the user: "I found track '<track_description>'. Is this correct?"
39-
3. If no match is found, or if the match is ambiguous, inform the user and ask for clarification. Suggest the next available track as below.
38+
2. If a unique match is found, immediately call the `ask_user` tool to confirm the selection (do not repeat the question in the chat):
39+
- **questions:**
40+
- **header:** "Confirm"
41+
- **question:** "I found track '<track_description>'. Is this correct?"
42+
- **type:** "yesno"
43+
3. If no match is found, or if the match is ambiguous, immediately call the `ask_user` tool to inform the user and request the correct track name (do not repeat the question in the chat):
44+
- **questions:**
45+
- **header:** "Clarify"
46+
- **question:** "I couldn't find a unique track matching the name you provided. Did you mean '<next_available_track>'? Or please type the exact track name."
47+
- **type:** "text"
4048
- **If no track name was provided (or if the previous step failed):**
4149
1. **Identify Next Track:** Find the first track in the parsed tracks file that is NOT marked as `[x] Completed`.
4250
2. **If a next track is found:**
43-
- Announce: "No track name provided. Automatically selecting the next incomplete track: '<track_description>'."
44-
- Proceed with this track.
51+
- Immediately call the `ask_user` tool to confirm the selection (do not repeat the question in the chat):
52+
- **questions:**
53+
- **header:** "Next Track"
54+
- **question:** "No track name provided. Would you like to proceed with the next incomplete track: '<track_description>'?"
55+
- **type:** "yesno"
56+
- If confirmed, proceed with this track. Otherwise, immediately call the `ask_user` tool to request the correct track name (do not repeat the question in the chat):
57+
- **questions:**
58+
- **header:** "Clarify"
59+
- **question:** "Please type the exact name of the track you would like to implement."
60+
- **type:** "text"
4561
3. **If no incomplete tracks are found:**
4662
- Announce: "No incomplete tracks found in the tracks file. All tasks are completed!"
4763
- Halt the process and await further user instructions.
@@ -71,6 +87,7 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
7187
b. **Iterate Through Tasks:** You MUST now loop through each task in the track's **Implementation Plan** one by one.
7288
c. **For Each Task, You MUST:**
7389
i. **Defer to Workflow:** The **Workflow** file is the **single source of truth** for the entire task lifecycle. You MUST now read and execute the procedures defined in the "Task Workflow" section of the **Workflow** file you have in your context. Follow its steps for implementation, testing, and committing precisely.
90+
- **CRITICAL:** Every human-in-the-loop interaction, confirmation, or request for feedback mentioned in the **Workflow** (e.g., manual verification plans or guidance on persistent failures) MUST be conducted using the `ask_user` tool.
7491
7592
5. **Finalize Track:**
7693
- After all tasks in the track's local **Implementation Plan** are completed, you MUST update the track's status in the **Tracks Registry**.
@@ -99,31 +116,49 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
99116
a. **Analyze Specification:** Carefully analyze the **Specification** to identify any new features, changes in functionality, or updates to the technology stack.
100117
b. **Update Product Definition:**
101118
i. **Condition for Update:** Based on your analysis, you MUST determine if the completed feature or bug fix significantly impacts the description of the product itself.
102-
ii. **Propose and Confirm Changes:** If an update is needed, generate the proposed changes. Then, present them to the user for confirmation:
103-
> "Based on the completed track, I propose the following updates to the **Product Definition**:"
104-
> ```diff
105-
> [Proposed changes here, ideally in a diff format]
106-
> ```
107-
> "Do you approve these changes? (yes/no)"
119+
ii. **Propose and Confirm Changes:** If an update is needed:
120+
- **Announce:** Briefly state that updates are proposed. Do NOT repeat the request to review in the chat.
121+
- **Ask for Approval:** Use the `ask_user` tool to request confirmation. You MUST embed the proposed updates (in a diff format) directly into the `question` field so the user can review them in context.
122+
- **questions:**
123+
- **header:** "Product"
124+
- **question:**
125+
Please review the proposed updates to the Product Definition below. Do you approve?
126+
127+
---
128+
129+
<Insert Proposed product.md Updates/Diff Here>
130+
- **type:** "yesno"
108131
iii. **Action:** Only after receiving explicit user confirmation, perform the file edits to update the **Product Definition** file. Keep a record of whether this file was changed.
109132
c. **Update Tech Stack:**
110133
i. **Condition for Update:** Similarly, you MUST determine if significant changes in the technology stack are detected as a result of the completed track.
111-
ii. **Propose and Confirm Changes:** If an update is needed, generate the proposed changes. Then, present them to the user for confirmation:
112-
> "Based on the completed track, I propose the following updates to the **Tech Stack**:"
113-
> ```diff
114-
> [Proposed changes here, ideally in a diff format]
115-
> ```
116-
> "Do you approve these changes? (yes/no)"
134+
ii. **Propose and Confirm Changes:** If an update is needed:
135+
- **Announce:** Briefly state that updates are proposed. Do NOT repeat the request to review in the chat.
136+
- **Ask for Approval:** Use the `ask_user` tool to request confirmation. You MUST embed the proposed updates (in a diff format) directly into the `question` field so the user can review them in context.
137+
- **questions:**
138+
- **header:** "Tech Stack"
139+
- **question:**
140+
Please review the proposed updates to the Tech Stack below. Do you approve?
141+
142+
---
143+
144+
<Insert Proposed tech-stack.md Updates/Diff Here>
145+
- **type:** "yesno"
117146
iii. **Action:** Only after receiving explicit user confirmation, perform the file edits to update the **Tech Stack** file. Keep a record of whether this file was changed.
118147
d. **Update Product Guidelines (Strictly Controlled):**
119148
i. **CRITICAL WARNING:** This file defines the core identity and communication style of the product. It should be modified with extreme caution and ONLY in cases of significant strategic shifts, such as a product rebrand or a fundamental change in user engagement philosophy. Routine feature updates or bug fixes should NOT trigger changes to this file.
120149
ii. **Condition for Update:** You may ONLY propose an update to this file if the track's **Specification** explicitly describes a change that directly impacts branding, voice, tone, or other core product guidelines.
121-
iii. **Propose and Confirm Changes:** If the conditions are met, you MUST generate the proposed changes and present them to the user with a clear warning:
122-
> "WARNING: The completed track suggests a change to the core **Product Guidelines**. This is an unusual step. Please review carefully:"
123-
> ```diff
124-
> [Proposed changes here, ideally in a diff format]
125-
> ```
126-
> "Do you approve these critical changes to the **Product Guidelines**? (yes/no)"
150+
iii. **Propose and Confirm Changes:** If the conditions are met:
151+
- **Announce:** Briefly state that updates are proposed. Do NOT repeat the request to review in the chat.
152+
- **Ask for Approval:** Use the `ask_user` tool to request confirmation. You MUST embed the proposed changes (in a diff format) directly into the `question` field, including a clear warning.
153+
- **questions:**
154+
- **header:** "Product"
155+
- **question:**
156+
WARNING: This is a sensitive action as it impacts core product guidelines. Please review the proposed changes below. Do you approve these critical changes?
157+
158+
---
159+
160+
<Insert Proposed product-guidelines.md Updates/Diff Here>
161+
- **type:** "yesno"
127162
iv. **Action:** Only after receiving explicit user confirmation, perform the file edits. Keep a record of whether this file was changed.
128163
129164
6. **Final Report:** Announce the completion of the synchronization process and provide a summary of the actions taken.
@@ -146,34 +181,41 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
146181
147182
1. **Execution Trigger:** This protocol MUST only be executed after the current track has been successfully implemented and the `SYNCHRONIZE PROJECT DOCUMENTATION` step is complete.
148183
149-
2. **Ask for User Choice:** You MUST prompt the user with the available options for the completed track.
150-
> "Track '<track_description>' is now complete. What would you like to do?
151-
> A. **Review (Recommended):** Run the review command to verify changes before finalizing.
152-
> B. **Archive:** Move the track's folder to `conductor/archive/` and remove it from the tracks file.
153-
> C. **Delete:** Permanently delete the track's folder and remove it from the tracks file.
154-
> D. **Skip:** Do nothing and leave it in the tracks file.
155-
> Please enter the option of your choice (A, B, C, or D)."
184+
2. **Ask for User Choice:** Immediately call the `ask_user` tool to prompt the user (do not repeat the question in the chat):
185+
- **questions:**
186+
- **header:** "Track Cleanup"
187+
- **question:** "Track '<track_description>' is now complete. What would you like to do?"
188+
- **type:** "choice"
189+
- **multiSelect:** false
190+
- **options:**
191+
- Label: "Review", Description: "Run the review command to verify changes before finalizing."
192+
- Label: "Archive", Description: "Move the track's folder to `conductor/archive/` and remove it from the tracks file."
193+
- Label: "Delete", Description: "Permanently delete the track's folder and remove it from the tracks file."
194+
- Label: "Skip", Description: "Do nothing and leave it in the tracks file."
156195
157196
3. **Handle User Response:**
158-
* **If user chooses "A" (Review):**
197+
* **If user chooses "Review":**
159198
* Announce: "Please run `/conductor:review` to verify your changes. You will be able to archive or delete the track after the review."
160-
* **If user chooses "B" (Archive):**
199+
* **If user chooses "Archive":**
161200
i. **Create Archive Directory:** Check for the existence of `conductor/archive/`. If it does not exist, create it.
162201
ii. **Archive Track Folder:** Move the track's folder from its current location (resolved via the **Tracks Directory**) to `conductor/archive/<track_id>`.
163202
iii. **Remove from Tracks File:** Read the content of the **Tracks Registry** file, remove the entire section for the completed track (the part that starts with `---` and contains the track description), and write the modified content back to the file.
164203
iv. **Commit Changes:** Stage the **Tracks Registry** file and `conductor/archive/`. Commit with the message `chore(conductor): Archive track '<track_description>'`.
165204
v. **Announce Success:** Announce: "Track '<track_description>' has been successfully archived."
166-
* **If user chooses "C" (Delete):**
167-
i. **CRITICAL WARNING:** Before proceeding, you MUST ask for a final confirmation due to the irreversible nature of the action.
168-
> "WARNING: This will permanently delete the track folder and all its contents. This action cannot be undone. Are you sure you want to proceed? (yes/no)"
205+
* **If user chooses "Delete":**
206+
i. **CRITICAL WARNING:** Before proceeding, immediately call the `ask_user` tool to ask for final confirmation (do not repeat the warning in the chat):
207+
- **questions:**
208+
- **header:** "Confirm"
209+
- **question:** "WARNING: This will permanently delete the track folder and all its contents. This action cannot be undone. Are you sure?"
210+
- **type:** "yesno"
169211
ii. **Handle Confirmation:**
170212
- **If 'yes'**:
171213
a. **Delete Track Folder:** Resolve the **Tracks Directory** and permanently delete the track's folder from `<Tracks Directory>/<track_id>`.
172214
b. **Remove from Tracks File:** Read the content of the **Tracks Registry** file, remove the entire section for the completed track, and write the modified content back to the file.
173215
c. **Commit Changes:** Stage the **Tracks Registry** file and the deletion of the track directory. Commit with the message `chore(conductor): Delete track '<track_description>'`.
174216
d. **Announce Success:** Announce: "Track '<track_description>' has been permanently deleted."
175-
- **If 'no' (or anything else)**:
217+
- **If 'no'**:
176218
a. **Announce Cancellation:** Announce: "Deletion cancelled. The track has not been changed."
177-
* **If user chooses "D" (Skip) or provides any other input:**
219+
* **If user chooses "Skip":**
178220
* Announce: "Okay, the completed track will remain in your tracks file for now."
179-
"""
221+
"""

0 commit comments

Comments
 (0)