Skip to content

refactor(config): replace bespoke config commands with generic get/set - #601

Merged
edenreich merged 2 commits into
mainfrom
refactor/config-get-set
Jun 5, 2026
Merged

edenreich merged 2 commits into
mainfrom
refactor/config-get-set

Conversation

@edenreich

@edenreich edenreich commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Consolidates the infer config surface from ~45 bespoke per-setting subcommands into a uniform key/value interface, moves tool operations to a dedicated top-level infer tools command, and cleans up the sandbox/skills configuration that motivated the work.

Config: generic get/set

  • infer config get [key] prints the effective value (built-in defaults + global ~/.infer/config.yaml + local .infer/config.yaml with sandbox directories merged + INFER_* env), as YAML or --format json. No key dumps the whole config.
  • infer config set <key> <value> writes to config.yaml, parsing the value to the field's type via reflection over Config. List keys take a comma-separated value; --userspace targets ~/.infer/config.yaml.
  • infer config init is unchanged.

Tools: top-level command

  • infer tools execute <tool> [json-args] and infer tools validate <command> (moved from config tools exec/validate). tools execute resolves tool names case-insensitively (CLI only; the agent still uses exact PascalCase names).

Sandbox / skills

  • DefaultConfig no longer bakes an absolute ~/.infer/skills path into tools.sandbox.directories (it was leaking machine-specific paths like /home/runner/.infer/skills into committed configs). Skills reads remain allowed via the unconditional isWithinSkillsDir carve-out, which also bypasses the .infer/ protected-path rule that a plain directory entry cannot.
  • The userspace config.yaml sandbox directories are now merged into the project's effective list, so a project config no longer fully shadows the global allowlist.

Removed commands and replacements

Old New
config agent set-model X config set agent.model X
config agent set-max-turns N config set agent.max_turns N
config agent verbose-tools enable config set agent.verbose_tools true
config agent skills enable config set agent.skills.enabled true
config tools enable / bash enable config set tools.enabled true / tools.bash.enabled true
config tools safety set bash enabled config set tools.bash.require_approval true
config tools sandbox add DIR config set tools.sandbox.directories ".,DIR" (replaces list)
config tools grep set-backend rg config set tools.grep.backend ripgrep
config tools web-fetch add-domain D config set tools.web_fetch.whitelisted_domains "D,..."
config export set-model X config set export.summary_model X
config tools exec <tool> tools execute <tool>
config tools validate <cmd> tools validate <cmd>

System prompts live in prompts.yaml (e.g. prompts.agent.system_prompt) and are edited there rather than via config set.

