opencode-statboard 2.10.7 → 2.10.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tui-dashboard.js +19 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-statboard",
3
- "version": "2.10.7",
3
+ "version": "2.10.9",
4
4
  "description": "Real-time dashboard for opencode token usage and cost statistics",
5
5
  "main": "server.js",
6
6
  "bin": {
package/tui-dashboard.js CHANGED
@@ -398,8 +398,13 @@ class TUIServer {
398
398
 
399
399
  openWeb() {
400
400
  const url = 'http://' + this.host + ':' + this.port;
401
- const opener = process.platform === 'win32' ? 'start' : process.platform === 'darwin' ? 'open' : 'xdg-open';
402
- spawn(opener, [url], { detached: true, stdio: 'ignore' }).unref();
401
+ if (process.platform === 'win32') {
402
+ spawn('cmd', ['/c', 'start', '""', url], { detached: true, stdio: 'ignore' }).unref();
403
+ } else if (process.platform === 'darwin') {
404
+ spawn('open', [url], { detached: true, stdio: 'ignore' }).unref();
405
+ } else {
406
+ spawn('xdg-open', [url], { detached: true, stdio: 'ignore' }).unref();
407
+ }
403
408
  }
404
409
 
405
410
  getContentWidth() {
@@ -436,6 +441,15 @@ class TUIServer {
436
441
  }
437
442
  }
438
443
 
444
+ fillScreen(lines) {
445
+ const height = this.getContentHeight();
446
+ const width = this.getContentWidth();
447
+ const contentWidth = width - 2; // account for borders
448
+ const contentHeight = height - 2;
449
+ while (lines.length < contentHeight) lines.push('');
450
+ return lines.map(l => l.padEnd(contentWidth)).join('\n');
451
+ }
452
+
439
453
  renderOverview() {
440
454
  const ov = this.data;
441
455
  const t = this.t.bind(this);
@@ -467,7 +481,7 @@ class TUIServer {
467
481
  '{bold}' + t('avgCostDay') + ':{/bold} ' + this.formatCost(cost.avgCostPerDay || 0),
468
482
  '{bold}' + t('avgTokensDay') + ':{/bold} ' + this.formatNumber(cost.avgTokensPerDay || 0)
469
483
  ];
470
- return lines.join('\n');
484
+ return this.fillScreen(lines);
471
485
  }
472
486
 
473
487
  renderProjects() {
@@ -496,7 +510,7 @@ class TUIServer {
496
510
  lines.push('{gray}... ' + t('noData') + ' ' + (projects.length - 50) + ' ' + t('projects') + '{/gray}');
497
511
  }
498
512
 
499
- return lines.join('\n');
513
+ return this.fillScreen(lines);
500
514
  }
501
515
 
502
516
  renderModels() {
@@ -522,7 +536,7 @@ class TUIServer {
522
536
  lines.push(namePad + ' ' + provPad + ' ' + tokPad + ' ' + costPad + ' ' + speedPad);
523
537
  }
524
538
 
525
- return lines.join('\n');
539
+ return this.fillScreen(lines);
526
540
  }
527
541
 
528
542
  renderTrend() {