@segosolutions/auto-task 1.0.0 → 1.1.0
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/README.md +534 -108
- package/dist/index.cjs +42 -36
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,133 +1,260 @@
|
|
|
1
1
|
# @segosolutions/auto-task
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@segosolutions/auto-task)
|
|
4
|
+
[](https://www.npmjs.com/package/@segosolutions/auto-task)
|
|
4
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
[](https://claude.ai/code)
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
> Automated task processing for [Sego PM](https://sego.pm) - runs Claude locally to process high-confidence tasks in the background.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
____ _ _ _____ _
|
|
13
|
+
/ ___| ___ __ _ ___ / \ _ _| |_ ___ |_ _|_ _ ___| | __
|
|
14
|
+
\___ \ / _ \/ _` |/ _ \ / _ \| | | | __/ _ \ _____| |/ _` / __| |/ /
|
|
15
|
+
___) | __/ (_| | (_) |/ ___ \ |_| | || (_) |_____| | (_| \__ \ <
|
|
16
|
+
|____/ \___|\__, |\___/_/ \_\__,_|\__\___/ |_|\__,_|___/_|\_\
|
|
17
|
+
|___/
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## What Does This Do?
|
|
23
|
+
|
|
24
|
+
The Sego Auto-Task Monitor watches your Sego PM projects and automatically processes tasks that meet your confidence threshold. When a client submits a request, the monitor:
|
|
25
|
+
|
|
26
|
+
1. **Detects** new client requests or eligible tasks
|
|
27
|
+
2. **Claims** the task (prevents duplicate processing)
|
|
28
|
+
3. **Executes** using your local Claude CLI with full project context
|
|
29
|
+
4. **Completes** and moves the task to review with detailed output
|
|
30
|
+
|
|
31
|
+
This means less manual work for you and faster turnaround for your clients.
|
|
32
|
+
|
|
33
|
+
---
|
|
7
34
|
|
|
8
35
|
## Prerequisites
|
|
9
36
|
|
|
10
|
-
|
|
37
|
+
> **Important:** You must have Claude Code CLI installed and authenticated before using this tool.
|
|
11
38
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
39
|
+
### Claude Code CLI (Required)
|
|
40
|
+
|
|
41
|
+
The monitor uses the Claude Code CLI to process tasks locally. Install and authenticate:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Install globally
|
|
45
|
+
npm install -g @anthropic-ai/claude-code
|
|
46
|
+
|
|
47
|
+
# Authenticate (opens browser)
|
|
48
|
+
claude auth login
|
|
49
|
+
|
|
50
|
+
# Verify it works
|
|
51
|
+
claude --version
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> **Note:** Claude Code requires an Anthropic account with API access.
|
|
55
|
+
|
|
56
|
+
### Sego PM API Key (Required)
|
|
57
|
+
|
|
58
|
+
Generate an API key from your [Developer Settings](https://sego.pm/developer/api-keys) in Sego PM.
|
|
59
|
+
|
|
60
|
+
---
|
|
19
61
|
|
|
20
62
|
## Quick Start
|
|
21
63
|
|
|
22
64
|
Get up and running in under 5 minutes:
|
|
23
65
|
|
|
24
66
|
```bash
|
|
25
|
-
# 1
|
|
67
|
+
# Step 1: Install globally
|
|
26
68
|
npm install -g @segosolutions/auto-task
|
|
27
69
|
|
|
28
|
-
# 2
|
|
70
|
+
# Step 2: Run the interactive setup wizard
|
|
29
71
|
sego-auto-task init
|
|
30
72
|
|
|
31
|
-
# 3
|
|
73
|
+
# Step 3: Start monitoring
|
|
32
74
|
sego-auto-task
|
|
33
75
|
```
|
|
34
76
|
|
|
35
77
|
That's it! The monitor will now process eligible tasks automatically.
|
|
36
78
|
|
|
79
|
+
### One-Liner (For the impatient)
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm i -g @segosolutions/auto-task && sego-auto-task init
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
37
87
|
## Installation
|
|
38
88
|
|
|
39
|
-
### Global
|
|
89
|
+
### NPM Global (Recommended)
|
|
40
90
|
|
|
41
91
|
```bash
|
|
42
92
|
npm install -g @segosolutions/auto-task
|
|
43
93
|
```
|
|
44
94
|
|
|
45
|
-
|
|
95
|
+
After installation, the `sego-auto-task` command is available globally.
|
|
96
|
+
|
|
97
|
+
### NPX (No Install)
|
|
98
|
+
|
|
99
|
+
Run without installing:
|
|
46
100
|
|
|
47
101
|
```bash
|
|
48
|
-
|
|
49
|
-
npx sego-auto-task --help
|
|
102
|
+
npx @segosolutions/auto-task --help
|
|
50
103
|
```
|
|
51
104
|
|
|
52
|
-
|
|
105
|
+
### Yarn Global
|
|
53
106
|
|
|
54
|
-
|
|
107
|
+
```bash
|
|
108
|
+
yarn global add @segosolutions/auto-task
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### PNPM Global
|
|
55
112
|
|
|
56
113
|
```bash
|
|
57
|
-
|
|
58
|
-
|
|
114
|
+
pnpm add -g @segosolutions/auto-task
|
|
115
|
+
```
|
|
59
116
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
117
|
+
### Project Local (Dev Dependency)
|
|
118
|
+
|
|
119
|
+
Install as a dev dependency for project-specific use:
|
|
63
120
|
|
|
64
|
-
|
|
65
|
-
|
|
121
|
+
```bash
|
|
122
|
+
npm install --save-dev @segosolutions/auto-task
|
|
123
|
+
|
|
124
|
+
# Run via npx
|
|
125
|
+
npx sego-auto-task
|
|
66
126
|
```
|
|
67
127
|
|
|
68
|
-
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Configuration
|
|
131
|
+
|
|
132
|
+
### Interactive Setup (Recommended)
|
|
133
|
+
|
|
134
|
+
The easiest way to configure is the setup wizard:
|
|
69
135
|
|
|
70
136
|
```bash
|
|
71
|
-
|
|
72
|
-
|
|
137
|
+
sego-auto-task init
|
|
138
|
+
```
|
|
73
139
|
|
|
74
|
-
|
|
75
|
-
|
|
140
|
+
This will:
|
|
141
|
+
- Prompt for your API key
|
|
142
|
+
- Validate the connection
|
|
143
|
+
- Optionally set a project filter
|
|
144
|
+
- Save configuration to `.env`
|
|
145
|
+
|
|
146
|
+
### Non-Interactive Setup
|
|
147
|
+
|
|
148
|
+
For CI/CD or scripted setups:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
SEGO_API_KEY=sk_live_xxx sego-auto-task init --yes
|
|
76
152
|
```
|
|
77
153
|
|
|
78
|
-
###
|
|
154
|
+
### Environment Variables
|
|
155
|
+
|
|
156
|
+
Create a `.env` file in your project directory (or use `sego-auto-task init`):
|
|
157
|
+
|
|
158
|
+
| Variable | Required | Default | Description |
|
|
159
|
+
|----------|----------|---------|-------------|
|
|
160
|
+
| `SEGO_API_KEY` | Yes | - | Your Sego PM API key |
|
|
161
|
+
| `SEGO_API_URL` | No | `https://sego.pm` | API endpoint URL |
|
|
162
|
+
| `SEGO_PROJECT_ID` | No | All projects | Filter to a specific project |
|
|
163
|
+
| `SEGO_WORKING_DIR` | No | Current directory | Working directory for Claude |
|
|
164
|
+
|
|
165
|
+
**Example `.env` file:**
|
|
79
166
|
|
|
80
167
|
```bash
|
|
81
|
-
#
|
|
82
|
-
|
|
168
|
+
# Required
|
|
169
|
+
SEGO_API_KEY=sk_live_your_key_here
|
|
170
|
+
|
|
171
|
+
# Optional
|
|
172
|
+
SEGO_API_URL=https://sego.pm
|
|
173
|
+
SEGO_PROJECT_ID=proj_abc123
|
|
174
|
+
SEGO_WORKING_DIR=/path/to/project
|
|
83
175
|
```
|
|
84
176
|
|
|
85
|
-
|
|
177
|
+
### CLI Options
|
|
178
|
+
|
|
179
|
+
All options can be passed via command line (overrides environment variables):
|
|
86
180
|
|
|
87
181
|
| Option | Description | Default |
|
|
88
182
|
|--------|-------------|---------|
|
|
89
|
-
| `--api-key <key>` | Sego PM API key |
|
|
183
|
+
| `--api-key <key>` | Sego PM API key | `$SEGO_API_KEY` |
|
|
90
184
|
| `--api-url <url>` | Sego PM API URL | `https://sego.pm` |
|
|
91
|
-
| `--project-id <id>` |
|
|
185
|
+
| `--project-id <id>` | Filter to specific project | All projects |
|
|
92
186
|
| `--poll <seconds>` | Poll interval for checking tasks | `30` |
|
|
93
187
|
| `--timeout <minutes>` | Task processing timeout | `10` |
|
|
94
188
|
| `--client-request-timeout <minutes>` | Client request analysis timeout | `2` |
|
|
95
|
-
| `--no-sse` | Disable SSE mode | SSE enabled |
|
|
96
|
-
| `--dry-run` |
|
|
189
|
+
| `--no-sse` | Disable real-time SSE mode | SSE enabled |
|
|
190
|
+
| `--dry-run` | Check for tasks without processing | `false` |
|
|
97
191
|
| `--working-dir <path>` | Working directory for Claude | Current directory |
|
|
98
|
-
| `--no-update-check` |
|
|
192
|
+
| `--no-update-check` | Skip update check on startup | Check enabled |
|
|
99
193
|
| `-V, --version` | Show version number | |
|
|
100
194
|
| `-h, --help` | Show help | |
|
|
101
195
|
|
|
102
|
-
|
|
196
|
+
---
|
|
103
197
|
|
|
104
|
-
|
|
198
|
+
## Usage Examples
|
|
199
|
+
|
|
200
|
+
### Basic Usage
|
|
105
201
|
|
|
106
202
|
```bash
|
|
107
|
-
#
|
|
108
|
-
|
|
203
|
+
# Start with default settings (uses .env)
|
|
204
|
+
sego-auto-task
|
|
109
205
|
|
|
110
|
-
#
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
206
|
+
# Use inline API key
|
|
207
|
+
sego-auto-task --api-key=sk_live_xxx
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Development Mode
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Connect to local Sego PM instance
|
|
214
|
+
sego-auto-task --api-url=http://localhost:3000
|
|
215
|
+
|
|
216
|
+
# Test without processing (see what would be processed)
|
|
217
|
+
sego-auto-task --dry-run
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Project-Specific Monitoring
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Only monitor a specific project
|
|
224
|
+
sego-auto-task --project-id=cmiursa7x0001qptpaehaq7hg
|
|
225
|
+
```
|
|
114
226
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
227
|
+
### Custom Timeouts
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
# Longer timeout for complex tasks (30 minutes)
|
|
231
|
+
sego-auto-task --timeout=30 --client-request-timeout=5
|
|
232
|
+
|
|
233
|
+
# Faster polling (check every 15 seconds)
|
|
234
|
+
sego-auto-task --poll=15
|
|
119
235
|
```
|
|
120
236
|
|
|
237
|
+
### Polling Only (No Real-time)
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# Disable SSE, rely only on polling
|
|
241
|
+
sego-auto-task --no-sse --poll=60
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
121
246
|
## How It Works
|
|
122
247
|
|
|
123
|
-
The monitor runs in hybrid mode:
|
|
248
|
+
The monitor runs in hybrid mode combining real-time and polling:
|
|
124
249
|
|
|
125
250
|
### SSE Mode (Real-time)
|
|
251
|
+
|
|
126
252
|
- Listens for client request events via Server-Sent Events
|
|
127
253
|
- Processes new requests immediately as they arrive
|
|
128
|
-
-
|
|
254
|
+
- Requires `--project-id` for targeted monitoring
|
|
129
255
|
|
|
130
256
|
### Polling Mode (Batch)
|
|
257
|
+
|
|
131
258
|
- Checks every 30 seconds (configurable) for eligible tasks
|
|
132
259
|
- Processes tasks where:
|
|
133
260
|
- Project has auto-task enabled
|
|
@@ -136,20 +263,36 @@ The monitor runs in hybrid mode:
|
|
|
136
263
|
|
|
137
264
|
### Processing Flow
|
|
138
265
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
266
|
+
```
|
|
267
|
+
New Request/Task Found
|
|
268
|
+
|
|
|
269
|
+
v
|
|
270
|
+
Claim Task (mark IN_PROGRESS)
|
|
271
|
+
|
|
|
272
|
+
v
|
|
273
|
+
Run Claude with project context
|
|
274
|
+
|
|
|
275
|
+
v
|
|
276
|
+
Complete (move to IN_REVIEW)
|
|
277
|
+
|
|
|
278
|
+
v
|
|
279
|
+
Post results as task comment
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
143
283
|
|
|
144
|
-
## Project Configuration
|
|
284
|
+
## Project Configuration (Sego PM)
|
|
145
285
|
|
|
146
|
-
Enable auto-task processing for your project:
|
|
286
|
+
Enable auto-task processing for your project in Sego PM:
|
|
147
287
|
|
|
148
|
-
|
|
288
|
+
### Via Web UI
|
|
289
|
+
|
|
290
|
+
1. Go to your project settings
|
|
149
291
|
2. Enable "Auto-Task Processing"
|
|
150
292
|
3. Set your confidence threshold (recommended: 0.85)
|
|
151
293
|
|
|
152
|
-
|
|
294
|
+
### Via API
|
|
295
|
+
|
|
153
296
|
```bash
|
|
154
297
|
curl -X PATCH https://sego.pm/api/mcp/projects/{projectId}/auto-task \
|
|
155
298
|
-H "Authorization: Bearer sk_live_..." \
|
|
@@ -157,56 +300,23 @@ curl -X PATCH https://sego.pm/api/mcp/projects/{projectId}/auto-task \
|
|
|
157
300
|
-d '{"enabled": true, "confidenceThreshold": 0.85}'
|
|
158
301
|
```
|
|
159
302
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
### "Claude CLI is not available"
|
|
163
|
-
|
|
164
|
-
Ensure Claude Code is installed and authenticated:
|
|
165
|
-
```bash
|
|
166
|
-
npm install -g @anthropic-ai/claude-code
|
|
167
|
-
claude auth login
|
|
168
|
-
claude --version
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### "API key is required"
|
|
172
|
-
|
|
173
|
-
Set your API key via environment variable or CLI flag:
|
|
174
|
-
```bash
|
|
175
|
-
export SEGO_API_KEY=sk_live_...
|
|
176
|
-
# or
|
|
177
|
-
sego-auto-task --api-key=sk_live_...
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### Connection Issues
|
|
181
|
-
|
|
182
|
-
1. Verify your API key is valid
|
|
183
|
-
2. Check if you can reach the API:
|
|
184
|
-
```bash
|
|
185
|
-
curl -H "Authorization: Bearer sk_live_..." https://sego.pm/api/mcp/tasks
|
|
186
|
-
```
|
|
187
|
-
3. For local development, ensure `--api-url` points to your local server
|
|
188
|
-
|
|
189
|
-
### Tasks Not Being Processed
|
|
190
|
-
|
|
191
|
-
1. Verify auto-task is enabled for the project
|
|
192
|
-
2. Check task AI confidence meets the threshold
|
|
193
|
-
3. Ensure task is in `BACKLOG` status
|
|
194
|
-
4. Run with `--dry-run` to see what would be processed
|
|
303
|
+
---
|
|
195
304
|
|
|
196
305
|
## Running as a Service
|
|
197
306
|
|
|
198
|
-
### Using PM2
|
|
307
|
+
### Using PM2 (Recommended)
|
|
199
308
|
|
|
200
309
|
```bash
|
|
310
|
+
# Install PM2
|
|
201
311
|
npm install -g pm2
|
|
202
312
|
|
|
203
|
-
# Start the monitor
|
|
204
|
-
pm2 start sego-auto-task --name "sego-monitor" -- --api-key=
|
|
313
|
+
# Start the monitor as a daemon
|
|
314
|
+
pm2 start sego-auto-task --name "sego-monitor" -- --api-key=sk_live_xxx
|
|
205
315
|
|
|
206
316
|
# View logs
|
|
207
317
|
pm2 logs sego-monitor
|
|
208
318
|
|
|
209
|
-
# Auto-
|
|
319
|
+
# Auto-restart on reboot
|
|
210
320
|
pm2 save
|
|
211
321
|
pm2 startup
|
|
212
322
|
```
|
|
@@ -225,7 +335,7 @@ Type=simple
|
|
|
225
335
|
User=your-user
|
|
226
336
|
WorkingDirectory=/path/to/your/project
|
|
227
337
|
Environment=SEGO_API_KEY=sk_live_...
|
|
228
|
-
ExecStart=/usr/bin/sego-auto-task
|
|
338
|
+
ExecStart=/usr/local/bin/sego-auto-task
|
|
229
339
|
Restart=always
|
|
230
340
|
RestartSec=10
|
|
231
341
|
|
|
@@ -233,24 +343,247 @@ RestartSec=10
|
|
|
233
343
|
WantedBy=multi-user.target
|
|
234
344
|
```
|
|
235
345
|
|
|
236
|
-
Then:
|
|
346
|
+
Then enable and start:
|
|
347
|
+
|
|
237
348
|
```bash
|
|
238
349
|
sudo systemctl enable sego-auto-task
|
|
239
350
|
sudo systemctl start sego-auto-task
|
|
351
|
+
sudo systemctl status sego-auto-task
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Using launchd (macOS)
|
|
355
|
+
|
|
356
|
+
Create `~/Library/LaunchAgents/com.segosolutions.auto-task.plist`:
|
|
357
|
+
|
|
358
|
+
```xml
|
|
359
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
360
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
361
|
+
<plist version="1.0">
|
|
362
|
+
<dict>
|
|
363
|
+
<key>Label</key>
|
|
364
|
+
<string>com.segosolutions.auto-task</string>
|
|
365
|
+
<key>ProgramArguments</key>
|
|
366
|
+
<array>
|
|
367
|
+
<string>/usr/local/bin/sego-auto-task</string>
|
|
368
|
+
</array>
|
|
369
|
+
<key>EnvironmentVariables</key>
|
|
370
|
+
<dict>
|
|
371
|
+
<key>SEGO_API_KEY</key>
|
|
372
|
+
<string>sk_live_...</string>
|
|
373
|
+
</dict>
|
|
374
|
+
<key>WorkingDirectory</key>
|
|
375
|
+
<string>/path/to/your/project</string>
|
|
376
|
+
<key>RunAtLoad</key>
|
|
377
|
+
<true/>
|
|
378
|
+
<key>KeepAlive</key>
|
|
379
|
+
<true/>
|
|
380
|
+
<key>StandardOutPath</key>
|
|
381
|
+
<string>/tmp/sego-auto-task.log</string>
|
|
382
|
+
<key>StandardErrorPath</key>
|
|
383
|
+
<string>/tmp/sego-auto-task.err</string>
|
|
384
|
+
</dict>
|
|
385
|
+
</plist>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Then load:
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
launchctl load ~/Library/LaunchAgents/com.segosolutions.auto-task.plist
|
|
240
392
|
```
|
|
241
393
|
|
|
394
|
+
### Using Docker
|
|
395
|
+
|
|
396
|
+
```dockerfile
|
|
397
|
+
FROM node:20-alpine
|
|
398
|
+
|
|
399
|
+
# Install Claude CLI and auto-task
|
|
400
|
+
RUN npm install -g @anthropic-ai/claude-code @segosolutions/auto-task
|
|
401
|
+
|
|
402
|
+
# Set working directory
|
|
403
|
+
WORKDIR /app
|
|
404
|
+
|
|
405
|
+
# Environment variables (or mount .env)
|
|
406
|
+
ENV SEGO_API_KEY=sk_live_...
|
|
407
|
+
|
|
408
|
+
CMD ["sego-auto-task"]
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
Build and run:
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
docker build -t sego-auto-task .
|
|
415
|
+
docker run -d --name sego-monitor sego-auto-task
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Troubleshooting
|
|
421
|
+
|
|
422
|
+
### "Claude CLI is not available"
|
|
423
|
+
|
|
424
|
+
The monitor requires the Claude Code CLI to be installed and authenticated.
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
# Install Claude CLI
|
|
428
|
+
npm install -g @anthropic-ai/claude-code
|
|
429
|
+
|
|
430
|
+
# Authenticate with Anthropic
|
|
431
|
+
claude auth login
|
|
432
|
+
|
|
433
|
+
# Verify installation
|
|
434
|
+
claude --version
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
If you see permission errors, try:
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
sudo npm install -g @anthropic-ai/claude-code
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
Or fix npm permissions (recommended for macOS/Linux):
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
mkdir -p ~/.npm-global
|
|
447
|
+
npm config set prefix ~/.npm-global
|
|
448
|
+
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc # or ~/.zshrc
|
|
449
|
+
source ~/.bashrc
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### "API key is required"
|
|
453
|
+
|
|
454
|
+
Set your API key via one of these methods:
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
# Option 1: Environment variable
|
|
458
|
+
export SEGO_API_KEY=sk_live_your_key
|
|
459
|
+
|
|
460
|
+
# Option 2: CLI flag
|
|
461
|
+
sego-auto-task --api-key=sk_live_your_key
|
|
462
|
+
|
|
463
|
+
# Option 3: .env file
|
|
464
|
+
echo "SEGO_API_KEY=sk_live_your_key" > .env
|
|
465
|
+
|
|
466
|
+
# Option 4: Interactive setup
|
|
467
|
+
sego-auto-task init
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### "Invalid API key or unable to connect"
|
|
471
|
+
|
|
472
|
+
1. **Verify your API key is correct and not expired**
|
|
473
|
+
|
|
474
|
+
2. **Check network connectivity:**
|
|
475
|
+
```bash
|
|
476
|
+
curl -I https://sego.pm
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
3. **Test API authentication:**
|
|
480
|
+
```bash
|
|
481
|
+
curl -H "Authorization: Bearer sk_live_..." https://sego.pm/api/mcp/tasks
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
4. **For local development**, ensure `--api-url` points to your local server:
|
|
485
|
+
```bash
|
|
486
|
+
sego-auto-task --api-url=http://localhost:3000
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Tasks Not Being Processed
|
|
490
|
+
|
|
491
|
+
Check these common causes:
|
|
492
|
+
|
|
493
|
+
1. **Project settings:** Auto-task must be enabled for the project in Sego PM
|
|
494
|
+
|
|
495
|
+
2. **Task status:** Task must be in `BACKLOG` status
|
|
496
|
+
|
|
497
|
+
3. **Confidence threshold:** Task's AI confidence must meet or exceed the project threshold
|
|
498
|
+
|
|
499
|
+
4. **Test with dry-run:**
|
|
500
|
+
```bash
|
|
501
|
+
sego-auto-task --dry-run
|
|
502
|
+
```
|
|
503
|
+
This shows what tasks would be processed without actually processing them.
|
|
504
|
+
|
|
505
|
+
5. **Check the console output** for any error messages or skipped tasks
|
|
506
|
+
|
|
507
|
+
### SSE Connection Issues
|
|
508
|
+
|
|
509
|
+
If real-time events aren't working:
|
|
510
|
+
|
|
511
|
+
1. **Ensure `--project-id` is set** (required for SSE mode):
|
|
512
|
+
```bash
|
|
513
|
+
sego-auto-task --project-id=your_project_id
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
2. **Check that the API URL supports SSE**
|
|
517
|
+
|
|
518
|
+
3. **Try disabling SSE** to use polling only:
|
|
519
|
+
```bash
|
|
520
|
+
sego-auto-task --no-sse
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### Monitor Keeps Stopping
|
|
524
|
+
|
|
525
|
+
If the monitor exits unexpectedly:
|
|
526
|
+
|
|
527
|
+
1. **Check logs for error messages**
|
|
528
|
+
|
|
529
|
+
2. **Increase timeout** for long-running tasks:
|
|
530
|
+
```bash
|
|
531
|
+
sego-auto-task --timeout=30
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
3. **Use PM2** for automatic restarts:
|
|
535
|
+
```bash
|
|
536
|
+
pm2 start sego-auto-task --name sego --restart-delay=5000
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### Permission Errors on macOS
|
|
540
|
+
|
|
541
|
+
If you get permission errors during global install:
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
# Fix npm permissions (recommended)
|
|
545
|
+
mkdir -p ~/.npm-global
|
|
546
|
+
npm config set prefix ~/.npm-global
|
|
547
|
+
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
|
|
548
|
+
source ~/.zshrc
|
|
549
|
+
|
|
550
|
+
# Then reinstall
|
|
551
|
+
npm install -g @segosolutions/auto-task
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### "Command not found: sego-auto-task"
|
|
555
|
+
|
|
556
|
+
The npm global bin directory may not be in your PATH:
|
|
557
|
+
|
|
558
|
+
```bash
|
|
559
|
+
# Find where npm installs global packages
|
|
560
|
+
npm config get prefix
|
|
561
|
+
|
|
562
|
+
# Add to PATH (adjust path as needed)
|
|
563
|
+
export PATH="$(npm config get prefix)/bin:$PATH"
|
|
564
|
+
|
|
565
|
+
# Make permanent
|
|
566
|
+
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
242
571
|
## Development
|
|
243
572
|
|
|
573
|
+
Want to contribute or run from source?
|
|
574
|
+
|
|
575
|
+
### Setup
|
|
576
|
+
|
|
244
577
|
```bash
|
|
245
578
|
# Clone the repository
|
|
246
|
-
git clone https://github.com/
|
|
579
|
+
git clone https://github.com/nickgs/sego-pm.git
|
|
247
580
|
cd sego-pm/auto-task-monitor
|
|
248
581
|
|
|
249
582
|
# Install dependencies
|
|
250
583
|
pnpm install
|
|
251
584
|
|
|
252
585
|
# Run in development mode
|
|
253
|
-
pnpm dev -- --api-key=
|
|
586
|
+
pnpm dev -- --api-key=sk_dev_xxx
|
|
254
587
|
|
|
255
588
|
# Type check
|
|
256
589
|
pnpm typecheck
|
|
@@ -259,12 +592,105 @@ pnpm typecheck
|
|
|
259
592
|
pnpm build
|
|
260
593
|
```
|
|
261
594
|
|
|
595
|
+
### Project Structure
|
|
596
|
+
|
|
597
|
+
```
|
|
598
|
+
auto-task-monitor/
|
|
599
|
+
├── src/
|
|
600
|
+
│ ├── index.ts # CLI entry point
|
|
601
|
+
│ ├── monitor.ts # Main monitor logic
|
|
602
|
+
│ ├── claude-runner.ts # Claude CLI integration
|
|
603
|
+
│ ├── config.ts # Configuration loading
|
|
604
|
+
│ ├── init.ts # Setup wizard
|
|
605
|
+
│ └── version-check.ts # Update notifications
|
|
606
|
+
├── dist/ # Built output
|
|
607
|
+
├── package.json
|
|
608
|
+
└── README.md
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
### Testing Locally
|
|
612
|
+
|
|
613
|
+
```bash
|
|
614
|
+
# Run with local API
|
|
615
|
+
pnpm dev -- --api-url=http://localhost:3000 --dry-run
|
|
616
|
+
|
|
617
|
+
# Build and test the built version
|
|
618
|
+
pnpm build
|
|
619
|
+
node dist/index.cjs --help
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
---
|
|
623
|
+
|
|
624
|
+
## Changelog
|
|
625
|
+
|
|
626
|
+
### v1.0.1
|
|
627
|
+
|
|
628
|
+
- Fixed repository URLs in package.json
|
|
629
|
+
- Improved error messages
|
|
630
|
+
|
|
631
|
+
### v1.0.0
|
|
632
|
+
|
|
633
|
+
- Initial release
|
|
634
|
+
- SSE and polling hybrid mode
|
|
635
|
+
- Interactive setup wizard
|
|
636
|
+
- Automatic update checks
|
|
637
|
+
- Claude CLI integration
|
|
638
|
+
|
|
639
|
+
---
|
|
640
|
+
|
|
641
|
+
## FAQ
|
|
642
|
+
|
|
643
|
+
### How does this differ from processing tasks in the Sego PM web UI?
|
|
644
|
+
|
|
645
|
+
The auto-task monitor runs Claude **locally** on your machine, using your local codebase context. This means:
|
|
646
|
+
- Claude has access to your full project files
|
|
647
|
+
- Processing happens on your hardware
|
|
648
|
+
- No additional API costs beyond your existing Claude subscription
|
|
649
|
+
|
|
650
|
+
### What confidence threshold should I use?
|
|
651
|
+
|
|
652
|
+
We recommend starting with **0.85** (85%). This ensures only well-understood tasks are automatically processed. You can lower it as you gain confidence in the system.
|
|
653
|
+
|
|
654
|
+
### Can I run multiple monitors?
|
|
655
|
+
|
|
656
|
+
Yes, but only one monitor should process each project to avoid conflicts. Use `--project-id` to assign different projects to different monitors.
|
|
657
|
+
|
|
658
|
+
### Does this work with self-hosted Sego PM?
|
|
659
|
+
|
|
660
|
+
Yes! Use `--api-url` to point to your self-hosted instance:
|
|
661
|
+
|
|
662
|
+
```bash
|
|
663
|
+
sego-auto-task --api-url=https://your-sego-instance.com
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
### How do I stop the monitor?
|
|
667
|
+
|
|
668
|
+
Press `Ctrl+C` for graceful shutdown, or:
|
|
669
|
+
|
|
670
|
+
```bash
|
|
671
|
+
# If using PM2
|
|
672
|
+
pm2 stop sego-monitor
|
|
673
|
+
|
|
674
|
+
# If using systemd
|
|
675
|
+
sudo systemctl stop sego-auto-task
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
---
|
|
679
|
+
|
|
680
|
+
## Support
|
|
681
|
+
|
|
682
|
+
- **Documentation:** [https://sego.pm/docs](https://sego.pm/docs)
|
|
683
|
+
- **Issues:** [GitHub Issues](https://github.com/nickgs/sego-pm/issues)
|
|
684
|
+
- **Email:** [hello@segosolutions.com](mailto:hello@segosolutions.com)
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
262
688
|
## License
|
|
263
689
|
|
|
264
690
|
MIT - see [LICENSE](./LICENSE)
|
|
265
691
|
|
|
266
|
-
|
|
692
|
+
---
|
|
267
693
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
694
|
+
<p align="center">
|
|
695
|
+
Built with Claude by <a href="https://segosolutions.com">Sego Solutions</a>
|
|
696
|
+
</p>
|