@enrichlayer/el-linear 1.9.0 → 1.15.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 (135) hide show
  1. package/README.md +139 -10
  2. package/claude-skills/linear-operations/SKILL.md +41 -1
  3. package/dist/auth/linear-credential.d.ts +27 -0
  4. package/dist/auth/linear-credential.js +1 -0
  5. package/dist/auth/oauth-app-config.d.ts +4 -3
  6. package/dist/auth/oauth-app-config.js +13 -2
  7. package/dist/auth/oauth-callback.d.ts +2 -3
  8. package/dist/auth/oauth-callback.js +2 -2
  9. package/dist/auth/oauth-client.d.ts +8 -2
  10. package/dist/auth/oauth-client.js +26 -0
  11. package/dist/auth/oauth-fs.d.ts +2 -1
  12. package/dist/auth/oauth-headless.d.ts +2 -1
  13. package/dist/auth/oauth-storage.d.ts +5 -1
  14. package/dist/auth/oauth-storage.js +1 -1
  15. package/dist/auth/oauth-token.d.ts +4 -3
  16. package/dist/auth/oauth-token.js +16 -4
  17. package/dist/auth/token-resolver.d.ts +14 -5
  18. package/dist/auth/token-resolver.js +6 -1
  19. package/dist/commands/attachments.js +2 -1
  20. package/dist/commands/batch.js +18 -21
  21. package/dist/commands/comments.js +22 -33
  22. package/dist/commands/config.js +178 -5
  23. package/dist/commands/cycles.js +2 -1
  24. package/dist/commands/documents.js +2 -1
  25. package/dist/commands/graphql.js +4 -6
  26. package/dist/commands/init/aliases.js +1 -1
  27. package/dist/commands/init/defaults.d.ts +2 -1
  28. package/dist/commands/init/index.js +45 -35
  29. package/dist/commands/init/oauth.d.ts +4 -1
  30. package/dist/commands/init/oauth.js +22 -4
  31. package/dist/commands/init/shared.d.ts +24 -2
  32. package/dist/commands/init/shared.js +35 -4
  33. package/dist/commands/init/token.d.ts +3 -3
  34. package/dist/commands/init/token.js +5 -24
  35. package/dist/commands/init/workspace.d.ts +2 -1
  36. package/dist/commands/init/workspace.js +1 -1
  37. package/dist/commands/introspect.d.ts +27 -0
  38. package/dist/commands/introspect.js +178 -0
  39. package/dist/commands/issue-id.js +1 -3
  40. package/dist/commands/issues/branch.js +9 -1
  41. package/dist/commands/issues/description.js +2 -6
  42. package/dist/commands/issues/link-references.d.ts +21 -0
  43. package/dist/commands/issues/link-references.js +171 -0
  44. package/dist/commands/issues/relations.d.ts +44 -0
  45. package/dist/commands/issues/relations.js +132 -0
  46. package/dist/commands/issues.js +269 -309
  47. package/dist/commands/labels.js +15 -24
  48. package/dist/commands/profile.js +1 -0
  49. package/dist/commands/project-milestones.js +13 -20
  50. package/dist/commands/projects.d.ts +2 -0
  51. package/dist/commands/projects.js +157 -44
  52. package/dist/commands/read-shortcut.d.ts +1 -1
  53. package/dist/commands/read-shortcut.js +28 -8
  54. package/dist/commands/refs.js +75 -8
  55. package/dist/commands/releases.js +26 -30
  56. package/dist/commands/search.js +49 -33
  57. package/dist/commands/teams.js +2 -1
  58. package/dist/commands/templates.js +9 -14
  59. package/dist/commands/users.js +5 -2
  60. package/dist/config/config.d.ts +99 -1
  61. package/dist/config/config.js +264 -52
  62. package/dist/config/error-enrichment.d.ts +62 -0
  63. package/dist/config/error-enrichment.js +417 -0
  64. package/dist/config/issue-validation.d.ts +37 -0
  65. package/dist/config/issue-validation.js +63 -1
  66. package/dist/config/paths.d.ts +2 -8
  67. package/dist/config/paths.js +4 -2
  68. package/dist/config/resolver.d.ts +8 -1
  69. package/dist/config/resolver.js +11 -5
  70. package/dist/main.js +13 -1
  71. package/dist/queries/attachments-types.d.ts +30 -0
  72. package/dist/queries/attachments-types.js +5 -0
  73. package/dist/queries/comments-types.d.ts +55 -0
  74. package/dist/queries/comments-types.js +5 -0
  75. package/dist/queries/common.d.ts +2 -2
  76. package/dist/queries/common.js +8 -0
  77. package/dist/queries/documents-types.d.ts +62 -0
  78. package/dist/queries/documents-types.js +9 -0
  79. package/dist/queries/introspect-types.d.ts +58 -0
  80. package/dist/queries/introspect-types.js +10 -0
  81. package/dist/queries/issues-types.d.ts +481 -0
  82. package/dist/queries/issues-types.js +23 -0
  83. package/dist/queries/issues.d.ts +51 -10
  84. package/dist/queries/issues.js +147 -5
  85. package/dist/queries/labels-types.d.ts +65 -0
  86. package/dist/queries/labels-types.js +5 -0
  87. package/dist/queries/project-milestones-types.d.ts +92 -0
  88. package/dist/queries/project-milestones-types.js +10 -0
  89. package/dist/queries/project-milestones.d.ts +1 -1
  90. package/dist/queries/projects-types.d.ts +76 -0
  91. package/dist/queries/projects-types.js +5 -0
  92. package/dist/queries/projects.d.ts +2 -0
  93. package/dist/queries/projects.js +22 -0
  94. package/dist/queries/releases-types.d.ts +85 -0
  95. package/dist/queries/releases-types.js +5 -0
  96. package/dist/queries/search-types.d.ts +102 -0
  97. package/dist/queries/search-types.js +6 -0
  98. package/dist/queries/templates-types.d.ts +62 -0
  99. package/dist/queries/templates-types.js +9 -0
  100. package/dist/types/linear.d.ts +21 -3
  101. package/dist/utils/auto-link-references.d.ts +3 -3
  102. package/dist/utils/auto-link-references.js +30 -34
  103. package/dist/utils/extract-field.d.ts +19 -0
  104. package/dist/utils/extract-field.js +99 -0
  105. package/dist/utils/file-service.d.ts +6 -13
  106. package/dist/utils/file-service.js +0 -2
  107. package/dist/utils/formatters/summary.js +6 -1
  108. package/dist/utils/graphql-attachments-service.js +6 -9
  109. package/dist/utils/graphql-documents-service.js +19 -25
  110. package/dist/utils/graphql-issues-service.d.ts +112 -46
  111. package/dist/utils/graphql-issues-service.js +398 -206
  112. package/dist/utils/graphql-service.d.ts +10 -12
  113. package/dist/utils/graphql-service.js +0 -3
  114. package/dist/utils/issue-reference-extractor.d.ts +7 -0
  115. package/dist/utils/issue-reference-extractor.js +5 -3
  116. package/dist/utils/issues-service-bootstrap.d.ts +28 -0
  117. package/dist/utils/issues-service-bootstrap.js +27 -0
  118. package/dist/utils/linear-service.d.ts +21 -14
  119. package/dist/utils/linear-service.js +73 -11
  120. package/dist/utils/markdown-prosemirror.js +12 -12
  121. package/dist/utils/mention-resolver.js +1 -1
  122. package/dist/utils/output.d.ts +82 -2
  123. package/dist/utils/output.js +76 -11
  124. package/dist/utils/project-slug.d.ts +21 -0
  125. package/dist/utils/project-slug.js +45 -0
  126. package/dist/utils/protected-ranges.d.ts +14 -0
  127. package/dist/utils/protected-ranges.js +88 -2
  128. package/dist/utils/sanitize-for-log.d.ts +24 -0
  129. package/dist/utils/sanitize-for-log.js +38 -0
  130. package/dist/utils/table-formatter.js +24 -0
  131. package/dist/utils/validators.d.ts +7 -2
  132. package/dist/utils/validators.js +6 -0
  133. package/dist/utils/workspace-url.d.ts +5 -1
  134. package/dist/utils/workspace-url.js +53 -7
  135. package/package.json +2 -2
