commit-ai-agent 1.0.2 → 1.0.3

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ⚡ Commit Analyzer
1
+ # ⚡ Commit AI Agent
2
2
 
3
3
  AI가 git 커밋과 현재 변경사항을 한국어로 자동 분석해주는 개발자 도구입니다.
4
4
 
@@ -15,21 +15,21 @@ AI가 git 커밋과 현재 변경사항을 한국어로 자동 분석해주는
15
15
  ### 방법 A — npx (설치 없이 바로 실행)
16
16
 
17
17
  ```bash
18
- npx commit-analyzer
18
+ npx commit-ai-agent
19
19
  ```
20
20
 
21
21
  ### 방법 B — 전역 설치 후 명령어로 실행
22
22
 
23
23
  ```bash
24
- npm install -g commit-analyzer
24
+ npm install -g commit-ai-agent
25
25
  commit-analyzer
26
26
  ```
27
27
 
28
28
  ### 방법 C — 직접 클론
29
29
 
30
30
  ```bash
31
- git clone https://github.com/cjy3458/commit-analyzer.git
32
- cd commit-analyzer
31
+ git clone https://github.com/cjy3458/commit-ai-agent.git
32
+ cd commit-ai-agent
33
33
  npm install
34
34
  npm start
35
35
  ```
@@ -84,6 +84,73 @@ PORT=3000
84
84
 
85
85
  ---
86
86
 
