vg-coder-cli 2.0.50 β 2.0.52
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/INTEGRATION.md +27 -3
- package/README.md +18 -3
- package/dist/vg-coder-bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +3 -1
- package/src/server/api-server.js +14 -1
- package/src/server/views/js/main.js +13 -1
- package/src/server/views/vg-coder/background.js +59 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vg-coder-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.52",
|
|
4
4
|
"description": "π CLI tool to analyze projects, concatenate source files, count tokens, and export HTML with syntax highlighting and copy functionality",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
package/src/index.js
CHANGED
|
@@ -57,6 +57,7 @@ class VGCoderCLI {
|
|
|
57
57
|
.description('Khα»i Δα»ng API server')
|
|
58
58
|
.option('-p, --port <port>', 'Port cho server', '6868')
|
|
59
59
|
.option('--host <host>', 'Bind address (loopback mαΊ·c Δα»nh, set 0.0.0.0 Δα» LAN/Docker)', process.env.VG_HOST || '127.0.0.1')
|
|
60
|
+
.option('--worker', 'Worker-only mode: αΊ©n bubble + panel UI trΓͺn tab AI Studio, chα» chαΊ‘y task automation')
|
|
60
61
|
.action(this.handleStart.bind(this));
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -221,7 +222,7 @@ class VGCoderCLI {
|
|
|
221
222
|
|
|
222
223
|
console.log(chalk.blue('\nπ Starting VG Coder Server...'));
|
|
223
224
|
|
|
224
|
-
const server = new ApiServer(initialPort, options.host);
|
|
225
|
+
const server = new ApiServer(initialPort, options.host, { workerOnly: !!options.worker });
|
|
225
226
|
const lockAcquired = await projectManager.acquireLock(initialPort);
|
|
226
227
|
if (!lockAcquired) throw new Error('Failed to acquire leader lock');
|
|
227
228
|
|
|
@@ -235,6 +236,7 @@ class VGCoderCLI {
|
|
|
235
236
|
console.log(chalk.green('\nβ
Server is running!'));
|
|
236
237
|
console.log(chalk.cyan('ββββββββββββββββββββββββββββββββββββββββββββββββββ'));
|
|
237
238
|
console.log(`π‘ URL: http://localhost:${server.port}`);
|
|
239
|
+
if (options.worker) console.log(chalk.magenta('π€ Mode: worker-only (UI suppressed on AI Studio tab)'));
|
|
238
240
|
console.log(chalk.cyan('ββββββββββββββββββββββββββββββββββββββββββββββββββ'));
|
|
239
241
|
|
|
240
242
|
console.log(chalk.yellow('\nπ§© CHΖ―A CΓI EXTENSION?'));
|
package/src/server/api-server.js
CHANGED
|
@@ -22,9 +22,10 @@ const taskStore = require('./task-store');
|
|
|
22
22
|
const multer = require('multer');
|
|
23
23
|
|
|
24
24
|
class ApiServer {
|
|
25
|
-
constructor(port = 6868, host = process.env.VG_HOST || '127.0.0.1') {
|
|
25
|
+
constructor(port = 6868, host = process.env.VG_HOST || '127.0.0.1', opts = {}) {
|
|
26
26
|
this.port = port;
|
|
27
27
|
this.host = host;
|
|
28
|
+
this.workerOnly = !!opts.workerOnly;
|
|
28
29
|
this.app = express();
|
|
29
30
|
this.httpServer = http.createServer(this.app);
|
|
30
31
|
this.io = new Server(this.httpServer, { cors: { origin: "*" } });
|
|
@@ -53,6 +54,18 @@ class ApiServer {
|
|
|
53
54
|
this.app.use(bodyParser.json({ limit: '50mb' }));
|
|
54
55
|
this.app.use(bodyParser.urlencoded({ extended: true, limit: '50mb' }));
|
|
55
56
|
this.app.use(express.static(path.join(__dirname, 'views')));
|
|
57
|
+
// Worker-only mode: prepend a runtime flag to the bundle so the dashboard
|
|
58
|
+
// skips bubble + side panels and only starts the task-worker socket.
|
|
59
|
+
this.app.get('/dist/vg-coder-bundle.js', (req, res, next) => {
|
|
60
|
+
try {
|
|
61
|
+
const bundlePath = path.join(__dirname, '../../dist/vg-coder-bundle.js');
|
|
62
|
+
const body = fs.readFileSync(bundlePath, 'utf8');
|
|
63
|
+
const prefix = `window.__VG_WORKER_ONLY__ = ${this.workerOnly};\n`;
|
|
64
|
+
res.set('Content-Type', 'application/javascript').send(prefix + body);
|
|
65
|
+
} catch (err) {
|
|
66
|
+
next(err);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
56
69
|
this.app.use('/dist', express.static(path.join(__dirname, '../../dist')));
|
|
57
70
|
|
|
58
71
|
this.app.use((req, res, next) => {
|
|
@@ -25,9 +25,21 @@ export async function initMain() {
|
|
|
25
25
|
console.log('VG Coder: Starting Main Logic...');
|
|
26
26
|
|
|
27
27
|
try {
|
|
28
|
+
// Worker-only mode: server injected `window.__VG_WORKER_ONLY__=true`
|
|
29
|
+
// into the bundle (vg start --worker). Hide the shadow host so the
|
|
30
|
+
// bubble + dashboard don't render on top of the AI Studio page, and
|
|
31
|
+
// only boot the task-worker socket.
|
|
32
|
+
if (window.__VG_WORKER_ONLY__) {
|
|
33
|
+
console.log('VG Coder: Worker-only mode β UI suppressed, task worker only');
|
|
34
|
+
const host = document.getElementById('vg-coder-shadow-host');
|
|
35
|
+
if (host) host.style.display = 'none';
|
|
36
|
+
initTaskWorker();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
const promptEl = getById('prompt-text');
|
|
29
41
|
if (promptEl) promptEl.textContent = SYSTEM_PROMPT;
|
|
30
|
-
|
|
42
|
+
|
|
31
43
|
|
|
32
44
|
initTheme();
|
|
33
45
|
loadExtensionPath();
|