fix: add -l flag to tmux send-keys and remove dead activityIndicator code
- Add literal (-l) flag to send-keys so user text isn't interpreted as tmux key names (e.g. "Enter", "Escape") - Remove unused activityIndicator function from format.ts and its tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1de3223554
commit
56e3f0b345
|
|
@ -90,11 +90,12 @@ describe("send command", () => {
|
|||
|
||||
await program.parseAsync(["node", "test", "send", "my-session", "hello", "world"]);
|
||||
|
||||
// Should have sent keys
|
||||
// Should have sent keys with -l (literal) flag
|
||||
expect(mockExec).toHaveBeenCalledWith("tmux", [
|
||||
"send-keys",
|
||||
"-t",
|
||||
"my-session",
|
||||
"-l",
|
||||
"hello world",
|
||||
]);
|
||||
// Should have sent Enter
|
||||
|
|
@ -139,6 +140,7 @@ describe("send command", () => {
|
|||
"send-keys",
|
||||
"-t",
|
||||
"my-session",
|
||||
"-l",
|
||||
"fix the bug",
|
||||
]);
|
||||
});
|
||||
|
|
@ -159,7 +161,7 @@ describe("send command", () => {
|
|||
await program.parseAsync(["node", "test", "send", "--no-wait", "my-session", "urgent"]);
|
||||
|
||||
// Should have sent the message without waiting
|
||||
expect(mockExec).toHaveBeenCalledWith("tmux", ["send-keys", "-t", "my-session", "urgent"]);
|
||||
expect(mockExec).toHaveBeenCalledWith("tmux", ["send-keys", "-t", "my-session", "-l", "urgent"]);
|
||||
});
|
||||
|
||||
it("detects queued message state", async () => {
|
||||
|
|
@ -219,7 +221,7 @@ describe("send command", () => {
|
|||
|
||||
await program.parseAsync(["node", "test", "send", "my-session", "short", "msg"]);
|
||||
|
||||
expect(mockExec).toHaveBeenCalledWith("tmux", ["send-keys", "-t", "my-session", "short msg"]);
|
||||
expect(mockExec).toHaveBeenCalledWith("tmux", ["send-keys", "-t", "my-session", "-l", "short msg"]);
|
||||
});
|
||||
|
||||
it("clears partial input before sending", async () => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import { formatAge, statusColor, activityIndicator, header, banner } from "../../src/lib/format.js";
|
||||
import { formatAge, statusColor, header, banner } from "../../src/lib/format.js";
|
||||
|
||||
describe("formatAge", () => {
|
||||
beforeEach(() => {
|
||||
|
|
@ -57,20 +57,6 @@ describe("statusColor", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("activityIndicator", () => {
|
||||
it("returns indicator for each state", () => {
|
||||
expect(activityIndicator("active")).toBeTruthy();
|
||||
expect(activityIndicator("idle")).toBeTruthy();
|
||||
expect(activityIndicator("waiting_input")).toBeTruthy();
|
||||
expect(activityIndicator("blocked")).toBeTruthy();
|
||||
expect(activityIndicator("exited")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("returns fallback for unknown state", () => {
|
||||
expect(activityIndicator("unknown")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("header", () => {
|
||||
it("returns multiline box drawing string", () => {
|
||||
const result = header("My Project");
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ export function registerSend(program: Command): void {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
await exec("tmux", ["send-keys", "-t", session, msg]);
|
||||
await exec("tmux", ["send-keys", "-t", session, "-l", msg]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,20 +55,3 @@ export function statusColor(status: string): string {
|
|||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
export function activityIndicator(activity: string): string {
|
||||
switch (activity) {
|
||||
case "active":
|
||||
return chalk.green("●");
|
||||
case "idle":
|
||||
return chalk.yellow("○");
|
||||
case "waiting_input":
|
||||
return chalk.magenta("◉");
|
||||
case "blocked":
|
||||
return chalk.red("✖");
|
||||
case "exited":
|
||||
return chalk.gray("◌");
|
||||
default:
|
||||
return chalk.dim("?");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue