summaryrefslogtreecommitdiffhomepage
path: root/js/example/cli.ts
blob: 9c9e07edd0f067b85efdfff67818b3b0116d360c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { App } from "../src/app";
import path from "path";
import { edit } from "../src/tool";
import { FileTimes } from "../src/tool/util/file-times";

await App.provide({ directory: process.cwd() }, async () => {
  const file = path.join(process.cwd(), "example/broken.ts");
  FileTimes.read(file);
  const tool = await edit.execute(
    {
      file_path: file,
      old_string: "x:",
      new_string: "x:",
    },
    {
      toolCallId: "test",
      messages: [],
    },
  );
  console.log(tool.output);
});