This commit is contained in:
Den Delimarsky 🌺
2025-09-18 11:22:30 -07:00
parent 5fc1d0b939
commit d90cc16786

View File

@@ -25,7 +25,7 @@ fi
echo "Building release packages for $NEW_VERSION" 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() { rewrite_paths() {
sed -E \ sed -E \
@@ -119,7 +119,6 @@ build_variant() {
if [[ -n $script_command ]]; then if [[ -n $script_command ]]; then
# Always prefix with .specify/ for plan usage # Always prefix with .specify/ for plan usage
script_command=".specify/$script_command" script_command=".specify/$script_command"
tmp_file=$(mktemp)
# Replace {SCRIPT} placeholder with the script command and __AGENT__ with agent name # 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") 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) # 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 echo "Warning: no plan-template script command found for $script in YAML frontmatter" >&2
fi fi
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 case $agent in
claude) claude)
mkdir -p "$base_dir/.claude/commands" mkdir -p "$base_dir/.claude/commands"
@@ -159,17 +163,18 @@ build_variant() {
ALL_AGENTS=(claude gemini copilot cursor qwen opencode) ALL_AGENTS=(claude gemini copilot cursor qwen opencode)
ALL_SCRIPTS=(sh ps) ALL_SCRIPTS=(sh ps)
norm_list() { norm_list() {
# convert comma+space separated -> space separated unique while preserving order of first occurrence # 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")}' tr ',\n' ' ' | awk '{for(i=1;i<=NF;i++){if(!seen[$i]++){printf((out?" ":"") $i)}}}END{printf("\n")}'
} }
validate_subset() { 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 local ok=1
for it in "${items[@]}"; do for it in "${items[@]}"; do
local found=0 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 if [[ $found -eq 0 ]]; then
echo "Error: unknown $type '$it' (allowed: ${allowed[*]})" >&2 echo "Error: unknown $type '$it' (allowed: ${allowed[*]})" >&2
ok=0 ok=0
@@ -179,17 +184,17 @@ validate_subset() {
} }
if [[ -n ${AGENTS:-} ]]; then 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 validate_subset agent ALL_AGENTS "${AGENT_LIST[@]}" || exit 1
else else
AGENT_LIST=(${ALL_AGENTS[@]}) AGENT_LIST=("${ALL_AGENTS[@]}")
fi fi
if [[ -n ${SCRIPTS:-} ]]; then 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 validate_subset script ALL_SCRIPTS "${SCRIPT_LIST[@]}" || exit 1
else else
SCRIPT_LIST=(${ALL_SCRIPTS[@]}) SCRIPT_LIST=("${ALL_SCRIPTS[@]}")
fi fi
echo "Agents: ${AGENT_LIST[*]}" echo "Agents: ${AGENT_LIST[*]}"
@@ -202,4 +207,4 @@ for agent in "${AGENT_LIST[@]}"; do
done done
echo "Archives:" echo "Archives:"
ls -1 spec-kit-template-*-${NEW_VERSION}.zip ls -1 spec-kit-template-*-"${NEW_VERSION}".zip