task-o-matic 0.0.1
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/LICENSE +21 -0
- package/README.md +552 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +8 -0
- package/dist/cli/display/common.d.ts +5 -0
- package/dist/cli/display/common.d.ts.map +1 -0
- package/dist/cli/display/common.js +44 -0
- package/dist/cli/display/plan.d.ts +11 -0
- package/dist/cli/display/plan.d.ts.map +1 -0
- package/dist/cli/display/plan.js +42 -0
- package/dist/cli/display/progress.d.ts +11 -0
- package/dist/cli/display/progress.d.ts.map +1 -0
- package/dist/cli/display/progress.js +47 -0
- package/dist/cli/display/task.d.ts +18 -0
- package/dist/cli/display/task.d.ts.map +1 -0
- package/dist/cli/display/task.js +250 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +61 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +197 -0
- package/dist/commands/prd.d.ts +4 -0
- package/dist/commands/prd.d.ts.map +1 -0
- package/dist/commands/prd.js +131 -0
- package/dist/commands/prompt.d.ts +3 -0
- package/dist/commands/prompt.d.ts.map +1 -0
- package/dist/commands/prompt.js +192 -0
- package/dist/commands/tasks.d.ts +3 -0
- package/dist/commands/tasks.d.ts.map +1 -0
- package/dist/commands/tasks.js +599 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/lib/ai-service/ai-operations.d.ts +31 -0
- package/dist/lib/ai-service/ai-operations.d.ts.map +1 -0
- package/dist/lib/ai-service/ai-operations.js +648 -0
- package/dist/lib/ai-service/json-parser.d.ts +9 -0
- package/dist/lib/ai-service/json-parser.d.ts.map +1 -0
- package/dist/lib/ai-service/json-parser.js +37 -0
- package/dist/lib/ai-service/mcp-client.d.ts +9 -0
- package/dist/lib/ai-service/mcp-client.d.ts.map +1 -0
- package/dist/lib/ai-service/mcp-client.js +48 -0
- package/dist/lib/ai-service/model-provider.d.ts +8 -0
- package/dist/lib/ai-service/model-provider.d.ts.map +1 -0
- package/dist/lib/ai-service/model-provider.js +71 -0
- package/dist/lib/ai-service/research-tools.d.ts +4 -0
- package/dist/lib/ai-service/research-tools.d.ts.map +1 -0
- package/dist/lib/ai-service/research-tools.js +8 -0
- package/dist/lib/ai-service/retry-handler.d.ts +8 -0
- package/dist/lib/ai-service/retry-handler.d.ts.map +1 -0
- package/dist/lib/ai-service/retry-handler.js +62 -0
- package/dist/lib/better-t-stack-cli.d.ts +35 -0
- package/dist/lib/better-t-stack-cli.d.ts.map +1 -0
- package/dist/lib/better-t-stack-cli.js +118 -0
- package/dist/lib/config.d.ts +24 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +160 -0
- package/dist/lib/context-builder.d.ts +53 -0
- package/dist/lib/context-builder.d.ts.map +1 -0
- package/dist/lib/context-builder.js +294 -0
- package/dist/lib/executors/executor-factory.d.ts +5 -0
- package/dist/lib/executors/executor-factory.d.ts.map +1 -0
- package/dist/lib/executors/executor-factory.js +21 -0
- package/dist/lib/executors/opencode-executor.d.ts +6 -0
- package/dist/lib/executors/opencode-executor.d.ts.map +1 -0
- package/dist/lib/executors/opencode-executor.js +46 -0
- package/dist/lib/index.d.ts +89 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +134 -0
- package/dist/lib/prompt-builder.d.ts +50 -0
- package/dist/lib/prompt-builder.d.ts.map +1 -0
- package/dist/lib/prompt-builder.js +171 -0
- package/dist/lib/prompt-registry.d.ts +22 -0
- package/dist/lib/prompt-registry.d.ts.map +1 -0
- package/dist/lib/prompt-registry.js +201 -0
- package/dist/lib/storage.d.ts +60 -0
- package/dist/lib/storage.d.ts.map +1 -0
- package/dist/lib/storage.js +768 -0
- package/dist/lib/task-execution.d.ts +3 -0
- package/dist/lib/task-execution.d.ts.map +1 -0
- package/dist/lib/task-execution.js +130 -0
- package/dist/lib/validation.d.ts +4 -0
- package/dist/lib/validation.d.ts.map +1 -0
- package/dist/lib/validation.js +52 -0
- package/dist/mcp/prompts.d.ts +3 -0
- package/dist/mcp/prompts.d.ts.map +1 -0
- package/dist/mcp/prompts.js +7 -0
- package/dist/mcp/resources.d.ts +3 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +7 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +25 -0
- package/dist/mcp/tools.d.ts +3 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +99 -0
- package/dist/prompts/documentation-detection.d.ts +2 -0
- package/dist/prompts/documentation-detection.d.ts.map +1 -0
- package/dist/prompts/documentation-detection.js +24 -0
- package/dist/prompts/index.d.ts +7 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +22 -0
- package/dist/prompts/prd-parsing.d.ts +3 -0
- package/dist/prompts/prd-parsing.d.ts.map +1 -0
- package/dist/prompts/prd-parsing.js +172 -0
- package/dist/prompts/prd-rework.d.ts +3 -0
- package/dist/prompts/prd-rework.d.ts.map +1 -0
- package/dist/prompts/prd-rework.js +81 -0
- package/dist/prompts/task-breakdown.d.ts +3 -0
- package/dist/prompts/task-breakdown.d.ts.map +1 -0
- package/dist/prompts/task-breakdown.js +151 -0
- package/dist/prompts/task-enhancement.d.ts +3 -0
- package/dist/prompts/task-enhancement.d.ts.map +1 -0
- package/dist/prompts/task-enhancement.js +140 -0
- package/dist/prompts/task-planning.d.ts +3 -0
- package/dist/prompts/task-planning.d.ts.map +1 -0
- package/dist/prompts/task-planning.js +66 -0
- package/dist/services/prd.d.ts +32 -0
- package/dist/services/prd.d.ts.map +1 -0
- package/dist/services/prd.js +191 -0
- package/dist/services/tasks.d.ts +67 -0
- package/dist/services/tasks.d.ts.map +1 -0
- package/dist/services/tasks.js +596 -0
- package/dist/test/commands.test.d.ts +2 -0
- package/dist/test/commands.test.d.ts.map +1 -0
- package/dist/test/commands.test.js +74 -0
- package/dist/test/storage.test.d.ts +2 -0
- package/dist/test/storage.test.d.ts.map +1 -0
- package/dist/test/storage.test.js +207 -0
- package/dist/types/callbacks.d.ts +27 -0
- package/dist/types/callbacks.d.ts.map +1 -0
- package/dist/types/callbacks.js +2 -0
- package/dist/types/index.d.ts +252 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/mcp.d.ts +3 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +3 -0
- package/dist/types/options.d.ts +94 -0
- package/dist/types/options.d.ts.map +1 -0
- package/dist/types/options.js +2 -0
- package/dist/types/results.d.ts +90 -0
- package/dist/types/results.d.ts.map +1 -0
- package/dist/types/results.js +2 -0
- package/dist/utils/ai-config-builder.d.ts +14 -0
- package/dist/utils/ai-config-builder.d.ts.map +1 -0
- package/dist/utils/ai-config-builder.js +22 -0
- package/dist/utils/ai-service-factory.d.ts +10 -0
- package/dist/utils/ai-service-factory.d.ts.map +1 -0
- package/dist/utils/ai-service-factory.js +52 -0
- package/dist/utils/stack-formatter.d.ts +11 -0
- package/dist/utils/stack-formatter.d.ts.map +1 -0
- package/dist/utils/stack-formatter.js +30 -0
- package/dist/utils/streaming-options.d.ts +10 -0
- package/dist/utils/streaming-options.d.ts.map +1 -0
- package/dist/utils/streaming-options.js +53 -0
- package/package.json +82 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.prdCommand = void 0;
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const prd_1 = require("../services/prd");
|
|
11
|
+
const streaming_options_1 = require("../utils/streaming-options");
|
|
12
|
+
const progress_1 = require("../cli/display/progress");
|
|
13
|
+
exports.prdCommand = new commander_1.Command("prd").description("Manage PRDs and generate tasks");
|
|
14
|
+
// Parse PRD into tasks
|
|
15
|
+
exports.prdCommand
|
|
16
|
+
.command("parse")
|
|
17
|
+
.description("Parse a PRD file into structured tasks")
|
|
18
|
+
.requiredOption("--file <path>", "Path to PRD file")
|
|
19
|
+
.option("--prompt <prompt>", "Override prompt")
|
|
20
|
+
.option("--message <message>", "User message")
|
|
21
|
+
.option("--ai-provider <provider>", "AI provider override")
|
|
22
|
+
.option("--ai-model <model>", "AI model override")
|
|
23
|
+
.option("--ai-key <key>", "AI API key override")
|
|
24
|
+
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
25
|
+
.option("--ai-reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
26
|
+
.option("--stream", "Show streaming AI output during parsing")
|
|
27
|
+
.action(async (options) => {
|
|
28
|
+
try {
|
|
29
|
+
// Determine working directory from current process location
|
|
30
|
+
// Service layer should receive this explicitly, not use process.cwd()
|
|
31
|
+
const workingDirectory = process.cwd();
|
|
32
|
+
const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, 'Parsing');
|
|
33
|
+
const result = await prd_1.prdService.parsePRD({
|
|
34
|
+
file: options.file,
|
|
35
|
+
workingDirectory, // Pass working directory explicitly to service
|
|
36
|
+
aiOptions: {
|
|
37
|
+
aiProvider: options.aiProvider,
|
|
38
|
+
aiModel: options.aiModel,
|
|
39
|
+
aiKey: options.aiKey,
|
|
40
|
+
aiProviderUrl: options.aiProviderUrl,
|
|
41
|
+
aiReasoning: options.aiReasoning,
|
|
42
|
+
},
|
|
43
|
+
promptOverride: options.prompt,
|
|
44
|
+
messageOverride: options.message,
|
|
45
|
+
streamingOptions,
|
|
46
|
+
callbacks: {
|
|
47
|
+
onProgress: progress_1.displayProgress,
|
|
48
|
+
onError: progress_1.displayError,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
console.log('');
|
|
52
|
+
console.log(chalk_1.default.blue(`📊 PRD Parsing Summary:`));
|
|
53
|
+
console.log(chalk_1.default.cyan(` Tasks created: ${result.stats.tasksCreated}`));
|
|
54
|
+
console.log(chalk_1.default.cyan(` Duration: ${result.stats.duration}ms`));
|
|
55
|
+
console.log(chalk_1.default.cyan(` AI Model: ${result.stats.aiModel}`));
|
|
56
|
+
console.log(chalk_1.default.blue('\n📋 Processing Steps:'));
|
|
57
|
+
result.steps.forEach(step => {
|
|
58
|
+
const icon = step.status === 'completed' ? '✓' : '✗';
|
|
59
|
+
console.log(` ${icon} ${step.step} (${step.duration}ms)`);
|
|
60
|
+
if (step.details) {
|
|
61
|
+
console.log(chalk_1.default.gray(` ${JSON.stringify(step.details)}`));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
// Show created tasks
|
|
65
|
+
console.log(chalk_1.default.blue("\n✨ Created Tasks:"));
|
|
66
|
+
result.tasks.forEach((task, index) => {
|
|
67
|
+
console.log(`${index + 1}. ${chalk_1.default.bold(task.title)} (${task.id})`);
|
|
68
|
+
if (task.description) {
|
|
69
|
+
console.log(chalk_1.default.gray(` ${task.description.substring(0, 100)}${task.description.length > 100 ? '...' : ''}`));
|
|
70
|
+
}
|
|
71
|
+
if (task.estimatedEffort) {
|
|
72
|
+
console.log(chalk_1.default.cyan(` Effort: ${task.estimatedEffort}`));
|
|
73
|
+
}
|
|
74
|
+
console.log('');
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
(0, progress_1.displayError)(error);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// Rework PRD with AI
|
|
83
|
+
exports.prdCommand
|
|
84
|
+
.command("rework")
|
|
85
|
+
.description("Rework a PRD based on user feedback")
|
|
86
|
+
.requiredOption("--file <path>", "Path to PRD file")
|
|
87
|
+
.requiredOption("--feedback <feedback>", "User feedback")
|
|
88
|
+
.option("--output <path>", "Output file path (default: overwrite original)")
|
|
89
|
+
.option("--prompt <prompt>", "Override prompt")
|
|
90
|
+
.option("--message <message>", "User message")
|
|
91
|
+
.option("--ai-provider <provider>", "AI provider override")
|
|
92
|
+
.option("--ai-model <model>", "AI model override")
|
|
93
|
+
.option("--ai-key <key>", "AI API key override")
|
|
94
|
+
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
95
|
+
.option("--ai-reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
96
|
+
.option("--stream", "Show streaming AI output during rework")
|
|
97
|
+
.action(async (options) => {
|
|
98
|
+
try {
|
|
99
|
+
// Determine working directory from current process location
|
|
100
|
+
// Service layer should receive this explicitly, not use process.cwd()
|
|
101
|
+
const workingDirectory = process.cwd();
|
|
102
|
+
const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, 'Rework');
|
|
103
|
+
const outputPath = await prd_1.prdService.reworkPRD({
|
|
104
|
+
file: options.file,
|
|
105
|
+
feedback: options.feedback,
|
|
106
|
+
output: options.output,
|
|
107
|
+
workingDirectory, // Pass working directory explicitly to service
|
|
108
|
+
aiOptions: {
|
|
109
|
+
aiProvider: options.aiProvider,
|
|
110
|
+
aiModel: options.aiModel,
|
|
111
|
+
aiKey: options.aiKey,
|
|
112
|
+
aiProviderUrl: options.aiProviderUrl,
|
|
113
|
+
aiReasoning: options.aiReasoning,
|
|
114
|
+
},
|
|
115
|
+
promptOverride: options.prompt,
|
|
116
|
+
messageOverride: options.message,
|
|
117
|
+
streamingOptions,
|
|
118
|
+
callbacks: {
|
|
119
|
+
onProgress: progress_1.displayProgress,
|
|
120
|
+
onError: progress_1.displayError,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
console.log('');
|
|
124
|
+
console.log(chalk_1.default.green(`✓ PRD improved and saved to ${outputPath}`));
|
|
125
|
+
console.log(chalk_1.default.cyan(`Feedback applied: ${options.feedback}`));
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
(0, progress_1.displayError)(error);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/commands/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC,eAAO,MAAM,aAAa,SAkOtB,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.promptCommand = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const prompt_builder_1 = require("../lib/prompt-builder");
|
|
6
|
+
const process_1 = require("process");
|
|
7
|
+
exports.promptCommand = new commander_1.Command("prompt")
|
|
8
|
+
.description("Build AI service prompts with variable replacement for external tools")
|
|
9
|
+
.argument("[name]", "Prompt name (e.g., prd-parsing, task-enhancement, task-breakdown, prd-rework, documentation-detection)")
|
|
10
|
+
.option("-t, --type <type>", "Prompt type: system or user (default: user)", "user")
|
|
11
|
+
.option("-l, --list", "List all available prompts and exit", false)
|
|
12
|
+
.option("-m, --metadata <name>", "Show metadata for a specific prompt and exit")
|
|
13
|
+
.option("--prd-content <content>", "PRD content (for PRD-related prompts)")
|
|
14
|
+
.option("--prd-file <filepath>", "Load PRD content from file")
|
|
15
|
+
.option("--task-title <title>", "Task title (for task-related prompts)")
|
|
16
|
+
.option("--task-description <description>", "Task description (for task-related prompts)")
|
|
17
|
+
.option("--task-file <filepath>", "Load task description from file")
|
|
18
|
+
.option("--stack-info <info>", 'Technology stack information (e.g., "Frontend: Next.js, Backend: Convex")')
|
|
19
|
+
.option("--context-info <info>", "Additional context information")
|
|
20
|
+
.option("--user-feedback <feedback>", "User feedback (for prd-rework prompt)")
|
|
21
|
+
.option("--var <key=value>", "Custom variable in format key=value (can be used multiple times)", (value, previous = []) => {
|
|
22
|
+
return [...previous, value];
|
|
23
|
+
}, [])
|
|
24
|
+
.action(async (name, options) => {
|
|
25
|
+
try {
|
|
26
|
+
// Handle list option
|
|
27
|
+
if (options.list) {
|
|
28
|
+
console.log(prompt_builder_1.PromptBuilder.listPrompts());
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// Handle metadata option
|
|
32
|
+
if (options.metadata) {
|
|
33
|
+
const metadata = prompt_builder_1.PromptBuilder.getPromptMetadata(options.metadata, options.type);
|
|
34
|
+
if (!metadata) {
|
|
35
|
+
console.error(`Prompt not found: ${options.metadata}`);
|
|
36
|
+
(0, process_1.exit)(1);
|
|
37
|
+
}
|
|
38
|
+
console.log(`Prompt: ${metadata.name}`);
|
|
39
|
+
console.log(`Type: ${metadata.type}`);
|
|
40
|
+
console.log(`Description: ${metadata.description}`);
|
|
41
|
+
console.log(`Required variables: ${metadata.requiredVariables.length > 0 ? metadata.requiredVariables.join(", ") : "None"}`);
|
|
42
|
+
console.log(`Optional variables: ${metadata.optionalVariables.length > 0 ? metadata.optionalVariables.join(", ") : "None"}`);
|
|
43
|
+
console.log("\nPrompt text:");
|
|
44
|
+
console.log(metadata.promptText);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Check if name is provided when not using list or metadata
|
|
48
|
+
if (!name) {
|
|
49
|
+
console.error("Error: Prompt name is required unless using --list or --metadata");
|
|
50
|
+
console.log("Use --help to see available options and examples");
|
|
51
|
+
(0, process_1.exit)(1);
|
|
52
|
+
}
|
|
53
|
+
// Validate prompt type
|
|
54
|
+
if (options.type !== "system" && options.type !== "user") {
|
|
55
|
+
console.error('Error: --type must be either "system" or "user"');
|
|
56
|
+
(0, process_1.exit)(1);
|
|
57
|
+
}
|
|
58
|
+
// Build variables object
|
|
59
|
+
const variables = {};
|
|
60
|
+
// Parse custom variables (--var key=value)
|
|
61
|
+
if (options.var) {
|
|
62
|
+
for (const varPair of options.var) {
|
|
63
|
+
const [key, ...valueParts] = varPair.split("=");
|
|
64
|
+
if (!key || valueParts.length === 0) {
|
|
65
|
+
console.error(`Error: Invalid variable format: ${varPair}. Expected format: key=value`);
|
|
66
|
+
(0, process_1.exit)(1);
|
|
67
|
+
}
|
|
68
|
+
variables[key] = valueParts.join("=");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Handle PRD content
|
|
72
|
+
let prdContent = options.prdContent;
|
|
73
|
+
if (options.prdFile) {
|
|
74
|
+
prdContent = prompt_builder_1.PromptBuilder.loadPRDContent(options.prdFile);
|
|
75
|
+
}
|
|
76
|
+
if (prdContent) {
|
|
77
|
+
variables.PRD_CONTENT = prdContent;
|
|
78
|
+
}
|
|
79
|
+
else if (!prdContent && !variables.PRD_CONTENT) {
|
|
80
|
+
// Auto-detect PRD content if not provided
|
|
81
|
+
prdContent = await prompt_builder_1.PromptBuilder.autoDetectPRDContent();
|
|
82
|
+
if (prdContent) {
|
|
83
|
+
variables.PRD_CONTENT = prdContent;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Handle task information
|
|
87
|
+
let taskDescription = options.taskDescription;
|
|
88
|
+
if (options.taskFile) {
|
|
89
|
+
taskDescription = await prompt_builder_1.PromptBuilder.buildTaskContext("", "", options.taskFile);
|
|
90
|
+
}
|
|
91
|
+
if (options.taskTitle) {
|
|
92
|
+
variables.TASK_TITLE = options.taskTitle;
|
|
93
|
+
}
|
|
94
|
+
if (taskDescription) {
|
|
95
|
+
variables.TASK_DESCRIPTION = taskDescription;
|
|
96
|
+
}
|
|
97
|
+
// If we have both title and description, build rich context
|
|
98
|
+
if (options.taskTitle && (options.taskDescription || options.taskFile)) {
|
|
99
|
+
const richContext = await prompt_builder_1.PromptBuilder.buildTaskContext(options.taskTitle, options.taskDescription, options.taskFile);
|
|
100
|
+
variables.TASK_CONTEXT = richContext;
|
|
101
|
+
}
|
|
102
|
+
// Handle stack info (don't auto-detect if custom var provided)
|
|
103
|
+
if (options.stackInfo) {
|
|
104
|
+
variables.STACK_INFO = options.stackInfo;
|
|
105
|
+
}
|
|
106
|
+
else if (!variables.STACK_INFO) {
|
|
107
|
+
// Auto-detect stack info from current directory
|
|
108
|
+
const stackInfo = await prompt_builder_1.PromptBuilder.detectStackInfo(process.cwd());
|
|
109
|
+
if (stackInfo !== "Not detected") {
|
|
110
|
+
variables.STACK_INFO = stackInfo;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Build CONTEXT_INFO from stack and PRD if not explicitly provided
|
|
114
|
+
if (!options.contextInfo && !variables.CONTEXT_INFO) {
|
|
115
|
+
const contextParts = [];
|
|
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
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Handle other variables
|
|
130
|
+
if (options.contextInfo) {
|
|
131
|
+
variables.CONTEXT_INFO = options.contextInfo;
|
|
132
|
+
}
|
|
133
|
+
if (options.userFeedback) {
|
|
134
|
+
variables.USER_FEEDBACK = options.userFeedback;
|
|
135
|
+
}
|
|
136
|
+
// Build the prompt
|
|
137
|
+
const result = prompt_builder_1.PromptBuilder.buildPrompt({
|
|
138
|
+
name,
|
|
139
|
+
type: options.type,
|
|
140
|
+
variables,
|
|
141
|
+
});
|
|
142
|
+
if (!result.success) {
|
|
143
|
+
console.error(`Error: ${result.error}`);
|
|
144
|
+
if (result.missingVariables && result.missingVariables.length > 0) {
|
|
145
|
+
console.error("\nMissing required variables:");
|
|
146
|
+
result.missingVariables.forEach((v) => console.error(` - ${v}`));
|
|
147
|
+
// Show available variables for the prompt
|
|
148
|
+
if (result.metadata) {
|
|
149
|
+
console.error("\nAvailable variables:");
|
|
150
|
+
if (result.metadata.requiredVariables.length > 0) {
|
|
151
|
+
console.error(" Required:");
|
|
152
|
+
result.metadata.requiredVariables.forEach((v) => console.error(` - ${v}`));
|
|
153
|
+
}
|
|
154
|
+
if (result.metadata.optionalVariables.length > 0) {
|
|
155
|
+
console.error(" Optional:");
|
|
156
|
+
result.metadata.optionalVariables.forEach((v) => console.error(` - ${v}`));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
(0, process_1.exit)(1);
|
|
161
|
+
}
|
|
162
|
+
// Output the built prompt
|
|
163
|
+
console.log(result.prompt);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
console.error(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
167
|
+
(0, process_1.exit)(1);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
// Add help examples
|
|
171
|
+
exports.promptCommand.on("--help", () => {
|
|
172
|
+
console.log("");
|
|
173
|
+
console.log("Examples:");
|
|
174
|
+
console.log(" # List all available prompts");
|
|
175
|
+
console.log(" $ task-o-matic prompt --list");
|
|
176
|
+
console.log("");
|
|
177
|
+
console.log(" # Show metadata for a specific prompt");
|
|
178
|
+
console.log(" $ task-o-matic prompt --metadata prd-parsing");
|
|
179
|
+
console.log(" $ task-o-matic prompt --metadata task-enhancement --type user");
|
|
180
|
+
console.log("");
|
|
181
|
+
console.log(" # Build PRD parsing prompt with content from file");
|
|
182
|
+
console.log(" $ task-o-matic prompt prd-parsing --prd-file ./my-prd.md");
|
|
183
|
+
console.log("");
|
|
184
|
+
console.log(" # Build task enhancement prompt with task info");
|
|
185
|
+
console.log(' $ task-o-matic prompt task-enhancement --task-title "Add user auth" --task-description "Implement JWT authentication"');
|
|
186
|
+
console.log("");
|
|
187
|
+
console.log(" # Build with custom variables");
|
|
188
|
+
console.log(' $ task-o-matic prompt prd-parsing --var PRD_CONTENT="My PRD content" --var STACK_INFO="Next.js, Convex"');
|
|
189
|
+
console.log("");
|
|
190
|
+
console.log(" # Build system prompt");
|
|
191
|
+
console.log(" $ task-o-matic prompt prd-parsing --type system");
|
|
192
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/commands/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BpC,eAAO,MAAM,YAAY,SAAuB,CAAC"}
|