Skip to content

Commit 2b7b2bf

Browse files
authored
Merge pull request #15 from googleads/step_by_step
Step by step
2 parents 18042a2 + bad9849 commit 2b7b2bf

File tree

4 files changed

+96
-11
lines changed

4 files changed

+96
-11
lines changed

.gemini/commands/step_by_step.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
description = "Presents a response as a step by step process for the user to follow."
2+
prompt = """
3+
# Task
4+
5+
Break down the user's request into a clear, step-by-step process.
6+
7+
## Context
8+
User input: {{args}}
9+
10+
## Instructions
11+
12+
1. **Analyze** the user's request carefully.
13+
2. **Structure** your response as a clear, numbered list of steps.
14+
3. **Actionable Steps**: Ensure each step is a direct action the user can take.
15+
4. **Logical Flow**: The steps should follow a logical chronological or dependency-based order.
16+
5. **Headers**: Use headers to separate distinct phases if the process is complex.
17+
6. **Verification**: Include a final step or section on how to verify the task is complete, if applicable.
18+
19+
## Format
20+
1. Step 1
21+
2. Step 2
22+
...
23+
"""

ChangeLog

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
* 1.0.0
2-
- Release of verion 1.0
1+
* 1.4.0
2+
- Modified ChangeLog so changes are listed in reverse chronological order.
3+
- Added step_by_step custom command.
34

4-
* 1.1.0
5-
- Added support for PHP, Ruby, Java, and C#.
6-
- Find latest verion of the API and prompt user whether to use this version.
7-
- Modified setup.sh to clone copies of the client libraries.
5+
* 1.3.0
6+
- Added explain command.
7+
- Placed client libraries in a sub-directory of the project directory.
8+
- Updated setup and update scripts.
9+
- Added constraint to GEMINI.md to never modify files in api_examples.
810

911
* 1.2.0
1012
- Updated README.md for clarity
@@ -15,8 +17,10 @@
1517
- Modified logic in setup and update scripts.
1618
- Added tests for setup and update scripts.
1719

18-
* 1.3.0
19-
- Added explain command.
20-
- Placed client libraries in a sub-directory of the project directory.
21-
- Updated setup and update scripts.
22-
- Added constraint to GEMINI.md to never modify files in api_examples.
20+
* 1.1.0
21+
- Added support for PHP, Ruby, Java, and C#.
22+
- Find latest verion of the API and prompt user whether to use this version.
23+
- Modified setup.sh to clone copies of the client libraries.
24+
25+
* 1.0.0
26+
- Release of verion 1.0

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,22 @@ b. **Set Context in Gemini:** The `gemini` command must be run from the root of
119119
> ... (results displayed) ...
120120
> "Save the results to csv"
121121

122+
### Customm Commands
123+
124+
There is a bug in `/help`. It does not list custom commands defined in
125+
`.gemini/commands` under the project directory.
126+
127+
This is a partial list of custom commands:
128+
129+
* `/explain` - Format the response from the model to be more readable.
130+
* `/step_by_step` - Format the response as series of steps. Show the model's thinking process. This is useful for debugging.
131+
132+
To see the full list, from within the Assistant, `ls -l .gemini/commands`. This
133+
will provide a list of the .toml files that define the commands. For example, `explain.toml`
134+
can be executed as `/explain <your request>`.
135+
136+
Or, you can execute `run list_commands.py` from within the Assistant to see the full list with descriptions.
137+
122138
## Directory Structure
123139
124140
* `google-ads-api-developer-assistant/`: Root directory. **Launch `gemini` from here.**

list_commands.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import pathlib
2+
import tomllib
3+
import sys
4+
5+
def main():
6+
commands_dir = pathlib.Path(".gemini/commands")
7+
8+
if not commands_dir.exists():
9+
print(f"Directory not found: {commands_dir.absolute()}")
10+
sys.exit(1)
11+
12+
files = sorted(commands_dir.glob("*.toml"))
13+
14+
if not files:
15+
print("No .toml files found in .gemini/commands")
16+
return
17+
18+
# Collect all commands and descriptions
19+
commands = []
20+
for file_path in files:
21+
try:
22+
with file_path.open("rb") as f:
23+
data = tomllib.load(f)
24+
description = data.get("description", "No description found")
25+
commands.append((file_path.stem, description))
26+
except Exception as e:
27+
print(f"Error reading {file_path.name}: {e}", file=sys.stderr)
28+
29+
if not commands:
30+
return
31+
32+
# Calculate max length for alignment
33+
max_len = max(len(cmd[0]) for cmd in commands)
34+
35+
# Print aligned output
36+
# We add a few spaces gap between command and description
37+
gap = 3
38+
for name, description in commands:
39+
print(f"{name:<{max_len + gap}}{description}")
40+
41+
if __name__ == "__main__":
42+
main()

0 commit comments

Comments
 (0)