Skip to content

fix: clean up legacy shim files and stale tmp files on upgrade#934

Merged
jackwener merged 2 commits intomainfrom
fix/cleanup-legacy-shims-and-tmp
Apr 10, 2026
Merged

fix: clean up legacy shim files and stale tmp files on upgrade#934
jackwener merged 2 commits intomainfrom
fix/cleanup-legacy-shims-and-tmp

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

Fixes the cluttered ~/.opencli/ directory reported by @WAWQAQ. Adds cleanup steps to fetch-adapters.js that run on every version upgrade:

  1. Remove legacy compat shim filesregistry.js, errors.js, utils.js, launcher.js, logger.js, types.js were created by an older approach using file:// re-exports. Current approach uses node_modules/@jackwener/opencli symlink. Safety check: only deletes files containing export * from 'file://
  2. Remove legacy compat shim directoriesbrowser/, download/, errors/, launcher/, logger/, pipeline/, registry/, types/, utils/ — same safety check
  3. Clean up stale .plugins.lock.json.tmp-* files — left behind by crashed processes, accumulating over time (108 found on one machine)

All cleanup runs as part of the existing fetchAdapters() flow, triggered by version change on npm install -g.

Test plan

  • src/plugin.test.ts — 72 tests passed (lock file logic unchanged)
  • Safety check verified: only deletes files matching export * from 'file:// pattern
  • Cleanup runs after adapter copy but before manifest write — no risk to adapter state

Add cleanup steps to fetch-adapters.js that run on every version upgrade:

1. Remove legacy compat shim files from ~/.opencli/ (registry.js,
   errors.js, utils.js, etc.) that were created by an older approach
   using file:// re-exports. Current approach uses node_modules symlink.
   Only deletes files containing "export * from 'file://" to avoid
   removing user-created files.

2. Remove legacy compat shim directories (browser/, download/, errors/,
   etc.) using the same safety check.

3. Clean up stale .plugins.lock.json.tmp-* files left behind by
   crashed processes. These accumulate over time (108 found on one
   machine) and clutter ~/.opencli/.
Instead of checking only the first file and deleting the entire
directory, now checks each file individually and only deletes files
matching the shim pattern. Directory is removed only if empty after
individual file cleanup.
@jackwener jackwener merged commit 2288cf7 into main Apr 10, 2026
9 of 11 checks passed
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