fix(cli): simplify spawn success message, use ao session attach (#947)
Replace verbose multi-line spawn output (worktree, branch, raw tmux attach) with a single-line message that directs users to the dashboard or `ao session attach <id>` instead of exposing internal tmux session hashes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fe6fb4f7a2
commit
5ad370e8d1
|
|
@ -281,7 +281,7 @@ describe("spawn command", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("shows tmux attach command using runtimeHandle.id (hash-based name)", async () => {
|
||||
it("shows ao session attach command instead of raw tmux attach", async () => {
|
||||
const fakeSession: Session = {
|
||||
id: "app-7",
|
||||
projectId: "my-app",
|
||||
|
|
@ -303,7 +303,9 @@ describe("spawn command", () => {
|
|||
await program.parseAsync(["node", "test", "spawn"]);
|
||||
|
||||
const output = consoleSpy.mock.calls.map((c) => String(c[0])).join("\n");
|
||||
expect(output).toContain("8474d6f29887-app-7");
|
||||
expect(output).toContain("ao session attach app-7");
|
||||
expect(output).not.toContain("tmux attach");
|
||||
expect(output).not.toContain("8474d6f29887-app-7");
|
||||
});
|
||||
|
||||
it("passes --agent flag to sessionManager.spawn()", async () => {
|
||||
|
|
@ -432,7 +434,7 @@ describe("spawn command", () => {
|
|||
|
||||
const output = consoleSpy.mock.calls.map((c) => String(c[0])).join("\n");
|
||||
expect(output).toContain("https://github.com/org/repo/pull/123");
|
||||
expect(output).toContain("feat/claimed-pr");
|
||||
expect(output).toContain("ao session attach app-1");
|
||||
});
|
||||
|
||||
it("passes GitHub assignment flag through to claimPR", async () => {
|
||||
|
|
|
|||
|
|
@ -102,7 +102,6 @@ async function spawnSession(
|
|||
agent,
|
||||
});
|
||||
|
||||
let branchStr = session.branch ?? "";
|
||||
let claimedPrUrl: string | null = null;
|
||||
|
||||
if (claimOptions?.claimPr) {
|
||||
|
|
@ -111,7 +110,6 @@ async function spawnSession(
|
|||
const claimResult = await sm.claimPR(session.id, claimOptions.claimPr, {
|
||||
assignOnGithub: claimOptions.assignOnGithub,
|
||||
});
|
||||
branchStr = claimResult.pr.branch;
|
||||
claimedPrUrl = claimResult.pr.url;
|
||||
} catch (err) {
|
||||
throw new Error(
|
||||
|
|
@ -127,14 +125,16 @@ async function spawnSession(
|
|||
: `Session ${chalk.green(session.id)} created`,
|
||||
);
|
||||
|
||||
console.log(` Worktree: ${chalk.dim(session.workspacePath ?? "-")}`);
|
||||
if (branchStr) console.log(` Branch: ${chalk.dim(branchStr)}`);
|
||||
if (claimedPrUrl) console.log(` PR: ${chalk.dim(claimedPrUrl)}`);
|
||||
const issueLabel = issueId ? ` for issue #${issueId}` : "";
|
||||
const claimLabel = claimedPrUrl ? ` (claimed ${claimedPrUrl})` : "";
|
||||
console.log(
|
||||
`Session ${session.id} spawned${issueLabel}${claimLabel}. ` +
|
||||
`View it in the dashboard or attach with: ${chalk.cyan(`ao session attach ${session.id}`)}`,
|
||||
);
|
||||
|
||||
// Warn if prompt delivery failed (for post-launch agents like Claude Code)
|
||||
const promptDelivered = session.metadata?.promptDelivered;
|
||||
if (promptDelivered === "false") {
|
||||
console.log();
|
||||
console.warn(
|
||||
chalk.yellow(
|
||||
` ⚠ Prompt delivery failed — agent may be idle.\n` +
|
||||
|
|
@ -143,14 +143,10 @@ async function spawnSession(
|
|||
);
|
||||
}
|
||||
|
||||
// Show the tmux name for attaching (stored in metadata or runtimeHandle)
|
||||
const tmuxTarget = session.runtimeHandle?.id ?? session.id;
|
||||
console.log(` Attach: ${chalk.dim(`tmux attach -t ${tmuxTarget}`)}`);
|
||||
console.log();
|
||||
|
||||
// Open terminal tab if requested
|
||||
if (openTab) {
|
||||
try {
|
||||
const tmuxTarget = session.runtimeHandle?.id ?? session.id;
|
||||
await exec("open-iterm-tab", [tmuxTarget]);
|
||||
} catch {
|
||||
// Terminal plugin not available
|
||||
|
|
|
|||
Loading…
Reference in New Issue