linear-sdk-cli 0.4.0 → 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.
@@ -154,6 +154,7 @@ const SETTING_ORIGIN_SHAPE = shape<SettingOrigin>({
154
154
  source: "string",
155
155
  "path?": "string",
156
156
  "key?": "string",
157
+ "workspace?": "string",
157
158
  });
158
159
  const SETTING_ORIGINS_SHAPE = shape<SettingOrigins>({
159
160
  team: SETTING_ORIGIN_SHAPE,
@@ -168,6 +169,7 @@ const CONFIG_SHOW_SHAPE: ObjectFields = {
168
169
  accessToken: "string",
169
170
  accessTokenSource: "string",
170
171
  credentialWorkspace: "string|null",
172
+ workspaceProfile: "string|null",
171
173
  team: "string|null",
172
174
  workspace: "string|null",
173
175
  sort: "string",
@@ -208,6 +210,48 @@ export const COMMAND_NODE_SHAPE = shape<CommandNode>({
208
210
  // Receipts shared by several commands.
209
211
  const ISSUE_REF: ObjectFields = { id: "string", identifier: "string" };
210
212
  const ISSUE_URL_RECEIPT: ObjectFields = { ...ISSUE_REF, url: "string" };
213
+ const ISSUE_ASSIGNEE_SHAPE: FieldShape = {
214
+ nullable: { id: "string", displayName: "string", email: "string" },
215
+ };
216
+ const ISSUE_DELEGATE_SHAPE: FieldShape = {
217
+ nullable: { id: "string", displayName: "string", name: "string" },
218
+ };
219
+ const ISSUE_DELEGATION_RECEIPT: ObjectFields = {
220
+ ...ISSUE_URL_RECEIPT,
221
+ assignee: ISSUE_ASSIGNEE_SHAPE,
222
+ delegate: ISSUE_DELEGATE_SHAPE,
223
+ };
224
+ const ISSUE_MUTATION_PREVIEW: ObjectFields = {
225
+ operation: "string",
226
+ dryRun: "boolean",
227
+ target: { nullable: ISSUE_REF },
228
+ input: "object",
229
+ };
230
+ const ISSUE_DELEGATION_FULL_RESULT: ObjectFields = {
231
+ receipt: ISSUE_DELEGATION_RECEIPT,
232
+ resource: ISSUE_DETAIL_SHAPE,
233
+ verified: "boolean",
234
+ };
235
+ const ISSUE_LABEL_REF: ObjectFields = { id: "string", name: "string" };
236
+ const ISSUE_LABEL_GROUPS: FieldShape = [{ group: ISSUE_LABEL_REF, label: ISSUE_LABEL_REF }];
237
+ const ISSUE_LABEL_GROUP_RECEIPT: ObjectFields = {
238
+ ...ISSUE_REF,
239
+ changed: "boolean",
240
+ mutationSent: "boolean",
241
+ groups: ISSUE_LABEL_GROUPS,
242
+ };
243
+ const ISSUE_LABEL_GROUP_PREVIEW: ObjectFields = {
244
+ ...ISSUE_MUTATION_PREVIEW,
245
+ changed: "boolean",
246
+ mutationSent: "boolean",
247
+ groups: ISSUE_LABEL_GROUPS,
248
+ };
249
+ const ISSUE_LABEL_GROUP_FULL_RESULT: ObjectFields = {
250
+ receipt: ISSUE_LABEL_GROUP_RECEIPT,
251
+ resource: ISSUE_DETAIL_SHAPE,
252
+ priorState: [{ group: ISSUE_LABEL_REF, labels: [ISSUE_LABEL_REF] }],
253
+ verified: "boolean",
254
+ };
211
255
  const NAMED_URL_RECEIPT: ObjectFields = { id: "string", name: "string", url: "string" };
212
256
  const NAMED_DELETED: ObjectFields = { id: "string", name: "string", deleted: "boolean" };
213
257
  const NAMED_ARCHIVED: ObjectFields = { id: "string", name: "string", archived: "boolean" };
@@ -291,6 +335,7 @@ export const OUTPUT_SHAPES: Record<string, OutputShape | null> = {
291
335
  removed: "boolean",
292
336
  revocation: "string",
293
337
  fallbackCredentialType: "string|null",
338
+ teamMetadataRemoved: "boolean",
294
339
  }),
295
340
  "auth migrate": receipt({ success: "boolean", migrated: ["string"], path: "string" }),
296
341
  "auth status": object({
@@ -324,7 +369,13 @@ export const OUTPUT_SHAPES: Record<string, OutputShape | null> = {
324
369
 
325
370
  config: runs("config show", object(CONFIG_SHOW_SHAPE)),
326
371
  "config init": receipt({ success: "boolean", path: "string", team: "string", "sort?": "string" }),
327
- "config set": receipt({ success: "boolean", path: "string", key: "string", value: "string" }),
372
+ "config set": receipt({
373
+ success: "boolean",
374
+ path: "string",
375
+ key: "string",
376
+ value: "string",
377
+ "workspace?": "string",
378
+ }),
328
379
  "config show": object(CONFIG_SHOW_SHAPE),
329
380
 
330
381
  cycle: null,
@@ -408,6 +459,12 @@ export const OUTPUT_SHAPES: Record<string, OutputShape | null> = {
408
459
  },
409
460
  ),
410
461
  "issue assign": receipt(ISSUE_REF),
462
+ "issue delegate": receipt(ISSUE_DELEGATION_RECEIPT, {
463
+ variants: {
464
+ "--dry-run": receipt(ISSUE_MUTATION_PREVIEW),
465
+ "--full-result": receipt(ISSUE_DELEGATION_FULL_RESULT),
466
+ },
467
+ }),
411
468
  "issue attach": list(
412
469
  {
413
470
  id: "string",
@@ -438,6 +495,10 @@ export const OUTPUT_SHAPES: Record<string, OutputShape | null> = {
438
495
  checkedOut: "boolean",
439
496
  stateChanged: "boolean",
440
497
  }),
498
+ "--delegate": receipt(ISSUE_DELEGATION_RECEIPT),
499
+ "--clear-delegate": receipt(ISSUE_DELEGATION_RECEIPT),
500
+ "--dry-run": receipt(ISSUE_MUTATION_PREVIEW),
501
+ "--full-result": receipt(ISSUE_DELEGATION_FULL_RESULT),
441
502
  },
442
503
  }),
443
504
  "issue delete": receipt(
@@ -469,7 +530,13 @@ export const OUTPUT_SHAPES: Record<string, OutputShape | null> = {
469
530
  },
470
531
  ),
471
532
  "issue id": receipt({ id: "string" }, { note: "`id` is the identifier (TES-123), not the UUID" }),
472
- "issue label": receipt(ISSUE_REF),
533
+ "issue label": receipt(ISSUE_REF, {
534
+ variants: {
535
+ "--set-group": receipt(ISSUE_LABEL_GROUP_RECEIPT),
536
+ "--dry-run": receipt(ISSUE_LABEL_GROUP_PREVIEW),
537
+ "--full-result": receipt(ISSUE_LABEL_GROUP_FULL_RESULT),
538
+ },
539
+ }),
473
540
  "issue list": ISSUE_LIST,
474
541
  "issue mine": ISSUE_LIST,
475
542
  "issue pull-request": receipt(
@@ -499,7 +566,14 @@ export const OUTPUT_SHAPES: Record<string, OutputShape | null> = {
499
566
  "issue title": receipt({ title: "string" }),
500
567
  "issue unarchive": receipt({ ...ISSUE_REF, archived: "boolean" }),
501
568
  "issue unsubscribe": receipt({ ...ISSUE_REF, subscribed: "boolean" }),
502
- "issue update": receipt(ISSUE_URL_RECEIPT),
569
+ "issue update": receipt(ISSUE_URL_RECEIPT, {
570
+ variants: {
571
+ "--delegate": receipt(ISSUE_DELEGATION_RECEIPT),
572
+ "--clear-delegate": receipt(ISSUE_DELEGATION_RECEIPT),
573
+ "--dry-run": receipt(ISSUE_MUTATION_PREVIEW),
574
+ "--full-result": receipt(ISSUE_DELEGATION_FULL_RESULT),
575
+ },
576
+ }),
503
577
  "issue url": receipt({ url: "string" }),
504
578
  "issue view": ISSUE_VIEW,
505
579
 
@@ -0,0 +1,10 @@
1
+ /** Lifecycle fields exposed by Linear on historically listable resources. */
2
+ export interface LifecycleFields {
3
+ archivedAt: string | null;
4
+ trashed?: boolean;
5
+ }
6
+
7
+ /** A visible suffix for mixed live/historical tables. Trashed wins over archived. */
8
+ export function lifecycleSuffix(resource: LifecycleFields): string {
9
+ return resource.trashed ? " (trashed)" : resource.archivedAt ? " (archived)" : "";
10
+ }
@@ -51,6 +51,8 @@ export interface InitiativeRow {
51
51
  targetDate: string | null;
52
52
  health: string | null;
53
53
  url: string;
54
+ archivedAt: string | null;
55
+ trashed: boolean;
54
56
  }
55
57
 
56
58
  /** The row's shape as `linear commands` advertises it (TES-610); checked against the interface. */
@@ -62,13 +64,15 @@ export const INITIATIVE_ROW_SHAPE = shape<InitiativeRow>({
62
64
  targetDate: "string|null",
63
65
  health: "string|null",
64
66
  url: "string",
67
+ archivedAt: "string|null",
68
+ trashed: "boolean",
65
69
  });
66
70
 
67
71
  const LIST_QUERY = `
68
72
  query CliInitiatives($filter: InitiativeFilter, $first: Int!, $after: String, $includeArchived: Boolean) {
69
73
  initiatives(filter: $filter, first: $first, after: $after, includeArchived: $includeArchived) {
70
74
  nodes {
71
- id name status priority targetDate health url
75
+ id name status priority targetDate health url archivedAt trashed
72
76
  }
73
77
  pageInfo { hasNextPage endCursor }
74
78
  }
@@ -80,7 +84,7 @@ export interface ListFilters {
80
84
  /** me|email|name|id — resolved to a user id. */
81
85
  owner?: string;
82
86
  /** Include archived initiatives (the API excludes them by default). */
83
- archived?: boolean;
87
+ includeArchived?: boolean;
84
88
  }
85
89
 
86
90
  /** Build an InitiativeFilter from human options, resolving names to ids. Exported for tests. */
@@ -104,7 +108,7 @@ export async function listInitiatives(
104
108
  return collectRawQuery<InitiativeRow>(
105
109
  client as any,
106
110
  LIST_QUERY,
107
- { filter, includeArchived: filters.archived === true },
111
+ { filter, includeArchived: filters.includeArchived === true },
108
112
  "initiatives",
109
113
  limit,
110
114
  (n) => ({
@@ -115,6 +119,8 @@ export async function listInitiatives(
115
119
  targetDate: n.targetDate ?? null,
116
120
  health: n.health ?? null,
117
121
  url: n.url,
122
+ archivedAt: n.archivedAt ?? null,
123
+ trashed: n.trashed === true,
118
124
  }),
119
125
  );
120
126
  }
@@ -137,6 +143,7 @@ export interface InitiativeDetail {
137
143
  startedAt: string | null;
138
144
  completedAt: string | null;
139
145
  archivedAt: string | null;
146
+ trashed: boolean;
140
147
  owner: string | null;
141
148
  creator: string | null;
142
149
  /** The projects linked to the initiative (`initiative add-project`), API order. */
@@ -162,6 +169,7 @@ export const INITIATIVE_DETAIL_SHAPE = shape<InitiativeDetail>({
162
169
  startedAt: "string|null",
163
170
  completedAt: "string|null",
164
171
  archivedAt: "string|null",
172
+ trashed: "boolean",
165
173
  owner: "string|null",
166
174
  creator: "string|null",
167
175
  projects: [
@@ -214,6 +222,7 @@ export async function getInitiativeDetail(
214
222
  startedAt: initiative.startedAt ? initiative.startedAt.toISOString() : null,
215
223
  completedAt: initiative.completedAt ? initiative.completedAt.toISOString() : null,
216
224
  archivedAt: initiative.archivedAt ? initiative.archivedAt.toISOString() : null,
225
+ trashed: initiative.trashed === true,
217
226
  owner: owner?.displayName ?? null,
218
227
  creator: creator?.displayName ?? null,
219
228
  projects: projectRows,