Skip to content

Commit e1d7542

Browse files
Digi-Boclaude
andcommitted
fix: include .specify/templates/ and real command files in release ZIPs
- Copy real command files from templates/commands/ (with speckit. prefix) instead of generating stubs, so slash commands have actual content - Add .specify/templates/ to every ZIP so ensure_constitution_from_template can find constitution-template.md on init - Add .vscode/settings.json to every ZIP - Having 3 top-level dirs prevents the extraction flatten heuristic from incorrectly stripping the agent config folder (.kimi/, .claude/, etc.) - Bump version to 0.1.14.1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ae85853 commit e1d7542

File tree

1 file changed

+100
-51
lines changed

1 file changed

+100
-51
lines changed

.github/workflows/scripts/create-release-packages.sh

Lines changed: 100 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,48 @@ VERSION="${VERSION:-$(git describe --tags --always 2>/dev/null || echo 'dev')}"
3232
# Output directory
3333
OUTPUT_DIR=".genreleases"
3434

35+
# Repository root (3 levels up from this script's location)
36+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
37+
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
38+
TEMPLATES_DIR="$REPO_ROOT/templates"
39+
COMMANDS_TEMPLATES_DIR="$TEMPLATES_DIR/commands"
40+
3541
#==============================================================================
3642
# Functions
3743
#==============================================================================
3844

39-
# Generate command files for an agent
40-
generate_commands() {
45+
# Copy real command files (from templates/commands/) into an agent's commands dir.
46+
# Files are renamed with the speckit. prefix (e.g. specify.md -> speckit.specify.md).
47+
# add-dir.md has no real template yet, so a stub is generated for it.
48+
copy_real_md_commands() {
49+
local dest_dir="$1"
50+
51+
local commands=(constitution specify clarify plan tasks analyze checklist implement taskstoissues)
52+
for cmd in "${commands[@]}"; do
53+
local src="$COMMANDS_TEMPLATES_DIR/${cmd}.md"
54+
if [[ -f "$src" ]]; then
55+
cp "$src" "$dest_dir/speckit.${cmd}.md"
56+
fi
57+
done
58+
59+
# add-dir.md: no real template exists yet, generate a stub
60+
cat > "$dest_dir/add-dir.md" << 'EOF'
61+
---
62+
description: "add-dir command for Spec Kit"
63+
---
64+
65+
# add-dir
66+
67+
Execute the add-dir workflow with arguments: $ARGUMENTS
68+
EOF
69+
}
70+
71+
# Generate toml command files for agents that use that format (gemini, qwen).
72+
generate_toml_commands() {
4173
local agent="$1"
42-
local format="$2"
43-
local args="$3"
44-
local dest_dir="$4"
45-
local script="$5"
46-
47-
# Command names follow the speckit.* pattern
74+
local args="$2"
75+
local dest_dir="$3"
76+
4877
local commands=(
4978
"speckit.constitution"
5079
"speckit.specify"
@@ -57,117 +86,129 @@ generate_commands() {
5786
"speckit.taskstoissues"
5887
"add-dir"
5988
)
60-
61-
for cmd in "${commands[@]}"; do
62-
local filename="${cmd}.${format}"
63-
local filepath="${dest_dir}/${filename}"
64-
65-
# Create command file with appropriate format
66-
case "$format" in
67-
md)
68-
cat > "$filepath" << EOF
69-
---
70-
description: "${cmd} command for Spec Kit"
71-
---
7289

73-
# ${cmd}
74-
75-
Execute the ${cmd} workflow with arguments: ${args}
76-
EOF
77-
;;
78-
toml)
79-
cat > "$filepath" << EOF
90+
for cmd in "${commands[@]}"; do
91+
cat > "$dest_dir/${cmd}.toml" << EOF
8092
description = "${cmd} command for Spec Kit"
8193
8294
prompt = """
8395
Execute the ${cmd} workflow with arguments: ${args}
8496
"""
8597
EOF
86-
;;
87-
esac
8898
done
8999
}
90100

