Skip to content

Commit ec72804

Browse files
authored
fix: remove conventional commits styling from response format requirements
* refactor: rename RESPONSE_REQUIREMENTS string to RESPONSE_FORMAT_REQUIREMENTS * fix: remove conventional commits styling from response format requirements
1 parent de6cdfb commit ec72804

12 files changed

+28
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ There are three special template strings that `cfme` recognizes by default:
275275

276276
- `<__GIT_DIFF__>` (required): Replaced with the output of `git diff --cached`
277277
(i.e. the staged changes)
278-
- `<__RESPONSE__REQUIREMENTS__>` (required): Replaced with a list of requirements
278+
- `<__RESPONSE_FORMAT_REQUIREMENTS__>` (required): Replaced with a list of requirements
279279
that dictates how the AI should format its response. This is essential so
280280
that `cfme` can parse the AI's response.
281281
Note that these requirements merely dictate the format of the response, they

defaults/prompts/conventional-commits/default.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ You are an expert at creating git commit messages according to the Conventional
22

33
---
44

5-
<__RESPONSE_REQUIREMENTS__>
5+
<__RESPONSE_FORMAT_REQUIREMENTS__>
6+
7+
**Content Requirements:**
8+
69
- ONLY and EXCLUSIVELY use the commit types listed in the following YAML file:
710

811
```yaml
912
<__ALLOWED_TYPES__>
1013
```
1114

1215
- Make sure to follow Conventional Commits:
16+
- A header is REQUIRED and must follow the format: `<required type>(<optional scope>): <required description>`
1317
- type MUST match one of the types provided
1418
- scope is OPTIONAL
1519
- breaking changes can be indicated with ! in header or BREAKING CHANGE in footer

spec/render_prompt_spec.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Describe 'render_prompt'
1919
It 'renders the prompt correctly with all variables replaced'
2020
local prompt_template="$(cat spec/samples/sample-prompt-complete.md)"
2121
declare -A vars_map
22-
vars_map["<__RESPONSE_REQUIREMENTS__>"]="$(cat spec/samples/sample-response-requirements.md)"
22+
vars_map["<__RESPONSE_FORMAT_REQUIREMENTS__>"]="$(cat spec/samples/sample-response-requirements.md)"
2323
vars_map["<__GIT_DIFF__>"]="SAMPLE_DIFF"
2424
vars_map["<__VAR1__>"]="VAL1"
2525
vars_map["<__VAR2__>"]="VAL2"
@@ -32,7 +32,7 @@ Describe 'render_prompt'
3232
It 'renders the prompt correctly with empty instructions'
3333
local prompt_template="$(cat spec/samples/sample-prompt-complete.md)"
3434
declare -A vars_map
35-
vars_map["<__RESPONSE_REQUIREMENTS__>"]="$(cat spec/samples/sample-response-requirements.md)"
35+
vars_map["<__RESPONSE_FORMAT_REQUIREMENTS__>"]="$(cat spec/samples/sample-response-requirements.md)"
3636
vars_map["<__GIT_DIFF__>"]="SAMPLE_DIFF"
3737
vars_map["<__VAR1__>"]="VAL1"
3838
vars_map["<__VAR2__>"]="VAL2"

spec/samples/sample-prompt-complete.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<__RESPONSE_REQUIREMENTS__>
1+
<__RESPONSE_FORMAT_REQUIREMENTS__>
22
<__GIT_DIFF__>
33
LINE_1
44
<__VAR1__>

spec/samples/sample-prompt-missing-1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<__RESPONSE_REQUIREMENTS__>
1+
<__RESPONSE_FORMAT_REQUIREMENTS__>
22
<__GIT_DIFF__>
33
LINE_1
44
LINE2

spec/samples/sample-prompt-missing-diff.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<__RESPONSE_REQUIREMENTS__>
1+
<__RESPONSE_FORMAT_REQUIREMENTS__>
22
LINE_1
33
<__VAR1__>
44
LINE2

spec/samples/sample-rendered-prompt-with-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**Requirements:**
1+
**Response Format Requirements:**
22

33
- Each commit message MUST include a 'header'.
44
- Optionally include 'body' and 'footer', ONLY if a 'header'
@@ -8,7 +8,7 @@
88

99
```yaml
1010
commitMessages:
11-
- header: "<type>[optional scope]: <description>"
11+
- header: "<required header>"
1212
body: "<optional body>"
1313
footer: "<optional footer>"
1414
score: <integer 0-100 representing confidence that this is the best commit message>

spec/samples/sample-rendered-prompt-without-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**Requirements:**
1+
**Response Format Requirements:**
22

33
- Each commit message MUST include a 'header'.
44
- Optionally include 'body' and 'footer', ONLY if a 'header'
@@ -8,7 +8,7 @@
88

99
```yaml
1010
commitMessages:
11-
- header: "<type>[optional scope]: <description>"
11+
- header: "<required header>"
1212
body: "<optional body>"
1313
footer: "<optional footer>"
1414
score: <integer 0-100 representing confidence that this is the best commit message>

