Skip to content

Commit d7588a8

Browse files
committed
Optimize the pipeline to centrally manage AI model names, making it easier to add other AI models to the pipeline in the future
1 parent 3b000fc commit d7588a8

4 files changed

Lines changed: 106 additions & 92 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Create Release
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- '**'
67
paths:
78
- 'memory/**'
89
- 'scripts/**'
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
# agent-config.sh
3+
# Centralized configuration for all supported AI agents
4+
# This file should be sourced by other scripts that need the agent list
5+
6+
# All supported AI agents
7+
# Add new agents here to automatically include them in releases
8+
ALL_AGENTS=(
9+
claude
10+
gemini
11+
copilot
12+
cursor-agent
13+
qwen
14+
opencode
15+
windsurf
16+
codex
17+
kilocode
18+
auggie
19+
roo
20+
codebuddy
21+
q
22+
)
23+
24+
# Agent-specific configuration
25+
# Format: agent_name:directory:file_extension:arg_format:extra_files
26+
declare -A AGENT_CONFIG=(
27+
# Markdown-based agents with $ARGUMENTS
28+
["claude"]=".claude/commands:md:\$ARGUMENTS:"
29+
["copilot"]=".github/prompts:prompt.md:\$ARGUMENTS:vscode-settings"
30+
["cursor-agent"]=".cursor/commands:md:\$ARGUMENTS:"
31+
["opencode"]=".opencode/command:md:\$ARGUMENTS:"
32+
["windsurf"]=".windsurf/workflows:md:\$ARGUMENTS:"
33+
["codex"]=".codex/prompts:md:\$ARGUMENTS:"
34+
["kilocode"]=".kilocode/workflows:md:\$ARGUMENTS:"
35+
["auggie"]=".augment/commands:md:\$ARGUMENTS:"
36+
["roo"]=".roo/commands:md:\$ARGUMENTS:"
37+
["codebuddy"]=".codebuddy/commands:md:\$ARGUMENTS:"
38+
["q"]=".amazonq/prompts:md:\$ARGUMENTS:"
39+
40+
# TOML-based agents with {{args}}
41+
["gemini"]=".gemini/commands:toml:{{args}}:gemini-readme"
42+
["qwen"]=".qwen/commands:toml:{{args}}:qwen-readme"
43+
)
44+
45+
# Function to get agent configuration values
46+
get_agent_dir() { echo "${AGENT_CONFIG[$1]}" | cut -d: -f1; }
47+
get_agent_ext() { echo "${AGENT_CONFIG[$1]}" | cut -d: -f2; }
48+
get_agent_args() { echo "${AGENT_CONFIG[$1]}" | cut -d: -f3; }
49+
get_agent_extras() { echo "${AGENT_CONFIG[$1]}" | cut -d: -f4; }
50+
51+
# Export for use in sourcing scripts
52+
export ALL_AGENTS
53+
export AGENT_CONFIG

