@@ -317,10 +317,10 @@ const getRepoUrlFromProjectId = async (api: NetlifyAPI, projectId: string): Prom
317
317
}
318
318
}
319
319
320
- const savePrompt = async ( instructions : string , targetDir : string ) : Promise < void > => {
320
+ const savePrompt = async ( instructions : string , ntlContext : string | null , targetDir : string ) : Promise < void > => {
321
321
try {
322
322
const filePath = resolve ( targetDir , 'AI-instructions.md' )
323
- await fs . writeFile ( filePath , instructions , 'utf-8' )
323
+ await fs . writeFile ( filePath , `Context: ${ ntlContext ?? '' } \n\n ${ instructions } ` , 'utf-8' )
324
324
log ( `${ chalk . green ( '✅' ) } AI instructions saved to ${ chalk . cyan ( 'AI-instructions.md' ) } ` )
325
325
} catch ( error ) {
326
326
const errorMessage = error instanceof Error ? error . message : 'Unknown error'
@@ -376,8 +376,21 @@ export const initWithAiRules = async (hash: string, command: BaseCommand): Promi
376
376
377
377
// Step 4: Save AI instructions to file
378
378
if ( projectInfo . prompt ) {
379
+ const ntlContext = await fetch (
380
+ 'https://docs.netlify.com/ai-context/scoped-context?scopes=serverless,blobs,forms' ,
381
+ {
382
+ method : 'GET' ,
383
+ headers : {
384
+ 'Content-Type' : 'text/plain' ,
385
+ } ,
386
+ } ,
387
+ )
388
+ . then ( ( res ) => res . text ( ) )
389
+ . catch ( ( ) => {
390
+ return null
391
+ } )
379
392
log ( '\n📝 Saving AI instructions...' )
380
- await savePrompt ( projectInfo . prompt , targetDir )
393
+ await savePrompt ( projectInfo . prompt , ntlContext , targetDir )
381
394
}
382
395
383
396
// Step 5: Detect IDE and configure MCP server
@@ -405,28 +418,30 @@ export const initWithAiRules = async (hash: string, command: BaseCommand): Promi
405
418
log ( )
406
419
log ( chalk . yellowBright ( `📁 Step 1: Enter your project directory` ) )
407
420
log ( ` ${ chalk . cyanBright ( `cd ${ targetDir } ` ) } ` )
408
-
421
+
409
422
if ( detectedIDE ) {
410
423
if ( mcpConfigured ) {
411
424
log ( chalk . yellowBright ( `🔧 Step 2: MCP Server Configured` ) )
412
- log ( ` ${ chalk . green ( '✅' ) } ${ chalk . cyan ( detectedIDE . presentedName ) } is ready with Netlify MCP server` )
425
+ log ( ` ${ chalk . green ( '✅' ) } ${ chalk . cyan ( detectedIDE . key ) } is ready with Netlify MCP server` )
413
426
log ( ` ${ chalk . gray ( '💡 MCP will activate when you reload/restart your IDE window' ) } ` )
414
427
} else {
415
428
log ( chalk . yellowBright ( `🔧 Step 2: Manual MCP Configuration` ) )
416
- log ( ` ${ chalk . cyan ( detectedIDE . presentedName ) } detected - MCP setup was skipped` )
429
+ log ( ` ${ chalk . cyan ( detectedIDE . key ) } detected - MCP setup was skipped` )
417
430
log ( ` ${ chalk . gray ( 'You can configure MCP manually later for enhanced AI capabilities' ) } ` )
418
431
}
419
432
log ( )
420
433
}
421
-
434
+
422
435
if ( projectInfo . prompt ) {
423
436
const stepNumber = detectedIDE ? '3' : '2'
424
437
log ( chalk . yellowBright ( `🤖 Step ${ stepNumber } : Ask your AI assistant to process the instructions` ) )
425
438
log ( )
426
- log ( chalk . bgGreen . black . bold ( ` follow instructions in ${ targetDir } /AI-instructions.md ` ) )
439
+ log ( chalk . gray ( '*' . repeat ( 60 ) ) )
440
+ log ( chalk . cyan ( `Follow ${ targetDir } /AI-instructions.md and create a new site` ) )
441
+ log ( chalk . gray ( '*' . repeat ( 60 ) ) )
427
442
log ( )
428
443
}
429
444
} catch ( error ) {
430
445
return logAndThrowError ( error )
431
446
}
432
- }
447
+ }
0 commit comments