@hivefloor/cli 0.1.1 → 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.
- package/dist/{chunk-Q2TS3GT3.js → chunk-DQV6FAJU.js} +2 -2
- package/dist/{chunk-MMWX62ZU.js → chunk-DWHMBUCA.js} +2 -2
- package/dist/{chunk-NCRQGIJY.js → chunk-E4V47VEV.js} +3 -9
- package/dist/{chunk-WO7NALQO.js → chunk-HT5KXWXM.js} +1 -1
- package/dist/{chunk-WLHRUZTR.js → chunk-LF2NWQ4B.js} +2 -1
- package/dist/{chunk-WHHV2NZA.js → chunk-NKMVO5BP.js} +4 -10
- package/dist/{chunk-YCZ7XJJF.js → chunk-NLZXB26Y.js} +2 -2
- package/dist/{chunk-SGDM7MAT.js → chunk-O2TC3WSS.js} +68 -2
- package/dist/{chunk-U7PMOZGI.js → chunk-O6VSA2JT.js} +4 -3
- package/dist/{chunk-76HDATOB.js → chunk-OOMBZN4M.js} +13 -13
- package/dist/{chunk-3IMV5EHP.js → chunk-T7TG6WA4.js} +1 -1
- package/dist/{chunk-ZYRPQPGL.js → chunk-TH4ANHSG.js} +333 -190
- package/dist/{chunk-WNDUGQDX.js → chunk-VNCQFFQO.js} +8 -0
- package/dist/{chunk-CWEEIRW2.js → chunk-YRNMECUF.js} +1 -1
- package/dist/{cli-FFAZRKLR.js → cli-F3F7SQLV.js} +13 -10
- package/dist/connect-TG2H5SMB.js +23 -0
- package/dist/{disconnect-VWUOUZP6.js → disconnect-FI76IEZJ.js} +10 -10
- package/dist/{hook-WSJXG2XU.js → hook-N4ZTQEWM.js} +53 -19
- package/dist/index.js +2 -2
- package/dist/{link-TFITMC6H.js → link-JX4YLF2Z.js} +9 -9
- package/dist/{machine-connect-I3OZCTUZ.js → machine-connect-NOQ3VZOO.js} +24 -24
- package/dist/{mcp-47WTNQNN.js → mcp-EUBTVJNX.js} +7 -7
- package/dist/run-CKNHDPNX.js +1883 -0
- package/dist/{status-GXZ267BD.js → status-SMAVPW4D.js} +14 -14
- package/dist/{token-C4K23KXH.js → token-AUEAWQDH.js} +4 -4
- package/dist/where-7NI7UEEF.js +70 -0
- package/package.json +1 -1
- package/dist/connect-FM4BXTQQ.js +0 -23
- package/dist/run-JO4NEHWG.js +0 -629
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
isRecord,
|
|
9
9
|
readText,
|
|
10
10
|
removeFile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VNCQFFQO.js";
|
|
12
12
|
import {
|
|
13
13
|
cliNpxCommand,
|
|
14
14
|
runCmd
|
|
15
|
-
} from "./chunk-
|
|
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-
|
|
11
|
+
} from "./chunk-DQV6FAJU.js";
|
|
12
12
|
import {
|
|
13
13
|
hostFromEnv,
|
|
14
14
|
normalizeHost
|
|
15
|
-
} from "./chunk-
|
|
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-
|
|
7
|
+
} from "./chunk-VNCQFFQO.js";
|
|
7
8
|
import {
|
|
8
9
|
PROFILE_KEY_RE
|
|
9
|
-
} from "./chunk-
|
|
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-
|
|
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,7 +3,7 @@
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@hivefloor/cli",
|
|
6
|
-
version: "0.1.
|
|
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
8
|
author: {
|
|
9
9
|
name: "Errr0rr404",
|
|
@@ -51,6 +51,7 @@ var package_default = {
|
|
|
51
51
|
},
|
|
52
52
|
devDependencies: {
|
|
53
53
|
"@hivefloor/shared": "workspace:*",
|
|
54
|
+
"@hivefloor/usage": "workspace:*",
|
|
54
55
|
"@types/node": "^22.20.5",
|
|
55
56
|
tsup: "^8.5.1",
|
|
56
57
|
typescript: "~5.9.3"
|
|
@@ -10,21 +10,22 @@ import {
|
|
|
10
10
|
removeHooks,
|
|
11
11
|
restoreFeatureHooks,
|
|
12
12
|
wasCreated
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NLZXB26Y.js";
|
|
14
14
|
import {
|
|
15
15
|
claudeConfigDirs,
|
|
16
16
|
codexConfigDir,
|
|
17
17
|
profileKeys
|
|
18
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
16
|
+
} from "./chunk-VNCQFFQO.js";
|
|
17
17
|
import {
|
|
18
18
|
cliNpxCommand,
|
|
19
19
|
runCmd
|
|
20
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
14
|
-
import {
|
|
15
|
-
readMachine
|
|
16
|
-
} from "./chunk-3IMV5EHP.js";
|
|
17
|
-
import {
|
|
18
|
-
deviceLogin
|
|
19
|
-
} from "./chunk-WO7NALQO.js";
|
|
16
|
+
} from "./chunk-NLZXB26Y.js";
|
|
20
17
|
import {
|
|
21
18
|
detectRepo
|
|
22
|
-
} from "./chunk-
|
|
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-
|
|
34
|
+
} from "./chunk-DQV6FAJU.js";
|
|
38
35
|
import {
|
|
39
36
|
VERSION
|
|
40
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
175
|
+
return (await import("./machine-connect-NOQ3VZOO.js")).connectMachine(ctx, p);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
export {
|