gitxplain 0.1.3 → 0.1.8

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
@@ -18,8 +18,10 @@ Supported providers:
18
18
  - Supports AI-assisted commit splitting plans, with optional execution for the latest commit
19
19
  - Supports release-branch merge previews driven by detected version bumps in diffs
20
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
21
22
  - Supports AI-assisted commit planning for uncommitted working tree changes
22
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
23
25
  - Supports single commits, commit ranges, and branch-vs-base comparisons
24
26
  - Truncates oversized diffs before sending them to the model and reports that truncation
25
27
  - Streams output for supported providers
@@ -27,7 +29,6 @@ Supported providers:
27
29
  - Supports plain, JSON, Markdown, and HTML output
28
30
  - Supports clipboard copy, verbosity controls, and hook installation
29
31
  - Supports project-level and user-level config files
30
- - Falls back to an interactive prompt when no analysis flag is supplied
31
32
  - Returns plain text or JSON output
32
33
  - Uses native Node APIs only, so the MVP has no runtime dependencies
33
34
 
@@ -37,7 +38,7 @@ Supported providers:
37
38
  - A Git repository in your current working directory
38
39
  - An API key for your chosen provider, or a local Ollama instance
39
40
 
40
- Optional environment variables:
41
+ Optional advanced environment variables:
41
42
 
42
43
  - `LLM_PROVIDER` default: `openai`
43
44
  - `LLM_MODEL` optional shared model override
@@ -53,7 +54,7 @@ Optional environment variables:
53
54
  Optional config files:
54
55
 
55
56
  - Project: `.gitxplainrc` or `.gitxplainrc.json`
56
- - User: `~/.gitxplain/config.json`
57
+ - User: `~/.gitxplain/config.json` on macOS/Linux, or `%USERPROFILE%\.gitxplain\config.json` on Windows
57
58
 
58
59
  You can start from:
59
60
 
@@ -63,74 +64,344 @@ cp .env.example .env
63
64
 
64
65
  ## Usage
65
66
 
67
+ Show the built-in command reference.
68
+
69
+ ```bash
70
+ gitxplain --help
71
+ ```
72
+
73
+ Save the default AI provider.
74
+
75
+ ```bash
76
+ gitxplain config set provider <name>
77
+ ```
78
+
79
+ Save the API key for a provider.
80
+
81
+ ```bash
82
+ gitxplain config set api-key <value> [--provider <name>]
83
+ ```
84
+
85
+ Print one saved config value, or all of them.
86
+
87
+ ```bash
88
+ gitxplain config get [key]
89
+ ```
90
+
91
+ List saved user config values.
92
+
93
+ ```bash
94
+ gitxplain config list
95
+ ```
96
+
97
+ Analyze a single commit.
98
+
99
+ ```bash
100
+ gitxplain <commit-id> [options]
101
+ ```
102
+
103
+ Analyze a commit range.
104
+
105
+ ```bash
106
+ gitxplain <start>..<end> [options]
107
+ ```
108
+
109
+ Compare the current branch to a base branch.
110
+
111
+ ```bash
112
+ gitxplain --branch [base-ref] [options]
113
+ ```
114
+
115
+ Compare the current branch like a PR.
116
+
117
+ ```bash
118
+ gitxplain --pr [base-ref] [options]
119
+ ```
120
+
121
+ Plan commits for uncommitted working tree changes.
122
+
66
123
  ```bash
67
- gitxplain help
68
- gitxplain commit
69
124
  gitxplain --commit
70
- gitxplain merge
125
+ ```
126
+
127
+ Show release branch health and next steps.
128
+
129
+ ```bash
130
+ gitxplain --release [status]
131
+ ```
132
+
133
+ Preview or execute a release merge.
134
+
135
+ ```bash
71
136
  gitxplain --merge
72
- gitxplain tag
137
+ ```
138
+
139
+ Preview or create release tags.
140
+
141
+ ```bash
73
142
  gitxplain --tag
74
- gitxplore tag
75
- gitxplore --tag
76
- gitxplain log --log
77
- gitxplain status
143
+ ```
144
+
145
+ Print repository log output.
146
+
147
+ ```bash
148
+ gitxplain --log
149
+ ```
150
+
151
+ Print repository status output.
152
+
153
+ ```bash
78
154
  gitxplain --status
79
- gitxplain add README.md
80
- gitxplain remove README.md
81
- gitxplain del scratch.txt
82
- gitxplain pop
83
- gitxplain pop 2
84
- gitxplain push
85
- gitxplain push origin main
86
- gitxplain <commit-id>
87
- gitxplain <commit-id> --summary
88
- gitxplain <commit-id> --issues
89
- gitxplain <commit-id> --fix
90
- gitxplain <commit-id> --impact
91
- gitxplain <commit-id> --full
92
- gitxplain <commit-id> --lines
93
- gitxplain <commit-id> --review
94
- gitxplain <commit-id> --security
95
- gitxplain <commit-id> --split
96
- gitxplain --commit --execute
97
- gitxplain merge
98
- gitxplain --merge --execute
99
- gitxplain tag
100
- gitxplain --tag --execute
101
- gitxplain <commit-id> --json
102
- gitxplain <commit-id> --markdown
103
- gitxplain <commit-id> --html
104
- gitxplain <commit-id> --stream
105
- gitxplain <commit-id> --clipboard
106
- gitxplain <commit-id> --verbose
107
- gitxplain <commit-id> --quiet
108
- gitxplain log --log
109
- gitxplain <start>..<end> --markdown
110
- gitxplain --branch main --review
111
- gitxplain --pr origin/main --security
112
- gitxplain install-hook
113
- gitxplain <commit-id> --provider openrouter --model anthropic/claude-3.7-sonnet
114
- gitxplain <commit-id> --provider chutes --model deepseek-ai/DeepSeek-V3-0324
115
- gitxplain <commit-id> --split --execute
116
155
  ```
