linear-cli-agents 0.6.0 → 0.7.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.
Files changed (41) hide show
  1. package/README.md +68 -1
  2. package/bin/dev.js +0 -0
  3. package/dist/commands/documents/create.d.ts +13 -0
  4. package/dist/commands/documents/create.js +68 -0
  5. package/dist/commands/documents/delete.d.ts +9 -0
  6. package/dist/commands/documents/delete.js +32 -0
  7. package/dist/commands/documents/get.d.ts +12 -0
  8. package/dist/commands/documents/get.js +79 -0
  9. package/dist/commands/documents/list.d.ts +12 -0
  10. package/dist/commands/documents/list.js +105 -0
  11. package/dist/commands/documents/update.d.ts +16 -0
  12. package/dist/commands/documents/update.js +75 -0
  13. package/dist/commands/info.js +174 -7
  14. package/dist/commands/initiatives/archive.d.ts +12 -0
  15. package/dist/commands/initiatives/archive.js +44 -0
  16. package/dist/commands/initiatives/create.d.ts +15 -0
  17. package/dist/commands/initiatives/create.js +84 -0
  18. package/dist/commands/initiatives/delete.d.ts +9 -0
  19. package/dist/commands/initiatives/delete.js +32 -0
  20. package/dist/commands/initiatives/get.d.ts +12 -0
  21. package/dist/commands/initiatives/get.js +90 -0
  22. package/dist/commands/initiatives/list.d.ts +11 -0
  23. package/dist/commands/initiatives/list.js +135 -0
  24. package/dist/commands/initiatives/update.d.ts +18 -0
  25. package/dist/commands/initiatives/update.js +90 -0
  26. package/dist/commands/issues/bulk-update.d.ts +2 -0
  27. package/dist/commands/issues/bulk-update.js +10 -0
  28. package/dist/commands/issues/create.d.ts +2 -0
  29. package/dist/commands/issues/create.js +10 -0
  30. package/dist/commands/issues/get.d.ts +1 -0
  31. package/dist/commands/issues/get.js +19 -1
  32. package/dist/commands/issues/update.d.ts +2 -0
  33. package/dist/commands/issues/update.js +12 -0
  34. package/dist/commands/projects/create.d.ts +1 -0
  35. package/dist/commands/projects/create.js +10 -0
  36. package/dist/commands/projects/update.d.ts +1 -0
  37. package/dist/commands/projects/update.js +7 -0
  38. package/dist/commands/upload.d.ts +13 -0
  39. package/dist/commands/upload.js +117 -0
  40. package/oclif.manifest.json +1362 -625
  41. package/package.json +23 -14
@@ -43,8 +43,9 @@ const COMMANDS = {
43
43
  args: { id: { description: 'Issue ID or identifier (e.g., ENG-123)', required: true } },
44
44
  flags: {
45
45
  format: { type: 'string', options: ['json', 'table', 'plain'], default: 'json' },
46
+ 'with-attachments': { type: 'boolean', description: 'Include attachments (linked PRs, commits, etc.)' },
46
47
  },
47
- examples: ['linear issues get ENG-123', 'linear issues get abc123-uuid'],
48
+ examples: ['linear issues get ENG-123', 'linear issues get ENG-123 --with-attachments'],
48
49
  },