@@ -1,6 +1,21 @@
1
- import type { GraphQLResponseData, LinearIssue } from "../types/linear.js";
1
+ import type { IssueArchiveEntity, IssueNode, IssueWithCommentsNode } from "../queries/issues-types.js";
2
+ import type { LinearIssue, LinearPriority } from "../types/linear.js";
2
3
  import type { GraphQLService } from "./graphql-service.js";
3
4
  import type { LinearService } from "./linear-service.js";
5
+ /**
6
+ * Project filter for `SearchIssueArgs`. Discriminated on `kind` so the
7
+ * "filter by project" and "filter to issues with no project" cases are
8
+ * mutually exclusive at the type level — the old `projectId?: string;
9
+ * noProject?: boolean` pair allowed `{ projectId: "x", noProject: true }`
10
+ * to compile but had to be detangled at runtime (`noProject` won by
11
+ * convention). The discriminant is the contract.
12
+ */
13
+ export type SearchIssueProject = {
14
+ kind: "id";
15
+ id: string;
16
+ } | {
17
+ kind: "none";
18
+ };
4
19
  /**
5
20
  * Arguments accepted by `GraphQLIssuesService.searchIssues`. Two
6
21
  * modes:
@@ -14,52 +29,80 @@ export interface SearchIssueArgs {
14
29
  query?: string;
15
30
  /** Team key, name, or UUID. */
