OverviewFilesCommitsIssuesDocsReleasesPeers

keet-cli commits / 69eed73

Migrate CLI to bare args for pear-runtime compatibility
- Parse args from Bare.argv when Pear global not available - Update help text and error messages to show `bare index.js` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
69eed73dd6b464fe75468fd6736f7bc27843666e
by plankatron <fleeky@gmail.com> · 2026-02-20T23:38:09.000Z

Changed files (1) +12 -8

index.js +12 -8
……@@ -6,7 +6,10 @@ import os from 'os'
66import { getGenericEventName } from 'keet-daemon/lib/format.js'
77
88// --- Parse Args ---
9const rawArgs = Pear.config.args || []
9// Dual-mode: works under pear run (Pear.config.args) or bare (Bare.argv)
10const rawArgs = (typeof Pear !== 'undefined' && Pear.config.args)
11 ? Pear.config.args
12 : Bare.argv.slice(2)
1013
1114let customStorage = null
1215let customSocket = null
……@@ -43,7 +46,8 @@ function printHelp () {
4346 console.log(`
4447keet-cli — Headless Keet P2P chat client (daemon + thin client)
4548
46Usage: pear run --dev . [options] <command> [args...]
49Usage: bare index.js [options] <command> [args...]
50 pear run --dev . [options] <command> [args...]
4751
4852Options:
4953 --profile <name> Use named profile (each profile = separate identity)
……@@ -103,12 +107,12 @@ System:
103107
104108Quick Start:
105109 # Terminal 1: start daemon
106 pear run --dev . daemon
110 bare index.js daemon
107111
108112 # Terminal 2: use CLI
109 pear run --dev . rooms
110 pear run --dev . send abc123 "Hello!"
111 pear run --dev . watch abc123
113 bare index.js rooms
114 bare index.js send abc123 "Hello!"
115 bare index.js watch abc123
112116`)
113117 Bare.exit(0)
114118}
……@@ -279,7 +283,7 @@ try {
279283 }
280284} catch (err) {
281285 if (err.code === 'ENOENT' || err.message.includes('ENOENT')) {
282 console.error('[keet-cli] Daemon not running. Start with: pear run --dev . daemon')
286 console.error('[keet-cli] Daemon not running. Start with: bare index.js daemon')
283287 } else {
284288 console.error('[keet-cli] Error:', err.message || err)
285289 }
……@@ -521,7 +525,7 @@ async function clientWatch (roomId) {
521525
522526 pipe.on('error', (err) => {
523527 if (err.code === 'ENOENT') {
524 console.error('[keet-cli] Daemon not running. Start with: pear run --dev . daemon')
528 console.error('[keet-cli] Daemon not running. Start with: bare index.js daemon')
525529 } else {
526530 console.error('[keet-cli] Connection error:', err.message)
527531 }