taskmonkey-cli 0.5.0 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskmonkey-cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "TaskMonkey CLI — Remote dev tools for tenant config editing and tool testing",
5
5
  "bin": {
6
6
  "tm": "./bin/tm.js",
@@ -15,7 +15,8 @@ export async function chat(options) {
15
15
  const task = options.task || null;
16
16
  const isPublic = options.public || false;
17
17
 
18
- // Validate task exists
18
+ // Validate task exists and get chatId from server
19
+ let chatId;
19
20
  if (task && !isPublic) {
20
21
  try {
21
22
  const client = createClient();
@@ -30,16 +31,25 @@ export async function chat(options) {
30
31
  }
31
32
  process.exit(1);
32
33
  }
34
+ // Use the chatId from server (has correct userId)
35
+ chatId = found.chat_id;
36
+ } catch {
37
+ chatId = `task_${task}_cli_${Date.now()}`;
38
+ }
39
+ } else if (isPublic) {
40
+ chatId = `public_cli_${Date.now()}`;
41
+ } else {
42
+ // Unified: get chatId from server too
43
+ try {
44
+ const client = createClient();
45
+ const tasksResult = await client.get('/api/tasks');
46
+ const unified = (tasksResult.tasks || []).find(t => t.is_unified);
47
+ chatId = unified?.chat_id || `unified_cli_${Date.now()}`;
33
48
  } catch {
34
- // Skip validation if API not reachable
49
+ chatId = `unified_cli_${Date.now()}`;
35
50
  }
36
51
  }
37
52
 
38
- let chatId;
39
- if (task) chatId = `task_${task}_cli_${Date.now()}`;
40
- else if (isPublic) chatId = `public_cli_${Date.now()}`;
41
- else chatId = `unified_cli_${Date.now()}`;
42
-
43
53
  const label = task ? `(${task})` : isPublic ? '(public)' : '(unified)';
44
54
  console.log(chalk.cyan('💬 Chat'), chalk.gray(label));
45
55
  console.log(chalk.gray(' Empty line to quit.\n'));