From cac7494af7903afe4215e8c2ed2bfd9aebad765c Mon Sep 17 00:00:00 2001 From: Advait Paliwal Date: Mon, 23 Mar 2026 18:46:41 -0700 Subject: [PATCH] =?UTF-8?q?Remove=20redundant=20package=20installer=20?= =?UTF-8?q?=E2=80=94=20let=20Pi=20handle=20it=20at=20runtime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pi's own package manager already installs packages from settings.json on first REPL launch. Feynman was duplicating this in both postinstall and first-run, causing slow installs and looping. Co-Authored-By: Claude Opus 4.6 (1M context) --- package-lock.json | 4 +-- package.json | 2 +- scripts/patch-embedded-pi.mjs | 48 +---------------------------------- 3 files changed, 4 insertions(+), 50 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8c616d5..d6430da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@companion-ai/feynman", - "version": "0.2.1", + "version": "0.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@companion-ai/feynman", - "version": "0.2.1", + "version": "0.2.2", "hasInstallScript": true, "dependencies": { "@companion-ai/alpha-hub": "^0.1.2", diff --git a/package.json b/package.json index e85ca92..aacecb5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@companion-ai/feynman", - "version": "0.2.1", + "version": "0.2.2", "description": "Research-first CLI agent built on Pi and alphaXiv", "type": "module", "bin": { diff --git a/scripts/patch-embedded-pi.mjs b/scripts/patch-embedded-pi.mjs index 4bb1d1d..5dc2009 100644 --- a/scripts/patch-embedded-pi.mjs +++ b/scripts/patch-embedded-pi.mjs @@ -27,53 +27,7 @@ const settingsPath = resolve(appRoot, ".feynman", "settings.json"); const workspaceDir = resolve(appRoot, ".feynman", "npm"); const workspacePackageJsonPath = resolve(workspaceDir, "package.json"); -function ensurePackageWorkspace() { - if (!existsSync(settingsPath)) { - return; - } - - const settings = JSON.parse(readFileSync(settingsPath, "utf8")); - const packageSpecs = Array.isArray(settings.packages) - ? settings.packages - .filter((value) => typeof value === "string" && value.startsWith("npm:")) - .map((value) => value.slice(4)) - : []; - - if (packageSpecs.length === 0) { - return; - } - - mkdirSync(workspaceDir, { recursive: true }); - - writeFileSync( - workspacePackageJsonPath, - JSON.stringify( - { - name: "pi-extensions", - private: true, - dependencies: Object.fromEntries(packageSpecs.map((spec) => [spec, "latest"])), - }, - null, - 2, - ) + "\n", - "utf8", - ); - - const npmExec = process.env.npm_execpath; - const install = npmExec - ? spawnSync(process.execPath, [npmExec, "install", "--prefix", workspaceDir, ...packageSpecs], { - stdio: "inherit", - }) - : spawnSync("npm", ["install", "--prefix", workspaceDir, ...packageSpecs], { - stdio: "inherit", - }); - - if (install.status !== 0) { - console.warn("[feynman] warning: failed to preinstall default Pi packages into .feynman/npm"); - } -} - -ensurePackageWorkspace(); +// Pi handles package installation from .feynman/settings.json at runtime — no manual install needed if (existsSync(packageJsonPath)) { const pkg = JSON.parse(readFileSync(packageJsonPath, "utf8"));