diff --git a/.github/workflows/scripts/create-release-packages.sh b/.github/workflows/scripts/create-release-packages.sh index 1a60b8c..0e408d2 100644 --- a/.github/workflows/scripts/create-release-packages.sh +++ b/.github/workflows/scripts/create-release-packages.sh @@ -4,7 +4,14 @@ set -euo pipefail # create-release-packages.sh (workflow-local) # Build Spec Kit template release archives for each supported AI assistant and script type. # Usage: .github/workflows/scripts/create-release-packages.sh -# Version argument should include leading 'v'. +# Version argument should include leading 'v'. +# Optionally set AGENTS and/or SCRIPTS env vars to limit what gets built. +# AGENTS : space or comma separated subset of: claude gemini copilot (default: all) +# SCRIPTS : space or comma separated subset of: sh ps (default: both) +# Examples: +# AGENTS=claude SCRIPTS=sh $0 v0.2.0 +# AGENTS="copilot,gemini" $0 v0.2.0 +# SCRIPTS=ps $0 v0.2.0 if [[ $# -ne 1 ]]; then echo "Usage: $0 " >&2 @@ -40,10 +47,26 @@ generate_commands() { mkdir -p "$output_dir" for template in templates/commands/*.md; do [[ -f "$template" ]] || continue - local name description raw_body variant_line injected body + local name description raw_body variant_line injected body file_norm delim_count name=$(basename "$template" .md) - description=$(awk '/^description:/ {gsub(/^description: *"?/, ""); gsub(/"$/, ""); print; exit}' "$template" | tr -d '\r') - raw_body=$(awk '/^---$/{if(++count==2) start=1; next} start' "$template") + # Normalize line endings first (remove CR) for consistent regex matching + file_norm=$(tr -d '\r' < "$template") + # Extract description from frontmatter + description=$(printf '%s\n' "$file_norm" | awk '/^description:/ {sub(/^description:[[:space:]]*/, ""); print; exit}') + # Count YAML frontmatter delimiter lines + delim_count=$(printf '%s\n' "$file_norm" | grep -c '^---$' || true) + if [[ $delim_count -ge 2 ]]; then + # Grab everything after the second --- line + raw_body=$(printf '%s\n' "$file_norm" | awk '/^---$/ {if(++c==2){next}; if(c>=2){print}}') + else + # Fallback: no proper frontmatter detected; use entire file content (still allowing variant parsing) + raw_body=$file_norm + fi + # If somehow still empty, fallback once more to whole normalized file + if [[ -z ${raw_body// /} ]]; then + echo "Warning: body extraction empty for $template; using full file" >&2 + raw_body=$file_norm + fi # Find single-line variant comment matching the variant: or variant_line=$(printf '%s\n' "$raw_body" | awk -v sv="$script_variant" '//, m); if (m[1]!="") {print m[1]; exit}}') if [[ -z $variant_line ]]; then @@ -54,6 +77,11 @@ generate_commands() { injected=$(printf '%s\n' "$raw_body" | sed "s/VARIANT-INJECT/${variant_line//\//\/}/") # Remove all single-line variant comments injected=$(printf '%s\n' "$injected" | sed '/ diff --git a/templates/commands/specify.md b/templates/commands/specify.md index dbd86d5..111e278 100644 --- a/templates/commands/specify.md +++ b/templates/commands/specify.md @@ -1,3 +1,6 @@ +--- +description: Create or update the feature specification from a natural language feature description. +--- diff --git a/templates/commands/tasks.md b/templates/commands/tasks.md index 4677f25..3a58489 100644 --- a/templates/commands/tasks.md +++ b/templates/commands/tasks.md @@ -1,3 +1,6 @@ +--- +description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts. +---