sequant 2.4.0 → 2.6.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 +2 -2
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/README.md +125 -163
  4. package/dist/bin/cli.js +26 -3
  5. package/dist/dashboard/server.js +1 -0
  6. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +2 -2
  7. package/dist/marketplace/external_plugins/sequant/README.md +6 -3
  8. package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +92 -0
  9. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +18 -9
  10. package/dist/marketplace/external_plugins/sequant/hooks/relay-check.sh +107 -0
  11. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/behavior-rule-detection.md +205 -0
  12. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/subagent-types.md +21 -8
  13. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +302 -86
  14. package/dist/marketplace/external_plugins/sequant/skills/assess/references/predicted-collision-detection.md +109 -0
  15. package/dist/marketplace/external_plugins/sequant/skills/docs/SKILL.md +141 -22
  16. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +83 -78
  17. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +377 -137
  18. package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +28 -0
  19. package/dist/marketplace/external_plugins/sequant/skills/merger/SKILL.md +621 -0
  20. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +741 -232
  21. package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +47 -1
  22. package/dist/marketplace/external_plugins/sequant/skills/setup/SKILL.md +12 -6
  23. package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +217 -964
  24. package/dist/marketplace/external_plugins/sequant/skills/spec/references/parallel-groups.md +7 -0
  25. package/dist/marketplace/external_plugins/sequant/skills/spec/references/quality-checklist.md +75 -0
  26. package/dist/marketplace/external_plugins/sequant/skills/spec/references/recommended-workflow.md +4 -2
  27. package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +0 -27
  28. package/dist/marketplace/external_plugins/sequant/skills/testgen/SKILL.md +24 -44
  29. package/dist/src/commands/ready-tui-adapter.d.ts +59 -0
  30. package/dist/src/commands/ready-tui-adapter.js +130 -0
  31. package/dist/src/commands/ready.d.ts +49 -0
  32. package/dist/src/commands/ready.js +243 -0
  33. package/dist/src/commands/run-flags.d.ts +31 -0
  34. package/dist/src/commands/run-flags.js +34 -0
  35. package/dist/src/commands/run.js +7 -1
  36. package/dist/src/commands/status.js +4 -0
  37. package/dist/src/lib/cli-ui/run-renderer.d.ts +7 -1
  38. package/dist/src/lib/cli-ui/run-renderer.js +28 -28
  39. package/dist/src/lib/settings.d.ts +34 -0
  40. package/dist/src/lib/settings.js +23 -1
  41. package/dist/src/lib/workflow/phase-executor.js +17 -2
  42. package/dist/src/lib/workflow/platforms/github.d.ts +6 -0
  43. package/dist/src/lib/workflow/platforms/github.js +17 -0
  44. package/dist/src/lib/workflow/ready-gate.d.ts +155 -0
  45. package/dist/src/lib/workflow/ready-gate.js +374 -0
  46. package/dist/src/lib/workflow/reconcile.js +6 -0
  47. package/dist/src/lib/workflow/state-schema.d.ts +3 -0
  48. package/dist/src/lib/workflow/state-schema.js +1 -0
  49. package/dist/src/lib/workflow/types.d.ts +27 -3
  50. package/dist/src/ui/tui/App.js +8 -2
  51. package/dist/src/ui/tui/IssueBox.js +3 -4
  52. package/dist/src/ui/tui/index.d.ts +13 -4
  53. package/dist/src/ui/tui/index.js +19 -5
  54. package/dist/src/ui/tui/row-cap.d.ts +51 -0
  55. package/dist/src/ui/tui/row-cap.js +76 -0
  56. package/dist/src/ui/tui/teardown.d.ts +20 -0
  57. package/dist/src/ui/tui/teardown.js +29 -0
  58. package/dist/src/ui/tui/theme.d.ts +3 -0
  59. package/dist/src/ui/tui/theme.js +3 -0
  60. package/package.json +19 -8
  61. package/templates/skills/qa/SKILL.md +5 -2
@@ -25,6 +25,13 @@ When the implementation involves 3+ independent tasks that could be parallelized
25
25
 
26
26
  ## Model Selection
27
27
 