49
50
  'issues create': {
50
51
  description: 'Create a new issue',
@@ -159,7 +160,8 @@ const COMMANDS = {
159
160
  description: 'Create a project',
160
161
  flags: {
161
162
  name: { type: 'string', char: 'n', description: 'Project name', required: true },
162
- description: { type: 'string', char: 'd', description: 'Project description' },
163
+ description: { type: 'string', char: 'd', description: 'Project description (short subtitle)' },
164
+ content: { type: 'string', char: 'c', description: 'Project content (markdown, long-form description body)' },
163
165
  state: { type: 'string', options: ['planned', 'started', 'paused', 'completed', 'canceled'] },
164
166
  'team-ids': { type: 'string', description: 'Team IDs (uses default if configured)' },
165
167
  'lead-id': { type: 'string', description: 'Lead user ID' },
@@ -176,10 +178,17 @@ const COMMANDS = {
176
178
  args: { id: { description: 'Project ID', required: true } },
177
179
  flags: {
178
180
  name: { type: 'string', description: 'New name' },
179
- description: { type: 'string', description: 'New description' },
181
+ description: { type: 'string', description: 'New description (short subtitle)' },
182
+ content: { type: 'string', char: 'c', description: 'New content (markdown, long-form description body)' },
180
183
  state: { type: 'string', options: ['planned', 'started', 'paused', 'completed', 'canceled'] },
184
+ 'lead-id': { type: 'string', description: 'Lead user ID' },
185
+ 'start-date': { type: 'string', description: 'Start date (YYYY-MM-DD)' },
186
+ 'target-date': { type: 'string', description: 'Target date (YYYY-MM-DD)' },
181
187
  },
182
- examples: ['linear projects update PROJECT_ID --name "New Name"'],
188
+ examples: [
189
+ 'linear projects update PROJECT_ID --name "New Name"',
190
+ 'linear projects update PROJECT_ID --content "# Plan\\nDetailed markdown content"',
191
+ ],
183
192
  },
184
193
  'projects delete': {
185
194
  description: 'Delete a project',
@@ -405,6 +414,122 @@ const COMMANDS = {
405
414
  },
406
415
  examples: ['linear templates update TEMPLATE_ID --name "New Name"'],
407
416
  },
417
+ // Documents
418
+ 'documents list': {
419
+ description: 'List documents',
420
+ flags: {
421
+ format: { type: 'string', options: ['json', 'table', 'plain'], default: 'json' },
422
+ first: { type: 'number', description: 'Number of results' },
423
+ },
424
+ examples: ['linear documents list'],
425
+ },
426
+ 'documents get': {
427
+ description: 'Get document details',
428
+ args: { id: { description: 'Document ID', required: true } },
429
+ flags: { format: { type: 'string', options: ['json', 'table', 'plain'], default: 'json' } },
430
+ examples: ['linear documents get DOCUMENT_ID'],
431
+ },
432
+ 'documents create': {
433
+ description: 'Create a new document',
434
+ flags: {
435
+ title: { type: 'string', char: 't', description: 'Document title', required: true },
436
+ content: { type: 'string', char: 'c', description: 'Document content (markdown)' },
437
+ 'project-id': { type: 'string', description: 'Project ID to associate with' },
438
+ icon: { type: 'string', description: 'Document icon (emoji)' },
439
+ color: { type: 'string', description: 'Document color (hex)' },
440
+ },
441
+ examples: [
442
+ 'linear documents create --title "My Document"',
443
+ 'linear documents create --title "Notes" --content "# Heading\\n\\nContent"',
444
+ ],
445
+ },
446
+ 'documents update': {
447
+ description: 'Update a document',
448
+ args: { id: { description: 'Document ID', required: true } },
449
+ flags: {
450
+ title: { type: 'string', char: 't', description: 'New title' },
451
+ content: { type: 'string', char: 'c', description: 'New content (markdown)' },
452
+ 'project-id': { type: 'string', description: 'New project ID (empty to remove)' },
453
+ icon: { type: 'string', description: 'New icon (emoji)' },
454
+ color: { type: 'string', description: 'New color (hex)' },
455
+ },
456
+ examples: ['linear documents update DOCUMENT_ID --title "New Title"'],
457
+ },
458
+ 'documents delete': {
459
+ description: 'Delete a document (moves to trash)',
460
+ args: { id: { description: 'Document ID', required: true } },
461
+ flags: {},
462
+ examples: ['linear documents delete DOCUMENT_ID'],
463
+ },
464
+ // Initiatives
465
+ 'initiatives list': {
466
+ description: 'List initiatives',
467
+ flags: {
468
+ format: { type: 'string', options: ['json', 'table', 'plain'], default: 'json' },
469
+ status: { type: 'string', options: ['Planned', 'Active', 'Completed'], description: 'Filter by status' },
470
+ first: { type: 'number', description: 'Number of results' },
471
+ },
472
+ examples: [
473
+ 'linear initiatives list',
474
+ 'linear initiatives list --status Active',
475
+ ],
476
+ },
477
+ 'initiatives get': {
478
+ description: 'Get initiative details',
479
+ args: { id: { description: 'Initiative ID', required: true } },
480
+ flags: { format: { type: 'string', options: ['json', 'table', 'plain'], default: 'json' } },
481
+ examples: ['linear initiatives get INITIATIVE_ID'],
482
+ },
483
+ 'initiatives create': {
484
+ description: 'Create a new initiative',
485
+ flags: {
486
+ name: { type: 'string', char: 'n', description: 'Initiative name', required: true },
487
+ description: { type: 'string', char: 'd', description: 'Initiative description' },
488
+ status: { type: 'string', options: ['Planned', 'Active', 'Completed'], description: 'Initial status' },
489
+ 'target-date': { type: 'string', description: 'Target completion date (YYYY-MM-DD)' },
490
+ 'owner-id': { type: 'string', description: 'Owner user ID' },
491
+ icon: { type: 'string', description: 'Initiative icon (emoji)' },
492
+ color: { type: 'string', description: 'Initiative color (hex)' },
493
+ },
494
+ examples: [
495
+ 'linear initiatives create --name "Q1 Goals"',
496
+ 'linear initiatives create --name "Launch" --status Active --target-date 2024-12-31',
497
+ ],
498
+ },
499
+ 'initiatives update': {
500
+ description: 'Update an initiative',
501
+ args: { id: { description: 'Initiative ID', required: true } },
502
+ flags: {
503
+ name: { type: 'string', char: 'n', description: 'New name' },
504
+ description: { type: 'string', char: 'd', description: 'New description' },
505
+ status: { type: 'string', options: ['Planned', 'Active', 'Completed'], description: 'New status' },
506
+ 'target-date': { type: 'string', description: 'New target date (YYYY-MM-DD)' },
507
+ 'owner-id': { type: 'string', description: 'New owner user ID' },
508
+ icon: { type: 'string', description: 'New icon (emoji)' },
509
+ color: { type: 'string', description: 'New color (hex)' },
510
+ },
511
+ examples: [
512
+ 'linear initiatives update INITIATIVE_ID --status Completed',
513
+ 'linear initiatives update INITIATIVE_ID --name "New Name"',
514
+ ],
515
+ },
516
+ 'initiatives delete': {
517
+ description: 'Delete an initiative (moves to trash)',
518
+ args: { id: { description: 'Initiative ID', required: true } },
519
+ flags: {},
520
+ examples: ['linear initiatives delete INITIATIVE_ID'],
521
+ },
522
+ 'initiatives archive': {
523
+ description: 'Archive or unarchive an initiative',
524
+ args: { id: { description: 'Initiative ID', required: true } },
525
+ flags: {
526
+ unarchive: { type: 'boolean', char: 'u', description: 'Unarchive instead of archive' },
527
+ },
528
+ examples: [
529
+ 'linear initiatives archive INITIATIVE_ID',
530
+ 'linear initiatives archive INITIATIVE_ID --unarchive',
531
+ ],
532
+ },
408
533
  // Config
409
534
  'config set': {
410
535
  description: 'Set a configuration value',
@@ -501,6 +626,19 @@ const COMMANDS = {
501
626
  },
502
627
  examples: ['linear schema', 'linear schema issues', 'linear schema --full'],
503
628
  },
629
+ upload: {
630
+ description: 'Upload a file to Linear and get the asset URL',
631
+ args: { file: { description: 'Path to the file to upload', required: true } },
632
+ flags: {
633
+ 'content-type': { type: 'string', description: 'Override the content type (MIME type)' },
634
+ markdown: { type: 'boolean', char: 'm', description: 'Output as markdown link/image' },
635
+ },
636
+ examples: [
637
+ 'linear upload ./screenshot.png',
638
+ 'linear upload ./document.pdf --content-type application/pdf',
639
+ 'linear upload ./image.png --markdown',
640
+ ],
641
+ },
504
642
  info: {
505
643
  description: 'Show comprehensive CLI documentation (this command)',
506
644
  flags: {
@@ -541,7 +679,8 @@ const ENTITY_SCHEMAS = {
541
679
  fields: {
542
680
  id: 'Unique identifier',
543
681
  name: 'Project name',
544
- description: 'Project description',
682
+ description: 'Short description (subtitle)',
683
+ content: 'Long-form markdown description body',
545
684
  state: 'planned/started/paused/completed/canceled',
546
685
  progress: 'Completion percentage',
547
686
  startDate: 'Start date',
@@ -616,6 +755,34 @@ const ENTITY_SCHEMAS = {
616
755
  createdAt: 'Creation timestamp',
617
756
  },
618
757
  },
758
+ documents: {
759
+ entity: 'documents',
760
+ operations: ['list', 'get', 'create', 'update', 'delete'],
761
+ description: 'Rich text documents in Linear',
762
+ fields: {
763
+ id: 'Unique identifier',
764
+ title: 'Document title',
765
+ content: 'Markdown content',
766
+ icon: 'Document icon (emoji)',
767
+ color: 'Document color (hex)',
768
+ project: 'Associated project',
769
+ creator: 'User who created it',
770
+ },
771
+ },
772
+ initiatives: {
773
+ entity: 'initiatives',
774
+ operations: ['list', 'get', 'create', 'update', 'delete', 'archive'],
775
+ description: 'Strategic initiatives grouping projects',
776
+ fields: {
777
+ id: 'Unique identifier',
778
+ name: 'Initiative name',
779
+ description: 'Initiative description',
780
+ status: 'Planned/Active/Completed',
781
+ targetDate: 'Target completion date',
782
+ owner: 'Initiative owner',
783
+ projects: 'Associated projects',
784
+ },
785
+ },
619
786
  };
620
787
  const WORKFLOWS = {
621
788
  createIssue: {
@@ -692,7 +859,7 @@ export default class Info extends Command {
692
859
  return acc;
693
860
  }, {});
694
861
  print(success({
695
- version: '0.6.0',
862
+ version: '0.7.0',
696
863
  commands: compactCommands,
697
864
  configKeys: CONFIG_KEYS,
698
865
  note: 'Use "linear info" for full documentation with examples and workflows',
@@ -701,7 +868,7 @@ export default class Info extends Command {
701
868
  }
702
869
  // Full documentation
703
870
  print(success({
704
- version: '0.6.0',
871
+ version: '0.7.0',
705
872
  overview: {
706
873
  description: 'CLI for interacting with Linear, designed for LLMs and agents',
707
874
  authentication: 'Run "linear auth login" or set LINEAR_API_KEY environment variable',
@@ -0,0 +1,12 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class InitiativesArchive extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ unarchive: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,44 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import { getClient } from '../../lib/client.js';
3
+ import { success, print } from '../../lib/output.js';
4
+ import { handleError, CliError, ErrorCodes } from '../../lib/errors.js';
5
+ export default class InitiativesArchive extends Command {
6
+ static description = 'Archive or unarchive an initiative';
7
+ static examples = [
8
+ '<%= config.bin %> initiatives archive INITIATIVE_ID',
9
+ '<%= config.bin %> initiatives archive INITIATIVE_ID --unarchive',
10
+ ];
11
+ static args = {
12
+ id: Args.string({
13
+ description: 'Initiative ID',
14
+ required: true,
15
+ }),
16
+ };
17
+ static flags = {
18
+ unarchive: Flags.boolean({
19
+ char: 'u',
20
+ description: 'Unarchive instead of archive',
21
+ default: false,
22
+ }),
23
+ };
24
+ async run() {
25
+ try {
26
+ const { args, flags } = await this.parse(InitiativesArchive);
27
+ const client = getClient();
28
+ const payload = flags.unarchive
29
+ ? await client.unarchiveInitiative(args.id)
30
+ : await client.archiveInitiative(args.id);
31
+ if (!payload.success) {
32
+ throw new CliError(ErrorCodes.API_ERROR, `Failed to ${flags.unarchive ? 'unarchive' : 'archive'} initiative`);
33
+ }
34
+ print(success({
35
+ id: args.id,
36
+ archived: !flags.unarchive,
37
+ }));
38
+ }
39
+ catch (err) {
40
+ handleError(err);
41
+ this.exit(1);
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,15 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class InitiativesCreate extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ 'target-date': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ 'owner-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ icon: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ color: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<void>;
15
+ }
@@ -0,0 +1,84 @@
1
+ import { Command, Flags } from '@oclif/core';
2
+ import { getClient } from '../../lib/client.js';
3
+ import { success, print } from '../../lib/output.js';
4
+ import { handleError, CliError, ErrorCodes } from '../../lib/errors.js';
5
+ import { LinearDocument } from '@linear/sdk';
6
+ const InitiativeStatus = LinearDocument.InitiativeStatus;
7
+ export default class InitiativesCreate extends Command {
8
+ static description = 'Create a new initiative';
9
+ static examples = [
10
+ '<%= config.bin %> initiatives create --name "Q1 Goals"',
11
+ '<%= config.bin %> initiatives create --name "Product Launch" --status Active',
12
+ '<%= config.bin %> initiatives create --name "H2 Objectives" --target-date 2024-12-31',
13
+ ];
14
+ static flags = {
15
+ name: Flags.string({
16
+ char: 'n',
17
+ description: 'Initiative name',
18
+ required: true,
19
+ }),
20
+ description: Flags.string({
21
+ char: 'd',
22
+ description: 'Initiative description',
23
+ }),
24
+ status: Flags.string({
25
+ char: 's',
26
+ description: 'Initiative status',
27
+ options: ['Planned', 'Active', 'Completed'],
28
+ }),
29
+ 'target-date': Flags.string({
30
+ description: 'Target completion date (YYYY-MM-DD)',
31
+ }),
32
+ 'owner-id': Flags.string({
33
+ description: 'Owner user ID',
34
+ }),
35
+ icon: Flags.string({
36
+ description: 'Initiative icon (emoji)',
37
+ }),
38
+ color: Flags.string({
39
+ description: 'Initiative color (hex)',
40
+ }),
41
+ };
42
+ async run() {
43
+ try {
44
+ const { flags } = await this.parse(InitiativesCreate);
45
+ const client = getClient();
46
+ const input = {
47
+ name: flags.name,
48
+ };
49
+ if (flags.description)
50
+ input.description = flags.description;
51
+ if (flags.status) {
52
+ input.status = InitiativeStatus[flags.status];
53
+ }
54
+ if (flags['target-date'])
55
+ input.targetDate = flags['target-date'];
56
+ if (flags['owner-id'])
57
+ input.ownerId = flags['owner-id'];
58
+ if (flags.icon)
59
+ input.icon = flags.icon;
60
+ if (flags.color)
61
+ input.color = flags.color;
62
+ const payload = await client.createInitiative(input);
63
+ if (!payload.success) {
64
+ throw new CliError(ErrorCodes.API_ERROR, 'Failed to create initiative');
65
+ }
66
+ const initiative = await payload.initiative;
67
+ if (!initiative) {
68
+ throw new CliError(ErrorCodes.API_ERROR, 'Initiative not returned');
69
+ }
70
+ const owner = await initiative.owner;
71
+ print(success({
72
+ id: initiative.id,
73
+ name: initiative.name,
74
+ status: initiative.status,
75
+ owner: owner ? { id: owner.id, name: owner.name } : null,
76
+ createdAt: initiative.createdAt,
77
+ }));
78
+ }
79
+ catch (err) {
80
+ handleError(err);
81
+ this.exit(1);
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,9 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class InitiativesDelete extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,32 @@
1
+ import { Args, Command } from '@oclif/core';
2
+ import { getClient } from '../../lib/client.js';
3
+ import { success, print } from '../../lib/output.js';
4
+ import { handleError, CliError, ErrorCodes } from '../../lib/errors.js';
5
+ export default class InitiativesDelete extends Command {
6
+ static description = 'Delete an initiative (moves to trash)';
7
+ static examples = ['<%= config.bin %> initiatives delete INITIATIVE_ID'];
8
+ static args = {
9
+ id: Args.string({
10
+ description: 'Initiative ID',
11
+ required: true,
12
+ }),
13
+ };
14
+ async run() {
15
+ try {
16
+ const { args } = await this.parse(InitiativesDelete);
17
+ const client = getClient();
18
+ const payload = await client.deleteInitiative(args.id);
19
+ if (!payload.success) {
20
+ throw new CliError(ErrorCodes.API_ERROR, 'Failed to delete initiative');
21
+ }
22
+ print(success({
23
+ id: args.id,
24
+ deleted: true,
25
+ }));
26
+ }
27
+ catch (err) {
28
+ handleError(err);
29
+ this.exit(1);
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,12 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class InitiativesGet extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,90 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import { getClient } from '../../lib/client.js';
3
+ import { success, print, printItem } from '../../lib/output.js';
4
+ import { handleError, CliError, ErrorCodes } from '../../lib/errors.js';
5
+ export default class InitiativesGet extends Command {
6
+ static description = 'Get initiative details';
7
+ static examples = [
8
+ '<%= config.bin %> initiatives get INITIATIVE_ID',
9
+ '<%= config.bin %> initiatives get INITIATIVE_ID --format table',
10
+ ];
11
+ static args = {
12
+ id: Args.string({
13
+ description: 'Initiative ID',
14
+ required: true,
15
+ }),
16
+ };
17
+ static flags = {
18
+ format: Flags.string({
19
+ char: 'F',
20
+ description: 'Output format',
21
+ options: ['json', 'table', 'plain'],
22
+ default: 'json',
23
+ }),
24
+ };
25
+ async run() {
26
+ try {
27
+ const { args, flags } = await this.parse(InitiativesGet);
28
+ const format = flags.format;
29
+ const client = getClient();
30
+ const initiative = await client.initiative(args.id);
31
+ if (!initiative) {
32
+ throw new CliError(ErrorCodes.NOT_FOUND, `Initiative ${args.id} not found`);
33
+ }
34
+ const [owner, creator, projects] = await Promise.all([
35
+ initiative.owner,
36
+ initiative.creator,
37
+ initiative.projects(),
38
+ ]);
39
+ const data = {
40
+ id: initiative.id,
41
+ name: initiative.name,
42
+ description: initiative.description ?? null,
43
+ status: initiative.status,
44
+ icon: initiative.icon ?? null,
45
+ color: initiative.color ?? null,
46
+ owner: owner
47
+ ? {
48
+ id: owner.id,
49
+ name: owner.name,
50
+ }
51
+ : null,
52
+ creator: creator
53
+ ? {
54
+ id: creator.id,
55
+ name: creator.name,
56
+ }
57
+ : null,
58
+ targetDate: initiative.targetDate ?? null,
59
+ projects: projects.nodes.map((p) => ({
60
+ id: p.id,
61
+ name: p.name,
62
+ })),
63
+ createdAt: initiative.createdAt,
64
+ updatedAt: initiative.updatedAt,
65
+ };
66
+ if (format === 'json') {
67
+ print(success(data));
68
+ }
69
+ else if (format === 'table') {
70
+ printItem({
71
+ id: data.id,
72
+ name: data.name,
73
+ status: data.status,
74
+ owner: data.owner?.name ?? 'Unassigned',
75
+ targetDate: data.targetDate ?? 'None',
76
+ projects: data.projects.length,
77
+ description: data.description ? `${data.description.slice(0, 100)}...` : 'None',
78
+ createdAt: data.createdAt,
79
+ }, format);
80
+ }
81
+ else {
82
+ console.log(data.id);
83
+ }
84
+ }
85
+ catch (err) {
86
+ handleError(err);
87
+ this.exit(1);
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,11 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class InitiativesList extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ first: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
9
+ };
10
+ run(): Promise<void>;
11
+ }