Enable explicit configuration imports and overlays
This commit is contained in:
14
docs/cli.md
14
docs/cli.md
@@ -26,7 +26,11 @@ go run ./cmd/scriptorium render \
|
||||
- `scriptorium inspect prompt`: inspect one prompt definition without model execution.
|
||||
- `scriptorium inspect profile`: inspect one effective profile without model execution.
|
||||
|
||||
All commands accept `--config <path>` and reject positional arguments. `run`,
|
||||
All commands accept `--config <path>` and `--config-overlay <name>` and reject
|
||||
positional arguments. `--config-overlay` selects one application configuration
|
||||
overlay; it is separate from `--profile`, which selects a Promptkit execution
|
||||
profile. See [configuration composition](config.md#explicit-imports-and-selected-overlays)
|
||||
for name, root, and no-base behavior. `run`,
|
||||
`render`, `serve`, and `inspect prompt` require an effective `prompt_dir`;
|
||||
`inspect profile` does not. Supply the directory through the configuration
|
||||
contract or a supported `--prompt-dir` flag. Explicit application flags,
|
||||
@@ -51,6 +55,7 @@ Optional flags:
|
||||
| Flag | Meaning |
|
||||
| --- | --- |
|
||||
| `--config <path>` | Application configuration file. |
|
||||
| `--config-overlay <name>` | Selected application configuration overlay. |
|
||||
| `--prompt-dir <dir>` | Prompt-definition directory override. |
|
||||
| `--profile-dir <dir>` | Custom profile-directory override. |
|
||||
| `--schema-dir <dir>` | Schema base-directory override. |
|
||||
@@ -148,7 +153,7 @@ scriptorium render [flags]
|
||||
```
|
||||
|
||||
`--prompt <id>` is required. The following optional flags are supported:
|
||||
`--config`, `--prompt-dir`, `--profile-dir`, `--schema-dir`, `--prompt-version`, `--profile`,
|
||||
`--config`, `--config-overlay`, `--prompt-dir`, `--profile-dir`, `--schema-dir`, `--prompt-version`, `--profile`,
|
||||
`--input`, `--var`, `--out`, `--llm-base-url`,
|
||||
`--model`, `--api-key-env`, `--temperature`, `--max-tokens`, `--top-p`,
|
||||
`--reasoning-effort`, `--session-id`, `--timeout`, `--transient-retries`, and `--format text|json`. Their meanings match the corresponding
|
||||
@@ -174,6 +179,7 @@ Optional flags:
|
||||
| Flag | Meaning |
|
||||
| --- | --- |
|
||||
| `--config <path>` | Application configuration file. |
|
||||
| `--config-overlay <name>` | Selected application configuration overlay. |
|
||||
| `--addr <listen-address>` | HTTP listen-address override. |
|
||||
| `--prompt-dir <dir>` | Prompt-definition directory override. |
|
||||
| `--profile-dir <dir>` | Custom profile-directory override. |
|
||||
@@ -190,7 +196,7 @@ schemas, and error codes are defined in the [HTTP API reference](api.md).
|
||||
|
||||
```text
|
||||
scriptorium inspect prompt --prompt ID [--prompt-version VERSION]
|
||||
[--config PATH] [--prompt-dir DIR] [--format text|json] [--out PATH]
|
||||
[--config PATH] [--config-overlay NAME] [--prompt-dir DIR] [--format text|json] [--out PATH]
|
||||
```
|
||||
|
||||
`--prompt` is required. Inspection uses normal configuration discovery and a
|
||||
@@ -203,7 +209,7 @@ template, reserve backend capacity, or call a model.
|
||||
|
||||
```text
|
||||
scriptorium inspect profile --profile ID
|
||||
[--config PATH] [--profile-dir DIR] [--format text|json] [--out PATH]
|
||||
[--config PATH] [--config-overlay NAME] [--profile-dir DIR] [--format text|json] [--out PATH]
|
||||
```
|
||||
|
||||
`--profile` is required; built-in profiles need no prompt directory. Inspection
|
||||
|
||||
@@ -20,8 +20,9 @@ When `--config` is omitted, Scriptorium searches
|
||||
If neither exists, it uses built-in defaults. An explicit `--config` path must
|
||||
exist and decode successfully.
|
||||
|
||||
The maintained [minimal configuration](../examples/config.yml) and
|
||||
[complete configuration](../examples/config.full.yml) are copyable examples.
|
||||
The maintained [minimal configuration](../examples/config.yml),
|
||||
[complete configuration](../examples/config.full.yml), and
|
||||
[composed configuration](../examples/config.composed.yml) are copyable examples.
|
||||
|
||||
## Application Configuration File
|
||||
|
||||
@@ -31,8 +32,7 @@ An explicit empty string is a value: it clears a file-provided optional path
|
||||
or, for required `prompt_dir`, fails the command's prerequisite. A scalar
|
||||
`null` is not an empty string and is rejected for scalar fields; nullable
|
||||
fields such as `transient_retries` retain their documented meaning. Raw
|
||||
API-key fields are not accepted. Imports and selected overlays are not yet
|
||||
enabled for application configuration.
|
||||
API-key fields are not accepted.
|
||||
|
||||
ConfigKit applies defaults, the selected file, then only explicitly supplied
|
||||
application CLI flags before validating the result. Paths in the application
|
||||
@@ -40,6 +40,43 @@ document remain relative to the process working directory, not to the file's
|
||||
directory. Load diagnostics are printed safely on stderr; invalid application
|
||||
configuration exits with status 1.
|
||||
|
||||
### Explicit imports and selected overlays
|
||||
|
||||
A file-backed configuration may declare `configkit.imports` with relative
|
||||
`path` or `glob` entries. Each entry is explicit; Scriptorium does not scan
|
||||
for fragments on its own. ConfigKit composes the selected file and imports by
|
||||
conflict, so two fragments cannot define the same field merely to establish
|
||||
precedence. A required missing import fails; an entry may use
|
||||
`optional: true` to suppress target nonexistence. Imports are resolved from
|
||||
the declaring file's canonical directory and remain within the selected
|
||||
file's canonical directory by default. Scriptorium does not widen that root.
|
||||
|
||||
`--config-overlay NAME` selects one file at `overlays/NAME.yml` below that
|
||||
root. The name must use letters, digits, `_`, or `-`; it is not a path. Empty
|
||||
and exact lowercase `default` select no overlay. There is no fallback,
|
||||
case folding, inherited stack, or automatic selection; a missing selected
|
||||
overlay fails. ConfigKit merges mapping fields and replaces other values,
|
||||
including sequences and explicit nulls, before applying explicit CLI flags.
|
||||
An active overlay needs a selected base file. No-source defaults-only loads
|
||||
cannot use imports or an active overlay.
|
||||
|
||||
The [composed example](../examples/config.composed.yml) imports two fragments
|
||||
and has a selectable [local overlay](../examples/overlays/local.yml). From the
|
||||
repository root:
|
||||
|
||||
```bash
|
||||
go run ./cmd/scriptorium render \
|
||||
--config ./examples/config.composed.yml --config-overlay local \
|
||||
--prompt generic.markdown_summary \
|
||||
--input transcript=./examples/fixtures/transcript.md \
|
||||
--input glossary=./examples/fixtures/glossary.yml
|
||||
```
|
||||
|
||||
Import and overlay file locations are constrained by ConfigKit;
|
||||
*application path values* such as `prompt_dir` remain relative
|
||||
to the process working directory even when authored in a fragment or overlay.
|
||||
These source constraints are separate from HTTP artifact containment.
|
||||
|
||||
| Field | Default | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `prompt_dir` | unset | Promptkit prompt-definition source directory. `run`, `render`, `serve`, and `inspect prompt` require an effective value. |
|
||||
|
||||
@@ -40,8 +40,10 @@ implicit discovery. One ConfigKit load applies explicit application overrides
|
||||
before validation and returns a result containing the resolved document and
|
||||
its frozen inspection records. `Settings` converts that document into the
|
||||
existing runtime settings with backend IDs sorted; it does not read files or
|
||||
apply another merge. Imports and selected overlays remain disabled until their
|
||||
own user-facing integration is ready.
|
||||
apply another merge. File-backed loads enable explicit ConfigKit imports and
|
||||
select one named overlay when requested. ConfigKit uses the selected file's
|
||||
canonical directory as the source root; the application does not widen it.
|
||||
Application path values retain process-working-directory-relative meaning.
|
||||
|
||||
Every configuration-loading command uses this boundary. The CLI maps only
|
||||
explicitly visited application flags to ConfigKit overrides and prints
|
||||
|
||||
@@ -44,6 +44,14 @@ schema sources that follow the tagged framework formats. For an HTTP deployment
|
||||
that accepts file artifacts, use a dedicated, narrow artifact directory rather
|
||||
than a general-purpose or sensitive filesystem tree.
|
||||
|
||||
If application configuration uses explicit imports or a selected overlay,
|
||||
deploy those files beneath the selected configuration file's canonical
|
||||
directory. ConfigKit keeps imported and overlay files within that root;
|
||||
Scriptorium does not widen it. Application path values inside those files still
|
||||
resolve from the process working directory, so set that directory deliberately
|
||||
in the service manager. This configuration-source boundary is distinct from
|
||||
the HTTP artifact root and does not constrain prompt or schema directories.
|
||||
|
||||
When upgrading existing definitions, review selected profile IDs.
|
||||
`deepseek-3-2`, `deepseek-4-flash`, and `deepseek-4-pro` were removed from the
|
||||
selected catalog. Choose an available catalog profile, one of Promptkit's
|
||||
|
||||
@@ -277,7 +277,11 @@ not yet advertised.
|
||||
|
||||
## Stage 4: Enable Explicit Imports And Selected Configuration Overlays
|
||||
|
||||
**Status: Not started.**
|
||||
**Status: Complete.** File-backed loads support explicit imports and one
|
||||
selected overlay under the selected file's canonical directory. All five
|
||||
existing command modes accept `--config-overlay`; real-file composition and a
|
||||
render workflow are tested. The composed example and contracts are updated;
|
||||
full test, race, vet, build, and diff checks passed.
|
||||
|
||||
Primary files: shared loader, CLI source-selection wiring, configuration and
|
||||
CLI tests, maintained configuration examples.
|
||||
|
||||
Reference in New Issue
Block a user