Skip to content

fix(zsh): resolve config path dynamically to open the correct file for editing#2919

Merged
tusharmath merged 4 commits intomainfrom
fix-config-path-consistency
Apr 10, 2026
Merged

fix(zsh): resolve config path dynamically to open the correct file for editing#2919
tusharmath merged 4 commits intomainfrom
fix-config-path-consistency

Conversation

@tusharmath
Copy link
Copy Markdown
Collaborator

@tusharmath tusharmath commented Apr 10, 2026

Summary

Fix ZSH config edit action opening the wrong file by resolving the config path dynamically via forge config path instead of hardcoding ~/forge/.forge.toml.

Context

The ZSH shell plugin's _forge_action_config_edit function had a hardcoded path of ~/forge/.forge.toml. This was incorrect for users whose config lives at the new canonical location ~/.forge/.forge.toml, or in a custom path set via FORGE_CONFIG. As a result, running the config edit action from ZSH would open (or create) the wrong file, silently ignoring any existing configuration.

Changes

  • ZSH plugin: _forge_action_config_edit now calls forge config path to resolve the correct config file path at runtime, respecting FORGE_CONFIG, the new ~/.forge location, and the legacy ~/forge fallback
  • CLI: Added forge config path subcommand that prints the resolved path to the global config file
  • CLI: Added forge config migrate subcommand to migrate the legacy ~/forge directory to ~/.forge
  • UI: Reformatted migration output to use writeln_title and TitleFormat for consistent styling
  • Workspace init: Removed the -y/--yes flag from workspace init — confirmation is now always prompted

Key Implementation Details

forge config path is the single source of truth for where the config file lives. The ZSH plugin shells out to it and fails fast with a clear error if the binary is unavailable or returns an empty path. Directory creation also uses the dynamically resolved path rather than the hardcoded one.

Testing

# Verify the new subcommand prints the correct path
forge config path

# In ZSH with the plugin loaded, open the config editor
# (should open the file reported by `forge config path`)
forge config edit

# Test migration from legacy path
forge config migrate

Links

@github-actions github-actions bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Apr 10, 2026
@tusharmath tusharmath force-pushed the fix-config-path-consistency branch from 362b607 to a595f6d Compare April 10, 2026 02:27
@tusharmath tusharmath enabled auto-merge (squash) April 10, 2026 02:27
@tusharmath tusharmath changed the title feat(cli): add config path subcommand to print global config file path fix(zsh): resolve config path dynamically to open the correct file for editing Apr 10, 2026
@tusharmath tusharmath merged commit 1885fb8 into main Apr 10, 2026
11 checks passed
@tusharmath tusharmath deleted the fix-config-path-consistency branch April 10, 2026 02:29
@github-actions github-actions bot added the type: fix Iterations on existing features or infrastructure. label Apr 10, 2026
@tusharmath tusharmath removed the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant