Problem
When running pi install git:github.com/Gentleman-Programming/gentle-shell@main, Pi fails to start with these errors:
Error: Failed to load extension ".../gentle-shell/extensions/gentle-agents.ts":
Failed to load extension: Cannot find module '@earendil-works/pi-tui/package.json'
Require stack:
- .../lib/vim-editor-adapter.ts
Root cause
pi install performs git fetch + git reset --hard (or git pull) which wipes node_modules/, but it does NOT run npm install.
@earendil-works/* were originally only optional peerDependencies, which npm does not install automatically. They are only transitively installed if another dependency's peer resolution happens to pull them in — but this is not guaranteed (especially in fresh clones or if the dep tree changes).
The code directly imports from these packages at runtime (e.g., vim-editor-adapter.ts line 1: `import { CURSOR_MARKER, Editor, visibleWidth } from "@earendil-works/pi-tui"``), making them hard runtime requirements, not optional peers.
Solution
Layered dependency strategy — the @earendil-works/* packages are now declared in three places:
dependencies — ensures npm install (triggered by git hooks, CI, or manual setup) correctly installs them at runtime
peerDependencies — preserves the runtime contract and existing test expectations
devDependencies — for local development and testing
"dependencies": {
"@earendil-works/pi-ai": "0.99.1",
"@earendil-works/pi-coding-agent": "0.99.1",
"@earendil-works/pi-tui": "0.99.1",
"typebox": "^1.3.34"
},
"peerDependencies": {
"@earendil-works/pi-ai": "*",
"@earendil-works/pi-coding-agent": ">=0.99.1",
"@earendil-works/pi-tui": "*"
},
"devDependencies": {
"@earendil-works/pi-ai": "0.99.1",
"@earendil-works/pi-coding-agent": "0.99.1",
"@earendil-works/pi-tui": "0.99.1"
}
Note on typebox: The original ^0.37.0 was invalid — npm only publishes 1.x versions. Updated to ^1.3.34.
PR
Fix in progress: #1588 (layered dependency strategy with 3 commits)
Problem
When running
pi install git:github.com/Gentleman-Programming/gentle-shell@main, Pi fails to start with these errors:Root cause
pi installperformsgit fetch + git reset --hard(orgit pull) which wipesnode_modules/, but it does NOT runnpm install.@earendil-works/*were originally onlyoptional peerDependencies, which npm does not install automatically. They are only transitively installed if another dependency's peer resolution happens to pull them in — but this is not guaranteed (especially in fresh clones or if the dep tree changes).The code directly imports from these packages at runtime (e.g.,
vim-editor-adapter.tsline 1: `import { CURSOR_MARKER, Editor, visibleWidth } from "@earendil-works/pi-tui"``), making them hard runtime requirements, not optional peers.Solution
Layered dependency strategy — the
@earendil-works/*packages are now declared in three places:dependencies— ensuresnpm install(triggered by git hooks, CI, or manual setup) correctly installs them at runtimepeerDependencies— preserves the runtime contract and existing test expectationsdevDependencies— for local development and testingNote on
typebox: The original^0.37.0was invalid — npm only publishes 1.x versions. Updated to^1.3.34.PR
Fix in progress: #1588 (layered dependency strategy with 3 commits)