@kud/jira-cli 0.4.1 → 0.5.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 +5 -1
- package/dist/{chunk-RTBMVYZM.js → chunk-QEOE2RPV.js} +50 -1
- package/dist/index.js +4 -23
- package/dist/tui-TWKZI63D.js +825 -0
- package/package.json +2 -2
- package/dist/tui-IET37PRI.js +0 -467
package/README.md
CHANGED
|
@@ -49,7 +49,11 @@ Run `jira` with no arguments:
|
|
|
49
49
|
jira
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
Your
|
|
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.
|
|
53
|
+
|
|
54
|
+
`↑↓` to move, `⇥` to switch tab, `enter` to open, `?` for the legend, `r` to refresh, `q` to quit.
|
|
55
|
+
|
|
56
|
+
`/` searches. Plain words narrow the list as you type and, on `enter`, run as `text ~ "…"` within your issues — so a match in a comment counts too. Anything shaped like JQL (`status = Done`, `labels in (a, b)`, `ORDER BY …`) is sent as-is and replaces the scope; the tag at the end of the line says which reading it took, and `⇥` flips it. A query Jira rejects shows Jira's own message under the box and keeps your text for editing. `esc` clears the search.
|
|
53
57
|
|
|
54
58
|
Inside an issue, `←→` switches between description, comments and attachments — descriptions and comments render as real Markdown, and attachments are listed with the comment or description each was embedded in. `t` transitions, `c` comments, `a` assigns to you, `o` opens the browser, `esc` goes back. Writes ask before they act.
|
|
55
59
|
|
|
@@ -61,11 +61,60 @@ 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
|
+
|
|
64
110
|
export {
|
|
65
111
|
table,
|
|
66
112
|
truncate,
|
|
67
113
|
exitError,
|
|
68
114
|
isExitError,
|
|
69
115
|
context,
|
|
70
|
-
printJson
|
|
116
|
+
printJson,
|
|
117
|
+
buildJql,
|
|
118
|
+
looksLikeJql,
|
|
119
|
+
searchJql
|
|
71
120
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
buildJql,
|
|
3
4
|
context,
|
|
4
5
|
exitError,
|
|
5
6
|
isExitError,
|
|
6
7
|
printJson,
|
|
7
8
|
table,
|
|
8
9
|
truncate
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QEOE2RPV.js";
|
|
10
11
|
|
|
11
12
|
// src/index.ts
|
|
12
13
|
import { realpathSync } from "fs";
|
|
@@ -389,26 +390,6 @@ var registerIssueWriteCommands = (issue) => {
|
|
|
389
390
|
};
|
|
390
391
|
|
|
391
392
|
// src/commands/issue.ts
|
|
392
|
-
var jqlEscape = (value) => `"${value.replace(/"/g, '\\"')}"`;
|
|
393
|
-
var buildJql = (options, defaultProject) => {
|
|
394
|
-
if (options.jql) return options.jql;
|
|
395
|
-
const clauses = [];
|
|
396
|
-
if (options.mine) clauses.push("assignee = currentUser()");
|
|
397
|
-
else if (options.assignee)
|
|
398
|
-
clauses.push(
|
|
399
|
-
options.assignee === "none" ? "assignee IS EMPTY" : `assignee = ${jqlEscape(options.assignee)}`
|
|
400
|
-
);
|
|
401
|
-
const project = options.project ?? defaultProject;
|
|
402
|
-
if (project) clauses.push(`project = ${jqlEscape(project)}`);
|
|
403
|
-
if (options.status) clauses.push(`status = ${jqlEscape(options.status)}`);
|
|
404
|
-
if (options.label) clauses.push(`labels = ${jqlEscape(options.label)}`);
|
|
405
|
-
if (options.sprint)
|
|
406
|
-
clauses.push(
|
|
407
|
-
options.sprint === "current" ? "sprint IN openSprints()" : `sprint = ${jqlEscape(options.sprint)}`
|
|
408
|
-
);
|
|
409
|
-
if (clauses.length === 0) clauses.push("assignee = currentUser()");
|
|
410
|
-
return `${clauses.join(" AND ")} ORDER BY updated DESC`;
|
|
411
|
-
};
|
|
412
393
|
var issueColumns = (ctx) => [
|
|
413
394
|
{ header: "KEY", value: (i) => i.key },
|
|
414
395
|
{ header: "STATUS", value: (i) => i.fields.status?.name ?? "\u2014" },
|
|
@@ -907,7 +888,7 @@ var interactiveArgs = (argv) => {
|
|
|
907
888
|
var main = async () => {
|
|
908
889
|
const { screen, mock, isBare } = interactiveArgs(process.argv);
|
|
909
890
|
if (screen === "list" && isBare) {
|
|
910
|
-
const { SCREENS } = await import("./tui-
|
|
891
|
+
const { SCREENS } = await import("./tui-TWKZI63D.js");
|
|
911
892
|
process.stdout.write(`${SCREENS.join("\n")}
|
|
912
893
|
`);
|
|
913
894
|
return;
|
|
@@ -917,7 +898,7 @@ var main = async () => {
|
|
|
917
898
|
program.outputHelp();
|
|
918
899
|
return;
|
|
919
900
|
}
|
|
920
|
-
const { runTui } = await import("./tui-
|
|
901
|
+
const { runTui } = await import("./tui-TWKZI63D.js");
|
|
921
902
|
const [, key] = (screen ?? "").split(":");
|
|
922
903
|
await runTui({
|
|
923
904
|
screen: screen?.startsWith("detail") ? "detail" : "issues",
|