Add profile loading and process execution

This commit is contained in:
2026-10-05 17:25:11 +00:00
parent 22a3dfe9bc
commit be225cf634
14 changed files with 575 additions and 12 deletions

View File

@@ -9,5 +9,5 @@ go run ./cmd/releasekit version
It prints `releasekit <version>` followed by a newline and exits with status 0.
The version comes from [`buildinfo.Version`](consumers/runtime-version.md).
Any other argument sequence prints `usage: releasekit version` to standard
error and exits with status 2.
Any other argument sequence prints an error message followed by
`usage: releasekit version` to standard error and exits with status 2.

27
docs/config.md Normal file
View File

@@ -0,0 +1,27 @@
# Configuration
ReleaseKit reads a JSON profile from `<repository>/releasekit.json` by default.
The repository directory defaults to the current directory. A relative profile
path is resolved from that repository directory; an absolute path is used as-is.
The current profile fields are:
| Field | Required | Behavior |
| --- | --- | --- |
| `product` | Yes | Product name used by release operations. |
| `remote` | No | Selected Git remote; defaults to `origin`. |
| `checks` | No | Ordered child commands, each with an argument vector and optional environment map. |
Each check requires a nonempty `args` array whose first element names the
executable. Arguments are passed directly to the child process; ReleaseKit does
not parse a shell command string. Select a shell explicitly when a check needs
shell syntax. Each `env` map overlays the current environment for that child.
The overlay does not modify the ReleaseKit process environment.
Unknown fields are rejected so a setting cannot be silently ignored. Build and
delivery fields will be added when those operations are implemented. Profile
loading and child-command adaptation are implemented; no CLI operation consumes
the profile yet.
See the [profile example](../examples/releasekit.json). The
[CLI contract](cli.md) lists the currently available command.

View File

@@ -12,7 +12,12 @@ Implemented internal packages:
release builder.
- `internal/apicheck` checks compiled exports with `go/types` and checks import
direction. Run it with `go run ./internal/apicheck` from the repository root.
- `internal/process` runs cancellable child commands with per-child environment
overlays.
- `cmd/releasekit/internal/cli` parses implemented commands, loads strict JSON
profiles, and adapts configured checks to the process runner.
The executable currently imports only the runtime facade. Release orchestration,
process execution, build, Git, and Gitea implementation packages are introduced
as their responsibilities are implemented.
The executable controller uses the runtime facade and the command-owned CLI
adapter. The adapter uses the process runner and imports neither public facade.
Release orchestration, build, Git, and Gitea implementation packages are
introduced as their responsibilities are implemented.

View File

@@ -510,7 +510,7 @@ checker command and internal package inventory to the canonical developer docs.
## Stage 4: Implement profile loading and command adaptation
Status: Pending. Depends on Stage 3.
Status: Complete. Depends on Stage 3.
1. Implement JSON product, remote, and command settings under an internal CLI
adapter. Add strict field decoding, directory resolution, required-value
@@ -527,6 +527,15 @@ selected environment values reach the child without changing process globals;
missing executables, invalid configuration, and cancellation report useful
errors. Tests use controlled local child commands and temporary directories.
Completion evidence: added strict profile decoding, repository-relative and
absolute profile resolution, required product and command diagnostics, and
direct check argument adaptation. Added a cancellable `os/exec` runner with
working directory, inherited environment plus child-only overlays, stdout,
stderr, and preserved exit errors. Tests cover spaced paths and arguments,
environment isolation, missing executables, exit failures, cancellation, and
invalid profiles. Added a profile example and canonical CLI, configuration, and
internal package documentation.
## Stage 5: Capture and validate one local candidate
Status: Pending. Depends on Stage 4.