fix(deps): declare openclaw as an optional peer, not a runtime dependency - #21
Merged
Merged
Conversation
…ency
openclaw is the host runtime. Declaring it under `dependencies` made anyone
installing findmy-cli pull the entire OpenClaw runtime, and GitHub attributed
every advisory in that tree to this repo at runtime scope: 23 open Dependabot
alerts (hono x7, undici x5, ip-address x3, fast-uri x3, brace-expansion x2,
protobufjs, tar) for code no consumer of this plugin ever installs.
Move it to an optional `peerDependencies` entry at `>=2026.6.5` (matching
`openclaw.compat.pluginApi`), plus `devDependencies` at `^2026.8.1`. This is
what OpenClaw's own packaging guide prescribes, and what the sibling
first-party plugins (apple-pim, porsche-connect, travel-hub, trakt-plugin)
already ship.
The top-level `import { definePluginEntry } from
'openclaw/plugin-sdk/plugin-entry'` in src/index.ts is left as-is. Per
openclaw's plugins/dependency-resolution.md, OpenClaw refuses to npm-install a
registry copy of the host into a managed plugin project and instead reasserts a
plugin-local `node_modules/openclaw` link for packages that declare the host
peer -- so declaring the peer is precisely what makes that import resolve.
No `overrides` are needed: openclaw pins its dependencies exactly, and 2026.8.1
already resolves all 23 advisories above their first-patched versions. Each
range was checked against the resolved lockfile with semver.
The devDependency is here for types, and that is its whole reason -- unlike the
equivalent restaurant-cli fix, where it was purely scope-pinning. Verified by
hiding node_modules/openclaw: `tsc --noEmit` fails TS2307, while the tsup build
and `plugin-inspector ci --mock-sdk` both still pass. Added a `typecheck` script
and a CI step running it, so that reason is enforced rather than asserted.
CI's Node is untouched: it already runs Node 24, which satisfies
openclaw@2026.8.1's `>=24.15.0 <25` floor.
Alert #5 (esbuild 0.27.7, low, development scope) is left open deliberately. It
comes from tsup@8.5.1, which declares `esbuild: ^0.27.0`; a caret on a 0.x pins
the minor, so forcing 0.28.x would put the build tool outside its own declared
range while `prepack` runs that build. The advisory is arbitrary file read via
esbuild's dev server on Windows -- nothing here starts that server or builds on
Windows.
Verified: npm ci --force clean, typecheck clean, build clean,
plugin-inspector ci PASS (0 breakages, 0 warnings), go test ./... 3/3 ok.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VDD6P9ft7DNNbrXpNWvCsk
|
| Filename | Overview |
|---|---|
| openclaw/package.json | Moves OpenClaw to an optional peer and development dependency, adds typechecking, and documents the packaging contract. |
| openclaw/package-lock.json | Regenerates the lockfile with OpenClaw 2026.8.1 and its dependency tree marked for development use. |
| .github/workflows/plugin-inspector.yml | Adds the new TypeScript typecheck to the existing Node 24 plugin validation job. |
Reviews (1): Last reviewed commit: "fix(deps): declare openclaw as an option..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
openclaw/package.jsondeclared the host runtime as an ordinary runtime dependency:So anyone installing
findmy-clipulled the entire OpenClaw runtime, and GitHub attributed every advisory in that tree to this repo at runtime scope — 23 open Dependabot alerts (hono ×7, undici ×5, ip-address ×3, fast-uri ×3, brace-expansion ×2, protobufjs, tar) for code no consumer of this plugin ever installs.The fix
openclawmoves to an optionalpeerDependenciesentry at>=2026.6.5(matchingopenclaw.compat.pluginApi), plusdevDependenciesat^2026.8.1.This is what OpenClaw's own packaging guide prescribes (
docs/snippets/plugin-publish/minimal-package.json), and what the sibling first-party plugins — apple-pim, porsche-connect, travel-hub, trakt-plugin — already ship.No
overridesare needed. openclaw pins its dependencies exactly, and 2026.8.1 already resolves all 23 advisories above their first-patched versions. Each advisory range was checked against the resolved lockfile with semver rather than assumed:The top-level import was deliberately left alone
src/index.tsdoes a hard, typedimport { definePluginEntry } from 'openclaw/plugin-sdk/plugin-entry'— not the try/catchrequirethat restaurant-cli uses. That is correct here and was not rewritten.openclaw's
plugins/dependency-resolution.mdstates that plugins importingopenclaw/plugin-sdk/*declare the host as a peer, that OpenClaw refuses to npm-install a registry copy of the host into a managed plugin project (a stale host copy corrupts peer resolution inside the plugin), and that it reasserts a plugin-localnode_modules/openclawlink for packages that declare the host peer. Declaring the peer is precisely what makes that import resolve; the olddependenciesentry was the thing working against it.The devDependency is here for types — and that is the whole reason
Unlike the restaurant-cli fix, where the entry was purely scope-pinning,
definePluginEntryhere is a typed import. Verified by hidingnode_modules/openclaw:tsc --noEmit→ failsTS2307(andapidegrades to implicitany)tsupbuild → still passes (the peer is externalized)plugin-inspector ci --mock-sdk→ still passesSo a
typecheckscript was added and wired into the existing CI job. The reason is now enforced, not asserted, and it is written down in a"//"note inpackage.jsonnext to the lines a maintainer would be tempted to delete.Two traps that did not apply here
>=24.15.0 <25floor. restaurant-cli's Node-20 problem does not exist in this repo, so nothing had to be worked around.koffi(new native postinstall in openclaw 2026.8.1) installed cleanly undernpm ci --force; no--ignore-scriptsscoping was needed. npm'sallowScriptsfield is advisory-only in npm 11.17, so it was deliberately not added.Left open deliberately
Alert #5 — esbuild 0.27.7, low severity, development scope: arbitrary file read via esbuild's dev server on Windows. It comes from
tsup@8.5.1, which declaresesbuild: ^0.27.0— a caret on a 0.x pins the minor, so forcing 0.28.x would put the build tool outside its own declared range whileprepackruns that build. Nothing here starts that dev server or builds on Windows. Same call the restaurant-cli fix made for its identical alert.Verification
Note: no workflow runs the Go tests (
.github/workflows/has only plugin-inspector and the tag-triggered publish jobs), so those were run locally. Ago testCI job would be a reasonable follow-up, out of scope here.🤖 Generated with Claude Code
https://claude.ai/code/session_01VDD6P9ft7DNNbrXpNWvCsk