Demonstrate native configuration authoring
This commit is contained in:
@@ -339,7 +339,7 @@ contributors, optional empty imports, atomic lists, and pointer escaping in
|
|||||||
allowed dynamic mapping keys. Inspection remains secret-safe and read-only,
|
allowed dynamic mapping keys. Inspection remains secret-safe and read-only,
|
||||||
without source reparsing or provenance-based acceptance gates.
|
without source reparsing or provenance-based acceptance gates.
|
||||||
|
|
||||||
## Stage 10: Exercise native authoring and maintain ergonomic examples
|
## Stage 10: Exercise native authoring and maintain ergonomic examples [x]
|
||||||
|
|
||||||
Read the production/testing bundle, artifact/family tests, native destinations
|
Read the production/testing bundle, artifact/family tests, native destinations
|
||||||
and collection rules, and maintained example tests.
|
and collection rules, and maintained example tests.
|
||||||
|
|||||||
@@ -12,13 +12,17 @@ in the [configuration reference](../docs/config.md).
|
|||||||
- [Production-shaped pipeline](pipeline.production.yml): S3 storage, publish,
|
- [Production-shaped pipeline](pipeline.production.yml): S3 storage, publish,
|
||||||
external tools, and configured Scriptorium artifacts.
|
external tools, and configured Scriptorium artifacts.
|
||||||
- [Production-base/testing-overlay bundle](production-testing/pipeline.yml):
|
- [Production-base/testing-overlay bundle](production-testing/pipeline.yml):
|
||||||
explicit `conf.d` imports, one ordinary artifact per `artifacts/<key>.yml`,
|
explicit required `conf.d` imports, an optional local import, destination-mounted
|
||||||
one family per `artifact-families/<key>.yml`, and the fixed
|
artifact files, a YAML-filtered directory of keyed families, and the fixed
|
||||||
`overlays/testing.yml` overlay. Production values live in the base. The
|
`overlays/testing.yml` overlay. Production values live in the base. The
|
||||||
bundle demonstrates an input-only artifact dependency, two character families
|
bundle demonstrates an input-only artifact dependency, two character families
|
||||||
sharing the campaign party, and a testing-only disabled artifact. The testing
|
sharing the campaign party, and a testing-only disabled artifact. The testing
|
||||||
overlay's `testing_notes` artifact inherits the recap prompt, inputs, and
|
overlay's `testing_notes` artifact inherits the recap prompt, inputs, and
|
||||||
testing profile while retaining its disabled status and separate output path.
|
testing profile while retaining its disabled status and separate output path.
|
||||||
|
The testing overlay upserts the transcript publish rule by `source`. A
|
||||||
|
destination key defines each artifact ID; filenames do not. Full-root and
|
||||||
|
disjoint definitions are also valid. Upsert replaces a matching list record
|
||||||
|
as a whole; empty append or upsert contributions leave existing entries intact.
|
||||||
Inspect it offline with:
|
Inspect it offline with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -45,7 +49,9 @@ with the sample campaign and a compatible local- or S3-audio session.
|
|||||||
|
|
||||||
- [Sample campaign](campaigns/sample-campaign/campaign.yml), its
|
- [Sample campaign](campaigns/sample-campaign/campaign.yml), its
|
||||||
[session template](campaigns/sample-campaign/session.template.yml), and its
|
[session template](campaigns/sample-campaign/session.template.yml), and its
|
||||||
adjacent stable inputs provide a complete campaign directory shape.
|
adjacent stable inputs provide a complete campaign directory shape. Its
|
||||||
|
imported settings and split party demonstrate local secondary imports;
|
||||||
|
relative resources follow the file that supplies each value.
|
||||||
- [Local-audio session](session.local-audio.yml) and
|
- [Local-audio session](session.local-audio.yml) and
|
||||||
[S3-audio session](session.s3-audio.yml) are concrete session files.
|
[S3-audio session](session.s3-audio.yml) are concrete session files.
|
||||||
- [Session template](session.template.yml) and the campaign-local equivalent
|
- [Session template](session.template.yml) and the campaign-local equivalent
|
||||||
@@ -78,8 +84,8 @@ names, or the Narratio credential lists must be changed to match. See the
|
|||||||
[Audita v2 migration guide](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.0/docs/migrations/v2.md)
|
[Audita v2 migration guide](https://gitea.maximumdirect.net/eric/audita/src/tag/v2.0.0/docs/migrations/v2.md)
|
||||||
for maintained downstream configuration examples.
|
for maintained downstream configuration examples.
|
||||||
|
|
||||||
For a deployed bundle, keep credential files out of source control in a
|
For a deployed bundle, keep credential files out of source control in the
|
||||||
`secrets/` directory beside the root `pipeline.yml`, one file per referenced
|
conventional `/usr/local/etc/narratio/secrets` directory, one file per referenced
|
||||||
environment-variable name, or select another directory with `--secrets-dir`.
|
environment-variable name, or select another directory with `--secrets-dir`.
|
||||||
Static S3 credentials are optional: omit both S3 credential references to use
|
Static S3 credentials are optional: omit both S3 credential references to use
|
||||||
the AWS SDK discovery chain.
|
the AWS SDK discovery chain.
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
|
config:
|
||||||
|
imports:
|
||||||
|
- path: fragments/inputs.yml
|
||||||
|
required: true
|
||||||
campaign_id: sample-campaign
|
campaign_id: sample-campaign
|
||||||
session_template_file: ./session.template.yml
|
|
||||||
inputs:
|
|
||||||
speakers_file: ./speakers.yml
|
|
||||||
autocorrect_file: ./autocorrect.yml
|
|
||||||
glossary_file: ./glossary.yml
|
|
||||||
party_file: ./party.yml
|
|
||||||
spell_catalog_file: ./spell_catalog.json
|
|
||||||
|
|||||||
12
examples/campaigns/sample-campaign/fragments/brenna.yml
Normal file
12
examples/campaigns/sample-campaign/fragments/brenna.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
brenna:
|
||||||
|
player:
|
||||||
|
name: Rowan Hale
|
||||||
|
character:
|
||||||
|
name: Brenna
|
||||||
|
alias:
|
||||||
|
- Shield of Dawn
|
||||||
|
classes:
|
||||||
|
- name: paladin
|
||||||
|
level: 6
|
||||||
|
- name: warlock
|
||||||
|
level: 2
|
||||||
7
examples/campaigns/sample-campaign/fragments/inputs.yml
Normal file
7
examples/campaigns/sample-campaign/fragments/inputs.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
session_template_file: ../session.template.yml
|
||||||
|
inputs:
|
||||||
|
speakers_file: ../speakers.yml
|
||||||
|
autocorrect_file: ../autocorrect.yml
|
||||||
|
glossary_file: ../glossary.yml
|
||||||
|
party_file: ../party.yml
|
||||||
|
spell_catalog_file: ../spell_catalog.json
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
schema_version: narratio.party.v1
|
schema_version: narratio.party.v1
|
||||||
|
config:
|
||||||
|
imports:
|
||||||
|
- path: fragments/brenna.yml
|
||||||
|
destination: [characters]
|
||||||
|
required: true
|
||||||
|
|
||||||
characters:
|
characters:
|
||||||
arannis:
|
arannis:
|
||||||
@@ -12,15 +17,3 @@ characters:
|
|||||||
classes:
|
classes:
|
||||||
- name: wizard
|
- name: wizard
|
||||||
level: 8
|
level: 8
|
||||||
brenna:
|
|
||||||
player:
|
|
||||||
name: Rowan Hale
|
|
||||||
character:
|
|
||||||
name: Brenna
|
|
||||||
alias:
|
|
||||||
- Shield of Dawn
|
|
||||||
classes:
|
|
||||||
- name: paladin
|
|
||||||
level: 6
|
|
||||||
- name: warlock
|
|
||||||
level: 2
|
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
scriptorium:
|
character_items:
|
||||||
artifact_families:
|
enabled: true
|
||||||
character_items:
|
for_each: party.characters
|
||||||
enabled: true
|
prompt_id: dnd.character_items
|
||||||
for_each: party.characters
|
profile_id: production-placeholder
|
||||||
prompt_id: dnd.character_items
|
output_path_pattern: artifacts/characters/{character_id}/items.md
|
||||||
profile_id: production-placeholder
|
inputs:
|
||||||
output_path_pattern: artifacts/characters/{character_id}/items.md
|
character_meta:
|
||||||
inputs:
|
source: narratio.member_artifact.character_meta
|
||||||
character_meta:
|
required: true
|
||||||
source: narratio.member_artifact.character_meta
|
member_vars:
|
||||||
required: true
|
character_id: character_id
|
||||||
member_vars:
|
character_name: character.name
|
||||||
character_id: character_id
|
aliases: character.alias_summary
|
||||||
character_name: character.name
|
publish:
|
||||||
aliases: character.alias_summary
|
enabled: true
|
||||||
publish:
|
required: false
|
||||||
enabled: true
|
dest_pattern: artifacts/characters/{character_id}/items.md
|
||||||
required: false
|
|
||||||
dest_pattern: artifacts/characters/{character_id}/items.md
|
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
scriptorium:
|
character_meta:
|
||||||
artifact_families:
|
enabled: true
|
||||||
character_meta:
|
for_each: party.characters
|
||||||
enabled: true
|
prompt_id: dnd.character_meta
|
||||||
for_each: party.characters
|
profile_id: production-placeholder
|
||||||
prompt_id: dnd.character_meta
|
output_path_pattern: artifacts/characters/{character_id}/meta.md
|
||||||
profile_id: production-placeholder
|
member_vars:
|
||||||
output_path_pattern: artifacts/characters/{character_id}/meta.md
|
character_id: character_id
|
||||||
member_vars:
|
character_name: character.name
|
||||||
character_id: character_id
|
player_name: player.name
|
||||||
character_name: character.name
|
class_summary: character.class_summary
|
||||||
player_name: player.name
|
|
||||||
class_summary: character.class_summary
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
scriptorium:
|
enabled: true
|
||||||
artifacts:
|
prompt_id: dnd.player_handout
|
||||||
player_handout:
|
profile_id: production-placeholder
|
||||||
enabled: true
|
output_path: artifacts/player-handout.md
|
||||||
prompt_id: dnd.player_handout
|
inputs:
|
||||||
profile_id: production-placeholder
|
recap:
|
||||||
output_path: artifacts/player-handout.md
|
source: narratio.artifact.session_recap
|
||||||
inputs:
|
required: true
|
||||||
recap:
|
|
||||||
source: narratio.artifact.session_recap
|
|
||||||
required: true
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
scriptorium:
|
enabled: true
|
||||||
artifacts:
|
prompt_id: dnd.session_recap
|
||||||
session_recap:
|
profile_id: production-placeholder
|
||||||
enabled: true
|
output_path: artifacts/session-recap.md
|
||||||
prompt_id: dnd.session_recap
|
inputs:
|
||||||
profile_id: production-placeholder
|
transcript:
|
||||||
output_path: artifacts/session-recap.md
|
source: narratio.transcript.final_trimmed
|
||||||
inputs:
|
required: true
|
||||||
transcript:
|
|
||||||
source: narratio.transcript.final_trimmed
|
|
||||||
required: true
|
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
config:
|
||||||
|
sequences:
|
||||||
|
- destination: [publish, outputs]
|
||||||
|
key: source
|
||||||
|
mode: upsert
|
||||||
|
|
||||||
|
publish:
|
||||||
|
outputs:
|
||||||
|
- source: narratio.transcript.final_markdown
|
||||||
|
dest: transcripts/final.md
|
||||||
|
required: false
|
||||||
|
|
||||||
audita:
|
audita:
|
||||||
proposal_profile: narratio-testing-model-placeholder
|
proposal_profile: narratio-testing-model-placeholder
|
||||||
validation_profile: narratio-testing-validator-placeholder
|
validation_profile: narratio-testing-validator-placeholder
|
||||||
|
|||||||
@@ -1,13 +1,25 @@
|
|||||||
# Copyable production-base/testing-overlay entry point. ConfigKit expands only
|
# ConfigKit assembles these declared sources; destinations define artifact IDs.
|
||||||
# these explicit path and glob imports; Narratio never scans directories itself.
|
|
||||||
config:
|
config:
|
||||||
imports:
|
imports:
|
||||||
- path: conf.d/platform.yml
|
- path: conf.d/platform.yml
|
||||||
|
required: true
|
||||||
- path: conf.d/storage.yml
|
- path: conf.d/storage.yml
|
||||||
|
required: true
|
||||||
- path: conf.d/transcript.yml
|
- path: conf.d/transcript.yml
|
||||||
|
required: true
|
||||||
- path: conf.d/publish.yml
|
- path: conf.d/publish.yml
|
||||||
- glob: artifacts/*.yml
|
required: true
|
||||||
- glob: artifact-families/*.yml
|
- path: conf.d/local.yml
|
||||||
|
- path: artifacts/session_recap.yml
|
||||||
|
destination: [scriptorium, artifacts, session_recap]
|
||||||
|
required: true
|
||||||
|
- path: artifacts/player_handout.yml
|
||||||
|
destination: [scriptorium, artifacts, player_handout]
|
||||||
|
required: true
|
||||||
|
- dir: artifact-families
|
||||||
|
pattern: "*.yml"
|
||||||
|
destination: [scriptorium, artifact_families]
|
||||||
|
required: true
|
||||||
|
|
||||||
scriptorium:
|
scriptorium:
|
||||||
binary: scriptorium
|
binary: scriptorium
|
||||||
|
|||||||
2
examples/session-inputs/local-audio.yml
Normal file
2
examples/session-inputs/local-audio.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
inputs:
|
||||||
|
audio_dir: ../audio
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
|
config:
|
||||||
|
imports:
|
||||||
|
- path: session-inputs/local-audio.yml
|
||||||
|
required: true
|
||||||
session_id: 2026-05-03
|
session_id: 2026-05-03
|
||||||
date: 2026-05-03
|
date: 2026-05-03
|
||||||
title: Sample Session
|
title: Sample Session
|
||||||
inputs:
|
|
||||||
audio_dir: ./audio
|
|
||||||
|
|||||||
50
internal/config/collection_authoring_test.go
Normal file
50
internal/config/collection_authoring_test.go
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAuthoredPublishOutputCollectionOperations(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
root := writePipelineFixture(t, dir, "pipeline.yml", `config:
|
||||||
|
sequences:
|
||||||
|
- destination: [publish, outputs]
|
||||||
|
key: source
|
||||||
|
publish:
|
||||||
|
outputs:
|
||||||
|
- {source: narratio.transcript.final_markdown, dest: transcripts/base.md, required: true}
|
||||||
|
`)
|
||||||
|
for _, tc := range []struct {
|
||||||
|
name string
|
||||||
|
mode string
|
||||||
|
body string
|
||||||
|
want []string
|
||||||
|
}{
|
||||||
|
{"append", "append", "[{source: narratio.transcript.final_trimmed, dest: transcripts/extra.json, required: false}]", []string{"transcripts/base.md", "transcripts/extra.json"}},
|
||||||
|
{"upsert", "upsert", "[{source: narratio.transcript.final_markdown, dest: transcripts/replaced.md, required: false}]", []string{"transcripts/replaced.md"}},
|
||||||
|
{"replace", "replace", "[]", []string{}},
|
||||||
|
{"empty append", "append", "[]", []string{"transcripts/base.md"}},
|
||||||
|
{"empty upsert", "upsert", "[]", []string{"transcripts/base.md"}},
|
||||||
|
} {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
selection := strings.ReplaceAll(tc.name, " ", "_")
|
||||||
|
writePipelineFixture(t, dir, "overlays/"+selection+".yml", "config:\n sequences:\n - destination: [publish, outputs]\n key: source\n mode: "+tc.mode+"\npublish:\n outputs: "+tc.body+"\n")
|
||||||
|
cfg, err := LoadPipelineWithOptions(root, PipelineLoadOptions{Overlay: &selection})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
got := make([]string, 0, len(cfg.Publish.Outputs))
|
||||||
|
for _, output := range cfg.Publish.Outputs {
|
||||||
|
got = append(got, output.Dest)
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(got, tc.want) {
|
||||||
|
t.Fatalf("output destinations = %v, want %v", got, tc.want)
|
||||||
|
}
|
||||||
|
if tc.name == "upsert" && (cfg.Publish.Outputs[0].Required == nil || *cfg.Publish.Outputs[0].Required) {
|
||||||
|
t.Fatal("upsert did not replace the whole matching output")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -429,6 +429,28 @@ func TestExamplesLoadAndValidate(t *testing.T) {
|
|||||||
if len(cfg.Pipeline.Publish.Outputs) != 3 {
|
if len(cfg.Pipeline.Publish.Outputs) != 3 {
|
||||||
t.Fatalf("publish outputs = %#v, want transcript plus two family outputs", cfg.Pipeline.Publish.Outputs)
|
t.Fatalf("publish outputs = %#v, want transcript plus two family outputs", cfg.Pipeline.Publish.Outputs)
|
||||||
}
|
}
|
||||||
|
foundTranscript := false
|
||||||
|
for _, output := range cfg.Pipeline.Publish.Outputs {
|
||||||
|
if output.Source == "narratio.transcript.final_markdown" {
|
||||||
|
foundTranscript = true
|
||||||
|
if output.Required == nil || *output.Required != (profile.selection == "") {
|
||||||
|
t.Fatalf("overlay transcript output = %#v", output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !foundTranscript {
|
||||||
|
t.Fatal("transcript output is missing")
|
||||||
|
}
|
||||||
|
for label, render := range map[string]func() ([]byte, error){
|
||||||
|
"campaign": func() ([]byte, error) { return RenderCampaignDocument(cfg) },
|
||||||
|
"session": func() ([]byte, error) { return RenderSessionDocument(cfg, cfg.Session.SessionID) },
|
||||||
|
"party": cfg.Party.Canonical.YAML,
|
||||||
|
} {
|
||||||
|
data, err := render()
|
||||||
|
if err != nil || strings.Contains(string(data), "imports:") || strings.Contains(string(data), "extends:") {
|
||||||
|
t.Fatalf("standalone %s = %q, %v", label, data, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
catalog, err := EffectiveArtifactCatalog(cfg.Pipeline, cfg.Party)
|
catalog, err := EffectiveArtifactCatalog(cfg.Pipeline, cfg.Party)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user