@kud/gh-ink 0.16.4 → 0.18.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 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 = {
@@ -177,6 +186,8 @@ declare const repoPriority: (repo: string) => number;
177
186
  declare const sortItems: (items: GHItem[]) => GHItem[];
178
187
  declare const sortByRecency: (items: GHItem[]) => GHItem[];
179
188
  declare const insertRepoHeaders: (items: GHItem[]) => AnyItem[];
189
+ type Standing = "authored" | "queued" | "spoken";
190
+ declare const whoseMove: (health: Health, sectionId: string, standing?: Standing) => "you" | "them";
180
191
  declare const layoutGHItems: (items: GHItem[], sectionId: string) => AnyItem[];
181
192
  declare const filterByOrigin: (sections: Section[], keep: "work" | "home", isWorkRepo: (repo: string) => boolean) => Section[];
182
193
  declare const filterBySearch: (sections: Section[], query: string) => Section[];
@@ -288,4 +299,4 @@ declare const writeCache: (key: string, data: {
288
299
  login: string;
289
300
  }) => void;
290
301
 
291
- 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, windowCount, withHeaders, withoutItem, writeCache };
302
+ 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,9 +875,51 @@ var insertRepoHeaders = (items) => {
875
875
  }
876
876
  return result;
877
877
  };
878
- var layoutGHItems = (items, sectionId) => insertRepoHeaders(
879
- sectionId === "done" ? sortByRecency(items) : sortItems(items)
880
- );
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";
898
+ var BAND_LABEL = {
899
+ you: "Your move",
900
+ them: "Their move"
901
+ };
902
+ var layoutGHItems = (items, sectionId) => {
903
+ if (sectionId === "done") return insertRepoHeaders(sortByRecency(items));
904
+ const sorted = sortItems(items);
905
+ const bands = ["you", "them"].map((side) => ({
906
+ side,
907
+ rows: sorted.filter(
908
+ (i) => whoseMove(i.health, sectionId, i.standing) === side
909
+ )
910
+ }));
911
+ const filled = bands.filter((b) => b.rows.length > 0);
912
+ if (filled.length < 2) return insertRepoHeaders(sorted);
913
+ return filled.flatMap(({ side, rows }) => [
914
+ {
915
+ kind: "subgroup-header",
916
+ label: `${BAND_LABEL[side]} (${rows.length})`,
917
+ age: "",
918
+ indent: false
919
+ },
920
+ ...insertRepoHeaders(rows)
921
+ ]);
922
+ };
881
923
  var filterByOrigin = (sections, keep, isWorkRepo) => sections.map((s) => {
882
924
  const kept = s.items.filter(
883
925
  (i) => i.kind !== "repo-header" && i.kind !== "subgroup-header" && i.kind !== "show-more" && i.kind !== "show-less" && (i.kind === "pr" || i.kind === "issue" ? keep === "work" ? isWorkRepo(i.repo) : !isWorkRepo(i.repo) : true)
@@ -2894,4 +2936,4 @@ var App = ({
2894
2936
  ] });
2895
2937
  };
2896
2938
 
2897
- export { ActionMenu, App, COLS, CiStatusLine, CommentsPanel, HealthPanel, 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, windowCount, withHeaders, withoutItem, writeCache };
2939
+ export { ActionMenu, App, COLS, CiStatusLine, CommentsPanel, HealthPanel, 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/gh-ink",
3
- "version": "0.16.4",
3
+ "version": "0.18.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",