taskmonkey-cli 0.4.3 → 0.5.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/bin/tm.js +6 -0
- package/package.json +1 -1
- package/src/commands/chat.js +22 -0
- package/src/commands/tasks.js +36 -0
package/bin/tm.js
CHANGED
|
@@ -8,6 +8,7 @@ import { pull } from '../src/commands/pull.js';
|
|
|
8
8
|
import { watch } from '../src/commands/watch.js';
|
|
9
9
|
import { logs } from '../src/commands/logs.js';
|
|
10
10
|
import { chat } from '../src/commands/chat.js';
|
|
11
|
+
import { tasks } from '../src/commands/tasks.js';
|
|
11
12
|
import { testChat } from '../src/commands/test-chat.js';
|
|
12
13
|
import { testConversations } from '../src/commands/test-conversations.js';
|
|
13
14
|
import { optimizePrompt } from '../src/commands/optimize-prompt.js';
|
|
@@ -32,6 +33,11 @@ program
|
|
|
32
33
|
.option('--json', 'JSON output only')
|
|
33
34
|
.action(testTool);
|
|
34
35
|
|
|
36
|
+
program
|
|
37
|
+
.command('tasks')
|
|
38
|
+
.description('List available monkey tasks')
|
|
39
|
+
.action(tasks);
|
|
40
|
+
|
|
35
41
|
program
|
|
36
42
|
.command('sync')
|
|
37
43
|
.description('Upload local config files to server')
|
package/package.json
CHANGED
package/src/commands/chat.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createInterface } from 'readline';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { loadConfig } from '../config.js';
|
|
4
|
+
import { createClient } from '../lib/api.js';
|
|
4
5
|
|
|
5
6
|
const SPINNER = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
6
7
|
|
|
@@ -13,6 +14,27 @@ export async function chat(options) {
|
|
|
13
14
|
|
|
14
15
|
const task = options.task || null;
|
|
15
16
|
const isPublic = options.public || false;
|
|
17
|
+
|
|
18
|
+
// Validate task exists
|
|
19
|
+
if (task && !isPublic) {
|
|
20
|
+
try {
|
|
21
|
+
const client = createClient();
|
|
22
|
+
const tasksResult = await client.get('/api/tasks');
|
|
23
|
+
const tasks = tasksResult.tasks || [];
|
|
24
|
+
const found = tasks.find(t => t.slug === task);
|
|
25
|
+
if (!found) {
|
|
26
|
+
const available = tasks.filter(t => !t.is_unified).map(t => t.slug);
|
|
27
|
+
console.error(chalk.red(`Task "${task}" nicht gefunden.`));
|
|
28
|
+
if (available.length > 0) {
|
|
29
|
+
console.log(chalk.gray(`Verfügbar: ${available.join(', ')}`));
|
|
30
|
+
}
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
} catch {
|
|
34
|
+
// Skip validation if API not reachable
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
16
38
|
let chatId;
|
|
17
39
|
if (task) chatId = `task_${task}_cli_${Date.now()}`;
|
|
18
40
|
else if (isPublic) chatId = `public_cli_${Date.now()}`;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
import { createClient } from '../lib/api.js';
|
|
4
|
+
|
|
5
|
+
export async function tasks() {
|
|
6
|
+
const client = createClient();
|
|
7
|
+
const spinner = ora('Loading tasks...').start();
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
const result = await client.get('/api/tasks');
|
|
11
|
+
spinner.stop();
|
|
12
|
+
|
|
13
|
+
const taskList = result.tasks || [];
|
|
14
|
+
|
|
15
|
+
if (taskList.length === 0) {
|
|
16
|
+
console.log(chalk.yellow('Keine Tasks konfiguriert.'));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (const task of taskList) {
|
|
21
|
+
const icon = task.icon || '📋';
|
|
22
|
+
const name = task.name || task.slug;
|
|
23
|
+
const slug = task.slug;
|
|
24
|
+
const desc = task.description || '';
|
|
25
|
+
const unified = task.is_unified ? chalk.gray(' (unified)') : '';
|
|
26
|
+
|
|
27
|
+
console.log(`${icon} ${chalk.white(name)}${unified} ${chalk.gray(`[${slug}]`)}`);
|
|
28
|
+
if (desc) console.log(` ${chalk.gray(desc)}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
console.log(chalk.gray(`\n${taskList.length} Tasks`));
|
|
32
|
+
} catch (err) {
|
|
33
|
+
spinner.fail(err.message);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|