@parall/cli 1.60.0 → 1.62.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.
Files changed (37) hide show
  1. package/dist/commands/agents.d.ts +9 -0
  2. package/dist/commands/agents.d.ts.map +1 -1
  3. package/dist/commands/agents.js +288 -8
  4. package/dist/commands/approvals.d.ts.map +1 -1
  5. package/dist/commands/approvals.js +19 -0
  6. package/dist/commands/chats.d.ts.map +1 -1
  7. package/dist/commands/chats.js +84 -0
  8. package/dist/commands/clip.d.ts.map +1 -1
  9. package/dist/commands/clip.js +21 -18
  10. package/dist/commands/comments.d.ts +3 -0
  11. package/dist/commands/comments.d.ts.map +1 -1
  12. package/dist/commands/comments.js +44 -1
  13. package/dist/commands/labels.d.ts +5 -0
  14. package/dist/commands/labels.d.ts.map +1 -0
  15. package/dist/commands/labels.js +114 -0
  16. package/dist/commands/messages.d.ts.map +1 -1
  17. package/dist/commands/messages.js +35 -0
  18. package/dist/commands/projects.d.ts.map +1 -1
  19. package/dist/commands/projects.js +4 -2
  20. package/dist/commands/search.d.ts +5 -0
  21. package/dist/commands/search.d.ts.map +1 -1
  22. package/dist/commands/search.js +28 -1
  23. package/dist/commands/tasks.d.ts +13 -3
  24. package/dist/commands/tasks.d.ts.map +1 -1
  25. package/dist/commands/tasks.js +214 -8
  26. package/dist/commands/triggers.d.ts +19 -0
  27. package/dist/commands/triggers.d.ts.map +1 -0
  28. package/dist/commands/{external-triggers.js → triggers.js} +96 -95
  29. package/dist/commands/wiki-comments.d.ts +6 -0
  30. package/dist/commands/wiki-comments.d.ts.map +1 -0
  31. package/dist/commands/wiki-comments.js +108 -0
  32. package/dist/commands/wiki.d.ts.map +1 -1
  33. package/dist/commands/wiki.js +2 -98
  34. package/dist/index.js +4 -2
  35. package/package.json +4 -4
  36. package/dist/commands/external-triggers.d.ts +0 -19
  37. package/dist/commands/external-triggers.d.ts.map +0 -1
@@ -2,6 +2,7 @@ import { ApiError } from '@parall/sdk';
2
2
  import { createHash } from 'node:crypto';
3
3
  import { resolveCredentials, resolveTypedDispatchBinding } from '../lib/client.js';
4
4
  import { printJson, printError, printRefHint, stripPrllScheme } from '../lib/output.js';
5
+ import { resolveResolutionFlag } from './comments.js';
5
6
  import { BODY_FILE_OPTION_DESC, BODY_OPTION_DESC, DESCRIPTION_FILE_OPTION_DESC, DESCRIPTION_OPTION_DESC, resolveCommentBody, resolveTaskDescription, } from '../lib/text-input.js';
6
7
  function stripUndefined(obj) {
7
8
  return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
@@ -48,6 +49,77 @@ function resolvePlacement(value) {
48
49
  }
49
50
  return value;
50
51
  }
