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.75",
"version": "2.0.0-pre.76",
"description": "Codebase CLI — a TypeScript coding agent on the pi-mono runtime. OAuth-aware, any LLM provider, single install.",
"keywords": [
"ai",
Expand Down
18 changes: 18 additions & 0 deletions src/projects/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,24 @@ describe("runProjectSubcommand", () => {
expect(result.stdout.join("\n")).toContain("preview: https://codebase.design/preview/proj-1");
});

it("fails a terminal build and prints the server reason", async () => {
const result = await runProject(
["project", "build", "--wait", "Build", "a", "demo"],
fakeClient({
status: {
sessionId: "sess-1",
status: "failed",
projectId: "proj-1",
error: "active-project cap reached (1)",
},
}),
);

expect(result.code).toBe(1);
expect(result.stdout.join("\n")).toContain("build sess-1: failed");
expect(result.stdout.join("\n")).toContain("error: active-project cap reached (1)");
});

it("streams deduplicated file and phase progress while waiting", async () => {
let calls = 0;
const statuses: BuildStatusResponse[] = [
Expand Down
5 changes: 3 additions & 2 deletions src/projects/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ async function buildCmd(
if (previewUrl) handoffStore?.update({ sessionId: started.sessionId, previewUrl });
return 0;
}
return status.status === "failed" ? 1 : 0;
return 1;
}

async function waitForBuild(
Expand Down Expand Up @@ -408,7 +408,7 @@ async function statusCmd(
const status = await client.getBuildStatus(resolved.sessionId);
handoffStore?.update({ sessionId: resolved.sessionId, status: status.status, model: status.model });
printBuildStatus(status, out);
return status.status === "failed" ? 1 : 0;
return status.status === "completed" || status.status === "building" ? 0 : 1;
}

async function previewCmd(
Expand Down Expand Up @@ -472,6 +472,7 @@ function resolveBuildSessionId(

function printBuildStatus(status: BuildStatusResponse, out: (msg: string) => void): void {
out(`build ${status.sessionId}: ${status.status}`);
if (status.error) out(` error: ${status.error}`);
if (status.projectId) out(` project: ${status.projectId}`);
if (status.model) out(` model: ${status.model}`);
const files = uniqueStrings(status.filesCreated);
Expand Down
1 change: 1 addition & 0 deletions src/projects/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface BuildStartResponse {
export interface BuildStatusResponse {
sessionId: string;
status: string;
error?: string;
projectId?: string;
filesCreated?: string[];
model?: string;
Expand Down
Loading