@kud/jira-cli 0.8.0 → 0.9.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.
package/dist/index.js
CHANGED
|
@@ -909,7 +909,7 @@ var interactiveArgs = (argv) => {
|
|
|
909
909
|
var main = async () => {
|
|
910
910
|
const { screen, mock, board, isBare } = interactiveArgs(process.argv);
|
|
911
911
|
if (screen === "list" && isBare) {
|
|
912
|
-
const { SCREENS } = await import("./tui-
|
|
912
|
+
const { SCREENS } = await import("./tui-5ILW4QX4.js");
|
|
913
913
|
process.stdout.write(`${SCREENS.join("\n")}
|
|
914
914
|
`);
|
|
915
915
|
return;
|
|
@@ -919,7 +919,7 @@ var main = async () => {
|
|
|
919
919
|
program.outputHelp();
|
|
920
920
|
return;
|
|
921
921
|
}
|
|
922
|
-
const { runTui } = await import("./tui-
|
|
922
|
+
const { runTui } = await import("./tui-5ILW4QX4.js");
|
|
923
923
|
const [, key] = (screen ?? "").split(":");
|
|
924
924
|
await runTui({
|
|
925
925
|
screen: screen?.startsWith("detail") ? "detail" : "issues",
|
|
@@ -16,11 +16,12 @@ import {
|
|
|
16
16
|
TextInput,
|
|
17
17
|
useAppKeys
|
|
18
18
|
} from "@kud/ink-ui";
|
|
19
|
-
import { Box, Text, useApp, useInput,
|
|
19
|
+
import { Box, Text, useApp, useInput, useWindowSize } from "ink";
|
|
20
20
|
import { useCallback, useEffect, useState } from "react";
|
|
21
21
|
import { errorMessagesOf, isJiraApiError } from "@kud/jira";
|
|
22
22
|
import {
|
|
23
23
|
IssueBoard,
|
|
24
|
+
IssueBoardSkeleton,
|
|
24
25
|
IssueDetailView,
|
|
25
26
|
pendingRow,
|
|
26
27
|
settleRow,
|
|
@@ -31,8 +32,6 @@ import {
|
|
|
31
32
|
import { Page } from "@kud/ink-ui";
|
|
32
33
|
import { jsx } from "react/jsx-runtime";
|
|
33
34
|
var Frame = ({
|
|
34
|
-
width,
|
|
35
|
-
height,
|
|
36
35
|
facts,
|
|
37
36
|
count,
|
|
38
37
|
user,
|
|
@@ -41,6 +40,7 @@ var Frame = ({
|
|
|
41
40
|
hints,
|
|
42
41
|
page = "root",
|
|
43
42
|
gap = true,
|
|
43
|
+
help,
|
|
44
44
|
children
|
|
45
45
|
}) => /* @__PURE__ */ jsx(
|
|
46
46
|
Page,
|
|
@@ -55,8 +55,8 @@ var Frame = ({
|
|
|
55
55
|
hints,
|
|
56
56
|
page,
|
|
57
57
|
gap,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
help,
|
|
59
|
+
fill: true,
|
|
60
60
|
children
|
|
61
61
|
}
|
|
62
62
|
);
|
|
@@ -69,9 +69,7 @@ var MIN_WIDTH = 60;
|
|
|
69
69
|
var MIN_HEIGHT = 12;
|
|
70
70
|
var App = ({ data, initialScreen, initialKey }) => {
|
|
71
71
|
const { exit } = useApp();
|
|
72
|
-
const {
|
|
73
|
-
const width = stdout?.columns ?? 80;
|
|
74
|
-
const height = stdout?.rows ?? 24;
|
|
72
|
+
const { columns: width, rows: height } = useWindowSize();
|
|
75
73
|
const [screen, setScreen] = useState(initialScreen);
|
|
76
74
|
const [model, setModel] = useState(null);
|
|
77
75
|
const [viewer, setViewer] = useState("you");
|
|
@@ -85,22 +83,26 @@ var App = ({ data, initialScreen, initialKey }) => {
|
|
|
85
83
|
const [error, setError] = useState(null);
|
|
86
84
|
const [busy, setBusy] = useState(null);
|
|
87
85
|
const [parents, setParents] = useState([]);
|
|
86
|
+
const [tabs, setTabs] = useState(null);
|
|
87
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
88
88
|
const [flash, setFlash] = useState(null);
|
|
89
89
|
const [moving, setMoving] = useState(null);
|
|
90
90
|
const loadList = useCallback(
|
|
91
91
|
async (all) => {
|
|
92
92
|
setError(null);
|
|
93
|
-
setModel(null);
|
|
94
|
-
setScope({ kind: "mine" });
|
|
95
93
|
setSearchError(null);
|
|
94
|
+
setRefreshing(true);
|
|
96
95
|
try {
|
|
97
96
|
const next = await data.board(all);
|
|
98
97
|
setModel(next);
|
|
98
|
+
setScope({ kind: "mine" });
|
|
99
99
|
setLoadedAt(Date.now());
|
|
100
100
|
void data.parents(next.rows).then(setParents).catch(() => {
|
|
101
101
|
});
|
|
102
102
|
} catch (e) {
|
|
103
103
|
setError(e instanceof Error ? e.message : String(e));
|
|
104
|
+
} finally {
|
|
105
|
+
setRefreshing(false);
|
|
104
106
|
}
|
|
105
107
|
},
|
|
106
108
|
[data]
|
|
@@ -121,6 +123,7 @@ var App = ({ data, initialScreen, initialKey }) => {
|
|
|
121
123
|
const runSearch = useCallback(
|
|
122
124
|
async (query, mode) => {
|
|
123
125
|
setSearchError(null);
|
|
126
|
+
setRefreshing(true);
|
|
124
127
|
try {
|
|
125
128
|
const result = await data.search(query, mode);
|
|
126
129
|
setModel(result.model);
|
|
@@ -130,6 +133,8 @@ var App = ({ data, initialScreen, initialKey }) => {
|
|
|
130
133
|
setLoadedAt(Date.now());
|
|
131
134
|
} catch (e) {
|
|
132
135
|
setSearchError(jiraMessageOf(e));
|
|
136
|
+
} finally {
|
|
137
|
+
setRefreshing(false);
|
|
133
138
|
}
|
|
134
139
|
},
|
|
135
140
|
[data]
|
|
@@ -156,6 +161,16 @@ var App = ({ data, initialScreen, initialKey }) => {
|
|
|
156
161
|
void data.me().then((me) => setViewer(me.displayName)).catch(() => {
|
|
157
162
|
});
|
|
158
163
|
}, [data]);
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
let cancelled = false;
|
|
166
|
+
data.tabs().then((t) => {
|
|
167
|
+
if (!cancelled) setTabs(t);
|
|
168
|
+
}).catch(() => {
|
|
169
|
+
});
|
|
170
|
+
return () => {
|
|
171
|
+
cancelled = true;
|
|
172
|
+
};
|
|
173
|
+
}, [data]);
|
|
159
174
|
useEffect(() => {
|
|
160
175
|
if (initialScreen === "detail" && initialKey) void loadIssue(initialKey);
|
|
161
176
|
else void loadList(false);
|
|
@@ -196,7 +211,7 @@ var App = ({ data, initialScreen, initialKey }) => {
|
|
|
196
211
|
"."
|
|
197
212
|
] });
|
|
198
213
|
}
|
|
199
|
-
const framed = (facts, body, hints, page = screen === "detail" ? "nested" : "root") => /* @__PURE__ */ jsx2(Frame, {
|
|
214
|
+
const framed = (facts, body, hints, page = screen === "detail" ? "nested" : "root") => /* @__PURE__ */ jsx2(Frame, { facts, hints, page, children: /* @__PURE__ */ jsx2(Box, { flexDirection: "column", marginTop: 1, paddingLeft: 2, flexGrow: 1, children: body }) });
|
|
200
215
|
if (error)
|
|
201
216
|
return framed("error", /* @__PURE__ */ jsx2(Alert, { variant: "error", children: error }), [
|
|
202
217
|
["r", "retry"]
|
|
@@ -302,33 +317,23 @@ var App = ({ data, initialScreen, initialKey }) => {
|
|
|
302
317
|
issue,
|
|
303
318
|
width,
|
|
304
319
|
height: height - FRAME_CHROME - DETAIL_CHROME,
|
|
305
|
-
frame: ({ title, subtitle, hints, body }) => /* @__PURE__ */ jsxs(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
flexDirection: "column",
|
|
323
|
-
marginTop: 1,
|
|
324
|
-
paddingLeft: 2,
|
|
325
|
-
flexGrow: 1,
|
|
326
|
-
children: body
|
|
327
|
-
}
|
|
328
|
-
)
|
|
329
|
-
]
|
|
330
|
-
}
|
|
331
|
-
),
|
|
320
|
+
frame: ({ title, subtitle, hints, body }) => /* @__PURE__ */ jsxs(Frame, { scope: title, hints: hints.filter(([k]) => k !== "\u232B"), page: "nested", children: [
|
|
321
|
+
/* @__PURE__ */ jsxs(Box, { paddingLeft: 2, children: [
|
|
322
|
+
/* @__PURE__ */ jsx2(Text, { dimColor: true, children: subtitle }),
|
|
323
|
+
moving === issue.key ? /* @__PURE__ */ jsx2(Text, { color: colors.accent, children: " \u22EF moving" }) : null
|
|
324
|
+
] }),
|
|
325
|
+
flash ? /* @__PURE__ */ jsx2(Box, { paddingLeft: 2, children: /* @__PURE__ */ jsx2(Text, { color: colors.error, children: `\u2717 ${flash}` }) }) : null,
|
|
326
|
+
/* @__PURE__ */ jsx2(
|
|
327
|
+
Box,
|
|
328
|
+
{
|
|
329
|
+
flexDirection: "column",
|
|
330
|
+
marginTop: 1,
|
|
331
|
+
paddingLeft: 2,
|
|
332
|
+
flexGrow: 1,
|
|
333
|
+
children: body
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
] }),
|
|
332
337
|
onBack: () => setScreen("issues"),
|
|
333
338
|
onOpenBrowser: () => execFile(opener(), [issue.url]),
|
|
334
339
|
onAssign: () => setOverlay({ kind: "assign" }),
|
|
@@ -350,33 +355,45 @@ var App = ({ data, initialScreen, initialKey }) => {
|
|
|
350
355
|
}
|
|
351
356
|
);
|
|
352
357
|
}
|
|
353
|
-
|
|
358
|
+
const boardHeight = height - (FRAME_CHROME - 1) - 1;
|
|
359
|
+
const boardFrame = (help) => ({ title, hints, body }) => /* @__PURE__ */ jsx2(
|
|
360
|
+
Frame,
|
|
361
|
+
{
|
|
362
|
+
count: title.count ?? void 0,
|
|
363
|
+
user: title.user,
|
|
364
|
+
scope: title.scope,
|
|
365
|
+
status: refreshing && model ? { text: "\u21BB refreshing\u2026", tone: "busy" } : title.status,
|
|
366
|
+
hints,
|
|
367
|
+
gap: false,
|
|
368
|
+
help,
|
|
369
|
+
children: body
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
if (!model) {
|
|
373
|
+
if (!tabs) return framed("loading\u2026", /* @__PURE__ */ jsx2(Spinner, { label: "Loading issues\u2026" }));
|
|
374
|
+
return /* @__PURE__ */ jsx2(
|
|
375
|
+
IssueBoardSkeleton,
|
|
376
|
+
{
|
|
377
|
+
tabs,
|
|
378
|
+
width,
|
|
379
|
+
height: boardHeight,
|
|
380
|
+
frame: boardFrame(false)
|
|
381
|
+
}
|
|
382
|
+
);
|
|
383
|
+
}
|
|
354
384
|
return /* @__PURE__ */ jsx2(
|
|
355
385
|
IssueBoard,
|
|
356
386
|
{
|
|
357
387
|
model,
|
|
358
388
|
parents,
|
|
359
|
-
frame: (
|
|
360
|
-
Frame,
|
|
361
|
-
{
|
|
362
|
-
width,
|
|
363
|
-
height,
|
|
364
|
-
count: title.count,
|
|
365
|
-
user: title.user,
|
|
366
|
-
scope: title.scope,
|
|
367
|
-
status: title.status,
|
|
368
|
-
hints,
|
|
369
|
-
gap: false,
|
|
370
|
-
children: body
|
|
371
|
-
}
|
|
372
|
-
),
|
|
389
|
+
frame: boardFrame(),
|
|
373
390
|
onInputFocus: setInputFocused,
|
|
374
391
|
viewer,
|
|
375
392
|
loadedAt,
|
|
376
393
|
scope,
|
|
377
394
|
searchError,
|
|
378
395
|
width,
|
|
379
|
-
height:
|
|
396
|
+
height: boardHeight,
|
|
380
397
|
showingAll,
|
|
381
398
|
onOpen: (key) => void loadIssue(key),
|
|
382
399
|
onRefresh: () => void (scope.kind === "search" ? runSearch(scope.query, scope.mode) : loadList(showingAll)),
|
|
@@ -399,6 +416,9 @@ import {
|
|
|
399
416
|
boardOf,
|
|
400
417
|
issueDetailOf,
|
|
401
418
|
parentsOf,
|
|
419
|
+
tabsFromBoard,
|
|
420
|
+
tabsFromConfig,
|
|
421
|
+
tabsFromCategories,
|
|
402
422
|
transitionsOf,
|
|
403
423
|
withBehind
|
|
404
424
|
} from "@kud/jira-ink";
|
|
@@ -407,6 +427,13 @@ var boardOptions = (ctx) => ({
|
|
|
407
427
|
...ctx.config.tabs ? { tabs: ctx.config.tabs } : {},
|
|
408
428
|
...ctx.board ?? ctx.config.defaultBoard !== void 0 ? { board: ctx.board ?? ctx.config.defaultBoard } : {}
|
|
409
429
|
});
|
|
430
|
+
var tabsOf = async (ctx) => {
|
|
431
|
+
const { tabs, board } = boardOptions(ctx);
|
|
432
|
+
if (tabs?.length) return tabsFromConfig(tabs);
|
|
433
|
+
if (board === void 0) return tabsFromCategories();
|
|
434
|
+
const configuration = await ctx.client.getBoardConfiguration(board);
|
|
435
|
+
return tabsFromBoard(configuration) ?? tabsFromCategories();
|
|
436
|
+
};
|
|
410
437
|
var marked = (model) => ({
|
|
411
438
|
...model,
|
|
412
439
|
rows: withBehind(model.rows, model.tabs)
|
|
@@ -420,6 +447,7 @@ var liveData = (ctx = context()) => ({
|
|
|
420
447
|
boardOptions(ctx)
|
|
421
448
|
)
|
|
422
449
|
),
|
|
450
|
+
tabs: () => tabsOf(ctx),
|
|
423
451
|
parents: (rows) => parentsOf(ctx.client, rows),
|
|
424
452
|
me: async () => ({ displayName: (await ctx.client.getMe()).displayName }),
|
|
425
453
|
search: async (query, mode) => {
|
|
@@ -527,6 +555,7 @@ var fallbackDetail = (key) => {
|
|
|
527
555
|
var mockData = () => ({
|
|
528
556
|
baseUrl: "https://example.atlassian.net",
|
|
529
557
|
board: async () => mockBoard(),
|
|
558
|
+
tabs: async () => mockBoard().tabs,
|
|
530
559
|
me: async () => ({ displayName: "Ada Okafor" }),
|
|
531
560
|
search: async (query, mode) => {
|
|
532
561
|
const used = mode === "jql" || mode === "auto" && looksLikeJql(query) ? "jql" : "text";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/jira-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Jira on the command line — read issues, comments and attachments as plain text",
|
|
6
6
|
"keywords": [
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"prepublishOnly": "npm run build"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@kud/ink-ui": "0.
|
|
40
|
+
"@kud/ink-ui": "0.32.0",
|
|
41
41
|
"@kud/jira": "0.4.0",
|
|
42
|
-
"@kud/jira-ink": "0.
|
|
42
|
+
"@kud/jira-ink": "0.11.0",
|
|
43
43
|
"commander": "14.0.1",
|
|
44
44
|
"ink": "7.1.1",
|
|
45
45
|
"react": "19.2.5"
|