@jxtools/visualgit 1.0.0 → 1.2.0
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 +15 -42
- package/bin/cli.js +9 -2
- package/dist/assets/index-CfMbMqji.js +13 -0
- package/dist/index.html +1 -1
- package/dist-server/index.js +6 -6
- package/dist-server/routes/ai.js +2 -2
- package/dist-server/services/ai.service.js +4 -4
- package/package.json +1 -1
- package/dist/assets/index-BZU2xrvr.js +0 -13
package/dist/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
9
9
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
10
10
|
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-CfMbMqji.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-Xj2Kq8Xb.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
package/dist-server/index.js
CHANGED
|
@@ -13,8 +13,11 @@ export function createServer(repoPath, isGitRepo = true) {
|
|
|
13
13
|
app.use('/api/ai', createAiRouter());
|
|
14
14
|
const distPath = path.join(__dirname, '..', 'dist');
|
|
15
15
|
app.use(express.static(distPath));
|
|
16
|
-
app.get('/{*splat}', (_req, res) => {
|
|
17
|
-
res.sendFile(path.join(distPath, 'index.html'))
|
|
16
|
+
app.get('/{*splat}', (_req, res, next) => {
|
|
17
|
+
res.sendFile(path.join(distPath, 'index.html'), (err) => {
|
|
18
|
+
if (err)
|
|
19
|
+
next();
|
|
20
|
+
});
|
|
18
21
|
});
|
|
19
22
|
return app;
|
|
20
23
|
}
|
|
@@ -25,8 +28,5 @@ if (isDirectRun) {
|
|
|
25
28
|
const port = parseInt(process.env.PORT || '4321', 10);
|
|
26
29
|
const isGitRepo = process.env.IS_GIT_REPO !== 'false';
|
|
27
30
|
const app = createServer(repoPath, isGitRepo);
|
|
28
|
-
app.listen(port
|
|
29
|
-
console.log(`VisualGit server running at http://localhost:${port}`);
|
|
30
|
-
console.log(`Repo: ${repoPath}`);
|
|
31
|
-
});
|
|
31
|
+
app.listen(port);
|
|
32
32
|
}
|
package/dist-server/routes/ai.js
CHANGED
|
@@ -4,7 +4,7 @@ export function createAiRouter() {
|
|
|
4
4
|
const router = Router();
|
|
5
5
|
const aiService = new AiService();
|
|
6
6
|
router.post('/analyze', async (req, res) => {
|
|
7
|
-
const { provider = 'claude', mode = 'full', content, filePath } = req.body;
|
|
7
|
+
const { provider = 'claude', mode = 'full', content, filePath, model } = req.body;
|
|
8
8
|
if (!content) {
|
|
9
9
|
res.status(400).json({ error: 'content is required' });
|
|
10
10
|
return;
|
|
@@ -15,7 +15,7 @@ export function createAiRouter() {
|
|
|
15
15
|
Connection: 'keep-alive',
|
|
16
16
|
});
|
|
17
17
|
try {
|
|
18
|
-
for await (const chunk of aiService.analyze(provider, mode, content, filePath)) {
|
|
18
|
+
for await (const chunk of aiService.analyze(provider, mode, content, filePath, model)) {
|
|
19
19
|
res.write(`data: ${JSON.stringify({ text: chunk })}\n\n`);
|
|
20
20
|
}
|
|
21
21
|
res.write(`data: ${JSON.stringify({ done: true })}\n\n`);
|
|
@@ -10,9 +10,9 @@ export class AiService {
|
|
|
10
10
|
}
|
|
11
11
|
return `You are a senior software engineer. Analyze this complete git diff and provide:\n\n1. Executive summary of all changes\n2. Key improvements or patterns introduced\n3. Any potential risks or concerns\n4. How the changes relate to each other\n\nBe concise with bullet points. Do not repeat the code.\n\n\`\`\`diff\n${content}\n\`\`\``;
|
|
12
12
|
}
|
|
13
|
-
getCommand(provider, prompt) {
|
|
13
|
+
getCommand(provider, prompt, model = 'sonnet') {
|
|
14
14
|
if (provider === 'claude') {
|
|
15
|
-
const args = ['-p', '--model',
|
|
15
|
+
const args = ['-p', '--model', model];
|
|
16
16
|
if (this.hasConversation)
|
|
17
17
|
args.push('--continue');
|
|
18
18
|
args.push(prompt);
|
|
@@ -23,9 +23,9 @@ export class AiService {
|
|
|
23
23
|
args: ['api', 'chat.completions.create', '-m', 'gpt-4o', '-g', 'user', prompt],
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
async *analyze(provider, mode, content, filePath) {
|
|
26
|
+
async *analyze(provider, mode, content, filePath, model) {
|
|
27
27
|
const prompt = this.buildPrompt(mode, content, filePath);
|
|
28
|
-
const { command, args } = this.getCommand(provider, prompt);
|
|
28
|
+
const { command, args } = this.getCommand(provider, prompt, model);
|
|
29
29
|
const env = { ...process.env };
|
|
30
30
|
delete env.CLAUDECODE;
|
|
31
31
|
const proc = spawn(command, args, { env });
|