clawwork-ai / clawwork-ai/ClawWork

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

Open Beginner friendly
#390 1 comment 0 reactions 0 assignees View on GitHub
area/artifact kind/bug
Dominant language
TypeScript
Stars
532
Forks
75
Avg merge
5h 31m
Merged PRs (30d)
1

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`

```typescript
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

Open the contributing guide

Research direction

Open packages/desktop/src/main/context/file-index.ts at the walkDir loop and inspect how isHidden uses the ALLOWED_DOT_FILES allow-list. Run pnpm check, then scan a folder containing .DS_Store, file.ts, and .env; done means file.ts and .env are indexed while .DS_Store is omitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
desktop
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.