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,53 +0,0 @@
|
||||
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("../src/utils/image-resize.js", () => ({
|
||||
resizeImage: vi.fn(),
|
||||
formatDimensionNote: vi.fn(() => undefined),
|
||||
}));
|
||||
|
||||
import { processFileArguments } from "../src/cli/file-processor.js";
|
||||
import { createReadTool } from "../src/core/tools/read.js";
|
||||
import { resizeImage } from "../src/utils/image-resize.js";
|
||||
|
||||
const TINY_PNG_BASE64 =
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8DwHwAFBQIAX8jx0gAAAABJRU5ErkJggg==";
|
||||
|
||||
describe("image resize callers", () => {
|
||||
let testDir: string;
|
||||
|
||||
beforeEach(() => {
|
||||
testDir = join(tmpdir(), `image-resize-callers-${Date.now()}`);
|
||||
mkdirSync(testDir, { recursive: true });
|
||||
vi.mocked(resizeImage).mockReset();
|
||||
vi.mocked(resizeImage).mockResolvedValue(null);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
rmSync(testDir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("read tool returns text-only output when auto-resize cannot produce a safe image", async () => {
|
||||
const imagePath = join(testDir, "test.png");
|
||||
writeFileSync(imagePath, Buffer.from(TINY_PNG_BASE64, "base64"));
|
||||
|
||||
const tool = createReadTool(testDir);
|
||||
const result = await tool.execute("test-read-image", { path: imagePath });
|
||||
|
||||
expect(result.content).toHaveLength(1);
|
||||
expect(result.content[0].type).toBe("text");
|
||||
expect((result.content[0] as { type: "text"; text: string }).text).toContain("Image omitted");
|
||||
});
|
||||
|
||||
it("file processor omits image attachments when auto-resize cannot produce a safe image", async () => {
|
||||
const imagePath = join(testDir, "test.png");
|
||||
writeFileSync(imagePath, Buffer.from(TINY_PNG_BASE64, "base64"));
|
||||
|
||||
const result = await processFileArguments([imagePath]);
|
||||
|
||||
expect(result.images).toHaveLength(0);
|
||||
expect(result.text).toContain("Image omitted");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user