@@ -37,8 +37,10 @@ async function main() {
3737 const userId = generateAnonymousId ( ) ;
3838 const systemInfo = getSystemInfo ( ) ;
3939
40- console . log ( chalk . blue ( '🚀 Welcome to Flyde!' ) ) ;
41- console . log ( chalk . gray ( 'Creating your visual flow project...\n' ) ) ;
40+ console . log ( ) ;
41+ console . log ( chalk . cyan . bold ( ' 🚀 Welcome to Flyde!' ) ) ;
42+ console . log ( chalk . dim ( ' Create visual flow-based programs with TypeScript' ) ) ;
43+ console . log ( ) ;
4244
4345 // Get project name from args or prompt
4446 let projectName = process . argv [ 2 ] ;
@@ -47,33 +49,72 @@ async function main() {
4749 const response = await prompts ( {
4850 type : 'text' ,
4951 name : 'projectName' ,
50- message : 'Project name: ' ,
52+ message : 'Project name' ,
5153 initial : 'my-flyde-project'
5254 } ) ;
5355
5456 if ( ! response . projectName ) {
55- console . log ( chalk . red ( '❌ Project creation cancelled. ') ) ;
57+ console . log ( chalk . yellow ( '\n⚠ Project creation cancelled') ) ;
5658 process . exit ( 0 ) ;
5759 }
5860
5961 projectName = response . projectName ;
6062 }
6163
64+ // Report project name selected
65+ reportEvent ( userId , 'create-project:name-selected' , {
66+ ...systemInfo ,
67+ fromArgs : ! ! process . argv [ 2 ]
68+ } ) ;
69+
70+ // IDE selection
71+ const ideResponse = await prompts ( {
72+ type : 'select' ,
73+ name : 'ide' ,
74+ message : 'Which editor are you using?' ,
75+ choices : [
76+ { title : 'VS Code' , value : 'vscode' } ,
77+ { title : 'Cursor' , value : 'cursor' } ,
78+ { title : 'Windsurf' , value : 'windsurf' } ,
79+ { title : 'Other' , value : 'other' }
80+ ] ,
81+ initial : 0
82+ } ) ;
83+
84+ if ( ! ideResponse . ide ) {
85+ console . log ( chalk . yellow ( '\n⚠ Project creation cancelled' ) ) ;
86+ process . exit ( 0 ) ;
87+ }
88+
89+ const ide = ideResponse . ide ;
90+
91+ // Report IDE selected
92+ reportEvent ( userId , 'create-project:ide-selected' , {
93+ ...systemInfo ,
94+ ide
95+ } ) ;
96+
6297 const projectPath = path . resolve ( process . cwd ( ) , projectName ) ;
6398
6499 // Check if directory exists
65100 if ( fs . existsSync ( projectPath ) ) {
66- console . log ( chalk . red ( `❌ Directory "${ projectName } " already exists. `) ) ;
101+ console . log ( chalk . yellow ( `\n⚠ Directory "${ projectName } " already exists`) ) ;
67102 process . exit ( 1 ) ;
68103 }
69104
70105 try {
71106 // Create project directory
72- console . log ( chalk . blue ( ' 📁 Creating project directory...') ) ;
107+ console . log ( chalk . dim ( '\n 📁 Creating project directory...') ) ;
73108 fs . ensureDirSync ( projectPath ) ;
109+
110+ // Report directory created
111+ reportEvent ( userId , 'create-project:directory-created' , {
112+ ...systemInfo ,
113+ ide
114+ } ) ;
74115
75116 // Copy template files
76- console . log ( chalk . blue ( '📋 Setting up project files...' ) ) ;
117+ console . log ( chalk . dim ( '📋 Setting up project files...' ) ) ;
77118 const templatePath = path . join ( __dirname , '..' , 'templates' , 'default' ) ;
78119 fs . copySync ( templatePath , projectPath ) ;
79120
@@ -84,40 +125,127 @@ async function main() {
84125 fs . writeJsonSync ( packageJsonPath , packageJson , { spaces : 2 } ) ;
85126
86127 // Install dependencies
87- console . log ( chalk . blue ( '📦 Installing dependencies...' ) ) ;
128+ console . log ( chalk . dim ( '📦 Installing dependencies...' ) ) ;
129+ const installStart = Date . now ( ) ;
88130 execSync ( 'npm install' , { cwd : projectPath , stdio : 'inherit' } ) ;
131+
132+ // Report dependencies installed
133+ reportEvent ( userId , 'create-project:dependencies-installed' , {
134+ ...systemInfo ,
135+ ide,
136+ installDuration : Date . now ( ) - installStart
137+ } ) ;
89138
90- // Install VS Code extension
91- console . log ( chalk . blue ( '🔧 Installing VS Code extension...' ) ) ;
92- try {
93- execSync ( 'code --install-extension flyde.flyde-vscode' , { stdio : 'pipe' } ) ;
94- console . log ( chalk . green ( '✅ VS Code extension installed!' ) ) ;
95- } catch ( error ) {
96- console . log ( chalk . yellow ( '⚠️ Could not install VS Code extension automatically.' ) ) ;
97- console . log ( chalk . gray ( ' Please install it manually from the VS Code marketplace.' ) ) ;
139+ // Install IDE extension based on selection
140+ if ( ide !== 'other' ) {
141+ console . log ( chalk . dim ( '\n🔧 Installing Flyde extension...' ) ) ;
142+
143+ const commands = {
144+ vscode : 'code' ,
145+ cursor : 'cursor' ,
146+ windsurf : 'windsurf'
147+ } ;
148+
149+ const command = commands [ ide as keyof typeof commands ] ;
150+
151+ try {
152+ // Check if IDE command is available
153+ execSync ( `${ command } --version` , { stdio : 'pipe' } ) ;
154+
155+ try {
156+ execSync ( `${ command } --install-extension flyde.flyde-vscode` , { stdio : 'pipe' } ) ;
157+ console . log ( chalk . green ( '✅ Flyde extension installed' ) ) ;
158+
159+ // Report extension installed
160+ reportEvent ( userId , 'create-project:extension-installed' , {
161+ ...systemInfo ,
162+ ide,
163+ success : true
164+ } ) ;
165+ } catch ( error ) {
166+ console . log ( chalk . yellow ( `\n⚠ Could not install extension automatically` ) ) ;
167+
168+ // Report extension installation failed
169+ reportEvent ( userId , 'create-project:extension-installed' , {
170+ ...systemInfo ,
171+ ide,
172+ success : false ,
173+ reason : 'install-failed'
174+ } ) ;
175+ if ( ide === 'vscode' ) {
176+ console . log ( chalk . dim ( ' Install from: https://marketplace.visualstudio.com/items?itemName=flyde.flyde-vscode' ) ) ;
177+ } else {
178+ console . log ( chalk . dim ( ' Install from: https://open-vsx.org/extension/flyde/flyde-vscode' ) ) ;
179+ }
180+ }
181+ } catch ( error ) {
182+ console . log ( chalk . yellow ( `\n⚠ ${ command } command not found` ) ) ;
183+
184+ // Report IDE not found
185+ reportEvent ( userId , 'create-project:extension-installed' , {
186+ ...systemInfo ,
187+ ide,
188+ success : false ,
189+ reason : 'ide-not-found'
190+ } ) ;
191+
192+ if ( ide === 'vscode' ) {
193+ console . log ( chalk . dim ( ' Install VS Code first, then install the extension from:' ) ) ;
194+ console . log ( chalk . dim ( ' https://marketplace.visualstudio.com/items?itemName=flyde.flyde-vscode' ) ) ;
195+ } else {
196+ console . log ( chalk . dim ( ` Install ${ ide } first, then install the extension from:` ) )
197+ console . log ( chalk . dim ( ' https://open-vsx.org/extension/flyde/flyde-vscode' ) ) ;
198+ }
199+ }
200+ } else {
201+ console . log ( chalk . yellow ( '\n⚠ Please install the Flyde extension manually' ) ) ;
202+ console . log ( chalk . dim ( ' VS Code Marketplace: https://marketplace.visualstudio.com/items?itemName=flyde.flyde-vscode' ) ) ;
203+ console . log ( chalk . dim ( ' Open VSX: https://open-vsx.org/extension/flyde/flyde-vscode' ) ) ;
98204 }
99205
100206 // Success message
101- console . log ( chalk . green ( '\n🎉 Project created successfully!' ) ) ;
102- console . log ( chalk . gray ( '\nNext steps:' ) ) ;
103- console . log ( chalk . gray ( ` cd ${ projectName } ` ) ) ;
104- console . log ( chalk . gray ( ' code .' ) ) ;
105- console . log ( chalk . gray ( ' Open hello-world.flyde to get started\n' ) ) ;
106-
107- // Open VS Code automatically
108- try {
109- console . log ( chalk . blue ( '🚀 Opening VS Code...' ) ) ;
110- execSync ( `code "${ projectPath } " "${ projectPath } /hello-world.flyde"` , { stdio : 'pipe' } ) ;
111- } catch ( error ) {
112- console . log ( chalk . yellow ( '⚠️ Could not open VS Code automatically.' ) ) ;
113- console . log ( chalk . gray ( ` Please run: cd ${ projectName } && code .` ) ) ;
207+ console . log ( chalk . green . bold ( '\n✨ Project created successfully!' ) ) ;
208+ console . log ( chalk . dim ( '\nNext steps:' ) ) ;
209+ console . log ( chalk . white ( ` cd ${ projectName } ` ) ) ;
210+
211+ if ( ide !== 'other' ) {
212+ const commands = {
213+ vscode : 'code' ,
214+ cursor : 'cursor' ,
215+ windsurf : 'windsurf'
216+ } ;
217+ console . log ( chalk . white ( ` ${ commands [ ide as keyof typeof commands ] } .` ) ) ;
218+ }
219+
220+ console . log ( chalk . white ( ' Open hello-world.flyde to start building' ) ) ;
221+ console . log ( ) ;
222+
223+ // Open IDE automatically
224+ if ( ide !== 'other' ) {
225+ const commands = {
226+ vscode : 'code' ,
227+ cursor : 'cursor' ,
228+ windsurf : 'windsurf'
229+ } ;
230+
231+ const command = commands [ ide as keyof typeof commands ] ;
232+
233+ try {
234+ console . log ( chalk . dim ( `🚀 Opening ${ ide } ...` ) ) ;
235+ execSync ( `${ command } "${ projectPath } " "${ projectPath } /hello-world.flyde"` , { stdio : 'pipe' } ) ;
236+ } catch ( error ) {
237+ // Silently fail - user can open manually
238+ }
114239 }
115240
116241 // Report success
117- reportEvent ( userId , 'create-project:success' , systemInfo ) ;
242+ reportEvent ( userId , 'create-project:success' , {
243+ ...systemInfo ,
244+ ide
245+ } ) ;
118246
119247 } catch ( error ) {
120- console . error ( chalk . red ( '❌ Error creating project:' ) , error ) ;
248+ console . error ( chalk . red ( '\n ❌ Error creating project:' ) , error ) ;
121249
122250 // Report error
123251 reportEvent ( userId , 'create-project:error' , {
0 commit comments