Skip to content

Commit 1b4821a

Browse files
committed
refactor: rename RESPONSE_REQUIREMENTS string to RESPONSE_FORMAT_REQUIREMENTS
1 parent de6cdfb commit 1b4821a

File tree

8 files changed

+24
-21
lines changed

8 files changed

+24
-21
lines changed

defaults/prompts/conventional-commits/default.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ 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

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"
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<__RESPONSE_REQUIREMENTS__>
2-
<__GIT_DIFF__>
1+
<**RESPONSE_FORMAT_REQUIREMENTS**>
2+
<**GIT_DIFF**>
33
LINE_1
4-
<__VAR1__>
4+
<**VAR1**>
55
LINE2
6-
<__VAR2__>
6+
<**VAR2**>
77
LINE3
8-
<__VAR3__>
9-
<__INSTRUCTIONS__>
8+
<**VAR3**>
9+
<**INSTRUCTIONS**>

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/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"

src/lib/load_vars_map.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ load_vars_map() {
3636
# Add defaults to the map
3737
referenced_map["<__GIT_DIFF__>"]="$(git diff --cached)"
3838

39-
referenced_map["<__RESPONSE_REQUIREMENTS__>"]="$(
39+
referenced_map["<__RESPONSE_FORMAT_REQUIREMENTS__>"]="$(
4040
cat <<'EOF'
41-
**Requirements:**
41+
**Response Format Requirements:**
4242
4343
- Each commit message MUST include a 'header'.
4444
- Optionally include 'body' and 'footer', ONLY if a 'header'

src/lib/validate_vars_map.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function validate_vars_map() {
1717
continue
1818
fi
1919
if ! grep -q "$key" <<<"$prompt"; then
20-
if [[ "$key" == "<__RESPONSE_REQUIREMENTS__>" || "$key" == "<__GIT_DIFF__>" ]]; then
20+
if [[ "$key" == "<__RESPONSE_FORMAT_REQUIREMENTS__>" || "$key" == "<__GIT_DIFF__>" ]]; then
2121
# This key is mandatory
2222
echo "Error: key '$key' is essential for cfme to function, but not present in the prompt." >&2
2323
return 1

0 commit comments

Comments
 (0)