Skip to content

feat: honor pi agent config directories for settings - #4

Merged
Luminger merged 2 commits into
mainfrom
fix/configdir
Sep 20, 2026
Merged

Luminger merged 2 commits into
mainfrom
fix/configdir

Conversation

@Finkregh

@Finkregh Finkregh commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Move pi-python's global settings under pi's configured agent directory instead of the fixed ~/.pi root:

${PI_CODING_AGENT_DIR}/pi-python/settings.json

The project file similarly follows pi's CONFIG_DIR_NAME:

<cwd>/${CONFIG_DIR_NAME}/pi-python/settings.json

Existing ~/.pi/pi-python/settings.json files migrate once when the new location does not exist. Migration is best-effort; on failure the legacy file remains active and /python-status reports the warning.

Review changes

The original proposal used $PI_CODING_AGENT_DIR/extensions/pi-python/settings.json. That directory can be the extension itself (for example, our local install is a symlink from there to the source checkout), which would write user configuration into source code and expose it to package updates. The reviewed version keeps configuration under the agent root but outside extension code.

Validation

New tests cover, under both Node and Bun:

  • PI_CODING_AGENT_DIR global path resolution
  • CONFIG_DIR_NAME project path resolution
  • one-time migration from the legacy location
  • project and environment precedence
  • preserving both files when the destination already exists

This is intentionally non-breaking: migration requires no user action, so the release remains on the 0.3.x patch line.

@Finkregh
Finkregh requested a review from Luminger September 19, 2026 22:49
Finkregh and others added 2 commits September 20, 2026 08:04
Store the global pi-python settings.json next to pi's other user
extensions instead of ~/.pi/pi-python/settings.json:

  $PI_CODING_AGENT_DIR/extensions/pi-python/settings.json

Resolve the agent dir via pi's own getAgentDir(), which honours
PI_CODING_AGENT_DIR and defaults to ~/.pi/agent.

Migrate the pre-extensions location once, on load: if the legacy file
exists and the new one does not, create the parent directories and move
it. The move is best-effort - failure surfaces as a /python-status
warning and the legacy file is still read.

The project file (<cwd>/.pi/pi-python/settings.json) is unchanged.
The proposed path under $PI_CODING_AGENT_DIR/extensions/pi-python can be
the extension itself: local installations commonly put a symlink there.
Migrating settings into that directory would write user configuration
into the source checkout, dirtying it and risking deletion on package
updates.

Keep the useful part of the change — honoring pi's agent directory — but
store configuration at $PI_CODING_AGENT_DIR/pi-python/settings.json.
Use CONFIG_DIR_NAME for the project path as pi's extension API requires,
and retain best-effort migration from the historical ~/.pi location.

Add cross-runtime tests for path resolution, migration, precedence, and
the case where both old and new files exist.
@Luminger Luminger changed the title feat!: move global settings to $PI_CODING_AGENT_DIR/extensions feat: honor pi agent config directories for settings Sep 20, 2026
@Luminger
Luminger merged commit eaad718 into main Sep 20, 2026
19 checks passed
@Luminger
Luminger deleted the fix/configdir branch September 20, 2026 06:14
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.

2 participants