@theholocron/holocron-plugin-github 5.0.0-alpha.12 → 5.0.0-alpha.120
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.mts +3 -22
- package/dist/index.mjs +6 -13
- package/package.json +12 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GitHubClient, GitHubClientOptions, createGitHubClient } from "@theholocron/github-client";
|
|
2
|
-
import { Auth, AuthError, Ci, CiRun, CiRunFilter, Environment, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, PagesConfig, PullRequest, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretScope, Secrets, Source, TeamEntry, TeamEntry as TeamEntry$1, TeamPermission, TrackerDoctorReport, TrackerUser, createFeatureResolver } from "@theholocron/cli";
|
|
2
|
+
import { Auth, AuthError, Ci, CiRun, CiRunFilter, Environment, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, PagesConfig, PullRequest, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretScope, Secrets, Source, TeamEntry, TeamEntry as TeamEntry$1, TeamPermission, TrackerDoctorReport, TrackerUser, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, createFeatureResolver } from "@theholocron/cli";
|
|
3
3
|
//#region src/auth.d.ts
|
|
4
4
|
declare const resolveReadToken: (input?: ResolveTokenInput) => string;
|
|
5
5
|
declare const resolveIssuesToken: (input?: ResolveTokenInput) => string;
|
|
@@ -159,7 +159,7 @@ declare class GitHubSource implements Source {
|
|
|
159
159
|
removeWorkflowFile(name: string): Promise<void>;
|
|
160
160
|
writeRepoFile(path: string, contents: string): Promise<void>;
|
|
161
161
|
syncLabels(canonical: ReadonlyArray<LabelDef>, stale: ReadonlyArray<string>): Promise<string>;
|
|
162
|
-
syncProperties(values: Record<string, string>): Promise<string>;
|
|
162
|
+
syncProperties(values: Record<string, string | string[]>): Promise<string>;
|
|
163
163
|
syncTeams(teams: TeamEntry$1[]): Promise<string>;
|
|
164
164
|
syncTopics(topics: string[]): Promise<string>;
|
|
165
165
|
syncDescription(description: string): Promise<string>;
|
|
@@ -184,30 +184,11 @@ declare function syncTeams(client: GitHubClient, repo: string, teams: TeamEntry[
|
|
|
184
184
|
declare function encryptSecret(publicKeyBase64: string, value: string): Promise<string>;
|
|
185
185
|
//#endregion
|
|
186
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;
|
|
206
187
|
interface VerifyTokenOptions {
|
|
207
188
|
baseUrl?: string;
|
|
208
189
|
fetch?: typeof fetch;
|
|
209
190
|
}
|
|
210
|
-
declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult>;
|
|
191
|
+
declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
211
192
|
//#endregion
|
|
212
193
|
//#region src/index.d.ts
|
|
213
194
|
interface GitHubPluginOptions extends ResolveTokenInput {
|
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { createGitHubClient, createGitHubClient as createGitHubClient$1 } from "
|
|
|
3
3
|
import { AuthError, createFeatureResolver } from "@theholocron/cli";
|
|
4
4
|
import { mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
|
+
import { errorMessage } from "@theholocron/misc-utils";
|
|
6
7
|
//#region src/auth.ts
|
|
7
8
|
const resolveReadToken = createFeatureResolver({
|
|
8
9
|
envName: "HOLOCRON_READ_TOKEN",
|
|
@@ -652,16 +653,6 @@ async function ensureDir(path) {
|
|
|
652
653
|
}
|
|
653
654
|
//#endregion
|
|
654
655
|
//#region src/verify-token.ts
|
|
655
|
-
/**
|
|
656
|
-
* `verifyToken` — plugin-level export used by `holocron auth set` +
|
|
657
|
-
* `holocron auth check`. Hits `GET /user` and translates the response
|
|
658
|
-
* into the normalized `VerifyTokenResult` shape.
|
|
659
|
-
*
|
|
660
|
-
* Kept as a standalone function (not a capability method) so the auth
|
|
661
|
-
* command can call it without initializing the full plugin — plugin
|
|
662
|
-
* construction requires an already-resolved token, which is exactly
|
|
663
|
-
* what we don't have yet at bootstrap time.
|
|
664
|
-
*/
|
|
665
656
|
async function verifyToken(token, opts = {}) {
|
|
666
657
|
const client = createGitHubClient({
|
|
667
658
|
token,
|
|
@@ -677,7 +668,7 @@ async function verifyToken(token, opts = {}) {
|
|
|
677
668
|
} catch (err) {
|
|
678
669
|
return {
|
|
679
670
|
ok: false,
|
|
680
|
-
message:
|
|
671
|
+
message: errorMessage(err)
|
|
681
672
|
};
|
|
682
673
|
}
|
|
683
674
|
}
|
|
@@ -708,10 +699,11 @@ function issues(ctx) {
|
|
|
708
699
|
}
|
|
709
700
|
function createPlugin(options) {
|
|
710
701
|
function makeCtx(resolver) {
|
|
702
|
+
const token = resolver(options);
|
|
711
703
|
return {
|
|
712
704
|
options,
|
|
713
705
|
client: createGitHubClient$1({
|
|
714
|
-
token
|
|
706
|
+
token,
|
|
715
707
|
baseUrl: options.baseUrl,
|
|
716
708
|
fetch: options.fetch
|
|
717
709
|
}),
|
|
@@ -721,8 +713,9 @@ function createPlugin(options) {
|
|
|
721
713
|
}
|
|
722
714
|
function makeOrgClient() {
|
|
723
715
|
try {
|
|
716
|
+
const token = resolveOrgToken(options);
|
|
724
717
|
return createGitHubClient$1({
|
|
725
|
-
token
|
|
718
|
+
token,
|
|
726
719
|
baseUrl: options.baseUrl,
|
|
727
720
|
fetch: options.fetch
|
|
728
721
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-github",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.120",
|
|
4
4
|
"description": "Holocron plugin for GitHub. Implements source, ci, secrets, environments, and issues capabilities against the GitHub REST API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -34,11 +34,13 @@
|
|
|
34
34
|
"libsodium-wrappers": "^0.8.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@theholocron/eslint-config": "^8.
|
|
38
|
-
"@theholocron/github-client": "^1.
|
|
39
|
-
"@theholocron/
|
|
40
|
-
"@theholocron/
|
|
41
|
-
"@theholocron/
|
|
37
|
+
"@theholocron/eslint-config": "^8.7.0",
|
|
38
|
+
"@theholocron/github-client": "^1.38.0",
|
|
39
|
+
"@theholocron/http-client": "^1.38.0",
|
|
40
|
+
"@theholocron/misc-utils": "^1.9.2",
|
|
41
|
+
"@theholocron/tsconfig": "^8.7.0",
|
|
42
|
+
"@theholocron/tsdown-config": "^8.7.0",
|
|
43
|
+
"@theholocron/vitest-config": "^8.7.0",
|
|
42
44
|
"@types/node": "^26",
|
|
43
45
|
"@vitest/coverage-v8": "^4.1.11",
|
|
44
46
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
@@ -49,11 +51,12 @@
|
|
|
49
51
|
"tsx": "4.23.12",
|
|
50
52
|
"typescript": "^5.9.3",
|
|
51
53
|
"vitest": "^4.1.11",
|
|
52
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
54
|
+
"@theholocron/cli": "5.0.0-alpha.120"
|
|
53
55
|
},
|
|
54
56
|
"peerDependencies": {
|
|
55
|
-
"@theholocron/github-client": "^1.
|
|
56
|
-
"@theholocron/
|
|
57
|
+
"@theholocron/github-client": "^1.38.0",
|
|
58
|
+
"@theholocron/misc-utils": "^1.9.2",
|
|
59
|
+
"@theholocron/cli": "5.0.0-alpha.120"
|
|
57
60
|
},
|
|
58
61
|
"engines": {
|
|
59
62
|
"node": ">=22"
|