Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Auto-generated from all feature plans. Last updated: 2026-01-24
- Git worktrees for lane isolation
- TypeScript (strict mode) - per Constitution §III + Bun runtime, existing CLI framework (no new deps) (004-verification-artifact-usability)
- File system (`.agent/checkpoint-N-verification.md`) (004-verification-artifact-usability)
- TypeScript (strict mode) - per Constitution §III + Existing CLI framework, Bun child process APIs (005-auto-install-deps)
- File system (`.switchyard/dependency-error.log` for failures) (005-auto-install-deps)
- TypeScript (strict mode) - per Constitution §III + Existing CLI framework, Bun child process APIs, Bun exec APIs (005-auto-install-deps)

## Project Structure

Expand Down Expand Up @@ -65,9 +68,9 @@ bun test && bun run lint # Full validation
TypeScript (strict mode) under Bun runtime: Follow standard conventions

## Recent Changes
- 005-auto-install-deps: Added TypeScript (strict mode) - per Constitution §III + Existing CLI framework, Bun child process APIs, Bun exec APIs
- 005-auto-install-deps: Added TypeScript (strict mode) - per Constitution §III + Existing CLI framework, Bun child process APIs
- 004-verification-artifact-usability: Added TypeScript (strict mode) - per Constitution §III + Bun runtime, existing CLI framework (no new deps)
- 003-lane-lifecycle: Lane lifecycle improvements - spec discovery, auto-detection, delete/merge commands
- 002-simplify-workflow: Simplified workflow (init → new → run), removed refine/lock commands, renamed CONSTITUTION to FOUNDATION

<!-- MANUAL ADDITIONS START -->
<!-- MANUAL ADDITIONS END -->
66 changes: 49 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,22 @@ A "lane" is an isolated worktree for developing a feature:
switchyard new my-feature
```

This creates:
- A git worktree at `.switchyard/wt/my-feature/`
- A lane state file tracking progress
- Event log for the lane
This:
- Creates a git worktree at `.switchyard/wt/my-feature/`
- Installs dependencies (auto-detects bun/npm/yarn/pnpm)
- Launches Claude Code in the new worktree

To pass flags to Claude Code, use double-dash flags:

```bash
switchyard new my-feature --dangerously-skip-permissions
```

To skip Claude launch:

```bash
switchyard new my-feature -no-claude
```

#### 3. Add Tasks

Expand Down Expand Up @@ -116,17 +128,37 @@ switchyard reset my-feature

# Delete a lane (archives state by default)
switchyard delete my-feature
switchyard delete my-feature --force # Delete even if running/locked
switchyard delete my-feature --no-archive # Delete without archiving
switchyard delete my-feature -force # Delete even if running/locked
switchyard delete my-feature -no-archive # Delete without archiving

# Merge a completed lane to main
switchyard merge my-feature
switchyard merge my-feature --squash # Squash all commits
switchyard merge my-feature --cleanup # Delete lane after merge
switchyard merge my-feature --base develop # Merge to different branch
switchyard merge my-feature -no-squash # Use regular merge instead of squash
switchyard merge my-feature -no-cleanup # Keep lane after merge
switchyard merge my-feature -base develop # Merge to different branch

# Force re-initialization (overwrites existing)
switchyard init --force
switchyard init -force
```

## Flag Convention

Switchyard uses a simple flag convention:

- **Single-dash flags (`-flag`)**: Go to switchyard
- **Double-dash flags (`--flag`)**: Passed to Claude Code on `new` command

Examples:

```bash
# -force is a switchyard flag
switchyard init -force

# --model is passed to Claude
switchyard new my-feature --model opus

# Mix both
switchyard new my-feature -no-claude --dangerously-skip-permissions
```

## Verification Artifacts
Expand All @@ -135,17 +167,17 @@ Verification artifacts are markdown files that document checkpoint completion. T

### Generating a Template

Use the `--template` flag to generate a pre-filled verification artifact:
Use the `-template` flag to generate a pre-filled verification artifact:

```bash
# Generate template for checkpoint 1
switchyard checkpoint 1 --template
switchyard checkpoint 1 -template

# Overwrite existing template
switchyard checkpoint 1 --template --force
switchyard checkpoint 1 -template -force

# Output as JSON
switchyard checkpoint 1 --template --json
switchyard checkpoint 1 -template -json
```

This creates a file at `.agent/checkpoint-1-verification.md` with:
Expand Down Expand Up @@ -207,9 +239,9 @@ After filling in the verification artifact:

```bash
switchyard checkpoint 1 \
--commit abc1234 \
--test-log .agent/test-log.txt \
--verification .agent/checkpoint-1-verification.md
-commit abc1234 \
-test-log .agent/test-log.txt \
-verification .agent/checkpoint-1-verification.md
```

## Claude Code Integration
Expand Down
36 changes: 36 additions & 0 deletions specs/005-auto-install-deps/checklists/requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Specification Quality Checklist: Auto-Install Dependencies After Lane Creation

**Purpose**: Validate specification completeness and quality before proceeding to planning
**Created**: 2026-01-25
**Feature**: [spec.md](../spec.md)

## Content Quality

- [x] No implementation details (languages, frameworks, APIs)
- [x] Focused on user value and business needs
- [x] Written for non-technical stakeholders
- [x] All mandatory sections completed

## Requirement Completeness

