Skip to content

feat(pipeline): add codebase health analysis step#217

Open
nextlevelshit wants to merge 4 commits intomainfrom
207-health-analysis-step
Open

feat(pipeline): add codebase health analysis step#217
nextlevelshit wants to merge 4 commits intomainfrom
207-health-analysis-step

Conversation

@nextlevelshit
Copy link
Collaborator

Summary

  • Add a new internal/health package implementing forge-aware codebase health analysis that produces structured JSON artifacts
  • Implement full GitHub forge analysis covering commit history, open PR status (review state, staleness, comments), open issues (categorization, priorities), and CI/code health signals
  • Add forge detection from git remote URLs with stub implementations for GitLab, Bitbucket, and Gitea forges
  • Add contract schema validation for the health analysis artifact
  • Extend pipeline matrix executor with dependency tiers and child pipeline invocation support

Closes #207

Changes

  • internal/health/types.go — Core data types for the health analysis artifact (commits, PRs, issues, CI status)
  • internal/health/analyzer.go — Main analyzer orchestrating forge detection and analysis execution
  • internal/health/detect.go — Forge type detection from git remote URLs
  • internal/health/github.go — Full GitHub implementation using gh CLI for commit, PR, issue, and CI analysis
  • internal/health/stubs.go — Stub implementations for GitLab, Bitbucket, and Gitea with TODO markers
  • internal/health/schema_test.go — Schema validation tests for the health artifact
  • internal/health/*_test.go — Comprehensive test coverage for all health analysis components
  • .wave/contracts/health-analysis.schema.json — JSON Schema contract for the health analysis artifact
  • internal/pipeline/matrix.go — Extended matrix executor with dependency tier support and child pipeline invocation
  • internal/pipeline/matrix_test.go — Tests for matrix executor enhancements
  • .wave/pipelines/gh-implement-epic.yaml — New epic implementation pipeline leveraging health analysis
  • specs/207-health-analysis-step/ — Specification, plan, and task artifacts for this feature

Test Plan

  • All new code includes table-driven tests with edge case coverage
  • go test ./internal/health/... validates forge detection, GitHub analysis, stub behavior, and schema conformance
  • go test ./internal/pipeline/... validates matrix executor dependency tiers and child invocation
  • go test ./... passes across the full project

Add tiered execution support to MatrixStrategy, enabling items with
dependencies to execute in topologically-sorted tiers. Items within
a tier run in parallel; tiers execute sequentially.

New MatrixStrategy fields:
- item_id_key: dot-path to unique ID field in each item
- dependency_key: dot-path to dependency array in each item
- child_pipeline: name of pipeline to invoke per item (Phase 2)
- input_template: Go template for constructing input (Phase 2)

New MatrixResult fields: Skipped, SkipReason, ItemID

Implementation uses Kahn's algorithm (BFS topological sort) to compute
tiers. Dependency failure propagation skips downstream items but allows
unrelated items to continue.

6 new tests covering independent items, linear chains, diamond
dependencies, dependency failure propagation, cycle detection, and
missing dependency validation.
Add the ability for matrix strategy steps to invoke a full child pipeline
per matrix item instead of executing a single step. This enables the
gh-implement-epic pipeline to fan out gh-implement runs per subissue.

Key additions:
- NewChildExecutor() factory on DefaultPipelineExecutor for independent state
- ChildPipeline field on MatrixStrategy to name or path a child pipeline
- InputTemplate field with Go text/template rendering for item → input
- Refactored tieredExecution to accept a matrixWorkerFunc for reuse
- 5 new tests: LoadsAndExecutes, InputTemplate, WithTiers, PartialFailure, NotFound
New pipeline that consumes gh-scope output and implements all subissues
by fanning out parallel gh-implement child pipeline runs, respecting
the dependency ordering from the scope plan.

Pipeline steps:
- fetch-scope: parse epic's scope comment, extract subissues + deps
- implement-subissues: matrix strategy with child_pipeline + dependency tiers
- report: post implementation summary comment on parent epic

Includes:
- Pipeline YAML with matrix strategy using child_pipeline and dependency_key
- Prompt files for fetch-scope and report steps
- Contract schemas for epic-scope-plan and epic-report
- Mock adapter output for testing (gh-implement-epic routing before gh-implement)
Implement forge-aware repository health analysis producing structured
JSON artifacts. Adds internal/health package with ForgeAnalyzer interface,
GitHub implementation via gh CLI, and stub analyzers for GitLab/Bitbucket/Gitea.

- ForgeType detection from git remote URLs
- GitHub analyzer: commits, PRs, issues, CI status via gh CLI
- Stub analyzers with TODO markers for non-GitHub forges
- JSON Schema contract for health report validation
- Comprehensive test suite with mocked subprocess execution
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.

feat(pipeline): codebase health analysis step — forge-aware repository state artifact

1 participant