task-o-matic 0.0.2 → 0.0.4
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 +96 -40
- package/dist/commands/prd.js +4 -0
- package/dist/commands/prompt.d.ts.map +1 -1
- package/dist/commands/prompt.js +69 -61
- package/dist/commands/tasks/create.d.ts +3 -0
- package/dist/commands/tasks/create.d.ts.map +1 -0
- package/dist/commands/tasks/create.js +58 -0
- package/dist/commands/tasks/delete.d.ts +3 -0
- package/dist/commands/tasks/delete.d.ts.map +1 -0
- package/dist/commands/tasks/delete.js +40 -0
- package/dist/commands/tasks/document.d.ts +5 -0
- package/dist/commands/tasks/document.d.ts.map +1 -0
- package/dist/commands/tasks/document.js +118 -0
- package/dist/commands/tasks/enhance.d.ts +3 -0
- package/dist/commands/tasks/enhance.d.ts.map +1 -0
- package/dist/commands/tasks/enhance.js +86 -0
- package/dist/commands/tasks/execute.d.ts +3 -0
- package/dist/commands/tasks/execute.d.ts.map +1 -0
- package/dist/commands/tasks/execute.js +33 -0
- package/dist/commands/tasks/index.d.ts +16 -0
- package/dist/commands/tasks/index.d.ts.map +1 -0
- package/dist/commands/tasks/index.js +31 -0
- package/dist/commands/tasks/list.d.ts +3 -0
- package/dist/commands/tasks/list.d.ts.map +1 -0
- package/dist/commands/tasks/list.js +27 -0
- package/dist/commands/tasks/next.d.ts +3 -0
- package/dist/commands/tasks/next.d.ts.map +1 -0
- package/dist/commands/tasks/next.js +44 -0
- package/dist/commands/tasks/plan.d.ts +7 -0
- package/dist/commands/tasks/plan.d.ts.map +1 -0
- package/dist/commands/tasks/plan.js +131 -0
- package/dist/commands/tasks/show.d.ts +3 -0
- package/dist/commands/tasks/show.d.ts.map +1 -0
- package/dist/commands/tasks/show.js +23 -0
- package/dist/commands/tasks/split.d.ts +3 -0
- package/dist/commands/tasks/split.d.ts.map +1 -0
- package/dist/commands/tasks/split.js +95 -0
- package/dist/commands/tasks/status.d.ts +3 -0
- package/dist/commands/tasks/status.d.ts.map +1 -0
- package/dist/commands/tasks/status.js +26 -0
- package/dist/commands/tasks/subtasks.d.ts +3 -0
- package/dist/commands/tasks/subtasks.d.ts.map +1 -0
- package/dist/commands/tasks/subtasks.js +35 -0
- package/dist/commands/tasks/tags.d.ts +4 -0
- package/dist/commands/tasks/tags.d.ts.map +1 -0
- package/dist/commands/tasks/tags.js +37 -0
- package/dist/commands/tasks/tree.d.ts +3 -0
- package/dist/commands/tasks/tree.d.ts.map +1 -0
- package/dist/commands/tasks/tree.js +20 -0
- package/dist/commands/tasks/update.d.ts +3 -0
- package/dist/commands/tasks/update.d.ts.map +1 -0
- package/dist/commands/tasks/update.js +35 -0
- package/dist/commands/tasks.d.ts.map +1 -1
- package/dist/commands/tasks.js +23 -594
- package/dist/commands/workflow.d.ts +4 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +434 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/ai-service/ai-operations.d.ts +5 -3
- package/dist/lib/ai-service/ai-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/ai-operations.js +231 -30
- package/dist/lib/ai-service/filesystem-tools.d.ts +69 -0
- package/dist/lib/ai-service/filesystem-tools.d.ts.map +1 -0
- package/dist/lib/ai-service/filesystem-tools.js +70 -0
- package/dist/lib/ai-service/research-tools.d.ts.map +1 -1
- package/dist/lib/ai-service/research-tools.js +2 -2
- package/dist/lib/context-builder.d.ts +2 -1
- package/dist/lib/context-builder.d.ts.map +1 -1
- package/dist/lib/context-builder.js +3 -8
- package/dist/lib/executors/claude-code-executor.d.ts +6 -0
- package/dist/lib/executors/claude-code-executor.d.ts.map +1 -0
- package/dist/lib/executors/claude-code-executor.js +41 -0
- package/dist/lib/executors/codex-executor.d.ts +6 -0
- package/dist/lib/executors/codex-executor.d.ts.map +1 -0
- package/dist/lib/executors/codex-executor.js +41 -0
- package/dist/lib/executors/executor-factory.d.ts.map +1 -1
- package/dist/lib/executors/executor-factory.js +6 -3
- package/dist/lib/executors/gemini-executor.d.ts +6 -0
- package/dist/lib/executors/gemini-executor.d.ts.map +1 -0
- package/dist/lib/executors/gemini-executor.js +41 -0
- package/dist/lib/executors/opencode-executor.d.ts.map +1 -1
- package/dist/lib/executors/opencode-executor.js +2 -3
- package/dist/lib/hooks/logger.d.ts +2 -0
- package/dist/lib/hooks/logger.d.ts.map +1 -0
- package/dist/lib/hooks/logger.js +27 -0
- package/dist/lib/hooks.d.ts +64 -0
- package/dist/lib/hooks.d.ts.map +1 -0
- package/dist/lib/hooks.js +60 -0
- package/dist/lib/index.d.ts +18 -17
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +3 -3
- package/dist/lib/prompt-builder.d.ts +8 -0
- package/dist/lib/prompt-builder.d.ts.map +1 -1
- package/dist/lib/prompt-builder.js +110 -4
- package/dist/lib/{storage.d.ts → storage/file-system.d.ts} +4 -3
- package/dist/lib/storage/file-system.d.ts.map +1 -0
- package/dist/lib/{storage.js → storage/file-system.js} +141 -152
- package/dist/lib/storage/types.d.ts +43 -0
- package/dist/lib/storage/types.d.ts.map +1 -0
- package/dist/lib/storage/types.js +2 -0
- package/dist/lib/task-execution.d.ts.map +1 -1
- package/dist/lib/task-execution.js +63 -14
- package/dist/prompts/workflow-assistance.d.ts +32 -0
- package/dist/prompts/workflow-assistance.d.ts.map +1 -0
- package/dist/prompts/workflow-assistance.js +130 -0
- package/dist/services/prd.d.ts +2 -0
- package/dist/services/prd.d.ts.map +1 -1
- package/dist/services/prd.js +4 -4
- package/dist/services/tasks.d.ts +13 -6
- package/dist/services/tasks.d.ts.map +1 -1
- package/dist/services/tasks.js +202 -88
- package/dist/services/workflow-ai-assistant.d.ts +74 -0
- package/dist/services/workflow-ai-assistant.d.ts.map +1 -0
- package/dist/services/workflow-ai-assistant.js +223 -0
- package/dist/test/hooks.test.d.ts +2 -0
- package/dist/test/hooks.test.d.ts.map +1 -0
- package/dist/test/hooks.test.js +58 -0
- package/dist/test/storage.test.js +16 -16
- package/dist/types/options.d.ts +35 -0
- package/dist/types/options.d.ts.map +1 -1
- package/dist/utils/ai-service-factory.d.ts +5 -5
- package/dist/utils/ai-service-factory.d.ts.map +1 -1
- package/dist/utils/ai-service-factory.js +4 -3
- package/dist/utils/workflow-prompts.d.ts +17 -0
- package/dist/utils/workflow-prompts.d.ts.map +1 -0
- package/dist/utils/workflow-prompts.js +88 -0
- package/package.json +2 -2
- package/dist/lib/storage.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ AI-powered task management for CLI, TUI, and web applications. Parse PRDs, enhan
|
|
|
5
5
|
## ✨ Features
|
|
6
6
|
|
|
7
7
|
- 🤖 **AI-Powered**: Parse PRDs and enhance tasks using multiple AI providers
|
|
8
|
+
- 🎭 **Interactive Workflow**: Guided setup from project init to task generation with AI assistance
|
|
8
9
|
- 📦 **Multi-Purpose Package**: Use as CLI tool, library, or MCP server
|
|
9
10
|
- 📁 **Project-Local Storage**: All data stored locally in `.task-o-matic/` directory
|
|
10
11
|
- 🎯 **Task Management**: Full CRUD operations with AI enhancement
|
|
@@ -102,36 +103,41 @@ npm install task-o-matic
|
|
|
102
103
|
#### Basic Example
|
|
103
104
|
|
|
104
105
|
```typescript
|
|
105
|
-
import {
|
|
106
|
+
import {
|
|
107
|
+
TaskService,
|
|
108
|
+
PRDService,
|
|
109
|
+
type Task,
|
|
110
|
+
type AIConfig,
|
|
111
|
+
} from "task-o-matic";
|
|
106
112
|
|
|
107
113
|
// Initialize the service
|
|
108
114
|
const taskService = new TaskService();
|
|
109
115
|
|
|
110
116
|
// Create a task with AI enhancement
|
|
111
117
|
const result = await taskService.createTask({
|
|
112
|
-
title:
|
|
113
|
-
content:
|
|
118
|
+
title: "Implement user authentication",
|
|
119
|
+
content: "Add login and signup functionality",
|
|
114
120
|
aiEnhance: true,
|
|
115
121
|
aiOptions: {
|
|
116
|
-
provider:
|
|
117
|
-
model:
|
|
118
|
-
apiKey: process.env.ANTHROPIC_API_KEY
|
|
122
|
+
provider: "anthropic",
|
|
123
|
+
model: "claude-3-5-sonnet",
|
|
124
|
+
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
119
125
|
},
|
|
120
126
|
callbacks: {
|
|
121
127
|
onProgress: (event) => {
|
|
122
128
|
console.log(`Progress: ${event.message}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
129
|
+
},
|
|
130
|
+
},
|
|
125
131
|
});
|
|
126
132
|
|
|
127
|
-
console.log(
|
|
133
|
+
console.log("Task created:", result.task);
|
|
128
134
|
```
|
|
129
135
|
|
|
130
136
|
#### TUI Integration Example
|
|
131
137
|
|
|
132
138
|
```typescript
|
|
133
|
-
import { TaskService } from
|
|
134
|
-
import type { ProgressCallback } from
|
|
139
|
+
import { TaskService } from "task-o-matic";
|
|
140
|
+
import type { ProgressCallback } from "task-o-matic";
|
|
135
141
|
|
|
136
142
|
const taskService = new TaskService();
|
|
137
143
|
|
|
@@ -140,12 +146,12 @@ const progressCallback: ProgressCallback = {
|
|
|
140
146
|
onProgress: (event) => {
|
|
141
147
|
// Update your TUI with progress
|
|
142
148
|
tuiStatusBar.update(event.message);
|
|
143
|
-
}
|
|
149
|
+
},
|
|
144
150
|
};
|
|
145
151
|
|
|
146
152
|
// Create task with streaming
|
|
147
153
|
const result = await taskService.createTask({
|
|
148
|
-
title:
|
|
154
|
+
title: "Add payment integration",
|
|
149
155
|
aiEnhance: true,
|
|
150
156
|
streamingOptions: {
|
|
151
157
|
enabled: true,
|
|
@@ -154,37 +160,37 @@ const result = await taskService.createTask({
|
|
|
154
160
|
tuiTextArea.append(chunk);
|
|
155
161
|
},
|
|
156
162
|
onFinish: ({ text }) => {
|
|
157
|
-
tuiStatusBar.success(
|
|
158
|
-
}
|
|
163
|
+
tuiStatusBar.success("Task enhanced!");
|
|
164
|
+
},
|
|
159
165
|
},
|
|
160
|
-
callbacks: progressCallback
|
|
166
|
+
callbacks: progressCallback,
|
|
161
167
|
});
|
|
162
168
|
```
|
|
163
169
|
|
|
164
170
|
#### PRD Parsing Example
|
|
165
171
|
|
|
166
172
|
```typescript
|
|
167
|
-
import { PRDService } from
|
|
173
|
+
import { PRDService } from "task-o-matic";
|
|
168
174
|
|
|
169
175
|
const prdService = new PRDService();
|
|
170
176
|
|
|
171
177
|
const result = await prdService.parsePRD({
|
|
172
|
-
file:
|
|
178
|
+
file: "./requirements.md",
|
|
173
179
|
workingDirectory: process.cwd(),
|
|
174
180
|
aiOptions: {
|
|
175
|
-
provider:
|
|
176
|
-
model:
|
|
177
|
-
apiKey: process.env.OPENROUTER_API_KEY
|
|
181
|
+
provider: "openrouter",
|
|
182
|
+
model: "anthropic/claude-3.5-sonnet",
|
|
183
|
+
apiKey: process.env.OPENROUTER_API_KEY,
|
|
178
184
|
},
|
|
179
185
|
callbacks: {
|
|
180
186
|
onProgress: (event) => {
|
|
181
187
|
console.log(event.message);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
188
|
+
},
|
|
189
|
+
},
|
|
184
190
|
});
|
|
185
191
|
|
|
186
192
|
console.log(`Created ${result.tasks.length} tasks from PRD`);
|
|
187
|
-
result.tasks.forEach(task => {
|
|
193
|
+
result.tasks.forEach((task) => {
|
|
188
194
|
console.log(`- ${task.title}`);
|
|
189
195
|
});
|
|
190
196
|
```
|
|
@@ -192,11 +198,7 @@ result.tasks.forEach(task => {
|
|
|
192
198
|
#### Using Utility Factories
|
|
193
199
|
|
|
194
200
|
```typescript
|
|
195
|
-
import {
|
|
196
|
-
getStorage,
|
|
197
|
-
getAIOperations,
|
|
198
|
-
buildAIConfig
|
|
199
|
-
} from 'task-o-matic';
|
|
201
|
+
import { getStorage, getAIOperations, buildAIConfig } from "task-o-matic";
|
|
200
202
|
|
|
201
203
|
// Get singleton instances
|
|
202
204
|
const storage = getStorage();
|
|
@@ -204,9 +206,9 @@ const aiOps = getAIOperations();
|
|
|
204
206
|
|
|
205
207
|
// Build AI configuration
|
|
206
208
|
const aiConfig = buildAIConfig({
|
|
207
|
-
provider:
|
|
208
|
-
model:
|
|
209
|
-
apiKey: process.env.OPENAI_API_KEY
|
|
209
|
+
provider: "openai",
|
|
210
|
+
model: "gpt-4",
|
|
211
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
210
212
|
});
|
|
211
213
|
|
|
212
214
|
// Use storage directly
|
|
@@ -224,8 +226,8 @@ import type {
|
|
|
224
226
|
StreamingOptions,
|
|
225
227
|
CreateTaskOptions,
|
|
226
228
|
PRDParseResult,
|
|
227
|
-
TaskAIMetadata
|
|
228
|
-
} from
|
|
229
|
+
TaskAIMetadata,
|
|
230
|
+
} from "task-o-matic";
|
|
229
231
|
```
|
|
230
232
|
|
|
231
233
|
### CLI Usage
|
|
@@ -298,17 +300,71 @@ task-o-matic prd parse --file my-prd.md --stream
|
|
|
298
300
|
task-o-matic tasks list
|
|
299
301
|
```
|
|
300
302
|
|
|
303
|
+
### 7. Interactive Workflow (Recommended for New Projects)
|
|
304
|
+
|
|
305
|
+
The interactive workflow guides you through the entire setup process:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Start the interactive workflow
|
|
309
|
+
task-o-matic workflow
|
|
310
|
+
|
|
311
|
+
# With streaming AI output
|
|
312
|
+
task-o-matic workflow --stream
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**The workflow will guide you through:**
|
|
316
|
+
|
|
317
|
+
1. **Project Initialization** - Choose quick start, custom, or AI-assisted configuration
|
|
318
|
+
2. **PRD Definition** - Upload file, write manually, or use AI to generate from description
|
|
319
|
+
3. **PRD Refinement** - Optional AI-assisted improvements
|
|
320
|
+
4. **Task Generation** - Parse PRD into actionable tasks
|
|
321
|
+
5. **Task Splitting** - Break down complex tasks into subtasks
|
|
322
|
+
|
|
323
|
+
**AI Assistance at Every Step:**
|
|
324
|
+
|
|
325
|
+
At each step, you can choose "AI-assisted" to describe your needs in natural language:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
# Example AI-assisted workflow
|
|
329
|
+
task-o-matic workflow --stream
|
|
330
|
+
|
|
331
|
+
# Step 1: "I want to build a SaaS platform for team collaboration"
|
|
332
|
+
# Step 2: "Real-time chat, file sharing, and task management features"
|
|
333
|
+
# Step 3: "Add more details about authentication and security"
|
|
334
|
+
# Step 4: "Focus on MVP features first"
|
|
335
|
+
# Step 5: "Break tasks into 2-4 hour chunks"
|
|
336
|
+
```
|
|
337
|
+
|
|
301
338
|
## 📚 Documentation
|
|
302
339
|
|
|
303
340
|
- [Configuration](docs/configuration.md) - AI providers and settings
|
|
304
341
|
- [Task Management](docs/tasks.md) - Full task lifecycle with AI features
|
|
305
342
|
- [PRD Processing](docs/prd.md) - Parse and rework Product Requirements Documents
|
|
343
|
+
- [Interactive Workflow](docs/workflow-command.md) - Guided setup with AI assistance
|
|
306
344
|
- [AI Integration](docs/ai-integration.md) - AI providers and prompt engineering
|
|
307
345
|
- [Project Initialization](docs/projects.md) - Project setup and bootstrapping
|
|
308
346
|
- [Streaming Output](docs/streaming.md) - Real-time AI streaming capabilities
|
|
309
347
|
|
|
310
348
|
## 🎯 Common Workflows
|
|
311
349
|
|
|
350
|
+
### Workflow 0: Interactive Guided Setup (Recommended)
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# One command to rule them all
|
|
354
|
+
task-o-matic workflow --stream
|
|
355
|
+
|
|
356
|
+
# The workflow will guide you through:
|
|
357
|
+
# 1. Project initialization with AI-assisted configuration
|
|
358
|
+
# 2. PRD creation (manual, upload, or AI-generated)
|
|
359
|
+
# 3. PRD refinement with AI feedback
|
|
360
|
+
# 4. Task generation from PRD
|
|
361
|
+
# 5. Complex task splitting
|
|
362
|
+
|
|
363
|
+
# After completion:
|
|
364
|
+
task-o-matic tasks list
|
|
365
|
+
task-o-matic tasks tree
|
|
366
|
+
```
|
|
367
|
+
|
|
312
368
|
### Workflow 1: From PRD to Tasks
|
|
313
369
|
|
|
314
370
|
```bash
|
|
@@ -467,15 +523,15 @@ The package is structured for both CLI and library use:
|
|
|
467
523
|
|
|
468
524
|
```json
|
|
469
525
|
{
|
|
470
|
-
"main": "./dist/lib/index.js",
|
|
471
|
-
"types": "./dist/lib/index.d.ts",
|
|
526
|
+
"main": "./dist/lib/index.js", // CommonJS library entry
|
|
527
|
+
"types": "./dist/lib/index.d.ts", // TypeScript definitions
|
|
472
528
|
"bin": {
|
|
473
|
-
"task-o-matic": "./dist/cli/bin.js",
|
|
474
|
-
"task-o-matic-mcp": "./dist/mcp/server.js"
|
|
529
|
+
"task-o-matic": "./dist/cli/bin.js", // CLI binary
|
|
530
|
+
"task-o-matic-mcp": "./dist/mcp/server.js" // MCP server binary
|
|
475
531
|
},
|
|
476
532
|
"exports": {
|
|
477
|
-
".": "./dist/lib/index.js",
|
|
478
|
-
"./types": "./dist/types/index.js"
|
|
533
|
+
".": "./dist/lib/index.js", // Main library export
|
|
534
|
+
"./types": "./dist/types/index.js" // Type-only exports
|
|
479
535
|
}
|
|
480
536
|
}
|
|
481
537
|
```
|
package/dist/commands/prd.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.prdCommand
|
|
|
24
24
|
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
25
25
|
.option("--ai-reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
26
26
|
.option("--stream", "Show streaming AI output during parsing")
|
|
27
|
+
.option("--tools", "Enable filesystem tools for project analysis")
|
|
27
28
|
.action(async (options) => {
|
|
28
29
|
try {
|
|
29
30
|
// Determine working directory from current process location
|
|
@@ -33,6 +34,7 @@ exports.prdCommand
|
|
|
33
34
|
const result = await prd_1.prdService.parsePRD({
|
|
34
35
|
file: options.file,
|
|
35
36
|
workingDirectory, // Pass working directory explicitly to service
|
|
37
|
+
enableFilesystemTools: options.tools,
|
|
36
38
|
aiOptions: {
|
|
37
39
|
aiProvider: options.aiProvider,
|
|
38
40
|
aiModel: options.aiModel,
|
|
@@ -94,6 +96,7 @@ exports.prdCommand
|
|
|
94
96
|
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
95
97
|
.option("--ai-reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
96
98
|
.option("--stream", "Show streaming AI output during rework")
|
|
99
|
+
.option("--tools", "Enable filesystem tools for project analysis")
|
|
97
100
|
.action(async (options) => {
|
|
98
101
|
try {
|
|
99
102
|
// Determine working directory from current process location
|
|
@@ -105,6 +108,7 @@ exports.prdCommand
|
|
|
105
108
|
feedback: options.feedback,
|
|
106
109
|
output: options.output,
|
|
107
110
|
workingDirectory, // Pass working directory explicitly to service
|
|
111
|
+
enableFilesystemTools: options.tools,
|
|
108
112
|
aiOptions: {
|
|
109
113
|
aiProvider: options.aiProvider,
|
|
110
114
|
aiModel: options.aiModel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/commands/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/commands/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,eAAO,MAAM,aAAa,SAyPtB,CAAC"}
|
package/dist/commands/prompt.js
CHANGED
|
@@ -21,6 +21,8 @@ exports.promptCommand = new commander_1.Command("prompt")
|
|
|
21
21
|
.option("--var <key=value>", "Custom variable in format key=value (can be used multiple times)", (value, previous = []) => {
|
|
22
22
|
return [...previous, value];
|
|
23
23
|
}, [])
|
|
24
|
+
.option("--full-context", "Include comprehensive project context (file structure, dependencies, etc.)", false)
|
|
25
|
+
.option("--executor <type>", "Format output for specific executor: opencode, claude, gemini, codex")
|
|
24
26
|
.action(async (name, options) => {
|
|
25
27
|
try {
|
|
26
28
|
// Handle list option
|
|
@@ -55,91 +57,92 @@ exports.promptCommand = new commander_1.Command("prompt")
|
|
|
55
57
|
console.error('Error: --type must be either "system" or "user"');
|
|
56
58
|
(0, process_1.exit)(1);
|
|
57
59
|
}
|
|
58
|
-
// Build variables object
|
|
60
|
+
// Build variables object with AUTOMATIC DETECTION FIRST (like all other commands)
|
|
59
61
|
const variables = {};
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
//
|
|
72
|
-
|
|
62
|
+
// STEP 1: AUTO-DETECT EVERYTHING (default behavior)
|
|
63
|
+
// Auto-detect PRD content ALWAYS
|
|
64
|
+
const autoPrdContent = await prompt_builder_1.PromptBuilder.autoDetectPRDContent();
|
|
65
|
+
if (autoPrdContent) {
|
|
66
|
+
variables.PRD_CONTENT = autoPrdContent;
|
|
67
|
+
}
|
|
68
|
+
// Auto-detect stack info ALWAYS
|
|
69
|
+
const autoStackInfo = await prompt_builder_1.PromptBuilder.detectStackInfo(process.cwd());
|
|
70
|
+
if (autoStackInfo !== "Not detected") {
|
|
71
|
+
variables.STACK_INFO = autoStackInfo;
|
|
72
|
+
}
|
|
73
|
+
// STEP 2: OVERRIDE with explicit options if provided
|
|
74
|
+
// Override PRD if explicitly provided
|
|
73
75
|
if (options.prdFile) {
|
|
74
|
-
|
|
76
|
+
variables.PRD_CONTENT = prompt_builder_1.PromptBuilder.loadPRDContent(options.prdFile);
|
|
75
77
|
}
|
|
76
|
-
if (prdContent) {
|
|
77
|
-
variables.PRD_CONTENT = prdContent;
|
|
78
|
+
else if (options.prdContent) {
|
|
79
|
+
variables.PRD_CONTENT = options.prdContent;
|
|
78
80
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (prdContent) {
|
|
83
|
-
variables.PRD_CONTENT = prdContent;
|
|
84
|
-
}
|
|
81
|
+
// Override stack if explicitly provided
|
|
82
|
+
if (options.stackInfo) {
|
|
83
|
+
variables.STACK_INFO = options.stackInfo;
|
|
85
84
|
}
|
|
86
85
|
// Handle task information
|
|
87
|
-
let taskDescription = options.taskDescription;
|
|
88
|
-
if (options.taskFile) {
|
|
89
|
-
taskDescription = await prompt_builder_1.PromptBuilder.buildTaskContext("", "", options.taskFile);
|
|
90
|
-
}
|
|
91
86
|
if (options.taskTitle) {
|
|
92
87
|
variables.TASK_TITLE = options.taskTitle;
|
|
93
88
|
}
|
|
94
|
-
if (
|
|
95
|
-
variables.TASK_DESCRIPTION =
|
|
89
|
+
if (options.taskFile) {
|
|
90
|
+
variables.TASK_DESCRIPTION = await prompt_builder_1.PromptBuilder.buildTaskContext(options.taskTitle || "", "", options.taskFile);
|
|
91
|
+
}
|
|
92
|
+
else if (options.taskDescription) {
|
|
93
|
+
variables.TASK_DESCRIPTION = options.taskDescription;
|
|
96
94
|
}
|
|
97
|
-
//
|
|
95
|
+
// Build rich task context if we have title and description
|
|
98
96
|
if (options.taskTitle && (options.taskDescription || options.taskFile)) {
|
|
99
|
-
|
|
100
|
-
variables.TASK_CONTEXT = richContext;
|
|
97
|
+
variables.TASK_CONTEXT = await prompt_builder_1.PromptBuilder.buildTaskContext(options.taskTitle, options.taskDescription, options.taskFile);
|
|
101
98
|
}
|
|
102
|
-
// Handle
|
|
103
|
-
if (options.
|
|
104
|
-
variables.
|
|
99
|
+
// Handle user feedback
|
|
100
|
+
if (options.userFeedback) {
|
|
101
|
+
variables.USER_FEEDBACK = options.userFeedback;
|
|
105
102
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
// Build comprehensive CONTEXT_INFO (combining everything)
|
|
104
|
+
const contextParts = [];
|
|
105
|
+
// Add stack info if available
|
|
106
|
+
if (variables.STACK_INFO) {
|
|
107
|
+
contextParts.push(`**Technology Stack:** ${variables.STACK_INFO}`);
|
|
108
|
+
}
|
|
109
|
+
// Add PRD content if available
|
|
110
|
+
if (variables.PRD_CONTENT) {
|
|
111
|
+
contextParts.push(`**Product Requirements:**\n${variables.PRD_CONTENT}`);
|
|
112
|
+
}
|
|
113
|
+
// Add full context if requested
|
|
114
|
+
if (options.fullContext) {
|
|
115
|
+
const fullContext = await prompt_builder_1.PromptBuilder.buildFullProjectContext(process.cwd());
|
|
116
|
+
if (fullContext) {
|
|
117
|
+
contextParts.push(fullContext);
|
|
111
118
|
}
|
|
112
119
|
}
|
|
113
|
-
//
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
// Add stack info if available
|
|
117
|
-
if (variables.STACK_INFO) {
|
|
118
|
-
contextParts.push(`**Technology Stack:** ${variables.STACK_INFO}`);
|
|
119
|
-
}
|
|
120
|
-
// Add PRD content if available
|
|
121
|
-
if (variables.PRD_CONTENT) {
|
|
122
|
-
contextParts.push(`**Product Requirements:**\n${variables.PRD_CONTENT}`);
|
|
123
|
-
}
|
|
124
|
-
// Set combined context info
|
|
125
|
-
if (contextParts.length > 0) {
|
|
126
|
-
variables.CONTEXT_INFO = contextParts.join('\n\n');
|
|
127
|
-
}
|
|
120
|
+
// Set combined context info
|
|
121
|
+
if (contextParts.length > 0) {
|
|
122
|
+
variables.CONTEXT_INFO = contextParts.join('\n\n');
|
|
128
123
|
}
|
|
129
|
-
//
|
|
124
|
+
// Override context info if explicitly provided
|
|
130
125
|
if (options.contextInfo) {
|
|
131
126
|
variables.CONTEXT_INFO = options.contextInfo;
|
|
132
127
|
}
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
// STEP 3: FINAL OVERRIDE with custom --var variables (highest priority)
|
|
129
|
+
if (options.var) {
|
|
130
|
+
for (const varPair of options.var) {
|
|
131
|
+
const [key, ...valueParts] = varPair.split("=");
|
|
132
|
+
if (!key || valueParts.length === 0) {
|
|
133
|
+
console.error(`Error: Invalid variable format: ${varPair}. Expected format: key=value`);
|
|
134
|
+
(0, process_1.exit)(1);
|
|
135
|
+
}
|
|
136
|
+
variables[key] = valueParts.join("=");
|
|
137
|
+
}
|
|
135
138
|
}
|
|
136
139
|
// Build the prompt
|
|
137
140
|
const result = prompt_builder_1.PromptBuilder.buildPrompt({
|
|
138
|
-
name,
|
|
141
|
+
name: name, // name is checked above, will not be undefined here
|
|
139
142
|
type: options.type,
|
|
140
143
|
variables,
|
|
141
144
|
});
|
|
142
|
-
if (!result.success) {
|
|
145
|
+
if (!result.success || !result.prompt) {
|
|
143
146
|
console.error(`Error: ${result.error}`);
|
|
144
147
|
if (result.missingVariables && result.missingVariables.length > 0) {
|
|
145
148
|
console.error("\nMissing required variables:");
|
|
@@ -159,8 +162,13 @@ exports.promptCommand = new commander_1.Command("prompt")
|
|
|
159
162
|
}
|
|
160
163
|
(0, process_1.exit)(1);
|
|
161
164
|
}
|
|
165
|
+
// Format output based on executor if specified
|
|
166
|
+
let outputPrompt = result.prompt;
|
|
167
|
+
if (options.executor) {
|
|
168
|
+
outputPrompt = prompt_builder_1.PromptBuilder.formatForExecutor(result.prompt, options.executor);
|
|
169
|
+
}
|
|
162
170
|
// Output the built prompt
|
|
163
|
-
console.log(
|
|
171
|
+
console.log(outputPrompt);
|
|
164
172
|
}
|
|
165
173
|
catch (error) {
|
|
166
174
|
console.error(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,aAAa,SAsDtB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCommand = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const tasks_1 = require("../../services/tasks");
|
|
6
|
+
const hooks_1 = require("../../lib/hooks");
|
|
7
|
+
const streaming_options_1 = require("../../utils/streaming-options");
|
|
8
|
+
const progress_1 = require("../../cli/display/progress");
|
|
9
|
+
const common_1 = require("../../cli/display/common");
|
|
10
|
+
const task_1 = require("../../cli/display/task");
|
|
11
|
+
exports.createCommand = new commander_1.Command("create")
|
|
12
|
+
.description("Create a new task with AI enhancement using Context7")
|
|
13
|
+
.requiredOption("--title <title>", "Task title")
|
|
14
|
+
.option("--content <content>", "Task content (supports markdown)")
|
|
15
|
+
.option("--effort <effort>", "Estimated effort (small/medium/large)")
|
|
16
|
+
.option("--parent-id <id>", "Parent task ID (creates subtask)")
|
|
17
|
+
.option("--ai-enhance", "Enhance task with AI using Context7 documentation")
|
|
18
|
+
.option("--stream", "Show streaming AI output during enhancement")
|
|
19
|
+
.option("--ai-provider <provider>", "AI provider override")
|
|
20
|
+
.option("--ai-model <model>", "AI model override")
|
|
21
|
+
.option("--ai-key <key>", "AI API key override")
|
|
22
|
+
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
23
|
+
.option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
24
|
+
.action(async (options) => {
|
|
25
|
+
try {
|
|
26
|
+
const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.aiEnhance && options.stream, "Enhancement");
|
|
27
|
+
const progressHandler = (payload) => {
|
|
28
|
+
(0, progress_1.displayProgress)(payload);
|
|
29
|
+
};
|
|
30
|
+
hooks_1.hooks.on("task:progress", progressHandler);
|
|
31
|
+
try {
|
|
32
|
+
const result = await tasks_1.taskService.createTask({
|
|
33
|
+
title: options.title,
|
|
34
|
+
content: options.content,
|
|
35
|
+
parentId: options.parentId,
|
|
36
|
+
effort: options.effort,
|
|
37
|
+
aiEnhance: options.aiEnhance,
|
|
38
|
+
aiOptions: {
|
|
39
|
+
aiProvider: options.aiProvider,
|
|
40
|
+
aiModel: options.aiModel,
|
|
41
|
+
aiKey: options.aiKey,
|
|
42
|
+
aiProviderUrl: options.aiProviderUrl,
|
|
43
|
+
aiReasoning: options.reasoning,
|
|
44
|
+
},
|
|
45
|
+
streamingOptions,
|
|
46
|
+
});
|
|
47
|
+
(0, common_1.displayEnhancementResult)(options.aiEnhance && options.stream);
|
|
48
|
+
(0, task_1.displayCreatedTask)(result.task, result.aiMetadata);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
hooks_1.hooks.off("task:progress", progressHandler);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
(0, progress_1.displayError)(error);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,aAAa,SAmCtB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.deleteCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const tasks_1 = require("../../services/tasks");
|
|
10
|
+
const task_1 = require("../../cli/display/task");
|
|
11
|
+
const progress_1 = require("../../cli/display/progress");
|
|
12
|
+
exports.deleteCommand = new commander_1.Command("delete")
|
|
13
|
+
.description("Delete a task")
|
|
14
|
+
.requiredOption("--id <id>", "Task ID to delete")
|
|
15
|
+
.option("--force", "Skip confirmation and delete anyway")
|
|
16
|
+
.option("--cascade", "Delete all subtasks as well")
|
|
17
|
+
.action(async (options) => {
|
|
18
|
+
try {
|
|
19
|
+
if (!options.force) {
|
|
20
|
+
const task = await tasks_1.taskService.getTask(options.id);
|
|
21
|
+
if (!task) {
|
|
22
|
+
throw new Error(`Task with ID ${options.id} not found`);
|
|
23
|
+
}
|
|
24
|
+
console.log(chalk_1.default.red(`\n⚠️ Are you sure you want to delete task: ${task.title} (${task.id})?`));
|
|
25
|
+
console.log(chalk_1.default.red("This action cannot be undone."));
|
|
26
|
+
// Simple confirmation - in a real CLI you might want a proper prompt
|
|
27
|
+
console.log(chalk_1.default.yellow("Use --force to confirm deletion."));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const result = await tasks_1.taskService.deleteTask(options.id, {
|
|
31
|
+
cascade: options.cascade,
|
|
32
|
+
force: options.force,
|
|
33
|
+
});
|
|
34
|
+
(0, task_1.displayTaskDelete)(result.deleted, result.orphanedSubtasks);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
(0, progress_1.displayError)(error);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,eAAO,MAAM,eAAe,SA2ExB,CAAC;AAEL,eAAO,MAAM,uBAAuB,SAgChC,CAAC;AAEL,eAAO,MAAM,uBAAuB,SA8ChC,CAAC"}
|