Skip to content

Response Format

Every String command response is composed of two parts: a system message (meta information) and optional content (actual data).

  • Commands that return content: system message\n---\ncontent
  • Commands that return only a confirmation: system message alone (no ---)
  • The daemon prepends re: [request_id] /cmd before the body

Final form example:

re: [003qm] /open hello.md
Opened hello.md
---
# Hello World
Welcome

Commands that return documents or structured data.

CommandSystem messageContent
/open pathOpened pathrendered document
/open path#blockOpened path#blockrendered block
/backBack to pathrendered document
/refreshRefreshed pathrendered document
/edit path (view)[editing: path]source with line numbers
/edit path#block (view)[editing: path#block]block source
/helpString Commandshelp text
/ls [path]Listing path/directory entries
/navMenusmenu list
/nav nameMenu: namemenu entries
/nav scaffoldNav Scaffoldscaffold template
/infoSession infoinfo key-value pairs
/actActionsaction list
/act.name --helpAction: nameaction schema
/verify path#blockVerified path#blockblock content preview
/set (list)Variablesvariable list
bash (output)exit: N | cwd: pathcommand output

Confirmation and status messages.

CommandSystem message
/open (no args)usage error
/write pathWritten: path (42 bytes, 3 lines)
/append pathAppended to: path (now 78 bytes)
/edit path (with body)Edited path (2 lines, whole file)
/edit path#block (with body)Edited path#block (5 lines)
/closeClosed: path
/set {var} = "val"{var} = "val"
/undoUndo: reverted path (N lines)
/act.name --flags (template response)action output (template result)
/act.name --flags (doc response)category A (rendered doc)

Errors are formatted by the daemon as ERROR(code): message. Commands return err(message, code) and the daemon wraps them. No --- separator.

re: [003qm] /open nonexistent.md
ERROR(NOT_FOUND): File not found: nonexistent.md

Return points in commands.ts that produce system message\n---\ncontent:

  1. cmdHelp()String Commands\n---\n{help text}
  2. cmdHelp(bash)Bash Session\n---\n{help text}
  3. cmdLs()Listing {path}/\n---\n{entries}
  4. cmdNav() (list) — Menus\n---\n{menu list}
  5. cmdNav(name)Menu: {name}\n---\n{entries}
  6. cmdNav(scaffold)Nav Scaffold\n---\n{scaffold}
  7. cmdInfo()Session info\n---\n{info lines}
  8. cmdAction() (list all) — Actions\n---\n{action list}
  9. cmdAction() (—help, action schema) — Action: {id}\n---\n{schema}
  10. cmdAction() (no flags, action schema) — Action: {id}\n---\n{schema}
  11. cmdAction() (doc response) — Opened {path}\n---\n{rendered doc}
  12. cmdEdit() (view whole file) — [editing: {path}]\n---\n{source}
  13. cmdEdit() (view block) — [editing: {path}#{block}]\n---\n{source}
  14. cmdVerify()Verified {path}#{block}\n---\n{preview}
  15. cmdSet() (list variables) — Variables\n---\n{variable lines}
  16. cmdOpen()Opened {path}\n---\n{rendered doc}
  17. cmdBack()Back to {path}\n---\n{rendered doc}
  18. cmdRefresh()Refreshed {path}\n---\n{rendered doc}