Commit Graph
5 Commits
Author SHA1 Message Date
azank 868ac1e894 test(hooks): build the session-start test env without mutating it
AGENTS.md asks for new objects rather than mutation. Leave NODE_PATH out
with a rest destructure, as pre-bash-tmux-reminder.test.js does, instead
of deleting it from the env after building it.
2026-10-15 19:21:38 +05:00
azank 218f4ae85f test(hooks): isolate the no-deps session-start test from NODE_PATH and the context cap
A NODE_PATH that exposes js-yaml let the regression pass the test, and an
inherited ECC_SESSION_START_MAX_CHARS=0 made it fail falsely. Drop
NODE_PATH from the child environment and pin the cap to 8000, as
session-start-alias-unavailable.test.js does.
2026-10-15 19:08:53 +05:00
azank 1d704e75e3 fix(hooks): load js-yaml lazily so session-start runs without node_modules
The merge of #3470 moved the Flutter check in scripts/lib/project-detect.js
onto js-yaml with a top-level require. session-start.js loads that module
on every SessionStart, and plugin installs have no node_modules (#2822),
so the hook now exits 1 with "Cannot find module 'js-yaml'" in every
project, not only Dart ones.

Require js-yaml inside hasFlutterSdkDependency instead. When it is
missing, the existing catch returns false: Dart is still detected from
pubspec.yaml and only the Flutter refinement is skipped. Installs that
have their dependencies behave as before.

Add a case to the no-node_modules plugin install test that runs
session-start.js against a pubspec.yaml project. It fails on main.
2026-10-15 16:38:43 +05:00
wakqasahmed fe3d82e280 fix(install): derive dependency versions from package.json, harden fixture isolation (#2822)
Addresses Greptile's review on #2994:

- missing-dependency.js no longer hardcodes a second copy of the four
  runtime dependency versions; it reads them from package.json's
  dependencies field instead, so the two can't silently drift apart.
  describeMissingDependencyError() still recognizes a tracked
  dependency even if package.json can't be read for some reason,
  just without a version-pinned install command in that case.
- The regression test now asserts no ancestor directory of its
  temp fixture has a node_modules, so a stray one wouldn't let
  Node resolve ajv/sql.js from there and mask what the test is
  actually meant to exercise. Also copies package.json into the
  fixture, matching a real plugin-marketplace git clone and what
  the version-lookup above now needs.
2026-09-07 16:26:10 -04:00
wakqasahmed ce11e8f690 fix(install): ship ajv/sql.js with the plugin install bundle (#2822)
install-plan.js and install-apply.js both require ./lib/install/config at
load time, and that module required ajv unconditionally at the top of the
file even though ajv is only actually used when validating an
ecc-install.json. When ECC is installed via the Claude Code plugin
marketplace, the marketplace directory is a bare git clone with no
node_modules, so requiring ajv crashes commands like --list-profiles that
never touch install-config validation at all.

Same root cause in scripts/lib/control-pane/state.js: sql.js and
@iarna/toml were required at module scope even though they are only used
inside openSqlDatabase() and readTomlConfig(), so control-pane.js --help
crashed too.

Make both requires lazy so they only load when the feature that actually
needs them runs. For the case where ajv/sql.js/js-yaml/@iarna-toml is
genuinely needed and still missing, add a small helper that turns the raw
MODULE_NOT_FOUND into an actionable message naming the package and the
install command, instead of a stack trace (install-apply.js) or, worse, an
unhandled crash with a usage banner tacked on that reads like a bad
argument (install-plan.js, control-pane.js). Applied the same helper to
memory-mcp.mjs, where ajv is genuinely load-bearing (it compiles every MCP
tool's JSON schema up front) so it can't be made lazy the same way.

Added a regression test that copies just scripts/, schemas/, and
manifests/ into a directory with no node_modules anywhere above it in the
filesystem, which reproduces the plugin-marketplace install exactly, and
asserts install-plan.js and control-pane.js still work.
2026-09-07 16:26:10 -04:00