Skip to content

cli: migrate from pico-args to clap 4.x derive API#395

Merged
bpowers merged 2 commits intomainfrom
claude/migrate-cli-clap-qVi5o
Mar 14, 2026
Merged

cli: migrate from pico-args to clap 4.x derive API#395
bpowers merged 2 commits intomainfrom
claude/migrate-cli-clap-qVi5o

Conversation

@bpowers
Copy link
Owner

@bpowers bpowers commented Mar 14, 2026

Replace the flat Args struct and manual parse_args() function with
clap's derive-based subcommand parsing. Each subcommand now declares
exactly the arguments it accepts, making the CLI self-documenting for
both humans and AI agents.

Key changes:

  • Subcommands (simulate, convert, equations, debug, gen-stdlib, vdf-dump)
    are now a proper enum with per-variant fields
  • Shared model-input args (path + format) use #[command(flatten)]
  • Input format auto-detected from file extension (.mdl, .pb/.bin)
    with explicit --format override
  • Mutually exclusive --to-xmile/--to-mdl replaced by --to enum
  • --reference on debug is enforced required at parse time by clap
  • New open_model() helper centralizes format-dispatch logic

Also fixes lint-project.sh to use a temp file instead of process
substitution, which requires /dev/fd and fails in some environments.

https://claude.ai/code/session_017qMQ634tovdKLeQmYgQMAm

claude added 2 commits March 14, 2026 22:34
Replace the flat Args struct and manual parse_args() function with
clap's derive-based subcommand parsing. Each subcommand now declares
exactly the arguments it accepts, making the CLI self-documenting for
both humans and AI agents.

Key changes:
- Subcommands (simulate, convert, equations, debug, gen-stdlib, vdf-dump)
  are now a proper enum with per-variant fields
- Shared model-input args (path + format) use #[command(flatten)]
- Input format auto-detected from file extension (.mdl, .pb/.bin)
  with explicit --format override
- Mutually exclusive --to-xmile/--to-mdl replaced by --to enum
- --reference on debug is enforced required at parse time by clap
- New open_model() helper centralizes format-dispatch logic

Also fixes lint-project.sh to use a temp file instead of process
substitution, which requires /dev/fd and fails in some environments.

https://claude.ai/code/session_017qMQ634tovdKLeQmYgQMAm
@claude
Copy link

claude bot commented Mar 14, 2026

Code Review

Reviewed the migration from pico-args to clap 4.x derive API, the open_model() helper, resolve_input_format(), and the lint-project.sh fix.

No bugs found. The refactoring is a clean 1:1 behavioral migration with some nice improvements:

  • Subcommand-scoped arguments prevent invalid flag combinations at parse time
  • --reference on debug is now enforced by clap instead of a manual runtime check
  • Auto-detection of input format from file extension is a good UX addition
  • The lint-project.sh temp file fix correctly avoids the /dev/fd process substitution issue

Overall correctness: Correct. The patch preserves existing behavior, the argument structure maps cleanly to the old flags, and no existing code paths are broken by the migration.

@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

❌ Patch coverage is 0% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.00%. Comparing base (0fa352a) to head (37f1fde).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/simlin-cli/src/main.rs 0.00% 77 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #395      +/-   ##
==========================================
+ Coverage   76.92%   77.00%   +0.08%     
==========================================
  Files         143      143              
  Lines       36549    36511      -38     
==========================================
+ Hits        28115    28116       +1     
+ Misses       8434     8395      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bpowers
Copy link
Owner Author

bpowers commented Mar 14, 2026

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Provided git ref refs/pull/395/head does not exist
ℹ️ 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".

@bpowers bpowers merged commit fa39c73 into main Mar 14, 2026
11 of 12 checks passed
@bpowers bpowers deleted the claude/migrate-cli-clap-qVi5o branch March 14, 2026 23:28
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