Skip to content

feat: implement phraya merge CLI (#80)#108

Merged
crashfrog merged 3 commits into
mainfrom
worktree-agent-a9419a2104eda4db1
May 31, 2026
Merged

feat: implement phraya merge CLI (#80)#108
crashfrog merged 3 commits into
mainfrom
worktree-agent-a9419a2104eda4db1

Conversation

@crashfrog
Copy link
Copy Markdown
Member

Summary

Implements the phraya merge CLI command that reads multiple .phraya files, merges them using the existing merge_phraya_files library function, and writes the merged result.

  • Accepts variable number of input .phraya files as positional arguments
  • Requires --output <PATH> to specify the merged output file
  • Logs merge progress to stderr (e.g., "Merging 3 samples...")
  • Returns non-zero exit code on error (file not found, mismatched reference lengths, etc.)
  • Preserves provenance for all observations
  • Sums coverage tracks element-wise
  • Deduplicates identical observations

Test Results

All 12 acceptance tests pass:

  • Merge two files
  • Merge three files
  • Merge single file
  • Merge deduplicates observations
  • Merge preserves provenance
  • Merge coverage summing
  • Error handling: no input files
  • Error handling: missing --output flag
  • Error handling: nonexistent input file
  • Error handling: mismatched reference lengths
  • Error handling: non-zero exit code
  • Logs progress to stderr

Uses merge_phraya_files() from phraya-io crate for the core merge logic.

Co-Authored-By: Claude Haiku 4.5 noreply@anthropic.com

crashfrog and others added 2 commits May 31, 2026 17:09
- 12 integration tests covering happy path, edge cases, and error conditions
- Tests verify: multiple file merging, coverage summing, provenance preservation
- Tests verify: error handling for mismatched refs, nonexistent files, missing args
- All tests are RED (7 fail with 'unrecognized subcommand', 5 pass on CLI validation)
- Ready for implementation of merge subcommand in phraya-cli

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Adds the 'phraya merge' subcommand that reads multiple .phraya files,
calls the merge_phraya_files function from phraya_io, and writes the
merged result. Logs progress to stderr.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@crashfrog crashfrog mentioned this pull request May 31, 2026
8 tasks
Tests were failing in CI because they used a hardcoded absolute path
to Cargo.toml that only existed on the developer's machine. Now uses
env!("CARGO_MANIFEST_DIR") to get the correct path in any environment.
@crashfrog crashfrog merged commit 3bbc313 into main May 31, 2026
2 of 4 checks passed
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