28
+ > **Note:** Per anthropics/claude-code#43869, the `[model: ...]` annotation
29
+ > below and the `model=` parameter `/exec` passes to `Agent(...)` are currently
30
+ > ignored — every spawned subagent inherits the parent session's model. The
31
+ > guidance here reflects the *intended* tier for each task once upstream fixes
32
+ > ship; the parser in `exec/SKILL.md` is kept intact so it reactivates
33
+ > automatically.
34
+
28
35
  Include a `[model: haiku]` or `[model: sonnet]` annotation at the end of each task line:
29
36
 
30
37
  | Task Type | Recommended Model |
@@ -0,0 +1,75 @@
1
+ # Feature Quality Planning — Full Checklist
2
+
3
+ Use this checklist for **Complex** tier issues or when the exception-based summary in SKILL.md flags significant gaps. For Simple/Standard tiers, the exception-based approach in the main prompt is sufficient.
4
+
5
+ ## Section Applicability
6
+
7
+ | Issue Type | Sections Required |
8
+ |------------|-------------------|
9
+ | Bug fix | Completeness, Error Handling, Test Coverage |
10
+ | New feature | All sections |
11
+ | Refactor | Completeness, Code Quality, Test Coverage |
12
+ | UI change | All sections including Polish |
13
+ | Backend/API | Completeness, Error Handling, Code Quality, Test Coverage, Best Practices |
14
+ | CLI/Script | Completeness, Error Handling, Test Coverage, Best Practices |
15
+ | Docs only | Completeness only |
16
+
17
+ ## Completeness Check
18
+
19
+ - [ ] All AC items have corresponding implementation steps
20
+ - [ ] Integration points with existing features identified
21
+ - [ ] No partial implementations or TODOs planned
22
+ - [ ] State management considered (if applicable)
23
+ - [ ] Data flow is complete end-to-end
24
+
25
+ ## Error Handling
26
+
27
+ - [ ] Invalid input scenarios identified
28
+ - [ ] API/external service failures handled
29
+ - [ ] Edge cases documented (empty, null, max values)
30
+ - [ ] Error messages are user-friendly
31
+ - [ ] Graceful degradation planned
32
+
33
+ ## Code Quality
34
+
35
+ - [ ] Types fully defined (no `any` planned)
36
+ - [ ] Follows existing patterns in codebase
37
+ - [ ] Error boundaries where needed
38
+ - [ ] No magic strings/numbers
39
+ - [ ] Consistent naming conventions
40
+
41
+ ## Test Coverage Plan
42
+
43
+ - [ ] Unit tests for business logic
44
+ - [ ] Integration tests for data flow
45
+ - [ ] Edge case tests identified
46
+ - [ ] Mocking strategy appropriate
47
+ - [ ] Critical paths have test coverage
48
+
49
+ ## Best Practices
50
+
51
+ - [ ] Logging for debugging/observability
52
+ - [ ] Accessibility considerations (if UI)
53
+ - [ ] Performance implications considered
54
+ - [ ] Security reviewed (auth, validation, sanitization)
55
+ - [ ] Documentation updated (if behavior changes)
56
+
57
+ ## Polish (UI features only)
58
+
59
+ - [ ] Loading states planned
60
+ - [ ] Error states have UI
61
+ - [ ] Empty states handled
62
+ - [ ] Responsive design considered
63
+ - [ ] Keyboard navigation works
64
+
65
+ ## Derived ACs
66
+
67
+ Based on quality planning, identify additional ACs:
68
+
69
+ | Source | Derived AC | Priority |
70
+ |--------|-----------|----------|
71
+ | Error Handling | AC-N: Handle [specific error] with [specific response] | High/Medium/Low |
72
+ | Test Coverage | AC-N+1: Add tests for [specific scenario] | High/Medium/Low |
73
+ | Best Practices | AC-N+2: Add logging for [specific operation] | High/Medium/Low |
74
+
75
+ Derived ACs are numbered sequentially after original ACs.
@@ -14,16 +14,18 @@ This document shows the expected output format for the `## Recommended Workflow`
14
14
 
15
15
  ## Examples
16
16
 
17
- ### Simple Bug Fix
17
+ ### Simple Bug Fix (spec confirms straightforward scope)
18
18
 
19
19
  ```markdown
20
20
  ## Recommended Workflow
21
21
 
22
22
  **Phases:** exec → qa
23
23
  **Quality Loop:** disabled
24
- **Reasoning:** Straightforward bug fix with clear root cause. No planning needed.
24
+ **Reasoning:** This spec pass confirmed a clear root cause and narrow scope — no testgen or additional phases required; proceed to exec.
25
25
  ```
