Skip to content

Commit e2828fa

Browse files
committed
fix: scan files when absolute path contains dot-prefixed directory
fdir/picomatch ignores dot-prefixed path segments by default. When the project lives inside a directory like .claude/worktrees/, the VirtualFileSystem scan returns 0 files silently.
1 parent a52193d commit e2828fa

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/virtual_file_system.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export class VirtualFileSystem {
8282
this.#options = options ?? {}
8383
this.#picoMatchOptions = {
8484
cwd: this.#source,
85+
dot: true,
8586
}
8687
this.#matcher = picomatch(this.#options.glob ?? DEFAULT_GLOB, this.#picoMatchOptions)
8788
}

tests/virtual_file_system.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,23 @@ test.group('Virtual file system', () => {
195195
vfs.clear()
196196
assert.deepEqual(vfs.asList(), {})
197197
})
198+
199+
test('scan files when absolute path contains a dot-prefixed directory', async ({
200+
fs,
201+
assert,
202+
}) => {
203+
await fs.create('.claude/worktrees/my-app/app/controllers/users_controller.ts', '')
204+
await fs.create('.claude/worktrees/my-app/app/controllers/posts_controller.ts', '')
205+
await fs.create('.claude/worktrees/my-app/app/controllers/api/auth_controller.ts', '')
206+
207+
const source = string.toUnixSlash(join(fs.basePath, '.claude/worktrees/my-app/app/controllers'))
208+
const vfs = new VirtualFileSystem(source)
209+
await vfs.scan()
210+
211+
assert.deepEqual(vfs.asList(), {
212+
'users_controller': join(source, 'users_controller.ts'),
213+
'posts_controller': join(source, 'posts_controller.ts'),
214+
'api/auth_controller': join(source, 'api/auth_controller.ts'),
215+
})
216+
})
198217
})

0 commit comments

Comments
 (0)