@amsterdamdatalabs/enact-extensions 0.1.3 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +15 -1
- package/dist/install.js.map +1 -1
- package/dist/internal/agents.d.ts +29 -0
- package/dist/internal/agents.d.ts.map +1 -0
- package/dist/internal/agents.js +83 -0
- package/dist/internal/agents.js.map +1 -0
- package/extensions/enact-context/hooks/hooks.json +17 -7
- package/extensions/enact-core/.agents/plugin.json +39 -0
- package/extensions/enact-core/hooks/hooks.json +14 -0
- package/extensions/enact-factory/.agents/plugin.json +9 -3
- package/extensions/enact-factory/agents/architect.toml +30 -0
- package/extensions/enact-factory/agents/code-reviewer.toml +29 -0
- package/extensions/enact-factory/agents/critic.toml +35 -0
- package/extensions/enact-factory/agents/executor.toml +23 -0
- package/extensions/enact-factory/agents/explore.toml +22 -0
- package/extensions/enact-factory/agents/planner.toml +23 -0
- package/extensions/enact-factory/agents/verifier.toml +29 -0
- package/extensions/enact-factory/skills/ai-slop-cleaner/SKILL.md +52 -0
- package/extensions/enact-factory/skills/azdo-ci-strategy/SKILL.md +262 -0
- package/extensions/enact-factory/skills/azdo-ci-strategy/references/build-failures.md +60 -0
- package/extensions/enact-factory/skills/azdo-ci-strategy/references/cli-reference.md +87 -0
- package/extensions/enact-factory/skills/azdo-ci-strategy/references/policies-and-pipelines.md +132 -0
- package/extensions/enact-factory/skills/azdo-ci-strategy/references/troubleshooting.md +53 -0
- package/extensions/enact-factory/skills/deep-interview/SKILL.md +72 -0
- package/extensions/enact-factory/skills/drive-loop/SKILL.md +259 -0
- package/extensions/enact-factory/skills/drive-loop/references/contract-schema.md +107 -0
- package/extensions/enact-factory/skills/hyperplan/SKILL.md +51 -0
- package/extensions/enact-factory/skills/looplan/SKILL.md +103 -0
- package/extensions/enact-factory/skills/plan/SKILL.md +71 -0
- package/extensions/enact-factory/skills/remove-deadcode/SKILL.md +41 -0
- package/extensions/enact-factory/skills/research/SKILL.md +73 -0
- package/extensions/enact-factory/skills/review/SKILL.md +48 -0
- package/extensions/enact-factory/skills/security-research/SKILL.md +54 -0
- package/extensions/enact-factory/skills/tdd/SKILL.md +56 -0
- package/extensions/enact-factory/skills/trace/SKILL.md +37 -0
- package/extensions/enact-factory/skills/ultraqa/SKILL.md +79 -0
- package/extensions/enact-factory/skills/work-with-workitem/SKILL.md +51 -0
- package/extensions/enact-factory/skills/workitem-triage/SKILL.md +15 -0
- package/extensions/enact-loop/.agents/plugin.json +46 -0
- package/extensions/enact-loop/.mcp.json +1 -0
- package/extensions/enact-loop/hooks/hooks.json +27 -0
- package/extensions/enact-loop/skills/enact-loop/SKILL.md +327 -0
- package/extensions/enact-operator/.agents/plugin.json +0 -1
- package/extensions/enact-operator/hooks/hooks.json +0 -55
- package/extensions/enact-wiki/skills/wiki/SKILL.md +42 -0
- package/extensions/plugin-dev/.agents/plugin.json +4 -6
- package/extensions/plugin-dev/agents/plugin-validator.md +1 -1
- package/extensions/plugin-dev/skills/agent-development/SKILL.md +7 -7
- package/extensions/plugin-dev/{commands/create-plugin.md → skills/create-plugin/SKILL.md} +44 -37
- package/extensions/plugin-dev/skills/plugin-dev-guide/SKILL.md +13 -14
- package/extensions/plugin-dev/skills/skill-development/SKILL.md +0 -2
- package/extensions/plugin-dev/{commands/start.md → skills/start/SKILL.md} +7 -6
- package/package.json +11 -6
- package/scripts/check-hooks.mjs +174 -0
- package/scripts/check-principles.mjs +101 -0
- package/scripts/enact-extensions.mjs +87 -3
- package/scripts/lib/run-validate.mjs +36 -2
- package/scripts/lib/ups-router.mjs +432 -0
- package/spec/enact.json +4 -0
- package/spec/enact.md +5 -2
- package/extensions/cmux/.agents/plugin.json +0 -37
- package/extensions/cmux/skills/cmux/SKILL.md +0 -82
- package/extensions/cmux/skills/cmux/agents/openai.yaml +0 -4
- package/extensions/cmux/skills/cmux/references/handles-and-identify.md +0 -35
- package/extensions/cmux/skills/cmux/references/panes-surfaces.md +0 -37
- package/extensions/cmux/skills/cmux/references/trigger-flash-and-health.md +0 -23
- package/extensions/cmux/skills/cmux/references/windows-workspaces.md +0 -31
- package/extensions/cmux/skills/cmux-vm-monitor/SKILL.md +0 -122
- package/extensions/cmux/skills/cmux-vm-monitor/agents/openai.yaml +0 -4
- package/extensions/cmux/skills/cmux-vm-monitor/references/cmux-commands.md +0 -66
- package/extensions/cmux/skills/cmux-vm-monitor/scripts/codex_vm_monitor.sh +0 -45
- package/extensions/cmux/skills/cmux-workspace/SKILL.md +0 -93
- package/extensions/devops/.agents/plugin.json +0 -36
- package/extensions/devops/skills/azure-devops-cli/SKILL.md +0 -431
- package/extensions/devops/skills/azure-devops-cli/agents/openai.yaml +0 -4
- package/extensions/devops/skills/ci-pipeline-strategy/SKILL.md +0 -217
- package/extensions/devops/skills/ci-pipeline-strategy/agents/openai.yaml +0 -4
- package/extensions/enact-factory/hooks/user-prompt-submit.mjs +0 -67
- package/extensions/enact-operator/commands/doctor.md +0 -39
- package/extensions/enact-operator/commands/setup.md +0 -51
- package/extensions/plugin-dev/.mcp.json +0 -3
- package/extensions/plugin-dev/commands/_archive/create-marketplace.md +0 -427
- package/extensions/plugin-dev/commands/_archive/plugin-dev-guide.md +0 -12
- package/extensions/plugin-dev/hooks/hooks.json +0 -3
- package/extensions/plugin-dev/skills/command-development/SKILL.md +0 -763
- package/extensions/plugin-dev/skills/command-development/examples/plugin-commands.md +0 -612
- package/extensions/plugin-dev/skills/command-development/examples/simple-commands.md +0 -527
- package/extensions/plugin-dev/skills/command-development/references/advanced-workflows.md +0 -762
- package/extensions/plugin-dev/skills/command-development/references/documentation-patterns.md +0 -769
- package/extensions/plugin-dev/skills/command-development/references/frontmatter-reference.md +0 -508
- package/extensions/plugin-dev/skills/command-development/references/interactive-commands.md +0 -966
- package/extensions/plugin-dev/skills/command-development/references/marketplace-considerations.md +0 -943
- package/extensions/plugin-dev/skills/command-development/references/plugin-features-reference.md +0 -637
- package/extensions/plugin-dev/skills/command-development/references/plugin-integration.md +0 -191
- package/extensions/plugin-dev/skills/command-development/references/skill-tool.md +0 -447
- package/extensions/plugin-dev/skills/command-development/references/testing-strategies.md +0 -723
- package/extensions/plugin-dev/skills/command-development/scripts/check-frontmatter.sh +0 -234
- package/extensions/plugin-dev/skills/command-development/scripts/validate-command.sh +0 -160
- /package/extensions/enact-operator/{skills/_variants.md → docs/skill-variants.md} +0 -0
|
@@ -1,723 +0,0 @@
|
|
|
1
|
-
# Command Testing Strategies
|
|
2
|
-
|
|
3
|
-
Comprehensive strategies for testing slash commands before deployment and distribution.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Testing commands ensures they work correctly, handle edge cases, and provide good user experience. A systematic testing approach catches issues early and builds confidence in command reliability.
|
|
8
|
-
|
|
9
|
-
## Testing Levels
|
|
10
|
-
|
|
11
|
-
### Level 1: Syntax and Structure Validation
|
|
12
|
-
|
|
13
|
-
**What to test:**
|
|
14
|
-
|
|
15
|
-
- YAML frontmatter syntax
|
|
16
|
-
- Markdown format
|
|
17
|
-
- File location and naming
|
|
18
|
-
|
|
19
|
-
**How to test:**
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# Validate YAML frontmatter
|
|
23
|
-
head -n 20 .claude/commands/my-command.md | grep -A 10 "^---"
|
|
24
|
-
|
|
25
|
-
# Check for closing frontmatter marker
|
|
26
|
-
head -n 20 .claude/commands/my-command.md | grep -c "^---" # Should be 2
|
|
27
|
-
|
|
28
|
-
# Verify file has .md extension
|
|
29
|
-
ls .claude/commands/*.md
|
|
30
|
-
|
|
31
|
-
# Check file is in correct location
|
|
32
|
-
test -f .claude/commands/my-command.md && echo "Found" || echo "Missing"
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**Automated validation script:**
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
#!/bin/bash
|
|
39
|
-
# validate-command.sh
|
|
40
|
-
|
|
41
|
-
COMMAND_FILE="$1"
|
|
42
|
-
|
|
43
|
-
if [ ! -f "$COMMAND_FILE" ]; then
|
|
44
|
-
echo "ERROR: File not found: $COMMAND_FILE"
|
|
45
|
-
exit 1
|
|
46
|
-
fi
|
|
47
|
-
|
|
48
|
-
# Check .md extension
|
|
49
|
-
if [[ ! "$COMMAND_FILE" =~ \.md$ ]]; then
|
|
50
|
-
echo "ERROR: File must have .md extension"
|
|
51
|
-
exit 1
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
# Validate YAML frontmatter if present
|
|
55
|
-
if head -n 1 "$COMMAND_FILE" | grep -q "^---"; then
|
|
56
|
-
# Count frontmatter markers
|
|
57
|
-
MARKERS=$(head -n 50 "$COMMAND_FILE" | grep -c "^---")
|
|
58
|
-
if [ "$MARKERS" -ne 2 ]; then
|
|
59
|
-
echo "ERROR: Invalid YAML frontmatter (need exactly 2 '---' markers)"
|
|
60
|
-
exit 1
|
|
61
|
-
fi
|
|
62
|
-
echo "✓ YAML frontmatter syntax valid"
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
# Check for empty file
|
|
66
|
-
if [ ! -s "$COMMAND_FILE" ]; then
|
|
67
|
-
echo "ERROR: File is empty"
|
|
68
|
-
exit 1
|
|
69
|
-
fi
|
|
70
|
-
|
|
71
|
-
echo "✓ Command file structure valid"
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Level 2: Frontmatter Field Validation
|
|
75
|
-
|
|
76
|
-
**What to test:**
|
|
77
|
-
|
|
78
|
-
- Field types correct
|
|
79
|
-
- Values in valid ranges
|
|
80
|
-
- Required fields present (if any)
|
|
81
|
-
|
|
82
|
-
**Validation script:**
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
#!/bin/bash
|
|
86
|
-
# validate-frontmatter.sh
|
|
87
|
-
|
|
88
|
-
COMMAND_FILE="$1"
|
|
89
|
-
|
|
90
|
-
# Extract YAML frontmatter
|
|
91
|
-
FRONTMATTER=$(sed -n '/^---$/,/^---$/p' "$COMMAND_FILE" | sed '1d;$d')
|
|
92
|
-
|
|
93
|
-
if [ -z "$FRONTMATTER" ]; then
|
|
94
|
-
echo "No frontmatter to validate"
|
|
95
|
-
exit 0
|
|
96
|
-
fi
|
|
97
|
-
|
|
98
|
-
# Check 'model' field if present
|
|
99
|
-
if echo "$FRONTMATTER" | grep -q "^model:"; then
|
|
100
|
-
MODEL=$(echo "$FRONTMATTER" | grep "^model:" | cut -d: -f2 | tr -d ' ')
|
|
101
|
-
if ! echo "sonnet opus haiku" | grep -qw "$MODEL"; then
|
|
102
|
-
echo "ERROR: Invalid model '$MODEL' (must be sonnet, opus, or haiku)"
|
|
103
|
-
exit 1
|
|
104
|
-
fi
|
|
105
|
-
echo "✓ Model field valid: $MODEL"
|
|
106
|
-
fi
|
|
107
|
-
|
|
108
|
-
# Check 'allowed-tools' field format
|
|
109
|
-
if echo "$FRONTMATTER" | grep -q "^allowed-tools:"; then
|
|
110
|
-
echo "✓ allowed-tools field present"
|
|
111
|
-
# Could add more sophisticated validation here
|
|
112
|
-
fi
|
|
113
|
-
|
|
114
|
-
# Check 'description' length
|
|
115
|
-
if echo "$FRONTMATTER" | grep -q "^description:"; then
|
|
116
|
-
DESC=$(echo "$FRONTMATTER" | grep "^description:" | cut -d: -f2-)
|
|
117
|
-
LENGTH=${#DESC}
|
|
118
|
-
if [ "$LENGTH" -gt 80 ]; then
|
|
119
|
-
echo "WARNING: Description length $LENGTH (recommend < 60 chars)"
|
|
120
|
-
else
|
|
121
|
-
echo "✓ Description length acceptable: $LENGTH chars"
|
|
122
|
-
fi
|
|
123
|
-
fi
|
|
124
|
-
|
|
125
|
-
echo "✓ Frontmatter fields valid"
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Level 3: Manual Command Invocation
|
|
129
|
-
|
|
130
|
-
**What to test:**
|
|
131
|
-
|
|
132
|
-
- Command appears in `/help`
|
|
133
|
-
- Command executes without errors
|
|
134
|
-
- Output is as expected
|
|
135
|
-
|
|
136
|
-
**Test procedure:**
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
# 1. Start Claude Code
|
|
140
|
-
claude --debug
|
|
141
|
-
|
|
142
|
-
# 2. Check command appears in help
|
|
143
|
-
> /help
|
|
144
|
-
# Look for your command in the list
|
|
145
|
-
|
|
146
|
-
# 3. Invoke command without arguments
|
|
147
|
-
> /my-command
|
|
148
|
-
# Check for reasonable error or behavior
|
|
149
|
-
|
|
150
|
-
# 4. Invoke with valid arguments
|
|
151
|
-
> /my-command arg1 arg2
|
|
152
|
-
# Verify expected behavior
|
|
153
|
-
|
|
154
|
-
# 5. Check debug logs
|
|
155
|
-
tail -f ~/.claude/debug-logs/latest
|
|
156
|
-
# Look for errors or warnings
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Level 4: Argument Testing
|
|
160
|
-
|
|
161
|
-
**What to test:**
|
|
162
|
-
|
|
163
|
-
- Positional arguments work ($1, $2, etc.)
|
|
164
|
-
- $ARGUMENTS captures all arguments
|
|
165
|
-
- Missing arguments handled gracefully
|
|
166
|
-
- Invalid arguments detected
|
|
167
|
-
|
|
168
|
-
**Test matrix:**
|
|
169
|
-
|
|
170
|
-
| Test Case | Command | Expected Result |
|
|
171
|
-
| ------------- | ------------------------ | -------------------------------------------- |
|
|
172
|
-
| No args | `/cmd` | Graceful handling or useful message |
|
|
173
|
-
| One arg | `/cmd arg1` | $1 substituted correctly |
|
|
174
|
-
| Two args | `/cmd arg1 arg2` | $1 and $2 substituted |
|
|
175
|
-
| Extra args | `/cmd a b c d` | All captured or extras ignored appropriately |
|
|
176
|
-
| Special chars | `/cmd "arg with spaces"` | Quotes handled correctly |
|
|
177
|
-
| Empty arg | `/cmd ""` | Empty string handled |
|
|
178
|
-
|
|
179
|
-
**Test script:**
|
|
180
|
-
|
|
181
|
-
```bash
|
|
182
|
-
#!/bin/bash
|
|
183
|
-
# test-command-arguments.sh
|
|
184
|
-
|
|
185
|
-
COMMAND="$1"
|
|
186
|
-
|
|
187
|
-
echo "Testing argument handling for /$COMMAND"
|
|
188
|
-
echo
|
|
189
|
-
|
|
190
|
-
echo "Test 1: No arguments"
|
|
191
|
-
echo " Command: /$COMMAND"
|
|
192
|
-
echo " Expected: [describe expected behavior]"
|
|
193
|
-
echo " Manual test required"
|
|
194
|
-
echo
|
|
195
|
-
|
|
196
|
-
echo "Test 2: Single argument"
|
|
197
|
-
echo " Command: /$COMMAND test-value"
|
|
198
|
-
echo " Expected: 'test-value' appears in output"
|
|
199
|
-
echo " Manual test required"
|
|
200
|
-
echo
|
|
201
|
-
|
|
202
|
-
echo "Test 3: Multiple arguments"
|
|
203
|
-
echo " Command: /$COMMAND arg1 arg2 arg3"
|
|
204
|
-
echo " Expected: All arguments used appropriately"
|
|
205
|
-
echo " Manual test required"
|
|
206
|
-
echo
|
|
207
|
-
|
|
208
|
-
echo "Test 4: Special characters"
|
|
209
|
-
echo " Command: /$COMMAND \"value with spaces\""
|
|
210
|
-
echo " Expected: Entire phrase captured"
|
|
211
|
-
echo " Manual test required"
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### Level 5: File Reference Testing
|
|
215
|
-
|
|
216
|
-
**What to test:**
|
|
217
|
-
|
|
218
|
-
- @ syntax loads file contents
|
|
219
|
-
- Non-existent files handled
|
|
220
|
-
- Large files handled appropriately
|
|
221
|
-
- Multiple file references work
|
|
222
|
-
|
|
223
|
-
**Test procedure:**
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
# Create test files
|
|
227
|
-
echo "Test content" > /tmp/test-file.txt
|
|
228
|
-
echo "Second file" > /tmp/test-file-2.txt
|
|
229
|
-
|
|
230
|
-
# Test single file reference
|
|
231
|
-
> /my-command /tmp/test-file.txt
|
|
232
|
-
# Verify file content is read
|
|
233
|
-
|
|
234
|
-
# Test non-existent file
|
|
235
|
-
> /my-command /tmp/nonexistent.txt
|
|
236
|
-
# Verify graceful error handling
|
|
237
|
-
|
|
238
|
-
# Test multiple files
|
|
239
|
-
> /my-command /tmp/test-file.txt /tmp/test-file-2.txt
|
|
240
|
-
# Verify both files processed
|
|
241
|
-
|
|
242
|
-
# Test large file
|
|
243
|
-
dd if=/dev/zero of=/tmp/large-file.bin bs=1M count=100
|
|
244
|
-
> /my-command /tmp/large-file.bin
|
|
245
|
-
# Verify reasonable behavior (may truncate or warn)
|
|
246
|
-
|
|
247
|
-
# Cleanup
|
|
248
|
-
rm /tmp/test-file*.txt /tmp/large-file.bin
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Level 6: Bash Execution Testing
|
|
252
|
-
|
|
253
|
-
**What to test:**
|
|
254
|
-
|
|
255
|
-
- ` commands execute correctly
|
|
256
|
-
- Command output included in prompt
|
|
257
|
-
- Command failures handled
|
|
258
|
-
- Security: only allowed commands run
|
|
259
|
-
|
|
260
|
-
**Test procedure:**
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
# Create test command with bash execution
|
|
264
|
-
cat > .claude/commands/test-bash.md << 'EOF'
|
|
265
|
-
---
|
|
266
|
-
description: Test bash execution
|
|
267
|
-
allowed-tools: Bash(echo:*), Bash(date:*)
|
|
268
|
-
---
|
|
269
|
-
|
|
270
|
-
Current date: `date`
|
|
271
|
-
Test output: `echo "Hello from bash"`
|
|
272
|
-
|
|
273
|
-
Analysis of output above...
|
|
274
|
-
EOF
|
|
275
|
-
|
|
276
|
-
# Test in Claude Code
|
|
277
|
-
> /test-bash
|
|
278
|
-
# Verify:
|
|
279
|
-
# 1. Date appears correctly
|
|
280
|
-
# 2. Echo output appears
|
|
281
|
-
# 3. No errors in debug logs
|
|
282
|
-
|
|
283
|
-
# Test with disallowed command (should fail or be blocked)
|
|
284
|
-
cat > .claude/commands/test-forbidden.md << 'EOF'
|
|
285
|
-
---
|
|
286
|
-
description: Test forbidden command
|
|
287
|
-
allowed-tools: Bash(echo:*)
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
Trying forbidden: `ls -la /`
|
|
291
|
-
EOF
|
|
292
|
-
|
|
293
|
-
> /test-forbidden
|
|
294
|
-
# Verify: Permission denied or appropriate error
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
### Level 7: Integration Testing
|
|
298
|
-
|
|
299
|
-
**What to test:**
|
|
300
|
-
|
|
301
|
-
- Commands work with other plugin components
|
|
302
|
-
- Commands interact correctly with each other
|
|
303
|
-
- State management works across invocations
|
|
304
|
-
- Workflow commands execute in sequence
|
|
305
|
-
|
|
306
|
-
**Test scenarios:**
|
|
307
|
-
|
|
308
|
-
#### Scenario 1: Command + Hook Integration
|
|
309
|
-
|
|
310
|
-
```bash
|
|
311
|
-
# Setup: Command that triggers a hook
|
|
312
|
-
# Test: Invoke command, verify hook executes
|
|
313
|
-
|
|
314
|
-
# Command: .claude/commands/risky-operation.md
|
|
315
|
-
# Hook: PreToolUse that validates the operation
|
|
316
|
-
|
|
317
|
-
> /risky-operation
|
|
318
|
-
# Verify: Hook executes and validates before command completes
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
#### Scenario 2: Command Sequence
|
|
322
|
-
|
|
323
|
-
```bash
|
|
324
|
-
# Setup: Multi-command workflow
|
|
325
|
-
> /workflow-init
|
|
326
|
-
# Verify: State file created
|
|
327
|
-
|
|
328
|
-
> /workflow-step2
|
|
329
|
-
# Verify: State file read, step 2 executes
|
|
330
|
-
|
|
331
|
-
> /workflow-complete
|
|
332
|
-
# Verify: State file cleaned up
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
#### Scenario 3: Command + MCP Integration
|
|
336
|
-
|
|
337
|
-
```bash
|
|
338
|
-
# Setup: Command uses MCP tools
|
|
339
|
-
# Test: Verify MCP server accessible
|
|
340
|
-
|
|
341
|
-
> /mcp-command
|
|
342
|
-
# Verify:
|
|
343
|
-
# 1. MCP server starts (if stdio)
|
|
344
|
-
# 2. Tool calls succeed
|
|
345
|
-
# 3. Results included in output
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
## Automated Testing Approaches
|
|
349
|
-
|
|
350
|
-
### Command Test Suite
|
|
351
|
-
|
|
352
|
-
Create a test suite script:
|
|
353
|
-
|
|
354
|
-
```bash
|
|
355
|
-
#!/bin/bash
|
|
356
|
-
# test-commands.sh - Command test suite
|
|
357
|
-
|
|
358
|
-
TEST_DIR=".claude/commands"
|
|
359
|
-
FAILED_TESTS=0
|
|
360
|
-
|
|
361
|
-
echo "Command Test Suite"
|
|
362
|
-
echo "=================="
|
|
363
|
-
echo
|
|
364
|
-
|
|
365
|
-
for cmd_file in "$TEST_DIR"/*.md; do
|
|
366
|
-
cmd_name=$(basename "$cmd_file" .md)
|
|
367
|
-
echo "Testing: $cmd_name"
|
|
368
|
-
|
|
369
|
-
# Validate structure
|
|
370
|
-
if ./validate-command.sh "$cmd_file"; then
|
|
371
|
-
echo " ✓ Structure valid"
|
|
372
|
-
else
|
|
373
|
-
echo " ✗ Structure invalid"
|
|
374
|
-
((FAILED_TESTS++))
|
|
375
|
-
fi
|
|
376
|
-
|
|
377
|
-
# Validate frontmatter
|
|
378
|
-
if ./validate-frontmatter.sh "$cmd_file"; then
|
|
379
|
-
echo " ✓ Frontmatter valid"
|
|
380
|
-
else
|
|
381
|
-
echo " ✗ Frontmatter invalid"
|
|
382
|
-
((FAILED_TESTS++))
|
|
383
|
-
fi
|
|
384
|
-
|
|
385
|
-
echo
|
|
386
|
-
done
|
|
387
|
-
|
|
388
|
-
echo "=================="
|
|
389
|
-
echo "Tests complete"
|
|
390
|
-
echo "Failed: $FAILED_TESTS"
|
|
391
|
-
|
|
392
|
-
exit $FAILED_TESTS
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### Pre-Commit Hook
|
|
396
|
-
|
|
397
|
-
Validate commands before committing:
|
|
398
|
-
|
|
399
|
-
```bash
|
|
400
|
-
#!/bin/bash
|
|
401
|
-
# .git/hooks/pre-commit
|
|
402
|
-
|
|
403
|
-
echo "Validating commands..."
|
|
404
|
-
|
|
405
|
-
COMMANDS_CHANGED=$(git diff --cached --name-only | grep "\.claude/commands/.*\.md")
|
|
406
|
-
|
|
407
|
-
if [ -z "$COMMANDS_CHANGED" ]; then
|
|
408
|
-
echo "No commands changed"
|
|
409
|
-
exit 0
|
|
410
|
-
fi
|
|
411
|
-
|
|
412
|
-
for cmd in $COMMANDS_CHANGED; do
|
|
413
|
-
echo "Checking: $cmd"
|
|
414
|
-
|
|
415
|
-
if ! ./scripts/validate-command.sh "$cmd"; then
|
|
416
|
-
echo "ERROR: Command validation failed: $cmd"
|
|
417
|
-
exit 1
|
|
418
|
-
fi
|
|
419
|
-
done
|
|
420
|
-
|
|
421
|
-
echo "✓ All commands valid"
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### Continuous Testing
|
|
425
|
-
|
|
426
|
-
Test commands in CI/CD:
|
|
427
|
-
|
|
428
|
-
```yaml
|
|
429
|
-
# .github/workflows/test-commands.yml
|
|
430
|
-
name: Test Commands
|
|
431
|
-
|
|
432
|
-
on: [push, pull_request]
|
|
433
|
-
|
|
434
|
-
jobs:
|
|
435
|
-
test:
|
|
436
|
-
runs-on: ubuntu-latest
|
|
437
|
-
steps:
|
|
438
|
-
- uses: actions/checkout@v2
|
|
439
|
-
|
|
440
|
-
- name: Validate command structure
|
|
441
|
-
run: |
|
|
442
|
-
for cmd in .claude/commands/*.md; do
|
|
443
|
-
echo "Testing: $cmd"
|
|
444
|
-
./scripts/validate-command.sh "$cmd"
|
|
445
|
-
done
|
|
446
|
-
|
|
447
|
-
- name: Validate frontmatter
|
|
448
|
-
run: |
|
|
449
|
-
for cmd in .claude/commands/*.md; do
|
|
450
|
-
./scripts/validate-frontmatter.sh "$cmd"
|
|
451
|
-
done
|
|
452
|
-
|
|
453
|
-
- name: Check for TODOs
|
|
454
|
-
run: |
|
|
455
|
-
if grep -r "TODO" .claude/commands/; then
|
|
456
|
-
echo "ERROR: TODOs found in commands"
|
|
457
|
-
exit 1
|
|
458
|
-
fi
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
## Edge Case Testing
|
|
462
|
-
|
|
463
|
-
### Test Edge Cases
|
|
464
|
-
|
|
465
|
-
**Empty arguments:**
|
|
466
|
-
|
|
467
|
-
```bash
|
|
468
|
-
> /cmd ""
|
|
469
|
-
> /cmd '' ''
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
**Special characters:**
|
|
473
|
-
|
|
474
|
-
```bash
|
|
475
|
-
> /cmd "arg with spaces"
|
|
476
|
-
> /cmd arg-with-dashes
|
|
477
|
-
> /cmd arg_with_underscores
|
|
478
|
-
> /cmd arg/with/slashes
|
|
479
|
-
> /cmd 'arg with "quotes"'
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
**Long arguments:**
|
|
483
|
-
|
|
484
|
-
```bash
|
|
485
|
-
> /cmd $(python -c "print('a' * 10000)")
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
**Unusual file paths:**
|
|
489
|
-
|
|
490
|
-
```bash
|
|
491
|
-
> /cmd ./file
|
|
492
|
-
> /cmd ../file
|
|
493
|
-
> /cmd ~/file
|
|
494
|
-
> /cmd "/path with spaces/file"
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
**Bash command edge cases:**
|
|
498
|
-
|
|
499
|
-
```markdown
|
|
500
|
-
# Commands that might fail
|
|
501
|
-
|
|
502
|
-
`exit 1`
|
|
503
|
-
`false`
|
|
504
|
-
`command-that-does-not-exist`
|
|
505
|
-
|
|
506
|
-
# Commands with special output
|
|
507
|
-
|
|
508
|
-
`echo ""`
|
|
509
|
-
`cat /dev/null`
|
|
510
|
-
`yes | head -n 1000000`
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
## Performance Testing
|
|
514
|
-
|
|
515
|
-
### Response Time Testing
|
|
516
|
-
|
|
517
|
-
```bash
|
|
518
|
-
#!/bin/bash
|
|
519
|
-
# test-command-performance.sh
|
|
520
|
-
|
|
521
|
-
COMMAND="$1"
|
|
522
|
-
|
|
523
|
-
echo "Testing performance of /$COMMAND"
|
|
524
|
-
echo
|
|
525
|
-
|
|
526
|
-
for i in {1..5}; do
|
|
527
|
-
echo "Run $i:"
|
|
528
|
-
START=$(date +%s%N)
|
|
529
|
-
|
|
530
|
-
# Invoke command (manual step - record time)
|
|
531
|
-
echo " Invoke: /$COMMAND"
|
|
532
|
-
echo " Start time: $START"
|
|
533
|
-
echo " (Record end time manually)"
|
|
534
|
-
echo
|
|
535
|
-
done
|
|
536
|
-
|
|
537
|
-
echo "Analyze results:"
|
|
538
|
-
echo " - Average response time"
|
|
539
|
-
echo " - Variance"
|
|
540
|
-
echo " - Acceptable threshold: < 3 seconds for fast commands"
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
### Resource Usage Testing
|
|
544
|
-
|
|
545
|
-
```bash
|
|
546
|
-
# Monitor Claude Code during command execution
|
|
547
|
-
# In terminal 1:
|
|
548
|
-
claude --debug
|
|
549
|
-
|
|
550
|
-
# In terminal 2:
|
|
551
|
-
watch -n 1 'ps aux | grep claude'
|
|
552
|
-
|
|
553
|
-
# Execute command and observe:
|
|
554
|
-
# - Memory usage
|
|
555
|
-
# - CPU usage
|
|
556
|
-
# - Process count
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
## User Experience Testing
|
|
560
|
-
|
|
561
|
-
### Usability Checklist
|
|
562
|
-
|
|
563
|
-
- [ ] Command name is intuitive
|
|
564
|
-
- [ ] Description is clear in `/help`
|
|
565
|
-
- [ ] Arguments are well-documented
|
|
566
|
-
- [ ] Error messages are helpful
|
|
567
|
-
- [ ] Output is formatted readably
|
|
568
|
-
- [ ] Long-running commands show progress
|
|
569
|
-
- [ ] Results are actionable
|
|
570
|
-
- [ ] Edge cases have good UX
|
|
571
|
-
|
|
572
|
-
### User Acceptance Testing
|
|
573
|
-
|
|
574
|
-
Recruit testers:
|
|
575
|
-
|
|
576
|
-
```markdown
|
|
577
|
-
# Testing Guide for Beta Testers
|
|
578
|
-
|
|
579
|
-
## Command: /my-new-command
|
|
580
|
-
|
|
581
|
-
### Test Scenarios
|
|
582
|
-
|
|
583
|
-
1. **Basic usage:**
|
|
584
|
-
- Run: `/my-new-command`
|
|
585
|
-
- Expected: [describe]
|
|
586
|
-
- Rate clarity: 1-5
|
|
587
|
-
|
|
588
|
-
2. **With arguments:**
|
|
589
|
-
- Run: `/my-new-command arg1 arg2`
|
|
590
|
-
- Expected: [describe]
|
|
591
|
-
- Rate usefulness: 1-5
|
|
592
|
-
|
|
593
|
-
3. **Error case:**
|
|
594
|
-
- Run: `/my-new-command invalid-input`
|
|
595
|
-
- Expected: Helpful error message
|
|
596
|
-
- Rate error message: 1-5
|
|
597
|
-
|
|
598
|
-
### Feedback Questions
|
|
599
|
-
|
|
600
|
-
1. Was the command easy to understand?
|
|
601
|
-
2. Did the output meet your expectations?
|
|
602
|
-
3. What would you change?
|
|
603
|
-
4. Would you use this command regularly?
|
|
604
|
-
```
|
|
605
|
-
|
|
606
|
-
## Testing Checklist
|
|
607
|
-
|
|
608
|
-
Before releasing a command:
|
|
609
|
-
|
|
610
|
-
### Structure
|
|
611
|
-
|
|
612
|
-
- [ ] File in correct location
|
|
613
|
-
- [ ] Correct .md extension
|
|
614
|
-
- [ ] Valid YAML frontmatter (if present)
|
|
615
|
-
- [ ] Markdown syntax correct
|
|
616
|
-
|
|
617
|
-
### Functionality
|
|
618
|
-
|
|
619
|
-
- [ ] Command appears in `/help`
|
|
620
|
-
- [ ] Description is clear
|
|
621
|
-
- [ ] Command executes without errors
|
|
622
|
-
- [ ] Arguments work as expected
|
|
623
|
-
- [ ] File references work
|
|
624
|
-
- [ ] Bash execution works (if used)
|
|
625
|
-
|
|
626
|
-
### Edge Cases
|
|
627
|
-
|
|
628
|
-
- [ ] Missing arguments handled
|
|
629
|
-
- [ ] Invalid arguments detected
|
|
630
|
-
- [ ] Non-existent files handled
|
|
631
|
-
- [ ] Special characters work
|
|
632
|
-
- [ ] Long inputs handled
|
|
633
|
-
|
|
634
|
-
### Integration
|
|
635
|
-
|
|
636
|
-
- [ ] Works with other commands
|
|
637
|
-
- [ ] Works with hooks (if applicable)
|
|
638
|
-
- [ ] Works with MCP (if applicable)
|
|
639
|
-
- [ ] State management works
|
|
640
|
-
|
|
641
|
-
### Quality
|
|
642
|
-
|
|
643
|
-
- [ ] Performance acceptable
|
|
644
|
-
- [ ] No security issues
|
|
645
|
-
- [ ] Error messages helpful
|
|
646
|
-
- [ ] Output formatted well
|
|
647
|
-
- [ ] Documentation complete
|
|
648
|
-
|
|
649
|
-
### Distribution
|
|
650
|
-
|
|
651
|
-
- [ ] Tested by others
|
|
652
|
-
- [ ] Feedback incorporated
|
|
653
|
-
- [ ] README updated
|
|
654
|
-
- [ ] Examples provided
|
|
655
|
-
|
|
656
|
-
## Debugging Failed Tests
|
|
657
|
-
|
|
658
|
-
### Common Issues and Solutions
|
|
659
|
-
|
|
660
|
-
#### Issue: Command not appearing in /help
|
|
661
|
-
|
|
662
|
-
```bash
|
|
663
|
-
# Check file location
|
|
664
|
-
ls -la .claude/commands/my-command.md
|
|
665
|
-
|
|
666
|
-
# Check permissions
|
|
667
|
-
chmod 644 .claude/commands/my-command.md
|
|
668
|
-
|
|
669
|
-
# Check syntax
|
|
670
|
-
head -n 20 .claude/commands/my-command.md
|
|
671
|
-
|
|
672
|
-
# Restart Claude Code
|
|
673
|
-
claude --debug
|
|
674
|
-
```
|
|
675
|
-
|
|
676
|
-
#### Issue: Arguments not substituting
|
|
677
|
-
|
|
678
|
-
```bash
|
|
679
|
-
# Verify syntax
|
|
680
|
-
grep '\$1' .claude/commands/my-command.md
|
|
681
|
-
grep '\$ARGUMENTS' .claude/commands/my-command.md
|
|
682
|
-
|
|
683
|
-
# Test with simple command first
|
|
684
|
-
echo "Test: \$1 and \$2" > .claude/commands/test-args.md
|
|
685
|
-
```
|
|
686
|
-
|
|
687
|
-
#### Issue: Bash commands not executing
|
|
688
|
-
|
|
689
|
-
```bash
|
|
690
|
-
# Check allowed-tools
|
|
691
|
-
grep "allowed-tools" .claude/commands/my-command.md
|
|
692
|
-
|
|
693
|
-
# Verify command has bash execution syntax (! followed by backtick)
|
|
694
|
-
# Note: Command files use actual ! syntax, not [BANG] placeholder
|
|
695
|
-
grep -E '!\x60' .claude/commands/my-command.md
|
|
696
|
-
|
|
697
|
-
# Test command manually
|
|
698
|
-
date
|
|
699
|
-
echo "test"
|
|
700
|
-
```
|
|
701
|
-
|
|
702
|
-
#### Issue: File references not working
|
|
703
|
-
|
|
704
|
-
```bash
|
|
705
|
-
# Check @ syntax
|
|
706
|
-
grep '@' .claude/commands/my-command.md
|
|
707
|
-
|
|
708
|
-
# Verify file exists
|
|
709
|
-
ls -la /path/to/referenced/file
|
|
710
|
-
|
|
711
|
-
# Check permissions
|
|
712
|
-
chmod 644 /path/to/referenced/file
|
|
713
|
-
```
|
|
714
|
-
|
|
715
|
-
## Best Practices
|
|
716
|
-
|
|
717
|
-
1. **Test early, test often**: Validate as you develop
|
|
718
|
-
2. **Automate validation**: Use scripts for repeatable checks
|
|
719
|
-
3. **Test edge cases**: Don't just test the happy path
|
|
720
|
-
4. **Get feedback**: Have others test before wide release
|
|
721
|
-
5. **Document tests**: Keep test scenarios for regression testing
|
|
722
|
-
6. **Monitor in production**: Watch for issues after release
|
|
723
|
-
7. **Iterate**: Improve based on real usage data
|