26
26
 
27
+ *Note:* Since #533, spec always runs by default. `**Phases:**` lists phases **after** spec — use `exec → qa` here to indicate "spec is done; only exec and qa remain."
28
+
27
29
  ### Standard Feature
28
30
 
29
31
  ```markdown
@@ -805,33 +805,6 @@ Both can be used together:
805
805
 
806
806
  ---
807
807
 
808
- ## State Tracking
809
-
810
- **IMPORTANT:** Update workflow state when running standalone (not orchestrated).
811
-
812
- ### State Updates (Standalone Only)
813
-
814
- When NOT orchestrated (`SEQUANT_ORCHESTRATOR` is not set):
815
-
816
- **At skill start:**
817
- ```bash
818
- npx tsx scripts/state/update.ts start <issue-number> test
819
- ```
820
-
821
- **On successful completion:**
822
- ```bash
823
- npx tsx scripts/state/update.ts complete <issue-number> test
824
- ```
825
-
826
- **On failure:**
827
- ```bash
828
- npx tsx scripts/state/update.ts fail <issue-number> test "X/Y tests failed"
829
- ```
830
-
831
- **Why this matters:** State tracking enables dashboard visibility, resume capability, and workflow orchestration. Skills update state when standalone; orchestrators handle state when running workflows.
832
-
833
- ---
834
-
835
808
  ## Output Verification
836
809
 
837
810
  **Before responding, verify your output includes ALL of these:**
@@ -39,9 +39,16 @@ 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
42
+ ## Sub-Agent Delegation for Stub Generation
43
43
 
44
- **Purpose:** Test stub generation is highly mechanical and benefits from using haiku sub-agents to minimize token cost.
44
+ **Purpose:** Test stub generation is highly mechanical and is delegated to `sequant-testgen` so the main agent focuses on orchestration.
45
+
46
+ > **Upstream caveat:** `sequant-testgen` declares `model: haiku`, but per
47
+ > anthropics/claude-code#43869 that declaration is currently ignored — the
48
+ > subagent inherits the parent session's model. Older versions of this doc
49
+ > claimed concrete token-cost savings from haiku. Those numbers are not
50
+ > achievable until the upstream fix ships; treat the haiku claim as the
51
+ > *intended* tier, not the runtime one.
45
52
 
46
53
  **Pattern:** Use `Agent(subagent_type="sequant-testgen")` for:
47
54
  1. Parsing verification criteria from /spec comments
@@ -49,13 +56,12 @@ When invoked as `/testgen <issue-number>`, your job is to:
49
56
  3. Writing test file content
50
57
 
51
58
  **Benefits:**
52
- - 90% token cost reduction for mechanical generation
53
- - Faster execution for templated operations
54
- - Main agent focuses on orchestration and decisions
59
+ - Main agent focuses on orchestration and decisions, not stub templating
60
+ - Designated tier (`haiku`) will yield token savings once anthropics/claude-code#43869 is fixed; today subagents inherit the parent's model
55
61
 
56
62
  ### Sub-Agent Usage
57
63
 
58
- **Step 1: Parse Verification Criteria (use haiku)**
64
+ **Step 1: Parse Verification Criteria (designated haiku — currently inert per anthropics/claude-code#43869)**
59
65
 
60
66
  ```javascript
61
67
  Agent(subagent_type="sequant-testgen", prompt=`
@@ -87,7 +93,7 @@ ${specComment}
87
93
  `)
88
94
  ```
89
95
 
90
- **Step 2: Generate Test Stubs (use haiku for each AC)**
96
+ **Step 2: Generate Test Stubs (designated haiku currently inert per anthropics/claude-code#43869)**
91
97
 
92
98
  ```javascript
93
99
  // For each AC with Unit Test or Integration Test verification method
@@ -122,16 +128,16 @@ The main agent handles file operations to ensure proper coordination:
122
128
 
123
129
  | Task | Agent | Reasoning |
124
130
  |------|-------|-----------|
