Skip to content

feat: add --follow-symlinks option for collection indexing#468

Open
moralesl wants to merge 3 commits intotobi:mainfrom
moralesl:feat/follow-symlinks
Open

feat: add --follow-symlinks option for collection indexing#468
moralesl wants to merge 3 commits intotobi:mainfrom
moralesl:feat/follow-symlinks

Conversation

@moralesl
Copy link
Copy Markdown

Problem

qmd collection add and qmd update do not traverse symbolic links when scanning for files. Collections whose root directory contains symlinked subdirectories silently skip all files behind those symlinks.

Fixes #423.

Solution

Add a per-collection follow_symlinks option that controls fast-glob's followSymbolicLinks behavior. The setting is:

  • Set via CLI: qmd collection add ~/vault --follow-symlinks
  • Persisted in index.yml per collection:
    collections:
      vault:
        path: ~/vault
        follow_symlinks: true
  • Respected by both collection add (initial index) and qmd update (re-index)
  • Defaults to false (backward compatible)

Changes

File Change
src/collections.ts Added follow_symlinks to Collection interface, addCollection(), and updateCollectionSettings()
src/store.ts Added followSymlinks option to reindexCollection(), passes to fast-glob
src/cli/qmd.ts Added --follow-symlinks CLI flag, threaded through collectionAdd()indexFiles(), updated help text

Testing

Verified manually:

  • Without --follow-symlinks: symlinked directory skipped (3 files indexed)
  • With --follow-symlinks: symlinked directory traversed (4 files indexed)
  • qmd update respects the persisted follow_symlinks: true config
  • All existing tests pass

Add per-collection follow_symlinks support so symlinked directories
within a collection root are traversed during indexing.

- Add --follow-symlinks flag to `qmd collection add`
- Persist follow_symlinks in index.yml per collection
- Pass the setting through to fast-glob in both CLI and SDK paths
- Default remains false (backward compatible)

Closes tobi#423
Three tests covering the symlink feature:
- Symlinked directories are skipped by default
- --follow-symlinks flag enables traversal
- Setting persists in index.yml and is respected by qmd update
- Show follow_symlinks setting in 'qmd collection show' output
- Add --follow-symlinks example to README Collection Management section
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.

collection add does not follow symbolic links

1 participant