@kud/gh-ink 0.4.0 → 0.5.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
@@ -42,6 +42,8 @@ interface InboxExtension {
42
42
  id: string;
43
43
  title: string;
44
44
  key: string;
45
+ hint?: string;
46
+ scope?: "item" | "global";
45
47
  body: (onExit: () => void, target?: ExtensionTarget) => ReactNode;
46
48
  }
47
49
 
@@ -172,7 +174,10 @@ declare const runHere: (cmd: string) => void;
172
174
  declare const COLS: number;
173
175
  declare const topLevelCount: (s: Section) => number;
174
176
  declare const drillCmd: (item: AnyItem) => string | null;
175
- declare const buildActions: (item: AnyItem, login: string, showFlash: (msg: string) => void, jiraBase?: string, jiraKeyRe?: RegExp, jiraTransitions?: JiraTransition[], onRefresh?: () => void, onRemove?: (item: GHItem) => void, onOpenView?: (item: AnyItem) => boolean) => Action[];
177
+ declare const buildActions: (item: AnyItem, login: string, showFlash: (msg: string) => void, jiraBase?: string, jiraKeyRe?: RegExp, jiraTransitions?: JiraTransition[], onRefresh?: () => void, onRemove?: (item: GHItem) => void, onOpenView?: (item: AnyItem) => boolean, ext?: {
178
+ extensions?: InboxExtension[];
179
+ onOpenExt?: (id: string, target: ExtensionTarget) => void;
180
+ }) => Action[];
176
181
  type CiStatusState = {
177
182
  kind: "loading";
178
183
  } | {
package/dist/index.js CHANGED
@@ -1065,7 +1065,7 @@ var drillLabel = (item) => {
1065
1065
  if (item.kind === "pr") return "Open PR";
1066
1066
  return "Drill in";
1067
1067
  };
1068
- var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions, onRefresh, onRemove, onOpenView) => {
1068
+ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions, onRefresh, onRemove, onOpenView, ext) => {
1069
1069
  if (item.kind === "repo-header" || item.kind === "subgroup-header" || item.kind === "show-more" || item.kind === "show-less")
1070
1070
  return [];
1071
1071
  const open = {
@@ -1306,6 +1306,12 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
1306
1306
  });
1307
1307
  }
1308
1308
  }
1309
+ for (const e of itemExtensions(ext?.extensions))
1310
+ actions.push({
1311
+ label: e.title,
1312
+ hint: e.key,
1313
+ run: () => ext?.onOpenExt?.(e.id, { item, login })
1314
+ });
1309
1315
  return actions;
1310
1316
  };
1311
1317
  var agoText = (ms) => {
@@ -1524,7 +1530,7 @@ var TURN_LEGEND = [
1524
1530
  ];
1525
1531
  var HelpModal = ({
1526
1532
  workToggle,
1527
- hasCi,
1533
+ extensions,
1528
1534
  hasJira,
1529
1535
  tabHelp
1530
1536
  }) => {
@@ -1545,7 +1551,7 @@ var HelpModal = ({
1545
1551
  ["f", "filter by repo"],
1546
1552
  ["r", "refresh"],
1547
1553
  ...workToggle ? [["w", "toggle work / home"]] : [],
1548
- ...hasCi ? [["J", "Jenkins explorer"]] : [],
1554
+ ...extensionLegend(extensions),
1549
1555
  ["?", "this help"],
1550
1556
  ["q", "quit"]
1551
1557
  ];
@@ -1658,6 +1664,9 @@ var RepoPicker = ({
1658
1664
  );
1659
1665
  };
1660
1666
  var extensionFor = (input, extensions) => input ? extensions?.find((e) => e.key === input) : void 0;
1667
+ var extensionHints = (extensions) => (extensions ?? []).map((e) => [e.key, e.hint ?? e.title.toLowerCase()]);
1668
+ var extensionLegend = (extensions) => (extensions ?? []).map((e) => [e.key, e.title]);
1669
+ var itemExtensions = (extensions) => (extensions ?? []).filter((e) => e.scope === "item");
1661
1670
  var BrowseScreen = ({
1662
1671
  sections,
1663
1672
  login,
@@ -1794,7 +1803,8 @@ var BrowseScreen = ({
1794
1803
  jiraTransitions,
1795
1804
  onRefresh,
1796
1805
  removeItemFromSections,
1797
- openDrillView
1806
+ openDrillView,
1807
+ { extensions, onOpenExt }
1798
1808
  );
1799
1809
  menu.open(actions);
1800
1810
  };
@@ -2053,7 +2063,7 @@ var BrowseScreen = ({
2053
2063
  ["/", "search"],
2054
2064
  ["f", "filter"],
2055
2065
  ["r", "refresh"],
2056
- ...ciStatus ? [["J", "jenkins"]] : [],
2066
+ ...extensionHints(extensions),
2057
2067
  ["?", "help"],
2058
2068
  ["q", "quit"]
2059
2069
  ];
@@ -2122,7 +2132,7 @@ var BrowseScreen = ({
2122
2132
  HelpModal,
2123
2133
  {
2124
2134
  workToggle,
2125
- hasCi: ciStatus != null,
2135
+ extensions,
2126
2136
  hasJira: !!jiraBase,
2127
2137
  tabHelp
2128
2138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/gh-ink",
3
- "version": "0.4.0",
3
+ "version": "0.5.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",