diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 4a67869..c7d83ed 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -1,441 +1,371 @@ -# ConfigKit and CommandKit adoption implementation plan +# ReleaseKit adoption implementation plan ## Scope and execution -Implement the target in [config.md](config.md). This plan is for a Luna coding -agent working through one end-to-end sprint. Execute the numbered stages in -order. Intermediate stages may leave callers or tests temporarily incompatible; -do not add compatibility routes merely to keep each intermediate commit green. -The completed sprint must compile, pass validation, and implement the full target. -Report intermediate verification limitations accurately. +Implement the target in [releasekit.md](releasekit.md). This plan is for a Luna +coding agent completing one end-to-end sprint. Execute Stage 1 through Stage 7 +in order. Intermediate stages may leave scripts, callers, tests, or documentation +temporarily inconsistent. Reach the final native workflow directly; temporary +compatibility layers and repeated intermediate full-suite runs are unnecessary. -Start each prompt with `docs/development.md` and `docs/policy/agents.md`. Read -the architecture and testing policies for code work, the documentation policy for -documentation work, and the OSS policy for dependency/attribution work. Follow -the repository's graph-first code-discovery guidance. File names below identify -the current owners, not a requirement to preserve their internal structure. +The baseline is Narratio commit +`0d0596b204ab3a374c522e7e9d8395b8b0b0ce8a`, which added the feature roadmap +without implementing it. This plan replaces the completed ConfigKit/CommandKit +implementation plan; those features remain part of the baseline. -Read the feature roadmap once for scope and intent, then the focused files named -by each stage. Use its pinned upstream references for native semantics. This plan -specifies Narratio changes; it is not a replacement library reference. +Start each implementation prompt with `docs/development.md` and +`docs/policy/agents.md`. Read the release, architecture, testing, documentation, +and OSS policies where the stage affects their topics. Reuse unchanged policy +context. Follow graph-first code discovery. The file names below identify +current owners; their internal structure is not a preservation requirement. + +Read the feature roadmap for scope and selections. Its pinned ReleaseKit v0.10.0 +links are the canonical upstream references. A sibling checkout at +`../ReleaseKit` can supply those documents and templates after verifying commit +`82bac1a3ab935beddd4b8789d1e07f52135d4243`; the released module is the dependency. + +Mark each stage completed here with a short outcome and relevant verification. +Follow the repository's focused-commit policy. Report intermediate validation +limitations accurately; a stage need not pass tests made obsolete by a later +stage. This sprint does not authorize an upstream push, real release tag, +hosted release, or live delivery. ### Decisions carried into implementation -- Select ConfigKit v1.4.0, CommandKit v0.8.0, and `ckconfig` v0.11.0 together. - Preserve the Go minimum and maintained toolchain. -- Pipeline selection produces a native source. Command-owned acquisition calls - `LoadSecretsIntoEnvironmentFromConfig` and passes the returned source to the - same pure pipeline loader used by library callers. Leave bootstrap options at - their native defaults, including filesystem context and overwrite selection. -- Retire `--secrets-dir` and the conventional-directory fallback completely. - Ordinary library loading remains free of environment writes. -- Reuse an acquired result within its acquisition object. Each distinct pipeline - acquisition performs ordinary native preparation and loading. Comparison - sides use that same path, shared process environment, and native `ckconfig` - comparison behavior. No primary-side bootstrap or environment restoration. -- Use a small CommandKit invocation feature for bootstrap evidence reporting, - as described in Stage 5. Acquisition retains fallible startup work. This - replaces the current byte-buffer capture and scope report-forwarding wrappers. -- Preserve the existing app, campaign, session, and party scopes, configuration - rules, domain catalogs, persistence, resume evidence, subprocess credential - forwarding, and cleanup behavior apart from the agreed startup changes. - Audita/workspace implementation, new scopes, and `ckprompt` are separate work. -- Keep upstream feature documentation upstream. Local documentation describes - Narratio's selections, wiring, domain rules, and operator workflows. +- Adopt ReleaseKit v0.10.0 as both a registered CLI tool and the runtime + `buildinfo` dependency. Keep the existing Narratio module path, Go 1.27.0 + consumer minimum, and selected Go 1.27.4 toolchain. +- Keep the root-module `main`/`origin` release workflow. Maintainers push the + candidate before native `publish`; publication pushes its annotated tag. +- Narratio owns the profile, release note, selected destinations and platforms, + and small invocation/integration wiring. ReleaseKit owns validation execution, + tag mechanics, native diagnostics and recovery, builds, and delivery. +- Keep native race, full vet, formatting, and local-replacement checks. Use the + selected application builds for platform verification. Remove custom release + gates and leave other optional validations unselected. +- Confirmed source-tag publication is completion. CI, hosted content, and + installation remain separate observations. Use native recovery on uncertainty. +- Keep the existing binary names, `SHA256SUMS`, and platform support. Map the + existing CI secret to ReleaseKit's environment variable. +- Keep shared-library documentation upstream. Local documentation owns + Narratio's selections and short, executable maintainer workflow. +- Historical tags and release records remain unchanged. ConfigKit, CommandKit, + application configuration, session behavior, and the Audita/workspace features + are outside this implementation scope. -## Stage 1 — Update the coordinated dependencies and notices +## Stage 1 — Add ReleaseKit and adopt the native runtime version -**Completed.** Updated the three coordinated modules and commit-pinned notices; -other dependency versions and Go declarations are unchanged. Upstream copyright -and license terms match the retained texts. Configuration, application, and -documentation checks and the repository build pass with Go 1.27.4. +Status: pending. -Read `go.mod`, `go.sum`, the three component entries in -`docs/oss/attribution.md`, and the release references in the feature roadmap. +Read `go.mod`, `go.sum`, `internal/app/commands.go`, +`internal/app/version_test.go`, `internal/buildinfo/buildinfo.go`, and +`docs/oss/attribution.md`. Consult upstream consumer adoption, runtime-version, +and v0.10.0 release guidance, plus its COPYRIGHT and LICENSE. -1. Update ConfigKit to v1.4.0, CommandKit to v0.8.0, and `ckconfig` to v0.11.0. - Resolve/tidy the module graph without adding local replacements, sibling - checkout dependencies, or unrelated upgrades. -2. Update the three attribution entries to the exact imported commits recorded - in the roadmap, retaining the current license expressions and notice format. - Check the upstream notices; reuse unchanged local standard texts. -3. Keep the existing Go/platform declarations and CommandKit/ckconfig public - assembly unless a real compilation adjustment is required. Convert any - affected positional upstream struct literal to a keyed literal. +1. Register the released tool with + `go get -tool go.maximumdirect.net/releasekit/cmd/releasekit@v0.10.0`. + Keep one module selection shared by the tool and runtime import. Use the + selected official Go toolchain; do not add a local module replacement. +2. In `newApplication`, import + `go.maximumdirect.net/releasekit/buildinfo` and supply `buildinfo.Version()` + to `commandkit.Identity`. Keep existing CommandKit commands and presentation. +3. Remove `internal/buildinfo/buildinfo.go` once its callers are replaced. + Replace the version test's global assignment/restoration with an assertion + that Narratio's structured version output has name `narratio` and the value + returned by the native accessor. Retain the invalid-argument test. Native + builder verification in Stage 7 covers injected release identifiers. +4. Run `go mod tidy` after the imports and tool directive are in place. Retain + dependency changes required by module selection and review any collateral + changes. Do not opportunistically upgrade the other native libraries. +5. Add a ReleaseKit attribution entry for v0.10.0 at the pinned full upstream + commit, preserving its copyright statement and LGPL-3.0-or-later expression. + Reuse the existing LGPL and GPL standard texts. Review relevant transitive + notice changes based on actual incorporation/distribution; membership in a + tool's module graph alone does not require attributing every tool dependency. + Stage 6 finalizes the copied-wiring scope after those files exist. -Validation: inspect the selected module versions and dependency diff. Run -`go test ./internal/config ./internal/app ./internal/doccheck` and -`go build ./...` as an initial compatibility check. Subsequent stages intentionally -change startup behavior; this compatibility check is not sprint completion. +Validation: inspect the module diff and registered tool declaration. Run +`go test ./internal/app` and `go build ./cmd/narratio`. Existing script tests +and scripts still refer to the old linker variable until Stage 5; do not add a +version compatibility shim to accommodate them. -## Stage 2 — Share native source selection and pure pipeline loading +Completion: the application reads its version from ReleaseKit, and the released +CLI tool is retained by the module metadata. -**Completed.** Centralized explicit/discovered native source selection and added -a pure source-taking loader that retains existing resolution and metadata. A -prepared-source regression verifies captured main content, source-relative -context, provenance, and that ordinary loading does not bootstrap secrets. The -full configuration package passes with Go 1.27.4. +## Stage 2 — Define the profile and minimal native launcher -Read `internal/config/load.go`, `pipeline_configkit.go`, -`pipeline_discovery_test.go`, `pipeline_configkit_test.go`, and -`native_results_test.go`. Consult ConfigKit's prepared-source contract. +Status: pending. -1. Extract the existing file/search source construction into one helper, proposed - name `PipelineSource(path, opts)`. Keep current explicit-file selection, - discovery order, injected `Search`, and required-search behavior. -2. Add a source-taking entry point, proposed name - `LoadPipelineSourceWithOptions(source, opts)`. It must perform the current - `loadPipelineConfigKitResult`, metadata attachment, and - `finalizeLoadedPipeline` path with the supplied native source. -3. Make `LoadPipelineWithOptions(path, opts)` select its source and delegate to - that entry point. Existing library callers continue to load configuration - without bootstrapping the process environment. -4. Preserve overlay normalization, inspection overrides, defaults, resolution, - validation, native result retention, selected-source provenance, and effective - digest behavior. Do not reconstruct or serialize a prepared source to a new - file/bytes source. Keep ConfigKit types inside the existing config/application - boundary rather than adding a general source abstraction. -5. Add a focused test that a native prepared source is consumed successfully - after its original main file changes, while its original source identity and - context remain useful. Also verify that the pure loader alone does not apply - a declared secrets directory. These tests protect Narratio's handoff, not - ConfigKit's entire snapshot implementation. +Read the roadmap's release selections, upstream adoption and profile references, +and `.gitignore`. -Validation: `go test ./internal/config`. Reuse existing import, discovery, -overlay, provenance, and materialization tests rather than duplicating them. +1. Create root `releasekit.json` with this complete initial selection: -## Stage 3 — Replace startup guards with ordinary pipeline acquisition - -**Completed.** Pipeline acquisition now selects and prepares a native source, -retains its bootstrap report, and loads the prepared source with normal result -reuse. Explicit local document acquisition remains lazy; removed the old guard, -directory probe, duplicate startup route, and per-command resets. Direct -acquisition fixtures use the new seams. The repository build and configuration -suite pass with Go 1.27.4; application tests await the scheduled fixture/CLI -migration in Stage 4 and cannot yet compile. Reporting is scheduled for Stage 5. - -Read `internal/app/configuration_acquisition.go`, `config_loader.go`, -`command_dependencies.go`, `secrets_bootstrap.go`, and the Stage 2 entry points. -Use graph search to find startup resets and dependency seams in command helpers. - -1. Change `configurationAcquisition.Pipeline` to check cancellation/selection, - return its cached pipeline when available, then select, prepare/bootstrap, - and load the native source. Keep the bootstrap report separately from the - completed configuration, including on preparation/bootstrap failure. -2. Replace the old path-based loader/direct-directory test seams with narrow - seams for native source preparation and source loading where needed by - existing tests. Their production defaults call ConfigKit's helper and the - Stage 2 loader. Source selection has one owner; the application uses the - shared selection helper and passes `pipelineSearch` through existing options. -3. Consolidate or remove `loadPipelineConfigWithDependencies` so it no longer - constitutes another startup route. Preserve useful error context and native - causes. Obtain the resolved pipeline path from the completed native result. -4. Delete `secretsBootstrap`, `selectedSecretsDirectory`, the conventional path - variable/probe, `loadSecretsDir`, and the per-command bootstrap resets. - Remove `bootstrap()` calls from campaign/party/session/domain acquisition; - retain their cancellation and selection checks where still needed. -5. Keep explicit local campaign/session/party inspection independent of pipeline - acquisition. Retain remote session acquisition and resource release through - the existing domain path. Every command that needs a pipeline, including - planning, initialization, restore, and clean-all, reaches the same ordinary - pipeline acquisition. -6. Cache completed results normally. Distinct acquisitions, including native - comparison loads, prepare their own sources. Do not replace the retired - invocation guard with a source-keyed bootstrap registry, cached environment, - failure-replay mechanism, or primary/secondary role flag. - -The small reporting connection needed here is completed in Stage 5. Update -direct acquisition tests as the new seams become available. Other caller/test -breakage can remain visible until Stage 4; do not retain old startup machinery -as a temporary compatibility API. - -Validation: focused acquisition and pure-loader tests that are runnable at this -point. Confirm by code review that environment mutation occurs only in explicit -command-side native preparation, and reuse returns before another preparation. - -## Stage 4 — Remove the CLI surface and migrate affected fixtures - -**Completed.** Removed the secrets-directory selector and binding from the -command tree, and migrated acquisition and credential fixtures to configured -bootstrap or disposable environment values. Retired obsolete fallback/guard -tests and conventional-directory test setup; representative help and rejection -coverage protects the removed flag. Application and process tests pass with Go -1.27.4. Native final bootstrap reporting is addressed in Stage 5. - -Read `internal/app/command_selection.go`, command declarations reached by its -flags, `configuration_commands.go`, and tests identified by graph search for -`SecretsDir`, `secretsBootstrap`, and `loadSecretsDir`. - -1. Remove the secrets selector field, flag binding, empty-value check, scope - selector registration, and flag installation from every command declaration. - Retain other selectors and domain input checks. -2. Migrate existing command fixtures using `--secrets-dir` to a root pipeline - declaration and a temporary adjacent secrets directory, or to disposable - environment values when the fixture is not testing bootstrap. Keep unrelated - test intent intact; no real credentials or installed directories. -3. Delete obsolete tests of the removed flag/fallback helpers and invocation - guard. Update loader stubs to the Stage 3 seam. Remove `TestMain`'s temporary - conventional-directory redirection in `test_environment_test.go` when it has - no remaining purpose; retain useful environment-restoration helpers. -4. Add representative CLI coverage that the removed flag is absent from help - and rejected as an unknown flag. The shared binding removal supplies the - rest of the command tree; do not add a separate exhaustive parser suite. - -Validation: compile/test `internal/app` and `cmd/narratio` as far as remaining -Stage 5 reporting changes allow. Search active code for retired selectors and -bootstrap types; remaining references should be intentional retirement tests, -not production compatibility handling. - -## Stage 5 — Report native bootstrap evidence through CommandKit - -**Completed.** Added an invocation-local native final diagnostic report for -bootstrap evidence and secrets diagnostics, preserving native errors and safe -rendering independently of command report format. Removed the former buffers, -bootstrap writer and scope wrappers; each native scope load creates its own -acquisition. Focused success, quiet, failure, cancellation, later-load failure, -redaction and writer-failure checks pass with the application and process suites -on Go 1.27.4. - -Read `internal/app/commands.go`, `command_reporting.go`, `command_outcome.go`, -`configuration_commands.go`, and the upstream invocation-feature, `Report`, -`SecretsReport`, and diagnostic-rendering APIs at the adopted versions. - -1. Install one flag-free CommandKit invocation feature through normal application - assembly. Its `Start` creates a small invocation-local evidence collector and - places it in the context. Startup does no file access or bootstrap. Keep the - caller's cancellation context intact. -2. Ordinary pipeline acquisition records its returned native `SecretsReport` - reference in that collector, including when preparation fails or a later - configuration load fails. On `SecretsError`, retain native diagnostic records - for presentation as well. Acquisition still returns the native error through - the normal command outcome path; the collector does not choose success. -3. Return a final report producer from the feature. Use native final diagnostic - timing, text rendering independent of the main `--format`, and quiet-mode - handling. This intentionally replaces the old successful-bootstrap Info-only - delivery path with native final diagnostic reporting. No evidence means no - rendered bytes; help and direct non-pipeline inspection acquire no evidence. -4. Bridge native evidence to `commandkit.Report` with a small text template and - a value whose rendering method delegates to `SecretsReport.WriteTo` and - `configkit.WriteDiagnostics` for bootstrap-directory failures. `Report` exposes - `Value`/`TextTemplate`, not an arbitrary writer callback: a local - `strings.Builder` in that final formatter is sufficient. Preserve renderer - errors for CommandKit; do not duplicate native line formatting or retain an - eagerly rendered error/report string. Only safe native bootstrap evidence - belongs in this report, never configuration credential values. -5. Leave `LoadError` presentation to existing native ckconfig adaptation and - domain outcome handling, avoiding a second copy in the bootstrap report. - Keep joined operational/cancellation causes and current native classification; - do not invent custom status codes or translate `SecretsError` into `LoadError`. -6. Remove `pendingDiagnostics`, `bootstrapDiagnostics`, the diagnostic-only - `Scope.Acquire`/`Scope.Compare` wrappers, and the old bootstrap writer adapter - where now unused. Remove the `independent` flag and selection-to-acquisition - map: each native scope loader callback creates its own acquisition object - with that callback's selections and overrides. Reuse within that object's - dependency chain remains sufficient. This lets native comparison loaders - receive separate results without any local comparison wrapper, and permits - distinct aggregate-scope loads to perform ordinary startup as well. -7. Keep substantive command reports, logging adapters, final persistence, and - session resource cleanup on their existing boundaries. Diagnostic delivery - failures remain CommandKit's finalization concern and do not interrupt durable - work. A background-context unit test can inspect acquisition-retained evidence; - it does not need a fallback global reporter. - -Validation: focused native invocation/reporting tests for successful bootstrap, -bootstrap failure, later load failure, cancellation, quiet, JSON main output, -empty evidence, and diagnostic writer failure. Assert useful evidence, preserved -causes, separation of stdout/stderr, and absence of synthetic credential values; -do not snapshot incidental wording or require old buffers/wrapper choreography. - -## Stage 6 — Verify configured startup behavior at stable boundaries - -**Completed.** Added real configured-startup checks for explicit and discovered -sources, relative context, provenance, acquisition reuse, environment-only -operation, preservation/overwrite and existing-empty values, missing startup -input, and absence of implicit adjacent-directory selection. Existing fixtures -cover native errors/reports, retained effects, and adapter credential forwarding. -Configuration, application and process suites and focused race checks pass with -Go 1.27.4. - -Read the migrated `secrets_bootstrap_test.go`, -`configuration_acquisition_test.go`, `configuration_commands_test.go`, and -existing environment helpers. Consolidate into focused behavioral fixtures. - -1. Use real ConfigKit and temporary files for explicit-file and search-discovered - pipeline startup. Verify configured credentials resolve into the completed - typed pipeline and that ordinary repeated access to that acquired result - reuses it. Include source-relative directory selection from a different - invocation directory and preserved native source/provenance evidence. -2. Exercise environment-only loading and native preservation/explicit-overwrite - behavior, including an existing empty variable where relevant. Omit the - directory declaration to show there is no Narratio auto-selection of an - adjacent `secrets/` directory. Removal of the fixed probe plus this test is - sufficient; do not touch the real system-wide directory to test its absence. -3. Verify declared missing/invalid startup input fails before pipeline execution - or adapter construction, retaining native report/error evidence. A successful - bootstrap followed by invalid pipeline data leaves the applied environment - value and report available. For partial application failures that cannot be - induced portably, use the narrow preparation seam to propagate a native - partial report/error instead of reproducing ConfigKit's filesystem internals. -4. Preserve credential forwarding/redaction coverage for Audita, Notarius, - Scriptorium, and storage. Existing tests of native configuration, catalog - derivation, prepared snapshots, and semantic resume should remain meaningful; - change obsolete startup fixtures rather than weakening their actual checks. - -Validation: `go test ./internal/config ./internal/app ./cmd/narratio` and focused -race tests for changed application paths. Environment-mutating tests restore -variables and do not run concurrently with other process-environment mutations. -Avoid redundant tests of upstream limits, symlink policy, or exact error wording. - -## Stage 7 — Verify native comparisons and lazy acquisition - -**Completed.** Real comparison fixtures exercise independently prepared pipeline -sources, shared-environment preservation/overwrite, and both placements of a -single pipeline-dependent party selection. Existing direct-document, override, -discovery, and lazy-command fixtures remain in place. The full application suite -passes with Go 1.27.4. - -Read `configuration_comparison_test.go`, `configuration_acquisition_test.go`, -`commands_boundary_test.go`, and the native ckconfig comparison contract. - -1. Keep existing independent selector/default and override-isolation coverage. - Add a real two-pipeline comparison with distinct configured secrets directories - and a shared disposable variable. Native preservation and overwrite determine - each completed result in library acquisition order; no test-time environment - isolation is inserted into production code. -2. Cover a comparison where only one side needs pipeline acquisition, such as - exact party-file selection on one side and campaign discovery on the other. - Assert that the reached pipeline's configured bootstrap works, whichever side - needs it. Let ckconfig handle early failure, result comparison, and output. -3. Verify explicit local campaign/session/party inspection remains usable without - acquiring pipeline configuration just for bootstrap. Reuse the existing - acquisition-free help/version/completion/scope-listing and bare-explain tests. -4. Remove obsolete shared-bootstrap expectations and comparison wrappers/tests - whose only purpose was preserving implementation bookkeeping. Tests protect - ordinary acquisition reuse and native pass-through, not a new comparison - transaction, primary-source rule, retry protocol, or isolation contract. - -Validation: focused comparison/boundary tests, then `go test ./internal/app`. -Comparison is best effort; keep the cases small and avoid a bespoke comparator, -per-side environment snapshots, or a matrix duplicating native library tests. - -## Stage 8 — Simplify public configuration and CLI documentation - -**Completed.** Updated the configuration and CLI references for configured -startup, shared-process comparison, final diagnostics, and removal of the flag -and fallback. General ConfigKit and CommandKit syntax and reporting descriptions -now link to the adopted versions while Narratio selectors, domain behavior, and -report fields remain local. Documentation checks pass with Go 1.27.4. - -Read `docs/config.md`, `docs/cli.md`, and the adopted documentation policy's -Upstream Dependencies rule. Use the roadmap's pinned upstream contracts. - -1. Replace generic ConfigKit feature explanations with a short identification - and canonical version-appropriate links. Keep Narratio's schema, discovery - choices, resource interpretation, scope selection, domain validation, and - environment bootstrap integration discoverable locally. -2. Replace generic CommandKit/ckconfig parsing, visibility tables, inspection - field descriptions, pointer syntax, and library comparison rules with links. - Keep Narratio's command inventory, installed selectors/scopes, domain reports, - and short practical invocation examples. -3. Document removal of the flag/fallback and the new pipeline-owned selection. - Explain only the local acquisition choice and shared-process comparison - integration; link upstream for control definitions and environment semantics. - Distinguish final bootstrap diagnostics from substantive command output. -4. Refresh imported-version links, consolidate redundant sections, and repair - inbound anchors as sections move. Do not remove application-specific facts - merely because they are adjacent to duplicate library prose. - -Validation: review this diff against runtime changes and the ownership policy; -run `go test ./internal/doccheck`. No new upstream tutorial or report contract -belongs in Narratio as part of this cleanup. - -## Stage 9 — Align policy, operator guidance, internals, and examples - -**Completed.** Updated architecture startup policy and operator, troubleshooting, -internal, and example guidance for configured bootstrap and migration. Added -version-pinned upstream links and a commented main-file example while preserving -credential protection and historical decisions. Documentation and maintained -example checks pass with Go 1.27.4. - -Read `docs/policy/architecture.md`, `docs/operations.md`, -`docs/troubleshooting.md`, `docs/internal/configuration.md`, -`docs/internal/overview.md`, `docs/development.md`, `examples/README.md`, and -affected maintained YAML/integration documents found by non-code text search. - -1. Revise the architecture startup paragraph affirmatively: explicit command-side - preparation uses ConfigKit's configured bootstrap before that pipeline's typed - credentials and adapters; completed acquisitions are reused normally; native - environment policy applies. Remove once-per-invocation, fixed-directory, and - always-environment-wins requirements. Preserve credential protection and the - existing ownership boundary. Leave accepted ADR 0003's decision unchanged. - Retain policy provenance and update the local modification date. -2. Keep internal docs about Narratio's wiring, acquisition state, safe persistence, - and domain derivation; link to library APIs for upstream behavior. The adopted - documentation policy already supplies the needed rule; no policy-suite rewrite - or extra ADR is required. -3. Update operations/troubleshooting and examples to remove the flag and fallback - recommendations. Explain migration: remove the flag from invocations, declare - a directory through native main-file controls, or provision environment values. - An adjacent system-wide pipeline can retain `secrets_dir: secrets`. Use native - default filesystem context; other layouts follow upstream path rules rather - than gaining a new Narratio path override or automatic migration shim. -4. Keep copyable maintained examples free of real credentials. Existing examples - need no secrets directory by default. A small commented startup declaration - in the full annotated pipeline can demonstrate where the selection belongs; - link upstream for its definition. Preserve usable example commands and test - them through the existing example owner. -5. Replace duplicate library guidance in operator/integration/example documents - with upstream links, retaining actual subprocess argument mappings, resume - implications, and Narratio development workflows. Identify PromptKit only in - its actual downstream role; no direct dependency is added. Historical release - notes and accepted decision records remain historical records. - -Validation: `go test ./internal/doccheck` and -`go test ./internal/config -run '^TestExamplesLoadAndValidate$'`. Search current -documentation for stale flag/fallback instructions and upstream feature reference -copies. Preserve a reference only when it describes intentional migration/history -or an actual Narratio-specific responsibility. - -## Stage 10 — Complete the integration and simplification review - -**Completed.** Reviewed the dependency graph and notices, native prepared-source -startup and ordinary acquisition reuse, lazy document inspection, comparison -behavior, diagnostic reporting, and documentation ownership. Removed stale test -names. Full tests, race tests, vet, build, module-tidiness and diff checks pass -with Go 1.27.4; focused checks pass after the test-name cleanup. Maintained -examples and documentation checks are included. No release, tag, push, or CI -wait was performed. - -Read the final diff and the feature roadmap's Targeted End State and Verification -sections. Finish remaining mechanical fixture/caller cleanup from earlier stages. - -1. Confirm the selected dependency graph and attribution match Stage 1. Verify - no sibling checkout or `replace` is needed to build or run default tests. -2. Confirm there is one ordinary command-side pipeline preparation/load route, - pure library loading, normal acquisition reuse, and no retired selector, - directory probe, blanket bootstrap guard, diagnostic capture/reset buffer, - role-based comparison startup, or environment-restore machinery left active. -3. Review code for proportionate simplification. Remove dead dependencies, - helpers, state, and obsolete tests made unnecessary by this work. Keep useful - domain boundaries; no LOC quota or unrelated refactoring is required. -4. Run the maintained Go toolchain's full verification: - - ```sh - go test ./... - go test -race ./... - go vet ./... - go build ./... - git diff --check + ```json + { + "product": "Narratio", + "remote": "origin", + "validation": { + "go": { + "race": true, + "full_vet": true + }, + "go_format": true, + "module_distribution": { + "local_replacements": true + } + }, + "build": { + "main_package": "./cmd/narratio", + "binary_name": "narratio", + "targets": ["linux/amd64", "linux/arm64", "darwin/arm64"] + }, + "delivery": { + "forge": "gitea", + "base_url": "https://forge.maximumdirect.net", + "owner": "eric", + "repository": "narratio", + "token_env": "RELEASEKIT_GITEA_TOKEN" + } + } ``` - The full suite includes maintained examples and documentation checks. Use - local/fake subprocesses and services; no paid or live-provider smoke tests. -5. Verify the documentation follows ownership policy and the roadmap's runtime - changes are all accounted for. Update implementation status honestly, review - staged changes, and commit completed work under the repository's plain-English - commit policy. Report test results and any outstanding work. This sprint does - not authorize a release, tag, push, or CI wait. + Omit `module_dir` for the root module. Omit additional `checks`, + `expected_push_url`, `compile_targets`, workspace/file-size/Markdown checks, + token files, and other optional selections. The Git destination documented + by the runbook is the existing `origin` URL, not an extra profile guard. +2. Add an executable root `releasekit` file using the short forwarding launcher + from upstream adoption guidance: POSIX shell, native `GOHOSTOS`/`GOHOSTARCH` + selection, and a direct `exec` of the full registered tool package with + `"$@"`. Maintainers invoke it from the repository root. Preserve the native + exit status and argument forwarding. +3. Keep the launcher confined to tool invocation. Profile interpretation, + dependency preparation, validation, tag logic, records, and recovery use + native commands. Retain upstream environment and toolchain behavior. +4. Add `/dist/` to `.gitignore` for the native builder's default retained output. + Private publication records already live under Git's own directory. No local + delivery-token file or new credential-storage convention is needed. -Completion means all ten stages' end-state work is present and repository-wide -verification succeeds; earlier compatibility tests or a dependency-only upgrade -do not establish completion. +Validation: run `sh -n ./releasekit` and `./releasekit version` after tool +dependency preparation. Confirm the selected tool reports v0.10.0. Also invoke +the launcher with an ambient cross target, such as +`GOOS=windows GOARCH=amd64 ./releasekit version`, to verify host selection; this +is a tool-launch check, not a change to supported Narratio platforms. Native +profile consumption is exercised by Stage 7. + +Completion: profile selections are declarative and maintainers have a direct +entry point for native subcommands. + +## Stage 3 — Adopt the upstream Woodpecker delivery workflow + +Status: pending. + +Read `.woodpecker/release.yml`, the v0.10.0 root-module tag-delivery template, +and the upstream delivery guide's Woodpecker section. + +1. Replace `.woodpecker/release.yml` with the matching upstream template. + Keep its native matrix/list structure and `golang:1.27.4-bookworm` selection. + Adapt only Narratio-specific wiring and a concise source-version comment. +2. Map `RELEASEKIT_GITEA_TOKEN` from the existing `GITEA_RELEASE_TOKEN` + Woodpecker secret. Retain the template's tag event/filter and native + bootstrap, including Woodpecker's escaped runtime substitutions. +3. Preserve template handling for annotated tag objects, event-commit agreement, + detached tagged source, temporary module metadata, the selected full tool + package, host target, `GOWORK=off`, `GOTOOLCHAIN=local`, and + `ci-deliver --prepared`. Keep the tagged module files unchanged during tool + bootstrap. Use the upstream wiring rather than rewriting its mechanics. +4. Remove the separate validation, custom asset-build, and plugin-release steps. + Native `ci-deliver` prepares dependencies and builds/delivers from the tag; + it does not rerun the candidate suite or publish source refs. Leave + `.woodpecker/verify.yml` and `.woodpecker/shuffle.yml` unchanged. + +Validation: compare the result directly with the pinned upstream template; +review the image, secret mapping, runtime escaping, and tag inputs. Existing +doccheck tests are expected to reject the list-shaped workflow or old-step +removal until Stage 4. A live Woodpecker run is not a sprint prerequisite. + +Completion: tag CI uses the tagged ReleaseKit selection for asynchronous native +delivery, independently of source publication. + +## Stage 4 — Refocus tests on Narratio's selections and integration + +Status: pending. + +Read `internal/doccheck/doccheck_test.go`, especially the workflow types, +`TestWoodpeckerWorkflowDependencies`, +`TestVerifyWorkflowUsesFullSuiteWithoutFocusedDuplicates`, and +`TestReleaseWorkflowRequiresValidation`. Read the profile and delivery workflow +created in Stages 2–3. + +1. Replace the obsolete release-workflow test with small tests of Narratio-owned + integration: product identity, selected checks, package/binary and target + mapping, Gitea destination, token variable, selected CI image, secret mapping, + and native tool/`ci-deliver` entry point. Decode selected JSON fields with + `encoding/json`; ReleaseKit retains ownership of full profile validation. + Avoid a duplicate local profile schema or whole-file golden snapshot. +2. Adapt the test-only workflow loader to accept both existing named mappings + and the template's named-step sequence. A small `UnmarshalYAML` on the steps + collection can normalize both shapes to the existing map for dependency + checks. Add the step name and environment/matrix fields only as needed by + these tests. Do not force the upstream template into the old representation + or build a general Woodpecker interpreter. +3. Preserve meaningful undefined-dependency/cycle checks and the existing + verification-workflow assertions. Add a small fixture for each supported + YAML steps shape so the new decoder's purpose is covered. +4. Verify Narratio's selected wiring, without pinning every bootstrap shell + command, ordering detail, or upstream diagnostic. Native bootstrap, + publication guards, checksums, and Gitea algorithms are tested upstream. + Do not invoke native `check` from the default Go suite: it would recursively + run that same suite. No live network or real credential enters these tests. + +Validation: run `go test ./internal/doccheck ./internal/app`. Old +`internal/releasecheck` assertions remain obsolete until Stage 5. + +Completion: tests accept the native workflow and protect the small local +integration surface without recreating ReleaseKit's suite. + +## Stage 5 — Remove the superseded release implementation + +Status: pending. + +Read all four scripts and `internal/releasecheck/` to identify references and +fixtures exclusively owned by that implementation. Search code through the +graph and non-code references with the usual text tools. + +1. Delete `scripts/release.sh`, `scripts/check-release-candidate.sh`, + `scripts/build-release-assets.sh`, and `scripts/release-lib.sh`. +2. Delete `internal/releasecheck/assets_test.go` and + `internal/releasecheck/publication_test.go`, including their fake tools, + transport fixtures, and helpers. Remove any other discovered fixtures used + only by the deleted implementation. Preserve unrelated tests and files. +3. Remove remaining active callers and imports of the old buildinfo variable, + script paths, and custom linker injection. Retain the native launcher rather + than adding legacy command aliases or a Go release orchestration package. + +Validation: run `go test ./internal/app ./internal/doccheck` and +`go build ./...`. Review code/workflow references for the removed symbols and +scripts. Historical release documents and roadmap baseline descriptions may +still mention old tooling; current maintainer prose is addressed next. + +Completion: Narratio maintains selections and wiring rather than release +algorithms and their dedicated test harness. + +## Stage 6 — Align the policy, runbook, and notices with native adoption + +Status: pending. + +Read `docs/release.md`, `docs/policy/release.md`, `docs/development.md`, +`docs/oss/attribution.md`, and the documentation/OSS policies. Use the roadmap's +pinned upstream references for shared semantics. + +1. Rewrite `docs/release.md` as the short Narratio maintainer runbook. Identify + the `main` branch, authoritative `origin` at + `ssh://git@forge.maximumdirect.net:22222/eric/narratio.git`, hosted destination, + Git/POSIX shell/native race-toolchain prerequisites, and selected Go 1.27.4. + Preserve the `release-toolchain` heading anchor or repair its incoming links. +2. Provide concise commands for toolchain/module preparation, candidate + commit/push, and `./releasekit publish VERSION`. Prepare modules and the + native tool before offline validation. State that the native tool uses the + module-selected ReleaseKit version. Show native `check` only as optional + diagnosis, never a prerequisite that repeats publication validation. +3. Keep version choice and compatibility defined by the adopted release + policy. Retain version-matched release-note preparation and its immutable + `COPYRIGHT | LICENSE | ATTRIBUTION` footer, using the Narratio paths at + `https://forge.maximumdirect.net/eric/narratio/src/tag//...` for + future notes. Summarize annotated-tag publication and separate CI delivery. + Identify the existing three binary filenames and `SHA256SUMS` locally. +4. Give short links/entry points for native saved-record reconciliation and + native delivery retries, including older-tag tooling selection. Use upstream + behavior for uncertain pushes, partial delivery, and content conflicts. + Source-release completion stays at confirmed tag publication. No CI polling, + live credential probe, download, installation check, or human confirmation + becomes an added publication gate. +5. Replace only the Narratio-specific candidate-check wording in + `docs/policy/release.md`: native race/full-vet/formatting/local-replacement + checks and selected builds replace the custom checker, tidy, and whitespace + gates. Keep shared upstream wording, compatibility, immutability, and other + established rules. Update local date metadata where appropriate without + inventing a new upstream adoption revision or upgrading the policy suite. +6. In `docs/development.md`, identify ReleaseKit with its version-appropriate + consumer link and replace the statement that tag CI independently repeats + candidate validation with its delivery responsibility. Keep ordinary push/PR + and scheduled test guidance. Inspect other current docs for affected build + version/release statements; repair real stale references without rewriting + historical notes or copying upstream CLI/configuration guides. +7. Finalize the ReleaseKit attribution entry for the runtime import and copied + launcher/workflow, using the full adopted commit and actual upstream notices. + Reuse unchanged local license texts; retain Narratio's license grant. +8. Update roadmap/plan completion status only to the implemented boundary. + Remove obsolete links in the completed ConfigKit roadmap that imply this + now-replaced plan still contains its stages, retaining its completion + summary. Preserve other pending roadmaps. A future release-preparation task + can retire completed documents; this sprint does not require their deletion. + +Write concise, factual policy statements and use affirmative phrasing. General +ReleaseKit features remain documented upstream; the runbook owns Narratio's +configuration choices and commands. + +Validation: run `go test ./internal/doccheck` and inspect the actual launcher, +profile, and workflow against every affected command/selection in the runbook. +Review attribution links and unchanged grant/license scope. Publication and CI +availability are not documentation checks. + +Completion: current documentation describes the implemented native workflow, +with one canonical owner per topic and no obsolete script procedure. + +## Stage 7 — Verify the completed native integration and close the sprint + +Status: pending. + +Read the completed changes and feature-roadmap completion criteria. Use +upstream candidate/build guides for their native preconditions. + +1. Make the official Go 1.27.4 installation the active `go` command on PATH and + verify `go version`. Prepare dependencies and the tool separately. Run + `go mod tidy -diff` once as migration/module hygiene, not a new recurring + release gate. Confirm the registered ReleaseKit version and final module + metadata; review that required checks and targets match Stage 2. +2. After the implementation changes are committed, make a disposable clone of + that exact source under a task-specific `mktemp -d` directory outside this + worktree, without copying tags. In that clone only, use branch `main` and + create/commit a synthetic `docs/releases/v0.0.0.md` with title + `# Narratio v0.0.0`, an explicitly synthetic summary, and the footer shape + from the runbook. Confirm that version has no local tag. Keep synthetic + metadata and refs out of Narratio's real checkout and upstream. +3. In that clean disposable candidate, prepare modules/the tool and run + `./releasekit check v0.0.0`. Keep the production profile unchanged. This is + the full native integration verification: one race-enabled offline suite, + selected vet/format/distribution checks, all three release binaries, and + the real executable's injected-version smoke check. Inspect the result and + confirm it leaves the checkout clean and creates no tag. A check requires + neither Gitea credentials nor remote publication, so a live service is not + a fallback for a failing fixture. +4. Reuse that result for unchanged test/vet/build coverage rather than rerunning + the complete suite merely to satisfy another stage. Run `go build ./...` on + the final source if its Stage 5 result is no longer current. The fixture + verifies adoption; it is not evidence that a real future release candidate + has already passed its own publication-time validation. +5. Compare the final delivery YAML with the pinned template and confirm only + the documented consumer adaptations. Inspect executable mode and + `sh -n ./releasekit`. Default tests and direct review cover local wiring; + upstream tests cover generic tag bootstrap and hosted protocols. A live CI + run, live delivery, and a real tag push are not required for sprint closure. +6. Confirm all four scripts, the dedicated script-test package, old buildinfo + package, and active current-doc references are removed. Check that the + remaining release code is the small launcher plus native version integration + and test-only consumer wiring. Preserve historical material and useful + unrelated tests. Avoid an artificial LOC threshold or broad cleanup. +7. Review the final diff for unintended application/platform/Go-minimum changes + and additional gates. Run whitespace checks, update stage outcomes and + roadmap status accurately, and commit the focused remaining work. Report + tests, source revision, removals, and any external delivery not exercised. + +Completion: all feature-roadmap criteria are satisfied, native integration has +passed on a committed disposable candidate, and the repository is clean and +ready for a separately authorized release sequence. + +## Open Questions + +None. The feature roadmap resolves the significant product and policy choices. +Upstream mechanics retain their native semantics; no new local release contract +or external service availability is required to complete this sprint. diff --git a/docs/roadmap/releasekit.md b/docs/roadmap/releasekit.md index 7366ccc..a8e7256 100644 --- a/docs/roadmap/releasekit.md +++ b/docs/roadmap/releasekit.md @@ -1,6 +1,6 @@ # Adopt ReleaseKit's native release workflow -Status: proposed. +Status: accepted; implementation pending. ## Goal @@ -14,9 +14,9 @@ Go toolchain. ReleaseKit owns the release mechanics and their semantics. Local documentation explains Narratio's selections and links to canonical upstream guidance for shared behavior. -This document defines the desired end state and required changes. A staged -implementation plan will be prepared separately. This roadmap does not authorize -publishing a release. +This document defines the desired end state and required changes. The +[implementation plan](implementation.md) owns the staged work and its progress. +This roadmap does not authorize publishing a release. ## Reviewed Baseline