Hand out the right opencode command: the API's public URL, and setup uses the install script
install-newt now asks for the API's public URL first (--api-url) and records it; it names the Pangolin resource and refuses an endpoint on the same host. expose-dashboard records only that the dashboard is public. One rule (opencode.client_targets) decides which opencode-install.sh commands are shown -- local only without a tunnel; internet and local with one; internet only once the dashboard is public -- and setup's closing message, `llmhost opencode-config` and the dashboard's Connect dialog all use it. Setup's offer to install opencode now goes through opencode-install.sh --install-only, a new mode that only installs opencode; this machine's own provider is still configured by llm-host, which keeps it in sync on every switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c8b70afdbf
commit
3e9ebeed42
10 changed files with 266 additions and 109 deletions
|
|
@ -172,7 +172,22 @@ code, out = run(home, b, oc, "--url", URL)
|
|||
check("a .jsonc is never rewritten; the block is printed", code == 0 and "by hand" in out
|
||||
and (cd / "opencode.jsonc").read_text().startswith("{ // mine") and not (cd / "opencode.json").exists(), out)
|
||||
|
||||
print("\n5. --help works when run as `bash -c`")
|
||||
print("\n5. --install-only, which `llmhost setup` uses")
|
||||
home, b, oc = sandbox(with_opencode=False)
|
||||
code, out = run(home, b, oc, "--install-only", key=None)
|
||||
check("installs without a URL or key", code == 0 and (home / ".opencode/bin/opencode").exists(), out)
|
||||
check("touches no config", not (home / ".config/opencode").exists())
|
||||
code, out = run(home, b, oc, "--install-only", key=None)
|
||||
check("a second run finds it", code == 0 and "already installed" in out, out)
|
||||
home, b, oc = sandbox(with_opencode=False)
|
||||
env = {"HOME": str(home), "PATH": f"{b}:/usr/bin:/bin", "FAKE_OPENCODE": str(oc),
|
||||
"LLMHOST_HOME": str(home / "lh"), "LLMHOST_CONFIG": str(home / "lhc"), "PYTHONPATH": str(harness.REPO)}
|
||||
r = subprocess.run([sys.executable, "-c", "from llmhost import opencode; print('FOUND', opencode.install(lambda *_: None))"],
|
||||
env=env, capture_output=True, text=True, timeout=60, stdin=subprocess.DEVNULL, start_new_session=True)
|
||||
check("llm-host's own opencode install goes through the script",
|
||||
r.returncode == 0 and f"FOUND {home}/.opencode/bin/opencode" in r.stdout, r.stdout + r.stderr)
|
||||
|
||||
print("\n6. --help works when run as `bash -c`")
|
||||
r = subprocess.run(["bash", "-c", SCRIPT.read_text(), "--", "--help"], capture_output=True, text=True)
|
||||
check("prints usage", r.returncode == 0 and "--url" in r.stdout, r.stdout + r.stderr)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue