Commit Graph

8 Commits

Author SHA1 Message Date
roboomp 805b994211 fix(cli): accepted npm protocol plugin installs
Allowed npm:<package> install specs to validate against the resolved package name while still forwarding the original spec to Bun.

Added regression coverage for installing npm:pi-figma-remote-auth through PluginManager.

Fixes #4310
2026-07-02 12:08:01 +00:00
oldschoola a2854ba768 fix: migrate coding-agent tests from fs.rm to removeWithRetries
Migrate 203 test files (356 call sites) from fs.rm/fs.rmSync to
removeWithRetries/removeSyncWithRetries to reduce EBUSY test failures
on Windows. removeWithRetries is now exported from @oh-my-pi/pi-utils.

The migration uses a regex-based approach that:
- Replaces fs.rm(path, { recursive, force }) → removeWithRetries(path)
- Replaces fs.rmSync(path, { recursive, force }) → removeSyncWithRetries(path)
- Replaces fs.rm(path) → removeWithRetries(path) (no options)
- Skips fs.rm/fs.rmSync inside template literals (bun --eval scripts)
- Adds imports to existing @oh-my-pi/pi-utils import or creates new one
- Removes unused fs imports where fs.rm was the only fs usage (4 files)
2026-06-23 15:28:05 -07:00
roboomp a63da8a3a3 fix(coding-agent): made plugin install transaction atomic on validation failure
The #3063 fix introduced a second mutating step — `bun update <name>` —
that rewrites bun.lock before extension validation runs. Three failure
paths could still leave the rejected commit pinned in the lockfile or
active tree:

- Extension validation throwing after `bun update` had refreshed
  bun.lock — rollback restored package.json and node_modules/<name>
  but never touched bun.lock.
- Feature validation (`omp plugin install pkg[ghost]`) throwing
  outside the rollback block entirely.
- Runtime-config save failing after a successful install with no
  rollback path.

Snapshot bun.lock alongside package.json before `bun install` runs and
route every post-install step (resolution, update, package.json read,
feature validation, extension validation, runtime-config save) through
one outer catch that restores all three (package.json + bun.lock +
node_modules/<name> from snapshot). `#rollbackFailedInstall` now
tolerates an unresolved `actualName` for failures that throw before
the dep key is known.

Three regression tests in plugin-install-validation.test.ts pin the
new contract: bun.lock restoration after a git reinstall fails
validation, bun.lock removal when it didn't exist pre-install, and
rollback on an unknown feature request.

Addresses review feedback on #3069.
2026-06-19 18:33:33 +00:00
roboomp 0ada5fe168 fix(coding-agent): refreshed github plugin lockfile pin on re-install
bun install <spec> respects the existing bun.lock pin when the spec is
unchanged and never re-resolves the remote ref, so re-running
`omp plugin install github:owner/repo` on an already-installed plugin
reported success while silently keeping the user on the original
resolved commit (1ms no-op, no network).

PluginManager.install now follows a git re-install with
`bun update <name>` to force re-resolution of the ref against the
upstream. First-time installs (no prior dep entry) skip the update —
the initial bun install already fetches HEAD. bun update failures
trigger the same rollback path as validation failures.

Fixes #3063
2026-06-19 18:22:57 +00:00
roboomp 54922241d9 fix(cli): restored git plugin upgrades by repo identity
Matched installed git dependencies by parsed host and repo path instead of the new ref so failed ref upgrades restore the prior package tree.
2026-06-11 16:46:41 +00:00
roboomp bfbbbb02af fix(cli): rejected plugins declaring missing extension entries
Surfaced manifest entries that resolve to nothing on disk at install time instead of silently skipping them through resolvePluginExtensionPaths.
2026-06-11 16:42:27 +00:00
roboomp dd5936701e fix(cli): restored plugin tree after invalid reinstall
Backed up existing npm plugin package trees before reinstall validation so failed extension loads restore the previous working package contents.
2026-06-11 16:39:39 +00:00
roboomp 9842ad8494 fix(cli): rejected unloadable npm plugin installs
Validated npm plugin extension entry points before recording installs and rolled back fresh installs that cannot resolve their extension imports.

Fixes #2312
2026-06-11 16:32:27 +00:00