Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codebase-cli",
"version": "2.0.0-pre.79",
"version": "2.0.0-pre.80",
"description": "Codebase CLI — a TypeScript coding agent on the pi-mono runtime. OAuth-aware, any LLM provider, single install.",
"keywords": [
"ai",
Expand Down
34 changes: 34 additions & 0 deletions src/projects/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ describe("runProjectSubcommand", () => {

expect(result.code).toBe(0);
expect(result.stdout.join("\n")).toContain("alias: codebase web-build");
expect(result.stdout.join("\n")).toContain("default: 1800");
});

it("prints pull help without treating the flag as a project id", async () => {
Expand Down Expand Up @@ -267,6 +268,39 @@ describe("runProjectSubcommand", () => {
expect(result.stdout.join("\n")).toContain("preview: https://codebase.design/preview/proj-1");
});

it("keeps the default wait alive beyond ten minutes", async () => {
let now = 0;
const nowSpy = vi.spyOn(Date, "now").mockImplementation(() => now);
const client = fakeClient({
status: { sessionId: "sess-1", status: "building", projectId: "proj-1" },
preview: { ok: true, previewPath: "/preview/proj-1" },
}) as ProjectClient;
client.getBuildStatus = async () => ({
sessionId: "sess-1",
status: now >= 11 * 60_000 ? "completed" : "building",
projectId: "proj-1",
});

try {
const stdout: string[] = [];
const code = await runProjectSubcommand(["project", "build", "--wait", "Build", "a", "demo"], {
client,
stdout: (message) => stdout.push(message),
stderr: () => {},
sleep: async (ms) => {
now += ms;
},
handoffStore: null,
});

expect(code).toBe(0);
expect(now).toBeGreaterThanOrEqual(11 * 60_000);
expect(stdout.join("\n")).toContain("build sess-1: completed");
} finally {
nowSpy.mockRestore();
}
});

it("fails a terminal build and prints the server reason", async () => {
const result = await runProject(
["project", "build", "--wait", "Build", "a", "demo"],
Expand Down
4 changes: 2 additions & 2 deletions src/projects/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BuildHandoffStore } from "./handoff.js";
import type { BuildStatusResponse, PlatformProject } from "./types.js";

const DEFAULT_LIST_LIMIT = 25;
const DEFAULT_BUILD_TIMEOUT_MS = 10 * 60_000;
const DEFAULT_BUILD_TIMEOUT_MS = 30 * 60_000;
const DEFAULT_BUILD_POLL_MS = 30_000;

export interface ProjectCliOptions {
Expand Down Expand Up @@ -661,7 +661,7 @@ function printBuildHelp(out: (msg: string) => void): void {
out("");
out("Options:");
out(" --wait, -w poll until the build completes, then print preview URL");
out(" --timeout SECONDS max wait time with --wait (default: 600)");
out(" --timeout SECONDS max wait time with --wait (default: 1800)");
out(" --model MODEL request a specific web build model");
out(" --scaffold ID request a specific web scaffold");
out(" --project ID continue/build against an existing project when supported by the web API");
Expand Down
Loading