Skip to content

Commit 6d3b83a

Browse files
fix: update example to match Provider interface and modernize README
- Fix mockProvider to implement Chat() method instead of Complete() - Modernize README with badges, quick start, and examples section Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
1 parent f20496c commit 6d3b83a

2 files changed

Lines changed: 37 additions & 107 deletions

File tree

README.md

Lines changed: 33 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,60 @@
1-
# sight
1+
<p align="center">
2+
<h1 align="center">Sight</h1>
3+
<p align="center">
4+
<strong>AI-powered code review for diffs</strong>
5+
</p>
6+
<p align="center">
7+
<a href="https://golang.org/"><img src="https://img.shields.io/badge/Go-1.23+-00ADD8?style=flat-square&logo=go&logoColor=white" alt="Go"></a>
8+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="License"></a>
9+
<a href="https://github.com/GrayCodeAI/sight/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/GrayCodeAI/sight/ci.yml?style=flat-square&label=tests" alt="CI"></a>
10+
</p>
11+
</p>
212

3-
AI-powered code review on diffs. Parses unified diffs, enriches with surrounding code context and git history, then runs parallel multi-concern reviews through an LLM provider.
13+
---
414

5-
## Design
15+
Sight provides intelligent code review capabilities by analyzing diffs with AI. It understands context, identifies issues, and suggests improvements.
616

7-
- **Library only** — no CLI, no binary
8-
- **No LLM SDK dependency** — defines a Provider interface; consumers implement it
9-
- **No opinions** — consumers inject their own LLM client (e.g., via eyrie)
17+
## Features
1018

11-
## Install
19+
- **Diff-aware analysis** - Reviews only changed code with full context
20+
- **Severity classification** - Categorizes findings by impact
21+
- **Provider agnostic** - Works with any LLM provider through the `Provider` interface
22+
- **Extensible rules** - Add custom review rules for your codebase
23+
24+
## Quick Start
1225

1326
```bash
14-
go get github.com/GrayCodeAI/sight@latest
27+
go get github.com/GrayCodeAI/sight
1528
```
1629

17-
## Usage
18-
19-
### One-shot review
20-
2130
```go
22-
result, err := sight.Review(ctx, diffText,
23-
sight.WithProvider(myProvider),
31+
import "github.com/GrayCodeAI/sight"
32+
33+
reviewer := sight.NewReviewer(
34+
sight.WithProvider(myLLMProvider),
2435
sight.Thorough,
2536
)
37+
38+
result, err := reviewer.Review(ctx, diff)
2639
for _, f := range result.Findings {
2740
fmt.Printf("[%s] %s:%d - %s\n", f.Severity, f.File, f.Line, f.Message)
2841
}
2942
```
3043

31-
### Reusable reviewer
44+
## Examples
3245

33-
```go
34-
r := sight.NewReviewer(sight.WithProvider(p), sight.Thorough)
35-
result1, _ := r.Review(ctx, diff1)
36-
result2, _ := r.Review(ctx, diff2)
37-
```
46+
See the [examples/](examples/) directory for runnable code samples.
3847

39-
### Provider interface
48+
## Provider Interface
4049

41-
Implement this with any LLM client:
50+
Implement the `Provider` interface to use any LLM:
4251

4352
```go
4453
type Provider interface {
45-
Complete(ctx context.Context, messages []Message) (string, error)
54+
Chat(ctx context.Context, messages []Message, opts ChatOpts) (*Response, error)
4655
}
4756
```
4857

49-
## Presets
50-
51-
| Preset | Concerns | Use case |
52-
|--------|----------|----------|
53-
| Quick | security, correctness | Fast PR checks |
54-
| Standard | all (default) | Balanced review |
55-
| Thorough | all + deeper analysis | Critical code |
56-
| SecurityFocus | security only | Security audit |
57-
| CI | all + fail-on threshold | CI/CD gates |
58-
59-
## Findings
60-
61-
Each finding includes:
62-
- **Concern**: security, performance, correctness, maintainability, testing
63-
- **Severity**: critical, high, medium, low, info
64-
- **File** and **Line**: exact location in diff
65-
- **Message**: human-readable description
66-
- **Fix**: suggested code fix
67-
- **CWE**: reference (e.g., CWE-79)
68-
69-
## Output Formats
70-
71-
- Inline comments (GitHub/GitLab PR comments)
72-
- Human-readable terminal output
73-
74-
## Configuration
75-
76-
File-based config via `.sight.toml`:
77-
78-
```toml
79-
fail-on = "high"
80-
exclude = ["vendor/", "generated/"]
81-
concerns = ["security", "performance", "correctness"]
82-
```
83-
84-
## Testing
85-
86-
```bash
87-
make test # Unit tests
88-
make test-race # With race detector
89-
make bench # Benchmarks
90-
make cover # Coverage report
91-
```
92-
9358
## License
9459

95-
MIT
96-
97-
## New Features (Wave 1-4)
98-
99-
### Confidence Scoring
100-
101-
Every finding includes a numeric confidence score (0.0-1.0) indicating how certain the system is that it's a true positive. Higher scores = more reliable findings.
102-
103-
### SAST-LLM Fusion
104-
105-
Sight can ingest findings from static analysis tools (SAST) and feed them into the LLM review prompt for validation. This combines the breadth of automated scanning with the depth of LLM reasoning.
106-
107-
### Fix Suggestion Pipeline
108-
109-
Sight includes a built-in fix suggestion pipeline that generates remediation code for common vulnerability patterns:
110-
- SQL injection → parameterized queries
111-
- XSS → HTML escaping / template engines
112-
- Hardcoded secrets → environment variables
113-
- Missing input validation → validation middleware
114-
- Weak crypto → modern algorithm replacement
115-
- Path traversal → filepath.Clean + base path checks
116-
- SSRF → URL allowlist validation
117-
118-
Custom rules can be registered via AddRule().
119-
120-
### Memory Bridge (Coming Soon)
121-
122-
Integration with yaad memory for context-aware reviews. Sight can recall similar past findings and store review results for future reference.
123-
124-
## Ecosystem
125-
126-
Sight is part of the hawk-eco platform:
127-
- **hawk** — CLI/REPL that orchestrates all tools
128-
- **eyrie** — LLM provider layer (sight calls LLMs through eyrie)
129-
- **yaad** — memory/recall engine
130-
- **inspect** — security/accessibility auditing
131-
- **tok** — token counting and cost estimation
132-
- **trace** — session capture and replay
60+
MIT - see [LICENSE](LICENSE) for details.

examples/basic/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import (
1010

1111
type mockProvider struct{}
1212

13-
func (m *mockProvider) Complete(ctx context.Context, messages []sight.Message) (string, error) {
14-
return "Code looks good. Consider adding error handling for edge cases.", nil
13+
func (m *mockProvider) Chat(ctx context.Context, messages []sight.Message, opts sight.ChatOpts) (*sight.Response, error) {
14+
return &sight.Response{
15+
Content: "Code looks good. Consider adding error handling for edge cases.",
16+
}, nil
1517
}
1618

1719
func main() {

0 commit comments

Comments
 (0)