@litmers/cursorflow-orchestrator 0.1.2 → 0.1.5
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.
- package/CHANGELOG.md +7 -6
- package/dist/cli/clean.d.ts +5 -0
- package/dist/cli/clean.js +57 -0
- package/dist/cli/clean.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.js +120 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +7 -0
- package/dist/cli/init.js +302 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/monitor.d.ts +8 -0
- package/dist/cli/monitor.js +210 -0
- package/dist/cli/monitor.js.map +1 -0
- package/dist/cli/resume.d.ts +5 -0
- package/dist/cli/resume.js +58 -0
- package/dist/cli/resume.js.map +1 -0
- package/dist/cli/run.d.ts +5 -0
- package/dist/cli/run.js +74 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/setup-commands.d.ts +19 -0
- package/dist/cli/setup-commands.js +218 -0
- package/dist/cli/setup-commands.js.map +1 -0
- package/dist/core/orchestrator.d.ts +47 -0
- package/dist/core/orchestrator.js +192 -0
- package/dist/core/orchestrator.js.map +1 -0
- package/dist/core/reviewer.d.ts +60 -0
- package/dist/core/reviewer.js +239 -0
- package/dist/core/reviewer.js.map +1 -0
- package/dist/core/runner.d.ts +49 -0
- package/dist/core/runner.js +475 -0
- package/dist/core/runner.js.map +1 -0
- package/dist/utils/config.d.ts +31 -0
- package/dist/utils/config.js +198 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/cursor-agent.d.ts +61 -0
- package/dist/utils/cursor-agent.js +263 -0
- package/dist/utils/cursor-agent.js.map +1 -0
- package/dist/utils/git.d.ts +131 -0
- package/dist/utils/git.js +272 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/logger.d.ts +68 -0
- package/dist/utils/logger.js +158 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/state.d.ts +65 -0
- package/dist/utils/state.js +216 -0
- package/dist/utils/state.js.map +1 -0
- package/dist/utils/types.d.ts +117 -0
- package/dist/utils/types.js +6 -0
- package/dist/utils/types.js.map +1 -0
- package/examples/README.md +155 -0
- package/examples/demo-project/README.md +262 -0
- package/examples/demo-project/_cursorflow/tasks/demo-test/01-create-utils.json +18 -0
- package/examples/demo-project/_cursorflow/tasks/demo-test/02-add-tests.json +18 -0
- package/examples/demo-project/_cursorflow/tasks/demo-test/README.md +109 -0
- package/package.json +71 -61
- package/scripts/ai-security-check.js +11 -4
- package/scripts/local-security-gate.sh +76 -0
- package/src/cli/{clean.js → clean.ts} +11 -5
- package/src/cli/{index.js → index.ts} +22 -16
- package/src/cli/{init.js → init.ts} +26 -18
- package/src/cli/{monitor.js → monitor.ts} +57 -44
- package/src/cli/{resume.js → resume.ts} +11 -5
- package/src/cli/run.ts +54 -0
- package/src/cli/{setup-commands.js → setup-commands.ts} +19 -18
- package/src/core/{orchestrator.js → orchestrator.ts} +44 -26
- package/src/core/{reviewer.js → reviewer.ts} +36 -29
- package/src/core/{runner.js → runner.ts} +78 -56
- package/src/utils/{config.js → config.ts} +17 -25
- package/src/utils/{cursor-agent.js → cursor-agent.ts} +38 -47
- package/src/utils/{git.js → git.ts} +70 -56
- package/src/utils/{logger.js → logger.ts} +170 -178
- package/src/utils/{state.js → state.ts} +30 -38
- package/src/utils/types.ts +133 -0
- 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;;;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
|
|
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,EAAC,cAAc,EAAE,CAAC,WAAW,CAAC,EAAE;YACtD,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,IAAI,CAAC,yBAAyB,EAAE,EAAE,CAAC;QACjC,OAAO,CAAC,KAAK,CAAC;;;;;;;;;;;KAWb,CAAC,CAAC;QACH,OAAO,CAAC,I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O;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,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git utilities for CursorFlow
|
|
3
|
+
*/
|
|
4
|
+
export interface GitRunOptions {
|
|
5
|
+
cwd?: string;
|
|
6
|
+
silent?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface GitResult {
|
|
9
|
+
exitCode: number;
|
|
10
|
+
stdout: string;
|
|
11
|
+
stderr: string;
|
|
12
|
+
success: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface WorktreeInfo {
|
|
15
|
+
path: string;
|
|
16
|
+
branch?: string;
|
|
17
|
+
head?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ChangedFile {
|
|
20
|
+
status: string;
|
|
21
|
+
file: string;
|
|
22
|
+
}
|
|
23
|
+
export interface CommitInfo {
|
|
24
|
+
hash: string;
|
|
25
|
+
shortHash: string;
|
|
26
|
+
author: string;
|
|
27
|
+
authorEmail: string;
|
|
28
|
+
timestamp: number;
|
|
29
|
+
subject: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Run git command and return output
|
|
33
|
+
*/
|
|
34
|
+
export declare function runGit(args: string[], options?: GitRunOptions): string;
|
|
35
|
+
/**
|
|
36
|
+
* Run git command and return result object
|
|
37
|
+
*/
|
|
38
|
+
export declare function runGitResult(args: string[], options?: GitRunOptions): GitResult;
|
|
39
|
+
/**
|
|
40
|
+
* Get current branch name
|
|
41
|
+
*/
|
|
42
|
+
export declare function getCurrentBranch(cwd?: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Get repository root directory
|
|
45
|
+
*/
|
|
46
|
+
export declare function getRepoRoot(cwd?: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Check if directory is a git repository
|
|
49
|
+
*/
|
|
50
|
+
export declare function isGitRepo(cwd?: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Check if worktree exists
|
|
53
|
+
*/
|
|
54
|
+
export declare function worktreeExists(worktreePath: string, cwd?: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Create worktree
|
|
57
|
+
*/
|
|
58
|
+
export declare function createWorktree(worktreePath: string, branchName: string, options?: {
|
|
59
|
+
cwd?: string;
|
|
60
|
+
baseBranch?: string;
|
|
61
|
+
}): string;
|
|
62
|
+
/**
|
|
63
|
+
* Remove worktree
|
|
64
|
+
*/
|
|
65
|
+
export declare function removeWorktree(worktreePath: string, options?: {
|
|
66
|
+
cwd?: string;
|
|
67
|
+
force?: boolean;
|
|
68
|
+
}): void;
|
|
69
|
+
/**
|
|
70
|
+
* List all worktrees
|
|
71
|
+
*/
|
|
72
|
+
export declare function listWorktrees(cwd?: string): WorktreeInfo[];
|
|
73
|
+
/**
|
|
74
|
+
* Check if there are uncommitted changes
|
|
75
|
+
*/
|
|
76
|
+
export declare function hasUncommittedChanges(cwd?: string): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Get list of changed files
|
|
79
|
+
*/
|
|
80
|
+
export declare function getChangedFiles(cwd?: string): ChangedFile[];
|
|
81
|
+
/**
|
|
82
|
+
* Create commit
|
|
83
|
+
*/
|
|
84
|
+
export declare function commit(message: string, options?: {
|
|
85
|
+
cwd?: string;
|
|
86
|
+
addAll?: boolean;
|
|
87
|
+
}): void;
|
|
88
|
+
/**
|
|
89
|
+
* Push to remote
|
|
90
|
+
*/
|
|
91
|
+
export declare function push(branchName: string, options?: {
|
|
92
|
+
cwd?: string;
|
|
93
|
+
force?: boolean;
|
|
94
|
+
setUpstream?: boolean;
|
|
95
|
+
}): void;
|
|
96
|
+
/**
|
|
97
|
+
* Fetch from remote
|
|
98
|
+
*/
|
|
99
|
+
export declare function fetch(options?: {
|
|
100
|
+
cwd?: string;
|
|
101
|
+
prune?: boolean;
|
|
102
|
+
}): void;
|
|
103
|
+
/**
|
|
104
|
+
* Check if branch exists (local or remote)
|
|
105
|
+
*/
|
|
106
|
+
export declare function branchExists(branchName: string, options?: {
|
|
107
|
+
cwd?: string;
|
|
108
|
+
remote?: boolean;
|
|
109
|
+
}): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Delete branch
|
|
112
|
+
*/
|
|
113
|
+
export declare function deleteBranch(branchName: string, options?: {
|
|
114
|
+
cwd?: string;
|
|
115
|
+
force?: boolean;
|
|
116
|
+
remote?: boolean;
|
|
117
|
+
}): void;
|
|
118
|
+
/**
|
|
119
|
+
* Merge branch
|
|
120
|
+
*/
|
|
121
|
+
export declare function merge(branchName: string, options?: {
|
|
122
|
+
cwd?: string;
|
|
123
|
+
noFf?: boolean;
|
|
124
|
+
message?: string | null;
|
|
125
|
+
}): void;
|
|
126
|
+
/**
|
|
127
|
+
* Get commit info
|
|
128
|
+
*/
|
|
129
|
+
export declare function getCommitInfo(commitHash: string, options?: {
|
|
130
|
+
cwd?: string;
|
|
131
|
+
}): CommitInfo | null;
|