Skip to content

feat(install): port install to Node — drops Perl requirement, succeeds on pure Windows#4

Open
97wow wants to merge 1 commit into
mainfrom
feat/native-install-windows-support
Open

feat(install): port install to Node — drops Perl requirement, succeeds on pure Windows#4
97wow wants to merge 1 commit into
mainfrom
feat/native-install-windows-support

Conversation

@97wow
Copy link
Copy Markdown
Contributor

@97wow 97wow commented May 13, 2026

Summary

npx claude-next install no longer needs Perl. The five install phases (copy / backup / merge / verify / dry-run) are now native Node code in bin/cli.js; install.sh is kept as a documented legacy POSIX-with-perl path. Closes the install-time half of the README roadmap item PowerShell fallback for pure-Windows environments.

Behavior preserved 1:1

  • Substring match on next/scripts/ingest.sh for idempotent re-install (no duplicate hook on repeat npx claude-next install)
  • Backup ~/.claude/settings.json to .bak-YYYYMMDD-HHMMSS (matches install.sh's timestamp format)
  • Canonical sorted-key JSON output (matches Perl JSON::PP ->canonical)
  • UTF-8 round-trip via Node native read/write — Chinese hook labels + emoji preserved exactly the way the 0.2.6 Perl fix preserved them
  • Same 8 dry-run assertions including the 0.2.9 false-positive guards

What changes for the user

  • POSIX-with-perl users: zero visible change. npx claude-next install still works. Direct bash install.sh still works.
  • Pure-Windows users (no Perl, no Git Bash): install now succeeds instead of failing at the Perl preflight. The dry-run auto-skips with a clear message: install Git for Windows so the runtime hook can fire. Removing the bash runtime requirement is the next milestone (v0.3.x track, README updated).

Reverse-prove (4/4 PASS)

Per claude-next dogfooding rule: every claim reverse-proved against current src before code change.

Case Method Result
POSIX happy path sandbox HOME, full install, 8 hook scenarios 8/8 ✓
Re-install idempotent run twice into same HOME hook count stays 1 ✓
Pre-existing hooks merged seed settings.json with OtherEvent + a Chinese-echo UserPromptSubmit entry both preserved, ours appended as 2nd ✓
UTF-8 round-trip seed settings.json with 中文 + 🎉 emoji exact bytes preserved ✓
No-bash environment PATH=/tmp/empty-bin /usr/bin/node bin/cli.js install install completes, hook in place, runtime warning shown ✓

Test plan

  • On a real pure-Windows machine (no WSL, no Git Bash), npx claude-next@<this-branch> install completes with the warning and produces a valid ~/.claude/settings.json
  • After installing Git for Windows, the hook fires correctly when Claude Code triggers UserPromptSubmit
  • On POSIX (macOS/Linux), npx claude-next install is bit-identical in behavior to v0.2.10

🤖 Generated with Claude Code

…s on pure Windows

bin/cli.js now does the five install phases (copy / backup / merge /
verify / dry-run) directly in Node, replacing the spawnSync to
bash install.sh that required Perl + JSON::PP. install.sh is kept as
a documented legacy POSIX-with-perl path.

Behavior preserved 1:1:
- Substring match on next/scripts/ingest.sh for idempotent re-install
- Backup settings.json with .bak-YYYYMMDD-HHMMSS stamp
- Canonical sorted-key JSON output
- UTF-8 round-trip (Chinese / emoji hook labels preserved)
- Same 8 dry-run assertions (including 0.2.9 false-positive guards)

Pure-Win behavior: install completes, hook merged, dry-run auto-skipped
with explicit guidance to install Git for Windows for the bash runtime.

Reverse-proved 4/4:
- WSL POSIX e2e: 8/8 dry-run cases pass
- Re-install idempotent (hook count stays 1)
- Existing hooks merged (OtherEvent preserved, ours appended)
- UTF-8 (Chinese + emoji round-trip)
- No-bash environment (install succeeds, runtime warning shown)
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.

1 participant