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