clawwork-ai/ClawWork

[Bug] file-index walkDir does not filter hidden files at the top level

Open

#390 opened on Apr 15, 2026

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (63 forks)github user discovery
area/artifactgood first issuekind/bug

Repository metrics

Stars
 (519 stars)
PR merge metrics
 (PR metrics pending)

Description

Problem

walkDir skips hidden entries only when depth > 0. At the root of a scanned folder, hidden files like .DS_Store, .zsh_history, or .env.local are included in the index. When a user adds ~/ or any dotfile-heavy directory as a context folder, the file index pollutes the UI with noise and potentially exposes sensitive files to assistant context.

Location

File: packages/desktop/src/main/context/file-index.ts:42-43

for (const name of entries) {
  if (isHidden(name) && depth > 0) continue;

Fix Approach

  1. Drop the && depth > 0 condition so isHidden applies at all depths.
  2. Verify the ALLOWED_DOT_FILES allow-list (.env, .gitignore, .dockerfile) still works — it should, since isHidden already consults it.

Verification

  1. Run pnpm check — must pass.
  2. Unit test: scan a folder containing .DS_Store, file.ts, .env — expect the result to contain file.ts and .env, but not .DS_Store.

Context

  • WG: Artifact & File System
  • Priority: Low (good first issue)
  • Estimated effort: 10-15 minutes

Contributor guide