Files
Netcatty/components/QuickAddSnippetDialog.test.tsx
陈大猫 ae209d37c1 feat(terminal): remote command history side panel (#1385)
* feat(terminal): add remote command history side panel

Read remote shell history over SSH/ET/Mosh exec channels, browse it in a virtualized side panel with search, paste, and save-as-snippet actions. Closes #1381.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(history): expand command detail inline below selected row

Move the detail strip from a fixed slot above the list into the row
immediately below the clicked entry so expansion reads top-to-bottom.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(history): filter Netcatty AI PTY commands from remote history

Drop shell history lines containing the __NCMCP_ marker so AI exec noise
does not clutter the command history panel.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(history): tighten detail strip and add run action

Size the expanded row to its content, add a run-in-terminal button, and
use clearer snippet icon/tooltip for save-as-snippet.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(history): address review findings before merge

Key cache by host+session, retry Mosh pending reads, and clamp virtual
list scroll position when filtered items shrink.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 23:19:31 +08:00

23 lines
659 B
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { getQuickAddSnippetInitialCommand } from "./QuickAddSnippetDialog.tsx";
test("quick add snippet event can prefill command", () => {
const event = {
detail: { command: "ls -la\npwd" },
} as CustomEvent<{ command?: string }>;
assert.equal(getQuickAddSnippetInitialCommand(event), "ls -la\npwd");
});
test("quick add snippet event defaults to an empty command", () => {
assert.equal(getQuickAddSnippetInitialCommand({} as Event), "");
assert.equal(
getQuickAddSnippetInitialCommand({
detail: { command: 123 },
} as unknown as Event),
"",
);
});