How do I create shell commands for a new entity?

Table of Contents

Command class layout, registration pattern, and file locations are in Shell entity patterns. The codegen-add-shell-entity skill drives this process.

Question

How do I add shell REPL commands for a new entity in ores.shell?

Answer

Phase 1 — list and add (PR: [shell] Add {entity} list and add commands):

  1. Create {entity}_commands.hpp in include/ores.shell/app/commands/ with the static class shape from Shell entity patterns.
  2. Implement {entity}_commands.cpp in src/app/commands/: create the submenu, register list and add operations.
  3. Call {entity}_commands::register_commands(menu, session) from src/app/application.cpp.
  4. Build and smoke-test: start ores.shell and exercise {entities} list and {entities} add.

Phase 2 — history (PR: [shell] Add {entity} history command):

  1. Add process_get_{entity}_history handler.
  2. Register history subcommand in register_commands.
  3. Build and smoke-test.

Phase 3 — recipe docs (PR: [doc] Add {entity} shell command recipes):

  1. Add how_do_i_*.org recipes under doc/recipes/shell/ (one per operation).

Tested by

Start ores.shell, connect, and exercise each subcommand interactively against a local database.

See also

Emacs 29.1 (Org mode 9.6.6)