@theholocron/holocron-plugin-github 5.0.0-alpha.17 → 5.0.0-alpha.171

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,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;
@@ -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,8 @@ 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 { findRootSync } from "@theholocron/fs-utils";
7
+ import { errorMessage } from "@theholocron/misc-utils";
6
8
  //#region src/auth.ts
7
9
  const resolveReadToken = createFeatureResolver({
8
10
  envName: "HOLOCRON_READ_TOKEN",
@@ -496,8 +498,11 @@ var GitHubSource = class {
496
498
  this.owner = owner;
497
499
  this.name = name;
498
500
  this.repo = opts.repo;
499
- this.repoRoot = opts.repoRoot;
500
- this.workflowDir = join(opts.repoRoot, ".github", "workflows");
501
+ this.repoRoot = findRootSync(opts.repoRoot, ".git", {
502
+ fallback: "start",
503
+ realpath: true
504
+ });
505
+ this.workflowDir = join(this.repoRoot, ".github", "workflows");
501
506
  this.orgClient = opts.orgClient;
502
507
  this.baseUrl = opts.baseUrl;
503
508
  this.fetchImpl = opts.fetch;
@@ -652,16 +657,6 @@ async function ensureDir(path) {
652
657
  }
653
658
  //#endregion
654
659
  //#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
660
  async function verifyToken(token, opts = {}) {
666
661
  const client = createGitHubClient({
667
662
  token,
@@ -677,7 +672,7 @@ async function verifyToken(token, opts = {}) {
677
672
  } catch (err) {
678
673
  return {
679
674
  ok: false,
680
- message: err instanceof Error ? err.message : String(err)
675
+ message: errorMessage(err)
681
676
  };
682
677
  }
683
678
  }
@@ -708,10 +703,11 @@ function issues(ctx) {
708
703
  }
709
704
  function createPlugin(options) {
710
705
  function makeCtx(resolver) {
706
+ const token = resolver(options);
711
707
  return {
712
708
  options,
713
709
  client: createGitHubClient$1({
714
- token: resolver(options),
710
+ token,
715
711
  baseUrl: options.baseUrl,
716
712
  fetch: options.fetch
717
713
  }),
@@ -721,8 +717,9 @@ function createPlugin(options) {
721
717
  }
722
718
  function makeOrgClient() {
723
719
  try {
720
+ const token = resolveOrgToken(options);
724
721
  return createGitHubClient$1({
725
- token: resolveOrgToken(options),
722
+ token,
726
723
  baseUrl: options.baseUrl,
727
724
  fetch: options.fetch
728
725
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-github",
3
- "version": "5.0.0-alpha.17",
3
+ "version": "5.0.0-alpha.171",
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",
@@ -9,12 +9,12 @@
9
9
  "plugin",
10
10
  "source"
11
11
  ],
12
- "homepage": "https://github.com/theholocron/holocron/tree/main/packages/holocron-plugin-github#readme",
12
+ "homepage": "https://github.com/theholocron/holocron/tree/main/plugins/holocron-plugin-github#readme",
13
13
  "bugs": "https://github.com/theholocron/holocron/issues",
14
14
  "repository": {
15
15
  "type": "git",
16
16
  "url": "git+https://github.com/theholocron/holocron.git",
17
- "directory": "packages/holocron-plugin-github"
17
+ "directory": "plugins/holocron-plugin-github"
18
18
  },
19
19
  "license": "MIT",
20
20
  "author": "Newton Koumantzelis",
@@ -34,12 +34,14 @@
34
34
  "libsodium-wrappers": "^0.8.4"
35
35
  },
36
36
  "devDependencies": {
37
- "@theholocron/eslint-config": "^8.0.0",
38
- "@theholocron/github-client": "^1.18.0",
39
- "@theholocron/http-client": "^1.18.0",
40
- "@theholocron/tsconfig": "^8.0.0",
41
- "@theholocron/tsdown-config": "^8.0.0",
42
- "@theholocron/vitest-config": "^8.0.0",
37
+ "@theholocron/eslint-config": "^8.8.0",
38
+ "@theholocron/fs-utils": "^1.16.0",
39
+ "@theholocron/github-client": "^1.42.1",
40
+ "@theholocron/http-client": "^1.42.1",
41
+ "@theholocron/misc-utils": "^1.16.0",
42
+ "@theholocron/tsconfig": "^8.8.0",
43
+ "@theholocron/tsdown-config": "^8.8.0",
44
+ "@theholocron/vitest-config": "^8.8.0",
43
45
  "@types/node": "^26",
44
46
  "@vitest/coverage-v8": "^4.1.11",
45
47
  "@vitest/eslint-plugin": "^1.6.27",
@@ -47,14 +49,16 @@
47
49
  "eslint-plugin-n": "^18.3.0",
48
50
  "globals": "^17.11.0",
49
51
  "tsdown": "^0.22.14",
50
- "tsx": "4.23.12",
52
+ "tsx": "4.23.15",
51
53
  "typescript": "^5.9.3",
52
54
  "vitest": "^4.1.11",
53
- "@theholocron/cli": "5.0.0-alpha.17"
55
+ "@theholocron/cli": "5.0.0-alpha.171"
54
56
  },
55
57
  "peerDependencies": {
56
- "@theholocron/github-client": "^1.18.0",
57
- "@theholocron/cli": "5.0.0-alpha.17"
58
+ "@theholocron/fs-utils": "^1.16.0",
59
+ "@theholocron/github-client": "^1.42.1",
60
+ "@theholocron/misc-utils": "^1.16.0",
61
+ "@theholocron/cli": "5.0.0-alpha.171"
58
62
  },
59
63
  "engines": {
60
64
  "node": ">=22"