Skip to content

Commit 3f5fafa

Browse files
committed
feat(prompts): add versioning and last amended information to prompt files
1 parent 18c8525 commit 3f5fafa

File tree

7 files changed

+173
-2
lines changed

7 files changed

+173
-2
lines changed

.github/prompts/speckit.implement.prompt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ Before marking implementation as complete, verify:
3333
- [ ] All `### Show & Tell` steps executed successfully for each phase
3434
- [ ] Repository-template capabilities are present and up to date (see [.github/skills/repository-template/SKILL.md](/.github/skills/repository-template/SKILL.md))
3535
- [ ] `make lint` and `make test` complete with zero errors and zero warnings
36+
37+
---
38+
39+
> **Version**: 1.5.1
40+
> **Last Amended**: 2026-01-21

.github/prompts/speckit.plan.prompt.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Before marking `plan.md` as complete, verify:
2929

3030
- [ ] Plan addresses all requirements from `spec.md`
3131
- [ ] All architectural decisions have corresponding ADRs
32-
- [ ] Toolchain versions are specified
32+
- [ ] Toolchain versions are specified, verified online during planning, and confirmed as the latest stable releases
3333
- [ ] Repository-template capabilities are planned using the skill at [.github/skills/repository-template/SKILL.md](/.github/skills/repository-template/SKILL.md), including at minimum:
3434
- [ ] Core Make System
3535
- [ ] Pre-commit Hooks
@@ -40,3 +40,8 @@ Before marking `plan.md` as complete, verify:
4040
- [ ] Tool Version Management
4141
- [ ] Each phase and user story includes a `### Show & Tell` subsection
4242
- [ ] Show & Tell subsections are placed at the end of each phase or user story
43+
44+
---
45+
46+
> **Version**: 1.5.1
47+
> **Last Amended**: 2026-01-21

.github/prompts/speckit.tasks.prompt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ Before marking `tasks.md` as complete, verify:
5353
- [ ] Test tasks are listed before their corresponding implementation tasks
5454
- [ ] Each phase and user story ends with a task that runs `make lint` and `make test`
5555
- [ ] Each phase and user story includes a `### Show & Tell` subsection with executable steps
56+
57+
---
58+
59+
> **Version**: 1.5.1
60+
> **Last Amended**: 2026-01-21

.specify/extensions/prompts/speckit.implement.prompt.ext.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ Before marking implementation as complete, verify:
2929
- [ ] All `### Show & Tell` steps executed successfully for each phase
3030
- [ ] Repository-template capabilities are present and up to date (see [.github/skills/repository-template/SKILL.md](/.github/skills/repository-template/SKILL.md))
3131
- [ ] `make lint` and `make test` complete with zero errors and zero warnings
32+
33+
---
34+
35+
> **Version**: 1.5.1
36+
> **Last Amended**: 2026-01-21

.specify/extensions/prompts/speckit.plan.prompt.ext.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ Before marking `plan.md` as complete, verify:
3636
- [ ] Tool Version Management
3737
- [ ] Each phase and user story includes a `### Show & Tell` subsection
3838
- [ ] Show & Tell subsections are placed at the end of each phase or user story
39+
40+
---
41+
42+
> **Version**: 1.5.1
43+
> **Last Amended**: 2026-01-21

.specify/extensions/prompts/speckit.tasks.prompt.ext.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,8 @@ Before marking `tasks.md` as complete, verify:
4949
- [ ] Test tasks are listed before their corresponding implementation tasks
5050
- [ ] Each phase and user story ends with a task that runs `make lint` and `make test`
5151
- [ ] Each phase and user story includes a `### Show & Tell` subsection with executable steps
52+
53+
---
54+
55+
> **Version**: 1.5.1
56+
> **Last Amended**: 2026-01-21

scripts/patch-speckit.sh

