chore: drop non-code junk (pi-mono-reference, runtime state, root duplicates)
Remove files that should never have been tracked: - pi-mono-reference/: 688-file copy of an upstream monorepo, zero imports, used only as offline human reference - build/electron-builder.runtime.json: environment-specific build artifact with hardcoded local paths - state/cancel-signal-state.json: runtime state written by the app - prompt.txt, logo.svg (root): exact duplicates of the canonical copies under .planning/archive/ and assets/ Add state/ to .gitignore so future runtime state stays out.
This commit is contained in:
1 parent
34ca5b77f1
commit
1f7230fe87
691 files changed
+3
-190434
No files matched your search
@@ -1,111 +0,0 @@
|
||||
import { setKeybindings } from "@mariozechner/pi-tui";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { KeybindingsManager } from "../src/core/keybindings.js";
|
||||
import type { SessionInfo } from "../src/core/session-manager.js";
|
||||
import { SessionSelectorComponent } from "../src/modes/interactive/components/session-selector.js";
|
||||
import { initTheme } from "../src/modes/interactive/theme/theme.js";
|
||||
|
||||
async function flushPromises(): Promise<void> {
|
||||
await new Promise<void>((resolve) => {
|
||||
setImmediate(resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function makeSession(overrides: Partial<SessionInfo> & { id: string }): SessionInfo {
|
||||
return {
|
||||
path: overrides.path ?? `/tmp/${overrides.id}.jsonl`,
|
||||
id: overrides.id,
|
||||
cwd: overrides.cwd ?? "",
|
||||
name: overrides.name,
|
||||
created: overrides.created ?? new Date(0),
|
||||
modified: overrides.modified ?? new Date(0),
|
||||
messageCount: overrides.messageCount ?? 1,
|
||||
firstMessage: overrides.firstMessage ?? "hello",
|
||||
allMessagesText: overrides.allMessagesText ?? "hello",
|
||||
};
|
||||
}
|
||||
|
||||
// Kitty keyboard protocol encoding for Ctrl+R
|
||||
const CTRL_R = "\x1b[114;5u";
|
||||
|
||||
describe("session selector rename", () => {
|
||||
beforeAll(() => {
|
||||
initTheme("dark");
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// Ensure test isolation: keybindings are a global singleton
|
||||
setKeybindings(new KeybindingsManager());
|
||||
});
|
||||
|
||||
it("shows rename hint in interactive /resume picker configuration", async () => {
|
||||
const sessions = [makeSession({ id: "a" })];
|
||||
const keybindings = new KeybindingsManager();
|
||||
const selector = new SessionSelectorComponent(
|
||||
async () => sessions,
|
||||
async () => [],
|
||||
() => {},
|
||||
() => {},
|
||||
() => {},
|
||||
() => {},
|
||||
{ showRenameHint: true, keybindings },
|
||||
);
|
||||
await flushPromises();
|
||||
|
||||
const output = selector.render(120).join("\n");
|
||||
expect(output).toContain("ctrl+r");
|
||||
expect(output).toContain("rename");
|
||||
});
|
||||
|
||||
it("does not show rename hint in --resume picker configuration", async () => {
|
||||
const sessions = [makeSession({ id: "a" })];
|
||||
const keybindings = new KeybindingsManager();
|
||||
const selector = new SessionSelectorComponent(
|
||||
async () => sessions,
|
||||
async () => [],
|
||||
() => {},
|
||||
() => {},
|
||||
() => {},
|
||||
() => {},
|
||||
{ showRenameHint: false, keybindings },
|
||||
);
|
||||
await flushPromises();
|
||||
|
||||
const output = selector.render(120).join("\n");
|
||||
expect(output).not.toContain("ctrl+r");
|
||||
expect(output).not.toContain("rename");
|
||||
});
|
||||
|
||||
it("enters rename mode on Ctrl+R and submits with Enter", async () => {
|
||||
const sessions = [makeSession({ id: "a", name: "Old" })];
|
||||
const renameSession = vi.fn(async () => {});
|
||||
|
||||
const keybindings = new KeybindingsManager();
|
||||
const selector = new SessionSelectorComponent(
|
||||
async () => sessions,
|
||||
async () => [],
|
||||
() => {},
|
||||
() => {},
|
||||
() => {},
|
||||
() => {},
|
||||
{ renameSession, showRenameHint: true, keybindings },
|
||||
);
|
||||
await flushPromises();
|
||||
|
||||
selector.getSessionList().handleInput(CTRL_R);
|
||||
await flushPromises();
|
||||
|
||||
// Rename mode layout
|
||||
const output = selector.render(120).join("\n");
|
||||
expect(output).toContain("Rename Session");
|
||||
expect(output).not.toContain("Resume Session");
|
||||
|
||||
// Type and submit
|
||||
selector.handleInput("X");
|
||||
selector.handleInput("\r");
|
||||
await flushPromises();
|
||||
|
||||
expect(renameSession).toHaveBeenCalledTimes(1);
|
||||
expect(renameSession).toHaveBeenCalledWith(sessions[0]!.path, "XOld");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user