beads-ui 0.9.2 → 0.9.3

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/CHANGES.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changes
2
2
 
3
+ ## 0.9.3
4
+
5
+ - [`2e04bc1`](https://github.com/mantoni/beads-ui/commit/2e04bc1eeb5c43e6934d858cd017d80f745a38bb)
6
+ Add -v/—version flag to CLI (#46) (Brent Traut)
7
+
8
+ _Released by [Maximilian Antoni](https://github.com/mantoni) on 2026-01-23._
9
+
3
10
  ## 0.9.2
4
11
 
5
12
  - [`ffa376c`](https://github.com/mantoni/beads-ui/commit/ffa376cab432b0e321232e8bc0de2caca20a6b17)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beads-ui",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Local UI for Beads — Collaborate on issues with your coding agent.",
5
5
  "keywords": [
6
6
  "agent",
@@ -1,3 +1,4 @@
1
+ import { readFile } from 'node:fs/promises';
1
2
  import { enableAllDebug } from '../logging.js';
2
3
  import { handleRestart, handleStart, handleStop } from './commands.js';
3
4
  import { printUsage } from './usage.js';
@@ -30,6 +31,10 @@ export function parseArgs(args) {
30
31
  flags.push('open');
31
32
  continue;
32
33
  }
34
+ if (token === '--version' || token === '-v') {
35
+ flags.push('version');
36
+ continue;
37
+ }
33
38
  if (token === '--host' && i + 1 < args.length) {
34
39
  options.host = args[++i];
35
40
  continue;
@@ -54,6 +59,22 @@ export function parseArgs(args) {
54
59
  return { command, flags, options };
55
60
  }
56
61
 
62
+ /**
63
+ * Load the package.json version string.
64
+ *
65
+ * @returns {Promise<string>}
66
+ */
67
+ async function loadVersion() {
68
+ const package_url = new URL('../../package.json', import.meta.url);
69
+ const package_text = await readFile(package_url, 'utf8');
70
+ const package_data = JSON.parse(package_text);
71
+ const version = package_data.version;
72
+ if (typeof version !== 'string') {
73
+ throw new Error('Invalid package.json version');
74
+ }
75
+ return version;
76
+ }
77
+
57
78
  /**
58
79
  * CLI main entry. Returns an exit code and prints usage on `--help` or errors.
59
80
  * No side effects beyond invoking stub handlers.
@@ -69,6 +90,11 @@ export async function main(args) {
69
90
  enableAllDebug();
70
91
  }
71
92
 
93
+ if (flags.includes('version')) {
94
+ const version = await loadVersion();
95
+ process.stdout.write(`${version}\n`);
96
+ return 0;
97
+ }
72
98
  if (flags.includes('help')) {
73
99
  printUsage(process.stdout);
74
100
  return 0;
@@ -14,6 +14,7 @@ export function printUsage(out_stream) {
14
14
  '',
15
15
  'Options:',
16
16
  ' -h, --help Show this help message',
17
+ ' -v, --version Show the CLI version',
17
18
  ' -d, --debug Enable debug logging',
18
19
  ' --open Open the browser after start/restart',
19
20
  ' --host <addr> Bind to a specific host (default: 127.0.0.1)',