Skip to content

feat(cli): add rig config get|set <dot.path> — read/edit one key, then reconcile#20

Open
alex-mextner wants to merge 1 commit into
mainfrom
rig-config-getset
Open

feat(cli): add rig config get|set <dot.path> — read/edit one key, then reconcile#20
alex-mextner wants to merge 1 commit into
mainfrom
rig-config-getset

Conversation

@alex-mextner

Copy link
Copy Markdown
Owner

The recommended way to change a single setting without hand-editing YAML.

get <dot.path> [--global] [--json]
Reads one nested key from the single target file (./rig.yaml, or
~/.config/rig/config.yaml with --global) — NOT the cascade. A missing file or
absent path exits non-zero; a mapping/list subtree prints as YAML; --json emits
the JSON value (default=str, fail-soft). Diagnostics go to stderr so
get --json | jq keeps a clean stdout. --global get works outside a git repo.

set <dot.path> [--global] [--no-apply]
Coerces the value conservatively (true/false/int/float/null; leading-zero,
nan/inf/1e3/underscore, and Unicode digits stay strings; quote-wrap forces a
literal string), creates intermediate mappings, then guards the write with two
pre-apply gates: schema validation, then a catalog-backed plan build over the
full cascade (the same engine rig apply runs). On either failure — or a write
IO error — the file is rolled back to its prior contents (a freshly-created file,
and the immediate dir set created for it, are removed; a failed restore warns
honestly). On success it reconciles immediately; --no-apply writes + prints the
plan only. A repo-local set refuses when ./rig.yaml is absent (run rig init
first) so built-in defaults never reconcile onto disk with no committed source.
Setting the removed scope key is refused.

Dot-path engine (split_path/get_path/set_path/coerce_scalar) and a public
read_yaml_file live in riglib.config next to the loader/validator; version
validation now rejects a bool (True == 1). install-skill's SKILL.md, install.sh,
the dispatch SVG, README, and docs/config-schema.md document the command.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

…hen reconcile

The recommended way to change a single setting without hand-editing YAML.

get <dot.path> [--global] [--json]
  Reads one nested key from the single target file (./rig.yaml, or
  ~/.config/rig/config.yaml with --global) — NOT the cascade. A missing file or
  absent path exits non-zero; a mapping/list subtree prints as YAML; --json emits
  the JSON value (default=str, fail-soft). Diagnostics go to stderr so
  `get --json | jq` keeps a clean stdout. `--global` get works outside a git repo.

set <dot.path> <value> [--global] [--no-apply]
  Coerces the value conservatively (true/false/int/float/null; leading-zero,
  nan/inf/1e3/underscore, and Unicode digits stay strings; quote-wrap forces a
  literal string), creates intermediate mappings, then guards the write with two
  pre-apply gates: schema validation, then a catalog-backed plan build over the
  full cascade (the same engine `rig apply` runs). On either failure — or a write
  IO error — the file is rolled back to its prior contents (a freshly-created file,
  and the immediate dir set created for it, are removed; a failed restore warns
  honestly). On success it reconciles immediately; --no-apply writes + prints the
  plan only. A repo-local set refuses when ./rig.yaml is absent (run `rig init`
  first) so built-in defaults never reconcile onto disk with no committed source.
  Setting the removed `scope` key is refused.

Dot-path engine (split_path/get_path/set_path/coerce_scalar) and a public
read_yaml_file live in riglib.config next to the loader/validator; version
validation now rejects a bool (True == 1). install-skill's SKILL.md, install.sh,
the dispatch SVG, README, and docs/config-schema.md document the command.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40ae438205

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread riglib/cli.py
target.write_text(state.to_yaml(), encoding="utf-8")
else:
state.write(target)
plan, _loaded, _env = _load_plan(args.cwd, config=None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate global edits before repo overrides

When --global is used from a repo whose rig.yaml overrides a catalog-backed global value (for example, the repo has a valid agent_tools_source), this cascaded _load_plan validates the merged repo view rather than the global file just written. A typo such as rig config set agent_tools_source /bad --global can therefore succeed and persist a global config that fails in any repo without that override; the same masking can apply to global catalog item refs hidden by local config. Please validate the edited global layer itself, or otherwise ensure catalog checks cannot be masked by the repo overlay, before accepting the write.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant