@hivefloor/cli 0.1.4 → 0.1.8

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 (55) hide show
  1. package/LICENSE +6 -20
  2. package/README.md +31 -9
  3. package/dist/chunk-2ERPDCOT.js +38 -0
  4. package/dist/chunk-4G362W6G.js +19 -0
  5. package/dist/chunk-5OJUJCE3.js +817 -0
  6. package/dist/chunk-5XXYQQG6.js +274 -0
  7. package/dist/chunk-AGIYVFDQ.js +10984 -0
  8. package/dist/{chunk-2BSA7LFD.js → chunk-BLLPDPTL.js} +7 -3
  9. package/dist/{chunk-R5KDI4WI.js → chunk-FPJNGKT5.js} +9 -3
  10. package/dist/chunk-HW3KRNCO.js +201 -0
  11. package/dist/{chunk-ZC2DAKB5.js → chunk-HWBUESB4.js} +1500 -316
  12. package/dist/{chunk-DNG5CRT3.js → chunk-K2IRTZH5.js} +8 -7
  13. package/dist/chunk-KQMPCV57.js +122 -0
  14. package/dist/{chunk-UJ4BQFWV.js → chunk-L6EFW2SJ.js} +53 -31
  15. package/dist/{chunk-T7TG6WA4.js → chunk-LX5A25O6.js} +4 -2
  16. package/dist/{chunk-W7DROKC7.js → chunk-MYJCU5JL.js} +89 -13
  17. package/dist/chunk-NMUH5NXN.js +52 -0
  18. package/dist/chunk-NRJONTFT.js +67 -0
  19. package/dist/chunk-QBBKGORP.js +327 -0
  20. package/dist/chunk-QGULSOQ2.js +142 -0
  21. package/dist/{chunk-PDXYOREI.js → chunk-QLMLB7RB.js} +110 -31
  22. package/dist/{chunk-TKMIV7BG.js → chunk-QPAFN47B.js} +3 -1
  23. package/dist/chunk-SBOEAOHD.js +48 -0
  24. package/dist/{chunk-SD65CIIY.js → chunk-TIR4CV3P.js} +117 -33
  25. package/dist/{chunk-QHYZBHXO.js → chunk-X2KH6AR4.js} +195 -251
  26. package/dist/chunk-XAXKZ572.js +106 -0
  27. package/dist/{chunk-VNCQFFQO.js → chunk-XPGL7VYE.js} +114 -1
  28. package/dist/cli-BFOJWJNG.js +279 -0
  29. package/dist/connect-ZJ4JXBAJ.js +27 -0
  30. package/dist/control-6GHTZQJV.js +25 -0
  31. package/dist/{disconnect-MKRHK4CX.js → disconnect-3T25NTKX.js} +55 -34
  32. package/dist/hook-TPSHBCWU.js +575 -0
  33. package/dist/index.js +9 -6
  34. package/dist/{link-HXBMMSG3.js → link-EAS5F5PC.js} +34 -18
  35. package/dist/{machine-connect-BYHZRRRB.js → machine-connect-KEI4BRWF.js} +30 -24
  36. package/dist/mcp-LVIYR3EN.js +1882 -0
  37. package/dist/orch-KVRL2YA2.js +137 -0
  38. package/dist/{run-336BSU72.js → run-JL2OZWK3.js} +1933 -29
  39. package/dist/{status-KBBSAADD.js → status-QXOOJGGN.js} +29 -14
  40. package/dist/token-BFWWQIDA.js +44 -0
  41. package/dist/voice-QXHFXRWG.js +264 -0
  42. package/dist/{where-KR7VWSEC.js → where-CMUORQIO.js} +20 -8
  43. package/package.json +6 -7
  44. package/dist/chunk-2IMJECYD.js +0 -71
  45. package/dist/chunk-7KF7IQJN.js +0 -30
  46. package/dist/chunk-GT3HFFT4.js +0 -132
  47. package/dist/chunk-JCLWCMEM.js +0 -8
  48. package/dist/chunk-K3NQKI34.js +0 -10
  49. package/dist/chunk-O2TC3WSS.js +0 -303
  50. package/dist/chunk-PY74LT2W.js +0 -41
  51. package/dist/cli-P3DYE5IR.js +0 -103
  52. package/dist/connect-ACNM5DQG.js +0 -23
  53. package/dist/hook-KR2HGVAR.js +0 -301
  54. package/dist/mcp-N2TMD4GR.js +0 -121
  55. package/dist/token-JDRLEV5D.js +0 -32
@@ -1,41 +1,55 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire as __hfCreateRequire } from 'node:module';
3
+ const require = __hfCreateRequire(import.meta.url);
2
4
  import {
3
5
  detectRepo
4
- } from "./chunk-2BSA7LFD.js";
6
+ } from "./chunk-BLLPDPTL.js";
5
7
  import {
6
8
  resolveSession
7
- } from "./chunk-7KF7IQJN.js";
8
- import "./chunk-2IMJECYD.js";
9
- import "./chunk-TKMIV7BG.js";
9
+ } from "./chunk-NMUH5NXN.js";
10
10
  import {
11
11
  SCHTASKS_TASK,
12
+ hostKey,
12
13
  readCredentials,
13
14
  windowsServiceStatus
14
- } from "./chunk-PDXYOREI.js";
15
+ } from "./chunk-QLMLB7RB.js";
16
+ import {
17
+ checkUnknownFlags
18
+ } from "./chunk-QPAFN47B.js";
15
19
  import {
16
20
  profileKeys
17
- } from "./chunk-UJ4BQFWV.js";
21
+ } from "./chunk-L6EFW2SJ.js";
18
22
  import {
19
23
  SERVICE_ALIVE_MS,
20
24
  readMachine,
21
25
  readServiceState
22
- } from "./chunk-T7TG6WA4.js";
26
+ } from "./chunk-LX5A25O6.js";
23
27
  import {
24
28
  apiRequest,
25
29
  errorOf
26
- } from "./chunk-PY74LT2W.js";
27
- import "./chunk-VNCQFFQO.js";
30
+ } from "./chunk-NRJONTFT.js";
31
+ import "./chunk-XAXKZ572.js";
32
+ import "./chunk-XPGL7VYE.js";
28
33
  import {
29
- cliNpxCommand,
30
34
  machineName,
31
35
  runCmd
32
- } from "./chunk-ZC2DAKB5.js";
33
- import "./chunk-K3NQKI34.js";
36
+ } from "./chunk-QGULSOQ2.js";
37
+ import {
38
+ cliNpxCommand
39
+ } from "./chunk-HWBUESB4.js";
40
+ import "./chunk-2ERPDCOT.js";
34
41
 
35
42
  // src/status.ts
36
43
  var str = (v) => typeof v === "string" ? v : void 0;
37
44
  var rec = (v) => typeof v === "object" && v !== null ? v : {};
