Repository navigation
[regression of #11] Published CLI cannot start: optional peerDependencies (commander, ts-morph, chalk, @inquirer/prompts) not installed by npm/npx #42
Description
Bug
The published @manningworks/projex@1.6.0 CLI cannot start at all via the
documented invocation npx @manningworks/projex <command> (nor after a local
npm install @manningworks/projex). Every CLI command — init, add,
edit, remove, list — is non-functional for consumers of the published
package.
Steps to reproduce
Path A (npx, the skill's primary invocation):
- In a fresh/empty project, run:
npx @manningworks/projex init -y - npm installs
@manningworks/projex@1.6.0into the npx cache. - The CLI crashes:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'commander' imported from
.../node_modules/@manningworks/projex/dist/cli.js
code: 'ERR_MODULE_NOT_FOUND'
Path B (local pre-install, the skill's "deterministic" recommendation):
npm install @manningworks/projex→ succeeds, exit 0../node_modules/.bin/projex --version→ sameERR_MODULE_NOT_FOUND: commander.commander,ts-morph,chalk,@inquirer/promptsare all ABSENT from
node_modulesafter the install.
Reproduced twice (npx path) and once (local install path) — not a transient
cache glitch.
Root cause
The published @manningworks/projex manifest declares:
dependencies:fuse.js,react,react-dom,zodpeerDependencies(each"optional": trueinpeerDependenciesMeta):
@inquirer/prompts,chalk,commander,ts-morph
But dist/cli.js hard-imports commander (the crash proves it), and the CLI
also requires ts-morph (AST edits of projex.config.ts), chalk (colored
✓/⚠ output), and @inquirer/prompts (interactive prompts). npm and npx do
not auto-install optional peer dependencies, so none of the four are
present in a consumer's node_modules, and the CLI bin cannot load.
This is a regression of #11 ("CLI dependencies not relocated out of the
main bundle"), which was closed as resolved by moving exactly these four deps
from dependencies to optional peerDependencies. That change slims the
library bundle but breaks the CLI bin that ships in the same package,
because optional peers are not installed for the consumer.
Impact
- Any user (or coding agent) who installs the published package and runs the
CLI hits an unexplained crash on the very first command, with no documented
workaround. - The agent skill
skills/projex/SKILL.md(branchskill/projex-agent-skill,
PR docs: add projex agent skill (skills/projex) #40) documentsnpx @manningworks/projex <command>as the working
invocation. Its "verified against live--help/ v1.6.0" drift baseline was
established against a source build, where these deps are present — so the
published-package breakage was not caught. The skill's accuracy claim only
holds for a from-source install.
Workaround (not a fix, not documented)
Manually install the four peers, then the CLI runs:
npm install commander@^12.1.0 ts-morph@^28.0.0 chalk@^5.3.0 @inquirer/prompts@^6.0.1
Direction (fix out of scope for the verification run that found this)
The CLI bin's runtime deps must be guaranteed present for the consumer.
Options: keep them as regular dependencies (they are hard runtime
requirements of the bin), or split the CLI into a separate package so
library-only consumers aren't forced to take them. Optional peers cannot
serve a bin that lives in the same package.
Verification run
Found by literal-execution verification of the agent skill (kanban task
t_19ac1f56), 2026-10-12. Full transcript:
~/workspace/projex-skill-verify/transcript.md (steps 1a–1d).
- Version:
@manningworks/projex@1.6.0 - Node v26.7.0, npm 11.19.0
- Reproduced on both the npx path and the local
npm installpath.
Activity