Files
plan2code/.plan2code/lessons/installer.md
T

2.7 KiB

Installer

Paths: install.js, src/installer/**, scripts/bench-install-update.mjs, scripts/publish-install-refs.mjs, scripts/test-install-.mjs, scripts/install-.mjs

A new src/installer/ module that install.js requires must join the file list npxCopy() copies in scripts/test-install-update.mjs, or every release redirect test fails.

  • Kind: convention
  • About: scripts/test-install-update.mjs, install.js
  • Why: Adding skills-cli.js and canonical-skills.js failed five release redirect tests until npxCopy() copied them too.
  • Noted: 2026-12-03, implement-review

A test run of node install.js with a temp HOME still writes the plan2code shims into the real npm global bin, because npm's prefix does not follow HOME; also set npm_config_prefix to a temp folder.

  • Kind: correction
  • About: install.js
  • Why: A piped --update test run repointed the real plan2code shims at a temp folder until they were fixed by hand.
  • Noted: 2026-11-17, implement-review

A test that calls install() must point APPDATA and LOCALAPPDATA at the temp HOME first: its cleanLegacyPaths() sweep reads the VS Code prompts and Crush skills folders from them, outside HOME.

  • Kind: how-it-works
  • About: install.js, scripts/test-install-update.mjs
  • Noted: 2026-12-03, implement-review

An install-ref fixture test checks each fixture's own root for cleanup, never a count of p2c-install-refs-* in the temp dir: other test files build fixtures in parallel.

  • Kind: correction
  • About: scripts/test-install-refs.mjs, scripts/install-ref-fixtures.mjs
  • Why: The cleanup test counted the temp dir and failed once other test files built fixtures alongside it.
  • Noted: 2026-12-03, implement-review

Each recordInstalled() in install.js stamps the version being installed into install.json, so a failed update must restore the old one with setRecordVersion(), or a retry says Already on.

  • Kind: how-it-works
  • About: install.js
  • Noted: 2026-11-17, implement-review

Give bench-install-update.mjs no --workdir whose path holds a UUID, since npm 12 redacts UUIDs in paths to *** and every isolated path breaks; the default temp workdir is safe.

  • Kind: how-it-works
  • About: scripts/bench-install-update.mjs
  • Noted: 2026-12-03, implement-review
  • Kind: how-it-works
  • About: src/installer/skills-cli.js, install.js
  • Noted: 2026-12-03, implement-review

The app's webview data sits outside ~/.plan2code, in Tauri's app_local_data_dir() on Windows and Linux (%LOCALAPPDATA%/com.plan2code.desktop); appWebviewDirs() in install.js lists it per OS.

  • Kind: how-it-works
  • About: install.js
  • Noted: 2026-11-17, implement-review