Lines changed: 142 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,24 @@ function patch-file() {
184184

185185
local upstream_content
186186
local extension_content
187+
local extension_body
188+
local extension_footer
187189
local patched_content
188190

189191
upstream_content=$(cat "$upstream_file")
190192
extension_content=$(cat "$ext_file")
191-
patched_content=$(inject-extension "$upstream_content" "$extension_content" "$injection_point")
193+
194+
# Separate extension body from footer (footer starts with --- followed by version block)
195+
extension_body=$(extract-extension-body "$extension_content")
196+
extension_footer=$(extract-extension-footer "$extension_content")
197+
198+
# Inject extension body at the configured location
199+
patched_content=$(inject-extension "$upstream_content" "$extension_body" "$injection_point")
200+
201+
# Append footer at the very end if present
202+
if [[ -n "$extension_footer" ]]; then
203+
patched_content=$(append-footer "$patched_content" "$extension_footer")
204+
fi
192205

193206
echo "$patched_content" > "$target_file"
194207

@@ -452,6 +465,134 @@ function inject-prepend() {
452465
return 0
453466
}
454467

468+
# Extract the body of an extension file (everything before the footer).
469+
# The footer is identified by a line containing only "---" followed by
470+
# lines starting with "> **Version**:" and "> **Last Amended**:".
471+
# Arguments:
472+
# $1=[extension content]
473+
# Returns:
474+
# Extension body without footer (via stdout)
475+
function extract-extension-body() {
476+
local content="$1"
477+
local result=""
478+
local footer_start_line=""
479+
local line_num=0
480+
local lines=()
481+
482+
# Read content into array
483+
while IFS= read -r line || [[ -n "$line" ]]; do
484+
lines+=("$line")
485+
done <<< "$content"
486+
487+
local total_lines=${#lines[@]}
488+
489+
# Scan backwards to find footer pattern: --- followed by Version and Last Amended
490+
local i=$((total_lines - 1))
491+
while [[ $i -ge 0 ]]; do
492+
local line="${lines[$i]}"
493+
if [[ "$line" == "---" ]]; then
494+
# Check if following lines match footer pattern
495+
local next_idx=$((i + 1))
496+
if [[ $next_idx -lt $total_lines ]]; then
497+
local next_line="${lines[$next_idx]}"
498+
if [[ "$next_line" =~ ^\>\ \*\*Version\*\*: ]]; then
499+
footer_start_line=$i
500+
break
501+
fi
502+
fi
503+
fi
504+
((i--))
505+
done
506+
507+
# Output body (everything before footer)
508+
if [[ -n "$footer_start_line" ]]; then
509+
# Remove trailing blank lines before footer
510+
local end_idx=$((footer_start_line - 1))
511+
while [[ $end_idx -ge 0 ]] && [[ -z "${lines[$end_idx]}" ]]; do
512+
((end_idx--))
513+
done
514+
for ((j = 0; j <= end_idx; j++)); do
515+
result+="${lines[$j]}"$'\n'
516+
done
517+
else
518+
# No footer found, return entire content
519+
result="$content"$'\n'
520+
fi
521+
522+
# Remove trailing newline
523+
result="${result%$'\n'}"
524+
echo "$result"
525+
526+
return 0
527+
}
528+
529+
# Extract the footer from an extension file.
530+
# The footer is identified by a line containing only "---" followed by
531+
# lines starting with "> **Version**:" and "> **Last Amended**:".
532+
# Arguments:
533+
# $1=[extension content]
534+
# Returns:
535+
# Footer content (via stdout), empty if no footer found
536+
function extract-extension-footer() {
537+
local content="$1"
538+
local result=""
539+
local footer_start_line=""
540+
local lines=()
541+
542+
# Read content into array
543+
while IFS= read -r line || [[ -n "$line" ]]; do
544+
lines+=("$line")
545+
done <<< "$content"
546+
547+
local total_lines=${#lines[@]}
548+
549+
# Scan backwards to find footer pattern: --- followed by Version and Last Amended
550+
local i=$((total_lines - 1))
551+
while [[ $i -ge 0 ]]; do
552+
local line="${lines[$i]}"
553+
if [[ "$line" == "---" ]]; then
554+
# Check if following lines match footer pattern
555+
local next_idx=$((i + 1))
556+
if [[ $next_idx -lt $total_lines ]]; then
557+
local next_line="${lines[$next_idx]}"
558+
if [[ "$next_line" =~ ^\>\ \*\*Version\*\*: ]]; then
559+
footer_start_line=$i
560+
break
561+
fi
562+
fi
563+
fi
564+
((i--))
565+
done
566+
567+
# Output footer if found
568+
if [[ -n "$footer_start_line" ]]; then
569+
for ((j = footer_start_line; j < total_lines; j++)); do
570+
result+="${lines[$j]}"$'\n'
571+
done
572+
fi
573+
574+
# Remove trailing newline
575+
result="${result%$'\n'}"
576+
echo "$result"
577+
578+
return 0
579+
}
580+
581+
# Append footer to the end of patched content.
582+
# Arguments:
583+
# $1=[patched content]
584+
# $2=[footer content]
585+
# Returns:
586+
# Content with footer appended (via stdout)
587+
function append-footer() {
588+
local content="$1"
589+
local footer="$2"
590+
591+
echo "${content}"$'\n'$'\n'"${footer}"
592+
593+
return 0
594+
}
595+
455596
# ==============================================================================
456597

457598
# Check if an argument is truthy (true, yes, y, on, 1).

0 commit comments

Comments
 (0)