Repository navigation
feat(cli): move version to a subcommand and make -v verbosity - #120
Merged
Merged
Conversation
P1 foundation (PR-1.2) of the CLI UX overhaul. Drop cobra's Version: field and
the --version flag so -v is free, and add a `yacd version` subcommand that
prints the same build-metadata line to stdout. Add the persistent UX flags
--verbose/-v (count), --quiet/-q, --non-interactive, --color, and --no-color;
this PR consumes only -v and -q (the rest are registered for the foundation and
wired to ui.IO in a later phase).
Verbose logging now runs on slog: PersistentPreRunE reads -v/-q directly off
cmd.Flags() (flag-only, env-immune) without changing loadRuntimeConfig's
signature, raises the resolved --log-level by the verbose count via raise()
(additive along error<warn<info<debug, capped, never lowering), and forces the
logger off under -q while the final returned error still prints via the exit
handler.
Note on raise() semantics: the design prose is internally inconsistent (it both
describes additive "warn->info->debug" stepping and gives a warn+-v=>debug
example). Additive-by-one is the only model that delivers goal 5's graduated
-vvv control and matches the stepping description, so raise("warn",1)=="info".
BREAKING (pre-1.0, intentional): `yacd --version` is removed; use `yacd version`.
-v/--verbose is always verbosity.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 8, 2026
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.
Summary
P1 / PR-1.2 of the CLI UX overhaul. Frees
-vfor verbosity and lands the global UX flag surface + verbose logging on slog.yacd --versionis removed. Cobra'sVersion:field and the--versionflag are dropped; useyacd version(prints the same build-metadata line to stdout).-v/--verboseis always verbosity (a count:-v,-vv,-vvv), never version.-q/--quietforces the logger off (overriding-v/--log-level); data and the final returned error reason still print.What's here
Version:/SetVersionTemplate; addversion.go(yacd version→ stdout).--verbose -v(count),--quiet -q,--non-interactive,--color,--no-color. This PR consumes only-vand-q;--non-interactive/--color/--no-colorare registered for the foundation and wired intoui.IOin PR-1.4 (adding their consumer —resolveUX— now would be dead code that fails theunusedlinter).PersistentPreRunEreads-v/-qdirectly offcmd.Flags()(flag-only, env-immune) without changingloadRuntimeConfig's signature (that change is coupled to deleting the 11 re-call sites and lands atomically in PR-1.4). It raises the resolved--log-levelby the verbose count viaraise()and forces the logger off under-q.raise(base, count): additive alongerror<warn<info<debug, capped at debug, never lowers;newLoggergains aquietparam returningslog.DiscardHandler.build BuildInfotocommandContextsoversion(and tests) read it symmetrically.Note on
raise()semanticsThe 063 design prose is internally inconsistent: §6 describes additive
warn→info→debugstepping, but one example claimsYACD_LOG_LEVEL=warn … -v → debug. Additive-by-one is the only model that delivers goal 5's graduated-vvvcontrol and matches the stepping description, so I implemented that:raise("warn",1)=="info",raise("info",1)=="debug". (Flagging for visibility;-vfrom the defaultinfobase still reachesdebugas expected.)Testing
gofmt/go vet/go buildclean;moon run root:check(golangci-lint + generated-drift) green;moon run root:test(full envtest gate) green;git diff --checkclean.versionsubcommand prints to stdout (byte-identical to the old--version);--versionis now an unknown flag;versionstill prints under-q(data survives the mute);-vvv versionis accepted (verbosity, not version);raise()table (env-base steps, cap, never-lowers, unknown/negative);newLoggerdiscard-under-quiet + level gating.Part of the P1 foundation series (1.1 #119 merged → 1.2 → … → 1.6).
🤖 Generated with Claude Code