@hivefloor/cli 0.1.0 → 0.1.2

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 (31) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/dist/{chunk-4A5WOW2D.js → chunk-DQV6FAJU.js} +2 -2
  4. package/dist/{chunk-BAB4DPCN.js → chunk-DWHMBUCA.js} +2 -2
  5. package/dist/{chunk-M3PLXINO.js → chunk-E4V47VEV.js} +3 -9
  6. package/dist/{chunk-UPRHMVYJ.js → chunk-HT5KXWXM.js} +1 -1
  7. package/dist/{chunk-IEYWMDXA.js → chunk-LF2NWQ4B.js} +8 -3
  8. package/dist/{chunk-DIW4VIU7.js → chunk-NKMVO5BP.js} +4 -10
  9. package/dist/{chunk-LHF4KCEA.js → chunk-NLZXB26Y.js} +2 -2
  10. package/dist/{chunk-SGDM7MAT.js → chunk-O2TC3WSS.js} +68 -2
  11. package/dist/{chunk-6UZBZ7LR.js → chunk-O6VSA2JT.js} +4 -3
  12. package/dist/{chunk-4OFN5KHY.js → chunk-OOMBZN4M.js} +13 -13
  13. package/dist/{chunk-3IMV5EHP.js → chunk-T7TG6WA4.js} +1 -1
  14. package/dist/{chunk-RE2EQZWL.js → chunk-TH4ANHSG.js} +394 -198
  15. package/dist/{chunk-WNDUGQDX.js → chunk-VNCQFFQO.js} +8 -0
  16. package/dist/{chunk-OQ6QVFSH.js → chunk-YRNMECUF.js} +1 -1
  17. package/dist/{cli-7CIYC6A3.js → cli-F3F7SQLV.js} +13 -10
  18. package/dist/connect-TG2H5SMB.js +23 -0
  19. package/dist/{disconnect-NRYU6W5P.js → disconnect-FI76IEZJ.js} +10 -10
  20. package/dist/{hook-B2I42GE3.js → hook-N4ZTQEWM.js} +53 -19
  21. package/dist/index.js +2 -2
  22. package/dist/{link-EPWADGYT.js → link-JX4YLF2Z.js} +9 -9
  23. package/dist/{machine-connect-RWNZ77NO.js → machine-connect-NOQ3VZOO.js} +24 -24
  24. package/dist/{mcp-QX6VMTOD.js → mcp-EUBTVJNX.js} +7 -7
  25. package/dist/run-CKNHDPNX.js +1883 -0
  26. package/dist/{status-HADESN2E.js → status-SMAVPW4D.js} +14 -14
  27. package/dist/{token-SM5MDJKY.js → token-AUEAWQDH.js} +4 -4
  28. package/dist/where-7NI7UEEF.js +70 -0
  29. package/package.json +7 -3
  30. package/dist/connect-R3PMIY7G.js +0 -23
  31. package/dist/run-64ZYCJU2.js +0 -629
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Validate-QA
3
+ Copyright (c) 2026 Errr0rr404
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -71,7 +71,7 @@ The machine token stays on your computer (the file above, or the OS keychain in
71
71
 
72
72
  ## Links
73
73
 
74
- - Source and issues: https://github.com/Validate-QA/hivefloor
74
+ - Source and issues: https://github.com/Errr0rr404/hivefloor
75
75
  - Docs: https://hivefloor.worldofz.info
76
76
 
77
77
  MIT License.
@@ -8,11 +8,11 @@ import {
8
8
  isRecord,
9
9
  readText,
10
10
  removeFile
11
- } from "./chunk-WNDUGQDX.js";
11
+ } from "./chunk-VNCQFFQO.js";
12
12
  import {
13
13
  cliNpxCommand,
14
14
  runCmd
15
- } from "./chunk-RE2EQZWL.js";
15
+ } from "./chunk-TH4ANHSG.js";
16
16
 
17
17
  // src/service/units.ts
18
18
  import os from "os";
@@ -8,11 +8,11 @@ import {
8
8
  import {
9
9
  defaultHost,
10
10
  loadToken
11
- } from "./chunk-4A5WOW2D.js";
11
+ } from "./chunk-DQV6FAJU.js";
12
12
  import {
13
13
  hostFromEnv,
14
14
  normalizeHost
15
- } from "./chunk-RE2EQZWL.js";
15
+ } from "./chunk-TH4ANHSG.js";
16
16
 
17
17
  // src/session.ts