87
+ ## 버그 제보 & 기능 제안
88
+
89
+ [GitHub Issues](https://github.com/cjy3458/commit-ai-agent/issues)를 통해 자유롭게 제보해 주세요.
90
+
91
+ **버그 제보 시 포함하면 좋은 정보:**
92
+
93
+ - OS / Node.js 버전
94
+ - 실행 방법 (npx / 전역 설치 / 직접 클론)
95
+ - 오류 메시지 전문 (터미널 출력)
96
+ - 재현 방법
97
+
98
+ **기능 제안 시:**
99
+
100
+ - 제안 배경 (어떤 문제를 해결하고 싶은지)
101
+ - 원하는 동작 방식
102
+
103
+ ---
104
+
105
+ ## 기여하기
106
+
107
+ PR은 언제나 환영합니다.
108
+
109
+ ```bash
110
+ # 1. 저장소 포크 후 클론
111
+ git clone https://github.com/cjy3458/commit-ai-agent.git
112
+ cd commit-ai-agent
113
+
114
+ # 2. 의존성 설치
115
+ npm install
116
+
117
+ # 3. 환경 설정
118
+ cp .env.example .env
119
+ # .env에 GEMINI_API_KEY, DEV_ROOT 입력
120
+
121
+ # 4. 개발 서버 실행 (파일 변경 시 자동 재시작)
122
+ npm run dev
123
+
124
+ # 5. 브랜치 생성 → 작업 → PR
125
+ git checkout -b feat/my-feature
126
+ ```
127
+
128
+ ---
129
+
130
+ ## 프로젝트 구조
131
+
132
+ ```
133
+ commit-analyzer/
134
+ ├── bin/
135
+ │ └── cli.js # CLI 진입점 (npx / npm install -g)
136
+ ├── src/
137
+ │ ├── server.js # Express 서버 · API 라우트 · SSE 스트리밍
138
+ │ ├── analyzer.js # Gemini AI 분석 프롬프트 · 재시도 로직
139
+ │ └── git.js # simple-git 래퍼 (커밋 조회, status diff)
140
+ ├── public/ # 프론트엔드 정적 파일 (HTML · CSS · JS)
141
+ ├── .env.example # 환경변수 예시
142
+ └── package.json
143
+ ```
144
+
145
+ | 파일 | 역할 |
146
+ | ----------------- | ----------------------------------------------------- |
147
+ | `bin/cli.js` | npx 실행 시 .env 로드, 브라우저 자동 오픈, 서버 시작 |
148
+ | `src/server.js` | REST API + SSE 엔드포인트, 리포트 저장 |
149
+ | `src/analyzer.js` | Gemini API 호출, 모델 폴백(2.5→2.0→lite), 지수 백오프 |
150
+ | `src/git.js` | 프로젝트 목록 탐색, 커밋 diff, working status diff |
151
+
152
+ ---
153
+
87
154
  ## 라이선스
88
155
 
89
156
  [MIT](./LICENSE)
package/bin/cli.js CHANGED
@@ -3,34 +3,38 @@
3
3
  * commit-analyzer CLI 진입점
4
4
  * npx commit-analyzer 또는 npm install -g 후 commit-analyzer 명령으로 실행
5
5
  */
6
- import dotenv from 'dotenv';
7
- import path from 'path';
8
- import { fileURLToPath } from 'url';
9
- import { spawn } from 'child_process';
6
+ import dotenv from "dotenv";
7
+ import path from "path";
8
+ import { fileURLToPath } from "url";
9
+ import { spawn } from "child_process";
10
10
 
11
11
  // 사용자 현재 디렉토리의 .env 로드
12
- dotenv.config({ path: path.resolve(process.cwd(), '.env') });
12
+ dotenv.config({ path: path.resolve(process.cwd(), ".env") });
13
13
 
14
14
  // 패키지 루트 경로를 환경변수로 전달 (server.js가 public/ 위치를 찾기 위함)
15
15
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
16
- process.env.COMMIT_ANALYZER_ROOT = path.resolve(__dirname, '..');
16
+ process.env.COMMIT_ANALYZER_ROOT = path.resolve(__dirname, "..");
17
17
 
18
18
  const PORT = process.env.PORT || 3000;
19
19
 
20
- console.log('');
21
- console.log(' ⚡ Commit Analyzer');
20
+ console.log("");
21
+ console.log(" ⚡ Commit AI Agent 실행 중...");
22
22
  console.log(` 🌐 http://localhost:${PORT}`);
23
- console.log(' 종료: Ctrl+C');
24
- console.log('');
23
+ console.log(" 종료: Ctrl+C");
24
+ console.log("");
25
25
 
26
26
  // 브라우저 자동 오픈 (1초 지연 - 서버 준비 대기)
27
27
  setTimeout(async () => {
28
28
  const url = `http://localhost:${PORT}`;
29
29
  const platform = process.platform;
30
- const cmd = platform === 'win32' ? 'start' :
31
- platform === 'darwin' ? 'open' : 'xdg-open';
32
- spawn(cmd, [url], { shell: true, stdio: 'ignore', detached: true });
30
+ const cmd =
31
+ platform === "win32"
32
+ ? "start"
33
+ : platform === "darwin"
34
+ ? "open"
35
+ : "xdg-open";
36
+ spawn(cmd, [url], { shell: true, stdio: "ignore", detached: true });
33
37
  }, 1200);
34
38
 
35
39
  // 서버 시작
36
- await import('../src/server.js');
40
+ await import("../src/server.js");
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "commit-ai-agent",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "AI-powered git commit & working status analyzer with web UI",
5
5
  "type": "module",
6
6
  "main": "src/server.js",
7
7
  "bin": {
8
- "commit-analyzer": "./bin/cli.js"
8
+ "commit-ai-agent": "./bin/cli.js"
9
9
  },
10
10
  "files": [
11
11
  "bin/",
package/public/app.js CHANGED
@@ -201,6 +201,7 @@ async function startAnalysis(endpoint) {
201
201
  resultCard.style.display = 'block';
202
202
  analysisBody.innerHTML = '';
203
203
  reportSaved.textContent = '';
204
+ document.getElementById('copy-btn').style.display = 'none'; // 분석 시작 시 숨김
204
205
  setStatus('loading', '분석 준비 중...');
205
206
  analyzeBtn.disabled = true;
206
207
  btnIcon.textContent = '⏳';
@@ -251,6 +252,7 @@ async function startAnalysis(endpoint) {
251
252
  }
252
253
  } else if (data.type === 'done') {
253
254
  setStatus('done', '✅ 분석 완료!');
255
+ document.getElementById('copy-btn').style.display = 'inline-flex'; // 완료 시에만 표시
254
256
  } else if (data.type === 'error') {
255
257
  setStatus('error', `오류: ${data.message}`);
256
258
  }
package/public/index.html CHANGED
@@ -1,128 +1,155 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="ko">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Commit Analyzer — AI 커밋 분석기</title>
7
- <meta name="description" content="AI 기반 git 커밋 문서화 및 코드 리뷰 에이전트" />
8
- <meta name="theme-color" content="#6366f1" />
9
- <link rel="preconnect" href="https://fonts.googleapis.com" />
10
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
11
- <link href="https://fonts.googleapis.com/css2?family=Pretendard:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
12
- <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
13
- <link rel="stylesheet" href="/style.css" />
14
- </head>
15
- <body>
16
- <!-- ── Header ── -->
17
- <header class="header">
18
- <div class="header-inner">
19
- <div class="logo">
20
- <span class="logo-icon">⚡</span>
21
- <span class="logo-text">Commit Analyzer</span>
22
- <span class="logo-badge">AI</span>
23
- </div>
24
- <nav class="header-nav">
25
- <button class="nav-btn active" data-tab="analyze" id="btn-analyze">분석하기</button>
26
- <button class="nav-btn" data-tab="reports" id="btn-reports">리포트</button>
27
- </nav>
28
- </div>
29
- </header>
30
-
31
- <!-- ── Main ── -->
32
- <main class="main">
33
-
34
- <!-- ── Tab: Analyze ── -->
35
- <section class="tab-content active" id="tab-analyze">
36
-
37
- <!-- API Key Warning -->
38
- <div class="alert alert-warn" id="api-key-warn" style="display:none">
39
- ⚠️ <strong>.env</strong> 파일에 <code>GEMINI_API_KEY</code>가 설정되지 않았습니다.
40
- <code>c:\dev\commit-analyzer\.env</code> 파일을 생성하고 키를 입력해 주세요.
41
- </div>
42
-
43
- <!-- Project Selector Card -->
44
- <div class="card selector-card">
45
- <div class="card-header">
46
- <h2 class="card-title">🗂 프로젝트 선택</h2>
47
- <button class="refresh-btn" id="refresh-projects" title="새로고침">↻</button>
48
- </div>
49
- <!-- Mode Toggle -->
50
- <div class="mode-toggle">
51
- <button class="mode-btn active" id="mode-commit" data-mode="commit">📦 최근 커밋 분석</button>
52
- <button class="mode-btn" id="mode-status" data-mode="status">🔍 현재 변경사항 분석</button>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Commit Ai agent — AI 커밋 분석기</title>
7
+ <meta
8
+ name="description"
9
+ content="AI 기반 git 커밋 문서화 및 코드 리뷰 에이전트"
10
+ />
11
+ <meta name="theme-color" content="#6366f1" />
12
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
13
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
14
+ <link
15
+ href="https://fonts.googleapis.com/css2?family=Pretendard:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
16
+ rel="stylesheet"
17
+ />
18
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
19
+ <link rel="stylesheet" href="/style.css" />
20
+ </head>
21
+ <body>
22
+ <!-- ── Header ── -->
23
+ <header class="header">
24
+ <div class="header-inner">
25
+ <div class="logo">
26
+ <span class="logo-icon">⚡</span>
27
+ <span class="logo-text">Commit Ai agent</span>
28
+ <span class="logo-badge">AI</span>
53
29
  </div>
54
- <div class="project-grid" id="project-grid">
55
- <div class="skeleton-grid">
56
- <div class="skeleton"></div><div class="skeleton"></div><div class="skeleton"></div>
57
- </div>
58
- </div>
59
- <div class="card-footer">
60
- <span class="selected-hint" id="selected-hint">프로젝트를 선택해 주세요</span>
61
- <button class="btn-primary" id="analyze-btn" disabled>
62
- <span class="btn-icon">🔍</span> 커밋 분석하기
30
+ <nav class="header-nav">
31
+ <button class="nav-btn active" data-tab="analyze" id="btn-analyze">
32
+ 분석하기
63
33
  </button>
64
- </div>
34
+ <button class="nav-btn" data-tab="reports" id="btn-reports">
35
+ 리포트
36
+ </button>
37
+ </nav>
65
38
  </div>
39
+ </header>
66
40
 
67
- <!-- Working Status Card (hidden until project selected in status mode) -->
68
- <div class="card commit-card" id="status-card" style="display:none">
69
- <h2 class="card-title">🔧 현재 변경사항 (미커밋)</h2>
70
- <div class="commit-meta" id="status-meta"></div>
71
- <div class="diff-toggle">
72
- <button class="btn-ghost" id="status-diff-toggle-btn">diff 보기 ▾</button>
73
- <pre class="diff-content" id="status-diff-content" style="display:none"></pre>
41
+ <!-- ── Main ── -->
42
+ <main class="main">
43
+ <!-- ── Tab: Analyze ── -->
44
+ <section class="tab-content active" id="tab-analyze">
45
+ <!-- API Key Warning -->
46
+ <div class="alert alert-warn" id="api-key-warn" style="display: none">
47
+ ⚠️ <strong>.env</strong> 파일에 <code>GEMINI_API_KEY</code>가 설정되지
48
+ 않았습니다. <code>c:\dev\commit-analyzer\.env</code> 파일을 생성하고
49
+ 키를 입력해 주세요.
74
50
  </div>
75
- </div>
76
51
 
77
- <!-- Commit Info Card (hidden until project selected) -->
78
- <div class="card commit-card" id="commit-card" style="display:none">
79
- <h2 class="card-title">📦 최근 커밋</h2>
80
- <div class="commit-meta" id="commit-meta"></div>
81
- <div class="diff-toggle">
82
- <button class="btn-ghost" id="diff-toggle-btn">diff 보기 ▾</button>
83
- <pre class="diff-content" id="diff-content" style="display:none"></pre>
52
+ <!-- Project Selector Card -->
53
+ <div class="card selector-card">
54
+ <div class="card-header">
55
+ <h2 class="card-title">🗂 프로젝트 선택</h2>
56
+ <button class="refresh-btn" id="refresh-projects" title="새로고침">
57
+
58
+ </button>
59
+ </div>
60
+ <!-- Mode Toggle -->
61
+ <div class="mode-toggle">
62
+ <button class="mode-btn active" id="mode-commit" data-mode="commit">
63
+ 📦 최근 커밋 분석
64
+ </button>
65
+ <button class="mode-btn" id="mode-status" data-mode="status">
66
+ 🔍 현재 변경사항 분석
67
+ </button>
68
+ </div>
69
+ <div class="project-grid" id="project-grid">
70
+ <div class="skeleton-grid">
71
+ <div class="skeleton"></div>
72
+ <div class="skeleton"></div>
73
+ <div class="skeleton"></div>
74
+ </div>
75
+ </div>
76
+ <div class="card-footer">
77
+ <span class="selected-hint" id="selected-hint"
78
+ >프로젝트를 선택해 주세요</span
79
+ >
80
+ <button class="btn-primary" id="analyze-btn" disabled>
81
+ <span class="btn-icon">🔍</span> 커밋 분석하기
82
+ </button>
83
+ </div>
84
84
  </div>
85
- </div>
86
85
 
87
- <!-- Analysis Output -->
88
- <div class="card result-card" id="result-card" style="display:none">
89
- <div class="result-header">
90
- <h2 class="card-title">📝 AI 분석 결과</h2>
91
- <div class="result-actions">
92
- <button class="btn-ghost" id="copy-btn">📋 복사</button>
93
- <span class="report-saved" id="report-saved"></span>
86
+ <!-- Working Status Card (hidden until project selected in status mode) -->
87
+ <div class="card commit-card" id="status-card" style="display: none">
88
+ <h2 class="card-title">🔧 현재 변경사항 (미커밋)</h2>
89
+ <div class="commit-meta" id="status-meta"></div>
90
+ <div class="diff-toggle">
91
+ <button class="btn-ghost" id="status-diff-toggle-btn">
92
+ diff 보기
93
+ </button>
94
+ <pre
95
+ class="diff-content"
96
+ id="status-diff-content"
97
+ style="display: none"
98
+ ></pre>
94
99
  </div>
95
100
  </div>
96
- <!-- Status bar -->
97
- <div class="status-bar" id="status-bar">
98
- <span class="status-dot loading"></span>
99
- <span id="status-msg">분석 준비 중...</span>
101
+
102
+ <!-- Commit Info Card (hidden until project selected) -->
103
+ <div class="card commit-card" id="commit-card" style="display: none">
104
+ <h2 class="card-title">📦 최근 커밋</h2>
105
+ <div class="commit-meta" id="commit-meta"></div>
106
+ <div class="diff-toggle">
107
+ <button class="btn-ghost" id="diff-toggle-btn">diff 보기 ▾</button>
108
+ <pre
109
+ class="diff-content"
110
+ id="diff-content"
111
+ style="display: none"
112
+ ></pre>
113
+ </div>
100
114
  </div>
101
- <!-- Streaming output -->
102
- <div class="analysis-body" id="analysis-body"></div>
103
- </div>
104
115
 
105
- </section>
116
+ <!-- Analysis Output -->
117
+ <div class="card result-card" id="result-card" style="display: none">
118
+ <div class="result-header">
119
+ <h2 class="card-title">📝 AI 분석 결과</h2>
120
+ <div class="result-actions">
121
+ <button class="btn-ghost" id="copy-btn" style="display:none">📋 복사</button>
122
+ <span class="report-saved" id="report-saved"></span>
123
+ </div>
124
+ </div>
125
+ <!-- Status bar -->
126
+ <div class="status-bar" id="status-bar">
127
+ <span class="status-dot loading"></span>
128
+ <span id="status-msg">분석 준비 중...</span>
129
+ </div>
130
+ <!-- Streaming output -->
131
+ <div class="analysis-body" id="analysis-body"></div>
132
+ </div>
133
+ </section>
106
134
 
107
- <!-- ── Tab: Reports ── -->
108
- <section class="tab-content" id="tab-reports">
109
- <div class="card">
110
- <h2 class="card-title">📁 저장된 리포트</h2>
111
- <div id="reports-list" class="reports-list">
112
- <p class="empty-state">아직 저장된 리포트가 없습니다.</p>
135
+ <!-- ── Tab: Reports ── -->
136
+ <section class="tab-content" id="tab-reports">
137
+ <div class="card">
138
+ <h2 class="card-title">📁 저장된 리포트</h2>
139
+ <div id="reports-list" class="reports-list">
140
+ <p class="empty-state">아직 저장된 리포트가 없습니다.</p>
141
+ </div>
113
142
  </div>
114
- </div>
115
- <div class="card" id="report-viewer" style="display:none">
116
- <div class="result-header">
117
- <h2 class="card-title" id="report-viewer-title">리포트</h2>
118
- <button class="btn-ghost" id="close-report-btn">✕ 닫기</button>
143
+ <div class="card" id="report-viewer" style="display: none">
144
+ <div class="result-header">
145
+ <h2 class="card-title" id="report-viewer-title">리포트</h2>
146
+ <button class="btn-ghost" id="close-report-btn">✕ 닫기</button>
147
+ </div>
148
+ <div class="analysis-body" id="report-viewer-body"></div>
119
149
  </div>
120
- <div class="analysis-body" id="report-viewer-body"></div>
121
- </div>
122
- </section>
123
-
124
- </main>
150
+ </section>
151
+ </main>
125
152
 
126
- <script src="/app.js"></script>
127
- </body>
153
+ <script src="/app.js"></script>
154
+ </body>
128
155
  </html>