3 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 a7b605f0c0 feat(cli): -v/--verbose streams the run log
A global -v/--verbose (persistent on the root, the only one with
--help): each line the run log gets, numbered steps, the redacted
command lines and the commands' output, also goes to stderr as it's
written, without control characters (a C1 control split across writes
too) and dim where stderr is colored, with no status line. The run log
is still written. A logged failure while verbose names the log
(log_details) instead of printing its end again. DEVVM_VERBOSE is gone.

ui: SetVerbose; stream (printable, dim) and logTo tee LoggedCmd's and
LogWriter's output; a streamed command's pipe gets WaitDelay
(streamWait, 2s) so a process it leaves running can't hold devvm, and
ErrWaitDelay alone isn't a failure. --version stays root-only, and
version.txtar checks -v isn't it.

Tests: TestStreamIsPrintable, TestDieLoggedVerbose, the logged-command
and status tests; build.txtar streams a build with -v. Docs:
troubleshooting (A command fails), settings (colors, environment),
commands (Flags and values), contributing (styles); CLI reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 02:55:59 -08:00
w3cjandClaude Opus 5.5 f9e14e9b37 feat(cli): usage errors as devvm messages, checked before anything runs, exit code 2
Every argument and flag error is a devvm message naming what the command
expected, followed by usage_help naming that command's own --help, and
exits with 2. Arguments and flag values are checked in Args, before the
root's PersistentPreRun and any VM lookup.

- internal/cli/args.go: noArgs, exactArgs, maxArgs, minArgs (argsN, with
  ValidArgs), argsOf (the arguments in Use), checkCommands (wraps every
  command's Args with checkFlags and marks RunE's errors as ranError),
  checkFlagValue (--cpus, --memory, --disk, --ports, --lifetime,
  --older-than), exclusive (flag groups checked first, then Cobra's own
  required flags and groups), flagError (SetFlagErrorFunc: pflag's
  NotExist, ValueRequired, InvalidValue, InvalidSyntax errors).
- Execute: 0, 1 for a failure (RunE's error: a message, or
  output_failed), 2 for a usage error; usage_error is only the fallback.
- Checked early: ports LIST and add/rm LIST (vm.ParsePortList), network
  allow/deny RULEs, network on/off(/ask with -g), layer new NAME
  (build.CheckLayerName), retention KEY=VALUE (state.CheckRetention),
  setup --features '', secret NAME, completion SHELL, git-protect and
  ssh-agent values.
- ui.UI.Error prints an error without ending the run (UI's method limit
  44).
- Messages: usage_help, arg_missing, args_too_many, args_none,
  arg_not_choice, no_subcommand, flag_unknown, flag_needs_value,
  flag_bad_value, flag_bad_switch, flags_exclusive, output_failed;
  usage_error reworded; doc links to troubleshooting.
- Tests: TestUsageErrorsEveryCommand, TestRanErrorIsAFailure, TestArgsOf,
  TestFlagErrors; txtars check message names; e2e checks a bad port list
  exits 2.
- Docs: troubleshooting (a command refused before it runs, exit codes),
  contributing (command arguments), AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-01 02:27:57 -08:00
w3cjandClaude Opus 5.5 6dd2bd730f feat(cli): version, help and shell completion
- devvm --version (and a hidden devvm version) prints the version alone:
  the one release builds set with -ldflags -X .../internal/cli.version,
  else Go's build info without the v, else (devel). No -v shorthand.
- devvm help [COMMAND], --help and -h stay Cobra's.
- devvm completion bash|zsh|fish prints Cobra's script (no powershell).
  Completion offers image names after the +-joined parts given (base,
  the toolchains, the user's layers, the agents), shared tools for
  remove, backend names for --backend, all/none for --ports, and never
  file names.
- Tests: version.txtar, completion.txtar, help cases in root.txtar;
  TestJoined, TestVersionFromRelease, TestVersionFlagHasNoShorthand;
  more exit codes in TestExecuteExitCodes; docgen tests know the
  completion page and keep version and __complete out.
- Docs: commands.md "devvm itself" and "Shell completion"; the CLI
  reference regenerated (devvm_completion.md, --version on devvm.md).
- Converted: cli.bats "doctor: all there; --version prints VERSION"
  (its --version half; doctor waits for doctor). No messages added.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 15:52:27 -06:00