Skip to content

Feature request: configurable ignore-paths (and safelist editor server caches like ~/.vscode-server by default) #1

Description

@NiveditJain

Background

I ran dev-purge on my home directory and it deleted the out/ directory inside ~/.vscode-server/bin/<commit-hash>/, which broke my code command in WSL. The error after running:

Error: Cannot find module '/home/<user>/.vscode-server/bin/<hash>/out/server-cli.js'

Root cause

The VS Code Remote server installs a package.json at ~/.vscode-server/bin/<commit-hash>/package.json so it can resolve its own dependencies. The README says generic dirs like out, dist, build, target are only flagged inside actual projects (detected via marker files like package.json). But that detection is exactly what backfires here — the VS Code server bin has a package.json, so the directory gets classified as a project, and its out/ (which contains server-cli.js, server-main.js, bootstrap-fork.js, the bundled vs/ runtime, etc.) gets removed. The code command in WSL launches via:

"$ROOT/node" "$ROOT/out/server-cli.js" ...

so once out/ is gone, the CLI is broken until the server is re-provisioned by VS Code Remote.

This very likely affects sibling tools the same way (Cursor uses ~/.cursor-server, Windsurf uses ~/.windsurf-server, JetBrains Gateway uses ~/.cache/JetBrains/RemoteDev-*, etc. — they all ship a package.json/marker file alongside an out/ or dist/).

Feature request

Two things, ideally:

  1. A user-configurable ignore/exclude list — flag(s) like --ignore <glob> (repeatable) and a config file equivalent (e.g. ~/.config/dev-purge/config.json with an ignore array). Globs should match against absolute paths so users can write ~/.vscode-server/** etc.

  2. A built-in safelist of known editor server caches, applied by default but overridable. Suggested entries:

    • ~/.vscode-server/**
    • ~/.vscode-server-insiders/**
    • ~/.vscode-remote/**
    • ~/.cursor-server/**
    • ~/.windsurf-server/**
    • ~/.cache/JetBrains/RemoteDev-*/**

These directories are not user projects — they're machine-managed editor runtime installs that happen to contain marker files, and reclaiming a few hundred MB inside them isn't worth bricking the editor's remote command.

A related, smaller mitigation: when the project marker is package.json and the directory path is under a known editor-server root, skip it regardless of the user's other flags.

Happy to send a PR if there's interest and a preferred config format.

Repro

  1. Set up VS Code Remote-WSL (or any setup that creates ~/.vscode-server/bin/<hash>/).
  2. Run dev-purge -a (or any invocation that includes the build-artifacts category) over $HOME.
  3. Observe ~/.vscode-server/bin/<hash>/out/ gets deleted.
  4. code --version from inside WSL fails with Cannot find module '.../out/server-cli.js'.

Workaround for anyone hitting this now

Re-download the matching server tarball and extract just the out/ dir:

HASH=$(ls ~/.vscode-server/bin | head -1)
cd ~/.vscode-server/bin/$HASH
curl -sL -o /tmp/vscs.tgz "https://update.code.visualstudio.com/commit:$HASH/server-linux-x64/stable"
tar -xzf /tmp/vscs.tgz --strip-components=1 vscode-server-linux-x64/out
rm /tmp/vscs.tgz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions