Skip to content

[Feature]: W0: Uniform CLI & Desktop Flag & Stream Contract (--log-level, --log-format, --result-format, --no-status) #1842

Open

Description

@skevetter

Parent Epic: #1841

Overview

Consolidate CLI and Desktop flags onto a single, non-overlapping flag per concern across STDOUT (data results + live progress) and STDERR (diagnostic logs), removing redundant/conflicting flags (-v/-vv/-vvv, --debug, -q/--quiet, --log-output, and per-command --json).

Target Flag & Stream Contract

Concern Stream Canonical Flag Environment Variable (BindEnv) Allowed Values Default
Log Verbosity STDERR --log-level DEVSY_LOG_LEVEL (fallback: context LOG_LEVEL) error, warn, info, debug, trace warn (CLI) / info (remote agent)
Log Encoding STDERR --log-format DEVSY_LOG_FORMAT auto, text, json, logfmt (alias: plain -> text) auto (text on TTY, json when piped / DEVSY_UI=true / internal)
Result Format STDOUT --result-format DEVSY_RESULT_FORMAT auto, text, plain, json auto (plain/text on TTY, json when piped / DEVSY_UI=true)
Live Progress STDOUT --no-status DEVSY_NO_STATUS true, false false

Subtasks & Engineering Specifications

  • Task 0.1: Consolidate Global Logging Flags (--log-level, --log-format) & Remove -v, --debug, -q, --log-output (size/m)

    • Target Files:
      • cmd/flags/flags.go
      • cmd/root.go, cmd/root_test.go, cmd/flag_aliases_test.go
      • pkg/flags/names/names.go, pkg/flags/names/names_test.go, pkg/flags/env_test.go
      • pkg/config/env.go
      • pkg/log/logger.go, pkg/log/levels.go, pkg/log/logger_test.go
    • Implementation Details:
      1. In cmd/flags/flags.go:
        • Remove Verbosity, Quiet, Debug, and LogOutput from GlobalFlags.
        • Keep LogLevel string, LogFormat string (default "auto"), ResultFormat string (default "auto"), and NoStatus bool.
        • Update bindGlobalEnvVars (pkgflags.BindEnv) to bind DEVSY_HOME, DEVSY_CONTEXT, DEVSY_PROVIDER, DEVSY_LOG_LEVEL, DEVSY_LOG_FORMAT, DEVSY_RESULT_FORMAT, and DEVSY_NO_STATUS.
      2. In cmd/root.go:
        • Validate --log-format against auto | text | plain | json | logfmt.
        • Resolve "auto" to "json" when isMachineConsumer (isInternal, DEVSY_UI=true, or non-TTY os.Stderr), otherwise "text". This fixes the bug where rootPreRun overwrote "json" with "text" when --log-output defaulted to "text".
      3. In pkg/log/logger.go and pkg/log/levels.go:
        • Add log.InitProvider(providerName string) that reads DEVSY_LOG_LEVEL (default "info") and DEVSY_LOG_FORMAT (default "json").
        • Keep Verbosity and Debug as // Deprecated: compatibility fields on log.Config (and have log.Init(cfg) automatically fall back to os.Getenv("DEVSY_LOG_LEVEL") and os.Getenv("DEVSY_LOG_FORMAT") when cfg.Level == "" / cfg.Format == "") so that bumping github.com/devsy-org/devsy in the 12 external Go provider repositories (aws, gcloud, azure, digitalocean, civo, terraform, lima, orbstack, kubernetes, ecs, dockerless, ssh) never breaks compilation before their cmd/root.go is updated.
        • Add log.InfoEnabled() bool alongside log.DebugEnabled() bool and log.TraceEnabled() bool.
        • Replace cmd.Verbosity > 0 || cmd.Debug in cmd/workspace/up/up.go and cmd/workspace/stop.go with log.InfoEnabled().
  • Task 0.2: Update All Internal Child Subprocess & Desktop CLI Invocations to --log-level and --log-format (size/m)

    • Target Files:
      • cmd/workspace/up/agent.go, cmd/workspace/logs.go, cmd/workspace/ssh.go, cmd/workspace/gpg_tunnel.go, cmd/machine/ssh.go
      • pkg/agent/agent.go, pkg/client/clientimplementation/workspace_client.go, pkg/devcontainer/setup.go
      • pkg/dotfiles/dotfiles.go, pkg/gpg/forward.go, pkg/tunnel/browser.go, pkg/tunnel/container.go, pkg/ide/opener/browser_tunnel.go
      • desktop/src/main/cli.ts, desktop/src/main/__tests__/cli.test.ts, desktop/e2e/no-status-protocol.e2e.ts
    • Implementation Details:
      1. Add log.ForwardFlagArgs() []string returning []string{"--log-level", log.LevelString()} when non-default, and replace all --debug child-process flag forwarding across cmd/ and pkg/.
      2. Remove invalid --log-output=raw arguments from pkg/dotfiles/dotfiles.go, pkg/gpg/forward.go, and pkg/tunnel/browser.go.
      3. Update desktop/src/main/cli.ts (argsWithProtocol and commandNeedsSecret) and Desktop tests to pass --log-format instead of --log-output.
  • Task 0.3: Standardize All Subcommand STDOUT Output on --result-format & Unify text/plain Value Names (size/s)

    • Target Files:
      • pkg/output/mode.go, pkg/output/mode_test.go
      • pkg/status/render.go, pkg/status/render_test.go
      • cmd/provider/versions.go, cmd/provider/versions_test.go
      • cmd/feature/outdated.go, cmd/feature/outdated_test.go
      • cmd/machine/describe.go, cmd/machine/inspect.go
      • cmd/ci/status.go
    • Implementation Details:
      1. In pkg/output/mode.go and pkg/status/render.go, accept "text" alongside "plain" (mapping both to human-readable output), and in pkg/log/logger.go accept "plain" as an alias for "text", so auto|text|json works identically across both --log-format and --result-format.
      2. Remove --json (names.JSON) from devsy provider versions and use output.ResolveMode(cmd.ResultFormat) (ModeJSON vs ModePlain).
      3. Add output.ResolveMode(cmd.ResultFormat) support to feature outdated, machine describe, machine inspect, and ci.

Verification & Acceptance Criteria

  • mise run cli:test and mise run desktop:test pass with zero CLI flag references to --log-output, --verbose, -v/-vv/-vvv, -q/--quiet, or --debug.
  • --log-format=auto emits JSON logs on STDERR when os.Stderr is non-TTY or DEVSY_UI=true, and human-readable text when interactive.
  • Both --log-format=text and --result-format=text (as well as plain) are accepted across CLI commands.

Activity

  1. coderabbitai commented on Nov 15, 2026

    @coderabbitai
    🔗 Related PRs

    #1736 - feat(cli): add progress visibility control [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions