sequant 1.0.0

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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +237 -0
  3. package/dist/bin/cli.d.ts +8 -0
  4. package/dist/bin/cli.d.ts.map +1 -0
  5. package/dist/bin/cli.js +70 -0
  6. package/dist/bin/cli.js.map +1 -0
  7. package/dist/src/commands/doctor.d.ts +8 -0
  8. package/dist/src/commands/doctor.d.ts.map +1 -0
  9. package/dist/src/commands/doctor.js +171 -0
  10. package/dist/src/commands/doctor.js.map +1 -0
  11. package/dist/src/commands/init.d.ts +11 -0
  12. package/dist/src/commands/init.d.ts.map +1 -0
  13. package/dist/src/commands/init.js +124 -0
  14. package/dist/src/commands/init.js.map +1 -0
  15. package/dist/src/commands/run.d.ts +18 -0
  16. package/dist/src/commands/run.d.ts.map +1 -0
  17. package/dist/src/commands/run.js +229 -0
  18. package/dist/src/commands/run.js.map +1 -0
  19. package/dist/src/commands/status.d.ts +5 -0
  20. package/dist/src/commands/status.d.ts.map +1 -0
  21. package/dist/src/commands/status.js +45 -0
  22. package/dist/src/commands/status.js.map +1 -0
  23. package/dist/src/commands/update.d.ts +10 -0
  24. package/dist/src/commands/update.d.ts.map +1 -0
  25. package/dist/src/commands/update.js +124 -0
  26. package/dist/src/commands/update.js.map +1 -0
  27. package/dist/src/index.d.ts +15 -0
  28. package/dist/src/index.d.ts.map +1 -0
  29. package/dist/src/index.js +13 -0
  30. package/dist/src/index.js.map +1 -0
  31. package/dist/src/lib/fs.d.ts +10 -0
  32. package/dist/src/lib/fs.d.ts.map +1 -0
  33. package/dist/src/lib/fs.js +44 -0
  34. package/dist/src/lib/fs.js.map +1 -0
  35. package/dist/src/lib/manifest.d.ts +14 -0
  36. package/dist/src/lib/manifest.d.ts.map +1 -0
  37. package/dist/src/lib/manifest.js +37 -0
  38. package/dist/src/lib/manifest.js.map +1 -0
  39. package/dist/src/lib/stacks.d.ts +22 -0
  40. package/dist/src/lib/stacks.d.ts.map +1 -0
  41. package/dist/src/lib/stacks.js +131 -0
  42. package/dist/src/lib/stacks.js.map +1 -0
  43. package/dist/src/lib/templates.d.ts +16 -0
  44. package/dist/src/lib/templates.d.ts.map +1 -0
  45. package/dist/src/lib/templates.js +118 -0
  46. package/dist/src/lib/templates.js.map +1 -0
  47. package/dist/src/lib/workflow/cli-args.d.ts +138 -0
  48. package/dist/src/lib/workflow/cli-args.d.ts.map +1 -0
  49. package/dist/src/lib/workflow/cli-args.js +210 -0
  50. package/dist/src/lib/workflow/cli-args.js.map +1 -0
  51. package/dist/src/lib/workflow/execute-issues.d.ts +42 -0
  52. package/dist/src/lib/workflow/execute-issues.d.ts.map +1 -0
  53. package/dist/src/lib/workflow/execute-issues.js +463 -0
  54. package/dist/src/lib/workflow/execute-issues.js.map +1 -0
  55. package/dist/src/lib/workflow/logger.d.ts +168 -0
  56. package/dist/src/lib/workflow/logger.d.ts.map +1 -0
  57. package/dist/src/lib/workflow/logger.js +249 -0
  58. package/dist/src/lib/workflow/logger.js.map +1 -0
  59. package/dist/src/lib/workflow/types.d.ts +89 -0
  60. package/dist/src/lib/workflow/types.d.ts.map +1 -0
  61. package/dist/src/lib/workflow/types.js +23 -0
  62. package/dist/src/lib/workflow/types.js.map +1 -0
  63. package/package.json +69 -0
  64. package/stacks/go.yaml +22 -0
  65. package/stacks/nextjs.yaml +28 -0
  66. package/stacks/python.yaml +24 -0
  67. package/stacks/rust.yaml +23 -0
  68. package/templates/hooks/post-tool.sh +301 -0
  69. package/templates/hooks/pre-tool.sh +350 -0
  70. package/templates/memory/constitution.md +60 -0
  71. package/templates/scripts/cleanup-worktree.sh +78 -0
  72. package/templates/scripts/list-worktrees.sh +50 -0
  73. package/templates/scripts/new-feature.sh +156 -0
  74. package/templates/settings.json +26 -0
  75. package/templates/skills/assess/SKILL.md +428 -0
  76. package/templates/skills/clean/SKILL.md +196 -0
  77. package/templates/skills/docs/SKILL.md +323 -0
  78. package/templates/skills/exec/SKILL.md +426 -0
  79. package/templates/skills/fullsolve/SKILL.md +479 -0
  80. package/templates/skills/loop/SKILL.md +310 -0
  81. package/templates/skills/qa/SKILL.md +261 -0
  82. package/templates/skills/qa/references/code-quality-exemplars.md +112 -0
  83. package/templates/skills/qa/references/code-review-checklist.md +77 -0
  84. package/templates/skills/qa/references/quality-gates.md +95 -0
  85. package/templates/skills/qa/references/testing-requirements.md +109 -0
  86. package/templates/skills/qa/scripts/quality-checks.sh +109 -0
  87. package/templates/skills/reflect/SKILL.md +159 -0
  88. package/templates/skills/reflect/references/documentation-tiers.md +70 -0
  89. package/templates/skills/reflect/references/phase-reflection.md +95 -0
  90. package/templates/skills/reflect/scripts/workflow-queries.ts +165 -0
  91. package/templates/skills/security-review/SKILL.md +344 -0
  92. package/templates/skills/security-review/references/security-checklists.md +377 -0
  93. package/templates/skills/solve/SKILL.md +242 -0
  94. package/templates/skills/spec/SKILL.md +169 -0
  95. package/templates/skills/spec/references/parallel-groups.md +72 -0
  96. package/templates/skills/spec/references/verification-criteria.md +104 -0
  97. package/templates/skills/test/SKILL.md +508 -0
  98. package/templates/skills/testgen/SKILL.md +561 -0
  99. package/templates/skills/verify/SKILL.md +266 -0
