refactor(cli): route success/status output to stderr#122
Open
tcerqueira wants to merge 3 commits into
Open
Conversation
Generalize the stdout-discipline convention to human mode: stdout carries only data payloads (list/query tables, identity dumps), while success/confirmation/status/empty-state messages go to stderr in both --json and human modes. - create: 'Using the following build configuration', 'Created app', revision-URL and post-create hints -> stderr - whoami: '✔ Authenticated as …' confirmation -> stderr; orgs table stays on stdout as data - logout: 'Successfully logged out' -> stderr - orgs list: empty-state notice -> stderr - deployments list: empty-state notice and pagination hint -> stderr
tokenStorage.remove() (reached via `logout`) printed KEYCHAIN_WARNING via console.log, unlike its siblings in get()/set() which use console.error. Route it to stderr so the warning never pollutes stdout.
The dry-run create tests asserted the 'Using the following build configuration:' echo on stdout, but it now goes to stderr per the stdout-discipline convention. Capture combined stdout+stderr in the `deploy` test helper (matching `deployFail`).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Generalizes the CLI's stdout-discipline convention (previously documented for
--jsononly) to human mode too. The rule is now uniform across all commands and both modes:--jsonthe single JSON result object; in human mode the actual data a user would pipe (list/query tables, identity dumps).console.error, in both--jsonand human modes.Files in this PR (orphan files not owned by an in-flight PR)
deploy/create/mod.ts— "Using the following build configuration", "✔ Created app …", revision-URL info, and the post-create "go to the revision page" hint → stderr.deploy/mod.ts—whoami"✔ Authenticated as …" confirmation → stderr (the orgs table stays on stdout as data);logout"✔ Successfully logged out" → stderr. Thelogsregion is untouched (sibling PR).deploy/orgs.ts— "No organizations accessible with this token." empty-state → stderr (list data stays on stdout).deploy/deployments.ts— "No deployments for this application." empty-state and "More results available; pass --cursor …" pagination hint → stderr (list data stays on stdout).Covered by sibling PRs (not touched here)
config.ts(#118 — config-file-creation + "Selected org/app" messages),deploy/env.ts(#119),deploy/database.ts(#117),deploy/setup-cloud.ts(#115),main.ts/switch(#116),deploy/apps.ts+deploy/publish.ts(#121),sandbox/*(#118).Verification
deno fmt --check,deno lint,deno checkall pass. Live-checked against a throwaway org/app:orgs list/deployments list(human +--json): data on stdout, stderr clean.create --dry-run(human): build-config echo on stderr, stdout empty; (--json): single JSON object on stdout, stderr empty.whoami(human): orgs table on stdout, "✔ Authenticated as …" on stderr; (--json): single object on stdout, stderr empty.logout: confirmation on stderr.