117
156
 
118
- Examples:
157
+ Detect and generate CI/CD workflow files.
158
+
159
+ ```bash
160
+ gitxplain --pipeline
161
+ ```
162
+
163
+ Analysis:
164
+
165
+ Generate a one-line summary.
166
+
167
+ ```bash
168
+ --summary
169
+ ```
170
+
171
+ Focus on the issue being fixed.
172
+
173
+ ```bash
174
+ --issues
175
+ ```
176
+
177
+ Explain the fix in simple terms.
178
+
179
+ ```bash
180
+ --fix
181
+ ```
182
+
183
+ Explain behavior changes before vs after.
184
+
185
+ ```bash
186
+ --impact
187
+ ```
188
+
189
+ Generate the full structured analysis.
190
+
191
+ ```bash
192
+ --full
193
+ ```
194
+
195
+ Walk through the changed code file by file.
196
+
197
+ ```bash
198
+ --lines
199
+ ```
200
+
201
+ Generate review findings and risks.
202
+
203
+ ```bash
204
+ --review
205
+ ```
206
+
207
+ Focus on security-relevant changes.
208
+
209
+ ```bash
210
+ --security
211
+ ```
212
+
213
+ Propose splitting a commit into smaller commits.
214
+
215
+ ```bash
216
+ --split
217
+ ```
218
+
219
+ Propose commits for current working tree changes.
220
+
221
+ ```bash
222
+ --commit
223
+ ```
224
+
225
+ Apply a split, commit, merge, or tag plan.
226
+
227
+ ```bash
228
+ --execute
229
+ ```
230
+
231
+ Preview a plan without applying it.
232
+
233
+ ```bash
234
+ --dry-run
235
+ ```
236
+
237
+ Release:
238
+
239
+ Show release status details.
240
+
241
+ ```bash
242
+ --release [status]
243
+ ```
244
+
245
+ Preview or apply a merge into the release branch.
246
+
247
+ ```bash
248
+ --merge
249
+ ```
250
+
251
+ Preview or create release tags from version bumps.
252
+
253
+ ```bash
254
+ --tag
255
+ ```
256
+
257
+ Repo:
258
+
259
+ Print the current repository log.
260
+
261
+ ```bash
262
+ --log
263
+ ```
264
+
265
+ Print the current working tree status.
266
+
267
+ ```bash
268
+ --status
269
+ ```
270
+
271
+ Inspect the repo and create CI/CD workflow files.
272
+
273
+ ```bash
274
+ --pipeline
275
+ ```
276
+
277
+ Quick Actions:
278
+
279
+ Persist provider, model, and API key settings.
280
+
281
+ ```bash
282
+ config
283
+ ```
284
+
285
+ Stage one or more files.
286
+
287
+ ```bash
288
+ add
289
+ ```
290
+
291
+ Unstage one or more files.
292
+
293
+ ```bash
294
+ remove
295
+ ```
296
+
297
+ Hard reset the repository to HEAD.
298
+
299
+ ```bash
300
+ remove hard
301
+ ```
302
+
303
+ Delete one or more files from the working tree.
304
+
305
+ ```bash
306
+ del
307
+ ```
308
+
309
+ Soft reset `HEAD~1` and keep your changes.
310
+
311
+ ```bash
312
+ bin
313
+ ```
314
+
315
+ Pop a stash entry.
316
+
317
+ ```bash
318
+ pop
319
+ ```
320
+
321
+ Run `git pull`.
322
+
323
+ ```bash
324
+ pull
325
+ ```
326
+
327
+ Run `git push`.
328
+
329
+ ```bash
330
+ push
331
+ ```
332
+
333
+ Install the `gitxplain` hook.
334
+
335
+ ```bash
336
+ install-hook
337
+ ```
338
+
339
+ Pass through to native Git commands.
340
+
341
+ ```bash
342
+ git
343
+ ```
344
+
345
+ Output:
346
+
347
+ Override the configured provider for one command.
348
+
349
+ ```bash
350
+ --provider <name>
351
+ ```
352
+
353
+ Override the configured model for one command.
354
+
355
+ ```bash
356
+ --model <name>
357
+ ```
358
+
359
+ Return JSON output.
360
+
361
+ ```bash
362
+ --json
363
+ ```
364
+
365
+ Return Markdown output.
366
+
367
+ ```bash
368
+ --markdown
369
+ ```
370
+
371
+ Return HTML output.
372
+
373
+ ```bash
374
+ --html
375
+ ```
376
+
377
+ Reduce extra console output.
378
+
379
+ ```bash
380
+ --quiet
381
+ ```
382
+
383
+ Show extra response metadata.
384
+
385
+ ```bash
386
+ --verbose
387
+ ```
388
+
389
+ Copy the final output to the clipboard.
390
+
391
+ ```bash
392
+ --clipboard
393
+ ```
394
+
395
+ Stream model output as it arrives.
396
+
397
+ ```bash
398
+ --stream
399
+ ```
400
+
401
+ Limit diff size before sending it to the model.
119
402
 
120
403
  ```bash
121
- npm start -- HEAD~1 --summary
122
- npm start -- commit
123
- npm start -- merge
124
- npm start -- tag
125
- npm start -- log --log
126
- npm start -- a1b2c3d --full
127
- npm start -- HEAD~1 --lines
128
- npm start -- HEAD~5..HEAD --markdown
129
- npm start -- --branch main --review
130
- npm start -- HEAD~1 --provider groq --model llama-3.3-70b-versatile
131
- npm start -- HEAD~1 --provider gemini --model gemini-2.5-flash
132
- npm start -- HEAD~1 --provider chutes --model deepseek-ai/DeepSeek-V3-0324
133
- npm start -- HEAD --split --execute
404
+ --max-diff-lines <n>
134
405
  ```
135
406
 
136
407
  ## Running The CLI
@@ -138,14 +409,15 @@ npm start -- HEAD --split --execute
138
409
  To use the actual `gitxplain` command directly:
139
410
 
140
411
  ```bash
141
- cd /home/guru/Dev/gitxplain
142
412
  npm link
143
413
  ```
144
414
 
415
+ 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.
416
+
145
417
  Then from any Git repository:
146
418
 
147
419
  ```bash
148
- gitxplain help
420
+ gitxplain --help
149
421
  gitxplain HEAD~1 --full
150
422
  gitxplain a1b2c3d --summary
151
423
  gitxplain HEAD~1 --lines
@@ -153,19 +425,10 @@ gitxplain HEAD~5..HEAD --markdown
153
425
  gitxplain --branch main --review
154
426
  ```
155
427
 
156
- The `gitxplain help` command also prints quick API-key setup examples for:
157
-
158
- - OpenAI
159
- - Groq
160
- - OpenRouter
161
- - Gemini
162
- - Ollama
163
- - Chutes AI
164
-
165
428
  If you do not want to link it globally, you can still run it locally:
166
429
 
167
430
  ```bash
168
- node /home/guru/Dev/gitxplain/cli/index.js HEAD~1 --full
431
+ node ./cli/index.js HEAD~1 --full
169
432
  ```
170
433
 
171
434
  ## Output Modes
@@ -181,43 +444,63 @@ node /home/guru/Dev/gitxplain/cli/index.js HEAD~1 --full
181
444
  - `--split`: propose how to split a commit into multiple atomic commits
182
445
  - `--merge`: preview or execute a merge into the `release` branch based on detected version bumps
183
446
  - `--tag`: preview or create release tags from the same detected version windows
447
+ - `--release [status]`: inspect release branch health, missing tags, source-vs-release drift, and the next recommended action
184
448
  - `--commit`: propose commits for current uncommitted changes
185
449
  - `--log`: print Git log entries for the current repository
186
450
  - `--status`: print Git working tree status for the current repository
451
+ - `--pipeline`: inspect the current repository and generate GitHub Actions CI/CD workflows
187
452
  - `--execute`: apply a proposed split by rewriting history
188
453
  - `--dry-run`: preview the split or commit plan without applying it
189
454
  - `--json`: return structured JSON instead of formatted text
190
455
  - `--markdown`: return Markdown output
191
456
  - `--html`: return HTML output
192
457
 
193
- If no analysis flag is supplied, the CLI asks what kind of explanation you want.
194
-
195
458
  ## Repository Log
196
459
 
197
460
  Print recent log entries from the current repository:
198
461
 
199
462
  ```bash
200
- gitxplain log
201
463
  gitxplain --log
202
464
  ```
203
465
 
204
- Both forms print the repository history in a compact one-line format using the current repository, without calling the LLM.
466
+ This prints the repository history in a compact one-line format using the current repository, without calling the LLM.
205
467
 
206
468
  ## Quick Actions
207
469
 
208
470
  Run a few common Git actions directly through `gitxplain`:
209
471
 
210
472
  ```bash
211
- gitxplain status
473
+ gitxplain --status
212
474
  gitxplain add README.md
213
475
  gitxplain remove README.md
476
+ gitxplain remove hard
214
477
  gitxplain del scratch.txt
478
+ gitxplain bin
215
479
  gitxplain pop
216
480
  gitxplain pop 2
481
+ gitxplain pull
482
+ gitxplain pull origin main
217
483
  gitxplain push
218
484
  gitxplain push origin main
219
485
  ```
220
486
 
487
+ For native Git commands that do not have a custom `gitxplain` workflow, use them directly:
488
+
489
+ ```bash
490
+ gitxplain branch -a
491
+ gitxplain checkout -b feature/demo
492
+ gitxplain rebase origin/main
493
+ gitxplain worktree list
494
+ ```
495
+
496
+ If you want to force native Git for a reserved custom command name, use the `git` wrapper:
497
+
498
+ ```bash
499
+ gitxplain git commit -m "native commit message"
500
+ gitxplain git merge feature/demo
501
+ gitxplain git tag -a v1.2.3 -m "release"
502
+ ```
503
+
221
504
  ## Comparison Modes
222
505
 
223
506
  Single commit:
@@ -270,7 +553,6 @@ Warning: `--split --execute` rewrites history. If the commit was already pushed,
270
553
  Preview the release merge plan for the current branch:
271
554
 
272
555
  ```bash
273
- gitxplain merge
274
556
  gitxplain --merge
275
557
  ```
276
558
 
@@ -287,9 +569,7 @@ This command scans commits on your current branch after the branch split point a
287
569
  Preview the release tags for the current branch:
288
570
 
289
571
  ```bash
290
- gitxplain tag
291
572
  gitxplain --tag
292
- gitxplore tag
293
573
  gitxplore --tag
294
574
  ```
295
575
 
@@ -300,14 +580,13 @@ gitxplain --tag --execute
300
580
  gitxplore --tag --execute
301
581
  ```
302
582
 
303
- 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`.
583
+ 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`.
304
584
 
305
585
  ## Commit Working Tree
306
586
 
307
587
  Preview how the current uncommitted changes should be committed:
308
588
 
309
589
  ```bash
310
- gitxplain commit
311
590
  gitxplain --commit
312
591
  ```
313
592
 
@@ -343,6 +622,15 @@ Example `.gitxplainrc`:
343
622
 
344
623
  CLI flags still override config values for a single command.
345
624
 
625
+ You can also save provider settings permanently with the CLI:
626
+
627
+ ```bash
628
+ gitxplain config set provider openai
629
+ gitxplain config set api-key your_key
630
+ gitxplain config set model gpt-4.1-mini
631
+ gitxplain config list
632
+ ```
633
+
346
634
  ## Clipboard, Streaming, And Hooks
347
635
 
348
636
  Copy the final output to your clipboard:
@@ -365,48 +653,34 @@ gitxplain install-hook
365
653
 
366
654
  ## Provider Setup
367
655
 
368
- OpenAI:
656
+ Recommended persistent setup:
369
657
 
370
658
  ```bash
371
- export LLM_PROVIDER=openai
372
- export OPENAI_API_KEY=your_key
659
+ gitxplain config set provider openai
660
+ gitxplain config set api-key your_key
373
661
  ```
374
662
 
375
- Groq:
663
+ You can also save a default model:
376
664
 
377
665
  ```bash
378
- export LLM_PROVIDER=groq
379
- export GROQ_API_KEY=your_key
666
+ gitxplain config set model gpt-4.1-mini
380
667
  ```
381
668
 
382
- OpenRouter:
669
+ You can switch providers later:
383
670
 
384
671
  ```bash
385
- export LLM_PROVIDER=openrouter
386
- export OPENROUTER_API_KEY=your_key
672
+ gitxplain config set provider groq
673
+ gitxplain config set api-key your_key
387
674
  ```
388
675
 
389
- Gemini:
676
+ If you want to inspect what is saved:
390
677
 
391
678
  ```bash
392
- export LLM_PROVIDER=gemini
393
- export GEMINI_API_KEY=your_key
679
+ gitxplain config list
680
+ gitxplain config get provider
394
681
  ```
395
682
 
396
- Ollama:
397
-
398
- ```bash
399
- export LLM_PROVIDER=ollama
400
- export OLLAMA_MODEL=llama3.2
401
- ```
402
-
403
- Chutes AI:
404
-
405
- ```bash
406
- export LLM_PROVIDER=chutes
407
- export CHUTES_API_KEY=your_key
408
- export CHUTES_MODEL=deepseek-ai/DeepSeek-V3-0324
409
- ```
683
+ Saved user settings live in `~/.gitxplain/config.json` on macOS/Linux, or `%USERPROFILE%\.gitxplain\config.json` on Windows.
410
684
 
411
685
  ## Development
412
686
 
@@ -420,3 +694,5 @@ To make the command globally available during local development:
420
694
  ```bash
421
695
  npm link
422
696
  ```
697
+
698
+ Run this from the repository root. On some systems, you may need an elevated shell depending on where npm installs global links.