The Open Framework for Building Agents
fix(eve): avoid repeated init onboarding header (#4238)
Colton Paddenbdba125e11df
diff --git a/.changeset/single-init-header.md b/.changeset/single-init-header.mdnew file mode 100644index 000000000..4fbecd946--- /dev/null+++ b/.changeset/single-init-header.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Avoid repeating the eve header when interactive `eve init` opens onboarding. Standalone init runs still print their header, and all CLI banners now use a single space between the eve wordmark and version.diff --git a/packages/eve/src/cli/banner.ts b/packages/eve/src/cli/banner.tsindex e878b224f..9088c45a5 100644--- a/packages/eve/src/cli/banner.ts+++ b/packages/eve/src/cli/banner.ts@@ -6,18 +6,18 @@ export const EVE_WORDMARK = "eve";/*** The boot banner shared by every CLI command that announces itself: the eve- * badge plus the installed version. Init prints it before its progress row.+ * badge plus the installed version.*/export function eveCliBanner(): string {const { version } = resolveInstalledPackageInfo();- return `${pc.bgBlack(pc.white(`☰${EVE_WORDMARK} `))} ${pc.dim(`v${version}`)}`;+ return `${pc.bgBlack(pc.white(`☰${EVE_WORDMARK}`))} ${pc.dim(`v${version}`)}`;}/**- * The unstyled wordmark-and-version tag (`☰eve v0.24.5`) — the boot banner's+ * The unstyled wordmark-and-version tag (`☰eve v0.24.5`) — the boot banner's* plain-text form. The dev TUI dims it as its parting line on teardown.*/export function eveVersionTag(): string {const { version } = resolveInstalledPackageInfo();- return `☰${EVE_WORDMARK} v${version}`;+ return `☰${EVE_WORDMARK} v${version}`;}diff --git a/packages/eve/src/cli/commands/init-agent-workspace.ts b/packages/eve/src/cli/commands/init-agent-workspace.tsindex f1fea5ca0..c83063983 100644--- a/packages/eve/src/cli/commands/init-agent-workspace.ts+++ b/packages/eve/src/cli/commands/init-agent-workspace.ts@@ -3,6 +3,8 @@ import { join } from "node:path";import pc from "#compiled/picocolors/index.js";+import { eveCliBanner } from "#cli/banner.js";+import { assertValidPublicAgentName } from "#internal/agent-name.js";import { findEveProjectContext } from "#internal/project-context.js";import { resolveInitAgentSettings } from "#shared/default-agent-model.js";@@ -97,6 +99,7 @@ export async function addAgentsToWorkspace(): Promise<boolean> {const context = await findEveProjectContext(workspaceRoot);if (context?.kind !== "workspace") return false;+ logger.log(eveCliBanner());if (options.channelWebNextjs === true) {throw new InitTargetError("workspace_input",diff --git a/packages/eve/src/cli/commands/init.integration.test.ts b/packages/eve/src/cli/commands/init.integration.test.tsindex f19a50218..f1975711a 100644--- a/packages/eve/src/cli/commands/init.integration.test.ts+++ b/packages/eve/src/cli/commands/init.integration.test.ts@@ -240,6 +240,7 @@ describe("runInitCommand", () => {client,renderer,appRoot: projectPath,+ serverUrl: "http://eve-test.invalid",onboard: true,bootDetections: [],onBootProgress: report,@@ -267,6 +268,8 @@ describe("runInitCommand", () => {input.enter();await screen.waitForText("Hello Alice, your agent is ready.");await screen.waitForIdlePrompt();+ expect(output.messages.join("\n")).not.toContain("☰eve");+ expect(stripAnsi(screen.rawOutput())).toContain("☰eve v");input.type("/exit");input.enter();await run;@@ -284,48 +287,53 @@ describe("runInitCommand", () => {);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,+ { interactive: true, agent: false, nonInteractive: false },+ { interactive: false, agent: false, nonInteractive: false },+ { interactive: true, agent: true, nonInteractive: false },+ { interactive: true, agent: false, nonInteractive: true },+ ])(+ "keeps init inline with the shell command (%j)",+ async ({ interactive, agent, nonInteractive }) => {+ 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),);- 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);+ 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", { nonInteractive }, deps);+ const transcript = stripAnsi(screen.snapshot());+ const startsDevelopment = interactive && !agent && !nonInteractive;+ expect(transcript.startsWith(shellOutput)).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 v/gu) ?? []).toHaveLength(startsDevelopment ? 0 : 1);+ expect(deps.spawnPackageManager).toHaveBeenCalledTimes(startsDevelopment ? 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-"));@@ -393,6 +401,11 @@ describe("runInitCommand", () => {model: "openai/gpt-6-luna-fast",reasoning: undefined,},+ {+ options: { nonInteractive: true },+ model: "openai/gpt-6-luna-fast",+ reasoning: "high",+ },])("adds only agent files to an existing workspace with $options",async ({ options, model, reasoning }) => {@@ -425,6 +438,10 @@ describe("runInitCommand", () => {);expect(deps.runPackageManagerInstall).not.toHaveBeenCalled();expect(deps.tryInitializeGit).not.toHaveBeenCalled();+ expect(deps.spawnPackageManager).not.toHaveBeenCalled();+ const transcript = stripAnsi(output.messages.join("\n"));+ expect(transcript.match(/☰eve v/gu)).toHaveLength(1);+ expect(transcript.indexOf("☰eve v")).toBeLessThan(transcript.indexOf("✓ Added agent"));},);@@ -521,16 +538,15 @@ describe("runInitCommand", () => {"--onboard",]);const messages = output.messages.map(stripAnsi);- expect(messages).toHaveLength(7);+ expect(messages).toHaveLength(6);expect(messages[0]).toBe("");- expect(messages[1]).toContain("☰eve");- expect(messages.slice(2, 5)).toEqual([+ expect(messages.slice(1, 4)).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[4]).toBe(`✓ Created an eve agent in ${projectPath} in 13.8s`);+ expect(messages[5]).toBe("");expect(messages.join("\n")).not.toContain("$ eve dev");expect(output.messages.join("\n")).not.toContain("Instructions ");});diff --git a/packages/eve/src/cli/commands/init.ts b/packages/eve/src/cli/commands/init.tsindex d2eb11ffc..14474abe1 100644--- a/packages/eve/src/cli/commands/init.ts+++ b/packages/eve/src/cli/commands/init.ts@@ -494,8 +494,8 @@ export async function runInitCommand(): Promise<void> {const agentLaunched = await dependencies.isCodingAgentLaunch();const interactive = dependencies.hasInteractiveTerminal();+ const startDevelopment = interactive && !agentLaunched && !options.nonInteractive;if (interactive && !agentLaunched) logger.log("");- logger.log(eveCliBanner());trackStep?.("resolve_target");let result: InitResult;@@ -514,6 +514,7 @@ export async function runInitCommand(return;}+ if (!startDevelopment) logger.log(eveCliBanner());result = await runInitSteps({agentLaunched,interactive,@@ -582,7 +583,7 @@ export async function runInitCommand(return;}- if (options.nonInteractive || !interactive) {+ if (!startDevelopment) {logger.log(agentHandoff);return;}diff --git a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts b/packages/eve/src/cli/dev/tui/terminal-renderer.test.tsindex b20091ce7..ab2eca73e 100644--- a/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts+++ b/packages/eve/src/cli/dev/tui/terminal-renderer.test.ts@@ -218,8 +218,8 @@ describe("TerminalRenderer (inline scrollback)", () => {renderer.shutdown();const lines = screen.snapshot().trimEnd().split("\n");- expect(lines.at(-1)).toMatch(/^☰eve {2}v\d+\.\d+\.\d+/u);- expect(screen.rawOutput()).toContain(`\x1b[2m☰eve v`);+ expect(lines.at(-1)).toMatch(/^☰eve v\d+\.\d+\.\d+/u);+ expect(screen.rawOutput()).toContain(`\x1b[2m☰eve v`);// Once, ever — repeated teardown must not repeat the tag.renderer.shutdown();expect(screen.snapshot().match(/☰eve/gu)).toHaveLength(1);@@ -240,7 +240,7 @@ describe("TerminalRenderer (inline scrollback)", () => {renderer.shutdown();const lines = screen.snapshot().trimEnd().split("\n");- expect(lines.at(-1)).toMatch(/^☰eve {2}v\d+\.\d+\.\d+ · session ses_0123456789$/u);+ expect(lines.at(-1)).toMatch(/^☰eve v\d+\.\d+\.\d+ · session ses_0123456789$/u);// Repeated reports keep the latest id; a renderer that never received// one prints the bare tag.@@ -2005,9 +2005,8 @@ describe("TerminalRenderer (inline scrollback)", () => {// Every runtime-artifacts change re-sends the header; an identical one// must not stack another banner under the transcript.renderer.renderAgentHeader({ name: "Weather Agent", serverUrl: "http://localhost:3000" });- renderer.shutdown();-expect(countOccurrences(screen.snapshot(), "☰eve v")).toBe(1);+ renderer.shutdown();});it("reset clears committed transcript rows", () => {