Skip to content

enhance(config, cli): resolve --cfg paths across multiple roots#432

Merged
JeanMertz merged 5 commits intomainfrom
prr8
Mar 11, 2026
Merged

enhance(config, cli): resolve --cfg paths across multiple roots#432
JeanMertz merged 5 commits intomainfrom
prr8

Conversation

@JeanMertz
Copy link
Collaborator

Previously, --cfg path resolution only searched for files relative to the workspace root. This made it impossible to define personal configuration fragments that apply across all workspaces (in the user-global root) or fragments scoped to a single workspace but kept private (in the user-workspace root).

This commit implements RFD 035, extending --cfg resolution to search across three config roots in precedence order:

  1. User-global: $XDG_CONFIG_HOME/jp/config/
  2. Workspace: <workspace_root>/
  3. User-workspace: $XDG_DATA_HOME/jp/workspace/<id>/config/

When a --cfg path is provided, JP now searches each root independently. If matching files are found in multiple roots, they are all loaded and merged in precedence order (highest precedence wins). Within a single root, the existing "first match wins" behavior for entries in config_load_paths is preserved.

Additionally, the MissingConfigFile error now includes a list of all locations that were searched, improving the debugging experience when a config fragment cannot be found.

For example, running jp --cfg skill/web will now search for and merge matches from your global config, the current workspace, and your workspace-specific private config.

Previously, `--cfg` path resolution only searched for files relative to
the workspace root. This made it impossible to define personal
configuration fragments that apply across all workspaces (in the
user-global root) or fragments scoped to a single workspace but kept
private (in the user-workspace root).

This commit implements RFD 035, extending `--cfg` resolution to search
across three config roots in precedence order:

1. User-global: `$XDG_CONFIG_HOME/jp/config/`
2. Workspace: `<workspace_root>/`
3. User-workspace: `$XDG_DATA_HOME/jp/workspace/<id>/config/`

When a `--cfg` path is provided, JP now searches each root
independently. If matching files are found in multiple roots, they are
all loaded and merged in precedence order (highest precedence wins).
Within a single root, the existing "first match wins" behavior for
entries in `config_load_paths` is preserved.

Additionally, the `MissingConfigFile` error now includes a list of all
locations that were searched, improving the debugging experience when a
config fragment cannot be found.

For example, running `jp --cfg skill/web` will now search for and merge
matches from your global config, the current workspace, and your
workspace-specific private config.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 91eba56 into main Mar 11, 2026
12 checks passed
@JeanMertz JeanMertz deleted the prr8 branch March 11, 2026 20:39
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