Skip to content

fix(repository): stop repo-root search at $HOME, clarify error - #273

Merged
graywolf336 merged 1 commit into
fix/agent-enable-without-repofrom
fix/repo-root-home-boundary
Oct 17, 2026
Merged

graywolf336 merged 1 commit into
fix/agent-enable-without-repofrom
fix/repo-root-home-boundary

Conversation

@graywolf336

Copy link
Copy Markdown
Contributor

Stop find_repository_root_from() from walking past $HOME to filesystem root when run from a directory with no .atomic/ ancestor. ~/.atomic is global config (no database) and is never treated as a valid repo root — has_database() still requires atomic.redb.

Also improves the RepositoryNotFound message to point users at atomic init or cd-ing into a real repository.

Complements #272 (agent enable outside a repo): both return RepositoryNotFound cleanly at the home boundary instead of walking to /.

@graywolf336
graywolf336 force-pushed the fix/repo-root-home-boundary branch from fc811a7 to e10b502 Compare October 16, 2026 22:19
find_repository_root_from() walked up to filesystem root when run from
/Users/bradleyhilton, skipping ~/.atomic (global config, no database) and returning a
cryptic RepositoryNotFound. Stop at $HOME and surface a message pointing
users to 'atomic init' or cd-ing into a real repository. Home is never
treated as a valid repo root: .atomic/ still requires atomic.redb.
@graywolf336
graywolf336 force-pushed the fix/repo-root-home-boundary branch from e10b502 to 76655a8 Compare October 17, 2026 02:06
@graywolf336
graywolf336 changed the base branch from dev to fix/agent-enable-without-repo October 17, 2026 02:08
@graywolf336
graywolf336 merged commit b09537f into fix/agent-enable-without-repo Oct 17, 2026
@graywolf336
graywolf336 deleted the fix/repo-root-home-boundary branch October 17, 2026 02:08
geekgonecrazy pushed a commit that referenced this pull request Oct 17, 2026
find_repository_root_from() walked up to filesystem root when run from
/Users/bradleyhilton, skipping ~/.atomic (global config, no database) and returning a
cryptic RepositoryNotFound. Stop at $HOME and surface a message pointing
users to 'atomic init' or cd-ing into a real repository. Home is never
treated as a valid repo root: .atomic/ still requires atomic.redb.
geekgonecrazy added a commit that referenced this pull request Oct 17, 2026
* feat(agent): let `enable` run outside an Atomic repository

`atomic agent enable` failed with RepositoryNotFound outside a repo, but
nothing about hook installation needs one: every installed hook command
is guarded by `test -d .atomic || test -f .atomic-sandbox && ...`, so
hooks stay dormant until they fire inside an Atomic repository.

Soften both `find_repository_root()?` calls in the enable path:

- `run` now falls back to the current directory as the install base,
  with warnings that turns are only recorded in Atomic projects.
- `.atomic/sessions/` is only created when `.atomic/` already exists, so
  enabling outside a repo never leaves a stray directory behind.
- the `--agents-md` path in `install_integration` skips `[[repo-file]]`
  entries with a warning instead of failing the whole install
  (`InstallOptions.repo_root` was already optional).

Inside a repository behavior is unchanged: same base directory, same
sessions directory, no fallback warnings.

* fix(agent): install to the home directory, not cwd, outside a repo

The previous fallback used the current directory as the install base,
which wrote hooks into an arbitrary ./.claude/settings.json no agent
session would ever read. Outside a repository the correct target is the
home directory — the same one --global uses.

- Rename repo_root → install_base in run(); outside a repo it is the
  home directory (via dirs::home_dir, an existing dependency).
- Gate .atomic/sessions creation behind in_repo so the home .atomic/
  (global config) is never touched by the fallback path.
- Update the module and subcommand docs to match.

* docs(agent): correct the enable docs to match what actually installs where

Every registry agent is packaged, and the packages install entirely into
the home directory per their manifests (~/.claude/settings.json,
~/.config/opencode/opencode.json, skills, prompts) — never the repo. The
repo root only feeds agent auto-detection, .atomic/sessions/, and
--agents-md [[repo-file]] entries; the repo-relative AgentHook::install
path is a degraded fallback for when the package cannot be fetched.

State that plainly in the module and subcommand docs so the fallback is
not mistaken for the primary behavior.

* refactor(agent)!: remove the redundant --global install path

The integration packages (the normal enable path for every registry
agent) install entirely into the home directory — ~/.claude/settings.json,
~/.config/opencode/opencode.json, skills, prompts — and never the repo.
The pre-package `--global` path was a parallel, worse model: bare hooks
only, no skills, no prompts, no receipt. With plain `enable` now falling
back to the home directory outside a repository, there is one install
model and `--global` only added confusion.

- Remove the `--global` flag from `agent enable` and `agent disable`,
  along with both `run_global()` implementations.
- `agent disable` gains the same outside-repo fallback (home directory)
  and always cleans both scopes — the uninstall base and the home
  config — so one command removes Atomic's hooks wherever they live,
  including legacy global installs that predate receipts.
- Delete the now-orphaned install_global/uninstall_global methods and
  claude/gemini global_settings_path from atomic-agent; codex keeps
  global_hooks_path/is_installed_global, which its trait is_installed
  and the receipt-repair path still use.

BREAKING CHANGE: `atomic agent enable --global` and
`atomic agent disable --global` no longer exist; plain `enable`/
`disable` install and remove the same global hooks.

* fix(repository): stop repo-root search at $HOME, clarify error (#273)

find_repository_root_from() walked up to filesystem root when run from
/Users/bradleyhilton, skipping ~/.atomic (global config, no database) and returning a
cryptic RepositoryNotFound. Stop at $HOME and surface a message pointing
users to 'atomic init' or cd-ing into a real repository. Home is never
treated as a valid repo root: .atomic/ still requires atomic.redb.

---------

Co-authored-by: Bradley Hilton <graywolf336@craftyn.com>
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