@kud/gh-ink 0.17.0 → 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,7 +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[];
180
- declare const whoseMove: (health: Health, sectionId: string) => "you" | "them";
189
+ type Standing = "authored" | "queued" | "spoken";
190
+ declare const whoseMove: (health: Health, sectionId: string, standing?: Standing) => "you" | "them";
181
191
  declare const layoutGHItems: (items: GHItem[], sectionId: string) => AnyItem[];
182
192
  declare const filterByOrigin: (sections: Section[], keep: "work" | "home", isWorkRepo: (repo: string) => boolean) => Section[];
183
193
  declare const filterBySearch: (sections: Section[], query: string) => Section[];
@@ -289,4 +299,4 @@ declare const writeCache: (key: string, data: {
289
299
  login: string;
290
300
  }) => void;
291
301
 
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 };
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,12 +875,26 @@ var insertRepoHeaders = (items) => {
875
875
  }
876
876
  return result;
877
877
  };
878
- var AUTHORED_SECTIONS = /* @__PURE__ */ new Set(["open", "draft", "assigned", "issues"]);
879
- var whoseMove = (health, sectionId) => {
880
- if (health === "threads" || health === "approved") return "you";
881
- const yours = AUTHORED_SECTIONS.has(sectionId) ? ["ci-fail", "conflict", "changes-req"] : ["waiting", "pending"];
882
- return yours.includes(health) ? "you" : "them";
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((i) => whoseMove(i.health, sectionId) === side)
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/gh-ink",
3
- "version": "0.17.0",
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",