CLI command
spis serve
The loopback HTTP/JSON backend Spis Desktop starts and talks to; every endpoint runs the spis command it names.
Invocation#
spis serve --port PORTBinds the loopback address on PORT (0 lets the system choose; Spis Desktop passes 0), prints exactly one line, {"ready":true,"port":N}, and from then on writes nothing to stdout. Every endpoint runs the spis subcommand the CLI would run, as a child of the same executable, one job at a time; there is no second implementation behind the HTTP surface.
Endpoints#
GET /v1/healthanswers{"status":"ok"}.GET /v1/docs-status,POST /v1/docs-search(query, optionalsiteand a positivelimit) andPOST /v1/docs-show(site,url) answer with the JSON documentspis docs-corpus status|search|showprints, unchanged.POST /v1/corpus-adopt(absolutepath),/v1/catalogs-check,/v1/drift,/v1/verify,/v1/capture-dry-run(catalog),/v1/reference-add(slug,name,sourceUrl,category,selectionNote,visual),/v1/reference-remove(slug, positivenumber, optionalforce),/v1/catalog-add(slug,title, optionaldescription; runsspis catalog-type add),/v1/catalog-edit(slugand at least one oftitle,description,status,rename; runscatalog-type edit) and/v1/catalog-remove(slug, optionalforce; runscatalog-type remove) stream NDJSON: zero or more{"type":"log","stream":"stdout"|"stderr","chunk":…}lines as the command writes them, then exactly one{"type":"result","status":N,"json":{…}}with the command's exit status and, on failure,{"error": <its refusal sentence>}.
Refusals#
- Without
--port PORT, or with anything else:usage: spis serve --port PORT (0 lets the system choose one), exit 2. - A port that cannot be bound:
cannot listen on the loopback address, port PORT: …, exit 1. - Before a stream starts, a refusal is a non-2xx
{"error": sentence}: 404unknown endpoint: METHOD PATH; 400request body is not valid JSON,request body must be a JSON object, or the missing field named (for exampleadding a record requires a source URL); 500 for a document command's own refusal (its last stderr line withouterror:) orspis could not start: ….