@kud/jira-cli 0.5.2 → 0.6.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/README.md CHANGED
@@ -49,7 +49,7 @@ Run `jira` with no arguments:
49
49
  jira
50
50
  ```
51
51
 
52
- Your issues as a board: three tabs — **To do**, **In progress**, **Done** — filed by Jira's status *category*, so it works on any instance without knowing what your board calls its columns. Rows hang under their epic, carry a type pill, a priority glyph (`▲` high, `▼` low) and how long since they last moved. Closed work from the last fortnight is on the Done tab; `a` loads everything.
52
+ Your issues as a board. By default the tabs are Jira's three status *categories* — **To do**, **In progress**, **Done** — so it works on any instance without knowing what your board calls its columns. Pass `--board <id>` (or set `defaultBoard` in the config file) and the tabs become that board's own columns, matched by status id; statuses no column claims land on an **Off board** tab. Hand-written `tabs` in the config file win over both. Rows hang under their epic, carry a type pill, a priority glyph (`▲` high, `▼` low) and how long since they last moved. Closed work from the last fortnight is on the Done tab; `a` loads everything.
53
53
 
54
54
  `↑↓` to move, `←→` (or `⇥`) to switch tab, `enter` to open, `?` for the legend, `r` to refresh, `q` to quit.
55
55
 
@@ -61,60 +61,11 @@ var printJson = (value) => {
61
61
  `);
62
62
  };
63
63
 
64
- // src/jql.ts
65
- var jqlEscape = (value) => `"${value.replace(/"/g, '\\"')}"`;
66
- var buildJql = (options, defaultProject) => {
67
- if (options.jql) return options.jql;
68
- const clauses = [];
69
- if (options.mine) clauses.push("assignee = currentUser()");
70
- else if (options.assignee)
71
- clauses.push(
72
- options.assignee === "none" ? "assignee IS EMPTY" : `assignee = ${jqlEscape(options.assignee)}`
73
- );
74
- const project = options.project ?? defaultProject;
75
- if (project) clauses.push(`project = ${jqlEscape(project)}`);
76
- if (options.status) clauses.push(`status = ${jqlEscape(options.status)}`);
77
- if (options.label) clauses.push(`labels = ${jqlEscape(options.label)}`);
78
- if (options.sprint)
79
- clauses.push(
80
- options.sprint === "current" ? "sprint IN openSprints()" : `sprint = ${jqlEscape(options.sprint)}`
81
- );
82
- if (clauses.length === 0) clauses.push("assignee = currentUser()");
83
- return `${clauses.join(" AND ")} ORDER BY updated DESC`;
84
- };
85
- var WORD_OPS = [
86
- String.raw`\s+(not\s+)?in\s*\(`,
87
- String.raw`\s+is\s+(not\s+)?(empty|null)\b`,
88
- String.raw`\s+was\s+(not\s+)?(in\s*\(|"|'|empty|null)`,
89
- String.raw`\s+changed\s*(by|after|before|during|on|from|to|$)`
90
- ].join("|");
91
- var JQL_SHAPE = new RegExp(
92
- String.raw`^\(?\s*(not\s+)?\(?\s*[\w.\-[\]"]+\s*(=|!=|~|!~|<=|>=|<|>|` + WORD_OPS + ")",
93
- "i"
94
- );
95
- var ORDER_ONLY = /^order\s+by\s/i;
96
- var looksLikeJql = (input) => {
97
- const s = input.trim();
98
- return JQL_SHAPE.test(s) || ORDER_ONLY.test(s);
99
- };
100
- var LUCENE_SPECIALS = /([+\-&|!(){}[\]^~*?:\\])/g;
101
- var textClause = (words) => `text ~ ${jqlEscape(words.replace(LUCENE_SPECIALS, "\\$1"))}`;
102
- var searchJql = (input, { mode = "auto", scope } = {}) => {
103
- const trimmed = input.trim();
104
- const isJql = mode === "jql" || mode === "auto" && looksLikeJql(trimmed);
105
- if (isJql) return { jql: trimmed, mode: "jql" };
106
- const clauses = [scope, textClause(trimmed)].filter(Boolean);
107
- return { jql: `${clauses.join(" AND ")} ORDER BY updated DESC`, mode: "text" };
108
- };
109
-
110
64
  export {
111
65
  table,
112
66
  truncate,
113
67
  exitError,
114
68
  isExitError,
115
69
  context,
116
- printJson,
117
- buildJql,
118
- looksLikeJql,
119
- searchJql
70
+ printJson
120
71
  };
