Skip to content

feat(config): discover devbox.json in a .config subdirectory - #2947

Open
mikeland73 wants to merge 1 commit into
mainfrom
claude/focused-goldberg-dnyfqr
Open

feat(config): discover devbox.json in a .config subdirectory#2947
mikeland73 wants to merge 1 commit into
mainfrom
claude/focused-goldberg-dnyfqr

Conversation

@mikeland73

Copy link
Copy Markdown
Collaborator

Summary

Fixes #2792.

Devbox now discovers a config file at .config/devbox.json in addition to a top-level devbox.json. This lets projects keep their root directory tidy by moving the Devbox config (and the .devbox state that lives alongside it) under a .config directory, instead of adding yet another dotfile/config file to the project root.

Behavior:

  • When resolving a directory, Devbox first looks for devbox.json directly in it, then falls back to <dir>/.config/devbox.json.
  • A top-level devbox.json always takes precedence, so existing projects are completely unaffected — the new location is only used when no root-level config exists.
  • Both Open (single directory) and Find (walking up parent directories) honor the new location, so running devbox from a subdirectory of a project that stores its config under .config works as expected.

The change is small and localized to searchDir, which already used a []string of candidate names — the project-directory anchoring semantics (project dir = the directory containing the resolved config file) are unchanged, so .config/devbox.json keeps its state self-contained under .config.

Note: this implements the devbox.json half of the request. process-compose.yml discovery was left out of scope for this change to keep it focused and low-risk.

cc @eknowles (issue reporter)

How was it tested?

Added unit tests in internal/devconfig/config_test.go (TestConfigSubdir) covering:

  • Open finding .config/devbox.json.
  • A root-level devbox.json taking precedence over .config/devbox.json.
  • Find locating .config/devbox.json in a parent directory when invoked from a child directory.

go build ./..., go vet ./internal/devconfig/..., and gofmt are clean. The new tests pass. (Two unrelated pre-existing failures in TestFindError/Permissions and TestFindError/ExactFilePermissions occur only because the test environment runs as root, which bypasses chmod 0o000; they fail identically on the base commit and are untouched by this change.)

Community Contribution License

All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.

By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.


Generated by Claude Code

Devbox now looks for a config file in `.config/devbox.json` in addition
to `devbox.json` at the top of a directory. This lets projects keep their
root directory tidy by moving devbox.json (and the `.devbox` state that
lives alongside it) under `.config`.

A top-level `devbox.json` still takes precedence, so existing projects are
unaffected. Both `Open` (single directory) and `Find` (walking up parent
directories) honor the new location.

Fixes #2792

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VgaUq2F9Drmri6oRUp5duV
Copilot AI lite review requested due to automatic review settings August 13, 2026 00:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Support .config dir for devbox.json and process-compose.yml

3 participants