specweave 1.0.55 → 1.0.56
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/package.json +1 -1
- package/plugins/specweave/agents/infrastructure/AGENT.md +49 -0
- package/plugins/specweave/commands/auto.md +165 -0
- package/plugins/specweave/commands/do.md +56 -0
- package/plugins/specweave/hooks/stop-auto.sh +45 -0
- package/plugins/specweave/skills/auto-execute/SKILL.md +374 -0
- package/plugins/specweave-infrastructure/agents/devops/AGENT.md +109 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specweave",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.56",
|
|
4
4
|
"description": "Spec-driven development framework for Claude Code. AI-native workflow with living documentation, intelligent agents, and multilingual support (9 languages). Enterprise-grade traceability with permanent specs and temporary increments.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -77,6 +77,55 @@ Before you finish ANY response, mentally verify:
|
|
|
77
77
|
|
|
78
78
|
---
|
|
79
79
|
|
|
80
|
+
## 🚨🔐 CRITICAL: AUTO-EXECUTE WITH CREDENTIALS (MANDATORY) 🔐🚨
|
|
81
|
+
|
|
82
|
+
**NEVER OUTPUT MANUAL "NEXT STEPS" WHEN CREDENTIALS ARE AVAILABLE!**
|
|
83
|
+
|
|
84
|
+
### The Golden Rule
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
❌ FORBIDDEN: "Next Steps: Run terraform apply"
|
|
88
|
+
❌ FORBIDDEN: "Execute the schema in Supabase SQL Editor"
|
|
89
|
+
❌ FORBIDDEN: "Deploy with: wrangler deploy"
|
|
90
|
+
|
|
91
|
+
✅ REQUIRED: Execute commands DIRECTLY using available credentials
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Mandatory Credential Lookup (BEFORE ANY DEPLOYMENT)
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Always check for credentials FIRST:
|
|
98
|
+
grep -E "SUPABASE|DATABASE_URL|CF_|AWS_|HETZNER|GCP|AZURE" .env 2>/dev/null
|
|
99
|
+
wrangler whoami 2>/dev/null
|
|
100
|
+
aws sts get-caller-identity 2>/dev/null
|
|
101
|
+
supabase status 2>/dev/null
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Platform Auto-Execution Rules
|
|
105
|
+
|
|
106
|
+
| Platform | If Credentials Found | Action |
|
|
107
|
+
|----------|---------------------|--------|
|
|
108
|
+
| **Supabase** | `DATABASE_URL` or `SUPABASE_*` | Execute: `supabase db push` or `psql -f schema.sql` |
|
|
109
|
+
| **Wrangler** | `CF_API_TOKEN` or authenticated | Execute: `wrangler deploy`, `wrangler secret put` |
|
|
110
|
+
| **Terraform** | Cloud provider credentials | Execute: `terraform apply -auto-approve` |
|
|
111
|
+
| **Firebase** | `FIREBASE_TOKEN` or logged in | Execute: `firebase deploy` |
|
|
112
|
+
| **AWS** | `AWS_*` credentials | Execute: AWS CLI commands directly |
|
|
113
|
+
|
|
114
|
+
### If Credentials Missing → ASK, Don't Show Manual Steps
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
🔐 **Credential Required**
|
|
118
|
+
|
|
119
|
+
I need your Supabase database URL to execute the migration.
|
|
120
|
+
|
|
121
|
+
**How to get it:** https://supabase.com/dashboard → Settings → API
|
|
122
|
+
|
|
123
|
+
**Please paste your DATABASE_URL:**
|
|
124
|
+
[I will save to .env and execute automatically]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
80
129
|
# Infrastructure Agent
|
|
81
130
|
|
|
82
131
|
I'm a serverless infrastructure specialist who generates production-ready Infrastructure-as-Code (IaC) using Terraform. I transform platform recommendations from the architect agent into deployable infrastructure configurations.
|
|
@@ -182,6 +182,171 @@ Pure Ralph Wiggum behavior:
|
|
|
182
182
|
- **Max Hours**: Time boxing
|
|
183
183
|
- **stop_hook_active**: Prevents infinite continuation loops
|
|
184
184
|
|
|
185
|
+
## 🔐 Auto-Execute with Credentials (MANDATORY)
|
|
186
|
+
|
|
187
|
+
**In auto mode, ALL agents MUST follow the auto-execute skill rules:**
|
|
188
|
+
|
|
189
|
+
### The Golden Rule
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
❌ FORBIDDEN: "Next Steps: Run wrangler deploy"
|
|
193
|
+
❌ FORBIDDEN: "Execute the schema in Supabase SQL Editor"
|
|
194
|
+
❌ FORBIDDEN: "Set secret via: wrangler secret put..."
|
|
195
|
+
|
|
196
|
+
✅ REQUIRED: Execute commands DIRECTLY using available credentials
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Credential Lookup Order
|
|
200
|
+
|
|
201
|
+
Before ANY deployment task, check for credentials:
|
|
202
|
+
|
|
203
|
+
1. **`.env` file** - Primary credential storage
|
|
204
|
+
2. **Environment variables** - Already loaded in session
|
|
205
|
+
3. **CLI tool auth** - `wrangler whoami`, `gh auth status`, etc.
|
|
206
|
+
4. **Config files** - `wrangler.toml`, `.specweave/config.json`
|
|
207
|
+
|
|
208
|
+
### If Credentials Found → AUTO-EXECUTE
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Example: Supabase migration
|
|
212
|
+
if grep -q "DATABASE_URL" .env; then
|
|
213
|
+
source .env
|
|
214
|
+
psql "$DATABASE_URL" -f schema.sql
|
|
215
|
+
fi
|
|
216
|
+
|
|
217
|
+
# Example: Wrangler deployment
|
|
218
|
+
if wrangler whoami 2>/dev/null; then
|
|
219
|
+
wrangler deploy
|
|
220
|
+
fi
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### If Credentials Missing → ASK, Don't Show Manual Steps
|
|
224
|
+
|
|
225
|
+
```markdown
|
|
226
|
+
🔐 **Credential Required for Auto-Execution**
|
|
227
|
+
|
|
228
|
+
I need your Supabase database URL to execute the migration.
|
|
229
|
+
|
|
230
|
+
**Please paste your DATABASE_URL:**
|
|
231
|
+
[I will save to .env and continue automatically]
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**After user provides credential:**
|
|
235
|
+
1. Save to `.env`
|
|
236
|
+
2. EXECUTE immediately
|
|
237
|
+
3. Continue auto mode
|
|
238
|
+
|
|
239
|
+
See: `plugins/specweave/skills/auto-execute/SKILL.md` for full details.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 🎯 Self-Assessment Scoring (Ralph-Loop Pattern)
|
|
244
|
+
|
|
245
|
+
**Auto mode uses self-assessment scoring to guide continuation decisions:**
|
|
246
|
+
|
|
247
|
+
### Confidence Scoring
|
|
248
|
+
|
|
249
|
+
After each task/iteration, Claude self-assesses execution quality:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"iteration": 5,
|
|
254
|
+
"task": "T-003",
|
|
255
|
+
"confidence": {
|
|
256
|
+
"execution_quality": 0.92, // How well was the task executed?
|
|
257
|
+
"test_coverage": 0.85, // Are tests adequate?
|
|
258
|
+
"spec_alignment": 0.95, // Does implementation match spec?
|
|
259
|
+
"credential_success": 1.0, // Were all deployments successful?
|
|
260
|
+
"overall": 0.93 // Weighted average
|
|
261
|
+
},
|
|
262
|
+
"concerns": [],
|
|
263
|
+
"blockers": []
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Score Thresholds
|
|
268
|
+
|
|
269
|
+
| Overall Score | Action |
|
|
270
|
+
|---------------|--------|
|
|
271
|
+
| ≥ 0.90 | ✅ Continue confidently |
|
|
272
|
+
| 0.70-0.89 | ⚠️ Continue with caution, log concerns |
|
|
273
|
+
| 0.50-0.69 | 🟡 Pause for self-review before continuing |
|
|
274
|
+
| < 0.50 | 🔴 Stop and request human review |
|
|
275
|
+
|
|
276
|
+
### Self-Assessment Prompt (Internal)
|
|
277
|
+
|
|
278
|
+
After completing each task, evaluate:
|
|
279
|
+
|
|
280
|
+
```markdown
|
|
281
|
+
<self-assessment>
|
|
282
|
+
Task: T-003 - Implement user authentication
|
|
283
|
+
Status: completed
|
|
284
|
+
|
|
285
|
+
Execution Quality (0.0-1.0): 0.92
|
|
286
|
+
- ✅ All acceptance criteria met
|
|
287
|
+
- ✅ Tests pass
|
|
288
|
+
- ⚠️ Minor edge case not covered (low impact)
|
|
289
|
+
|
|
290
|
+
Test Coverage (0.0-1.0): 0.85
|
|
291
|
+
- ✅ Unit tests: 12/12 pass
|
|
292
|
+
- ✅ Integration tests: 5/5 pass
|
|
293
|
+
- ⚠️ E2E test coverage: 75% (target: 80%)
|
|
294
|
+
|
|
295
|
+
Spec Alignment (0.0-1.0): 0.95
|
|
296
|
+
- ✅ All ACs addressed
|
|
297
|
+
- ✅ Architecture matches plan.md
|
|
298
|
+
|
|
299
|
+
Credential Success (0.0-1.0): 1.0
|
|
300
|
+
- ✅ Database migration executed successfully
|
|
301
|
+
- ✅ Secrets deployed to Cloudflare
|
|
302
|
+
|
|
303
|
+
Overall: 0.93 → CONTINUE
|
|
304
|
+
</self-assessment>
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Integration with Stop Hook
|
|
308
|
+
|
|
309
|
+
The stop hook (`plugins/specweave/hooks/stop-auto.sh`) reads this scoring:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Check self-assessment in transcript
|
|
313
|
+
SCORE=$(grep -oP 'Overall:\s*\K[0-9.]+' "$TRANSCRIPT_PATH" 2>/dev/null | tail -1)
|
|
314
|
+
|
|
315
|
+
if [ -n "$SCORE" ] && [ "$(echo "$SCORE < 0.50" | bc)" -eq 1 ]; then
|
|
316
|
+
# Score too low, stop for human review
|
|
317
|
+
approve "Low confidence score ($SCORE), requesting human review"
|
|
318
|
+
fi
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Test Execution Integration
|
|
322
|
+
|
|
323
|
+
**Auto mode MUST run tests after completing testable tasks:**
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
# After task completion, if task affects testable code:
|
|
327
|
+
if [[ "$TASK_TYPE" == *"implement"* ]] || [[ "$TASK_TYPE" == *"fix"* ]]; then
|
|
328
|
+
npm test 2>&1 | tee test-output.log
|
|
329
|
+
|
|
330
|
+
if [ $? -ne 0 ]; then
|
|
331
|
+
# Tests failed - attempt fix
|
|
332
|
+
echo "🔴 Tests failed, attempting fix..."
|
|
333
|
+
# Self-healing loop (max 3 attempts)
|
|
334
|
+
fi
|
|
335
|
+
fi
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Quality Gate Before Continue
|
|
339
|
+
|
|
340
|
+
Before moving to next task, verify:
|
|
341
|
+
|
|
342
|
+
1. ✅ Current task marked complete in tasks.md
|
|
343
|
+
2. ✅ Corresponding ACs checked in spec.md
|
|
344
|
+
3. ✅ Tests pass (if applicable)
|
|
345
|
+
4. ✅ No deployment errors (if applicable)
|
|
346
|
+
5. ✅ Self-assessment score ≥ 0.70
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
185
350
|
## Execution
|
|
186
351
|
|
|
187
352
|
When this command is invoked:
|
|
@@ -680,6 +680,62 @@ Options:
|
|
|
680
680
|
|
|
681
681
|
---
|
|
682
682
|
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
## 🔐 Auto-Execute with Credentials (MANDATORY)
|
|
686
|
+
|
|
687
|
+
**When executing deployment tasks, ALWAYS follow auto-execute rules:**
|
|
688
|
+
|
|
689
|
+
### The Golden Rule
|
|
690
|
+
|
|
691
|
+
```
|
|
692
|
+
❌ FORBIDDEN: "Next Steps: Run wrangler deploy"
|
|
693
|
+
❌ FORBIDDEN: "Execute the schema in Supabase SQL Editor"
|
|
694
|
+
❌ FORBIDDEN: "Set secret via: wrangler secret put..."
|
|
695
|
+
|
|
696
|
+
✅ REQUIRED: Execute commands DIRECTLY using available credentials
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
### Before Any Deployment Task
|
|
700
|
+
|
|
701
|
+
```bash
|
|
702
|
+
# Always check for credentials FIRST:
|
|
703
|
+
grep -E "SUPABASE|DATABASE_URL|CF_|AWS_|HETZNER" .env 2>/dev/null
|
|
704
|
+
wrangler whoami 2>/dev/null
|
|
705
|
+
aws sts get-caller-identity 2>/dev/null
|
|
706
|
+
gh auth status 2>/dev/null
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
### Auto-Execute Decision
|
|
710
|
+
|
|
711
|
+
| Credentials Found? | Action |
|
|
712
|
+
|-------------------|--------|
|
|
713
|
+
| ✅ Found | Execute command directly, show success message |
|
|
714
|
+
| ❌ Not found | ASK for credential (don't show manual steps) |
|
|
715
|
+
|
|
716
|
+
### Example: Supabase Migration Task
|
|
717
|
+
|
|
718
|
+
**If DATABASE_URL exists in .env:**
|
|
719
|
+
```bash
|
|
720
|
+
source .env
|
|
721
|
+
psql "$DATABASE_URL" -f src/db/schema.sql
|
|
722
|
+
echo "✅ Schema applied successfully"
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
**If DATABASE_URL missing:**
|
|
726
|
+
```markdown
|
|
727
|
+
🔐 **Credential Required**
|
|
728
|
+
|
|
729
|
+
I need your Supabase database URL to execute the migration.
|
|
730
|
+
|
|
731
|
+
**Please paste your DATABASE_URL:**
|
|
732
|
+
[I will save to .env and execute automatically]
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
See: `plugins/specweave/skills/auto-execute/SKILL.md` for full details.
|
|
736
|
+
|
|
737
|
+
---
|
|
738
|
+
|
|
683
739
|
## Why "/do" instead of "/do"?
|
|
684
740
|
|
|
685
741
|
**Universal applicability**: SpecWeave isn't just for software engineering!
|
|
@@ -122,6 +122,51 @@ if [ -n "$TRANSCRIPT_PATH" ] && [ -f "$TRANSCRIPT_PATH" ]; then
|
|
|
122
122
|
> "$SESSION_FILE"
|
|
123
123
|
approve "Completion promise detected"
|
|
124
124
|
fi
|
|
125
|
+
|
|
126
|
+
# Check self-assessment score (Ralph-Loop pattern)
|
|
127
|
+
# Look for <self-assessment>...Overall: X.XX...</self-assessment> in transcript
|
|
128
|
+
SELF_SCORE=$(grep -oE 'Overall:\s*[0-9]+\.[0-9]+' "$TRANSCRIPT_PATH" 2>/dev/null | tail -1 | grep -oE '[0-9]+\.[0-9]+')
|
|
129
|
+
|
|
130
|
+
if [ -n "$SELF_SCORE" ]; then
|
|
131
|
+
# Log the score
|
|
132
|
+
echo "{\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"event\":\"self_assessment\",\"score\":$SELF_SCORE,\"increment\":\"$CURRENT_INCREMENT\"}" >> "$LOGS_DIR/auto-iterations.log"
|
|
133
|
+
|
|
134
|
+
# Check if score is critically low (< 0.50) - requires human review
|
|
135
|
+
if [ "$(echo "$SELF_SCORE < 0.50" | bc 2>/dev/null || echo "0")" -eq 1 ]; then
|
|
136
|
+
echo "$SESSION" | jq --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg score "$SELF_SCORE" \
|
|
137
|
+
'.status = "paused" | .pauseTime = $now | .pauseReason = "low_confidence_score" | .lastScore = ($score | tonumber)' \
|
|
138
|
+
> "$SESSION_FILE"
|
|
139
|
+
approve "Low confidence score ($SELF_SCORE < 0.50), requesting human review"
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
# Check if score indicates concern (0.50-0.69) - log but continue
|
|
143
|
+
if [ "$(echo "$SELF_SCORE >= 0.50 && $SELF_SCORE < 0.70" | bc 2>/dev/null || echo "0")" -eq 1 ]; then
|
|
144
|
+
echo "{\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"event\":\"caution\",\"score\":$SELF_SCORE,\"message\":\"Moderate confidence, self-review recommended\"}" >> "$LOGS_DIR/auto-iterations.log"
|
|
145
|
+
fi
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
# Check for failed tests in transcript (hard stop)
|
|
149
|
+
if grep -q "Tests failed\|FAIL\|npm ERR!" "$TRANSCRIPT_PATH" 2>/dev/null; then
|
|
150
|
+
FAIL_COUNT=$(grep -c "FAIL\|npm ERR!" "$TRANSCRIPT_PATH" 2>/dev/null | tr -d '[:space:]' || echo "0")
|
|
151
|
+
# Only stop if multiple failures (single failure might be fixed in next iteration)
|
|
152
|
+
if [ "$FAIL_COUNT" -gt 3 ]; then
|
|
153
|
+
echo "$SESSION" | jq --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
|
154
|
+
'.status = "paused" | .pauseTime = $now | .pauseReason = "repeated_test_failures"' \
|
|
155
|
+
> "$SESSION_FILE"
|
|
156
|
+
approve "Multiple test failures detected ($FAIL_COUNT), requesting human review"
|
|
157
|
+
fi
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# Check for deployment/credential errors (auto-execute integration)
|
|
161
|
+
if grep -qE "wrangler.*error|supabase.*error|terraform.*error|aws.*error|Error:.*credential|Error:.*secret|Error:.*token" "$TRANSCRIPT_PATH" 2>/dev/null; then
|
|
162
|
+
CRED_ERRORS=$(grep -cE "credential|secret|token" "$TRANSCRIPT_PATH" 2>/dev/null | tr -d '[:space:]' || echo "0")
|
|
163
|
+
if [ "$CRED_ERRORS" -gt 2 ]; then
|
|
164
|
+
echo "$SESSION" | jq --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
|
165
|
+
'.status = "paused" | .pauseTime = $now | .pauseReason = "credential_errors"' \
|
|
166
|
+
> "$SESSION_FILE"
|
|
167
|
+
approve "Multiple credential/deployment errors, requesting credential check"
|
|
168
|
+
fi
|
|
169
|
+
fi
|
|
125
170
|
fi
|
|
126
171
|
|
|
127
172
|
# Check tasks.md for completion (primary completion signal)
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auto-execute
|
|
3
|
+
description: Enforces automatic command execution when credentials are available. NEVER output manual "Next Steps" - always execute commands automatically using secrets from .env, environment variables, and config files. Applies to all deployment tools including Supabase, Cloudflare Wrangler, Terraform, AWS CLI, GitHub CLI, and database operations. Activates for: auto-execute, credentials, deployment, wrangler, supabase, terraform, deploy, secrets, .env.
|
|
4
|
+
allowed-tools: Bash, Read, Grep, Glob, Write, Edit
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Auto-Execute Skill: MANDATORY for Auto Mode
|
|
8
|
+
|
|
9
|
+
## CRITICAL RULE: NEVER Output Manual Instructions When Credentials Exist
|
|
10
|
+
|
|
11
|
+
**This skill MUST be applied by ALL agents when operating in auto mode or when credentials are available.**
|
|
12
|
+
|
|
13
|
+
### The Golden Rule
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
❌ WRONG: "Next Steps: Run the schema SQL in Supabase SQL Editor..."
|
|
17
|
+
❌ WRONG: "Set the secret via: wrangler secret put SUPABASE_SECRET_KEY"
|
|
18
|
+
❌ WRONG: "Deploy with: wrangler deploy"
|
|
19
|
+
|
|
20
|
+
✅ CORRECT: Execute commands directly using available credentials
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Mandatory Credential Lookup Workflow
|
|
26
|
+
|
|
27
|
+
### Step 1: ALWAYS Check for Existing Credentials FIRST
|
|
28
|
+
|
|
29
|
+
**Before outputting ANY manual instructions, search for credentials in this order:**
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 1. Check .env file (primary location)
|
|
33
|
+
if [ -f .env ]; then
|
|
34
|
+
source .env 2>/dev/null
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# 2. Check project-specific .env files
|
|
38
|
+
for f in .env.local .env.development .env.production; do
|
|
39
|
+
[ -f "$f" ] && source "$f" 2>/dev/null
|
|
40
|
+
done
|
|
41
|
+
|
|
42
|
+
# 3. Check environment variables (already loaded)
|
|
43
|
+
# e.g., $SUPABASE_URL, $SUPABASE_ANON_KEY, $CF_API_TOKEN
|
|
44
|
+
|
|
45
|
+
# 4. Check .specweave/config.json for service configs
|
|
46
|
+
cat .specweave/config.json 2>/dev/null | grep -A10 '"sync"'
|
|
47
|
+
|
|
48
|
+
# 5. Check wrangler.toml for Cloudflare config
|
|
49
|
+
cat wrangler.toml 2>/dev/null
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Step 2: Credential Discovery Patterns
|
|
53
|
+
|
|
54
|
+
**Supabase Credentials:**
|
|
55
|
+
```bash
|
|
56
|
+
# Check for Supabase credentials
|
|
57
|
+
grep -E "SUPABASE|NEXT_PUBLIC_SUPABASE" .env .env.* 2>/dev/null
|
|
58
|
+
# Look for: SUPABASE_URL, SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Cloudflare Wrangler Credentials:**
|
|
62
|
+
```bash
|
|
63
|
+
# Check for Cloudflare credentials
|
|
64
|
+
grep -E "CF_|CLOUDFLARE_|WRANGLER" .env .env.* 2>/dev/null
|
|
65
|
+
wrangler whoami 2>/dev/null # Check if already authenticated
|
|
66
|
+
# Look for: CF_API_TOKEN, CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**AWS Credentials:**
|
|
70
|
+
```bash
|
|
71
|
+
aws sts get-caller-identity 2>/dev/null # Check if configured
|
|
72
|
+
cat ~/.aws/credentials 2>/dev/null
|
|
73
|
+
# Look for: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**GitHub CLI:**
|
|
77
|
+
```bash
|
|
78
|
+
gh auth status 2>/dev/null # Check if logged in
|
|
79
|
+
grep GITHUB_TOKEN .env 2>/dev/null
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Terraform Cloud:**
|
|
83
|
+
```bash
|
|
84
|
+
grep TF_TOKEN .env 2>/dev/null
|
|
85
|
+
cat ~/.terraform.d/credentials.tfrc.json 2>/dev/null
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Auto-Execution Commands by Tool
|
|
91
|
+
|
|
92
|
+
### Supabase Operations
|
|
93
|
+
|
|
94
|
+
**WHEN CREDENTIALS EXIST, AUTO-EXECUTE:**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Execute SQL schema directly
|
|
98
|
+
supabase db push --db-url "$DATABASE_URL"
|
|
99
|
+
|
|
100
|
+
# OR if using Supabase CLI with project ref
|
|
101
|
+
supabase db push --project-ref "$SUPABASE_PROJECT_REF"
|
|
102
|
+
|
|
103
|
+
# OR execute SQL file directly via psql
|
|
104
|
+
psql "$DATABASE_URL" -f src/db/supabase-schema.sql
|
|
105
|
+
|
|
106
|
+
# Deploy edge functions
|
|
107
|
+
supabase functions deploy <function-name>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**NEVER say**: "Run the schema SQL in Supabase SQL Editor..."
|
|
111
|
+
|
|
112
|
+
### Cloudflare Wrangler Operations
|
|
113
|
+
|
|
114
|
+
**WHEN CREDENTIALS EXIST, AUTO-EXECUTE:**
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Set secrets (loop through required secrets)
|
|
118
|
+
for secret in SUPABASE_SECRET_KEY DATABASE_URL JWT_SECRET; do
|
|
119
|
+
if [ -n "${!secret}" ]; then
|
|
120
|
+
echo "${!secret}" | wrangler secret put "$secret" --quiet
|
|
121
|
+
fi
|
|
122
|
+
done
|
|
123
|
+
|
|
124
|
+
# Deploy
|
|
125
|
+
wrangler deploy
|
|
126
|
+
|
|
127
|
+
# Or for Pages projects
|
|
128
|
+
wrangler pages publish ./dist
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**NEVER say**: "Set the secret via: wrangler secret put..."
|
|
132
|
+
**NEVER say**: "Deploy with: wrangler deploy"
|
|
133
|
+
|
|
134
|
+
### Terraform Operations
|
|
135
|
+
|
|
136
|
+
**WHEN CREDENTIALS EXIST, AUTO-EXECUTE:**
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Auto-approve in non-interactive mode
|
|
140
|
+
TF_VAR_hetzner_token="$HETZNER_API_TOKEN" terraform apply -auto-approve
|
|
141
|
+
|
|
142
|
+
# Or with var file
|
|
143
|
+
terraform apply -auto-approve -var-file="environments/dev.tfvars"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**NEVER say**: "Run terraform apply and type 'yes'..."
|
|
147
|
+
|
|
148
|
+
### AWS CLI Operations
|
|
149
|
+
|
|
150
|
+
**WHEN CREDENTIALS EXIST, AUTO-EXECUTE:**
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Lambda deployment
|
|
154
|
+
aws lambda update-function-code --function-name my-func --zip-file fileb://function.zip
|
|
155
|
+
|
|
156
|
+
# S3 upload
|
|
157
|
+
aws s3 sync ./dist s3://my-bucket/
|
|
158
|
+
|
|
159
|
+
# CloudFormation deployment
|
|
160
|
+
aws cloudformation deploy --template-file template.yaml --stack-name my-stack
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### GitHub CLI Operations
|
|
164
|
+
|
|
165
|
+
**WHEN CREDENTIALS EXIST, AUTO-EXECUTE:**
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Create release
|
|
169
|
+
gh release create v1.0.0 --title "Release v1.0.0" --notes "Changelog..."
|
|
170
|
+
|
|
171
|
+
# Create issue
|
|
172
|
+
gh issue create --title "Title" --body "Body"
|
|
173
|
+
|
|
174
|
+
# Create PR
|
|
175
|
+
gh pr create --title "Title" --body "Body"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### NPM Publishing
|
|
179
|
+
|
|
180
|
+
**WHEN NPM_TOKEN EXISTS, AUTO-EXECUTE:**
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Check for NPM token
|
|
184
|
+
if [ -n "$NPM_TOKEN" ]; then
|
|
185
|
+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
|
|
186
|
+
npm publish
|
|
187
|
+
rm .npmrc
|
|
188
|
+
fi
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Decision Tree: Execute vs Ask
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
┌─────────────────────────────────────────────────────────┐
|
|
197
|
+
│ Task requires external tool (wrangler, supabase, etc.) │
|
|
198
|
+
└───────────────────────────┬─────────────────────────────┘
|
|
199
|
+
│
|
|
200
|
+
▼
|
|
201
|
+
┌────────────────────────┐
|
|
202
|
+
│ Search for credentials │
|
|
203
|
+
│ .env, env vars, config │
|
|
204
|
+
└───────────┬────────────┘
|
|
205
|
+
│
|
|
206
|
+
┌─────────────────┴─────────────────┐
|
|
207
|
+
│ │
|
|
208
|
+
▼ ▼
|
|
209
|
+
┌───────────────────┐ ┌───────────────────┐
|
|
210
|
+
│ Credentials FOUND │ │ Credentials MISSING│
|
|
211
|
+
└────────┬──────────┘ └────────┬──────────┘
|
|
212
|
+
│ │
|
|
213
|
+
▼ ▼
|
|
214
|
+
┌────────────────────┐ ┌────────────────────┐
|
|
215
|
+
│ EXECUTE COMMAND │ │ ASK FOR CREDENTIALS│
|
|
216
|
+
│ IMMEDIATELY │ │ (Don't show manual │
|
|
217
|
+
│ │ │ steps, ask for │
|
|
218
|
+
│ NO "Next Steps" │ │ the actual token) │
|
|
219
|
+
└────────────────────┘ └────────────────────┘
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Auto Mode Integration
|
|
225
|
+
|
|
226
|
+
When running in `/sw:auto` mode, this skill is MANDATORY:
|
|
227
|
+
|
|
228
|
+
1. **All agents MUST check credentials before any deployment task**
|
|
229
|
+
2. **No manual "Next Steps" ever in auto mode**
|
|
230
|
+
3. **If credentials missing, auto mode PAUSES and asks user** (human gate)
|
|
231
|
+
4. **After user provides credentials, save to .env and CONTINUE**
|
|
232
|
+
|
|
233
|
+
### Auto Mode Credential Prompt Pattern
|
|
234
|
+
|
|
235
|
+
```markdown
|
|
236
|
+
🔐 **Credential Required for Auto-Execution**
|
|
237
|
+
|
|
238
|
+
I need your Supabase Service Role Key to execute the schema migration.
|
|
239
|
+
|
|
240
|
+
**How to get it:**
|
|
241
|
+
1. Go to: https://supabase.com/dashboard/project/YOUR_PROJECT/settings/api
|
|
242
|
+
2. Copy the "service_role" key (NOT the anon key)
|
|
243
|
+
|
|
244
|
+
**Please paste your Supabase Service Role Key:**
|
|
245
|
+
[I will save it to .env and continue execution automatically]
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Key difference from manual mode:**
|
|
249
|
+
- After user provides credential, AUTO-SAVE and CONTINUE
|
|
250
|
+
- NEVER say "now run these commands manually"
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Common Platform Credential Mappings
|
|
255
|
+
|
|
256
|
+
| Platform | Credential Variable | Check Command |
|
|
257
|
+
|----------|-------------------|---------------|
|
|
258
|
+
| **Supabase** | `SUPABASE_URL`, `SUPABASE_ANON_KEY`, `SUPABASE_SERVICE_ROLE_KEY` | `supabase status` |
|
|
259
|
+
| **Cloudflare Wrangler** | `CF_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID` | `wrangler whoami` |
|
|
260
|
+
| **Vercel** | `VERCEL_TOKEN` | `vercel whoami` |
|
|
261
|
+
| **Netlify** | `NETLIFY_AUTH_TOKEN` | `netlify status` |
|
|
262
|
+
| **Railway** | `RAILWAY_TOKEN` | `railway status` |
|
|
263
|
+
| **Render** | `RENDER_API_KEY` | - |
|
|
264
|
+
| **AWS** | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` | `aws sts get-caller-identity` |
|
|
265
|
+
| **GCP** | `GOOGLE_APPLICATION_CREDENTIALS` | `gcloud auth list` |
|
|
266
|
+
| **Azure** | `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID` | `az account show` |
|
|
267
|
+
| **GitHub** | `GITHUB_TOKEN`, `GH_TOKEN` | `gh auth status` |
|
|
268
|
+
| **NPM** | `NPM_TOKEN` | `npm whoami` |
|
|
269
|
+
| **Docker Hub** | `DOCKER_USERNAME`, `DOCKER_PASSWORD` | `docker login` |
|
|
270
|
+
| **Terraform Cloud** | `TF_TOKEN_app_terraform_io` | - |
|
|
271
|
+
| **Hetzner** | `HETZNER_API_TOKEN` | - |
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Forbidden Patterns (NEVER DO THESE)
|
|
276
|
+
|
|
277
|
+
### Pattern 1: Manual SQL Editor Instructions
|
|
278
|
+
```
|
|
279
|
+
❌ FORBIDDEN:
|
|
280
|
+
"Next Steps:
|
|
281
|
+
1. Run the schema SQL in Supabase SQL Editor (file: src/db/supabase-schema.sql)"
|
|
282
|
+
|
|
283
|
+
✅ CORRECT:
|
|
284
|
+
# Check for credentials
|
|
285
|
+
if [ -n "$DATABASE_URL" ] || [ -n "$SUPABASE_SERVICE_ROLE_KEY" ]; then
|
|
286
|
+
# Execute directly
|
|
287
|
+
supabase db push --db-url "$DATABASE_URL"
|
|
288
|
+
else
|
|
289
|
+
# Ask for credentials (don't show manual steps)
|
|
290
|
+
echo "🔐 I need your Supabase database URL to execute the migration..."
|
|
291
|
+
fi
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Pattern 2: Manual Secret Setting
|
|
295
|
+
```
|
|
296
|
+
❌ FORBIDDEN:
|
|
297
|
+
"Set the secret via: wrangler secret put SUPABASE_SECRET_KEY"
|
|
298
|
+
|
|
299
|
+
✅ CORRECT:
|
|
300
|
+
if [ -n "$SUPABASE_SECRET_KEY" ]; then
|
|
301
|
+
echo "$SUPABASE_SECRET_KEY" | wrangler secret put SUPABASE_SECRET_KEY --quiet
|
|
302
|
+
else
|
|
303
|
+
echo "🔐 I need your SUPABASE_SECRET_KEY to configure Wrangler..."
|
|
304
|
+
fi
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Pattern 3: Manual Deploy Commands
|
|
308
|
+
```
|
|
309
|
+
❌ FORBIDDEN:
|
|
310
|
+
"Deploy with: wrangler deploy"
|
|
311
|
+
|
|
312
|
+
✅ CORRECT:
|
|
313
|
+
wrangler deploy
|
|
314
|
+
# Just do it. The credentials are already configured.
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Pattern 4: Conditional Manual Fallback
|
|
318
|
+
```
|
|
319
|
+
❌ FORBIDDEN:
|
|
320
|
+
"If the above command fails, try running manually..."
|
|
321
|
+
|
|
322
|
+
✅ CORRECT:
|
|
323
|
+
# Handle errors programmatically, retry, or ask for different credentials
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Integration with Existing Agents
|
|
329
|
+
|
|
330
|
+
### DevOps Agent Integration
|
|
331
|
+
|
|
332
|
+
The DevOps agent MUST follow this skill when:
|
|
333
|
+
- Generating IaC and deploying
|
|
334
|
+
- Setting up CI/CD
|
|
335
|
+
- Configuring cloud services
|
|
336
|
+
|
|
337
|
+
### Infrastructure Agent Integration
|
|
338
|
+
|
|
339
|
+
The Infrastructure agent MUST follow this skill when:
|
|
340
|
+
- Deploying Terraform configurations
|
|
341
|
+
- Setting up cloud resources
|
|
342
|
+
- Configuring secrets in cloud providers
|
|
343
|
+
|
|
344
|
+
### All Agents General Rule
|
|
345
|
+
|
|
346
|
+
**Every agent that outputs "Next Steps" or deployment instructions MUST:**
|
|
347
|
+
|
|
348
|
+
1. Check for existing credentials FIRST
|
|
349
|
+
2. If found → EXECUTE immediately
|
|
350
|
+
3. If not found → ASK for credentials (not manual steps)
|
|
351
|
+
4. After receiving credentials → SAVE to .env AND EXECUTE
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Success Metrics
|
|
356
|
+
|
|
357
|
+
- **Zero manual "Next Steps"** when credentials are available
|
|
358
|
+
- **100% auto-execution** in auto mode for supported platforms
|
|
359
|
+
- **Credential save rate**: 100% of provided credentials saved to .env
|
|
360
|
+
- **Continuation rate**: 100% auto-continue after credential provided
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Related Files
|
|
365
|
+
|
|
366
|
+
- `.env` - Primary credential storage
|
|
367
|
+
- `.env.example` - Template for team (commit this)
|
|
368
|
+
- `.specweave/config.json` - Service configurations
|
|
369
|
+
- `wrangler.toml` - Cloudflare configuration
|
|
370
|
+
|
|
371
|
+
## Related ADRs
|
|
372
|
+
|
|
373
|
+
- ADR-0177: Autonomous Mode Safety
|
|
374
|
+
- ADR-0178: Stop Hook-Based Auto Architecture
|
|
@@ -76,6 +76,115 @@ Before you finish ANY response, mentally verify:
|
|
|
76
76
|
|
|
77
77
|
---
|
|
78
78
|
|
|
79
|
+
## 🚨🔐 CRITICAL: AUTO-EXECUTE WITH CREDENTIALS (MANDATORY) 🔐🚨
|
|
80
|
+
|
|
81
|
+
**NEVER OUTPUT MANUAL "NEXT STEPS" WHEN CREDENTIALS ARE AVAILABLE!**
|
|
82
|
+
|
|
83
|
+
### The Golden Rule
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
❌ FORBIDDEN: "Next Steps: Run wrangler deploy"
|
|
87
|
+
❌ FORBIDDEN: "Set the secret via: wrangler secret put..."
|
|
88
|
+
❌ FORBIDDEN: "Deploy with: terraform apply"
|
|
89
|
+
|
|
90
|
+
✅ REQUIRED: Execute commands DIRECTLY using available credentials
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Mandatory Credential Lookup (ALWAYS DO THIS FIRST)
|
|
94
|
+
|
|
95
|
+
**Before ANY deployment task, check for credentials in this order:**
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# 1. Check .env file (primary)
|
|
99
|
+
grep -E "SUPABASE|CF_|CLOUDFLARE|WRANGLER|AWS_|HETZNER|VERCEL|RAILWAY" .env 2>/dev/null
|
|
100
|
+
|
|
101
|
+
# 2. Check environment variables
|
|
102
|
+
env | grep -E "SUPABASE|CF_|AWS_|DATABASE_URL" 2>/dev/null
|
|
103
|
+
|
|
104
|
+
# 3. Check tool authentication status
|
|
105
|
+
wrangler whoami 2>/dev/null
|
|
106
|
+
aws sts get-caller-identity 2>/dev/null
|
|
107
|
+
gh auth status 2>/dev/null
|
|
108
|
+
supabase status 2>/dev/null
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Auto-Execute Decision Tree
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Task requires deployment/secrets?
|
|
115
|
+
│
|
|
116
|
+
▼
|
|
117
|
+
Search for credentials (.env, env vars, CLI auth)
|
|
118
|
+
│
|
|
119
|
+
┌───────┴───────┐
|
|
120
|
+
│ │
|
|
121
|
+
▼ ▼
|
|
122
|
+
FOUND NOT FOUND
|
|
123
|
+
│ │
|
|
124
|
+
▼ ▼
|
|
125
|
+
EXECUTE ASK for credential
|
|
126
|
+
COMMAND (NOT manual steps)
|
|
127
|
+
DIRECTLY
|
|
128
|
+
│ │
|
|
129
|
+
▼ ▼
|
|
130
|
+
"Deployed "🔐 I need your CF_API_TOKEN
|
|
131
|
+
successfully" to deploy. Please paste it:"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Platform-Specific Auto-Execution
|
|
135
|
+
|
|
136
|
+
**Cloudflare Wrangler:**
|
|
137
|
+
```bash
|
|
138
|
+
# If CF_API_TOKEN or wrangler authenticated:
|
|
139
|
+
wrangler secret put SECRET_NAME <<< "$SECRET_VALUE"
|
|
140
|
+
wrangler deploy
|
|
141
|
+
# NEVER say "run wrangler deploy manually"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Supabase:**
|
|
145
|
+
```bash
|
|
146
|
+
# If DATABASE_URL or SUPABASE_* credentials exist:
|
|
147
|
+
supabase db push --db-url "$DATABASE_URL"
|
|
148
|
+
psql "$DATABASE_URL" -f schema.sql
|
|
149
|
+
# NEVER say "run in Supabase SQL Editor"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Terraform:**
|
|
153
|
+
```bash
|
|
154
|
+
# If cloud provider credentials exist:
|
|
155
|
+
terraform init && terraform apply -auto-approve
|
|
156
|
+
# NEVER say "type 'yes' to confirm"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**AWS CLI:**
|
|
160
|
+
```bash
|
|
161
|
+
# If AWS credentials configured:
|
|
162
|
+
aws lambda update-function-code --function-name X --zip-file fileb://code.zip
|
|
163
|
+
# NEVER say "run aws command manually"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### What To Do When Credentials Missing
|
|
167
|
+
|
|
168
|
+
```markdown
|
|
169
|
+
🔐 **Credential Required for Auto-Execution**
|
|
170
|
+
|
|
171
|
+
I need your Cloudflare API token to deploy automatically.
|
|
172
|
+
|
|
173
|
+
**How to get it:**
|
|
174
|
+
1. Go to: https://dash.cloudflare.com/profile/api-tokens
|
|
175
|
+
2. Create token with "Edit Workers" permissions
|
|
176
|
+
|
|
177
|
+
**Please paste your CF_API_TOKEN:**
|
|
178
|
+
[I will save it to .env and deploy automatically]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**After user provides credential:**
|
|
182
|
+
1. Save to `.env`
|
|
183
|
+
2. EXECUTE the command immediately
|
|
184
|
+
3. NEVER show "now run these commands manually"
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
79
188
|
**When to Use**:
|
|
80
189
|
- You need to design and implement cloud infrastructure (AWS, Azure, GCP)
|
|
81
190
|
- You want to create Infrastructure as Code with Terraform or CloudFormation
|