@gonovus-ai/spec-flow-cli 0.5.0 → 0.6.2
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/README.md +60 -29
- package/dist/bin.js +6 -50
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +116 -400
- package/dist/cli.js.map +1 -1
- package/dist/commands/work-item-output.d.ts +466 -0
- package/dist/commands/work-item-output.js +36 -0
- package/dist/commands/work-item-output.js.map +1 -0
- package/dist/http-origin.js +3 -0
- package/dist/http-origin.js.map +1 -1
- package/dist/index.js +50 -28
- package/dist/index.js.map +1 -1
- package/dist/input/text-source.d.ts +9 -0
- package/dist/input/text-source.js +74 -0
- package/dist/input/text-source.js.map +1 -0
- package/dist/program.d.ts +3 -0
- package/dist/program.js +19 -0
- package/dist/program.js.map +1 -0
- package/dist/runtime/errors.d.ts +28 -0
- package/dist/runtime/errors.js +133 -0
- package/dist/runtime/errors.js.map +1 -0
- package/dist/runtime/execute.d.ts +23 -0
- package/dist/runtime/execute.js +25 -0
- package/dist/runtime/execute.js.map +1 -0
- package/dist/runtime/identity.d.ts +183 -0
- package/dist/runtime/identity.js +17 -0
- package/dist/runtime/identity.js.map +1 -0
- package/dist/runtime/output.d.ts +3 -0
- package/dist/runtime/output.js +13 -0
- package/dist/runtime/output.js.map +1 -0
- package/dist/runtime/session.d.ts +16 -0
- package/dist/runtime/session.js +123 -0
- package/dist/runtime/session.js.map +1 -0
- package/dist/work-item-query-commands.js +4 -1
- package/dist/work-item-query-commands.js.map +1 -1
- package/dist/work-item-resource-link-commands.js +44 -0
- package/dist/work-item-resource-link-commands.js.map +1 -1
- package/package.json +1 -1
- package/dist/work-item-time-entry-input.d.ts +0 -4
- package/dist/work-item-time-entry-input.js +0 -27
- package/dist/work-item-time-entry-input.js.map +0 -1
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import type { paths } from "@spec-flow/api-client";
|
|
2
|
+
type Item = paths["/v1/projects/{projectId}/work-items/{workItemId}"]["get"]["responses"][200]["content"]["application/json"]["workItem"];
|
|
3
|
+
type ItemList = paths["/v1/projects/{projectId}/work-items"]["get"]["responses"][200]["content"]["application/json"];
|
|
4
|
+
type RelationList = paths["/v1/projects/{projectId}/work-items/{workItemId}/relations"]["get"]["responses"][200]["content"]["application/json"];
|
|
5
|
+
type Relation = RelationList["relations"][number];
|
|
6
|
+
type Receipt = paths["/v1/projects/{projectId}/work-items/{workItemId}/relations"]["post"]["responses"][201]["content"]["application/json"];
|
|
7
|
+
type CompatibleItem = Omit<Item, "url"> & {
|
|
8
|
+
readonly url?: string | null;
|
|
9
|
+
};
|
|
10
|
+
type CompatibleList = Omit<ItemList, "groups"> & {
|
|
11
|
+
readonly groups?: ItemList["groups"];
|
|
12
|
+
};
|
|
13
|
+
export type OutputMode = "full" | "summary";
|
|
14
|
+
export declare function itemSummary(item: CompatibleItem): {
|
|
15
|
+
id: string;
|
|
16
|
+
systemId: string;
|
|
17
|
+
projectId: string;
|
|
18
|
+
title: string;
|
|
19
|
+
url: string | null | undefined;
|
|
20
|
+
status: string;
|
|
21
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
22
|
+
version: string;
|
|
23
|
+
assignee: {
|
|
24
|
+
image: string | null;
|
|
25
|
+
name: string;
|
|
26
|
+
userId: string;
|
|
27
|
+
} | null;
|
|
28
|
+
};
|
|
29
|
+
export declare function itemOutput<T extends {
|
|
30
|
+
readonly workItem?: CompatibleItem;
|
|
31
|
+
}>(data: T, mode: OutputMode, warn: () => void): T;
|
|
32
|
+
export declare function itemListOutput(data: CompatibleList, mode: OutputMode, warn: () => void): CompatibleList | {
|
|
33
|
+
workItems: {
|
|
34
|
+
id: string;
|
|
35
|
+
systemId: string;
|
|
36
|
+
projectId: string;
|
|
37
|
+
title: string;
|
|
38
|
+
url: string | null | undefined;
|
|
39
|
+
status: string;
|
|
40
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
41
|
+
version: string;
|
|
42
|
+
assignee: {
|
|
43
|
+
image: string | null;
|
|
44
|
+
name: string;
|
|
45
|
+
userId: string;
|
|
46
|
+
} | null;
|
|
47
|
+
}[];
|
|
48
|
+
hiddenCompleted?: {
|
|
49
|
+
status: string;
|
|
50
|
+
count: number;
|
|
51
|
+
}[];
|
|
52
|
+
nextCursor: string | null;
|
|
53
|
+
permissions: {
|
|
54
|
+
canAssign: boolean;
|
|
55
|
+
canCreate: boolean;
|
|
56
|
+
canDelete: boolean;
|
|
57
|
+
canUpdate: boolean;
|
|
58
|
+
};
|
|
59
|
+
groups?: ItemList["groups"];
|
|
60
|
+
} | {
|
|
61
|
+
groups: {
|
|
62
|
+
workItems: {
|
|
63
|
+
id: string;
|
|
64
|
+
systemId: string;
|
|
65
|
+
projectId: string;
|
|
66
|
+
title: string;
|
|
67
|
+
url: string | null | undefined;
|
|
68
|
+
status: string;
|
|
69
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
70
|
+
version: string;
|
|
71
|
+
assignee: {
|
|
72
|
+
image: string | null;
|
|
73
|
+
name: string;
|
|
74
|
+
userId: string;
|
|
75
|
+
} | null;
|
|
76
|
+
}[];
|
|
77
|
+
name: string;
|
|
78
|
+
status: string;
|
|
79
|
+
}[];
|
|
80
|
+
workItems: {
|
|
81
|
+
id: string;
|
|
82
|
+
systemId: string;
|
|
83
|
+
projectId: string;
|
|
84
|
+
title: string;
|
|
85
|
+
url: string | null | undefined;
|
|
86
|
+
status: string;
|
|
87
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
88
|
+
version: string;
|
|
89
|
+
assignee: {
|
|
90
|
+
image: string | null;
|
|
91
|
+
name: string;
|
|
92
|
+
userId: string;
|
|
93
|
+
} | null;
|
|
94
|
+
}[];
|
|
95
|
+
hiddenCompleted?: {
|
|
96
|
+
status: string;
|
|
97
|
+
count: number;
|
|
98
|
+
}[];
|
|
99
|
+
nextCursor: string | null;
|
|
100
|
+
permissions: {
|
|
101
|
+
canAssign: boolean;
|
|
102
|
+
canCreate: boolean;
|
|
103
|
+
canDelete: boolean;
|
|
104
|
+
canUpdate: boolean;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export declare function relationSummary(relation: Relation): {
|
|
108
|
+
parent?: {
|
|
109
|
+
projectId: string;
|
|
110
|
+
id: string;
|
|
111
|
+
};
|
|
112
|
+
child?: {
|
|
113
|
+
projectId: string;
|
|
114
|
+
id: string;
|
|
115
|
+
};
|
|
116
|
+
id: string;
|
|
117
|
+
relationType: "subtask" | "blocks" | "related";
|
|
118
|
+
version: "\"1\"";
|
|
119
|
+
createdAt: string;
|
|
120
|
+
canRemove: boolean;
|
|
121
|
+
sourceWorkItem: {
|
|
122
|
+
id: string;
|
|
123
|
+
systemId: string;
|
|
124
|
+
projectId: string;
|
|
125
|
+
title: string;
|
|
126
|
+
url: string | null | undefined;
|
|
127
|
+
status: string;
|
|
128
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
129
|
+
version: string;
|
|
130
|
+
assignee: {
|
|
131
|
+
image: string | null;
|
|
132
|
+
name: string;
|
|
133
|
+
userId: string;
|
|
134
|
+
} | null;
|
|
135
|
+
};
|
|
136
|
+
targetWorkItem: {
|
|
137
|
+
id: string;
|
|
138
|
+
systemId: string;
|
|
139
|
+
projectId: string;
|
|
140
|
+
title: string;
|
|
141
|
+
url: string | null | undefined;
|
|
142
|
+
status: string;
|
|
143
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
144
|
+
version: string;
|
|
145
|
+
assignee: {
|
|
146
|
+
image: string | null;
|
|
147
|
+
name: string;
|
|
148
|
+
userId: string;
|
|
149
|
+
} | null;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
export declare function relationListOutput(data: RelationList, mode: OutputMode, warn: () => void): {
|
|
153
|
+
relations: {
|
|
154
|
+
id: string;
|
|
155
|
+
relationType: "subtask" | "blocks" | "related";
|
|
156
|
+
createdAt: string;
|
|
157
|
+
version: "\"1\"";
|
|
158
|
+
sourceWorkItem: {
|
|
159
|
+
sources?: {
|
|
160
|
+
kind: "lark-message";
|
|
161
|
+
url: string;
|
|
162
|
+
createdAt: string;
|
|
163
|
+
}[];
|
|
164
|
+
url: string;
|
|
165
|
+
githubIssue?: {
|
|
166
|
+
repositoryOwner: string;
|
|
167
|
+
repositoryName: string;
|
|
168
|
+
number: number;
|
|
169
|
+
state: "open" | "closed";
|
|
170
|
+
origin: "github" | "spec-flow";
|
|
171
|
+
url: string;
|
|
172
|
+
disconnected: boolean;
|
|
173
|
+
} | null;
|
|
174
|
+
assignee: {
|
|
175
|
+
image: string | null;
|
|
176
|
+
name: string;
|
|
177
|
+
userId: string;
|
|
178
|
+
} | null;
|
|
179
|
+
createdAt: string;
|
|
180
|
+
description: string | null;
|
|
181
|
+
descriptionGeneration?: number;
|
|
182
|
+
dueDate: string | null;
|
|
183
|
+
id: string;
|
|
184
|
+
systemId: string;
|
|
185
|
+
position: number;
|
|
186
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
187
|
+
projectId: string;
|
|
188
|
+
startDate: string | null;
|
|
189
|
+
status: string;
|
|
190
|
+
title: string;
|
|
191
|
+
sourceFindingId?: string | null;
|
|
192
|
+
updatedAt: string;
|
|
193
|
+
completedAt?: string | null;
|
|
194
|
+
statusChangedAt?: string;
|
|
195
|
+
parentId?: string | null;
|
|
196
|
+
subtasks?: {
|
|
197
|
+
total: number;
|
|
198
|
+
done: number;
|
|
199
|
+
};
|
|
200
|
+
creator?: {
|
|
201
|
+
image: string | null;
|
|
202
|
+
name: string;
|
|
203
|
+
userId: string;
|
|
204
|
+
} | null;
|
|
205
|
+
version: string;
|
|
206
|
+
};
|
|
207
|
+
targetWorkItem: {
|
|
208
|
+
sources?: {
|
|
209
|
+
kind: "lark-message";
|
|
210
|
+
url: string;
|
|
211
|
+
createdAt: string;
|
|
212
|
+
}[];
|
|
213
|
+
url: string;
|
|
214
|
+
githubIssue?: {
|
|
215
|
+
repositoryOwner: string;
|
|
216
|
+
repositoryName: string;
|
|
217
|
+
number: number;
|
|
218
|
+
state: "open" | "closed";
|
|
219
|
+
origin: "github" | "spec-flow";
|
|
220
|
+
url: string;
|
|
221
|
+
disconnected: boolean;
|
|
222
|
+
} | null;
|
|
223
|
+
assignee: {
|
|
224
|
+
image: string | null;
|
|
225
|
+
name: string;
|
|
226
|
+
userId: string;
|
|
227
|
+
} | null;
|
|
228
|
+
createdAt: string;
|
|
229
|
+
description: string | null;
|
|
230
|
+
descriptionGeneration?: number;
|
|
231
|
+
dueDate: string | null;
|
|
232
|
+
id: string;
|
|
233
|
+
systemId: string;
|
|
234
|
+
position: number;
|
|
235
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
236
|
+
projectId: string;
|
|
237
|
+
startDate: string | null;
|
|
238
|
+
status: string;
|
|
239
|
+
title: string;
|
|
240
|
+
sourceFindingId?: string | null;
|
|
241
|
+
updatedAt: string;
|
|
242
|
+
completedAt?: string | null;
|
|
243
|
+
statusChangedAt?: string;
|
|
244
|
+
parentId?: string | null;
|
|
245
|
+
subtasks?: {
|
|
246
|
+
total: number;
|
|
247
|
+
done: number;
|
|
248
|
+
};
|
|
249
|
+
creator?: {
|
|
250
|
+
image: string | null;
|
|
251
|
+
name: string;
|
|
252
|
+
userId: string;
|
|
253
|
+
} | null;
|
|
254
|
+
version: string;
|
|
255
|
+
};
|
|
256
|
+
canRemove: boolean;
|
|
257
|
+
}[];
|
|
258
|
+
canCreateRelation: boolean;
|
|
259
|
+
canCreateSubtask: boolean;
|
|
260
|
+
} | {
|
|
261
|
+
relations: {
|
|
262
|
+
parent?: {
|
|
263
|
+
projectId: string;
|
|
264
|
+
id: string;
|
|
265
|
+
};
|
|
266
|
+
child?: {
|
|
267
|
+
projectId: string;
|
|
268
|
+
id: string;
|
|
269
|
+
};
|
|
270
|
+
id: string;
|
|
271
|
+
relationType: "subtask" | "blocks" | "related";
|
|
272
|
+
version: "\"1\"";
|
|
273
|
+
createdAt: string;
|
|
274
|
+
canRemove: boolean;
|
|
275
|
+
sourceWorkItem: {
|
|
276
|
+
id: string;
|
|
277
|
+
systemId: string;
|
|
278
|
+
projectId: string;
|
|
279
|
+
title: string;
|
|
280
|
+
url: string | null | undefined;
|
|
281
|
+
status: string;
|
|
282
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
283
|
+
version: string;
|
|
284
|
+
assignee: {
|
|
285
|
+
image: string | null;
|
|
286
|
+
name: string;
|
|
287
|
+
userId: string;
|
|
288
|
+
} | null;
|
|
289
|
+
};
|
|
290
|
+
targetWorkItem: {
|
|
291
|
+
id: string;
|
|
292
|
+
systemId: string;
|
|
293
|
+
projectId: string;
|
|
294
|
+
title: string;
|
|
295
|
+
url: string | null | undefined;
|
|
296
|
+
status: string;
|
|
297
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
298
|
+
version: string;
|
|
299
|
+
assignee: {
|
|
300
|
+
image: string | null;
|
|
301
|
+
name: string;
|
|
302
|
+
userId: string;
|
|
303
|
+
} | null;
|
|
304
|
+
};
|
|
305
|
+
}[];
|
|
306
|
+
canCreateRelation: boolean;
|
|
307
|
+
canCreateSubtask: boolean;
|
|
308
|
+
};
|
|
309
|
+
export declare function relationReceiptOutput(data: Receipt, mode: OutputMode, warn: () => void): {
|
|
310
|
+
relationId: string;
|
|
311
|
+
relation: {
|
|
312
|
+
id: string;
|
|
313
|
+
relationType: "subtask" | "blocks" | "related";
|
|
314
|
+
createdAt: string;
|
|
315
|
+
version: "\"1\"";
|
|
316
|
+
sourceWorkItem: {
|
|
317
|
+
sources?: {
|
|
318
|
+
kind: "lark-message";
|
|
319
|
+
url: string;
|
|
320
|
+
createdAt: string;
|
|
321
|
+
}[];
|
|
322
|
+
url: string;
|
|
323
|
+
githubIssue?: {
|
|
324
|
+
repositoryOwner: string;
|
|
325
|
+
repositoryName: string;
|
|
326
|
+
number: number;
|
|
327
|
+
state: "open" | "closed";
|
|
328
|
+
origin: "github" | "spec-flow";
|
|
329
|
+
url: string;
|
|
330
|
+
disconnected: boolean;
|
|
331
|
+
} | null;
|
|
332
|
+
assignee: {
|
|
333
|
+
image: string | null;
|
|
334
|
+
name: string;
|
|
335
|
+
userId: string;
|
|
336
|
+
} | null;
|
|
337
|
+
createdAt: string;
|
|
338
|
+
description: string | null;
|
|
339
|
+
descriptionGeneration?: number;
|
|
340
|
+
dueDate: string | null;
|
|
341
|
+
id: string;
|
|
342
|
+
systemId: string;
|
|
343
|
+
position: number;
|
|
344
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
345
|
+
projectId: string;
|
|
346
|
+
startDate: string | null;
|
|
347
|
+
status: string;
|
|
348
|
+
title: string;
|
|
349
|
+
sourceFindingId?: string | null;
|
|
350
|
+
updatedAt: string;
|
|
351
|
+
completedAt?: string | null;
|
|
352
|
+
statusChangedAt?: string;
|
|
353
|
+
parentId?: string | null;
|
|
354
|
+
subtasks?: {
|
|
355
|
+
total: number;
|
|
356
|
+
done: number;
|
|
357
|
+
};
|
|
358
|
+
creator?: {
|
|
359
|
+
image: string | null;
|
|
360
|
+
name: string;
|
|
361
|
+
userId: string;
|
|
362
|
+
} | null;
|
|
363
|
+
version: string;
|
|
364
|
+
};
|
|
365
|
+
targetWorkItem: {
|
|
366
|
+
sources?: {
|
|
367
|
+
kind: "lark-message";
|
|
368
|
+
url: string;
|
|
369
|
+
createdAt: string;
|
|
370
|
+
}[];
|
|
371
|
+
url: string;
|
|
372
|
+
githubIssue?: {
|
|
373
|
+
repositoryOwner: string;
|
|
374
|
+
repositoryName: string;
|
|
375
|
+
number: number;
|
|
376
|
+
state: "open" | "closed";
|
|
377
|
+
origin: "github" | "spec-flow";
|
|
378
|
+
url: string;
|
|
379
|
+
disconnected: boolean;
|
|
380
|
+
} | null;
|
|
381
|
+
assignee: {
|
|
382
|
+
image: string | null;
|
|
383
|
+
name: string;
|
|
384
|
+
userId: string;
|
|
385
|
+
} | null;
|
|
386
|
+
createdAt: string;
|
|
387
|
+
description: string | null;
|
|
388
|
+
descriptionGeneration?: number;
|
|
389
|
+
dueDate: string | null;
|
|
390
|
+
id: string;
|
|
391
|
+
systemId: string;
|
|
392
|
+
position: number;
|
|
393
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
394
|
+
projectId: string;
|
|
395
|
+
startDate: string | null;
|
|
396
|
+
status: string;
|
|
397
|
+
title: string;
|
|
398
|
+
sourceFindingId?: string | null;
|
|
399
|
+
updatedAt: string;
|
|
400
|
+
completedAt?: string | null;
|
|
401
|
+
statusChangedAt?: string;
|
|
402
|
+
parentId?: string | null;
|
|
403
|
+
subtasks?: {
|
|
404
|
+
total: number;
|
|
405
|
+
done: number;
|
|
406
|
+
};
|
|
407
|
+
creator?: {
|
|
408
|
+
image: string | null;
|
|
409
|
+
name: string;
|
|
410
|
+
userId: string;
|
|
411
|
+
} | null;
|
|
412
|
+
version: string;
|
|
413
|
+
};
|
|
414
|
+
canRemove: boolean;
|
|
415
|
+
} | null;
|
|
416
|
+
replayed: boolean;
|
|
417
|
+
} | {
|
|
418
|
+
relation: {
|
|
419
|
+
parent?: {
|
|
420
|
+
projectId: string;
|
|
421
|
+
id: string;
|
|
422
|
+
};
|
|
423
|
+
child?: {
|
|
424
|
+
projectId: string;
|
|
425
|
+
id: string;
|
|
426
|
+
};
|
|
427
|
+
id: string;
|
|
428
|
+
relationType: "subtask" | "blocks" | "related";
|
|
429
|
+
version: "\"1\"";
|
|
430
|
+
createdAt: string;
|
|
431
|
+
canRemove: boolean;
|
|
432
|
+
sourceWorkItem: {
|
|
433
|
+
id: string;
|
|
434
|
+
systemId: string;
|
|
435
|
+
projectId: string;
|
|
436
|
+
title: string;
|
|
437
|
+
url: string | null | undefined;
|
|
438
|
+
status: string;
|
|
439
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
440
|
+
version: string;
|
|
441
|
+
assignee: {
|
|
442
|
+
image: string | null;
|
|
443
|
+
name: string;
|
|
444
|
+
userId: string;
|
|
445
|
+
} | null;
|
|
446
|
+
};
|
|
447
|
+
targetWorkItem: {
|
|
448
|
+
id: string;
|
|
449
|
+
systemId: string;
|
|
450
|
+
projectId: string;
|
|
451
|
+
title: string;
|
|
452
|
+
url: string | null | undefined;
|
|
453
|
+
status: string;
|
|
454
|
+
priority: "no-priority" | "low" | "medium" | "high" | "urgent";
|
|
455
|
+
version: string;
|
|
456
|
+
assignee: {
|
|
457
|
+
image: string | null;
|
|
458
|
+
name: string;
|
|
459
|
+
userId: string;
|
|
460
|
+
} | null;
|
|
461
|
+
};
|
|
462
|
+
} | null;
|
|
463
|
+
relationId: string;
|
|
464
|
+
replayed: boolean;
|
|
465
|
+
};
|
|
466
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function itemSummary(item) {
|
|
2
|
+
return { id: item.id, systemId: item.systemId, projectId: item.projectId, title: item.title, url: item.url, status: item.status, priority: item.priority, version: item.version, assignee: item.assignee };
|
|
3
|
+
}
|
|
4
|
+
function checkUrls(items, warn) {
|
|
5
|
+
if (items.some(item => item.url === undefined || item.url === null))
|
|
6
|
+
warn();
|
|
7
|
+
}
|
|
8
|
+
export function itemOutput(data, mode, warn) {
|
|
9
|
+
if (data.workItem !== undefined)
|
|
10
|
+
checkUrls([data.workItem], warn);
|
|
11
|
+
if (mode === "full")
|
|
12
|
+
return data;
|
|
13
|
+
if (data.workItem === undefined)
|
|
14
|
+
throw new Error("Missing Work Item response");
|
|
15
|
+
return { ...data, workItem: itemSummary(data.workItem) };
|
|
16
|
+
}
|
|
17
|
+
export function itemListOutput(data, mode, warn) {
|
|
18
|
+
checkUrls([...data.workItems, ...(data.groups?.flatMap(group => group.workItems) ?? [])], warn);
|
|
19
|
+
return mode === "full" ? data : { ...data, workItems: data.workItems.map(itemSummary), ...(data.groups === undefined ? {} : data.groups === null ? { groups: null } : { groups: data.groups.map(group => ({ ...group, workItems: group.workItems.map(itemSummary) })) }) };
|
|
20
|
+
}
|
|
21
|
+
export function relationSummary(relation) {
|
|
22
|
+
return { id: relation.id, relationType: relation.relationType, version: relation.version, createdAt: relation.createdAt, canRemove: relation.canRemove,
|
|
23
|
+
sourceWorkItem: itemSummary(relation.sourceWorkItem), targetWorkItem: itemSummary(relation.targetWorkItem),
|
|
24
|
+
...(relation.relationType === "subtask" ? { parent: { projectId: relation.sourceWorkItem.projectId, id: relation.sourceWorkItem.id }, child: { projectId: relation.targetWorkItem.projectId, id: relation.targetWorkItem.id } } : {}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function relationListOutput(data, mode, warn) {
|
|
28
|
+
checkUrls(data.relations.flatMap(relation => [relation.sourceWorkItem, relation.targetWorkItem]), warn);
|
|
29
|
+
return mode === "full" ? data : { ...data, relations: data.relations.map(relationSummary) };
|
|
30
|
+
}
|
|
31
|
+
export function relationReceiptOutput(data, mode, warn) {
|
|
32
|
+
if (data.relation !== null)
|
|
33
|
+
checkUrls([data.relation.sourceWorkItem, data.relation.targetWorkItem], warn);
|
|
34
|
+
return mode === "full" ? data : { ...data, relation: data.relation === null ? null : relationSummary(data.relation) };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=work-item-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-item-output.js","sourceRoot":"","sources":["../../src/commands/work-item-output.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,WAAW,CAAC,IAAoB;IAC9C,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,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I,CAAC,CAAC;IACxG,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;AAC9F,CAAC;AACD,MAAM,UAAU,qBAAqB,CAAC,IAAa,EAAE,IAAgB,EAAE,IAAgB;IACrF,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;QAAE,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC;IAC1G,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;AACxH,CAAC"}
|
package/dist/http-origin.js
CHANGED
|
@@ -10,6 +10,9 @@ export function readBuildDefaultApiOrigin(value) {
|
|
|
10
10
|
return result.origin;
|
|
11
11
|
}
|
|
12
12
|
export function readServerFlag(arguments_) {
|
|
13
|
+
const inline = arguments_.find(value => value.startsWith("--server="));
|
|
14
|
+
if (inline !== undefined)
|
|
15
|
+
return inline.slice("--server=".length);
|
|
13
16
|
const index = arguments_.indexOf("--server");
|
|
14
17
|
const value = index === -1 ? undefined : arguments_[index + 1];
|
|
15
18
|
if (value === undefined || value.startsWith("-")) {
|
package/dist/http-origin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-origin.js","sourceRoot":"","sources":["../src/http-origin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAA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AM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommanderError, Option } from "commander";
|
|
2
2
|
import openBrowser from "open";
|
|
3
3
|
import createClient from "openapi-fetch";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import {
|
|
5
|
+
import { formatResourceDiagnostic, runCli as runResourceCli } from "./cli.js";
|
|
6
6
|
import { cliClientIdentityHeaders, detectCliClientIdentity, } from "./client-identity.js";
|
|
7
7
|
import { createCredentialStore, } from "./credential-store.js";
|
|
8
8
|
import { parseHttpOrigin, unresolvedSpecFlowApiOrigin, } from "./http-origin.js";
|
|
9
9
|
import { assertSupportedNodeVersion } from "./node-version.js";
|
|
10
10
|
import { SafeCliError } from "./safe-cli-error.js";
|
|
11
|
-
import {
|
|
11
|
+
import { specFlowCliUserAgent, withSpecFlowCliUserAgent, } from "./user-agent.js";
|
|
12
12
|
export { assertSupportedNodeVersion } from "./node-version.js";
|
|
13
13
|
const deviceAuthorizationSchema = z
|
|
14
14
|
.object({
|
|
@@ -78,9 +78,32 @@ const defaultDependencies = {
|
|
|
78
78
|
export async function runSpecFlowCli(argv, dependencies = defaultDependencies) {
|
|
79
79
|
try {
|
|
80
80
|
assertSupportedNodeVersion(dependencies.nodeVersion);
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
const args = argv.slice(2);
|
|
82
|
+
const stores = new Map();
|
|
83
|
+
let globalOptions = () => ({});
|
|
84
|
+
const store = (apiKeyId) => {
|
|
85
|
+
const slot = apiKeyId ?? "session";
|
|
86
|
+
let pending = stores.get(slot);
|
|
87
|
+
if (pending === undefined) {
|
|
88
|
+
const options = {
|
|
89
|
+
allowFileFallback: globalOptions().allowFileFallback === true,
|
|
90
|
+
serverOrigin: resolveServerOrigin(unresolvedSpecFlowApiOrigin(globalOptions().server, dependencies.environment?.SPEC_FLOW_API_URL)),
|
|
91
|
+
warning: (message) => { dependencies.stderr(formatResourceDiagnostic(message).trimEnd()); },
|
|
92
|
+
};
|
|
93
|
+
pending = apiKeyId === undefined
|
|
94
|
+
? dependencies.createCredentialStore(options)
|
|
95
|
+
: createCredentialStore({ ...options, apiKeyId });
|
|
96
|
+
stores.set(slot, pending);
|
|
97
|
+
}
|
|
98
|
+
return pending;
|
|
99
|
+
};
|
|
100
|
+
return await runResourceCli(args, {
|
|
101
|
+
environment: dependencies.environment ?? {},
|
|
102
|
+
credentialStore: { read: async () => (await store()).get(), readApiKey: async (id) => (await store(id)).get(), writeApiKey: async (id, value) => (await store(id)).set(value), deleteApiKey: async (id) => (await store(id)).delete() },
|
|
103
|
+
fetch: request => dependencies.fetch(request), open: dependencies.open,
|
|
104
|
+
stdout: value => { dependencies.stdout(value.trimEnd()); }, stderr: value => { dependencies.stderr(value.trimEnd()); },
|
|
105
|
+
registerAuthentication: (program, authentication) => { globalOptions = () => program.opts(); registerAuthenticationActions(program, authentication, dependencies); },
|
|
106
|
+
});
|
|
84
107
|
}
|
|
85
108
|
catch (error) {
|
|
86
109
|
if (error instanceof CommanderError) {
|
|
@@ -90,36 +113,35 @@ export async function runSpecFlowCli(argv, dependencies = defaultDependencies) {
|
|
|
90
113
|
return 1;
|
|
91
114
|
}
|
|
92
115
|
}
|
|
93
|
-
function
|
|
94
|
-
const program = new Command()
|
|
95
|
-
.name("specflow")
|
|
96
|
-
.description("Access SpecFlow without exposing CLI credentials")
|
|
97
|
-
.version(specFlowCliVersion)
|
|
98
|
-
.option("--server <url>", "SpecFlow server origin", unresolvedSpecFlowApiOrigin(undefined, dependencies.environment?.SPEC_FLOW_API_URL))
|
|
99
|
-
.exitOverride()
|
|
100
|
-
.configureOutput({
|
|
101
|
-
writeErr: (value) => {
|
|
102
|
-
dependencies.stderr(value.trimEnd());
|
|
103
|
-
},
|
|
104
|
-
writeOut: (value) => {
|
|
105
|
-
dependencies.stdout(value.trimEnd());
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
const authentication = addAuthenticationCommandTopology(program);
|
|
116
|
+
function registerAuthenticationActions(program, authentication, dependencies) {
|
|
109
117
|
addCredentialOption(authentication.login)
|
|
110
118
|
.addOption(new Option("--grants <json>", "Explicit grants for a restricted legacy CLI Session").hideHelp())
|
|
111
|
-
.action(async (options) =>
|
|
119
|
+
.action(async (options) => {
|
|
120
|
+
requireSessionCredentialSelection(program, dependencies);
|
|
121
|
+
await login(program, options, dependencies);
|
|
122
|
+
});
|
|
112
123
|
addCredentialOption(authentication.status)
|
|
113
|
-
.action(async (options) =>
|
|
124
|
+
.action(async (options) => {
|
|
125
|
+
requireSessionCredentialSelection(program, dependencies);
|
|
126
|
+
await status(program, options, dependencies);
|
|
127
|
+
});
|
|
114
128
|
addCredentialOption(authentication.logout)
|
|
115
|
-
.action(async (options) =>
|
|
116
|
-
|
|
129
|
+
.action(async (options) => {
|
|
130
|
+
requireSessionCredentialSelection(program, dependencies);
|
|
131
|
+
await logout(program, options, dependencies);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function requireSessionCredentialSelection(program, dependencies) {
|
|
135
|
+
const environment = dependencies.environment;
|
|
136
|
+
if (program.opts().apiKeyId !== undefined || environment?.SPEC_FLOW_API_KEY !== undefined || environment?.SPEC_FLOW_WORKSPACE_READ_TOKEN !== undefined || environment?.SPEC_FLOW_PROJECT_READ_TOKEN !== undefined) {
|
|
137
|
+
throw new SafeCliError("These commands manage CLI Sessions; clear explicit API Key/read-only Token selections. Use auth whoami for the selected User credential.");
|
|
138
|
+
}
|
|
117
139
|
}
|
|
118
140
|
function addCredentialOption(command) {
|
|
119
141
|
return command.option("--allow-file-fallback", "use a warned owner-only local credential file if the system store is unavailable");
|
|
120
142
|
}
|
|
121
143
|
async function login(program, options, dependencies) {
|
|
122
|
-
const serverOrigin = resolveServerOrigin(program.opts().server);
|
|
144
|
+
const serverOrigin = resolveServerOrigin(unresolvedSpecFlowApiOrigin(program.opts().server, dependencies.environment?.SPEC_FLOW_API_URL));
|
|
123
145
|
const authorization = deviceAuthorizationSchema.parse(await requestJson(dependencies.fetch, `${serverOrigin}/v1/auth/device/code`, {
|
|
124
146
|
body: JSON.stringify({ client_id: "specflow-cli", scope: options.grants === undefined ? "user" : `grants:${encodeURIComponent(JSON.stringify(JSON.parse(options.grants)))}` }),
|
|
125
147
|
headers: { "content-type": "application/json" },
|
|
@@ -211,7 +233,7 @@ function createCliApiClient(serverOrigin, fetch) {
|
|
|
211
233
|
});
|
|
212
234
|
}
|
|
213
235
|
async function currentCredential(program, options, dependencies) {
|
|
214
|
-
const serverOrigin = resolveServerOrigin(program.opts().server);
|
|
236
|
+
const serverOrigin = resolveServerOrigin(unresolvedSpecFlowApiOrigin(program.opts().server, dependencies.environment?.SPEC_FLOW_API_URL));
|
|
215
237
|
const store = await resolveCredentialStore(serverOrigin, options, dependencies);
|
|
216
238
|
const credential = await store.get();
|
|
217
239
|
if (credential === null) {
|