jvcs 1.5.6 → 1.5.7
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.
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
async function aiAnalyzer({ filePath="", leftContent="", rightContent="", mode=""}) {
|
|
2
|
+
|
|
3
|
+
const { ChatOllama } = await import("@langchain/ollama");
|
|
4
|
+
|
|
5
|
+
const llm = new ChatOllama({
|
|
6
|
+
model: "gpt-oss:120b-cloud",
|
|
7
|
+
baseUrl: "https://ollama.com",
|
|
8
|
+
apiKey: "31dbc890aff540ac8fe835a4bdf7853b.Y7yR3jLgZ5CQu5WlqQOanCp0",
|
|
9
|
+
temperature: 0,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const prompt = `
|
|
13
|
+
You are a code reviewer. Analyze the changes in the file "${filePath}".
|
|
14
|
+
Diff mode: ${mode}
|
|
15
|
+
|
|
16
|
+
OLD CONTENT:
|
|
17
|
+
${leftContent || "<empty>"}
|
|
18
|
+
|
|
19
|
+
NEW CONTENT:
|
|
20
|
+
${rightContent || "<empty>"}
|
|
21
|
+
|
|
22
|
+
Provide:
|
|
23
|
+
- Summary of changes
|
|
24
|
+
- Suggestions or improvements
|
|
25
|
+
- Risks or bugs introduced
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const response = await llm.invoke(prompt);
|
|
29
|
+
return response.content
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = aiAnalyzer
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const blessed = require("blessed")
|
|
2
|
+
const aiAnalyzer = require("./aiAnalyzer")
|
|
2
3
|
|
|
3
4
|
function startUI(state) {
|
|
4
5
|
const screen = blessed.screen({
|
|
@@ -120,29 +121,35 @@ function startUI(state) {
|
|
|
120
121
|
}).join("\n")
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
function renderFileView() {
|
|
124
|
+
async function renderFileView() {
|
|
124
125
|
const file = state.getCurrentFile()
|
|
125
126
|
if (!file) return
|
|
126
127
|
|
|
127
128
|
leftBox.setContent(colorDiffContent(file.leftContent, "removed"))
|
|
128
129
|
rightBox.setContent(colorDiffContent(file.rightContent, "added"))
|
|
129
130
|
|
|
130
|
-
aiBox.setContent(
|
|
131
|
-
{bold}Summary:{/bold}
|
|
132
|
-
Status: ${file.status.toUpperCase()}
|
|
133
|
-
|
|
134
|
-
{green-fg}Lines Added: ${file.stats.added}{/green-fg}
|
|
135
|
-
{red-fg}Lines Removed: ${file.stats.removed}{/red-fg}
|
|
136
|
-
|
|
137
|
-
(Real AI analysis will appear here later)
|
|
138
|
-
`)
|
|
139
|
-
|
|
131
|
+
aiBox.setContent("AI Analysis: Loading...");
|
|
140
132
|
screen.append(leftBox)
|
|
141
133
|
screen.append(rightBox)
|
|
142
134
|
screen.append(aiBox)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
135
|
+
updateActiveTabHighlight();
|
|
136
|
+
screen.render();
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
const aiSummary = await aiAnalyzer({
|
|
140
|
+
filePath: file.path,
|
|
141
|
+
leftContent: file.leftContent,
|
|
142
|
+
rightContent: file.rightContent,
|
|
143
|
+
mode: state.mode
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
aiBox.setContent(aiSummary)
|
|
147
|
+
screen.render()
|
|
148
|
+
}
|
|
149
|
+
catch(error) {
|
|
150
|
+
aiBox.setContent(`AI Analysis failed: ${err.message || err}`);
|
|
151
|
+
screen.render()
|
|
152
|
+
}
|
|
146
153
|
}
|
|
147
154
|
|
|
148
155
|
function destroyFileView() {
|
|
@@ -184,10 +191,10 @@ Status: ${file.status.toUpperCase()}
|
|
|
184
191
|
})
|
|
185
192
|
|
|
186
193
|
// Enter → Open file view
|
|
187
|
-
fileList.key(["enter"], () => {
|
|
194
|
+
fileList.key(["enter"], async () => {
|
|
188
195
|
state.goToFileView()
|
|
189
196
|
fileList.detach()
|
|
190
|
-
renderFileView()
|
|
197
|
+
await renderFileView()
|
|
191
198
|
})
|
|
192
199
|
|
|
193
200
|
// ESC → Back to list
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jvcs",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.7",
|
|
4
4
|
"bin": {
|
|
5
5
|
"jvcs": "index.js"
|
|
6
6
|
},
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
"author": "",
|
|
9
9
|
"license": "ISC",
|
|
10
10
|
"dependencies": {
|
|
11
|
+
"@langchain/core": "^1.1.29",
|
|
12
|
+
"@langchain/ollama": "^1.2.5",
|
|
11
13
|
"blessed": "^0.1.81",
|
|
12
14
|
"chalk": "^4.1.2",
|
|
13
15
|
"dotenv": "^17.2.3",
|
|
@@ -18,4 +20,4 @@
|
|
|
18
20
|
"validator": "^13.15.20",
|
|
19
21
|
"yargs": "^18.0.0"
|
|
20
22
|
}
|
|
21
|
-
}
|
|
23
|
+
}
|