Skip to content

Add script to remove temp/cache dirs#58

Merged
imnasnainaec merged 8 commits into
mainfrom
dev-reset-script
May 12, 2026
Merged

Add script to remove temp/cache dirs#58
imnasnainaec merged 8 commits into
mainfrom
dev-reset-script

Conversation

@imnasnainaec
Copy link
Copy Markdown
Contributor

@imnasnainaec imnasnainaec commented May 11, 2026

Tested in Powershell on Windows 11. Not tested on Unix.

This change is Reviewable

Summary by CodeRabbit

  • New Features

    • Added a core:reset command to clean core caches and temp directories.
    • Added a CLI cleanup utility to remove core and extension temporary/build artifacts.
  • Chores

    • Broadened linting to include script files.
    • Relaxed specific lint rules for additional script locations to accommodate tooling scripts.

Review Change Stack

@imnasnainaec imnasnainaec self-assigned this May 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 22324c0f-b9d0-4fea-a610-9cc3718ae100

📥 Commits

Reviewing files that changed from the base of the PR and between e8d79dc and 5c4cbfc.

📒 Files selected for processing (1)
  • scripts/delete-temp-dirs.cjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/delete-temp-dirs.cjs

📝 Walkthrough

Walkthrough

Adds a CommonJS cleanup script to remove core and extension temporary directories, updates ESLint and TypeScript lint includes to cover scripts, and adds a core:reset npm script to run the cleanup with --core --ext.

Changes

Cleanup Script Infrastructure

Layer / File(s) Summary
Linting Configuration
tsconfig.lint.json, .eslintrc.js
tsconfig.lint.json adds scripts and broadens .*.js; .eslintrc.js expands the overrides glob to include ./scripts/* so no-console is disabled for script files.
Cleanup Script Implementation
scripts/delete-temp-dirs.cjs
New script resolves platform-specific config/appdata base, defines CORE_DIRS and EXT_DIRS, provides deleteDirectory() using fs.rmSync(..., { recursive: true, force: true }), parses --core/--ext flags, runs deletions, logs progress, and exits with appropriate codes on errors.
npm Script Integration
package.json
Adds core:reset npm script that runs core:stop then node ./scripts/delete-temp-dirs.cjs --core --ext.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hop through tempdirs with a tiny broom,
I whisper to consoles, "Log away, not gloom."
Caches cleared and dist folders put to bed,
Flags picked—core and ext—no stray files left to dread.
A tidy repo dance, from this rabbit's stead.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly summarizes the main change: adding a script to remove temporary and cache directories, which is the primary purpose of the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-reset-script

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

@imnasnainaec

This comment was marked as resolved.

@coderabbitai

This comment was marked as outdated.

@jasonleenaylor
Copy link
Copy Markdown
Contributor

scripts/delete-temp-dirs.cjs line 4 at r2 (raw file):

const path = require('path');

/** Cross-platform script to delete temporary and cache directories */

Add a 'why' if you can

@jasonleenaylor
Copy link
Copy Markdown
Contributor

scripts/delete-temp-dirs.cjs line 22 at r2 (raw file):

    /* eslint-enable no-nested-ternary */
    return electronParent ? path.join(electronParent, 'Electron') : '';
  },

For simplification can we make sure this array is full of only strings? Then we don't need type checking and function executing below in a link.

Code quote:

  () => {
    /* eslint-disable no-nested-ternary */
    let electronParent =
      process.platform === 'win32' ? process.env.APPDATA : process.env.XDG_CONFIG_HOME;
    if (!electronParent && process.env.HOME) {
      electronParent =
        process.platform === 'linux'
          ? path.join(process.env.HOME, '.config')
          : process.platform === 'darwin'
            ? path.join(process.env.HOME, 'Library', 'Application Support')
            : '';
    }
    /* eslint-enable no-nested-ternary */
    return electronParent ? path.join(electronParent, 'Electron') : '';
  },

Copy link
Copy Markdown
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

Had some suggestions.

@jasonleenaylor reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: 3 of 4 files reviewed, all discussions resolved (waiting on imnasnainaec).

Copy link
Copy Markdown
Contributor Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

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

@imnasnainaec reviewed all commit messages.
Reviewable status: 3 of 4 files reviewed, all discussions resolved.

@imnasnainaec
Copy link
Copy Markdown
Contributor Author

imnasnainaec commented May 11, 2026

Updated the Electron cache directory to match: paranext/paranext-core#2257

UPDATE: ... and reverted.

Copy link
Copy Markdown
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

:lgtm:

@jasonleenaylor reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).

Copy link
Copy Markdown
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

:lgtm:

@jasonleenaylor reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).

@imnasnainaec imnasnainaec merged commit 74bd141 into main May 12, 2026
8 checks passed
@imnasnainaec imnasnainaec deleted the dev-reset-script branch May 12, 2026 18:47
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.

2 participants