@@ -36,19 +36,15 @@ describe('goalExitCode', () => {
3636} ) ;
3737
3838describe ( 'parseHeadlessGoalCreate' , ( ) => {
39- it ( 'returns undefined when the flag is disabled' , ( ) => {
40- expect ( parseHeadlessGoalCreate ( '/goal Ship feature X' , false ) ) . toBeUndefined ( ) ;
41- } ) ;
42-
4339 it ( 'parses a create command into objective + replace' , ( ) => {
44- const result = parseHeadlessGoalCreate ( '/goal Ship feature X' , true ) ;
40+ const result = parseHeadlessGoalCreate ( '/goal Ship feature X' ) ;
4541 expect ( result ) . toEqual ( { objective : 'Ship feature X' , replace : false } ) ;
4642 } ) ;
4743
4844 it ( 'returns undefined for non-goal prompts and non-create subcommands' , ( ) => {
49- expect ( parseHeadlessGoalCreate ( 'say hello' , true ) ) . toBeUndefined ( ) ;
50- expect ( parseHeadlessGoalCreate ( '/goal status' , true ) ) . toBeUndefined ( ) ;
51- expect ( parseHeadlessGoalCreate ( '/goal pause' , true ) ) . toBeUndefined ( ) ;
45+ expect ( parseHeadlessGoalCreate ( 'say hello' ) ) . toBeUndefined ( ) ;
46+ expect ( parseHeadlessGoalCreate ( '/goal status' ) ) . toBeUndefined ( ) ;
47+ expect ( parseHeadlessGoalCreate ( '/goal pause' ) ) . toBeUndefined ( ) ;
5248 } ) ;
5349} ) ;
5450
@@ -106,7 +102,7 @@ const mocks = vi.hoisted(() => {
106102 session,
107103 eventHandlers,
108104 mainEvent,
109- experimentalFeatures : [ { id : 'goal_command ' , enabled : true } ] ,
105+ experimentalFeatures : [ { id : 'micro_compaction ' , enabled : true } ] ,
110106 sessions : [ ] as Array < { readonly id : string ; readonly workDir : string } > ,
111107 } ;
112108} ) ;
@@ -164,7 +160,7 @@ describe('runPrompt headless goal mode', () => {
164160
165161 beforeEach ( ( ) => {
166162 savedExitCode = process . exitCode ;
167- mocks . experimentalFeatures = [ { id : 'goal_command ' , enabled : true } ] ;
163+ mocks . experimentalFeatures = [ { id : 'micro_compaction ' , enabled : true } ] ;
168164 mocks . sessions = [ ] ;
169165 mocks . session . createGoal . mockClear ( ) ;
170166 mocks . session . getStatus . mockResolvedValue ( { permission : 'auto' , model : 'k2' } as never ) ;
@@ -233,7 +229,7 @@ describe('runPrompt headless goal mode', () => {
233229 expect ( stdout . text ( ) ) . not . toContain ( '"goalId":null' ) ;
234230 } ) ;
235231
236- it ( 'treats /goal as a normal prompt when the flag is disabled ' , async ( ) => {
232+ it ( 'creates a headless goal without reading experimental features ' , async ( ) => {
237233 mocks . experimentalFeatures = [ ] ;
238234 const stdout = writer ( ) ;
239235 const stderr = writer ( ) ;
@@ -242,8 +238,8 @@ describe('runPrompt headless goal mode', () => {
242238 stderr,
243239 process : { once : ( ) => { } , off : ( ) => { } , exit : ( ) => undefined as never } ,
244240 } ) ;
245- expect ( mocks . session . createGoal ) . not . toHaveBeenCalled ( ) ;
246- expect ( mocks . session . prompt ) . toHaveBeenCalled ( ) ;
241+ expect ( mocks . session . createGoal ) . toHaveBeenCalled ( ) ;
242+ expect ( mocks . session . prompt ) . toHaveBeenCalledWith ( 'Ship feature X' ) ;
247243 } ) ;
248244
249245 it ( 'validates the resumed session model before creating a headless goal' , async ( ) => {
0 commit comments