vg-coder-cli 2.0.64 → 2.0.66

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vg-coder-cli",
3
- "version": "2.0.64",
3
+ "version": "2.0.66",
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": {
@@ -788,6 +788,36 @@ class ApiServer {
788
788
  } catch (e) { res.status(launcherErr(e)).json({ error: e.message }); }
789
789
  });
790
790
 
791
+ // Dump launcher SW state (chromeId source, tabs, storage, runtime info).
792
+ // Query: chromeId? | workerLabel? | (none → broadcast all launchers).
793
+ // Useful for diagnosing chromeId/profile mismatches.
794
+ this.app.get('/api/launcher/debug', async (req, res) => {
795
+ try {
796
+ const opts = launcherOpts({}, req.query) || { all: true };
797
+ const result = await taskQueue.requestLauncher('launcher:debug', {}, opts, 5_000);
798
+ res.json(result);
799
+ } catch (e) { res.status(launcherErr(e)).json({ error: e.message }); }
800
+ });
801
+
802
+ // Run a predefined chrome.* command inside the launcher SW. Manifest V3
803
+ // CSP forbids new Function() in service workers, so eval was replaced by
804
+ // a fixed command map. Body:
805
+ // { chromeId? | workerLabel?, cmd, args?, timeoutMs? }
806
+ // Available cmds (see launcher.ts execCommands):
807
+ // tabs.query | tabs.get | tabs.update | tabs.reload
808
+ // storage.sync.get | storage.sync.set | storage.local.get
809
+ // runtime.reload | windows.list | cookies.get
810
+ this.app.post('/api/launcher/exec', async (req, res) => {
811
+ try {
812
+ const body = req.body || {};
813
+ if (!body.cmd) return res.status(400).json({ error: 'cmd required' });
814
+ const opts = launcherOpts(body) || (body.all ? { all: true } : {});
815
+ const timeoutMs = Math.min(Math.max(parseInt(body.timeoutMs, 10) || 10_000, 1_000), 30_000);
816
+ const result = await taskQueue.requestLauncher('launcher:exec', { cmd: body.cmd, args: body.args }, opts, timeoutMs);
817
+ res.json(result);
818
+ } catch (e) { res.status(launcherErr(e)).json({ error: e.message }); }
819
+ });
820
+
791
821
  this.app.get('/api/worker/status', (req, res) => {
792
822
  const label = (req.query?.label || req.query?.workerLabel || '').toString().toLowerCase().trim();
793
823
  res.json(taskQueue.workerStatus(label || undefined));