@kud/gh-cockpit 0.4.16 → 0.4.18

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.
Files changed (2) hide show
  1. package/dist/index.js +31 -1
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -97,6 +97,28 @@ var fetchBody = async (kind, repo, number) => {
97
97
  return null;
98
98
  }
99
99
  };
100
+
101
+ // src/views/pr-summary.ts
102
+ var DIVIDER = " \xB7 ";
103
+ var sizeOf = (data) => data.additions === void 0 || data.deletions === void 0 ? null : `+${data.additions} -${data.deletions}`;
104
+ var summaryOf = (item, data, cols) => {
105
+ const size = data ? sizeOf(data) : null;
106
+ const files = data?.changedFiles === void 0 ? null : `${data.changedFiles} ${data.changedFiles === 1 ? "file" : "files"}`;
107
+ const base = data?.baseRefName;
108
+ const author = item.author ? item.author : null;
109
+ const opened = item.age ? `opened ${item.age} ago` : null;
110
+ const branches = base ? item.branch ? `${item.branch} \u2192 ${base}` : `\u2192 ${base}` : item.branch ?? null;
111
+ const parts = (branch) => [branch, author, opened].filter((p) => !!p);
112
+ const full = parts(branches);
113
+ const line = (ps) => ps.join(DIVIDER);
114
+ const width = (ps) => (size ? size.length + DIVIDER.length : 0) + (files ? files.length + DIVIDER.length : 0) + line(ps).length;
115
+ const draft = item.health === "draft";
116
+ const prefix = draft ? `~ draft${DIVIDER}` : "";
117
+ if (width(full) + prefix.length <= cols)
118
+ return { size, files, rest: prefix + line(full) };
119
+ const shortened = parts(base ? `\u2192 ${base}` : null);
120
+ return { size, files, rest: prefix + line(shortened) };
121
+ };
100
122
  var jobIdOf = (url) => url?.match(/\/job\/(\d+)/)?.[1] ?? null;
101
123
  var stripTimestamp = (line) => line.replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z\s?/, "").replace(/\s+$/, "");
102
124
  var colorFor = (clean) => {
@@ -349,6 +371,7 @@ var PrView = ({
349
371
  `pr-health-${item.repo}-${item.number}`,
350
372
  () => fetchHealth(item.repo, item.number)
351
373
  );
374
+ const summary = summaryOf(item, health.data, process.stdout.columns ?? 80);
352
375
  const checkLabel = (c) => c.workflowName ? `${c.workflowName} / ${c.context ?? c.name}` : c.context ?? c.name ?? "";
353
376
  const onOpenCheck = (c) => {
354
377
  const url = c.detailsUrl ?? c.targetUrl ?? "";
@@ -487,7 +510,14 @@ var PrView = ({
487
510
  subtitle: item.title,
488
511
  hints,
489
512
  children: [
490
- /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsx(Tabs, { active: tab, items: tabItems }) }),
513
+ summary.size || summary.files || summary.rest ? /* @__PURE__ */ jsxs(Box, { children: [
514
+ summary.size ? /* @__PURE__ */ jsx(Text, { color: "#FF8700", bold: true, children: summary.size }) : null,
515
+ summary.size && (summary.files || summary.rest) ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \xB7 " }) : null,
516
+ summary.files ? /* @__PURE__ */ jsx(Text, { children: summary.files }) : null,
517
+ summary.files && summary.rest ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \xB7 " }) : null,
518
+ summary.rest ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: summary.rest }) : null
519
+ ] }) : null,
520
+ /* @__PURE__ */ jsx(Box, { marginBottom: 1, marginTop: 1, children: /* @__PURE__ */ jsx(Tabs, { active: tab, items: tabItems }) }),
491
521
  menu.actions ? /* @__PURE__ */ jsx(ActionMenu, { item, actions: menu.actions, cursor: menu.cursor }) : tab === "health" ? /* @__PURE__ */ jsx(
492
522
  HealthPanel,
493
523
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/gh-cockpit",
3
- "version": "0.4.16",
3
+ "version": "0.4.18",
4
4
  "description": "A configurable GitHub cockpit for the terminal — your PRs, reviews and issues in one Ink TUI, grouped by whose move it is.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -53,11 +53,11 @@
53
53
  "react": ">=19"
54
54
  },
55
55
  "dependencies": {
56
- "@kud/gh": "0.12.2",
57
- "@kud/gh-ink": "0.45.7",
56
+ "@kud/gh": "0.12.3",
57
+ "@kud/gh-ink": "0.45.9",
58
58
  "@kud/ink-ui": "0.22.0",
59
59
  "zx": "8.8.5",
60
- "@kud/gh-workflow": "0.3.2"
60
+ "@kud/gh-workflow": "0.3.4"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "22.20.1",