mirror of
https://github.com/github/spec-kit.git
synced 2026-07-05 21:49:47 +08:00
feat: add name field injection for forgecode agent
Forgecode requires both 'name' and 'description' fields in command
frontmatter. This commit adds automatic injection of the 'name' field
during command generation for forgecode.
Changes:
- Python (agents.py): Add inject_name: True to forgecode config and
implement name injection logic in register_commands
- Bash (create-release-packages.sh): Add post-processing step to inject
name field into frontmatter after command generation
This complements the existing handoffs stripping fix (d83be82) to fully
support forgecode command requirements.
This commit is contained in:
@@ -333,7 +333,15 @@ build_variant() {
|
||||
generate_commands iflow md "\$ARGUMENTS" "$base_dir/.iflow/commands" "$script" ;;
|
||||
forgecode)
|
||||
mkdir -p "$base_dir/.forge/commands"
|
||||
generate_commands forgecode md "{{parameters}}" "$base_dir/.forge/commands" "$script" "handoffs" ;;
|
||||
generate_commands forgecode md "{{parameters}}" "$base_dir/.forge/commands" "$script" "handoffs"
|
||||
# Inject name field into frontmatter (forgecode requires name + description)
|
||||
for _cmd_file in "$base_dir/.forge/commands/"*.md; do
|
||||
[[ -f "$_cmd_file" ]] || continue
|
||||
_cmd_name=$(basename "$_cmd_file" .md)
|
||||
_tmp_file="${_cmd_file}.tmp"
|
||||
awk -v name="$_cmd_name" 'NR==1 && /^---$/ { print; print "name: "name; next } { print }' "$_cmd_file" > "$_tmp_file"
|
||||
mv "$_tmp_file" "$_cmd_file"
|
||||
done ;;
|
||||
generic)
|
||||
mkdir -p "$base_dir/.speckit/commands"
|
||||
generate_commands generic md "\$ARGUMENTS" "$base_dir/.speckit/commands" "$script" ;;
|
||||
|
||||
@@ -169,6 +169,7 @@ class CommandRegistrar:
|
||||
"args": "{{parameters}}",
|
||||
"extension": ".md",
|
||||
"strip_frontmatter_keys": ["handoffs"],
|
||||
"inject_name": True,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,6 +508,9 @@ class CommandRegistrar:
|
||||
for key in agent_config.get("strip_frontmatter_keys", []):
|
||||
frontmatter.pop(key, None)
|
||||
|
||||
if agent_config.get("inject_name") and not frontmatter.get("name"):
|
||||
frontmatter["name"] = cmd_name
|
||||
|
||||
body = self._convert_argument_placeholder(
|
||||
body, "$ARGUMENTS", agent_config["args"]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user