@yolo-labs/yolobridge 0.15.0 → 0.16.0

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/dist/cli.js +37 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -17,7 +17,8 @@
17
17
  * YOLOBRIDGE_AUTH_URL for local dev against a different environment.
18
18
  */
19
19
  import { fileURLToPath } from 'node:url';
20
- import { realpathSync } from 'node:fs';
20
+ import path from 'node:path';
21
+ import { realpathSync, existsSync, readFileSync } from 'node:fs';
21
22
  import { hostname } from 'node:os';
22
23
  import { runLogin } from './login-cmd.js';
23
24
  import { runAttachFromDisk, pickWorkspaceFromDisk } from './attach-cmd.js';
@@ -99,6 +100,7 @@ function printHelp() {
99
100
  ' that check entirely.',
100
101
  ' detach Detach the current workspace attachment.',
101
102
  ' status Print local login/attach state.',
103
+ ' version Print the installed yolo-bridge version (also --version, -v).',
102
104
  ' --help Print this help.',
103
105
  '',
104
106
  `API base: ${apiUrl()} (override: YOLOBRIDGE_API_URL)`,
@@ -559,6 +561,35 @@ async function cmdWorkspaces() {
559
561
  process.stdout.write(`${formatWorkspacesTable(result.workspaces)}\n`);
560
562
  return 0;
561
563
  }
564
+ /**
565
+ * This package's own version, read from the package.json that ships beside
566
+ * `dist/`.
567
+ *
568
+ * Resolved from `import.meta.url`, NOT `process.argv[1]`: the global install
569
+ * puts a symlink on PATH, and argv[1] is that symlink's unresolved path, so
570
+ * walking up from it lands outside the package. Same reasoning as
571
+ * `isMainModule` below.
572
+ *
573
+ * Returns `'unknown'` rather than throwing — a version probe must never be the
574
+ * thing that stops the CLI from starting.
575
+ */
576
+ export function readOwnVersion() {
577
+ try {
578
+ const here = path.dirname(fileURLToPath(import.meta.url));
579
+ // dist/cli.js -> package root. Walk up a couple of levels so this holds
580
+ // whether it is run from `dist/` or from a ts-node-style layout.
581
+ for (const rel of ['..', '../..']) {
582
+ const candidate = path.join(here, rel, 'package.json');
583
+ if (!existsSync(candidate))
584
+ continue;
585
+ const parsed = JSON.parse(readFileSync(candidate, 'utf-8'));
586
+ if (parsed.name === '@yolo-labs/yolobridge' && typeof parsed.version === 'string')
587
+ return parsed.version;
588
+ }
589
+ }
590
+ catch { /* fall through */ }
591
+ return 'unknown';
592
+ }
562
593
  async function main() {
563
594
  const [, , cmd, ...rest] = process.argv;
564
595
  switch (cmd) {
@@ -572,6 +603,11 @@ async function main() {
572
603
  return cmdDetach();
573
604
  case 'status':
574
605
  return cmdStatus();
606
+ case 'version':
607
+ case '--version':
608
+ case '-v':
609
+ process.stdout.write(`${readOwnVersion()}\n`);
610
+ return 0;
575
611
  case '--help':
576
612
  case '-h':
577
613
  case undefined:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-labs/yolobridge",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "YoloBridge — local coding-agent daemon that attaches a user's own Claude Code/Codex session to a YOLO Studio workspace as a first-class tile (docs/YOLOBRIDGE_PLAN.md, build-order Phase 5).",
5
5
  "license": "MIT",
6
6
  "type": "module",