This commit is contained in:
Dax Raad
2025-05-30 20:47:56 -04:00
parent 9a26b3058f
commit f3da73553c
178 changed files with 765 additions and 3382 deletions

View File

@@ -0,0 +1,17 @@
// Bun Snapshot v1, https://goo.gl/fbAQLP
exports[`tool.ls basic 1`] = `
"- /home/thdxr/dev/projects/sst/opencode/js/example/
- home/
- thdxr/
- dev/
- projects/
- sst/
- opencode/
- js/
- example/
- ink.tsx
- broken.ts
- cli.ts
"
`;

View File

@@ -0,0 +1,55 @@
import { describe, expect, test } from "bun:test";
import { App } from "../../src/app/app";
import { glob } from "../../src/tool/glob";
import { ls } from "../../src/tool/ls";
describe("tool.glob", () => {
test("truncate", async () => {
await App.provide({ directory: process.cwd() }, async () => {
let result = await glob.execute(
{
pattern: "./node_modules/**/*",
},
{
toolCallId: "test",
messages: [],
},
);
expect(result.metadata.truncated).toBe(true);
});
});
test("basic", async () => {
await App.provide({ directory: process.cwd() }, async () => {
let result = await glob.execute(
{
pattern: "*.json",
},
{
toolCallId: "test",
messages: [],
},
);
expect(result.metadata).toMatchObject({
truncated: false,
count: 2,
});
});
});
});
describe("tool.ls", () => {
test("basic", async () => {
const result = await App.provide({ directory: process.cwd() }, async () => {
return await ls.execute(
{
path: "./example",
},
{
toolCallId: "test",
messages: [],
},
);
});
expect(result.output).toMatchSnapshot();
});
});