@litmers/cursorflow-orchestrator 0.1.3 → 0.1.6

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +17 -7
  2. package/README.md +33 -2
  3. package/commands/cursorflow-doctor.md +24 -0
  4. package/commands/cursorflow-signal.md +19 -0
  5. package/dist/cli/clean.d.ts +5 -0
  6. package/dist/cli/clean.js +57 -0
  7. package/dist/cli/clean.js.map +1 -0
  8. package/dist/cli/doctor.d.ts +15 -0
  9. package/dist/cli/doctor.js +139 -0
  10. package/dist/cli/doctor.js.map +1 -0
  11. package/dist/cli/index.d.ts +6 -0
  12. package/dist/cli/index.js +125 -0
  13. package/dist/cli/index.js.map +1 -0
  14. package/dist/cli/init.d.ts +7 -0
  15. package/dist/cli/init.js +302 -0
  16. package/dist/cli/init.js.map +1 -0
  17. package/dist/cli/monitor.d.ts +8 -0
  18. package/dist/cli/monitor.js +210 -0
  19. package/dist/cli/monitor.js.map +1 -0
  20. package/dist/cli/resume.d.ts +5 -0
  21. package/dist/cli/resume.js +128 -0
  22. package/dist/cli/resume.js.map +1 -0
  23. package/dist/cli/run.d.ts +5 -0
  24. package/dist/cli/run.js +128 -0
  25. package/dist/cli/run.js.map +1 -0
  26. package/dist/cli/setup-commands.d.ts +23 -0
  27. package/dist/cli/setup-commands.js +234 -0
  28. package/dist/cli/setup-commands.js.map +1 -0
  29. package/dist/cli/signal.d.ts +7 -0
  30. package/dist/cli/signal.js +99 -0
  31. package/dist/cli/signal.js.map +1 -0
  32. package/dist/core/orchestrator.d.ts +47 -0
  33. package/dist/core/orchestrator.js +192 -0
  34. package/dist/core/orchestrator.js.map +1 -0
  35. package/dist/core/reviewer.d.ts +60 -0
  36. package/dist/core/reviewer.js +239 -0
  37. package/dist/core/reviewer.js.map +1 -0
  38. package/dist/core/runner.d.ts +51 -0
  39. package/dist/core/runner.js +499 -0
  40. package/dist/core/runner.js.map +1 -0
  41. package/dist/utils/config.d.ts +31 -0
  42. package/dist/utils/config.js +198 -0
  43. package/dist/utils/config.js.map +1 -0
  44. package/dist/utils/cursor-agent.d.ts +61 -0
  45. package/dist/utils/cursor-agent.js +263 -0
  46. package/dist/utils/cursor-agent.js.map +1 -0
  47. package/dist/utils/doctor.d.ts +63 -0
  48. package/dist/utils/doctor.js +280 -0
  49. package/dist/utils/doctor.js.map +1 -0
  50. package/dist/utils/git.d.ts +131 -0
  51. package/dist/utils/git.js +272 -0
  52. package/dist/utils/git.js.map +1 -0
  53. package/dist/utils/logger.d.ts +68 -0
  54. package/dist/utils/logger.js +158 -0
  55. package/dist/utils/logger.js.map +1 -0
  56. package/dist/utils/state.d.ts +65 -0
  57. package/dist/utils/state.js +216 -0
  58. package/dist/utils/state.js.map +1 -0
  59. package/dist/utils/types.d.ts +118 -0
  60. package/dist/utils/types.js +6 -0
  61. package/dist/utils/types.js.map +1 -0
  62. package/examples/README.md +155 -0
  63. package/examples/demo-project/README.md +262 -0
  64. package/examples/demo-project/_cursorflow/tasks/demo-test/01-create-utils.json +18 -0
  65. package/examples/demo-project/_cursorflow/tasks/demo-test/02-add-tests.json +18 -0
  66. package/examples/demo-project/_cursorflow/tasks/demo-test/README.md +109 -0
  67. package/package.json +71 -61
  68. package/scripts/ai-security-check.js +11 -4
  69. package/scripts/local-security-gate.sh +76 -0
  70. package/src/cli/{clean.js → clean.ts} +11 -5
  71. package/src/cli/doctor.ts +127 -0
  72. package/src/cli/{index.js → index.ts} +27 -16
  73. package/src/cli/{init.js → init.ts} +26 -18
  74. package/src/cli/{monitor.js → monitor.ts} +57 -44
  75. package/src/cli/resume.ts +119 -0
  76. package/src/cli/run.ts +109 -0
  77. package/src/cli/{setup-commands.js → setup-commands.ts} +38 -18
  78. package/src/cli/signal.ts +89 -0
  79. package/src/core/{orchestrator.js → orchestrator.ts} +44 -26
  80. package/src/core/{reviewer.js → reviewer.ts} +36 -29
  81. package/src/core/{runner.js → runner.ts} +125 -76
  82. package/src/utils/{config.js → config.ts} +17 -25
  83. package/src/utils/{cursor-agent.js → cursor-agent.ts} +38 -47
  84. package/src/utils/doctor.ts +312 -0
  85. package/src/utils/{git.js → git.ts} +70 -56
  86. package/src/utils/{logger.js → logger.ts} +170 -178
  87. package/src/utils/{state.js → state.ts} +30 -38
  88. package/src/utils/types.ts +134 -0
  89. package/src/cli/resume.js +0 -31
  90. package/src/cli/run.js +0 -51
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ /**
3
+ * Configuration loader for CursorFlow
4
+ *
5
+ * Finds project root and loads user configuration with defaults
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || (function () {
24
+ var ownKeys = function(o) {
25
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26
+ var ar = [];
27
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
+ return ar;
29
+ };
30
+ return ownKeys(o);
31
+ };
32
+ return function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ })();
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.findProjectRoot = findProjectRoot;
42
+ exports.loadConfig = loadConfig;
43
+ exports.getTasksDir = getTasksDir;
44
+ exports.getLogsDir = getLogsDir;
45
+ exports.validateConfig = validateConfig;
46
+ exports.createDefaultConfig = createDefaultConfig;
47
+ const path = __importStar(require("path"));
48
+ const fs = __importStar(require("fs"));
49
+ /**
50
+ * Find project root by looking for package.json
51
+ */
52
+ function findProjectRoot(cwd = process.cwd()) {
53
+ let current = cwd;
54
+ while (current !== path.parse(current).root) {
55
+ const packagePath = path.join(current, 'package.json');
56
+ if (fs.existsSync(packagePath)) {
57
+ return current;
58
+ }
59
+ current = path.dirname(current);
60
+ }
61
+ throw new Error('Cannot find project root with package.json');
62
+ }
63
+ /**
64
+ * Load configuration with defaults
65
+ */
66
+ function loadConfig(projectRoot = null) {
67
+ if (!projectRoot) {
68
+ projectRoot = findProjectRoot();
69
+ }
70
+ const configPath = path.join(projectRoot, 'cursorflow.config.js');
71
+ // Default configuration
72
+ const defaults = {
73
+ // Directories
74
+ tasksDir: '_cursorflow/tasks',
75
+ logsDir: '_cursorflow/logs',
76
+ // Git
77
+ baseBranch: 'main',
78
+ branchPrefix: 'feature/',
79
+ // Execution
80
+ executor: 'cursor-agent',
81
+ pollInterval: 60,
82
+ // Dependencies
83
+ allowDependencyChange: false,
84
+ lockfileReadOnly: true,
85
+ // Review
86
+ enableReview: false,
87
+ reviewModel: 'sonnet-4.5-thinking',
88
+ maxReviewIterations: 3,
89
+ // Lane defaults
90
+ defaultLaneConfig: {
91
+ devPort: 3001,
92
+ autoCreatePr: false,
93
+ },
94
+ // Logging
95
+ logLevel: 'info',
96
+ verboseGit: false,
97
+ // Advanced
98
+ worktreePrefix: 'cursorflow-',
99
+ maxConcurrentLanes: 10,
100
+ // Internal
101
+ projectRoot,
102
+ };
103
+ // Try to load user config
104
+ if (fs.existsSync(configPath)) {
105
+ try {
106
+ const userConfig = require(configPath);
107
+ return { ...defaults, ...userConfig, projectRoot };
108
+ }
109
+ catch (error) {
110
+ console.warn(`Warning: Failed to load config from ${configPath}: ${error.message}`);
111
+ console.warn('Using default configuration...');
112
+ }
113
+ }
114
+ return defaults;
115
+ }
116
+ /**
117
+ * Get absolute path for tasks directory
118
+ */
119
+ function getTasksDir(config) {
120
+ return path.join(config.projectRoot, config.tasksDir);
121
+ }
122
+ /**
123
+ * Get absolute path for logs directory
124
+ */
125
+ function getLogsDir(config) {
126
+ return path.join(config.projectRoot, config.logsDir);
127
+ }
128
+ /**
129
+ * Validate configuration
130
+ */
131
+ function validateConfig(config) {
132
+ const errors = [];
133
+ if (!config.tasksDir) {
134
+ errors.push('tasksDir is required');
135
+ }
136
+ if (!config.logsDir) {
137
+ errors.push('logsDir is required');
138
+ }
139
+ if (!['cursor-agent', 'cloud'].includes(config.executor)) {
140
+ errors.push('executor must be "cursor-agent" or "cloud"');
141
+ }
142
+ if (config.pollInterval < 1) {
143
+ errors.push('pollInterval must be >= 1');
144
+ }
145
+ if (errors.length > 0) {
146
+ throw new Error(`Configuration validation failed:\n${errors.join('\n')}`);
147
+ }
148
+ return true;
149
+ }
150
+ /**
151
+ * Create default config file
152
+ */
153
+ function createDefaultConfig(projectRoot, force = false) {
154
+ const configPath = path.join(projectRoot, 'cursorflow.config.js');
155
+ if (fs.existsSync(configPath) && !force) {
156
+ throw new Error(`Config file already exists: ${configPath}`);
157
+ }
158
+ const template = `module.exports = {
159
+ // Directory configuration
160
+ tasksDir: '_cursorflow/tasks',
161
+ logsDir: '_cursorflow/logs',
162
+
163
+ // Git configuration
164
+ baseBranch: 'main',
165
+ branchPrefix: 'feature/',
166
+
167
+ // Execution configuration
168
+ executor: 'cursor-agent', // 'cursor-agent' | 'cloud'
169
+ pollInterval: 60, // seconds
170
+
171
+ // Dependency management
172
+ allowDependencyChange: false,
173
+ lockfileReadOnly: true,
174
+
175
+ // Review configuration
176
+ enableReview: false,
177
+ reviewModel: 'sonnet-4.5-thinking',
178
+ maxReviewIterations: 3,
179
+
180
+ // Lane configuration
181
+ defaultLaneConfig: {
182
+ devPort: 3001, // 3000 + laneNumber
183
+ autoCreatePr: false,
184
+ },
185
+
186
+ // Logging
187
+ logLevel: 'info', // 'error' | 'warn' | 'info' | 'debug'
188
+ verboseGit: false,
189
+
190
+ // Advanced
191
+ worktreePrefix: 'cursorflow-',
192
+ maxConcurrentLanes: 10,
193
+ };
194
+ `;
195
+ fs.writeFileSync(configPath, template, 'utf8');
196
+ return configPath;
197
+ }
198
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUH,0CAYC;AAKD,gCA4DC;AAKD,kCAEC;AAKD,gCAEC;AAKD,wCAwBC;AAKD,kDA+CC;AApLD,2CAA6B;AAC7B,uCAAyB;AAIzB;;GAEG;AACH,SAAgB,eAAe,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IACjD,IAAI,OAAO,GAAG,GAAG,CAAC;IAElB,OAAO,OAAO,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACvD,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;AAChE,CAAC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,cAA6B,IAAI;IAC1D,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,eAAe,EAAE,CAAC;IAClC,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CA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B,UAAU,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoClB,CAAC;IAEA,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Cursor Agent CLI wrapper and utilities
3
+ */
4
+ /**
5
+ * Check if cursor-agent CLI is installed
6
+ */
7
+ export declare function checkCursorAgentInstalled(): boolean;
8
+ /**
9
+ * Get cursor-agent version
10
+ */
11
+ export declare function getCursorAgentVersion(): string | null;
12
+ /**
13
+ * Ensure cursor-agent is installed, exit with error message if not
14
+ */
15
+ export declare function ensureCursorAgent(): void;
16
+ /**
17
+ * Print installation guide
18
+ */
19
+ export declare function printInstallationGuide(): void;
20
+ /**
21
+ * Check if CURSOR_API_KEY is set (for cloud execution)
22
+ */
23
+ export declare function checkCursorApiKey(): boolean;
24
+ /**
25
+ * Validate cursor-agent setup for given executor type
26
+ */
27
+ export declare function validateSetup(executor?: string): {
28
+ valid: boolean;
29
+ errors: string[];
30
+ };
31
+ /**
32
+ * Get available models (if cursor-agent supports it)
33
+ */
34
+ export declare function getAvailableModels(): string[];
35
+ /**
36
+ * Parse model names from cursor-agent output
37
+ */
38
+ export declare function parseModelsFromOutput(output: string): string[];
39
+ /**
40
+ * Test cursor-agent with a simple command
41
+ */
42
+ export declare function testCursorAgent(): {
43
+ success: boolean;
44
+ output?: string;
45
+ error?: string;
46
+ };
47
+ export interface AuthCheckResult {
48
+ authenticated: boolean;
49
+ message: string;
50
+ details?: string;
51
+ help?: string;
52
+ error?: string;
53
+ }
54
+ /**
55
+ * Check cursor-agent authentication
56
+ */
57
+ export declare function checkCursorAuth(): AuthCheckResult;
58
+ /**
59
+ * Print authentication help
60
+ */
61
+ export declare function printAuthHelp(): void;
@@ -0,0 +1,263 @@
1
+ "use strict";
2
+ /**
3
+ * Cursor Agent CLI wrapper and utilities
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.checkCursorAgentInstalled = checkCursorAgentInstalled;
7
+ exports.getCursorAgentVersion = getCursorAgentVersion;
8
+ exports.ensureCursorAgent = ensureCursorAgent;
9
+ exports.printInstallationGuide = printInstallationGuide;
10
+ exports.checkCursorApiKey = checkCursorApiKey;
11
+ exports.validateSetup = validateSetup;
12
+ exports.getAvailableModels = getAvailableModels;
13
+ exports.parseModelsFromOutput = parseModelsFromOutput;
14
+ exports.testCursorAgent = testCursorAgent;
15
+ exports.checkCursorAuth = checkCursorAuth;
16
+ exports.printAuthHelp = printAuthHelp;
17
+ const child_process_1 = require("child_process");
18
+ /**
19
+ * Check if cursor-agent CLI is installed
20
+ */
21
+ function checkCursorAgentInstalled() {
22
+ try {
23
+ const result = (0, child_process_1.spawnSync)('cursor-agent', ['--version'], { stdio: 'pipe' });
24
+ return result.status === 0;
25
+ }
26
+ catch {
27
+ return false;
28
+ }
29
+ }
30
+ /**
31
+ * Get cursor-agent version
32
+ */
33
+ function getCursorAgentVersion() {
34
+ try {
35
+ const result = (0, child_process_1.spawnSync)('cursor-agent', ['--version'], {
36
+ encoding: 'utf8',
37
+ stdio: 'pipe',
38
+ });
39
+ return result.status === 0 ? result.stdout.trim() : null;
40
+ }
41
+ catch {
42
+ return null;
43
+ }
44
+ }
45
+ /**
46
+ * Ensure cursor-agent is installed, exit with error message if not
47
+ */
48
+ function ensureCursorAgent() {
49
+ if (!checkCursorAgentInstalled()) {
50
+ console.error(`
51
+ ❌ cursor-agent CLI is not installed
52
+
53
+ Installation:
54
+ npm install -g @cursor/agent
55
+ # or
56
+ pnpm add -g @cursor/agent
57
+ # or
58
+ yarn global add @cursor/agent
59
+
60
+ More info: https://docs.cursor.com/agent
61
+ `);
62
+ process.exit(1);
63
+ }
64
+ }
65
+ /**
66
+ * Print installation guide
67
+ */
68
+ function printInstallationGuide() {
69
+ console.log(`
70
+ 📦 cursor-agent CLI Installation Guide
71
+
72
+ The cursor-agent CLI is required to run CursorFlow orchestration.
73
+
74
+ Installation methods:
75
+
76
+ npm install -g @cursor/agent
77
+ pnpm add -g @cursor/agent
78
+ yarn global add @cursor/agent
79
+
80
+ Verification:
81
+
82
+ cursor-agent --version
83
+
84
+ Documentation:
85
+
86
+ https://docs.cursor.com/agent
87
+
88
+ After installation, run your command again.
89
+ `);
90
+ }
91
+ /**
92
+ * Check if CURSOR_API_KEY is set (for cloud execution)
93
+ */
94
+ function checkCursorApiKey() {
95
+ return !!process.env['CURSOR_API_KEY'];
96
+ }
97
+ /**
98
+ * Validate cursor-agent setup for given executor type
99
+ */
100
+ function validateSetup(executor = 'cursor-agent') {
101
+ const errors = [];
102
+ if (executor === 'cursor-agent') {
103
+ if (!checkCursorAgentInstalled()) {
104
+ errors.push('cursor-agent CLI is not installed');
105
+ }
106
+ }
107
+ if (executor === 'cloud') {
108
+ if (!checkCursorApiKey()) {
109
+ errors.push('CURSOR_API_KEY environment variable is not set');
110
+ }
111
+ }
112
+ return {
113
+ valid: errors.length === 0,
114
+ errors,
115
+ };
116
+ }
117
+ /**
118
+ * Get available models (if cursor-agent supports it)
119
+ */
120
+ function getAvailableModels() {
121
+ try {
122
+ // This is a placeholder - actual implementation depends on cursor-agent API
123
+ // execSync('cursor-agent --model invalid "test"', {
124
+ // encoding: 'utf8',
125
+ // stdio: 'pipe',
126
+ // });
127
+ return [];
128
+ }
129
+ catch (error) {
130
+ // Parse from error message
131
+ const output = (error.stderr || error.stdout || '').toString();
132
+ // Extract model names from output
133
+ return parseModelsFromOutput(output);
134
+ }
135
+ }
136
+ /**
137
+ * Parse model names from cursor-agent output
138
+ */
139
+ function parseModelsFromOutput(output) {
140
+ // This is a placeholder implementation
141
+ // Actual parsing depends on cursor-agent CLI output format
142
+ const models = [];
143
+ // Example parsing logic
144
+ const lines = output.split('\n');
145
+ for (const line of lines) {
146
+ if (line.includes('sonnet') || line.includes('opus') || line.includes('gpt')) {
147
+ const match = line.match(/['"]([^'"]+)['"]/);
148
+ if (match) {
149
+ models.push(match[1]);
150
+ }
151
+ }
152
+ }
153
+ return models;
154
+ }
155
+ /**
156
+ * Test cursor-agent with a simple command
157
+ */
158
+ function testCursorAgent() {
159
+ try {
160
+ const result = (0, child_process_1.spawnSync)('cursor-agent', ['--help'], {
161
+ encoding: 'utf8',
162
+ stdio: 'pipe',
163
+ });
164
+ return {
165
+ success: result.status === 0,
166
+ output: result.stdout,
167
+ error: result.stderr,
168
+ };
169
+ }
170
+ catch (error) {
171
+ return {
172
+ success: false,
173
+ error: error.message,
174
+ };
175
+ }
176
+ }
177
+ /**
178
+ * Check cursor-agent authentication
179
+ */
180
+ function checkCursorAuth() {
181
+ try {
182
+ const result = (0, child_process_1.spawnSync)('cursor-agent', ['create-chat'], {
183
+ encoding: 'utf8',
184
+ stdio: 'pipe',
185
+ timeout: 10000, // 10 second timeout
186
+ });
187
+ if (result.status === 0 && result.stdout.trim()) {
188
+ return {
189
+ authenticated: true,
190
+ message: 'Cursor authentication OK',
191
+ };
192
+ }
193
+ const errorMsg = (result.stderr?.trim() || result.stdout?.trim() || '').toString();
194
+ // Check for authentication errors
195
+ if (errorMsg.includes('not authenticated') ||
196
+ errorMsg.includes('login') ||
197
+ errorMsg.includes('auth')) {
198
+ return {
199
+ authenticated: false,
200
+ message: 'Not authenticated with Cursor',
201
+ details: errorMsg,
202
+ help: 'Please open Cursor IDE and sign in to your account',
203
+ };
204
+ }
205
+ // Check for network errors
206
+ if (errorMsg.includes('network') ||
207
+ errorMsg.includes('connection') ||
208
+ errorMsg.includes('timeout')) {
209
+ return {
210
+ authenticated: false,
211
+ message: 'Network error',
212
+ details: errorMsg,
213
+ help: 'Check your internet connection',
214
+ };
215
+ }
216
+ return {
217
+ authenticated: false,
218
+ message: 'Unknown error',
219
+ details: errorMsg,
220
+ };
221
+ }
222
+ catch (error) {
223
+ if (error.code === 'ETIMEDOUT') {
224
+ return {
225
+ authenticated: false,
226
+ message: 'Connection timeout',
227
+ help: 'Check your internet connection',
228
+ };
229
+ }
230
+ return {
231
+ authenticated: false,
232
+ message: 'Failed to check authentication',
233
+ error: error.message,
234
+ };
235
+ }
236
+ }
237
+ /**
238
+ * Print authentication help
239
+ */
240
+ function printAuthHelp() {
241
+ console.log(`
242
+ 🔐 Cursor Authentication Required
243
+
244
+ CursorFlow requires an authenticated Cursor session to use AI features.
245
+
246
+ Steps to authenticate:
247
+
248
+ 1. Open Cursor IDE
249
+ 2. Sign in to your Cursor account (if not already)
250
+ 3. Verify AI features work in the IDE
251
+ 4. Run your CursorFlow command again
252
+
253
+ Common issues:
254
+
255
+ • Not signed in to Cursor
256
+ • Subscription expired or inactive
257
+ • Network connectivity issues
258
+ • VPN or firewall blocking Cursor API
259
+
260
+ For more help, visit: https://docs.cursor.com
261
+ `);
262
+ }
263
+ //# sourceMappingURL=cursor-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor-agent.js","sourceRoot":"","sources":["../../src/utils/cursor-agent.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAOH,8DAOC;AAKD,sDAUC;AAKD,8CAgBC;AAKD,wDAsBC;AAKD,8CAEC;AAKD,sCAmBC;AAKD,gDAeC;AAKD,sDAiBC;AAKD,0CAkBC;AAaD,0CA6DC;AAKD,sCAsBC;AAhRD,iDAAoD;AAEpD;;GAEG;AACH,SAAgB,yBAAyB;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,cAAc,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAC3E,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB;IACnC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,yBAAS,E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,CAAC,SAAS,CAAC;YAC5B,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC/B,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACjC,OAAO;gBACL,aAAa,EAAE,KAAK;gBACpB,OAAO,EAAE,eAAe;gBACxB,OAAO,EAAE,QAAQ;gBACjB,IAAI,EAAE,gCAAgC;aACvC,CAAC;QACJ,CAAC;QAED,OAAO;YACL,aAAa,EAAE,KAAK;YACpB,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,QAAQ;SAClB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC/B,OAAO;gBACL,aAAa,EAAE,KAAK;gBACpB,OAAO,EAAE,oBAAoB;gBAC7B,IAAI,EAAE,gCAAgC;aACvC,CAAC;QACJ,CAAC;QAED,OAAO;YACL,aAAa,EAAE,KAAK;YACpB,OAAO,EAAE,gCAAgC;YACzC,KAAK,EAAE,KAAK,CAAC,OAAO;SACrB,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa;IAC3B,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;GAoBX,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * CursorFlow Doctor - environment and preflight checks
3
+ *
4
+ * This module provides actionable diagnostics for common run failures:
5
+ * - Not inside a Git work tree
6
+ * - Missing `origin` remote (required for pushing lane branches)
7
+ * - Missing Git worktree support
8
+ * - Missing base branch referenced by lane task files
9
+ * - Missing/invalid tasks directory
10
+ * - Missing Cursor Agent setup (optional)
11
+ */
12
+ export type DoctorSeverity = 'error' | 'warn';
13
+ export interface DoctorIssue {
14
+ /**
15
+ * Stable identifier for machines (NOCC) and tests.
16
+ */
17
+ id: string;
18
+ severity: DoctorSeverity;
19
+ title: string;
20
+ message: string;
21
+ /**
22
+ * Suggested commands or steps to fix the issue.
23
+ */
24
+ fixes?: string[];
25
+ /**
26
+ * Optional technical details (stderr, stdout, etc.)
27
+ */
28
+ details?: string;
29
+ }
30
+ export interface DoctorContext {
31
+ cwd: string;
32
+ repoRoot?: string;
33
+ tasksDir?: string;
34
+ executor?: string;
35
+ }
36
+ export interface DoctorReport {
37
+ ok: boolean;
38
+ issues: DoctorIssue[];
39
+ context: DoctorContext;
40
+ }
41
+ export interface DoctorOptions {
42
+ cwd?: string;
43
+ /**
44
+ * Optional tasks directory (used for `cursorflow run` preflight).
45
+ */
46
+ tasksDir?: string;
47
+ /**
48
+ * Executor type ('cursor-agent' | 'cloud' | ...).
49
+ */
50
+ executor?: string;
51
+ /**
52
+ * When true (default), include Cursor Agent install/auth checks.
53
+ */
54
+ includeCursorAgentChecks?: boolean;
55
+ }
56
+ /**
57
+ * Run doctor checks.
58
+ *
59
+ * If `tasksDir` is provided, additional preflight checks are performed:
60
+ * - tasks directory existence and JSON validity
61
+ * - baseBranch referenced by lanes exists locally
62
+ */
63
+ export declare function runDoctor(options?: DoctorOptions): DoctorReport;