@litmers/cursorflow-orchestrator 0.1.3 → 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,262 @@
|
|
|
1
|
+
# CursorFlow Demo Project
|
|
2
|
+
|
|
3
|
+
A complete example project demonstrating CursorFlow's capabilities with real LLM execution.
|
|
4
|
+
|
|
5
|
+
## 🎯 Purpose
|
|
6
|
+
|
|
7
|
+
This demo project shows how to use CursorFlow to orchestrate parallel AI tasks, including:
|
|
8
|
+
- Task creation and configuration
|
|
9
|
+
- Git worktree management
|
|
10
|
+
- LLM agent execution
|
|
11
|
+
- Real-time monitoring
|
|
12
|
+
- Complete log capture
|
|
13
|
+
|
|
14
|
+
## 📦 Setup
|
|
15
|
+
|
|
16
|
+
### 1. Prerequisites
|
|
17
|
+
|
|
18
|
+
- **Node.js** >= 18.0.0
|
|
19
|
+
- **Git** with worktree support
|
|
20
|
+
- **cursor-agent** CLI: `npm install -g @cursor/agent`
|
|
21
|
+
- **Cursor IDE** with valid authentication
|
|
22
|
+
|
|
23
|
+
### 2. Initialize Your Project
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Create a new project
|
|
27
|
+
mkdir my-cursorflow-test
|
|
28
|
+
cd my-cursorflow-test
|
|
29
|
+
git init
|
|
30
|
+
git config user.email "you@example.com"
|
|
31
|
+
git config user.name "Your Name"
|
|
32
|
+
|
|
33
|
+
# Create initial files
|
|
34
|
+
echo '{"name":"my-test","version":"1.0.0"}' > package.json
|
|
35
|
+
echo "# My Test Project" > README.md
|
|
36
|
+
git add .
|
|
37
|
+
git commit -m "Initial commit"
|
|
38
|
+
|
|
39
|
+
# Rename branch to main (if needed)
|
|
40
|
+
git branch -m main
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 3. Initialize CursorFlow
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Install cursorflow globally (if not already)
|
|
47
|
+
npm install -g @litmers/cursorflow-orchestrator
|
|
48
|
+
|
|
49
|
+
# Initialize in your project
|
|
50
|
+
cursorflow init
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 4. Copy Demo Tasks
|
|
54
|
+
|
|
55
|
+
Copy the `_cursorflow/tasks/demo-test/` directory from this example to your project:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# From the cursorflow repository
|
|
59
|
+
cp -r examples/demo-project/_cursorflow/tasks/demo-test your-project/_cursorflow/tasks/
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 🚀 Running the Demo
|
|
63
|
+
|
|
64
|
+
### Run the Tasks
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cursorflow run _cursorflow/tasks/demo-test/
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Monitor in Real-Time
|
|
71
|
+
|
|
72
|
+
In a separate terminal:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Single check
|
|
76
|
+
cursorflow monitor
|
|
77
|
+
|
|
78
|
+
# Watch mode (updates every 2 seconds)
|
|
79
|
+
cursorflow monitor --watch --interval 2
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 📋 Demo Tasks
|
|
83
|
+
|
|
84
|
+
This demo includes 2 tasks that run in parallel:
|
|
85
|
+
|
|
86
|
+
### Task 1: Create Utils (`01-create-utils.json`)
|
|
87
|
+
- **Goal**: Create `src/utils.js` with utility functions
|
|
88
|
+
- **Functions**: capitalize, sum, unique
|
|
89
|
+
- **Model**: Sonnet 4.5
|
|
90
|
+
- **Time**: ~1-2 minutes
|
|
91
|
+
|
|
92
|
+
### Task 2: Add Tests (`02-add-tests.json`)
|
|
93
|
+
- **Goal**: Create `src/utils.test.js` with simple tests
|
|
94
|
+
- **Tests**: Manual console.log tests for all utils
|
|
95
|
+
- **Model**: Sonnet 4.5
|
|
96
|
+
- **Time**: ~1-2 minutes
|
|
97
|
+
|
|
98
|
+
## 📊 Expected Results
|
|
99
|
+
|
|
100
|
+
After completion, you'll see:
|
|
101
|
+
|
|
102
|
+
### 1. Source Files
|
|
103
|
+
```
|
|
104
|
+
src/
|
|
105
|
+
├── utils.js # Created by Task 1
|
|
106
|
+
└── utils.test.js # Created by Task 2
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 2. Git Branches
|
|
110
|
+
```bash
|
|
111
|
+
git branch | grep cursorflow
|
|
112
|
+
# cursorflow/demo-XXXXX--01-create-utils
|
|
113
|
+
# cursorflow/demo-XXXXX--02-add-tests
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 3. Logs
|
|
117
|
+
```
|
|
118
|
+
_cursorflow/logs/runs/run-XXXXX/
|
|
119
|
+
└── lanes/
|
|
120
|
+
├── 01-create-utils/
|
|
121
|
+
│ ├── state.json
|
|
122
|
+
│ ├── conversation.jsonl
|
|
123
|
+
│ └── terminal.log
|
|
124
|
+
└── 02-add-tests/
|
|
125
|
+
├── state.json
|
|
126
|
+
├── conversation.jsonl
|
|
127
|
+
└── terminal.log
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 4. Monitor Output
|
|
131
|
+
```
|
|
132
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
133
|
+
📊 Run: run-1234567890123
|
|
134
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
135
|
+
|
|
136
|
+
Lane Status Progress Tasks
|
|
137
|
+
─────────────── ──────────────── ──────── ──────────
|
|
138
|
+
01-create-utils ✅ completed 100% 1/1
|
|
139
|
+
02-add-tests ✅ completed 100% 1/1
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## 🔍 Inspecting Results
|
|
143
|
+
|
|
144
|
+
### View Conversation Logs
|
|
145
|
+
```bash
|
|
146
|
+
cat _cursorflow/logs/runs/run-*/lanes/01-create-utils/conversation.jsonl
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### View Terminal Output
|
|
150
|
+
```bash
|
|
151
|
+
cat _cursorflow/logs/runs/run-*/lanes/01-create-utils/terminal.log
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### View Lane State
|
|
155
|
+
```bash
|
|
156
|
+
cat _cursorflow/logs/runs/run-*/lanes/01-create-utils/state.json
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### View Branch Changes
|
|
160
|
+
```bash
|
|
161
|
+
# List branches
|
|
162
|
+
git branch | grep cursorflow
|
|
163
|
+
|
|
164
|
+
# View commits
|
|
165
|
+
git log cursorflow/demo-XXXXX--01-create-utils
|
|
166
|
+
|
|
167
|
+
# View diff
|
|
168
|
+
git diff main cursorflow/demo-XXXXX--01-create-utils
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 🧹 Cleanup
|
|
172
|
+
|
|
173
|
+
After testing, clean up the worktrees and branches:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Remove worktrees
|
|
177
|
+
git worktree list | grep cursorflow | awk '{print $1}' | xargs -I {} git worktree remove {} --force
|
|
178
|
+
|
|
179
|
+
# Delete branches
|
|
180
|
+
git branch | grep cursorflow | xargs -I {} git branch -D {}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Or use the clean command (if available):
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
cursorflow clean branches --all
|
|
187
|
+
cursorflow clean worktrees --all
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 🐛 Troubleshooting
|
|
191
|
+
|
|
192
|
+
### Authentication Failed
|
|
193
|
+
```
|
|
194
|
+
Error: Cursor authentication failed
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Solution**:
|
|
198
|
+
1. Open Cursor IDE
|
|
199
|
+
2. Sign in to your account
|
|
200
|
+
3. Verify AI features work
|
|
201
|
+
4. Run `node test-auth.js` to check authentication
|
|
202
|
+
|
|
203
|
+
### cursor-agent Not Found
|
|
204
|
+
```
|
|
205
|
+
Error: cursor-agent CLI not found
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Solution**:
|
|
209
|
+
```bash
|
|
210
|
+
npm install -g @cursor/agent
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Timeout Errors
|
|
214
|
+
```
|
|
215
|
+
Error: cursor-agent timed out
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Solution**:
|
|
219
|
+
- Check internet connection
|
|
220
|
+
- Verify Cursor IDE is signed in
|
|
221
|
+
- Check if firewall/VPN is blocking
|
|
222
|
+
|
|
223
|
+
### Worktree Creation Failed
|
|
224
|
+
```
|
|
225
|
+
Error: failed to create worktree
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Solution**:
|
|
229
|
+
- Ensure you have at least one commit: `git log`
|
|
230
|
+
- Check you're on the main branch: `git branch`
|
|
231
|
+
|
|
232
|
+
## 📖 Learn More
|
|
233
|
+
|
|
234
|
+
- **CursorFlow Documentation**: [Main README](../../README.md)
|
|
235
|
+
- **Task Configuration**: See task JSON files for structure
|
|
236
|
+
- **Configuration Options**: Check `cursorflow.config.js`
|
|
237
|
+
|
|
238
|
+
## 💡 Next Steps
|
|
239
|
+
|
|
240
|
+
After running this demo:
|
|
241
|
+
|
|
242
|
+
1. **Examine the logs** to understand execution flow
|
|
243
|
+
2. **Check the branches** to see what the LLM created
|
|
244
|
+
3. **Modify prompts** to test different scenarios
|
|
245
|
+
4. **Create your own tasks** for real projects
|
|
246
|
+
5. **Explore parallel execution** with more complex workflows
|
|
247
|
+
|
|
248
|
+
## ⏱️ Timing
|
|
249
|
+
|
|
250
|
+
- Setup: ~5 minutes
|
|
251
|
+
- Task execution: ~2-4 minutes
|
|
252
|
+
- Total: ~10 minutes
|
|
253
|
+
|
|
254
|
+
## ⚠️ Notes
|
|
255
|
+
|
|
256
|
+
- Real LLM API calls will be made
|
|
257
|
+
- Small API usage will occur (~2 requests)
|
|
258
|
+
- Internet connection required
|
|
259
|
+
- Cursor authentication required
|
|
260
|
+
|
|
261
|
+
Happy testing! 🚀
|
|
262
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseBranch": "main",
|
|
3
|
+
"branchPrefix": "cursorflow/demo-",
|
|
4
|
+
"executor": "cursor-agent",
|
|
5
|
+
"autoCreatePr": false,
|
|
6
|
+
"pollInterval": 10,
|
|
7
|
+
"dependencyPolicy": {
|
|
8
|
+
"allowDependencyChange": false,
|
|
9
|
+
"lockfileReadOnly": true
|
|
10
|
+
},
|
|
11
|
+
"tasks": [
|
|
12
|
+
{
|
|
13
|
+
"name": "create-utils",
|
|
14
|
+
"model": "sonnet-4.5",
|
|
15
|
+
"prompt": "# Task: Create a simple utility module\n\n## Goal\nCreate a `src/utils.js` file with basic utility functions.\n\n## Requirements\n1. Create `src/` directory if it doesn't exist\n2. Create `src/utils.js` with the following functions:\n - `capitalize(str)`: Capitalizes the first letter of a string\n - `sum(arr)`: Returns the sum of an array of numbers\n - `unique(arr)`: Returns unique elements from an array\n\n## Steps\n1. Create the src directory\n2. Write the utils.js file with proper JSDoc comments\n3. Add module.exports at the end\n4. Commit with message: \"feat: add utility functions\"\n\n## Important\n- Use modern JavaScript (ES6+)\n- Add JSDoc comments for each function\n- Make sure all functions are exported\n"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"baseBranch": "main",
|
|
3
|
+
"branchPrefix": "cursorflow/demo-",
|
|
4
|
+
"executor": "cursor-agent",
|
|
5
|
+
"autoCreatePr": false,
|
|
6
|
+
"pollInterval": 10,
|
|
7
|
+
"dependencyPolicy": {
|
|
8
|
+
"allowDependencyChange": false,
|
|
9
|
+
"lockfileReadOnly": true
|
|
10
|
+
},
|
|
11
|
+
"tasks": [
|
|
12
|
+
{
|
|
13
|
+
"name": "add-tests",
|
|
14
|
+
"model": "sonnet-4.5",
|
|
15
|
+
"prompt": "# Task: Add simple tests for utility functions\n\n## Goal\nCreate a `src/utils.test.js` file with basic tests.\n\n## Requirements\n1. Create `src/utils.test.js`\n2. Add simple manual tests (no testing framework needed)\n3. Test all three utility functions:\n - Test `capitalize()` with a few examples\n - Test `sum()` with different arrays\n - Test `unique()` with arrays containing duplicates\n\n## Steps\n1. Create the test file\n2. Import the utils module\n3. Write simple console.log tests that show expected vs actual\n4. Add a success message at the end if all tests pass\n5. Commit with message: \"test: add basic tests for utils\"\n\n## Example Format\n```javascript\nconst utils = require('./utils');\n\nconsole.log('Testing capitalize...');\nconst result1 = utils.capitalize('hello');\nconsole.log('Expected: Hello, Got:', result1);\nconsole.log(result1 === 'Hello' ? '✓ Pass' : '✗ Fail');\n```\n"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# CursorFlow Demo Test
|
|
2
|
+
|
|
3
|
+
This directory contains test tasks for demonstrating CursorFlow with real LLM execution.
|
|
4
|
+
|
|
5
|
+
## Tasks Overview
|
|
6
|
+
|
|
7
|
+
### 01-create-utils.json
|
|
8
|
+
Creates a utility module with basic functions:
|
|
9
|
+
- capitalize(str)
|
|
10
|
+
- sum(arr)
|
|
11
|
+
- unique(arr)
|
|
12
|
+
|
|
13
|
+
**Model**: sonnet-4.5
|
|
14
|
+
**Estimated time**: 1-2 minutes
|
|
15
|
+
|
|
16
|
+
### 02-add-tests.json
|
|
17
|
+
Adds simple tests for the utility functions without requiring any testing framework.
|
|
18
|
+
|
|
19
|
+
**Model**: sonnet-4.5
|
|
20
|
+
**Estimated time**: 1-2 minutes
|
|
21
|
+
|
|
22
|
+
## Running the Demo
|
|
23
|
+
|
|
24
|
+
### Prerequisites
|
|
25
|
+
- cursor-agent CLI installed (`npm install -g @cursor/agent`)
|
|
26
|
+
- Valid Cursor API key configured
|
|
27
|
+
|
|
28
|
+
### Run the test
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# From your project directory (after cursorflow init)
|
|
32
|
+
cursorflow run _cursorflow/tasks/demo-test/
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Monitor execution
|
|
36
|
+
|
|
37
|
+
In a separate terminal:
|
|
38
|
+
```bash
|
|
39
|
+
# Watch mode (updates every 2 seconds)
|
|
40
|
+
cursorflow monitor --watch --interval 2
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Check results
|
|
44
|
+
|
|
45
|
+
After completion:
|
|
46
|
+
```bash
|
|
47
|
+
# View the logs
|
|
48
|
+
ls -la _cursorflow/logs/runs/
|
|
49
|
+
|
|
50
|
+
# Check the latest run
|
|
51
|
+
cursorflow monitor
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## What to Expect
|
|
55
|
+
|
|
56
|
+
1. **Orchestrator** will create 2 lanes (one per task)
|
|
57
|
+
2. **Each lane** will:
|
|
58
|
+
- Create a Git worktree
|
|
59
|
+
- Create a branch (`cursorflow/demo-XXXXX--01-create-utils`, etc.)
|
|
60
|
+
- Execute the LLM agent with the prompt
|
|
61
|
+
- Commit changes
|
|
62
|
+
- Push the branch
|
|
63
|
+
3. **Monitor** will show:
|
|
64
|
+
- Lane status (running, completed, failed)
|
|
65
|
+
- Progress (current task / total tasks)
|
|
66
|
+
- Real-time updates in watch mode
|
|
67
|
+
|
|
68
|
+
## Expected Output Structure
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
_cursorflow/
|
|
72
|
+
├── logs/
|
|
73
|
+
│ └── runs/
|
|
74
|
+
│ └── run-XXXXX/
|
|
75
|
+
│ └── lanes/
|
|
76
|
+
│ ├── 01-create-utils/
|
|
77
|
+
│ │ ├── state.json
|
|
78
|
+
│ │ ├── conversation.jsonl
|
|
79
|
+
│ │ └── terminal.log
|
|
80
|
+
│ └── 02-add-tests/
|
|
81
|
+
│ ├── state.json
|
|
82
|
+
│ ├── conversation.jsonl
|
|
83
|
+
│ └── terminal.log
|
|
84
|
+
└── tasks/
|
|
85
|
+
└── demo-test/
|
|
86
|
+
├── 01-create-utils.json
|
|
87
|
+
├── 02-add-tests.json
|
|
88
|
+
└── README.md (this file)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Troubleshooting
|
|
92
|
+
|
|
93
|
+
### If cursor-agent is not found
|
|
94
|
+
```bash
|
|
95
|
+
npm install -g @cursor/agent
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### If API key is missing
|
|
99
|
+
Check your Cursor IDE settings and ensure you're authenticated.
|
|
100
|
+
|
|
101
|
+
### If worktree creation fails
|
|
102
|
+
Make sure you're in a Git repository with at least one commit.
|
|
103
|
+
|
|
104
|
+
## Notes
|
|
105
|
+
|
|
106
|
+
- These tasks are designed to be simple and quick
|
|
107
|
+
- No external dependencies required
|
|
108
|
+
- All operations are Git-safe (branches only, no main changes)
|
|
109
|
+
- Logs are preserved for inspection
|
package/package.json
CHANGED
|
@@ -1,61 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@litmers/cursorflow-orchestrator",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Git worktree-based parallel AI agent orchestration system for Cursor",
|
|
5
|
-
"main": "
|
|
6
|
-
"bin": {
|
|
7
|
-
"cursorflow": "
|
|
8
|
-
"cursorflow-setup": "
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"release
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"security:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
},
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@litmers/cursorflow-orchestrator",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Git worktree-based parallel AI agent orchestration system for Cursor",
|
|
5
|
+
"main": "dist/cli/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"cursorflow": "dist/cli/index.js",
|
|
8
|
+
"cursorflow-setup": "dist/cli/setup-commands.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"watch": "tsc -w",
|
|
13
|
+
"test": "jest",
|
|
14
|
+
"prepublishOnly": "npm run build && npm run validate",
|
|
15
|
+
"postinstall": "node scripts/postinstall.js",
|
|
16
|
+
"validate": "npm pack --dry-run",
|
|
17
|
+
"release": "scripts/release.sh",
|
|
18
|
+
"release:patch": "scripts/release.sh patch",
|
|
19
|
+
"release:minor": "scripts/release.sh minor",
|
|
20
|
+
"release:major": "scripts/release.sh major",
|
|
21
|
+
"security:check": "scripts/local-security-gate.sh",
|
|
22
|
+
"security:audit": "npm audit",
|
|
23
|
+
"security:audit:fix": "npm audit fix",
|
|
24
|
+
"security:setup": "scripts/setup-security.sh",
|
|
25
|
+
"prepare": "husky"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"cursor",
|
|
29
|
+
"cursor-ide",
|
|
30
|
+
"ai-agent",
|
|
31
|
+
"orchestration",
|
|
32
|
+
"git-worktree",
|
|
33
|
+
"parallel-execution",
|
|
34
|
+
"code-review",
|
|
35
|
+
"automation",
|
|
36
|
+
"devops",
|
|
37
|
+
"ci-cd"
|
|
38
|
+
],
|
|
39
|
+
"author": "Eugene Jin <eungjin.cigro@gmail.com>",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/eungjin-cigro/cursorflow.git"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/eungjin-cigro/cursorflow/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/eungjin-cigro/cursorflow#readme",
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=18.0.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/jest": "^30.0.0",
|
|
54
|
+
"@types/node": "^25.0.3",
|
|
55
|
+
"husky": "^9.1.7",
|
|
56
|
+
"jest": "^30.2.0",
|
|
57
|
+
"ts-jest": "^29.4.6",
|
|
58
|
+
"typescript": "^5.9.3"
|
|
59
|
+
},
|
|
60
|
+
"files": [
|
|
61
|
+
"dist/",
|
|
62
|
+
"src/",
|
|
63
|
+
"scripts/",
|
|
64
|
+
"commands/",
|
|
65
|
+
"templates/",
|
|
66
|
+
"examples/",
|
|
67
|
+
"README.md",
|
|
68
|
+
"LICENSE",
|
|
69
|
+
"CHANGELOG.md"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
const path = require('path');
|
|
10
|
-
const {
|
|
10
|
+
const { spawnSync } = require('child_process');
|
|
11
11
|
|
|
12
12
|
// 색상 정의
|
|
13
13
|
const colors = {
|
|
@@ -29,8 +29,10 @@ if (!OPENAI_API_KEY) {
|
|
|
29
29
|
function getChangedFiles() {
|
|
30
30
|
try {
|
|
31
31
|
const baseBranch = process.env.GITHUB_BASE_REF || 'main';
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const result = spawnSync('git', ['diff', '--name-only', `origin/${baseBranch}...HEAD`], { encoding: 'utf-8' });
|
|
33
|
+
if (result.status !== 0) throw new Error(result.stderr);
|
|
34
|
+
|
|
35
|
+
const files = result.stdout
|
|
34
36
|
.split('\n')
|
|
35
37
|
.filter(f => f.endsWith('.js') || f.endsWith('.ts') || f.endsWith('.jsx') || f.endsWith('.tsx'))
|
|
36
38
|
.filter(f => f && fs.existsSync(f));
|
|
@@ -38,7 +40,10 @@ function getChangedFiles() {
|
|
|
38
40
|
} catch (error) {
|
|
39
41
|
// PR이 아닌 경우 최근 커밋의 파일들
|
|
40
42
|
try {
|
|
41
|
-
const
|
|
43
|
+
const result = spawnSync('git', ['diff-tree', '--no-commit-id', '--name-only', '-r', 'HEAD'], { encoding: 'utf-8' });
|
|
44
|
+
if (result.status !== 0) return [];
|
|
45
|
+
|
|
46
|
+
const files = result.stdout
|
|
42
47
|
.split('\n')
|
|
43
48
|
.filter(f => f.endsWith('.js') || f.endsWith('.ts') || f.endsWith('.jsx') || f.endsWith('.tsx'))
|
|
44
49
|
.filter(f => f && fs.existsSync(f));
|
|
@@ -71,6 +76,8 @@ Please analyze for:
|
|
|
71
76
|
8. **Rate limiting or DoS vulnerabilities**
|
|
72
77
|
9. **CSRF/SSRF vulnerabilities**
|
|
73
78
|
10. **Any OWASP Top 10 issues**
|
|
79
|
+
11. **CodeQL-specific patterns** (tainted data flow, improper input validation, dangerous sinks like eval or child_process.exec)
|
|
80
|
+
12. **Code quality issues** that might trigger CodeQL's "Security and Quality" queries
|
|
74
81
|
|
|
75
82
|
Respond in JSON format:
|
|
76
83
|
{
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# 로컬 보안 게이트 (Local Security Gate)
|
|
4
|
+
# 커밋 또는 푸시 전에 보안 취약점을 미리 검사합니다.
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# 색상 정의
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
BLUE='\033[0;34m'
|
|
13
|
+
NC='\033[0m'
|
|
14
|
+
|
|
15
|
+
echo -e "${BLUE}🔍 Starting Local Security Gate...${NC}"
|
|
16
|
+
|
|
17
|
+
# 1. 의존성 취약점 검사 (npm audit)
|
|
18
|
+
echo -e "\n${BLUE}[1/4] Checking dependencies (npm audit)...${NC}"
|
|
19
|
+
if npm audit --audit-level=high; then
|
|
20
|
+
echo -e "${GREEN}✅ No high-severity dependency issues found.${NC}"
|
|
21
|
+
else
|
|
22
|
+
echo -e "${RED}❌ High-severity dependency issues found!${NC}"
|
|
23
|
+
echo -e "${YELLOW}Please run 'npm audit fix' to resolve them.${NC}"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# 2. 정적 코드 분석 (Semgrep - CodeQL 대안)
|
|
28
|
+
echo -e "\n${BLUE}[2/4] Running static analysis (Semgrep)...${NC}"
|
|
29
|
+
if command -v semgrep &> /dev/null; then
|
|
30
|
+
if semgrep --config=auto --error .; then
|
|
31
|
+
echo -e "${GREEN}✅ Semgrep analysis passed.${NC}"
|
|
32
|
+
else
|
|
33
|
+
echo -e "${RED}❌ Semgrep found potential security issues!${NC}"
|
|
34
|
+
echo -e "${YELLOW}CodeQL과 유사한 보안 이슈들입니다. 위 리포트를 확인하고 수정하세요.${NC}"
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
else
|
|
38
|
+
echo -e "${YELLOW}⚠️ Semgrep not installed. Skipping static analysis.${NC}"
|
|
39
|
+
echo -e "Install it to catch CodeQL-like issues: pip install semgrep"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# 3. 민감 정보 노출 검사 (Simple Secret Scan)
|
|
43
|
+
echo -e "\n${BLUE}[3/4] Checking for hardcoded secrets...${NC}"
|
|
44
|
+
# git에 추적되는 파일들 중 API 키나 비밀번호 패턴 검색
|
|
45
|
+
# .cursorignore나 .gitignore에 있는 파일은 제외
|
|
46
|
+
# .github, *.md, scripts/setup-security.sh 등은 제외
|
|
47
|
+
# 변수 선언이나 에러 메시지에 포함된 키워드는 제외하도록 필터 강화
|
|
48
|
+
SECRETS_FOUND=$(git grep -Ei "api[_-]?key|secret|password|token|bearer|private[_-]?key" -- ":!package-lock.json" ":!*.md" ":!scripts/setup-security.sh" ":!scripts/ai-security-check.js" ":!.github/*" ":!scripts/local-security-gate.sh" | grep -v "process.env" | grep -v "example" | grep -v "\${{" | grep -vE "stderr\.includes|checkCursorApiKey|CURSOR_API_KEY|api key|API_KEY" || true)
|
|
49
|
+
|
|
50
|
+
if [ -z "$SECRETS_FOUND" ]; then
|
|
51
|
+
echo -e "${GREEN}✅ No obvious secrets found in tracked files.${NC}"
|
|
52
|
+
else
|
|
53
|
+
echo -e "${YELLOW}⚠️ Possible secrets found:${NC}"
|
|
54
|
+
echo "$SECRETS_FOUND"
|
|
55
|
+
echo -e "\n${RED}❌ Please remove secrets or move them to .env file before pushing!${NC}"
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# 4. AI 기반 코드 보안 분석 (선택적)
|
|
60
|
+
echo -e "\n${BLUE}[4/4] AI-based security analysis...${NC}"
|
|
61
|
+
if [ -z "$OPENAI_API_KEY" ]; then
|
|
62
|
+
echo -e "${YELLOW}⚠️ OPENAI_API_KEY not set. Skipping AI security check.${NC}"
|
|
63
|
+
echo -e "Set the environment variable to enable this step: export OPENAI_API_KEY=your-key"
|
|
64
|
+
else
|
|
65
|
+
if node scripts/ai-security-check.js; then
|
|
66
|
+
echo -e "${GREEN}✅ AI security check passed.${NC}"
|
|
67
|
+
else
|
|
68
|
+
echo -e "${RED}❌ AI security check failed!${NC}"
|
|
69
|
+
exit 1
|
|
70
|
+
fi
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
echo -e "\n${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
74
|
+
echo -e "${GREEN}✅ All local security checks passed!${NC}"
|
|
75
|
+
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n"
|
|
76
|
+
|