vg-coder-cli 2.0.11 → 2.0.14
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/package.json +6 -19
- package/src/server/api-server.js +93 -297
- package/src/server/terminal-manager.js +82 -0
- package/src/server/views/css/git-view.css +155 -0
- package/src/server/views/css/terminal.css +98 -0
- package/src/server/views/dashboard.html +39 -3
- package/src/server/views/js/api.js +15 -0
- package/src/server/views/js/features/git-view.js +117 -0
- package/src/server/views/js/features/terminal.js +174 -0
- package/src/server/views/js/main.js +18 -40
- package/vg-coder-cli-2.0.12.tgz +0 -0
- package/vg-coder-cli-2.0.14.tgz +0 -0
- package/vg-coder-cli-2.0.11.tgz +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// Main entry point - Initialize application
|
|
2
2
|
import { SYSTEM_PROMPT } from './config.js';
|
|
3
3
|
import { checkHealth } from './api.js';
|
|
4
|
-
import './handlers.js';
|
|
4
|
+
import './handlers.js';
|
|
5
5
|
import { showToast, showCopiedState } from './utils.js';
|
|
6
6
|
import { initIframeManager } from './features/iframe-manager.js';
|
|
7
|
+
import { initGitView } from './features/git-view.js';
|
|
8
|
+
import { initTerminal, createNewTerminal } from './features/terminal.js';
|
|
7
9
|
|
|
8
|
-
/**
|
|
9
|
-
* Initialize application on DOM ready
|
|
10
|
-
*/
|
|
11
10
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
12
11
|
// Load system prompt text
|
|
13
12
|
document.getElementById('prompt-text').textContent = SYSTEM_PROMPT;
|
|
@@ -21,13 +20,19 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|
|
21
20
|
// Load Extension Path
|
|
22
21
|
loadExtensionPath();
|
|
23
22
|
|
|
24
|
-
// Initialize Iframe Manager
|
|
23
|
+
// Initialize Iframe Manager
|
|
25
24
|
initIframeManager();
|
|
25
|
+
|
|
26
|
+
// Initialize Git View
|
|
27
|
+
initGitView();
|
|
28
|
+
|
|
29
|
+
// Initialize Terminal System
|
|
30
|
+
initTerminal();
|
|
31
|
+
|
|
32
|
+
// Auto open one terminal on start (Optional)
|
|
33
|
+
// setTimeout(() => createNewTerminal(), 500);
|
|
26
34
|
});
|
|
27
35
|
|
|
28
|
-
/**
|
|
29
|
-
* Check and update server status
|
|
30
|
-
*/
|
|
31
36
|
async function checkServerStatus() {
|
|
32
37
|
const statusEl = document.getElementById('status');
|
|
33
38
|
const isHealthy = await checkHealth();
|
|
@@ -43,28 +48,15 @@ async function checkServerStatus() {
|
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
/**
|
|
47
|
-
* Initialize Theme Logic
|
|
48
|
-
*/
|
|
49
51
|
function initTheme() {
|
|
50
52
|
const themeBtn = document.getElementById('theme-toggle');
|
|
51
|
-
const themeIcon = document.getElementById('theme-icon');
|
|
52
|
-
|
|
53
|
-
// Get current theme from DOM (set by inline script) or localStorage
|
|
54
53
|
let currentTheme = localStorage.getItem('theme') || 'light';
|
|
55
|
-
|
|
56
|
-
// Update icon initially
|
|
57
54
|
updateThemeIcon(currentTheme);
|
|
58
55
|
|
|
59
56
|
themeBtn.addEventListener('click', () => {
|
|
60
|
-
// Toggle theme
|
|
61
57
|
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
|
|
62
|
-
|
|
63
|
-
// Update DOM
|
|
64
58
|
document.documentElement.setAttribute('data-theme', newTheme);
|
|
65
59
|
localStorage.setItem('theme', newTheme);
|
|
66
|
-
|
|
67
|
-
// Update local state
|
|
68
60
|
currentTheme = newTheme;
|
|
69
61
|
updateThemeIcon(newTheme);
|
|
70
62
|
});
|
|
@@ -79,25 +71,19 @@ function updateThemeIcon(theme) {
|
|
|
79
71
|
}
|
|
80
72
|
}
|
|
81
73
|
|
|
82
|
-
// Extension Helpers
|
|
83
74
|
async function loadExtensionPath() {
|
|
84
75
|
try {
|
|
85
76
|
const res = await fetch('/api/extension-path');
|
|
86
77
|
const data = await res.json();
|
|
87
78
|
const input = document.getElementById('extension-path-input');
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
input.value =
|
|
91
|
-
} else {
|
|
92
|
-
input.value = "Error: Extension folder not found. Run 'npm run build' first.";
|
|
79
|
+
if (data.exists) input.value = data.path;
|
|
80
|
+
else {
|
|
81
|
+
input.value = "Error: Extension folder not found.";
|
|
93
82
|
input.style.color = "var(--ios-red)";
|
|
94
83
|
}
|
|
95
|
-
} catch (err) {
|
|
96
|
-
console.error('Failed to load extension path', err);
|
|
97
|
-
}
|
|
84
|
+
} catch (err) {}
|
|
98
85
|
}
|
|
99
86
|
|
|
100
|
-
// Expose extension handlers to window for onclick events
|
|
101
87
|
window.toggleExtensionGuide = function() {
|
|
102
88
|
const content = document.getElementById('extension-content');
|
|
103
89
|
const icon = document.getElementById('ext-toggle-icon');
|
|
@@ -110,12 +96,9 @@ window.copyExtensionPath = function(event) {
|
|
|
110
96
|
const btn = event.currentTarget;
|
|
111
97
|
const icon = document.getElementById('ext-copy-icon');
|
|
112
98
|
const text = document.getElementById('ext-copy-text');
|
|
113
|
-
|
|
114
99
|
navigator.clipboard.writeText(input.value).then(() => {
|
|
115
100
|
showCopiedState(btn, icon, text, '📋', 'Copy Path');
|
|
116
101
|
showToast('Đã copy đường dẫn extension', 'success');
|
|
117
|
-
}).catch(err => {
|
|
118
|
-
showToast('Lỗi copy: ' + err.message, 'error');
|
|
119
102
|
});
|
|
120
103
|
}
|
|
121
104
|
|
|
@@ -123,14 +106,9 @@ window.copyChromeUrl = function(event) {
|
|
|
123
106
|
const input = document.getElementById('chrome-url-input');
|
|
124
107
|
const btn = event.currentTarget;
|
|
125
108
|
const originalText = btn.innerHTML;
|
|
126
|
-
|
|
127
109
|
navigator.clipboard.writeText(input.value).then(() => {
|
|
128
110
|
btn.innerHTML = '✓';
|
|
129
111
|
showToast('Đã copy URL', 'success');
|
|
130
|
-
setTimeout(() =>
|
|
131
|
-
btn.innerHTML = originalText;
|
|
132
|
-
}, 1500);
|
|
133
|
-
}).catch(err => {
|
|
134
|
-
showToast('Lỗi copy: ' + err.message, 'error');
|
|
112
|
+
setTimeout(() => btn.innerHTML = originalText, 1500);
|
|
135
113
|
});
|
|
136
114
|
}
|
|
Binary file
|
|
Binary file
|
package/vg-coder-cli-2.0.11.tgz
DELETED
|
Binary file
|