chore(cli): address PR review feedback

Three small follow-ups raised by reviewers on #2039:

- Remove stale findFreePort mock in autoCreateConfig test — the function
  no longer calls findFreePort, so the mock setup was dead code
- Drop misleading "⚠ Could not register project in global config" warning
  printed immediately before rethrowing. The yellow warning visually
  signalled a recoverable-and-continuing flow, but the function now
  throws fatally. Let the thrown error propagate to the caller for
  presentation; the registerProjectInGlobalConfig error message is
  descriptive enough on its own
- Add trailing newline to cli-first-run-config.integration.test.ts

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
suraj-markup 2026-05-23 21:44:57 +05:30
parent bd364a92e1
commit 801ccaec6a
3 changed files with 1 additions and 7 deletions

View File

@ -2389,9 +2389,6 @@ describe("start command — autoCreateConfig", () => {
vi.mocked(detectAvailableAgents).mockResolvedValue([]);
vi.mocked(detectAgentRuntime).mockResolvedValue("claude-code");
const { findFreePort } = await import("../../src/lib/web-dir.js");
vi.mocked(findFreePort).mockResolvedValue(3000);
// start.ts uses `import { cwd } from "node:process"` which is intercepted
// by the node:process mock defined at the top of this file.
mockProcessCwd.mockReturnValue(tmpDir);

View File

@ -590,9 +590,6 @@ export async function autoCreateConfig(workingDir: string): Promise<Orchestrator
console.log(chalk.green(`✓ Registered "${registeredProjectId}" in global config\n`));
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
console.log(chalk.yellow("⚠ Could not register project in global config."));
console.log(chalk.dim(` ${message}\n`));
rmSync(outputPath, { force: true });
throw err;
}

View File

@ -99,4 +99,4 @@ describe.skipIf(!canRun)("CLI first-run config generation (integration)", () =>
expect(fromLocal.projects[projectId].path).toBe(repoPath);
expect(fromGlobal.projects[projectId].path).toBe(repoPath);
}, 90_000);
});
});