feat: git-style scope auto-detection with .dotf/ walk-up#15
Merged
Conversation
Replace ~/dotfiles with ~/.dotf as the global data directory. Add find_dotf_root() that walks up from cwd looking for .dotf/ directories, with CVE-2022-24765-style ownership check via libc::getuid(). Add resolve_context() for automatic Global vs Local mode detection. Extract validate_link_boundary() and print_mode_header() onto DotfContext for reuse across commands. Add local_from_path() constructor for init. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove --dir <PATH> in favor of automatic scope detection. Add --global/-G as a top-level escape hatch to force global mode from any directory. Split Command enum with #[command(flatten)] so Init and Completions are handled before scope resolution. Extract unwrap_or_exit helper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add print_mode_header() to status, sync, and diff so users see which scope was resolved. Use validate_link_boundary() in config command instead of inline check. Update test helpers for ~/dotfiles → ~/.dotf. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Insert -- before user-controlled URI/item arguments in pass, op, and bw CLI invocations to prevent crafted values like --help from being interpreted as flags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Warn when creating a .dotf/ inside a directory that already has a parent .dotf/. Show migration hint when ~/dotfiles exists but ~/.dotf doesn't. Add tests for local init: directory creation, .gitignore idempotency, preserving existing content, edge cases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update TestEnv to use ~/.dotf instead of ~/dotfiles. Add fuzz targets for find_dotf_root and validation helpers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update README, SECURITY.md, and docs site to reflect the new ~/.dotf directory, --global/-G flag, and dotf init [path] syntax. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace continue-on-error with || true on cargo mutants so the job reports green in the GitHub UI. Missed mutants are still surfaced in the step summary — they just don't break the pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
chrisfentiman
added a commit
that referenced
this pull request
Mar 14, 2026
🤖 I have created a release *beep* *boop* --- ## [0.9.0](v0.8.1...v0.9.0) (2026-03-14) ### Features * git-style scope auto-detection with .dotf/ walk-up ([#15](#15)) ([13e3ccc](13e3ccc)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dotfnow walks up from cwd looking for.dotf/directories (like git finds.git/), with CVE-2022-24765-style ownership check viagetuid()~/dotfiles→~/.dotf: global data directory renamed for consistency with local.dotf/convention--dir→--global/-G: replaced explicit directory flag with escape hatch to force global mode;dotf init [path]replacesdotf --dir <path> initstatus,sync, anddiffnow print which scope was resolved (to stderr, keeping stdout pipeable)--separator added before user-controlled values in all secret backend CLI calls (pass, op, bw) to prevent flag injectionvalidate_link_boundary()ontoDotfContext, used by bothconfigandrender_and_symlink_all.dotf/creation, shows migration hint when~/dotfilesexistsTest plan
cargo fmtcleandotf initcreates~/.dotf/,dotf init .creates local.dotf/dotf -G statusforces global from inside a local project.dotf/from nested subdirectory🤖 Generated with Claude Code