18
18
  async function resolveSession(ctx, p) {
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  home,
4
+ isDir,
4
5
  isRecord,
5
6
  readText
6
- } from "./chunk-WNDUGQDX.js";
7
+ } from "./chunk-VNCQFFQO.js";
7
8
  import {
8
9
  PROFILE_KEY_RE
9
- } from "./chunk-RE2EQZWL.js";
10
+ } from "./chunk-TH4ANHSG.js";
10
11
 
11
12
  // src/profiles.ts
12
13
  import fs from "fs";
@@ -54,13 +55,6 @@ function claudeDirsFromRc(homeDir = home()) {
54
55
  }
55
56
  return found;
56
57
  }
57
- function isDir(p) {
58
- try {
59
- return fs.statSync(p).isDirectory();
60
- } catch {
61
- return false;
62
- }
63
- }
64
58
  function readText0(file) {
65
59
  try {
66
60
  return readText(file);
@@ -8,7 +8,7 @@ import {
8
8
  deviceCodeResponseSchema,
9
9
  deviceTokenErrorSchema,
10
10
  deviceTokenSuccessSchema
11
- } from "./chunk-RE2EQZWL.js";
11
+ } from "./chunk-TH4ANHSG.js";
12
12
 
13
13
  // src/device.ts
14
14
  var printable = (s) => [...s].filter((c) => c.charCodeAt(0) >= 32 && c.charCodeAt(0) !== 127).join("");
@@ -3,8 +3,12 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@hivefloor/cli",
6
- version: "0.1.0",
6
+ version: "0.1.2",
7
7
  description: "Connect your coding agents (Claude Code, Codex, Cursor, Gemini, Grok) to Hivefloor: live presence, task coordination and usage on one floor.",
8
+ author: {
9
+ name: "Errr0rr404",
10
+ url: "https://github.com/Errr0rr404"
11
+ },
8
12
  keywords: [
9
13
  "hivefloor",
10
14
  "ai-agents",
@@ -17,11 +21,11 @@ var package_default = {
17
21
  ],
18
22
  homepage: "https://hivefloor.worldofz.info",
19
23
  bugs: {
20
- url: "https://github.com/Validate-QA/hivefloor/issues"
24
+ url: "https://github.com/Errr0rr404/hivefloor/issues"
21
25
  },
22
26
  repository: {
23
27
  type: "git",
24
- url: "git+https://github.com/Validate-QA/hivefloor.git",
28
+ url: "git+https://github.com/Errr0rr404/hivefloor.git",
25
29
  directory: "packages/cli"
26
30
  },
27
31
  license: "MIT",
@@ -47,6 +51,7 @@ var package_default = {
47
51
  },
48
52
  devDependencies: {
49
53
  "@hivefloor/shared": "workspace:*",
54
+ "@hivefloor/usage": "workspace:*",
50
55
  "@types/node": "^22.20.5",
51
56
  tsup: "^8.5.1",
52
57
  typescript: "~5.9.3"
@@ -10,21 +10,22 @@ import {
10
10
  removeHooks,
11
11
  restoreFeatureHooks,
12
12
  wasCreated
13
- } from "./chunk-LHF4KCEA.js";
13
+ } from "./chunk-NLZXB26Y.js";
14
14
  import {
15
15
  claudeConfigDirs,
16
16
  codexConfigDir,
17
17
  profileKeys
18
- } from "./chunk-M3PLXINO.js";
18
+ } from "./chunk-E4V47VEV.js";
19
19
  import {
20
20
  atomicWrite,
21
21
  backupOnce,
22
22
  cliDir,
23
23
  cliEntry,
24
24
  dropBackupIfSame,
25
+ isDir,
25
26
  readText,
26
27
  removeFile
27
- } from "./chunk-WNDUGQDX.js";
28
+ } from "./chunk-VNCQFFQO.js";
28
29
 
29
30
  // src/machine-hooks.ts
30
31
  import fs from "fs";
@@ -54,13 +55,6 @@ var q = (s) => `"${s.replace(/(["\\$`])/g, "\\$1")}"`;
54
55
  function codexMachineSpecs(node, profile) {
55
56
  return CODEX_EVENTS.map((event) => ({ event, entry: { type: "command", command: `${q(node)} ${q(cliEntry())} hook codex ${event} --profile ${profile}` } }));
56
57
  }
