@litmers/cursorflow-orchestrator 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -136,10 +136,10 @@ function validateConfig(config) {
136
136
  /**
137
137
  * Create default config file
138
138
  */
139
- function createDefaultConfig(projectRoot) {
139
+ function createDefaultConfig(projectRoot, force = false) {
140
140
  const configPath = path.join(projectRoot, 'cursorflow.config.js');
141
141
 
142
- if (fs.existsSync(configPath)) {
142
+ if (fs.existsSync(configPath) && !force) {
143
143
  throw new Error(`Config file already exists: ${configPath}`);
144
144
  }
145
145
 
@@ -178,6 +178,100 @@ function testCursorAgent() {
178
178
  }
179
179
  }
180
180
 
181
+ /**
182
+ * Check cursor-agent authentication
183
+ */
184
+ function checkCursorAuth() {
185
+ try {
186
+ const result = spawnSync('cursor-agent', ['create-chat'], {
187
+ encoding: 'utf8',
188
+ stdio: 'pipe',
189
+ timeout: 10000, // 10 second timeout
190
+ });
191
+
192
+ if (result.status === 0 && result.stdout.trim()) {
193
+ return {
194
+ authenticated: true,
195
+ message: 'Cursor authentication OK',
196
+ };
197
+ }
198
+
199
+ const errorMsg = result.stderr?.trim() || result.stdout?.trim() || '';
200
+
201
+ // Check for authentication errors
202
+ if (errorMsg.includes('not authenticated') ||
203
+ errorMsg.includes('login') ||
204
+ errorMsg.includes('auth')) {
205
+ return {
206
+ authenticated: false,
207
+ message: 'Not authenticated with Cursor',
208
+ details: errorMsg,
209
+ help: 'Please open Cursor IDE and sign in to your account',
210
+ };
211
+ }
212
+
213
+ // Check for network errors
214
+ if (errorMsg.includes('network') ||
215
+ errorMsg.includes('connection') ||
216
+ errorMsg.includes('timeout')) {
217
+ return {
218
+ authenticated: false,
219
+ message: 'Network error',
220
+ details: errorMsg,
221
+ help: 'Check your internet connection',
222
+ };
223
+ }
224
+
225
+ return {
226
+ authenticated: false,
227
+ message: 'Unknown error',
228
+ details: errorMsg,
229
+ };
230
+ } catch (error) {
231
+ if (error.code === 'ETIMEDOUT') {
232
+ return {
233
+ authenticated: false,
234
+ message: 'Connection timeout',
235
+ help: 'Check your internet connection',
236
+ };
237
+ }
238
+
239
+ return {
240
+ authenticated: false,
241
+ message: 'Failed to check authentication',
242
+ error: error.message,
243
+ };
244
+ }
245
+ }
246
+
247
+ /**
248
+ * Print authentication help
249
+ */
250
+ function printAuthHelp() {
251
+ console.log(`
252
+ 🔐 Cursor Authentication Required
253
+
254
+ CursorFlow requires an authenticated Cursor session to use AI features.
255
+
256
+ Steps to authenticate:
257
+
258
+ 1. Open Cursor IDE
259
+ 2. Sign in to your Cursor account (if not already)
260
+ 3. Verify AI features work in the IDE
261
+ 4. Run your CursorFlow command again
262
+
263
+ Common issues:
264
+
265
+ • Not signed in to Cursor
266
+ • Subscription expired or inactive
267
+ • Network connectivity issues
268
+ • VPN or firewall blocking Cursor API
269
+
270
+ For more help, visit: https://docs.cursor.com
271
+
272
+ `);
273
+ }
274
+
181
275
  module.exports = {
182
276
  checkCursorAgentInstalled,
183
277
  getCursorAgentVersion,
@@ -187,4 +281,6 @@ module.exports = {
187
281
  validateSetup,
188
282
  getAvailableModels,
189
283
  testCursorAgent,
284
+ checkCursorAuth,
285
+ printAuthHelp,
190
286
  };