feat(lifecycle/cli): run native commands with selected modules (#16)
Documentation / docs (push) Successful in 16s
ci / check (push) Successful in 27s

Add native urfave/cli command adapters with explicit module selection,
signal-aware execution, reverse cleanup and documented exit-code mapping.
Include focused tests, an executable example and the accepted CLI ADR.

Closes #8
This commit was merged in pull request #16.
This commit is contained in:
end committed 2026-10-28 14:46:11 -07:00
1 parent f0439000cb
commit fe44cac3a2
7 files changed
+837

No files matched your search

+21
View File
@@ -63,6 +63,27 @@ for at least two signals, and subscription cleanup. Nil signals disable receptio
There are no signal subscriptions, process exits, external dependencies or CLI
integration in this package.
## lifecycle/cli
`go.auvem.com/corestack/lifecycle/cli` adapts native `urfave/cli/v3` commands.
Bind `Serve(config, modules)` to run selected services, or `Action(config, modules,
fn)` for a one-off with selected setup/cleanup and module services suppressed.
See the [executable serve/inspect example](lifecycle/cli/example_test.go).
`Run(ctx, cliRoot, args)` accepts argv including the program name and returns the
exit code and inspectable error: success/help/graceful first signal is 0, usage is
2, and runtime/lifecycle failure is 1. Runtime failures dominate mixed errors.
Run prints diagnostics without exiting; the caller owns process exit. Nil signals
subscribe to SIGINT/SIGTERM during adapted actions; injected channels stay caller
owned. The private lifecycle App does not expose managed-worker admission.
Use fresh command trees and leave `ExitErrHandler`, `OnUsageError` and
`CommandNotFound` unset; Run owns those hooks. Other native hooks run outside the
adapted lifecycle action. Native environment/custom validation and generated-help
parse failures can return 1 with native diagnostics; custom pre-lifecycle
validators may return `urfavecli.Exit(err, 2)` for usage. Help and flags use native
urfave/cli declarations, without a configuration or environment facade.
## Status
No support is guaranteed. Breaking changes, including to the format rules, may happen before 1.0 and are listed in the release notes.