.github/workflows/scripts/create-github-release.sh

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,19 @@ VERSION="$1"
1515
# Remove 'v' prefix from version for release title
1616
VERSION_NO_V=${VERSION#v}
1717

18+
# Source centralized agent configuration
19+
source "./agent-config.sh"
20+
21+
# Dynamically build release asset list
22+
RELEASE_ASSETS=()
23+
for agent in "${ALL_AGENTS[@]}"; do
24+
for script_type in sh ps; do
25+
RELEASE_ASSETS+=(".genreleases/spec-kit-template-${agent}-${script_type}-${VERSION}.zip")
26+
done
27+
done
28+
29+
# Create GitHub release with all assets
1830
gh release create "$VERSION" \
19-
.genreleases/spec-kit-template-copilot-sh-"$VERSION".zip \
20-
.genreleases/spec-kit-template-copilot-ps-"$VERSION".zip \
21-
.genreleases/spec-kit-template-claude-sh-"$VERSION".zip \
22-
.genreleases/spec-kit-template-claude-ps-"$VERSION".zip \
23-
.genreleases/spec-kit-template-gemini-sh-"$VERSION".zip \
24-
.genreleases/spec-kit-template-gemini-ps-"$VERSION".zip \
25-
.genreleases/spec-kit-template-cursor-agent-sh-"$VERSION".zip \
26-
.genreleases/spec-kit-template-cursor-agent-ps-"$VERSION".zip \
27-
.genreleases/spec-kit-template-opencode-sh-"$VERSION".zip \
28-
.genreleases/spec-kit-template-opencode-ps-"$VERSION".zip \
29-
.genreleases/spec-kit-template-qwen-sh-"$VERSION".zip \
30-
.genreleases/spec-kit-template-qwen-ps-"$VERSION".zip \
31-
.genreleases/spec-kit-template-windsurf-sh-"$VERSION".zip \
32-
.genreleases/spec-kit-template-windsurf-ps-"$VERSION".zip \
33-
.genreleases/spec-kit-template-codex-sh-"$VERSION".zip \
34-
.genreleases/spec-kit-template-codex-ps-"$VERSION".zip \
35-
.genreleases/spec-kit-template-kilocode-sh-"$VERSION".zip \
36-
.genreleases/spec-kit-template-kilocode-ps-"$VERSION".zip \
37-
.genreleases/spec-kit-template-auggie-sh-"$VERSION".zip \
38-
.genreleases/spec-kit-template-auggie-ps-"$VERSION".zip \
39-
.genreleases/spec-kit-template-roo-sh-"$VERSION".zip \
40-
.genreleases/spec-kit-template-roo-ps-"$VERSION".zip \
41-
.genreleases/spec-kit-template-codebuddy-sh-"$VERSION".zip \
42-
.genreleases/spec-kit-template-codebuddy-ps-"$VERSION".zip \
43-
.genreleases/spec-kit-template-q-sh-"$VERSION".zip \
44-
.genreleases/spec-kit-template-q-ps-"$VERSION".zip \
31+
"${RELEASE_ASSETS[@]}" \
4532
--title "Spec Kit Templates - $VERSION_NO_V" \
4633
--notes-file release_notes.md

.github/workflows/scripts/create-release-packages.sh

Lines changed: 38 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ generate_commands() {
4444
[[ -f "$template" ]] || continue
4545
local name description script_command agent_script_command body
4646
name=$(basename "$template" .md)
47-
47+
4848
# Normalize line endings
4949
file_content=$(tr -d '\r' < "$template")
50-
50+
5151
# Extract description and script command from YAML frontmatter
5252
description=$(printf '%s\n' "$file_content" | awk '/^description:/ {sub(/^description:[[:space:]]*/, ""); print; exit}')
5353
script_command=$(printf '%s\n' "$file_content" | awk -v sv="$script_variant" '/^[[:space:]]*'"$script_variant"':[[:space:]]*/ {sub(/^[[:space:]]*'"$script_variant"':[[:space:]]*/, ""); print; exit}')
54-
54+
5555
if [[ -z $script_command ]]; then
5656
echo "Warning: no script command found for $script_variant in $template" >&2
5757
script_command="(Missing script command for $script_variant)"
5858
fi
59-
59+
6060
# Extract agent_script command from YAML frontmatter if present
6161
agent_script_command=$(printf '%s\n' "$file_content" | awk '
6262
/^agent_scripts:$/ { in_agent_scripts=1; next }
@@ -67,15 +67,15 @@ generate_commands() {
6767
}
6868
in_agent_scripts && /^[a-zA-Z]/ { in_agent_scripts=0 }
6969
')
70-
70+
7171
# Replace {SCRIPT} placeholder with the script command
7272
body=$(printf '%s\n' "$file_content" | sed "s|{SCRIPT}|${script_command}|g")
73-
73+
7474
# Replace {AGENT_SCRIPT} placeholder with the agent script command if found
7575
if [[ -n $agent_script_command ]]; then
7676
body=$(printf '%s\n' "$body" | sed "s|{AGENT_SCRIPT}|${agent_script_command}|g")
7777
fi
78-
78+
7979
# Remove the scripts: and agent_scripts: sections from frontmatter while preserving YAML structure
8080
body=$(printf '%s\n' "$body" | awk '
8181
/^---$/ { print; if (++dash_count == 1) in_frontmatter=1; else in_frontmatter=0; next }
@@ -85,10 +85,10 @@ generate_commands() {
8585
in_frontmatter && skip_scripts && /^[[:space:]]/ { next }
8686
{ print }
8787
')
88-
88+
8989
# Apply other substitutions
9090
body=$(printf '%s\n' "$body" | sed "s/{ARGS}/$arg_format/g" | sed "s/__AGENT__/$agent/g" | rewrite_paths)
91-
91+
9292
case $ext in
9393
toml)
9494
body=$(printf '%s\n' "$body" | sed 's/\\/\\\\/g')
@@ -106,13 +106,13 @@ build_variant() {
106106
local base_dir="$GENRELEASES_DIR/sdd-${agent}-package-${script}"
107107
echo "Building $agent ($script) package..."
108108
mkdir -p "$base_dir"
109-
109+
110110
# Copy base structure but filter scripts by variant
111111
SPEC_DIR="$base_dir/.specify"
112112
mkdir -p "$SPEC_DIR"
113-
113+
114114
[[ -d memory ]] && { cp -r memory "$SPEC_DIR/"; echo "Copied memory -> .specify"; }
115-
115+
116116
# Only copy the relevant script variant directory
117117
if [[ -d scripts ]]; then
118118
mkdir -p "$SPEC_DIR/scripts"
@@ -129,68 +129,41 @@ build_variant() {
129129
;;
130130
esac
131131
fi
132-
132+
133133
[[ -d templates ]] && { mkdir -p "$SPEC_DIR/templates"; find templates -type f -not -path "templates/commands/*" -not -name "vscode-settings.json" -exec cp --parents {} "$SPEC_DIR"/ \; ; echo "Copied templates -> .specify/templates"; }
134-
135-
# NOTE: We substitute {ARGS} internally. Outward tokens differ intentionally:
136-
# * Markdown/prompt (claude, copilot, cursor-agent, opencode): $ARGUMENTS
137-
# * TOML (gemini, qwen): {{args}}
138-
# This keeps formats readable without extra abstraction.
139-
140-
case $agent in
141-
claude)
142-
mkdir -p "$base_dir/.claude/commands"
143-
generate_commands claude md "\$ARGUMENTS" "$base_dir/.claude/commands" "$script" ;;
144-
gemini)
145-
mkdir -p "$base_dir/.gemini/commands"
146-
generate_commands gemini toml "{{args}}" "$base_dir/.gemini/commands" "$script"
147-
[[ -f agent_templates/gemini/GEMINI.md ]] && cp agent_templates/gemini/GEMINI.md "$base_dir/GEMINI.md" ;;
148-
copilot)
149-
mkdir -p "$base_dir/.github/prompts"
150-
generate_commands copilot prompt.md "\$ARGUMENTS" "$base_dir/.github/prompts" "$script"
151-
# Create VS Code workspace settings
134+
135+
# Get agent-specific configuration
136+
local agent_dir agent_ext arg_format agent_extras
137+
agent_dir=$(get_agent_dir "$agent")
138+
agent_ext=$(get_agent_ext "$agent")
139+
arg_format=$(get_agent_args "$agent")
140+
agent_extras=$(get_agent_extras "$agent")
141+
142+
# Create agent-specific directory and generate commands
143+
mkdir -p "$base_dir/$agent_dir"
144+
generate_commands "$agent" "$agent_ext" "$arg_format" "$base_dir/$agent_dir" "$script"
145+
146+
# Handle agent-specific extra files
147+
case $agent_extras in
148+
vscode-settings)
152149
mkdir -p "$base_dir/.vscode"
153150
[[ -f templates/vscode-settings.json ]] && cp templates/vscode-settings.json "$base_dir/.vscode/settings.json"
154151
;;
155-
cursor-agent)
156-
mkdir -p "$base_dir/.cursor/commands"
157-
generate_commands cursor-agent md "\$ARGUMENTS" "$base_dir/.cursor/commands" "$script" ;;
158-
qwen)
159-
mkdir -p "$base_dir/.qwen/commands"
160-
generate_commands qwen toml "{{args}}" "$base_dir/.qwen/commands" "$script"
161-
[[ -f agent_templates/qwen/QWEN.md ]] && cp agent_templates/qwen/QWEN.md "$base_dir/QWEN.md" ;;
162-
opencode)
163-
mkdir -p "$base_dir/.opencode/command"
164-
generate_commands opencode md "\$ARGUMENTS" "$base_dir/.opencode/command" "$script" ;;
165-
windsurf)
166-
mkdir -p "$base_dir/.windsurf/workflows"
167-
generate_commands windsurf md "\$ARGUMENTS" "$base_dir/.windsurf/workflows" "$script" ;;
168-
codex)
169-
mkdir -p "$base_dir/.codex/prompts"
170-
generate_commands codex md "\$ARGUMENTS" "$base_dir/.codex/prompts" "$script" ;;
171-
kilocode)
172-
mkdir -p "$base_dir/.kilocode/workflows"
173-
generate_commands kilocode md "\$ARGUMENTS" "$base_dir/.kilocode/workflows" "$script" ;;
174-
auggie)
175-
mkdir -p "$base_dir/.augment/commands"
176-
generate_commands auggie md "\$ARGUMENTS" "$base_dir/.augment/commands" "$script" ;;
177-
roo)
178-
mkdir -p "$base_dir/.roo/commands"
179-
generate_commands roo md "\$ARGUMENTS" "$base_dir/.roo/commands" "$script" ;;
180-
codebuddy)
181-
mkdir -p "$base_dir/.codebuddy/commands"
182-
generate_commands codebuddy md "\$ARGUMENTS" "$base_dir/.codebuddy/commands" "$script" ;;
183-
184-
q)
185-
mkdir -p "$base_dir/.amazonq/prompts"
186-
generate_commands q md "\$ARGUMENTS" "$base_dir/.amazonq/prompts" "$script" ;;
152+
gemini-readme)
153+
[[ -f agent_templates/gemini/GEMINI.md ]] && cp agent_templates/gemini/GEMINI.md "$base_dir/GEMINI.md"
154+
;;
155+
qwen-readme)
156+
[[ -f agent_templates/qwen/QWEN.md ]] && cp agent_templates/qwen/QWEN.md "$base_dir/QWEN.md"
157+
;;
187158
esac
159+
188160
( cd "$base_dir" && zip -r "../spec-kit-template-${agent}-${script}-${NEW_VERSION}.zip" . )
189161
echo "Created $GENRELEASES_DIR/spec-kit-template-${agent}-${script}-${NEW_VERSION}.zip"
190162
}
191163

192-
# Determine agent list
193-
ALL_AGENTS=(claude gemini copilot cursor-agent qwen opencode windsurf codex kilocode auggie roo codebuddy q)
164+
# Source centralized agent configuration
165+
source "./agent-config.sh"
166+
194167
ALL_SCRIPTS=(sh ps)
195168

196169
norm_list() {

0 commit comments

Comments
 (0)