fix(scout): widen repo tool schema types

This commit is contained in:
Shoubhit Dash 2026-04-24 16:38:37 +05:30
parent 343e68853c
commit 35a19df57d
2 changed files with 16 additions and 5 deletions

View file

@ -8,7 +8,12 @@ import DESCRIPTION from "./repo_clone.txt"
import * as Tool from "./tool"
import { parseRepositoryReference, repositoryCachePath, sameRepositoryReference } from "@/util/repository"
const parameters = z.object({
type Parameters = {
repository: string
refresh?: boolean
}
const parameters: z.ZodType<Parameters> = z.object({
repository: z
.string()
.describe("Repository to clone, as a git URL, host/path reference, or GitHub owner/repo shorthand"),
@ -53,7 +58,7 @@ export const RepoCloneTool = Tool.define<typeof parameters, Metadata, AppFileSys
return {
description: DESCRIPTION,
parameters,
execute: (params: z.infer<typeof parameters>, ctx: Tool.Context<Metadata>) =>
execute: (params: Parameters, ctx: Tool.Context<Metadata>) =>
Effect.gen(function* () {
const reference = parseRepositoryReference(params.repository)
if (!reference) throw new Error("Repository must be a git URL, host/path reference, or GitHub owner/repo shorthand")

View file

@ -9,7 +9,13 @@ import * as Tool from "./tool"
import { parseRepositoryReference, repositoryCachePath } from "@/util/repository"
import { Instance } from "@/project/instance"
const parameters = z
type Parameters = {
repository?: string
path?: string
depth?: number
}
const parameters: z.ZodType<Parameters> = z
.object({
repository: z
.string()
@ -84,7 +90,7 @@ export const RepoOverviewTool = Tool.define<typeof parameters, Metadata, AppFile
const fs = yield* AppFileSystem.Service
const git = yield* Git.Service
const resolveTarget = Effect.fn("RepoOverviewTool.resolveTarget")(function* (params: z.infer<typeof parameters>) {
const resolveTarget = Effect.fn("RepoOverviewTool.resolveTarget")(function* (params: Parameters) {
if (params.path) {
const full = path.isAbsolute(params.path) ? params.path : path.resolve(Instance.directory, params.path)
return { path: full, repository: params.repository }
@ -147,7 +153,7 @@ export const RepoOverviewTool = Tool.define<typeof parameters, Metadata, AppFile
return {
description: DESCRIPTION,
parameters,
execute: (params: z.infer<typeof parameters>, ctx: Tool.Context<Metadata>) =>
execute: (params: Parameters, ctx: Tool.Context<Metadata>) =>
Effect.gen(function* () {
const target = yield* resolveTarget(params)
const depth = params.depth ?? 3