125
- | Parse /spec comment | haiku | Mechanical text extraction |
126
- | Generate test stub code | haiku | Templated generation |
127
- | Identify failure scenarios | haiku | Pattern matching |
131
+ | Parse /spec comment | `sequant-testgen` (declared haiku, inert per #43869) | Mechanical text extraction |
132
+ | Generate test stub code | `sequant-testgen` (declared haiku, inert per #43869) | Templated generation |
133
+ | Identify failure scenarios | `sequant-testgen` (declared haiku, inert per #43869) | Pattern matching |
128
134
  | Decide file locations | main | Requires codebase context |
129
135
  | Write files | main | File system coordination |
130
136
  | Post GitHub comment | main | Session context needed |
131
137
 
132
138
  ### Parallel Sub-Agent Execution
133
139
 
134
- When multiple ACs need test stubs, spawn haiku agents in parallel:
140
+ When multiple ACs need test stubs, spawn `sequant-testgen` agents in parallel (declared haiku tier, currently inert per anthropics/claude-code#43869):
135
141
 
136
142
  ```javascript
137
143
  // Spawn all stub generation agents in a single message
@@ -143,11 +149,12 @@ const stubPromises = criteria
143
149
  // Main agent writes all files
144
150
  ```
145
151
 
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%
152
+ **Cost savings (when upstream lands):**
153
+ Once anthropics/claude-code#43869 is fixed and the declared haiku tier takes
154
+ effect, delegating mechanical stub generation to `sequant-testgen` will
155
+ substantially reduce token cost vs. having the main agent generate every stub.
156
+ Concrete savings are not measured here because the declaration is currently
157
+ inert.
151
158
 
152
159
  ## Workflow
153
160
 
@@ -626,7 +633,7 @@ Cannot generate test files - no feature worktree exists for Issue #<N>.
626
633
 
627
634
  **Options:**
628
635
  1. Run `/exec <issue>` first (creates worktree automatically)
629
- 2. Create worktree manually: `./scripts/dev/new-feature.sh <issue>`
636
+ 2. Create worktree manually: `./scripts/new-feature.sh <issue>`
630
637
  3. Use the browser/manual test scenarios from this comment
631
638
  ```
632
639
 
@@ -672,33 +679,6 @@ Generated with [Claude Code](https://claude.com/claude-code)
672
679
 
673
680
  ---
674
681
 
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
-
702
682
  ## Output Verification
703
683
 
704
684
  **Before responding, verify your output includes ALL of these:**
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Single-issue snapshot adapter for `sequant ready` (#699 Part A).
3
+ *
4
+ * The Ink TUI is pull-based: `App` polls `getSnapshot(): RunSnapshot` at 10 Hz
5
+ * (see `src/ui/tui/index.ts`). But `ready` has no `RunOrchestrator` — its
6
+ * progress arrives push-style via the gate's `onProgress` hook (#697). This
7
+ * adapter bridges the two: a small mutable tracker the gate feeds, exposing a
8
+ * `getSnapshot()` that returns a one-issue `RunSnapshot` for the TUI to mount.
9
+ *
10
+ * The gate fires `start`/`complete`/`failed` around each `qa`/`loop` pass; we
11
+ * model those passes as the phase row, with a coarse `nowLine`
12
+ * (`formatCoarseNowLine`) — no agent-stream enrichment (a stated Non-Goal).
13
+ */
14
+ import type { ProgressCallback } from "../lib/workflow/types.js";
15
+ import { type RunSnapshot } from "../lib/workflow/run-state.js";
16
+ export interface ReadySnapshotAdapterOptions {
17
+ issueNumber: number;
18
+ title: string;
19
+ branch: string;
20
+ /** Surfaced in the snapshot config header; `ready` always loops. */
21
+ qualityLoop?: boolean;
22
+ }
23
+ /**
24
+ * Mutable single-issue runtime tracker that doubles as a TUI snapshot provider.
25
+ *
26
+ * Lifecycle: construct → mount `renderTui(adapter)` → pass `adapter.onProgress`
27
+ * to the gate → on gate resolution call `markDone(ready)` so the polling `App`
28
+ * sees `done` and unmounts.
29
+ */
30
+ export declare class ReadySnapshotAdapter {
31
+ private readonly issueNumber;
32
+ private readonly title;
33
+ private readonly branch;
34
+ private readonly qualityLoop;
35
+ private status;
36
+ private readonly phases;
37
+ private currentPhase;
38
+ private startedAt;
39
+ private completedAt;
40
+ private finished;
41
+ constructor(opts: ReadySnapshotAdapterOptions);
42
+ /**
43
+ * `ProgressCallback`-shaped sink wired into the gate's `onProgress`.
44
+ *
45
+ * - `start` → append a running phase + set `currentPhase` (coarse nowLine).
46
+ * - `complete` → mark the active phase done, record elapsed, clear nowLine.
47
+ * - `failed` → mark the active phase failed, flip issue status to failed.
48
+ * - `activity` → refresh the activity stamp / nowLine if a finer signal lands.
49
+ */
50
+ readonly onProgress: ProgressCallback;
51
+ /**
52
+ * Mark the run finished after `runReadyGate` resolves. Flips the snapshot's
53
+ * `done` flag so the polling `App` unmounts, and sets a terminal status
54
+ * (failed wins if a phase already failed).
55
+ */
56
+ markDone(ready: boolean): void;
57
+ /** Pull-based snapshot consumed by the TUI's 10 Hz poll loop. */
58
+ getSnapshot(): RunSnapshot;
59
+ }
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Single-issue snapshot adapter for `sequant ready` (#699 Part A).
3
+ *
4
+ * The Ink TUI is pull-based: `App` polls `getSnapshot(): RunSnapshot` at 10 Hz
5
+ * (see `src/ui/tui/index.ts`). But `ready` has no `RunOrchestrator` — its
6
+ * progress arrives push-style via the gate's `onProgress` hook (#697). This
7
+ * adapter bridges the two: a small mutable tracker the gate feeds, exposing a
8
+ * `getSnapshot()` that returns a one-issue `RunSnapshot` for the TUI to mount.
9
+ *
10
+ * The gate fires `start`/`complete`/`failed` around each `qa`/`loop` pass; we
11
+ * model those passes as the phase row, with a coarse `nowLine`
12
+ * (`formatCoarseNowLine`) — no agent-stream enrichment (a stated Non-Goal).
13
+ */
14
+ import { formatCoarseNowLine, } from "../lib/workflow/run-state.js";
15
+ /**
16
+ * Mutable single-issue runtime tracker that doubles as a TUI snapshot provider.
17
+ *
18
+ * Lifecycle: construct → mount `renderTui(adapter)` → pass `adapter.onProgress`
19
+ * to the gate → on gate resolution call `markDone(ready)` so the polling `App`
20
+ * sees `done` and unmounts.
21
+ */
22
+ export class ReadySnapshotAdapter {
23
+ issueNumber;
24
+ title;
25
+ branch;
26
+ qualityLoop;
27
+ status = "queued";
28
+ phases = [];
29
+ currentPhase;
30
+ startedAt;
31
+ completedAt;
32
+ finished = false;
33
+ constructor(opts) {
34
+ this.issueNumber = opts.issueNumber;
35
+ this.title = opts.title;
36
+ this.branch = opts.branch;
37
+ this.qualityLoop = opts.qualityLoop ?? true;
38
+ }
39
+ /**
40
+ * `ProgressCallback`-shaped sink wired into the gate's `onProgress`.
41
+ *
42
+ * - `start` → append a running phase + set `currentPhase` (coarse nowLine).
43
+ * - `complete` → mark the active phase done, record elapsed, clear nowLine.
44
+ * - `failed` → mark the active phase failed, flip issue status to failed.
45
+ * - `activity` → refresh the activity stamp / nowLine if a finer signal lands.
46
+ */
47
+ onProgress = (_issue, phase, event, extra) => {
48
+ const now = new Date();
49
+ switch (event) {
50
+ case "start": {
51
+ if (!this.startedAt)
52
+ this.startedAt = now;
53
+ this.status = "running";
54
+ this.phases.push({ name: phase, status: "running", startedAt: now });
55
+ this.currentPhase = {
56
+ name: phase,
57
+ startedAt: now,
58
+ lastActivityAt: now,
59
+ nowLine: formatCoarseNowLine(phase),
60
+ };
61
+ break;
62
+ }
63
+ case "complete":
64
+ case "failed": {
65
+ const active = this.phases[this.phases.length - 1];
66
+ if (active && active.status === "running") {
67
+ active.status = event === "failed" ? "failed" : "done";
68
+ active.elapsedMs =
69
+ extra?.durationSeconds != null
70
+ ? Math.round(extra.durationSeconds * 1000)
71
+ : active.startedAt
72
+ ? now.getTime() - active.startedAt.getTime()
73
+ : undefined;
74
+ }
75
+ this.currentPhase = undefined;
76
+ if (event === "failed")
77
+ this.status = "failed";
78
+ break;
79
+ }
80
+ case "activity": {
81
+ if (this.currentPhase) {
82
+ this.currentPhase = {
83
+ ...this.currentPhase,
84
+ lastActivityAt: now,
85
+ nowLine: extra?.text?.trim()
86
+ ? extra.text.trim()
87
+ : this.currentPhase.nowLine,
88
+ };
89
+ }
90
+ break;
91
+ }
92
+ }
93
+ };
94
+ /**
95
+ * Mark the run finished after `runReadyGate` resolves. Flips the snapshot's
96
+ * `done` flag so the polling `App` unmounts, and sets a terminal status
97
+ * (failed wins if a phase already failed).
98
+ */
99
+ markDone(ready) {
100
+ this.completedAt = new Date();
101
+ this.currentPhase = undefined;
102
+ if (this.status !== "failed") {
103
+ this.status = ready ? "passed" : "failed";
104
+ }
105
+ this.finished = true;
106
+ }
107
+ /** Pull-based snapshot consumed by the TUI's 10 Hz poll loop. */
108
+ getSnapshot() {
109
+ const issue = {
110
+ number: this.issueNumber,
111
+ title: this.title,
112
+ branch: this.branch,
113
+ status: this.status,
114
+ phases: this.phases.map((p) => ({ ...p })),
115
+ currentPhase: this.currentPhase ? { ...this.currentPhase } : undefined,
116
+ startedAt: this.startedAt,
117
+ completedAt: this.completedAt,
118
+ };
119
+ return {
120
+ config: {
121
+ concurrency: 1,
122
+ baseBranch: this.branch,
123
+ qualityLoop: this.qualityLoop,
124
+ },
125
+ issues: [issue],
126
+ done: this.finished,
127
+ capturedAt: new Date(),
128
+ };
129
+ }
130
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * sequant ready <issue> — post-resolve A+ QA gate (#683)
3
+ *
4
+ * Runs a full-weight `qa → loop → qa` pipeline against an issue's existing
5
+ * worktree, reproducing the maintainer's manual fresh-session A+ pass
6
+ * deterministically, then STOPS at a human merge gate. It NEVER merges.
7
+ *
8
+ * Gate policy (flag > settings.ready.policy > "ac"):
9
+ * - `ac` (default) — loop until ACs are objectively met; report (not fix)
10
+ * quality gaps and Non-Goal-touching findings.
11
+ * - `a-plus` (opt-in) — loop toward READY_FOR_MERGE, auto-fixing quality gaps.
12
+ *
13
+ * Terminates in `waiting_for_human_merge` (when ready) or `blocked` (needs
14
+ * human / no implementation), persists that state, and emits a structured gap
15
+ * report. See `src/lib/workflow/ready-gate.ts` for the engine.
16
+ */
17
+ import { type ReadyPolicy } from "../lib/settings.js";
18
+ import { type ReadyResult } from "../lib/workflow/ready-gate.js";
19
+ export interface ReadyCommandOptions {
20
+ policy?: string;
21
+ maxIterations?: number;
22
+ budget?: number;
23
+ timeout?: number;
24
+ /** Commander surfaces `--no-mcp` as `mcp === false`. */
25
+ mcp?: boolean;
26
+ json?: boolean;
27
+ verbose?: boolean;
28
+ }
29
+ /**
30
+ * Exit code from a ready result.
31
+ * - 0: ready (awaiting human merge)
32
+ * - 1: not ready — needs human intervention (budget/iterations/stagnation)
33
+ * - 2: not ready — no implementation (#534) or hard error
34
+ */
35
+ export declare function getReadyExitCode(result: ReadyResult): number;
36
+ /**
37
+ * Resolve the gate policy: `--policy` flag > settings.ready.policy > "ac".
38
+ * Invalid flag values fall back to the settings/default value.
39
+ *
40
+ * @internal Exported for testing only.
41
+ */
42
+ export declare function resolvePolicy(flag: string | undefined, settingsPolicy: ReadyPolicy): ReadyPolicy;
43
+ /**
44
+ * Locate the worktree path for an issue from `git worktree list`.
45
+ *
46
+ * @internal Exported for testing only.
47
+ */
48
+ export declare function resolveWorktreePath(issueNumber: number): string | null;
49
+ export declare function readyCommand(issueArg: string, options: ReadyCommandOptions): Promise<void>;