refactor main

This commit is contained in:
David Blass
2025-12-17 16:28:17 -05:00
parent 1f1c1602c5
commit 90ed2648be
24 changed files with 638 additions and 546 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import { relative, resolve } from "node:path";
import { type } from "arktype";
import type { ToolContext } from "../main.ts";
import { $ } from "../utils/shell.ts";
import type { Context } from "../main.ts";
import { execute, tool } from "./shared.ts";
export const ListFiles = type({
@@ -10,13 +10,13 @@ export const ListFiles = type({
.default("."),
});
export function ListFilesTool(_ctx: Context) {
export function ListFilesTool(_ctx: ToolContext) {
return tool({
name: "list_files",
description:
"List files in the repository, including both git-tracked and untracked files. Useful for discovering the file structure and locating files, including newly created files that haven't been committed yet.",
parameters: ListFiles,
execute: execute(_ctx, async ({ path }: { path?: string }) => {
execute: execute(async ({ path }: { path?: string }) => {
const pathStr = path ?? ".";
const cwd = process.cwd();