57
- var isDir = (p) => {
58
- try {
59
- return fs.statSync(p).isDirectory();
60
- } catch {
61
- return false;
62
- }
63
- };
64
58
  function installMachineHooks(node, opts) {
65
59
  const res = { claude_dirs: [], lines: [], warnings: [] };
66
60
  const dirs = claudeConfigDirs(opts.processDirs).filter(isDir);
@@ -13,11 +13,11 @@ import {
13
13
  readText,
14
14
  removeFile,
15
15
  serializeJson
16
- } from "./chunk-WNDUGQDX.js";
16
+ } from "./chunk-VNCQFFQO.js";
17
17
  import {
18
18
  cliNpxCommand,
19
19
  runCmd
20
- } from "./chunk-RE2EQZWL.js";
20
+ } from "./chunk-TH4ANHSG.js";
21
21
 
22
22
  // src/manifest.ts
23
23
  function readManifest() {
@@ -5,7 +5,7 @@ import {
5
5
  removeFile,
6
6
  serviceLogFile,
7
7
  spoolFile
8
- } from "./chunk-WNDUGQDX.js";
8
+ } from "./chunk-VNCQFFQO.js";
9
9
 
10
10
  // src/spool.ts
11
11
  import fs from "fs";
@@ -230,8 +230,74 @@ function appendToSpool(event, file = spoolFile()) {
230
230
  }
231
231
  }
232
232
 
233
+ // src/nudge.ts
234
+ import fs2 from "fs";
235
+ import path2 from "path";
236
+ var STASH_TTL_MS = 24 * 36e5;
237
+ var nudgeStashFile = () => path2.join(configDir(), "nudges.jsonl");
238
+ var CONTEXT_EVENTS = {
239
+ claude: ["UserPromptSubmit", "SessionStart", "PreToolUse", "PostToolUse"],
240
+ codex: ["UserPromptSubmit", "SessionStart"]
241
+ };
242
+ function contextEventName(tool, native) {
243
+ return CONTEXT_EVENTS[tool]?.find((e) => e.toLowerCase() === native.toLowerCase()) ?? null;
244
+ }
245
+ var isNudge = (v) => typeof v === "object" && v !== null && typeof v.session_id === "string" && typeof v.text === "string";
246
+ function nudgesOf(json) {
247
+ const list = typeof json === "object" && json !== null ? json.nudges : void 0;
248
+ return Array.isArray(list) ? list.filter(isNudge) : [];
249
+ }
250
+ function contextOutput(hookEventName, texts) {
251
+ return JSON.stringify({ hookSpecificOutput: { hookEventName, additionalContext: texts.join("\n\n") } });
252
+ }
253
+ function stashNudges(nudges, nowMs, file = nudgeStashFile()) {
254
+ if (nudges.length === 0) return;
255
+ try {
256
+ fs2.mkdirSync(path2.dirname(file), { recursive: true, mode: 448 });
257
+ fs2.appendFileSync(file, nudges.map((n) => `${JSON.stringify({ ...n, at: nowMs })}
258
+ `).join(""), { mode: 384 });
259
+ } catch {
260
+ }
261
+ }
262
+ function takeStashed(sessionId, nowMs, file = nudgeStashFile()) {
263
+ if (!fs2.existsSync(file)) return [];
264
+ const claim = `${file}.${process.pid}-${nowMs}`;
265
+ try {
266
+ fs2.renameSync(file, claim);
267
+ } catch {
268
+ return [];
269
+ }
270
+ const mine = [];
271
+ const rest = [];
272
+ try {
273
+ for (const line of fs2.readFileSync(claim, "utf8").split("\n")) {
274
+ if (!line.trim()) continue;
275
+ try {
276
+ const n = JSON.parse(line);
277
+ if (!isNudge(n) || nowMs - (n.at ?? 0) > STASH_TTL_MS) continue;
278
+ if (n.session_id === sessionId) mine.push(n.text);
279
+ else rest.push(line);
280
+ } catch {
281
+ }
282
+ }
283
+ if (rest.length > 0) fs2.appendFileSync(file, `${rest.join("\n")}
284
+ `, { mode: 384 });
285
+ } catch {
286
+ }
287
+ try {
288
+ fs2.rmSync(claim, { force: true });
289
+ } catch {
290
+ }
291
+ return mine;
292
+ }
293
+
233
294
  export {
234
295
  takeSpool,
235
296
  releaseSpool,
236
- appendToSpool
297
+ appendToSpool,
298
+ contextEventName,
299
+ nudgesOf,
300
+ contextOutput,
301
+ stashNudges,
302
+ takeStashed
237
303
  };
