vg-coder-cli 2.0.33 → 2.0.35

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.
@@ -8,10 +8,15 @@ import { initEditorTabs } from './features/editor-tabs.js';
8
8
  // REMOVED: initMonaco
9
9
  import { initResizeHandler } from './features/resize.js';
10
10
  import { initSavedCommands } from './features/commands.js';
11
- import { initProjectSwitcher } from './features/project-switcher.js';
12
11
  import './features/structure.js';
13
12
  import { initBubble } from './features/bubble.js';
14
13
 
14
+ // NEW: Import Tool Window modules
15
+ import { initToolWindow } from './features/tool-window.js';
16
+ import { initProjectPanel } from './features/project-panel.js';
17
+ import { initGitPanel } from './features/git-panel.js';
18
+ import { initCommandsPanel } from './features/commands-panel.js';
19
+
15
20
  export async function initMain() {
16
21
  console.log('VG Coder: Starting Main Logic...');
17
22
 
@@ -19,8 +24,6 @@ export async function initMain() {
19
24
  const promptEl = getById('prompt-text');
20
25
  if (promptEl) promptEl.textContent = SYSTEM_PROMPT;
21
26
 
22
- await checkServerStatus();
23
- await loadProjectInfo();
24
27
 
25
28
  initTheme();
26
29
  loadExtensionPath();
@@ -28,12 +31,18 @@ export async function initMain() {
28
31
  // Initialize event handlers FIRST (before bubble which dispatches events)
29
32
  initEventHandlers();
30
33
 
34
+ // NEW: Initialize Tool Window system
35
+ initToolWindow();
36
+ initProjectPanel();
37
+ initGitPanel();
38
+ initCommandsPanel();
39
+
31
40
  initGitView();
32
41
  initTerminal();
33
42
  initEditorTabs();
34
43
  initResizeHandler();
35
44
  initSavedCommands();
36
- await initProjectSwitcher();
45
+ // initProjectSwitcher(); // REMOVED: project-panel.js now handles project polling
37
46
 
38
47
  // Init Bubble (will use event protocol)
39
48
  initBubble();
@@ -44,11 +53,9 @@ export async function initMain() {
44
53
  }
45
54
  }
46
55
 
47
- // ... (Giữ nguyên các hàm helper khác: switchProject, loadProjectInfo, initTheme...)
48
56
  // Để ngắn gọn, tôi copy lại phần còn lại của main.js
49
57
  window.addEventListener('project-switched', async (event) => {
50
58
  const { projectId, projectName } = event.detail;
51
- await loadProjectInfo();
52
59
  if (window.updateTerminalVisibility) window.updateTerminalVisibility(projectId);
53
60
  if (window.loadSavedCommands) await window.loadSavedCommands();
54
61
  const treeContainer = getById('structure-tree');
@@ -57,31 +64,6 @@ window.addEventListener('project-switched', async (event) => {
57
64
  if (treeContent) treeContent.innerHTML = '';
58
65
  });
59
66
 
60
- async function checkServerStatus() {
61
- const statusEl = getById('status');
62
- if (!statusEl) return;
63
- const isHealthy = await checkHealth();
64
- if (isHealthy) {
65
- statusEl.textContent = '●';
66
- statusEl.style.background = 'transparent';
67
- statusEl.style.color = 'var(--ios-green)';
68
- } else {
69
- statusEl.textContent = '●';
70
- statusEl.style.background = 'transparent';
71
- statusEl.style.color = 'var(--ios-red)';
72
- }
73
- }
74
-
75
- async function loadProjectInfo() {
76
- try {
77
- const res = await fetch(`${API_BASE}/api/info?path=.`);
78
- const data = await res.json();
79
- const projectNameEl = getById('project-name');
80
- const projectMetaEl = getById('project-meta');
81
- if (projectNameEl) projectNameEl.textContent = data.path.split(/[\\/]/).pop();
82
- if (projectMetaEl) projectMetaEl.textContent = `${data.primaryType} • ${data.path}`;
83
- } catch (err) {}
84
- }
85
67
 
86
68
  function initTheme() {
87
69
  const themeBtn = getById('theme-toggle');