feat(cli): add rig config get|set <dot.path> — read/edit one key, then reconcile#20
feat(cli): add rig config get|set <dot.path> — read/edit one key, then reconcile#20alex-mextner wants to merge 1 commit into
rig config get|set <dot.path> — read/edit one key, then reconcile#20Conversation
…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>
40ae438 to
3b29727
Compare
There was a problem hiding this comment.
💡 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".
| target.write_text(state.to_yaml(), encoding="utf-8") | ||
| else: | ||
| state.write(target) | ||
| plan, _loaded, _env = _load_plan(args.cwd, config=None) |
There was a problem hiding this comment.
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 👍 / 👎.
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 | jqkeeps a clean stdout.--globalget 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 applyruns). On either failure — or a writeIO 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 initfirst) so built-in defaults never reconcile onto disk with no committed source.
Setting the removed
scopekey 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