Skip to content

Commit 5f40247

Browse files
committed
chore: doc
1 parent ed063f4 commit 5f40247

1 file changed

Lines changed: 28 additions & 29 deletions

File tree

README.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,37 @@
11
# diffctx = diff context
22

3-
Auto code reviewer powered by GPT + LSIF. All in one GitHub Action.
4-
53
## Showcase
64

5+
<img width="697" alt="image" src="https://user-images.githubusercontent.com/13421694/236666915-5d403e4a-9cc1-4364-afbe-363cf82e5e49.png">
6+
77
With a simple setup in your GitHub Action:
88

99
```yaml
1010
- name: diffctx
11-
uses: williamfzc/diffctx@v0.1.4
11+
uses: williamfzc/diffctx@v0.2.2
1212
with:
1313
lang: "golang"
14-
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
1514
```
1615
17-
Diffctx will automatically analyse the diff (**and the context of diff**) every new PullRequests in your repo, and leave comments for indicating which part you should care most:
18-
19-
<img width="628" alt="image" src="https://user-images.githubusercontent.com/13421694/232233602-f59f5d82-31dc-489b-8501-791faeff2db9.png">
16+
Diffctx will automatically analyse the diff (**and the context of diff**) every new PullRequests in your repo, and leave
17+
comments for indicating which part you should care most:
2018
21-
Based on [LSIF](https://microsoft.github.io/language-server-protocol/overviews/lsif/overview/), diffctx will not only analyse the lines contained by the diff, but also the full scope of your repo, and understand it well.
19+
![](https://user-images.githubusercontent.com/13421694/236665125-4968558b-8601-43d0-9618-97e146f93749.svg)
2220
23-
So it can better evaluate your changes and give more accurate suggestions from a global perspective.
21+
Based on [LSIF](https://microsoft.github.io/language-server-protocol/overviews/lsif/overview/), diffctx will not only
22+
analyse the lines contained by the diff, but also the full scope of your repo, and understand it well.
2423
2524
## Usage
2625
2726
diffctx can be directly used with GitHub Action.
2827
29-
### Add OpenAI Api Key
30-
31-
<img width="816" alt="image" src="https://user-images.githubusercontent.com/13421694/232230719-1d827367-d766-4cc7-95d0-e8a0c3adbea8.png">
32-
3328
### Add to GitHub Action
3429
3530
```yaml
3631
name: Test PR
3732

3833
# triggered by pull_request
39-
on: [push, pull_request]
34+
on: [ push, pull_request ]
4035

4136
# for creating comments
4237
permissions:
@@ -49,36 +44,40 @@ jobs:
4944
- uses: actions/checkout@v3
5045
with:
5146
fetch-depth: 2
52-
47+
5348
# ...
54-
49+
5550
- name: diffctx
56-
uses: williamfzc/diffctx@v0.1.4
51+
uses: williamfzc/diffctx@v0.2.2
5752
with:
58-
# currently we support: golang/java/python
53+
# currently we support: golang/python
5954
lang: "golang"
60-
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
6155
```
6256
6357
### Done!
6458
6559
You can create a new PullRequest for test.
6660
61+
### Still have a problem?
62+
63+
A real example can be found in: https://github.com/williamfzc/srctx/tree/test_diffctx
64+
6765
## How it works
6866
6967
1. Scan the repo and understand it well
7068
2. Extract the sub graph influenced by the diff
7169
3. Generate a summary from sub graph
72-
4. Send the summary to AI for evaluation
73-
5. Create a comment
74-
75-
The 1-3 is finished by [srctx](https://github.com/williamfzc/srctx).
70+
4. Create a comment
7671
77-
## Cost
72+
## Supported Languages
7873
79-
Token is expensive. So we did not intend to let AI scan all the codes at the beginning, but advanced and standardized the calculation part through the parser.
74+
Thanks to tree-sitter and LSIF, diffctx can support nearly all the popular languages.
8075
81-
Everything can be done in one request. Which takes ~10s.
76+
| Languages | Status |
77+
|-----------|---------|
78+
| Golang | Done |
79+
| Python | Done |
80+
| Java | Working |
8281
8382
## Contribution
8483
@@ -89,7 +88,7 @@ Issues, PRs and suggestions are welcome.
8988
9089
## Roadmap
9190
92-
- Stable prompt
93-
- Send AI the necessary code to make better suggestions
91+
- More languages
9492
- Better comment format
95-
- Extract more meaningful columns (like function definition) from code
93+
- Extract more meaningful columns (like function definition) from code
94+
- Display graph in comment also

0 commit comments

Comments
 (0)