- [x] No [NEEDS CLARIFICATION] markers remain
- [x] Requirements are testable and unambiguous
- [x] Success criteria are measurable
- [x] Success criteria are technology-agnostic (no implementation details)
- [x] All acceptance scenarios are defined
- [x] Edge cases are identified
- [x] Scope is clearly bounded
- [x] Dependencies and assumptions identified

## Feature Readiness

- [x] All functional requirements have clear acceptance criteria
- [x] User scenarios cover primary flows
- [x] Feature meets measurable outcomes defined in Success Criteria
- [x] No implementation details leak into specification

## Notes

- All items pass validation
- Spec is ready for `/speckit.clarify` or `/speckit.plan`
- Key implementation consideration noted: install command must run in worktree directory, not user's current working directory (captured in FR-003)
174 changes: 174 additions & 0 deletions specs/005-auto-install-deps/data-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Data Model: Streamlined Lane Creation with Claude Launch

**Feature**: 005-auto-install-deps
**Date**: 2026-01-25

## Entities

### PackageManager (Enum)

Represents the supported package managers.

| Value | Lockfile | Install Command |
|-------|----------|-----------------|
| `bun` | `bun.lockb` | `bun install` |
| `npm` | `package-lock.json` | `npm install` |
| `yarn` | `yarn.lock` | `yarn install` |
| `pnpm` | `pnpm-lock.yaml` | `pnpm install` |

**Detection Priority**: bun → npm → yarn → pnpm (first lockfile found wins)

### DetectionResult

Result of detecting the package manager for a project.

| Field | Type | Description |
|-------|------|-------------|
| `detected` | `PackageManager \| null` | Detected package manager, or null if no package.json |
| `hasPackageJson` | `boolean` | Whether package.json exists |
| `lockfileFound` | `string \| null` | Path to lockfile if found |

### InstallResult

Result of running dependency installation.

| Field | Type | Description |
|-------|------|-------------|
| `success` | `boolean` | Whether installation succeeded |
| `packageManager` | `PackageManager` | Package manager that was used |
| `exitCode` | `number` | Process exit code |
| `stdout` | `string` | Full stdout output |
| `stderr` | `string` | Full stderr output |
| `duration` | `number` | Installation duration in milliseconds |
| `timedOut` | `boolean` | Whether installation was terminated due to timeout |
| `errorLogPath` | `string \| null` | Path to error log if failed |

### DependencyInstallOptions

Options for the dependency installer.

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `worktreePath` | `string` | (required) | Path to the worktree |
| `skipIfNoPackageJson` | `boolean` | `true` | Skip silently if no package.json |
| `timeoutMs` | `number` | `300000` | Installation timeout in milliseconds (default: 5 minutes) |

### ClaudeLaunchOptions

Options for launching Claude Code.

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `worktreePath` | `string` | (required) | Working directory for Claude |
| `passThruFlags` | `string[]` | `[]` | Flags to pass through to Claude |

### NewCommandOptions (Updated)

Options for the `switchyard new` command.

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `name` | `string` | (required) | Feature name for lane ID |
| `baseBranch` | `string` | `'main'` | Base branch to create from |
| `profile` | `string` | `undefined` | Profile template (server_fly_io, etc.) |
| `gitRoot` | `string` | (required) | Git repository root |
| `json` | `boolean` | `false` | Output as JSON (incompatible with Claude launch) |
| `claudeFlags` | `string[]` | `[]` | Flags to pass through to Claude via `--` separator |

## File Artifacts

### Error Log File

**Path**: `{worktreePath}/.switchyard/dependency-error.log`

**Created**: Only on installation failure

**Format**: Markdown with sections

```markdown
# Dependency Installation Error Log
# Generated: {ISO timestamp}
# Package Manager: {packageManager}
# Working Directory: {worktreePath}
# Exit Code: {exitCode}

## stdout
{full stdout output}

## stderr
{full stderr output}
```

## State Transitions

This feature does not introduce new lane states. It operates during lane creation (before any state transitions).

```
Lane Creation Flow (Updated):
┌──────────────────┐
│ createWorktree() │
└────────┬─────────┘
┌────────────────────────┐
│ detectPackageManager() │
└────────┬───────────────┘
┌────┴────┐
│ │
▼ ▼
[found] [not found]
│ │
▼ │
┌──────────────┐│
│isAvailable() ││
└────────┬─────┘│
┌────┴────┐ │
│ │ │
▼ ▼ │
[yes] [no] │
│ │ │
▼ │ │
┌─────────────────────────┐
│ runInstall() [5m timeout]│
└────┬────────────────────┘
┌┴─────────┐
│ │ │
▼ ▼ ▼
[ok] [fail] [timeout]
│ │ │
│ └──┬──┘
│ ▼
│┌────────────────┐
││writeErrorLog() │
│└────────────────┘
│ │
└───────┘
┌─────────────────────┐
│ isClaudeInstalled() │
└────────┬────────────┘
┌────┴────┐
│ │
▼ ▼
[yes] [no]
│ │
│ ▼
│ ┌─────────────┐
│ │ Error: exit │
│ └─────────────┘
┌─────────────────────────────┐
│ launchClaude(passThruFlags) │
│ (exec - never returns) │
└─────────────────────────────┘
```

## Relationships

- **CreateLaneResult** (existing): Extended with optional `dependencyInstallResult: InstallResult | null`
- **NewCommandOptions** (existing): Extended with `claudeFlags: string[]` for pass-through
- **NewCommandResult** (existing): Not returned when Claude launches (process is replaced)
Loading
Loading