2525
2626echo " Building release packages for $NEW_VERSION "
2727
28- rm -rf sdd-package-base* sdd-* -package-* spec-kit-template-* -${NEW_VERSION} .zip || true
28+ rm -rf sdd-package-base* sdd-* -package-* spec-kit-template-* -" ${NEW_VERSION} " .zip || true
2929
3030rewrite_paths () {
3131 sed -E \
@@ -119,7 +119,6 @@ build_variant() {
119119 if [[ -n $script_command ]]; then
120120 # Always prefix with .specify/ for plan usage
121121 script_command=" .specify/$script_command "
122- tmp_file=$( mktemp)
123122 # Replace {SCRIPT} placeholder with the script command and __AGENT__ with agent name
124123 substituted=$( sed " s|{SCRIPT}|${script_command} |g" " $plan_tpl " | tr -d ' \r' | sed " s|__AGENT__|${agent} |g" )
125124 # Strip YAML frontmatter from plan template output (keep body only)
@@ -129,6 +128,11 @@ build_variant() {
129128 echo " Warning: no plan-template script command found for $script in YAML frontmatter" >&2
130129 fi
131130 fi
131+ # NOTE: We substitute {ARGS} internally. Outward tokens differ intentionally:
132+ # * Markdown/prompt (claude, copilot, cursor, opencode): $ARGUMENTS
133+ # * TOML (gemini, qwen): {{args}}
134+ # This keeps formats readable without extra abstraction.
135+
132136 case $agent in
133137 claude)
134138 mkdir -p " $base_dir /.claude/commands"
@@ -159,17 +163,18 @@ build_variant() {
159163ALL_AGENTS=(claude gemini copilot cursor qwen opencode)
160164ALL_SCRIPTS=(sh ps)
161165
166+
162167norm_list () {
163168 # convert comma+space separated -> space separated unique while preserving order of first occurrence
164169 tr ' ,\n' ' ' | awk ' {for(i=1;i<=NF;i++){if(!seen[$i]++){printf((out?" ":"") $i)}}}END{printf("\n")}'
165170}
166171
167172validate_subset () {
168- local type=$1 ; shift ; local -n allowed=$1 ; shift ; local items=($@ )
173+ local type=$1 ; shift ; local -n allowed=$1 ; shift ; local items=(" $@ " )
169174 local ok=1
170175 for it in " ${items[@]} " ; do
171176 local found=0
172- for a in " ${allowed[@]} " ; do [[ $it == $a ]] && { found=1; break ; }; done
177+ for a in " ${allowed[@]} " ; do [[ $it == " $a " ]] && { found=1; break ; }; done
173178 if [[ $found -eq 0 ]]; then
174179 echo " Error: unknown $type '$it ' (allowed: ${allowed[*]} )" >&2
175180 ok=0
@@ -179,17 +184,17 @@ validate_subset() {
179184}
180185
181186if [[ -n ${AGENTS:- } ]]; then
182- AGENT_LIST=( $( printf ' %s' " $AGENTS " | norm_list) )
187+ mapfile -t AGENT_LIST < <( printf ' %s' " $AGENTS " | norm_list)
183188 validate_subset agent ALL_AGENTS " ${AGENT_LIST[@]} " || exit 1
184189else
185- AGENT_LIST=(${ALL_AGENTS[@]} )
190+ AGENT_LIST=(" ${ALL_AGENTS[@]} " )
186191fi
187192
188193if [[ -n ${SCRIPTS:- } ]]; then
189- SCRIPT_LIST=( $( printf ' %s' " $SCRIPTS " | norm_list) )
194+ mapfile -t SCRIPT_LIST < <( printf ' %s' " $SCRIPTS " | norm_list)
190195 validate_subset script ALL_SCRIPTS " ${SCRIPT_LIST[@]} " || exit 1
191196else
192- SCRIPT_LIST=(${ALL_SCRIPTS[@]} )
197+ SCRIPT_LIST=(" ${ALL_SCRIPTS[@]} " )
193198fi
194199
195200echo " Agents: ${AGENT_LIST[*]} "
@@ -202,4 +207,4 @@ for agent in "${AGENT_LIST[@]}"; do
202207done
203208
204209echo " Archives:"
205- ls -1 spec-kit-template-* -${NEW_VERSION} .zip
210+ ls -1 spec-kit-template-* -" ${NEW_VERSION} " .zip
0 commit comments