ai-git-tools 2.0.35 → 2.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-git-tools",
3
- "version": "2.0.35",
3
+ "version": "2.0.36",
4
4
  "description": "AI-powered Git automation tools for commit messages and PR generation",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -13,14 +13,14 @@ import { Logger } from '../pr-modules/ui/logger.js';
13
13
  import { colors } from '../pr-modules/utils/constants.js';
14
14
 
15
15
  /**
16
- * 檢查 gh CLI 是否已登入,未登入則印出提示並回傳 false
16
+ * 檢查 gh CLI 是否已登入且 token 有效,未登入則印出提示並回傳 false
17
17
  */
18
18
  function checkGHAuth(logger) {
19
19
  try {
20
- execSync('gh auth token', { stdio: 'pipe' });
20
+ execSync('gh api user --jq .login', { stdio: 'pipe' });
21
21
  return true;
22
22
  } catch (_) {
23
- logger.error('GitHub CLI 未登入,無法執行 PR 相關操作');
23
+ logger.error('GitHub CLI 未登入或 token 已失效,無法執行 PR 相關操作');
24
24
  console.log('');
25
25
  console.log('請先執行認證:');
26
26
  console.log(` ${colors.green}gh auth login${colors.reset}`);
@@ -63,7 +63,7 @@ export class GitHubAPI {
63
63
  */
64
64
  checkAuth() {
65
65
  try {
66
- execSync('gh auth token', { stdio: 'pipe' });
66
+ execSync('gh api user --jq .login', { stdio: 'pipe' });
67
67
  return { authenticated: true };
68
68
  } catch (error) {
69
69
  return { authenticated: false };