gitxplain 0.1.0 → 0.1.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.
- package/.env.example +5 -10
- package/.github/workflows/ci.yml +28 -0
- package/.github/workflows/release.yml +27 -0
- package/IMPLEMENTATION.md +225 -0
- package/README.md +201 -0
- package/cli/index.js +693 -27
- package/cli/services/aiService.js +2 -2
- package/cli/services/chatService.js +683 -0
- package/cli/services/commitService.js +379 -0
- package/cli/services/envLoader.js +33 -0
- package/cli/services/gitConnectionService.js +267 -0
- package/cli/services/gitService.js +633 -1
- package/cli/services/mergeService.js +826 -0
- package/cli/services/outputFormatter.js +185 -13
- package/cli/services/pipelineService.js +721 -0
- package/cli/services/promptService.js +66 -2
- package/cli/services/splitService.js +472 -0
- package/package.json +4 -3
- package/prompts/commit.txt +57 -0
- package/prompts/split.txt +44 -0
package/.env.example
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
LLM_PROVIDER=openai
|
|
2
2
|
LLM_MODEL=
|
|
3
3
|
|
|
4
|
+
# Gemini API (Recommended)
|
|
5
|
+
GEMINI_API_KEY=
|
|
6
|
+
GEMINI_MODEL=gemini-2.5-flash
|
|
7
|
+
GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta
|
|
8
|
+
|
|
4
9
|
OPENAI_API_KEY=
|
|
5
10
|
OPENAI_MODEL=gpt-4.1-mini
|
|
6
11
|
OPENAI_BASE_URL=https://api.openai.com/v1
|
|
@@ -9,16 +14,6 @@ GROQ_API_KEY=
|
|
|
9
14
|
GROQ_MODEL=llama-3.3-70b-versatile
|
|
10
15
|
GROQ_BASE_URL=https://api.groq.com/openai/v1
|
|
11
16
|
|
|
12
|
-
OPENROUTER_API_KEY=
|
|
13
|
-
OPENROUTER_MODEL=openai/gpt-4.1-mini
|
|
14
|
-
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
|
|
15
|
-
OPENROUTER_SITE_URL=https://github.com
|
|
16
|
-
OPENROUTER_APP_NAME=gitxplain
|
|
17
|
-
|
|
18
|
-
GEMINI_API_KEY=
|
|
19
|
-
GEMINI_MODEL=gemini-2.5-flash
|
|
20
|
-
GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta
|
|
21
|
-
|
|
22
17
|
OLLAMA_API_KEY=ollama
|
|
23
18
|
OLLAMA_MODEL=llama3.2
|
|
24
19
|
OLLAMA_BASE_URL=http://127.0.0.1:11434/v1
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
verify:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout
|
|
13
|
+
uses: actions/checkout@v4
|
|
14
|
+
- name: Setup Node.js
|
|
15
|
+
uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: '20'
|
|
18
|
+
cache: npm
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: npm ci
|
|
21
|
+
- name: Lint
|
|
22
|
+
run: npm run lint
|
|
23
|
+
- name: Test
|
|
24
|
+
run: npm test
|
|
25
|
+
- name: Verify package
|
|
26
|
+
env:
|
|
27
|
+
npm_config_cache: ${{ runner.temp }}/npm-cache
|
|
28
|
+
run: npm pack --dry-run
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags:
|
|
5
|
+
- 'v*.*.*'
|
|
6
|
+
jobs:
|
|
7
|
+
publish:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout
|
|
13
|
+
uses: actions/checkout@v4
|
|
14
|
+
- name: Setup Node.js
|
|
15
|
+
uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: '20'
|
|
18
|
+
cache: npm
|
|
19
|
+
registry-url: 'https://registry.npmjs.org/'
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: npm ci
|
|
22
|
+
- name: Test
|
|
23
|
+
run: npm test
|
|
24
|
+
- name: Publish to npm
|
|
25
|
+
env:
|
|
26
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
27
|
+
run: npm publish
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# GitXplain Enhancement - Implementation Summary
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Successfully implemented two major new features for gitxplain:
|
|
5
|
+
1. **GitHub Connection** (`--connect-github`) - Connect GitHub account with Personal Access Token
|
|
6
|
+
2. **Interactive Chat Interface** (`--boot`) - Start a chat session with repository context
|
|
7
|
+
|
|
8
|
+
## New Features
|
|
9
|
+
|
|
10
|
+
### 1. GitHub Connection Feature (`--connect-github`)
|
|
11
|
+
|
|
12
|
+
**Command:**
|
|
13
|
+
```bash
|
|
14
|
+
gitxplain --connect-github
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Functionality:**
|
|
18
|
+
- Prompts user for GitHub Personal Access Token (PAT)
|
|
19
|
+
- Saves connection securely to `~/.gitxplain/git-connection.json`
|
|
20
|
+
- Displays user's git configuration (name and email)
|
|
21
|
+
- Shows success message upon completion
|
|
22
|
+
- Required before using `--boot` feature
|
|
23
|
+
|
|
24
|
+
**Files Created:**
|
|
25
|
+
- `cli/services/gitConnectionService.js` - Handles connection storage and retrieval
|
|
26
|
+
|
|
27
|
+
**Key Functions:**
|
|
28
|
+
- `saveGitConnection(token, provider)` - Saves PAT locally
|
|
29
|
+
- `loadGitConnection()` - Retrieves saved connection
|
|
30
|
+
- `isGitConnected()` - Checks if connection exists
|
|
31
|
+
- `getGitUserInfo()` - Gets git user name/email
|
|
32
|
+
|
|
33
|
+
### 2. Interactive Chat Interface (`--boot`)
|
|
34
|
+
|
|
35
|
+
**Command:**
|
|
36
|
+
```bash
|
|
37
|
+
gitxplain --boot
|
|
38
|
+
gitxplain --boot --provider groq --model llama-3.3-70b-versatile
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Functionality:**
|
|
42
|
+
- Requires prior git connection (`gitxplain --connect-github`)
|
|
43
|
+
- Initializes repository context (commits, branches, status)
|
|
44
|
+
- Launches interactive readline interface
|
|
45
|
+
- Maintains conversation history with LLM
|
|
46
|
+
- Supports all LLM providers (OpenAI, Groq, OpenRouter, Gemini, Ollama, Chutes)
|
|
47
|
+
|
|
48
|
+
**Files Created:**
|
|
49
|
+
- `cli/services/chatService.js` - Chat interface implementation
|
|
50
|
+
|
|
51
|
+
**Key Features:**
|
|
52
|
+
- Repository Context Awareness
|
|
53
|
+
- Last 20 commits with abbreviated hash and message
|
|
54
|
+
- All git branches (local and remote)
|
|
55
|
+
- Current working directory status
|
|
56
|
+
|
|
57
|
+
- Chat Commands:
|
|
58
|
+
- Type normally to ask questions about the code/commits
|
|
59
|
+
- `clear` - Reset conversation history
|
|
60
|
+
- `exit` - Close chat session
|
|
61
|
+
|
|
62
|
+
- Multi-Provider Support:
|
|
63
|
+
- OpenAI Compatible providers: OpenAI, Groq, OpenRouter, Chutes
|
|
64
|
+
- Specialized providers: Gemini (with custom formatting)
|
|
65
|
+
- Local providers: Ollama
|
|
66
|
+
|
|
67
|
+
**Key Classes:**
|
|
68
|
+
- `ChatService` - Main chat interface class
|
|
69
|
+
- `constructor(cwd, providerOverride, modelOverride)` - Initialize service
|
|
70
|
+
- `initializeRepoContext()` - Load repository information
|
|
71
|
+
- `buildSystemPrompt()` - Create context-aware system prompt
|
|
72
|
+
- `sendMessage(userMessage)` - Handle user input
|
|
73
|
+
- `startInteractiveChat()` - Main interactive loop
|
|
74
|
+
|
|
75
|
+
### 3. Updated CLI (`cli/index.js`)
|
|
76
|
+
|
|
77
|
+
**New Flags:**
|
|
78
|
+
- `--connect-github` - Initialize GitHub connection
|
|
79
|
+
- `--boot` - Start interactive chat session
|
|
80
|
+
|
|
81
|
+
**Updated Features:**
|
|
82
|
+
- `parseArgs()` - Now detects `connectGitHub` and `boot` flags
|
|
83
|
+
- `handleConnectGit()` - Manages connection workflow
|
|
84
|
+
- `handleBoot()` - Manages chat initialization
|
|
85
|
+
- `printHelp()` - Updated documentation
|
|
86
|
+
|
|
87
|
+
**Error Handling:**
|
|
88
|
+
- Checks for git repository existence
|
|
89
|
+
- Validates connection before allowing `--boot`
|
|
90
|
+
- Graceful error messages for missing PAT or connection
|
|
91
|
+
|
|
92
|
+
## Updated Files
|
|
93
|
+
|
|
94
|
+
### `cli/services/aiService.js`
|
|
95
|
+
- Exported `getProviderConfig()` function (moved from private)
|
|
96
|
+
- Exported `validateProviderConfig()` function (moved from private)
|
|
97
|
+
- These are now used by `chatService.js`
|
|
98
|
+
|
|
99
|
+
### `package.json`
|
|
100
|
+
- Updated lint script to include new service files
|
|
101
|
+
- `gitConnectionService.js`
|
|
102
|
+
- `chatService.js`
|
|
103
|
+
|
|
104
|
+
### `README.md`
|
|
105
|
+
- Added new features documentation
|
|
106
|
+
- Added usage examples for `--connect-github` and `--boot`
|
|
107
|
+
- Added section explaining chat commands
|
|
108
|
+
|
|
109
|
+
## Connection Storage
|
|
110
|
+
|
|
111
|
+
**Location:** `~/.gitxplain/git-connection.json`
|
|
112
|
+
|
|
113
|
+
**Format:**
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"token": "github_pat_xxx",
|
|
117
|
+
"provider": "github",
|
|
118
|
+
"connectedAt": "2026-04-08T09:45:18.238Z"
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Security Notes:**
|
|
123
|
+
- Token stored locally in user's home directory
|
|
124
|
+
- Not included in version control (added to `.gitignore`)
|
|
125
|
+
- Can be manually deleted to disconnect
|
|
126
|
+
|
|
127
|
+
## Testing
|
|
128
|
+
|
|
129
|
+
✅ All features tested and working:
|
|
130
|
+
1. `--connect-github` successfully saves PAT
|
|
131
|
+
2. Connection file created at correct location
|
|
132
|
+
3. `--boot` checks for existing connection
|
|
133
|
+
4. Help text updated with new commands
|
|
134
|
+
5. Syntax validation passes for all files
|
|
135
|
+
|
|
136
|
+
## Usage Examples
|
|
137
|
+
|
|
138
|
+
### Connect to GitHub
|
|
139
|
+
```bash
|
|
140
|
+
gitxplain --connect-github
|
|
141
|
+
# Enter your PAT when prompted
|
|
142
|
+
# Output: Git Connected Successfully
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Start Interactive Chat with Default Provider
|
|
146
|
+
```bash
|
|
147
|
+
gitxplain --boot
|
|
148
|
+
# Opens chat interface with repository context
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Start Chat with Specific Provider
|
|
152
|
+
```bash
|
|
153
|
+
gitxplain --boot --provider groq --model llama-3.3-70b-versatile
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Chat Commands
|
|
157
|
+
```
|
|
158
|
+
You: What commits were made recently?
|
|
159
|
+
[Assistant responds about recent commits]
|
|
160
|
+
|
|
161
|
+
You: Explain the last change
|
|
162
|
+
[Assistant explains based on repo context]
|
|
163
|
+
|
|
164
|
+
You: clear
|
|
165
|
+
[Conversation history cleared]
|
|
166
|
+
|
|
167
|
+
You: exit
|
|
168
|
+
[Chat session ends]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Architecture
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
CLI (index.js)
|
|
175
|
+
├── parseArgs() → detects --connect-github, --boot
|
|
176
|
+
├── handleConnectGit()
|
|
177
|
+
│ └── gitConnectionService.js
|
|
178
|
+
│ ├── saveGitConnection()
|
|
179
|
+
│ └── getGitUserInfo()
|
|
180
|
+
└── handleBoot()
|
|
181
|
+
└── chatService.js
|
|
182
|
+
├── ChatService class
|
|
183
|
+
├── initializeRepoContext()
|
|
184
|
+
├── sendMessage()
|
|
185
|
+
└── startInteractiveChat()
|
|
186
|
+
└── aiService.js
|
|
187
|
+
├── getProviderConfig()
|
|
188
|
+
└── validateProviderConfig()
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Backward Compatibility
|
|
192
|
+
|
|
193
|
+
✅ All existing features remain fully functional:
|
|
194
|
+
- Commit analysis (`gitxplain <commit-id>`)
|
|
195
|
+
- All analysis modes (--summary, --issues, --fix, --impact, --full)
|
|
196
|
+
- Provider override (--provider, --model)
|
|
197
|
+
- Output formatting (--json)
|
|
198
|
+
- Help command
|
|
199
|
+
|
|
200
|
+
## Next Steps (Optional Enhancements)
|
|
201
|
+
|
|
202
|
+
1. Add token validation against GitHub API
|
|
203
|
+
2. Add token expiration checking
|
|
204
|
+
3. Add support for other git platforms (GitLab, Bitbucket)
|
|
205
|
+
4. Add option to save chat history
|
|
206
|
+
5. Add syntax highlighting in chat output
|
|
207
|
+
6. Add keyboard shortcuts for chat commands
|
|
208
|
+
|
|
209
|
+
## Files Modified/Created
|
|
210
|
+
|
|
211
|
+
### Created:
|
|
212
|
+
- `cli/services/gitConnectionService.js` (134 lines)
|
|
213
|
+
- `cli/services/chatService.js` (216 lines)
|
|
214
|
+
|
|
215
|
+
### Modified:
|
|
216
|
+
- `cli/index.js` - Added new features, updated help, added handlers
|
|
217
|
+
- `cli/services/aiService.js` - Exported previously private functions
|
|
218
|
+
- `package.json` - Updated lint script
|
|
219
|
+
- `README.md` - Updated documentation
|
|
220
|
+
|
|
221
|
+
### Unchanged but Supporting:
|
|
222
|
+
- `cli/services/gitService.js` - Git integration
|
|
223
|
+
- `cli/services/outputFormatter.js` - Output formatting
|
|
224
|
+
- `cli/services/promptService.js` - Prompt templates
|
|
225
|
+
- Prompts directory - All prompt templates
|
package/README.md
CHANGED
|
@@ -15,6 +15,13 @@ Supported providers:
|
|
|
15
15
|
|
|
16
16
|
- Explains what a commit does, why it exists, and how the fix works
|
|
17
17
|
- Supports focused output modes like summary, issue, fix, impact, review, security, and line-by-line walkthroughs
|
|
18
|
+
- Supports AI-assisted commit splitting plans, with optional execution for the latest commit
|
|
19
|
+
- Supports release-branch merge previews driven by detected version bumps in diffs
|
|
20
|
+
- Supports automatic release tagging driven by the same version-bump detection used for release merges
|
|
21
|
+
- Supports release health status checks that show missing tags, unmerged version bumps, branch drift, and next steps
|
|
22
|
+
- Supports AI-assisted commit planning for uncommitted working tree changes
|
|
23
|
+
- Supports quick repository log output for full history inspection
|
|
24
|
+
- Supports repository-aware CI/CD workflow generation for the repo you are currently in
|
|
18
25
|
- Supports single commits, commit ranges, and branch-vs-base comparisons
|
|
19
26
|
- Truncates oversized diffs before sending them to the model and reports that truncation
|
|
20
27
|
- Streams output for supported providers
|
|
@@ -60,6 +67,34 @@ cp .env.example .env
|
|
|
60
67
|
|
|
61
68
|
```bash
|
|
62
69
|
gitxplain help
|
|
70
|
+
gitxplain branch -a
|
|
71
|
+
gitxplain checkout -b feature/demo
|
|
72
|
+
gitxplain commit
|
|
73
|
+
gitxplain --commit
|
|
74
|
+
gitxplain merge
|
|
75
|
+
gitxplain --merge
|
|
76
|
+
gitxplain tag
|
|
77
|
+
gitxplain --tag
|
|
78
|
+
gitxplain release
|
|
79
|
+
gitxplain release status
|
|
80
|
+
gitxplore tag
|
|
81
|
+
gitxplore --tag
|
|
82
|
+
gitxplain log --log
|
|
83
|
+
gitxplain status
|
|
84
|
+
gitxplain --status
|
|
85
|
+
gitxplain pipeline
|
|
86
|
+
gitxplain --pipeline
|
|
87
|
+
gitxplain add README.md
|
|
88
|
+
gitxplain remove README.md
|
|
89
|
+
gitxplain remove hard
|
|
90
|
+
gitxplain del scratch.txt
|
|
91
|
+
gitxplain bin
|
|
92
|
+
gitxplain pop
|
|
93
|
+
gitxplain pop 2
|
|
94
|
+
gitxplain pull
|
|
95
|
+
gitxplain pull origin main
|
|
96
|
+
gitxplain push
|
|
97
|
+
gitxplain push origin main
|
|
63
98
|
gitxplain <commit-id>
|
|
64
99
|
gitxplain <commit-id> --summary
|
|
65
100
|
gitxplain <commit-id> --issues
|
|
@@ -69,6 +104,12 @@ gitxplain <commit-id> --full
|
|
|
69
104
|
gitxplain <commit-id> --lines
|
|
70
105
|
gitxplain <commit-id> --review
|
|
71
106
|
gitxplain <commit-id> --security
|
|
107
|
+
gitxplain <commit-id> --split
|
|
108
|
+
gitxplain --commit --execute
|
|
109
|
+
gitxplain merge
|
|
110
|
+
gitxplain --merge --execute
|
|
111
|
+
gitxplain tag
|
|
112
|
+
gitxplain --tag --execute
|
|
72
113
|
gitxplain <commit-id> --json
|
|
73
114
|
gitxplain <commit-id> --markdown
|
|
74
115
|
gitxplain <commit-id> --html
|
|
@@ -76,18 +117,24 @@ gitxplain <commit-id> --stream
|
|
|
76
117
|
gitxplain <commit-id> --clipboard
|
|
77
118
|
gitxplain <commit-id> --verbose
|
|
78
119
|
gitxplain <commit-id> --quiet
|
|
120
|
+
gitxplain log --log
|
|
79
121
|
gitxplain <start>..<end> --markdown
|
|
80
122
|
gitxplain --branch main --review
|
|
81
123
|
gitxplain --pr origin/main --security
|
|
82
124
|
gitxplain install-hook
|
|
83
125
|
gitxplain <commit-id> --provider openrouter --model anthropic/claude-3.7-sonnet
|
|
84
126
|
gitxplain <commit-id> --provider chutes --model deepseek-ai/DeepSeek-V3-0324
|
|
127
|
+
gitxplain <commit-id> --split --execute
|
|
85
128
|
```
|
|
86
129
|
|
|
87
130
|
Examples:
|
|
88
131
|
|
|
89
132
|
```bash
|
|
90
133
|
npm start -- HEAD~1 --summary
|
|
134
|
+
npm start -- commit
|
|
135
|
+
npm start -- merge
|
|
136
|
+
npm start -- tag
|
|
137
|
+
npm start -- log --log
|
|
91
138
|
npm start -- a1b2c3d --full
|
|
92
139
|
npm start -- HEAD~1 --lines
|
|
93
140
|
npm start -- HEAD~5..HEAD --markdown
|
|
@@ -95,6 +142,7 @@ npm start -- --branch main --review
|
|
|
95
142
|
npm start -- HEAD~1 --provider groq --model llama-3.3-70b-versatile
|
|
96
143
|
npm start -- HEAD~1 --provider gemini --model gemini-2.5-flash
|
|
97
144
|
npm start -- HEAD~1 --provider chutes --model deepseek-ai/DeepSeek-V3-0324
|
|
145
|
+
npm start -- HEAD --split --execute
|
|
98
146
|
```
|
|
99
147
|
|
|
100
148
|
## Running The CLI
|
|
@@ -110,6 +158,8 @@ Then from any Git repository:
|
|
|
110
158
|
|
|
111
159
|
```bash
|
|
112
160
|
gitxplain help
|
|
161
|
+
gitxplain --connect-github <token>
|
|
162
|
+
gitxplain --boot
|
|
113
163
|
gitxplain HEAD~1 --full
|
|
114
164
|
gitxplain a1b2c3d --summary
|
|
115
165
|
gitxplain HEAD~1 --lines
|
|
@@ -117,6 +167,16 @@ gitxplain HEAD~5..HEAD --markdown
|
|
|
117
167
|
gitxplain --branch main --review
|
|
118
168
|
```
|
|
119
169
|
|
|
170
|
+
Inside `gitxplain --boot`, the session now prints the available interactive commands on startup. You can also type `help` at any time to re-display:
|
|
171
|
+
|
|
172
|
+
- `help`
|
|
173
|
+
- `repos`
|
|
174
|
+
- `issues`
|
|
175
|
+
- `status`
|
|
176
|
+
- `download`
|
|
177
|
+
- `clear`
|
|
178
|
+
- `exit`
|
|
179
|
+
|
|
120
180
|
The `gitxplain help` command also prints quick API-key setup examples for:
|
|
121
181
|
|
|
122
182
|
- OpenAI
|
|
@@ -142,12 +202,69 @@ node /home/guru/Dev/gitxplain/cli/index.js HEAD~1 --full
|
|
|
142
202
|
- `--lines`: file-by-file, line-by-line walkthrough of the changed code
|
|
143
203
|
- `--review`: code review findings with actionable suggestions
|
|
144
204
|
- `--security`: security-focused analysis of the change
|
|
205
|
+
- `--split`: propose how to split a commit into multiple atomic commits
|
|
206
|
+
- `--merge`: preview or execute a merge into the `release` branch based on detected version bumps
|
|
207
|
+
- `--tag`: preview or create release tags from the same detected version windows
|
|
208
|
+
- `release status`: inspect release branch health, missing tags, source-vs-release drift, and the next recommended action
|
|
209
|
+
- `--commit`: propose commits for current uncommitted changes
|
|
210
|
+
- `--log`: print Git log entries for the current repository
|
|
211
|
+
- `--status`: print Git working tree status for the current repository
|
|
212
|
+
- `pipeline` or `--pipeline`: inspect the current repository and generate GitHub Actions CI/CD workflows
|
|
213
|
+
- `--execute`: apply a proposed split by rewriting history
|
|
214
|
+
- `--dry-run`: preview the split or commit plan without applying it
|
|
145
215
|
- `--json`: return structured JSON instead of formatted text
|
|
146
216
|
- `--markdown`: return Markdown output
|
|
147
217
|
- `--html`: return HTML output
|
|
148
218
|
|
|
149
219
|
If no analysis flag is supplied, the CLI asks what kind of explanation you want.
|
|
150
220
|
|
|
221
|
+
## Repository Log
|
|
222
|
+
|
|
223
|
+
Print recent log entries from the current repository:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
gitxplain log
|
|
227
|
+
gitxplain --log
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Both forms print the repository history in a compact one-line format using the current repository, without calling the LLM.
|
|
231
|
+
|
|
232
|
+
## Quick Actions
|
|
233
|
+
|
|
234
|
+
Run a few common Git actions directly through `gitxplain`:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
gitxplain status
|
|
238
|
+
gitxplain add README.md
|
|
239
|
+
gitxplain remove README.md
|
|
240
|
+
gitxplain remove hard
|
|
241
|
+
gitxplain del scratch.txt
|
|
242
|
+
gitxplain bin
|
|
243
|
+
gitxplain pop
|
|
244
|
+
gitxplain pop 2
|
|
245
|
+
gitxplain pull
|
|
246
|
+
gitxplain pull origin main
|
|
247
|
+
gitxplain push
|
|
248
|
+
gitxplain push origin main
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
For native Git commands that do not have a custom `gitxplain` workflow, use them directly:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
gitxplain branch -a
|
|
255
|
+
gitxplain checkout -b feature/demo
|
|
256
|
+
gitxplain rebase origin/main
|
|
257
|
+
gitxplain worktree list
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
If you want to force native Git for a reserved custom command name, use the `git` wrapper:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
gitxplain git commit -m "native commit message"
|
|
264
|
+
gitxplain git merge feature/demo
|
|
265
|
+
gitxplain git tag -a v1.2.3 -m "release"
|
|
266
|
+
```
|
|
267
|
+
|
|
151
268
|
## Comparison Modes
|
|
152
269
|
|
|
153
270
|
Single commit:
|
|
@@ -171,6 +288,90 @@ gitxplain --pr origin/main --security
|
|
|
171
288
|
|
|
172
289
|
`--branch` and `--pr` compare the current branch to a base ref using the merge base with `HEAD`.
|
|
173
290
|
|
|
291
|
+
## Commit Splitting
|
|
292
|
+
|
|
293
|
+
Preview how a commit could be split:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
gitxplain HEAD~1 --split
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Actually split the current `HEAD` commit into smaller commits:
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
gitxplain HEAD --split --execute
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Use a specific provider for the analysis:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
gitxplain HEAD --split --provider gemini
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
`--split` asks the model for a plan first. By default this is a dry run and only prints the proposed commit breakdown. Adding `--execute` rewrites Git history by undoing the current `HEAD` commit and recreating it as multiple commits in the suggested order.
|
|
312
|
+
|
|
313
|
+
Warning: `--split --execute` rewrites history. If the commit was already pushed, you may need to force-push after reviewing the new commit stack. For safety, execution only supports splitting the current `HEAD` commit and requires a clean working tree.
|
|
314
|
+
|
|
315
|
+
## Release Merge
|
|
316
|
+
|
|
317
|
+
Preview the release merge plan for the current branch:
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
gitxplain merge
|
|
321
|
+
gitxplain --merge
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Actually merge the current branch into the `release` branch:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
gitxplain --merge --execute
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
This command scans commits on your current branch after the branch split point and uses version-file diffs as release checkpoints. Each time a commit changes the version, that closes a release window. On the `release` branch, the command creates commits named `release <version>`. If no release versions have been promoted yet, it creates release commits for all detected versions in order. If some release versions already exist on `release`, it skips those and creates only the latest unreleased `release <version>` commit.
|
|
331
|
+
|
|
332
|
+
## Release Tagging
|
|
333
|
+
|
|
334
|
+
Preview the release tags for the current branch:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
gitxplain tag
|
|
338
|
+
gitxplain --tag
|
|
339
|
+
gitxplore tag
|
|
340
|
+
gitxplore --tag
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Actually create the tags:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
gitxplain --tag --execute
|
|
347
|
+
gitxplore --tag --execute
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
This command uses the same release-window detection as `merge`. It scans commits on your current branch after the branch split point, detects version bumps from version-file diffs, and maps each unreleased version to the last commit in that release window. By default it creates annotated tags named exactly after the detected version, such as `1.2.3`.
|
|
351
|
+
|
|
352
|
+
## Commit Working Tree
|
|
353
|
+
|
|
354
|
+
Preview how the current uncommitted changes should be committed:
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
gitxplain commit
|
|
358
|
+
gitxplain --commit
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Actually create the suggested commits:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
gitxplain --commit --execute
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Use a specific provider for the analysis:
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
gitxplain --commit --provider gemini
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
This mode analyzes the current working tree, proposes one or more logical commits with conventional commit messages, and can then create those commits automatically. By default it only previews the plan.
|
|
374
|
+
|
|
174
375
|
## Config File
|
|
175
376
|
|
|
176
377
|
Example `.gitxplainrc`:
|