Skip to content

feat: implement wave ops commands (status, logs, cancel, artifacts)#1

Merged
nextlevelshit merged 19 commits intomainfrom
016-wave-ops-commands
Feb 2, 2026
Merged

feat: implement wave ops commands (status, logs, cancel, artifacts)#1
nextlevelshit merged 19 commits intomainfrom
016-wave-ops-commands

Conversation

@nextlevelshit
Copy link
Collaborator

@nextlevelshit nextlevelshit commented Feb 2, 2026

Summary

Implements spec 016-wave-ops-commands, adding operational commands for pipeline monitoring and management.

New Commands

  • wave status [run-id] - Show pipeline status (running, recent with --all, specific run details)
  • wave logs [run-id] - View event logs with --follow, --tail, --errors, --step, --since filters
  • wave cancel [run-id] - Cancel pipelines (graceful or --force for SIGKILL)
  • wave artifacts [run-id] - List and export artifacts with --type, --step, --export options
  • wave list runs - List recent pipeline runs with --limit, --run-pipeline, --run-status filters

Enhanced Commands

  • wave clean - Added --older-than, --status, --quiet flags with path traversal protection

StateStore Extensions

  • New types: RunRecord, LogRecord, ArtifactRecord, CancellationRecord
  • 14 new methods for run tracking, event logging, artifact registration, and cancellation

Schema Additions

  • pipeline_run table with status tracking
  • event_log table for NDJSON events
  • artifact table for produced files
  • cancellation table for cancel requests

Implementation Details

  • All commands support --format json for scripting
  • Color-coded status output (yellow=running, green=completed, red=failed)
  • SQLite with WAL mode for concurrent access
  • Process group termination with SIGTERM/SIGKILL fallback

Test plan

  • All tests pass with race detector (go test -race ./...)
  • State package tests: 100% coverage on new methods
  • Command tests: 87-100% coverage across new commands
  • Concurrent access tests for SQLite operations
  • Extended review completed by 4 specialized agents (code quality, security, test coverage, API consistency)

Review Summary

Review Status Notes
Code Quality WARN Minor issues documented
Security PASS Path traversal fix applied
Test Coverage 87-100% Good to Excellent
API Consistency WARN Minor inconsistencies documented

Add specification for new operational commands:
- wave ps: view pipeline status
- wave logs: view execution logs with --follow support
- wave attach/stop: detached pipeline management
- wave health: system health checks

Includes 4 user stories (P1-P3), 22 functional requirements,
and 6 measurable success criteria.
Initial plan.md template for 016-wave-ops-commands feature.
To be completed with technical context and design decisions.
Update steps 2-4 (hypothesize, investigate, fix) to explicitly tell
Claude to read from the artifacts/ directory where injected artifacts
are placed. Previously, steps would ask for context instead of reading
the available artifacts.
When CommandArgs is not provided, the test_suite validator now
splits the Command string using strings.Fields() to extract the
executable and arguments. This allows users to write natural
commands like "go test ./... -v" instead of requiring separate
command and command_args fields.

Previously, the entire command string was passed as the executable
name to exec.Command(), causing "no such file or directory" errors.
When ResultContent is empty (due to relay compaction, parsing failures,
or adapter issues), skip writing output artifacts to preserve any
existing content. This prevents a regression where artifacts get
overwritten with empty content during token limit scenarios.

Added regression test to verify existing artifact content is preserved
when ResultContent is empty.
Add Claude Code command files for BMAD (Build Measure Analyze Design)
workflow integration:
- bmad.architecture - Create technical architecture from PRD
- bmad.code-review - Validate code quality with review checklist
- bmad.dev-story - Implement a single story from spec
- bmad.epics - Create epic and story breakdown from architecture
- bmad.help - Get contextual BMAD guidance
- bmad.party - Multi-agent collaborative session
- bmad.prd - Create Product Requirements Document
- bmad.product-brief - Define problem, users, and MVP scope
- bmad.quick-spec - Analyze codebase and produce tech-spec
- bmad.sprint - Initialize sprint tracking
- bmad.story - Create detailed story specification
Add supporting bash scripts for BMAD workflow:
- bmad-quick-spec.sh - Quick path to generate tech specs
- bmad-review.sh - Code review automation
- bmad-setup.sh - Initialize BMAD project structure
- bmad-sprint.sh - Sprint tracking initialization
Add templates for BMAD workflow documentation:
- Product brief template
- PRD (Product Requirements Document) template
- Architecture document template
- Epic and story templates
- Sprint tracking templates
Add Claude Code command files for OpenSpec change management:
- opsx.new - Create a new change proposal
- opsx.ff - Fast-forward to generate design and tasks
- opsx.apply - Execute implementation tasks
- opsx.archive - Archive completed changes
- opsx.onboard - Get started guide with workflow overview
Add supporting bash scripts for OpenSpec workflow:
- opsx-new.sh - Create change proposal with directory structure
- opsx-ff.sh - Fast-forward to generate design and tasks docs
- opsx-apply.sh - Prepare context for task execution
- opsx-archive.sh - Archive completed changes
Add templates for OpenSpec change management:
- proposal.md - Change proposal with requirements and success criteria
- design.md - Technical design document with architecture
- tasks.md - Implementation task list with dependencies
Add additional test files for relay package:
- relay_benchmark_test.go - Performance benchmarks
- relay_concurrency_test.go - Concurrent access tests
- relay_edge_cases_test.go - Edge case handling
- relay_stress_test.go - Stress testing under load
Complete feature specification for Wave operational commands:
- spec.md: 6 user stories (status, logs, clean, list runs, cancel, artifacts)
- clarifications.md: 8 resolved design questions
- plan.md: 8-phase implementation plan
- tasks.md: 19 tasks with dependencies (38-50 hours estimated)
- research.md: Codebase analysis with file:line references
- checklists/implementation.md: Pre/post implementation checklist
- quickstart.md: User guide with examples

