Skip to content

8.7.0: install with one Python program instead of three shell scripts - #22

Merged
foursecondfivefour merged 7 commits into
mainfrom
arena/36a4d756-nerveforge
Dec 2, 2026
Merged

foursecondfivefour merged 7 commits into
mainfrom
arena/36a4d756-nerveforge

Conversation

@foursecondfivefour

@foursecondfivefour foursecondfivefour commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

What changed

./nerveforge install — one installer, ten steps, the same on Linux, macOS, Windows and Termux. The three shell scripts become hand-overs that find a Python 3.10+ and pass the arguments through.

 [ok]  1. Python version           Python 3.11.2 at /usr/bin/python3
 [ok]  2. Administrator rights     running as a normal user
 [ok]  3. Tunnel                   local mode: the panel is reachable on this machine only
 [--]  4. Tunnel download          no download needed
 [ok]  5. Config and data folders  /home/u/.config/nerveforge, /home/u/.local/share/nerveforge
 [ok]  6. Working folder           /home/u/NerveForgeProjects
 [--]  7. Desktop shortcut         no desktop session detected; start it with ./nerveforge
 [--]  8. `nerveforge` command     not requested (pass --command to add it)
 [ok]  9. Program check            NerveForge 8.7.0, 72 routes, 3.11.2 at /usr/bin/python3

4 done, 5 skipped, 0 failed

A step that cannot go on stops the run with a reason and a remedy; a step that fails but blocks nothing (a blocked cloudflared download) says so and lets the rest continue.

The three promises the flags keep

  • --plan walks the same step table and prints only the steps that would change the machine, so the plan cannot drift from the run.
  • --yes answers the defaults, and the defaults are quiet: shortcut yes on a desktop, skipped on a server or Termux; the nerveforge command on PATH is offered, never assumed.
  • --uninstall removes the shortcut, the launcher and the downloaded cloudflared, and says out loud that it kept the token, settings, skills and audit log.

The scripts you have keep working

setup.sh, setup_termux.sh and setup_windows.ps1 now only find an interpreter and hand over. run.py is an alias for the new ./nerveforge. The Windows script lost its own winget logic and its four switches: flags belong in nerveforge install, where every platform gets them.

Bugs the tests found

Writing real tests instead of asserting on a script's text turned up four:

  1. A .cmd launcher reported success on failure. It never passed on %ERRORLEVEL%, so a launcher whose Python had gone missing flashed a console and vanished cleanly. It now holds the window open and exits with the code.
  2. uninstall deleted the wrong file on Windows. It removed cloudflared while the downloader writes cloudflared.exe. Both go through actions.cloudflared_path() now.
  3. command_targets could pick a project's build folder. Any bin under home counted; ~/repo/src/bin was a candidate. Only ~/.local/bin, ~/bin and (on Windows) the WindowsApps shim count, and only when already on PATH.
  4. The desktop entry wrote platform separators into a Linux file. It now uses forward slashes by construction.

Tests

InstallerTests read setup_windows.ps1 and asserted on its BOM, chr(46) and brace balance — tests of a script, not an installer. Replaced by 71 tests in tests/test_installer.py that run the real steps against a temporary HOME, and a portability test that refuses an unguarded os.geteuid anywhere in the installer.

  • python -m unittest discover -s tests → 1908 tests, OK (skipped=1)
  • ruff check src tests scripts → clean
  • bump_version.py --check, check_docs.py, gen_api_doc.py --check → clean
  • CI: linux 3.10, linux 3.12, windows — all pass

Docs updated in both languages: README quick start, the repo tree, DEVELOPMENT.md, CHANGELOG 8.7.0. CI now syntax-checks both shell scripts and runs the installer's plan.

foursecondfivefour added a commit that referenced this pull request Dec 2, 2026
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@foursecondfivefour
foursecondfivefour force-pushed the arena/36a4d756-nerveforge branch 2 times, most recently from b053035 to 9b689ba Compare December 2, 2026 14:54
The installer was three scripts with three sets of answers: setup.sh knew
APT, setup_termux.sh knew pkg, setup_windows.ps1 knew winget, and each had
its own sentence for a missing Python or a missing tunnel. Fixing a step
meant fixing it three times, and the Windows script had grown four of its
own switches that the other platforms never got.

Now `./nerveforge install` runs the same ten steps everywhere — Python,
rights, tunnel, download, folders, workspace, shortcut, command, check,
start — and each step prints one line saying what it found or why it
stopped, with a remedy under it. The steps live in installer/actions.py,
the questions in menu.py, the output in render.py.

The flags keep three promises: --plan goes through the same step table and
changes nothing, so it cannot drift from the run; --yes answers the
defaults, which are quiet (the PATH launcher is offered, never assumed);
--uninstall removes the shortcut, launcher and downloaded cloudflared and
says out loud that the token, settings, skills and audit log were kept.

The old entry points still work: setup.sh, setup_termux.sh and
setup_windows.ps1 now find a Python 3.10+ and hand over, and run.py starts
the bridge as before, so an older README or shortcut does not break.

InstallerTests read setup_windows.ps1 and asserted on its BOM, its chr(46)
trick and its brace balance — tests of a script, not an installer. They are
replaced by 64 tests that run the real steps against a temporary HOME.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@foursecondfivefour
foursecondfivefour force-pushed the arena/36a4d756-nerveforge branch from 9b689ba to e4f85f4 Compare December 2, 2026 14:56
foursecondfivefour and others added 6 commits December 2, 2026 15:02
The .cmd wrapper did not pass on %ERRORLEVEL%, so a launcher whose Python
had gone missing flashed a console and reported success. It now holds the
window open on a failure and exits with the code.

The read-only-directory tests assumed os.geteuid, which Windows does not
have. They skip on a platform without POSIX permission bits now, and a new
test refuses an unguarded os.geteuid anywhere in the installer.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Five Windows failures came from tests that assumed POSIX: a colon-separated
PATH, an executable bit, a shell-script fake interpreter, a chmod that makes
a folder read-only, and the local bin name. They now use os.pathsep, skip
where the premise cannot exist, and assert on what Windows actually gets.

One real bug fell out of it: uninstall deleted 'cloudflared' while the
downloader writes 'cloudflared.exe' on Windows. Both now go through
actions.cloudflared_path(), and a test checks the name matches the platform.

command_targets also stopped treating any 'bin' under home as a user bin —
~/repo/src/bin was a candidate, which would drop a launcher into a build
directory. Only ~/.local/bin, ~/bin and (on Windows) the WindowsApps shim
count, and only when already on PATH.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Three failures left: the launcher and desktop-entry tests built expected
paths with str(), which is backslashes on Windows and slashes everywhere
else, and the PATH test expected a bare launcher name on a platform that
names it .exe. Written with as_posix() and os.name now.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The .desktop file is Linux-only, but two tests compared its paths with
str() and as_posix(), which differ on Windows. The entry now writes
forward slashes by construction, and the tests compare the same repr the
launcher contains.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
On Windows command_targets returns nerveforge.exe and the Python half sits
beside it as nerveforge.py; the test read the bare 'nerveforge' path,
which is the POSIX layout only. Both launcher tests now resolve the file
the way install_command does.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The launcher writes forward slashes on every platform, so a Windows runner
reads back D:/a/... while str(Path) there is D:\\a\\.... The tests now parse
the ROOT line and compare it with the tree as paths, which is what the
launcher itself relies on.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@foursecondfivefour
foursecondfivefour merged commit 374e796 into main Dec 2, 2026
3 checks passed
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