Skip to content

fix(cli): honor --with-source on rig config get (#1618) - #1628

Merged
mvschwarz merged 1 commit into
mvschwarz:mainfrom
markankamaransheogarat-sys:fix/config-get-with-source-1618
Oct 20, 2026
Merged

mvschwarz merged 1 commit into
mvschwarz:mainfrom
markankamaransheogarat-sys:fix/config-get-with-source-1618

Conversation

@markankamaransheogarat-sys

@markankamaransheogarat-sys markankamaransheogarat-sys commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What a user gets

Closes #1618. Before, rig config get daemon.port --with-source printed only the value. Now it prints the same single line as --show-source (7555 (source: file)), whether the flag comes before get (rig config --with-source get <key>) or after it (rig config get <key> --with-source). --with-source is the parent command's option, and commander accepts it in both positions, so get now reads it from cmd.opts() next to its own --show-source. --show-source, --json and plain get behave exactly as before. --json still wins when it is combined with --with-source.

How you verified it

Tested at upstream main 27f0129d plus this change, on Linux with Node 22:

  • New packages/cli/test/config-get-with-source.test.ts (8 tests). For both flag positions it checks a value from the config file (source: file), one from OPENRIG_PORT (source: env) and the default (source: default). It also checks that the line is identical to --show-source, and that plain get / --json are unchanged. Without the fix, 7 of the 8 fail; the one that passes is the "unchanged" test.
  • npx tsc --noEmit -p packages/cli/tsconfig.json: clean.
  • Full packages/cli vitest: 5116 tests, 33 failures. On main without this change the same suite gives 5108 tests and the same 33 failures: I diffed the failing test names. They are environment-dependent on this machine (desktop-wake-loop and client --version need a built CLI, plus host-ipv6-status, scope-* and preflight).
  • Not run: the root npm test / npm run lint across all workspaces (only daemon was built, as the cli tests need it).

Anything you were unsure about

Whether --with-source should also be added to get as its own option for --help. I kept it on the parent, as the issue describes, so the help text stays the same.

If this is security-related

Not security-related.

  • One concern per PR; no version bump; no CHANGELOG.md edit
  • Tests added or updated where the change is testable
  • I listed the checks I ran, their results, and any checks I could not run

Summary by CodeRabbit

  • New Features

    • config get now displays the resolved value and its source when --with-source is provided before or after get.
    • Source information can identify configuration files, environment variables, or default values.
  • Bug Fixes

    • Ensured --json output and standard config get output remain unchanged.

`rig config get <key>` ignored the parent command's --with-source flag
and printed only the value. Treat it like --show-source, on either side
of `get`. --show-source, --json and plain `get` are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012FiU6MUdCBELKP3rxWkFTm
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3bbe102e-a0b7-480b-80f4-edd76858484b
📥 Commits

Reviewing files that changed from the base of the PR and between a25cd1c and dc7e61d.

📒 Files selected for processing: 2
  • packages/cli/src/commands/config.ts
  • packages/cli/test/config-get-with-source.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

config get now prints the resolved value and its source when invoked with either --show-source or the parent --with-source flag. Tests cover both flag positions and verify that plain and JSON output remain unchanged.

Changes: Config get source output

Layer / File(s) Summary
Source flag handling and coverage
packages/cli/src/commands/config.ts, packages/cli/test/config-get-with-source.test.ts
config get checks both source flags before printing value-and-source output. Tests cover file, environment, and default sources, both flag positions, and unchanged plain and JSON output.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: mvschwarz

Merge Risk: ⚪ Minimal · up to dc7e6

The requested source output is covered for both flag positions, with no identified issue blocking merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: making rig config get honor --with-source.
Linked Issues check Passed Issue #1618 requires config get to treat parent --with-source as equivalent to --show-source before or after get. The change checks cmd.opts().withSource with opts.showSource and prints th…
Out of Scope Changes check Passed The change modifies only the config get source-selection condition and adds focused tests for issue #1618. The implementation comment and test helpers support the requested behavior. No unrelated co…
Full details: Linked Issues check

Explanation

Issue #1618 requires config get to treat parent --with-source as equivalent to --show-source before or after get. The change checks cmd.opts().withSource with opts.showSource and prints the existing value-and-source line. The added tests cover both flag positions and file, environment, and default sources. They also verify plain get and --json behavior.

Full details: Out of Scope Changes check

Explanation

The change modifies only the config get source-selection condition and adds focused tests for issue #1618. The implementation comment and test helpers support the requested behavior. No unrelated code or behavior changes are shown.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mvschwarz

Copy link
Copy Markdown
Owner

Thanks, @markankamaransheogarat-sys, for your first PR here, and for your fix for #1618 with a test for the flag both before and after get. It's in review, and the checks have started. We'll be back here.

@mvschwarz mvschwarz moved this from Todo to In Progress in OpenRig roadmap Oct 20, 2026

@openrig-review openrig-review left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at dc7e61d. rig config get <key> --with-source now prints the value with its source, the same single line as --show-source, whether the flag comes before or after get. --json still wins when combined, and plain get, --show-source and --json are unchanged. Required CI (8/8) passes here.

— dev60-planner@v-openrig-build

@mvschwarz
mvschwarz merged commit 4e2474a into mvschwarz:main Oct 20, 2026
17 of 18 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRig roadmap Oct 20, 2026
@mvschwarz

Copy link
Copy Markdown
Owner

Thanks again, @markankamaransheogarat-sys, for a clean first PR. Merged as 4e2474ad, which closes #1618. rig config get <key> --with-source now prints the value with its source, the same output as --show-source, whether the flag comes before or after get, and your test covers both positions. It's on main and not in a release yet.

@mvschwarz

Copy link
Copy Markdown
Owner

Thanks again, @markankamaransheogarat-sys: #1628 is released in 0.7.0 (release notes).

AlephCasara pushed a commit to AlephCasara/openrig that referenced this pull request Nov 10, 2026
…chwarz#1628)

`rig config get <key> --with-source` printed only the value. `--with-source` is the parent `config` command's option, which Commander accepts on either side of `get`, but `get` never read it. It now reads it from the parent's options, as it already did for `--json`, and prints the same `value<TAB>(source: …)` line as `--show-source`, in both flag positions.

`--json` is still checked first, so `--json --with-source` prints the JSON object as before. Plain `get`, `--show-source` and `--json` are unchanged. A new test drives the real command parsing in both positions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

rig config get ignores --with-source

3 participants