clawwork-ai/ClawWork

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

Open

#390 创建于 2026年4月15日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)TypeScript (63 fork)github user discovery
area/artifactgood first issuekind/bug

仓库指标

Star
 (519 star)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南