Skip to content

chore: replace fs.rm with safeDelete#1263

Open
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
chore/replace-fs-rm-with-safeDelete
Open

chore: replace fs.rm with safeDelete#1263
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
chore/replace-fs-rm-with-safeDelete

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 22, 2026

Summary

CLAUDE.md forbids `fs.rm` / `fs.rmSync` / `rm -rf` in our code — use `safeDelete` from `@socketsecurity/lib/fs`.

Fixes:

  • `packages/cli/scripts/sync-checksums.mts` — 3 call sites (cleanup after parsing checksums.txt + error path + finally block).
  • `.claude/hooks/setup-security-tools/index.mts` — 1 call site (zizmor extract-dir cleanup).

Test plan

  • `pnpm run lint` + `pnpm run type` clean.
  • `node packages/cli/scripts/sync-checksums.mts --dry-run` still works.

Note

Low Risk
Low risk refactor: only changes temp directory cleanup in two scripts, with no impact to core business logic beyond how deletions are performed.

Overview
Replaces recursive temp-directory cleanup using fs.rm(..., { recursive: true }) with safeDelete from @socketsecurity/lib/fs.

This updates cleanup paths in the zizmor extraction flow (.claude/hooks/setup-security-tools/index.mts) and in the checksum sync script (packages/cli/scripts/sync-checksums.mts), including normal, error, and finally cleanup branches.

Reviewed by Cursor Bugbot for commit f0ccde5. Configure here.

CLAUDE.md forbids fs.rm / fs.rmSync / rm -rf in our code —
safeDelete from @socketsecurity/lib/fs is the canonical wrapper.
Fixes sync-checksums.mts (3 sites) and the setup-security-tools
Claude hook (1 site).
@jdalton
Copy link
Copy Markdown
Contributor Author

bugbot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f0ccde5. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant