@kud/jira-cli 0.6.2 → 0.7.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
@@ -900,7 +900,7 @@ var interactiveArgs = (argv) => {
900
900
  var main = async () => {
901
901
  const { screen, mock, board, isBare } = interactiveArgs(process.argv);
902
902
  if (screen === "list" && isBare) {
903
- const { SCREENS } = await import("./tui-NYMHOUTL.js");
903
+ const { SCREENS } = await import("./tui-Y4KR7SWS.js");
904
904
  process.stdout.write(`${SCREENS.join("\n")}
905
905
  `);
906
906
  return;
@@ -910,7 +910,7 @@ var main = async () => {
910
910
  program.outputHelp();
911
911
  return;
912
912
  }
913
- const { runTui } = await import("./tui-NYMHOUTL.js");
913
+ const { runTui } = await import("./tui-Y4KR7SWS.js");
914
914
  const [, key] = (screen ?? "").split(":");
915
915
  await runTui({
916
916
  screen: screen?.startsWith("detail") ? "detail" : "issues",
@@ -9,6 +9,7 @@ import { render } from "ink";
9
9
  import { execFile } from "child_process";
10
10
  import {
11
11
  Alert,
12
+ colors,
12
13
  ConfirmInput,
13
14
  Select,
14
15
  Spinner,
@@ -20,7 +21,10 @@ import { useCallback, useEffect, useState } from "react";
20
21
  import { errorMessagesOf, isJiraApiError } from "@kud/jira";
21
22
  import {
22
23
  IssueBoard,
23
- IssueDetailView
24
+ IssueDetailView,
25
+ pendingRow,
26
+ settleRow,
27
+ transitionRow
24
28
  } from "@kud/jira-ink";
25
29
 
26
30
  // src/tui/frame.tsx
@@ -80,6 +84,9 @@ var App = ({ data, initialScreen, initialKey }) => {
80
84
  const [showingAll, setShowingAll] = useState(false);
81
85
  const [error, setError] = useState(null);
82
86
  const [busy, setBusy] = useState(null);
87
+ const [parents, setParents] = useState([]);
88
+ const [flash, setFlash] = useState(null);
89
+ const [moving, setMoving] = useState(null);
83
90
  const loadList = useCallback(
84
91
  async (all) => {
85
92
  setError(null);
@@ -87,8 +94,11 @@ var App = ({ data, initialScreen, initialKey }) => {
87
94
  setScope({ kind: "mine" });
88
95
  setSearchError(null);
89
96
  try {
90
- setModel(await data.board(all));
97
+ const next = await data.board(all);
98
+ setModel(next);
91
99
  setLoadedAt(Date.now());
100
+ void data.parents(next.rows).then(setParents).catch(() => {
101
+ });
92
102
  } catch (e) {
93
103
  setError(e instanceof Error ? e.message : String(e));
94
104
  }
@@ -114,6 +124,8 @@ var App = ({ data, initialScreen, initialKey }) => {
114
124
  try {
115
125
  const result = await data.search(query, mode);
116
126
  setModel(result.model);
127
+ void data.parents(result.model.rows).then(setParents).catch(() => {
128
+ });
117
129
  setScope({ kind: "search", query, mode: result.mode });
118
130
  setLoadedAt(Date.now());
119
131
  } catch (e) {
@@ -122,6 +134,24 @@ var App = ({ data, initialScreen, initialKey }) => {
122
134
  },
123
135
  [data]
124
136
  );
137
+ const move = useCallback(
138
+ async (key, t) => {
139
+ setFlash(null);
140
+ setMoving(key);
141
+ setModel((m) => m ? pendingRow(m, key, t.to) : m);
142
+ try {
143
+ await data.transition(key, t.id);
144
+ setModel((m) => m ? transitionRow(m, key, t.to) : m);
145
+ setIssue((i) => i && i.key === key ? { ...i, status: t.to.name } : i);
146
+ } catch (e) {
147
+ setModel((m) => m ? settleRow(m, key) : m);
148
+ setFlash(jiraMessageOf(e));
149
+ } finally {
150
+ setMoving(null);
151
+ }
152
+ },
153
+ [data]
154
+ );
125
155
  useEffect(() => {
126
156
  void data.me().then((me) => setViewer(me.displayName)).catch(() => {
127
157
  });
@@ -185,22 +215,13 @@ var App = ({ data, initialScreen, initialKey }) => {
185
215
  Select,
186
216
  {
187
217
  options: overlay.options.map((t) => ({
188
- label: `${t.name} \u2192 ${t.to}`,
218
+ label: `${t.name} \u2192 ${t.to.name}`,
189
219
  value: t.id
190
220
  })),
191
221
  onSubmit: (id) => {
222
+ const chosen = overlay.options.find((t) => t.id === id);
192
223
  setOverlay({ kind: "none" });
193
- void (async () => {
194
- setBusy("Transitioning\u2026");
195
- try {
196
- await data.transition(issue.key, id);
197
- await loadIssue(issue.key);
198
- } catch (e) {
199
- setError(e instanceof Error ? e.message : String(e));
200
- } finally {
201
- setBusy(null);
202
- }
203
- })();
224
+ void move(issue.key, chosen);
204
225
  }
205
226
  }
206
227
  ),
@@ -290,7 +311,11 @@ var App = ({ data, initialScreen, initialKey }) => {
290
311
  hints: hints.filter(([k]) => k !== "\u232B"),
291
312
  page: "nested",
292
313
  children: [
293
- /* @__PURE__ */ jsx2(Box, { paddingLeft: 2, children: /* @__PURE__ */ jsx2(Text, { dimColor: true, children: subtitle }) }),
314
+ /* @__PURE__ */ jsxs(Box, { paddingLeft: 2, children: [
315
+ /* @__PURE__ */ jsx2(Text, { dimColor: true, children: subtitle }),
316
+ moving === issue.key ? /* @__PURE__ */ jsx2(Text, { color: colors.accent, children: " \u22EF moving" }) : null
317
+ ] }),
318
+ flash ? /* @__PURE__ */ jsx2(Box, { paddingLeft: 2, children: /* @__PURE__ */ jsx2(Text, { color: colors.error, children: `\u2717 ${flash}` }) }) : null,
294
319
  /* @__PURE__ */ jsx2(
295
320
  Box,
296
321
  {
@@ -309,6 +334,7 @@ var App = ({ data, initialScreen, initialKey }) => {
309
334
  onAssign: () => setOverlay({ kind: "assign" }),
310
335
  onComment: () => setOverlay({ kind: "comment" }),
311
336
  onTransition: () => {
337
+ if (moving) return;
312
338
  void (async () => {
313
339
  setBusy("Loading transitions\u2026");
314
340
  try {
@@ -329,6 +355,7 @@ var App = ({ data, initialScreen, initialKey }) => {
329
355
  IssueBoard,
330
356
  {
331
357
  model,
358
+ parents,
332
359
  frame: ({ title, hints, body }) => /* @__PURE__ */ jsx2(
333
360
  Frame,
334
361
  {
@@ -371,27 +398,39 @@ import { searchJql } from "@kud/jira";
371
398
  import {
372
399
  boardOf,
373
400
  issueDetailOf,
374
- transitionsOf
401
+ parentsOf,
402
+ transitionsOf,
403
+ withBehind
375
404
  } from "@kud/jira-ink";
376
405
  var DEFAULT_SCOPE = "(statusCategory != Done OR (statusCategory = Done AND updated >= -14d))";
377
406
  var boardOptions = (ctx) => ({
378
407
  ...ctx.config.tabs ? { tabs: ctx.config.tabs } : {},
379
408
  ...ctx.board ?? ctx.config.defaultBoard !== void 0 ? { board: ctx.board ?? ctx.config.defaultBoard } : {}
380
409
  });
410
+ var marked = (model) => ({
411
+ ...model,
412
+ rows: withBehind(model.rows, model.tabs)
413
+ });
381
414
  var liveData = (ctx = context()) => ({
382
415
  baseUrl: ctx.config.baseUrl,
383
- board: (all) => boardOf(
384
- ctx.client,
385
- `assignee = currentUser()${all ? "" : ` AND ${DEFAULT_SCOPE}`} ORDER BY updated DESC`,
386
- boardOptions(ctx)
416
+ board: async (all) => marked(
417
+ await boardOf(
418
+ ctx.client,
419
+ `assignee = currentUser()${all ? "" : ` AND ${DEFAULT_SCOPE}`} ORDER BY updated DESC`,
420
+ boardOptions(ctx)
421
+ )
387
422
  ),
423
+ parents: (rows) => parentsOf(ctx.client, rows),
388
424
  me: async () => ({ displayName: (await ctx.client.getMe()).displayName }),
389
425
  search: async (query, mode) => {
390
426
  const { jql, mode: used } = searchJql(query, {
391
427
  mode,
392
428
  scope: "assignee = currentUser()"
393
429
  });
394
- return { model: await boardOf(ctx.client, jql, boardOptions(ctx)), mode: used };
430
+ return {
431
+ model: marked(await boardOf(ctx.client, jql, boardOptions(ctx))),
432
+ mode: used
433
+ };
395
434
  },
396
435
  getIssue: (key) => issueDetailOf(ctx.client, ctx.config.baseUrl, key),
397
436
  getTransitions: (key) => transitionsOf(ctx.client, key),
@@ -503,11 +542,25 @@ var mockData = () => ({
503
542
  }
504
543
  };
505
544
  },
545
+ // Nobody's epic is missing from the mock board, so the lookup has nothing
546
+ // to find — which is the honest answer here rather than an invented fence.
547
+ parents: async () => [],
506
548
  getIssue: async (key) => DETAIL[key] ?? fallbackDetail(key),
549
+ // The status ids match the mock board's own, so a transition here actually
550
+ // lands the row in the tab it names — a mock whose move goes nowhere cannot
551
+ // demonstrate the one thing the move is for.
507
552
  getTransitions: async () => [
508
- { id: "11", name: "Start progress", to: "In Progress" },
509
- { id: "21", name: "Ready for review", to: "In Review" },
510
- { id: "31", name: "Done", to: "Done" }
553
+ {
554
+ id: "11",
555
+ name: "Start progress",
556
+ to: { id: "10001", name: "In Progress", category: "indeterminate" }
557
+ },
558
+ {
559
+ id: "21",
560
+ name: "Ready for review",
561
+ to: { id: "10002", name: "In Review", category: "indeterminate" }
562
+ },
563
+ { id: "31", name: "Done", to: { id: "10003", name: "Done", category: "done" } }
511
564
  ],
512
565
  transition: async () => {
513
566
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/jira-cli",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "Jira on the command line — read issues, comments and attachments as plain text",
6
6
  "keywords": [
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@kud/ink-ui": "0.28.2",
41
41
  "@kud/jira": "0.4.0",
42
- "@kud/jira-ink": "0.5.0",
42
+ "@kud/jira-ink": "0.10.0",
43
43
  "commander": "14.0.1",
44
44
  "ink": "7.1.1",
45
45
  "react": "19.2.5"