나는 Git 혼란을 읽고 완벽한 커밋을 작성하는 API를 만들었다 (+노출된 API 키를 잡아냄)
Source: Dev.to
내가 만든 것
이것을 만들게 된 동기
Commit messages는 중요합니다—코드베이스에서 무슨 일이 일어났는지 우리와 팀원들이 이해하도록 돕는 빵 부스러기와 같습니다. 하지만 좋은 커밋 메시지를 작성하는 것은 번거로운 일입니다.
나는 두 가지 중 하나를 하고 있었습니다:
- “fix stuff” 혹은 “updates”와 같은 대충 만든 메시지로 하루에 한두 번 커밋하기.
- 작은 변경마다 “완벽한” 커밋 메시지를 만들기 위해 지나치게 많은 시간 소비하기.
두 접근 방식 모두 지속 가능하지 않았습니다. 내 변경 사항을 이해하고 의미 있는 커밋을 대신 작성해줄 무언가가 필요했습니다.
GitSense API 개요
GitSense API는 커밋 메시지 문제를 해결하는 프로덕션‑레디 개발자 툴킷입니다. 워크플로우는 간단합니다:
- 한 번 초기화 – API에 프로젝트를 등록합니다.
- 한 번의 명령 –
git status를 전송하고, 지능형 커밋 제안을 받아옵니다. - 복사하여 실행 – 생성된 git 명령을 바로 사용합니다.
커밋 메시지 외에도, 이 API는 개인 보안 가드 역할을 하여 노출된 비밀키와 취약점을 리포지토리에 반영되기 전에 스캔합니다.
제공되는 데이터 서비스
1) 스마트 커밋 인텔리전스
- 변경된 파일을 분석하고 목적별(문서, 설정, 기능, 툴링)로 분류합니다.
- Conventional Commit 표준에 따라 의미 있는 커밋 메시지를 생성합니다.
- 논리적 기능별로 그룹화된 바로 실행 가능한 git 명령을 제공합니다.
2) 보안 취약점 탐지
- 파일 내용에서 노출된 API 키(AWS, GitHub, OpenAI, Stripe 등)를 스캔합니다.
- 하드코딩된 비밀번호와 데이터베이스 연결 문자열을 감지합니다.
- 구체적인 명령과 함께 실행 가능한 조치 방안을 제시합니다.
3) 프로젝트 분석
- 커밋 패턴 및 리포지토리 분석 이력을 추적합니다.
- 프로젝트 메타데이터와 제안 이력을 유지합니다.
- 개발 워크플로우에 대한 인사이트를 제공합니다.
실제 적용 사례
GitSense 사용 전
git add .
git commit -m "fix stuff" # 😅 우리 모두 겪어봤죠
GitSense 사용 후
# 하나의 API 호출로 이렇게 얻습니다:
git add HACKATHON_SUBMISSION.md
git commit -m 'feat: add hackathon submission documentation'
git add .vscode/settings.json
git commit -m 'chore: configure VS Code workspace settings'
git add docs/API.md
git commit -m 'docs: update project documentation'
왜 중요한가
1) 개인 개발자
- 커밋 메시지 작성에 하루 15–20분을 절감합니다.
- 코드 리뷰 시 인상적인 전문적인 git 히스토리를 만듭니다.
- 보안 사고를 사전에 방지합니다.
2) 개발 팀
- 팀 전체에 걸쳐 커밋 메시지 형식을 표준화합니다.
- 디버깅 및 기능 추적에 유용한 git 히스토리를 제공합니다.
- 공유 리포지토리의 보안 취약점을 감소시킵니다.
3) 프로젝트 유지보수자
- 의미론적 커밋으로 자동 changelog 생성을 가능하게 합니다.
- 설명적인 커밋 메시지로 코드 리뷰 효율을 높입니다.
- 보안 컴플라이언스를 위한 감사 추적을 제공합니다.
GitSense API는 git 커밋을 필수적인 작업에서 자동화된 지능형 프로세스로 전환시켜, 개발 워크플로우에 실질적인 가치를 더합니다.
API 문서
기본 URL
사용 가능한 엔드포인트
POST /analyze-project– 프로젝트 분석 초기화.POST /generate_smart_commits– 지능형 커밋 제안 생성.GET /project_lookup– 프로젝트 상태 및 이력 조회.POST /Security_Analysis– 보안 취약점 스캔.POST /generate_commit_suggestion– 기본 커밋 메시지 생성.
1. 프로젝트 분석 초기화
Endpoint: POST https://x8ki-letl-twmt.n7.xano.io/api:78VRpQ6j/analyze-project
# 프로젝트 디렉터리로 이동
cd /path/to/your/project
# GitSense API에 프로젝트 등록
curl -X POST "https://x8ki-letl-twmt.n7.xano.io/api:78VRpQ6j/analyze-project" \
-H "Content-Type: application/json" \
-d "{\"repo_path\": \"$(pwd)\"}"
Expected Response
{
"status": "created",
"project_id": 3,
"message": "New project created successfully.",
"repo_path": "/path/to/your/project"
}
2. 스마트 커밋 메시지 생성
Endpoint: POST https://x8ki-letl-twmt.n7.xano.io/api:78VRpQ6j/generate_smart_commits
# 프로젝트 디렉터리에서 실행
cd /path/to/your/project
# 지능형 커밋 제안 받기 (project_id를 실제 ID로 교체)
curl -X POST "https://x8ki-letl-twmt.n7.xano.io/api:78VRpQ6j/generate_smart_commits" \
-H "Content-Type: application/json" \
-d "{\"project_id\": 3, \"git_status\": \"$(git status --porcelain)\"}"
Expected Response
{
"suggested_commits": [
{
"files": [".vscode/settings.json"],
"git_add": "git add .vscode/settings.json",
"git_commit": "git commit -m 'chore: configure VS Code workspace settings'",
"feature": "development_environment",
"type": "tooling"
},
{
"files": ["README.md", "docs/API.md"],
"git_add": "git add README.md docs/API.md",
"git_commit": "git commit -m 'docs: update project documentation'",
"feature": "documentation",
"type": "documentation"
}
],
"total_groups": 2,
"total_files": 6,
"analysis": "Files categorized by feature and purpose"
}
3. 프로젝트 상태 확인
Endpoint: GET https://x8ki-letl-twmt.n7.xano.io/api:78VRpQ6j/project_lookup
# 프로젝트 상세 및 이력 조회
curl -X GET "https://x8ki-letl-twmt.n7.xano.io/api:78VRpQ6j/project_lookup?repo_path=$(pwd)" \
-H "Content-Type: application/json"
Expected Response
{
"project_id": 3,
"repo_path": "/path/to/your/project",
"last_analyzed": 1765775353612,
"commit_count": 0,
"recent_suggestions": [],
"status": "success"
}
4. 보안 취약점 스캔
Endpoint: POST https://x8ki-letl-twmt.n7.xano.io/api:78VRpQ6j/Security_Analysis
# 파일 내용을 스캔하여 보안 이슈 탐지
curl -X POST "https://x8ki-letl-twmt.n7.xano.io/api:78VRpQ6j/Security_Analysis" \
-H "Content-Type: application/json" \
-d "{\"project_id\": 3, \"file_contents\": \"$(cat .env 2>/dev/null || echo 'const apiKey = \\\"sk-test123\\\";')\"}"
Expected Response
{
"security_issues": ["Database Connection URL", "Hardcoded Password/Secret"],
"risk_level": "medium",
"suggestions": [
"Remove or use environment variables for Database Connection URL",
"Remove or use environment variables for Hardcoded Password/Secret"
],
"total_issues": 2,
"scan_timestamp": "2025-12-15T05:09:55.688Z"
}
5. 기본 커밋 제안
Endpoint: POST https://x8ki-letl-twmt.n7.xano.io/api:78VRpQ6j/generate_commit_suggestion
(자세한 내용은 생략)