-
Notifications
You must be signed in to change notification settings - Fork 0
docs: explain the value Base-CLI adds to a consumer #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
codeforester
merged 2 commits into
main
from
documentation/18-20260918-docs-make-the-case-for-adopting-base-cli-value-proposition-w
Sep 19, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Why base-cli? | ||
|
|
||
| Every CLI application chooses how to define commands. A production CLI also | ||
| needs a repeatable contract around each command: where logs go, how errors map | ||
| to exit status, where temporary and run data live, how cleanup runs, and how | ||
| automation requests structured output. Without a shared lifecycle layer, each | ||
| application decides, implements, and tests those details for itself. | ||
|
|
||
| Base-CLI composes with Click (and can attach to Typer); it is not a replacement | ||
| parser. It supplies the invocation lifecycle and public output/runtime APIs, | ||
| while the consumer keeps its command tree, configuration policy, and domain | ||
| behavior. | ||
|
|
||
| | Shared concern | Northstar example | What the framework supplies | | ||
| | --- | --- | --- | | ||
| | Human and machine output | `northstar status --format json` | Public record renderers and stable JSON records. | | ||
| | Automation envelope | `northstar --json status --format json` | A versioned success/error envelope and the command's exit status. | | ||
| | Safe state-changing workflow | `northstar --dry-run release reconcile` | A lifecycle dry-run flag and consistent invocation context; Northstar decides what its local demo operation means. | | ||
| | Diagnostics | `northstar --debug --log-file ... release reconcile` | Lifecycle logging, log placement, and registered sensitive-argument redaction. | | ||
| | Per-run files and cleanup | `release reconcile` | Managed runtime/temp paths and cleanup hooks; Northstar owns its state record. | | ||
|
|
||
| ## What would otherwise be hand-written | ||
|
|
||
| The small consumer entry point in [`src/base_cli_demo/cli.py`](../src/base_cli_demo/cli.py) | ||
| still owns the Click command tree and domain behavior. Without Base-CLI, that | ||
| same file would also need to hand-write and test the surrounding lifecycle: | ||
|
|
||
| - turn `--environment`, `--dry-run`, `--json`, `--debug`, `--log-file`, and | ||
| `--keep-temp` into a consistent invocation context; | ||
| - choose state and temporary directories, run cleanup callbacks, and preserve | ||
| the dry-run boundary around `release reconcile`; | ||
| - route records through text/JSON/CSV/TSV/NDJSON output and emit the structured | ||
| success/error envelope used by automation; and | ||
| - configure logging, redact `approval_token`, and map command failures to stable | ||
| exit status. | ||
|
|
||
| Those are the production-shaped behaviors supplied by Base-CLI and exercised | ||
| through its public facade. Northstar still decides its service fixture schema, | ||
| environment selection, target-version policy, and the meaning of | ||
| `release reconcile`; those decisions remain in the Click commands and | ||
| [`src/base_cli_demo/profile.py`](../src/base_cli_demo/profile.py). The README's | ||
| [framework boundary](../README.md#framework-boundary) is the concise ownership | ||
| summary. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content-completeness gap vs. the linked issue. Issue #18's suggested fix asked for a concrete before/after of
cli.py: "the ~30 lines ofcli.pythat produce a production-shaped CLI, annotated to mark which behavior would otherwise be hand-written" (or at minimum a "without base-cli you would also write ..." callout). This table lists Northstar examples and framework capabilities in the abstract, but never ties a specific behavior to the lines ofcli.py/profile.pya reader would otherwise have had to write themselves (e.g. log setup, temp/state path plumbing, redaction wiring, envelope serialization). A reader still can't tell, line-by-line, which parts ofcli.pyrepresent effort base-cli is saving them versus ordinary Click code — the specific gap the issue called out.