@kud/gh-cockpit 0.0.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/LICENSE +21 -0
- package/README.md +162 -0
- package/dist/chunk-A3NXVFEI.js +311 -0
- package/dist/extensions/index.d.ts +7 -0
- package/dist/extensions/index.js +69 -0
- package/dist/index.d.ts +124 -0
- package/dist/index.js +624 -0
- package/package.json +71 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { GHItem, RepoFilter, InboxExtension, DetailContext } from '@kud/gh-ink';
|
|
3
|
+
export * from '@kud/gh-ink';
|
|
4
|
+
import { Health } from '@kud/gh';
|
|
5
|
+
export { buildInboxQuery } from '@kud/gh';
|
|
6
|
+
|
|
7
|
+
declare const withRetry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
8
|
+
declare const computeHealth: (node: any) => Health;
|
|
9
|
+
type CockpitItem = GHItem & {
|
|
10
|
+
labels?: string[];
|
|
11
|
+
};
|
|
12
|
+
declare const toGHItem: (node: any, opts?: {
|
|
13
|
+
indent?: boolean;
|
|
14
|
+
}) => CockpitItem;
|
|
15
|
+
declare const signalPath: () => string;
|
|
16
|
+
|
|
17
|
+
type CheckDrillContext = {
|
|
18
|
+
/** `owner/name` of the PR the check belongs to. */
|
|
19
|
+
repo: string;
|
|
20
|
+
/** The check's details URL, as GitHub reported it. */
|
|
21
|
+
url: string;
|
|
22
|
+
/** Human label for the check, for the view's own chrome. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Return focus to the PR view. */
|
|
25
|
+
onBack: () => void;
|
|
26
|
+
};
|
|
27
|
+
type CheckDrill = {
|
|
28
|
+
/** Whether this viewer handles the URL. Cheap and synchronous — it runs per activation. */
|
|
29
|
+
match: (url: string) => boolean;
|
|
30
|
+
render: (ctx: CheckDrillContext) => ReactNode;
|
|
31
|
+
};
|
|
32
|
+
/** Supply the host's CI drill-ins. Call once, before rendering. */
|
|
33
|
+
declare const registerCheckDrills: (drills: readonly CheckDrill[]) => void;
|
|
34
|
+
declare const checkDrillFor: (url: string) => CheckDrill | null;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* One tab. `searches` are GitHub search qualifiers, run as written and folded
|
|
38
|
+
* into a single tab — which is how a tab can draw on more than one search while
|
|
39
|
+
* still banding each row correctly.
|
|
40
|
+
*
|
|
41
|
+
* `standing` says where YOU stand on the rows a search returns, and it cannot be
|
|
42
|
+
* recovered from a row afterwards: the same "awaiting review" is your work when
|
|
43
|
+
* a review was requested of you and somebody else's once you have given one.
|
|
44
|
+
* The two are different searches and nothing else tells them apart.
|
|
45
|
+
*/
|
|
46
|
+
type TabSearch = {
|
|
47
|
+
/** Search qualifiers, minus `is:pr` — e.g. `review-requested:@me`. */
|
|
48
|
+
q: string;
|
|
49
|
+
standing?: "authored" | "queued" | "spoken";
|
|
50
|
+
};
|
|
51
|
+
type TabSpec = {
|
|
52
|
+
/** Shown on the tab, and in the `?` legend. Yours to word. */
|
|
53
|
+
label: string;
|
|
54
|
+
/** One line saying what this tab holds, for the legend. */
|
|
55
|
+
help?: string;
|
|
56
|
+
searches: readonly (string | TabSearch)[];
|
|
57
|
+
};
|
|
58
|
+
type CockpitConfig = {
|
|
59
|
+
tabs: readonly TabSpec[];
|
|
60
|
+
/**
|
|
61
|
+
* Repo ranking, best first. `acme/` matches an owner, `acme/monorepo` matches
|
|
62
|
+
* one repo, so a repo can outrank the owner containing it.
|
|
63
|
+
*/
|
|
64
|
+
repoPriority?: readonly string[];
|
|
65
|
+
/** Default filter, which `--include` / `--exclude` override. */
|
|
66
|
+
filter?: RepoFilter;
|
|
67
|
+
/** Named filters, invoked as `gh-cockpit <name>`. */
|
|
68
|
+
filters?: Record<string, RepoFilter>;
|
|
69
|
+
/** Where checkouts live, for the drill-in that opens one. */
|
|
70
|
+
checkoutDir?: string;
|
|
71
|
+
/** Cache directory name and how long a cached inbox is trusted. */
|
|
72
|
+
cacheNamespace?: string;
|
|
73
|
+
cacheTtlMs?: number;
|
|
74
|
+
/** Where a CI check drills in. Nothing registered means checks open in a browser. */
|
|
75
|
+
checkDrills?: readonly CheckDrill[];
|
|
76
|
+
extensions?: readonly InboxExtension[];
|
|
77
|
+
/** Rendered instead of the row's default drill-in, when supplied. */
|
|
78
|
+
detailFor?: (ctx: never) => ReactNode;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Identity, but typed — so a config file is checked against the schema at build
|
|
82
|
+
* time rather than producing an empty tab at runtime. The one thing a YAML
|
|
83
|
+
* config could not have given us.
|
|
84
|
+
*/
|
|
85
|
+
declare const defineCockpit: (config: CockpitConfig) => CockpitConfig;
|
|
86
|
+
|
|
87
|
+
type CockpitArgs = {
|
|
88
|
+
/** Scope every search to the repo you are standing in. */
|
|
89
|
+
here: boolean;
|
|
90
|
+
/** Named filter from config, given positionally: `gh-cockpit work`. */
|
|
91
|
+
named?: string;
|
|
92
|
+
/** Patterns from the flags, which override a named or default filter. */
|
|
93
|
+
filter: RepoFilter;
|
|
94
|
+
};
|
|
95
|
+
declare const parseArgs: (argv: readonly string[]) => CockpitArgs;
|
|
96
|
+
/** Whether the flags said anything at all, which decides if they override. */
|
|
97
|
+
declare const hasPatterns: (f: RepoFilter) => boolean;
|
|
98
|
+
|
|
99
|
+
declare const detailFor: (ctx: DetailContext) => React.JSX.Element;
|
|
100
|
+
|
|
101
|
+
type Tab = "health" | "conversation";
|
|
102
|
+
declare const PrView: ({ item, login, onBack, defaultTab, onRefresh, onRemove, onMerged, }: {
|
|
103
|
+
item: GHItem;
|
|
104
|
+
login: string;
|
|
105
|
+
onBack: () => void;
|
|
106
|
+
defaultTab?: Tab;
|
|
107
|
+
onRefresh?: () => void;
|
|
108
|
+
onRemove?: (item: GHItem) => void;
|
|
109
|
+
onMerged?: (item: GHItem) => void;
|
|
110
|
+
}) => React.JSX.Element;
|
|
111
|
+
|
|
112
|
+
declare const IssueView: ({ item, login, onBack, }: {
|
|
113
|
+
item: {
|
|
114
|
+
number: number;
|
|
115
|
+
repo: string;
|
|
116
|
+
url: string;
|
|
117
|
+
title?: string;
|
|
118
|
+
labels?: string[];
|
|
119
|
+
};
|
|
120
|
+
login: string;
|
|
121
|
+
onBack: () => void;
|
|
122
|
+
}) => React.JSX.Element;
|
|
123
|
+
|
|
124
|
+
export { type CheckDrill, type CheckDrillContext, type CockpitArgs, type CockpitConfig, type CockpitItem, IssueView, PrView, type TabSearch, type TabSpec, checkDrillFor, computeHealth, defineCockpit, detailFor, hasPatterns, parseArgs, registerCheckDrills, signalPath, toGHItem, withRetry };
|