CLI-Anything explained: give an agent a real software boundary
CLI-Anything source analysis: HARNESS and preview_bundle.py
Read the contract that generated CLIs are supposed to satisfy.
What you will learn
- The methodology is prescriptive
- Preview bundles have identity
- Read beyond the happy path
Before you start
- Python packaging basics
- A licensed GUI application with a real backend
Build a narrow proof of concept before publishing a community command.
Key takeaways
- The specification is a target, not proof of conformance.
- Cache keys need all relevant inputs.
- Registry packages require individual review.
The methodology is prescriptive
HARNESS.md defines phases for analysis, architecture, implementation, planning, tests, documentation and publishing. It requires true-backend end-to-end tests and an installed-command subprocess test.
The command file says to read HARNESS.md first. If an automated run skips that file, a plausible-looking CLI may miss essential tests or package metadata.
Preview bundles have identity
preview_bundle.py defines a protocol version, hashes source data, searches cached manifests and creates bundle IDs. It records artifacts and summaries so a viewer can find the output.
A cache hit is only meaningful if its key includes the inputs and generator settings that determine the preview. Review those fields before trusting reuse across revisions.
Read beyond the happy path
Look for path traversal, concurrent writes, missing native executable and errors that return success. The guide discusses session locking and failing rather than silently skipping true-backend tests.
We inspected this helper and the specification, not every generated harness in the registry. Package quality must be evaluated one by one.
Decision guide
| Criterion | Option A | Option B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
Implementation steps
- 1
Read the phase requirements in HARNESS.md.
- 2
Trace prepare_bundle to finalize_bundle in the helper.
- 3
Write tests for a missing backend and conflicting session save.
Copy-ready example
prepare_bundle(...)
# generate a real artifact with the native backend
finalize_bundle(...)Frequently asked questions
Does a generated test file prove the GUI ran?
No. Inspect the subprocess and produced native artifact.
Can a preview cache conceal changes?
Yes, if inputs that affect output are absent from the cache key.
Sources
- CLI-Anything / cli-anything-plugin/HARNESS.mdSource checked 2026-09-26
- CLI-Anything / cli-anything-plugin/commands/cli-anything.mdSource checked 2026-09-26
- CLI-Anything / cli-anything-plugin/preview_bundle.pySource checked 2026-09-26