The Open Framework for Building Agents
fix(eve): onboarding - polish init output and chat handoff (#3536)
Andrew Barba9f1d1cf72101
diff --git a/.changeset/quiet-init-onboarding.md b/.changeset/quiet-init-onboarding.mdnew file mode 100644index 000000000..5e94973ab--- /dev/null+++ b/.changeset/quiet-init-onboarding.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Polish `eve init` with inline terminal output, timed installation progress, and a quiet transition into chat without automatic login entries in history. Failed installs show bounded diagnostics and recovery instructions; debug logging retains package-manager output.diff --git a/packages/eve/scripts/copy-compiled-assets.mjs b/packages/eve/scripts/copy-compiled-assets.mjsindex 6b8378044..76c5bdfc0 100644--- a/packages/eve/scripts/copy-compiled-assets.mjs+++ b/packages/eve/scripts/copy-compiled-assets.mjs@@ -21,6 +21,8 @@ export async function copyCompiledAssets() {});await cp(sourcePath, destinationPath, {recursive: true,+ // Parallel vendor runs can release this coordination lock while we copy.+ filter: (source) => source !== join(sourcePath, ".vendor-lock"),});}diff --git a/packages/eve/src/cli/banner.ts b/packages/eve/src/cli/banner.tsindex 6cb1c5db1..e878b224f 100644--- a/packages/eve/src/cli/banner.ts+++ b/packages/eve/src/cli/banner.ts@@ -6,8 +6,7 @@ export const EVE_WORDMARK = "eve";/*** The boot banner shared by every CLI command that announces itself: the eve- * badge plus the installed version. Printed only by the CLI program's- * pre-action hook so commands never compose their own variant.+ * badge plus the installed version. Init prints it before its progress row.*/export function eveCliBanner(): string {const { version } = resolveInstalledPackageInfo();diff --git a/packages/eve/src/cli/commands/init-install.test.ts b/packages/eve/src/cli/commands/init-install.test.tsnew file mode 100644index 000000000..bf588440c--- /dev/null+++ b/packages/eve/src/cli/commands/init-install.test.ts@@ -0,0 +1,46 @@+import { describe, expect, it } from "vitest";++import { createInstallDiagnostics } from "./init-install.js";++describe("install diagnostics", () => {+ it("prefers actionable output even when npm keeps emitting noise", () => {+ const diagnostics = createInstallDiagnostics();+ diagnostics.append("npm silly fetching manifest");+ diagnostics.append("npm error ERESOLVE unable to resolve dependency tree");+ for (let index = 0; index < 30; index++) diagnostics.append(`npm http fetch ${index}`);+ expect(diagnostics.result()).toEqual({+ lines: ["npm error ERESOLVE unable to resolve dependency tree"],+ truncated: false,+ });+ });++ it.each(["npm silly step", "error line"])("retains the last 20 lines of %s", (prefix) => {+ const diagnostics = createInstallDiagnostics();+ for (let index = 0; index < 25; index++) diagnostics.append(`${prefix} ${index}`);+ const { lines, truncated } = diagnostics.result();+ expect(lines).toHaveLength(20);+ expect(lines[0]).toBe(`${prefix} 5`);+ expect(lines.at(-1)).toBe(`${prefix} 24`);+ expect(truncated).toBe(true);+ });++ it("bounds oversized UTF-8 lines and includes the most recent error", () => {+ const diagnostics = createInstallDiagnostics();+ diagnostics.append("🚀".repeat(10_000));+ let result = diagnostics.result();+ expect(Buffer.byteLength(`${result.lines.join("\n")}\n`)).toBeLessThanOrEqual(16 * 1_024);+ expect(result.lines.join("")).not.toContain("�");+ diagnostics.append("Registry unavailable");+ result = diagnostics.result();+ expect(Buffer.byteLength(`${result.lines.join("\n")}\n`)).toBeLessThanOrEqual(16 * 1_024);+ expect(result.lines.at(-1)).toBe("Registry unavailable");+ expect(result.truncated).toBe(true);+ });++ it("drops blank lines and terminal control sequences from diagnostics", () => {+ const diagnostics = createInstallDiagnostics();+ diagnostics.append(" ");+ diagnostics.append("\u001B[3J\u001B[Hnpm error failed");+ expect(diagnostics.result()).toEqual({ lines: ["npm error failed"], truncated: false });+ });+});diff --git a/packages/eve/src/cli/commands/init-install.ts b/packages/eve/src/cli/commands/init-install.tsindex 90636f675..6058b84e5 100644--- a/packages/eve/src/cli/commands/init-install.ts+++ b/packages/eve/src/cli/commands/init-install.ts@@ -1,30 +1,52 @@import type { EveCliSetupFailureCode } from "#cli/telemetry/index.js";-import type { PackageManagerKind } from "#setup/package-manager.js";import { type PackageManagerInstallResult } from "#setup/primitives/index.js";-import type { ProcessOutputLine } from "#setup/primitives/process-output.js";+import { sanitizeForTerminal } from "#cli/ui/output.js";-export function installProgressDetail(- packageManager: PackageManagerKind,- line: ProcessOutputLine,-): string | undefined {- const text = line.text.trim();- if (text === "" || packageManager !== "npm") return text || undefined;+const NPM_NOISE_LINE = /^\s*npm (?:silly|verbose|http|timing)\b/u;+const INSTALL_OUTPUT_MAX_LINES = 20;+const INSTALL_OUTPUT_MAX_BYTES = 16 * 1_024;- const manifest = /^npm silly fetch manifest (.+)$/u.exec(text);- if (manifest !== null) return `Resolving ${manifest[1]}`;+/** Keeps a bounded error tail, falling back to npm detail only when no other output exists. */+export function createInstallDiagnostics() {+ const lines: string[] = [];+ let bytes = 0;+ let hasUsefulOutput = false;+ let truncated = false;- const failedRequest = /^npm http fetch \S+ \S+ attempt (\d+) failed with (\S+)$/u.exec(text);- if (failedRequest !== null) {- return `npm registry · attempt ${failedRequest[1]} failed: ${failedRequest[2]}`;- }+ return {+ append(text: string): void {+ let line = sanitizeForTerminal(text).trimEnd();+ if (line.trim() === "") return;+ const noise = NPM_NOISE_LINE.test(line);+ if (noise && hasUsefulOutput) return;+ if (!noise && !hasUsefulOutput) {+ lines.length = 0;+ bytes = 0;+ truncated = false;+ hasUsefulOutput = true;+ }- if (line.stream === "stdout" || /^npm (?:error|warn)\b/u.test(text)) return text;- return undefined;+ const encoded = Buffer.from(line);+ if (encoded.length >= INSTALL_OUTPUT_MAX_BYTES) {+ let start = encoded.length - INSTALL_OUTPUT_MAX_BYTES + 1;+ // Keep complete UTF-8 code points while reserving one byte for the newline.+ while ((encoded[start]! & 0xc0) === 0x80) start += 1;+ line = encoded.subarray(start).toString("utf8");+ truncated = true;+ }+ lines.push(line);+ bytes += Buffer.byteLength(line) + 1;+ while (lines.length > INSTALL_OUTPUT_MAX_LINES || bytes > INSTALL_OUTPUT_MAX_BYTES) {+ bytes -= Buffer.byteLength(lines.shift()!) + 1;+ truncated = true;+ }+ },+ result(): { lines: readonly string[]; truncated: boolean } {+ return { lines, truncated };+ },+ };}-export const NPM_NOISE_LINE = /^\s*npm (?:silly|verbose|http|timing)\b/u;-export const INSTALL_OUTPUT_FALLBACK_LINES = 20;-export function packageManagerInstallFailureCode(result: PackageManagerInstallResult,): EveCliSetupFailureCode {diff --git a/packages/eve/src/cli/commands/init-project.ts b/packages/eve/src/cli/commands/init-project.tsindex 7e29d2b76..4b94c7c73 100644--- a/packages/eve/src/cli/commands/init-project.ts+++ b/packages/eve/src/cli/commands/init-project.ts@@ -33,9 +33,8 @@ export type PreparedInitProject =};export type InitResult = {- agentElapsedMs: number;+ elapsedMs: number;agentLaunched: boolean;- installElapsedMs: number;packageManager: PackageManagerKind;projectPath: string;selfModificationEnabled: boolean;diff --git a/packages/eve/src/cli/commands/init.integration.test.ts b/packages/eve/src/cli/commands/init.integration.test.tsindex 84be67fe1..6f25074be 100644--- a/packages/eve/src/cli/commands/init.integration.test.ts+++ b/packages/eve/src/cli/commands/init.integration.test.ts@@ -4,7 +4,15 @@ import { join } from "node:path";import { afterEach, describe, expect, it, vi } from "vitest";-import { MockScreen } from "#cli/dev/tui/test/mock-terminal.js";+import { MockScreen, MockUserInput } from "#cli/dev/tui/test/mock-terminal.js";+import { TerminalRenderer } from "#cli/dev/tui/terminal-renderer.js";+import { EveTUIRunner } from "#cli/dev/tui/runner.js";+import { createDevBootProgressReporter } from "#cli/dev/boot-progress.js";+import { startCliLiveRow } from "#cli/ui/live-row.js";+import * as liveRow from "#cli/ui/live-row.js";+import { Client, MessageResponse } from "#client/index.js";+import { createTestAgentInfoResult } from "#internal/testing/agent-info-fixture.js";+import { stampTestEvents } from "#internal/testing/events.js";import { stripAnsi } from "#cli/ui/terminal-text.js";import { packageInstallResult, packageProcessResult } from "#internal/testing/package-process.js";import { DEFAULT_AGENT_MODEL_ID } from "#shared/default-agent-model.js";@@ -20,6 +28,7 @@ import {type ScaffoldBaseProjectOptions,} from "#setup/scaffold/index.js";import { pathExists } from "#setup/path-exists.js";+import { WizardCancelledError } from "#setup/step.js";import type { GitInitResult } from "./init-git.js";import {@@ -131,6 +140,218 @@ afterEach(() => {});describe("runInitCommand", () => {+ it.each(["install-failure", "cancelled", "startup-failure"] as const)(+ "clears progress before ending init on %s",+ async (outcome) => {+ vi.stubEnv("CI", "");+ vi.stubEnv("TERM", "xterm-256color");+ const parentDirectory = await mkdtemp(join(tmpdir(), "eve-init-interrupted-"));+ const screen = new MockScreen({ columns: 80, rows: 10 });+ const startRow = startCliLiveRow;+ vi.spyOn(liveRow, "startCliLiveRow").mockImplementation((log, options) =>+ startRow(log, { ...options, output: screen }),+ );+ const output = logger();+ const deps = dependencies();+ deps.runPackageManagerInstall.mockImplementation(async (_kind, _path, options) => {+ expect(screen.snapshot()).toContain("Installing dependencies");+ if (outcome === "cancelled") throw new WizardCancelledError();+ if (outcome === "install-failure") {+ options?.onOutput?.({ stream: "stderr", text: "npm error registry unavailable" });+ return packageInstallResult(1);+ }+ return packageInstallResult();+ });+ deps.spawnPackageManager.mockImplementation(async () => {+ expect(screen.snapshot()).toBe("");+ return packageProcessResult(1);+ });+ const run = runInitCommand(output, parentDirectory, "agent", {}, deps);+ if (outcome === "cancelled") await expect(run).resolves.toBeUndefined();+ else+ await expect(run).rejects.toThrow(+ outcome === "install-failure"+ ? "Failed to install dependencies"+ : "Development server exited unsuccessfully",+ );+ expect(screen.snapshot()).toBe("");+ if (outcome === "install-failure")+ expect(output.errors).toContain("npm error registry unavailable");+ if (outcome !== "startup-failure") expect(deps.spawnPackageManager).not.toHaveBeenCalled();+ },+ );++ it.each([true, false])(+ "hands init through model connection to first chat (connected=%s)",+ async (connected) => {+ const parentDirectory = await mkdtemp(join(tmpdir(), "eve-init-chat-"));+ const output = logger();+ const deps = dependencies();+ const screen = new MockScreen({ columns: 100, rows: 30 });+ const input = new MockUserInput();+ const renderer = new TerminalRenderer({+ input,+ output: screen,+ captureForeignOutput: false,+ unicode: true,+ });+ const client = new Client({ host: "http://eve-test.invalid" });+ const baseInfo = createTestAgentInfoResult();+ const info = {+ ...baseInfo,+ agent: {+ ...baseInfo.agent,+ model: {+ id: "openai/test-model",+ routing: { kind: "gateway" as const, target: "openai" },+ endpoint: connected+ ? {+ kind: "gateway" as const,+ connected: true as const,+ credential: "api-key" as const,+ }+ : { kind: "gateway" as const, connected: false as const },+ },+ },+ };+ vi.spyOn(client, "info").mockResolvedValue(info);+ const session = client.sessions.attach("session_init");+ vi.spyOn(session, "stream").mockImplementation(async function* () {});+ const send = vi.spyOn(session, "send").mockImplementation(+ async () =>+ new MessageResponse({+ sessionId: "session_init",+ cancelTurn: async () => ({ status: "no_active_turn" }),+ createStream: async function* () {+ yield* stampTestEvents([+ { type: "turn.started", data: { sequence: 1, turnId: "turn_init" } },+ {+ type: "message.completed",+ data: {+ sequence: 2,+ turnId: "turn_init",+ stepIndex: 0,+ finishReason: "stop",+ message: "Hello Alice, your agent is ready.",+ },+ },+ {+ type: "session.waiting",+ data: { continuationToken: "session_init", wait: "next-user-message" },+ },+ ]);+ },+ }),+ );+ const handle = vi.fn(async () => {+ if (!connected) {+ const provider = await renderer.setupFlow.readSelect({+ kind: "single",+ message: "Connect a model",+ options: [{ label: "Test connection", value: "test" }],+ });+ expect(provider).toEqual(["test"]);+ }+ return { message: connected ? "Using existing connection." : "Model connected." };+ });+ const readPrompt = vi.spyOn(renderer, "readPrompt");+ deps.spawnPackageManager.mockImplementation(async (_manager, projectPath, args) => {+ expect(args).toContain("--onboard");+ const progress = startCliLiveRow(output, { output: screen, elapsed: true });+ const report = createDevBootProgressReporter(progress);+ report({ type: "phase-started", phase: "compiling internal artifacts" });+ const runner = new EveTUIRunner({+ client,+ session,+ renderer,+ appRoot: projectPath,+ onboard: true,+ bootDetections: [],+ onBootProgress: report,+ detectProjectIdentity: async () => undefined,+ getVercelAuthStatus: async () => "authenticated",+ promptCommandHandler: { handle },+ });+ await runner.run();+ return packageProcessResult();+ });++ const run = runInitCommand(output, parentDirectory, "agent", {}, deps);+ void run.catch(() => {});+ try {+ if (!connected) {+ await screen.waitForText("Connect a model");+ expect(screen.snapshot()).not.toContain("Starting your agent");+ input.enter();+ }+ await vi.waitFor(() => expect(readPrompt).toHaveBeenCalled());+ expect(screen.snapshot()).not.toContain("/login");+ expect(screen.rawOutput()).not.toContain("Using existing connection.");+ expect(screen.rawOutput()).not.toContain("Model connected.");+ input.type("Hello, I'm Alice.");+ input.enter();+ await screen.waitForText("Hello Alice, your agent is ready.");+ await screen.waitForIdlePrompt();+ input.type("/exit");+ input.enter();+ await run;+ expect(send).toHaveBeenCalledOnce();+ expect(handle).toHaveBeenCalledOnce();+ expect(screen.snapshot()).not.toContain("Starting your agent");+ expect(screen.rawOutput()).not.toContain("compiling internal artifacts");+ expect(screen.rawOutput()).not.toContain("\u001B[3J");+ expect(output.messages.join("\n")).not.toContain("$ eve dev");+ } finally {+ renderer.requestInterrupt();+ await run.catch(() => {});+ }+ },+ );++ it.each([+ { interactive: true, agent: false },+ { interactive: false, agent: false },+ { interactive: true, agent: true },+ ])("keeps init inline with the shell command (%j)", async ({ interactive, agent }) => {+ vi.stubEnv("CI", "");+ vi.stubEnv("TERM", "xterm-256color");+ const parentDirectory = await mkdtemp(join(tmpdir(), "eve-init-inline-"));+ const screen = new MockScreen({ columns: 100, rows: 30 });+ const properties = ["isTTY", "rows", "columns"] as const;+ const original = properties.map((key) => Object.getOwnPropertyDescriptor(process.stdout, key));+ for (const key of properties) {+ Object.defineProperty(process.stdout, key, { configurable: true, value: screen[key] });+ }+ vi.spyOn(process.stdout, "write").mockImplementation((chunk) => screen.write(String(chunk)));+ const output = logger();+ output.log = (message) => {+ screen.write(`${message}\n`);+ };+ const deps = { ...dependencies(), hasInteractiveTerminal: () => interactive };+ deps.isCodingAgentLaunch.mockResolvedValue(agent);+ const shellOutput = "$ pnpm dlx eve init agent\nProgress: resolved 47, added 33, done\n";+ screen.write(shellOutput);+ try {+ await runInitCommand(output, parentDirectory, "agent", {}, deps);+ const transcript = stripAnsi(screen.snapshot());+ expect(transcript.startsWith(`${shellOutput}${interactive && !agent ? "\n" : ""}☰eve`)).toBe(+ true,+ );+ expect(transcript).not.toContain("\n\n\n");+ expect(screen.rawOutput()).not.toContain("\u001B[H");+ expect(screen.rawOutput()).not.toContain("\u001B[2J");+ expect(screen.rawOutput()).not.toContain("\u001B[3J");+ expect(transcript.match(/☰eve/gu)).toHaveLength(1);+ expect(deps.spawnPackageManager).toHaveBeenCalledTimes(interactive && !agent ? 1 : 0);+ } finally {+ for (const [index, key] of properties.entries()) {+ const descriptor = original[index];+ if (descriptor === undefined) Reflect.deleteProperty(process.stdout, key);+ else Object.defineProperty(process.stdout, key, descriptor);+ }+ }+ });+it("returns after scaffolding without opening the TUI in a noninteractive terminal", async () => {const parentDirectory = await mkdtemp(join(tmpdir(), "eve-init-headless-"));const deps = { ...dependencies(), hasInteractiveTerminal: () => false };@@ -166,6 +387,7 @@ describe("runInitCommand", () => {'"agents/**/*.ts"',);expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectRoot, [+ "--reporter=silent","exec","eve","dev",@@ -252,10 +474,12 @@ describe("runInitCommand", () => {const output = logger();const deps = dependencies();deps.now+ .mockReturnValueOnce(0).mockReturnValueOnce(0).mockReturnValueOnce(467).mockReturnValueOnce(467)- .mockReturnValueOnce(13_667);+ .mockReturnValueOnce(13_667)+ .mockReturnValueOnce(13_800);await runInitCommand(output, parentDirectory, "my-agent", {}, deps);@@ -280,23 +504,24 @@ describe("runInitCommand", () => {);expect(deps.tryInitializeGit).toHaveBeenCalledWith(projectPath);expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectPath, [+ "--reporter=silent","exec","eve","dev","--onboard",]);- // Substring assertions keep the expectations color-agnostic; picocolors- // decides at import time whether the strings carry escape codes. The boot- // banner is the CLI program's pre-action hook, not the command's output.- expect(output.messages).toHaveLength(4);- expect(output.messages[0]).toContain("Preparing project...");- expect(output.messages[1]).toContain("✓");- expect(output.messages[1]).toContain("Created an eve agent in ");- expect(output.messages[1]).toContain(projectPath);- expect(output.messages[1]).toContain("in 467ms");- expect(output.messages[2]).toContain("Installed dependencies");- expect(output.messages[2]).toContain("in 13.2s");- expect(output.messages[3]).toContain("$ eve dev");+ const messages = output.messages.map(stripAnsi);+ expect(messages).toHaveLength(7);+ expect(messages[0]).toBe("");+ expect(messages[1]).toContain("☰eve");+ expect(messages.slice(2, 5)).toEqual([+ "Creating agent...",+ "Installing dependencies...",+ "Initializing Git...",+ ]);+ expect(messages[5]).toBe(`✓ Created an eve agent in ${projectPath} in 13.8s`);+ expect(messages[6]).toBe("");+ expect(messages.join("\n")).not.toContain("$ eve dev");expect(output.messages.join("\n")).not.toContain("Instructions ");});@@ -455,13 +680,15 @@ describe("runInitCommand", () => {);expect(deps.tryInitializeGit).toHaveBeenCalledWith(projectPath);expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectPath, [+ "--reporter=silent","exec","eve","dev","--onboard",]);- expect(output.messages[1]).toContain("Created an eve agent in ");- expect(output.messages[1]).toContain(projectPath);+ expect(output.messages.map(stripAnsi).join("\n")).toContain(+ `Created an eve agent in ${projectPath}`,+ );},);@@ -559,7 +786,7 @@ describe("runInitCommand", () => {["npm", "package-lock.json", "bun", ["exec", "--", "eve", "dev", "--onboard"]],["yarn", "yarn.lock", "npm", ["eve", "dev", "--onboard"]],["bun", "bun.lock", "npm", ["x", "eve", "dev", "--onboard"]],- ["pnpm", "pnpm-lock.yaml", "npm", ["exec", "eve", "dev", "--onboard"]],+ ["pnpm", "pnpm-lock.yaml", "npm", ["--reporter=silent", "exec", "eve", "dev", "--onboard"]],] as const)("scaffolds a fresh named project with the ancestor %s lockfile before the launcher",async (kind, lockfile, invokingManager, devArguments) => {@@ -831,6 +1058,7 @@ describe("runInitCommand", () => {`Git initialization failed during commit: commit refused\nThe eve agent was created successfully. Git repository metadata and staged files were preserved at "${projectPath}"; the initial commit is optional.\n\nTo create it later, configure Git identity and run:\n git -C ${JSON.stringify(projectPath)} commit -m "Initial commit from eve"`,);expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectPath, [+ "--reporter=silent","exec","eve","dev",@@ -858,6 +1086,7 @@ describe("runInitCommand", () => {expect.anything(),);expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectPath, [+ "--reporter=silent","exec","eve","dev",@@ -926,6 +1155,7 @@ describe("runInitCommand", () => {// An existing project's history is its own; only fresh scaffolds get git init.expect(deps.tryInitializeGit).not.toHaveBeenCalled();expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm", projectRoot, [+ "--reporter=silent","exec","eve","dev",@@ -1239,6 +1469,7 @@ describe("runInitCommand", () => {expect(messages).toContain(`✓ Model ${DEFAULT_AGENT_MODEL_ID} (eve default)`);expect(messages).toContain(`✓ Instructions ${join(projectPath, "agent/instructions.md")}`);expect(messages).toContain("pnpm exec eve dev --no-ui");+ expect(messages).not.toContain("--reporter");});it("derives the agent dev handoff command from the existing project's own manager", async () => {@@ -1289,7 +1520,7 @@ describe("runInitCommand", () => {expect(deps.spawnPackageManager).toHaveBeenCalledWith("pnpm",join(parentDirectory, "my-agent"),- ["exec", "eve", "dev", "--onboard"],+ ["--reporter=silent", "exec", "eve", "dev", "--onboard"],);});@@ -1400,8 +1631,9 @@ describe("runInitCommand", () => {"Failed to install dependencies",);- expect(output.errors).toHaveLength(20);- expect(output.errors.at(0)).toBe("npm silly step 5");+ expect(output.errors).toHaveLength(21);+ expect(output.errors.at(0)).toContain("Earlier install output omitted");+ expect(output.errors.at(1)).toBe("npm silly step 5");expect(output.errors.at(-1)).toBe("npm silly step 24");});@@ -1467,71 +1699,78 @@ describe("runInitCommand", () => {}});- it("keeps interactive progress on one physical row", async () => {- const parentDirectory = await mkdtemp(join(tmpdir(), "eve-init-progress-"));- const output = logger();- const deps = dependencies();- const screen = new MockScreen({ columns: 80, rows: 10 });- const snapshots: string[] = [];- const isTtyDescriptor = Object.getOwnPropertyDescriptor(process.stdout, "isTTY");- const columnsDescriptor = Object.getOwnPropertyDescriptor(process.stdout, "columns");-- Object.defineProperty(process.stdout, "isTTY", { configurable: true, value: true });- Object.defineProperty(process.stdout, "columns", { configurable: true, value: screen.columns });- vi.spyOn(process.stdout, "write").mockImplementation((chunk: string | Uint8Array) => {- screen.write(chunk);- snapshots.push(screen.snapshot());- return true;- });- deps.isCodingAgentLaunch.mockResolvedValue(true);- deps.detectInvokingPackageManager.mockReturnValue("npm");- deps.runPackageManagerInstall.mockImplementation(async (_kind, _projectPath, options) => {- options?.onOutput?.({ stream: "stderr", text: "npm silly config load:file:/tmp/.npmrc" });- options?.onOutput?.({- stream: "stderr",- text: "npm silly fetch manifest @vercel/[email protected]",+ it.each(["npm", "pnpm", "yarn", "bun"] as const)(+ "keeps %s output behind one native progress row",+ async (manager) => {+ vi.stubEnv("CI", "");+ vi.stubEnv("TERM", "xterm-256color");+ const parentDirectory = await mkdtemp(join(tmpdir(), "eve-init-progress-"));+ const output = logger();+ const deps = dependencies();+ const screen = new MockScreen({ columns: 80, rows: 10 });+ const snapshots: string[] = [];+ const isTtyDescriptor = Object.getOwnPropertyDescriptor(process.stdout, "isTTY");+ const columnsDescriptor = Object.getOwnPropertyDescriptor(process.stdout, "columns");++ Object.defineProperty(process.stdout, "isTTY", { configurable: true, value: true });+ Object.defineProperty(process.stdout, "columns", {+ configurable: true,+ value: screen.columns,});- options?.onOutput?.({ stream: "stderr", text: "npm silly fetch manifest [email protected]" });- options?.onOutput?.({- stream: "stderr",- text: "npm http fetch GET https://registry.npmjs.org/@vercel%2fconnect attempt 1 failed with ENOTFOUND",+ vi.spyOn(process.stdout, "write").mockImplementation((chunk: string | Uint8Array) => {+ screen.write(chunk);+ snapshots.push(screen.snapshot());+ return true;+ });+ deps.detectInvokingPackageManager.mockReturnValue(manager);+ deps.runPackageManagerInstall.mockImplementation(async (_kind, _projectPath, options) => {+ options?.onOutput?.({ stream: "stderr", text: "npm silly config load:file:/tmp/.npmrc" });+ options?.onOutput?.({+ stream: "stderr",+ text: "npm silly fetch manifest @vercel/[email protected]",+ });+ options?.onOutput?.({ stream: "stderr", text: "npm silly fetch manifest [email protected]" });+ options?.onOutput?.({+ stream: "stderr",+ text: "npm http fetch GET https://registry.npmjs.org/@vercel%2fconnect attempt 1 failed with ENOTFOUND",+ });+ options?.onOutput?.({ stream: "stdout", text: `Downloading ${"package".repeat(20)}` });+ return packageInstallResult();});- options?.onOutput?.({ stream: "stdout", text: `Downloading ${"package".repeat(20)}` });- return packageInstallResult();- });- try {- await runInitCommand(output, parentDirectory, "my-agent", {}, deps);- } finally {- if (isTtyDescriptor === undefined) {- Reflect.deleteProperty(process.stdout, "isTTY");- } else {- Object.defineProperty(process.stdout, "isTTY", isTtyDescriptor);+ try {+ await runInitCommand(output, parentDirectory, "my-agent", {}, deps);+ } finally {+ if (isTtyDescriptor === undefined) {+ Reflect.deleteProperty(process.stdout, "isTTY");+ } else {+ Object.defineProperty(process.stdout, "isTTY", isTtyDescriptor);+ }+ if (columnsDescriptor === undefined) {+ Reflect.deleteProperty(process.stdout, "columns");+ } else {+ Object.defineProperty(process.stdout, "columns", columnsDescriptor);+ }}- if (columnsDescriptor === undefined) {- Reflect.deleteProperty(process.stdout, "columns");- } else {- Object.defineProperty(process.stdout, "columns", columnsDescriptor);- }- }- const rendered = snapshots.join("\n");- expect(rendered).toContain("Preparing project");- expect(rendered).toContain("Creating agent");- expect(rendered).toContain("Installing dependencies");- expect(rendered).toContain("npm install");- expect(rendered).toContain("Resolving @vercel/[email protected]");- expect(rendered).toContain("npm registry · attempt 1 failed: ENOTFOUND");- expect(rendered).not.toContain("config load:file");- expect(rendered).toContain("Initializing Git repository");- expect(deps.runPackageManagerInstall).toHaveBeenCalledWith(- "npm",- join(parentDirectory, "my-agent"),- expect.objectContaining({ progressDetails: true }),- );- for (const snapshot of snapshots.filter(Boolean)) {- expect(snapshot.split("\n")).toHaveLength(1);- expect([...snapshot].length).toBeLessThan(screen.columns);- }- });+ const rendered = snapshots.join("\n");+ expect(rendered).toContain("Creating agent");+ expect(rendered).toContain("Installing dependencies");+ expect(rendered).toContain(`${manager} · 0s`);+ expect(rendered).not.toContain("Resolving");+ expect(rendered).not.toContain("ENOTFOUND");+ expect(rendered).not.toContain("Downloading");+ expect(rendered).not.toContain("config load:file");+ expect(rendered).toContain("Initializing Git");+ expect(deps.runPackageManagerInstall).toHaveBeenCalledWith(+ manager,+ join(parentDirectory, "my-agent"),+ expect.objectContaining({ progressDetails: false }),+ );+ for (const snapshot of snapshots.filter(Boolean)) {+ expect(snapshot.split("\n")).toHaveLength(1);+ expect([...snapshot].length).toBeLessThan(screen.columns);+ }+ },+ );});diff --git a/packages/eve/src/cli/commands/init.ts b/packages/eve/src/cli/commands/init.tsindex 375b5495c..cb251bd72 100644--- a/packages/eve/src/cli/commands/init.ts+++ b/packages/eve/src/cli/commands/init.ts@@ -10,7 +10,7 @@ import type {EveCliSetupStep,EveCliSetupTerminalResult,} from "#cli/telemetry/index.js";-import { EVE_WORDMARK } from "#cli/banner.js";+import { eveCliBanner, EVE_WORDMARK } from "#cli/banner.js";import { formatElapsed } from "#cli/format-elapsed.js";import { startCliLiveRow } from "#cli/ui/live-row.js";import { createLogger, isLogLevelEnabled } from "#internal/logging.js";@@ -44,12 +44,7 @@ import {} from "#setup/scaffold/create/project.js";import { initAgentDevHandoff } from "./agent-instructions.js";-import {- installProgressDetail,- INSTALL_OUTPUT_FALLBACK_LINES,- NPM_NOISE_LINE,- packageManagerInstallFailureCode,-} from "./init-install.js";+import { createInstallDiagnostics, packageManagerInstallFailureCode } from "./init-install.js";import {addAgentsToWorkspace,convertScaffoldToAgentWorkspace,@@ -274,12 +269,14 @@ async function runInitSteps(input: {parentDirectory: string;target: string | undefined;agentLaunched: boolean;+ interactive: boolean;trackStep?: (step: EveCliSetupStep) => void;trackTerminal?: InitTerminalTracker;}): Promise<InitResult> {const {agentLaunched,dependencies,+ interactive,logger,options,parentDirectory,@@ -292,10 +289,15 @@ async function runInitSteps(input: {const evePackage = resolveInitEvePackageOverride();const selfModificationEnabled = false;- let progress = startCliLiveRow(logger);+ const startedAt = dependencies.now();+ const progressOptions = {+ animate: interactive && !agentLaunched && !process.env.CI && process.env.TERM !== "dumb",+ elapsed: true,+ logPhases: true,+ };+ let progress = startCliLiveRow(logger, progressOptions);let activeInitStep: EveCliSetupStep = "scaffold";let installFailureCode: EveCliSetupFailureCode | undefined;- progress.update("Preparing project");try {const scaffoldPhase = initTarget.kind === "fresh" ? "creating agent" : "adding agent";trackStep?.(activeInitStep);@@ -387,36 +389,25 @@ async function runInitSteps(input: {if (project.kind === "added") {progress.stop();reportExistingProjectChanges(logger, project);- progress = startCliLiveRow(logger);+ progress = startCliLiveRow(logger, progressOptions);}activeInitStep = "install_dependencies";trackStep?.(activeInitStep);- progress.update("Installing dependencies", `${project.packageManager} install`);+ progress.update("Installing dependencies", project.packageManager);initLog.debug(`installing dependencies with ${project.packageManager}`);const installStartedAt = dependencies.now();- const installFailureOutput: string[] = [];- const recentInstallOutput: string[] = [];+ const diagnostics = createInstallDiagnostics();const installResult = await dependencies.runPackageManagerInstall(project.packageManager,project.projectPath,{autoApprove: true,bypassMinimumReleaseAge: true,- progressDetails: process.stdout.isTTY === true && !debug,+ progressDetails: false,onOutput: (line) => {- if (line.text.trim() !== "") {- recentInstallOutput.push(line.text);- if (recentInstallOutput.length > INSTALL_OUTPUT_FALLBACK_LINES) {- recentInstallOutput.shift();- }- if (!NPM_NOISE_LINE.test(line.text)) {- installFailureOutput.push(line.text);- }- }+ diagnostics.append(line.text);if (debug) initLog.debug(line.text);- const detail = installProgressDetail(project.packageManager, line);- if (detail !== undefined) progress.update("Installing dependencies", detail);},},);@@ -425,8 +416,8 @@ async function runInitSteps(input: {installFailureCode = packageManagerInstallFailureCode(installResult);initLog.debug("dependency installation failed", { ms: installElapsedMs });progress.stop();- const failureOutput =- installFailureOutput.length > 0 ? installFailureOutput : recentInstallOutput;+ const { lines: failureOutput, truncated } = diagnostics.result();+ if (truncated) logger.error("Earlier install output omitted; showing the final diagnostics.");for (const line of failureOutput) logger.error(line);if (failureOutput.length === 0) {const message = packageManagerInstallFailureMessage(installResult);@@ -467,23 +458,22 @@ async function runInitSteps(input: {if (project.kind === "created") {activeInitStep = "initialize_git";trackStep?.(activeInitStep);- progress.update("Initializing Git repository");+ progress.update("Initializing Git");initLog.debug("initializing git repository");+ const gitResult = await dependencies.tryInitializeGit(project.projectPath);return {...project,- agentElapsedMs,+ elapsedMs: dependencies.now() - startedAt,agentLaunched,- gitResult: await dependencies.tryInitializeGit(project.projectPath),- installElapsedMs,+ gitResult,selfModificationEnabled,};}return {...project,- agentElapsedMs,+ elapsedMs: dependencies.now() - startedAt,agentLaunched,- installElapsedMs,selfModificationEnabled,};} catch (error) {@@ -507,6 +497,11 @@ export async function runInitCommand(trackStep?: (step: EveCliSetupStep) => void,trackTerminal?: InitTerminalTracker,): Promise<void> {+ const agentLaunched = await dependencies.isCodingAgentLaunch();+ const interactive = dependencies.hasInteractiveTerminal();+ if (interactive && !agentLaunched) logger.log("");+ logger.log(eveCliBanner());+trackStep?.("resolve_target");let result: InitResult;try {@@ -525,7 +520,8 @@ export async function runInitCommand(}result = await runInitSteps({- agentLaunched: await dependencies.isCodingAgentLaunch(),+ agentLaunched,+ interactive,dependencies,logger,options,@@ -548,19 +544,16 @@ export async function runInitCommand(trackStep?.("handoff");if (result.kind === "created") {logger.log(- `${pc.green("✓")} Created an ${EVE_WORDMARK} agent in ${pc.bold(result.projectPath)} ${pc.dim(`in ${formatElapsed(result.agentElapsedMs)}`)}`,+ `${pc.green("✓")} Created an ${EVE_WORDMARK} agent in ${pc.bold(result.projectPath)} ${pc.dim(`in ${formatElapsed(result.elapsedMs)}`)}`,);for (const mutation of result.workspaceRootMutations) {logger.log(pc.yellow(`⚠ ${formatWorkspaceRootMutationWarning(mutation)}`));}} else {logger.log(- `${pc.green("✓")} Added an ${EVE_WORDMARK} agent to ${pc.bold(result.projectPath)} ${pc.dim(`in ${formatElapsed(result.agentElapsedMs)}`)}`,+ `${pc.green("✓")} Added an ${EVE_WORDMARK} agent to ${pc.bold(result.projectPath)} ${pc.dim(`in ${formatElapsed(result.elapsedMs)}`)}`,);}- logger.log(- `${pc.green("✓")} Installed dependencies ${pc.dim(`in ${formatElapsed(result.installElapsedMs)}`)}`,- );if (result.selfModificationEnabled) {logger.log(`${pc.green("✓")} Enabled self-modification`);}@@ -597,17 +590,20 @@ export async function runInitCommand(return;}- if (!dependencies.hasInteractiveTerminal()) {+ if (!interactive) {logger.log(agentHandoff);return;}// Strictly the eve binary, never the project's dev script, which in an- // existing app may start unrelated processes. Exec-style runs do not echo- // the command the way run-scripts do, so the handoff line is printed here.+ // existing app may start unrelated processes.const freshScaffold = result.kind === "created";- const devArguments = freshScaffold ? [...baseDevArguments, "--onboard"] : baseDevArguments;- logger.log(pc.dim("$ eve dev"));+ const devArguments = [+ ...(result.packageManager === "pnpm" ? ["--reporter=silent"] : []),+ ...baseDevArguments,+ ...(freshScaffold ? ["--onboard"] : []),+ ];+ logger.log("");if (!resultSucceeded(await dependencies.spawnPackageManager(diff --git a/packages/eve/src/cli/dev/boot-progress.ts b/packages/eve/src/cli/dev/boot-progress.tsindex 11f0c61b9..2818f415c 100644--- a/packages/eve/src/cli/dev/boot-progress.ts+++ b/packages/eve/src/cli/dev/boot-progress.ts@@ -10,7 +10,7 @@ export function createDevBootProgressReporter(return (event) => {switch (event.type) {case "phase-started":- row?.update("Building your agent", event.phase);+ row?.update("Starting your agent");devBootLog.debug(event.phase);return;case "phase-finished":diff --git a/packages/eve/src/cli/dev/command.ts b/packages/eve/src/cli/dev/command.tsindex f89359409..fed35f195 100644--- a/packages/eve/src/cli/dev/command.ts+++ b/packages/eve/src/cli/dev/command.ts@@ -185,9 +185,9 @@ export function registerDevelopmentCommand(input: {return;}- const buildProgress = mode === "tui" ? startCliLiveRow(logger) : undefined;+ const buildProgress = mode === "tui" ? startCliLiveRow(logger, { elapsed: true }) : undefined;const onBootProgress = createDevBootProgressReporter(buildProgress);- buildProgress?.update("Building your agent");+ buildProgress?.update("Starting your agent");let server: DevelopmentServer | undefined;let closePromise: Promise<void> | undefined;diff --git a/packages/eve/src/cli/dev/tui/runner.test.ts b/packages/eve/src/cli/dev/tui/runner.test.tsindex 798956fea..5ff20b0c5 100644--- a/packages/eve/src/cli/dev/tui/runner.test.ts+++ b/packages/eve/src/cli/dev/tui/runner.test.ts@@ -2099,11 +2099,17 @@ describe("EveTUIRunner initial input", () => {};const handle = vi.fn(async () => {await login.promise;- return result === "cancelled" ? { cancelled: true as const } : { tone: "error" as const };+ return result === "cancelled"+ ? { cancelled: true as const, message: "Connect a model with /login when you’re ready." }+ : { tone: "error" as const, message: "Could not connect. Retry with /login." };});const session = stubSession();vi.spyOn(session, "send");- const renderer = fakeRenderer({ setupFlow: createFakeSetupFlowRenderer() });+ const renderer = fakeRenderer({+ setupFlow: createFakeSetupFlowRenderer(),+ renderCommandInvocation: vi.fn(),+ renderCommandResult: vi.fn(),+ });const runner = new EveTUIRunner({session,renderer,@@ -2123,6 +2129,13 @@ describe("EveTUIRunner initial input", () => {expect(renderer.readPrompt).toHaveBeenCalledWith(expect.objectContaining({ initialDraft: "Hello Alice\n\nstill editing" }),);+ expect(renderer.renderCommandInvocation).not.toHaveBeenCalled();+ expect(renderer.renderCommandResult).toHaveBeenCalledWith(+ result === "cancelled"+ ? "Connect a model with /login when you’re ready."+ : "Could not connect. Retry with /login.",+ result === "error" ? "error" : undefined,+ );},);@@ -4174,7 +4187,7 @@ describe("EveTUIRunner boot setup detection", () => {const run = runner.run();await vi.waitFor(() => expect(readPrompt).toHaveBeenCalledOnce());expect(client.info).toHaveBeenCalledTimes(2);- expect(renderCommandResult).toHaveBeenCalledOnce();+ expect(renderCommandResult).not.toHaveBeenCalled();expect(renderSetupWarning).not.toHaveBeenCalled();expect(setStartupPhase).toHaveBeenLastCalledWith(undefined);await run;@@ -4322,7 +4335,7 @@ describe("EveTUIRunner boot setup detection", () => {await runner.run();await vi.waitFor(() => expect(clearSetupWarning).toHaveBeenCalled());- expect(renderCommandResult).toHaveBeenCalledWith("AI Gateway via API key selected.", undefined);+ expect(renderCommandResult).not.toHaveBeenCalled();expect(client.info).toHaveBeenCalledTimes(2);expect(detect).not.toHaveBeenCalled();expect(headers.at(-1)?.info?.agent.model.endpoint).toMatchObject({@@ -4817,7 +4830,7 @@ describe("EveTUIRunner command shutdown", () => {});});-it("starts onboarding with only login and preserves the input draft", async () => {+it("starts onboarding without login history and preserves the input draft", async () => {const order: string[] = [];const handle = vi.fn(async (command: { name: string }) => {order.push(command.name);@@ -4825,6 +4838,8 @@ it("starts onboarding with only login and preserves the input draft", async () =});const renderer = fakeRenderer({setupFlow: createFakeSetupFlowRenderer(),+ renderCommandInvocation: vi.fn(),+ renderCommandResult: vi.fn(),readPrompt: vi.fn(async (options?: AgentTUISessionOptions) => {order.push("prompt");expect(options?.initialDraft).toBe("Hello Alice");@@ -4843,4 +4858,29 @@ it("starts onboarding with only login and preserves the input draft", async () =});await runner.run();expect(order).toEqual(["login", "prompt"]);+ expect(renderer.renderCommandInvocation).not.toHaveBeenCalled();+ expect(renderer.renderCommandResult).not.toHaveBeenCalled();+});++it("keeps the result of an explicit login command after onboarding", async () => {+ const prompts = ["/login", undefined];+ const handle = vi.fn(async () => ({ message: "Connected." }));+ const renderer = fakeRenderer({+ setupFlow: createFakeSetupFlowRenderer(),+ renderCommandResult: vi.fn(),+ readPrompt: vi.fn(async () => prompts.shift()),+ });+ const runner = new EveTUIRunner({+ session: sessionYielding([]),+ renderer,+ appRoot: "/tmp/agent",+ onboard: true,+ bootDetections: [],+ promptCommandHandler: { handle },+ });++ await runner.run();++ expect(handle).toHaveBeenCalledTimes(2);+ expect(renderer.renderCommandResult).toHaveBeenCalledExactlyOnceWith("Connected.", undefined);});diff --git a/packages/eve/src/cli/dev/tui/runner.ts b/packages/eve/src/cli/dev/tui/runner.tsindex 8d5628f53..2854cabcf 100644--- a/packages/eve/src/cli/dev/tui/runner.ts+++ b/packages/eve/src/cli/dev/tui/runner.ts@@ -838,14 +838,9 @@ export class EveTUIRunner {this.#replaceAgentInfo(this.#agentInfo);this.#paintSetupAttention();this.#renderer.setStartupPhase?.(undefined);- if (initialAgentOnboarding) {- this.#renderStartupCommandInvocation(- { type: "extension", name: "login", argument: "" },- "startup",- startupOutcome?.tone,- );+ if (!initialAgentOnboarding || startupOutcome?.cancelled || startupOutcome?.tone === "error") {+ this.#renderCommandOutcome(startupOutcome?.message, startupOutcome?.tone);}- this.#renderCommandOutcome(startupOutcome?.message, startupOutcome?.tone);while (true) {if (this.#lifecycle?.signal.aborted === true || this.#renderer.exitRequested?.() === true) {@@ -1799,20 +1794,6 @@ export class EveTUIRunner {return await handler.handle(command, context);}- #renderStartupCommandInvocation(- command: Extract<PromptCommand, { type: "extension" }>,- trigger: "startup" | "command",- tone?: "success" | "error",- ): void {- if (trigger !== "startup") return;-- const state = this.#remoteConnection?.current().connection.state;- const status =- tone === "error" || state === "auth-failed" || state === "unavailable" ? "failed" : undefined;- const argument = command.argument.length === 0 ? "" : ` ${command.argument}`;- this.#renderer.renderCommandInvocation?.(`/${command.name}${argument}`, status);- }-async #applyCommandEffect(effect: PromptCommandOutcome["effect"]): Promise<void> {if (effect?.kind === "model-access-changed") {this.#vercelStatus?.applyEffect({ kind: "refresh-identity" });diff --git a/packages/eve/src/cli/run.test.ts b/packages/eve/src/cli/run.test.tsindex c7b44540f..006efd003 100644--- a/packages/eve/src/cli/run.test.ts+++ b/packages/eve/src/cli/run.test.ts@@ -1018,6 +1018,8 @@ describe("eve dev boot progress", () => {expect(hostReporter).toBeTypeOf("function");expect(tuiReporter).toBe(hostReporter);+ expect(writes.join("")).toContain("Starting your agent");+ expect(writes.join("")).not.toContain("compiling agent");// Replaying every write through a terminal emulator: the boot progress row// is erased, leaving a clean screen for the error to print onto.const screen = new MockScreen({ columns: 80, rows: 10 });diff --git a/packages/eve/src/cli/run.ts b/packages/eve/src/cli/run.tsindex 512baefd7..7b8dc8600 100644--- a/packages/eve/src/cli/run.ts+++ b/packages/eve/src/cli/run.ts@@ -119,7 +119,13 @@ export function createCliProgram(.exitOverride().hook("preAction", (_program, actionCommand) => {const { json } = actionCommand.opts<{ json?: boolean }>();- if (["info", "init"].includes(actionCommand.name()) && !json) logger.log(eveCliBanner());+ if (+ !json &&+ (actionCommand.name() === "info" ||+ (actionCommand.name() === "init" && actionCommand.parent !== program))+ ) {+ logger.log(eveCliBanner());+ }}).configureOutput({writeErr: (message) => {diff --git a/packages/eve/src/cli/ui/live-row.test.ts b/packages/eve/src/cli/ui/live-row.test.tsindex 389a4e95b..08da8cd7b 100644--- a/packages/eve/src/cli/ui/live-row.test.ts+++ b/packages/eve/src/cli/ui/live-row.test.ts@@ -19,6 +19,50 @@ function lit(screen: MockScreen): boolean {}describe("startCliLiveRow", () => {+ it("keeps elapsed time moving during quiet installs and resets it between phases", () => {+ vi.useFakeTimers();+ const screen = makeScreen();+ const progress = startCliLiveRow(+ { log: vi.fn() },+ { output: screen, elapsed: true, pulseSequence: "00000000" },+ );+ progress.update("Installing dependencies", "pnpm");+ vi.advanceTimersByTime(12_000);+ expect(screen.snapshot()).toBe(" Installing dependencies pnpm · 12s");+ screen.resize(30, 10);+ vi.advanceTimersByTime(1_000);+ expect(visibleLength(screen.snapshot())).toBeLessThan(30);+ expect(screen.snapshot().split("\n")).toHaveLength(1);+ progress.update("Initializing Git");+ expect(screen.snapshot()).toContain("Initializing Git 0s");+ progress.stop();+ expect(screen.snapshot()).toBe("");+ expect(vi.getTimerCount()).toBe(0);+ });++ it("logs each phase once without cursor controls when animation is disabled", () => {+ vi.useFakeTimers();+ const screen = makeScreen();+ const log = vi.fn();+ const progress = startCliLiveRow(+ { log },+ { output: screen, animate: false, elapsed: true, logPhases: true },+ );+ progress.update("Creating agent");+ progress.update("Installing dependencies", "npm");+ progress.update("Installing dependencies", "npm");+ progress.update("Initializing Git");+ vi.advanceTimersByTime(5_000);+ progress.stop();+ expect(log.mock.calls.flat()).toEqual([+ "Creating agent...",+ "Installing dependencies...",+ "Initializing Git...",+ ]);+ expect(screen.rawOutput()).toBe("");+ expect(vi.getTimerCount()).toBe(0);+ });+it("starts each indicator at the first sequence step", () => {vi.useFakeTimers();const sequence = "10100000";diff --git a/packages/eve/src/cli/ui/live-row.ts b/packages/eve/src/cli/ui/live-row.tsindex 48ecd41fb..f7e19b786 100644--- a/packages/eve/src/cli/ui/live-row.ts+++ b/packages/eve/src/cli/ui/live-row.ts@@ -28,6 +28,9 @@ interface CliLiveRowOutput {interface CliLiveRowOptions {readonly output?: CliLiveRowOutput;readonly pulseSequence?: string;+ readonly animate?: boolean;+ readonly elapsed?: boolean;+ readonly logPhases?: boolean;}function validatePulseSequence(sequence: string): void {@@ -76,7 +79,7 @@ function renderProgressRow(return `${pc.green(glyph)}${prefix.slice(glyph.length)}${styledDetail}`;}-/** Starts one transient CLI row, or logs its first message when repainting is unavailable. */+/** Starts one transient row, falling back to phase logs when repainting is unavailable. */export function startCliLiveRow(logger: CliLiveRowLogger,options: CliLiveRowOptions = {},@@ -84,9 +87,8 @@ export function startCliLiveRow(const output = options.output ?? process.stdout;const pulseSequence = options.pulseSequence ?? PROGRESS_PULSE_SEQUENCE;validatePulseSequence(pulseSequence);- const animate = output.isTTY === true && !isLogLevelEnabled("debug");+ const animate = options.animate !== false && output.isTTY === true && !isLogLevelEnabled("debug");- // Single-row live region; only the animating path repaints, non-TTY logs once.const live = animate? new LiveRegion({write: (chunk) => {@@ -101,6 +103,9 @@ export function startCliLiveRow(let current: { detail: string; message: string } | undefined;let painted = false;let logged = false;+ let lastLoggedMessage: string | undefined;+ let phaseStartedAt = Date.now();+ let elapsedSeconds = 0;let stopped = false;let pulseTimer: ReturnType<typeof setTimeout> | undefined;@@ -109,7 +114,9 @@ export function startCliLiveRow(const row = renderProgressRow(pulseVisible ? PROGRESS_PULSE_GLYPH : " ",current.message,- current.detail,+ options.elapsed+ ? [current.detail, `${elapsedSeconds}s`].filter(Boolean).join(" · ")+ : current.detail,output.columns,);live.update([row]);@@ -122,8 +129,13 @@ export function startCliLiveRow(if (stopped) return;pulseStepIndex = (pulseStepIndex + 1) % pulseSequence.length;const nextPulseVisible = pulseSequence[pulseStepIndex] === "1";- if (nextPulseVisible !== pulseVisible) {+ const nextElapsedSeconds = Math.floor((Date.now() - phaseStartedAt) / 1_000);+ if (+ nextPulseVisible !== pulseVisible ||+ (options.elapsed && nextElapsedSeconds !== elapsedSeconds)+ ) {pulseVisible = nextPulseVisible;+ elapsedSeconds = nextElapsedSeconds;paint();}schedulePulseStep();@@ -136,14 +148,20 @@ export function startCliLiveRow(return {update(message, detail = "") {if (stopped) return;+ const nextMessage = sanitizeProgressText(message);+ if (current?.message !== nextMessage) {+ phaseStartedAt = Date.now();+ elapsedSeconds = 0;+ }current = {detail: sanitizeProgressText(detail),- message: sanitizeProgressText(message),+ message: nextMessage,};if (!animate) {- if (!logged) {+ if (!logged || (options.logPhases && lastLoggedMessage !== current.message)) {logger.log(`${current.message}...`);logged = true;+ lastLoggedMessage = current.message;}return;}diff --git a/packages/eve/test/scenarios/eve-init.scenario.test.ts b/packages/eve/test/scenarios/eve-init.scenario.test.tsindex d89d9caa6..6b905597c 100644--- a/packages/eve/test/scenarios/eve-init.scenario.test.ts+++ b/packages/eve/test/scenarios/eve-init.scenario.test.ts@@ -7,9 +7,11 @@ import { promisify } from "node:util";import { describe, expect, it } from "vitest";import { CODING_AGENT_ENV_MARKERS } from "../../src/cli/agent-detection.js";+import { stripAnsi } from "../../src/cli/ui/terminal-text.js";import { loadYaml } from "../../src/evals/loaders/yaml.js";import { DEFAULT_AGENT_MODEL_ID } from "../../src/shared/default-agent-model.js";import { pathExists } from "../../src/setup/path-exists.js";+import { eveDevArguments } from "../../src/setup/primitives/run-pnpm.js";import { ensureScenarioEveTarballPath } from "../../src/internal/testing/scenario-app.js";import { useTemporaryDirectories } from "../../src/internal/testing/use-temporary-app-roots.js";@@ -226,11 +228,19 @@ describe("eve init smoke", () => {// pnpm checks the installed lockfile before exec/run and may reinstall.// A one-time install flag must not leave the next command rejecting it.- const dev = await runFile("pnpm", ["exec", "eve", "dev", "--help"], {+ const devArguments = ["--reporter=silent", ...eveDevArguments("pnpm")];+ const dev = await runFile("pnpm", [...devArguments, "--help"], {cwd: projectDir,env,});expect(dev.stdout).toContain("Usage: eve dev");+ expect(dev.stdout).not.toMatch(/Lockfile|Already up to date|Done in/u);+ await expect(+ runFile("pnpm", [...devArguments, "--unknown-init-test-option"], {+ cwd: projectDir,+ env,+ }),+ ).rejects.toMatchObject({ stderr: expect.stringContaining("unknown option") });await expect(runFile("pnpm", ["install", "--frozen-lockfile"], { cwd: projectDir, env }),).resolves.toMatchObject({ stdout: expect.any(String) });@@ -297,10 +307,12 @@ describe("eve init smoke", () => {cwd: canonicalProjectDir,},]);- expect(result.stdout).toContain("Created an eve agent in ");- expect(result.stdout).toContain("Preparing project...");- expect(result.stdout).toContain("Installed dependencies");- expect(result.stdout).not.toContain("Progress: resolved");+ const output = stripAnsi(result.stdout);+ expect(output).toContain(`Created an eve agent in ${canonicalProjectDir} in `);+ expect(output).toContain("Creating agent...");+ expect(output).toContain("Installing dependencies...");+ expect(output).toContain("Initializing Git...");+ expect(output).not.toContain("Progress: resolved");await expect(pathExists(join(projectDir, ".git"))).resolves.toBe(true);await expect(runFile("git", ["log", "-1", "--pretty=%s"], { cwd: projectDir }),diff --git a/packages/eve/test/scenarios/post-build-scripts.scenario.test.ts b/packages/eve/test/scenarios/post-build-scripts.scenario.test.tsindex 0b1d6ee8c..6bcc57e2b 100644--- a/packages/eve/test/scenarios/post-build-scripts.scenario.test.ts+++ b/packages/eve/test/scenarios/post-build-scripts.scenario.test.ts@@ -71,6 +71,61 @@ async function createPostBuildFixture(}describe("post-build scripts", () => {+ it.each(["present", "released"])(+ "copies compiled assets without traversing a %s vendor lock",+ async (lockState) => {+ const packageRoot = await createPostBuildFixture();+ await copyScript(packageRoot, "copy-compiled-assets.mjs");+ const compiledRoot = join(packageRoot, ".generated", "compiled");+ const moduleRoot = join(compiledRoot, "@eve", "catalog");+ const lockPath = join(compiledRoot, ".vendor-lock");+ await mkdir(moduleRoot, { recursive: true });+ await mkdir(lockPath);+ await writeFile(join(moduleRoot, "index.js"), "export const catalog = [];\n");+ await writeFile(join(moduleRoot, "index.d.ts"), "export declare const catalog: [];\n");+ await writeFile(join(lockPath, "owner.json"), '{"pid":123}\n');++ const runnerPath = join(packageRoot, "copy-assets-test.mjs");+ await writeFile(+ runnerPath,+ [+ 'import fs from "node:fs/promises";',+ 'import { syncBuiltinESMExports } from "node:module";',+ 'import { join } from "node:path";',+ 'const lockPath = join(process.cwd(), ".generated", "compiled", ".vendor-lock");',+ ...(lockState === "released"+ ? [+ "const copy = fs.cp;",+ "fs.cp = (source, destination, options) => copy(source, destination, {",+ " ...options,",+ " filter: async (source, destination) => {",+ // Release the lock after cp has enumerated it, before it stats the entry.+ " if (source === lockPath) await fs.rm(lockPath, { recursive: true });",+ " return options.filter?.(source, destination) ?? true;",+ " },",+ "});",+ "syncBuiltinESMExports();",+ ]+ : []),+ 'const { copyCompiledAssets } = await import("./scripts/copy-compiled-assets.mjs");',+ "await copyCompiledAssets();",+ ].join("\n"),+ );+ await runFile(process.execPath, [runnerPath], { cwd: packageRoot });++ const copiedRoot = join(packageRoot, "dist", "src", "compiled");+ await expect(readFile(join(copiedRoot, "@eve", "catalog", "index.js"), "utf8")).resolves.toBe(+ "export const catalog = [];\n",+ );+ await expect(+ readFile(join(copiedRoot, "@eve", "catalog", "index.d.ts"), "utf8"),+ ).resolves.toBe("export declare const catalog: [];\n");+ await expect(access(join(copiedRoot, ".vendor-lock"))).rejects.toThrow();+ if (lockState === "released") await expect(access(lockPath)).rejects.toThrow();+ else await expect(access(join(lockPath, "owner.json"))).resolves.toBeUndefined();+ },+ );+it("copies docs without overwriting the package README", async () => {const packageReadme = "# Package README\nKeep me as-is.\n";const packageRoot = await createPostBuildFixture({ packageReadme });