From 79526b01f4d3cf16c3cfb46313cf1179f0db40ac Mon Sep 17 00:00:00 2001 From: Uttkarsh <38376852+uttkarsh-26@users.noreply.github.com> Date: Sun, 11 Oct 2026 23:40:29 +0530 Subject: test: keep host-provided packages out of dependencies (#36) Adds a manifest guard (scripts/check-manifest.ts + test/util/manifest-test.ts) so npm run check fails if a host-provided package such as typebox lands in dependencies, plus a daemon-startup troubleshooting section in the skill. Co-Authored-By: Claude Fable 5.1 --- scripts/check-manifest.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 scripts/check-manifest.ts (limited to 'scripts') diff --git a/scripts/check-manifest.ts b/scripts/check-manifest.ts new file mode 100644 index 0000000..437cd90 --- /dev/null +++ b/scripts/check-manifest.ts @@ -0,0 +1,40 @@ +// Mirrors HOST_PROVIDED_EXTENSION_PACKAGES in pi-coding-agent's +// resource-loader.js and the list in its docs/packages.md. Pi provides these +// packages to extensions at runtime; declaring them in dependencies makes pi +// emit an extension warning and risks duplicate runtime modules. +export const HOST_PROVIDED_EXTENSION_PACKAGES: ReadonlySet = new Set([ + "@earendil-works/pi-agent-core", + "@earendil-works/pi-ai", + "@earendil-works/pi-coding-agent", + "@earendil-works/pi-tui", + "@mariozechner/pi-agent-core", + "@mariozechner/pi-ai", + "@mariozechner/pi-coding-agent", + "@mariozechner/pi-tui", + "@sinclair/typebox", + "typebox", +]); + +export type Manifest = { + readonly dependencies?: unknown; + readonly peerDependencies?: unknown; + readonly devDependencies?: unknown; +}; + +// A host-provided package belongs in peerDependencies with a "*" range only. +export function findHostProvidedDependencies( + manifest: Manifest +): ReadonlyArray { + const dependencies = manifest.dependencies; + if ( + typeof dependencies !== "object" || + dependencies === null || + Array.isArray(dependencies) + ) { + return []; + } + const names = Object.keys(dependencies).filter((name) => + HOST_PROVIDED_EXTENSION_PACKAGES.has(name) + ); + return names.sort(); +} -- cgit v1.2.3