Files
code-crispies/.wave/pipelines/impl-feature.yaml

215 lines
5.8 KiB
YAML

kind: WavePipeline
metadata:
name: impl-feature
description: "Plan, implement, test, and commit a feature to a new branch"
release: true
skills:
- "{{ project.skill }}"
- software-design
input:
source: cli
example: "add a --dry-run flag to the run command"
steps:
- id: explore
persona: navigator
model: claude-haiku
workspace:
mount:
- source: ./
target: /project
mode: readonly
exec:
type: prompt
source: |
Explore the codebase to plan this feature: {{ input }}
## Exploration
1. **Understand the request**: What is being asked? Assess scope
(small = 1-2 files, medium = 3-7, large = 8+).
2. **Find related code**: Use Glob and Grep to find files related
to the feature. Note paths, relevance, and key symbols.
3. **Identify patterns**: Read key files. Document conventions that
must be followed (naming, error handling, testing patterns).
4. **Map affected modules**: Which packages are directly/indirectly affected?
5. **Survey tests**: Find related test files, testing patterns, gaps.
6. **Assess risks**: Breaking changes, performance, security implications.
Produce a structured JSON result matching the contract schema.
output_artifacts:
- name: exploration
path: .wave/output/exploration.json
type: json
retry:
policy: patient
max_attempts: 2
handover:
contract:
type: json_schema
source: .wave/output/exploration.json
schema_path: .wave/contracts/feature-exploration.schema.json
on_failure: retry
- id: plan
persona: planner
dependencies: [explore]
memory:
inject_artifacts:
- step: explore
artifact: exploration
as: context
workspace:
mount:
- source: ./
target: /project
mode: readonly
exec:
type: prompt
source: |
Create an implementation plan for this feature.
Feature: {{ input }}
The codebase exploration has been injected into your workspace. Read it first.
Break the feature into ordered implementation steps:
1. For each step: what to do, which files to modify, acceptance criteria
2. Dependencies between steps
3. What tests to write
4. Complexity estimate per step (S/M/L)
Produce a structured JSON result matching the contract schema.
output_artifacts:
- name: plan
path: .wave/output/plan.json
type: json
retry:
policy: standard
max_attempts: 2
handover:
contract:
type: json_schema
source: .wave/output/plan.json
schema_path: .wave/contracts/feature-plan.schema.json
on_failure: retry
- id: implement
persona: craftsman
dependencies: [plan]
memory:
inject_artifacts:
- step: explore
artifact: exploration
as: context
- step: plan
artifact: plan
as: impl_plan
workspace:
type: worktree
branch: "feat/{{ pipeline_id }}"
exec:
type: prompt
source: |
Implement the feature on this isolated worktree branch.
The codebase exploration and implementation plan have been injected into your
workspace. Read them both before starting.
Feature: {{ input }}
## Process
1. **Implement step by step** following the plan:
- Follow existing codebase patterns identified in exploration
- Write tests alongside implementation
- After each significant change, verify it compiles
2. Run the full test suite and fix any failures before proceeding.
3. **Commit**:
```bash
git add <specific-files>
git commit -m "<commit_message_suggestion from plan>
Implementation following plan:
- S01: <title>
- S02: <title>
..."
```
Commit changes to the worktree branch.
retry:
policy: standard
max_attempts: 3
handover:
contract:
type: test_suite
command: "{{ project.test_command }}"
must_pass: true
on_failure: retry
compaction:
trigger: "token_limit_80%"
persona: summarizer
output_artifacts:
- name: result
path: .wave/output/result.md
type: markdown
# ── Publish ─────────────────────────────────────────────────────────
- id: publish
persona: craftsman
dependencies: [implement]
memory:
inject_artifacts:
- step: implement
artifact: result
as: result
workspace:
type: worktree
branch: "feat/{{ pipeline_id }}"
exec:
type: prompt
source: |
PUBLISH — push the branch and create a pull request.
## Steps
1. Push the branch:
```bash
git push -u origin HEAD
```
2. Create a pull request using the implementation result as context:
```bash
COMMIT_SUBJECT=$(git log --format=%s -1)
{{ forge.cli_tool }} {{ forge.pr_command }} create --title "feat: $COMMIT_SUBJECT" --body-file .wave/artifacts/result
```
output_artifacts:
- name: pr-result
path: .wave/output/pr-result.json
type: json
retry:
policy: aggressive
max_attempts: 2
handover:
contract:
type: json_schema
source: .wave/output/pr-result.json
schema_path: .wave/contracts/pr-result.schema.json
must_pass: true
on_failure: retry
outcomes:
- type: pr
extract_from: .wave/output/pr-result.json
json_path: .pr_url
label: "Pull Request"