Configure lefthook formatter checks (#231)

* Add lefthook formatter checks

* Fix SDK mode hydration

* Stabilize SDK mode integration test
This commit is contained in:
Nathan Flurry 2026-03-10 23:03:11 -07:00 committed by GitHub
parent 0471214d65
commit d2346bafb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
282 changed files with 5840 additions and 8399 deletions

View file

@ -16,21 +16,47 @@ if (process.env.DATABASE_URL) {
connectionString = process.env.DATABASE_URL;
} else {
const name = `persist-example-${randomUUID().slice(0, 8)}`;
containerId = execFileSync("docker", [
"run", "-d", "--rm", "--name", name,
"-e", "POSTGRES_USER=postgres", "-e", "POSTGRES_PASSWORD=postgres", "-e", "POSTGRES_DB=sandbox",
"-p", "127.0.0.1::5432", "postgres:16-alpine",
], { encoding: "utf8" }).trim();
containerId = execFileSync(
"docker",
[
"run",
"-d",
"--rm",
"--name",
name,
"-e",
"POSTGRES_USER=postgres",
"-e",
"POSTGRES_PASSWORD=postgres",
"-e",
"POSTGRES_DB=sandbox",
"-p",
"127.0.0.1::5432",
"postgres:16-alpine",
],
{ encoding: "utf8" },
).trim();
const port = execFileSync("docker", ["port", containerId, "5432/tcp"], { encoding: "utf8" })
.trim().split("\n")[0]?.match(/:(\d+)$/)?.[1];
.trim()
.split("\n")[0]
?.match(/:(\d+)$/)?.[1];
connectionString = `postgres://postgres:postgres@127.0.0.1:${port}/sandbox`;
console.log(`Postgres on port ${port}`);
const deadline = Date.now() + 30_000;
while (Date.now() < deadline) {
const c = new Client({ connectionString });
try { await c.connect(); await c.query("SELECT 1"); await c.end(); break; }
catch { try { await c.end(); } catch {} await delay(250); }
try {
await c.connect();
await c.query("SELECT 1");
await c.end();
break;
} catch {
try {
await c.end();
} catch {}
await delay(250);
}
}
}
@ -40,10 +66,7 @@ try {
console.log("Starting sandbox...");
const sandbox = await startDockerSandbox({
port: 3000,
setupCommands: [
"sandbox-agent install-agent claude",
"sandbox-agent install-agent codex",
],
setupCommands: ["sandbox-agent install-agent claude", "sandbox-agent install-agent codex"],
});
const sdk = await SandboxAgent.connect({ baseUrl: sandbox.baseUrl, persist });
@ -71,6 +94,8 @@ try {
await sandbox.cleanup();
} finally {
if (containerId) {
try { execFileSync("docker", ["rm", "-f", containerId], { stdio: "ignore" }); } catch {}
try {
execFileSync("docker", ["rm", "-f", containerId], { stdio: "ignore" });
} catch {}
}
}