Skip to content

implement config and github packages for ralph - #3

Merged
RevCBH merged 22 commits into
mainfrom
RevCBH/ralph-config-v3
Jan 18, 2026
Merged

implement config and github packages for ralph#3
RevCBH merged 22 commits into
mainfrom
RevCBH/ralph-config-v3

Conversation

@RevCBH

@RevCBH RevCBH commented Jan 18, 2026

Copy link
Copy Markdown
Owner

This PR implements the core infrastructure for Ralph:

  • Config package: Configuration loading, validation, and environment overrides
  • GitHub package: Types and client for GitHub PR lifecycle management
  • CLI and orchestrator wiring for component assembly

All worksets completed successfully with full test coverage and validation passing.

RevCBH added 20 commits January 18, 2026 16:18
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
Automated commit by ralph.sh
RevCBH added a commit that referenced this pull request Jan 18, 2026
* ralph: cli/#1 - Root Command and App Struct

Automated commit by ralph.sh

* ralph: cli/#2 - Display Formatting

Automated commit by ralph.sh

* ralph: cli/#3 - Signal Handling

Automated commit by ralph.sh

* ralph: cli/#4 - Version Command

Automated commit by ralph.sh

* ralph: cli/#5 - Status Command

Automated commit by ralph.sh

* ralph: cli/#6 - Run Command

Automated commit by ralph.sh

* ralph: cli/#7 - Resume Command

Automated commit by ralph.sh

* ralph: cli/#8 - Cleanup Command

Automated commit by ralph.sh

* ralph: cli/#9 - Component Wiring

Automated commit by ralph.sh

* ralph: config/#1 - Core Config Types

Automated commit by ralph.sh

* ralph: config/#2 - Config Defaults

Automated commit by ralph.sh

* ralph: config/#3 - Environment Variable Overrides

Automated commit by ralph.sh

* ralph: config/#4 - Config Validation

Automated commit by ralph.sh

* ralph: config/#5 - GitHub Auto-Detection

Automated commit by ralph.sh

* ralph: config/#6 - LoadConfig Function

Automated commit by ralph.sh

* ralph: events/#1 - Event Types

Automated commit by ralph.sh

* ralph: events/#2 - Event Bus

Automated commit by ralph.sh

* ralph: events/#3 - Built-in Handlers

Automated commit by ralph.sh

* ralph: config - Update ralph.log with iteration 4 completion

* Fix PR review feedback: cleanup config and bus data race

- cleanup.go: Load config and use cfg.Worktree.BasePath instead of
  hardcoded .ralph/worktrees path. Repos with custom worktree.base_path
  in .choo.yaml will now be cleaned properly.
- bus.go: Copy handlers slice in dispatch() to prevent data race when
  Subscribe is called concurrently during event dispatch.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2eb9e4f0d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/cli/resume.go Outdated
