diff --git a/docs/roadmap/releasekit.md b/docs/roadmap/releasekit.md new file mode 100644 index 0000000..ef4bd8a --- /dev/null +++ b/docs/roadmap/releasekit.md @@ -0,0 +1,259 @@ +# ReleaseKit Native Adoption + +## Objective And Scope + +Fully adopt ReleaseKit and its native release conventions, minimizing the +release-related code maintained in Scriptorium. ReleaseKit will own candidate +validation, versioned builds, source-tag publication, hosted delivery, and +publication recovery. Scriptorium will supply its product selections and the +small amount of integration required to use those workflows. + +This is a feature roadmap, not an implementation sequence. It describes the +target and the changes needed from the current baseline. Current procedures +remain authoritative until implementation lands. Application configuration, +prompt execution, and HTTP behavior are outside this work's scope. + +## Reviewed Baseline And Upstream + +The Scriptorium baseline is commit +`592b97b06cb868043a844a5e9dccd09199850564`. + +Adopt `go.maximumdirect.net/releasekit` at **v0.10.0**, whose upstream tag +identifies commit **`82bac1a3ab935beddd4b8789d1e07f52135d4243`**. The +[consumer adoption guide][adoption] owns tool registration and upgrades. +ReleaseKit's Go 1.27.0 minimum matches Scriptorium's existing minimum; retain +Go 1.27.4 for release validation and builds. + +| Area | Current baseline | Target | +| --- | --- | --- | +| Dependency | No direct ReleaseKit adoption or registered release tool. | Module-selected ReleaseKit CLI plus its public runtime version package. | +| Publication | A 123-line `scripts/release.sh` implements release guards, validation, tag creation, push, and recovery inspection. | Native `publish` through a small forwarding launcher. | +| Release tests | `scripts/release_test.go` maintains a 357-line script test harness. | Focused consumer integration coverage; upstream owns generic release-mechanism tests. | +| Product selections | Targets and build settings are repeated in the script, CI, and runbook. | One native `releasekit.json` profile for local and hosted operations. | +| Version identity | `cmd/scriptorium/main.go` exposes `main.version` and `main.revision` linker variables. | CommandKit identity obtains its version from `releasekit/buildinfo.Version()`. | +| Hosted delivery | `.woodpecker/release.yml` builds assets with custom shell functions and uploads through a separate release plugin. | Upstream's maintained single-module tag-delivery workflow and native `ci-deliver`. | +| Documentation | `docs/release.md` explains the locally implemented release machinery. | A short Scriptorium runbook linking the adopted ReleaseKit contracts. | + +The [release policy](../policy/release.md), +[release procedure](../release.md), and +[architecture policy](../policy/architecture.md) describe the current local +selections. The distribution-guard difference requires the decision below. + +## Targeted End State + +### Native Tool And Ownership Boundary + +ReleaseKit is registered as a versioned Go tool in `go.mod`; its CLI and +runtime import use the same selected module version. Module metadata, rather +than an independently installed executable or a floating version, determines +the release tool used by maintainers and tagged CI jobs. +Update `go.mod` and `go.sum` together and review the resulting shared module +graph; adding a tool dependency also participates in Go's version selection. +Unrelated framework upgrades are not a separate objective of this adoption. + +A root `releasekit` launcher follows the upstream adoption example: select the +Go host target and execute the tool by its full package path, forwarding native +arguments and preserving its exit status. Its documented invocation is from +the module root. Replace the existing publication script rather than retaining +a second release workflow or translating the old command grammar. + +The launcher contains no candidate inspection, Git publication, build loop, +delivery, retry, or recovery implementation. No local Go orchestrator or +release-framework wrapper is needed. Runtime application code imports only +the public `buildinfo` package for version identity; release orchestration +remains maintainer tooling. + +### Shared Product Profile + +The root `releasekit.json` selects: + +- Product `Scriptorium`, the root module, and remote `origin`, using its native + effective push-endpoint handling. The runbook identifies the authoritative + repository, currently + `ssh://git@forge.maximumdirect.net:22222/eric/scriptorium.git`. +- Main package `./cmd/scriptorium`, binary name `scriptorium`, and targets + `linux/amd64` and `linux/arm64`. +- Race-enabled native candidate testing, preserving the current justification + that concurrent HTTP requests share engine and backend-capacity state. +- Native committed-workspace and filesystem-replacement checks, subject to the + distribution-guard decision below. +- Explicit Gitea delivery to `https://forge.maximumdirect.net`, owner `eric`, + repository `scriptorium`, using `RELEASEKIT_GITEA_TOKEN`. + +The [profile contract][configuration] owns field definitions and defaults. +Local documentation identifies Scriptorium's selections without duplicating +the upstream reference. Optional full vet, package-compilation matrices, +formatting, Markdown, and file-size checks are not added as release gates +merely because ReleaseKit offers them. Selected native binary builds already +cover the declared targets; do not also select a duplicate compilation pass +without a distinct reason. + +### Candidate Validation And Publication + +Retain stable semantic versions, `main` as the release branch, publication of +the source commit to authoritative `main` before the tag, and the committed +`docs/releases/.md` note. The single publication command is the native +`publish` command through the launcher. Native `check` remains an optional +diagnostic, not a mandatory preceding invocation that repeats validation. + +ReleaseKit owns its offline candidate suite, selected builds, release-note +checks, clean-candidate and remote guards, annotated tag, and exact-object tag +push. Dependency preparation and local toolchain setup remain preparation +work. Adopt native environment handling and build flags instead of preserving +the old script's command lines or linker options. + +ReleaseKit's built-in native version smoke check is part of adopting its +selected-target build workflow. It does not require executing every target on +its own platform. Successful source publication remains separate from hosted +delivery; CI success, downloadable assets, provider access, and consumer +installation are not publication gates. The [publication guide][publication] +and [build guide][build] own these mechanisms. + +### Runtime Version Identity + +Use the public accessor described in [runtime version guidance][runtime] to +populate CommandKit's Scriptorium identity. Remove the application-owned +`version` and `revision` linker variables and their build-time injection. +Release builds report `scriptorium ` through the existing native +CommandKit version command. Ordinary source builds and module-installed builds +use ReleaseKit's documented fallback semantics. + +The target intentionally drops the separately injected revision suffix rather +than maintaining a parallel metadata path. Leave CommandKit's native +structured version representation to CommandKit; this is not a redesign of +its report schema. The immutable tag and native release/build evidence provide +source traceability without promising reproducible bytes or embedded revision +metadata. Explain the observable metadata change in the adoption release note. + +### Hosted Delivery And Recovery + +Replace the custom build and upload steps with the maintained +[single-module Woodpecker template][workflow], customized only for Scriptorium +and its selected release toolchain. Use `golang:1.27.4-bookworm` as in the +reviewed template. The tagged profile governs targets and destination; the +tagged module metadata governs the tool version. Keep upstream tag/event +verification, temporary bootstrap metadata, and native `ci-deliver --prepared` +rather than reimplementing them locally. + +Use the template's `releasekit_gitea_token` Woodpecker secret mapping to +`RELEASEKIT_GITEA_TOKEN`. Provision that repository secret as deployment setup; +the current workflow uses `GITEA_RELEASE_TOKEN`. No credential is committed. +Environment-based delivery credentials are sufficient for this adoption; +local token-file support remains available through ReleaseKit when needed, +without requiring a second credential loader or provisioning workflow here. + +Deliverables remain: + +- `scriptorium--linux-amd64`; +- `scriptorium--linux-arm64`; and +- `SHA256SUMS`, alongside the hosted page containing the complete release note. + +Native delivery owns checksums, receipts when separate builds are requested, +existing-content comparison, missing-asset delivery, and delivery outcomes. +Native publication-attempt records and reconciliation replace locally +maintained recovery inspection. Operators follow the [delivery guide][delivery] +and publication guide for recovery, including partial or unknown outcomes and +retention of original build output where a rebuild could change bytes. +Private publication records may contain sensitive endpoint information; use +upstream handling guidance rather than inventing a local record format. + +The cutover applies to future source revisions. Published tags, release notes, +and assets remain unchanged. Historical retries retain their applicable +workflow/tool selection; this adoption does not retrofit ReleaseKit into tags +that predate it or promise universal native delivery for historical tags. + +### Documentation, Policy, And Attribution + +Rewrite `docs/release.md` as a concise native runbook identifying local +prerequisites, the selected toolchain, profile and launcher, note preparation, +the publication entry point, declared deliverables, and hosted credential +wiring. Link the adopted upstream contracts for command semantics, profile +fields, build behavior, and recovery. Keep preparation, source completion, and +asynchronous delivery status distinct. Do not copy ReleaseKit's manuals or +maintain an alternative local recovery procedure. + +Update Scriptorium's release-policy selections to identify ReleaseKit and +accurately reflect the selected guards. Preserve the existing general release +policy unless an actual integration conflict requires a narrow change. Align +`docs/development.md`, relevant internal inventory and adapter documentation, +and affected CLI guidance with the version integration and tooling boundary. +Keep upstream tool-only packages distinct from the small runtime import when +describing the dependency graph. Existing accepted ADR decisions need not be +rewritten for this tooling change. + +Preserve release-note licensing navigation, using immutable Scriptorium tag +links with visible text `COPYRIGHT | LICENSE | ATTRIBUTION`. For new notes, +use the current `forge.maximumdirect.net/eric/scriptorium` repository URLs; +historical release documents remain historical. Native hosted delivery reuses +the checked-in note rather than generating a second footer. + +Update `docs/oss/attribution.md` under the [OSS policy](../policy/oss.md) for +the ReleaseKit runtime package and any copied or adapted launcher/workflow +material, identifying the imported commit and applicable notices. Reuse the +existing local LGPL/GPL texts as appropriate. Review actual runtime and copied +material scope rather than attributing every tool-only transitive dependency +as application runtime code. The project license remains unchanged. + +### Consumer Validation And Code Retirement + +Remove the old script and the generic publication-test harness that exists to +exercise it. Preserve meaningful Scriptorium-specific coverage with +proportionate consumer tests and adoption checks: native version integration, +profile/package/target mapping, launcher forwarding, and tagged CI wiring. +Use disposable repositories and simulated external boundaries where needed; +tests must not publish to the real repository or require real credentials. +Upstream owns exhaustive publication, build, bootstrap, and delivery tests. + +Verify the actual integration during implementation, including the native +versioned build and both declared build targets. Check affected documentation +and attribution links. These adoption checks do not automatically become new +recurring release gates. Do not preserve tests of obsolete shell invocations, +exact linker flags, or upload-plugin behavior as compatibility requirements. + +## Completion Criteria + +The roadmap is realized when the pinned native tool, profile, launcher, +runtime identity, and hosted workflow form the supported release path; the +old publication/build/upload implementation and its duplicate tests are +retired; and canonical documentation, policy selections, and attribution agree +with that implemented path. Scriptorium retains its product choices and +necessary integration, while upstream owns the release machinery. Resolve the +following policy choice before finalizing the implementation plan. + +## Open Decisions + +### Distribution Guards Beyond Native Checks + +The current release-policy selections and script reject every module +replacement and any root vendor tree. ReleaseKit's native checks reject +filesystem replacements and committed workspace files, while permitting +versioned replacements and vendoring. The architecture policy separately +prohibits committed local replacements and vendored PromptKit source. These +are different scopes; adoption must not silently relax an existing rule or +turn a broad script check into an even stronger invariant. + +**Recommendation:** adopt the native workspace/filesystem-replacement checks +and revise the broader release-only bans to that scope. Preserve the +architecture policy's no-vendored-PromptKit boundary, with narrowly scoped +application-suite coverage where needed rather than a second release +orchestrator. Versioned replacements still need ordinary dependency review; +this choice does not authorize unpublished dependency assumptions. This best +matches native ownership and targets the stated risk of masking unpublished +framework code without maintaining a general ban on unrelated vendoring or +published replacements. The exact scope of any retained project assertion +should be settled in the implementation plan after this policy choice. + +**Alternative:** retain the blanket vendor-tree and all-replacement bans as +explicit local release requirements and enforce their native-check gaps with +a small product check invoked by ReleaseKit. This preserves the current +broader release boundary, but adds locally owned validation and excludes +published replacements and vendoring that upstream supports. Choose it only +if that additional restriction has a Scriptorium-specific justification. + +[adoption]: https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/docs/consumers/adoption.md +[configuration]: https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/docs/config.md +[publication]: https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/docs/consumers/publish.md +[build]: https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/docs/consumers/build.md +[runtime]: https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/docs/consumers/runtime-version.md +[delivery]: https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/docs/consumers/delivery.md +[workflow]: https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/examples/woodpecker/tag-delivery.yml