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
@@ -20,7 +20,7 @@ allowed-tools:
20
20
  - Bash(semgrep:*)
21
21
  - Bash(npx semgrep:*)
22
22
  - Bash(npx tsx scripts/semgrep-scan.ts:*)
23
- - Task(general-purpose)
23
+ - Agent(sequant-qa-checker)
24
24
  - AgentOutputTool
25
25
  ---
26
26
 
@@ -599,134 +599,6 @@ quality_plan_exists=$(gh issue view <issue> --comments --json comments -q '.comm
599
599
 
600
600
  ---
601
601
 
602
- ### Phase 0c: Incremental Re-Run Detection (CONDITIONAL)
603
-
604
- **When to apply:** On QA re-runs (when a prior QA phase marker exists in issue comments).
605
-
606
- **Purpose:** Optimize QA re-runs by detecting what changed since the last QA run and skipping checks whose inputs haven't changed. This significantly reduces token usage and execution time on iterative QA cycles.
607
-
608
- **Detection:**
609
-
610
- ```bash
611
- # Step 1: Check for prior QA run context in cache
612
- prior_context=$(npx tsx scripts/qa/qa-cache-cli.ts get-run-context 2>/dev/null || true)
613
-
614
- # Step 2: If no cache context found, fall through to full QA run
615
- if [[ -z "$prior_context" ]] || echo "$prior_context" | grep -q "No QA run context"; then
616
- echo "No prior QA context found — running full QA"
617
- INCREMENTAL_MODE=false
618
- else
619
- LAST_QA_SHA=$(echo "$prior_context" | jq -r '.lastQACommitSHA')
620
- LAST_QA_HASH=$(echo "$prior_context" | jq -r '.lastQADiffHash')
621
-
622
- # Step 3: Validate the commit SHA still exists in git history
623
- if ! git cat-file -t "$LAST_QA_SHA" &>/dev/null; then
624
- echo "Warning: Last QA commit SHA ($LAST_QA_SHA) not found in history — running full QA"
625
- INCREMENTAL_MODE=false
626
- else
627
- # Step 4: Get files changed since last QA
628
- changed_files=$(npx tsx scripts/qa/qa-cache-cli.ts changed-since "$LAST_QA_SHA" 2>/dev/null || true)
629
-
630
- if [[ "$changed_files" == "NO_CHANGES" ]]; then
631
- echo "No changes since last QA — all checks can use cached results"
632
- INCREMENTAL_MODE=true
633
- NO_FILE_CHANGES=true
634
- else
635
- echo "Changes detected since last QA ($LAST_QA_SHA):"
636
- echo "$changed_files" | head -20
637
- INCREMENTAL_MODE=true
638
- NO_FILE_CHANGES=false
639
- fi
640
- fi
641
- fi
642
- ```
643
-
644
- **Skip Logic (when INCREMENTAL_MODE=true):**
645
-
646
- | Check / Item | Skip Condition | Re-run Condition |
647
- |-------------|----------------|------------------|
648
- | Quality checks (type-safety, security, etc.) | Existing diff-hash cache handles this | Hash mismatch -> re-run |
649
- | Build verification | **Never skip** (always re-run) | Always — cheap and can regress |
650
- | CI status | **Never skip** (always re-run) | Always — external state changes |
651
- | AC items with prior status `met` | Skip if NO_FILE_CHANGES=true | Any file changes since last QA |
652
- | AC items with prior status `not_met` | **Never skip** | Always re-evaluate |
653
- | AC items with prior status `partially_met` | **Never skip** | Always re-evaluate |
654
- | AC items with prior status `pending`/`blocked` | **Never skip** | Always re-evaluate |
655
-
656
- **AC Re-evaluation Rules:**
657
-
658
- When `INCREMENTAL_MODE=true`:
659
-
660
- 1. **Load prior AC statuses** from run context:
661
- ```bash
662
- # Extract AC statuses from prior context
663
- ac_statuses=$(echo "$prior_context" | jq -r '.acStatuses | to_entries[] | "\(.key)=\(.value)"')
664
- ```
665
-
666
- 2. **For each AC item:**
667
- - If prior status is `met` AND `NO_FILE_CHANGES=true`:
668
- - **Skip full re-evaluation** — output "Cached: previously MET, no file changes"
669
- - Mark as `MET (cached)` in output
670
- - If prior status is `met` AND files changed:
671
- - **Re-evaluate** — changes may have caused regression
672
- - If prior status is `not_met` or `partially_met`:
673
- - **Always re-evaluate** — this is the primary purpose of re-runs
674
- - If prior status is `pending` or `blocked`:
675
- - **Always re-evaluate** — status may have changed
676
-
677
- 3. **`--no-cache` flag behavior:**
678
- - When `--no-cache` is passed, set `INCREMENTAL_MODE=false`
679
- - This forces full re-evaluation of ALL checks and AC items
680
- - Run context is still saved at the end for future re-runs
681
-
682
- **Output Format (Incremental QA Summary):**
683
-
684
- When `INCREMENTAL_MODE=true`, prepend this section to the QA output:
685
-
686
- ```markdown
687
- ### Incremental QA Summary
688
-
689
- **Last QA:** <timestamp> (commit: <sha-short>)
690
- **Changes since last QA:** N files
691
-
692
- | Check / AC | Status | Re-run? | Reason |
693
- |------------|--------|---------|--------|
694
- | type-safety | PASS | Cached | Diff hash unchanged |
695
- | security | PASS | Cached | Diff hash unchanged |
696
- | build | PASS | Re-run | Always fresh |
697
- | CI status | PASS | Re-run | Always fresh |
698
- | AC-1 | MET | Cached | Previously MET, no file changes |
699
- | AC-2 | MET | Re-evaluated | Was NOT_MET |
700
- | AC-3 | MET | Re-evaluated | Files changed since last QA |
701
-
702
- **Summary:** X checks cached, Y re-evaluated, Z always-fresh
703
- ```
704
-
705
- **Run Context Persistence:**
706
-
707
- After QA completes (regardless of incremental mode), save the run context:
708
-
709
- ```bash
710
- # Get current HEAD SHA
711
- current_sha=$(git rev-parse HEAD)
712
- # Get current diff hash
713
- current_hash=$(npx tsx scripts/qa/qa-cache-cli.ts hash)
714
-
715
- # Build AC statuses JSON from QA results
716
- # Example: {"AC-1":"met","AC-2":"not_met","AC-3":"met"}
717
- ac_json='{"AC-1":"met","AC-2":"not_met"}' # Replace with actual results
718
-
719
- # Save run context
720
- echo "{
721
- \"lastQACommitSHA\": \"$current_sha\",
722
- \"lastQADiffHash\": \"$current_hash\",
723
- \"acStatuses\": $ac_json,
724
- \"timestamp\": \"$(date -u +%Y-%m-%dT%H:%M:%S.000Z)\"
725
- }" | npx tsx scripts/qa/qa-cache-cli.ts set-run-context
726
- ```
727
-
728
- ---
729
-
730
602
  ### Phase 1: CI Status Check — REQUIRED
731
603
 
732
604
  **Purpose:** Check GitHub CI status before finalizing verdict. CI-dependent AC items (e.g., "Tests pass in CI") should reflect actual CI status, not just local test results.
@@ -933,7 +805,7 @@ issue_type="${SEQUANT_ISSUE_TYPE:-}"
933
805
 
934
806
  **Docs QA sub-agents (1 agent instead of 3):**
935
807
 
936
- 1. `Task(subagent_type="general-purpose", model="haiku", mode="bypassPermissions", prompt="Run scope and size checks on the current branch vs main. Check for broken links in changed markdown files. Report: files count, diff size, broken links, size assessment.")`
808
+ 1. `Agent(subagent_type="sequant-qa-checker", prompt="Run scope and size checks on the current branch vs main. Check for broken links in changed markdown files. Report: files count, diff size, broken links, size assessment.")`
937
809
 
938
810
  **If `SEQUANT_ISSUE_TYPE` is not set or is not `docs`**, use the standard pipeline below.
939
811
 
@@ -943,11 +815,11 @@ issue_type="${SEQUANT_ISSUE_TYPE:-}"
943
815
 
944
816
  **IMPORTANT:** Background agents need `mode="bypassPermissions"` to execute Bash commands (`git diff`, `npm test`, etc.) without interactive approval. The default `acceptEdits` mode only auto-approves Edit/Write — Bash calls are silently denied. These quality check agents only read and analyze; they never write files or push code, so bypassing permissions is safe.
945
817
 
946
- 1. `Task(subagent_type="general-purpose", model="haiku", mode="bypassPermissions", prompt="Run type safety and deleted tests checks on the current branch vs main. Report: type issues count, deleted tests, verdict.")`
818
+ 1. `Agent(subagent_type="sequant-qa-checker", prompt="Run type safety and deleted tests checks on the current branch vs main. Report: type issues count, deleted tests, verdict.")`
947
819
 
948
- 2. `Task(subagent_type="general-purpose", model="haiku", mode="bypassPermissions", prompt="Run scope and size checks on the current branch vs main. Report: files count, diff size, size assessment.")`
820
+ 2. `Agent(subagent_type="sequant-qa-checker", prompt="Run scope and size checks on the current branch vs main. Report: files count, diff size, size assessment.")`
949
821
 
950
- 3. `Task(subagent_type="general-purpose", model="haiku", mode="bypassPermissions", prompt="Run security scan on changed files in current branch vs main. Report: critical/warning/info counts, verdict.")`
822
+ 3. `Agent(subagent_type="sequant-qa-checker", prompt="Run security scan on changed files in current branch vs main. Report: critical/warning/info counts, verdict.")`
951
823
 
952
824
  #### If sequential mode (default):
953
825
 
@@ -955,11 +827,11 @@ issue_type="${SEQUANT_ISSUE_TYPE:-}"
955
827
 
956
828
  **Note:** Sequential agents run in the foreground where the user can approve Bash interactively. However, for consistency and to avoid approval fatigue, we still use `mode="bypassPermissions"` since these agents only perform read-only quality checks.
957
829
 
958
- 1. **First:** `Task(subagent_type="general-purpose", model="haiku", mode="bypassPermissions", prompt="Run type safety and deleted tests checks on the current branch vs main. Report: type issues count, deleted tests, verdict.")`
830
+ 1. **First:** `Agent(subagent_type="sequant-qa-checker", prompt="Run type safety and deleted tests checks on the current branch vs main. Report: type issues count, deleted tests, verdict.")`
959
831
 
960
- 2. **After #1 completes:** `Task(subagent_type="general-purpose", model="haiku", mode="bypassPermissions", prompt="Run scope and size checks on the current branch vs main. Report: files count, diff size, size assessment.")`
832
+ 2. **After #1 completes:** `Agent(subagent_type="sequant-qa-checker", prompt="Run scope and size checks on the current branch vs main. Report: files count, diff size, size assessment.")`
961
833
 
962
- 3. **After #2 completes:** `Task(subagent_type="general-purpose", model="haiku", mode="bypassPermissions", prompt="Run security scan on changed files in current branch vs main. Report: critical/warning/info counts, verdict.")`
834
+ 3. **After #2 completes:** `Agent(subagent_type="sequant-qa-checker", prompt="Run security scan on changed files in current branch vs main. Report: critical/warning/info counts, verdict.")`
963
835
 
964
836
  **Add RLS check if admin files modified:**
965
837
  ```bash
@@ -1476,43 +1348,6 @@ Provide a sentence or two explaining why.
1476
1348
 
1477
1349
  Do NOT mark MET based on "the general intent is satisfied." The AC text is the contract — verify it literally.
1478
1350
 
1479
- ### 3a. AC Status Persistence — REQUIRED
1480
-
1481
- **After evaluating each AC item**, update the status in workflow state using the state CLI:
1482
-
1483
- ```bash
1484
- # Step 1: Initialize AC items for the issue (run once, before updating statuses)
1485
- npx tsx scripts/state/update.ts init-ac <issue-number> <ac-count>
1486
-
1487
- # Example: Initialize 4 AC items for issue #250
1488
- npx tsx scripts/state/update.ts init-ac 250 4
1489
- ```
1490
-
1491
- ```bash
1492
- # Step 2: Update each AC item's status
1493
- npx tsx scripts/state/update.ts ac <issue-number> <ac-id> <status> "<notes>"
1494
-
1495
- # Examples:
1496
- npx tsx scripts/state/update.ts ac 250 AC-1 met "Verified: tests pass and feature works"
1497
- npx tsx scripts/state/update.ts ac 250 AC-2 not_met "Missing error handling for edge case"
1498
- npx tsx scripts/state/update.ts ac 250 AC-3 blocked "Waiting on upstream dependency"
1499
- ```
1500
-
1501
- **Status mapping:**
1502
- - `MET` → `met`
1503
- - `PARTIALLY_MET` → `not_met` (with notes explaining what's missing)
1504
- - `NOT_MET` → `not_met`
1505
- - `BLOCKED` → `blocked` (external dependency issue)
1506
-
1507
- **Why this matters:** Updating AC status in state enables:
1508
- - Dashboard shows real-time AC progress per issue
1509
- - Cross-skill tracking of which AC items need work
1510
- - Summary badges show "X/Y met" status
1511
-
1512
- **If issue has no stored AC:**
1513
- - Run `init-ac` first to create the AC items
1514
- - Then update each AC status individually
1515
-
1516
1351
  ### 4. Failure Path & Edge Case Testing (REQUIRED)
1517
1352
 
1518
1353
  Before any READY_FOR_MERGE verdict, complete the adversarial thinking checklist:
@@ -2125,34 +1960,6 @@ In some cases, `/verify` execution can be safely skipped when script changes are
2125
1960
 
2126
1961
  ---
2127
1962
 
2128
- ## State Tracking
2129
-
2130
- **IMPORTANT:** Update workflow state when running standalone (not orchestrated).
2131
-
2132
- ### State Updates (Standalone Only)
2133
-
2134
- When NOT orchestrated (`SEQUANT_ORCHESTRATOR` is not set):
2135
-
2136
- **At skill start:**
2137
- ```bash
2138
- npx tsx scripts/state/update.ts start <issue-number> qa
2139
- ```
2140
-
2141
- **On successful completion (READY_FOR_MERGE or AC_MET_BUT_NOT_A_PLUS):**
2142
- ```bash
2143
- npx tsx scripts/state/update.ts complete <issue-number> qa
2144
- npx tsx scripts/state/update.ts status <issue-number> ready_for_merge
2145
- ```
2146
-
2147
- **On failure (AC_NOT_MET):**
2148
- ```bash
2149
- npx tsx scripts/state/update.ts fail <issue-number> qa "AC not met"
2150
- ```
2151
-
2152
- **Why this matters:** State tracking enables dashboard visibility, resume capability, and workflow orchestration. Skills update state when standalone; orchestrators handle state when running workflows.
2153
-
2154
- ---
2155
-
2156
1963
  ## Output Verification
2157
1964
 
2158
1965
  **Before responding, verify your output includes ALL of these:**
@@ -2162,7 +1969,6 @@ npx tsx scripts/state/update.ts fail <issue-number> qa "AC not met"
2162
1969
  When the size gate determined `SMALL_DIFF=true`, use the **simplified output template**. The following sections are **omitted** (not marked N/A — completely absent):
2163
1970
 
2164
1971
  - Quality Plan Verification
2165
- - Incremental QA Summary
2166
1972
  - Call-Site Review
2167
1973
  - Product Review
2168
1974
  - Smoke Test
@@ -2357,21 +2163,6 @@ You MUST include these sections:
2357
2163
 
2358
2164
  ---
2359
2165
 
2360
- ### Incremental QA Summary
2361
-
2362
- [Include if INCREMENTAL_MODE=true from Phase 0c, otherwise: "N/A - First QA run"]
2363
-
2364
- **Last QA:** <timestamp> (commit: <sha-short>)
2365
- **Changes since last QA:** N files
2366
-
2367
- | Check / AC | Status | Re-run? | Reason |
2368
- |------------|--------|---------|--------|
2369
- | [check/AC] | [status] | Cached / Re-run / Re-evaluated | [reason] |
2370
-
2371
- **Summary:** X checks cached, Y re-evaluated, Z always-fresh
2372
-
2373
- ---
2374
-
2375
2166
  ### CI Status
2376
2167
 
2377
2168
  [Include if PR exists, otherwise: "No PR exists yet" or "No CI configured"]