gitxplain 0.1.6 → 0.1.9
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/.github/workflows/release.yml +1 -1
- package/README.md +543 -128
- package/cli/index.js +609 -385
- package/cli/services/aiService.js +234 -28
- package/cli/services/cacheService.js +92 -1
- package/cli/services/clipboardService.js +6 -1
- package/cli/services/colorSupport.js +31 -0
- package/cli/services/commitService.js +105 -23
- package/cli/services/configService.js +91 -3
- package/cli/services/envLoader.js +2 -2
- package/cli/services/gitService.js +369 -23
- package/cli/services/hookService.js +36 -4
- package/cli/services/mergeService.js +88 -65
- package/cli/services/outputFormatter.js +23 -73
- package/cli/services/pipelineService.js +113 -1
- package/cli/services/promptService.js +8 -1
- package/cli/services/splitService.js +1 -21
- package/cli/services/usageService.js +158 -0
- package/package.json +2 -2
- package/prompts/blame.txt +29 -0
- package/prompts/changelog.txt +36 -0
- package/prompts/conflict.txt +33 -0
- package/prompts/pr-description.txt +40 -0
- package/prompts/refactor.txt +29 -0
- package/prompts/stash.txt +34 -0
- package/prompts/test-suggest.txt +29 -0
- package/IMPLEMENTATION.md +0 -225
- package/cli/services/chatService.js +0 -683
- package/cli/services/gitConnectionService.js +0 -267
package/README.md
CHANGED
|
@@ -10,18 +10,26 @@ Supported providers:
|
|
|
10
10
|
- Gemini
|
|
11
11
|
- Ollama
|
|
12
12
|
- Chutes AI
|
|
13
|
+
- Anthropic
|
|
14
|
+
- Mistral
|
|
15
|
+
- Azure OpenAI
|
|
13
16
|
|
|
14
17
|
## Features
|
|
15
18
|
|
|
16
19
|
- Explains what a commit does, why it exists, and how the fix works
|
|
17
20
|
- Supports focused output modes like summary, issue, fix, impact, review, security, and line-by-line walkthroughs
|
|
21
|
+
- Supports blame summaries, changelog drafting, PR description drafting, refactor suggestions, and test suggestion modes
|
|
22
|
+
- Supports stash explanation and single-file diff deep dives
|
|
23
|
+
- Supports merge conflict analysis with suggested resolutions
|
|
24
|
+
- Supports cumulative token usage tracking and optional estimated cost reporting
|
|
25
|
+
- Supports interactive split-plan review before history is rewritten
|
|
18
26
|
- Supports AI-assisted commit splitting plans, with optional execution for the latest commit
|
|
19
27
|
- Supports release-branch merge previews driven by detected version bumps in diffs
|
|
20
28
|
- Supports automatic release tagging driven by the same version-bump detection used for release merges
|
|
21
29
|
- Supports release health status checks that show missing tags, unmerged version bumps, branch drift, and next steps
|
|
22
30
|
- Supports AI-assisted commit planning for uncommitted working tree changes
|
|
23
31
|
- Supports quick repository log output for full history inspection
|
|
24
|
-
- Supports repository-aware CI/CD workflow generation for
|
|
32
|
+
- Supports repository-aware CI/CD workflow generation for GitHub Actions, GitLab CI, CircleCI, and Bitbucket Pipelines
|
|
25
33
|
- Supports single commits, commit ranges, and branch-vs-base comparisons
|
|
26
34
|
- Truncates oversized diffs before sending them to the model and reports that truncation
|
|
27
35
|
- Streams output for supported providers
|
|
@@ -29,7 +37,6 @@ Supported providers:
|
|
|
29
37
|
- Supports plain, JSON, Markdown, and HTML output
|
|
30
38
|
- Supports clipboard copy, verbosity controls, and hook installation
|
|
31
39
|
- Supports project-level and user-level config files
|
|
32
|
-
- Falls back to an interactive prompt when no analysis flag is supplied
|
|
33
40
|
- Returns plain text or JSON output
|
|
34
41
|
- Uses native Node APIs only, so the MVP has no runtime dependencies
|
|
35
42
|
|
|
@@ -39,7 +46,7 @@ Supported providers:
|
|
|
39
46
|
- A Git repository in your current working directory
|
|
40
47
|
- An API key for your chosen provider, or a local Ollama instance
|
|
41
48
|
|
|
42
|
-
Optional environment variables:
|
|
49
|
+
Optional advanced environment variables:
|
|
43
50
|
|
|
44
51
|
- `LLM_PROVIDER` default: `openai`
|
|
45
52
|
- `LLM_MODEL` optional shared model override
|
|
@@ -55,7 +62,7 @@ Optional environment variables:
|
|
|
55
62
|
Optional config files:
|
|
56
63
|
|
|
57
64
|
- Project: `.gitxplainrc` or `.gitxplainrc.json`
|
|
58
|
-
- User: `~/.gitxplain/config.json`
|
|
65
|
+
- User: `~/.gitxplain/config.json` on macOS/Linux, or `%USERPROFILE%\.gitxplain\config.json` on Windows
|
|
59
66
|
|
|
60
67
|
You can start from:
|
|
61
68
|
|
|
@@ -65,84 +72,439 @@ cp .env.example .env
|
|
|
65
72
|
|
|
66
73
|
## Usage
|
|
67
74
|
|
|
75
|
+
Show the built-in command reference.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
gitxplain --help
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Inspect cache usage or clear cached responses.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
gitxplain cache stats
|
|
85
|
+
gitxplain cache clear
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Show cumulative token usage and estimated cost totals.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
gitxplain --cost
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Save the default AI provider.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
gitxplain config set provider <name>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Save the API key for a provider.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
gitxplain config set api-key <value> [--provider <name>]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Print one saved config value, or all of them.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
gitxplain config get [key]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
List saved user config values.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
gitxplain config list
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Analyze a single commit.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
gitxplain <commit-id> [options]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Analyze a commit range.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
gitxplain <start>..<end> [options]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Compare the current branch to a base branch.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
gitxplain --branch [base-ref] [options]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Compare the current branch like a PR.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
gitxplain --pr [base-ref] [options]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Plan commits for uncommitted working tree changes.
|
|
143
|
+
|
|
68
144
|
```bash
|
|
69
|
-
gitxplain help
|
|
70
|
-
gitxplain branch -a
|
|
71
|
-
gitxplain checkout -b feature/demo
|
|
72
|
-
gitxplain commit
|
|
73
145
|
gitxplain --commit
|
|
74
|
-
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Show release branch health and next steps.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
gitxplain --release [status]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Preview or execute a release merge.
|
|
155
|
+
|
|
156
|
+
```bash
|
|
75
157
|
gitxplain --merge
|
|
76
|
-
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Preview or create release tags.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
77
163
|
gitxplain --tag
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
gitxplain
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Explain the latest stash, or a specific stash entry.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
gitxplain --stash
|
|
170
|
+
gitxplain --stash stash@{2}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Print repository log output.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
gitxplain --log
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Print repository status output.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
84
182
|
gitxplain --status
|
|
85
|
-
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Detect and generate CI/CD workflow files.
|
|
186
|
+
|
|
187
|
+
```bash
|
|
86
188
|
gitxplain --pipeline
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
gitxplain
|
|
93
|
-
gitxplain
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
gitxplain <commit-id> --summary
|
|
100
|
-
gitxplain <commit-id> --issues
|
|
101
|
-
gitxplain <commit-id> --fix
|
|
102
|
-
gitxplain <commit-id> --impact
|
|
103
|
-
gitxplain <commit-id> --full
|
|
104
|
-
gitxplain <commit-id> --lines
|
|
105
|
-
gitxplain <commit-id> --review
|
|
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
|
|
113
|
-
gitxplain <commit-id> --json
|
|
114
|
-
gitxplain <commit-id> --markdown
|
|
115
|
-
gitxplain <commit-id> --html
|
|
116
|
-
gitxplain <commit-id> --stream
|
|
117
|
-
gitxplain <commit-id> --clipboard
|
|
118
|
-
gitxplain <commit-id> --verbose
|
|
119
|
-
gitxplain <commit-id> --quiet
|
|
120
|
-
gitxplain log --log
|
|
121
|
-
gitxplain <start>..<end> --markdown
|
|
122
|
-
gitxplain --branch main --review
|
|
123
|
-
gitxplain --pr origin/main --security
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Analyze unresolved merge conflicts in the working tree.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
gitxplain --conflict
|
|
195
|
+
gitxplain --conflict --diff src/auth.js
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Install a git hook for commit, merge, or push workflows.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
124
201
|
gitxplain install-hook
|
|
125
|
-
gitxplain
|
|
126
|
-
gitxplain
|
|
127
|
-
|
|
202
|
+
gitxplain install-hook post-merge
|
|
203
|
+
gitxplain install-hook pre-push
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Analysis:
|
|
207
|
+
|
|
208
|
+
Generate a one-line summary.
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
--summary
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Focus on the issue being fixed.
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
--issues
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Explain the fix in simple terms.
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
--fix
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Explain behavior changes before vs after.
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
--impact
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Generate the full structured analysis.
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
--full
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Walk through the changed code file by file.
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
--lines
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Generate review findings and risks.
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
--review
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Focus on security-relevant changes.
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
--security
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Suggest refactoring follow-ups.
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
--refactor
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Suggest tests to add or update.
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
--test-suggest
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Generate a PR description.
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
--pr-description
|
|
128
272
|
```
|
|
129
273
|
|
|
130
|
-
|
|
274
|
+
Generate changelog-style notes.
|
|
131
275
|
|
|
132
276
|
```bash
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
277
|
+
--changelog
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Analyze file ownership with git blame.
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
--blame <file>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Suggest resolutions for unresolved merge conflicts.
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
--conflict
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Focus analysis on one changed file.
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
--diff <file>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Propose splitting a commit into smaller commits.
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
--split
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Propose commits for current working tree changes.
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
--commit
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Apply a split, commit, merge, or tag plan.
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
--execute
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Preview a plan without applying it.
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
--dry-run
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Review or edit a split plan before execution.
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
--interactive
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Release:
|
|
329
|
+
|
|
330
|
+
Show release status details.
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
--release [status]
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Preview or apply a merge into the release branch.
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
--merge
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Preview or create release tags from version bumps.
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
--tag
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Repo:
|
|
349
|
+
|
|
350
|
+
Print the current repository log.
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
--log
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Print the current working tree status.
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
--status
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Inspect the repo and create CI/CD workflow files.
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
--pipeline
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Quick Actions:
|
|
369
|
+
|
|
370
|
+
Persist provider, model, and API key settings.
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
config
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Stage one or more files.
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
add
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Unstage one or more files.
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
remove
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Hard reset the repository to HEAD.
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
remove hard
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Delete one or more files from the working tree.
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
del
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Soft reset `HEAD~1` and keep your changes.
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
bin
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
Pop a stash entry.
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
pop
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Run `git pull`.
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
pull
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Run `git push`.
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
push
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Install the `gitxplain` hook.
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
install-hook
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Pass through to native Git commands.
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
git
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Output:
|
|
437
|
+
|
|
438
|
+
Override the configured provider for one command.
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
--provider <name>
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
Override the configured model for one command.
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
--model <name>
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Return JSON output.
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
--json
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
Return Markdown output.
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
--markdown
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Return HTML output.
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
--html
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Reduce extra console output.
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
--quiet
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
Show extra response metadata.
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
--verbose
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Copy the final output to the clipboard.
|
|
481
|
+
|
|
482
|
+
```bash
|
|
483
|
+
--clipboard
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
Stream model output as it arrives.
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
--stream
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
Bypass cached responses for one command.
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
--no-cache
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
Show cumulative token usage and estimated cost totals.
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
--cost
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Limit diff size before sending it to the model.
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
--max-diff-lines <n>
|
|
146
508
|
```
|
|
147
509
|
|
|
148
510
|
## Running The CLI
|
|
@@ -150,46 +512,37 @@ npm start -- HEAD --split --execute
|
|
|
150
512
|
To use the actual `gitxplain` command directly:
|
|
151
513
|
|
|
152
514
|
```bash
|
|
153
|
-
cd /home/guru/Dev/gitxplain
|
|
154
515
|
npm link
|
|
155
516
|
```
|
|
156
517
|
|
|
518
|
+
Run that from the repository root. `npm link` works on Windows, macOS, and Linux, though it may require elevated privileges depending on your Node/npm install prefix.
|
|
519
|
+
|
|
157
520
|
Then from any Git repository:
|
|
158
521
|
|
|
159
522
|
```bash
|
|
160
|
-
gitxplain help
|
|
161
|
-
gitxplain --connect-github <token>
|
|
162
|
-
gitxplain --boot
|
|
523
|
+
gitxplain --help
|
|
163
524
|
gitxplain HEAD~1 --full
|
|
164
525
|
gitxplain a1b2c3d --summary
|
|
165
526
|
gitxplain HEAD~1 --lines
|
|
166
527
|
gitxplain HEAD~5..HEAD --markdown
|
|
167
528
|
gitxplain --branch main --review
|
|
529
|
+
gitxplain --branch main --pr-description
|
|
530
|
+
gitxplain HEAD~10..HEAD --changelog
|
|
531
|
+
gitxplain HEAD --refactor
|
|
532
|
+
gitxplain HEAD --test-suggest
|
|
533
|
+
gitxplain --blame cli/index.js
|
|
534
|
+
gitxplain --conflict
|
|
535
|
+
gitxplain --stash
|
|
536
|
+
gitxplain HEAD~5..HEAD --lines --diff cli/index.js
|
|
537
|
+
gitxplain --cost
|
|
538
|
+
gitxplain HEAD --split --interactive --execute
|
|
539
|
+
gitxplain install-hook post-merge
|
|
168
540
|
```
|
|
169
541
|
|
|
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
|
-
|
|
180
|
-
The `gitxplain help` command also prints quick API-key setup examples for:
|
|
181
|
-
|
|
182
|
-
- OpenAI
|
|
183
|
-
- Groq
|
|
184
|
-
- OpenRouter
|
|
185
|
-
- Gemini
|
|
186
|
-
- Ollama
|
|
187
|
-
- Chutes AI
|
|
188
|
-
|
|
189
542
|
If you do not want to link it globally, you can still run it locally:
|
|
190
543
|
|
|
191
544
|
```bash
|
|
192
|
-
node
|
|
545
|
+
node ./cli/index.js HEAD~1 --full
|
|
193
546
|
```
|
|
194
547
|
|
|
195
548
|
## Output Modes
|
|
@@ -202,39 +555,49 @@ node /home/guru/Dev/gitxplain/cli/index.js HEAD~1 --full
|
|
|
202
555
|
- `--lines`: file-by-file, line-by-line walkthrough of the changed code
|
|
203
556
|
- `--review`: code review findings with actionable suggestions
|
|
204
557
|
- `--security`: security-focused analysis of the change
|
|
558
|
+
- `--refactor`: suggest maintainability-focused refactors visible in the change
|
|
559
|
+
- `--test-suggest`: suggest the most valuable tests to add or update
|
|
560
|
+
- `--pr-description`: draft a ready-to-paste pull request description
|
|
561
|
+
- `--changelog`: generate changelog-style release notes from the change set
|
|
562
|
+
- `--blame <file>`: summarize ownership and change history for one file using `git blame`
|
|
563
|
+
- `--conflict`: inspect unresolved merge conflicts and suggest likely resolutions
|
|
564
|
+
- `--stash [ref]`: explain what is stored in a stash entry, defaulting to `stash@{0}`
|
|
565
|
+
- `--diff <file>`: focus commit or range analysis on a single file
|
|
205
566
|
- `--split`: propose how to split a commit into multiple atomic commits
|
|
567
|
+
- `--interactive`: review or edit a split plan before executing it
|
|
568
|
+
- `--cost`: show cumulative token usage and estimated cost totals
|
|
206
569
|
- `--merge`: preview or execute a merge into the `release` branch based on detected version bumps
|
|
207
570
|
- `--tag`: preview or create release tags from the same detected version windows
|
|
208
|
-
-
|
|
571
|
+
- `--release [status]`: inspect release branch health, missing tags, source-vs-release drift, and the next recommended action
|
|
209
572
|
- `--commit`: propose commits for current uncommitted changes
|
|
210
573
|
- `--log`: print Git log entries for the current repository
|
|
211
574
|
- `--status`: print Git working tree status for the current repository
|
|
212
|
-
-
|
|
575
|
+
- `--pipeline`: inspect the current repository and generate GitHub Actions, GitLab CI, CircleCI, or Bitbucket Pipelines config
|
|
213
576
|
- `--execute`: apply a proposed split by rewriting history
|
|
214
577
|
- `--dry-run`: preview the split or commit plan without applying it
|
|
215
578
|
- `--json`: return structured JSON instead of formatted text
|
|
216
579
|
- `--markdown`: return Markdown output
|
|
217
580
|
- `--html`: return HTML output
|
|
218
581
|
|
|
219
|
-
If no analysis flag is supplied, the CLI asks what kind of explanation you want.
|
|
220
|
-
|
|
221
582
|
## Repository Log
|
|
222
583
|
|
|
223
584
|
Print recent log entries from the current repository:
|
|
224
585
|
|
|
225
586
|
```bash
|
|
226
|
-
gitxplain log
|
|
227
587
|
gitxplain --log
|
|
228
588
|
```
|
|
229
589
|
|
|
230
|
-
|
|
590
|
+
This prints the repository history in a compact one-line format using the current repository, without calling the LLM.
|
|
231
591
|
|
|
232
592
|
## Quick Actions
|
|
233
593
|
|
|
234
594
|
Run a few common Git actions directly through `gitxplain`:
|
|
235
595
|
|
|
236
596
|
```bash
|
|
237
|
-
gitxplain status
|
|
597
|
+
gitxplain --status
|
|
598
|
+
gitxplain cache stats
|
|
599
|
+
gitxplain cache clear
|
|
600
|
+
gitxplain --cost
|
|
238
601
|
gitxplain add README.md
|
|
239
602
|
gitxplain remove README.md
|
|
240
603
|
gitxplain remove hard
|
|
@@ -302,13 +665,19 @@ Actually split the current `HEAD` commit into smaller commits:
|
|
|
302
665
|
gitxplain HEAD --split --execute
|
|
303
666
|
```
|
|
304
667
|
|
|
668
|
+
Review the plan interactively before executing it:
|
|
669
|
+
|
|
670
|
+
```bash
|
|
671
|
+
gitxplain HEAD --split --interactive --execute
|
|
672
|
+
```
|
|
673
|
+
|
|
305
674
|
Use a specific provider for the analysis:
|
|
306
675
|
|
|
307
676
|
```bash
|
|
308
677
|
gitxplain HEAD --split --provider gemini
|
|
309
678
|
```
|
|
310
679
|
|
|
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.
|
|
680
|
+
`--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. Adding `--interactive` lets you keep, edit, skip, or abort individual split groups before the rewrite happens.
|
|
312
681
|
|
|
313
682
|
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
683
|
|
|
@@ -317,7 +686,6 @@ Warning: `--split --execute` rewrites history. If the commit was already pushed,
|
|
|
317
686
|
Preview the release merge plan for the current branch:
|
|
318
687
|
|
|
319
688
|
```bash
|
|
320
|
-
gitxplain merge
|
|
321
689
|
gitxplain --merge
|
|
322
690
|
```
|
|
323
691
|
|
|
@@ -334,9 +702,7 @@ This command scans commits on your current branch after the branch split point a
|
|
|
334
702
|
Preview the release tags for the current branch:
|
|
335
703
|
|
|
336
704
|
```bash
|
|
337
|
-
gitxplain tag
|
|
338
705
|
gitxplain --tag
|
|
339
|
-
gitxplore tag
|
|
340
706
|
gitxplore --tag
|
|
341
707
|
```
|
|
342
708
|
|
|
@@ -347,14 +713,13 @@ gitxplain --tag --execute
|
|
|
347
713
|
gitxplore --tag --execute
|
|
348
714
|
```
|
|
349
715
|
|
|
350
|
-
This command
|
|
716
|
+
This command scans the full history of your current branch, detects version bumps from version-file diffs, and maps each untagged detected version to the last commit in that version window. It works independently from the `merge` workflow and does not require a `release` branch. By default it creates annotated tags named exactly after the detected version, such as `1.2.3`.
|
|
351
717
|
|
|
352
718
|
## Commit Working Tree
|
|
353
719
|
|
|
354
720
|
Preview how the current uncommitted changes should be committed:
|
|
355
721
|
|
|
356
722
|
```bash
|
|
357
|
-
gitxplain commit
|
|
358
723
|
gitxplain --commit
|
|
359
724
|
```
|
|
360
725
|
|
|
@@ -390,7 +755,16 @@ Example `.gitxplainrc`:
|
|
|
390
755
|
|
|
391
756
|
CLI flags still override config values for a single command.
|
|
392
757
|
|
|
393
|
-
|
|
758
|
+
You can also save provider settings permanently with the CLI:
|
|
759
|
+
|
|
760
|
+
```bash
|
|
761
|
+
gitxplain config set provider openai
|
|
762
|
+
gitxplain config set api-key your_key
|
|
763
|
+
gitxplain config set model gpt-4.1-mini
|
|
764
|
+
gitxplain config list
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
## Clipboard, Streaming, Cost, And Hooks
|
|
394
768
|
|
|
395
769
|
Copy the final output to your clipboard:
|
|
396
770
|
|
|
@@ -404,57 +778,96 @@ Stream long responses as they arrive:
|
|
|
404
778
|
gitxplain HEAD~1 --full --stream
|
|
405
779
|
```
|
|
406
780
|
|
|
781
|
+
Show cumulative usage and estimated cost totals:
|
|
782
|
+
|
|
783
|
+
```bash
|
|
784
|
+
gitxplain --cost
|
|
785
|
+
```
|
|
786
|
+
|
|
407
787
|
Install a post-commit hook that saves a Markdown explanation under `.git/gitxplain/last-explanation.md`:
|
|
408
788
|
|
|
409
789
|
```bash
|
|
410
790
|
gitxplain install-hook
|
|
411
791
|
```
|
|
412
792
|
|
|
793
|
+
Install a post-merge hook that explains the new `HEAD` after merges:
|
|
794
|
+
|
|
795
|
+
```bash
|
|
796
|
+
gitxplain install-hook post-merge
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
Install a pre-push hook that runs a security-oriented review:
|
|
800
|
+
|
|
801
|
+
```bash
|
|
802
|
+
gitxplain install-hook pre-push
|
|
803
|
+
```
|
|
804
|
+
|
|
413
805
|
## Provider Setup
|
|
414
806
|
|
|
415
|
-
|
|
807
|
+
Recommended persistent setup:
|
|
416
808
|
|
|
417
809
|
```bash
|
|
418
|
-
|
|
419
|
-
|
|
810
|
+
gitxplain config set provider openai
|
|
811
|
+
gitxplain config set api-key your_key
|
|
420
812
|
```
|
|
421
813
|
|
|
422
|
-
|
|
814
|
+
You can also save a default model:
|
|
423
815
|
|
|
424
816
|
```bash
|
|
425
|
-
|
|
426
|
-
export GROQ_API_KEY=your_key
|
|
817
|
+
gitxplain config set model gpt-4.1-mini
|
|
427
818
|
```
|
|
428
819
|
|
|
429
|
-
|
|
820
|
+
You can switch providers later:
|
|
430
821
|
|
|
431
822
|
```bash
|
|
432
|
-
|
|
433
|
-
|
|
823
|
+
gitxplain config set provider groq
|
|
824
|
+
gitxplain config set api-key your_key
|
|
434
825
|
```
|
|
435
826
|
|
|
436
|
-
|
|
827
|
+
Additional supported providers:
|
|
437
828
|
|
|
438
829
|
```bash
|
|
439
|
-
|
|
440
|
-
|
|
830
|
+
gitxplain config set provider anthropic
|
|
831
|
+
gitxplain config set api-key your_key
|
|
832
|
+
|
|
833
|
+
gitxplain config set provider mistral
|
|
834
|
+
gitxplain config set api-key your_key
|
|
835
|
+
|
|
836
|
+
gitxplain config set provider azure-openai
|
|
837
|
+
gitxplain config set api-key your_key
|
|
441
838
|
```
|
|
442
839
|
|
|
443
|
-
|
|
840
|
+
Azure OpenAI also requires endpoint configuration:
|
|
444
841
|
|
|
445
842
|
```bash
|
|
446
|
-
export
|
|
447
|
-
export
|
|
843
|
+
export AZURE_OPENAI_BASE_URL="https://your-resource.openai.azure.com"
|
|
844
|
+
export AZURE_OPENAI_DEPLOYMENT="your-deployment-name"
|
|
845
|
+
export AZURE_OPENAI_API_VERSION="2024-10-21"
|
|
448
846
|
```
|
|
449
847
|
|
|
450
|
-
|
|
848
|
+
Optional token pricing env vars for estimated cost tracking:
|
|
451
849
|
|
|
452
850
|
```bash
|
|
453
|
-
export
|
|
454
|
-
export
|
|
455
|
-
export CHUTES_MODEL=deepseek-ai/DeepSeek-V3-0324
|
|
851
|
+
export OPENAI_INPUT_COST_PER_MTOK="0.15"
|
|
852
|
+
export OPENAI_OUTPUT_COST_PER_MTOK="0.60"
|
|
456
853
|
```
|
|
457
854
|
|
|
855
|
+
Or use generic pricing defaults across providers:
|
|
856
|
+
|
|
857
|
+
```bash
|
|
858
|
+
export LLM_INPUT_COST_PER_MTOK="0.15"
|
|
859
|
+
export LLM_OUTPUT_COST_PER_MTOK="0.60"
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
If you want to inspect what is saved:
|
|
863
|
+
|
|
864
|
+
```bash
|
|
865
|
+
gitxplain config list
|
|
866
|
+
gitxplain config get provider
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
Saved user settings live in `~/.gitxplain/config.json` on macOS/Linux, or `%USERPROFILE%\.gitxplain\config.json` on Windows.
|
|
870
|
+
|
|
458
871
|
## Development
|
|
459
872
|
|
|
460
873
|
```bash
|
|
@@ -467,3 +880,5 @@ To make the command globally available during local development:
|
|
|
467
880
|
```bash
|
|
468
881
|
npm link
|
|
469
882
|
```
|
|
883
|
+
|
|
884
|
+
Run this from the repository root. On some systems, you may need an elevated shell depending on where npm installs global links.
|