How do I create CLI commands for a new entity?
Struct layout, parser class shape, and file locations are in CLI entity patterns. The codegen-add-cli-entity skill drives this process.
Question
How do I add CLI commands for a new entity in ores.cli?
Answer
Phase 1 — list and export (PR: [cli] Add {entity} list and export commands):
- Add the entity to the
entityenum ininclude/ores.cli/config/entity.hpp. - Create
{entity}_parser.hppand{entity}_parser.cppimplementing the list and export operations. - Register the parser in
src/parsers/main_parser.cpp. - Build and smoke-test:
./ores.cli {entities} --helpand./ores.cli {entities} list --format table.
Phase 2 — add and delete (PR: [cli] Add {entity} add and delete commands):
- Create
include/ores.cli/config/add_{entity}_options.hppwith the options struct for theaddcommand. - Extend
{entity}_parserwithaddanddeletemethods. - Build and smoke-test:
./ores.cli {entities} add --help.
Phase 3 — recipe docs (PR: [doc] Add {entity} CLI command recipes):
- Add
how_do_i_*.orgrecipes underdoc/recipes/cli/(one per operation, following existing naming conventions).
Tested by
Build ores.cli and run ./{entities} --help, list, add, delete
interactively against a local database.
See also
- CLI entity patterns — struct layout, parser shape, file locations.
- codegen-add-cli-entity — skill that drives this workflow.
- Entity lifecycle — layer ordering overview.