@kud/gh-ink 0.3.1 → 0.4.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 +7 -2
- package/dist/index.js +28 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,11 +33,16 @@ declare const healthGlyph: (h: Health) => string;
|
|
|
33
33
|
declare const healthColor: (h: Health) => string;
|
|
34
34
|
declare const healthLegend: [Health, string][];
|
|
35
35
|
|
|
36
|
+
type ExtensionTarget = {
|
|
37
|
+
item?: AnyItem;
|
|
38
|
+
ciJob?: string;
|
|
39
|
+
login: string;
|
|
40
|
+
};
|
|
36
41
|
interface InboxExtension {
|
|
37
42
|
id: string;
|
|
38
43
|
title: string;
|
|
39
44
|
key: string;
|
|
40
|
-
body: (onExit: () => void, target?:
|
|
45
|
+
body: (onExit: () => void, target?: ExtensionTarget) => ReactNode;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
type GHDetail = {
|
|
@@ -233,4 +238,4 @@ declare const writeCache: (key: string, data: {
|
|
|
233
238
|
login: string;
|
|
234
239
|
}) => void;
|
|
235
240
|
|
|
236
|
-
export { type Action, ActionMenu, type AnyItem, App, COLS, type CiStatus, CiStatusLine, type CiStatusState, CommentsPanel, type CommentsPanelProps, type DetailContext, type ExplainSection, type GHDetail, type GHItem, HealthPanel, type HealthPanelProps, type InboxExtension, type JiraRow, type JiraTransition, type RepoHeader, type Section, type ShowLess, type ShowMore, type SubgroupHeader, 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 };
|
|
241
|
+
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 JiraRow, type JiraTransition, type RepoHeader, type Section, type ShowLess, type ShowMore, type SubgroupHeader, 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 };
|
package/dist/index.js
CHANGED
|
@@ -622,6 +622,7 @@ var writeCache = (key, data) => {
|
|
|
622
622
|
} catch {
|
|
623
623
|
}
|
|
624
624
|
};
|
|
625
|
+
var quietly = $({ quiet: true });
|
|
625
626
|
var relativeTime = (iso) => {
|
|
626
627
|
const diff = (Date.now() - new Date(iso).getTime()) / 1e3;
|
|
627
628
|
if (diff < 3600) return `${Math.floor(diff / 60)}m`;
|
|
@@ -1071,7 +1072,7 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1071
1072
|
label: "Open in browser",
|
|
1072
1073
|
hint: "o",
|
|
1073
1074
|
run: () => {
|
|
1074
|
-
|
|
1075
|
+
quietly`open ${item.url}`.catch(() => {
|
|
1075
1076
|
});
|
|
1076
1077
|
showFlash("\u2197 Opened in browser");
|
|
1077
1078
|
}
|
|
@@ -1118,7 +1119,7 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1118
1119
|
hint: "",
|
|
1119
1120
|
run: () => {
|
|
1120
1121
|
showFlash(`\u22EF ${label} \xB7 ${resolution}\u2026`);
|
|
1121
|
-
void
|
|
1122
|
+
void quietly`jira issue move ${item.key} ${state} --resolution ${resolution}`.then(() => {
|
|
1122
1123
|
showFlash(`\u2713 ${label} \xB7 ${resolution}`);
|
|
1123
1124
|
setTimeout(() => onRefresh?.(), 1500);
|
|
1124
1125
|
}).catch(() => showFlash(`\u2717 Move to ${label} failed`));
|
|
@@ -1129,7 +1130,7 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1129
1130
|
hint: "",
|
|
1130
1131
|
run: () => {
|
|
1131
1132
|
showFlash(`\u22EF Moving to ${label}\u2026`);
|
|
1132
|
-
void
|
|
1133
|
+
void quietly`jira issue move ${item.key} ${state}`.then(() => {
|
|
1133
1134
|
showFlash(`\u2713 Moved to ${label}`);
|
|
1134
1135
|
setTimeout(() => onRefresh?.(), 1500);
|
|
1135
1136
|
}).catch(() => showFlash(`\u2717 Move to ${label} failed`));
|
|
@@ -1210,7 +1211,7 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1210
1211
|
run: () => {
|
|
1211
1212
|
onRemove?.(item);
|
|
1212
1213
|
showFlash(`\u2713 Closed #${item.number}`);
|
|
1213
|
-
void
|
|
1214
|
+
void quietly`gh issue close ${item.number} --repo ${item.repo}`.catch(
|
|
1214
1215
|
() => {
|
|
1215
1216
|
showFlash(`\u2717 Close failed \u2014 restoring #${item.number}`);
|
|
1216
1217
|
onRefresh?.();
|
|
@@ -1247,7 +1248,7 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1247
1248
|
label: `Open ${jiraKey} in Jira`,
|
|
1248
1249
|
hint: "t",
|
|
1249
1250
|
run: () => {
|
|
1250
|
-
|
|
1251
|
+
quietly`open ${jiraBase}/${jiraKey}`.catch(() => {
|
|
1251
1252
|
});
|
|
1252
1253
|
showFlash(`\u2197 Opened ${jiraKey} in Jira`);
|
|
1253
1254
|
}
|
|
@@ -1266,10 +1267,12 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1266
1267
|
run: () => {
|
|
1267
1268
|
onRemove?.(item);
|
|
1268
1269
|
showFlash(`\u2713 Closed #${item.number}`);
|
|
1269
|
-
void
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1270
|
+
void quietly`gh pr close ${item.number} --repo ${item.repo}`.catch(
|
|
1271
|
+
() => {
|
|
1272
|
+
showFlash(`\u2717 Close failed \u2014 restoring #${item.number}`);
|
|
1273
|
+
onRefresh?.();
|
|
1274
|
+
}
|
|
1275
|
+
);
|
|
1273
1276
|
}
|
|
1274
1277
|
},
|
|
1275
1278
|
{ label: "Cancel", hint: "", run: () => {
|
|
@@ -1289,8 +1292,8 @@ var buildActions = (item, login, showFlash, jiraBase, jiraKeyRe, jiraTransitions
|
|
|
1289
1292
|
run: () => {
|
|
1290
1293
|
onRemove?.(item);
|
|
1291
1294
|
showFlash(`\u2713 Closed #${item.number} and deleted ${item.branch}`);
|
|
1292
|
-
void
|
|
1293
|
-
() =>
|
|
1295
|
+
void quietly`gh pr close ${item.number} --repo ${item.repo}`.then(
|
|
1296
|
+
() => quietly`gh api -X DELETE ${`repos/${item.repo}/git/refs/heads/${item.branch}`}`
|
|
1294
1297
|
).catch(() => {
|
|
1295
1298
|
showFlash(`\u2717 Close + delete failed \u2014 restoring`);
|
|
1296
1299
|
onRefresh?.();
|
|
@@ -1654,6 +1657,7 @@ var RepoPicker = ({
|
|
|
1654
1657
|
}
|
|
1655
1658
|
);
|
|
1656
1659
|
};
|
|
1660
|
+
var extensionFor = (input, extensions) => input ? extensions?.find((e) => e.key === input) : void 0;
|
|
1657
1661
|
var BrowseScreen = ({
|
|
1658
1662
|
sections,
|
|
1659
1663
|
login,
|
|
@@ -1669,6 +1673,7 @@ var BrowseScreen = ({
|
|
|
1669
1673
|
onOpenPr,
|
|
1670
1674
|
onOpenIssue,
|
|
1671
1675
|
onOpenExt,
|
|
1676
|
+
extensions,
|
|
1672
1677
|
ciStatusState,
|
|
1673
1678
|
ciJob,
|
|
1674
1679
|
tabHelp,
|
|
@@ -1889,8 +1894,13 @@ var BrowseScreen = ({
|
|
|
1889
1894
|
if (keptIdx >= 0) setTabIdx(keptIdx);
|
|
1890
1895
|
return;
|
|
1891
1896
|
}
|
|
1892
|
-
|
|
1893
|
-
|
|
1897
|
+
const ext = extensionFor(input, extensions);
|
|
1898
|
+
if (ext) {
|
|
1899
|
+
onOpenExt?.(ext.id, {
|
|
1900
|
+
item: activeItem ?? void 0,
|
|
1901
|
+
ciJob: ciStatus?.job,
|
|
1902
|
+
login
|
|
1903
|
+
});
|
|
1894
1904
|
return;
|
|
1895
1905
|
}
|
|
1896
1906
|
if (!activeItem || activeItem.kind === "repo-header" || activeItem.kind === "subgroup-header")
|
|
@@ -1946,7 +1956,7 @@ var BrowseScreen = ({
|
|
|
1946
1956
|
return;
|
|
1947
1957
|
}
|
|
1948
1958
|
if (input === "o") {
|
|
1949
|
-
|
|
1959
|
+
quietly`open ${activeItem.url}`.catch(() => {
|
|
1950
1960
|
});
|
|
1951
1961
|
const label = activeItem.kind === "jira" ? activeItem.key : `#${activeItem.number}`;
|
|
1952
1962
|
showFlash(`\u2197 Opened ${label}`);
|
|
@@ -2012,7 +2022,7 @@ var BrowseScreen = ({
|
|
|
2012
2022
|
run: () => {
|
|
2013
2023
|
menu.close();
|
|
2014
2024
|
showFlash(`\u22EF ${label} \xB7 ${resolution}\u2026`);
|
|
2015
|
-
|
|
2025
|
+
quietly`jira issue move ${jiraKey} ${state} --resolution ${resolution}`.then(() => {
|
|
2016
2026
|
showFlash(`\u2713 ${label} \xB7 ${resolution}`);
|
|
2017
2027
|
setTimeout(() => onRefresh?.(), 1500);
|
|
2018
2028
|
}).catch(() => showFlash(`\u2717 Move to ${label} failed`));
|
|
@@ -2024,7 +2034,7 @@ var BrowseScreen = ({
|
|
|
2024
2034
|
run: () => {
|
|
2025
2035
|
menu.close();
|
|
2026
2036
|
showFlash(`\u22EF Moving to ${label}\u2026`);
|
|
2027
|
-
|
|
2037
|
+
quietly`jira issue move ${jiraKey} ${state}`.then(() => {
|
|
2028
2038
|
showFlash(`\u2713 Moved to ${label}`);
|
|
2029
2039
|
setTimeout(() => onRefresh?.(), 1500);
|
|
2030
2040
|
}).catch(() => showFlash(`\u2717 Move to ${label} failed`));
|
|
@@ -2364,7 +2374,8 @@ var App = ({
|
|
|
2364
2374
|
target,
|
|
2365
2375
|
sections: state.sections,
|
|
2366
2376
|
login: state.login
|
|
2367
|
-
})
|
|
2377
|
+
}),
|
|
2378
|
+
extensions
|
|
2368
2379
|
}
|
|
2369
2380
|
),
|
|
2370
2381
|
(overlay?.kind === "pr" || overlay?.kind === "issue") && detailFor?.({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/gh-ink",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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",
|