Skip to content

feat(config): discover treehouse.toml in ancestor directories - #76

Open
rudingma wants to merge 2 commits into
kunchenguid:mainfrom
rudingma:codex/ancestor-config-discovery
Open

feat(config): discover treehouse.toml in ancestor directories#76
rudingma wants to merge 2 commits into
kunchenguid:mainfrom
rudingma:codex/ancestor-config-discovery

Conversation

@rudingma

Copy link
Copy Markdown

Summary

  • discover the nearest treehouse.toml from the repository root upward
  • stop before $HOME or the filesystem root
  • resolve relative root values from the selected config file's directory
  • preserve repo-root precedence, user-level hooks, global config, and global prune behavior
  • document ancestor configuration and make config-committing E2E fixtures independent of global ignore rules

Why

Pool placement is operator and machine policy, but repository-root-only discovery requires duplicating the same untracked configuration across every repository in a context. Ancestor discovery lets a context directory such as ~/Workspace/personal own that policy while repository-root files remain available as explicit overrides.

The implementation stays behind the existing config.Load(repoRoot) interface, so all repo-scoped commands receive the behavior consistently without changing their callers.

Compatibility

  • existing repository-root files remain the nearest file and keep precedence
  • only one repo-scoped file is selected; configs are not cascaded or merged
  • $HOME/treehouse.toml is not treated as a second global config
  • malformed nearest configs fail instead of silently falling back
  • hooks in every repo-scoped config remain ignored
  • treehouse init, user-level config, and prune --all retain their existing roles

Validation

  • make lint
  • make test
  • GOOS=windows GOARCH=amd64 go build ./...
  • git diff --check

Closes #75

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.

Feature request: discover treehouse.toml in ancestor directories (nearest file wins)

1 participant