@@ -3,7 +3,8 @@ import { generateId } from './fileUtils';
33
44export interface ProjectCommands {
55 type : string ;
6- setupCommand : string ;
6+ setupCommand ?: string ;
7+ startCommand ?: string ;
78 followupMessage : string ;
89}
910
@@ -33,7 +34,8 @@ export async function detectProjectCommands(files: FileContent[]): Promise<Proje
3334 if ( availableCommand ) {
3435 return {
3536 type : 'Node.js' ,
36- setupCommand : `npm install && npm run ${ availableCommand } ` ,
37+ setupCommand : `npm install` ,
38+ startCommand : `npm run ${ availableCommand } ` ,
3739 followupMessage : `Found "${ availableCommand } " script in package.json. Running "npm run ${ availableCommand } " after installation.` ,
3840 } ;
3941 }
@@ -53,7 +55,7 @@ export async function detectProjectCommands(files: FileContent[]): Promise<Proje
5355 if ( hasFile ( 'index.html' ) ) {
5456 return {
5557 type : 'Static' ,
56- setupCommand : 'npx --yes serve' ,
58+ startCommand : 'npx --yes serve' ,
5759 followupMessage : '' ,
5860 } ;
5961 }
@@ -62,17 +64,28 @@ export async function detectProjectCommands(files: FileContent[]): Promise<Proje
6264}
6365
6466export function createCommandsMessage ( commands : ProjectCommands ) : Message | null {
65- if ( ! commands . setupCommand ) {
67+ if ( ! commands . setupCommand && ! commands . startCommand ) {
6668 return null ;
6769 }
6870
71+ let commandString = '' ;
72+
73+ if ( commands . setupCommand ) {
74+ commandString += `
75+ <boltAction type="shell">${ commands . setupCommand } </boltAction>` ;
76+ }
77+
78+ if ( commands . startCommand ) {
79+ commandString += `
80+ <boltAction type="start">${ commands . startCommand } </boltAction>
81+ ` ;
82+ }
83+
6984 return {
7085 role : 'assistant' ,
7186 content : `
7287<boltArtifact id="project-setup" title="Project Setup">
73- <boltAction type="shell">
74- ${ commands . setupCommand }
75- </boltAction>
88+ ${ commandString }
7689</boltArtifact>${ commands . followupMessage ? `\n\n${ commands . followupMessage } ` : '' } ` ,
7790 id : generateId ( ) ,
7891 createdAt : new Date ( ) ,
0 commit comments