45
+ var STATUS_FLAGS = /* @__PURE__ */ new Set(["host", "tool", "help", "h"]);
38
46
  async function status(ctx, p) {
47
+ const unknown = checkUnknownFlags(p, STATUS_FLAGS);
48
+ if (unknown) {
49
+ ctx.err(`hivefloor: unknown flag "--${unknown}". Run "hivefloor help".
50
+ `);
51
+ return 2;
52
+ }
39
53
  const machine = readMachine();
40
54
  if (machine) await machineStatus(ctx, machine);
41
55
  const s = await resolveSession(ctx, p);
@@ -50,7 +64,8 @@ async function status(ctx, p) {
50
64
  ctx.out(`Host: ${s.host}
51
65
  Machine: ${machineName()}
52
66
  `);
53
- const connected = Object.keys(readCredentials().hosts[s.host]?.tools ?? {});
67
+ const creds = readCredentials();
68
+ const connected = Object.keys(creds.hosts[hostKey(creds, s.host) ?? ""]?.tools ?? {});
54
69
  if (connected.length > 0) ctx.out(`Connected tools: ${connected.join(", ")}
55
70
  `);
56
71
  if (repo) ctx.out(`Repo here: ${repo.remote}${repo.branch ? ` (${repo.branch})` : ""}
@@ -59,7 +74,7 @@ Machine: ${machineName()}
59
74
  try {
60
75
  res = await apiRequest(ctx, s.host, "/api/v1/agent/whoami", { token: s.token, headers: repo ? { "x-hf-repo": repo.remote } : {}, timeoutMs: 8e3 });
61
76
  } catch (e) {
62
- ctx.err(`hivefloor: could not reach ${s.host}: ${e.message}
77
+ ctx.err(`hivefloor: ${e.message}
63
78
  `);
64
79
  return 1;
65
80
  }
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __hfCreateRequire } from 'node:module';
3
+ const require = __hfCreateRequire(import.meta.url);
4
+ import {
5
+ resolveSession
6
+ } from "./chunk-NMUH5NXN.js";
7
+ import "./chunk-QLMLB7RB.js";
8
+ import {
9
+ checkUnknownFlags
10
+ } from "./chunk-QPAFN47B.js";
11
+ import "./chunk-XAXKZ572.js";
12
+ import "./chunk-XPGL7VYE.js";
13
+ import "./chunk-QGULSOQ2.js";
14
+ import {
15
+ cliNpxCommand
16
+ } from "./chunk-HWBUESB4.js";
17
+ import "./chunk-2ERPDCOT.js";
18
+
19
+ // src/token.ts
20
+ var TOKEN_FLAGS = /* @__PURE__ */ new Set(["reveal", "host", "tool", "help", "h"]);
21
+ async function token(ctx, p) {
22
+ const unknown = checkUnknownFlags(p, TOKEN_FLAGS);
23
+ if (unknown) {
24
+ ctx.err(`hivefloor: unknown flag "--${unknown}". Run "hivefloor help".
25
+ `);
26
+ return 2;
27
+ }
28
+ const s = await resolveSession(ctx, p);
29
+ if (!s) {
30
+ ctx.err(`hivefloor: no token stored. Run: ${cliNpxCommand("connect")}
31
+ `);
32
+ return 1;
33
+ }
34
+ if (ctx.stdoutIsTTY && !p.flags.reveal) {
35
+ ctx.err("hivefloor: refusing to print the token to a terminal. Use it in a pipe or $(...), or pass --reveal.\n");
36
+ return 1;
37
+ }
38
+ ctx.out(`${s.token}
39
+ `);
40
+ return 0;
41
+ }
42
+ export {
43
+ token
44
+ };
@@ -0,0 +1,264 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __hfCreateRequire } from 'node:module';
3
+ const require = __hfCreateRequire(import.meta.url);
4
+ import {
5
+ checkUnknownFlags,
6
+ flagStr
7
+ } from "./chunk-QPAFN47B.js";
8
+ import {
9
+ KOKORO_VOICES,
10
+ KOKORO_VOICE_ID,
11
+ voiceFor
12
+ } from "./chunk-HWBUESB4.js";
13
+ import "./chunk-2ERPDCOT.js";
14
+
15
+ // src/voice/index.ts
16
+ import fs2 from "fs";
17
+ import path2 from "path";
18
+
19
+ // src/voice/talkback.ts
20
+ import net from "net";
21
+ import os from "os";
22
+ import path from "path";
23
+ import fs from "fs";
24
+ var TALKBACK_INSTALL_LINE = "claude plugin marketplace add Errr0rr404/talkback && claude plugin install talkback@talkback";
25
+ var SYNTH_MAX_CHARS = 2e3;
26
+ var MAX_WAV_BYTES = 64 * 1024 * 1024;
27
+ var VoiceError = class extends Error {
28
+ constructor(code, message) {
29
+ super(message);
30
+ this.code = code;
31
+ this.name = "VoiceError";
32
+ }
33
+ code;
34
+ };
35
+ var talkbackDir = (o = {}) => (o.env ?? process.env).TALKBACK_HOME || path.join(o.homeDir ?? os.homedir(), ".talkback");
36
+ function readEndpoint(o = {}) {
37
+ let raw;
38
+ try {
39
+ raw = fs.readFileSync(path.join(talkbackDir(o), "voiced.json"), "utf8");
40
+ } catch {
41
+ return void 0;
42
+ }
43
+ try {
44
+ const j = JSON.parse(raw);
45
+ if (typeof j.port === "number" && Number.isInteger(j.port) && j.port > 0 && j.port < 65536 && typeof j.token === "string" && j.token) return { port: j.port, token: j.token };
46
+ } catch {
47
+ }
48
+ return void 0;
49
+ }
50
+ function need(o) {
51
+ const ep = readEndpoint(o);
52
+ if (!ep) throw new VoiceError("not_installed", `TalkBack's voice is not set up here. Install it with:
53
+ ${TALKBACK_INSTALL_LINE}
54
+ then run /talkback on in Claude Code (the first session sets the voice up).`);
55
+ return ep;
56
+ }
57
+ function exchange(ep, req, o, parse) {
58
+ const timeoutMs = o.timeoutMs ?? 12e4;
59
+ return new Promise((resolve, reject) => {
60
+ const sock = net.connect({ host: "127.0.0.1", port: ep.port });
61
+ const chunks = [];
62
+ let size = 0;
63
+ let settled = false;
64
+ const finish = (err, buf) => {
65
+ if (settled) return;
66
+ settled = true;
67
+ clearTimeout(timer);
68
+ sock.destroy();
69
+ if (err) reject(err);
70
+ else resolve(buf ?? Buffer.alloc(0));
71
+ };
72
+ const timer = setTimeout(() => finish(new VoiceError("timeout", `TalkBack's voice did not answer within ${Math.round(timeoutMs / 1e3)} s.`)), timeoutMs);
73
+ sock.on("connect", () => sock.write(`${JSON.stringify({ ...req, token: ep.token })}
74
+ `));
75
+ sock.on("data", (d) => {
76
+ chunks.push(d);
77
+ size += d.length;
78
+ if (size > MAX_WAV_BYTES + 256) return finish(new VoiceError("protocol", "The voice daemon sent more data than a reply can hold."));
79
+ const buf = Buffer.concat(chunks);
80
+ let state;
81
+ try {
82
+ state = parse(buf);
83
+ } catch (e) {
84
+ return finish(e instanceof VoiceError ? e : new VoiceError("protocol", "Unreadable reply from the voice daemon."));
85
+ }
86
+ if (state === "done") finish(void 0, buf);
87
+ });
88
+ sock.on("end", () => {
89
+ const buf = Buffer.concat(chunks);
90
+ if (buf.length === 0) return finish(new VoiceError("no_reply", 'The voice daemon closed the connection without an answer (an old TalkBack that lacks "synth", or it was restarted). Update TalkBack and try again.'));
91
+ let state = "more";
92
+ try {
93
+ state = parse(buf);
94
+ } catch (e) {
95
+ return finish(e instanceof VoiceError ? e : new VoiceError("protocol", "Unreadable reply from the voice daemon."));
96
+ }
97
+ if (state === "done") finish(void 0, buf);
98
+ else finish(new VoiceError("protocol", "The voice daemon closed the connection before the reply was complete."));
99
+ });
100
+ sock.on("error", (e) => finish(new VoiceError("unreachable", `TalkBack's voice is not reachable on 127.0.0.1:${ep.port} (${e.code ?? "error"}). Start a Claude Code session with TalkBack on, or run /talkback status.`)));
101
+ });
102
+ }
103
+ async function ping(o = {}) {
104
+ const ep = need(o);
105
+ const buf = await exchange(ep, { cmd: "ping" }, { timeoutMs: 5e3, ...o }, (b) => b.includes(10) ? "done" : "more");
106
+ const line = buf.subarray(0, buf.indexOf(10)).toString("utf8").trim();
107
+ const m = /^pong (\S+) (\S+) (\S+)$/.exec(line);
108
+ if (!m) throw new VoiceError("protocol", "The daemon at the TalkBack port did not answer like TalkBack.");
109
+ return { engine: m[1], version: m[2], player: m[3] };
110
+ }
111
+ async function synthToWav(text, voice2, speed, o = {}) {
112
+ if (!text.trim()) throw new VoiceError("empty", "Nothing to say: the text is empty.");
113
+ if (text.length > SYNTH_MAX_CHARS) throw new VoiceError("too_long", `The text is ${text.length} characters; the voice takes at most ${SYNTH_MAX_CHARS}.`);
114
+ const ep = need(o);
115
+ const req = { cmd: "synth", text };
116
+ if (voice2 !== void 0) req.voice = voice2;
117
+ if (speed !== void 0) req.speed = speed;
118
+ let header;
119
+ const buf = await exchange(ep, req, o, (b) => {
120
+ if (!header) {
121
+ const nl = b.indexOf(10);
122
+ if (nl < 0) return b.length > 512 ? fail("protocol", "Unreadable reply from the voice daemon.") : "more";
123
+ const line = b.subarray(0, nl).toString("utf8").trim();
124
+ const ok = /^ok (\d+) (\d+) wav$/.exec(line);
125
+ if (!ok) {
126
+ const err = /^err (\S+)(?: (.{0,200}))?$/.exec(line);
127
+ if (err?.[1] === "empty") throw new VoiceError("empty", "Nothing to say: the text is empty.");
128
+ if (err?.[1] === "too_long") throw new VoiceError("too_long", `The voice refused the text as too long (over ${SYNTH_MAX_CHARS} characters).`);
129
+ if (err?.[1] === "engine") throw new VoiceError("engine", `The voice engine failed${err[2] ? `: ${err[2]}` : "."}`);
130
+ return fail("protocol", "The daemon at the TalkBack port did not answer like TalkBack.");
131
+ }
132
+ const n = Number(ok[1]);
133
+ if (!Number.isSafeInteger(n) || n < 44 || n > MAX_WAV_BYTES) return fail("protocol", "The voice daemon announced an audio size that is not a WAV reply.");
134
+ if (ok[2] !== "24000") return fail("protocol", `The voice daemon sent ${ok[2]} Hz audio; 24000 Hz was expected.`);
135
+ header = { end: nl + 1, n };
136
+ }
137
+ return b.length >= header.end + header.n ? "done" : "more";
138
+ });
139
+ if (!header) throw new VoiceError("protocol", "Unreadable reply from the voice daemon.");
140
+ const wav = buf.subarray(header.end, header.end + header.n);
141
+ if (wav.length !== header.n || wav.toString("latin1", 0, 4) !== "RIFF" || wav.toString("latin1", 8, 12) !== "WAVE") throw new VoiceError("protocol", "The voice daemon sent audio that is not a WAV file.");
142
+ return Buffer.from(wav);
143
+ }
144
+ function fail(code, message) {
145
+ throw new VoiceError(code, message);
146
+ }
147
+
148
+ // src/voice/index.ts
149
+ var SAY_FLAGS = /* @__PURE__ */ new Set(["out", "voice", "speed", "agent-id", "help", "h"]);
150
+ var LIST_FLAGS = /* @__PURE__ */ new Set(["agent-id", "help", "h"]);
151
+ var USAGE = 'usage: hivefloor voice status | hivefloor voice list [--agent-id ID] | hivefloor voice say "<text>" --out file.wav [--voice ID | --agent-id AGENT_ID] [--speed N]\n';
152
+ async function voice(ctx, p) {
153
+ const sub = p.positionals[0];
154
+ const opts = { env: ctx.env };
155
+ if (sub === "list") {
156
+ const unknown = checkUnknownFlags(p, LIST_FLAGS);
157
+ if (unknown || p.positionals.length > 1 || p.flags["agent-id"] === true) {
158
+ ctx.err(unknown ? `hivefloor: unknown flag "--${unknown}". Run "hivefloor voice --help".
159
+ ` : USAGE);
160
+ return 2;
161
+ }
162
+ const agent = flagStr(p, "agent-id");
163
+ if (agent !== void 0) {
164
+ const v = voiceFor(agent);
165
+ ctx.out(`agent ${agent}: ${v.voice} at ${v.speed}x
166
+ `);
167
+ return 0;
168
+ }
169
+ const american = KOKORO_VOICES.filter((id) => id.startsWith("a"));
170
+ const british = KOKORO_VOICES.filter((id) => id.startsWith("b"));
171
+ ctx.out(`American English
172
+ ${american.join("\n")}
173
+ British English
174
+ ${british.join("\n")}
175
+ `);
176
+ return 0;
177
+ }
178
+ if (sub === "status") {
179
+ const unknown = checkUnknownFlags(p, /* @__PURE__ */ new Set(["help", "h"]));
180
+ if (unknown || p.positionals.length > 1) {
181
+ ctx.err(unknown ? `hivefloor: unknown flag "--${unknown}". Run "hivefloor voice --help".
182
+ ` : USAGE);
183
+ return 2;
184
+ }
185
+ try {
186
+ const r = await ping(opts);
187
+ ctx.out(`TalkBack voice: running (engine ${r.engine}, version ${r.version}, player ${r.player})
188
+ `);
189
+ return 0;
190
+ } catch (e) {
191
+ return fail2(ctx, e);
192
+ }
193
+ }
194
+ if (sub === "say") {
195
+ const unknown = checkUnknownFlags(p, SAY_FLAGS);
196
+ if (unknown) {
197
+ ctx.err(`hivefloor: unknown flag "--${unknown}". Run "hivefloor voice --help".
198
+ `);
199
+ return 2;
200
+ }
201
+ const text = p.positionals.slice(1).join(" ");
202
+ const out = flagStr(p, "out");
203
+ if (!text.trim() || !out) {
204
+ ctx.err(USAGE);
205
+ return 2;
206
+ }
207
+ let voiceId = flagStr(p, "voice");
208
+ let speed;
209
+ if (p.flags.voice === true || p.flags.speed === true || p.flags["agent-id"] === true) {
210
+ ctx.err("hivefloor: --voice, --speed and --agent-id each need a value.\n");
211
+ return 2;
212
+ }
213
+ const agent = flagStr(p, "agent-id");
214
+ if (agent !== void 0) {
215
+ const v = voiceFor(agent);
216
+ voiceId ??= v.voice;
217
+ speed = v.speed;
218
+ }
219
+ if (voiceId !== void 0 && !KOKORO_VOICE_ID.test(voiceId)) {
220
+ ctx.err(`hivefloor: "${voiceId}" is not a voice id (for example af_heart or bf_emma).
221
+ `);
222
+ return 2;
223
+ }
224
+ const sp = flagStr(p, "speed");
225
+ if (sp !== void 0) {
226
+ speed = Number(sp);
227
+ if (!Number.isFinite(speed) || speed < 0.5 || speed > 2) {
228
+ ctx.err("hivefloor: --speed must be a number from 0.5 to 2.\n");
229
+ return 2;
230
+ }
231
+ }
232
+ try {
233
+ const wav = await synthToWav(text, voiceId, speed, opts);
234
+ const file = path2.resolve(ctx.cwd, out);
235
+ fs2.writeFileSync(file, wav);
236
+ ctx.out(`Wrote ${file} (${wav.length} bytes, 24 kHz mono WAV)
237
+ `);
238
+ return 0;
239
+ } catch (e) {
240
+ return fail2(ctx, e);
241
+ }
242
+ }
243
+ ctx.err(USAGE);
244
+ return 2;
245
+ }
246
+ function fail2(ctx, e) {
247
+ if (e instanceof VoiceError) {
248
+ ctx.err(`hivefloor: ${e.message}
249
+ `);
250
+ return e.code === "empty" || e.code === "too_long" ? 2 : 1;
251
+ }
252
+ ctx.err(`hivefloor: ${e.message}
253
+ `);
254
+ return 1;
255
+ }
256
+ export {
257
+ SYNTH_MAX_CHARS,
258
+ TALKBACK_INSTALL_LINE,
259
+ VoiceError,
260
+ ping,
261
+ readEndpoint,
262
+ synthToWav,
263
+ voice
264
+ };
@@ -1,24 +1,36 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire as __hfCreateRequire } from 'node:module';
3
+ const require = __hfCreateRequire(import.meta.url);
2
4
  import {
3
5
  resolveSession
4
- } from "./chunk-7KF7IQJN.js";
5
- import "./chunk-2IMJECYD.js";
6
- import "./chunk-TKMIV7BG.js";
7
- import "./chunk-PDXYOREI.js";
6
+ } from "./chunk-NMUH5NXN.js";
7
+ import "./chunk-QLMLB7RB.js";
8
+ import {
9
+ checkUnknownFlags
10
+ } from "./chunk-QPAFN47B.js";
8
11
  import {
9
12
  apiRequest,
10
13
  errorOf
11
- } from "./chunk-PY74LT2W.js";
12
- import "./chunk-VNCQFFQO.js";
14
+ } from "./chunk-NRJONTFT.js";
15
+ import "./chunk-XAXKZ572.js";
16
+ import "./chunk-XPGL7VYE.js";
17
+ import "./chunk-QGULSOQ2.js";
13
18
  import {
14
19
  cliNpxCommand,
15
20
  routeProviderFromParam,
16
21
  usageRouteSchema
17
- } from "./chunk-ZC2DAKB5.js";
18
- import "./chunk-K3NQKI34.js";
22
+ } from "./chunk-HWBUESB4.js";
23
+ import "./chunk-2ERPDCOT.js";
19
24
 
