From de9f144858107b4230f44956283542bd137bffb6 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Mon, 26 May 2025 17:15:41 -0400 Subject: sync --- js/example/broken.ts | 1 + js/example/cli.ts | 44 +++++++++++++++++++------------------------- 2 files changed, 20 insertions(+), 25 deletions(-) create mode 100644 js/example/broken.ts (limited to 'js/example') diff --git a/js/example/broken.ts b/js/example/broken.ts new file mode 100644 index 000000000..e073ad008 --- /dev/null +++ b/js/example/broken.ts @@ -0,0 +1 @@ +export const x: number = "asd"; diff --git a/js/example/cli.ts b/js/example/cli.ts index bb7522cbb..9c9e07edd 100644 --- a/js/example/cli.ts +++ b/js/example/cli.ts @@ -1,27 +1,21 @@ -import { hc } from "hono/client"; -import type { Server } from "../src/server/server"; +import { App } from "../src/app"; +import path from "path"; +import { edit } from "../src/tool"; +import { FileTimes } from "../src/tool/util/file-times"; -const message = process.argv.slice(2).join(" "); -console.log(message); - -const client = hc(`http://localhost:16713`); -const session = await client.session_create.$post().then((res) => res.json()); -const result = await client.session_chat - .$post({ - json: { - sessionID: session.id, - parts: [ - { - type: "text", - text: message, - }, - ], +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:", }, - }) - .then((res) => res.json()); - -for (const part of result.parts) { - if (part.type === "text") { - console.log(part.text); - } -} + { + toolCallId: "test", + messages: [], + }, + ); + console.log(tool.output); +}); -- cgit v1.2.3