Files
scriptorium/docs/cli.md

99 lines
4.8 KiB
Markdown
Raw Normal View History

# CLI Reference
Scriptorium installs native [CommandKit v0.8.0 and integration commands][native]
alongside application-owned `run` and `serve`. Upstream owns standard command
grammar, reusable flags, reporting, completion, and outcomes. See
[configuration](config.md), the [HTTP contract](api.md), and the
[CLI migration guide](consumers/upgrading-cli.md) for application choices.
## Commands
```text
scriptorium run PROMPT_ID [flags]
scriptorium serve [flags]
scriptorium config scopes|validate|show|sources|explain|diff [flags]
scriptorium promptkit list|show|requirements|test [flags]
scriptorium help [COMMAND ...]
scriptorium version
scriptorium completion bash|zsh|fish
```
Use `--help` for installed commands and flags. Help, version, scope discovery,
bare config-explain help, and static completion do not acquire configuration.
Configuration-consuming commands accept `--config PATH` and `--overlay NAME`.
Native `--show-tokens` requests a diagnostic usage/cost summary; quiet mode
suppresses it. Explicit smoke tests may contact providers and incur cost.
## Generation
`run` requires one positional prompt ID and uses the native profile, session,
input, execution, and namespace bindings. Preferred aliases omit `llm-`, such
as `--profile`, `--input-text`, `--input-file`, `--var`, `--endpoint`, and
`--timeout-seconds`. `--input` and `--llm-input` mean literal input text. The
[native CLI contract][native] owns the full binding and mapping semantics.
There is no duplicate prompt flag or direct backend flag.
Application-owned controls are `--run-timeout DURATION`, passed unchanged as
PromptKit's operation budget, and `--report PATH` with optional
`--report-format text|yaml|json`. Omission of the report format passes native
automatic selection. An explicitly empty report path is a usage error.
### Results And Separate Reports
Automatic/text stdout is exactly the generated artifact bytes, without an added
newline. Native JSON/YAML output is the full upstream result. Save stdout with
shell redirection; there is no output-file flag. Omit `--quiet` to capture the
main result, since quiet suppresses it even when redirected.
An explicitly requested report is independently rendered from the same result,
without the artifact-only template, even in quiet mode. Its extension does not
choose a format; `-` is an ordinary filename. Files are created or truncated
normally, with mode 0644 for new files subject to umask; parent directories are
not created. A resultless failure leaves an existing report untouched. Main
delivery is attempted first, then the report even if main delivery fails. Writes
are nontransactional; the caller owns redirected destinations and retention.
## Application Configuration Inspection
Native `config` defaults to `app`; `promptkit` focuses the same complete load at
its framework section. Both scopes accept native overrides and independent
comparison selections; paths remain application-root paths. Neither scope
constructs an engine. See [configuration](config.md#inspection-and-credentials)
and the [native CLI contract][native] for scope and path operations.
## Framework Configuration Inspection
The focused view retains native whole-load evidence and allows explicit queries
outside its focus. Native sensitivity is not a general-purpose secret filter;
inspection, prompt, prepared, and result reports can contain sensitive content.
## Discovery, Preview, And Explicit Smoke Testing
Native PromptKit commands expose inventories, named inspection, requirements,
validation, prepared preview, and explicit smoke tests. Requirements discovery
is distinct from preparation and generation; consult the
[PromptKit consumer contract][promptkit] and [native CLI contract][native].
Prepared and named reports can include prompt content.
## Server And Statuses
`serve` accepts `--addr`, `--artifact-root`, `--max-request-bytes`,
`--max-artifact-bytes`, and `--max-response-bytes` in addition to configuration
selection. Interrupt/SIGTERM cancels the invocation and closes the listener and
active connections; no graceful-drain guarantee is added.
| Status | Application meaning |
| --- | --- |
| 0 | Success, subject to delivery. |
| 1 | Operational failure, cancellation, or delivery failure. |
| 2 | Usage error or natively classified invalid configuration. |
| 3 | Native `config diff --check` found differences. |
| 4 | Completed generation failed content validation; its result is delivered. |
Native finalization owns presentation failures. A report-file failure retains
an existing nonzero domain status and adds delivery evidence. A resultless
operation failure does not produce a synthetic result.
[native]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md
[promptkit]: https://forge.maximumdirect.net/base-layer/promptkit/src/commit/207677e9948dc5699073a4d6620d21139033c72d/docs/consumers/pkg-promptkit.md