@@ -9,6 +9,7 @@ import { isAuthenticated, browserLogin, interactiveLogin } from '../utils/auth';
99import { saveCredentials } from '../utils/credentials' ;
1010import { updateConfig , getApiKey } from '../utils/config' ;
1111import { buildSkillsInstallArgs } from './skills-install' ;
12+ import { hasNpx , installSkillsNative } from './skills-native' ;
1213
1314export interface InitOptions {
1415 global ?: boolean ;
@@ -215,19 +216,29 @@ async function stepIntegrations(options: InitOptions): Promise<void> {
215216 switch ( integration ) {
216217 case 'skills' : {
217218 console . log ( `\n Setting up skills...` ) ;
218- const args = buildSkillsInstallArgs ( {
219- agent : options . agent ,
220- yes : options . yes || options . all ,
221- global : true ,
222- includeNpxYes : true ,
223- } ) ;
224- try {
225- execSync ( args . join ( ' ' ) , { stdio : 'inherit' } ) ;
226- console . log ( ` ${ green } ✓${ reset } Skills installed` ) ;
227- } catch {
228- console . error (
229- ' Failed to install skills. Run "firecrawl setup skills" later.'
230- ) ;
219+ if ( hasNpx ( ) ) {
220+ const args = buildSkillsInstallArgs ( {
221+ agent : options . agent ,
222+ yes : options . yes || options . all ,
223+ global : true ,
224+ includeNpxYes : true ,
225+ } ) ;
226+ try {
227+ execSync ( args . join ( ' ' ) , { stdio : 'inherit' } ) ;
228+ console . log ( ` ${ green } ✓${ reset } Skills installed` ) ;
229+ } catch {
230+ console . error (
231+ ' Failed to install skills. Run "firecrawl setup skills" later.'
232+ ) ;
233+ }
234+ } else {
235+ try {
236+ await installSkillsNative ( ) ;
237+ } catch {
238+ console . error (
239+ ' Failed to install skills. Run "firecrawl setup skills" later.'
240+ ) ;
241+ }
231242 }
232243 break ;
233244 }
@@ -616,20 +627,32 @@ async function runNonInteractive(options: InitOptions): Promise<void> {
616627 console . log (
617628 `${ stepLabel ( ) } Installing firecrawl skill for AI coding agents...`
618629 ) ;
619- const args = buildSkillsInstallArgs ( {
620- agent : options . agent ,
621- yes : true ,
622- global : true ,
623- includeNpxYes : true ,
624- } ) ;
625- try {
626- execSync ( args . join ( ' ' ) , { stdio : 'inherit' } ) ;
627- console . log ( `${ green } ✓${ reset } Skills installed\n` ) ;
628- } catch {
629- console . error (
630- '\nFailed to install skills. You can retry with: firecrawl setup skills'
631- ) ;
632- process . exit ( 1 ) ;
630+ if ( hasNpx ( ) ) {
631+ const args = buildSkillsInstallArgs ( {
632+ agent : options . agent ,
633+ yes : true ,
634+ global : true ,
635+ includeNpxYes : true ,
636+ } ) ;
637+ try {
638+ execSync ( args . join ( ' ' ) , { stdio : 'inherit' } ) ;
639+ console . log ( `${ green } ✓${ reset } Skills installed\n` ) ;
640+ } catch {
641+ console . error (
642+ '\nFailed to install skills. You can retry with: firecrawl setup skills'
643+ ) ;
644+ process . exit ( 1 ) ;
645+ }
646+ } else {
647+ try {
648+ await installSkillsNative ( ) ;
649+ console . log ( '' ) ;
650+ } catch {
651+ console . error (
652+ '\nFailed to install skills. You can retry with: firecrawl setup skills'
653+ ) ;
654+ process . exit ( 1 ) ;
655+ }
633656 }
634657 }
635658
0 commit comments