From d90cc167860ee8e1f3c7a5b670592b0709e44bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Den=20Delimarsky=20=F0=9F=8C=BA?= <53200638+localden@users.noreply.github.com> Date: Thu, 18 Sep 2025 11:22:30 -0700 Subject: [PATCH] Cleanup --- .../scripts/create-release-packages.sh | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/scripts/create-release-packages.sh b/.github/workflows/scripts/create-release-packages.sh index 84eae54..d45f33e 100644 --- a/.github/workflows/scripts/create-release-packages.sh +++ b/.github/workflows/scripts/create-release-packages.sh @@ -25,7 +25,7 @@ fi echo "Building release packages for $NEW_VERSION" -rm -rf sdd-package-base* sdd-*-package-* spec-kit-template-*-${NEW_VERSION}.zip || true +rm -rf sdd-package-base* sdd-*-package-* spec-kit-template-*-"${NEW_VERSION}".zip || true rewrite_paths() { sed -E \ @@ -119,7 +119,6 @@ build_variant() { if [[ -n $script_command ]]; then # Always prefix with .specify/ for plan usage script_command=".specify/$script_command" - tmp_file=$(mktemp) # Replace {SCRIPT} placeholder with the script command and __AGENT__ with agent name substituted=$(sed "s|{SCRIPT}|${script_command}|g" "$plan_tpl" | tr -d '\r' | sed "s|__AGENT__|${agent}|g") # Strip YAML frontmatter from plan template output (keep body only) @@ -129,6 +128,11 @@ build_variant() { echo "Warning: no plan-template script command found for $script in YAML frontmatter" >&2 fi fi + # NOTE: We substitute {ARGS} internally. Outward tokens differ intentionally: + # * Markdown/prompt (claude, copilot, cursor, opencode): $ARGUMENTS + # * TOML (gemini, qwen): {{args}} + # This keeps formats readable without extra abstraction. + case $agent in claude) mkdir -p "$base_dir/.claude/commands" @@ -159,17 +163,18 @@ build_variant() { ALL_AGENTS=(claude gemini copilot cursor qwen opencode) ALL_SCRIPTS=(sh ps) + norm_list() { # convert comma+space separated -> space separated unique while preserving order of first occurrence tr ',\n' ' ' | awk '{for(i=1;i<=NF;i++){if(!seen[$i]++){printf((out?" ":"") $i)}}}END{printf("\n")}' } validate_subset() { - local type=$1; shift; local -n allowed=$1; shift; local items=($@) + local type=$1; shift; local -n allowed=$1; shift; local items=("$@") local ok=1 for it in "${items[@]}"; do local found=0 - for a in "${allowed[@]}"; do [[ $it == $a ]] && { found=1; break; }; done + for a in "${allowed[@]}"; do [[ $it == "$a" ]] && { found=1; break; }; done if [[ $found -eq 0 ]]; then echo "Error: unknown $type '$it' (allowed: ${allowed[*]})" >&2 ok=0 @@ -179,17 +184,17 @@ validate_subset() { } if [[ -n ${AGENTS:-} ]]; then - AGENT_LIST=($(printf '%s' "$AGENTS" | norm_list)) + mapfile -t AGENT_LIST < <(printf '%s' "$AGENTS" | norm_list) validate_subset agent ALL_AGENTS "${AGENT_LIST[@]}" || exit 1 else - AGENT_LIST=(${ALL_AGENTS[@]}) + AGENT_LIST=("${ALL_AGENTS[@]}") fi if [[ -n ${SCRIPTS:-} ]]; then - SCRIPT_LIST=($(printf '%s' "$SCRIPTS" | norm_list)) + mapfile -t SCRIPT_LIST < <(printf '%s' "$SCRIPTS" | norm_list) validate_subset script ALL_SCRIPTS "${SCRIPT_LIST[@]}" || exit 1 else - SCRIPT_LIST=(${ALL_SCRIPTS[@]}) + SCRIPT_LIST=("${ALL_SCRIPTS[@]}") fi echo "Agents: ${AGENT_LIST[*]}" @@ -202,4 +207,4 @@ for agent in "${AGENT_LIST[@]}"; do done echo "Archives:" -ls -1 spec-kit-template-*-${NEW_VERSION}.zip +ls -1 spec-kit-template-*-"${NEW_VERSION}".zip