sequant 2.0.0 → 2.1.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 (61) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +7 -6
  4. package/dist/bin/cli.js +2 -1
  5. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +1 -1
  6. package/dist/marketplace/external_plugins/sequant/.mcp.json +6 -0
  7. package/dist/marketplace/external_plugins/sequant/README.md +58 -8
  8. package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +19 -8
  9. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +36 -49
  10. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/subagent-types.md +158 -48
  11. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +354 -352
  12. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +1155 -33
  13. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +35 -4
  14. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +2157 -104
  15. package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +1 -1
  16. package/dist/marketplace/external_plugins/sequant/skills/setup/SKILL.md +386 -0
  17. package/dist/marketplace/external_plugins/sequant/skills/solve/SKILL.md +38 -664
  18. package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +505 -120
  19. package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +246 -1
  20. package/dist/marketplace/external_plugins/sequant/skills/testgen/SKILL.md +138 -1
  21. package/dist/src/commands/dashboard.js +1 -1
  22. package/dist/src/commands/doctor.js +1 -1
  23. package/dist/src/commands/init.js +10 -10
  24. package/dist/src/commands/logs.js +1 -1
  25. package/dist/src/commands/run.js +49 -39
  26. package/dist/src/commands/state.js +3 -3
  27. package/dist/src/commands/status.js +5 -5
  28. package/dist/src/commands/sync.js +8 -8
  29. package/dist/src/commands/update.js +16 -16
  30. package/dist/src/lib/cli-ui.js +20 -19
  31. package/dist/src/lib/merge-check/index.js +2 -2
  32. package/dist/src/lib/settings.d.ts +8 -0
  33. package/dist/src/lib/settings.js +1 -0
  34. package/dist/src/lib/shutdown.js +1 -1
  35. package/dist/src/lib/templates.js +2 -0
  36. package/dist/src/lib/wizard.js +6 -4
  37. package/dist/src/lib/workflow/batch-executor.d.ts +9 -1
  38. package/dist/src/lib/workflow/batch-executor.js +39 -2
  39. package/dist/src/lib/workflow/log-writer.js +6 -6
  40. package/dist/src/lib/workflow/metrics-writer.js +5 -3
  41. package/dist/src/lib/workflow/phase-executor.d.ts +1 -1
  42. package/dist/src/lib/workflow/phase-executor.js +52 -22
  43. package/dist/src/lib/workflow/platforms/github.js +5 -1
  44. package/dist/src/lib/workflow/state-cleanup.js +1 -1
  45. package/dist/src/lib/workflow/state-manager.js +15 -13
  46. package/dist/src/lib/workflow/state-rebuild.js +2 -2
  47. package/dist/src/lib/workflow/types.d.ts +27 -0
  48. package/dist/src/lib/workflow/worktree-manager.js +40 -41
  49. package/dist/src/lib/worktree-isolation.d.ts +130 -0
  50. package/dist/src/lib/worktree-isolation.js +310 -0
  51. package/package.json +24 -14
  52. package/templates/agents/sequant-explorer.md +23 -0
  53. package/templates/agents/sequant-implementer.md +18 -0
  54. package/templates/agents/sequant-qa-checker.md +24 -0
  55. package/templates/agents/sequant-testgen.md +25 -0
  56. package/templates/scripts/cleanup-worktree.sh +18 -0
  57. package/templates/skills/_shared/references/subagent-types.md +158 -48
  58. package/templates/skills/exec/SKILL.md +72 -6
  59. package/templates/skills/qa/SKILL.md +8 -217
  60. package/templates/skills/spec/SKILL.md +446 -120
  61. package/templates/skills/testgen/SKILL.md +138 -1
@@ -17,7 +17,7 @@ allowed-tools:
17
17
  - Bash(git worktree list:*)
18
18
  - Bash(ls:*)
19
19
  - Bash(mkdir:*)
20
- - Task(general-purpose)
20
+ - Agent(sequant-testgen)
21
21
  ---
22
22
 
23
23
  # Test Generation Command
@@ -39,6 +39,116 @@ When invoked as `/testgen <issue-number>`, your job is to:
39
39
  - `/testgen 123` - Generate test stubs for issue #123 based on /spec comment
40
40
  - `/testgen` - Generate stubs for the most recently discussed issue in conversation
41
41
 
