Skip to content

feat(config): expose FORGE_* env vars via :config-env command#2682

Open
marchantdev wants to merge 1 commit intoantinomyhq:mainfrom
marchantdev:feat/config-env-vars
Open

feat(config): expose FORGE_* env vars via :config-env command#2682
marchantdev wants to merge 1 commit intoantinomyhq:mainfrom
marchantdev:feat/config-env-vars

Conversation

@marchantdev
Copy link

Fixes #2638

Problem

Many Forge tuning knobs — retry limits, HTTP timeouts, tool timeouts, max file sizes — are only discoverable by reading the source code or documentation. Changing them requires manually editing a .env file. There is no in-shell way to list what is configurable or to set a value without leaving the terminal.

Solution

This PR adds a :config-env (:ce) command and the corresponding CLI plumbing so users can browse, inspect, and set all FORGE_* environment variables without touching a file.

CLI changes

Command Behaviour
forge config get env Lists all 38 known FORGE_* vars with current values and defaults
forge config get env KEY Shows the current value of a single variable
forge config set env KEY VALUE Writes KEY=VALUE to .env in cwd and applies immediately (no restart needed)

ZSH changes

  • :config-env / :ce — opens an fzf picker populated by forge config get env; selecting a variable prompts for a value and calls forge config set env automatically
  • Registered in built_in_commands.json so it appears in :help and tab completion

Example

# List all configurable variables with current values
$ forge config get env
FORGE_TOOL_TIMEOUT              300  (default)   # Max seconds a shell tool is allowed to run
FORGE_MAX_SEARCH_RESULT_BYTES   10240  (default)  # Max bytes returned by a file-search result
...

# Get a specific variable
$ forge config get env FORGE_TOOL_TIMEOUT
FORGE_TOOL_TIMEOUT (not set, default: 300)

# Set a variable (writes to .env, applies immediately)
$ forge config set env FORGE_TOOL_TIMEOUT 60
● FORGE_TOOL_TIMEOUT  is now set to '60' in /home/user/myproject/.env

# Or interactively via ZSH
:ce   # Opens fzf picker → select variable → enter value

Variables exposed

All 38 FORGE_* variables including: tool timeouts, file size limits, HTTP/TLS config, retry settings, semantic search parameters, API URLs, conversation history settings, and dump/debug options.

Closes antinomyhq#2638

## Summary

Some Forge configurations were only discoverable by reading source code
or documentation; they could only be changed by manually editing `.env`
files.  This adds a first-class `:config-env` (`:ce`) command and the
underlying CLI plumbing so users can browse, inspect, and set all
FORGE_* variables without ever touching a file directly.

## Changes

### CLI (`forge config get env` / `forge config set env`)

* **`forge config get env [KEY]`** — prints the current value of a
  specific `FORGE_*` variable, or lists the entire catalogue (38 vars)
  with their default values and one-line descriptions when `KEY` is
  omitted.
* **`forge config set env KEY VALUE`** — writes `KEY=VALUE` to the
  nearest `.env` file in the current working directory (creates the
  file if it does not exist; updates in-place if the key is already
  present) and applies the change to the running process immediately so
  a restart is not required.

### ZSH plugin (`:config-env` / `:ce`)

* Opens an fzf picker populated by `forge config get env`, showing
  every `FORGE_*` variable with its current value.
* Selecting a variable prompts for a new value and calls
  `forge config set env` automatically.
* Registered in `built_in_commands.json` so it appears in `:help` and
  completion.
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.

[Feature]: Expose all env variables via a :config-* command

1 participant