@@ -1,4 +1,4 @@
|
||||
// Opt-in real-host check: OPENCODE_204=/absolute/path/to/2.0.4/opencode bun scripts/test-multi-work-host.ts
|
||||
// Opt-in real-host check: OPENCODE_2015=/absolute/path/to/2.0.15/opencode bun scripts/test-multi-work-host.ts
|
||||
// Only fake Herdr/model servers and fresh temporary repositories/databases are used.
|
||||
import { mkdir, mkdtemp, writeFile, chmod, readFile } from "node:fs/promises";
|
||||
import { join, resolve } from "node:path";
|
||||
@@ -7,8 +7,8 @@ import { OpenCode } from "@opencode/client";
|
||||
import { command } from "../src/herdr.js";
|
||||
import { z } from "zod";
|
||||
|
||||
const binary = process.env.OPENCODE_204;
|
||||
if (!binary) throw new Error("Set OPENCODE_204 to an isolated OpenCode 2.0.4 binary");
|
||||
const binary = process.env.OPENCODE_2015;
|
||||
if (!binary) throw new Error("Set OPENCODE_2015 to an isolated OpenCode 2.0.15 binary");
|
||||
const temp = await mkdtemp("/tmp/opencode/native-multi-work-");
|
||||
console.log(`Fixture retained at ${temp}`);
|
||||
const root = join(temp, "root"),
|
||||
@@ -18,8 +18,8 @@ const root = join(temp, "root"),
|
||||
const herdrCreation = join(temp, "herdr-creation.txt");
|
||||
for (const path of [root, bin, config, join(temp, "plugin")]) await mkdir(path);
|
||||
const signal = AbortSignal.timeout(120_000);
|
||||
if ((await command([binary, "--version"], temp, signal)) !== "opencode v2.0.4")
|
||||
throw new Error("Exact 2.0.4 binary required");
|
||||
if ((await command([binary, "--version"], temp, signal)) !== "opencode v2.0.15")
|
||||
throw new Error("Exact 2.0.15 binary required");
|
||||
await command(["git", "init", "-b", "main"], root, signal);
|
||||
await command(
|
||||
[
|
||||
@@ -145,7 +145,7 @@ async function ready() {
|
||||
)?.[1];
|
||||
if (password)
|
||||
headers.authorization = `Basic ${Buffer.from(`opencode:${password}`).toString("base64")}`;
|
||||
await client.server.status();
|
||||
await client.server.info();
|
||||
return;
|
||||
} catch {
|
||||
await Bun.sleep(100);
|
||||
|
||||
Reference in New Issue
Block a user