66 GitPreparePullRequestThreadResult ,
77 GitRunStackedActionInput ,
88 VcsCreateWorktreeInput ,
9+ VcsListRefsInput ,
910 VcsRef ,
1011} from "./git.ts" ;
1112import { WorktreeMcpHandoffInput } from "./worktreeMcp.ts" ;
@@ -16,6 +17,8 @@ const encodeVcsRef = Schema.encodeUnknownSync(VcsRef);
1617const decodeVcsRef = Schema . decodeUnknownSync ( VcsRef ) ;
1718const encodeCreateWorktreeInput = Schema . encodeUnknownSync ( VcsCreateWorktreeInput ) ;
1819const decodeCreateWorktreeInput = Schema . decodeUnknownSync ( VcsCreateWorktreeInput ) ;
20+ const encodeListRefsInput = Schema . encodeUnknownSync ( VcsListRefsInput ) ;
21+ const decodeListRefsInput = Schema . decodeUnknownSync ( VcsListRefsInput ) ;
1922const decodeWorktreeHandoffInput = Schema . decodeUnknownSync ( WorktreeMcpHandoffInput ) ;
2023const decodeGitCommandError = Schema . decodeUnknownSync ( Schema . toCodecJson ( GitCommandError ) ) ;
2124const decodePreparePullRequestThreadResult = Schema . decodeUnknownSync (
@@ -129,6 +132,9 @@ describe("Git ref names", () => {
129132
130133 const handoff = { branch : name , baseRef : name , startFromOrigin : true } ;
131134 expect ( decodeWorktreeHandoffInput ( handoff ) ) . toEqual ( handoff ) ;
135+
136+ const listInput = { cwd : "/repo" , query : name } ;
137+ expect ( decodeListRefsInput ( encodeListRefsInput ( listInput ) ) ) . toEqual ( listInput ) ;
132138 } ,
133139 ) ;
134140
@@ -137,5 +143,7 @@ describe("Git ref names", () => {
137143 decodeCreateWorktreeInput ( { cwd : "/repo" , refName : " \tmain\n" , path : null } ) . refName ,
138144 ) . toBe ( "main" ) ;
139145 expect ( ( ) => decodeCreateWorktreeInput ( { cwd : "/repo" , refName : " \t" , path : null } ) ) . toThrow ( ) ;
146+ expect ( decodeListRefsInput ( { cwd : "/repo" , query : " \tmain\n" } ) . query ) . toBe ( "main" ) ;
147+ expect ( ( ) => decodeListRefsInput ( { cwd : "/repo" , query : " \t" } ) ) . toThrow ( ) ;
140148 } ) ;
141149} ) ;
0 commit comments