lifecycle/cli: run commands inside the lifecycle #8

Closed
opened 2026-10-26 22:16:40 -07:00 by end · 0 comments
Owner

Root-module package go.auvem.com/corestack/lifecycle/cli. Blocked by #5.

Clean-room rewrite. Build from this spec. Don't read or port go-toolkit/appcli.

Purpose

Turn a set of lifecycle modules into a binary with subcommands. One example is serve, which runs every service; another is a one-off command such as migrate up, which sets up only the modules it needs, does its work and exits.

Requirements

  • Commands declare which modules they need. Only those modules are set up, and they're torn down when the command finishes.
  • Signals. Commands get the lifecycle's signal-aware context. Ctrl-C during a one-off command shuts down cleanly.
  • Exit codes follow a documented mapping: 0 on success, non-zero on failure, and a distinct code for a usage error.
  • Usage output. Help and usage output come for free.
  • Dependencies. The ADR keeps this package in the root module, so stay light:
    • prefer the standard library flag, or one small, widely used CLI dependency;
    • justify any dependency in the PR;
    • if a dependency turns out to be needed and heavy, stop and raise it, because under the module-boundary ADR it would mean a nested module.
  • No config framework. Flags and environment variables are the caller's business. At most, provide a helper for env fallback on flags if it's a few lines.

Done when

  • Tests cover:
    • only the needed modules being set up for a command;
    • teardown after a one-off command;
    • the exit-code mapping;
    • signal handling during a command.
  • An Example shows serve plus one one-off command.
Kickoff prompt
Use the feature-delivery skill to resolve corestack/go#8 (the issue body is the spec).
Repo ~/Projects/corestack/go, base main (lifecycle from #5 must be merged), branch
feat/lifecycle-cli. Read AGENTS.md and the accepted ADRs first, especially the module-
boundary ADR before choosing any CLI dependency. Clean-room: do not read or port
go-toolkit/appcli. Independent review before the PR.
Root-module package `go.auvem.com/corestack/lifecycle/cli`. Blocked by #5. **Clean-room rewrite.** Build from this spec. Don't read or port `go-toolkit/appcli`. ## Purpose Turn a set of lifecycle modules into a binary with subcommands. One example is `serve`, which runs every service; another is a one-off command such as `migrate up`, which sets up only the modules it needs, does its work and exits. ## Requirements - **Commands** declare which modules they need. Only those modules are set up, and they're torn down when the command finishes. - **Signals.** Commands get the lifecycle's signal-aware context. Ctrl-C during a one-off command shuts down cleanly. - **Exit codes** follow a documented mapping: 0 on success, non-zero on failure, and a distinct code for a usage error. - **Usage output.** Help and usage output come for free. - **Dependencies.** The ADR keeps this package in the root module, so stay light: - prefer the standard library `flag`, or one small, widely used CLI dependency; - justify any dependency in the PR; - if a dependency turns out to be needed and heavy, stop and raise it, because under the module-boundary ADR it would mean a nested module. - **No config framework.** Flags and environment variables are the caller's business. At most, provide a helper for env fallback on flags if it's a few lines. ## Done when - Tests cover: - only the needed modules being set up for a command; - teardown after a one-off command; - the exit-code mapping; - signal handling during a command. - An `Example` shows `serve` plus one one-off command. <details> <summary>Kickoff prompt</summary> ```text Use the feature-delivery skill to resolve corestack/go#8 (the issue body is the spec). Repo ~/Projects/corestack/go, base main (lifecycle from #5 must be merged), branch feat/lifecycle-cli. Read AGENTS.md and the accepted ADRs first, especially the module- boundary ADR before choosing any CLI dependency. Clean-room: do not read or port go-toolkit/appcli. Independent review before the PR. ``` </details>
end added a new dependency 2026-10-26 22:17:23 -07:00
end added a new dependency 2026-10-26 22:17:23 -07:00
end closed this issue 2026-10-28 14:46:11 -07:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Reference: corestack/go#8