52
+ /** Update grammar for reference flags (--assignee-id, --parent-id): the
53
+ * lowercase "none" sentinel maps to an explicit null (clear) on the wire,
54
+ * mirroring the date flags. */
55
+ function resolveUpdateRefFlag(value) {
56
+ if (value === undefined || value === '')
57
+ return undefined;
58
+ if (value === 'none')
59
+ return null;
60
+ return stripPrllScheme(value);
61
+ }
62
+ /** --label-ids grammar: comma-separated lbl_ IDs → full-set replacement array.
63
+ * On update, "none" maps to null (clear all labels). */
64
+ function resolveLabelIdsFlag(value) {
65
+ if (value === undefined)
66
+ return undefined;
67
+ const ids = value
68
+ .split(',')
69
+ .map((s) => stripPrllScheme(s.trim()))
70
+ .filter(Boolean);
71
+ if (ids.length === 0) {
72
+ throw new Error('--label-ids must be a comma-separated list of label IDs');
73
+ }
74
+ return ids;
75
+ }
76
+ function resolveUpdateLabelIdsFlag(value) {
77
+ if (value === 'none')
78
+ return null;
79
+ return resolveLabelIdsFlag(value);
80
+ }
81
+ const RELATION_TARGET_PREFIXES = {
82
+ tsk: 'task',
83
+ msg: 'message',
84
+ cht: 'chat',
85
+ ase: 'agent_session',
86
+ wcs: 'wiki_changeset',
87
+ };
88
+ const RELATION_TYPES = [
89
+ 'blocks',
90
+ 'related',
91
+ 'duplicate',
92
+ 'source',
93
+ 'reference',
94
+ 'discussion',
95
+ 'execution',
96
+ ];
97
+ /** Relation target grammar: the target_type is inferred from the ID prefix so
98
+ * the agent passes one ID instead of a (type, id) pair. Exported for tests. */
99
+ export function resolveRelationTarget(raw) {
100
+ const id = stripPrllScheme(raw.trim());
101
+ const targetType = RELATION_TARGET_PREFIXES[id.split('_')[0]];
102
+ if (!targetType) {
103
+ throw new Error('--target must be a tsk_ / msg_ / cht_ / ase_ / wcs_ ID');
104
+ }
105
+ return { target_type: targetType, target_id: id };
106
+ }
107
+ function resolveRelationType(value) {
108
+ if (!RELATION_TYPES.includes(value)) {
109
+ throw new Error(`--type must be one of: ${RELATION_TYPES.join(', ')}`);
110
+ }
111
+ return value;
112
+ }
113
+ /** Strict command grammar for --scope; the server stays authoritative for
114
+ * archived-task visibility semantics. */
115
+ function resolveScopeFlag(value) {
116
+ if (value === undefined)
117
+ return undefined;
118
+ if (value !== 'active' && value !== 'archived' && value !== 'all') {
119
+ throw new Error('--scope must be "active", "archived", or "all"');
120
+ }
121
+ return value;
122
+ }
51
123
  /** Number('abc') is NaN and JSON.stringify(NaN) is null — without this guard
52
124
  * a malformed --sort-order becomes sort_order:null, which the server treats
53
125
  * as "field absent" and answers 200 without moving the task. */
@@ -73,6 +145,7 @@ export function buildCreateTaskData(opts) {
73
145
  source_chat_id: opts.sourceChatId ? stripPrllScheme(opts.sourceChatId) : undefined,
74
146
  planned_start_date: resolveCreateDateFlag('--planned-start', opts.plannedStart),
75
147
  due_date: resolveCreateDateFlag('--due-date', opts.dueDate),
148
+ label_ids: resolveLabelIdsFlag(opts.labelIds),
76
149
  });
77
150
  }
78
151
  export function buildUpdateTaskData(opts) {
@@ -86,13 +159,14 @@ export function buildUpdateTaskData(opts) {
86
159
  title: opts.title,
87
160
  status: opts.status,
88
161
  priority: opts.priority,
89
- assignee_id: opts.assigneeId ? stripPrllScheme(opts.assigneeId) : undefined,
162
+ assignee_id: resolveUpdateRefFlag(opts.assigneeId),
90
163
  description: resolveTaskDescription(opts),
91
- parent_id: opts.parentId ? stripPrllScheme(opts.parentId) : undefined,
164
+ parent_id: resolveUpdateRefFlag(opts.parentId),
92
165
  sort_order: resolveSortOrder(opts.sortOrder),
93
166
  placement: resolvePlacement(opts.placement),
94
167
  planned_start_date: resolveUpdateDateFlag('--planned-start', opts.plannedStart),
95
168
  due_date: resolveUpdateDateFlag('--due-date', opts.dueDate),
169
+ label_ids: resolveUpdateLabelIdsFlag(opts.labelIds),
96
170
  });
97
171
  }
