@g-abhishek/gitx 0.1.1 → 0.1.4
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 +374 -3
- package/dist/ai/claudeAi.d.ts +35 -0
- package/dist/ai/claudeAi.d.ts.map +1 -0
- package/dist/ai/claudeAi.js +396 -0
- package/dist/ai/claudeAi.js.map +1 -0
- package/dist/ai/claudeCliAi.d.ts +27 -0
- package/dist/ai/claudeCliAi.d.ts.map +1 -0
- package/dist/ai/claudeCliAi.js +312 -0
- package/dist/ai/claudeCliAi.js.map +1 -0
- package/dist/ai/localClaudeAi.d.ts +2 -0
- package/dist/ai/localClaudeAi.d.ts.map +1 -0
- package/dist/ai/localClaudeAi.js +4 -0
- package/dist/ai/localClaudeAi.js.map +1 -0
- package/dist/ai/mockAi.d.ts +8 -1
- package/dist/ai/mockAi.d.ts.map +1 -1
- package/dist/ai/mockAi.js +57 -0
- package/dist/ai/mockAi.js.map +1 -1
- package/dist/ai/openAiAi.d.ts +33 -0
- package/dist/ai/openAiAi.d.ts.map +1 -0
- package/dist/ai/openAiAi.js +388 -0
- package/dist/ai/openAiAi.js.map +1 -0
- package/dist/ai/reviewHelpers.d.ts +66 -0
- package/dist/ai/reviewHelpers.d.ts.map +1 -0
- package/dist/ai/reviewHelpers.js +559 -0
- package/dist/ai/reviewHelpers.js.map +1 -0
- package/dist/ai/types.d.ts +247 -0
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/types.js.map +1 -1
- package/dist/cli/commands/ask.d.ts +27 -0
- package/dist/cli/commands/ask.d.ts.map +1 -0
- package/dist/cli/commands/ask.js +230 -0
- package/dist/cli/commands/ask.js.map +1 -0
- package/dist/cli/commands/commit.d.ts +16 -0
- package/dist/cli/commands/commit.d.ts.map +1 -0
- package/dist/cli/commands/commit.js +163 -0
- package/dist/cli/commands/commit.js.map +1 -0
- package/dist/cli/commands/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +666 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/implement.d.ts.map +1 -1
- package/dist/cli/commands/implement.js +149 -28
- package/dist/cli/commands/implement.js.map +1 -1
- package/dist/cli/commands/init.d.ts +4 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +7 -54
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/port.d.ts +32 -0
- package/dist/cli/commands/port.d.ts.map +1 -0
- package/dist/cli/commands/port.js +554 -0
- package/dist/cli/commands/port.js.map +1 -0
- package/dist/cli/commands/pr/close.d.ts +15 -0
- package/dist/cli/commands/pr/close.d.ts.map +1 -0
- package/dist/cli/commands/pr/close.js +71 -0
- package/dist/cli/commands/pr/close.js.map +1 -0
- package/dist/cli/commands/pr/create.d.ts +17 -0
- package/dist/cli/commands/pr/create.d.ts.map +1 -1
- package/dist/cli/commands/pr/create.js +209 -5
- package/dist/cli/commands/pr/create.js.map +1 -1
- package/dist/cli/commands/pr/fixComments.d.ts.map +1 -1
- package/dist/cli/commands/pr/fixComments.js +77 -5
- package/dist/cli/commands/pr/fixComments.js.map +1 -1
- package/dist/cli/commands/pr/index.d.ts.map +1 -1
- package/dist/cli/commands/pr/index.js +4 -0
- package/dist/cli/commands/pr/index.js.map +1 -1
- package/dist/cli/commands/pr/list.d.ts.map +1 -1
- package/dist/cli/commands/pr/list.js +26 -3
- package/dist/cli/commands/pr/list.js.map +1 -1
- package/dist/cli/commands/pr/merge.d.ts +23 -0
- package/dist/cli/commands/pr/merge.d.ts.map +1 -0
- package/dist/cli/commands/pr/merge.js +191 -0
- package/dist/cli/commands/pr/merge.js.map +1 -0
- package/dist/cli/commands/pr/review.d.ts.map +1 -1
- package/dist/cli/commands/pr/review.js +123 -5
- package/dist/cli/commands/pr/review.js.map +1 -1
- package/dist/cli/commands/push.d.ts +16 -0
- package/dist/cli/commands/push.d.ts.map +1 -0
- package/dist/cli/commands/push.js +166 -0
- package/dist/cli/commands/push.js.map +1 -0
- package/dist/cli/commands/sync.d.ts +24 -0
- package/dist/cli/commands/sync.d.ts.map +1 -0
- package/dist/cli/commands/sync.js +414 -0
- package/dist/cli/commands/sync.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +34 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/config/config.d.ts +20 -3
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +103 -24
- package/dist/config/config.js.map +1 -1
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +70 -9
- package/dist/config/schema.js.map +1 -1
- package/dist/core/context.d.ts +13 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +2 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/gitx.d.ts +47 -0
- package/dist/core/gitx.d.ts.map +1 -1
- package/dist/core/gitx.js +204 -9
- package/dist/core/gitx.js.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/providers/azure.d.ts +26 -0
- package/dist/providers/azure.d.ts.map +1 -0
- package/dist/providers/azure.js +256 -0
- package/dist/providers/azure.js.map +1 -0
- package/dist/providers/base.d.ts +104 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +5 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/factory.d.ts +8 -0
- package/dist/providers/factory.d.ts.map +1 -0
- package/dist/providers/factory.js +25 -0
- package/dist/providers/factory.js.map +1 -0
- package/dist/providers/github.d.ts +19 -0
- package/dist/providers/github.d.ts.map +1 -0
- package/dist/providers/github.js +291 -0
- package/dist/providers/github.js.map +1 -0
- package/dist/providers/gitlab.d.ts +19 -0
- package/dist/providers/gitlab.d.ts.map +1 -0
- package/dist/providers/gitlab.js +186 -0
- package/dist/providers/gitlab.js.map +1 -0
- package/dist/types/config.d.ts +53 -9
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js.map +1 -1
- package/dist/utils/azureAuth.d.ts +51 -0
- package/dist/utils/azureAuth.d.ts.map +1 -0
- package/dist/utils/azureAuth.js +172 -0
- package/dist/utils/azureAuth.js.map +1 -0
- package/dist/utils/git.d.ts +22 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +63 -7
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/gitOps.d.ts +118 -0
- package/dist/utils/gitOps.d.ts.map +1 -0
- package/dist/utils/gitOps.js +380 -0
- package/dist/utils/gitOps.js.map +1 -0
- package/dist/utils/lockFile.d.ts +13 -0
- package/dist/utils/lockFile.d.ts.map +1 -0
- package/dist/utils/lockFile.js +54 -0
- package/dist/utils/lockFile.js.map +1 -0
- package/dist/utils/retry.d.ts +10 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +31 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/workflows/implement.d.ts +41 -0
- package/dist/workflows/implement.d.ts.map +1 -0
- package/dist/workflows/implement.js +219 -0
- package/dist/workflows/implement.js.map +1 -0
- package/dist/workflows/pr.d.ts +41 -0
- package/dist/workflows/pr.d.ts.map +1 -0
- package/dist/workflows/pr.js +285 -0
- package/dist/workflows/pr.js.map +1 -0
- package/dist/workflows/prAddress.d.ts +55 -0
- package/dist/workflows/prAddress.d.ts.map +1 -0
- package/dist/workflows/prAddress.js +349 -0
- package/dist/workflows/prAddress.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,383 @@
|
|
|
1
1
|
# gitx
|
|
2
2
|
|
|
3
|
-
AI-powered Git workflow automation CLI and SDK
|
|
3
|
+
**AI-powered Git workflow automation CLI and SDK.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
gitx wraps your everyday git operations with AI to generate commit messages, write PR descriptions, review code, resolve merge conflicts, implement tasks from a plain-English prompt, and answer questions about your repo — all from a single CLI.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Features](#features)
|
|
12
|
+
- [Installation](#installation)
|
|
13
|
+
- [Configuration](#configuration)
|
|
14
|
+
- [Commands](#commands)
|
|
15
|
+
- [gitx ask](#gitx-ask)
|
|
16
|
+
- [gitx commit](#gitx-commit)
|
|
17
|
+
- [gitx push](#gitx-push)
|
|
18
|
+
- [gitx sync](#gitx-sync)
|
|
19
|
+
- [gitx implement](#gitx-implement)
|
|
20
|
+
- [gitx pr create](#gitx-pr-create)
|
|
21
|
+
- [gitx pr review](#gitx-pr-review)
|
|
22
|
+
- [gitx pr fix-comments](#gitx-pr-fix-comments)
|
|
23
|
+
- [gitx pr merge](#gitx-pr-merge)
|
|
24
|
+
- [gitx pr list](#gitx-pr-list)
|
|
25
|
+
- [gitx pr close](#gitx-pr-close)
|
|
26
|
+
- [gitx config](#gitx-config)
|
|
27
|
+
- [Supported Providers](#supported-providers)
|
|
28
|
+
- [Environment Variables](#environment-variables)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
| Feature | What it does |
|
|
35
|
+
|---------|--------------|
|
|
36
|
+
| **AI commit messages** | Generates conventional-commit messages from your staged diff |
|
|
37
|
+
| **AI PR descriptions** | Writes PR title + body from your branch commits and diff |
|
|
38
|
+
| **AI code review** | Senior-dev quality review with inline comments posted to GitHub/GitLab/Azure |
|
|
39
|
+
| **AI conflict resolution** | Tries to auto-resolve merge/rebase conflicts; prompts when unsure |
|
|
40
|
+
| **AI task implementation** | Takes a plain-English task, plans and applies diffs, commits, pushes, opens PR |
|
|
41
|
+
| **AI comment addressing** | Reads unresolved review comments and generates targeted fixes |
|
|
42
|
+
| **gitx ask** | Ask anything about your repo — get answers grounded in live git context |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
6
47
|
|
|
7
48
|
```bash
|
|
49
|
+
# Clone and build
|
|
50
|
+
git clone https://github.com/g-abhishek/gitx.git
|
|
51
|
+
cd gitx
|
|
8
52
|
npm install
|
|
9
53
|
npm run build
|
|
10
|
-
|
|
54
|
+
|
|
55
|
+
# Link globally so `gitx` is available everywhere
|
|
56
|
+
npm link
|
|
11
57
|
```
|
|
12
58
|
|
|
59
|
+
**Requirements:** Node.js ≥ 18
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Configuration
|
|
64
|
+
|
|
65
|
+
Run the interactive setup wizard on first use:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
gitx init
|
|
69
|
+
# or equivalently:
|
|
70
|
+
gitx config setup
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The wizard will ask you to configure:
|
|
74
|
+
|
|
75
|
+
1. **Git provider** — GitHub, GitLab, or Azure DevOps
|
|
76
|
+
2. **AI provider** — Anthropic Claude (API key), OpenAI (API key), or local Claude CLI (no key needed)
|
|
77
|
+
|
|
78
|
+
Config is stored in `~/.config/gitx/config.json` (or the platform-appropriate XDG path).
|
|
79
|
+
|
|
80
|
+
**Quick config with env vars (no wizard needed):**
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
export ANTHROPIC_API_KEY=sk-ant-… # enables Claude automatically
|
|
84
|
+
export OPENAI_API_KEY=sk-… # enables OpenAI automatically
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Azure DevOps authentication
|
|
88
|
+
|
|
89
|
+
Azure DevOps supports two authentication methods:
|
|
90
|
+
|
|
91
|
+
| Method | When to use |
|
|
92
|
+
|--------|-------------|
|
|
93
|
+
| **GCM (recommended)** | Your company uses Git Credential Manager + OAuth (blocks PAT tokens) |
|
|
94
|
+
| **PAT** | Personal Access Token — classic approach, works everywhere |
|
|
95
|
+
|
|
96
|
+
**GCM setup (one time):**
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# 1. Configure git to use OAuth for Azure DevOps
|
|
100
|
+
git config --global credential.azreposCredentialType oauth
|
|
101
|
+
git config --global credential.https://dev.azure.com.useHttpPath true
|
|
102
|
+
|
|
103
|
+
# 2. Run gitx setup — choose "Azure DevOps" → "GCM"
|
|
104
|
+
gitx config set azure
|
|
105
|
+
# gitx verifies your GCM setup and saves authMethod: "gcm" — no token stored
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
With GCM configured, gitx calls `git credential fill` at runtime to obtain a short-lived OAuth token. GCM handles browser login (once) and silent token refresh automatically.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Commands
|
|
113
|
+
|
|
114
|
+
### gitx ask
|
|
115
|
+
|
|
116
|
+
Acts as a smart support assistant that can answer three categories of question — all in one command.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
gitx ask "<question>"
|
|
120
|
+
gitx ask "<question>" --pr # also fetch open PRs for context
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**1. Setup & diagnostic questions** — answered from your live gitx config (no fabrication):
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
gitx ask "is my AI provider set up?"
|
|
127
|
+
gitx ask "which AI model am I using?"
|
|
128
|
+
gitx ask "do I have a GitHub token configured?"
|
|
129
|
+
gitx ask "why isn't gitx working?"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**2. Repo state questions** — answered from live git data:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
gitx ask "what did I last commit?"
|
|
136
|
+
gitx ask "do I have any unstaged changes?"
|
|
137
|
+
gitx ask "show me all open PRs" --pr
|
|
138
|
+
gitx ask "do I have any stashed changes?"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**3. How-to questions** — answered from the built-in command reference:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
gitx ask "how do I sync my branch with main?"
|
|
145
|
+
gitx ask "how do I undo my last commit without losing changes?"
|
|
146
|
+
gitx ask "what command creates a PR?"
|
|
147
|
+
gitx ask "how do I implement a task with AI?"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Sources the AI draws from:**
|
|
151
|
+
|
|
152
|
+
- **Live gitx config** — which AI provider is active, whether keys are set, which git providers have tokens (keys are never exposed, only their presence/absence)
|
|
153
|
+
- **Live git state** — current branch, last 10 commits, working-tree status, stash list
|
|
154
|
+
- **Open PRs** — fetched from the provider API when `--pr` is passed or the question mentions "PR"
|
|
155
|
+
- **Built-in command reference** — the full gitx command table is embedded in every prompt
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### gitx commit
|
|
160
|
+
|
|
161
|
+
Stage all changes, AI-generate a conventional-commit message from the diff, preview it, and commit.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
gitx commit # stage → AI message → confirm → commit
|
|
165
|
+
gitx commit -m "feat: …" # skip AI, use your own message
|
|
166
|
+
gitx commit --push # commit then push to origin
|
|
167
|
+
gitx commit --dry-run # preview the AI message without committing
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The AI always receives a `git diff --stat` file summary alongside the diff, so it sees every changed file even when the diff is large and gets truncated.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### gitx push
|
|
175
|
+
|
|
176
|
+
Stage → AI-commit → push in one command.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
gitx push
|
|
180
|
+
gitx push -b feature/my-branch # push to a specific branch name
|
|
181
|
+
gitx push --dry-run # preview without pushing
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### gitx sync
|
|
187
|
+
|
|
188
|
+
Sync your current branch with its base branch. Auto-detects the base branch, fetches from origin, then merges or rebases.
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
gitx sync # auto-detect base, merge (default)
|
|
192
|
+
gitx sync --strategy rebase # rebase instead of merge
|
|
193
|
+
gitx sync --base develop # explicitly set the base branch
|
|
194
|
+
gitx sync --continue # resume after manually resolving conflicts
|
|
195
|
+
gitx sync --abort # cancel an in-progress operation
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**AI conflict resolution:** When a merge/rebase conflict is detected, gitx asks the AI to resolve it. High-confidence resolutions are applied automatically; low-confidence ones are shown to you for confirmation.
|
|
199
|
+
|
|
200
|
+
**Pre-sync PR comment check:** If your branch has an open PR with unresolved review comments, gitx will ask whether to address them before syncing. Choosing "Resolve comments first" runs the address workflow, commits the fixes, then the sync rebase/merge picks everything up in a single push.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### gitx port
|
|
205
|
+
|
|
206
|
+
Port commits from your current branch onto one or more other branches — the solution to "my lead wants this change on two other branches too."
|
|
207
|
+
|
|
208
|
+
gitx uses `git cherry` (patch-ID comparison) to detect which commits are already ported, so re-running is always safe and incremental.
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# From your feature branch:
|
|
212
|
+
gitx port release/v2 # port to one branch
|
|
213
|
+
gitx port release/v2 hotfix/v1 # port to multiple at once
|
|
214
|
+
gitx port release/v2 --base develop # override base branch detection
|
|
215
|
+
gitx port release/v2 --no-pr # push only, create PRs manually
|
|
216
|
+
gitx port release/v2 --draft # create draft PRs
|
|
217
|
+
|
|
218
|
+
# After adding more commits — only NEW commits will be ported:
|
|
219
|
+
gitx port release/v2 # incremental: skips already-ported commits
|
|
220
|
+
|
|
221
|
+
# Conflict resolution:
|
|
222
|
+
gitx port --continue # after manually fixing conflicts
|
|
223
|
+
gitx port --abort # abandon a stuck port
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**What it does per target branch:**
|
|
227
|
+
1. Checks `origin/<target>` exists — errors clearly if not
|
|
228
|
+
2. On first run: creates `port/<source>-to-<target>` and cherry-picks all commits
|
|
229
|
+
3. On re-run: uses `git cherry` to find only NEW commits — skips already-ported ones
|
|
230
|
+
4. Conflicts → AI attempts resolution; unresolvable ones pause for manual fix
|
|
231
|
+
5. Pushes the port branch, checks for an existing open PR (updates it), or creates a new one with an AI-generated description
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
### gitx implement
|
|
236
|
+
|
|
237
|
+
Give the AI a task in plain English. It analyzes the repo, creates a plan, generates and applies diffs, commits, pushes, and opens a PR.
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
gitx implement "add pagination to the users endpoint"
|
|
241
|
+
gitx implement "fix the null pointer on login" --mode guided
|
|
242
|
+
gitx implement "refactor auth module" --mode plan # plan only, no code changes
|
|
243
|
+
gitx implement "add unit tests for utils" --dry-run # preview plan, no commits
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Autonomy modes:**
|
|
247
|
+
|
|
248
|
+
| Mode | Behaviour |
|
|
249
|
+
|------|-----------|
|
|
250
|
+
| `plan` | Analyze and generate a plan — no code changes |
|
|
251
|
+
| `guided` | Confirm after every AI step |
|
|
252
|
+
| `semi-auto` | Confirm once before execution begins |
|
|
253
|
+
| `auto` | Fully automatic end-to-end |
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
### gitx pr create
|
|
258
|
+
|
|
259
|
+
Stage any uncommitted changes, AI-generate a PR title and body from your branch commits and diff, and open the PR.
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
gitx pr create
|
|
263
|
+
gitx pr create --title "feat: …" --body "…" # override AI-generated content
|
|
264
|
+
gitx pr create --draft # open as draft PR
|
|
265
|
+
gitx pr create --dry-run # preview without creating
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
### gitx pr review
|
|
271
|
+
|
|
272
|
+
Run a senior-developer quality AI review on an open PR and post the results as formal review comments (inline where supported).
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
gitx pr review <number>
|
|
276
|
+
gitx pr review 42 --no-comment # show review locally, don't post to GitHub
|
|
277
|
+
gitx pr review 42 --address # skip review, jump straight to addressing comments
|
|
278
|
+
gitx pr review 42 --no-push # apply fixes locally without pushing
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
The review covers: correctness, security, robustness, performance, breaking changes, best practices, test coverage, and documentation.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
### gitx pr fix-comments
|
|
286
|
+
|
|
287
|
+
Read all unresolved review comments on a PR, AI-generate targeted fixes for each, and apply them.
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
gitx pr fix-comments <number>
|
|
291
|
+
gitx pr fix-comments 42 --dry-run # preview fixes without applying
|
|
292
|
+
gitx pr fix-comments 42 --no-push # apply locally, skip push
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
### gitx pr merge
|
|
298
|
+
|
|
299
|
+
Merge a pull request via the provider API.
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
gitx pr merge <number>
|
|
303
|
+
gitx pr merge 42 --strategy rebase # rebase merge
|
|
304
|
+
gitx pr merge 42 --strategy merge # regular merge commit
|
|
305
|
+
gitx pr merge 42 --delete-branch # delete source branch after merge
|
|
306
|
+
gitx pr merge 42 --force # skip confirmation prompt
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Default strategy: `squash`.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
### gitx pr list
|
|
314
|
+
|
|
315
|
+
List pull requests for the current repo.
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
gitx pr list # open PRs (default)
|
|
319
|
+
gitx pr list --state closed
|
|
320
|
+
gitx pr list --state all
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
### gitx pr close
|
|
326
|
+
|
|
327
|
+
Close (or abandon on Azure DevOps) a pull request.
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
gitx pr close <number>
|
|
331
|
+
gitx pr close 42 --force # skip confirmation prompt
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### gitx config
|
|
337
|
+
|
|
338
|
+
Manage your gitx configuration.
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
gitx config # run interactive setup wizard
|
|
342
|
+
gitx config setup # same as above
|
|
343
|
+
gitx config show # display current config (secrets redacted)
|
|
344
|
+
gitx config set github # configure GitHub token
|
|
345
|
+
gitx config set openai # configure OpenAI API key
|
|
346
|
+
gitx config set-default-ai claude # switch AI provider
|
|
347
|
+
gitx config set-default-branch main # set default base branch
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Supported Providers
|
|
353
|
+
|
|
354
|
+
| Type | Supported |
|
|
355
|
+
|------|-----------|
|
|
356
|
+
| **Git hosts** | GitHub, GitLab, Azure DevOps |
|
|
357
|
+
| **Azure auth** | PAT (Personal Access Token), GCM OAuth (Git Credential Manager) |
|
|
358
|
+
| **AI backends** | Anthropic Claude (API), OpenAI GPT-4o, Local Claude CLI |
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## Environment Variables
|
|
363
|
+
|
|
364
|
+
| Variable | Description |
|
|
365
|
+
|----------|-------------|
|
|
366
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key — auto-selects Claude as the AI provider |
|
|
367
|
+
| `OPENAI_API_KEY` | OpenAI API key — auto-selects OpenAI as the AI provider |
|
|
368
|
+
| `GITX_AI_MODEL` | Override the AI model name (e.g. `claude-opus-4-5`, `gpt-4-turbo`) |
|
|
369
|
+
| `GITX_DEBUG=1` | Print full stack traces on errors |
|
|
370
|
+
|
|
371
|
+
AI provider priority when multiple are configured:
|
|
372
|
+
1. `ANTHROPIC_API_KEY` env var → Claude
|
|
373
|
+
2. `OPENAI_API_KEY` env var → OpenAI
|
|
374
|
+
3. `defaultAiProvider` in config
|
|
375
|
+
4. First configured provider entry with a key
|
|
376
|
+
5. Auto-detected local `claude` CLI
|
|
377
|
+
6. Mock fallback (warns user)
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## License
|
|
382
|
+
|
|
383
|
+
MIT
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude AI integration via the Anthropic Messages API.
|
|
3
|
+
*
|
|
4
|
+
* Authentication: reads ANTHROPIC_API_KEY from the environment.
|
|
5
|
+
* Model: defaults to claude-3-5-haiku-20241022 (fast, affordable).
|
|
6
|
+
* Override via GITX_AI_MODEL env var.
|
|
7
|
+
*
|
|
8
|
+
* All methods send a structured system prompt and parse the JSON response.
|
|
9
|
+
* If parsing fails we fall back gracefully rather than crashing.
|
|
10
|
+
*/
|
|
11
|
+
import type { AiAnalyzeTaskResponse, AiClient, AiGenerateDiffsResponse, AiGeneratePlanResponse, AiReviewPRResponse, AiSuggestFixesResponse, AiSummarizeChangesResponse } from "./types.js";
|
|
12
|
+
export declare class ClaudeAi implements AiClient {
|
|
13
|
+
private readonly apiKey;
|
|
14
|
+
private readonly model;
|
|
15
|
+
/**
|
|
16
|
+
* @param apiKey Anthropic API key. Falls back to ANTHROPIC_API_KEY env var.
|
|
17
|
+
* @param model Model override. Falls back to GITX_AI_MODEL env var then default.
|
|
18
|
+
*/
|
|
19
|
+
constructor(apiKey?: string, model?: string);
|
|
20
|
+
/** Check whether an API key is available without instantiating the class. */
|
|
21
|
+
static isAvailable(key?: string): boolean;
|
|
22
|
+
analyzeTask(input: string): Promise<AiAnalyzeTaskResponse>;
|
|
23
|
+
generatePlan(context: unknown): Promise<AiGeneratePlanResponse>;
|
|
24
|
+
generateDiffs(step: unknown): Promise<AiGenerateDiffsResponse>;
|
|
25
|
+
summarizeChanges(diff: unknown): Promise<AiSummarizeChangesResponse>;
|
|
26
|
+
suggestFixes(comment: unknown): Promise<AiSuggestFixesResponse>;
|
|
27
|
+
reviewPR(context: unknown): Promise<AiReviewPRResponse>;
|
|
28
|
+
generatePrContent(commits: string[], diff: string, stat?: string): Promise<import("./types.js").AiPrContentResponse>;
|
|
29
|
+
resolveConflict(filePath: string, conflictContent: string): Promise<import("./types.js").AiConflictResolutionResponse>;
|
|
30
|
+
generateCommitMessage(diff: string): Promise<import("./types.js").AiCommitMessageResponse>;
|
|
31
|
+
reviewPRDetailed(context: Parameters<import("./types.js").AiClient["reviewPRDetailed"]>[0]): Promise<import("./types.js").AiDetailedReviewResponse>;
|
|
32
|
+
generateFix(context: Parameters<import("./types.js").AiClient["generateFix"]>[0]): Promise<import("./types.js").AiFixResponse>;
|
|
33
|
+
ask(question: string, context: import("./types.js").AiAskContext): Promise<import("./types.js").AiAskResponse>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=claudeAi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claudeAi.d.ts","sourceRoot":"","sources":["../../src/ai/claudeAi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EACV,qBAAqB,EACrB,QAAQ,EACR,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AA+FpB,qBAAa,QAAS,YAAW,QAAQ;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAE/B;;;OAGG;gBACS,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAY3C,6EAA6E;IAC7E,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IAInC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAqB1D,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA8C/D,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAuD9D,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAgCpE,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA+C/D,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoDvD,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,YAAY,EAAE,mBAAmB,CAAC;IAmCpH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,YAAY,EAAE,4BAA4B,CAAC;IA+BtH,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,YAAY,EAAE,uBAAuB,CAAC;IA+B1F,gBAAgB,CACpB,OAAO,EAAE,UAAU,CAAC,OAAO,YAAY,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,GACxE,OAAO,CAAC,OAAO,YAAY,EAAE,wBAAwB,CAAC;IAWnD,WAAW,CACf,OAAO,EAAE,UAAU,CAAC,OAAO,YAAY,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GACnE,OAAO,CAAC,OAAO,YAAY,EAAE,aAAa,CAAC;IAWxC,GAAG,CACP,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,YAAY,EAAE,YAAY,GACzC,OAAO,CAAC,OAAO,YAAY,EAAE,aAAa,CAAC;CAK/C"}
|