package/dist/index.js CHANGED
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- buildJql,
4
3
  context,
5
4
  exitError,
6
5
  isExitError,
7
6
  printJson,
8
7
  table,
9
8
  truncate
10
- } from "./chunk-QEOE2RPV.js";
9
+ } from "./chunk-RTBMVYZM.js";
11
10
 
12
11
  // src/index.ts
13
12
  import { realpathSync } from "fs";
@@ -390,6 +389,9 @@ var registerIssueWriteCommands = (issue) => {
390
389
  };
391
390
 
392
391
  // src/commands/issue.ts
392
+ import {
393
+ buildJql
394
+ } from "@kud/jira";
393
395
  var issueColumns = (ctx) => [
394
396
  { header: "KEY", value: (i) => i.key },
395
397
  { header: "STATUS", value: (i) => i.fields.status?.name ?? "\u2014" },
@@ -873,7 +875,16 @@ var interactiveArgs = (argv) => {
873
875
  const inlineAt = rest.findIndex((a) => a.startsWith("--screen="));
874
876
  const spacedAt = rest.indexOf("--screen");
875
877
  const screen = inlineAt !== -1 ? rest[inlineAt]?.slice("--screen=".length) : spacedAt === -1 ? void 0 : rest[spacedAt + 1];
878
+ const boardInline = rest.findIndex((a) => a.startsWith("--board="));
879
+ const boardSpaced = rest.indexOf("--board");
880
+ const boardRaw = boardInline !== -1 ? rest[boardInline]?.slice("--board=".length) : boardSpaced === -1 ? void 0 : rest[boardSpaced + 1];
881
+ const board = boardRaw !== void 0 ? Number(boardRaw) : void 0;
876
882
  const consumed = /* @__PURE__ */ new Set(["--mock"]);
883
+ if (boardInline !== -1) consumed.add(rest[boardInline]);
884
+ if (boardSpaced !== -1) {
885
+ consumed.add("--board");
886
+ consumed.add(rest[boardSpaced + 1] ?? "");
887
+ }
877
888
  if (inlineAt !== -1) consumed.add(rest[inlineAt]);
878
889
  if (spacedAt !== -1) {
879
890
  consumed.add("--screen");
@@ -882,13 +893,14 @@ var interactiveArgs = (argv) => {
882
893
  return {
883
894
  screen,
884
895
  mock: rest.includes("--mock"),
896
+ ...board !== void 0 && !Number.isNaN(board) ? { board } : {},
885
897
  isBare: rest.every((a) => consumed.has(a))
886
898
  };
887
899
  };
888
900
  var main = async () => {
889
- const { screen, mock, isBare } = interactiveArgs(process.argv);
901
+ const { screen, mock, board, isBare } = interactiveArgs(process.argv);
890
902
  if (screen === "list" && isBare) {
891
- const { SCREENS } = await import("./tui-XQKRS4AW.js");
903
+ const { SCREENS } = await import("./tui-V2HHFJ2H.js");
892
904
  process.stdout.write(`${SCREENS.join("\n")}
893
905
  `);
894
906
  return;
@@ -898,12 +910,13 @@ var main = async () => {
898
910
  program.outputHelp();
899
911
  return;
900
912
  }
901
- const { runTui } = await import("./tui-XQKRS4AW.js");
913
+ const { runTui } = await import("./tui-V2HHFJ2H.js");
902
914
  const [, key] = (screen ?? "").split(":");
903
915
  await runTui({
904
916
  screen: screen?.startsWith("detail") ? "detail" : "issues",
905
917
  mock,
906
- ...key ? { issueKey: key } : {}
918
+ ...key ? { issueKey: key } : {},
919
+ ...board !== void 0 ? { board } : {}
907
920
  });
908
921
  return;
909
922
  }
@@ -0,0 +1,481 @@
1
+ import {
2
+ context
3
+ } from "./chunk-RTBMVYZM.js";
4
+
5
+ // src/tui/index.tsx
6
+ import { render } from "ink";
7
+
8
+ // src/tui/app.tsx
9
+ import { execFile } from "child_process";
10
+ import {
11
+ Alert,
12
+ ConfirmInput,
13
+ Select,
14
+ Spinner,
15
+ TextInput
16
+ } from "@kud/ink-ui";
17
+ import { Box as Box2, Text as Text2, useApp, useInput, useStdout } from "ink";
18
+ import { useCallback, useEffect, useState } from "react";
19
+ import { errorMessagesOf, isJiraApiError } from "@kud/jira";
20
+ import {
21
+ IssueBoard,
22
+ IssueDetailView
23
+ } from "@kud/jira-ink";
24
+
25
+ // src/tui/frame.tsx
26
+ import { FooterHints, Panel } from "@kud/ink-ui";
27
+ import { Box, Text } from "ink";
28
+ import { jsx, jsxs } from "react/jsx-runtime";
29
+ var Frame = ({ width, height, facts, hints, children }) => /* @__PURE__ */ jsxs(Panel, { width, height, children: [
30
+ /* @__PURE__ */ jsxs(Box, { paddingLeft: 1, children: [
31
+ /* @__PURE__ */ jsx(Text, { bold: true, children: "\u{1F3AB} Jira" }),
32
+ /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
33
+ " ",
34
+ facts
35
+ ] })
36
+ ] }),
37
+ /* @__PURE__ */ jsx(Box, { flexDirection: "column", flexGrow: 1, children }),
38
+ hints ? /* @__PURE__ */ jsx(Box, { paddingLeft: 2, children: /* @__PURE__ */ jsx(FooterHints, { hints }) }) : null
39
+ ] });
40
+ var FRAME_CHROME = 3;
41
+
42
+ // src/tui/app.tsx
43
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
44
+ var DETAIL_CHROME = 4;
45
+ var MIN_WIDTH = 60;
46
+ var MIN_HEIGHT = 12;
47
+ var App = ({ data, initialScreen, initialKey }) => {
48
+ const { exit } = useApp();
49
+ const { stdout } = useStdout();
50
+ const width = stdout?.columns ?? 80;
51
+ const height = stdout?.rows ?? 24;
52
+ const [screen, setScreen] = useState(initialScreen);
53
+ const [model, setModel] = useState(null);
54
+ const [viewer, setViewer] = useState("you");
55
+ const [loadedAt, setLoadedAt] = useState(Date.now);
56
+ const [scope, setScope] = useState({ kind: "mine" });
57
+ const [searchError, setSearchError] = useState(null);
58
+ const [issue, setIssue] = useState(null);
59
+ const [overlay, setOverlay] = useState({ kind: "none" });
60
+ const [showingAll, setShowingAll] = useState(false);
61
+ const [error, setError] = useState(null);
62
+ const [busy, setBusy] = useState(null);
63
+ const loadList = useCallback(
64
+ async (all) => {
65
+ setError(null);
66
+ setModel(null);
67
+ setScope({ kind: "mine" });
68
+ setSearchError(null);
69
+ try {
70
+ setModel(await data.board(all));
71
+ setLoadedAt(Date.now());
72
+ } catch (e) {
73
+ setError(e instanceof Error ? e.message : String(e));
74
+ }
75
+ },
76
+ [data]
77
+ );
78
+ const loadIssue = useCallback(
79
+ async (key) => {
80
+ setError(null);
81
+ setIssue(null);
82
+ setScreen("detail");
83
+ try {
84
+ setIssue(await data.getIssue(key));
85
+ } catch (e) {
86
+ setError(e instanceof Error ? e.message : String(e));
87
+ }
88
+ },
89
+ [data]
90
+ );
91
+ const runSearch = useCallback(
92
+ async (query, mode) => {
93
+ setSearchError(null);
94
+ try {
95
+ const result = await data.search(query, mode);
96
+ setModel(result.model);
97
+ setScope({ kind: "search", query, mode: result.mode });
98
+ setLoadedAt(Date.now());
99
+ } catch (e) {
100
+ setSearchError(jiraMessageOf(e));
101
+ }
102
+ },
103
+ [data]
104
+ );
105
+ useEffect(() => {
106
+ void data.me().then((me) => setViewer(me.displayName)).catch(() => {
107
+ });
108
+ }, [data]);
109
+ useEffect(() => {
110
+ if (initialScreen === "detail" && initialKey) void loadIssue(initialKey);
111
+ else void loadList(false);
112
+ }, [initialScreen, initialKey, loadIssue, loadList]);
113
+ useInput((input, key) => {
114
+ if (overlay.kind !== "none") return;
115
+ if (input === "q" || key.ctrl && input === "c") exit();
116
+ if (error && input === "r") {
117
+ if (screen === "issues") void loadList(showingAll);
118
+ else if (issue) void loadIssue(issue.key);
119
+ }
120
+ });
121
+ if (width < MIN_WIDTH || height < MIN_HEIGHT) {
122
+ return /* @__PURE__ */ jsxs2(Text2, { children: [
123
+ "Terminal too small \u2014 needs at least ",
124
+ MIN_WIDTH,
125
+ "\xD7",
126
+ MIN_HEIGHT,
127
+ ", this is",
128
+ " ",
129
+ width,
130
+ "\xD7",
131
+ height,
132
+ "."
133
+ ] });
134
+ }
135
+ const framed = (facts, body, hints) => /* @__PURE__ */ jsx2(Frame, { width, height, facts, hints, children: /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", marginTop: 1, paddingLeft: 2, flexGrow: 1, children: body }) });
136
+ if (error)
137
+ return framed("error", /* @__PURE__ */ jsx2(Alert, { variant: "error", children: error }), [
138
+ ["r", "retry"],
139
+ ["q", "quit"]
140
+ ]);
141
+ if (busy) return framed("working\u2026", /* @__PURE__ */ jsx2(Spinner, { label: busy }));
142
+ if (overlay.kind === "transition") {
143
+ return framed(
144
+ issue?.key ?? "",
145
+ /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", gap: 1, children: [
146
+ /* @__PURE__ */ jsxs2(Text2, { bold: true, children: [
147
+ "Move ",
148
+ issue?.key,
149
+ " to\u2026"
150
+ ] }),
151
+ /* @__PURE__ */ jsx2(
152
+ Select,
153
+ {
154
+ options: overlay.options.map((t) => ({
155
+ label: `${t.name} \u2192 ${t.to}`,
156
+ value: t.id
157
+ })),
158
+ onSubmit: (id) => {
159
+ setOverlay({ kind: "none" });
160
+ void (async () => {
161
+ setBusy("Transitioning\u2026");
162
+ try {
163
+ await data.transition(issue.key, id);
164
+ await loadIssue(issue.key);
165
+ } catch (e) {
166
+ setError(e instanceof Error ? e.message : String(e));
167
+ } finally {
168
+ setBusy(null);
169
+ }
170
+ })();
171
+ }
172
+ }
173
+ ),
174
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "esc cancel" })
175
+ ] })
176
+ );
177
+ }
178
+ if (overlay.kind === "comment") {
179
+ return framed(
180
+ issue?.key ?? "",
181
+ /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", gap: 1, children: [
182
+ /* @__PURE__ */ jsxs2(Text2, { bold: true, children: [
183
+ "Comment on ",
184
+ issue?.key
185
+ ] }),
186
+ /* @__PURE__ */ jsx2(
187
+ TextInput,
188
+ {
189
+ placeholder: "Markdown is supported\u2026",
190
+ onSubmit: (body) => {
191
+ setOverlay({ kind: "none" });
192
+ if (!body.trim()) return;
193
+ void (async () => {
194
+ setBusy("Posting\u2026");
195
+ try {
196
+ await data.comment(issue.key, body);
197
+ await loadIssue(issue.key);
198
+ } catch (e) {
199
+ setError(e instanceof Error ? e.message : String(e));
200
+ } finally {
201
+ setBusy(null);
202
+ }
203
+ })();
204
+ }
205
+ }
206
+ )
207
+ ] })
208
+ );
209
+ }
210
+ if (overlay.kind === "assign") {
211
+ return framed(
212
+ issue?.key ?? "",
213
+ /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", gap: 1, children: [
214
+ /* @__PURE__ */ jsxs2(Text2, { children: [
215
+ "Assign ",
216
+ issue?.key,
217
+ " to yourself?"
218
+ ] }),
219
+ /* @__PURE__ */ jsx2(
220
+ ConfirmInput,
221
+ {
222
+ onCancel: () => setOverlay({ kind: "none" }),
223
+ onConfirm: () => {
224
+ setOverlay({ kind: "none" });
225
+ void (async () => {
226
+ setBusy("Assigning\u2026");
227
+ try {
228
+ await data.assignToMe(issue.key);
229
+ await loadIssue(issue.key);
230
+ } catch (e) {
231
+ setError(e instanceof Error ? e.message : String(e));
232
+ } finally {
233
+ setBusy(null);
234
+ }
235
+ })();
236
+ }
237
+ }
238
+ )
239
+ ] })
240
+ );
241
+ }
242
+ if (screen === "detail") {
243
+ if (!issue) return framed("loading\u2026", /* @__PURE__ */ jsx2(Spinner, { label: "Loading issue\u2026" }));
244
+ return /* @__PURE__ */ jsx2(
245
+ IssueDetailView,
246
+ {
247
+ issue,
248
+ width,
249
+ height: height - FRAME_CHROME - DETAIL_CHROME,
250
+ frame: ({ title, subtitle, hints, body }) => /* @__PURE__ */ jsxs2(Frame, { width, height, facts: title, hints, children: [
251
+ /* @__PURE__ */ jsx2(Box2, { paddingLeft: 2, marginTop: 1, children: /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: subtitle }) }),
252
+ /* @__PURE__ */ jsx2(
253
+ Box2,
254
+ {
255
+ flexDirection: "column",
256
+ marginTop: 1,
257
+ paddingLeft: 2,
258
+ flexGrow: 1,
259
+ children: body
260
+ }
261
+ )
262
+ ] }),
263
+ onBack: () => setScreen("issues"),
264
+ onOpenBrowser: () => execFile(opener(), [issue.url]),
265
+ onAssign: () => setOverlay({ kind: "assign" }),
266
+ onComment: () => setOverlay({ kind: "comment" }),
267
+ onTransition: () => {
268
+ void (async () => {
269
+ setBusy("Loading transitions\u2026");
270
+ try {
271
+ const options = await data.getTransitions(issue.key);
272
+ setOverlay({ kind: "transition", options });
273
+ } catch (e) {
274
+ setError(e instanceof Error ? e.message : String(e));
275
+ } finally {
276
+ setBusy(null);
277
+ }
278
+ })();
279
+ }
280
+ }
281
+ );
282
+ }
283
+ if (!model) return framed("loading\u2026", /* @__PURE__ */ jsx2(Spinner, { label: "Loading issues\u2026" }));
284
+ return /* @__PURE__ */ jsx2(
285
+ IssueBoard,
286
+ {
287
+ model,
288
+ frame: ({ facts, hints, body }) => /* @__PURE__ */ jsx2(Frame, { width, height, facts, hints, children: body }),
289
+ viewer,
290
+ loadedAt,
291
+ scope,
292
+ searchError,
293
+ width,
294
+ height: height - FRAME_CHROME - 1,
295
+ showingAll,
296
+ onOpen: (key) => void loadIssue(key),
297
+ onRefresh: () => void (scope.kind === "search" ? runSearch(scope.query, scope.mode) : loadList(showingAll)),
298
+ onSearch: (query, mode) => void runSearch(query, mode),
299
+ onClearSearch: () => void loadList(showingAll),
300
+ onToggleAll: () => {
301
+ const next = !showingAll;
302
+ setShowingAll(next);
303
+ void loadList(next);
304
+ }
305
+ }
306
+ );
307
+ };
308
+ var jiraMessageOf = (e) => isJiraApiError(e) && (e.status === 401 || e.status === 403) ? `Jira refused the request (${e.status}) \u2014 check your token.` : errorMessagesOf(e).join(" ");
309
+ var opener = () => process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
310
+
311
+ // src/tui/data.ts
312
+ import { searchJql } from "@kud/jira";
313
+ import {
314
+ boardOf,
315
+ issueDetailOf,
316
+ transitionsOf
317
+ } from "@kud/jira-ink";
318
+ var DEFAULT_SCOPE = "(statusCategory != Done OR (statusCategory = Done AND updated >= -14d))";
319
+ var boardOptions = (ctx) => ({
320
+ ...ctx.config.tabs ? { tabs: ctx.config.tabs } : {},
321
+ ...ctx.board ?? ctx.config.defaultBoard !== void 0 ? { board: ctx.board ?? ctx.config.defaultBoard } : {}
322
+ });
323
+ var liveData = (ctx = context()) => ({
324
+ baseUrl: ctx.config.baseUrl,
325
+ board: (all) => boardOf(
326
+ ctx.client,
327
+ `assignee = currentUser()${all ? "" : ` AND ${DEFAULT_SCOPE}`} ORDER BY updated DESC`,
328
+ boardOptions(ctx)
329
+ ),
330
+ me: async () => ({ displayName: (await ctx.client.getMe()).displayName }),
331
+ search: async (query, mode) => {
332
+ const { jql, mode: used } = searchJql(query, {
333
+ mode,
334
+ scope: "assignee = currentUser()"
335
+ });
336
+ return { model: await boardOf(ctx.client, jql, boardOptions(ctx)), mode: used };
337
+ },
338
+ getIssue: (key) => issueDetailOf(ctx.client, ctx.config.baseUrl, key),
339
+ getTransitions: (key) => transitionsOf(ctx.client, key),
340
+ transition: (key, transitionId) => ctx.client.transitionIssue(key, transitionId),
341
+ comment: async (key, body) => {
342
+ const { markdownToAdf } = await import("@kud/jira");
343
+ await ctx.client.addComment(key, markdownToAdf(body));
344
+ },
345
+ assignToMe: async (key) => {
346
+ const me = await ctx.client.getMe();
347
+ await ctx.client.assignIssue(key, me.accountId);
348
+ }
349
+ });
350
+
351
+ // src/tui/mock.ts
352
+ import { looksLikeJql } from "@kud/jira";
353
+ import { MOCK_BOARD_ROWS, mockBoard } from "@kud/jira-ink";
354
+ var ROWS = MOCK_BOARD_ROWS;
355
+ var DETAIL = {
356
+ "SHOP-412": {
357
+ key: "SHOP-412",
358
+ summary: "Checkout total ignores the discount on the last item",
359
+ status: "In Progress",
360
+ type: "Bug",
361
+ assignee: "Ada Okafor",
362
+ reporter: "Bram Nilsen",
363
+ labels: ["checkout", "regression"],
364
+ parent: { key: "SHOP-300", summary: "Basket and checkout correctness" },
365
+ url: "https://example.atlassian.net/browse/SHOP-412",
366
+ description: [
367
+ "## What happens",
368
+ "",
369
+ "The basket total is correct until the **last** line item, whose discount is",
370
+ "dropped from the sum.",
371
+ "",
372
+ "```js",
373
+ "const total = items.slice(0, -1).reduce(withDiscount, 0)",
374
+ "```",
375
+ "",
376
+ "1. Add three items",
377
+ "2. Apply `SUMMER20`",
378
+ "3. Compare the total against the line items",
379
+ "",
380
+ "[attachment: basket.png]"
381
+ ].join("\n"),
382
+ comments: [
383
+ {
384
+ id: "c1",
385
+ author: "Bram Nilsen",
386
+ created: "2026-08-13",
387
+ body: "Reproduced on staging. Screenshot attached.\n\n[attachment: basket.png]"
388
+ },
389
+ {
390
+ id: "c2",
391
+ author: "Ada Okafor",
392
+ created: "2026-08-14",
393
+ body: "Off-by-one in `slice(0, -1)`. Fix and a regression test on the way."
394
+ }
395
+ ],
396
+ attachments: [
397
+ {
398
+ id: "9001",
399
+ filename: "basket.png",
400
+ mimeType: "image/png",
401
+ size: 48213,
402
+ origins: [{ kind: "comment", commentId: "c1", author: "Bram Nilsen" }]
403
+ },
404
+ {
405
+ id: "9002",
406
+ filename: "checkout.log",
407
+ mimeType: "text/plain",
408
+ size: 2044,
409
+ origins: [{ kind: "issue" }]
410
+ }
411
+ ]
412
+ }
413
+ };
414
+ var fallbackDetail = (key) => {
415
+ const row = ROWS.find((r) => r.key === key) ?? ROWS[0];
416
+ return {
417
+ key: row.key,
418
+ summary: row.summary,
419
+ status: row.status,
420
+ type: row.type,
421
+ assignee: row.assignee,
422
+ reporter: "Bram Nilsen",
423
+ labels: [],
424
+ url: `https://example.atlassian.net/browse/${row.key}`,
425
+ description: "_No description._",
426
+ comments: [],
427
+ attachments: []
428
+ };
429
+ };
430
+ var mockData = () => ({
431
+ baseUrl: "https://example.atlassian.net",
432
+ board: async () => mockBoard(),
433
+ me: async () => ({ displayName: "Ada Okafor" }),
434
+ search: async (query, mode) => {
435
+ const used = mode === "jql" || mode === "auto" && looksLikeJql(query) ? "jql" : "text";
436
+ const words = query.toLowerCase();
437
+ const model = mockBoard();
438
+ return {
439
+ mode: used,
440
+ model: used === "jql" ? model : {
441
+ ...model,
442
+ rows: ROWS.filter(
443
+ (r) => `${r.key} ${r.summary}`.toLowerCase().includes(words)
444
+ )
445
+ }
446
+ };
447
+ },
448
+ getIssue: async (key) => DETAIL[key] ?? fallbackDetail(key),
449
+ getTransitions: async () => [
450
+ { id: "11", name: "Start progress", to: "In Progress" },
451
+ { id: "21", name: "Ready for review", to: "In Review" },
452
+ { id: "31", name: "Done", to: "Done" }
453
+ ],
454
+ transition: async () => {
455
+ },
456
+ comment: async () => {
457
+ },
458
+ assignToMe: async () => {
459
+ }
460
+ });
461
+
462
+ // src/tui/index.tsx
463
+ import { jsx as jsx3 } from "react/jsx-runtime";
464
+ var SCREENS = ["issues", "detail"];
465
+ var runTui = async ({
466
+ screen,
467
+ mock,
468
+ issueKey,
469
+ board
470
+ }) => {
471
+ const data = mock ? mockData() : liveData({ ...context(), board });
472
+ const key = issueKey ?? (mock ? "SHOP-412" : void 0);
473
+ const { waitUntilExit } = render(
474
+ /* @__PURE__ */ jsx3(App, { data, initialScreen: screen, initialKey: key })
475
+ );
476
+ await waitUntilExit();
477
+ };
478
+ export {
479
+ SCREENS,
480
+ runTui
481
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/jira-cli",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "Jira on the command line — read issues, comments and attachments as plain text",
6
6
  "keywords": [
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@kud/ink-ui": "0.25.0",
41
- "@kud/jira": "0.3.0",
42
- "@kud/jira-ink": "0.2.1",
41
+ "@kud/jira": "0.4.0",
42
+ "@kud/jira-ink": "0.3.1",
43
43
  "commander": "14.0.1",
44
44
  "ink": "7.1.1",
45
45
  "react": "19.2.5"