@@ -6,6 +6,7 @@ import { getConfig } from '../utils/config-runtime.js';
66import { getProvider } from '../feature/providers/index.js' ;
77import { generateCommitMessage } from '../utils/openai.js' ;
88import { KnownError , handleCommandError } from '../utils/error.js' ;
9+ import { isHeadless } from '../utils/headless.js' ;
910
1011const [ messageFilePath , commitSource ] = process . argv . slice ( 2 ) ;
1112
@@ -28,7 +29,10 @@ export default () =>
2829 return ;
2930 }
3031
31- intro ( bgCyan ( black ( ' aicommits ' ) ) ) ;
32+ const headless = isHeadless ( ) ;
33+ if ( ! headless ) {
34+ intro ( bgCyan ( black ( ' aicommits ' ) ) ) ;
35+ }
3236
3337 const config = await getConfig ( { } ) ;
3438
@@ -60,8 +64,8 @@ export default () =>
6064 // Use the unified model or provider default
6165 let model = config . OPENAI_MODEL || providerInstance . getDefaultModel ( ) ;
6266
63- const s = spinner ( ) ;
64- s . start ( 'The AI is analyzing your changes' ) ;
67+ const s = headless ? null : spinner ( ) ;
68+ s ? .start ( 'The AI is analyzing your changes' ) ;
6569 let messages : string [ ] ;
6670 try {
6771 const result = await generateCommitMessage (
@@ -79,7 +83,7 @@ export default () =>
7983 ) ;
8084 messages = result . messages ;
8185 } finally {
82- s . stop ( 'Changes analyzed' ) ;
86+ s ? .stop ( 'Changes analyzed' ) ;
8387 }
8488
8589 /**
@@ -119,5 +123,7 @@ export default () =>
119123 const newContent = instructions + '\n' + currentContent ;
120124 await fs . writeFile ( messageFilePath , newContent ) ;
121125
122- outro ( `${ green ( '✔' ) } Saved commit message!` ) ;
126+ if ( ! headless ) {
127+ outro ( `${ green ( '✔' ) } Saved commit message!` ) ;
128+ }
123129 } ) ( ) . catch ( handleCommandError ) ;
0 commit comments