@kud/gh-ink 0.43.3 → 0.44.1
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 +28 -1
- package/dist/index.js +42 -12
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -209,6 +209,18 @@ type GHItem = {
|
|
|
209
209
|
unresolved: number;
|
|
210
210
|
conversation: number;
|
|
211
211
|
lastActor?: string;
|
|
212
|
+
/**
|
|
213
|
+
* The item's labels, unordered and by name only — which is all GitHub gives
|
|
214
|
+
* without the timeline API. `labels(first: N)` orders by when the label was
|
|
215
|
+
* created IN THE REPO, never by when it was applied here, so "the newest two"
|
|
216
|
+
* is not derivable and the row ranks them against the host's `labelPriority`
|
|
217
|
+
* instead.
|
|
218
|
+
*
|
|
219
|
+
* Optional because a `minimal` fetch omits the selection entirely — these
|
|
220
|
+
* fields vanish rather than degrade — so undefined means "not asked for",
|
|
221
|
+
* which the row draws as nothing at all rather than as an unlabelled item.
|
|
222
|
+
*/
|
|
223
|
+
labels?: readonly string[];
|
|
212
224
|
detail?: GHDetail;
|
|
213
225
|
/**
|
|
214
226
|
* Where YOU stand on this row, when the host knows it per row rather than per
|
|
@@ -419,6 +431,7 @@ type ExplainSection = {
|
|
|
419
431
|
};
|
|
420
432
|
declare const explainItem: (item: GHItem, login: string) => ExplainSection[];
|
|
421
433
|
declare const repoPriority: (repo: string) => number;
|
|
434
|
+
declare const labelPriority: (name: string) => number;
|
|
422
435
|
declare const sortItems: (items: GHItem[]) => GHItem[];
|
|
423
436
|
declare const sortByRecency: (items: GHItem[]) => GHItem[];
|
|
424
437
|
declare const insertRepoHeaders: (items: GHItem[]) => AnyItem[];
|
|
@@ -657,6 +670,20 @@ type InboxConfig = {
|
|
|
657
670
|
* the owner that contains it. Repos matching nothing sort last, together.
|
|
658
671
|
*/
|
|
659
672
|
repoPriority: readonly string[];
|
|
673
|
+
/**
|
|
674
|
+
* Label ranking, best first, deciding which two labels a row shows when it
|
|
675
|
+
* carries more than two. An entry ending in `*` matches by prefix; anything
|
|
676
|
+
* else must equal the label name exactly. Labels matching nothing share the
|
|
677
|
+
* last rank and are ordered among themselves by name.
|
|
678
|
+
*
|
|
679
|
+
* Empty like everything else here, and that is load-bearing rather than
|
|
680
|
+
* merely consistent: `plan`, `spike` and `app:*` are one reader's filing
|
|
681
|
+
* conventions, invented in their own notes, and a library that shipped them
|
|
682
|
+
* as defaults would be ranking a stranger's labels by a scheme they have
|
|
683
|
+
* never seen. Empty means a labelled row shows its labels in name order,
|
|
684
|
+
* which is honest about knowing nothing.
|
|
685
|
+
*/
|
|
686
|
+
labelPriority: readonly string[];
|
|
660
687
|
profiles: readonly RepoProfile[];
|
|
661
688
|
/**
|
|
662
689
|
* Fallback directory holding checkouts, for repos in no profile that names one
|
|
@@ -719,4 +746,4 @@ declare const matchesFilter: (repo: string, filter: RepoFilter) => boolean;
|
|
|
719
746
|
*/
|
|
720
747
|
declare const parsePatterns: (value: string) => string[];
|
|
721
748
|
|
|
722
|
-
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 InboxBudget, type InboxConfig, type InboxExtension, type JiraTransition, type OriginSplit, PIN_MARK, type RepoFilter, type RepoHeader, type RepoProfile, SIDEBAR_COLS, type Section, type ShowLess, type ShowMore, SidePanel, type Sidebar, type SidebarRow, type Standing, type SubgroupHeader, type TaskRow, budgetNotice, buildActions, buildCheckoutCmd, checkoutDirs, clipboard, configureInbox, counts, drillCmd, explainGhAction, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, gapsAbove, healthColor, healthDisplay, healthGlyph, healthLegend, inboxConfig, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, layoutGHItems, matchesFilter, maxViewStart, moveCursor, openInTab, parsePatterns, profileOf, railCapacity, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resetInboxConfig, resolveRepoPath, runHere, runInPane, runInPaneHorizontal, sameCiStatusState, signatureOf, sortByRecency, sortItems, toCiStatusState, topLevelCount, truncate, useActionMenu, whoseMove, windowCount, withHeaders, withoutItem, writeCache };
|
|
749
|
+
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 InboxBudget, type InboxConfig, type InboxExtension, type JiraTransition, type OriginSplit, PIN_MARK, type RepoFilter, type RepoHeader, type RepoProfile, SIDEBAR_COLS, type Section, type ShowLess, type ShowMore, SidePanel, type Sidebar, type SidebarRow, type Standing, type SubgroupHeader, type TaskRow, budgetNotice, buildActions, buildCheckoutCmd, checkoutDirs, clipboard, configureInbox, counts, drillCmd, explainGhAction, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, gapsAbove, healthColor, healthDisplay, healthGlyph, healthLegend, inboxConfig, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, labelPriority, layoutGHItems, matchesFilter, maxViewStart, moveCursor, openInTab, parsePatterns, profileOf, railCapacity, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resetInboxConfig, resolveRepoPath, runHere, runInPane, runInPaneHorizontal, sameCiStatusState, signatureOf, sortByRecency, sortItems, toCiStatusState, topLevelCount, truncate, useActionMenu, whoseMove, windowCount, withHeaders, withoutItem, writeCache };
|
package/dist/index.js
CHANGED
|
@@ -702,6 +702,7 @@ var healthLegend = [
|
|
|
702
702
|
// src/inbox/config.ts
|
|
703
703
|
var EMPTY = {
|
|
704
704
|
repoPriority: [],
|
|
705
|
+
labelPriority: [],
|
|
705
706
|
profiles: [],
|
|
706
707
|
cacheNamespace: "gh-ink",
|
|
707
708
|
cacheTtlMs: 6e5
|
|
@@ -1016,6 +1017,13 @@ var repoPriority = (repo) => {
|
|
|
1016
1017
|
);
|
|
1017
1018
|
return i === -1 ? order.length : i;
|
|
1018
1019
|
};
|
|
1020
|
+
var labelPriority = (name) => {
|
|
1021
|
+
const order = inboxConfig().labelPriority;
|
|
1022
|
+
const i = order.findIndex(
|
|
1023
|
+
(p) => p.endsWith("*") ? name.startsWith(p.slice(0, -1)) : name === p
|
|
1024
|
+
);
|
|
1025
|
+
return i === -1 ? Infinity : i;
|
|
1026
|
+
};
|
|
1019
1027
|
var sortItems = (items) => [...items].sort((a, b) => {
|
|
1020
1028
|
const pd = repoPriority(a.repo) - repoPriority(b.repo);
|
|
1021
1029
|
if (pd !== 0) return pd;
|
|
@@ -2056,33 +2064,54 @@ var ItemRow = ({
|
|
|
2056
2064
|
const mergedLabel = merged ? "merged" : "";
|
|
2057
2065
|
const pillCaps = [mergedLabel, farewellLabel].filter(Boolean).length * 2;
|
|
2058
2066
|
const repoLabel = depthOf(item) > 0 ? item.repo : "";
|
|
2059
|
-
const
|
|
2067
|
+
const labelNames = [...item.labels ?? []].sort((a, b) => labelPriority(a) - labelPriority(b) || a.localeCompare(b)).slice(0, 2);
|
|
2068
|
+
const givingUp = {
|
|
2069
|
+
author: false,
|
|
2070
|
+
threads: false,
|
|
2071
|
+
age: false,
|
|
2072
|
+
repo: false,
|
|
2073
|
+
labels: 0
|
|
2074
|
+
};
|
|
2075
|
+
const LABEL_CELL_MAX = 24;
|
|
2076
|
+
const labelCell = () => {
|
|
2077
|
+
const shown = labelNames.slice(
|
|
2078
|
+
0,
|
|
2079
|
+
Math.max(0, labelNames.length - givingUp.labels)
|
|
2080
|
+
);
|
|
2081
|
+
if (shown.length === 0) return "";
|
|
2082
|
+
const fitted = [];
|
|
2083
|
+
for (const name of shown) {
|
|
2084
|
+
const next = [...fitted, name].join(", ");
|
|
2085
|
+
if (next.length <= LABEL_CELL_MAX) fitted.push(name);
|
|
2086
|
+
}
|
|
2087
|
+
if (fitted.length === 0) {
|
|
2088
|
+
return `\uF02B ${truncate2(shown[0], LABEL_CELL_MAX)}`;
|
|
2089
|
+
}
|
|
2090
|
+
return `\uF02B ${fitted.join(", ")}`;
|
|
2091
|
+
};
|
|
2060
2092
|
const widthOf2 = () => {
|
|
2061
|
-
const
|
|
2093
|
+
const suffix = [
|
|
2062
2094
|
givingUp.age ? "" : ageLabel || "",
|
|
2063
2095
|
givingUp.threads ? "" : unresolvedLabel,
|
|
2064
2096
|
showAuthor && !givingUp.author ? `by ${item.author}` : "",
|
|
2065
2097
|
mergedLabel
|
|
2066
2098
|
].filter(Boolean).join(" ");
|
|
2067
|
-
|
|
2099
|
+
const cell = labelCell();
|
|
2100
|
+
return 2 + prefix.length + 2 + 2 + 7 + (cell ? 2 + cell.length + 1 : 0) + (givingUp.repo ? 0 : repoLabel.length) + suffix.length + pillCaps + 6;
|
|
2068
2101
|
};
|
|
2069
2102
|
const MIN_TITLE = 24;
|
|
2070
2103
|
for (const give of [
|
|
2071
2104
|
() => givingUp.author = true,
|
|
2105
|
+
() => givingUp.labels = 1,
|
|
2072
2106
|
() => givingUp.threads = true,
|
|
2107
|
+
() => givingUp.labels = 2,
|
|
2073
2108
|
() => givingUp.repo = true,
|
|
2074
2109
|
() => givingUp.age = true
|
|
2075
2110
|
]) {
|
|
2076
2111
|
if (cols - widthOf2() >= MIN_TITLE) break;
|
|
2077
2112
|
give();
|
|
2078
2113
|
}
|
|
2079
|
-
|
|
2080
|
-
givingUp.age ? "" : ageLabel || "",
|
|
2081
|
-
givingUp.threads ? "" : unresolvedLabel,
|
|
2082
|
-
showAuthor && !givingUp.author ? `by ${item.author}` : "",
|
|
2083
|
-
mergedLabel,
|
|
2084
|
-
farewellLabel
|
|
2085
|
-
].filter(Boolean).join(" ");
|
|
2114
|
+
const labelLabel = labelCell();
|
|
2086
2115
|
const titleMax = Math.max(1, cols - widthOf2());
|
|
2087
2116
|
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
2088
2117
|
/* @__PURE__ */ jsx(Text3, { color: "cyan", children: active ? "\u276F " : " " }),
|
|
@@ -2099,6 +2128,7 @@ var ItemRow = ({
|
|
|
2099
2128
|
children: truncate2(item.title, titleMax) + " "
|
|
2100
2129
|
}
|
|
2101
2130
|
),
|
|
2131
|
+
labelLabel ? /* @__PURE__ */ jsx(Text3, { dimColor: true, children: labelLabel + " " }) : null,
|
|
2102
2132
|
repoLabel && !givingUp.repo ? /* @__PURE__ */ jsx(Text3, { dimColor: true, children: repoLabel }) : null,
|
|
2103
2133
|
unresolvedLabel && !givingUp.threads ? /* @__PURE__ */ jsx(Text3, { bold: !spokeLast, color: spokeLast ? "#888888" : "#FF8700", children: " " + unresolvedLabel }) : null,
|
|
2104
2134
|
showAuthor && !givingUp.author ? /* @__PURE__ */ jsx(Text3, { dimColor: true, italic: true, children: " by " + item.author }) : null,
|
|
@@ -3088,7 +3118,7 @@ var BrowseScreen = ({
|
|
|
3088
3118
|
{
|
|
3089
3119
|
flexDirection: "column",
|
|
3090
3120
|
minHeight: listHeight,
|
|
3091
|
-
width:
|
|
3121
|
+
width: listCols,
|
|
3092
3122
|
flexShrink: 0,
|
|
3093
3123
|
children: [
|
|
3094
3124
|
/* @__PURE__ */ jsxs(Backdrop, { dimmed: !!overlay, absolute: !!overlay, height: listHeight, children: [
|
|
@@ -3595,4 +3625,4 @@ var matchesFilter = (repo, filter) => {
|
|
|
3595
3625
|
};
|
|
3596
3626
|
var parsePatterns = (value) => value.split(",").map((p) => p.trim()).filter(Boolean);
|
|
3597
3627
|
|
|
3598
|
-
export { ActionMenu, App, COLS, CiStatusLine, CommentsPanel, HealthPanel, PIN_MARK, SIDEBAR_COLS, SidePanel, budgetNotice, buildActions, buildCheckoutCmd, checkoutDirs, clipboard, configureInbox, counts, drillCmd, explainGhAction, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, gapsAbove, healthColor, healthDisplay, healthGlyph, healthLegend, inboxConfig, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, layoutGHItems, matchesFilter, maxViewStart, moveCursor, openInTab, parsePatterns, profileOf, railCapacity, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resetInboxConfig, resolveRepoPath, runHere, runInPane, runInPaneHorizontal, sameCiStatusState, signatureOf, sortByRecency, sortItems, toCiStatusState, topLevelCount, truncate2 as truncate, useActionMenu, whoseMove, windowCount, withHeaders, withoutItem, writeCache };
|
|
3628
|
+
export { ActionMenu, App, COLS, CiStatusLine, CommentsPanel, HealthPanel, PIN_MARK, SIDEBAR_COLS, SidePanel, budgetNotice, buildActions, buildCheckoutCmd, checkoutDirs, clipboard, configureInbox, counts, drillCmd, explainGhAction, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, gapsAbove, healthColor, healthDisplay, healthGlyph, healthLegend, inboxConfig, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, labelPriority, layoutGHItems, matchesFilter, maxViewStart, moveCursor, openInTab, parsePatterns, profileOf, railCapacity, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resetInboxConfig, resolveRepoPath, runHere, runInPane, runInPaneHorizontal, sameCiStatusState, signatureOf, sortByRecency, sortItems, toCiStatusState, topLevelCount, truncate2 as truncate, useActionMenu, whoseMove, windowCount, withHeaders, withoutItem, writeCache };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/gh-ink",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.1",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@kud/gh": "0.9.0",
|
|
52
|
-
"@kud/ink-ui": "0.
|
|
52
|
+
"@kud/ink-ui": "0.22.0",
|
|
53
53
|
"zx": "8.8.5"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|