@kud/gh-ink 0.1.0 → 0.3.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 +204 -3
- package/dist/index.js +1783 -13
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { PrComments, PrHealthData, PrCheck, Health } from '@kud/gh';
|
|
3
3
|
import { StyledLine } from '@kud/ink-ui';
|
|
4
4
|
|
|
@@ -9,8 +9,9 @@ type CommentsPanelProps = {
|
|
|
9
9
|
error: string | null;
|
|
10
10
|
reload: () => void;
|
|
11
11
|
onReplyingChange?: (active: boolean) => void;
|
|
12
|
+
showConversationHeading?: boolean;
|
|
12
13
|
};
|
|
13
|
-
declare const CommentsPanel: ({ repo, number, data, error, reload, onReplyingChange, }: CommentsPanelProps) => React.JSX.Element;
|
|
14
|
+
declare const CommentsPanel: ({ repo, number, data, error, reload, onReplyingChange, showConversationHeading, }: CommentsPanelProps) => React.JSX.Element;
|
|
14
15
|
|
|
15
16
|
type HealthPanelProps = {
|
|
16
17
|
repo: string;
|
|
@@ -32,4 +33,204 @@ declare const healthGlyph: (h: Health) => string;
|
|
|
32
33
|
declare const healthColor: (h: Health) => string;
|
|
33
34
|
declare const healthLegend: [Health, string][];
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
interface InboxExtension {
|
|
37
|
+
id: string;
|
|
38
|
+
title: string;
|
|
39
|
+
key: string;
|
|
40
|
+
body: (onExit: () => void, target?: string) => ReactNode;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type GHDetail = {
|
|
44
|
+
reviewDecision?: string;
|
|
45
|
+
mergeable?: string;
|
|
46
|
+
checksPass: number;
|
|
47
|
+
checksFail: number;
|
|
48
|
+
checksPending: number;
|
|
49
|
+
threadsTotal: number;
|
|
50
|
+
lastCommitAt?: string;
|
|
51
|
+
lastEventAt?: string;
|
|
52
|
+
};
|
|
53
|
+
type GHItem = {
|
|
54
|
+
kind: "pr" | "issue";
|
|
55
|
+
number: number;
|
|
56
|
+
title: string;
|
|
57
|
+
repo: string;
|
|
58
|
+
url: string;
|
|
59
|
+
branch?: string;
|
|
60
|
+
health: Health;
|
|
61
|
+
author?: string;
|
|
62
|
+
age: string;
|
|
63
|
+
ts: number;
|
|
64
|
+
unresolved: number;
|
|
65
|
+
conversation: number;
|
|
66
|
+
lastActor?: string;
|
|
67
|
+
detail?: GHDetail;
|
|
68
|
+
indent: boolean;
|
|
69
|
+
};
|
|
70
|
+
type JiraRow = {
|
|
71
|
+
kind: "jira";
|
|
72
|
+
key: string;
|
|
73
|
+
summary: string;
|
|
74
|
+
url: string;
|
|
75
|
+
jiraStatus: string;
|
|
76
|
+
age: string;
|
|
77
|
+
indent: boolean;
|
|
78
|
+
instanceKey?: string;
|
|
79
|
+
};
|
|
80
|
+
type RepoHeader = {
|
|
81
|
+
kind: "repo-header";
|
|
82
|
+
repo: string;
|
|
83
|
+
age: string;
|
|
84
|
+
indent: boolean;
|
|
85
|
+
};
|
|
86
|
+
type ShowMore = {
|
|
87
|
+
kind: "show-more";
|
|
88
|
+
hidden: GHItem[];
|
|
89
|
+
indent: boolean;
|
|
90
|
+
};
|
|
91
|
+
type ShowLess = {
|
|
92
|
+
kind: "show-less";
|
|
93
|
+
toHide: GHItem[];
|
|
94
|
+
indent: boolean;
|
|
95
|
+
};
|
|
96
|
+
type SubgroupHeader = {
|
|
97
|
+
kind: "subgroup-header";
|
|
98
|
+
label: string;
|
|
99
|
+
age: string;
|
|
100
|
+
indent: boolean;
|
|
101
|
+
};
|
|
102
|
+
type AnyItem = GHItem | JiraRow | RepoHeader | SubgroupHeader | ShowMore | ShowLess;
|
|
103
|
+
type CiStatus = {
|
|
104
|
+
job: string;
|
|
105
|
+
buildNumber: number;
|
|
106
|
+
result: string;
|
|
107
|
+
building: boolean;
|
|
108
|
+
url: string;
|
|
109
|
+
age: string;
|
|
110
|
+
};
|
|
111
|
+
type Section = {
|
|
112
|
+
id: string;
|
|
113
|
+
label: string;
|
|
114
|
+
items: AnyItem[];
|
|
115
|
+
};
|
|
116
|
+
type DetailContext = {
|
|
117
|
+
item: GHItem;
|
|
118
|
+
kind: "pr" | "issue";
|
|
119
|
+
login: string;
|
|
120
|
+
onBack: () => void;
|
|
121
|
+
onRefresh: () => void;
|
|
122
|
+
onRemove: (item: GHItem) => void;
|
|
123
|
+
};
|
|
124
|
+
type Action = {
|
|
125
|
+
label: string;
|
|
126
|
+
hint: string;
|
|
127
|
+
run: () => void;
|
|
128
|
+
subActions?: Action[];
|
|
129
|
+
};
|
|
130
|
+
type JiraTransition = {
|
|
131
|
+
label: string;
|
|
132
|
+
state: string;
|
|
133
|
+
resolutions?: string[];
|
|
134
|
+
};
|
|
135
|
+
declare const relativeTime: (iso: string) => string;
|
|
136
|
+
type ExplainSection = {
|
|
137
|
+
heading: string;
|
|
138
|
+
lines: string[];
|
|
139
|
+
};
|
|
140
|
+
declare const explainItem: (item: GHItem, login: string) => ExplainSection[];
|
|
141
|
+
declare const repoPriority: (repo: string) => number;
|
|
142
|
+
declare const sortItems: (items: GHItem[]) => GHItem[];
|
|
143
|
+
declare const sortByRecency: (items: GHItem[]) => GHItem[];
|
|
144
|
+
declare const insertRepoHeaders: (items: GHItem[]) => AnyItem[];
|
|
145
|
+
declare const layoutGHItems: (items: GHItem[], sectionId: string) => AnyItem[];
|
|
146
|
+
declare const filterByOrigin: (sections: Section[], keep: "work" | "home", isWorkRepo: (repo: string) => boolean) => Section[];
|
|
147
|
+
declare const filterBySearch: (sections: Section[], query: string) => Section[];
|
|
148
|
+
declare const filterByRepos: (sections: Section[], repos: Set<string>) => Section[];
|
|
149
|
+
declare const withoutItem: (sections: Section[], target: GHItem) => Section[];
|
|
150
|
+
declare const reposInSections: (sections: Section[]) => string[];
|
|
151
|
+
declare const moveCursor: (items: AnyItem[], current: number, dir: 1 | -1) => number;
|
|
152
|
+
declare const fitCount: (items: AnyItem[], start: number, budget: number) => number;
|
|
153
|
+
declare const windowCount: (items: AnyItem[], start: number, budget: number) => number;
|
|
154
|
+
declare const maxViewStart: (items: AnyItem[], budget: number) => number;
|
|
155
|
+
declare const withHeaders: (items: AnyItem[], idx: number) => number;
|
|
156
|
+
declare const truncate: (str: string, max: number) => string;
|
|
157
|
+
declare const clipboard: (text: string) => void;
|
|
158
|
+
declare const buildCheckoutCmd: (repoFull: string, branch: string, login: string) => Promise<string>;
|
|
159
|
+
declare const resolveRepoPath: (repoFull: string) => Promise<string | null>;
|
|
160
|
+
declare const itermRun: (cmd: string, appleScript: string) => Promise<void>;
|
|
161
|
+
declare const jumpToRepo: (repoFull: string, branch: string, login: string) => Promise<void>;
|
|
162
|
+
declare const runInPane: (cmd: string) => Promise<void>;
|
|
163
|
+
declare const jumpToRepoPane: (repoFull: string, branch: string, login: string) => Promise<void>;
|
|
164
|
+
declare const openInTab: (cmd: string) => Promise<void>;
|
|
165
|
+
declare const runInPaneHorizontal: (cmd: string) => Promise<void>;
|
|
166
|
+
declare const runHere: (cmd: string) => void;
|
|
167
|
+
declare const COLS: number;
|
|
168
|
+
declare const topLevelCount: (s: Section) => number;
|
|
169
|
+
declare const drillCmd: (item: AnyItem) => string | null;
|
|
170
|
+
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[];
|
|
171
|
+
type CiStatusState = {
|
|
172
|
+
kind: "loading";
|
|
173
|
+
} | {
|
|
174
|
+
kind: "error";
|
|
175
|
+
} | {
|
|
176
|
+
kind: "ready";
|
|
177
|
+
status: CiStatus;
|
|
178
|
+
};
|
|
179
|
+
declare const toCiStatusState: (status: CiStatus | null) => CiStatusState;
|
|
180
|
+
declare const sameCiStatusState: (a: CiStatusState, b: CiStatusState) => boolean;
|
|
181
|
+
declare const CiStatusLine: ({ state, job, }: {
|
|
182
|
+
state: CiStatusState;
|
|
183
|
+
job?: string;
|
|
184
|
+
}) => React.JSX.Element;
|
|
185
|
+
declare const useActionMenu: () => {
|
|
186
|
+
actions: Action[] | null;
|
|
187
|
+
cursor: number;
|
|
188
|
+
open: (next: Action[]) => void;
|
|
189
|
+
close: () => void;
|
|
190
|
+
handleKey: (key: {
|
|
191
|
+
upArrow?: boolean;
|
|
192
|
+
downArrow?: boolean;
|
|
193
|
+
return?: boolean;
|
|
194
|
+
escape?: boolean;
|
|
195
|
+
}) => boolean;
|
|
196
|
+
};
|
|
197
|
+
declare const ActionMenu: ({ item, actions, cursor, }: {
|
|
198
|
+
item: AnyItem;
|
|
199
|
+
actions: Action[];
|
|
200
|
+
cursor: number;
|
|
201
|
+
}) => React.JSX.Element;
|
|
202
|
+
declare const App: ({ fetcher, cacheKey, title, detailFor, isWorkRepo, initialIncludeWork, jiraBase, jiraKeyRe, jiraTransitions, workToggle, hasCiStatus, ciJob, ciFetcher, ciPollMs, extensions, tabHelp, }: {
|
|
203
|
+
fetcher: () => Promise<{
|
|
204
|
+
sections: Section[];
|
|
205
|
+
login: string;
|
|
206
|
+
ciStatus?: CiStatus | null;
|
|
207
|
+
}>;
|
|
208
|
+
cacheKey?: string;
|
|
209
|
+
title?: string;
|
|
210
|
+
detailFor?: (ctx: DetailContext) => React.ReactNode;
|
|
211
|
+
isWorkRepo?: (repo: string) => boolean;
|
|
212
|
+
initialIncludeWork?: boolean;
|
|
213
|
+
tabHelp?: [string, string][];
|
|
214
|
+
jiraBase?: string;
|
|
215
|
+
jiraKeyRe?: RegExp;
|
|
216
|
+
jiraTransitions?: JiraTransition[];
|
|
217
|
+
workToggle?: boolean;
|
|
218
|
+
hasCiStatus?: boolean;
|
|
219
|
+
ciJob?: string;
|
|
220
|
+
ciFetcher?: () => Promise<CiStatus | null>;
|
|
221
|
+
ciPollMs?: number;
|
|
222
|
+
extensions?: InboxExtension[];
|
|
223
|
+
}) => React.JSX.Element;
|
|
224
|
+
|
|
225
|
+
type CachedCockpit = {
|
|
226
|
+
sections: Section[];
|
|
227
|
+
login: string;
|
|
228
|
+
at: number;
|
|
229
|
+
};
|
|
230
|
+
declare const readCache: (key: string) => CachedCockpit | null;
|
|
231
|
+
declare const writeCache: (key: string, data: {
|
|
232
|
+
sections: Section[];
|
|
233
|
+
login: string;
|
|
234
|
+
}) => void;
|
|
235
|
+
|
|
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 };
|