Update public documentation for shared native configuration

This commit is contained in:
2026-11-23 03:41:47 +00:00
parent ede8514450
commit 6e8c0a0c0c
6 changed files with 150 additions and 308 deletions

View File

@@ -1,186 +1,98 @@
# CLI Reference
Scriptorium uses CommandKit v0.7.0, ckconfig v0.9.0, and ckprompt v0.10.0.
This document owns application invocation and delivery behavior. The pinned
[upstream CLI contract][native-cli] owns standard family grammar and reports.
[Configuration](config.md) owns discovery, settings, and source composition;
the [HTTP API](api.md) owns the service contract.
Existing callers should read the [CLI migration guide](consumers/upgrading-cli.md).
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
scriptorium config validate|show|sources|explain|diff [flags]
scriptorium promptkit list prompts|profiles|backends|namespaces|collections [flags]
scriptorium promptkit show prompt|profile|backend ID [flags]
scriptorium promptkit requirements show|validate PROMPT_ID [flags]
scriptorium promptkit show prepared PROMPT_ID [flags]
scriptorium promptkit test KIND [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
```
Native help is also available with `--help`. Help, version, scope discovery,
and static completion do not load configuration or contact a provider.
Version/revision metadata is supplied by the build; ordinary builds identify
themselves as `dev` with no revision. Release build mechanics belong to the
[release procedure](release.md).
Commands that consume configuration accept `--config PATH` and `--overlay NAME`.
An explicitly empty config value remains explicit; overlay names follow
[ConfigKit selection](config.md#explicit-imports-and-selected-overlays).
There are no source/schema convenience flags or legacy command aliases.
Native shared `--format`, `--quiet`, `--verbose`, `--debug`, and progress
controls retain their upstream meanings. Diagnostics use stderr, not stdout.
Verbose exposes emitted Info and Warning messages without changing result bytes.
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 exactly one positional prompt ID. It has no duplicate prompt
flag or direct backend-selection flag; choose a profile for backend routing.
It uses these native bindings, with the preferred aliases below. Canonical
spellings prepend `llm-` (for example, `--llm-profile`).
`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.
| Preferred flags | Meaning |
| --- | --- |
| `--profile ID`, `--session-id ID` | Profile selection and optional non-secret session context. |
| `--var KEY=VALUE` | Repeatable caller-variable mappings. |
| `--input-text NAME=TEXT`, `--input NAME=TEXT` | Repeatable literal input mappings; `--llm-input` is also a literal-text alias. |
| `--input-file NAME=PATH` | Repeatable file references. |
| `--endpoint URL`, `--model NAME` | Native endpoint/model overrides. |
| `--temperature N`, `--max-tokens N`, `--top-p N` | Presence-aware numeric overrides, including zero. |
| `--timeout-seconds N` | Integer per-attempt generation timeout; zero disables that deadline, not caller cancellation or the transport cap. |
| `--reasoning-effort VALUE`, `--service-tier VALUE` | Native provider controls; an explicit empty reasoning value is preserved. |
| `--api-key-env NAME` | Credential environment-variable name, never raw key bytes. |
| `--extra-params JSON` | Native JSON-object provider parameters. |
| `--transient-retries N` | Request retry override; omission leaves the engine default. |
| `--prompt-namespace NAME`, `--profile-namespace NAME`, `--backend-namespace NAME` | Independent native namespace views. Qualified resource IDs remain exact; stored references are not rewritten. |
Mappings split at the first `=`; commas and subsequent equals signs are literal.
Repeat flags for multiple mappings. The last text/file occurrence for the same
input wins in command-line order. PromptKit validates selected definitions,
inputs, namespaces, provider settings, and credential requirements; Scriptorium
does not add an execution-readiness preflight or configurable default namespace.
Native string/pointer override semantics remain upstream-owned.
Application-owned generation controls:
| Flag | Meaning |
| --- | --- |
| `--run-timeout DURATION` | Go duration passed unchanged to PromptKit's operation budget. Positive values cover engine preparation/execution, including cooperative waits and repairs. Zero, omission, and negative values add no budget. Parsing, configuration/engine setup, and delivery are outside it. |
| `--report PATH` | Additionally write the returned native result to a separate file. |
| `--report-format text\|yaml\|json` | Explicit separate-report format; omission leaves native automatic rendering selected. |
The operation budget is independent of the integer per-attempt timeout.
Earlier parent cancellation/deadlines still apply. Cancellation is cooperative;
synchronous work that ignores context cannot be forcibly interrupted.
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
The main report goes through the invocation reporter to stdout. Automatic/text
output is exactly `Artifact.Body`, with no added newline, header, escaping, or
summary. JSON/YAML output is the full native PromptKit `RunResult`, without a
Scriptorium envelope. In native structured serialization, artifact bytes use
the upstream representation (JSON base64), not an application text projection.
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.
Save main output with shell redirection or the subprocess stdout destination.
There is no `--output` or `--out` flag. Omit `--quiet` when capturing the main
result: native quiet suppresses it even when stdout is redirected.
`--report` renders the same result through CommandKit without the artifact-only
text template. Its format is independent of stdout's `--format` and the filename
extension. Omission passes an unset format to the upstream renderer; it currently
renders structured values as YAML in automatic/text mode. Choose an explicit
format when required rather than relying on that upstream default.
The requested file is written even in quiet mode. Omission creates no separate
report. An explicitly empty path is a usage error before generation; `-` is an
ordinary filename. New files use mode 0644 subject to umask, existing files use
normal OS replacement behavior, and parent directories are not created.
Render, write, and close failures are reported.
Only a returned result is eligible for delivery. A resultless failure leaves an
existing report untouched; it does not synthesize an invocation-error result.
Main delivery is attempted first, then the requested report even if main
delivery fails. Writes are nontransactional; bytes already written remain.
Callers own redirected paths, retention, and keeping main and report destinations
separate. A shell may truncate its redirected file before the process starts.
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
The native `config` family defaults to `app`; select `--scope promptkit` for
captured framework configuration or use native scope discovery/all-scope modes.
`app` uses the actual completed ConfigKit result and does not construct an engine.
Native `--set POINTER=JSON` is enabled only for `app`. Records go directly to
ConfigKit: duplicate and ancestor/descendant-overlapping paths are rejected,
not resolved by flag order. No application-specific configuration flags or
custom `--against-*` counterparts are installed.
Native diff uses independent `--against-config`, `--against-overlay`, and
supported `--against-set` selections. Omitted right-side values do not inherit
the left side. See the [upstream contract][native-cli] for focused paths,
metadata discovery, source IDs, findings, explanations, and detailed comparisons.
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 `promptkit` config scope loads application settings selected by `--config`
and `--overlay`, constructs an engine, and exposes its captured native view.
It does not accept temporary overrides; native capability checks also apply
when an all-scope operation requests them.
Framework effective/explanation views retain native classified-field redaction,
including history. Environment-reference names and ordinary values remain
visible. This is not arbitrary secret detection and does not redact all prompt,
prepared, application, or generated content. Protect reports accordingly.
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
Inventories retain native defaults and `--namespace`/`--all-namespaces` filters.
Named inspections expose native prompt messages and profile/backend values;
prepared preview exposes rendered content, not a summary projection.
Requirements discovery works before input artifacts exist and without schema
loading, credential resolution, message rendering, or provider access. It still
loads configuration and captured message resources. Reports preserve exact names,
metadata, variable presence (including empty values), completeness, and issue
codes. Partial discovery may succeed with status zero; completeness is not
binding satisfaction or execution readiness. Concrete validation and preview
keep their native preparation-time prerequisites and make no generation call.
Smoke-test kinds are `reachability`, `authentication`, `text_inference`,
`structured_output`, or `all`, with native aliases as documented upstream.
These explicit commands may contact providers and incur cost. Their presence
does not add a startup/provider probe. Read the native findings: unsuccessful or
unsupported checks are not automatically invocation failures.
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 configuration selection and presence-aware HTTP controls:
`--addr`, `--artifact-root`, `--max-request-bytes`, `--max-artifact-bytes`,
and `--max-response-bytes`. It has no generation request controls. Values and
defaults belong to [configuration](config.md).
`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.
Interrupt/SIGTERM cancels the invocation context. The server closes its listener
and active connections; canceled shutdown returns operational status, with no
graceful-drain deadline or guarantee that context-ignoring work has finished.
| Status | Meaning |
| Status | Application meaning |
| --- | --- |
| 0 | Native success, subject to successful presentation/delivery. |
| 1 | Operational failure, including lookup/preparation/generation/capacity, cancellation/timeouts, unclassified load errors, and delivery failure for an otherwise successful run. |
| 2 | Native usage/declaration-input errors, or configuration errors classified as invalid input by native diagnostic evidence. |
| 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 returned `ValidationFailed`; artifact and native result remain deliverable. |
| 4 | Completed generation failed content validation; its result is delivered. |
Native finalization handles presentation errors: success/usage become operational;
an already nonzero domain outcome retains its classification/status. A report-file
failure preserves completed-validation status 4 while adding its explanation and
cause. An operational failure to perform validation is status 1, not status 4.
JSON selection does not turn failures into a separate JSON error envelope.
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-cli]: https://forge.maximumdirect.net/base-layer/commandkit/src/commit/d330d7637f2e7507eca931a899397222c82bc892/docs/cli.md
[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