42
+ ## Token Optimization with Haiku Sub-Agents
43
+
44
+ **Purpose:** Test stub generation is highly mechanical and benefits from using haiku sub-agents to minimize token cost.
45
+
46
+ **Pattern:** Use `Agent(subagent_type="sequant-testgen")` for:
47
+ 1. Parsing verification criteria from /spec comments
48
+ 2. Generating individual test stubs from templates
49
+ 3. Writing test file content
50
+
51
+ **Benefits:**
52
+ - 90% token cost reduction for mechanical generation
53
+ - Faster execution for templated operations
54
+ - Main agent focuses on orchestration and decisions
55
+
56
+ ### Sub-Agent Usage
57
+
58
+ **Step 1: Parse Verification Criteria (use haiku)**
59
+
60
+ ```javascript
61
+ Agent(subagent_type="sequant-testgen", prompt=`
62
+ Parse the following /spec comment and extract verification criteria.
63
+
64
+ For each AC, extract:
65
+ - AC number and description
66
+ - Verification method (Unit Test, Integration Test, Browser Test, Manual Test)
67
+ - Test scenario (Given/When/Then)
68
+ - Integration points
69
+ - Assumptions to validate
70
+
71
+ Return as JSON:
72
+ {
73
+ "criteria": [
74
+ {
75
+ "acNumber": "AC-1",
76
+ "description": "...",
77
+ "verificationMethod": "Unit Test",
78
+ "scenario": { "given": "...", "when": "...", "then": "..." },
79
+ "integrationPoints": ["..."],
80
+ "assumptions": ["..."]
81
+ }
82
+ ]
83
+ }
84
+
85
+ /spec comment:
86
+ ${specComment}
87
+ `)
88
+ ```
89
+
90
+ **Step 2: Generate Test Stubs (use haiku for each AC)**
91
+
92
+ ```javascript
93
+ // For each AC with Unit Test or Integration Test verification method
94
+ Agent(subagent_type="sequant-testgen", prompt=`
95
+ Generate a Jest test stub for the following verification criteria.
96
+
97
+ AC: ${ac.acNumber}: ${ac.description}
98
+ Verification Method: ${ac.verificationMethod}
99
+ Test Scenario:
100
+ - Given: ${ac.scenario.given}
101
+ - When: ${ac.scenario.when}
102
+ - Then: ${ac.scenario.then}
103
+
104
+ Use the template format:
105
+ - Include Given/When/Then as comments
106
+ - Add TODO markers where implementation is needed
107
+ - Include failure path stubs based on the action verb
108
+ - Use throw new Error('Test stub - implement this test')
109
+
110
+ Return ONLY the test code, no explanation.
111
+ `)
112
+ ```
113
+
114
+ **Step 3: Write Test Files (main agent)**
115
+
116
+ The main agent handles file operations to ensure proper coordination:
117
+ - Check if files exist (don't overwrite)
118
+ - Create directories if needed
119
+ - Write generated stubs to correct locations
120
+
121
+ ### When to Use Sub-Agents vs Main Agent
122
+
123
+ | Task | Agent | Reasoning |
124
+ |------|-------|-----------|
125
+ | Parse /spec comment | haiku | Mechanical text extraction |
126
+ | Generate test stub code | haiku | Templated generation |
127
+ | Identify failure scenarios | haiku | Pattern matching |
128
+ | Decide file locations | main | Requires codebase context |
129
+ | Write files | main | File system coordination |
130
+ | Post GitHub comment | main | Session context needed |
131
+
132
+ ### Parallel Sub-Agent Execution
133
+
134
+ When multiple ACs need test stubs, spawn haiku agents in parallel:
135
+
136
+ ```javascript
137
+ // Spawn all stub generation agents in a single message
138
+ const stubPromises = criteria
139
+ .filter(ac => ac.verificationMethod === 'Unit Test' || ac.verificationMethod === 'Integration Test')
140
+ .map(ac => Agent(subagent_type="sequant-testgen", prompt=`Generate test stub for ${ac.acNumber}...`))
141
+
142
+ // Collect results
143
+ // Main agent writes all files
144
+ ```
145
+
146
+ **Cost savings example:**
147
+ - 5 AC items with Unit Test verification
148
+ - Without haiku: ~50K tokens (main agent generates all)
149
+ - With haiku: ~5K tokens (main orchestrates, haiku generates)
150
+ - Savings: ~90%
151
+
42
152
  ## Workflow
43
153
 
44
154
  ### Step 1: Read Verification Criteria from GitHub Issue
@@ -562,6 +672,33 @@ Generated with [Claude Code](https://claude.com/claude-code)
562
672
 
563
673
  ---
564
674
 
675
+ ## State Tracking
676
+
677
+ **IMPORTANT:** Update workflow state when running standalone (not orchestrated).
678
+
679
+ ### State Updates (Standalone Only)
680
+
681
+ When NOT orchestrated (`SEQUANT_ORCHESTRATOR` is not set):
682
+
683
+ **At skill start:**
684
+ ```bash
685
+ npx tsx scripts/state/update.ts start <issue-number> testgen
686
+ ```
687
+
688
+ **On successful completion:**
689
+ ```bash
690
+ npx tsx scripts/state/update.ts complete <issue-number> testgen
691
+ ```
692
+
693
+ **On failure:**
694
+ ```bash
695
+ npx tsx scripts/state/update.ts fail <issue-number> testgen "Failed to generate test stubs"
696
+ ```
697
+
698
+ **Note:** `/testgen` is an optional skill that generates test stubs. State tracking is informational - it doesn't block subsequent phases.
699
+
700
+ ---
701
+
565
702
  ## Output Verification
566
703
 
567
704
  **Before responding, verify your output includes ALL of these:**