feat(grep): added grep CLI, diff highlighting, FileReader abstraction, and markdown improvements
- Added grep CLI subcommand with support for pattern matching, file globbing, context lines, and multiple output modes (content, files-with-matches, count). - Added diff syntax highlighting support with distinct colors for inserted and deleted lines in code output. - Implemented FileReader abstraction for cross-platform file reading with mmap support and 4MB size limit. - Refactored worker pool initialization to support both compiled and development build environments using resolveWorkerSpecifier utility. - Enhanced markdown rendering with improved inline style context handling and blockquote formatting with text wrapping. - Replaced external strip-ansi dependency with Bun's built-in stripANSI method across all packages.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { getThemeByName } from "@oh-my-pi/pi-coding-agent/modes/theme/theme";
|
||||
import { pythonToolRenderer } from "@oh-my-pi/pi-coding-agent/tools/python";
|
||||
import stripAnsi from "strip-ansi";
|
||||
|
||||
describe("pythonToolRenderer", () => {
|
||||
it("renders truncated output when collapsed and full output when expanded", async () => {
|
||||
@@ -32,13 +31,13 @@ describe("pythonToolRenderer", () => {
|
||||
{ expanded: false, isPartial: false, renderContext: { previewLines: 2 } },
|
||||
uiTheme,
|
||||
);
|
||||
const collapsedLines = stripAnsi(collapsed.render(80).join("\n"));
|
||||
const collapsedLines = Bun.stripANSI(collapsed.render(80).join("\n"));
|
||||
expect(collapsedLines).toContain("line 4");
|
||||
expect(collapsedLines).not.toContain("line 1");
|
||||
expect(collapsedLines).toContain("more lines");
|
||||
|
||||
const expanded = pythonToolRenderer.renderResult(result, { expanded: true, isPartial: false }, uiTheme);
|
||||
const expandedLines = stripAnsi(expanded.render(80).join("\n"));
|
||||
const expandedLines = Bun.stripANSI(expanded.render(80).join("\n"));
|
||||
expect(expandedLines).toContain("line 1");
|
||||
expect(expandedLines).toContain("line 4");
|
||||
expect(expandedLines).not.toContain("more lines");
|
||||
|
||||
Reference in New Issue
Block a user