@kud/gh-cockpit 0.4.15 → 0.4.17
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.js +36 -3
- 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) => [files, 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) + 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, rest: prefix + line(full) };
|
|
119
|
+
const shortened = parts(base ? `\u2192 ${base}` : null);
|
|
120
|
+
return { size, 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) => {
|
|
@@ -131,6 +153,8 @@ var processLog = (raw) => {
|
|
|
131
153
|
const jumpTo = firstError >= 0 ? Math.max(0, firstError - 3) : Math.max(0, lines.length - 1);
|
|
132
154
|
return { lines, jumpTo };
|
|
133
155
|
};
|
|
156
|
+
var ANSI = /\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g;
|
|
157
|
+
var stripAnsi = (s) => s.replace(ANSI, "");
|
|
134
158
|
var CheckLogView = ({
|
|
135
159
|
repo,
|
|
136
160
|
jobId,
|
|
@@ -141,8 +165,11 @@ var CheckLogView = ({
|
|
|
141
165
|
const [state, setState] = useState({ phase: "loading" });
|
|
142
166
|
useEffect(() => {
|
|
143
167
|
let live = true;
|
|
144
|
-
$`gh api repos/${repo}/actions/jobs/${jobId}/logs`.quiet().then(
|
|
145
|
-
(r) => live && setState({
|
|
168
|
+
$`gh api --allow-escape-sequences repos/${repo}/actions/jobs/${jobId}/logs`.quiet().then(
|
|
169
|
+
(r) => live && setState({
|
|
170
|
+
phase: "ready",
|
|
171
|
+
lines: stripAnsi(r.stdout).split("\n")
|
|
172
|
+
})
|
|
146
173
|
).catch(
|
|
147
174
|
(e) => live && setState({ phase: "error", message: e.message })
|
|
148
175
|
);
|
|
@@ -344,6 +371,7 @@ var PrView = ({
|
|
|
344
371
|
`pr-health-${item.repo}-${item.number}`,
|
|
345
372
|
() => fetchHealth(item.repo, item.number)
|
|
346
373
|
);
|
|
374
|
+
const summary = summaryOf(item, health.data, process.stdout.columns ?? 80);
|
|
347
375
|
const checkLabel = (c) => c.workflowName ? `${c.workflowName} / ${c.context ?? c.name}` : c.context ?? c.name ?? "";
|
|
348
376
|
const onOpenCheck = (c) => {
|
|
349
377
|
const url = c.detailsUrl ?? c.targetUrl ?? "";
|
|
@@ -482,7 +510,12 @@ var PrView = ({
|
|
|
482
510
|
subtitle: item.title,
|
|
483
511
|
hints,
|
|
484
512
|
children: [
|
|
485
|
-
|
|
513
|
+
summary.size || summary.rest ? /* @__PURE__ */ jsxs(Box, { children: [
|
|
514
|
+
summary.size ? /* @__PURE__ */ jsx(Text, { children: summary.size }) : null,
|
|
515
|
+
summary.size && summary.rest ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: " \xB7 " }) : null,
|
|
516
|
+
summary.rest ? /* @__PURE__ */ jsx(Text, { dimColor: true, children: summary.rest }) : null
|
|
517
|
+
] }) : null,
|
|
518
|
+
/* @__PURE__ */ jsx(Box, { marginBottom: 1, marginTop: 1, children: /* @__PURE__ */ jsx(Tabs, { active: tab, items: tabItems }) }),
|
|
486
519
|
menu.actions ? /* @__PURE__ */ jsx(ActionMenu, { item, actions: menu.actions, cursor: menu.cursor }) : tab === "health" ? /* @__PURE__ */ jsx(
|
|
487
520
|
HealthPanel,
|
|
488
521
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/gh-cockpit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.17",
|
|
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.
|
|
57
|
-
"@kud/gh-ink": "0.45.
|
|
56
|
+
"@kud/gh": "0.12.3",
|
|
57
|
+
"@kud/gh-ink": "0.45.8",
|
|
58
58
|
"@kud/ink-ui": "0.22.0",
|
|
59
59
|
"zx": "8.8.5",
|
|
60
|
-
"@kud/gh-workflow": "0.3.
|
|
60
|
+
"@kud/gh-workflow": "0.3.3"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "22.20.1",
|