Incidental fixes

  • Fixed a non-hermetic TestInitializeProject that wrote to the real ~/.infer on every task test run.
  • Added scanner.Err() checks in directexec/bash.go and cmd/agent.go (resolves scannererr warnings).
  • Updated README.md, examples/, and docs/*.md to the new interface.

Verification

  • task lint (0 issues), task test, task build all green.
  • Verified live: config get/set round-trips (incl. --userspace and comma lists), the global+local sandbox merge, tools execute Read/read (case-insensitive), tools validate, and that infer init writes no absolute $HOME path.

Follow-up: #600 (refactor log messages to lowercase-first).

Consolidate the sprawl of ~45 per-setting `config` subcommands into a uniform
key/value interface, move tool operations to a dedicated top-level command, and
clean up the sandbox/skills configuration that motivated the change.

Config:
- Add `config get [key]` (effective value: defaults + global ~/.infer + local
  .infer merged + env; yaml/json output) and `config set <key> <value>` (typed
  via reflection over Config, comma-separated lists, --userspace target).
- Remove every per-setting subcommand (agent set-*, tools enable/disable/list/
  safety/sandbox/bash/grep/web-*, export set-model/show, agent skills ...).
  Keep `config init`.

Tools:
- New top-level `infer tools execute <tool> [json-args]` and
  `infer tools validate <command>` (moved from `config tools exec/validate`).
  `tools execute` resolves tool names case-insensitively (CLI-only).

Sandbox / skills:
- DefaultConfig no longer bakes an absolute ~/.infer/skills path into
  tools.sandbox.directories (it leaked machine-specific paths such as
  /home/runner/.infer/skills into committed configs). Skills reads stay allowed
  via the unconditional isWithinSkillsDir carve-out.
- Merge the userspace config.yaml sandbox directories into the project's
  effective list so a project config no longer fully shadows global dirs.

Migration: use `infer config get/set <key>` (e.g. `config set agent.model X`,
`config set tools.bash.enabled true`); `config tools exec/validate` are now
`infer tools execute/validate`.

Also:
- Fix non-hermetic TestInitializeProject that wrote to the real ~/.infer.
- Check scanner.Err() in directexec/bash.go and cmd/agent.go (scannererr).
- Update README, examples, and docs/ to the new interface.
@edenreich

Copy link
Copy Markdown
Contributor Author

I think skills directory should be disabled for reading by default since skills are disabled by default, only once enabled the agent should be able to read from skills dir.

The filesystem sandbox unconditionally whitelisted the skills directories
(.infer/skills and ~/.infer/skills) via the isWithinSkillsDir carve-out,
even though skills are disabled by default (agent.skills.enabled: false).
This let the agent's Read/Grep tools read those directories while
skills.Load() was a no-op, so nothing there was ever loaded - and the
carve-out also bypasses the .infer/ protected-path rule.

Gate the skills half of the carve-out on agent.skills.enabled. When skills
are off, the skills directories fall through to the .infer/ protected-path
check and are denied; when on, behavior is unchanged. The tmp/plans
operational carve-out stays unconditional.
@edenreich
edenreich force-pushed the refactor/config-get-set branch from 0c6138f to 758defa Compare June 5, 2026 08:19
@edenreich

Copy link
Copy Markdown
Contributor Author

Okay now, this one fails:

go run . tools execute read '{"file_path":"/Users/edenreich/.infer/skills/maintainer/SKILL.md"}'

And once enabled it succeed:

INFER_AGENT_SKILLS_ENABLED=true go run . tools execute read '{"file_path":"/Users/edenreich/.infer/skills/maintainer/SKILL.md"}'

Exactly how I want it.

@edenreich
edenreich merged commit c80321a into main Jun 5, 2026
@edenreich
edenreich deleted the refactor/config-get-set branch June 5, 2026 08:26
inference-gateway-releaser Bot pushed a commit that referenced this pull request Jun 5, 2026
## [0.118.0](v0.117.1...v0.118.0) (2026-06-05)

### 🚀 Features

* add file explorer panel with tree view, preview, and fuzzy finder ([#589](#589)) ([2b73fcc](2b73fcc)), closes [#588](#588)
* **cli:** adopt fang for styled help, errors, version and completions ([#592](#592)) ([b7f649e](b7f649e))
* **tui:** animate loading states and modernise progress/cursor styling ([#594](#594)) ([06057d7](06057d7))
* **tui:** drive diff colours from the active theme ([#598](#598)) ([f279c1c](f279c1c))
* modernize diff display and migrate Charm UI stack to v2 ([#576](#576)) ([6bf8ac6](6bf8ac6))
* **tui:** rebuild GitHub Action setup wizard with huh forms ([#597](#597)) ([c875e84](c875e84))
* theme collapsed tool result previews ([#603](#603)) ([ffc2ee9](ffc2ee9))

### 🐛 Bug Fixes

* **pricing:** flag Pro-subscription Ollama Cloud models in model picker ([#604](#604)) ([5ec0298](5ec0298))
* **tools:** make bash whitelist shell-aware to fix benign-command rejections ([#581](#581)) ([#605](#605)) ([6119f2a](6119f2a))

### ♻️ Code Refactoring

* **tui:** migrate theme selector to bubbles/v2/list ([#596](#596)) ([a46079c](a46079c))
* move git branch indicator to input view border ([#602](#602)) ([7132237](7132237))
* remove redundant comment ([8e3210d](8e3210d))
* **tui:** render help bar with bubbles/v2/help ([#595](#595)) ([5aed140](5aed140))
* **cli:** render list commands with native lipgloss tables ([#593](#593)) ([28a0e55](28a0e55))
* **config:** replace bespoke config commands with generic get/set ([#601](#601)) ([c80321a](c80321a)), closes [#600](#600)
* separate git branch into own status bar row ([#591](#591)) ([9afbeb4](9afbeb4))

### 💄 Styles

* standardize log message capitalization ([e8ae466](e8ae466))

### 🔧 Build System

* **deps:** bump modernc.org/sqlite from 1.50.1 to 1.51.0 in the gomod group ([#584](#584)) ([908cfc4](908cfc4))
* **deps:** bump the github-actions group with 3 updates ([#585](#585)) ([a14de3e](a14de3e))
* **deps:** upgrade fang to charm.land/fang/v2 v2.0.1 ([d1b861f](d1b861f))

### 👷 CI/CD

* centralize claude.yml via reusable workflow ([#583](#583)) ([9a6839d](9a6839d))
* replace Nix build check with adl-cli recompute pattern ([#586](#586)) ([9c5f7cc](9c5f7cc)), closes [#585](#585) [#585](#585) [#585](#585)

### 🧹 Maintenance

* **deps:** bump claude-code 2.1.148 -> 2.1.158 ([#582](#582)) ([5e8d0b5](5e8d0b5))
* **deps:** bump infer CLI v0.117.0 -> v0.117.1, infer-action v0.9.1 -> v0.11.1 ([#580](#580)) ([90ddcf3](90ddcf3))
* **deps:** bump infer-action v0.11.1 -> v0.11.2 ([#587](#587)) ([56f2df8](56f2df8))
* regenerate keybindings from earlier features ([ff09192](ff09192))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.118.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant