vibeusage 0.2.11 → 0.2.12

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": "vibeusage",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Codex CLI token usage tracker (macOS-first, notify-driven).",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -51,6 +51,7 @@ const ASCII_LOGO = [
51
51
  ].join('\n');
52
52
 
53
53
  const DIVIDER = '----------------------------------------------';
54
+ const DEFAULT_DASHBOARD_URL = 'https://www.vibeusage.cc';
54
55
 
55
56
  async function cmdInit(argv) {
56
57
  const opts = parseArgs(argv);
@@ -69,7 +70,7 @@ async function cmdInit(argv) {
69
70
  let dashboardUrl = opts.dashboardUrl ||
70
71
  process.env.VIBEUSAGE_DASHBOARD_URL ||
71
72
  process.env.VIBESCORE_DASHBOARD_URL ||
72
- null;
73
+ DEFAULT_DASHBOARD_URL;
73
74
  const notifyPath = path.join(binDir, 'notify.cjs');
74
75
  const appDir = path.join(trackerDir, 'app');
75
76
  const trackerBinPath = path.join(appDir, 'bin', 'tracker.js');
@@ -140,7 +141,6 @@ async function cmdInit(argv) {
140
141
 
141
142
  if (setup.pendingBrowserAuth) {
142
143
  const deviceName = opts.deviceName || os.hostname();
143
- if (!dashboardUrl) dashboardUrl = await detectLocalDashboardUrl();
144
144
  const flow = await beginBrowserAuth({ baseUrl, dashboardUrl, timeoutMs: 10 * 60_000, open: false });
145
145
  const canAutoOpen = !opts.noOpen;
146
146
  renderAuthTransition({ authUrl: flow.authUrl, canAutoOpen });
@@ -157,7 +157,6 @@ async function cmdInit(argv) {
157
157
  const resolvedDashboardUrl = dashboardUrl || null;
158
158
  renderSuccessBox({ configPath, dashboardUrl: resolvedDashboardUrl });
159
159
  } else if (deviceToken) {
160
- if (!dashboardUrl) dashboardUrl = await detectLocalDashboardUrl();
161
160
  const resolvedDashboardUrl = dashboardUrl || null;
162
161
  renderSuccessBox({ configPath, dashboardUrl: resolvedDashboardUrl });
163
162
  } else {
@@ -686,35 +685,6 @@ function isSelfNotify(cmd) {
686
685
 
687
686
  module.exports = { cmdInit };
688
687
 
689
- async function detectLocalDashboardUrl() {
690
- // Dev-only convenience: prefer a local dashboard (if running) so the user sees our own UI first.
691
- // Vite defaults to 5173, but may auto-increment if the port is taken.
692
- const hosts = ['127.0.0.1', 'localhost'];
693
- const ports = [5173, 5174, 5175, 5176, 5177];
694
-
695
- for (const port of ports) {
696
- for (const host of hosts) {
697
- const base = `http://${host}:${port}`;
698
- const ok = await checkUrlReachable(base);
699
- if (ok) return base;
700
- }
701
- }
702
- return null;
703
- }
704
-
705
- async function checkUrlReachable(url) {
706
- const timeoutMs = 250;
707
- try {
708
- const controller = new AbortController();
709
- const t = setTimeout(() => controller.abort(), timeoutMs);
710
- const res = await fetch(url, { method: 'GET', signal: controller.signal });
711
- clearTimeout(t);
712
- return Boolean(res && res.ok);
713
- } catch (_e) {
714
- return false;
715
- }
716
- }
717
-
718
688
  async function probeFile(p) {
719
689
  try {
720
690
  const st = await fs.stat(p);