@@ -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+
194167ALL_SCRIPTS=(sh ps)
195168
196169norm_list () {
0 commit comments