@hivefloor/cli 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +76 -2
- package/dist/chunk-2IMJECYD.js +71 -0
- package/dist/chunk-3IMV5EHP.js +94 -0
- package/dist/chunk-4A5WOW2D.js +356 -0
- package/dist/chunk-4OFN5KHY.js +182 -0
- package/dist/chunk-6UZBZ7LR.js +182 -0
- package/dist/chunk-BAB4DPCN.js +30 -0
- package/dist/chunk-DIW4VIU7.js +138 -0
- package/dist/chunk-IEYWMDXA.js +67 -0
- package/dist/chunk-JCLWCMEM.js +8 -0
- package/dist/chunk-K3NQKI34.js +10 -0
- package/dist/chunk-LHF4KCEA.js +594 -0
- package/dist/chunk-M3PLXINO.js +143 -0
- package/dist/chunk-OQ6QVFSH.js +38 -0
- package/dist/chunk-PY74LT2W.js +41 -0
- package/dist/chunk-RE2EQZWL.js +21226 -0
- package/dist/chunk-SGDM7MAT.js +237 -0
- package/dist/chunk-TKMIV7BG.js +46 -0
- package/dist/chunk-UPRHMVYJ.js +74 -0
- package/dist/chunk-WNDUGQDX.js +135 -0
- package/dist/cli-7CIYC6A3.js +100 -0
- package/dist/connect-R3PMIY7G.js +23 -0
- package/dist/disconnect-NRYU6W5P.js +140 -0
- package/dist/hook-B2I42GE3.js +265 -0
- package/dist/index.js +22 -0
- package/dist/link-EPWADGYT.js +78 -0
- package/dist/machine-connect-RWNZ77NO.js +139 -0
- package/dist/mcp-QX6VMTOD.js +121 -0
- package/dist/run-64ZYCJU2.js +629 -0
- package/dist/status-HADESN2E.js +113 -0
- package/dist/token-SM5MDJKY.js +32 -0
- package/package.json +42 -4
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
profileKeys
|
|
4
|
+
} from "./chunk-M3PLXINO.js";
|
|
5
|
+
import {
|
|
6
|
+
SERVICE_ALIVE_MS,
|
|
7
|
+
readMachine,
|
|
8
|
+
readServiceState
|
|
9
|
+
} from "./chunk-3IMV5EHP.js";
|
|
10
|
+
import {
|
|
11
|
+
resolveSession
|
|
12
|
+
} from "./chunk-BAB4DPCN.js";
|
|
13
|
+
import {
|
|
14
|
+
detectRepo
|
|
15
|
+
} from "./chunk-OQ6QVFSH.js";
|
|
16
|
+
import "./chunk-2IMJECYD.js";
|
|
17
|
+
import "./chunk-TKMIV7BG.js";
|
|
18
|
+
import {
|
|
19
|
+
SCHTASKS_TASK,
|
|
20
|
+
readCredentials,
|
|
21
|
+
windowsServiceStatus
|
|
22
|
+
} from "./chunk-4A5WOW2D.js";
|
|
23
|
+
import {
|
|
24
|
+
apiRequest,
|
|
25
|
+
errorOf
|
|
26
|
+
} from "./chunk-PY74LT2W.js";
|
|
27
|
+
import "./chunk-WNDUGQDX.js";
|
|
28
|
+
import {
|
|
29
|
+
cliNpxCommand,
|
|
30
|
+
machineName,
|
|
31
|
+
runCmd
|
|
32
|
+
} from "./chunk-RE2EQZWL.js";
|
|
33
|
+
import "./chunk-K3NQKI34.js";
|
|
34
|
+
|
|
35
|
+
// src/status.ts
|
|
36
|
+
var str = (v) => typeof v === "string" ? v : void 0;
|
|
37
|
+
var rec = (v) => typeof v === "object" && v !== null ? v : {};
|
|
38
|
+
async function status(ctx, p) {
|
|
39
|
+
const machine = readMachine();
|
|
40
|
+
if (machine) await machineStatus(ctx, machine);
|
|
41
|
+
const s = await resolveSession(ctx, p);
|
|
42
|
+
if (!s) {
|
|
43
|
+
if (machine) return machine.revoked ? 1 : 0;
|
|
44
|
+
ctx.out(`Not connected. Run: ${cliNpxCommand("connect")}
|
|
45
|
+
`);
|
|
46
|
+
return 1;
|
|
47
|
+
}
|
|
48
|
+
if (machine) ctx.out("\nAgent connection (per repo):\n");
|
|
49
|
+
const repo = await detectRepo(ctx.cwd);
|
|
50
|
+
ctx.out(`Host: ${s.host}
|
|
51
|
+
Machine: ${machineName()}
|
|
52
|
+
`);
|
|
53
|
+
const connected = Object.keys(readCredentials().hosts[s.host]?.tools ?? {});
|
|
54
|
+
if (connected.length > 0) ctx.out(`Connected tools: ${connected.join(", ")}
|
|
55
|
+
`);
|
|
56
|
+
if (repo) ctx.out(`Repo here: ${repo.remote}${repo.branch ? ` (${repo.branch})` : ""}
|
|
57
|
+
`);
|
|
58
|
+
let res;
|
|
59
|
+
try {
|
|
60
|
+
res = await apiRequest(ctx, s.host, "/api/v1/agent/whoami", { token: s.token, headers: repo ? { "x-hf-repo": repo.remote } : {}, timeoutMs: 8e3 });
|
|
61
|
+
} catch (e) {
|
|
62
|
+
ctx.err(`hivefloor: could not reach ${s.host}: ${e.message}
|
|
63
|
+
`);
|
|
64
|
+
return 1;
|
|
65
|
+
}
|
|
66
|
+
if (res.status === 401) {
|
|
67
|
+
ctx.err(`hivefloor: the token was rejected (revoked?). Run: ${cliNpxCommand("connect")}
|
|
68
|
+
`);
|
|
69
|
+
return 1;
|
|
70
|
+
}
|
|
71
|
+
if (res.status !== 200) {
|
|
72
|
+
ctx.err(`hivefloor: ${errorOf(res).message}
|
|
73
|
+
`);
|
|
74
|
+
return 1;
|
|
75
|
+
}
|
|
76
|
+
const j = rec(res.json);
|
|
77
|
+
const agent = rec(j.agent);
|
|
78
|
+
const owner = rec(j.owner);
|
|
79
|
+
ctx.out(`Agent: ${str(agent.name) ?? str(agent.id) ?? "unknown"}${str(owner.login) ? ` (owner ${str(owner.login)})` : ""}
|
|
80
|
+
`);
|
|
81
|
+
const projects = Array.isArray(j.projects) ? j.projects.map(rec) : [];
|
|
82
|
+
ctx.out(projects.length === 0 ? "Projects: none\n" : "Projects:\n");
|
|
83
|
+
for (const pr of projects) ctx.out(` ${str(pr.key) ?? ""} ${str(pr.name) ?? ""}
|
|
84
|
+
`);
|
|
85
|
+
const sessions = Array.isArray(j.sessions) ? j.sessions.map(rec) : [];
|
|
86
|
+
if (sessions.length > 0) {
|
|
87
|
+
ctx.out("Live sessions:\n");
|
|
88
|
+
for (const se of sessions) ctx.out(` ${str(se.state) ?? ""} ${str(se.id) ?? ""}
|
|
89
|
+
`);
|
|
90
|
+
}
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
async function machineStatus(ctx, m) {
|
|
94
|
+
ctx.out(`Machine: ${m.machine.name} (${m.host})${m.revoked ? ` REMOVED on the server: run ${cliNpxCommand("disconnect")}, then ${cliNpxCommand("connect")}` : ""}
|
|
95
|
+
`);
|
|
96
|
+
const sv = readServiceState();
|
|
97
|
+
const alive = sv !== void 0 && ctx.now() - sv.beat < SERVICE_ALIVE_MS;
|
|
98
|
+
const ago = (t) => t ? `${Math.max(0, Math.round((ctx.now() - t) / 1e3))}s ago` : "never";
|
|
99
|
+
ctx.out(`Service: ${alive ? "running" : "not running"}${m.installed.service ? ` (${m.installed.service.kind})` : " (not installed)"}; last heartbeat ${ago(sv?.last_ok)}${sv?.last_error ? `; last error: ${sv.last_error}` : ""}
|
|
100
|
+
`);
|
|
101
|
+
if (m.installed.service?.kind === "windows" && (ctx.platform ?? process.platform) === "win32") {
|
|
102
|
+
ctx.out(`Scheduled Task: "${SCHTASKS_TASK}" ${await windowsServiceStatus(ctx.run ?? runCmd)}
|
|
103
|
+
`);
|
|
104
|
+
}
|
|
105
|
+
const keys = profileKeys("claude", m.installed.claude_dirs);
|
|
106
|
+
const profiles = [...keys.values()].map((k) => `claude:${k}`);
|
|
107
|
+
if (m.installed.codex_dir) profiles.push("codex:default");
|
|
108
|
+
ctx.out(profiles.length > 0 ? `Hooks in: ${profiles.join(", ")}
|
|
109
|
+
` : "Hooks: none installed\n");
|
|
110
|
+
}
|
|
111
|
+
export {
|
|
112
|
+
status
|
|
113
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
resolveSession
|
|
4
|
+
} from "./chunk-BAB4DPCN.js";
|
|
5
|
+
import "./chunk-2IMJECYD.js";
|
|
6
|
+
import "./chunk-TKMIV7BG.js";
|
|
7
|
+
import "./chunk-4A5WOW2D.js";
|
|
8
|
+
import "./chunk-WNDUGQDX.js";
|
|
9
|
+
import {
|
|
10
|
+
cliNpxCommand
|
|
11
|
+
} from "./chunk-RE2EQZWL.js";
|
|
12
|
+
import "./chunk-K3NQKI34.js";
|
|
13
|
+
|
|
14
|
+
// src/token.ts
|
|
15
|
+
async function token(ctx, p) {
|
|
16
|
+
const s = await resolveSession(ctx, p);
|
|
17
|
+
if (!s) {
|
|
18
|
+
ctx.err(`hivefloor: no token stored. Run: ${cliNpxCommand("connect")}
|
|
19
|
+
`);
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
if (ctx.stdoutIsTTY && !p.flags.reveal) {
|
|
23
|
+
ctx.err("hivefloor: refusing to print the token to a terminal. Use it in a pipe or $(...), or pass --reveal.\n");
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
ctx.out(`${s.token}
|
|
27
|
+
`);
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
token
|
|
32
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hivefloor/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Connect your coding agents (Claude Code, Codex, Cursor, Gemini, Grok) to Hivefloor: live presence, task coordination and usage on one floor.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"hivefloor",
|
|
7
|
+
"ai-agents",
|
|
8
|
+
"coding-agents",
|
|
9
|
+
"claude-code",
|
|
10
|
+
"codex",
|
|
11
|
+
"mcp",
|
|
12
|
+
"hooks",
|
|
13
|
+
"cli"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://hivefloor.worldofz.info",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/Validate-QA/hivefloor/issues"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/Validate-QA/hivefloor.git",
|
|
22
|
+
"directory": "packages/cli"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"type": "module",
|
|
26
|
+
"bin": {
|
|
27
|
+
"hivefloor": "dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=22"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@modelcontextprotocol/sdk": "^1.32.2"
|
|
40
|
+
},
|
|
41
|
+
"optionalDependencies": {
|
|
42
|
+
"@napi-rs/keyring": "^2.1.2"
|
|
43
|
+
}
|
|
44
|
+
}
|