16
31
  teamId?: string;
17
- /** Project name or UUID. */
18
- projectId?: string;
19
- /** Set true to match only issues with NO project. Mutually
20
- * exclusive with `projectId`. */
21
- noProject?: boolean;
32
+ /**
33
+ * Project filter. `{ kind: "id", id }` filters to a specific project
34
+ * (name or UUID accepted); `{ kind: "none" }` matches issues with no
35
+ * project. Undefined leaves the filter off.
36
+ */
37
+ project?: SearchIssueProject;
22
38
  /** Assignee name, email, alias, or UUID. */
23
39
  assigneeId?: string;
40
+ /** Agent user name, email, alias, or UUID delegated to the issue. */
41
+ delegateId?: string;
24
42
  /** Issue states to include (e.g. `["Todo", "In Progress"]`). */
25
43
  status?: string[];
26
44
  /** Label names to require (intersection). */
27
45
  labelNames?: string[];
28
46
  /** Priority values (0-4) to include. */
29
- priority?: number[];
47
+ priority?: LinearPriority[];
30
48
  /** Result cap; defaults to 10 when not set. */
31
49
  limit?: number;
32
50
  /** Linear orderBy enum (`createdAt` / `updatedAt`). */
33
51
  orderBy?: string;
34
52
  }
35
53
  /**
36
- * Arguments accepted by `GraphQLIssuesService.updateIssue`. Same
37
- * field shapes as `CreateIssueArgs` (UUID-or-name where applicable),
38
- * but with `id` required (the issue to update) and `subscriberIds` /
39
- * `templateId` omitted (not valid on update).
54
+ * Fields shared by `CreateIssueArgs` and `UpdateIssueArgs`. Both mutations
55
+ * accept the same scalar/foreign-key fields — only their lifecycle
56
+ * fields differ. `Create` adds `teamInput`/`subscriberIds`/`templateId`
57
+ * (initial-state-only); `Update` adds the required `id` and widens
58
+ * `cycleId` to `| null` (Linear's API uses `null` to detach from a
59
+ * cycle on update).
60
+ *
61
+ * Pre-fix this lived as two parallel 13-field interfaces. A field added
62
+ * to one would silently diverge from the other; the shared base now
63
+ * forces a deliberate per-side decision.
40
64
  */
41
- export interface UpdateIssueArgs {
42
- /** Issue identifier (e.g. `DEV-3592`) or UUID. Required. */
43
- id: string;
65
+ interface IssueMutationFields {
44
66
  title?: string;
67
+ /** Team key, name, or UUID. Required on create unless `templateId` is set. */
68
+ teamId?: string;
45
69
  description?: string;
46
70
  /** Assignee name, email, alias, or UUID. */
47
71
  assigneeId?: string;
48
- priority?: number;
72
+ /** Agent user name, email, alias, or UUID delegated to work on the issue. */
73
+ delegateId?: string | null;
74
+ /** Linear priority: 0 (none), 1 (urgent), 2 (high), 3 (medium), 4 (low). */
75
+ priority?: LinearPriority;
76
+ /** Project name or UUID. */
49
77
  projectId?: string;
78
+ /** Status name or UUID — resolved per team. */
50
79
  statusId?: string;
51
- /**
52
- * Hint for the team-aware label resolver when the issue is being
53
- * moved between teams.
54
- */
55
- teamId?: string;
80
+ /** Label names or UUIDs — auto-created on the team if missing. */
56
81
  labelIds?: string[];
82
+ /** Parent issue identifier or UUID. */
57
83
  parentId?: string;
84
+ /** Project milestone name or UUID — resolved within the project. */
58
85
  milestoneId?: string;
59
- cycleId?: string | null;
86
+ /** Due date, ISO 8601. */
60
87
  dueDate?: string;
88
+ /** Story-points / estimate. */
61
89
  estimate?: number;
62
90
  }
91
+ /**
92
+ * Arguments accepted by `GraphQLIssuesService.updateIssue`. Same field
93
+ * shapes as `CreateIssueArgs` (UUID-or-name where applicable), but with
94
+ * `id` required (the issue to update) and the create-only initial-state
95
+ * fields (`teamInput` / `subscriberIds` / `templateId`) omitted.
96
+ */
97
+ export interface UpdateIssueArgs extends IssueMutationFields {
98
+ /** Issue identifier (e.g. `DEV-3592`) or UUID. Required. */
99
+ id: string;
100
+ /**
101
+ * On update, `null` detaches the issue from its current cycle.
102
+ * (`undefined` leaves it unchanged; a UUID/number/name moves it.)
103
+ */
104
+ cycleId?: string | null;
105
+ }
63
106
  /**
64
107
  * Arguments accepted by `GraphQLIssuesService.createIssue`. Most fields
65
108
  * may be passed as a Linear UUID OR a name/identifier — the service
@@ -72,48 +115,62 @@ export interface UpdateIssueArgs {
72
115
  * `assigneeId` compiled cleanly and silently dropped the field. With
73
116
  * the typed shape, `tsc` catches the typo.
74
117
  */
75
- export interface CreateIssueArgs {
76
- title?: string;
77
- /** Team key, name, or UUID. Required unless `templateId` is set. */
78
- teamId?: string;
118
+ export interface CreateIssueArgs extends IssueMutationFields {
79
119
  /** Original team token (key or name) — used in label resolution error messages. */
80
120
  teamInput?: string;
81
- description?: string;
82
- /** Assignee name, email, alias, or UUID. */
83
- assigneeId?: string;
84
- /** Linear priority: 0 (none), 1 (urgent), 2 (high), 3 (medium), 4 (low). */
85
- priority?: number;
86
- /** Project name or UUID. */
87
- projectId?: string;
88
- /** Status name or UUID — resolved per team. */
89
- statusId?: string;
90
- /** Label names or UUIDs — auto-created on the team if missing. */
91
- labelIds?: string[];
92
- /** Parent issue identifier or UUID. */
93
- parentId?: string;
94
- /** Project milestone name or UUID — resolved within the project. */
95
- milestoneId?: string;
96
- /** Cycle number, name, or UUID — resolved per team. */
121
+ /** Cycle number, name, or UUID — resolved per team. (No `null` on create.) */
97
122
  cycleId?: string;
98
123
  /** Subscriber names, emails, aliases, or UUIDs. */
99
124
  subscriberIds?: string[];
100
- /** Due date, ISO 8601. */
101
- dueDate?: string;
102
- /** Story-points / estimate. */
103
- estimate?: number;
104
125
  /** Linear server-side template UUID for `--from-template`. */
105
126
  templateId?: string;
106
127
  }
128
+ export interface IssueArchiveOperationResult {
129
+ id: string;
130
+ entity?: IssueArchiveEntity;
131
+ lastSyncId: number;
132
+ }
133
+ export interface StartIssueResult {
134
+ issue: LinearIssue;
135
+ previousState?: {
136
+ id: string;
137
+ name: string;
138
+ type: string;
139
+ };
140
+ started: boolean;
141
+ targetState?: {
142
+ id: string;
143
+ name: string;
144
+ };
145
+ }
107
146
  export declare class GraphQLIssuesService {
108
147
  private readonly graphQLService;
109
148
  private readonly linearService;
110
149
  constructor(graphQLService: GraphQLService, linearService: LinearService);
111
150
  getIssues(limit?: number): Promise<LinearIssue[]>;
112
151
  getIssueById(issueId: string): Promise<LinearIssue>;
152
+ startIssue(issueId: string): Promise<StartIssueResult>;
113
153
  updateIssue(args: UpdateIssueArgs, labelMode?: string): Promise<LinearIssue>;
154
+ archiveIssue(issueId: string): Promise<IssueArchiveOperationResult>;
155
+ deleteIssue(issueId: string, options?: {
156
+ permanentlyDelete?: boolean;
157
+ }): Promise<IssueArchiveOperationResult>;
114
158
  private extractMilestoneNodes;
115
159
  private executeUpdateMutation;
116
160
  createIssue(args: CreateIssueArgs): Promise<LinearIssue>;
161
+ /**
162
+ * Folds the `@include`-gated `projectsByName` / `projectsById` aliases
163
+ * from a create batch response into the single `projects` field the
164
+ * field-resolution helpers expect. At most one project alias is ever
165
+ * present, since a `--project` input is either a name or a UUID.
166
+ */
167
+ private foldCreateBatchResult;
168
+ /**
169
+ * Folds the `@include`-gated `projectsByName` / `projectsById` aliases
170
+ * from an update batch response into the single `projects` field the
171
+ * field-resolution helpers expect. See `foldCreateBatchResult`.
172
+ */
173
+ private foldUpdateBatchResult;
117
174
  private resolveCreateFields;
118
175
  private executeCreateMutation;
119
176
  searchIssues(args: SearchIssueArgs): Promise<LinearIssue[]>;
@@ -139,14 +196,23 @@ export declare class GraphQLIssuesService {
139
196
  private applySearchFilters;
140
197
  private buildSearchFilter;
141
198
  private resolveAssigneeId;
199
+ private resolveDelegateId;
142
200
  private resolveUpdateContext;
143
201
  private resolveCycleIdForUpdate;
144
202
  private resolveStatusIdForUpdate;
203
+ /**
204
+ * Pre-resolve URL/slug-id project inputs to UUIDs before the batch
205
+ * resolver runs. Plain names and UUIDs pass through unchanged; only
206
+ * URL/slug-id forms incur a separate slug→UUID round-trip (the batch
207
+ * query's `name eqIgnoreCase` filter can't match a URL string).
208
+ */
209
+ private withNormalizedProjectId;
145
210
  private buildCreateResolveVariables;
146
211
  private resolveParentId;
147
- transformIssueData(issue: GraphQLResponseData): LinearIssue;
212
+ transformIssueData(issue: IssueNode | IssueWithCommentsNode): LinearIssue;
148
213
  private transformIssueCoreFields;
149
214
  private transformIssueRelations;
150
215
  private transformIssueHierarchy;
151
216
  private transformIssueComments;
152
217
  }
218
+ export {};