@theholocron/holocron-plugin-github 2.0.0-alpha.67 → 2.0.0-alpha.69

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, createGitHubClient } from "@theholocron/github-client";
2
- import { Auth, AuthError, Ci, CiRun, CiRunFilter, Environment, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretScope, Secrets, Source, TrackerDoctorReport, TrackerUser } from "@theholocron/cli";
2
+ import { Auth, AuthError, Ci, CiRun, CiRunFilter, Environment, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, RepoRef, RepoSettings, ResolveTokenInput, Ruleset, SecretScope, Secrets, Source, TeamEntry, TeamEntry as TeamEntry$1, TeamPermission, TrackerDoctorReport, TrackerUser } from "@theholocron/cli";
3
3
 
4
4
  //#region src/auth.d.ts
5
5
  declare const resolveToken: (input?: import("@theholocron/http-client").ResolveTokenInput) => string;
@@ -49,6 +49,7 @@ declare class GitHubSource implements Source {
49
49
  writeRepoFile(path: string, contents: string): Promise<void>;
50
50
  syncLabels(canonical: ReadonlyArray<LabelDef>, stale: ReadonlyArray<string>): Promise<string>;
51
51
  syncProperties(values: Record<string, string>): Promise<string>;
52
+ syncTeams(teams: TeamEntry$1[]): Promise<string>;
52
53
  syncTopics(topics: string[]): Promise<string>;
53
54
  syncDescription(description: string): Promise<string>;
54
55
  }
