Skip to content

feat(scan): add [scan] dirs to set scan roots without implying home - #130

Merged
django23 merged 2 commits into
mainfrom
claude/review-last-issues-uaft2i
Aug 10, 2026
Merged

feat(scan): add [scan] dirs to set scan roots without implying home#130
django23 merged 2 commits into
mainfrom
claude/review-last-issues-uaft2i

Conversation

@django23

@django23 django23 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #129.

[scan] extra only ever adds to the home directory, so there was no way to scan a subset of home without also walking all of it. This adds [scan] dirs, an exhaustive list of scan roots where home is scanned only if you list it:

[scan]
dirs = ~/Code
dirs = /Volumes/Work/clients

This is option 1 from the issue's "alternatives considered". The reporter also suggested renaming the existing keys to drop the "extra" concept, but that breaks every existing config for a problem a second key solves cleanly, so [scan] extra keeps its current additive meaning and is untouched.

Behaviour

  • Precedence. A positional CLI argument still overrides everything. Below that, dirs wins over extra; setting both warns rather than silently dropping one, since they answer different questions and mixing them is almost certainly a mistake.
  • Missing directories. A missing entry warns and is skipped, matching extra (an unmounted volume shouldn't fail a run). But if every listed directory is missing, that exits 1 rather than scanning nothing at all, which would otherwise look like a successful no-op.
  • Cache. Everything downstream (the find traversal, mdfind -onlyin, and the path cache's in-scope filter) already keys off ASIMOV_SCAN_DIRS, so narrowing the roots narrows all three. A cache left over from a full-home scan is filtered on read, not re-excluded, and out-of-scope entries stay in the file so widening the scope later brings them back.
  • asimov doctor recognises the new key, so a typo is still reported rather than silently ignored.

Global caches under [fixed_dirs] are still excluded regardless of scan roots, consistent with how [skip_paths] already behaves.

Test plan

  • make check passes
  • Shellcheck clean
  • CHANGELOG.md updated (if user-facing)

9 new Bats tests: scanning only the listed directory, multiple entries, home included only when listed explicitly, one-missing-warns, all-missing-errors, dirs beating extra with a warning, the CLI argument overriding dirs, and a cached run narrowing correctly when the roots shrink.

Verified against bash 5.2 locally. Every new empty-array expansion is guarded by a count check, following the existing bash 3.2 convention in this file; the CI matrix covers 3.2 for real.

README documents the new key alongside extra in "Scan more than your home directory".

claude added 2 commits August 6, 2026 07:46
[scan] extra always adds to home, with no way to scan only a subset
of it. [scan] dirs is an exhaustive list instead: home is scanned
only if it's listed. Positional CLI overrides both; dirs wins over
extra if both are set, with a warning; all-missing dirs is an error
rather than a silent no-op scan.

Closes #129.
The path cache outlives a config change, so a cache built from a full
home scan must be filtered on read rather than re-excluded wholesale
when the scan roots narrow.
@huyz

huyz commented Aug 6, 2026

Copy link
Copy Markdown

Proposal with backward-compatibility sounds perfect. Thanks!

@django23
django23 merged commit b2a6a83 into main Aug 10, 2026
5 checks passed
@django23
django23 deleted the claude/review-last-issues-uaft2i branch August 10, 2026 19:36
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.

Support multiple scan dirs without including HOME

3 participants