refactor(install): clone HarborForge.Cli to /tmp instead of fixed path #12

Merged
hzhang merged 1 commits from refactor/install-cli-clone-from-repo into main 2026-05-29 07:52:40 +00:00
Contributor

Summary

  • installCli() previously read the CLI source from a fixed sibling path (./HarborForge.Cli or ../HarborForge.Cli) and silently skipped if it wasn't there.
  • Refactor to mirror installManagedMonitor: git clone --depth 1 --branch <cliBranch> to /tmp/harborforge-cli-<ts>, go build there, copy the binary out, rm -rf the tmp dir.
  • Adds --cli-branch <name> flag (default main) for parity with --monitor-branch.
  • Stamps the binary with Version=<date>+<branch>-<sha> so hf version is informative instead of saying "dev".

Test plan

  • node --check syntax passes
  • node scripts/install.mjs --install --install-cli from a fresh plugin checkout (no sibling HarborForge.Cli) — should clone + build + install
  • node scripts/install.mjs --install --install-cli --cli-branch <feature-branch> — should use the named branch
## Summary - `installCli()` previously read the CLI source from a fixed sibling path (`./HarborForge.Cli` or `../HarborForge.Cli`) and silently skipped if it wasn't there. - Refactor to mirror `installManagedMonitor`: `git clone --depth 1 --branch <cliBranch>` to `/tmp/harborforge-cli-<ts>`, `go build` there, copy the binary out, `rm -rf` the tmp dir. - Adds `--cli-branch <name>` flag (default `main`) for parity with `--monitor-branch`. - Stamps the binary with `Version=<date>+<branch>-<sha>` so `hf version` is informative instead of saying "dev". ## Test plan - [x] `node --check` syntax passes - [ ] `node scripts/install.mjs --install --install-cli` from a fresh plugin checkout (no sibling HarborForge.Cli) — should clone + build + install - [ ] `node scripts/install.mjs --install --install-cli --cli-branch <feature-branch>` — should use the named branch
hzhang added 1 commit 2026-05-29 07:52:27 +00:00
`installCli()` used to look for the CLI source at a fixed path relative
to the plugin checkout: either `./HarborForge.Cli` or `../HarborForge.Cli`.
That breaks any install layout where the plugin lives on its own — the
script just logs "Skipping CLI installation" and returns. Same anti-
pattern installManagedMonitor had already fixed for the monitor binary.

Mirror the monitor flow:

  1. git clone --depth 1 --branch <cliBranch> CLI_REPO_URL → /tmp/<dir>
  2. go build -ldflags Version=<date>+<branch>-<sha> -o $openclaw/bin/hf
  3. chmod 755 + delete tmp dir on success or failure

Adds `--cli-branch <name>` (default: main) for parity with --monitor-branch.

Also stamps the binary with a real version string (was 'dev' before this
patch) so `hf version` is informative for debugging.
hzhang merged commit 06ccd3564e into main 2026-05-29 07:52:40 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: zhi/HarborForge.OpenclawPlugin#12