@theholocron/holocron-plugin-github 5.0.0-alpha.246 → 5.0.0-alpha.248

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 CHANGED
@@ -1,21 +1,18 @@
1
1
  import { Auth, AuthError, Ci, CiRun, CiRunFilter, Environment, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, PagesConfig, PullRequest, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretScope, Secrets, Source, SourceFile, SourceTeamMember, TeamEntry, TeamEntry as TeamEntry$1, TeamPermission, TrackerDoctorReport, TrackerUser, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, createFeatureResolver } from "@theholocron/cli";
2
2
  import { GitHubClient, GitHubClientOptions, createGitHubClient } from "@theholocron/github-client";
3
- //#region src/auth.d.ts
4
- declare const resolveReadToken: (input?: ResolveTokenInput) => string;
5
- declare const resolveIssuesToken: (input?: ResolveTokenInput) => string;
6
- declare const resolveSyncToken: (input?: ResolveTokenInput) => string;
7
- declare const resolveReleaseToken: (input?: ResolveTokenInput) => string;
8
- declare const resolveAdminToken: (input?: ResolveTokenInput) => string;
9
- declare const resolveSecretsToken: (input?: ResolveTokenInput) => string;
10
- declare const resolveDeployToken: (input?: ResolveTokenInput) => string;
11
- declare const resolveUserSyncToken: (input?: ResolveTokenInput) => string;
12
- declare const resolveOrgToken: (input?: ResolveTokenInput) => string;
13
- //#endregion
14
- //#region src/capabilities/ci.d.ts
3
+ export declare const resolveReadToken: (input?: ResolveTokenInput) => string;
4
+ export declare const resolveIssuesToken: (input?: ResolveTokenInput) => string;
5
+ export declare const resolveSyncToken: (input?: ResolveTokenInput) => string;
6
+ export declare const resolveReleaseToken: (input?: ResolveTokenInput) => string;
7
+ export declare const resolveAdminToken: (input?: ResolveTokenInput) => string;
8
+ export declare const resolveSecretsToken: (input?: ResolveTokenInput) => string;
9
+ export declare const resolveDeployToken: (input?: ResolveTokenInput) => string;
10
+ export declare const resolveUserSyncToken: (input?: ResolveTokenInput) => string;
11
+ export declare const resolveOrgToken: (input?: ResolveTokenInput) => string;
15
12
  interface CiOptions {
16
13
  repo: string;
17
14
  }
