Skip to content

feat: TypeScript runner infrastructure with XState (V2)#10

Merged
iamladi merged 9 commits intomainfrom
feat/typescript-runner-v2
Jan 25, 2026
Merged

feat: TypeScript runner infrastructure with XState (V2)#10
iamladi merged 9 commits intomainfrom
feat/typescript-runner-v2

Conversation

@iamladi
Copy link
Owner

@iamladi iamladi commented Jan 25, 2026

Summary

Implements the TypeScript workflow runner that orchestrates the full SDLC pipeline from research to merge-ready PR.

Key Changes

  • TypeScript Runner Infrastructure (src/runner/)

    • WorkflowRunner - Main orchestration loop with XState actor
    • ClaudeCLIAdapter - Spawn fresh Claude subprocesses per phase
    • SignalParser - Parse XML signals from CLI output
    • ProgressWriter - State persistence to progress file
    • PhaseMapper - Map XState phases to slash commands
  • XState State Machine (src/workflows/main.workflow.ts)

    • Complete lifecycle: idle → setup → planning → implementing → submitting → ci_resolution → comment_resolution → completed
    • CI resolution loop with retry limits (max 5 attempts)
    • Comment resolution loop with retry limits (max 10 attempts)
  • Phase Commands (commands/phase-*.md)

    • Each phase runs as separate Claude CLI subprocess (fresh context)
    • Emits XML signals for state transitions

Architecture

┌─────────────────────────────────────────────────────────────────┐
│  /workflows:build research/my-feature.md                        │
└──────────────────────────┬──────────────────────────────────────┘
                           │ bun run src/cli.ts run research/...
                           ▼
┌─────────────────────────────────────────────────────────────────┐
│  TypeScript Runner (WorkflowRunner)                              │
│  • XState actor (state machine)                                  │
│  • While loop until terminal state                               │
└──────────────────────────┬──────────────────────────────────────┘
                           │
         ┌─────────────────┼─────────────────┐
         ▼                 ▼                 ▼
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ claude -p      │ │ claude -p      │ │ claude -p      │
│ /phase-setup   │ │ /phase-plan    │ │ /phase-impl    │
│ Fresh context  │ │ Fresh context  │ │ Fresh context  │
└────────────────┘ └────────────────┘ └────────────────┘

Test Plan

  • 51 unit tests pass for signal parser, progress writer, and phase mapper
  • TypeScript type checking passes
  • Plugin validation passes
  • README documents all 9 commands

Implements the core runner loop that orchestrates workflow phases:
- WorkflowRunner class with XState actor management
- ClaudeCLIAdapter for spawning fresh Claude subprocesses
- SignalParser for XML signal extraction from output
- ProgressWriter for state persistence
- PhaseMapper for phase-to-command translation
Complete state machine with:
- idle → setup → planning → implementing → submitting flow
- ci_resolution ↔ ci_fixing loop with retry limits
- comment_resolution ↔ comment_resolving loop
- Proper guards and context updates on transitions
Each phase runs as separate Claude CLI subprocess:
- phase-setup: Create worktree, init progress
- phase-plan: Split research into plans
- phase-impl: Execute single plan
- phase-submit: Create PR
- phase-verify-ci: Check CI status
- phase-fix-ci: Fix CI failures
- phase-resolve-comments: Handle reviewer feedback

Updated build.md to be thin wrapper spawning TypeScript runner.
51 tests covering:
- SignalParser: XML signal extraction, error handling
- ProgressWriter: File I/O, state persistence
- PhaseMapper: Phase-to-command mapping, terminal states
- Add xstate for state machine management
- Add typescript for type checking
- Configure tsconfig for Bun runtime
- Add test and build scripts
Document:
- Internal phase commands for debugging
- Updated workflow phases including CI/comment resolution
- New src/ directory structure
- XState-based state management
Release includes:
- TypeScript runner infrastructure with XState
- Phase commands for fresh-context execution
- CI and comment resolution loops
- 51 unit tests
Runs on PRs and main branch pushes:
- Plugin validation
- TypeScript type checking
- Unit tests (51 tests)
- Shell script syntax validation
@iamladi iamladi merged commit 68918cb into main Jan 25, 2026
1 check passed
@iamladi iamladi deleted the feat/typescript-runner-v2 branch January 25, 2026 17:55
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.

1 participant