@parall/cli 1.12.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/dist/commands/agents.d.ts +3 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +18 -0
- package/dist/commands/chats.d.ts +3 -0
- package/dist/commands/chats.d.ts.map +1 -0
- package/dist/commands/chats.js +105 -0
- package/dist/commands/dm.d.ts +3 -0
- package/dist/commands/dm.d.ts.map +1 -0
- package/dist/commands/dm.js +51 -0
- package/dist/commands/mcp.d.ts +3 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +439 -0
- package/dist/commands/messages.d.ts +3 -0
- package/dist/commands/messages.d.ts.map +1 -0
- package/dist/commands/messages.js +102 -0
- package/dist/commands/projects.d.ts +3 -0
- package/dist/commands/projects.d.ts.map +1 -0
- package/dist/commands/projects.js +104 -0
- package/dist/commands/refs.d.ts +3 -0
- package/dist/commands/refs.d.ts.map +1 -0
- package/dist/commands/refs.js +50 -0
- package/dist/commands/tasks.d.ts +3 -0
- package/dist/commands/tasks.d.ts.map +1 -0
- package/dist/commands/tasks.js +240 -0
- package/dist/commands/users.d.ts +3 -0
- package/dist/commands/users.d.ts.map +1 -0
- package/dist/commands/users.js +49 -0
- package/dist/commands/wiki.d.ts +3 -0
- package/dist/commands/wiki.d.ts.map +1 -0
- package/dist/commands/wiki.js +644 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/lib/client.d.ts +24 -0
- package/dist/lib/client.d.ts.map +1 -0
- package/dist/lib/client.js +47 -0
- package/dist/lib/output.d.ts +3 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +18 -0
- package/dist/lib/wiki.d.ts +269 -0
- package/dist/lib/wiki.d.ts.map +1 -0
- package/dist/lib/wiki.js +1800 -0
- package/package.json +43 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { resolveCredentials, resolveRuntimeContext } from '../lib/client.js';
|
|
2
|
+
import { printJson, printError } from '../lib/output.js';
|
|
3
|
+
export function registerMessageCommands(program) {
|
|
4
|
+
const messages = program.command('messages').description('Manage messages');
|
|
5
|
+
messages
|
|
6
|
+
.command('list')
|
|
7
|
+
.description('List messages in a chat')
|
|
8
|
+
.argument('<chatId>', 'Chat ID')
|
|
9
|
+
.option('--limit <n>', 'Maximum number of messages to return', '20')
|
|
10
|
+
.option('--before <cursor>', 'Cursor for messages before')
|
|
11
|
+
.option('--after <cursor>', 'Cursor for messages after')
|
|
12
|
+
.option('--thread-root-id <id>', 'Filter by thread root message ID')
|
|
13
|
+
.option('--top-level', 'Only return top-level messages')
|
|
14
|
+
.action(async (chatId, opts) => {
|
|
15
|
+
try {
|
|
16
|
+
const { client, orgId } = resolveCredentials();
|
|
17
|
+
const params = { limit: Number(opts.limit) };
|
|
18
|
+
if (opts.before !== undefined)
|
|
19
|
+
params.before = opts.before;
|
|
20
|
+
if (opts.after !== undefined)
|
|
21
|
+
params.after = opts.after;
|
|
22
|
+
if (opts.threadRootId !== undefined)
|
|
23
|
+
params.thread_root_id = opts.threadRootId;
|
|
24
|
+
if (opts.topLevel)
|
|
25
|
+
params.top_level = true;
|
|
26
|
+
const result = await client.getMessages(orgId, chatId, params);
|
|
27
|
+
printJson(result);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
printError(err);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
messages
|
|
34
|
+
.command('get')
|
|
35
|
+
.description('Get a message by ID')
|
|
36
|
+
.argument('<messageId>', 'Message ID')
|
|
37
|
+
.action(async (messageId) => {
|
|
38
|
+
try {
|
|
39
|
+
const { client } = resolveCredentials();
|
|
40
|
+
const result = await client.getMessage(messageId);
|
|
41
|
+
printJson(result);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
printError(err);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
messages
|
|
48
|
+
.command('send')
|
|
49
|
+
.description('Send a text message to a chat')
|
|
50
|
+
.argument('[chatId]', 'Chat ID (defaults to PRLL_CHAT_ID if set)')
|
|
51
|
+
.requiredOption('--text <text>', 'Message text')
|
|
52
|
+
.option('--thread-root-id <id>', 'Reply to a thread')
|
|
53
|
+
.option('--no-reply', 'Hint that the recipient should not reply')
|
|
54
|
+
.action(async (chatIdArg, opts) => {
|
|
55
|
+
try {
|
|
56
|
+
const { client, orgId } = resolveCredentials();
|
|
57
|
+
const ctx = resolveRuntimeContext();
|
|
58
|
+
const chatId = chatIdArg?.trim() || ctx.chatId;
|
|
59
|
+
if (!chatId) {
|
|
60
|
+
printError(new Error('Chat ID required — provide as argument or set PRLL_CHAT_ID'));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const req = {
|
|
64
|
+
message_type: 'text',
|
|
65
|
+
content: { text: opts.text },
|
|
66
|
+
};
|
|
67
|
+
if (opts.threadRootId !== undefined)
|
|
68
|
+
req.thread_root_id = opts.threadRootId;
|
|
69
|
+
if (opts.reply === false)
|
|
70
|
+
req.hints = { no_reply: true };
|
|
71
|
+
if (ctx.stepId)
|
|
72
|
+
req.agent_step_id = ctx.stepId;
|
|
73
|
+
const result = await client.sendMessage(orgId, chatId, req);
|
|
74
|
+
printJson(result);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
printError(err);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
messages
|
|
81
|
+
.command('replies')
|
|
82
|
+
.description('Get replies to a message')
|
|
83
|
+
.argument('<messageId>', 'Message ID')
|
|
84
|
+
.option('--limit <n>', 'Maximum number of replies to return', '20')
|
|
85
|
+
.option('--before <cursor>', 'Cursor for replies before')
|
|
86
|
+
.option('--after <cursor>', 'Cursor for replies after')
|
|
87
|
+
.action(async (messageId, opts) => {
|
|
88
|
+
try {
|
|
89
|
+
const { client } = resolveCredentials();
|
|
90
|
+
const params = { limit: Number(opts.limit) };
|
|
91
|
+
if (opts.before !== undefined)
|
|
92
|
+
params.before = opts.before;
|
|
93
|
+
if (opts.after !== undefined)
|
|
94
|
+
params.after = opts.after;
|
|
95
|
+
const result = await client.getMessageReplies(messageId, params);
|
|
96
|
+
printJson(result);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
printError(err);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/commands/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QA6FvD"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { resolveCredentials } from '../lib/client.js';
|
|
2
|
+
import { printJson, printError } from '../lib/output.js';
|
|
3
|
+
export function registerProjectCommands(program) {
|
|
4
|
+
const projects = program.command('projects').description('Manage projects');
|
|
5
|
+
projects
|
|
6
|
+
.command('list')
|
|
7
|
+
.description('List projects in the organization')
|
|
8
|
+
.action(async () => {
|
|
9
|
+
try {
|
|
10
|
+
const { client, orgId } = resolveCredentials();
|
|
11
|
+
const result = await client.getProjects(orgId);
|
|
12
|
+
printJson(result);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
printError(err);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
projects
|
|
19
|
+
.command('get')
|
|
20
|
+
.description('Get a project by ID')
|
|
21
|
+
.argument('<projectId>', 'Project ID')
|
|
22
|
+
.action(async (projectId) => {
|
|
23
|
+
try {
|
|
24
|
+
const { client, orgId } = resolveCredentials();
|
|
25
|
+
const result = await client.getProject(orgId, projectId);
|
|
26
|
+
printJson(result);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
printError(err);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
projects
|
|
33
|
+
.command('create')
|
|
34
|
+
.description('Create a new project')
|
|
35
|
+
.requiredOption('--name <name>', 'Project name')
|
|
36
|
+
.requiredOption('--key <key>', 'Project key')
|
|
37
|
+
.option('--description <text>', 'Project description')
|
|
38
|
+
.option('--lead-id <id>', 'Lead user ID')
|
|
39
|
+
.option('--color <hex>', 'Project color (hex)')
|
|
40
|
+
.action(async (opts) => {
|
|
41
|
+
try {
|
|
42
|
+
const { client, orgId } = resolveCredentials();
|
|
43
|
+
const data = { name: opts.name, key: opts.key };
|
|
44
|
+
if (opts.description !== undefined)
|
|
45
|
+
data.description = opts.description;
|
|
46
|
+
if (opts.leadId !== undefined)
|
|
47
|
+
data.lead_id = opts.leadId;
|
|
48
|
+
if (opts.color !== undefined)
|
|
49
|
+
data.color = opts.color;
|
|
50
|
+
const result = await client.createProject(orgId, data);
|
|
51
|
+
printJson(result);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
printError(err);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
projects
|
|
58
|
+
.command('update')
|
|
59
|
+
.description('Update a project')
|
|
60
|
+
.argument('<projectId>', 'Project ID')
|
|
61
|
+
.option('--name <name>', 'Project name')
|
|
62
|
+
.option('--description <text>', 'Project description')
|
|
63
|
+
.option('--lead-id <id>', 'Lead user ID')
|
|
64
|
+
.option('--color <hex>', 'Project color (hex)')
|
|
65
|
+
.option('--status <status>', 'Project status')
|
|
66
|
+
.action(async (projectId, opts) => {
|
|
67
|
+
try {
|
|
68
|
+
const { client, orgId } = resolveCredentials();
|
|
69
|
+
const data = {};
|
|
70
|
+
if (opts.name !== undefined)
|
|
71
|
+
data.name = opts.name;
|
|
72
|
+
if (opts.description !== undefined)
|
|
73
|
+
data.description = opts.description;
|
|
74
|
+
if (opts.leadId !== undefined)
|
|
75
|
+
data.lead_id = opts.leadId;
|
|
76
|
+
if (opts.color !== undefined)
|
|
77
|
+
data.color = opts.color;
|
|
78
|
+
if (opts.status !== undefined)
|
|
79
|
+
data.status = opts.status;
|
|
80
|
+
if (Object.keys(data).length === 0) {
|
|
81
|
+
printError(new Error('No fields to update. Provide at least one option.'));
|
|
82
|
+
}
|
|
83
|
+
const result = await client.updateProject(orgId, projectId, data);
|
|
84
|
+
printJson(result);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
printError(err);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
projects
|
|
91
|
+
.command('delete')
|
|
92
|
+
.description('Delete a project')
|
|
93
|
+
.argument('<projectId>', 'Project ID')
|
|
94
|
+
.action(async (projectId) => {
|
|
95
|
+
try {
|
|
96
|
+
const { client, orgId } = resolveCredentials();
|
|
97
|
+
await client.deleteProject(orgId, projectId);
|
|
98
|
+
printJson({ deleted: projectId });
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
printError(err);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/commands/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,QA+CnD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { resolveCredentials } from '../lib/client.js';
|
|
2
|
+
import { printJson, printError } from '../lib/output.js';
|
|
3
|
+
export function registerRefCommands(program) {
|
|
4
|
+
const refs = program.command('refs').description('Reference resolution and backlinks');
|
|
5
|
+
refs
|
|
6
|
+
.command('resolve <uris...>')
|
|
7
|
+
.description('Batch resolve prll:// URIs to entity metadata')
|
|
8
|
+
.action(async (uris) => {
|
|
9
|
+
try {
|
|
10
|
+
const { client, orgId } = resolveCredentials();
|
|
11
|
+
const result = await client.resolveRefs(orgId, uris);
|
|
12
|
+
printJson(result);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
printError(err);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
refs
|
|
19
|
+
.command('backlinks <uri>')
|
|
20
|
+
.description('List backlinks pointing to a prll:// URI')
|
|
21
|
+
.option('--limit <n>', 'Maximum number of backlinks', '20')
|
|
22
|
+
.option('--cursor <cursor>', 'Pagination cursor')
|
|
23
|
+
.action(async (uri, opts) => {
|
|
24
|
+
try {
|
|
25
|
+
const { client, orgId } = resolveCredentials();
|
|
26
|
+
const result = await client.getBacklinks(orgId, {
|
|
27
|
+
uri,
|
|
28
|
+
limit: Number(opts.limit),
|
|
29
|
+
cursor: opts.cursor,
|
|
30
|
+
});
|
|
31
|
+
printJson(result);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
printError(err);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
refs
|
|
38
|
+
.command('check')
|
|
39
|
+
.description('Check for broken references in the organization (admin only)')
|
|
40
|
+
.action(async () => {
|
|
41
|
+
try {
|
|
42
|
+
const { client, orgId } = resolveCredentials();
|
|
43
|
+
const result = await client.checkBrokenRefs(orgId);
|
|
44
|
+
printJson(result);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
printError(err);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -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;AAQpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA6OpD"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { resolveCredentials } from '../lib/client.js';
|
|
2
|
+
import { printJson, printError } from '../lib/output.js';
|
|
3
|
+
function stripUndefined(obj) {
|
|
4
|
+
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
|
|
5
|
+
}
|
|
6
|
+
export function registerTaskCommands(program) {
|
|
7
|
+
const tasks = program.command('tasks').description('Manage tasks');
|
|
8
|
+
tasks
|
|
9
|
+
.command('list')
|
|
10
|
+
.description('List tasks in the organization')
|
|
11
|
+
.option('--status <status>', 'Filter by status')
|
|
12
|
+
.option('--priority <priority>', 'Filter by priority')
|
|
13
|
+
.option('--assignee-id <id>', 'Filter by assignee ID')
|
|
14
|
+
.option('--project-id <id>', 'Filter by project ID')
|
|
15
|
+
.option('--parent-id <id>', 'Filter by parent task ID')
|
|
16
|
+
.option('--limit <n>', 'Maximum number of tasks to return', '20')
|
|
17
|
+
.option('--cursor <cursor>', 'Pagination cursor')
|
|
18
|
+
.option('--sort <field>', 'Sort field')
|
|
19
|
+
.option('--order <order>', 'Sort order (asc or desc)')
|
|
20
|
+
.action(async (opts) => {
|
|
21
|
+
try {
|
|
22
|
+
const { client, orgId } = resolveCredentials();
|
|
23
|
+
const params = stripUndefined({
|
|
24
|
+
status: opts.status,
|
|
25
|
+
priority: opts.priority,
|
|
26
|
+
assignee_id: opts.assigneeId,
|
|
27
|
+
project_id: opts.projectId,
|
|
28
|
+
parent_id: opts.parentId,
|
|
29
|
+
limit: Number(opts.limit),
|
|
30
|
+
cursor: opts.cursor,
|
|
31
|
+
sort: opts.sort,
|
|
32
|
+
order: opts.order,
|
|
33
|
+
});
|
|
34
|
+
const result = await client.getTasks(orgId, params);
|
|
35
|
+
printJson(result);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
printError(err);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
tasks
|
|
42
|
+
.command('create')
|
|
43
|
+
.description('Create a new task')
|
|
44
|
+
.requiredOption('--title <title>', 'Task title')
|
|
45
|
+
.option('--description <text>', 'Task description')
|
|
46
|
+
.option('--status <status>', 'Task status')
|
|
47
|
+
.option('--priority <priority>', 'Task priority')
|
|
48
|
+
.option('--assignee-id <id>', 'Assignee user ID')
|
|
49
|
+
.option('--project-id <id>', 'Project ID')
|
|
50
|
+
.option('--parent-id <id>', 'Parent task ID')
|
|
51
|
+
.option('--source-chat-id <id>', 'Source chat ID')
|
|
52
|
+
.action(async (opts) => {
|
|
53
|
+
try {
|
|
54
|
+
const { client, orgId } = resolveCredentials();
|
|
55
|
+
const data = stripUndefined({
|
|
56
|
+
title: opts.title,
|
|
57
|
+
description: opts.description,
|
|
58
|
+
status: opts.status,
|
|
59
|
+
priority: opts.priority,
|
|
60
|
+
assignee_id: opts.assigneeId,
|
|
61
|
+
project_id: opts.projectId,
|
|
62
|
+
parent_id: opts.parentId,
|
|
63
|
+
source_chat_id: opts.sourceChatId,
|
|
64
|
+
});
|
|
65
|
+
const result = await client.createTask(orgId, data);
|
|
66
|
+
printJson(result);
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
printError(err);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
tasks
|
|
73
|
+
.command('get')
|
|
74
|
+
.description('Get a task by ID')
|
|
75
|
+
.argument('<taskId>', 'Task ID')
|
|
76
|
+
.action(async (taskId) => {
|
|
77
|
+
try {
|
|
78
|
+
const { client, orgId } = resolveCredentials();
|
|
79
|
+
const result = await client.getTask(orgId, taskId);
|
|
80
|
+
printJson(result);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
printError(err);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
tasks
|
|
87
|
+
.command('update')
|
|
88
|
+
.description('Update a task')
|
|
89
|
+
.argument('<taskId>', 'Task ID')
|
|
90
|
+
.option('--title <title>', 'Task title')
|
|
91
|
+
.option('--status <status>', 'Task status')
|
|
92
|
+
.option('--priority <priority>', 'Task priority')
|
|
93
|
+
.option('--assignee-id <id>', 'Assignee user ID')
|
|
94
|
+
.option('--description <text>', 'Task description')
|
|
95
|
+
.option('--project-id <id>', 'Project ID')
|
|
96
|
+
.option('--parent-id <id>', 'Parent task ID')
|
|
97
|
+
.option('--sort-order <n>', 'Sort order')
|
|
98
|
+
.action(async (taskId, opts) => {
|
|
99
|
+
try {
|
|
100
|
+
const { client, orgId } = resolveCredentials();
|
|
101
|
+
const data = stripUndefined({
|
|
102
|
+
title: opts.title,
|
|
103
|
+
status: opts.status,
|
|
104
|
+
priority: opts.priority,
|
|
105
|
+
assignee_id: opts.assigneeId,
|
|
106
|
+
description: opts.description,
|
|
107
|
+
project_id: opts.projectId,
|
|
108
|
+
parent_id: opts.parentId,
|
|
109
|
+
sort_order: opts.sortOrder !== undefined ? Number(opts.sortOrder) : undefined,
|
|
110
|
+
});
|
|
111
|
+
if (Object.keys(data).length === 0) {
|
|
112
|
+
printError(new Error('No fields to update. Provide at least one option.'));
|
|
113
|
+
}
|
|
114
|
+
const result = await client.updateTask(orgId, taskId, data);
|
|
115
|
+
printJson(result);
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
printError(err);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
tasks
|
|
122
|
+
.command('delete')
|
|
123
|
+
.description('Delete a task')
|
|
124
|
+
.argument('<taskId>', 'Task ID')
|
|
125
|
+
.action(async (taskId) => {
|
|
126
|
+
try {
|
|
127
|
+
const { client, orgId } = resolveCredentials();
|
|
128
|
+
await client.deleteTask(orgId, taskId);
|
|
129
|
+
printJson({ ok: true });
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
printError(err);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
tasks
|
|
136
|
+
.command('subtasks')
|
|
137
|
+
.description('List subtasks of a task')
|
|
138
|
+
.argument('<taskId>', 'Task ID')
|
|
139
|
+
.action(async (taskId) => {
|
|
140
|
+
try {
|
|
141
|
+
const { client, orgId } = resolveCredentials();
|
|
142
|
+
const result = await client.getSubtasks(orgId, taskId);
|
|
143
|
+
printJson(result);
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
printError(err);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
// ---- Comments subgroup ----
|
|
150
|
+
const comments = tasks.command('comments').description('Manage task comments');
|
|
151
|
+
comments
|
|
152
|
+
.command('list')
|
|
153
|
+
.description('List comments on a task')
|
|
154
|
+
.argument('<taskId>', 'Task ID')
|
|
155
|
+
.option('--limit <n>', 'Maximum number of comments to return', '20')
|
|
156
|
+
.option('--cursor <cursor>', 'Pagination cursor')
|
|
157
|
+
.option('--order <order>', 'Sort order (asc or desc)')
|
|
158
|
+
.action(async (taskId, opts) => {
|
|
159
|
+
try {
|
|
160
|
+
const { client, orgId } = resolveCredentials();
|
|
161
|
+
const params = stripUndefined({
|
|
162
|
+
limit: Number(opts.limit),
|
|
163
|
+
cursor: opts.cursor,
|
|
164
|
+
order: opts.order,
|
|
165
|
+
});
|
|
166
|
+
const result = await client.getTaskComments(orgId, taskId, params);
|
|
167
|
+
printJson(result);
|
|
168
|
+
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
printError(err);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
comments
|
|
174
|
+
.command('add')
|
|
175
|
+
.description('Add a comment to a task')
|
|
176
|
+
.argument('<taskId>', 'Task ID')
|
|
177
|
+
.requiredOption('--body <text>', 'Comment body')
|
|
178
|
+
.action(async (taskId, opts) => {
|
|
179
|
+
try {
|
|
180
|
+
const { client, orgId } = resolveCredentials();
|
|
181
|
+
const result = await client.createTaskComment(orgId, taskId, { body: opts.body });
|
|
182
|
+
printJson(result);
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
printError(err);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
comments
|
|
189
|
+
.command('update')
|
|
190
|
+
.description('Update a task comment')
|
|
191
|
+
.argument('<taskId>', 'Task ID')
|
|
192
|
+
.argument('<commentId>', 'Comment ID')
|
|
193
|
+
.requiredOption('--body <text>', 'New comment body')
|
|
194
|
+
.action(async (taskId, commentId, opts) => {
|
|
195
|
+
try {
|
|
196
|
+
const { client, orgId } = resolveCredentials();
|
|
197
|
+
const result = await client.updateTaskComment(orgId, taskId, commentId, { body: opts.body });
|
|
198
|
+
printJson(result);
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
printError(err);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
comments
|
|
205
|
+
.command('delete')
|
|
206
|
+
.description('Delete a task comment')
|
|
207
|
+
.argument('<taskId>', 'Task ID')
|
|
208
|
+
.argument('<commentId>', 'Comment ID')
|
|
209
|
+
.action(async (taskId, commentId) => {
|
|
210
|
+
try {
|
|
211
|
+
const { client, orgId } = resolveCredentials();
|
|
212
|
+
await client.deleteTaskComment(orgId, taskId, commentId);
|
|
213
|
+
printJson({ ok: true });
|
|
214
|
+
}
|
|
215
|
+
catch (err) {
|
|
216
|
+
printError(err);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
// ---- Activities ----
|
|
220
|
+
tasks
|
|
221
|
+
.command('activities')
|
|
222
|
+
.description('List activities for a task')
|
|
223
|
+
.argument('<taskId>', 'Task ID')
|
|
224
|
+
.option('--limit <n>', 'Maximum number of activities to return', '20')
|
|
225
|
+
.option('--cursor <cursor>', 'Pagination cursor')
|
|
226
|
+
.action(async (taskId, opts) => {
|
|
227
|
+
try {
|
|
228
|
+
const { client, orgId } = resolveCredentials();
|
|
229
|
+
const params = stripUndefined({
|
|
230
|
+
limit: Number(opts.limit),
|
|
231
|
+
cursor: opts.cursor,
|
|
232
|
+
});
|
|
233
|
+
const result = await client.getTaskActivities(orgId, taskId, params);
|
|
234
|
+
printJson(result);
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
printError(err);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/commands/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA+CpD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { resolveCredentials } from '../lib/client.js';
|
|
2
|
+
import { printJson, printError } from '../lib/output.js';
|
|
3
|
+
export function registerUserCommands(program) {
|
|
4
|
+
// whoami — registered directly on program
|
|
5
|
+
program
|
|
6
|
+
.command('whoami')
|
|
7
|
+
.description('Show the authenticated user')
|
|
8
|
+
.action(async () => {
|
|
9
|
+
try {
|
|
10
|
+
const { client } = resolveCredentials();
|
|
11
|
+
const result = await client.getMe();
|
|
12
|
+
printJson(result);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
printError(err);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
// users subcommand group
|
|
19
|
+
const users = program.command('users').description('Manage users');
|
|
20
|
+
users
|
|
21
|
+
.command('get')
|
|
22
|
+
.description('Get a user by ID')
|
|
23
|
+
.argument('<userId>', 'User ID')
|
|
24
|
+
.action(async (userId) => {
|
|
25
|
+
try {
|
|
26
|
+
const { client } = resolveCredentials();
|
|
27
|
+
const result = await client.getUser(userId);
|
|
28
|
+
printJson(result);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
printError(err);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
// members subcommand group
|
|
35
|
+
const members = program.command('members').description('Manage organization members');
|
|
36
|
+
members
|
|
37
|
+
.command('list')
|
|
38
|
+
.description('List organization members')
|
|
39
|
+
.action(async () => {
|
|
40
|
+
try {
|
|
41
|
+
const { client, orgId } = resolveCredentials();
|
|
42
|
+
const result = await client.getOrgMembers(orgId);
|
|
43
|
+
printJson(result);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
printError(err);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/commands/wiki.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA+oBpD"}
|