Comment on lines +70 to +74
// TODO: Load existing state from frontmatter
// For now, create a placeholder discovery to validate the pattern
disc := &discovery.Discovery{
Units: []*discovery.Unit{},
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Load resume state before validation

Resume always constructs an empty discovery.Discovery and immediately validates it, but validateResumeState rejects empty unit lists. As written, choo resume will always return “nothing to resume” even when there is valid persisted state, because no state is ever loaded before the validation call. This makes the resume command unusable for any input.

Useful? React with 👍 / 👎.

Comment thread internal/github/client.go Outdated
Comment on lines +123 to +127
jsonData, err := json.Marshal(body)
if err != nil {
return nil, fmt.Errorf("failed to marshal request body: %w", err)
}
reqBody = bytes.NewReader(jsonData)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset request body on retries

The request body is marshaled once into a bytes.Reader outside the retry loop, and the same reader is reused on every retry. After the first attempt, the reader is at EOF, so retries triggered by 403/429/5xx will send an empty body. That makes retried PATCH/PUT calls (e.g., merge or update) fail or behave incorrectly under rate limiting or transient errors. Recreate or reset the reader inside the retry loop.

Useful? React with 👍 / 👎.

RevCBH and others added 2 commits January 18, 2026 17:27
- resume.go: Load state from filesystem before validation instead of
  creating empty discovery that always fails validation
- client.go: Create fresh bytes.Reader inside retry loop to avoid EOF
  on retried requests
- wire.go: Properly wire GitHub PRClient with correct config mapping

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add .ralph/ to .gitignore and remove tracked log files
- Take main's events package (full implementation)
- Keep PR feedback fixes (resume.go state loading, client.go retry body)
- Properly wire GitHub client with PRClientConfig signature
- Update Close() to match events.Bus signature (no error return)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@RevCBH
RevCBH merged commit cf6bb08 into main Jan 18, 2026
RevCBH added a commit that referenced this pull request Jan 18, 2026
Automated commit by ralph.sh
RevCBH added a commit that referenced this pull request Jan 18, 2026
RevCBH added a commit that referenced this pull request Jan 18, 2026
Automated commit by ralph.sh
RevCBH added a commit that referenced this pull request Jan 18, 2026
Automated commit by ralph.sh
RevCBH added a commit that referenced this pull request Jan 18, 2026
RevCBH added a commit that referenced this pull request Jan 20, 2026
* feat(feature-discovery): complete task #1 - Core Types

* feat(feature-discovery): complete task #2 - Event Types

* feat(feature-discovery): complete task #3 - Frontmatter Parser

* feat(feature-discovery): complete task #4 - PRD Parser

* feat(feature-discovery): complete task #5 - PRD Validator

* feat(feature-discovery): complete task #6 - Discovery Functions

* feat(feature-discovery): complete task #7 - PRD Repository

---------

Co-authored-by: Test User <test@test.com>
RevCBH added a commit that referenced this pull request Jan 20, 2026
* feat(spec-review): complete task #1 - Review Core Types

* feat(spec-review): complete task #2 - Schema Validation

* feat(spec-review): complete task #3 - Review Criteria Definitions

* feat(spec-review): complete task #4 - Review Event Types

* feat(spec-review): complete task #5 - Feedback Application

* feat(spec-review): complete task #6 - Review Loop Orchestration

---------

Co-authored-by: Test User <test@test.com>
RevCBH added a commit that referenced this pull request Jan 20, 2026
* feat(feature-prioritizer): complete task #1 - Prioritization Types

* feat(feature-prioritizer): complete task #2 - PRD Loader

* feat(feature-prioritizer): complete task #4 - Response Parser

* feat(feature-prioritizer): complete task #3 - Prioritizer Core

* feat(feature-prioritizer): complete task #5 - CLI Command

---------

Co-authored-by: Test User <test@test.com>
RevCBH added a commit that referenced this pull request Jan 20, 2026
* feat(feature-workflow): complete task #1 - Feature Status States

* feat(feature-workflow): complete task #2 - Spec Commit Operations

* feat(feature-workflow): complete task #3 - Drift Detection

* feat(feature-workflow): complete task #4 - Auto-Triggered Completion

* feat(feature-workflow): complete task #5 - Review Cycle Management

* feat(feature-workflow): complete task #6 - Workflow Orchestration

---------

Co-authored-by: Test User <test@test.com>
RevCBH pushed a commit that referenced this pull request Jan 20, 2026
RevCBH added a commit that referenced this pull request Jan 20, 2026
* feat(feature-branch): complete task #1 - Feature Types

* feat(feature-branch): complete task #3 - Feature Config

* feat(feature-branch): complete task #2 - Branch Manager

* chore: update status frontmatter

---------

Co-authored-by: Test User <test@test.com>
RevCBH added a commit that referenced this pull request Jan 21, 2026
* specs update

* feat: feature-discovery (#27)

* feat(feature-discovery): complete task #1 - Core Types

* feat(feature-discovery): complete task #2 - Event Types

* feat(feature-discovery): complete task #3 - Frontmatter Parser

* feat(feature-discovery): complete task #4 - PRD Parser

* feat(feature-discovery): complete task #5 - PRD Validator

* feat(feature-discovery): complete task #6 - Discovery Functions

* feat(feature-discovery): complete task #7 - PRD Repository

---------

Co-authored-by: Test User <test@test.com>

* feat: spec-review (#29)

* feat(spec-review): complete task #1 - Review Core Types

* feat(spec-review): complete task #2 - Schema Validation

* feat(spec-review): complete task #3 - Review Criteria Definitions

* feat(spec-review): complete task #4 - Review Event Types

* feat(spec-review): complete task #5 - Feedback Application

* feat(spec-review): complete task #6 - Review Loop Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-prioritizer (#31)

* feat(feature-prioritizer): complete task #1 - Prioritization Types

* feat(feature-prioritizer): complete task #2 - PRD Loader

* feat(feature-prioritizer): complete task #4 - Response Parser

* feat(feature-prioritizer): complete task #3 - Prioritizer Core

* feat(feature-prioritizer): complete task #5 - CLI Command

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-workflow (#32)

* feat(feature-workflow): complete task #1 - Feature Status States

* feat(feature-workflow): complete task #2 - Spec Commit Operations

* feat(feature-workflow): complete task #3 - Drift Detection

* feat(feature-workflow): complete task #4 - Auto-Triggered Completion

* feat(feature-workflow): complete task #5 - Review Cycle Management

* feat(feature-workflow): complete task #6 - Workflow Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-branch (#30)

* feat(feature-branch): complete task #1 - Feature Types

* feat(feature-branch): complete task #3 - Feature Config

* feat(feature-branch): complete task #2 - Branch Manager

* chore: update status frontmatter

---------

Co-authored-by: Test User <test@test.com>

* fix: orchestrator reliability and UX improvements

- Add terminal state guard in scheduler.Complete() to prevent infinite loop
  when UnitCompleted events are re-emitted
- Fix PR existence check to handle empty JSON array response from gh CLI
- Add worktree-aware status refresh so `choo status` shows correct progress
- Auto-detect current branch as default target (instead of always 'main')
- Auto-push target branch if not on remote
- Reorganize PRD docs into docs/prds/ directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve type conflicts from merged feature PRs

- Remove duplicate Client type from git/commit.go (use exec.go's Client)
- Add WorktreePath alias to git.Client for worktree operations
- Rename feature.Status to LifecycleStatus to avoid collision with states.go
- Rename PRD in drift.go to DriftPRD to avoid collision with types.go
- Add NewDriftDetectorFromPRD helper for type conversion
- Remove placeholder BranchManager from workflow.go (use branch.go's impl)
- Add Units field to canonical PRD type for completion tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: update tests for DriftPRD type change

- Update drift_test.go to use DriftPRD and DriftUnit types
- Add SetBody method to DriftDetector for testing
- Update workflow_test.go to use drift.SetBody()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(feature-cli): complete task #1 - Feature State Types

* feat(feature-cli): complete task #2 - PRD Store

* feat(feature-cli): complete task #3 - Feature Parent Command

* feat(feature-cli): complete task #4 - Feature Start Command

* feat(feature-cli): complete task #5 - Feature Status Command

* feat(feature-cli): complete task #6 - Feature Resume Command

* feat: replace PR workflow with local merge for unit branches

This simplifies the orchestrator flow by merging unit branches directly
to the feature branch locally instead of creating PRs.

Key changes:
- Remove PR-related states (pr_open, in_review, merging) from scheduler
- Simplify unit lifecycle: pending -> in_progress -> complete
- Replace createPR() with mergeToFeatureBranch() in worker
- Merge happens locally in main repo (no remote push during execution)
- Add backwards compatibility for old PR status values
- Add UnitMerged event for tracking merge operations

Benefits:
- Dependent units immediately see predecessor code (no PR merge delay)
- Faster execution (no network operations during merge)
- User controls when to push feature branch to remote

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address PR review feedback for feature workflow system

- Rename docs/prds to docs/prd (singular) and update all references
- Fix PRD ID usage: use prd.ID instead of prd.Body in completion.go and workflow.go
- Fix spec commit scope: stage only specsDir instead of entire worktree
- Add git.StagePath() for staging specific paths
- Fix nil agent invoker: add agentInvoker field to App and return clear error
- Add clarifying comment about RepoRoot branch checkout assumption in worker.go
- Update all tests to use correct PRD ID field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve golangci-lint issues

- Fix errcheck: handle error returns in review.go
- Remove unused functions: getTargetBranch, cleanup
- Fix S1009: remove unnecessary nil check before len()
- Fix SA5011: use t.Fatal for nil checks in tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: add baseline checks configuration to .choo.yaml

Mirror CI workflow checks (build, vet, lint, test) in the baseline
configuration for local validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Test User <test@test.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
RevCBH added a commit that referenced this pull request Jan 21, 2026
* specs update

* feat: feature-discovery (#27)

* feat(feature-discovery): complete task #1 - Core Types

* feat(feature-discovery): complete task #2 - Event Types

* feat(feature-discovery): complete task #3 - Frontmatter Parser

* feat(feature-discovery): complete task #4 - PRD Parser

* feat(feature-discovery): complete task #5 - PRD Validator

* feat(feature-discovery): complete task #6 - Discovery Functions

* feat(feature-discovery): complete task #7 - PRD Repository

---------

Co-authored-by: Test User <test@test.com>

* feat: spec-review (#29)

* feat(spec-review): complete task #1 - Review Core Types

* feat(spec-review): complete task #2 - Schema Validation

* feat(spec-review): complete task #3 - Review Criteria Definitions

* feat(spec-review): complete task #4 - Review Event Types

* feat(spec-review): complete task #5 - Feedback Application

* feat(spec-review): complete task #6 - Review Loop Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-prioritizer (#31)

* feat(feature-prioritizer): complete task #1 - Prioritization Types

* feat(feature-prioritizer): complete task #2 - PRD Loader

* feat(feature-prioritizer): complete task #4 - Response Parser

* feat(feature-prioritizer): complete task #3 - Prioritizer Core

* feat(feature-prioritizer): complete task #5 - CLI Command

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-workflow (#32)

* feat(feature-workflow): complete task #1 - Feature Status States

* feat(feature-workflow): complete task #2 - Spec Commit Operations

* feat(feature-workflow): complete task #3 - Drift Detection

* feat(feature-workflow): complete task #4 - Auto-Triggered Completion

* feat(feature-workflow): complete task #5 - Review Cycle Management

* feat(feature-workflow): complete task #6 - Workflow Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-branch (#30)

* feat(feature-branch): complete task #1 - Feature Types

* feat(feature-branch): complete task #3 - Feature Config

* feat(feature-branch): complete task #2 - Branch Manager

* chore: update status frontmatter

---------

Co-authored-by: Test User <test@test.com>

* fix: orchestrator reliability and UX improvements

- Add terminal state guard in scheduler.Complete() to prevent infinite loop
  when UnitCompleted events are re-emitted
- Fix PR existence check to handle empty JSON array response from gh CLI
- Add worktree-aware status refresh so `choo status` shows correct progress
- Auto-detect current branch as default target (instead of always 'main')
- Auto-push target branch if not on remote
- Reorganize PRD docs into docs/prds/ directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve type conflicts from merged feature PRs

- Remove duplicate Client type from git/commit.go (use exec.go's Client)
- Add WorktreePath alias to git.Client for worktree operations
- Rename feature.Status to LifecycleStatus to avoid collision with states.go
- Rename PRD in drift.go to DriftPRD to avoid collision with types.go
- Add NewDriftDetectorFromPRD helper for type conversion
- Remove placeholder BranchManager from workflow.go (use branch.go's impl)
- Add Units field to canonical PRD type for completion tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: update tests for DriftPRD type change

- Update drift_test.go to use DriftPRD and DriftUnit types
- Add SetBody method to DriftDetector for testing
- Update workflow_test.go to use drift.SetBody()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(feature-cli): complete task #1 - Feature State Types

* feat(feature-cli): complete task #2 - PRD Store

* feat(feature-cli): complete task #3 - Feature Parent Command

* feat(feature-cli): complete task #4 - Feature Start Command

* feat(feature-cli): complete task #5 - Feature Status Command

* feat(feature-cli): complete task #6 - Feature Resume Command

* feat: replace PR workflow with local merge for unit branches

This simplifies the orchestrator flow by merging unit branches directly
to the feature branch locally instead of creating PRs.

Key changes:
- Remove PR-related states (pr_open, in_review, merging) from scheduler
- Simplify unit lifecycle: pending -> in_progress -> complete
- Replace createPR() with mergeToFeatureBranch() in worker
- Merge happens locally in main repo (no remote push during execution)
- Add backwards compatibility for old PR status values
- Add UnitMerged event for tracking merge operations

Benefits:
- Dependent units immediately see predecessor code (no PR merge delay)
- Faster execution (no network operations during merge)
- User controls when to push feature branch to remote

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address PR review feedback for feature workflow system

- Rename docs/prds to docs/prd (singular) and update all references
- Fix PRD ID usage: use prd.ID instead of prd.Body in completion.go and workflow.go
- Fix spec commit scope: stage only specsDir instead of entire worktree
- Add git.StagePath() for staging specific paths
- Fix nil agent invoker: add agentInvoker field to App and return clear error
- Add clarifying comment about RepoRoot branch checkout assumption in worker.go
- Update all tests to use correct PRD ID field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve golangci-lint issues

- Fix errcheck: handle error returns in review.go
- Remove unused functions: getTargetBranch, cleanup
- Fix S1009: remove unnecessary nil check before len()
- Fix SA5011: use t.Fatal for nil checks in tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: add baseline checks configuration to .choo.yaml

Mirror CI workflow checks (build, vet, lint, test) in the baseline
configuration for local validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Test User <test@test.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
RevCBH added a commit that referenced this pull request Jan 21, 2026
* specs update

* feat: feature-discovery (#27)

* feat(feature-discovery): complete task #1 - Core Types

* feat(feature-discovery): complete task #2 - Event Types

* feat(feature-discovery): complete task #3 - Frontmatter Parser

* feat(feature-discovery): complete task #4 - PRD Parser

* feat(feature-discovery): complete task #5 - PRD Validator

* feat(feature-discovery): complete task #6 - Discovery Functions

* feat(feature-discovery): complete task #7 - PRD Repository

---------

Co-authored-by: Test User <test@test.com>

* feat: spec-review (#29)

* feat(spec-review): complete task #1 - Review Core Types

* feat(spec-review): complete task #2 - Schema Validation

* feat(spec-review): complete task #3 - Review Criteria Definitions

* feat(spec-review): complete task #4 - Review Event Types

* feat(spec-review): complete task #5 - Feedback Application

* feat(spec-review): complete task #6 - Review Loop Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-prioritizer (#31)

* feat(feature-prioritizer): complete task #1 - Prioritization Types

* feat(feature-prioritizer): complete task #2 - PRD Loader

* feat(feature-prioritizer): complete task #4 - Response Parser

* feat(feature-prioritizer): complete task #3 - Prioritizer Core

* feat(feature-prioritizer): complete task #5 - CLI Command

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-workflow (#32)

* feat(feature-workflow): complete task #1 - Feature Status States

* feat(feature-workflow): complete task #2 - Spec Commit Operations

* feat(feature-workflow): complete task #3 - Drift Detection

* feat(feature-workflow): complete task #4 - Auto-Triggered Completion

* feat(feature-workflow): complete task #5 - Review Cycle Management

* feat(feature-workflow): complete task #6 - Workflow Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-branch (#30)

* feat(feature-branch): complete task #1 - Feature Types

* feat(feature-branch): complete task #3 - Feature Config

* feat(feature-branch): complete task #2 - Branch Manager

* chore: update status frontmatter

---------

Co-authored-by: Test User <test@test.com>

* fix: orchestrator reliability and UX improvements

- Add terminal state guard in scheduler.Complete() to prevent infinite loop
  when UnitCompleted events are re-emitted
- Fix PR existence check to handle empty JSON array response from gh CLI
- Add worktree-aware status refresh so `choo status` shows correct progress
- Auto-detect current branch as default target (instead of always 'main')
- Auto-push target branch if not on remote
- Reorganize PRD docs into docs/prds/ directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve type conflicts from merged feature PRs

- Remove duplicate Client type from git/commit.go (use exec.go's Client)
- Add WorktreePath alias to git.Client for worktree operations
- Rename feature.Status to LifecycleStatus to avoid collision with states.go
- Rename PRD in drift.go to DriftPRD to avoid collision with types.go
- Add NewDriftDetectorFromPRD helper for type conversion
- Remove placeholder BranchManager from workflow.go (use branch.go's impl)
- Add Units field to canonical PRD type for completion tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: update tests for DriftPRD type change

- Update drift_test.go to use DriftPRD and DriftUnit types
- Add SetBody method to DriftDetector for testing
- Update workflow_test.go to use drift.SetBody()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(feature-cli): complete task #1 - Feature State Types

* feat(feature-cli): complete task #2 - PRD Store

* feat(feature-cli): complete task #3 - Feature Parent Command

* feat(feature-cli): complete task #4 - Feature Start Command

* feat(feature-cli): complete task #5 - Feature Status Command

* feat(feature-cli): complete task #6 - Feature Resume Command

* feat: replace PR workflow with local merge for unit branches

This simplifies the orchestrator flow by merging unit branches directly
to the feature branch locally instead of creating PRs.

Key changes:
- Remove PR-related states (pr_open, in_review, merging) from scheduler
- Simplify unit lifecycle: pending -> in_progress -> complete
- Replace createPR() with mergeToFeatureBranch() in worker
- Merge happens locally in main repo (no remote push during execution)
- Add backwards compatibility for old PR status values
- Add UnitMerged event for tracking merge operations

Benefits:
- Dependent units immediately see predecessor code (no PR merge delay)
- Faster execution (no network operations during merge)
- User controls when to push feature branch to remote

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address PR review feedback for feature workflow system

- Rename docs/prds to docs/prd (singular) and update all references
- Fix PRD ID usage: use prd.ID instead of prd.Body in completion.go and workflow.go
- Fix spec commit scope: stage only specsDir instead of entire worktree
- Add git.StagePath() for staging specific paths
- Fix nil agent invoker: add agentInvoker field to App and return clear error
- Add clarifying comment about RepoRoot branch checkout assumption in worker.go
- Update all tests to use correct PRD ID field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve golangci-lint issues

- Fix errcheck: handle error returns in review.go
- Remove unused functions: getTargetBranch, cleanup
- Fix S1009: remove unnecessary nil check before len()
- Fix SA5011: use t.Fatal for nil checks in tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: add baseline checks configuration to .choo.yaml

Mirror CI workflow checks (build, vet, lint, test) in the baseline
configuration for local validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Test User <test@test.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
RevCBH added a commit that referenced this pull request Jan 21, 2026
* specs update

* feat: feature-discovery (#27)

* feat(feature-discovery): complete task #1 - Core Types

* feat(feature-discovery): complete task #2 - Event Types

* feat(feature-discovery): complete task #3 - Frontmatter Parser

* feat(feature-discovery): complete task #4 - PRD Parser

* feat(feature-discovery): complete task #5 - PRD Validator

* feat(feature-discovery): complete task #6 - Discovery Functions

* feat(feature-discovery): complete task #7 - PRD Repository

---------

Co-authored-by: Test User <test@test.com>

* feat: spec-review (#29)

* feat(spec-review): complete task #1 - Review Core Types

* feat(spec-review): complete task #2 - Schema Validation

* feat(spec-review): complete task #3 - Review Criteria Definitions

* feat(spec-review): complete task #4 - Review Event Types

* feat(spec-review): complete task #5 - Feedback Application

* feat(spec-review): complete task #6 - Review Loop Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-prioritizer (#31)

* feat(feature-prioritizer): complete task #1 - Prioritization Types

* feat(feature-prioritizer): complete task #2 - PRD Loader

* feat(feature-prioritizer): complete task #4 - Response Parser

* feat(feature-prioritizer): complete task #3 - Prioritizer Core

* feat(feature-prioritizer): complete task #5 - CLI Command

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-workflow (#32)

* feat(feature-workflow): complete task #1 - Feature Status States

* feat(feature-workflow): complete task #2 - Spec Commit Operations

* feat(feature-workflow): complete task #3 - Drift Detection

* feat(feature-workflow): complete task #4 - Auto-Triggered Completion

* feat(feature-workflow): complete task #5 - Review Cycle Management

* feat(feature-workflow): complete task #6 - Workflow Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-branch (#30)

* feat(feature-branch): complete task #1 - Feature Types

* feat(feature-branch): complete task #3 - Feature Config

* feat(feature-branch): complete task #2 - Branch Manager

* chore: update status frontmatter

---------

Co-authored-by: Test User <test@test.com>

* fix: orchestrator reliability and UX improvements

- Add terminal state guard in scheduler.Complete() to prevent infinite loop
  when UnitCompleted events are re-emitted
- Fix PR existence check to handle empty JSON array response from gh CLI
- Add worktree-aware status refresh so `choo status` shows correct progress
- Auto-detect current branch as default target (instead of always 'main')
- Auto-push target branch if not on remote
- Reorganize PRD docs into docs/prds/ directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve type conflicts from merged feature PRs

- Remove duplicate Client type from git/commit.go (use exec.go's Client)
- Add WorktreePath alias to git.Client for worktree operations
- Rename feature.Status to LifecycleStatus to avoid collision with states.go
- Rename PRD in drift.go to DriftPRD to avoid collision with types.go
- Add NewDriftDetectorFromPRD helper for type conversion
- Remove placeholder BranchManager from workflow.go (use branch.go's impl)
- Add Units field to canonical PRD type for completion tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: update tests for DriftPRD type change

- Update drift_test.go to use DriftPRD and DriftUnit types
- Add SetBody method to DriftDetector for testing
- Update workflow_test.go to use drift.SetBody()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(feature-cli): complete task #1 - Feature State Types

* feat(feature-cli): complete task #2 - PRD Store

* feat(feature-cli): complete task #3 - Feature Parent Command

* feat(feature-cli): complete task #4 - Feature Start Command

* feat(feature-cli): complete task #5 - Feature Status Command

* feat(feature-cli): complete task #6 - Feature Resume Command

* feat: replace PR workflow with local merge for unit branches

This simplifies the orchestrator flow by merging unit branches directly
to the feature branch locally instead of creating PRs.

Key changes:
- Remove PR-related states (pr_open, in_review, merging) from scheduler
- Simplify unit lifecycle: pending -> in_progress -> complete
- Replace createPR() with mergeToFeatureBranch() in worker
- Merge happens locally in main repo (no remote push during execution)
- Add backwards compatibility for old PR status values
- Add UnitMerged event for tracking merge operations

Benefits:
- Dependent units immediately see predecessor code (no PR merge delay)
- Faster execution (no network operations during merge)
- User controls when to push feature branch to remote

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address PR review feedback for feature workflow system

- Rename docs/prds to docs/prd (singular) and update all references
- Fix PRD ID usage: use prd.ID instead of prd.Body in completion.go and workflow.go
- Fix spec commit scope: stage only specsDir instead of entire worktree
- Add git.StagePath() for staging specific paths
- Fix nil agent invoker: add agentInvoker field to App and return clear error
- Add clarifying comment about RepoRoot branch checkout assumption in worker.go
- Update all tests to use correct PRD ID field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve golangci-lint issues

- Fix errcheck: handle error returns in review.go
- Remove unused functions: getTargetBranch, cleanup
- Fix S1009: remove unnecessary nil check before len()
- Fix SA5011: use t.Fatal for nil checks in tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: add baseline checks configuration to .choo.yaml

Mirror CI workflow checks (build, vet, lint, test) in the baseline
configuration for local validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Test User <test@test.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
RevCBH added a commit that referenced this pull request Jan 21, 2026
* specs update

* feat: feature-discovery (#27)

* feat(feature-discovery): complete task #1 - Core Types

* feat(feature-discovery): complete task #2 - Event Types

* feat(feature-discovery): complete task #3 - Frontmatter Parser

* feat(feature-discovery): complete task #4 - PRD Parser

* feat(feature-discovery): complete task #5 - PRD Validator

* feat(feature-discovery): complete task #6 - Discovery Functions

* feat(feature-discovery): complete task #7 - PRD Repository

---------

Co-authored-by: Test User <test@test.com>

* feat: spec-review (#29)

* feat(spec-review): complete task #1 - Review Core Types

* feat(spec-review): complete task #2 - Schema Validation

* feat(spec-review): complete task #3 - Review Criteria Definitions

* feat(spec-review): complete task #4 - Review Event Types

* feat(spec-review): complete task #5 - Feedback Application

* feat(spec-review): complete task #6 - Review Loop Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-prioritizer (#31)

* feat(feature-prioritizer): complete task #1 - Prioritization Types

* feat(feature-prioritizer): complete task #2 - PRD Loader

* feat(feature-prioritizer): complete task #4 - Response Parser

* feat(feature-prioritizer): complete task #3 - Prioritizer Core

* feat(feature-prioritizer): complete task #5 - CLI Command

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-workflow (#32)

* feat(feature-workflow): complete task #1 - Feature Status States

* feat(feature-workflow): complete task #2 - Spec Commit Operations

* feat(feature-workflow): complete task #3 - Drift Detection

* feat(feature-workflow): complete task #4 - Auto-Triggered Completion

* feat(feature-workflow): complete task #5 - Review Cycle Management

* feat(feature-workflow): complete task #6 - Workflow Orchestration

---------

Co-authored-by: Test User <test@test.com>

* feat: feature-branch (#30)

* feat(feature-branch): complete task #1 - Feature Types

* feat(feature-branch): complete task #3 - Feature Config

* feat(feature-branch): complete task #2 - Branch Manager

* chore: update status frontmatter

---------

Co-authored-by: Test User <test@test.com>

* fix: orchestrator reliability and UX improvements

- Add terminal state guard in scheduler.Complete() to prevent infinite loop
  when UnitCompleted events are re-emitted
- Fix PR existence check to handle empty JSON array response from gh CLI
- Add worktree-aware status refresh so `choo status` shows correct progress
- Auto-detect current branch as default target (instead of always 'main')
- Auto-push target branch if not on remote
- Reorganize PRD docs into docs/prds/ directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve type conflicts from merged feature PRs

- Remove duplicate Client type from git/commit.go (use exec.go's Client)
- Add WorktreePath alias to git.Client for worktree operations
- Rename feature.Status to LifecycleStatus to avoid collision with states.go
- Rename PRD in drift.go to DriftPRD to avoid collision with types.go
- Add NewDriftDetectorFromPRD helper for type conversion
- Remove placeholder BranchManager from workflow.go (use branch.go's impl)
- Add Units field to canonical PRD type for completion tracking

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: update tests for DriftPRD type change

- Update drift_test.go to use DriftPRD and DriftUnit types
- Add SetBody method to DriftDetector for testing
- Update workflow_test.go to use drift.SetBody()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(feature-cli): complete task #1 - Feature State Types

* feat(feature-cli): complete task #2 - PRD Store

* feat(feature-cli): complete task #3 - Feature Parent Command

* feat(feature-cli): complete task #4 - Feature Start Command

* feat(feature-cli): complete task #5 - Feature Status Command

* feat(feature-cli): complete task #6 - Feature Resume Command

* feat: replace PR workflow with local merge for unit branches

This simplifies the orchestrator flow by merging unit branches directly
to the feature branch locally instead of creating PRs.

Key changes:
- Remove PR-related states (pr_open, in_review, merging) from scheduler
- Simplify unit lifecycle: pending -> in_progress -> complete
- Replace createPR() with mergeToFeatureBranch() in worker
- Merge happens locally in main repo (no remote push during execution)
- Add backwards compatibility for old PR status values
- Add UnitMerged event for tracking merge operations

Benefits:
- Dependent units immediately see predecessor code (no PR merge delay)
- Faster execution (no network operations during merge)
- User controls when to push feature branch to remote

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address PR review feedback for feature workflow system

- Rename docs/prds to docs/prd (singular) and update all references
- Fix PRD ID usage: use prd.ID instead of prd.Body in completion.go and workflow.go
- Fix spec commit scope: stage only specsDir instead of entire worktree
- Add git.StagePath() for staging specific paths
- Fix nil agent invoker: add agentInvoker field to App and return clear error
- Add clarifying comment about RepoRoot branch checkout assumption in worker.go
- Update all tests to use correct PRD ID field

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve golangci-lint issues

- Fix errcheck: handle error returns in review.go
- Remove unused functions: getTargetBranch, cleanup
- Fix S1009: remove unnecessary nil check before len()
- Fix SA5011: use t.Fatal for nil checks in tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: add baseline checks configuration to .choo.yaml

Mirror CI workflow checks (build, vet, lint, test) in the baseline
configuration for local validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Test User <test@test.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
RevCBH pushed a commit that referenced this pull request Jan 21, 2026
RevCBH pushed a commit that referenced this pull request Jan 21, 2026
RevCBH pushed a commit that referenced this pull request Jan 21, 2026
RevCBH pushed a commit that referenced this pull request Jan 21, 2026
RevCBH pushed a commit that referenced this pull request Jan 21, 2026
RevCBH pushed a commit that referenced this pull request Jan 21, 2026
RevCBH pushed a commit that referenced this pull request Jan 21, 2026
RevCBH pushed a commit that referenced this pull request Jan 21, 2026
RevCBH pushed a commit that referenced this pull request Jan 21, 2026
RevCBH added a commit that referenced this pull request Jan 21, 2026
* feat: add daemon architecture specs with consistency fixes

Add comprehensive specs and tasks for the daemon subsystem:
- DAEMON-CORE: Process lifecycle, job manager, resume logic
- DAEMON-CLI: CLI commands for daemon and job management
- DAEMON-CLIENT: gRPC client wrapper for CLI communication
- DAEMON-GRPC: Protocol buffer definitions and server implementation
- DAEMON-DB: SQLite persistence layer for state storage

Key consistency fixes applied during review:
- Standardized socket path to ~/.choo/daemon.sock across all specs
- Aligned gRPC RPC name to WatchJob (was StreamEvents in DAEMON-CORE)
- Simplified UnitStatus enum: removed pr_open, aligned naming
  (running vs in_progress, completed vs complete)
- Added fromSeq parameter to WatchJob for sequence-based resumption
- Fixed DefaultConfig() to return error for home directory lookup
- Added DaemonVersion field to Run record for resume validation

Also moves completed feature specs to specs/completed/ directory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(daemon-db): complete task #1 - Types and Constants

* feat(daemon-db): complete task #2 - Connection and Migrations

* feat(daemon-db): complete task #3 - Run CRUD Operations

* feat(daemon-db): complete task #4 - Unit CRUD Operations

* feat(daemon-db): complete task #5 - Event Logging Operations

* feat(daemon-db): complete task #6 - Integration Tests

* feat(daemon-grpc): complete task #1 - Protocol Buffer Definitions

* feat(daemon-grpc): complete task #2 - gRPC Server Types

* feat(daemon-grpc): complete task #3 - Job Lifecycle RPCs

* feat(daemon-grpc): complete task #4 - WatchJob Event Streaming

* feat(daemon-grpc): complete task #5 - Daemon Lifecycle RPCs

* specs

* feat(daemon-grpc): complete task #6 - Unix Domain Socket Server

* feat(daemon-grpc): complete task #7 - Integration Tests

* ideas for future work and issues

* feat(daemon-grpc): complete task #1 - Protocol Buffer Definitions

* feat(daemon-grpc): complete task #2 - gRPC Server Types

* feat(daemon-grpc): complete task #3 - Job Lifecycle RPCs

* feat(daemon-grpc): complete task #4 - WatchJob Event Streaming

* feat(daemon-grpc): complete task #5 - Daemon Lifecycle RPCs

* feat(daemon-grpc): complete task #6 - Unix Domain Socket Server

* feat(daemon-grpc): complete task #7 - Integration Tests

* feat(daemon-client): complete task #1 - Client Types

* feat(daemon-client): complete task #2 - Protobuf Conversion

* feat(daemon-client): complete task #3 - Connection Management

* feat(daemon-client): complete task #4 - Job Lifecycle Methods

* feat(daemon-client): complete task #6 - Health and Shutdown

* feat(daemon-client): complete task #5 - Event Streaming

* feat(daemon-grpc): complete task #1 - Protocol Buffer Definitions

* feat(daemon-grpc): complete task #2 - gRPC Server Types

* feat(daemon-grpc): complete task #3 - Job Lifecycle RPCs

* feat(daemon-grpc): complete task #4 - WatchJob Event Streaming

* feat(daemon-grpc): complete task #5 - Daemon Lifecycle RPCs

* feat(daemon-grpc): complete task #6 - Unix Domain Socket Server

* feat(daemon-grpc): complete task #7 - Integration Tests

* feat(daemon-core): complete task #1 - Daemon Configuration

* feat(daemon-core): complete task #2 - PID File Utilities

* feat(daemon-core): complete task #3 - Job Manager Types

* feat(daemon-core): complete task #4 - Job Manager Core

* feat(daemon-core): complete task #5 - Job Event Subscription

* feat(daemon-core): complete task #6 - Job Resume Logic

* feat(daemon-core): complete task #7 - Daemon Lifecycle

* feat(daemon-grpc): complete task #1 - Protocol Buffer Definitions

* feat(daemon-grpc): complete task #2 - gRPC Server Types

* feat(daemon-grpc): complete task #3 - Job Lifecycle RPCs

* feat(daemon-grpc): complete task #4 - WatchJob Event Streaming

* feat(daemon-grpc): complete task #5 - Daemon Lifecycle RPCs

* feat(daemon-grpc): complete task #6 - Unix Domain Socket Server

* feat(daemon-grpc): complete task #7 - Integration Tests

* ideas for future work and issues

* feat(daemon-client): complete task #1 - Client Types

* feat(daemon-client): complete task #2 - Protobuf Conversion

* feat(daemon-client): complete task #3 - Connection Management

* feat(daemon-client): complete task #4 - Job Lifecycle Methods

* feat(daemon-client): complete task #6 - Health and Shutdown

* feat(daemon-client): complete task #5 - Event Streaming

* feat(daemon-core): complete task #1 - Daemon Configuration

* feat(daemon-core): complete task #2 - PID File Utilities

* feat(daemon-core): complete task #3 - Job Manager Types

* feat(daemon-core): complete task #4 - Job Manager Core

* feat(daemon-core): complete task #5 - Job Event Subscription

* feat(daemon-core): complete task #6 - Job Resume Logic

* feat(daemon-core): complete task #7 - Daemon Lifecycle

* feat(daemon-cli): complete task #1 - Display Helpers

* feat(daemon-cli): complete task #2 - Daemon Commands

* feat(daemon-cli): complete task #3 - Jobs Command

* feat(daemon-cli): complete task #4 - Watch Command

* feat(daemon-cli): complete task #5 - Stop Command

* feat(daemon-cli): complete task #6 - Run Command Daemon Mode

* fix(cli): add --use-daemon=false to TestRunCmd_Integration

The test was failing because it tried to connect to the daemon by default
(--use-daemon=true is the default) but no daemon was running. Adding
--use-daemon=false makes the test use inline mode like TestRunCmd_UseDaemonFalse.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve lint errors from golangci-lint

- Fix errcheck: handle tx.Rollback() error in db/events.go
- Fix errcheck: handle pidFile.Release() error in daemon.go
- Fix unused: remove unused Subscription struct and cancel field in job_events.go
- Fix unused: remove unused formatDuration function in daemon_display.go
- Fix gosimple S1000: use for range instead of for { select {} } in grpc.go
- Fix staticcheck SA1019: replace deprecated grpc.Dial with grpc.NewClient
- Fix staticcheck SA9003: add explicit no-op in empty select branch
- Fix staticcheck SA4011: use labeled break for outer loop in test

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve remaining staticcheck SA9003 and SA4011 warnings

- Add comments to empty default branches in select statements to make
  intent explicit (SA9003):
  - orchestrator.go: continue - not shutting down
  - integration_test.go: no error yet - continue checking
  - socket.go: continue accepting connections
  - workflow_test.go: channel full - drop event
- Fix ineffective break in pusher.go by using labeled break (SA4011)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: upgrade golangci-lint to v2.8.0 for Go 1.24 support

- Update CI to use go-version-file instead of hardcoded version
- Migrate .golangci.yml to v2 format (requires version: "2")
- Add Makefile lint targets for local development
- Configure staticcheck to only run SA checks (not ST/QF)
- Add exclude-functions for common unchecked errors
- Fix SA9003 empty branch in resume.go

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: resolve CI failures

- Update golangci-lint-action from v6 to v7 (required for golangci-lint v2.x)
- Fix data race in mockJobManager by adding mutex synchronization
- Add setJobStatus method for thread-safe status updates in tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore: add pre-push hook and check target

- Add scripts/pre-push hook that runs build, vet, lint, and test
- Add 'make check' target to run all CI checks locally
- Add 'make install-hooks' to configure git to use scripts/ as hooks path
- Add 'make vet' target

Run 'make install-hooks' to enable pre-push checks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Test User <test@test.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
RevCBH pushed a commit that referenced this pull request Jan 22, 2026
RevCBH pushed a commit that referenced this pull request Jan 22, 2026
RevCBH added a commit that referenced this pull request Jan 22, 2026
* specs

* feat(reviewer-interface): complete task #1 - Reviewer Interface and Types

* feat(review-config): complete task #2 - CodeReviewConfig Validation and Integration

* feat(codex-reviewer): complete task #2 - Codex Output Parser

* feat(claude-reviewer): complete task #2 - Review Prompt Builder

* feat(claude-reviewer): complete task #1 - ClaudeReviewer Implementation

* feat(claude-reviewer): complete task #3 - JSON Extraction and Output Parsing

* feat(review-worker): complete task #1 - Code Review Event Types

* feat(review-worker): complete task #2 - Review Orchestration

* feat(review-worker): complete task #3 - Review Fix Loop

* feat(review-worker): complete task #4 - Commit and Cleanup Operations

* feat(review-wiring): complete task #1 - Reviewer Resolution and Injection

* feat(review-wiring): replace logReviewPlaceholder with runCodeReview in merge flow

* test(review-wiring): add integration tests for review in merge flow

* fix(review-wiring): update TestRunCodeReview_IssuesFound to expect fix_attempt event

* feat(review-wiring): mark task #2 as complete

* fix(claude-reviewer): return errors for parsing failures instead of Passed:true

Parsing failures in the Claude reviewer were incorrectly marked as
Passed:true, which masked failures and caused CodeReviewPassed events
to be emitted instead of CodeReviewFailed. This could skip fix attempts
when they should have been triggered.

Now parseOutput returns errors for:
- No JSON found in review output
- JSON unmarshaling failures

The caller in review.go already handles these gracefully by logging
the error, emitting CodeReviewFailed, and proceeding to merge.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(worker): prevent tests from running git commands on actual repo

- Add guard to cleanupWorktree() to skip when worktreePath is empty
- Add Bus.Wait() and EventCollector for thread-safe event collection in tests
- Update review_test.go and worker_test.go to use new thread-safe patterns
- Add PRD for safe git operations interface refactoring

Root cause: Tests with MaxFixIterations>0 but no worktreePath would trigger
cleanupWorktree(), which ran git checkout/reset/clean in the current
working directory (the actual repo), reverting uncommitted changes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(prd): mark code-review as completed, add frontmatter to safe-git-operations

- CODE-REVIEW.md: status changed to completed
- safe-git-operations.md: added proper frontmatter and document info

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test: use setupTestRepo for review fix loop

---------

Co-authored-by: Test User <test@test.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
RevCBH added a commit that referenced this pull request Jan 22, 2026
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