Key decisions resolved:
- Log levels: --level all|info|error with --errors alias
- Cancel: Database flag (graceful) + SIGTERM/SIGKILL (force)
- Cleanup: Confirmation prompts, --force for CI, no daemon
- Storage: SQLite event_log table for consistency
Add new operational commands for pipeline monitoring and management:

- wave status: Show pipeline status (running, recent, by run-id)
- wave logs: View pipeline event logs with filtering and follow mode
- wave cancel: Cancel running pipelines (graceful and force modes)
- wave artifacts: List and export pipeline artifacts

Enhanced existing commands:
- wave clean: Add --older-than, --status, --quiet flags with path traversal protection
- wave list: Add runs subcommand for listing pipeline runs

StateStore extensions:
- New types: RunRecord, LogRecord, ArtifactRecord, CancellationRecord
- New methods: CreateRun, UpdateRunStatus, GetRun, GetRunningRuns, ListRuns,
  DeleteRun, LogEvent, GetEvents, RegisterArtifact, GetArtifacts,
  RequestCancellation, CheckCancellation, ClearCancellation

Schema additions:
- pipeline_run table with status tracking
- event_log table for NDJSON events
- artifact table for produced files
- cancellation table for cancel requests

All commands support --format json for scripting integration.
Tests pass with race detector.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request implements Wave operational commands for pipeline monitoring and management, adding capabilities for status checking, log viewing, pipeline cancellation, and artifact inspection as specified in spec 016-wave-ops-commands.

Changes:

  • Added five new commands: status, logs, cancel, artifacts, and enhanced clean with new filtering options
  • Extended state database schema with four new tables: pipeline_run, event_log, artifact, and cancellation
  • Implemented list runs subcommand for viewing recent pipeline executions
  • Enhanced pipeline executor to prevent overwriting artifacts with empty content during relay compaction

Reviewed changes

Copilot reviewed 70 out of 71 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
specs/016-wave-ops-commands/* Complete specification with user stories, clarifications, and implementation checklists
internal/state/types.go New types for run records, logs, artifacts, and cancellation tracking
internal/state/schema.sql Database schema additions for ops commands with proper indexing
cmd/wave/commands/cancel.go Cancel command with graceful and force termination support
cmd/wave/commands/artifacts.go Artifacts listing and export functionality
cmd/wave/commands/list.go Enhanced with runs subcommand for pipeline execution history
cmd/wave/commands/clean_test.go Extended tests for new clean command flags
internal/pipeline/executor.go Fix to preserve existing artifacts when ResultContent is empty
internal/contract/testsuite.go Command string parsing improvements
README.md Updated documentation with new commands and examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… entropy

- Cancel command now returns Success: false when there are no running
  pipelines to cancel (was incorrectly returning Success: true)
- Run ID suffix now uses crypto/rand for better collision resistance
  instead of truncated nanoseconds
- Validate runID in forceKillRun to prevent path traversal
- Validate artifact paths are within workspace before export
@nextlevelshit nextlevelshit merged commit 07bd812 into main Feb 2, 2026
@nextlevelshit nextlevelshit deleted the 016-wave-ops-commands branch February 2, 2026 19:11
nextlevelshit added a commit that referenced this pull request Feb 23, 2026
Strip 130+ violations of CLAUDE.md rule #1 across 24 pipeline YAML
files and 12 prompt templates. The executor now handles artifact
injection and output path guidance via buildContractPrompt, so prompts
no longer need to specify where to read/write.

Removed: output path directives, artifact read instructions, inline
JSON schema examples, and "matching the contract schema" phrases.
Kept: semantic task descriptions and field meaning explanations.
nextlevelshit added a commit that referenced this pull request Feb 24, 2026
CLI commands like gh pr create --body-file need literal artifact paths.
Clarify that rule #1 permits these while still forbidding inline schemas.
nextlevelshit added a commit that referenced this pull request Mar 4, 2026
feat: implement wave ops commands (status, logs, cancel, artifacts)
nextlevelshit added a commit that referenced this pull request Mar 4, 2026
Strip 130+ violations of CLAUDE.md rule #1 across 24 pipeline YAML
files and 12 prompt templates. The executor now handles artifact
injection and output path guidance via buildContractPrompt, so prompts
no longer need to specify where to read/write.

Removed: output path directives, artifact read instructions, inline
JSON schema examples, and "matching the contract schema" phrases.
Kept: semantic task descriptions and field meaning explanations.
nextlevelshit added a commit that referenced this pull request Mar 4, 2026
CLI commands like gh pr create --body-file need literal artifact paths.
Clarify that rule #1 permits these while still forbidding inline schemas.
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.

2 participants