@@ -158,6 +159,14 @@ interface CanonicalLabel {
158
159
  */
159
160
  declare function syncLabels(client: GitHubClient, repo: string, canonical: ReadonlyArray<CanonicalLabel>, stale: ReadonlyArray<string>): Promise<string>;
160
161
  //#endregion
162
+ //#region src/capabilities/teams.d.ts
163
+ interface NormalizedTeamEntry {
164
+ slug: string;
165
+ permission: TeamPermission;
166
+ }
167
+ declare function normalizeTeamEntry(entry: TeamEntry): NormalizedTeamEntry;
168
+ declare function syncTeams(client: GitHubClient, repo: string, teams: TeamEntry[]): Promise<string>;
169
+ //#endregion
161
170
  //#region src/verify-token.d.ts
162
171
  /**
163
172
  * `verifyToken` — plugin-level export used by `holocron auth set` +
@@ -231,4 +240,4 @@ declare function createPlugin(options: GitHubPluginOptions): {
231
240
  */
232
241
  declare const AUTH_HINT: string;
233
242
  //#endregion
234
- export { AUTH_HINT, type Auth, AuthError, type CanonicalLabel, GitHubCi, GitHubEnvironments, GitHubIssues, GitHubPluginOptions, GitHubSecrets, GitHubSource, PluginContext, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, ci, createContext, createGitHubClient, createPlugin, encryptSecret, environments, issues, resolveToken, secrets, source, syncLabels, verifyToken };
243
+ export { AUTH_HINT, type Auth, AuthError, type CanonicalLabel, GitHubCi, GitHubEnvironments, GitHubIssues, GitHubPluginOptions, GitHubSecrets, GitHubSource, type NormalizedTeamEntry, PluginContext, type ResolveTokenInput, type TeamEntry, type TeamPermission, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, ci, createContext, createGitHubClient, createPlugin, encryptSecret, environments, issues, normalizeTeamEntry, resolveToken, secrets, source, syncLabels, syncTeams, verifyToken };
package/dist/index.mjs CHANGED
@@ -428,6 +428,27 @@ async function syncProperties(client, repo, values) {
428
428
  return `${Object.keys(values).length} properties set`;
429
429
  }
430
430
  //#endregion
431
+ //#region src/capabilities/teams.ts
432
+ function normalizeTeamEntry(entry) {
433
+ if (typeof entry === "string") return {
434
+ slug: entry,
435
+ permission: "push"
436
+ };
437
+ return entry;
438
+ }
439
+ async function syncTeams(client, repo, teams) {
440
+ const [org = "", name = ""] = repo.split("/", 2);
441
+ const normalized = teams.map(normalizeTeamEntry);
442
+ const results = await Promise.allSettled(normalized.map(({ slug, permission }) => client.teams.addRepo(org, slug, org, name, permission)));
443
+ const succeeded = results.filter((r) => r.status === "fulfilled").length;
444
+ const failedSlugs = normalized.filter((_, i) => results[i]?.status === "rejected").map(({ slug }) => slug);
445
+ if (failedSlugs.length > 0) {
446
+ if (succeeded === 0) throw new Error(`all teams failed: ${failedSlugs.join(", ")}`);
447
+ return `${succeeded} synced, failed: ${failedSlugs.join(", ")}`;
448
+ }
449
+ return `${succeeded} team${succeeded === 1 ? "" : "s"} synced`;
450
+ }
451
+ //#endregion
431
452
  //#region src/capabilities/topics.ts
432
453
  async function syncTopics(client, repo, topics) {
433
454
  await client.topics.setTopics(repo, topics);
@@ -539,6 +560,9 @@ var GitHubSource = class {
539
560
  async syncProperties(values) {
540
561
  return syncProperties(this.client, this.repo, values);
541
562
  }
563
+ async syncTeams(teams) {
564
+ return syncTeams(this.client, this.repo, teams);
565
+ }
542
566
  async syncTopics(topics) {
543
567
  return syncTopics(this.client, this.repo, topics);
544
568
  }
@@ -647,4 +671,4 @@ function createPlugin(options) {
647
671
  */
648
672
  const AUTH_HINT = "generate a Personal Access Token at https://github.com/settings/tokens (scopes: repo, admin:repo_hook — plus admin:org for org-level ops), then run: holocron auth set github <PAT>";
649
673
  //#endregion
650
- export { AUTH_HINT, AuthError, GitHubCi, GitHubEnvironments, GitHubIssues, GitHubSecrets, GitHubSource, ci, createContext, createGitHubClient, createPlugin, encryptSecret, environments, issues, resolveToken, secrets, source, syncLabels, verifyToken };
674
+ export { AUTH_HINT, AuthError, GitHubCi, GitHubEnvironments, GitHubIssues, GitHubSecrets, GitHubSource, ci, createContext, createGitHubClient, createPlugin, encryptSecret, environments, issues, normalizeTeamEntry, resolveToken, secrets, source, syncLabels, syncTeams, verifyToken };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-github",
3
- "version": "2.0.0-alpha.67",
3
+ "version": "2.0.0-alpha.69",
4
4
  "description": "Holocron plugin for GitHub. Implements source, ci, secrets, environments, and issues capabilities against the GitHub REST API.",
5
5
  "homepage": "https://github.com/theholocron/holocron/tree/main/packages/holocron-plugin-github#readme",
6
6
  "bugs": "https://github.com/theholocron/holocron/issues",
@@ -21,15 +21,15 @@
21
21
  }
22
22
  },
23
23
  "peerDependencies": {
24
- "@theholocron/github-client": "^0.11.3",
25
- "@theholocron/cli": "2.0.0-alpha.67"
24
+ "@theholocron/github-client": "^1.1.0",
25
+ "@theholocron/cli": "2.0.0-alpha.69"
26
26
  },
27
27
  "dependencies": {
28
28
  "libsodium-wrappers": "^0.7.15"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@theholocron/eslint-config": "^7.3.0",
32
- "@theholocron/github-client": "^0.11.3",
32
+ "@theholocron/github-client": "^1.1.0",
33
33
  "@theholocron/tsconfig": "^7.3.0",
34
34
  "@theholocron/tsdown-config": "^7.3.0",
35
35
  "@theholocron/vitest-config": "^7.3.0",
@@ -44,7 +44,7 @@
44
44
  "tsx": "^4.22.4",
45
45
  "typescript": "^5.9.3",
46
46
  "vitest": "^4.1.10",
47
- "@theholocron/cli": "2.0.0-alpha.67"
47
+ "@theholocron/cli": "2.0.0-alpha.69"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"