@@ -0,0 +1,377 @@
1
+ # Security Checklists Reference
2
+
3
+ Detailed checklists for each security domain, used by the `/security-review` skill.
4
+
5
+ ## Authentication Checklist (AUTH)
6
+
7
+ ### AUTH-1: Password Hashing
8
+ **Requirement:** Passwords must use bcrypt/argon2 with appropriate cost factor.
9
+
10
+ **How to Verify:**
11
+ ```bash
12
+ grep -r "bcrypt\|argon2\|hashPassword" lib/ app/
13
+ ```
14
+
15
+ **Good:**
16
+ ```typescript
17
+ import bcrypt from 'bcryptjs'
18
+ const hash = await bcrypt.hash(password, 12)
19
+ ```
20
+
21
+ **Bad:**
22
+ ```typescript
23
+ const hash = crypto.createHash('sha256').update(password).digest('hex')
24
+ ```
25
+
26
+ ### AUTH-2: Session Token Randomness
27
+ **Requirement:** Session tokens must be cryptographically random.
28
+
29
+ **How to Verify:**
30
+ ```bash
31
+ grep -r "crypto.randomBytes\|uuid\|nanoid" lib/auth/
32
+ ```
33
+
34
+ **Good:**
35
+ ```typescript
36
+ const token = crypto.randomBytes(32).toString('hex')
37
+ ```
38
+
39
+ **Bad:**
40
+ ```typescript
41
+ const token = Date.now().toString(36)
42
+ ```
43
+
44
+ ### AUTH-3: Session Expiration
45
+ **Requirement:** Sessions must expire within appropriate timeframe.
46
+
47
+ **How to Verify:**
48
+ ```bash
49
+ grep -r "maxAge\|expires\|TTL" lib/auth/ app/api/auth/
50
+ ```
51
+
52
+ **Good:** 15-60 minutes for sensitive, 1-7 days for general.
53
+
54
+ **Bad:** No expiration or "remember me" without user consent.
55
+
56
+ ### AUTH-4: Logout Invalidation
57
+ **Requirement:** Logout must invalidate session server-side.
58
+
59
+ **How to Verify:**
60
+ - Check logout handler deletes session from store
61
+ - Verify token is invalidated, not just cleared from client
62
+
63
+ ### AUTH-5: Password Reset Tokens
64
+ **Requirement:** Reset tokens must be single-use and time-limited.
65
+
66
+ **How to Verify:**
67
+ ```bash
68
+ grep -r "resetToken\|passwordReset" lib/ app/
69
+ ```
70
+
71
+ **Good:** Token expires in 1 hour, deleted after use.
72
+
73
+ **Bad:** Token reusable, no expiration.
74
+
75
+ ### AUTH-6: Login Rate Limiting
76
+ **Requirement:** Failed login attempts must be rate-limited.
77
+
78
+ **How to Verify:**
79
+ ```bash
80
+ grep -r "rateLimit\|loginAttempts\|throttle" lib/ app/api/auth/
81
+ ```
82
+
83
+ **Good:** 5 attempts per 15 minutes.
84
+
85
+ ### AUTH-7: Timing Attack Prevention
86
+ **Requirement:** Password comparison must be constant-time.
87
+
88
+ **How to Verify:**
89
+ ```bash
90
+ grep -r "timingSafeEqual\|bcrypt.compare" lib/auth/
91
+ ```
92
+
93
+ **Good:**
94
+ ```typescript
95
+ await bcrypt.compare(input, hash) // bcrypt is constant-time
96
+ ```
97
+
98
+ **Bad:**
99
+ ```typescript
100
+ if (input === password) // Direct comparison leaks timing info
101
+ ```
102
+
103
+ ### AUTH-8: MFA Implementation
104
+ **Requirement:** If MFA is implemented, it must be properly enforced.
105
+
106
+ **How to Verify:**
107
+ - Check MFA cannot be bypassed
108
+ - Verify backup codes are single-use
109
+ - Confirm TOTP secrets are stored securely
110
+
111
+ ---
112
+
113
+ ## Authorization Checklist (AUTHZ)
114
+
115
+ ### AUTHZ-1: Authentication on All Endpoints
116
+ **Requirement:** Every sensitive endpoint must check authentication.
117
+
118
+ **How to Verify:**
119
+ ```bash
120
+ grep -r "requireAuth\|getServerSession\|authenticate" app/api/ app/admin/
121
+ ```
122
+
123
+ **Good:** Middleware checks auth before route handler.
124
+
125
+ **Bad:** Route handler assumes auth without checking.
126
+
127
+ ### AUTHZ-2: RBAC Enforcement
128
+ **Requirement:** Role checks must happen before privileged actions.
129
+
130
+ **How to Verify:**
131
+ ```bash
132
+ grep -r "role\|isAdmin\|hasPermission" lib/ app/
133
+ ```
134
+
135
+ **Good:**
136
+ ```typescript
137
+ if (user.role !== 'admin') throw new ForbiddenError()
138
+ ```
139
+
140
+ **Bad:**
141
+ ```typescript
142
+ // Role stored in frontend, not verified server-side
143
+ ```
144
+
145
+ ### AUTHZ-3: IDOR Prevention
146
+ **Requirement:** Object access must verify user owns/can access the object.
147
+
148
+ **How to Verify:**
149
+ - Check queries filter by user_id or org_id
150
+ - Verify route params can't access other users' data
151
+
152
+ **Bad:**
153
+ ```typescript
154
+ const shop = await db.shops.findUnique({ where: { id: shopId } })
155
+ // Missing: .eq('owner_id', user.id)
156
+ ```
157
+
158
+ ### AUTHZ-4: Horizontal Privilege Escalation
159
+ **Requirement:** Users cannot access other users' resources at same privilege level.
160
+
161
+ **How to Verify:**
162
+ - Review list queries for proper scoping
163
+ - Check bulk operations filter by user
164
+
165
+ ### AUTHZ-5: Vertical Privilege Escalation
166
+ **Requirement:** Lower-privilege users cannot perform admin actions.
167
+
168
+ **How to Verify:**
169
+ - Check admin routes have role verification
170
+ - Verify form submissions validate permissions
171
+
172
+ ### AUTHZ-6: Audit Logging
173
+ **Requirement:** Admin actions must be logged for audit.
174
+
175
+ **How to Verify:**
176
+ ```bash
177
+ grep -r "audit\|logAction\|shop_enrichment_log" lib/ app/admin/
178
+ ```
179
+
180
+ **Good:**
181
+ ```typescript
182
+ await logAuditEvent({ action: 'approve_shop', actor: userId, target: shopId })
183
+ ```
184
+
185
+ ---
186
+
187
+ ## API Security Checklist (API)
188
+
189
+ ### API-1: Input Validation
190
+ **Requirement:** All inputs must be validated with schemas.
191
+
192
+ **How to Verify:**
193
+ ```bash
194
+ grep -r "z\.\|zod\|yup\|joi" lib/validations/ app/api/
195
+ ```
196
+
197
+ **Good:**
198
+ ```typescript
199
+ const schema = z.object({ name: z.string().min(1).max(100) })
200
+ ```
201
+
202
+ **Bad:**
203
+ ```typescript
204
+ const { name } = req.body // No validation
205
+ ```
206
+
207
+ ### API-2: XSS Prevention
208
+ **Requirement:** Output must be properly encoded.
209
+
210
+ **How to Verify:**
211
+ - React/Next.js auto-escapes by default
212
+ - Check for `dangerouslySetInnerHTML` usage
213
+ - Verify markdown rendering is sanitized
214
+
215
+ ### API-3: SQL Injection Prevention
216
+ **Requirement:** Queries must use parameterized statements.
217
+
218
+ **How to Verify:**
219
+ ```bash
220
+ grep -r "\.from\(" lib/ app/ | grep -v "supabase"
221
+ grep -r "raw\|execute\|query" lib/ app/
222
+ ```
223
+
224
+ **Good:**
225
+ ```typescript
226
+ supabase.from('shops').select('*').eq('id', shopId)
227
+ ```
228
+
229
+ **Bad:**
230
+ ```typescript
231
+ db.query(`SELECT * FROM shops WHERE id = ${shopId}`)
232
+ ```
233
+
234
+ ### API-4: Rate Limiting
235
+ **Requirement:** Public endpoints must be rate-limited.
236
+
237
+ **How to Verify:**
238
+ ```bash
239
+ grep -r "rateLimit\|Ratelimit" middleware/ lib/
240
+ ```
241
+
242
+ ### API-5: CORS Configuration
243
+ **Requirement:** CORS must be properly configured.
244
+
245
+ **How to Verify:**
246
+ ```bash
247
+ grep -r "cors\|Access-Control" next.config.js middleware/
248
+ ```
249
+
250
+ **Good:** Specific origins allowed.
251
+
252
+ **Bad:** `Access-Control-Allow-Origin: *` for authenticated endpoints.
253
+
254
+ ### API-6: Error Message Safety
255
+ **Requirement:** Error messages must not leak sensitive info.
256
+
257
+ **How to Verify:**
258
+ - Check error responses in production mode
259
+ - Verify stack traces not exposed
260
+
261
+ **Good:**
262
+ ```typescript
263
+ return { error: 'Authentication failed' }
264
+ ```
265
+
266
+ **Bad:**
267
+ ```typescript
268
+ return { error: err.message, stack: err.stack }
269
+ ```
270
+
271
+ ### API-7: File Upload Validation
272
+ **Requirement:** Uploads must validate type, size, and name.
273
+
274
+ **How to Verify:**
275
+ ```bash
276
+ grep -r "upload\|multipart\|formData" app/api/ lib/
277
+ ```
278
+
279
+ **Good:**
280
+ ```typescript
281
+ if (!['image/jpeg', 'image/png'].includes(file.type)) throw Error
282
+ if (file.size > 5 * 1024 * 1024) throw Error
283
+ ```
284
+
285
+ ---
286
+
287
+ ## Data Protection Checklist (DATA)
288
+
289
+ ### DATA-1: Encryption at Rest
290
+ **Requirement:** Sensitive data must be encrypted in database.
291
+
292
+ **How to Verify:**
293
+ - Supabase uses encryption by default
294
+ - Check for additional encryption on highly sensitive fields
295
+
296
+ ### DATA-2: Encryption in Transit
297
+ **Requirement:** All communications must use HTTPS.
298
+
299
+ **How to Verify:**
300
+ - Vercel enforces HTTPS automatically
301
+ - Check for HTTP references in code
302
+
303
+ ### DATA-3: PII Handling
304
+ **Requirement:** PII must be handled per privacy policy.
305
+
306
+ **How to Verify:**
307
+ - Check what user data is collected
308
+ - Verify data retention policies
309
+ - Confirm deletion procedures
310
+
311
+ ### DATA-4: Log Safety
312
+ **Requirement:** Logs must not contain sensitive data.
313
+
314
+ **How to Verify:**
315
+ ```bash
316
+ grep -r "console.log\|logger" lib/ app/ | head -20
317
+ ```
318
+
319
+ **Bad:**
320
+ ```typescript
321
+ console.log('User login:', { email, password })
322
+ ```
323
+
324
+ ### DATA-5: Query Authorization
325
+ **Requirement:** Queries must respect user permissions.
326
+
327
+ **How to Verify:**
328
+ - Check RLS policies exist for tables
329
+ - Verify public client can't read unauthorized data
330
+
331
+ ---
332
+
333
+ ## Infrastructure Checklist (INFRA)
334
+
335
+ ### INFRA-1: Environment Variable Protection
336
+ **Requirement:** Secrets must be in env vars, not code.
337
+
338
+ **How to Verify:**
339
+ ```bash
340
+ grep -r "process.env" lib/ app/ | head -10
341
+ ```
342
+
343
+ **Good:** API keys in `.env.local`, read via `process.env`.
344
+
345
+ **Bad:** API key hardcoded in source file.
346
+
347
+ ### INFRA-2: No Hardcoded Secrets
348
+ **Requirement:** No secrets committed to repository.
349
+
350
+ **How to Verify:**
351
+ ```bash
352
+ grep -ri "password\|secret\|apikey\|api_key" --include="*.ts" --include="*.tsx" . | grep -v "process.env"
353
+ ```
354
+
355
+ ### INFRA-3: Dependencies Up to Date
356
+ **Requirement:** No known vulnerable dependencies.
357
+
358
+ **How to Verify:**
359
+ ```bash
360
+ npm audit
361
+ ```
362
+
363
+ ### INFRA-4: CSP Headers
364
+ **Requirement:** Content Security Policy should be configured.
365
+
366
+ **How to Verify:**
367
+ ```bash
368
+ grep -r "Content-Security-Policy\|CSP" next.config.js middleware/
369
+ ```
370
+
371
+ ### INFRA-5: Security Headers
372
+ **Requirement:** Standard security headers must be set.
373
+
374
+ **How to Verify:**
375
+ - X-Frame-Options: DENY
376
+ - X-Content-Type-Options: nosniff
377
+ - Strict-Transport-Security: max-age=...
@@ -0,0 +1,242 @@
1
+ ---
2
+ name: solve
3
+ description: "Generate the proper execute-issues.ts command for one or more GitHub issues"
4
+ license: MIT
5
+ metadata:
6
+ author: sequant
7
+ version: "1.0"
8
+ allowed-tools:
9
+ - Bash(gh issue view:*)
10
+ ---
11
+
12
+ # Solve Command Generator
13
+
14
+ You are the "Solve Command Generator" for the current repository.
15
+
16
+ ## Purpose
17
+
18
+ When invoked as `/solve <issue-numbers>`, your job is to:
19
+
20
+ 1. Analyze the provided issue number(s)
21
+ 2. Check if they require UI testing (based on labels: admin, ui, frontend)
22
+ 3. Generate the optimal `npx tsx scripts/dev/execute-issues.ts` command
23
+ 4. Display the command in a copy-paste ready format
24
+
25
+ ## Behavior
26
+
27
+ ### Invocation Formats
28
+
29
+ - `/solve 152` - Single issue
30
+ - `/solve 152 153 154` - Multiple issues (parallel execution)
31
+ - `/solve --batch "152 153" "154 155"` - Sequential batches
32
+
33
+ ### Detection Logic
34
+
35
+ For each issue, check GitHub labels to determine if `/test` phase is needed:
36
+
37
+ ```bash
38
+ gh issue view <issue-number> --json labels --jq '.labels[].name'
39
+ ```
40
+
41
+ **UI Testing Required** if labels include:
42
+ - `admin`
43
+ - `ui`
44
+ - `frontend`
45
+
46
+ **Backend Issues** (no UI testing):
47
+ - All other labels
48
+
49
+ ### Command Generation
50
+
51
+ **Single Issue:**
52
+ ```bash
53
+ # UI issue (has admin/ui/frontend label)
54
+ PHASES=spec,exec,test,qa npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 152
55
+
56
+ # Backend issue (no UI label)
57
+ npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 152
58
+ ```
59
+
60
+ **Multiple Issues (Parallel):**
61
+ ```bash
62
+ # All backend issues
63
+ npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 152 153 154
64
+
65
+ # Mixed (some UI, some backend)
66
+ PHASES=spec,exec,test,qa npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 152 153 154
67
+
68
+ # Note: PHASES env var applies to ALL issues
69
+ # If ANY issue needs /test, add it for all
70
+ ```
71
+
72
+ **Sequential Batches (Dependency-Aware):**
73
+ ```bash
74
+ # Run issues sequentially (respects dependencies)
75
+ npx tsx --env-file=.env.local scripts/dev/execute-issues.ts --sequential 152 153 154
76
+
77
+ # Run batch 1, then batch 2
78
+ npx tsx --env-file=.env.local scripts/dev/execute-issues.ts --batch "152 153" --batch "154 155"
79
+
80
+ # With custom phases
81
+ PHASES=spec,exec,test,qa npx tsx --env-file=.env.local scripts/dev/execute-issues.ts --batch "152 153" --batch "154 155"
82
+ ```
83
+
84
+ ## Output Format
85
+
86
+ Provide a clear, actionable response with:
87
+
88
+ 1. **Issue Summary Table** showing:
89
+ - Issue number
90
+ - Title
91
+ - Labels
92
+ - Needs /test? (Yes/No)
93
+
94
+ 2. **Recommended Command** in a code block for easy copying
95
+
96
+ 3. **Explanation** of why this command was chosen
97
+
98
+ ### Example Output
99
+
100
+ ```markdown
101
+ ## Solve Command for Issues: 152, 153, 154
102
+
103
+ ### Issue Analysis
104
+
105
+ | Issue | Title | Labels | Needs /test? |
106
+ |-------|-------|--------|--------------|
107
+ | #152 | Admin Review Queue: Bulk Edit v2 | admin, enhancement | Yes |
108
+ | #153 | Automated content discovery | backend, enhancement | No |
109
+ | #154 | City onboarding UI | admin, ui | Yes |
110
+
111
+ ### Recommended Command
112
+
113
+ Since issues #152 and #154 require UI testing, we'll add the `/test` phase for all issues:
114
+
115
+ \`\`\`bash
116
+ PHASES=spec,exec,test,qa npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 152 153 154
117
+ \`\`\`
118
+
119
+ ### Explanation
120
+
121
+ - **Parallel execution**: All 3 issues run simultaneously
122
+ - **Custom phases**: `spec,exec,test,qa` includes browser testing
123
+ - **Logs**: Check `/tmp/claude-issue-{152,153,154}.log` for progress
124
+
125
+ ### Quality Loop Option
126
+
127
+ For automatic fix iterations until quality gates pass:
128
+
129
+ \`\`\`bash
130
+ QUALITY_LOOP=true PHASES=spec,exec,test,qa npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 152 153 154
131
+ \`\`\`
132
+
133
+ This auto-includes `/testgen` for shift-left testing and runs `/loop` after test/QA failures (max 3 iterations per phase).
134
+
135
+ ### Speed Option
136
+
137
+ For faster batch execution without smart tests (disable auto-regression detection):
138
+
139
+ \`\`\`bash
140
+ npx tsx --env-file=.env.local scripts/dev/execute-issues.ts --no-smart-tests 152 153 154
141
+ \`\`\`
142
+
143
+ ### Alternative: Sequential Batches
144
+
145
+ If you want backend issues to run first (faster, no UI testing overhead):
146
+
147
+ \`\`\`bash
148
+ # Batch 1: Backend issue (faster)
149
+ npx tsx --env-file=.env.local scripts/dev/execute-issues.ts --batch "153" --batch "152 154"
150
+ \`\`\`
151
+
152
+ Or run all in parallel without /test:
153
+
154
+ \`\`\`bash
155
+ npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 152 153 154
156
+ \`\`\`
157
+
158
+ **Note:** Skipping /test for admin/UI issues means you'll need to manually verify the UI works correctly.
159
+ ```
160
+
161
+ ## Implementation Steps
162
+
163
+ 1. **Parse input**: Extract issue numbers from command arguments
164
+ 2. **Fetch issue data**: Use `gh issue view <N> --json number,title,labels`
165
+ 3. **Analyze labels**: Check for admin/ui/frontend labels
166
+ 4. **Determine phases**:
167
+ - If ANY issue has UI label → use `PHASES=spec,exec,test,qa`
168
+ - If ALL issues are backend → use default phases (no PHASES env var)
169
+ 5. **Generate command**: Format based on number of issues and batch requirements
170
+ 6. **Display output**: Show issue table + recommended command + explanation
171
+
172
+ ## Edge Cases
173
+
174
+ ### All Backend Issues
175
+ ```bash
176
+ npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 145 146 147
177
+ ```
178
+ No `PHASES` env var needed - default is `spec,exec,qa`
179
+
180
+ ### All UI Issues
181
+ ```bash
182
+ PHASES=spec,exec,test,qa npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 152 154 156
183
+ ```
184
+
185
+ ### Mixed UI + Backend
186
+ **Recommendation**: Use `PHASES=spec,exec,test,qa` for consistency, but warn user:
187
+ > Note: Issue #153 is a backend issue and doesn't need `/test`, but we're including it for consistency. If you want to skip `/test` for #153, run it separately.
188
+
189
+ ### Sequential Batches Requested
190
+ User types: `/solve --batch "152 153" "154"`
191
+
192
+ Generate:
193
+ ```bash
194
+ npx tsx --env-file=.env.local scripts/dev/execute-issues.ts --batch "152 153" --batch "154"
195
+ ```
196
+
197
+ ## Quality Loop Recommendation
198
+
199
+ Always offer `QUALITY_LOOP=true` as an option in your output. Recommend it especially when:
200
+
201
+ 1. **Complex UI issues** - Multiple test cases, likely to have edge case failures
202
+ 2. **Issues with many ACs** - More acceptance criteria = more chances for partial implementation
203
+ 3. **New feature implementations** - First-time implementations may need iteration
204
+ 4. **User requests "best quality"** - Explicit quality preference
205
+
206
+ **When NOT to recommend quality loop:**
207
+ - Simple bug fixes with clear scope
208
+ - Documentation-only changes
209
+ - User explicitly wants quick execution
210
+
211
+ ## Smart Tests
212
+
213
+ Smart tests are **enabled by default** in execute-issues.ts. When enabled:
214
+
215
+ - Auto-runs related tests after each file edit during implementation
216
+ - Catches regressions immediately (5-10s overhead per edit)
217
+ - Results logged to `/tmp/claude-tests.log`
218
+
219
+ **When to disable:**
220
+ - Batch processing many issues (speed priority)
221
+ - Issues with long-running test suites
222
+ - Simple documentation changes
223
+
224
+ **View smart test results:**
225
+ ```bash
226
+ npx tsx scripts/dev/analyze-hook-logs.ts --tests
227
+ ```
228
+
229
+ ## Quick Reference
230
+
231
+ **Script Features:**
232
+ - Default phases: `spec,exec,qa`
233
+ - Auto-detect UI issues: Adds `/test` if issue has admin/ui/frontend label
234
+ - `PHASES` env var: Overrides auto-detection for ALL issues
235
+ - `QUALITY_LOOP=true`: Auto-fix test/QA failures, **auto-includes `/testgen` after `/spec`**
236
+ - `MAX_ITERATIONS`: Max fix attempts per phase (default: 3)
237
+ - **Smart tests: Enabled by default** - auto-runs related tests after file edits
238
+ - `--no-smart-tests`: Disable smart tests (faster but no auto-regression detection)
239
+ - Parallel execution: Multiple issues run simultaneously
240
+ - Batch mode: `--batch "N M"` runs batches sequentially
241
+ - `--env-file=.env.local`: **Required** for database logging (workflow analytics)
242
+ - Logs: `/tmp/claude-issue-<N>.log`, `/tmp/claude-tests.log` (smart test results)