Skip to content

build: one double-click brings this PC's tools up to date (update-local.cmd) - #121

Merged
Nawid3333 merged 4 commits into
mainfrom
claude/update-local
Oct 1, 2026
Merged

Nawid3333 merged 4 commits into
mainfrom
claude/update-local

Conversation

@Nawid3333

Copy link
Copy Markdown
Owner

Third part of making issue #10 closable. GitHub can't update your PC, so update-local.cmd, a double-click in the repository's root, does. It runs tools/update-local.ps1, which brings your PC to what CI uses. It follows CI's rule: a release counts once it is 5 days old.

What How
Node.js The newest release of the major .nvmrc names, from nodejs.org's installer, checked against its SHASUMS256.txt. Windows asks for admin rights. A newer major you already have is kept
npm Its newest release, installed globally in %APPDATA%\npm
pnpm At least the version package.json pins. Inside the repository, pnpm switches to that version by itself
The repository Only on main with nothing uncommitted: git pull --ff-only, then pnpm install --frozen-lockfile into the store node_modules already uses (V:\.pnpm-store), and fsaunpack's npm ci with scripts off
The mpv helper native-host/install.ps1 again when the repository's host file differs from the installed one, keeping your mpv and Node paths

It never touches:

  • Firefox: it updates itself, and FastStream comes from the releases.
  • mpv: C:\Program Files\mpv is your own repository, Nawid3333/mpv, with its own updater. It's already on the build CI pins.
  • WSL: pnpm run verify:linux updates its distros.

Options and failures:

  • -DryRun only says what it would do.
  • -Repo <path> points it at another checkout.
  • A failed step is reported and the rest still run.

Tested on this PC for real, against the main checkout:

Node, npm and pnpm were already current, so no admin prompt came up. After #119 merges, .nvmrc says 26 and the script would install 26.10.0 once it's 5 days old.

Tests: tests/unit/updateLocal.test.mjs covers the version picks (age rule, fallback to the previous major, prereleases and deprecated releases skipped). It also checks that the script is ASCII, which Windows PowerShell 5.1 needs for a file without a BOM, and that it parses in Windows PowerShell. .gitattributes gives .cmd files CRLF line endings. Lint, typecheck and the unit tests (942) pass.

Docs: a "Your PC" section in docs/maintenance.md, and CLAUDE.md's Commands section.

Ships nothing.

🤖 Generated with Claude Code

…al.cmd)

GitHub can't update the owner's PC, so update-local.cmd runs
tools/update-local.ps1, which brings it to what CI uses, by CI's rule (a release
counts once it is 5 days old; tools/newest-release.mjs, on
tools/check-toolchain.mjs's helpers):

- Node.js of the major .nvmrc names: nodejs.org's MSI, checked against its
  SHASUMS256.txt, installed with an admin prompt; a newer major is kept;
- npm's newest release, and at least the pnpm version package.json pins
  (both global, %APPDATA%\npm);
- on main with nothing uncommitted: git pull --ff-only, pnpm install
  --frozen-lockfile into the store node_modules was installed from, and
  fsaunpack's npm ci (scripts off);
- the mpv helper again (native-host/install.ps1, with the installed mpv and
  Node paths) when the repository's host differs from the installed one.

Never Firefox, mpv (C:\Program Files\mpv is the owner's own repository with its
own updater) or WSL. -DryRun only says what it would do; -Repo points it at
another checkout. A failed step is reported and the rest still run.

Run for real on this PC against the main checkout: pulled to 6018d62,
installed into V:\.pnpm-store, fsaunpack installed, and the mpv helper
reinstalled (#109 had changed the host): it answers a ping through its .bat
with its mpv path. tests/unit/updateLocal.test.mjs: the version picks, and the
script is ASCII and parses in Windows PowerShell. .cmd files check out with
CRLF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread tools/newest-release.mjs Fixed
)

name.replace('/', '%2F') encoded only the first slash. An npm name has at most
one (@scope/name), so the lookup worked, but every one is encoded now, as
CodeQL's js/incomplete-sanitization asks. Checked: @types/node and npm resolve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread tools/update-local.ps1 Outdated
limex and others added 2 commits October 1, 2026 19:21
…ature

Windows PowerShell 5.1 turns a native command stderr line into a terminating error when output is redirected (the git pull report, npm warnings): its steps reported failed on success. Judge by the exit code, not by errors. [version] does not read prerelease or build suffixes (a pnpm pin carries sha512) and wants two numbers at least; strip and pad first. The MSI goes into a per-run directory under %TEMP% instead of its predictable name next to everything else, is required to carry the OpenJS Foundation signature (the SHASUMS hash comes from the same host), and msiexec.exe is resolved from System32, not PATH.
…C up to date

Double-clicking now changes nothing: it reports what is out of date (Node of
the .nvmrc major, npm, pinned pnpm, a clean main's distance behind origin, the
installed mpv helper) with the exact command for each. Only -Apply installs,
pulls or reinstalls, and -DryRun stays as an old name for the check. The Node
installer is staged under a per-run %ProgramData%\FastStream directory locked
by ACL to this user, Administrators and SYSTEM, so the same-user race between
the hash check and the elevated msiexec the review flagged is closed.
@Nawid3333

Copy link
Copy Markdown
Owner Author

Both threads addressed in 82266ef:

  • MSI staging (%TEMP% race): the installer now stages in a per-run %ProgramData%\FastStream\node-<guid> directory whose ACL is rebuilt (inheritance off, everyone else removed) to this user + Administrators + SYSTEM only. Download, hash, signature check and the elevated msiexec all run inside it.
  • newest-release.mjs string escaping: already fixed on this PR by 793210e (replaceAll); the code-scanning instance for 324d2d6 reports state "fixed" and the repo list shows 0 open alerts.

Behavior change worth noting: the default (double-click) run is now check-and-report only — it names what is out of date and the exact commands, and changes nothing. -Apply is what installs/pulls/reinstalls; -DryRun is kept as an old name for the check.

@Nawid3333
Nawid3333 merged commit 7a1348a into main Oct 1, 2026
9 of 10 checks passed
@Nawid3333
Nawid3333 deleted the claude/update-local branch October 1, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants