Skip to content

fix(install): a local refresh refuses the home directory (#3234) - #3288

Open
LuisAlbertoMK wants to merge 1 commit into
colbymchenry:mainfrom
LuisAlbertoMK:fix/refresh-home-guard
Open

LuisAlbertoMK wants to merge 1 commit into
colbymchenry:mainfrom
LuisAlbertoMK:fix/refresh-home-guard

Conversation

@LuisAlbertoMK

Copy link
Copy Markdown

A project-local install resolves every path from the working directory. Run from your home directory (or a filesystem root), codegraph install --refresh — which codegraph upgrade runs by default — wrote the CodeGraph instructions block into $HOME/AGENTS.md, the user's own global instructions file, not a project's. <cwd>/.codex resolving to ~/.codex made Codex's local layer look already configured, so the sweep rewrote it.

refreshTargets now refuses a local sweep from a directory that unsafeIndexRootReason already rejects for init (home directory, a parent of it, or a filesystem root). Every target reports a new skipped status with the reason, and the CLI says why and points at running it from a project directory. Global refresh is unchanged.

Added two tests in installer-targets.test.ts: one that seeds a global Codex install and refreshes from $HOME, asserting every report is skipped and no $HOME/AGENTS.md appears; and one that a real project-local refresh still works.

Tested: tsc --noEmit clean, npm run build, focused tests (new ones + cli-install-init + status-json), and the full installer-targets file (576 passed, 50 skipped).

This branch has not been deployed

No deployments
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