ktg-plugin-marketplace/plugins
Kjell Tore Guttormsen 798484bf0c fix(linkedin-studio): anchor analytics root on plugin marker + surface npm install
Wave 2 / Step 4 of the remediation plan (docs/remediation/plan.md).

PRIMARY (the real fresh-clone failure):
- scripts/analytics/node_modules is gitignored, so a fresh clone has neither
  tsx nor csv-parse. Surface an idempotent `npm install --silent` prerequisite
  at point-of-use in report.md (Step 1b) and import.md (Step 4).

DEVIATION FROM PLAN (correction-in-scope, to satisfy the plan's own Verify gate):
- The plan assumed prepending `npm install` was sufficient. Verified it is NOT:
  the commands invoke the CLI with an absolute src/cli.ts path but from the
  user's arbitrary CWD, and `node --import tsx` resolves the `tsx` specifier
  relative to CWD, not the script. There is no global tsx, so the call still
  fails with ERR_MODULE_NOT_FOUND from any CWD other than scripts/analytics.
- Complete fix: invoke the locally-installed tsx by its absolute
  node_modules/.bin/tsx path in all CLI calls (report.md x10, import.md x3), so
  they resolve from any working directory once the install above has run.
  Verified: 0 ERR_MODULE_NOT_FOUND running `report` from /tmp.

SECONDARY (latent correctness / hardening):
- Add findPluginRoot(): walks up to the dir holding .claude-plugin/plugin.json
  and anchors getAnalyticsRoot() on it, falling back to the legacy 4-up count.
  MEASURED that ../../../../ already resolved to the plugin root from BOTH
  src/utils and build/utils (both 4 levels deep), so the plan's "src-vs-build
  depth miscalibration" premise was false — this is correct-by-construction
  hardening (survives a future source move), not a live-bug fix.
- Reconcile cli.ts usage/help text: `node build/cli.js` -> `node --import tsx
  src/cli.ts` (the real runtime).
- Fix report.md troubleshooting: "Verify tsx is available" -> the actual
  install command on ERR_MODULE_NOT_FOUND.

Test-first: scripts/analytics/tests/storage-root.test.ts (red on missing
findPluginRoot export, green after). Full suite 106/106, tsc --noEmit clean,
structural lint 0 failed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-29 21:18:33 +02:00
..
ai-psychosis chore: WIP marketplace doc adjustments across plugins 2026-05-18 12:04:02 +02:00
claude-design docs(claude-design): polish README — Why this exists + workflow example + recent versions 2026-05-18 21:28:31 +02:00
config-audit chore: WIP marketplace doc adjustments across plugins 2026-05-18 12:04:02 +02:00
graceful-handoff chore: WIP marketplace doc adjustments across plugins 2026-05-18 12:04:02 +02:00
human-friendly-style feat(human-friendly-style): v1.1.0 — always show irreversible actions verbatim + discoverability docs 2026-05-29 11:53:00 +02:00
linkedin-studio fix(linkedin-studio): anchor analytics root on plugin marker + surface npm install 2026-05-29 21:18:33 +02:00
llm-security chore(llm-security): v7.7.2 — language consistency pass 2026-05-19 06:47:44 +02:00
ms-ai-architect chore: WIP marketplace doc adjustments across plugins 2026-05-18 12:04:02 +02:00
okr chore: WIP marketplace doc adjustments across plugins 2026-05-18 12:04:02 +02:00
voyage chore(voyage): consolidate continuity into STATE.md 2026-05-29 20:29:51 +02:00