fix: remove postinstall script to support pnpm strictDepBuilds - #576
Conversation
The postinstall hook in @code-inspector/core ran verify-terminal-runtime.js to fix node-pty spawn-helper permissions and probe PTY spawning. This same work is already performed at runtime in ai-terminal.ts (ensureNodePtySpawnHelperExecutable + verifyPtySpawn), making the postinstall redundant. Removing the postinstall unblocks users running pnpm with strictDepBuilds:true, which rejects lifecycle scripts by default for security reasons. Closes #575 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PR Summary by QodoRemove @code-inspector/core postinstall to support pnpm strictDepBuilds
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
Context used✅ Tickets:
🎫 Support for pnpm strictDepBuilds 1. Spawn-helper chmod too narrow
|
| "build:client:watch": " vite build --config ./vite.client.config.ts --watch", | ||
| "clear": "rimraf ./dist && rimraf ./types", | ||
| "build": "pnpm clear && tsc && pnpm build:server && pnpm build:client", | ||
| "postinstall": "node ./scripts/verify-terminal-runtime.js", |
There was a problem hiding this comment.
1. Spawn-helper chmod too narrow 🐞 Bug ☼ Reliability
Removing the @code-inspector/core postinstall hook leaves ensureNodePtySpawnHelperExecutable() as the only permission repair, and it only chmods the prebuilds/<platform>-<arch>/spawn-helper path. If node-pty’s helper binary is present in a different on-disk location in a given installation, execute permissions will no longer be repaired and PTY startup can fail at runtime.
Agent Prompt
## Issue description
The PR removes the installation-time `postinstall` verification/repair hook. The runtime repair helper (`ensureNodePtySpawnHelperExecutable`) currently only attempts to fix execute permissions for a single `prebuilds/<platform>-<arch>/spawn-helper` location, which is not necessarily the only possible location of node-pty’s helper binary.
## Issue Context
`attachTerminalWebSocket()` calls `ensureNodePtySpawnHelperExecutable()` before running the PTY self-test. With `postinstall` removed, any helper locations not covered by the runtime chmod attempt will never be repaired.
## Fix Focus Areas
- packages/core/src/ai/server/ai-terminal.ts[104-118]
- packages/core/src/ai/server/ai-terminal.ts[653-688]
- packages/core/package.json[40-48]
## Suggested change
Expand `ensureNodePtySpawnHelperExecutable()` to try chmod on a small set of candidate helper paths derived from the resolved `node-pty/package.json` directory (not just `prebuilds/.../spawn-helper`). Only add execute bits (e.g., OR with `0o111`) rather than broadening permissions.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #576 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 37 37
Lines 7032 7032
Branches 1986 1986
=========================================
Hits 7032 7032 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Removes the
postinstalllifecycle script from@code-inspector/coreand its associatedverify-terminal-runtime.jshelper.The postinstall script did two things:
node-pty'sspawn-helperbinaryBoth are already performed at runtime in
ai-terminal.ts(ensureNodePtySpawnHelperExecutable+verifyPtySpawn), so the postinstall was purely redundant.Removing it unblocks users running pnpm with
strictDepBuilds: true, which rejects all lifecycle scripts by default for security reasons.Closes #575
Changes
packages/core/package.json— removedpostinstallscript and"scripts"fromfilespackages/core/scripts/verify-terminal-runtime.js— deleted (logic lives inai-terminal.ts)test/core/scripts/verify-terminal-runtime.test.ts— deleted (no longer needed)Test Plan
@code-inspector/corein a project withpnpm strictDepBuilds: true— should succeed without whitelistingattachTerminalWebSocket)