gitxplain 0.1.8 → 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/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 the repo you are currently in
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
@@ -70,6 +78,19 @@ Show the built-in command reference.
70
78
  gitxplain --help
71
79
  ```
72
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
+
73
94
  Save the default AI provider.
74
95
 
75
96
  ```bash
@@ -142,6 +163,13 @@ Preview or create release tags.
142
163
  gitxplain --tag
143
164
  ```
144
165
 
166
+ Explain the latest stash, or a specific stash entry.
167
+
168
+ ```bash
169
+ gitxplain --stash
170
+ gitxplain --stash stash@{2}
171
+ ```
172
+
145
173
  Print repository log output.
146
174
 
147
175
  ```bash
@@ -160,6 +188,21 @@ Detect and generate CI/CD workflow files.
160
188
  gitxplain --pipeline
161
189
  ```
162
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
201
+ gitxplain install-hook
202
+ gitxplain install-hook post-merge
203
+ gitxplain install-hook pre-push
204
+ ```
205
+
163
206
  Analysis:
164
207
 
165
208
  Generate a one-line summary.
@@ -210,6 +253,48 @@ Focus on security-relevant changes.
210
253
  --security
211
254
  ```
212
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
272
+ ```
273
+
274
+ Generate changelog-style notes.
275
+
276
+ ```bash
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
+
213
298
  Propose splitting a commit into smaller commits.
214
299
 
215
300
  ```bash
@@ -234,6 +319,12 @@ Preview a plan without applying it.
234
319
  --dry-run
235
320
  ```
236
321
 
322
+ Review or edit a split plan before execution.
323
+
324
+ ```bash
325
+ --interactive
326
+ ```
327
+
237
328
  Release:
238
329
 
239
330
  Show release status details.
@@ -398,6 +489,18 @@ Stream model output as it arrives.
398
489
  --stream
399
490
  ```
400
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
+
401
504
  Limit diff size before sending it to the model.
402
505
 
403
506
  ```bash
@@ -423,6 +526,17 @@ gitxplain a1b2c3d --summary
423
526
  gitxplain HEAD~1 --lines
424
527
  gitxplain HEAD~5..HEAD --markdown
425
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
426
540
  ```
427
541
 
428
542
  If you do not want to link it globally, you can still run it locally:
@@ -441,14 +555,24 @@ node ./cli/index.js HEAD~1 --full
441
555
  - `--lines`: file-by-file, line-by-line walkthrough of the changed code
442
556
  - `--review`: code review findings with actionable suggestions
443
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
444
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
445
569
  - `--merge`: preview or execute a merge into the `release` branch based on detected version bumps
446
570
  - `--tag`: preview or create release tags from the same detected version windows
447
571
  - `--release [status]`: inspect release branch health, missing tags, source-vs-release drift, and the next recommended action
448
572
  - `--commit`: propose commits for current uncommitted changes
449
573
  - `--log`: print Git log entries for the current repository
450
574
  - `--status`: print Git working tree status for the current repository
451
- - `--pipeline`: inspect the current repository and generate GitHub Actions CI/CD workflows
575
+ - `--pipeline`: inspect the current repository and generate GitHub Actions, GitLab CI, CircleCI, or Bitbucket Pipelines config
452
576
  - `--execute`: apply a proposed split by rewriting history
453
577
  - `--dry-run`: preview the split or commit plan without applying it
454
578
  - `--json`: return structured JSON instead of formatted text
@@ -471,6 +595,9 @@ Run a few common Git actions directly through `gitxplain`:
471
595
 
472
596
  ```bash
473
597
  gitxplain --status
598
+ gitxplain cache stats
599
+ gitxplain cache clear
600
+ gitxplain --cost
474
601
  gitxplain add README.md
475
602
  gitxplain remove README.md
476
603
  gitxplain remove hard
@@ -538,13 +665,19 @@ Actually split the current `HEAD` commit into smaller commits:
538
665
  gitxplain HEAD --split --execute
539
666
  ```
540
667
 
668
+ Review the plan interactively before executing it:
669
+
670
+ ```bash
671
+ gitxplain HEAD --split --interactive --execute
672
+ ```
673
+
541
674
  Use a specific provider for the analysis:
542
675
 
543
676
  ```bash
544
677
  gitxplain HEAD --split --provider gemini
545
678
  ```
546
679
 
547
- `--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.
548
681
 
549
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.
550
683
 
@@ -631,7 +764,7 @@ gitxplain config set model gpt-4.1-mini
631
764
  gitxplain config list
632
765
  ```
633
766
 
634
- ## Clipboard, Streaming, And Hooks
767
+ ## Clipboard, Streaming, Cost, And Hooks
635
768
 
636
769
  Copy the final output to your clipboard:
637
770
 
@@ -645,12 +778,30 @@ Stream long responses as they arrive:
645
778
  gitxplain HEAD~1 --full --stream
646
779
  ```
647
780
 
781
+ Show cumulative usage and estimated cost totals:
782
+
783
+ ```bash
784
+ gitxplain --cost
785
+ ```
786
+
648
787
  Install a post-commit hook that saves a Markdown explanation under `.git/gitxplain/last-explanation.md`:
649
788
 
650
789
  ```bash
651
790
  gitxplain install-hook
652
791
  ```
653
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
+
654
805
  ## Provider Setup
655
806
 
656
807
  Recommended persistent setup:
@@ -673,6 +824,41 @@ gitxplain config set provider groq
673
824
  gitxplain config set api-key your_key
674
825
  ```
675
826
 
827
+ Additional supported providers:
828
+
829
+ ```bash
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
838
+ ```
839
+
840
+ Azure OpenAI also requires endpoint configuration:
841
+
842
+ ```bash
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"
846
+ ```
847
+
848
+ Optional token pricing env vars for estimated cost tracking:
849
+
850
+ ```bash
851
+ export OPENAI_INPUT_COST_PER_MTOK="0.15"
852
+ export OPENAI_OUTPUT_COST_PER_MTOK="0.60"
853
+ ```
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
+
676
862
  If you want to inspect what is saved:
677
863
 
678
864
  ```bash