98
172
  export function registerTaskCommands(program) {
@@ -100,29 +174,36 @@ export function registerTaskCommands(program) {
100
174
  tasks
101
175
  .command('list')
102
176
  .description('List tasks in the organization')
177
+ .option('--q <query>', 'Keyword filter on task title and description')
103
178
  .option('--status <status>', 'Filter by status')
104
179
  .option('--priority <priority>', 'Filter by priority')
105
180
  .option('--assignee-id <id>', 'Filter by assignee ID')
106
181
  .option('--project-id <id>', 'Filter by project ID')
107
- .option('--parent-id <id>', 'Filter by parent task ID')
182
+ .option('--parent-id <id>', 'Filter by parent task ID ("null" for top-level tasks only)')
183
+ .option('--label-ids <ids>', 'Filter by label IDs (comma-separated, any-of)')
184
+ .option('--scope <scope>', 'Which tasks to include: active (default), archived, or all')
108
185
  .option('--limit <n>', 'Maximum number of tasks to return', '20')
109
186
  .option('--cursor <cursor>', 'Pagination cursor')
110
187
  .option('--sort <field>', 'Sort field')
111
188
  .option('--order <order>', 'Sort order (asc or desc)')
112
189
  .action(async (opts) => {
113
190
  try {
114
- const { client, orgId } = resolveCredentials();
191
+ // Grammar first: option errors surface before credential resolution.
115
192
  const params = stripUndefined({
193
+ q: opts.q,
116
194
  status: opts.status,
117
195
  priority: opts.priority,
118
196
  assignee_id: opts.assigneeId ? stripPrllScheme(opts.assigneeId) : undefined,
119
197
  project_id: opts.projectId ? stripPrllScheme(opts.projectId) : undefined,
120
198
  parent_id: opts.parentId ? stripPrllScheme(opts.parentId) : undefined,
199
+ label_ids: resolveLabelIdsFlag(opts.labelIds)?.join(','),
200
+ scope: resolveScopeFlag(opts.scope),
121
201
  limit: Number(opts.limit),
122
202
  cursor: opts.cursor,
123
203
  sort: opts.sort,
124
204
  order: opts.order,
125
205
  });
206
+ const { client, orgId } = resolveCredentials();
126
207
  const result = await client.getTasks(orgId, params);
127
208
  printJson(result);
128
209
  }
@@ -144,6 +225,7 @@ export function registerTaskCommands(program) {
144
225
  .option('--source-chat-id <id>', 'Source chat ID')
145
226
  .option('--planned-start <date>', 'Planned start date (YYYY-MM-DD) — must be on or before --due-date when both are set')
146
227
  .option('--due-date <date>', 'Planned completion date (YYYY-MM-DD)')
228
+ .option('--label-ids <ids>', 'Labels to attach (comma-separated label IDs)')
147
229
  .action(async (opts) => {
148
230
  try {
149
231
  // Grammar first: an invalid option is a parameter error even when
@@ -198,10 +280,11 @@ export function registerTaskCommands(program) {
198
280
  .option('--title <title>', 'Task title')
199
281
  .option('--status <status>', 'Task status')
200
282
  .option('--priority <priority>', 'Task priority')
201
- .option('--assignee-id <id>', 'Assignee user ID')
283
+ .option('--assignee-id <id>', 'Assignee user ID, or "none" to unassign')
202
284
  .option('--description <text>', DESCRIPTION_OPTION_DESC)
203
285
  .option('--description-file <path>', DESCRIPTION_FILE_OPTION_DESC)
204
- .option('--parent-id <id>', 'Parent task ID')
286
+ .option('--parent-id <id>', 'Parent task ID, or "none" to promote the subtask to top level')
287
+ .option('--label-ids <ids>', 'Replace ALL labels (comma-separated label IDs), or "none" to clear them')
205
288
  .option('--sort-order <n>', 'Explicit sort_order value — only for pinpoint insertion relative to cards you can see; to append to a status column use --placement end')
206
289
  .option('--placement <where>', 'Ordering intent — only "end" is accepted: appends the task to the end of its status column, position resolved by the server (mutually exclusive with --sort-order)')
207
290
  .option('--planned-start <date>', 'Planned start date (YYYY-MM-DD), or "none" to clear it — must be on or before the due date when both are set')
@@ -251,7 +334,7 @@ export function registerTaskCommands(program) {
251
334
  });
252
335
  tasks
253
336
  .command('delete')
254
- .description('Delete a task')
337
+ .description('Delete a task (server-side soft delete, hidden from all views — prefer "tasks archive" for restorable cleanup)')
255
338
  .argument('<taskId>', 'Task ID')
256
339
  .action(async (taskId) => {
257
340
  try {
@@ -263,6 +346,34 @@ export function registerTaskCommands(program) {
263
346
  printError(err);
264
347
  }
265
348
  });
349
+ tasks
350
+ .command('archive')
351
+ .description('Archive a task (hidden from active views; restorable with "tasks restore")')
352
+ .argument('<taskId>', 'Task ID')
353
+ .action(async (taskId) => {
354
+ try {
355
+ const { client, orgId } = resolveCredentials();
356
+ await client.archiveTask(orgId, stripPrllScheme(taskId));
357
+ printJson({ ok: true });
358
+ }
359
+ catch (err) {
360
+ printError(err);
361
+ }
362
+ });
363
+ tasks
364
+ .command('restore')
365
+ .description('Restore an archived task')
366
+ .argument('<taskId>', 'Task ID')
367
+ .action(async (taskId) => {
368
+ try {
369
+ const { client, orgId } = resolveCredentials();
370
+ await client.restoreTask(orgId, stripPrllScheme(taskId));
371
+ printJson({ ok: true });
372
+ }
373
+ catch (err) {
374
+ printError(err);
375
+ }
376
+ });
266
377
  tasks
267
378
  .command('subtasks')
268
379
  .description('List subtasks of a task')
@@ -301,13 +412,16 @@ export function registerTaskCommands(program) {
301
412
  .option('--limit <n>', 'Maximum number of comments to return', '20')
302
413
  .option('--cursor <cursor>', 'Pagination cursor')
303
414
  .option('--order <order>', 'Sort order (asc or desc)')
415
+ .option('--resolution <state>', 'Filter by thread resolution state: active, resolved, or all')
304
416
  .action(async (taskId, opts) => {
305
417
  try {
418
+ const resolution = resolveResolutionFlag(opts.resolution);
306
419
  const { client, orgId } = resolveCredentials();
307
420
  const params = stripUndefined({
308
421
  limit: Number(opts.limit),
309
422
  cursor: opts.cursor,
310
423
  order: opts.order,
424
+ resolution,
311
425
  });
312
426
  const { COMMENT_TARGET } = await import('@parall/sdk');
313
427
  const result = await client.getComments(orgId, {
@@ -322,10 +436,11 @@ export function registerTaskCommands(program) {
322
436
  });
323
437
  comments
324
438
  .command('add')
325
- .description('Add a comment to a task')
439
+ .description('Add a comment to a task, or reply into an existing thread with --parent')
326
440
  .argument('<taskId>', 'Task ID')
327
441
  .option('--body <text>', BODY_OPTION_DESC)
328
442
  .option('--body-file <path>', BODY_FILE_OPTION_DESC)
443
+ .option('--parent <id>', 'Root comment ID — post as a threaded reply under it')
329
444
  .action(async (taskId, opts) => {
330
445
  try {
331
446
  // Grammar first: a body-flag error is a parameter error even when
@@ -336,6 +451,7 @@ export function registerTaskCommands(program) {
336
451
  const result = await client.createComment(orgId, {
337
452
  target_uri: COMMENT_TARGET.task(stripPrllScheme(taskId)),
338
453
  body,
454
+ parent_id: opts.parent ? stripPrllScheme(opts.parent) : undefined,
339
455
  });
340
456
  printJson(result);
341
457
  printRefHint(result.id);
@@ -461,4 +577,94 @@ export function registerTaskCommands(program) {
461
577
  printError(err);
462
578
  }
463
579
  });
580
+ // ---- Labels on a task (org label catalog lives under `parall labels`) ----
581
+ const labels = tasks
582
+ .command('labels')
583
+ .description('Attach or detach labels on a task (manage the org catalog with "parall labels")');
584
+ labels
585
+ .command('add')
586
+ .description('Attach labels to a task (existing labels are kept)')
587
+ .argument('<taskId>', 'Task ID')
588
+ .argument('<labelIds...>', 'Label IDs to attach')
589
+ .action(async (taskId, labelIds) => {
590
+ try {
591
+ const { client, orgId } = resolveCredentials();
592
+ const result = await client.addTaskLabels(orgId, stripPrllScheme(taskId), {
593
+ label_ids: labelIds.map((id) => stripPrllScheme(id)),
594
+ });
595
+ printJson(result);
596
+ }
597
+ catch (err) {
598
+ printError(err);
599
+ }
600
+ });
601
+ labels
602
+ .command('remove')
603
+ .description('Detach one label from a task')
604
+ .argument('<taskId>', 'Task ID')
605
+ .argument('<labelId>', 'Label ID to detach')
606
+ .action(async (taskId, labelId) => {
607
+ try {
608
+ const { client, orgId } = resolveCredentials();
609
+ const result = await client.removeTaskLabel(orgId, stripPrllScheme(taskId), stripPrllScheme(labelId));
610
+ printJson(result);
611
+ }
612
+ catch (err) {
613
+ printError(err);
614
+ }
615
+ });
616
+ // ---- Relations ----
617
+ const relations = tasks
618
+ .command('relations')
619
+ .description('Link a task to other entities (blocks / related / duplicate / source / …)');
620
+ relations
621
+ .command('add')
622
+ .description('Create a relation from a task to another entity')
623
+ .argument('<taskId>', 'Task ID')
624
+ .requiredOption('--type <type>', `Relation type: ${RELATION_TYPES.join(', ')}`)
625
+ .requiredOption('--target <id>', 'Target ID — tsk_ / msg_ / cht_ / ase_ / wcs_ (type inferred from the prefix)')
626
+ .action(async (taskId, opts) => {
627
+ try {
628
+ const relationType = resolveRelationType(opts.type);
629
+ const target = resolveRelationTarget(opts.target);
630
+ const { client, orgId } = resolveCredentials();
631
+ const result = await client.createTaskRelation(orgId, stripPrllScheme(taskId), {
632
+ relation_type: relationType,
633
+ ...target,
634
+ });
635
+ printJson(result);
636
+ }
637
+ catch (err) {
638
+ printError(err);
639
+ }
640
+ });
641
+ relations
642
+ .command('list')
643
+ .description('List relations of a task')
644
+ .argument('<taskId>', 'Task ID')
645
+ .action(async (taskId) => {
646
+ try {
647
+ const { client, orgId } = resolveCredentials();
648
+ const result = await client.getTaskRelations(orgId, stripPrllScheme(taskId));
649
+ printJson(result);
650
+ }
651
+ catch (err) {
652
+ printError(err);
653
+ }
654
+ });
655
+ relations
656
+ .command('remove')
657
+ .description('Delete a relation from a task')
658
+ .argument('<taskId>', 'Task ID')
659
+ .argument('<relationId>', 'Relation ID (from "tasks relations list")')
660
+ .action(async (taskId, relationId) => {
661
+ try {
662
+ const { client, orgId } = resolveCredentials();
663
+ await client.deleteTaskRelation(orgId, stripPrllScheme(taskId), stripPrllScheme(relationId));
664
+ printJson({ ok: true });
665
+ }
666
+ catch (err) {
667
+ printError(err);
668
+ }
669
+ });
464
670
  }
@@ -0,0 +1,19 @@
1
+ import type { TriggerConnection } from '@parall/sdk';
2
+ import type { Command } from 'commander';
3
+ export declare const TRIGGERS_FLAG = "external-triggers";
4
+ type TriggerFeatureFlagClient = {
5
+ getFeatureFlags(orgId: string): Promise<{
6
+ flags: Record<string, boolean | string | number>;
7
+ }>;
8
+ };
9
+ type IngressTokenOutputOptions = {
10
+ tokenFile?: string;
11
+ showToken?: boolean;
12
+ };
13
+ export declare function isFeatureFlagEnabled(value: boolean | string | number | undefined): boolean;
14
+ export declare function requireTriggersEnabled(client: TriggerFeatureFlagClient, orgId: string): Promise<void>;
15
+ export declare function validateIngressTokenOutputOptions(opts: IngressTokenOutputOptions): void;
16
+ export declare function connectionTokenOutput(connection: TriggerConnection, opts: IngressTokenOutputOptions): Promise<TriggerConnection | Record<string, unknown>>;
17
+ export declare function registerTriggerCommands(program: Command): void;
18
+ export {};
19
+ //# sourceMappingURL=triggers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../src/commands/triggers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iBAAiB,EAIlB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD,KAAK,wBAAwB,GAAG;IAC9B,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/F,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAsDF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAM1F;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,wBAAwB,EAChC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAKf;AAQD,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,yBAAyB,GAAG,IAAI,CAKvF;AAED,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,iBAAiB,EAC7B,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAqBtD;AAkBD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,QAsZvD"}