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.

Delivery checklist

  • Implement the canonical global logging, result-format and live-status flags on the Core candidate.
  • Update CLI child invocations and Desktop IPC to use the candidate stream contract.
  • Verify the hosted Linux candidate with the real CLI and unpackaged Electron. The visible context value and full error-toast assertion passed at 1f33a68d. Hosted run
  • Verify current-head hosted Desktop CI and scoped Lint. Core PR
  • Integrate the reviewed Windows tooling correction. The current Core Windows unit job failed the older temporary-directory fixture. Lint PR
  • Qualify the final pinned CLI and Desktop contract on its exact head, including native Windows, required reviews, and owner-approved squash.

Activity

  1. added
    enhancement
    on Nov 15, 2026
  2. 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!

  3. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The 13-file Desktop renderer diagnostics draft is open at signed 7d1c90d7. All 1,468 local Vitest checks, Svelte check, Electron bundling, scoped Biome, and Prek passed. The CLI/Desktop flag and result contract stays together in the later coordinated slice. Hosted CI and review are pending.

  4. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Desktop renderer diagnostics #1858 passed all hosted workflows at signed 7d1c90d7, including Desktop CI. Required main-repository reviews remain open.

  5. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Additive CLI controls are open at signed commit 8c732e72e86d21ed244ed580d26db1369169fa79. Canonical flags and environment variables are available alongside existing arguments. Focused Go race tests, CI-parity lint, Prek, and an isolated macOS CLI check passed. The native Windows, Desktop, and E2E results remain open.

  6. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The additive CLI draft now renders progress for --result-format=text while preserving the Desktop status envelope. The regression reproduced before the fix. Reporter race tests, CI-parity lint, and Prek passed at signed head fb0ef20ecaa25f4f476c03bc8128e88cc7fcb8c7. Hosted qualification has restarted.

  7. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Canonical CLI callers is open as a draft at signed head 9cf3f608ceda1c8ac26aa602cecdb0f6dfdf68d9. Desktop, workspace, agent, and tunnel calls now forward the canonical flags. Focused Go race tests, 87 Desktop tests, Svelte check, and Prek passed locally. The hosted Linux real-CLI Electron scenario and native Windows checks are pending. This draft depends on the additive controls.

  8. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The canonical caller draft now carries a signed test-fixture correction at 301c75636e39a3728c55c753f4941543aaa9e097. It addresses hosted Lint's three repeated-literal findings. The same affected race tests, CI-parity lint, and Prek passed locally. Hosted qualification restarted at the new head.

  9. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    CLI flag retirement is open as a signed, 64-file draft at bd5f3105d043a0fc9f3f850ff6e1b87358a856a5, based on the canonical caller migration. It removes the old flags and the temporary bridge. Focused race tests, CI-parity lint, Prek, 87 Desktop unit tests, E2E compilation, and isolated CLI result and error checks passed. Core CI and Desktop CI are pending.

  10. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Additive CLI controls at fb0ef20ecaa25f4f476c03bc8128e88cc7fcb8c7 passed Windows units. Linux and macOS reproduced the older-pin redaction failures. MicroSandbox E2E started the workspace and emitted timing events as text, but the capture accepts JSON. The capture now requests JSON in a private follow-up. Its race test failed before the change and passed after. Hosted requalification awaits the merged compatibility pin and updated stack.

  11. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Additive output controls at 745e74d4, canonical callers at a6f14e16, and flag retirement at e5a8c628 now include the merged logging pin and bootstrap fixture correction. The updated retirement head passed focused CLI, output, and timing parser race tests locally. Fresh hosted qualification is running.

  12. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Output controls at 73647b36, canonical callers at ccb83269, and flag retirement at 5cff91dd use the updated logging pin. Their original bases and feature changes are preserved. The folded capture race regression passed locally on each head. Fresh hosted checks are pending.

  13. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Output controls at ac8c537c, canonical callers at ae85b8ce, and flag retirement at 38028243 carry the folded masking fix with their existing bases. Focused race fixtures passed; fresh hosted checks are required.

  14. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Output controls at 6fb62bc8, canonical callers at bdafae6a, and flag retirement at 9249e4b5 carry the final masking fix. Focused race tests passed. The existing PR bases are preserved and fresh hosted CI is pending.

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

    enhancementsize/m

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions