sequant 1.16.1 → 1.18.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 (83) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +14 -2
  3. package/README.md +2 -0
  4. package/dist/bin/cli.js +2 -1
  5. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +21 -0
  6. package/dist/marketplace/external_plugins/sequant/README.md +38 -0
  7. package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +292 -0
  8. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +463 -0
  9. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/prompt-templates.md +350 -0
  10. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/subagent-types.md +131 -0
  11. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +474 -0
  12. package/dist/marketplace/external_plugins/sequant/skills/clean/SKILL.md +211 -0
  13. package/dist/marketplace/external_plugins/sequant/skills/docs/SKILL.md +337 -0
  14. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +807 -0
  15. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +678 -0
  16. package/dist/marketplace/external_plugins/sequant/skills/improve/SKILL.md +668 -0
  17. package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +374 -0
  18. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +570 -0
  19. package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-quality-exemplars.md +107 -0
  20. package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-review-checklist.md +65 -0
  21. package/dist/marketplace/external_plugins/sequant/skills/qa/references/quality-gates.md +179 -0
  22. package/dist/marketplace/external_plugins/sequant/skills/qa/references/semgrep-rules.md +207 -0
  23. package/dist/marketplace/external_plugins/sequant/skills/qa/references/testing-requirements.md +109 -0
  24. package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +622 -0
  25. package/dist/marketplace/external_plugins/sequant/skills/reflect/SKILL.md +175 -0
  26. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/documentation-tiers.md +70 -0
  27. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/phase-reflection.md +95 -0
  28. package/dist/marketplace/external_plugins/sequant/skills/security-review/SKILL.md +358 -0
  29. package/dist/marketplace/external_plugins/sequant/skills/security-review/references/security-checklists.md +432 -0
  30. package/dist/marketplace/external_plugins/sequant/skills/solve/SKILL.md +697 -0
  31. package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +754 -0
  32. package/dist/marketplace/external_plugins/sequant/skills/spec/references/parallel-groups.md +72 -0
  33. package/dist/marketplace/external_plugins/sequant/skills/spec/references/recommended-workflow.md +92 -0
  34. package/dist/marketplace/external_plugins/sequant/skills/spec/references/verification-criteria.md +104 -0
  35. package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +600 -0
  36. package/dist/marketplace/external_plugins/sequant/skills/testgen/SKILL.md +576 -0
  37. package/dist/marketplace/external_plugins/sequant/skills/verify/SKILL.md +281 -0
  38. package/dist/src/commands/run.d.ts +13 -274
  39. package/dist/src/commands/run.js +43 -1958
  40. package/dist/src/commands/sync.js +3 -0
  41. package/dist/src/commands/update.js +3 -0
  42. package/dist/src/lib/plugin-version-sync.d.ts +2 -1
  43. package/dist/src/lib/plugin-version-sync.js +28 -7
  44. package/dist/src/lib/solve-comment-parser.d.ts +26 -0
  45. package/dist/src/lib/solve-comment-parser.js +63 -7
  46. package/dist/src/lib/upstream/assessment.js +6 -3
  47. package/dist/src/lib/upstream/relevance.d.ts +5 -0
  48. package/dist/src/lib/upstream/relevance.js +24 -0
  49. package/dist/src/lib/upstream/report.js +18 -46
  50. package/dist/src/lib/upstream/types.d.ts +2 -0
  51. package/dist/src/lib/workflow/batch-executor.d.ts +117 -0
  52. package/dist/src/lib/workflow/batch-executor.js +574 -0
  53. package/dist/src/lib/workflow/phase-executor.d.ts +40 -0
  54. package/dist/src/lib/workflow/phase-executor.js +381 -0
  55. package/dist/src/lib/workflow/phase-mapper.d.ts +65 -0
  56. package/dist/src/lib/workflow/phase-mapper.js +147 -0
  57. package/dist/src/lib/workflow/pr-operations.d.ts +86 -0
  58. package/dist/src/lib/workflow/pr-operations.js +326 -0
  59. package/dist/src/lib/workflow/pr-status.d.ts +49 -0
  60. package/dist/src/lib/workflow/pr-status.js +131 -0
  61. package/dist/src/lib/workflow/run-reflect.d.ts +32 -0
  62. package/dist/src/lib/workflow/run-reflect.js +191 -0
  63. package/dist/src/lib/workflow/run-summary.d.ts +36 -0
  64. package/dist/src/lib/workflow/run-summary.js +142 -0
  65. package/dist/src/lib/workflow/state-cleanup.d.ts +79 -0
  66. package/dist/src/lib/workflow/state-cleanup.js +250 -0
  67. package/dist/src/lib/workflow/state-rebuild.d.ts +38 -0
  68. package/dist/src/lib/workflow/state-rebuild.js +140 -0
  69. package/dist/src/lib/workflow/state-utils.d.ts +14 -162
  70. package/dist/src/lib/workflow/state-utils.js +10 -677
  71. package/dist/src/lib/workflow/worktree-discovery.d.ts +61 -0
  72. package/dist/src/lib/workflow/worktree-discovery.js +229 -0
  73. package/dist/src/lib/workflow/worktree-manager.d.ts +205 -0
  74. package/dist/src/lib/workflow/worktree-manager.js +918 -0
  75. package/package.json +4 -2
  76. package/templates/skills/exec/SKILL.md +2 -2
  77. package/templates/skills/fullsolve/SKILL.md +15 -5
  78. package/templates/skills/loop/SKILL.md +1 -1
  79. package/templates/skills/qa/SKILL.md +47 -7
  80. package/templates/skills/solve/SKILL.md +92 -6
  81. package/templates/skills/spec/SKILL.md +57 -4
  82. package/templates/skills/test/SKILL.md +10 -0
  83. package/templates/skills/testgen/SKILL.md +1 -1
@@ -0,0 +1,374 @@
1
+ ---
2
+ name: loop
3
+ description: "Quality loop - Parse test/QA findings and iterate until quality gates pass"
4
+ license: MIT
5
+ metadata:
6
+ author: sequant
7
+ version: "1.0"
8
+ allowed-tools:
9
+ - Read
10
+ - Edit
11
+ - Write
12
+ - Glob
13
+ - Grep
14
+ - Bash
15
+ - TodoWrite
16
+ # Optional MCP tools (enhanced functionality if available)
17
+ - mcp__chrome-devtools__* # Browser testing - falls back to manual verification if unavailable
18
+ - mcp__sequential-thinking__* # Complex debugging - falls back to standard analysis if unavailable
19
+ - mcp__context7__* # Library documentation - falls back to web search if unavailable
20
+ - Bash(gh issue view:*)
21
+ - Bash(gh issue comment:*)
22
+ - Bash(npm test:*)
23
+ - Bash(npm run build:*)
24
+ - Bash(git diff:*)
25
+ - Bash(git status:*)
26
+ ---
27
+
28
+ # Quality Loop Command
29
+
30
+ You are the "Quality Loop Agent" for the current repository.
31
+
32
+ ## Purpose
33
+
34
+ When invoked as `/loop <issue-number>`, your job is to:
35
+
36
+ 1. Read the previous phase output from `/tmp/claude-issue-<N>.log`
37
+ 2. Parse findings from the last `/test` or `/qa` phase
38
+ 3. Fix the identified issues
39
+ 4. Re-run validation until quality gates pass
40
+ 5. Exit when `READY_FOR_MERGE` or max iterations reached
41
+
42
+ ## Invocation
43
+
44
+ - `/loop 123` - Parse log for issue #123, fix issues, re-validate
45
+
46
+ ## Workflow
47
+
48
+ ### Step 1: Read Previous Phase Output
49
+
50
+ Use the Read tool to read the log file for this issue:
51
+ ```
52
+ Read(file_path="/tmp/claude-issue-<issue-number>.log")
53
+ ```
54
+
55
+ Parse the log to find:
56
+ - **Last phase executed:** `/test` or `/qa`
57
+ - **Verdict:** `READY_FOR_MERGE`, `AC_MET_BUT_NOT_A_PLUS`, `NEEDS_VERIFICATION`,
58
+ or `AC_NOT_MET`
59
+ - **Test results:** PASS/FAIL/BLOCKED counts
60
+ - **Issues to fix:** Numbered recommendations or bug descriptions
61
+
62
+ ### Step 2: Detect Phase and Parse Findings
63
+
64
+ **If last phase was `/test`:**
65
+ Look for patterns like:
66
+ - `X/Y tests passed`
67
+ - `FAIL` or `BLOCKED` test results
68
+ - `### Bugs Found` section
69
+ - `### Issues to Fix` section
70
+
71
+ Extract:
72
+ - Failed test descriptions
73
+ - Bug locations and descriptions
74
+ - Blocked test dependencies
75
+
76
+ **If last phase was `/qa`:**
77
+ Look for patterns like:
78
+ - `Verdict: AC_NOT_MET` or `Verdict: AC_MET_BUT_NOT_A_PLUS`
79
+ - `NOT_MET` or `PARTIALLY_MET` AC items
80
+ - `### Issues` or `### Recommendations` sections
81
+
82
+ Extract:
83
+ - AC items marked NOT_MET or PARTIALLY_MET
84
+ - Specific recommendations
85
+ - Required fixes
86
+
87
+ ### Step 3: Check Exit Conditions
88
+
89
+ **Exit loop if:**
90
+ - Verdict is `READY_FOR_MERGE` - Nothing to fix!
91
+ - Verdict is `NEEDS_VERIFICATION` - Pending external verification
92
+ - No actionable issues found
93
+ - Max iterations reached (3 by default)
94
+
95
+ **Continue loop if:**
96
+ - Tests failed
97
+ - AC not met
98
+ - Specific issues identified
99
+
100
+ ### Step 4: Locate Feature Worktree
101
+
102
+ Find the worktree for this issue:
103
+ ```bash
104
+ git worktree list | grep -E "feature.*<issue-number>" || true
105
+ ```
106
+
107
+ Or check:
108
+ ```bash
109
+ ls ../worktrees/feature/<issue-number>-*/
110
+ ```
111
+
112
+ Navigate to the worktree directory for making fixes.
113
+
114
+ ### Step 5: Fix Identified Issues
115
+
116
+ For each issue found in the log:
117
+
118
+ 1. **Understand the issue:** Read relevant code to understand the problem
119
+ 2. **Plan the fix:** Determine minimal change needed
120
+ 3. **If complex issue:** Use Sequential Thinking to analyze root cause (see below)
121
+ 4. **If unfamiliar library:** Use Context7 for documentation lookup
122
+ 5. **Implement fix:** Make targeted changes
123
+ 6. **Verify locally:** Run `npm test` and `npm run build`
124
+
125
+ **Using Sequential Thinking for Complex Debugging:**
126
+
127
+ If the issue has multiple potential causes or requires deep analysis:
128
+
129
+ ```javascript
130
+ mcp__sequential-thinking__sequentialthinking({
131
+ thought: "Analyzing test failure: [description]. Potential causes: 1) [Cause A] 2) [Cause B] 3) [Cause C]. Let me examine each...",
132
+ thoughtNumber: 1,
133
+ totalThoughts: 4,
134
+ nextThoughtNeeded: true
135
+ })
136
+ ```
137
+
138
+ **When to use Sequential Thinking in loop:**
139
+ - Test failures with unclear root cause
140
+ - Multiple potential fixes exist
141
+ - Previous fix attempt failed
142
+ - Issue spans multiple files/components
143
+
144
+ **Fallback:** If Sequential Thinking unavailable, document analysis steps explicitly in your response.
145
+
146
+ **Using Context7 for Library-Related Fixes:**
147
+
148
+ If the issue involves third-party library behavior:
149
+
150
+ ```javascript
151
+ // Resolve library to Context7 ID
152
+ mcp__context7__resolve-library-id({
153
+ libraryName: "package-name",
154
+ query: "error message or behavior"
155
+ })
156
+
157
+ // Query for solution
158
+ mcp__context7__query-docs({
159
+ libraryId: "/org/package",
160
+ query: "specific problem description"
161
+ })
162
+ ```
163
+
164
+ **Fallback:** If Context7 unavailable, use WebSearch for documentation.
165
+
166
+ **Quality Standards (from /exec):**
167
+ - Make minimal, focused changes
168
+ - Avoid scope creep
169
+ - Maintain type safety (no `any`)
170
+ - Don't delete or modify unrelated tests
171
+
172
+ ### Step 6: Re-run Validation
173
+
174
+ After fixes are applied, re-run the phase that found issues:
175
+
176
+ **If fixing `/test` issues:**
177
+ - Use Chrome DevTools MCP to re-run failed tests
178
+ - Mark tests as PASS/FAIL based on fix
179
+ - Generate updated test summary
180
+
181
+ **If fixing `/qa` issues:**
182
+ - Run automated quality checks:
183
+ ```bash
184
+ npm test
185
+ npm run build
186
+ git diff main...HEAD --stat
187
+ ```
188
+ - Re-evaluate AC coverage
189
+ - Update verdict
190
+
191
+ ### Step 7: Iteration Check
192
+
193
+ After re-validation:
194
+
195
+ **If issues remain:**
196
+ - Increment iteration counter
197
+ - If iteration < MAX_ITERATIONS (3): Go back to Step 5
198
+ - If iteration >= MAX_ITERATIONS: Exit with summary
199
+
200
+ **If all issues fixed:**
201
+ - Confirm `READY_FOR_MERGE` status
202
+ - Post success comment to GitHub issue
203
+
204
+ ## Output Format
205
+
206
+ ### Progress Updates
207
+
208
+ For each iteration, output:
209
+
210
+ ```markdown
211
+ ## Loop Iteration X/3
212
+
213
+ ### Issues from Previous Phase
214
+ 1. [Issue description]
215
+ 2. [Issue description]
216
+
217
+ ### Fixes Applied
218
+ - [Fix 1]: [file:line] - [description]
219
+ - [Fix 2]: [file:line] - [description]
220
+
221
+ ### Re-validation Results
222
+ - Tests: X/Y passed
223
+ - Build: PASS/FAIL
224
+ - AC Coverage: X/Y met
225
+
226
+ ### Status
227
+ [FIXED - Continue to QA | NEEDS_MORE_WORK | MAX_ITERATIONS_REACHED]
228
+ ```
229
+
230
+ ### Final Summary
231
+
232
+ ```markdown
233
+ ## Quality Loop Complete
234
+
235
+ **Issue:** #<N>
236
+ **Iterations:** X/3
237
+ **Final Status:** [READY_FOR_MERGE | NEEDS_MANUAL_REVIEW]
238
+
239
+ ### Issues Fixed
240
+ 1. [Issue] - Fixed in [file:line]
241
+ 2. [Issue] - Fixed in [file:line]
242
+
243
+ ### Remaining Issues (if any)
244
+ - [Issue that couldn't be auto-fixed]
245
+
246
+ ### Recommended Next Steps
247
+ - [If READY_FOR_MERGE]: Run `/qa <N>` for final review
248
+ - [If manual review needed]: [Specific guidance]
249
+ ```
250
+
251
+ ## Integration with Workflow
252
+
253
+ **Interactive usage:**
254
+ ```bash
255
+ /spec 218 # Plan
256
+ /exec 218 # Implement
257
+ /test 218 # Test - finds 2 bugs
258
+ /loop 218 # Fixes bugs, re-tests, confirms PASS
259
+ /qa 218 # Final QA - READY_FOR_MERGE
260
+ ```
261
+
262
+ **Automated workflow:**
263
+ ```bash
264
+ /spec 218 # Plan
265
+ /exec 218 # Implement
266
+ /test 218 # Test - finds issues
267
+ /loop 218 # Fix issues, re-test
268
+ /qa 218 # Final QA
269
+ ```
270
+
271
+ ## Example Log Parsing
272
+
273
+ ### Test Log Example
274
+
275
+ ```
276
+ /test 218
277
+ ## Testing Results for Issue #218
278
+
279
+ **Summary:** 8/10 tests passed
280
+
281
+ ### Test Results
282
+
283
+ **Test 1: Basic image selection** - PASS
284
+ **Test 2: External URL validation** - FAIL
285
+ - Expected: URL validation error message
286
+ - Actual: No error shown for invalid URLs
287
+ - Issue: Validation not triggering on blur
288
+
289
+ **Test 3: Focal point picker** - BLOCKED
290
+ - Blocker: Modal not opening due to Test 2 failure
291
+
292
+ ### Bugs Found
293
+
294
+ 1. **URL validation not working**
295
+ - Location: components/admin/news/ExternalUrlTab.tsx:45
296
+ - Issue: onBlur handler missing validation call
297
+ - Status: needs fix
298
+ ```
299
+
300
+ **Parsed Output:**
301
+ - Last phase: `/test`
302
+ - Failed tests: 2 (Test 2, Test 3)
303
+ - Issues to fix:
304
+ 1. URL validation missing onBlur handler at `ExternalUrlTab.tsx:45`
305
+ 2. Test 3 blocked - depends on Test 2 fix
306
+
307
+ ### QA Log Example
308
+
309
+ ```
310
+ /qa 218
311
+ ## QA Review for Issue #218
312
+
313
+ ### AC Coverage
314
+
315
+ - AC-1: MET
316
+ - AC-2: MET
317
+ - AC-3: PARTIALLY_MET - External URL validation incomplete
318
+ - AC-4: NOT_MET - Focal point not persisted to database
319
+
320
+ ### Verdict: AC_NOT_MET
321
+
322
+ ### Required Fixes
323
+
324
+ 1. Complete URL validation in ExternalUrlTab
325
+ 2. Add focal point persistence in updateArticleImage action
326
+ ```
327
+
328
+ **Parsed Output:**
329
+ - Last phase: `/qa`
330
+ - Verdict: `AC_NOT_MET`
331
+ - Issues to fix:
332
+ 1. AC-3: Complete URL validation
333
+ 2. AC-4: Add focal point persistence
334
+
335
+ ## Error Handling
336
+
337
+ **If log file doesn't exist:**
338
+ ```
339
+ Error: Log file not found at /tmp/claude-issue-<N>.log
340
+ Please run /spec, /exec, /test, or /qa first.
341
+ ```
342
+
343
+ **If no issues found but not READY_FOR_MERGE:**
344
+ ```
345
+ Warning: No specific issues found in log.
346
+ Recommend running /qa <N> for fresh assessment.
347
+ ```
348
+
349
+ **If worktree not found:**
350
+ ```
351
+ Error: Feature worktree not found for issue #<N>
352
+ Expected: ../worktrees/feature/<N>-*/
353
+ Please run /exec <N> first to create the worktree.
354
+ ```
355
+
356
+ ## Configuration
357
+
358
+ **Max iterations:** 3 (prevents infinite loops)
359
+ **Re-validation after each fix:** Required
360
+ **GitHub comment:** Posted after loop completion
361
+
362
+ ---
363
+
364
+ ## Output Verification
365
+
366
+ **Before responding, verify your output includes ALL of these:**
367
+
368
+ - [ ] **Iteration Progress** - Current iteration X/3
369
+ - [ ] **Issues from Previous Phase** - List of issues being fixed
370
+ - [ ] **Fixes Applied** - Each fix with file:line location
371
+ - [ ] **Re-validation Results** - Tests/build/AC status after fixes
372
+ - [ ] **Final Status** - FIXED, NEEDS_MORE_WORK, or MAX_ITERATIONS_REACHED
373
+
374
+ **DO NOT respond until all items are verified.**