mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-28 19:11:03 +08:00
9fa90ee638
* feat(vscode): support @terminal context mention in chat and agent manager * docs: add @terminal to new extension docs tabs * fix(vscode): revert toggleRemote extraction, remove plan file, extract terminal handler method * chore: add changeset for @terminal feature and document changeset process in AGENTS.md
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "bun:test"
|
|
import {
|
|
buildTerminalAttachment,
|
|
findTerminalMention,
|
|
hasTerminalMention,
|
|
} from "../../webview-ui/src/hooks/terminal-context-utils"
|
|
|
|
describe("terminal context utils", () => {
|
|
it("detects standalone terminal mentions", () => {
|
|
expect(hasTerminalMention("see @terminal output")).toBe(true)
|
|
expect(hasTerminalMention("see foo@terminal output")).toBe(false)
|
|
expect(hasTerminalMention("see @terminal-output")).toBe(false)
|
|
})
|
|
|
|
it("returns mention source range", () => {
|
|
expect(findTerminalMention("hello @terminal")!).toEqual({ value: "@terminal", start: 6, end: 15 })
|
|
})
|
|
|
|
it("builds a text attachment with source metadata", () => {
|
|
const attachment = buildTerminalAttachment("check @terminal", "npm failed")!
|
|
expect(attachment.mime).toBe("text/plain")
|
|
expect(attachment.filename).toBe("terminal-output.txt")
|
|
expect(attachment.url).toBe("data:text/plain;charset=utf-8,npm%20failed")
|
|
expect(attachment.source?.text).toEqual({ value: "@terminal", start: 6, end: 15 })
|
|
})
|
|
})
|