18
- declare class GitHubCi implements Ci {
15
+ export declare class GitHubCi implements Ci {
19
16
  private readonly client;
20
17
  private readonly opts;
21
18
  readonly key: "ci";
@@ -26,12 +23,10 @@ declare class GitHubCi implements Ci {
26
23
  private mapRun;
27
24
  private mapConclusion;
28
25
  }
29
- //#endregion
30
- //#region src/capabilities/environments.d.ts
31
26
  interface EnvironmentsOptions {
32
27
  repo: string;
33
28
  }
34
- declare class GitHubEnvironments implements Environments {
29
+ export declare class GitHubEnvironments implements Environments {
35
30
  private readonly client;
36
31
  private readonly opts;
37
32
  readonly key: "environments";
@@ -42,8 +37,6 @@ declare class GitHubEnvironments implements Environments {
42
37
  deleteEnvironment(name: string): Promise<void>;
43
38
  private flattenReviewers;
44
39
  }
45
- //#endregion
46
- //#region src/capabilities/issues.d.ts
47
40
  interface IssuesOptions {
48
41
  repo: string;
49
42
  /**
@@ -57,7 +50,7 @@ interface IssuesOptions {
57
50
  inReview: string;
58
51
  };
59
52
  }
60
- declare class GitHubIssues implements Issues {
53
+ export declare class GitHubIssues implements Issues {
61
54
  private readonly client;
62
55
  readonly key: "issues";
63
56
  readonly providerName = "github";
@@ -84,8 +77,6 @@ declare class GitHubIssues implements Issues {
84
77
  private removeStatusLabels;
85
78
  private mapIssue;
86
79
  }
87
- //#endregion
88
- //#region src/capabilities/labels.d.ts
89
80
  interface CanonicalLabel {
90
81
  readonly name: string;
91
82
  readonly color: string;
@@ -99,13 +90,11 @@ interface CanonicalLabel {
99
90
  * - DELETEs labels listed in `stale`.
100
91
  * - Leaves unrecognised labels that aren't in `stale` untouched.
101
92
  */
102
- declare function syncLabels(client: GitHubClient, repo: string, canonical: ReadonlyArray<CanonicalLabel>, stale: ReadonlyArray<string>): Promise<string>;
103
- //#endregion
104
- //#region src/capabilities/secrets.d.ts
93
+ export declare function syncLabels(client: GitHubClient, repo: string, canonical: ReadonlyArray<CanonicalLabel>, stale: ReadonlyArray<string>): Promise<string>;
105
94
  interface SecretsOptions {
106
95
  repo: string;
107
96
  }
108
- declare class GitHubSecrets implements Secrets {
97
+ export declare class GitHubSecrets implements Secrets {
109
98
  private readonly client;
110
99
  private readonly opts;
111
100
  private readonly orgClient?;
@@ -122,8 +111,6 @@ declare class GitHubSecrets implements Secrets {
122
111
  setSecret(scope: SecretScope, name: string, value: string): Promise<void>;
123
112
  deleteSecret(scope: SecretScope, name: string): Promise<void>;
124
113
  }
125
- //#endregion
126
- //#region src/capabilities/source.d.ts
127
114
  interface SourceOptions {
128
115
  repo: string;
129
116
  repoRoot: string;
@@ -135,7 +122,7 @@ interface SourceOptions {
135
122
  baseUrl?: string;
136
123
  fetch?: typeof fetch;
137
124
  }
138
- declare class GitHubSource implements Source {
125
+ export declare class GitHubSource implements Source {
139
126
  private readonly client;
140
127
  readonly key: "source";
141
128
  readonly providerName = "github";
@@ -197,31 +184,23 @@ declare class GitHubSource implements Source {
197
184
  getPullRequest(number: number, repo?: string): Promise<PullRequest>;
198
185
  configurePages(config: PagesConfig, token: string): Promise<void>;
199
186
  }
200
- //#endregion
201
- //#region src/capabilities/teams.d.ts
202
187
  interface NormalizedTeamEntry {
203
188
  slug: string;
204
189
  permission: TeamPermission;
205
190
  }
206
- declare function normalizeTeamEntry(entry: TeamEntry): NormalizedTeamEntry;
207
- declare function syncTeams(client: GitHubClient, repo: string, teams: TeamEntry[]): Promise<string>;
208
- //#endregion
209
- //#region src/sodium.d.ts
191
+ export declare function normalizeTeamEntry(entry: TeamEntry): NormalizedTeamEntry;
192
+ export declare function syncTeams(client: GitHubClient, repo: string, teams: TeamEntry[]): Promise<string>;
210
193
  /**
211
194
  * Encrypt `value` for the given GitHub-provided base64 public key.
212
195
  * Returns the base64 ciphertext to send as `encrypted_value`.
213
196
  */
214
- declare function encryptSecret(publicKeyBase64: string, value: string): Promise<string>;
215
- //#endregion
216
- //#region src/verify-token.d.ts
197
+ export declare function encryptSecret(publicKeyBase64: string, value: string): Promise<string>;
217
198
  interface VerifyTokenOptions {
218
199
  baseUrl?: string;
219
200
  fetch?: typeof fetch;
220
201
  }
221
- declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
222
- //#endregion
223
- //#region src/index.d.ts
224
- interface GitHubPluginOptions extends ResolveTokenInput {
202
+ export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
203
+ export interface GitHubPluginOptions extends ResolveTokenInput {
225
204
  /** "owner/name" — e.g., "theholocron/holocron". Required. */
226
205
  repo: string;
227
206
  /** Absolute path to the working repo root. Used by `source`'s
@@ -237,18 +216,18 @@ interface GitHubPluginOptions extends ResolveTokenInput {
237
216
  /** Override `fetch` for tests. Defaults to global `fetch`. */
238
217
  fetch?: typeof fetch;
239
218
  }
240
- interface PluginContext {
219
+ export interface PluginContext {
241
220
  options: GitHubPluginOptions;
242
221
  client: GitHubClient;
243
222
  repo: string;
244
223
  repoRoot: string;
245
224
  }
246
- declare function source(ctx: PluginContext, orgClient?: GitHubClient, userSyncClient?: GitHubClient): Source;
247
- declare function secrets(ctx: PluginContext, orgClient?: GitHubClient): Secrets;
248
- declare function environments(ctx: PluginContext): Environments;
249
- declare function ci(ctx: PluginContext): Ci;
250
- declare function issues(ctx: PluginContext): Issues;
251
- declare function createPlugin(options: GitHubPluginOptions): {
225
+ export declare function source(ctx: PluginContext, orgClient?: GitHubClient, userSyncClient?: GitHubClient): Source;
226
+ export declare function secrets(ctx: PluginContext, orgClient?: GitHubClient): Secrets;
227
+ export declare function environments(ctx: PluginContext): Environments;
228
+ export declare function ci(ctx: PluginContext): Ci;
229
+ export declare function issues(ctx: PluginContext): Issues;
230
+ export declare function createPlugin(options: GitHubPluginOptions): {
252
231
  name: string;
253
232
  probes: {
254
233
  connection: import("@theholocron/cli").Probe;
@@ -265,6 +244,5 @@ declare function createPlugin(options: GitHubPluginOptions): {
265
244
  * One-line hint printed by `holocron auth set github` when no token
266
245
  * is supplied or the supplied token is rejected.
267
246
  */
268
- declare const AUTH_HINT: string;
269
- //#endregion
270
- export { AUTH_HINT, type Auth, AuthError, type CanonicalLabel, GitHubCi, type GitHubClientOptions, GitHubEnvironments, GitHubIssues, GitHubPluginOptions, GitHubSecrets, GitHubSource, type NormalizedTeamEntry, PluginContext, type ResolveTokenInput, type TeamEntry, type TeamPermission, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, ci, createFeatureResolver, createGitHubClient, createPlugin, encryptSecret, environments, issues, normalizeTeamEntry, resolveAdminToken, resolveDeployToken, resolveIssuesToken, resolveOrgToken, resolveReadToken, resolveReleaseToken, resolveSecretsToken, resolveSyncToken, resolveUserSyncToken, secrets, source, syncLabels, syncTeams, verifyToken };
247
+ export declare const AUTH_HINT: string;
248
+ export { type Auth, AuthError, type CanonicalLabel, type GitHubClientOptions, type NormalizedTeamEntry, type ResolveTokenInput, type TeamEntry, type TeamPermission, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createFeatureResolver, createGitHubClient };
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises"
5
5
  import { dirname, join } from "node:path";
6
6
  import { findRootSync } from "@theholocron/fs-utils";
7
7
  import { errorMessage } from "@theholocron/misc-utils";
8
- //#region src/auth.ts
8
+ // src/auth.ts
9
9
  const resolveReadToken = createFeatureResolver({
10
10
  envName: "HOLOCRON_READ_TOKEN",
11
11
  keyringKey: "github.read"
@@ -42,8 +42,7 @@ const resolveOrgToken = createFeatureResolver({
42
42
  envName: "HOLOCRON_ORG_TOKEN",
43
43
  keyringKey: "github.org"
44
44
  });
45
- //#endregion
46
- //#region src/capabilities/ci.ts
45
+ // src/capabilities/ci.ts
47
46
  var GitHubCi = class {
48
47
  client;
49
48
  opts;
@@ -87,8 +86,7 @@ var GitHubCi = class {
87
86
  }
88
87
  }
89
88
  };
90
- //#endregion
91
- //#region src/capabilities/environments.ts
89
+ // src/capabilities/environments.ts
92
90
  var GitHubEnvironments = class {
93
91
  client;
94
92
  opts;
@@ -129,8 +127,7 @@ var GitHubEnvironments = class {
129
127
  }));
130
128
  }
131
129
  };
132
- //#endregion
133
- //#region src/capabilities/issues.ts
130
+ // src/capabilities/issues.ts
134
131
  var GitHubIssues = class {
135
132
  client;
136
133
  key = "issues";
@@ -347,8 +344,7 @@ function parseIssueNumber(key, owner, repoName) {
347
344
  if (!/^\d+$/.test(num)) throw new Error(`Invalid GitHub issue key "${key}" — expected #N or N.`);
348
345
  return parseInt(num, 10);
349
346
  }
350
- //#endregion
351
- //#region src/sodium.ts
347
+ // src/sodium.ts
352
348
  /**
353
349
  * libsodium sealed-box encryption for GitHub Actions secrets.
354
350
  *
@@ -379,8 +375,7 @@ async function encryptSecret(publicKeyBase64, value) {
379
375
  const ciphertext = sodium.crypto_box_seal(plaintext, publicKey);
380
376
  return sodium.to_base64(ciphertext, sodium.base64_variants.ORIGINAL);
381
377
  }
382
- //#endregion
383
- //#region src/capabilities/secrets.ts
378
+ // src/capabilities/secrets.ts
384
379
  var GitHubSecrets = class {
385
380
  client;
386
381
  opts;
@@ -425,8 +420,7 @@ function toGHScope(scope) {
425
420
  };
426
421
  return scope;
427
422
  }
428
- //#endregion
429
- //#region src/capabilities/files.ts
423
+ // src/capabilities/files.ts
430
424
  /** Reads one file; `null` when it does not exist. `version` is the blob sha `writeFile` needs to replace exactly this one. */
431
425
  /** A fine-grained token only reaches the repositories and permissions it was given; say which one is missing. */
432
426
  function noAccess(repo, action, cause) {
@@ -465,8 +459,7 @@ async function writeRepoFile(client, repo, path, content, opts) {
465
459
  throw err;
466
460
  }
467
461
  }
468
- //#endregion
469
- //#region src/capabilities/labels.ts
462
+ // src/capabilities/labels.ts
470
463
  /**
471
464
  * Idempotently synchronise a repo's labels to the canonical set.
472
465
  *
@@ -504,14 +497,12 @@ async function syncLabels(client, repo, canonical, stale) {
504
497
  }
505
498
  return `${created} created, ${updated} updated, ${deleted} deleted`;
506
499
  }
507
- //#endregion
508
- //#region src/capabilities/properties.ts
500
+ // src/capabilities/properties.ts
509
501
  async function syncProperties(client, repo, values) {
510
502
  await client.properties.setProperties(repo, values);
511
503
  return `${Object.keys(values).length} properties set`;
512
504
  }
513
- //#endregion
514
- //#region src/capabilities/teams.ts
505
+ // src/capabilities/teams.ts
515
506
  function normalizeTeamEntry(entry) {
516
507
  if (typeof entry === "string") return {
517
508
  slug: entry,
@@ -531,14 +522,12 @@ async function syncTeams(client, repo, teams) {
531
522
  }
532
523
  return `${succeeded} team${succeeded === 1 ? "" : "s"} synced`;
533
524
  }
534
- //#endregion
535
- //#region src/capabilities/topics.ts
525
+ // src/capabilities/topics.ts
536
526
  async function syncTopics(client, repo, topics) {
537
527
  await client.topics.setTopics(repo, topics);
538
528
  return `${topics.length} topics set`;
539
529
  }
540
- //#endregion
541
- //#region src/capabilities/variables.ts
530
+ // src/capabilities/variables.ts
542
531
  /** GitHub's rule for a variable name: letters, digits and underscores, not starting with a digit or `GITHUB_`. */
543
532
  const NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
544
533
  /** Longest name GitHub accepts. */
@@ -638,8 +627,7 @@ function syncOrgVariables(client, repo, org, variables, opts = {}) {
638
627
  dryRun: opts.dryRun === true
639
628
  });
640
629
  }
641
- //#endregion
642
- //#region src/capabilities/source.ts
630
+ // src/capabilities/source.ts
643
631
  var GitHubSource = class {
644
632
  client;
645
633
  key = "source";
@@ -836,8 +824,7 @@ async function ensureDir(path) {
836
824
  throw err;
837
825
  }
838
826
  }
839
- //#endregion
840
- //#region src/verify-token.ts
827
+ // src/verify-token.ts
841
828
  async function verifyToken(token, opts = {}) {
842
829
  const client = createGitHubClient({
843
830
  token,
@@ -857,8 +844,7 @@ async function verifyToken(token, opts = {}) {
857
844
  };
858
845
  }
859
846
  }
860
- //#endregion
861
- //#region src/index.ts
847
+ // src/index.ts
862
848
  function source(ctx, orgClient, userSyncClient) {
863
849
  return new GitHubSource(ctx.client, {
864
850
  repo: ctx.repo,
@@ -978,5 +964,4 @@ function createPlugin(options) {
978
964
  * is supplied or the supplied token is rejected.
979
965
  */
980
966
  const AUTH_HINT = "generate fine-grained Personal Access Tokens at https://github.com/settings/tokens (one per feature — see docs/tokens.md for required scopes per operation), then run: holocron auth set github.<feature> <PAT>";
981
- //#endregion
982
967
  export { AUTH_HINT, AuthError, GitHubCi, GitHubEnvironments, GitHubIssues, GitHubSecrets, GitHubSource, ci, createFeatureResolver, createGitHubClient, createPlugin, encryptSecret, environments, issues, normalizeTeamEntry, resolveAdminToken, resolveDeployToken, resolveIssuesToken, resolveOrgToken, resolveReadToken, resolveReleaseToken, resolveSecretsToken, resolveSyncToken, resolveUserSyncToken, secrets, source, syncLabels, syncTeams, verifyToken };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-github",
3
- "version": "5.0.0-alpha.246",
3
+ "version": "5.0.0-alpha.248",
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",
@@ -43,22 +43,22 @@
43
43
  "@theholocron/tsdown-config": "^8.8.2",
44
44
  "@theholocron/vitest-config": "^8.8.2",
45
45
  "@types/node": "^26",
46
- "@vitest/coverage-v8": "^4.1.11",
46
+ "@vitest/coverage-v8": "^5.0.5",
47
47
  "@vitest/eslint-plugin": "^1.6.27",
48
48
  "eslint": "^10.8.1",
49
49
  "eslint-plugin-n": "^18.3.0",
50
50
  "globals": "^17.11.0",
51
- "tsdown": "^0.22.14",
51
+ "tsdown": "^0.23.3",
52
52
  "tsx": "4.23.15",
53
53
  "typescript": "^5.9.3",
54
- "vitest": "^4.1.11",
55
- "@theholocron/cli": "5.0.0-alpha.246"
54
+ "vitest": "^5.0.5",
55
+ "@theholocron/cli": "5.0.0-alpha.248"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@theholocron/fs-utils": "^1.16.0",
59
59
  "@theholocron/github-client": "^1.51.0",
60
60
  "@theholocron/misc-utils": "^1.16.0",
61
- "@theholocron/cli": "5.0.0-alpha.246"
61
+ "@theholocron/cli": "5.0.0-alpha.248"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">=22"