GitSense is an interactive CLI tool that uses AI to generate conventional commit messages and PR descriptions from your git changes. It now includes powerful JIRA integration features!
- AI-Generated Commit Messages: Analyzes your git diff and generates 5 conventional commit message options
- Interactive Selection: Navigate with arrow keys or vim-style (j/k) shortcuts
- Smart Diff Analysis: Automatically detects staged vs unstaged changes
- Commit Style Learning: Learns from your recent commit history to match your style
- Automatic Ticket Detection: Extracts JIRA ticket ID from branch name (e.g.,
feature/CDS-116548-authβCDS-116548) - PR Description Generator: Creates minimal, focused PR descriptions in WHAT/WHY/HOW/TESTS format
- JIRA Field Helper: Generates text for common JIRA fields:
- Bug Resolution
- CFD Escape Analysis
- Public Release Notes Summary
- Branch-Origin Diff: Calculates all changes since branch diverged from main/master
# Required
npm install -g cursor-agent # AI model access
# Optional (for JIRA features)
# Install JIRA CLI: https://github.com/ankitpokhrel/jira-cli# Make executable
chmod +x gitsense
# Optional: Add to PATH
sudo ln -s $(pwd)/gitsense /usr/local/bin/gitsense# Navigate to your git repository
cd your-project
# Stage your changes (or don't - gitsense handles both!)
git add .
# Run gitsense
./gitsenseβ/βorj/k- Move up/down through options (vim-style)1-5- Select option directly by number
Enter- Commit with selected messagee- Edit message in nvim before committingc- Copy message to clipboardd- Preview full diffr- Refine AI suggestions with feedback
p- Generate PR description from JIRA ticket + git changesj- Generate JIRA field text (Bug Resolution, CFD Escape, Release Notes)
?- Show help menuq- Quit without committing
When on a branch like feature/CDS-116548-add-authentication:
- Press
pin the menu - GitSense will:
- Extract ticket ID:
CDS-116548 - Fetch JIRA ticket info via
jira issue view CDS-116548 - Analyze all commits since branch diverged from main
- Calculate diff from branch origin point
- Generate minimal PR description in format:
- Extract ticket ID:
## WHAT
Add JWT-based authentication to API endpoints
## WHY
Enable secure user access as per CDS-116548 requirements
## HOW
- Implement JWT token generation and validation middleware
- Add authentication guards to protected routes
- Store refresh tokens in Redis cache
## TESTS
- tests/auth/jwt.test.ts
- tests/middleware/auth.test.ts- Copy to clipboard automatically (optional)
Press j to open JIRA field generator menu:
Bug Resolution Example:
Root cause: Null pointer exception when user profile was missing optional fields.
Fixed by adding null checks and default values in ProfileService.validate().
Prevents recurrence by enforcing schema validation at API boundary.
CFD Escape Analysis Example:
This escaped because our test suite didn't cover the edge case of missing
optional fields. The gap was lack of property-based testing for partial
object scenarios. Future prevention: Add property-based tests using fast-check
library for all API models.
Public Release Notes Example:
Users can now save incomplete profiles without required fields causing errors.
This improves the onboarding experience for new users.
- Staged changes (if any):
git diff --cached - All unstaged changes (if nothing staged):
git diff HEAD - Untracked files: Warning shown but not analyzed
For JIRA/PR features, GitSense finds where your branch diverged:
# Finds merge-base with main or master
git merge-base main HEAD
# Gets all commits since divergence
git log <merge-base>..HEAD
# Calculates full diff from branch start
git diff <merge-base>..HEADThis ensures PR descriptions include ALL work on the branch, not just latest commit.
Supports standard JIRA patterns:
feature/CDS-116548-descriptionβCDS-116548bugfix/PROJ-123-fix-authβPROJ-123CDS-116548βCDS-116548
Pattern: [A-Z]+-[0-9]+ (uppercase letters, dash, numbers)
Currently uses grok-code-fast-1 via cursor-agent. Can be modified in the script:
cursor-agent --model grok-code-fast-1 --printFollows Conventional Commits spec:
<type>: [<branch-name>]: <description>
Types: feat, fix, chore, docs, refactor, style, perf, test, ci, build
Ensure jira CLI is configured:
# Test JIRA access
jira issue view YOUR-TICKET-123
# If not configured, follow jira-cli setup docs$ ./gitsense
π Analyzing changes with AI (grok-code-fast-1)...
------------------------------------------------
Select a commit message (β/β to move, Enter to select):
------------------------------------------------
-> feat: [master]: add user authentication system
feat: [master]: implement JWT-based auth
feat: [master]: enable secure user login
fix: [master]: add missing auth middleware
chore: [master]: update auth dependencies
------------------------------------------------
[Enter] Commit [e] Edit [c] Copy [d] Diff [r] Refine [?] Help [q] Quit# On branch: feature/CDS-116548-add-auth
$ ./gitsense
# Press 'p' for PR description
π Generating PR Description for CDS-116548...
================================================
π PR Description for CDS-116548
================================================
## WHAT
Add JWT authentication to API endpoints
## WHY
Enable secure user sessions as required by security audit (CDS-116548)
## HOW
- Implement JWT middleware with RS256 signing
- Add refresh token rotation
- Integrate with existing user service
## TESTS
- tests/auth/jwt.test.ts (12 new test cases)
- tests/integration/auth-flow.test.ts
================================================
Copy to clipboard? [Y/n]:# Press 'j' for JIRA fields
================================================
π― JIRA Field Generator - CDS-116548
================================================
1) Bug Resolution
2) CFD Escape Analysis
3) Public Release Notes Summary
q) Back to main menu
================================================
Select field: 1
--- Bug Resolution ---
Root cause: Race condition in token refresh logic caused expired tokens
to be accepted during concurrent requests. Fixed by implementing atomic
token validation with Redis distributed lock. Prevents recurrence by
adding integration tests for concurrent auth scenarios.
Copy to clipboard? [Y/n]:- Stage Important Changes: Stage changes you want to commit, leave exploratory code unstaged
- Descriptive Branch Names: Include JIRA ticket in branch name for auto-detection
- Use Refine: Press
rto give feedback if AI suggestions miss the mark - Edit When Needed: Press
eto fine-tune AI suggestions in nvim - Preview Diffs: Press
dbefore committing to review changes - One PR Per Branch: JIRA features work best with feature-branch workflow
npm install -g cursor-agentJIRA features are optional. Install from: https://github.com/ankitpokhrel/jira-cli
Ensure your branch name includes ticket ID: feature/CDS-116548-description
Press r and provide feedback like: "This is a bugfix, not a feature"
Make sure you have either staged changes (git add) or modified files
- Uses OpenAI's gpt-4o-mini model via direct API calls
- Much faster than CLI wrappers
- Requires
OPENAI_API_KEYenvironment variable
- Uses Google's Gemini CLI
- Slower due to CLI overhead
- Requires
geminiCLI to be installed
Suggestions and improvements welcome! This is a productivity tool, so PRs for:
- Better AI prompts
- Additional JIRA field types
- Support for other issue trackers (Linear, GitHub Issues)
- Performance optimizations
MIT License - feel free to use and modify!
- Built with
cursor-agentfor AI completions - Inspired by conventional commit standards
- JIRA integration via
jira-cli