@kud/gh-ink 0.17.0 → 0.19.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.d.ts +25 -3
- package/dist/index.js +29 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,15 @@ type GHItem = {
|
|
|
74
74
|
conversation: number;
|
|
75
75
|
lastActor?: string;
|
|
76
76
|
detail?: GHDetail;
|
|
77
|
+
/**
|
|
78
|
+
* Where YOU stand on this row, when the host knows it per row rather than per
|
|
79
|
+
* tab. Set it and the whose-move band reads it instead of inferring from the
|
|
80
|
+
* section id — which is what lets one tab hold rows of mixed standing: a
|
|
81
|
+
* review asked of you and one you have already given differ only in whether
|
|
82
|
+
* the ball comes back, and that is a fact about the search a row came from,
|
|
83
|
+
* never about the PR. Left unset, the section id decides as before.
|
|
84
|
+
*/
|
|
85
|
+
standing?: Standing;
|
|
77
86
|
indent: boolean;
|
|
78
87
|
};
|
|
79
88
|
type TaskRow = {
|
|
@@ -163,8 +172,20 @@ type Action = {
|
|
|
163
172
|
subActions?: Action[];
|
|
164
173
|
};
|
|
165
174
|
type JiraTransition = {
|
|
175
|
+
/** What the action menu shows. Yours to word; nothing matches on it. */
|
|
166
176
|
label: string;
|
|
167
|
-
|
|
177
|
+
/**
|
|
178
|
+
* The TRANSITION name, passed verbatim to `jira issue move`. Not the
|
|
179
|
+
* destination status, and the two are routinely different strings — jira-cli
|
|
180
|
+
* matches `t.name.toLowerCase() === wanted`, so a status name here matches no
|
|
181
|
+
* transition, the move silently does nothing, and the row simply does not
|
|
182
|
+
* budge. This field was called `state`, which is what invited exactly that:
|
|
183
|
+
* cockpit had `{ label: "UAT", state: "UAT" }` against an ACC workflow whose
|
|
184
|
+
* transition is named "Ready for QA" and whose status is "In Testing (QA)" —
|
|
185
|
+
* no "UAT" anywhere, and no error either.
|
|
186
|
+
*/
|
|
187
|
+
transition: string;
|
|
188
|
+
/** Offered as a second step when the transition asks for a resolution. */
|
|
168
189
|
resolutions?: string[];
|
|
169
190
|
};
|
|
170
191
|
declare const relativeTime: (iso: string) => string;
|
|
@@ -177,7 +198,8 @@ declare const repoPriority: (repo: string) => number;
|
|
|
177
198
|
declare const sortItems: (items: GHItem[]) => GHItem[];
|
|
178
199
|
declare const sortByRecency: (items: GHItem[]) => GHItem[];
|
|
179
200
|
declare const insertRepoHeaders: (items: GHItem[]) => AnyItem[];
|
|
180
|
-
|
|
201
|
+
type Standing = "authored" | "queued" | "spoken";
|
|
202
|
+
declare const whoseMove: (health: Health, sectionId: string, standing?: Standing) => "you" | "them";
|
|
181
203
|
declare const layoutGHItems: (items: GHItem[], sectionId: string) => AnyItem[];
|
|
182
204
|
declare const filterByOrigin: (sections: Section[], keep: "work" | "home", isWorkRepo: (repo: string) => boolean) => Section[];
|
|
183
205
|
declare const filterBySearch: (sections: Section[], query: string) => Section[];
|
|
@@ -289,4 +311,4 @@ declare const writeCache: (key: string, data: {
|
|
|
289
311
|
login: string;
|
|
290
312
|
}) => void;
|
|
291
313
|
|
|
292
|
-
export { type Action, ActionMenu, type AnyItem, App, COLS, type CiStatus, CiStatusLine, type CiStatusState, CommentsPanel, type CommentsPanelProps, type DetailContext, type ExplainSection, type ExtensionTarget, type GHDetail, type GHItem, HealthPanel, type HealthPanelProps, type InboxExtension, type JiraTransition, type RepoHeader, type Section, type ShowLess, type ShowMore, type SubgroupHeader, type TaskRow, buildActions, buildCheckoutCmd, clipboard, drillCmd, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, healthColor, healthDisplay, healthGlyph, healthLegend, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, layoutGHItems, maxViewStart, moveCursor, openInTab, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resolveRepoPath, runHere, runInPane, runInPaneHorizontal, sameCiStatusState, sortByRecency, sortItems, toCiStatusState, topLevelCount, truncate, useActionMenu, whoseMove, windowCount, withHeaders, withoutItem, writeCache };
|
|
314
|
+
export { type Action, ActionMenu, type AnyItem, App, COLS, type CiStatus, CiStatusLine, type CiStatusState, CommentsPanel, type CommentsPanelProps, type DetailContext, type ExplainSection, type ExtensionTarget, type GHDetail, type GHItem, HealthPanel, type HealthPanelProps, type InboxExtension, type JiraTransition, type RepoHeader, type Section, type ShowLess, type ShowMore, type Standing, type SubgroupHeader, type TaskRow, buildActions, buildCheckoutCmd, clipboard, drillCmd, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, healthColor, healthDisplay, healthGlyph, healthLegend, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, layoutGHItems, maxViewStart, moveCursor, openInTab, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resolveRepoPath, runHere, runInPane, runInPaneHorizontal, sameCiStatusState, sortByRecency, sortItems, toCiStatusState, topLevelCount, truncate, useActionMenu, whoseMove, windowCount, withHeaders, withoutItem, writeCache };
|
package/dist/index.js
CHANGED
|
@@ -875,12 +875,26 @@ var insertRepoHeaders = (items) => {
|
|
|
875
875
|
}
|
|
876
876
|
return result;
|
|
877
877
|
};
|
|
878
|
-
var
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
878
|
+
var STANDING = {
|
|
879
|
+
mine: "authored",
|
|
880
|
+
// `open` and `draft` predate `mine` and are the same standing: a host that
|
|
881
|
+
// still splits its own PRs by draft-ness keeps working, and one that folds
|
|
882
|
+
// them into a single tab (as cockpit does — the band already sinks a draft,
|
|
883
|
+
// so the split said it twice) gets the same reading.
|
|
884
|
+
open: "authored",
|
|
885
|
+
draft: "authored",
|
|
886
|
+
assigned: "authored",
|
|
887
|
+
issues: "authored",
|
|
888
|
+
review: "queued",
|
|
889
|
+
incoming: "queued",
|
|
890
|
+
reviewed: "spoken"
|
|
891
|
+
};
|
|
892
|
+
var YOURS = {
|
|
893
|
+
authored: ["ci-fail", "conflict", "changes-req", "threads", "approved"],
|
|
894
|
+
queued: ["waiting", "pending", "threads", "approved"],
|
|
895
|
+
spoken: ["threads"]
|
|
896
|
+
};
|
|
897
|
+
var whoseMove = (health, sectionId, standing) => YOURS[standing ?? STANDING[sectionId] ?? "queued"].includes(health) ? "you" : "them";
|
|
884
898
|
var BAND_LABEL = {
|
|
885
899
|
you: "Your move",
|
|
886
900
|
them: "Their move"
|
|
@@ -890,7 +904,9 @@ var layoutGHItems = (items, sectionId) => {
|
|
|
890
904
|
const sorted = sortItems(items);
|
|
891
905
|
const bands = ["you", "them"].map((side) => ({
|
|
892
906
|
side,
|
|
893
|
-
rows: sorted.filter(
|
|
907
|
+
rows: sorted.filter(
|
|
908
|
+
(i) => whoseMove(i.health, sectionId, i.standing) === side
|
|
909
|
+
)
|
|
894
910
|
}));
|
|
895
911
|
const filled = bands.filter((b) => b.rows.length > 0);
|
|
896
912
|
if (filled.length < 2) return insertRepoHeaders(sorted);
|
|
@@ -1293,7 +1309,7 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1293
1309
|
run: () => {
|
|
1294
1310
|
},
|
|
1295
1311
|
subActions: jiraTransitions.map(
|
|
1296
|
-
({ label,
|
|
1312
|
+
({ label, transition, resolutions }) => resolutions && resolutions.length > 0 ? {
|
|
1297
1313
|
label,
|
|
1298
1314
|
hint: "",
|
|
1299
1315
|
run: () => {
|
|
@@ -1303,7 +1319,7 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1303
1319
|
hint: "",
|
|
1304
1320
|
run: () => {
|
|
1305
1321
|
showFlash(`\u22EF ${label} \xB7 ${resolution}\u2026`);
|
|
1306
|
-
void quietly`jira issue move ${item.ticket} ${
|
|
1322
|
+
void quietly`jira issue move ${item.ticket} ${transition} --resolution ${resolution}`.then(() => {
|
|
1307
1323
|
showFlash(`\u2713 ${label} \xB7 ${resolution}`);
|
|
1308
1324
|
ext?.onActed?.();
|
|
1309
1325
|
}).catch(() => showFlash(`\u2717 Move to ${label} failed`));
|
|
@@ -1314,7 +1330,7 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1314
1330
|
hint: "",
|
|
1315
1331
|
run: () => {
|
|
1316
1332
|
showFlash(`\u22EF Moving to ${label}\u2026`);
|
|
1317
|
-
void quietly`jira issue move ${item.ticket} ${
|
|
1333
|
+
void quietly`jira issue move ${item.ticket} ${transition}`.then(() => {
|
|
1318
1334
|
showFlash(`\u2713 Moved to ${label}`);
|
|
1319
1335
|
ext?.onActed?.();
|
|
1320
1336
|
}).catch(() => showFlash(`\u2717 Move to ${label} failed`));
|
|
@@ -2411,7 +2427,7 @@ var BrowseScreen = ({
|
|
|
2411
2427
|
if (input === "t" && activeItem && activeItem.kind === "task" && activeItem.ticket && jiraTransitions && jiraTransitions.length > 0) {
|
|
2412
2428
|
const jiraKey = activeItem.ticket;
|
|
2413
2429
|
const actions = jiraTransitions.map(
|
|
2414
|
-
({ label,
|
|
2430
|
+
({ label, transition, resolutions }) => resolutions && resolutions.length > 0 ? {
|
|
2415
2431
|
label,
|
|
2416
2432
|
hint: "",
|
|
2417
2433
|
run: () => {
|
|
@@ -2422,7 +2438,7 @@ var BrowseScreen = ({
|
|
|
2422
2438
|
run: () => {
|
|
2423
2439
|
menu.close();
|
|
2424
2440
|
showFlash(`\u22EF ${label} \xB7 ${resolution}\u2026`);
|
|
2425
|
-
quietly`jira issue move ${jiraKey} ${
|
|
2441
|
+
quietly`jira issue move ${jiraKey} ${transition} --resolution ${resolution}`.then(() => {
|
|
2426
2442
|
showFlash(`\u2713 ${label} \xB7 ${resolution}`);
|
|
2427
2443
|
onActed?.();
|
|
2428
2444
|
}).catch(() => showFlash(`\u2717 Move to ${label} failed`));
|
|
@@ -2434,7 +2450,7 @@ var BrowseScreen = ({
|
|
|
2434
2450
|
run: () => {
|
|
2435
2451
|
menu.close();
|
|
2436
2452
|
showFlash(`\u22EF Moving to ${label}\u2026`);
|
|
2437
|
-
quietly`jira issue move ${jiraKey} ${
|
|
2453
|
+
quietly`jira issue move ${jiraKey} ${transition}`.then(() => {
|
|
2438
2454
|
showFlash(`\u2713 Moved to ${label}`);
|
|
2439
2455
|
onActed?.();
|
|
2440
2456
|
}).catch(() => showFlash(`\u2717 Move to ${label} failed`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/gh-ink",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Ink components for rendering GitHub PR review comments and health — controlled, presentation-only, built on @kud/ink-ui and fed by @kud/gh.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|