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