@kud/gh-ink 0.16.3 → 0.17.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
@@ -177,6 +177,7 @@ declare const repoPriority: (repo: string) => number;
177
177
  declare const sortItems: (items: GHItem[]) => GHItem[];
178
178
  declare const sortByRecency: (items: GHItem[]) => GHItem[];
179
179
  declare const insertRepoHeaders: (items: GHItem[]) => AnyItem[];
180
+ declare const whoseMove: (health: Health, sectionId: string) => "you" | "them";
180
181
  declare const layoutGHItems: (items: GHItem[], sectionId: string) => AnyItem[];
181
182
  declare const filterByOrigin: (sections: Section[], keep: "work" | "home", isWorkRepo: (repo: string) => boolean) => Section[];
182
183
  declare const filterBySearch: (sections: Section[], query: string) => Section[];
@@ -288,4 +289,4 @@ declare const writeCache: (key: string, data: {
288
289
  login: string;
289
290
  }) => void;
290
291
 
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 };
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 };
package/dist/index.js CHANGED
@@ -853,7 +853,9 @@ var sortItems = (items) => [...items].sort((a, b) => {
853
853
  const pd = repoPriority(a.repo) - repoPriority(b.repo);
854
854
  if (pd !== 0) return pd;
855
855
  const rd = a.repo.localeCompare(b.repo);
856
- return rd !== 0 ? rd : b.ts - a.ts;
856
+ if (rd !== 0) return rd;
857
+ const dd = Number(a.health === "draft") - Number(b.health === "draft");
858
+ return dd !== 0 ? dd : b.ts - a.ts;
857
859
  });
858
860
  var sortByRecency = (items) => [...items].sort((a, b) => b.ts - a.ts);
859
861
  var insertRepoHeaders = (items) => {
@@ -873,9 +875,35 @@ var insertRepoHeaders = (items) => {
873
875
  }
874
876
  return result;
875
877
  };
876
- var layoutGHItems = (items, sectionId) => insertRepoHeaders(
877
- sectionId === "done" ? sortByRecency(items) : sortItems(items)
878
- );
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
+ };
884
+ var BAND_LABEL = {
885
+ you: "Your move",
886
+ them: "Their move"
887
+ };
888
+ var layoutGHItems = (items, sectionId) => {
889
+ if (sectionId === "done") return insertRepoHeaders(sortByRecency(items));
890
+ const sorted = sortItems(items);
891
+ const bands = ["you", "them"].map((side) => ({
892
+ side,
893
+ rows: sorted.filter((i) => whoseMove(i.health, sectionId) === side)
894
+ }));
895
+ const filled = bands.filter((b) => b.rows.length > 0);
896
+ if (filled.length < 2) return insertRepoHeaders(sorted);
897
+ return filled.flatMap(({ side, rows }) => [
898
+ {
899
+ kind: "subgroup-header",
900
+ label: `${BAND_LABEL[side]} (${rows.length})`,
901
+ age: "",
902
+ indent: false
903
+ },
904
+ ...insertRepoHeaders(rows)
905
+ ]);
906
+ };
879
907
  var filterByOrigin = (sections, keep, isWorkRepo) => sections.map((s) => {
880
908
  const kept = s.items.filter(
881
909
  (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)
@@ -2892,4 +2920,4 @@ var App = ({
2892
2920
  ] });
2893
2921
  };
2894
2922
 
2895
- 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 };
2923
+ 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.3",
3
+ "version": "0.17.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",