3.9 KiB
3.9 KiB
Development Guide
Purpose
Canonical contributor workflow and engineering conventions for implemented Narratio behavior.
Repository layout
cmd/narratio/: CLI entrypoint.internal/app/: command handlers, run/stage orchestration, cleanup gates, secrets loading.internal/config/: strict YAML loading, defaults, and validation.internal/stage/: stage implementations and stage registry/order.internal/adapters/: external boundary adapters (WhisperX, Seriatim, Audita, Scriptorium, storage, notify).internal/manifest/: session/run manifest types and persistence.internal/artifacts/: canonical local/remote path helpers and local artifact store.docs/: canonical documentation set.examples/: maintained config examples used by tests.
Build and test commands
- Run focused CLI behavior checks:
go test ./internal/app -run TestExecute -v
- Run config example load/validate checks:
go test ./internal/config -run TestExamplesLoadAndValidate -v
- Run full test suite:
go test ./...
Coding conventions
- Keep orchestration explicit and stage-driven; do not introduce generic workflow/DAG abstractions.
- Keep external-system details inside adapter packages; stages should consume Narratio-level contracts only.
- Use centralized path helpers from
internal/artifactsrather than ad hoc path concatenation. - Preserve manifest-driven state transitions (
running,succeeded,failed,skipped,stale) as the source of run progress. - Keep user/operator docs implementation-accurate; planned work belongs only under
docs/roadmap/.
For design principles and invariants, see docs/architecture.md. For stage/adapter contracts, see docs/internal/README.md.
Dependency policy
- Prefer Go standard library where practical.
- Add third-party dependencies only when they provide clear value for required behavior.
- Keep dependency additions narrow to the boundary package that needs them.
Change playbooks
Add config fields
- Add fields to config structs in
internal/config. - Set defaults in
internal/config/defaults.gowhen appropriate. - Add validation rules in
internal/config/validate.go. - Add or update load/validate tests in
internal/config/*_test.go. - Update canonical config docs and examples:
- docs/config.md
- relevant files under
examples/
Add CLI flags or commands
- Update command parsing and behavior in
internal/app. - Add or update command tests (
TestExecuteand command-specific tests). - Update docs/cli.md and, if operator workflow changes, docs/operations.md.
Remote-storage commands must obtain object storage through the app-level command object-store helper. Do not call storage.NewObjectStoreFromConfig directly from command handlers; the helper loads configured filesystem secrets before constructing the storage adapter.
Add or modify stages/adapters
- Implement stage behavior in
internal/stagewith clear input/output boundaries. - Keep external transport/subprocess details in
internal/adapters. - Preserve manifest and publish-output semantics expected by runner and publish logic.
- Add/update stage and adapter tests.
- Update internal component contracts in
docs/internal/.
Update examples
- Keep canonical examples only in
examples/. - Ensure examples load and validate through runtime config paths.
- Update
internal/config/load_validate_test.goas needed. - Update links in
docs/config.mdif example filenames change.
Update docs and roadmap
- Keep implemented behavior in canonical docs (
README,docs/*.md,docs/internal/). - Keep planned/unimplemented behavior only in
docs/roadmap/. - After completing roadmap items, remove or mark them complete in
docs/roadmap/documentation.md. - Run a link/path sweep before finalizing changes.