@@ -16,6 +16,7 @@ import { emptyMcpLayer } from "../fixture/mcp"
1616import { location } from "../fixture/location"
1717import { testEffect } from "../lib/effect"
1818import { host } from "./host"
19+ import PROMPT_INITIALIZE from "../../src/plugin/command/initialize.txt"
1920import PROMPT_REVIEW from "../../src/plugin/command/review.txt"
2021
2122const directory = AbsolutePath . make ( "/repo/packages/app" )
@@ -40,7 +41,11 @@ describe("CommandPlugin.Plugin", () => {
4041 it . effect ( "registers built-in init and review commands" , ( ) =>
4142 Effect . gen ( function * ( ) {
4243 const command = yield * Command . Service
43- const prompts : { text : string ; files ?: readonly { readonly uri : string } [ ] } [ ] = [ ]
44+ const prompts : {
45+ text : string
46+ files ?: readonly { readonly uri : string } [ ]
47+ delivery ?: "steer" | "queue"
48+ } [ ] = [ ]
4449 yield * CommandPlugin . Plugin . effect (
4550 host ( {
4651 command : {
@@ -51,7 +56,7 @@ describe("CommandPlugin.Plugin", () => {
5156 session : {
5257 prompt : ( input ) =>
5358 Effect . sync ( ( ) => {
54- prompts . push ( { text : input . text , files : input . files } )
59+ prompts . push ( { text : input . text , files : input . files , delivery : input . delivery } )
5560 return SessionInbox . User . make ( {
5661 id : SessionMessage . ID . make ( "msg_test" ) ,
5762 sessionID : input . sessionID ,
@@ -86,10 +91,50 @@ describe("CommandPlugin.Plugin", () => {
8691 delivery : "queue" ,
8792 } ,
8893 } )
94+ yield * command . execute ( {
95+ name : "review" ,
96+ invocation : {
97+ sessionID : Session . ID . make ( "ses_test" ) ,
98+ prompt : { text : " branch $& $$ $` $' " } ,
99+ delivery : "steer" ,
100+ } ,
101+ } )
102+ yield * command . execute ( {
103+ name : "init" ,
104+ invocation : {
105+ sessionID : Session . ID . make ( "ses_test" ) ,
106+ prompt : { text : "" } ,
107+ delivery : "steer" ,
108+ } ,
109+ } )
110+ yield * command . execute ( {
111+ name : "review" ,
112+ invocation : {
113+ sessionID : Session . ID . make ( "ses_test" ) ,
114+ prompt : { text : " " } ,
115+ delivery : "steer" ,
116+ } ,
117+ } )
89118 expect ( prompts ) . toEqual ( [
90119 {
91- text : expect . stringContaining ( "extra context" ) ,
120+ text : PROMPT_INITIALIZE . replace ( "${path}" , project ) . replaceAll ( "$ARGUMENTS" , "extra context" ) ,
92121 files : [ { uri : "file:///tmp/context.md" } ] ,
122+ delivery : "queue" ,
123+ } ,
124+ {
125+ text : PROMPT_REVIEW . replace ( "${path}" , project ) . replaceAll ( "$ARGUMENTS" , ( ) => "branch $& $$ $` $'" ) ,
126+ files : undefined ,
127+ delivery : "steer" ,
128+ } ,
129+ {
130+ text : PROMPT_INITIALIZE . replace ( "${path}" , project ) . replaceAll ( "$ARGUMENTS" , "" ) ,
131+ files : undefined ,
132+ delivery : "steer" ,
133+ } ,
134+ {
135+ text : PROMPT_REVIEW . replace ( "${path}" , project ) . replaceAll ( "$ARGUMENTS" , "" ) ,
136+ files : undefined ,
137+ delivery : "steer" ,
93138 } ,
94139 ] )
95140 } ) ,
0 commit comments