20
25
  // src/where.ts
26
+ var WHERE_FLAGS = /* @__PURE__ */ new Set(["json", "host", "tool", "help", "h"]);
21
27
  async function where(ctx, p) {
28
+ const unknown = checkUnknownFlags(p, WHERE_FLAGS);
29
+ if (unknown) {
30
+ ctx.err(`hivefloor: unknown flag "--${unknown}". Run "hivefloor help".
31
+ `);
32
+ return 2;
33
+ }
22
34
  const arg = p.positionals[0];
23
35
  if (arg !== void 0 && routeProviderFromParam(arg) === null) {
24
36
  ctx.err(`hivefloor: "${arg}" is not a tool or provider. Try: ${cliNpxCommand("where claude")}
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@hivefloor/cli",
3
- "version": "0.1.4",
4
- "description": "Connect your coding agents (Claude Code, Codex, Cursor, Gemini, Grok) to Hivefloor: live presence, task coordination and usage on one floor.",
3
+ "version": "0.1.8",
4
+ "description": "Connect your coding agents (Claude Code, Codex, Cursor, Gemini, Grok) to HiveFloor: live presence, task coordination and usage on one floor.",
5
5
  "author": {
6
- "name": "Errr0rr404",
6
+ "name": "Zan",
7
7
  "url": "https://github.com/Errr0rr404"
8
8
  },
9
9
  "keywords": [
@@ -18,14 +18,13 @@
18
18
  ],
19
19
  "homepage": "https://hivefloor.worldofz.info",
20
20
  "bugs": {
21
- "url": "https://github.com/Errr0rr404/hivefloor/issues"
21
+ "url": "https://github.com/Errr0rr404/hivefloor-cli/issues"
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
25
- "url": "git+https://github.com/Errr0rr404/hivefloor.git",
26
- "directory": "packages/cli"
25
+ "url": "git+https://github.com/Errr0rr404/hivefloor-cli.git"
27
26
  },
28
- "license": "MIT",
27
+ "license": "UNLICENSED",
29
28
  "type": "module",
30
29
  "bin": {
31
30
  "hivefloor": "dist/index.js"
@@ -1,71 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/tools.ts
4
- import fs from "fs";
5
- import path from "path";
6
- var REAL_TOOLS = ["claude", "codex", "cursor", "gemini", "grok"];
7
- var TOOL_LABEL = {
8
- claude: "Claude Code",
9
- codex: "Codex",
10
- cursor: "Cursor",
11
- gemini: "Gemini CLI",
12
- grok: "Grok CLI",
13
- other: "Other"
14
- };
15
- var BINARIES = {
16
- claude: ["claude"],
17
- codex: ["codex"],
18
- cursor: ["cursor-agent", "agent"],
19
- gemini: ["gemini"],
20
- grok: ["grok"]
21
- };
22
- function isTool(s) {
23
- return s === "other" || REAL_TOOLS.includes(s);
24
- }
25
- function findBin(name, env) {
26
- const exts = process.platform === "win32" ? ["", ".exe", ".cmd", ".bat"] : [""];
27
- for (const dir of (env.PATH ?? "").split(path.delimiter)) {
28
- if (!dir) continue;
29
- for (const ext of exts) {
30
- const p = path.join(dir, name + ext);
31
- try {
32
- if (fs.statSync(p).isFile()) {
33
- fs.accessSync(p, fs.constants.X_OK);
34
- return p;
35
- }
36
- } catch {
37
- }
38
- }
39
- }
40
- return void 0;
41
- }
42
- function detectTools(env) {
43
- const found = [];
44
- for (const tool of REAL_TOOLS) {
45
- for (const name of BINARIES[tool]) {
46
- const bin = findBin(name, env);
47
- if (bin) {
48
- found.push({ tool, bin });
49
- break;
50
- }
51
- }
52
- }
53
- return found;
54
- }
55
- function toolFromEnv(env) {
56
- if (env.GROK_SESSION_ID) return "grok";
57
- if (env.CLAUDECODE || env.CLAUDE_CODE_ENTRYPOINT) return "claude";
58
- if (env.CODEX_SANDBOX || env.CODEX_SESSION_ID || env.CODEX_THREAD_ID || env.CODEX_CI) return "codex";
59
- if (env.CURSOR_AGENT || env.CURSOR_TRACE_ID || env.CURSOR_SESSION_ID) return "cursor";
60
- if (env.GEMINI_CLI || env.GEMINI_SESSION_ID) return "gemini";
61
- return void 0;
62
- }
63
-
64
- export {
65
- REAL_TOOLS,
66
- TOOL_LABEL,
67
- isTool,
68
- findBin,
69
- detectTools,
70
- toolFromEnv
71
- };
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- isTool
4
- } from "./chunk-2IMJECYD.js";
5
- import {
6
- flagStr
7
- } from "./chunk-TKMIV7BG.js";
8
- import {
9
- defaultHost,
10
- loadToken
11
- } from "./chunk-PDXYOREI.js";
12
- import {
13
- hostFromEnv,
14
- normalizeHost
15
- } from "./chunk-ZC2DAKB5.js";
16
-
17
- // src/session.ts
18
- async function resolveSession(ctx, p) {
19
- const flagHost = flagStr(p, "host");
20
- const host = flagHost ? normalizeHost(flagHost) : ctx.env.HIVEFLOOR_URL ? hostFromEnv(ctx.env) : defaultHost() ?? hostFromEnv(ctx.env);
21
- const toolFlag = flagStr(p, "tool");
22
- const t = await loadToken(host, toolFlag && isTool(toolFlag) ? toolFlag : void 0);
23
- if (t) return { host, token: t.token, tool: t.tool };
24
- if (ctx.env.HIVEFLOOR_TOKEN) return { host, token: ctx.env.HIVEFLOOR_TOKEN, tool: toolFlag ?? "other" };
25
- return void 0;
26
- }
27
-
28
- export {
29
- resolveSession
30
- };