Skip to content

feat(run): Rewrite sequant run to use Claude Agent SDK - #24

Merged
admarble merged 2 commits into
mainfrom
feature/19-fix-sequant-run-to-use-claude-agent-sdk
Jan 8, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/19-fix-sequant-run-to-use-claude-agent-sdk

Conversation

@admarble

@admarble admarble commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Rewrites sequant run command to use the Claude Agent SDK's query() function instead of spawning the CLI with slash commands
  • Adds new features: quality loop, batch execution, testgen integration, smart tests, and auto UI detection
  • Fully supports environment variables for CI/CD integration

Key Changes

Core Rewrite (Claude Agent SDK)

  • AC-1: Install @anthropic-ai/claude-agent-sdk dependency
  • AC-2: Rewrite executePhase() to use query() instead of spawn()
  • AC-3: Use settingSources: ['project'] to load project skills
  • AC-4: Capture and display streaming output during execution
  • AC-5: Handle errors and timeouts properly
  • AC-6: Support session resumption for multi-phase workflows
  • AC-7: Verify skills are actually invoked (runtime verification needed)

New Features

  • AC-8: Implement --quality-loop / -q flag with auto-retry logic
  • AC-9: Implement --max-iterations option (default: 3)
  • AC-10: Implement --batch option for grouped sequential execution
  • AC-11: Implement --smart-tests / --no-smart-tests flags
  • AC-12: Implement --testgen flag to run testgen after spec
  • AC-13: Auto-detect UI issues by label and add test phase
  • AC-14: Support environment variables for CI (SEQUANT_QUALITY_LOOP, SEQUANT_MAX_ITERATIONS, etc.)

Test plan

  • Build succeeds (npm run build)
  • All 144 tests pass (npm test)
  • CLI help shows all new options (sequant run --help)
  • Test actual execution with a real issue (requires Claude API key)
  • Verify skills are invoked by checking GitHub issue comments

Usage Examples

# Basic
sequant run 12

# With quality loop (auto-fix iterations)
sequant run 12 --quality-loop
sequant run 12 -q

# Batch execution
sequant run --batch "12 13" --batch "14"

# Full options
sequant run 12 \
  --quality-loop \
  --max-iterations 3 \
  --phases spec,exec,test,qa \
  --testgen \
  --smart-tests \
  --verbose

Fixes #19


Generated with Claude Code

admarble and others added 2 commits January 8, 2026 12:45
Adds comprehensive test coverage for the structured logging system:
- run-log-schema.test.ts: 58 tests covering Zod schema validation and helper functions
- log-writer.test.ts: 41 tests covering LogWriter class and createPhaseLogFromTiming

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Replace spawn-based CLI invocation with the Claude Agent SDK's query()
function for proper skill invocation in headless mode.

## Changes

### Core Rewrite
- Use @anthropic-ai/claude-agent-sdk query() instead of spawn()
- Configure settingSources: ['project'] to load project skills
- Use Claude Code's system prompt and tools presets
- Implement streaming output in verbose mode
- Handle errors, timeouts, and session resumption

### New Features
- Add --quality-loop / -q flag for auto-retry with fix iterations
- Add --max-iterations option (default: 3)
- Add --batch option for grouped sequential execution
- Add --smart-tests / --no-smart-tests flags
- Add --testgen flag to run testgen after spec
- Auto-detect UI issues by label and add test phase
- Support SEQUANT_* environment variables for CI

## CLI Interface

```bash
sequant run 12 --quality-loop --max-iterations 3
sequant run --batch "12 13" --batch "14"
sequant run 12 --testgen --no-smart-tests
```

Fixes #19

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@admarble admarble mentioned this pull request Jan 8, 2026
14 tasks
@admarble
admarble merged commit d97e436 into main Jan 8, 2026
@admarble
admarble deleted the feature/19-fix-sequant-run-to-use-claude-agent-sdk branch January 8, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix sequant run to use Claude Agent SDK

1 participant