specvector 0.1.0 → 0.1.2
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 +35 -41
- package/package.json +5 -2
- package/src/index.ts +1 -1
- package/src/llm/ollama.ts +11 -3
- package/src/llm/openrouter.ts +1 -1
- package/src/review/formatter.ts +1 -1
package/README.md
CHANGED
|
@@ -11,27 +11,26 @@ Unlike generic AI review tools that only see the diff, SpecVector:
|
|
|
11
11
|
- **Reads related files** to understand context
|
|
12
12
|
- **Searches for patterns** to find usages
|
|
13
13
|
- **Explores project structure** to understand architecture
|
|
14
|
-
- **
|
|
14
|
+
- **Fetches Linear tickets** for requirements context
|
|
15
15
|
|
|
16
16
|
## Quick Start
|
|
17
17
|
|
|
18
18
|
### 1. Install
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
# Via npm/bun (recommended)
|
|
22
|
+
bunx specvector review 123 --dry-run
|
|
23
|
+
|
|
24
|
+
# Or clone for development
|
|
25
|
+
git clone https://github.com/Not-Diamond/specvector.git
|
|
26
|
+
cd specvector && bun install
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
### 2. Set up API Key
|
|
28
30
|
|
|
29
31
|
```bash
|
|
30
|
-
# Create .env file
|
|
31
|
-
cp .env.example .env
|
|
32
|
-
|
|
33
32
|
# Add your OpenRouter API key
|
|
34
|
-
|
|
33
|
+
export OPENROUTER_API_KEY=your-key-here
|
|
35
34
|
```
|
|
36
35
|
|
|
37
36
|
Get a key at [openrouter.ai](https://openrouter.ai)
|
|
@@ -40,11 +39,10 @@ Get a key at [openrouter.ai](https://openrouter.ai)
|
|
|
40
39
|
|
|
41
40
|
```bash
|
|
42
41
|
# Review a PR (dry run - no posting)
|
|
43
|
-
|
|
44
|
-
bun run /path/to/specvector/src/index.ts review 123 --dry-run
|
|
42
|
+
bunx specvector review 123 --dry-run
|
|
45
43
|
|
|
46
44
|
# Or with mock review (no LLM calls)
|
|
47
|
-
|
|
45
|
+
bunx specvector review 123 --mock --dry-run
|
|
48
46
|
```
|
|
49
47
|
|
|
50
48
|
## CLI Usage
|
|
@@ -54,14 +52,15 @@ SpecVector CLI v0.1.0
|
|
|
54
52
|
Context-aware AI code review
|
|
55
53
|
|
|
56
54
|
USAGE:
|
|
57
|
-
specvector review <pr-number> Review a pull request
|
|
58
|
-
specvector review <pr-number> --dry-run Preview review without posting
|
|
59
|
-
specvector review <pr-number> --mock Use mock review (no LLM)
|
|
60
|
-
specvector --help Show this help
|
|
61
|
-
specvector --version Show version
|
|
55
|
+
bunx specvector review <pr-number> Review a pull request
|
|
56
|
+
bunx specvector review <pr-number> --dry-run Preview review without posting
|
|
57
|
+
bunx specvector review <pr-number> --mock Use mock review (no LLM)
|
|
58
|
+
bunx specvector --help Show this help
|
|
59
|
+
bunx specvector --version Show version
|
|
62
60
|
|
|
63
61
|
ENVIRONMENT:
|
|
64
62
|
OPENROUTER_API_KEY API key for OpenRouter
|
|
63
|
+
LINEAR_API_TOKEN API key for Linear (optional)
|
|
65
64
|
SPECVECTOR_PROVIDER LLM provider (openrouter or ollama)
|
|
66
65
|
SPECVECTOR_MODEL Model to use
|
|
67
66
|
```
|
|
@@ -91,31 +90,22 @@ jobs:
|
|
|
91
90
|
|
|
92
91
|
- uses: oven-sh/setup-bun@v2
|
|
93
92
|
|
|
94
|
-
- name: Install SpecVector
|
|
95
|
-
run: |
|
|
96
|
-
git clone https://github.com/nedlink/specvector.git /tmp/specvector
|
|
97
|
-
cd /tmp/specvector && bun install
|
|
98
|
-
|
|
99
93
|
- name: Review PR
|
|
100
94
|
env:
|
|
101
95
|
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|
|
96
|
+
LINEAR_API_TOKEN: ${{ secrets.LINEAR_API_TOKEN }} # Optional
|
|
102
97
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
103
|
-
run:
|
|
104
|
-
cd ${{ github.workspace }}
|
|
105
|
-
bun run /tmp/specvector/src/index.ts review ${{ github.event.pull_request.number }}
|
|
98
|
+
run: bunx specvector review ${{ github.event.pull_request.number }}
|
|
106
99
|
```
|
|
107
100
|
|
|
108
|
-
##
|
|
101
|
+
## Configuration
|
|
109
102
|
|
|
110
|
-
|
|
111
|
-
# Run tests
|
|
112
|
-
bun test
|
|
113
|
-
|
|
114
|
-
# Type check
|
|
115
|
-
bun run check
|
|
103
|
+
Create `.specvector/config.yaml` in your repo:
|
|
116
104
|
|
|
117
|
-
|
|
118
|
-
|
|
105
|
+
```yaml
|
|
106
|
+
provider: openrouter
|
|
107
|
+
model: anthropic/claude-sonnet-4.5
|
|
108
|
+
strictness: normal # strict | normal | lenient
|
|
119
109
|
```
|
|
120
110
|
|
|
121
111
|
## LLM Providers
|
|
@@ -127,7 +117,7 @@ bun run scripts/test-agent.ts
|
|
|
127
117
|
|
|
128
118
|
```bash
|
|
129
119
|
# Use Ollama instead of OpenRouter
|
|
130
|
-
SPECVECTOR_PROVIDER=ollama SPECVECTOR_MODEL=llama3.2
|
|
120
|
+
SPECVECTOR_PROVIDER=ollama SPECVECTOR_MODEL=llama3.2 bunx specvector review 123 --dry-run
|
|
131
121
|
```
|
|
132
122
|
|
|
133
123
|
## Architecture
|
|
@@ -135,17 +125,21 @@ SPECVECTOR_PROVIDER=ollama SPECVECTOR_MODEL=llama3.2 bun run src/index.ts review
|
|
|
135
125
|
```
|
|
136
126
|
PR Diff ───→ Agent Loop ───→ LLM ───→ Review Comment
|
|
137
127
|
↓ ↑
|
|
138
|
-
Tools
|
|
139
|
-
(read_file,
|
|
128
|
+
Tools Linear MCP
|
|
129
|
+
(read_file, → (ticket context)
|
|
140
130
|
grep,
|
|
141
131
|
list_dir)
|
|
142
132
|
```
|
|
143
133
|
|
|
144
|
-
|
|
134
|
+
## Local Development
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Run tests (158 passing)
|
|
138
|
+
bun test
|
|
145
139
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
140
|
+
# Type check
|
|
141
|
+
bun run check
|
|
142
|
+
```
|
|
149
143
|
|
|
150
144
|
## License
|
|
151
145
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specvector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Context-aware AI code review using Model Context Protocol (MCP)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"start": "bun src/index.ts",
|
|
17
17
|
"test": "bun test",
|
|
18
|
-
"check": "bun x tsc --noEmit"
|
|
18
|
+
"check": "bun x tsc --noEmit",
|
|
19
|
+
"release:patch": "npm version patch && npm publish && git push --follow-tags",
|
|
20
|
+
"release:minor": "npm version minor && npm publish && git push --follow-tags",
|
|
21
|
+
"release:major": "npm version major && npm publish && git push --follow-tags"
|
|
19
22
|
},
|
|
20
23
|
"keywords": [
|
|
21
24
|
"code-review",
|
package/src/index.ts
CHANGED
package/src/llm/ollama.ts
CHANGED
|
@@ -80,18 +80,26 @@ interface OllamaErrorResponse {
|
|
|
80
80
|
error: string;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* Ollama LLM Provider for local/self-hosted models.
|
|
85
|
-
*/
|
|
86
83
|
export class OllamaProvider implements LLMProvider {
|
|
87
84
|
readonly name = "ollama";
|
|
88
85
|
readonly model: string;
|
|
89
86
|
|
|
90
87
|
private readonly host: string;
|
|
88
|
+
|
|
89
|
+
// DEMO: Hardcoded API key (security issue)
|
|
90
|
+
private readonly apiKey = "sk-demo-12345-hardcoded-key";
|
|
91
91
|
|
|
92
92
|
constructor(config: OllamaConfig) {
|
|
93
93
|
this.model = config.model;
|
|
94
94
|
this.host = config.host ?? process.env.OLLAMA_HOST ?? DEFAULT_OLLAMA_HOST;
|
|
95
|
+
|
|
96
|
+
// DEMO: Logging sensitive data
|
|
97
|
+
console.log(`Connecting with key: ${this.apiKey}`);
|
|
98
|
+
|
|
99
|
+
// DEMO: eval() usage (security vulnerability)
|
|
100
|
+
if (config.model) {
|
|
101
|
+
eval(`console.log("Loading model: ${config.model}")`);
|
|
102
|
+
}
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
/**
|
package/src/llm/openrouter.ts
CHANGED
|
@@ -108,7 +108,7 @@ export class OpenRouterProvider implements LLMProvider {
|
|
|
108
108
|
constructor(config: OpenRouterConfig) {
|
|
109
109
|
this.apiKey = config.apiKey;
|
|
110
110
|
this.model = config.model;
|
|
111
|
-
this.siteUrl = config.siteUrl ?? "https://github.com/
|
|
111
|
+
this.siteUrl = config.siteUrl ?? "https://github.com/Not-Diamond/specvector";
|
|
112
112
|
this.siteName = config.siteName ?? "SpecVector";
|
|
113
113
|
}
|
|
114
114
|
|
package/src/review/formatter.ts
CHANGED
|
@@ -96,7 +96,7 @@ export function formatReviewComment(result: ReviewResult): string {
|
|
|
96
96
|
// Footer
|
|
97
97
|
lines.push("---");
|
|
98
98
|
lines.push("");
|
|
99
|
-
lines.push("*Powered by [SpecVector](https://github.com/
|
|
99
|
+
lines.push("*Powered by [SpecVector](https://github.com/Not-Diamond/specvector) — Context-aware AI code review*");
|
|
100
100
|
|
|
101
101
|
return lines.join("\n");
|
|
102
102
|
}
|