@@ -15,6 +15,16 @@ const parameters = z.object({
1515 refresh : z . boolean ( ) . optional ( ) . describe ( "When true, fetches the latest remote state into the managed cache" ) ,
1616} )
1717
18+ type Metadata = {
19+ repository : string
20+ host : string
21+ remote : string
22+ localPath : string
23+ status : "cached" | "cloned" | "refreshed"
24+ head ?: string
25+ branch ?: string
26+ }
27+
1828function statusForRepository ( input : { reuse : boolean ; refresh ?: boolean } ) {
1929 if ( ! input . reuse ) return "cloned" as const
2030 if ( input . refresh ) return "refreshed" as const
@@ -34,7 +44,7 @@ function resetTarget(input: {
3444 return "HEAD"
3545}
3646
37- export const RepoCloneTool = Tool . define (
47+ export const RepoCloneTool = Tool . define < typeof parameters , Metadata , AppFileSystem . Service | Git . Service > (
3848 "repo_clone" ,
3949 Effect . gen ( function * ( ) {
4050 const fs = yield * AppFileSystem . Service
@@ -43,7 +53,7 @@ export const RepoCloneTool = Tool.define(
4353 return {
4454 description : DESCRIPTION ,
4555 parameters,
46- execute : ( params : z . infer < typeof parameters > , ctx : Tool . Context ) =>
56+ execute : ( params : z . infer < typeof parameters > , ctx : Tool . Context < Metadata > ) =>
4757 Effect . gen ( function * ( ) {
4858 const reference = parseRepositoryReference ( params . repository )
4959 if ( ! reference ) throw new Error ( "Repository must be a git URL, host/path reference, or GitHub owner/repo shorthand" )
@@ -137,6 +147,6 @@ export const RepoCloneTool = Tool.define(
137147 ( lock ) => Effect . promise ( ( ) => lock . release ( ) ) . pipe ( Effect . ignore ) ,
138148 )
139149 } ) . pipe ( Effect . orDie ) ,
140- }
150+ } satisfies Tool . DefWithoutID < typeof parameters , Metadata >
141151 } ) ,
142152)
0 commit comments