@@ -5,7 +5,7 @@ import {
5
5
  codexConfigDir,
6
6
  codexLabel,
7
7
  profileKeys
8
- } from "./chunk-M3PLXINO.js";
8
+ } from "./chunk-E4V47VEV.js";
9
9
 
10
10
  // src/osinfo.ts
11
11
  import os from "os";
@@ -140,8 +140,8 @@ async function scanProcesses(d) {
140
140
  return { procs };
141
141
  }
142
142
  var claudeDirsOfScan = (s) => s.procs.filter((p) => p.tool === "claude" && p.dir).map((p) => p.dir);
143
- function buildProfiles(scan, env, homeDir) {
144
- const claudeDirs = claudeConfigDirs(claudeDirsOfScan(scan), homeDir);
143
+ function buildProfiles(scan, env, homeDir, installedDirs = []) {
144
+ const claudeDirs = claudeConfigDirs([...installedDirs, ...claudeDirsOfScan(scan)], homeDir);
145
145
  const ckeys = profileKeys("claude", claudeDirs);
146
146
  const out = [];
147
147
  const defaultDir = claudeDirs[0];
@@ -176,6 +176,7 @@ var latestModel = (ps) => ps.map((p) => p.model).filter((m) => Boolean(m)).pop()
176
176
 
177
177
  export {
178
178
  cliVersionOs,
179
+ makeEnvReader,
179
180
  scanProcesses,
180
181
  claudeDirsOfScan,
181
182
  buildProfiles
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ deviceLogin
4
+ } from "./chunk-HT5KXWXM.js";
2
5
  import {
3
6
  RC_LINE,
4
7
  addRcLine,
@@ -10,16 +13,10 @@ import {
10
13
  installGrok,
11
14
  rcFileFor,
12
15
  updateManifest
13
- } from "./chunk-LHF4KCEA.js";
14
- import {
15
- readMachine
16
- } from "./chunk-3IMV5EHP.js";
17
- import {
18
- deviceLogin
19
- } from "./chunk-UPRHMVYJ.js";
16
+ } from "./chunk-NLZXB26Y.js";
20
17
  import {
21
18
  detectRepo
22
- } from "./chunk-OQ6QVFSH.js";
19
+ } from "./chunk-YRNMECUF.js";
23
20
  import {
24
21
  REAL_TOOLS,
25
22
  TOOL_LABEL,
@@ -34,16 +31,19 @@ import {
34
31
  } from "./chunk-TKMIV7BG.js";
35
32
  import {
36
33
  saveToken
37
- } from "./chunk-4A5WOW2D.js";
34
+ } from "./chunk-DQV6FAJU.js";
38
35
  import {
39
36
  VERSION
40
- } from "./chunk-IEYWMDXA.js";
37
+ } from "./chunk-LF2NWQ4B.js";
38
+ import {
39
+ readMachine
40
+ } from "./chunk-T7TG6WA4.js";
41
41
  import {
42
42
  ApiError
43
43
  } from "./chunk-PY74LT2W.js";
44
44
  import {
45
45
  ConfigError
46
- } from "./chunk-WNDUGQDX.js";
46
+ } from "./chunk-VNCQFFQO.js";
47
47
  import {
48
48
  CLI_BIN_NAME,
49
49
  CLI_INSTALL_COMMAND,
@@ -51,7 +51,7 @@ import {
51
51
  hostFromEnv,
52
52
  machineName,
53
53
  normalizeHost
54
- } from "./chunk-RE2EQZWL.js";
54
+ } from "./chunk-TH4ANHSG.js";
55
55
 
56
56
  // src/connect.ts
57
57
  var INSTALLERS = {
@@ -172,7 +172,7 @@ async function connect(ctx, p) {
172
172
  return 2;
173
173
  }
174
174
  if (p.flags.agent || p.flags.tool !== void 0) return connectAgent(ctx, p);
175
- return (await import("./machine-connect-RWNZ77NO.js")).connectMachine(ctx, p);
175
+ return (await import("./machine-connect-NOQ3VZOO.js")).connectMachine(ctx, p);
176
176
  }
177
177
 
178
178
  export {
@@ -6,7 +6,7 @@ import {
6
6
  machineFile,
7
7
  readText,
8
8
  serviceStateFile
9
- } from "./chunk-WNDUGQDX.js";
9
+ } from "./chunk-VNCQFFQO.js";
10
10
 
11
11
  // src/machine.ts
12
12
  import fs from "fs";