Repository navigation
feat(install): add Serverless install scripts that run init - #158
Conversation
This commit adds public/serverless/install.sh and install.ps1. Each script finds a CLI that has serverless init, or installs the latest CLI. Then it runs runware serverless init on the App directory. The scripts use Homebrew or Scoop when present, else a checksum-verified download. A CLI in a directory that is not on PATH runs by its absolute path, and the script then prints the PATH fix. install.ps1 writes the user PATH through the registry, so that entries such as %USERPROFILE% stay unexpanded. The installtest harness gets named stubs that can lack init or fail init, tripwires for pip, uv and python, and RunPwsh, which runs a script as irm | iex does. A customer must get from nothing to a ready App directory with one command (RUNSERV-1266). ADR 0001 keeps pip, uv and python out of the scripts, and the tripwires make sure of this in every test. A CLI from before init exits 0 for serverless init --help, so a probe on the exit status reuses a CLI that is too old. Thus the scripts look for init in the help text. They do this again after an install, because the latest release can lack init. Without the second probe, the script runs the old CLI and reports success. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. To trigger a review, include ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟡 Changes recommended
Clean-machine prerequisites, directory argument handling, and Windows PATH behavior need correction and coverage.
4 open findings
What changed in this PR
Adds Serverless bootstrap scripts that install or reuse the Runware CLI, then delegate App creation to serverless init.
Changes:
- Adds shell and PowerShell installers with capability checks and verified downloads.
- Adds PATH handling and initialization failure reporting.
- Extends installer tests with configurable stubs, PowerShell execution, and forbidden-tool tripwires.
| File | Description |
|---|---|
| public/serverless/install.sh | Adds POSIX installation and App initialization. |
| public/serverless/install.ps1 | Adds PowerShell installation and Windows PATH handling. |
| public/serverless/install_test.go | Covers installation, reuse, verification, and failures. |
| internal/installtest/installtest.go | Adds configurable stubs, tripwires, and PowerShell support. |
| internal/installtest/installtest_test.go | Tests named stubs and tripwire recording. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The Serverless install scripts now run runware serverless init with "--" before the App directory. The stub CLI skips the "--", and a new test gives --force as the App directory to both scripts. install.ps1 also warns when another CLI exists after it adds the install directory to the user PATH. Without the "--", Cobra reads a directory such as --force as a flag. Then init uses the current directory and skips its check for a non-empty directory. On Windows the machine PATH comes before the user PATH. Thus an older CLI on the machine PATH still runs first in a new terminal, and the user must know that. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
wilsonsilva
left a comment
There was a problem hiding this comment.
internal/installtest/installtest.go (releaseTargets)
thought (non-blocking): Follow-up ticket: make a test check that the fake release matches the archive names and checksum name in .goreleaser.yaml, including the Windows zip. Today nothing tests the Windows download path of install.ps1.
install.ps1 now sets $PSNativeCommandUseErrorActionPreference to false in its script block. A new test in internal/cmd runs the real 'runware serverless init --help' and makes sure that the output holds "runware serverless init". The scripts and tests no longer name ADR 0001, and each script keeps one short comment on the init probe. The tests use a new assertSuccess helper for the exit status. If a user turns on $PSNativeCommandUseErrorActionPreference, a failed init throws at once, and the script skips the PATH fix. Both scripts find init by that help text, but before this change only the stub CLI produced it. A change to the Use of init then breaks every install while CI passes. The ADR is not in this repository, so its name tells a reader nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This commit adds public/serverless/install.sh and install.ps1. Each script
finds a CLI that has serverless init, or installs the latest CLI. Then it
runs runware serverless init on the App directory. The scripts use Homebrew
or Scoop when present, else a checksum-verified download. A CLI in a
directory that is not on PATH runs by its absolute path, and the script then
prints the PATH fix. install.ps1 writes the user PATH through the registry,
so that entries such as %USERPROFILE% stay unexpanded. The installtest
harness gets named stubs that can lack init or fail init, tripwires for pip,
uv and python, and RunPwsh, which runs a script as irm | iex does.
A customer must get from nothing to a ready App directory with one command
(RUNSERV-1266). ADR 0001 keeps pip, uv and python out of the scripts, and
the tripwires make sure of this in every test. A CLI from before init exits
0 for serverless init --help, so a probe on the exit status reuses a CLI
that is too old. Thus the scripts look for init in the help text. They do
this again after an install, because the latest release can lack init.
Without the second probe, the script runs the old CLI and reports success.
Co-Authored-By: Claude Opus 5.5 (1M context) noreply@anthropic.com