chore(deps): Kill small dependencies (#4467)
This commit is contained in:
22
packages/coding-agent/test/ansi-utils.test.ts
Normal file
22
packages/coding-agent/test/ansi-utils.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { stripAnsi } from "../src/utils/ansi.js";
|
||||
|
||||
describe("stripAnsi", () => {
|
||||
it("strips RIS without leaking the final byte", () => {
|
||||
expect(stripAnsi("\x1bcdone")).toBe("done");
|
||||
});
|
||||
|
||||
it("strips single-byte ESC sequences without leaking final bytes", () => {
|
||||
for (let code = "g".charCodeAt(0); code <= "m".charCodeAt(0); code++) {
|
||||
expect(stripAnsi(`\x1b${String.fromCharCode(code)}ok`)).toBe("ok");
|
||||
}
|
||||
for (let code = "r".charCodeAt(0); code <= "t".charCodeAt(0); code++) {
|
||||
expect(stripAnsi(`\x1b${String.fromCharCode(code)}ok`)).toBe("ok");
|
||||
}
|
||||
});
|
||||
|
||||
it("strips common ANSI sequences used in tool output", () => {
|
||||
const input = "a\x1b[31mred\x1b[0m\x1b]8;;https://example.com\x07link\x1b]8;;\x07z";
|
||||
expect(stripAnsi(input)).toBe("aredlinkz");
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,4 @@
|
||||
import { setKeybindings } from "@earendil-works/pi-tui";
|
||||
import stripAnsi from "strip-ansi";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { AuthStorage } from "../src/core/auth-storage.js";
|
||||
import { KeybindingsManager } from "../src/core/keybindings.js";
|
||||
@@ -7,6 +6,7 @@ import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "../src/core/provider-display-na
|
||||
import { OAuthSelectorComponent } from "../src/modes/interactive/components/oauth-selector.js";
|
||||
import { isApiKeyLoginProvider } from "../src/modes/interactive/interactive-mode.js";
|
||||
import { initTheme } from "../src/modes/interactive/theme/theme.js";
|
||||
import { stripAnsi } from "../src/utils/ansi.js";
|
||||
|
||||
const originalOpenAiApiKey = process.env.OPENAI_API_KEY;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { setKeybindings, type TUI } from "@earendil-works/pi-tui";
|
||||
import stripAnsi from "strip-ansi";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { KeybindingsManager } from "../../../src/core/keybindings.js";
|
||||
import { ModelSelectorComponent } from "../../../src/modes/interactive/components/model-selector.js";
|
||||
import { ScopedModelsSelectorComponent } from "../../../src/modes/interactive/components/scoped-models-selector.js";
|
||||
import { initTheme } from "../../../src/modes/interactive/theme/theme.js";
|
||||
import { stripAnsi } from "../../../src/utils/ansi.js";
|
||||
import { createHarness, type Harness } from "../harness.js";
|
||||
|
||||
function createFakeTui(): TUI {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
||||
import type { AssistantMessage, ToolResultMessage, Usage } from "@earendil-works/pi-ai";
|
||||
import { Container, Text, type TUI } from "@earendil-works/pi-tui";
|
||||
import stripAnsi from "strip-ansi";
|
||||
import { beforeAll, describe, expect, test, vi } from "vitest";
|
||||
import type { AgentSessionEvent } from "../../../src/core/agent-session.js";
|
||||
import type { SessionContext } from "../../../src/core/session-manager.js";
|
||||
import type { ToolExecutionComponent } from "../../../src/modes/interactive/components/tool-execution.js";
|
||||
import { InteractiveMode } from "../../../src/modes/interactive/interactive-mode.js";
|
||||
import { initTheme } from "../../../src/modes/interactive/theme/theme.js";
|
||||
import { stripAnsi } from "../../../src/utils/ansi.js";
|
||||
|
||||
const TOOL_CALL_ID = "tool-4167";
|
||||
const TOOL_NAME = "slow_tool";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { join, resolve } from "node:path";
|
||||
import { Text, type TUI } from "@earendil-works/pi-tui";
|
||||
import stripAnsi from "strip-ansi";
|
||||
import { Type } from "typebox";
|
||||
import { beforeAll, describe, expect, test } from "vitest";
|
||||
import { getReadmePath } from "../src/config.js";
|
||||
@@ -10,6 +9,7 @@ import { createReadTool, createReadToolDefinition } from "../src/core/tools/read
|
||||
import { createWriteToolDefinition } from "../src/core/tools/write.js";
|
||||
import { ToolExecutionComponent } from "../src/modes/interactive/components/tool-execution.js";
|
||||
import { initTheme } from "../src/modes/interactive/theme/theme.js";
|
||||
import { stripAnsi } from "../src/utils/ansi.js";
|
||||
|
||||
function createBaseToolDefinition(name = "custom_tool"): ToolDefinition {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user