@kud/gh-ink 0.20.0 → 0.21.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
@@ -350,6 +350,19 @@ type InboxConfig = {
350
350
  * one machine would otherwise share a cache keyed only by section name.
351
351
  */
352
352
  cacheNamespace: string;
353
+ /**
354
+ * How long a cached inbox is trusted before a launch refetches. Every launch
355
+ * past it pays the full query — eight searches with check rollups — so this is
356
+ * the single knob between "always current" and "always slow, and drawing 502s
357
+ * from the API".
358
+ *
359
+ * It can be generous because staleness is bounded from the other end: acting
360
+ * on a row drops the entry outright, and `r` refetches on demand. What the TTL
361
+ * actually governs is how long a change made ELSEWHERE — someone approving
362
+ * your PR while you were not looking — can go unseen, which is a glance
363
+ * arriving late, not a wrong action taken.
364
+ */
365
+ cacheTtlMs: number;
353
366
  };
354
367
  /** Supply the host's opinions. Call once, before rendering. */
355
368
  declare const configureInbox: (config: Partial<InboxConfig>) => void;
@@ -366,4 +379,23 @@ declare const profileOf: (repo: string) => RepoProfile | null;
366
379
  */
367
380
  declare const checkoutDirs: () => string[];
368
381
 
369
- 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 InboxConfig, type InboxExtension, type JiraTransition, type RepoHeader, type RepoProfile, type Section, type ShowLess, type ShowMore, type Standing, type SubgroupHeader, type TaskRow, buildActions, buildCheckoutCmd, checkoutDirs, clipboard, configureInbox, drillCmd, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, healthColor, healthDisplay, healthGlyph, healthLegend, inboxConfig, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, layoutGHItems, maxViewStart, moveCursor, openInTab, profileOf, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resetInboxConfig, resolveRepoPath, runHere, runInPane, runInPaneHorizontal, sameCiStatusState, sortByRecency, sortItems, toCiStatusState, topLevelCount, truncate, useActionMenu, whoseMove, windowCount, withHeaders, withoutItem, writeCache };
382
+ type RepoFilter = {
383
+ /** Show only repos matching one of these. Empty or absent means show all. */
384
+ include?: readonly string[];
385
+ /** Hide repos matching one of these. Applied after include, and wins. */
386
+ exclude?: readonly string[];
387
+ };
388
+ /**
389
+ * Whether a repo survives the filter. No include list means everything is in;
390
+ * exclude is applied afterwards and always wins, so a reader can take a whole
391
+ * org and drop one repo from it without listing the rest.
392
+ */
393
+ declare const matchesFilter: (repo: string, filter: RepoFilter) => boolean;
394
+ /**
395
+ * Parse a comma-separated pattern list, as a flag supplies it. Blank entries and
396
+ * surrounding whitespace are dropped, so a trailing comma or a quoted list with
397
+ * spaces after the commas both behave.
398
+ */
399
+ declare const parsePatterns: (value: string) => string[];
400
+
401
+ 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 InboxConfig, type InboxExtension, type JiraTransition, type RepoFilter, type RepoHeader, type RepoProfile, type Section, type ShowLess, type ShowMore, type Standing, type SubgroupHeader, type TaskRow, buildActions, buildCheckoutCmd, checkoutDirs, clipboard, configureInbox, drillCmd, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, healthColor, healthDisplay, healthGlyph, healthLegend, inboxConfig, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, layoutGHItems, matchesFilter, maxViewStart, moveCursor, openInTab, parsePatterns, profileOf, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resetInboxConfig, resolveRepoPath, runHere, runInPane, runInPaneHorizontal, sameCiStatusState, sortByRecency, sortItems, toCiStatusState, topLevelCount, truncate, useActionMenu, whoseMove, windowCount, withHeaders, withoutItem, writeCache };
package/dist/index.js CHANGED
@@ -611,7 +611,8 @@ var healthLegend = [
611
611
  var EMPTY = {
612
612
  repoPriority: [],
613
613
  profiles: [],
614
- cacheNamespace: "gh-ink"
614
+ cacheNamespace: "gh-ink",
615
+ cacheTtlMs: 6e5
615
616
  };
616
617
  var current = EMPTY;
617
618
  var configureInbox = (config) => {
@@ -630,7 +631,7 @@ var checkoutDirs = () => [
630
631
  ];
631
632
 
632
633
  // src/inbox/cache.ts
633
- var CACHE_TTL_MS = 12e4;
634
+ var cacheTtlMs = () => inboxConfig().cacheTtlMs;
634
635
  var CACHE_VERSION = 2;
635
636
  var cacheDir = () => join(
636
637
  process.env.XDG_CACHE_HOME || join(homedir(), ".cache"),
@@ -647,7 +648,7 @@ var readCache = (key) => {
647
648
  return null;
648
649
  }
649
650
  };
650
- var isFresh = (cached, now = Date.now()) => !!cached && now - cached.at < CACHE_TTL_MS;
651
+ var isFresh = (cached, now = Date.now()) => !!cached && now - cached.at < cacheTtlMs();
651
652
  var writeCache = (key, data) => {
652
653
  try {
653
654
  mkdirSync(cacheDir(), { recursive: true });
@@ -2955,4 +2956,18 @@ var App = ({
2955
2956
  ] });
2956
2957
  };
2957
2958
 
2958
- export { ActionMenu, App, COLS, CiStatusLine, CommentsPanel, HealthPanel, buildActions, buildCheckoutCmd, checkoutDirs, clipboard, configureInbox, drillCmd, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, healthColor, healthDisplay, healthGlyph, healthLegend, inboxConfig, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, layoutGHItems, maxViewStart, moveCursor, openInTab, profileOf, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resetInboxConfig, resolveRepoPath, runHere, runInPane, runInPaneHorizontal, sameCiStatusState, sortByRecency, sortItems, toCiStatusState, topLevelCount, truncate, useActionMenu, whoseMove, windowCount, withHeaders, withoutItem, writeCache };
2959
+ // src/inbox/filter.ts
2960
+ var toRegExp = (pattern) => {
2961
+ const full = pattern.includes("/") ? pattern : `${pattern}/*`;
2962
+ const escaped = full.replace(/[.+^${}()|[\]\\]/g, "\\$&");
2963
+ return new RegExp(`^${escaped.replace(/\*/g, "[^/]*")}$`, "i");
2964
+ };
2965
+ var matchesAny = (repo, patterns) => patterns.some((p) => toRegExp(p).test(repo));
2966
+ var matchesFilter = (repo, filter) => {
2967
+ const { include = [], exclude = [] } = filter;
2968
+ if (include.length > 0 && !matchesAny(repo, include)) return false;
2969
+ return !matchesAny(repo, exclude);
2970
+ };
2971
+ var parsePatterns = (value) => value.split(",").map((p) => p.trim()).filter(Boolean);
2972
+
2973
+ export { ActionMenu, App, COLS, CiStatusLine, CommentsPanel, HealthPanel, buildActions, buildCheckoutCmd, checkoutDirs, clipboard, configureInbox, drillCmd, explainItem, filterByOrigin, filterByRepos, filterBySearch, fitCount, healthColor, healthDisplay, healthGlyph, healthLegend, inboxConfig, insertRepoHeaders, itermRun, jumpToRepo, jumpToRepoPane, layoutGHItems, matchesFilter, maxViewStart, moveCursor, openInTab, parsePatterns, profileOf, readCache, relativeTime, renderMarkdown, repoPriority, reposInSections, resetInboxConfig, 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.20.0",
3
+ "version": "0.21.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",