@theholocron/holocron-plugin-github 5.0.0-alpha.32 → 5.0.0-alpha.326
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/README.md +1 -1
- package/dist/index.d.mts +164 -70
- package/dist/index.mjs +594 -67
- package/package.json +25 -21
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ holocron auth set github.release ghp_xxx # semantic-release
|
|
|
45
45
|
holocron auth set github.admin ghp_xxx # setup, secrets, environments
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
See [
|
|
48
|
+
See the [token reference](https://docs.theholocron.dev/holocron/tokens/) for full scope requirements and CI setup.
|
|
49
49
|
|
|
50
50
|
## Config
|
|
51
51
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,47 +1,65 @@
|
|
|
1
|
+
import { Auth, AuthError, Ci, CiRun, CiRunFilter, Environment, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, PagesConfig, PluginToken, PullRequest, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretScope, Secrets, Source, SourceBranch, SourceFile, SourceRepoInfo, SourceRulesetDetail, SourceSecurity, SourceTeamMember, TeamEntry, TeamEntry as TeamEntry$1, TeamPermission, TeamPermission as TeamPermission$1, TrackerDoctorReport, TrackerUser, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, createFeatureResolver } from "@theholocron/cli";
|
|
1
2
|
import { GitHubClient, GitHubClientOptions, createGitHubClient } from "@theholocron/github-client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const resolveIssuesToken: (
|
|
6
|
-
|
|
7
|
-
declare const
|
|
8
|
-
|
|
9
|
-
declare const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
/** Resolves the token for read-only GitHub access (`HOLOCRON_READ_TOKEN`, keyring key `github.read`). */
|
|
4
|
+
export declare const resolveReadToken: import("@theholocron/cli").FeatureResolver;
|
|
5
|
+
/** Resolves the token for issue operations (`HOLOCRON_ISSUES_TOKEN`, keyring key `github.issues`). */
|
|
6
|
+
export declare const resolveIssuesToken: import("@theholocron/cli").FeatureResolver;
|
|
7
|
+
/** Resolves the token for syncing repo files and settings (`HOLOCRON_SYNC_TOKEN`, keyring key `github.sync`). */
|
|
8
|
+
export declare const resolveSyncToken: import("@theholocron/cli").FeatureResolver;
|
|
9
|
+
/** Resolves the token for release operations (`HOLOCRON_RELEASE_TOKEN`, keyring key `github.release`). */
|
|
10
|
+
export declare const resolveReleaseToken: import("@theholocron/cli").FeatureResolver;
|
|
11
|
+
/** Resolves the repo-scoped admin token (`HOLOCRON_ADMIN_TOKEN`, keyring key `github.admin`). */
|
|
12
|
+
export declare const resolveAdminToken: import("@theholocron/cli").FeatureResolver;
|
|
13
|
+
/** Resolves the org-level secrets token (`HOLOCRON_SECRETS_TOKEN`, keyring key `github.secrets`). */
|
|
14
|
+
export declare const resolveSecretsToken: import("@theholocron/cli").FeatureResolver;
|
|
15
|
+
/** Resolves the token for deployment operations (`HOLOCRON_DEPLOY_TOKEN`, keyring key `github.deploy`). */
|
|
16
|
+
export declare const resolveDeployToken: import("@theholocron/cli").FeatureResolver;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the token for the user-sync files in the org's private config repo (`HOLOCRON_USER_SYNC_TOKEN`, keyring
|
|
19
|
+
* key `github.user-sync`).
|
|
20
|
+
*/
|
|
21
|
+
export declare const resolveUserSyncToken: import("@theholocron/cli").FeatureResolver;
|
|
22
|
+
/** Resolves the org-level token (`HOLOCRON_ORG_TOKEN`, keyring key `github.org`). */
|
|
23
|
+
export declare const resolveOrgToken: import("@theholocron/cli").FeatureResolver;
|
|
13
24
|
interface CiOptions {
|
|
14
25
|
repo: string;
|
|
15
26
|
}
|
|
16
|
-
|
|
27
|
+
/** The GitHub implementation of the `ci` capability, backed by GitHub Actions workflow runs. */
|
|
28
|
+
export declare class GitHubCi implements Ci {
|
|
17
29
|
private readonly client;
|
|
18
30
|
private readonly opts;
|
|
31
|
+
/** Capability key, always `"ci"`. */
|
|
19
32
|
readonly key: "ci";
|
|
33
|
+
/** Provider name, always `"github"`. */
|
|
20
34
|
readonly providerName = "github";
|
|
21
35
|
constructor(client: GitHubClient, opts: CiOptions);
|
|
36
|
+
/** Lists workflow runs for the repo, optionally filtered by branch, status and limit. */
|
|
22
37
|
listRuns(filter?: CiRunFilter): Promise<CiRun[]>;
|
|
38
|
+
/** Fetches one workflow run by id. */
|
|
23
39
|
getRun(id: string | number): Promise<CiRun>;
|
|
24
40
|
private mapRun;
|
|
25
41
|
private mapConclusion;
|
|
26
42
|
}
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/capabilities/environments.d.ts
|
|
29
43
|
interface EnvironmentsOptions {
|
|
30
44
|
repo: string;
|
|
31
45
|
}
|
|
32
|
-
|
|
46
|
+
/** The GitHub implementation of the `environments` capability, managing a repo's deployment environments. */
|
|
47
|
+
export declare class GitHubEnvironments implements Environments {
|
|
33
48
|
private readonly client;
|
|
34
49
|
private readonly opts;
|
|
50
|
+
/** Capability key, always `"environments"`. */
|
|
35
51
|
readonly key: "environments";
|
|
52
|
+
/** Provider name, always `"github"`. */
|
|
36
53
|
readonly providerName = "github";
|
|
37
54
|
constructor(client: GitHubClient, opts: EnvironmentsOptions);
|
|
55
|
+
/** Lists the repo's environments with their wait timer, self-review rule and required reviewers. */
|
|
38
56
|
listEnvironments(): Promise<Environment[]>;
|
|
57
|
+
/** Creates or updates an environment, sending only the settings the given environment defines. */
|
|
39
58
|
upsertEnvironment(env: Environment): Promise<void>;
|
|
59
|
+
/** Deletes the named environment. */
|
|
40
60
|
deleteEnvironment(name: string): Promise<void>;
|
|
41
61
|
private flattenReviewers;
|
|
42
62
|
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/capabilities/issues.d.ts
|
|
45
63
|
interface IssuesOptions {
|
|
46
64
|
repo: string;
|
|
47
65
|
/**
|
|
@@ -55,9 +73,12 @@ interface IssuesOptions {
|
|
|
55
73
|
inReview: string;
|
|
56
74
|
};
|
|
57
75
|
}
|
|
58
|
-
|
|
76
|
+
/** The GitHub implementation of the `issues` capability, backed by GitHub Issues and status labels. */
|
|
77
|
+
export declare class GitHubIssues implements Issues {
|
|
59
78
|
private readonly client;
|
|
79
|
+
/** Capability key, always `"issues"`. */
|
|
60
80
|
readonly key: "issues";
|
|
81
|
+
/** Provider name, always `"github"`. */
|
|
61
82
|
readonly providerName = "github";
|
|
62
83
|
private readonly owner;
|
|
63
84
|
private readonly repoName;
|
|
@@ -65,8 +86,11 @@ declare class GitHubIssues implements Issues {
|
|
|
65
86
|
private readonly labels;
|
|
66
87
|
constructor(client: GitHubClient, opts: IssuesOptions);
|
|
67
88
|
getMyself(): Promise<TrackerUser>;
|
|
89
|
+
/** Searches the repo's issues, newest update first, leaving out pull requests. */
|
|
68
90
|
search(filter: IssueSearchFilter): Promise<Issue[]>;
|
|
91
|
+
/** Fetches one issue by its key. */
|
|
69
92
|
get(key: string): Promise<Issue>;
|
|
93
|
+
/** Creates an issue and returns its key as `#<number>`; the milestone is resolved from its title. */
|
|
70
94
|
create(input: {
|
|
71
95
|
summary: string;
|
|
72
96
|
body?: string;
|
|
@@ -76,17 +100,21 @@ declare class GitHubIssues implements Issues {
|
|
|
76
100
|
key: string;
|
|
77
101
|
}>;
|
|
78
102
|
transition(key: string, slot: LifecycleSlot): Promise<LifecycleResult>;
|
|
103
|
+
/** Adds a comment to the issue with the given key. */
|
|
79
104
|
comment(key: string, body: string): Promise<void>;
|
|
105
|
+
/** Checks the authenticated user, the repo and the label-backed lifecycle slots, and reports what resolves. */
|
|
80
106
|
doctor(): Promise<TrackerDoctorReport>;
|
|
81
107
|
private resolveMilestone;
|
|
82
108
|
private removeStatusLabels;
|
|
83
109
|
private mapIssue;
|
|
84
110
|
}
|
|
85
|
-
|
|
86
|
-
//#region src/capabilities/labels.d.ts
|
|
111
|
+
/** A label the repo is expected to have. */
|
|
87
112
|
interface CanonicalLabel {
|
|
113
|
+
/** The label's name. */
|
|
88
114
|
readonly name: string;
|
|
115
|
+
/** The label's color, as a hex string. */
|
|
89
116
|
readonly color: string;
|
|
117
|
+
/** The label's description. */
|
|
90
118
|
readonly description: string;
|
|
91
119
|
}
|
|
92
120
|
/**
|
|
@@ -97,36 +125,51 @@ interface CanonicalLabel {
|
|
|
97
125
|
* - DELETEs labels listed in `stale`.
|
|
98
126
|
* - Leaves unrecognised labels that aren't in `stale` untouched.
|
|
99
127
|
*/
|
|
100
|
-
declare function syncLabels(client: GitHubClient, repo: string, canonical: ReadonlyArray<CanonicalLabel>, stale: ReadonlyArray<string>): Promise<string>;
|
|
101
|
-
//#endregion
|
|
102
|
-
//#region src/capabilities/secrets.d.ts
|
|
128
|
+
export declare function syncLabels(client: GitHubClient, repo: string, canonical: ReadonlyArray<CanonicalLabel>, stale: ReadonlyArray<string>): Promise<string>;
|
|
103
129
|
interface SecretsOptions {
|
|
104
130
|
repo: string;
|
|
105
131
|
}
|
|
106
|
-
|
|
132
|
+
/** The GitHub implementation of the `secrets` capability, covering repository, environment and organization secrets. */
|
|
133
|
+
export declare class GitHubSecrets implements Secrets {
|
|
107
134
|
private readonly client;
|
|
108
135
|
private readonly opts;
|
|
136
|
+
private readonly orgClient?;
|
|
137
|
+
/** Capability key, always `"secrets"`. */
|
|
109
138
|
readonly key: "secrets";
|
|
139
|
+
/** Provider name, always `"github"`. */
|
|
110
140
|
readonly providerName = "github";
|
|
111
|
-
|
|
141
|
+
/**
|
|
142
|
+
* `client` handles repo and environment scopes; `orgClient`, when given, handles
|
|
143
|
+
* the organization scope. They differ when a dedicated org-only token exists:
|
|
144
|
+
* it can write org secrets but not repo ones, and `github.admin` is the reverse.
|
|
145
|
+
*/
|
|
146
|
+
constructor(client: GitHubClient, opts: SecretsOptions, orgClient?: GitHubClient | undefined);
|
|
147
|
+
private clientFor;
|
|
112
148
|
listSecrets(scope: SecretScope): Promise<string[]>;
|
|
113
149
|
setSecret(scope: SecretScope, name: string, value: string): Promise<void>;
|
|
150
|
+
/** Deletes the named secret in the given scope. */
|
|
114
151
|
deleteSecret(scope: SecretScope, name: string): Promise<void>;
|
|
115
152
|
}
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/capabilities/source.d.ts
|
|
118
153
|
interface SourceOptions {
|
|
119
154
|
repo: string;
|
|
120
155
|
repoRoot: string;
|
|
121
156
|
/** Secondary client authenticated with HOLOCRON_ORG_TOKEN for org-scoped operations (teams, custom properties). */
|
|
122
157
|
orgClient?: GitHubClient;
|
|
158
|
+
/** Client for the files that link GitHub accounts to other services (HOLOCRON_USER_SYNC_TOKEN); falls back to the org client. */
|
|
159
|
+
userSyncClient?: GitHubClient;
|
|
123
160
|
/** Forwarded to a secondary client created for Pages calls (HOLOCRON_DEPLOY_TOKEN). */
|
|
124
161
|
baseUrl?: string;
|
|
125
162
|
fetch?: typeof fetch;
|
|
126
163
|
}
|
|
127
|
-
|
|
164
|
+
/**
|
|
165
|
+
* The GitHub implementation of the `source` capability: repo settings, rulesets, branch protection, security
|
|
166
|
+
* features and local workflow files.
|
|
167
|
+
*/
|
|
168
|
+
export declare class GitHubSource implements Source {
|
|
128
169
|
private readonly client;
|
|
170
|
+
/** Capability key, always `"source"`. */
|
|
129
171
|
readonly key: "source";
|
|
172
|
+
/** Provider name, always `"github"`. */
|
|
130
173
|
readonly providerName = "github";
|
|
131
174
|
private readonly owner;
|
|
132
175
|
private readonly name;
|
|
@@ -134,83 +177,117 @@ declare class GitHubSource implements Source {
|
|
|
134
177
|
private readonly repoRoot;
|
|
135
178
|
private readonly workflowDir;
|
|
136
179
|
private readonly orgClient?;
|
|
180
|
+
private readonly userSyncClient?;
|
|
137
181
|
private readonly baseUrl?;
|
|
138
182
|
private readonly fetchImpl?;
|
|
139
183
|
constructor(client: GitHubClient, opts: SourceOptions);
|
|
140
184
|
whoami(): Promise<{
|
|
141
185
|
login: string;
|
|
142
186
|
}>;
|
|
187
|
+
/** Returns the repo's owner, name and default branch. */
|
|
143
188
|
getRepo(): Promise<RepoRef>;
|
|
189
|
+
/** Lists the repo's rulesets. */
|
|
144
190
|
listRulesets(): Promise<Ruleset[]>;
|
|
191
|
+
/** Creates a ruleset from the given payload. */
|
|
145
192
|
createRuleset(payload: Record<string, unknown>): Promise<Ruleset>;
|
|
193
|
+
/** Updates the ruleset with the given id from the payload. */
|
|
146
194
|
updateRuleset(id: number, payload: Record<string, unknown>): Promise<Ruleset>;
|
|
195
|
+
/** Updates the repo's settings. */
|
|
147
196
|
updateRepoSettings(settings: RepoSettings): Promise<void>;
|
|
148
197
|
protectBranch(branch: string, payload: Record<string, unknown>): Promise<void>;
|
|
198
|
+
/** Enables Dependabot vulnerability alerts. */
|
|
149
199
|
enableVulnerabilityAlerts(): Promise<void>;
|
|
200
|
+
/** Enables Dependabot automated security fixes. */
|
|
150
201
|
enableAutomatedSecurityFixes(): Promise<void>;
|
|
202
|
+
/** Enables secret scanning. */
|
|
151
203
|
enableSecretScanning(): Promise<void>;
|
|
152
204
|
enableCodeScanning(): Promise<string>;
|
|
153
205
|
disableDefaultCodeScanning(): Promise<void>;
|
|
154
206
|
enableDependencyGraph(): Promise<void>;
|
|
207
|
+
/** Enables private vulnerability reporting. */
|
|
155
208
|
enablePrivateVulnerabilityReporting(): Promise<void>;
|
|
209
|
+
/** Lists the `.yml` and `.yaml` files in `.github/workflows`, sorted by name; empty when the folder is missing. */
|
|
156
210
|
listWorkflowFiles(): Promise<string[]>;
|
|
211
|
+
/** Reads a workflow file's text, or `null` when it does not exist. */
|
|
157
212
|
readWorkflowFile(name: string): Promise<string | null>;
|
|
213
|
+
/** Writes a workflow file, creating `.github/workflows` first when needed. */
|
|
158
214
|
writeWorkflowFile(name: string, contents: string): Promise<void>;
|
|
215
|
+
/** Removes a workflow file; a file that is already gone is not an error. */
|
|
159
216
|
removeWorkflowFile(name: string): Promise<void>;
|
|
160
217
|
writeRepoFile(path: string, contents: string): Promise<void>;
|
|
161
218
|
syncLabels(canonical: ReadonlyArray<LabelDef>, stale: ReadonlyArray<string>): Promise<string>;
|
|
162
219
|
syncProperties(values: Record<string, string | string[]>): Promise<string>;
|
|
220
|
+
checkPropertyValues(values: Record<string, string | string[]>): Promise<string[] | undefined>;
|
|
163
221
|
syncTeams(teams: TeamEntry$1[]): Promise<string>;
|
|
222
|
+
teamMembers(teamSlug: string, org?: string): Promise<SourceTeamMember[]>;
|
|
223
|
+
readFile(path: string, repo?: string): Promise<SourceFile | null>;
|
|
224
|
+
writeFile(path: string, content: string, opts: {
|
|
225
|
+
message: string;
|
|
226
|
+
version?: string;
|
|
227
|
+
repo?: string;
|
|
228
|
+
}): Promise<void>;
|
|
164
229
|
syncTopics(topics: string[]): Promise<string>;
|
|
230
|
+
syncVariables(variables: Record<string, string>, opts?: {
|
|
231
|
+
prune?: boolean;
|
|
232
|
+
dryRun?: boolean;
|
|
233
|
+
}): Promise<string>;
|
|
234
|
+
syncOrgVariables(org: string, variables: Record<string, {
|
|
235
|
+
value: string;
|
|
236
|
+
visibility: "all" | "private";
|
|
237
|
+
}>, opts?: {
|
|
238
|
+
prune?: boolean;
|
|
239
|
+
dryRun?: boolean;
|
|
240
|
+
}): Promise<string>;
|
|
241
|
+
listVariables(): Promise<Record<string, string>>;
|
|
242
|
+
listOrgVariables(org: string): Promise<Record<string, {
|
|
243
|
+
value: string;
|
|
244
|
+
visibility: "all" | "private" | "selected";
|
|
245
|
+
}>>;
|
|
246
|
+
getRepoInfo(): Promise<SourceRepoInfo>;
|
|
247
|
+
getProperties(): Promise<Record<string, string | string[]>>;
|
|
248
|
+
listLabels(): Promise<LabelDef[]>;
|
|
249
|
+
listTeamAccess(): Promise<Array<{
|
|
250
|
+
slug: string;
|
|
251
|
+
permission: TeamPermission$1;
|
|
252
|
+
}>>;
|
|
253
|
+
getRulesetDetail(id: number): Promise<SourceRulesetDetail>;
|
|
254
|
+
getSecurity(): Promise<SourceSecurity>;
|
|
165
255
|
syncDescription(description: string): Promise<string>;
|
|
166
256
|
syncHomepage(homepage: string): Promise<string>;
|
|
167
257
|
getPullRequest(number: number, repo?: string): Promise<PullRequest>;
|
|
258
|
+
listPullRequests(state: "open" | "closed", repo?: string): Promise<PullRequest[]>;
|
|
259
|
+
listBranches(repo?: string): Promise<SourceBranch[]>;
|
|
260
|
+
deleteBranch(name: string, repo?: string): Promise<void>;
|
|
261
|
+
listPullRequestCommits(number: number, repo?: string): Promise<string[]>;
|
|
168
262
|
configurePages(config: PagesConfig, token: string): Promise<void>;
|
|
169
263
|
}
|
|
170
|
-
|
|
171
|
-
//#region src/capabilities/teams.d.ts
|
|
264
|
+
/** A team entry with the permission spelled out. */
|
|
172
265
|
interface NormalizedTeamEntry {
|
|
266
|
+
/** The team's slug. */
|
|
173
267
|
slug: string;
|
|
268
|
+
/** The permission the team gets on the repo. */
|
|
174
269
|
permission: TeamPermission;
|
|
175
270
|
}
|
|
176
|
-
|
|
177
|
-
declare function
|
|
178
|
-
|
|
179
|
-
|
|
271
|
+
/** Turns a team entry into slug and permission form; a bare slug gets `push`. */
|
|
272
|
+
export declare function normalizeTeamEntry(entry: TeamEntry): NormalizedTeamEntry;
|
|
273
|
+
/** Grants each team access to the repo and reports the outcome; throws when every team fails. */
|
|
274
|
+
export declare function syncTeams(client: GitHubClient, repo: string, teams: TeamEntry[]): Promise<string>;
|
|
180
275
|
/**
|
|
181
276
|
* Encrypt `value` for the given GitHub-provided base64 public key.
|
|
182
277
|
* Returns the base64 ciphertext to send as `encrypted_value`.
|
|
183
278
|
*/
|
|
184
|
-
declare function encryptSecret(publicKeyBase64: string, value: string): Promise<string>;
|
|
185
|
-
|
|
186
|
-
//#region src/verify-token.d.ts
|
|
187
|
-
/**
|
|
188
|
-
* `verifyToken` — plugin-level export used by `holocron auth set` +
|
|
189
|
-
* `holocron auth check`. Hits `GET /user` and translates the response
|
|
190
|
-
* into the normalized `VerifyTokenResult` shape.
|
|
191
|
-
*
|
|
192
|
-
* Kept as a standalone function (not a capability method) so the auth
|
|
193
|
-
* command can call it without initializing the full plugin — plugin
|
|
194
|
-
* construction requires an already-resolved token, which is exactly
|
|
195
|
-
* what we don't have yet at bootstrap time.
|
|
196
|
-
*/
|
|
197
|
-
interface VerifyTokenSuccess {
|
|
198
|
-
ok: true;
|
|
199
|
-
subject: string;
|
|
200
|
-
}
|
|
201
|
-
interface VerifyTokenFailure {
|
|
202
|
-
ok: false;
|
|
203
|
-
message: string;
|
|
204
|
-
}
|
|
205
|
-
type VerifyTokenResult = VerifyTokenSuccess | VerifyTokenFailure;
|
|
279
|
+
export declare function encryptSecret(publicKeyBase64: string, value: string): Promise<string>;
|
|
280
|
+
/** Options for `verifyToken`. */
|
|
206
281
|
interface VerifyTokenOptions {
|
|
282
|
+
/** Overrides the API base URL, for tests. */
|
|
207
283
|
baseUrl?: string;
|
|
284
|
+
/** Overrides `fetch`, for tests. */
|
|
208
285
|
fetch?: typeof fetch;
|
|
209
286
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
interface GitHubPluginOptions extends ResolveTokenInput {
|
|
287
|
+
/** Checks a token against `GET /user` and returns who it belongs to, or why it failed. */
|
|
288
|
+
export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
289
|
+
/** Options for the GitHub plugin. */
|
|
290
|
+
export interface GitHubPluginOptions extends ResolveTokenInput {
|
|
214
291
|
/** "owner/name" — e.g., "theholocron/holocron". Required. */
|
|
215
292
|
repo: string;
|
|
216
293
|
/** Absolute path to the working repo root. Used by `source`'s
|
|
@@ -218,7 +295,9 @@ interface GitHubPluginOptions extends ResolveTokenInput {
|
|
|
218
295
|
repoRoot?: string;
|
|
219
296
|
/** Lifecycle slot → label name. Used by the `issues` capability. */
|
|
220
297
|
labels?: {
|
|
298
|
+
/** Label that marks an issue as in progress. */
|
|
221
299
|
inProgress: string;
|
|
300
|
+
/** Label that marks an issue as in review. */
|
|
222
301
|
inReview: string;
|
|
223
302
|
};
|
|
224
303
|
/** Override base URL for tests. Defaults to https://api.github.com. */
|
|
@@ -226,19 +305,33 @@ interface GitHubPluginOptions extends ResolveTokenInput {
|
|
|
226
305
|
/** Override `fetch` for tests. Defaults to global `fetch`. */
|
|
227
306
|
fetch?: typeof fetch;
|
|
228
307
|
}
|
|
229
|
-
|
|
308
|
+
/** What the capability factories receive: the plugin options, a client, the repo and its root. */
|
|
309
|
+
export interface PluginContext {
|
|
310
|
+
/** The plugin options. */
|
|
230
311
|
options: GitHubPluginOptions;
|
|
312
|
+
/** The GitHub client the capability uses. */
|
|
231
313
|
client: GitHubClient;
|
|
314
|
+
/** The repo as `owner/name`. */
|
|
232
315
|
repo: string;
|
|
316
|
+
/** Absolute path to the working repo root. */
|
|
233
317
|
repoRoot: string;
|
|
234
318
|
}
|
|
235
|
-
|
|
236
|
-
declare function
|
|
237
|
-
|
|
238
|
-
declare function
|
|
239
|
-
|
|
240
|
-
declare function
|
|
319
|
+
/** Builds the `source` capability; the optional clients cover org-level and user-sync access. */
|
|
320
|
+
export declare function source(ctx: PluginContext, orgClient?: GitHubClient, userSyncClient?: GitHubClient): Source;
|
|
321
|
+
/** Builds the `secrets` capability; the optional client handles organization secrets. */
|
|
322
|
+
export declare function secrets(ctx: PluginContext, orgClient?: GitHubClient): Secrets;
|
|
323
|
+
/** Builds the `environments` capability. */
|
|
324
|
+
export declare function environments(ctx: PluginContext): Environments;
|
|
325
|
+
/** Builds the `ci` capability. */
|
|
326
|
+
export declare function ci(ctx: PluginContext): Ci;
|
|
327
|
+
/** Builds the `issues` capability, passing the lifecycle labels when configured. */
|
|
328
|
+
export declare function issues(ctx: PluginContext): Issues;
|
|
329
|
+
/** Creates the plugin, resolving a token per capability when it is first used. */
|
|
330
|
+
export declare function createPlugin(options: GitHubPluginOptions): {
|
|
241
331
|
name: string;
|
|
332
|
+
probes: {
|
|
333
|
+
connection: import("@theholocron/cli").Probe;
|
|
334
|
+
};
|
|
242
335
|
capabilities: {
|
|
243
336
|
source: () => Source;
|
|
244
337
|
ci: () => Ci;
|
|
@@ -251,6 +344,7 @@ declare function createPlugin(options: GitHubPluginOptions): {
|
|
|
251
344
|
* One-line hint printed by `holocron auth set github` when no token
|
|
252
345
|
* is supplied or the supplied token is rejected.
|
|
253
346
|
*/
|
|
254
|
-
declare const AUTH_HINT: string;
|
|
255
|
-
|
|
256
|
-
export
|
|
347
|
+
export declare const AUTH_HINT: string;
|
|
348
|
+
/** Every token this plugin takes, for `holocron doctor tokens`. */
|
|
349
|
+
export declare const tokens: PluginToken[];
|
|
350
|
+
export { type Auth, AuthError, type CanonicalLabel, type GitHubClientOptions, type NormalizedTeamEntry, type ResolveTokenInput, type TeamEntry, type TeamPermission, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createFeatureResolver, createGitHubClient };
|