feat(cli): add list subcommand for script/run discovery
Merged
KA
2mo ago+132+132+012345678901234567890123456789-2-2-0123456789
Summary
- Adds
reverse-api-engineer listnon-interactive CLI subcommand - Rich table output (compact/full) and JSON output (
--json) - Filters:
--mode,--model,--search,--limit - Enriches runs with script directory paths, file counts, and local path detection
- Bumps version to v0.4.0
Test plan
-
reverse-api-engineer list— Rich table renders with all runs -
reverse-api-engineer list --json— valid JSON array -
reverse-api-engineer list --search "hn" --limit 2— filtered correctly -
reverse-api-engineer list --help— all options documented -
ruff check— no new lint errors
🤖 Generated with Claude Code
Summary by cubic
Add reverse-api-engineer list to quickly discover generated scripts and past runs. Supports compact/full table views and --json, with filters and filesystem details.
- New Features
- Non-interactive
listsubcommand with rich table (compact/full) and--json. - Filters:
--mode,--model,--search,--limit. - Adds script directory path, file list/count, and local copy detection.
- Bumps
reverse-api-engineerto0.4.0.
- Non-interactive
Greptile Summary
This PR adds a reverse-api-engineer list subcommand that renders run history as a Rich table (compact/full) or JSON, with filters for mode, model, prompt search, and row limit, and bumps the version to v0.4.0.
- Path-traversal bypass in
_get_run_details:run_idis taken directly from the history JSON and used to build a filesystem path without the regex, length, oris_relative_toguards thatget_scripts_dir/get_har_dir/get_docs_dirall apply. A corrupted history entry could silently traverse outside the expected directory. - Unhandled
OSErroriniterdir()calls: All threeiterdir()calls (script_dir,local_scripts, and eachsubdir) can raisePermissionErrororOSError, which would crash the entirelistcommand via an unhandled exception inside a list comprehension. local_pathnot shown in table output: The field is computed and correctly included in--jsonoutput, but neither the compact nor--fulltable renders it, despite the PR description listing "local path detection" as a visible feature.uv.lockversion (previously0.3.2) was out of sync withpyproject.toml(0.3.3); both are now correctly aligned at0.4.0.
Confidence Score: 3/5
- Safe to merge with low risk, but the path-traversal bypass should be addressed before shipping to users who may have untrusted history files.
- The new command is additive and read-only, so there is no data-loss risk. However,
_get_run_detailsskips therun_idvalidation that every other path-building utility in the codebase enforces, which is a correctness/security regression. The missingOSErrorguards could also cause the command to crash unexpectedly for legitimate users. - src/reverse_api/cli.py — specifically the
_get_run_detailshelper (lines 1735–1773)
Important Files Changed
| Filename | Overview |
|---|---|
| src/reverse_api/cli.py | Adds _get_run_details helper and list subcommand. The helper bypasses the existing run_id path-traversal validation used everywhere else in the codebase, and all three iterdir() calls lack OSError handling. The computed local_path field is also missing from the table output despite being documented as a feature. |
| pyproject.toml | Version bumped from 0.3.3 to 0.4.0, consistent with the new list subcommand feature addition. |
| CHANGELOG.md | New [0.4.0] entry added documenting the list CLI subcommand and its options. No issues. |
| uv.lock | Lock file updated to reflect version 0.4.0; also resolves a pre-existing discrepancy where the lock file had 0.3.2 while pyproject.toml said 0.3.3. |
Last reviewed commit: 3a26e3e
Greptile also left 1 inline comment on this PR.