spec/samples/sample-response-requirements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**Requirements:**
1+
**Response Format Requirements:**
22

33
- Each commit message MUST include a 'header'.
44
- Optionally include 'body' and 'footer', ONLY if a 'header'
@@ -8,7 +8,7 @@
88

99
```yaml
1010
commitMessages:
11-
- header: "<type>[optional scope]: <description>"
11+
- header: "<required header>"
1212
body: "<optional body>"
1313
footer: "<optional footer>"
1414
score: <integer 0-100 representing confidence that this is the best commit message>

spec/validate_vars_map_spec.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Describe 'validate_vars_map'
1717

1818
It 'validates variables successfully when everything matches'
1919
local -A map
20-
map["<__RESPONSE_REQUIREMENTS__>"]="SAMPLE_REQUIREMENTS"
20+
map["<__RESPONSE_FORMAT_REQUIREMENTS__>"]="SAMPLE_FORMAT_REQUIREMENTS"
2121
map["<__GIT_DIFF__>"]="SAMPLE_DIFF"
2222
map["<__VAR1__>"]="VAL1"
2323
map["<__VAR2__>"]="VAL2"
@@ -31,7 +31,7 @@ Describe 'validate_vars_map'
3131

3232
It 'fails when a prompt is missing a custom variable present in the map'
3333
local -A map
34-
map["<__RESPONSE_REQUIREMENTS__>"]="SAMPLE_REQUIREMENTS"
34+
map["<__RESPONSE_FORMAT_REQUIREMENTS__>"]="SAMPLE_FORMAT_REQUIREMENTS"
3535
map["<__GIT_DIFF__>"]="SAMPLE_DIFF"
3636
map["<__VAR1__>"]="VAL1"
3737
map["<__VAR2__>"]="VAL2"
@@ -44,9 +44,9 @@ Describe 'validate_vars_map'
4444
The status should be failure
4545
End
4646

47-
It 'fails when a prompt is missing mandatory template string RESPONSE_REQUIREMENTS in the prompt'
47+
It 'fails when a prompt is missing mandatory template string RESPONSE_FORMAT_REQUIREMENTS in the prompt'
4848
local -A map
49-
map["<__RESPONSE_REQUIREMENTS__>"]="SAMPLE_REQUIREMENTS"
49+
map["<__RESPONSE_FORMAT_REQUIREMENTS__>"]="SAMPLE_FORMAT_REQUIREMENTS"
5050
map["<__GIT_DIFF__>"]="SAMPLE_DIFF"
5151
map["<__VAR1__>"]="VAL1"
5252
map["<__VAR2__>"]="VAL2"
@@ -55,13 +55,13 @@ Describe 'validate_vars_map'
5555
local variables_file_path="/path/to/variables.yaml"
5656
local prompt="$(cat spec/samples/sample-prompt-missing-requirements.md)"
5757
When call validate_vars_map map "$prompt"
58-
The stderr should eq "Error: key '<__RESPONSE_REQUIREMENTS__>' is essential for cfme to function, but not present in the prompt."
58+
The stderr should eq "Error: key '<__RESPONSE_FORMAT_REQUIREMENTS__>' is essential for cfme to function, but not present in the prompt."
5959
The status should be failure
6060
End
6161

6262
It 'fails when a prompt is missing mandatory template string GIT_DIFF in the prompt'
6363
local -A map
64-
map["<__RESPONSE_REQUIREMENTS__>"]="SAMPLE_REQUIREMENTS"
64+
map["<__RESPONSE_FORMAT_REQUIREMENTS__>"]="SAMPLE_FORMAT_REQUIREMENTS"
6565
map["<__GIT_DIFF__>"]="SAMPLE_DIFF"
6666
map["<__VAR1__>"]="VAL1"
6767
map["<__VAR2__>"]="VAL2"
@@ -76,7 +76,7 @@ Describe 'validate_vars_map'
7676

7777
It 'fails when a map is missing a variable present in the prompt'
7878
local -A map
79-
map["<__RESPONSE_REQUIREMENTS__>"]="SAMPLE_REQUIREMENTS"
79+
map["<__RESPONSE_FORMAT_REQUIREMENTS__>"]="SAMPLE_FORMAT_REQUIREMENTS"
8080
map["<__GIT_DIFF__>"]="SAMPLE_DIFF"
8181

8282
map["<__VAR2__>"]="VAL2"

0 commit comments

Comments
 (0)