add-ai-tools 1.2.4 → 1.2.6

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.
Files changed (2) hide show
  1. package/dist/index.mjs +20 -2
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -6,6 +6,7 @@ import * as os from "os";
6
6
  import { homedir } from "os";
7
7
  import * as path from "path";
8
8
  import { join } from "path";
9
+ import { execSync } from "node:child_process";
9
10
  import { parse } from "yaml";
10
11
  import { basename, dirname, join as join$1 } from "node:path";
11
12
  import { exec } from "child_process";
@@ -492,7 +493,21 @@ var GitHubFetcher = class {
492
493
  concurrencyLimit = 10;
493
494
  constructor() {
494
495
  this.parser = new ResourceParser();
495
- this.token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
496
+ this.token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN || this.getGhCliToken();
497
+ }
498
+ /**
499
+ * gh CLI에서 인증 토큰을 가져옵니다
500
+ */
501
+ getGhCliToken() {
502
+ try {
503
+ return execSync("gh auth token", { stdio: [
504
+ "pipe",
505
+ "pipe",
506
+ "ignore"
507
+ ] }).toString().trim() || void 0;
508
+ } catch {
509
+ return;
510
+ }
496
511
  }
497
512
  /**
498
513
  * 인증 헤더를 포함한 공통 헤더를 반환합니다
@@ -541,7 +556,10 @@ var GitHubFetcher = class {
541
556
  async getDefaultBranch(owner, repo) {
542
557
  const url = `${this.baseApiUrl}/repos/${owner}/${repo}`;
543
558
  const response = await fetch(url, { headers: this.getHeaders() });
544
- if (!response.ok) return "main";
559
+ if (!response.ok) {
560
+ if (response.status === 404 && this.token) throw new GitHubApiError(`Repository not found: ${owner}/${repo}. Your token may not have access to this repo. Check token permissions or try: GITHUB_TOKEN=$(gh auth token) npx add-ai-tools`, 404, `${owner}/${repo}`);
561
+ return "main";
562
+ }
545
563
  return (await response.json()).default_branch || "main";
546
564
  }
547
565
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-ai-tools",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "Universal AI agent resource installer CLI",
5
5
  "type": "module",
6
6
  "bin": {