Skip to content

Commit 070efcc

Browse files
authored
Rename /refactor to /modify, start running the app, and update GEMINI.md (#69)
1 parent 8bd2e5b commit 070efcc

File tree

9 files changed

+175
-82
lines changed

9 files changed

+175
-82
lines changed

.gemini/GEMINI.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Project Overview
22

3-
This repository contains a Gemini CLI extension for facilitating Flutter and Dart development. The extension provides a set of commands to streamline common development tasks, including project creation, refactoring, and committing code. It enforces a set of coding standards and best practices for building high-quality Flutter and Dart applications.
3+
This repository contains a Gemini CLI extension for facilitating Flutter and Dart development. The extension provides a set of commands to streamline common development tasks, including project creation, modification, and committing code. It enforces a set of coding standards and best practices for building high-quality Flutter and Dart applications.
44

55
The core of this extension is the `flutter.md` context file, which provides a comprehensive set of rules and guidelines for the AI model. These guidelines cover everything from project structure and coding style to state management and testing.
66

7-
The extension also includes a set of commands defined in `.toml` files within the `commands` directory. These commands provide a structured way to interact with the AI model for tasks such as creating new apps, refactoring existing code, and preparing changes for commit.
7+
The extension also includes a set of commands defined in `.toml` files within the `commands` directory. These commands provide a structured way to interact with the AI model for tasks such as creating new apps, modifying existing code, and preparing changes for commit.
88

99
## Building and Running
1010

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Help Gemini CLI create, build, test, and run Flutter apps.
77
## ✨ Features
88

99
- **🚀 Project Bootstrapping**: Create new Flutter projects from scratch with built-in best practices, including linters, documentation, and design planning.
10-
- **🔧 Guided Refactoring**: Execute complex refactoring tasks with automated planning, git branch management, and step-by-step implementation guides for your approval.
10+
- **🔧 Guided Modifications**: Execute complex modification tasks with automated planning, git branch management, and step-by-step implementation guides for your approval.
1111
- **✅ Automated Pre-Commit Checks**: Automatically format, analyze, and test your code before committing to maintain codebase quality.
1212
- **✍️ Smart Commit Messaging**: Generate descriptive, conventional commit messages based on your staged changes.
1313
- **🧠 Context Priming**: Initializes Gemini with specific rules and context for Dart and Flutter, ensuring high-quality, idiomatic code generation.
@@ -46,7 +46,7 @@ The new commands will be available in new Gemini CLI sessions. The following com
4646

4747
- `/create-app` - Guides you through bootstrapping a new Flutter project with best practices.
4848
- `/create-package` - Guides you through bootstrapping a new Dart package with best practices.
49-
- `/refactor` - Manages a structured refactoring session with automated planning.
49+
- `/modify` - Manages a structured modification session with automated planning.
5050
- `/commit` - Automates pre-commit checks and generates a descriptive commit message.
5151

5252
## 💡 Usage
@@ -68,19 +68,19 @@ Initiates a guided process to bootstrap a new Flutter application, ensuring your
6868
/create-app I want to create a trip planning app
6969
```
7070

71-
### `/refactor`
71+
### `/modify`
7272

73-
Starts a structured session to refactor existing code. It helps you plan and execute changes safely and efficiently.
73+
Starts a structured session to modify existing code. It helps you plan and execute changes safely and efficiently.
7474

7575
**Process:**
7676

77-
1. Asks for your high-level refactoring goals and what you want to accomplish.
78-
2. Offers to create a new `git` branch for the refactoring work, isolating changes.
79-
3. Generates a `REFACTOR.md` design document detailing the proposed changes.
80-
4. Creates a phased `REFACTOR_IMPLEMENTATION.md` plan for your review and approval.
77+
1. Asks for your high-level modification goals and what you want to accomplish.
78+
2. Offers to create a new `git` branch for the modification work, isolating changes.
79+
3. Generates a `MODIFICATION_DESIGN.md` design document detailing the proposed changes.
80+
4. Creates a phased `MODIFICATION_IMPLEMENTATION.md` plan for your review and approval.
8181

8282
```bash
83-
/refactor
83+
/modify
8484
```
8585

8686
### `/commit`

commands/create-app.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ The design doc should (at least) include sections for:
4747
- A summary of the design
4848
- References to research URLs used to arrive at the design.
4949
50+
Be sure to **actually fetch and read** the research URLs **before** writing the design document. Do actual web research on the topics that are important to the design.
51+
5052
You must ask the user to review this design document and they must approve it before you continue on to create the implementation plan. They must review and approve it first because if they ask for any changes, it may affect the implementation plan.
5153
5254
## Implementation plan
@@ -70,20 +72,26 @@ In the first phase of the implementation plan, include:
7072
- [ ] Update the README.md to include a short placeholder description of the package.
7173
- [ ] Create the CHANGELOG.md to have the initial version of 0.1.0.
7274
- [ ] Commit this empty version of the package to either a new branch or the current branch based on the user's preference.
75+
- [ ] After commiting the change, start running the app with the launch_app tool on the user's preferred device.
7376
7477
The implementation plan should specify after each phase that you should:
7578
7679
- [ ] Create/modify unit tests for testing the code added or modified in this phase, if relevant.
77-
- [ ] Run the dart_fix and dart_format tools to clean up the code.
80+
- [ ] Run the dart_fix tool to clean up the code.
7881
- [ ] Run the analyze_files tool one more time and fix any issues.
7982
- [ ] Run any tests to make sure they all pass.
80-
- [ ] Run dart_format one more time to make sure that the formatting is still correct if you made any changes during the analysis and testing steps.
83+
- [ ] Run dart_format to make sure that the formatting is correct.
8184
- [ ] Re-read the IMPLEMENTATION.md file to see what, if anything, has changed in the implementation plan, and if it has changed, take care of anything the changes imply.
8285
- [ ] Update the IMPLEMENTATION.md file with the current state, including any learnings, surprises, or deviations in the Journal section. Check off any checkboxes of items that have been completed.
8386
- [ ] Use `git diff` to verify the changes that have been made, and create a suitable commit message for any changes, following any guidelines you have about commit messages. Be sure to properly escape dollar signs and backticks, and present the change message to the user for approval.
8487
- [ ] Wait for approval. Don't commit the changes or move on to the next phase of implementation until the user approves the commit.
88+
- [ ] After commiting the change, if the app is running, use the hot_reload tool to reload it.
89+
90+
In the last phase of the plan, include steps to:
8591
86-
In the last phase of the plan, include a step to create a comprehensive README.md file for the package.
92+
- [ ] Create a comprehensive README.md file for the package.
93+
- [ ] Create a GEMINI.md file in the project directory that describes the app, its purpose, and implementation details of the application and the layout of the files.
94+
- [ ] Ask the user to inspect the app and the code and say if they are satisfied with it, or if any modifications are needed.
8795
8896
You must ask the user to review this implementation plan and they must approve it before starting implementation. They must review and approve it before you begin because if they ask for any changes, the changes may affect the implementation.
8997

commands/create-package.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# This command will be invoked via: /flutter:create-package
66

7-
description = "Create a new Dart or Flutter package."
7+
description = "Create a new Dart or Flutter package, with an opinionated structure."
88

99
prompt = """
1010
We're going to build a new Dart or Flutter package.
@@ -48,6 +48,8 @@ The design doc should (at least) include sections for:
4848
- A summary of the design
4949
- References to research URLs used to arrive at the design.
5050
51+
Be sure to **actually fetch and read** the research URLs **before** writing the design document. Do actual web research on the topics that are important to the design.
52+
5153
You must ask the user to review this design document and they must approve it before you continue on to create the implementation plan. They must review and approve it first because if they ask for any changes, it may affect the implementation plan.
5254
5355
## Implementation plan
@@ -75,16 +77,20 @@ In the first phase of the implementation plan, include:
7577
The implementation plan should specify after each phase that you should:
7678
7779
- [ ] Create/modify unit tests for testing the code added or modified in this phase, if relevant.
78-
- [ ] Run the dart_fix and dart_format tools to clean up the code.
80+
- [ ] Run the dart_fix tool to clean up the code.
7981
- [ ] Run the analyze_files tool one more time and fix any issues.
8082
- [ ] Run any tests to make sure they all pass.
81-
- [ ] Run dart_format one more time to make sure that the formatting is still correct if you made any changes during the analysis and testing steps.
83+
- [ ] Run dart_format to make sure that the formatting is correct.
8284
- [ ] Re-read the IMPLEMENTATION.md file to see what, if anything, has changed in the implementation plan, and if it has changed, take care of anything the changes imply.
8385
- [ ] Update the IMPLEMENTATION.md file with the current state, including any learnings, surprises, or deviations in the Journal section. Check off any checkboxes of items that have been completed.
8486
- [ ] Use `git diff` to verify the changes that have been made, and create a suitable commit message for any changes, following any guidelines you have about commit messages. Be sure to properly escape dollar signs and backticks, and present the change message to the user for approval.
8587
- [ ] Wait for approval. Don't commit the changes or move on to the next phase of implementation until the user approves the commit.
8688
87-
In the last phase of the plan, include a step to create a comprehensive README.md file for the package.
89+
In the last phase of the plan, include steps to:
90+
91+
- [ ] Create a comprehensive README.md file for the package.
92+
- [ ] Create a GEMINI.md file in the project directory that describes the package, its purpose, and implementation details of the package and the layout of the files.
93+
- [ ] Ask the user to inspect the package and say if they are satisfied with it, or if any modifications are needed.
8894
8995
You must ask the user to review this implementation plan and they must approve it before starting implementation. They must review and approve it before you begin because if they ask for any changes, the changes may affect the implementation.
9096

commands/modify.toml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Copyright 2025 The Flutter Authors.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
# This command will be invoked via: /flutter:modify
6+
7+
description = "Perform a modification of your Flutter or Dart project."
8+
9+
prompt = """
10+
We're going to modify some code.
11+
12+
## Problem specification
13+
14+
First, prompt the user for a description of what the purpose and details of the modification will be.
15+
16+
Once the user has specified the description and purpose of the modification, outline the information that you will be collecting before creating the design and implementation plan, and present the list to the user, along with your first question.
17+
18+
## Collecting Information
19+
20+
Next, collect remaining information from the user, one question at a time.
21+
22+
The information you need to collect includes, but might not be limited to:
23+
24+
- If there are ambiguous elements to the modification, ask the user questions to clarify. When the goal is clear, or the user says to, then move on.
25+
- Whether to do the work on the current git branch, or a new feature branch.
26+
- Suggest a branch name, making sure it is a valid git branch name.
27+
28+
## Initialize workspace
29+
30+
First, make sure there are no uncommitted changes on the current branch. If there are, notify the user and ask what they would like to do about them before proceeding.
31+
32+
If the user wants the work done on a new branch, create the branch now.
33+
34+
## Modification design document
35+
36+
Develop a **DETAILED** Markdown-formatted design document that follows all of the guidance you have about Dart and Flutter design patterns, rules, best practices, and core principles. Save the design document in MODIFICATION_DESIGN.md in the top directory of the workspace. Feel free to use your available tools to research any aspects of the modification that are unclear.
37+
38+
The design doc should (at least) include:
39+
40+
- An overview
41+
- A detailed analysis of the goal or problem
42+
- Alternatives considered
43+
- A detailed design for the modification
44+
- Any diagrams needed to explain the modification or the design, in Mermaid format.
45+
- Be sure to put quotes around labels that include special characters (e.g. parenthesis).
46+
- A summary of the design
47+
- References to research URLs used to arrive at the design.
48+
49+
Be sure to **actually fetch and read** the research URLs **before** writing the design document. Do actual web research on the topics that are important to the design.
50+
51+
You must ask the user to review this design document and they must approve it before you continue on to create the implementation plan. They must review and approve it first because if they ask for any changes, it may affect the implementation plan.
52+
53+
## Implementation plan
54+
55+
After getting explicit approval from the user for the MODIFICATION_DESIGN.md document, develop a **DETAILED** Markdown-formatted phased implementation plan of checkboxed tasks that need to be performed in order to finish the modification. Save the implementation plan in MODIFICATION_IMPLEMENTATION.md in the top of the repo.
56+
57+
The implementation plan should include a section for a "Journal" which will be updated after each phase and contain a log of the actions taken, things learned, surprises, and deviations from the plan. It should be in chronological order.
58+
59+
The plan should include instructions similar to: "After completing a task, if you added any TODOs to the code or didn't fully implement anything, make sure to add new tasks so that you can come back and complete them later." to prevent leaving tasks unfinished.
60+
61+
In the first phase of the implementation plan, include:
62+
- [ ] Run all tests to ensure the project is in a good state before starting modifications.
63+
64+
The implementation plan should specify after each phase that you should:
65+
66+
- [ ] Create/modify unit tests for testing the code added or modified in this phase, if relevant.
67+
- [ ] Run the dart_fix tool to clean up the code.
68+
- [ ] Run the analyze_files tool one more time and fix any issues.
69+
- [ ] Run any tests to make sure they all pass.
70+
- [ ] Run dart_format to make sure that the formatting is correct.
71+
- [ ] Re-read the MODIFICATION_IMPLEMENTATION.md file to see what, if anything, has changed in the implementation plan, and if it has changed, take care of anything the changes imply.
72+
- [ ] Update the MODIFICATION_IMPLEMENTATION.md file with the current state, including any learnings, surprises, or deviations in the Journal section. Check off any checkboxes of items that have been completed.
73+
- [ ] Use `git diff` to verify the changes that have been made, and create a suitable commit message for any changes, following any guidelines you have about commit messages. Be sure to properly escape dollar signs and backticks, and present the change message to the user for approval.
74+
- [ ] Wait for approval. Don't commit the changes or move on to the next phase of implementation until the user approves the commit.
75+
- [ ] After commiting the change, if an app is running, use the hot_reload tool to reload it.
76+
77+
In the last phase of the plan, include steps to:
78+
79+
- [ ] Update any README.md file for the package with relevant information from the modification (if any).
80+
- [ ] Update any GEMINI.md file in the project directory so that it still correctly describes the app, its purpose, and implementation details and the layout of the files.
81+
- [ ] Ask the user to inspect the package (and running app, if any) and say if they are satisfied with it, or if any modifications are needed.
82+
83+
You must ask the user to review this implementation plan and they must approve it before starting implementation. They must review and approve it before you begin because if they ask for any changes, the changes may affect the implementation.
84+
85+
## Implementation
86+
87+
After getting explicit approval from the user for the MODIFICATION_IMPLEMENTATION.md document, begin implementing the plan.
88+
"""

0 commit comments

Comments
 (0)