Skip to content

Commit 5c4558b

Browse files
authored
feat(demo): update demo, add lazygit demo (#12)
docs: add demo example changes file - my review changes feat: add pirate speak to demo
1 parent ec72804 commit 5c4558b

File tree

7 files changed

+164
-29
lines changed

7 files changed

+164
-29
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ using AI, prompt you to review and edit it, then commit it for you.
1212

1313
![cfme demo](./demo/demo.gif)
1414

15+
> There is also a demo available showing how to use `cfme` from within
16+
> [Lazygit](https://github.com/jesseduffield/lazygit/).
17+
> Jump to the [Lazygit Integration](#lazygit) section below.
18+
1519
## Features ✨
1620

1721
- **AI-Powered Commit Messages** - Leverages modern AI models
@@ -425,7 +429,9 @@ CFME_DEFAULT_PROMPT_VARIABLES_FILE_FETCH_URL
425429
426430
[Lazygit](https://github.com/jesseduffield/lazygit) is awesome.
427431
But `cfme` allows you to be even lazier! You can use `cfme`
428-
from within Lazygit's TUI to generate commit messages.
432+
from within Lazygit's TUI to generate commit messages:
433+
434+
![cfme lazygit demo](./demo/lazygit-demo.gif)
429435
430436
Just add the following custom command to your Lazygit config file
431437
(e.g. `~/.config/lazygit/config.yml`):

demo/demo.gif

845 KB
Loading

demo/demo.tape

Lines changed: 71 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,36 @@ Set WindowBar Colorful
1212
Type "# Welcome to the demo for cfme (Commit For Me)! 🐦 "
1313
Sleep 500ms
1414
Enter 2
15+
1516
Type "# Add some changes, then stage them:"
1617
Sleep 500ms
1718
Enter 2
19+
1820
Type "echo 'Example changes for demo' > my-changes.example"
1921
Sleep 500ms
2022
Enter
23+
2124
Type "git add my-changes.example"
2225
Sleep 500ms
2326
Enter 2
24-
Type "# Run cfme to generate commit message candidates"
25-
Sleep 50ms
26-
Enter
27-
Type "# pick from the candidates,"
27+
28+
Type "# cfme will generate a few commit message candidates based on the changes we made,"
2829
Sleep 50ms
2930
Enter
30-
Type "# and then review/edit the chosen message,"
31+
32+
Type "# we can then pick one of the candidates,"
3133
Sleep 50ms
3234
Enter
33-
Type "# before finally committing the changes."
35+
36+
Type "# edit or accept one message, and then commit."
3437
Sleep 50ms
3538
Enter 2
36-
Sleep 500ms
39+
3740
Type "cfme"
3841
Sleep 750ms
3942
Enter
43+
44+
# Wait for the screen, then add review changes and save the commit
4045
Wait@30000ms /Select commit/
4146
Sleep 1500ms
4247
Up 1
@@ -50,66 +55,104 @@ Ctrl+C
5055
Sleep 3000ms
5156
Type ":wq"
5257
Enter
53-
Sleep 500ms
54-
Type "# We have committed the changes with the chosen message!"
58+
5559
Sleep 1000ms
5660
Enter 2
57-
Type "# Cool! Now let's look at some additional options:"
61+
62+
Type "# Cool! But we can do more:"
5863
Sleep 500ms
5964
Enter 2
60-
Type "# Supply additional instructions on generating the messages:"
65+
66+
Type "# We can run cfme with custom prompts."
67+
Sleep 500ms
68+
Enter
69+
70+
Type "# For example, let's say your team always writes commit messages in pirate speak."
71+
Sleep 50ms
72+
Enter
73+
74+
Type "# You can create a custom prompt for that! Let's take a look at the pirate prompt:"
6175
Sleep 500ms
6276
Enter 2
63-
Type "git reset --soft HEAD~1 # Undo last commit so we can run the demo again"
77+
78+
Type "cat pirate-prompt.md"
6479
Sleep 500ms
80+
Enter
81+
82+
Sleep 5000ms
6583
Enter 2
66-
Type "cfme \"
67-
Sleep 50ms
68-
Enter
69-
Type "--instructions 'These are not real changes, the header should be in ALL CAPS.' \"
70-
Sleep 50ms
84+
85+
Type "# We chose to slot in our 'PIRATE_EXPRESSIONS' with a string from a YAML file:"
86+
Sleep 500ms
87+
Enter 2
88+
89+
Type "cat pirate-vars.yaml"
90+
Sleep 500ms
7191
Enter
72-
Type "--response \"
92+
93+
Sleep 5000ms
94+
Enter 2
95+
96+
Type "# Now let's run cfme with our custom pirate prompt!"
97+
Enter 2
98+
99+
# Run cfme with the custom prompt and variables, wait for the screen
100+
Type "git reset --soft HEAD~1 # We undo the last commit so we can run the demo again"
101+
Sleep 500ms
102+
Enter 2
103+
Type "# -p will specify the prompt file, -v the variables file"
73104
Sleep 50ms
74105
Enter
75-
Type "--silent \"
106+
Type "# -r will print the AI response directly, -s will run in silent mode"
76107
Sleep 50ms
77-
Enter
78-
Type "# -r prints the response only (useful for piping), -s suppresses debug output"
108+
Enter 2
109+
Type "cfme -p pirate-prompt.md -v pirate-vars.yaml -rs"
79110
Sleep 750ms
80111
Enter
81112
Wait+Screen@30000ms /commitMessages/
113+
82114
Sleep 3000ms
83115
Enter
84-
Type "# You get the idea! Here are some more options, we won't run them now:"
116+
117+
Type "# You get the idea now! Here are some more options"
85118
Sleep 750ms
86119
Enter 2
87-
Type "# Supplying a custom prompt and prompt variables file:"
120+
121+
Type "# Supply instructions to help the AI process your changes:"
88122
Sleep 250ms
89123
Enter
90-
Type "# cfme -p my-prompt.md -v my-variables.yaml"
124+
125+
Type "# cfme -i 'This commit changes xyz for abc reason'"
91126
Sleep 250ms
92127
Enter 2
128+
93129
Type "# Print the parsed prompt only (useful for debugging):"
94130
Sleep 250ms
95131
Enter
132+
96133
Type "# cfme --print-parsed-prompt"
97134
Sleep 250ms
98135
Enter 2
99-
Type "# Printing the reviewed message instead of committing:"
136+
137+
Type "# Printing the reviewed message (useful for piping to other tools):"
100138
Sleep 250ms
101139
Enter
102-
Type "# cfme --message (useful for piping to other tools)"
140+
141+
Type "# cfme -m"
103142
Sleep 250ms
104143
Enter 2
105-
Type "# Remember, you can easily customize cfme to use prompts that fit our own workflow!"
144+
145+
Type "# Remember, it is really easy to customize cfme to use prompts that fit your workflow!"
106146
Sleep 50ms
107147
Enter
108-
Type "# Be sure to check out the documentation for more details."
148+
149+
Type "# Be sure to check out the documentation for more information."
109150
Sleep 750ms
110151
Enter 2
152+
111153
Type "# Now, go download cfme, and thanks for watching!"
112154
Sleep 500ms
113155
Enter
156+
114157
Type "# - codevogel 🐦 (codevogel.com)"
115158
Sleep 3000ms

demo/lazygit-demo.gif

1.2 MB
Loading

demo/lazygit-demo.tape

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Where should we write the GIF?
2+
Output lazygit-demo.gif
3+
4+
# Set up a 1200x600 terminal with 46px font.
5+
Set FontSize 20
6+
Set FontFamily "JetBrains Mono"
7+
Set Width 1200
8+
Set Height 600
9+
Set Theme "Kanagawa"
10+
Set WindowBar Colorful
11+
12+
Type "# Welcome to the lazygit demo for cfme (Commit For Me)! 🐦 "
13+
Sleep 500ms
14+
Enter 2
15+
Type "# We will add some changes, then stage them, and then press Ctrl-a to run cfme."
16+
Sleep 50ms
17+
Enter
18+
Type "# cfme will generate a few commit message candidates based on the changes we made,"
19+
Sleep 50ms
20+
Enter
21+
Type "# we can then pick one of the candidates,"
22+
Sleep 50ms
23+
Enter
24+
Type "# edit or accept one message, and then commit."
25+
Sleep 50ms
26+
Enter 2
27+
Type "echo 'Example changes for demo' > my-changes.example"
28+
Sleep 500ms
29+
Enter
30+
Type "lazygit"
31+
Sleep 500ms
32+
Enter
33+
Sleep 500ms
34+
Type "a"
35+
Sleep 1000ms
36+
Ctrl+A
37+
Wait@30000ms /Select commit/
38+
Sleep 1500ms
39+
Up 1
40+
Sleep 500ms
41+
Up 1
42+
Sleep 1000ms
43+
Enter
44+
Sleep 1000ms
45+
Type "G$a - my review changes"
46+
Ctrl+C
47+
Sleep 3000ms
48+
Type ":wq"
49+
Enter
50+
Sleep 2000ms
51+
Type "q"
52+
Sleep 500ms
53+
Type "# We have committed the changes with the chosen message using lazygit!"
54+
Sleep 1000ms
55+
Enter 2
56+
Type "# Remember, it is really easy to customize cfme to use prompts that fit your workflow!"
57+
Sleep 50ms
58+
Enter
59+
Type "# Be sure to check out the documentation for more information."
60+
Sleep 750ms
61+
Enter 2
62+
Type "# Now, go download cfme, and thanks for watching!"
63+
Sleep 500ms
64+
Enter
65+
Type "# - codevogel 🐦 (codevogel.com)"
66+
Sleep 3000ms

demo/pirate-prompt.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
You write git commit messages in pirate speak.
2+
3+
Get inspired by these pirate expressions:
4+
<__PIRATE_EXPRESSIONS__>
5+
6+
You MUST generate exactly 3 commit messages
7+
8+
<__RESPONSE_FORMAT_REQUIREMENTS__>
9+
10+
These are the changes:
11+
<__GIT_DIFF__>

demo/pirate-vars.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
vars:
2+
- template_string: "<__PIRATE_EXPRESSIONS__>"
3+
value: |
4+
1. Avast!
5+
2. Shiver me timbers!
6+
3. Yo-ho-ho!
7+
# Or use 'value_from' with one or more commands to fetch the value, e.g.:
8+
value_from: |
9+
curl -s https://pirate.com/pirate-expressions.txt | head -n 3

0 commit comments

Comments
 (0)