101+
# Add .specify/templates/ directory to a package (required for constitution setup).
102+
add_specify_templates() {
103+
local base_dir="$1"
104+
mkdir -p "$base_dir/.specify/templates"
105+
106+
local templates=(
107+
agent-file-template.md
108+
checklist-template.md
109+
constitution-template.md
110+
plan-template.md
111+
spec-template.md
112+
tasks-template.md
113+
)
114+
for tmpl in "${templates[@]}"; do
115+
local src="$TEMPLATES_DIR/$tmpl"
116+
if [[ -f "$src" ]]; then
117+
cp "$src" "$base_dir/.specify/templates/"
118+
fi
119+
done
120+
}
121+
122+
# Add .vscode/settings.json to a package.
123+
add_vscode_settings() {
124+
local base_dir="$1"
125+
local src="$TEMPLATES_DIR/vscode-settings.json"
126+
if [[ -f "$src" ]]; then
127+
mkdir -p "$base_dir/.vscode"
128+
cp "$src" "$base_dir/.vscode/settings.json"
129+
fi
130+
}
131+
91132
# Create release package for an agent
92133
create_package() {
93134
local agent="$1"
94135
local script="$2" # sh or ps
95-
136+
96137
local base_dir="${OUTPUT_DIR}/temp-${agent}-${script}"
97-
98-
# Create directory structure based on agent type
138+
139+
# Create agent-specific commands directory and populate it
99140
case "$agent" in
100141
copilot)
101142
mkdir -p "$base_dir/.github/agents"
102-
generate_commands copilot md "$ARGUMENTS" "$base_dir/.github/agents" "$script"
143+
copy_real_md_commands "$base_dir/.github/agents"
103144
;;
104145
claude)
105146
mkdir -p "$base_dir/.claude/commands"
106-
generate_commands claude md "$ARGUMENTS" "$base_dir/.claude/commands" "$script"
147+
copy_real_md_commands "$base_dir/.claude/commands"
107148
;;
108149
gemini)
109150
mkdir -p "$base_dir/.gemini/commands"
110-
generate_commands gemini toml "{{args}}" "$base_dir/.gemini/commands" "$script"
151+
generate_toml_commands gemini "{{args}}" "$base_dir/.gemini/commands"
111152
;;
112153
cursor-agent)
113154
mkdir -p "$base_dir/.cursor/commands"
114-
generate_commands cursor-agent md "$ARGUMENTS" "$base_dir/.cursor/commands" "$script"
155+
copy_real_md_commands "$base_dir/.cursor/commands"
115156
;;
116157
qwen)
117158
mkdir -p "$base_dir/.qwen/commands"
118-
generate_commands qwen toml "{{args}}" "$base_dir/.qwen/commands" "$script"
159+
generate_toml_commands qwen "{{args}}" "$base_dir/.qwen/commands"
119160
;;
120161
opencode)
121162
mkdir -p "$base_dir/.opencode/command"
122-
generate_commands opencode md "$ARGUMENTS" "$base_dir/.opencode/command" "$script"
163+
copy_real_md_commands "$base_dir/.opencode/command"
123164
;;
124165
codex)
125166
mkdir -p "$base_dir/.codex/prompts"
126-
generate_commands codex md "$ARGUMENTS" "$base_dir/.codex/prompts" "$script"
167+
copy_real_md_commands "$base_dir/.codex/prompts"
127168
;;
128169
windsurf)
129170
mkdir -p "$base_dir/.windsurf/workflows"
130-
generate_commands windsurf md "$ARGUMENTS" "$base_dir/.windsurf/workflows" "$script"
171+
copy_real_md_commands "$base_dir/.windsurf/workflows"
131172
;;
132173
kilocode)
133174
mkdir -p "$base_dir/.kilocode/workflows"
134-
generate_commands kilocode md "$ARGUMENTS" "$base_dir/.kilocode/workflows" "$script"
175+
copy_real_md_commands "$base_dir/.kilocode/workflows"
135176
;;
136177
auggie)
137178
mkdir -p "$base_dir/.augment/commands"
138-
generate_commands auggie md "$ARGUMENTS" "$base_dir/.augment/commands" "$script"
179+
copy_real_md_commands "$base_dir/.augment/commands"
139180
;;
140181
codebuddy)
141182
mkdir -p "$base_dir/.codebuddy/commands"
142-
generate_commands codebuddy md "$ARGUMENTS" "$base_dir/.codebuddy/commands" "$script"
183+
copy_real_md_commands "$base_dir/.codebuddy/commands"
143184
;;
144185
qodercli)
145186
mkdir -p "$base_dir/.qoder/commands"
146-
generate_commands qodercli md "$ARGUMENTS" "$base_dir/.qoder/commands" "$script"
187+
copy_real_md_commands "$base_dir/.qoder/commands"
147188
;;
148189
roo)
149190
mkdir -p "$base_dir/.roo/rules"
150-
generate_commands roo md "$ARGUMENTS" "$base_dir/.roo/rules" "$script"
191+
copy_real_md_commands "$base_dir/.roo/rules"
151192
;;
152193
kiro-cli)
153194
mkdir -p "$base_dir/.kiro/prompts"
154-
generate_commands kiro-cli md "$ARGUMENTS" "$base_dir/.kiro/prompts" "$script"
195+
copy_real_md_commands "$base_dir/.kiro/prompts"
155196
;;
156197
amp)
157198
mkdir -p "$base_dir/.agents/commands"
158-
generate_commands amp md "$ARGUMENTS" "$base_dir/.agents/commands" "$script"
199+
copy_real_md_commands "$base_dir/.agents/commands"
159200
;;
160201
shai)
161202
mkdir -p "$base_dir/.shai/commands"
162-
generate_commands shai md "$ARGUMENTS" "$base_dir/.shai/commands" "$script"
203+
copy_real_md_commands "$base_dir/.shai/commands"
163204
;;
164205
agy)
165206
mkdir -p "$base_dir/.agent/workflows"
166-
generate_commands agy md "$ARGUMENTS" "$base_dir/.agent/workflows" "$script"
207+
copy_real_md_commands "$base_dir/.agent/workflows"
167208
;;
168209
bob)
169210
mkdir -p "$base_dir/.bob/commands"
170-
generate_commands bob md "$ARGUMENTS" "$base_dir/.bob/commands" "$script"
211+
copy_real_md_commands "$base_dir/.bob/commands"
171212
;;
172213
tabnine)
173214
mkdir -p "$base_dir/.tabnine/agent/commands"
@@ -179,14 +220,22 @@ create_package() {
179220
;;
180221
kimi)
181222
mkdir -p "$base_dir/.kimi/commands"
182-
generate_commands kimi md "$ARGUMENTS" "$base_dir/.kimi/commands" "$script"
223+
copy_real_md_commands "$base_dir/.kimi/commands"
183224
;;
184225
generic)
185226
mkdir -p "$base_dir/.speckit/commands"
186227
generate_commands generic md "$ARGUMENTS" "$base_dir/.speckit/commands" "$script"
187228
;;
188229
esac
189230

231+
# Add .specify/templates/ (needed by ensure_constitution_from_template)
232+
# and .vscode/settings.json to every package.
233+
# Having multiple top-level dirs also prevents the extraction flatten heuristic
234+
# from incorrectly stripping the agent config directory.
235+
add_specify_templates "$base_dir"
236+
add_vscode_settings "$base_dir"
237+
238+
190239
# Create the zip archive
191240
local zip_name="spec-kit-template-${agent}-${script}-${VERSION}.zip"
192241
(cd "$base_dir" && zip -r "../${zip_name}" .)

0 commit comments

Comments
 (0)