@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
@@ -27,6 +27,13 @@ function readText(file) {
27
27
  throw e;
28
28
  }
29
29
  }
30
+ function isDir(p) {
31
+ try {
32
+ return fs.statSync(p).isDirectory();
33
+ } catch {
34
+ return false;
35
+ }
36
+ }
30
37
  function resolveLink(file) {
31
38
  try {
32
39
  return fs.realpathSync(file);
@@ -123,6 +130,7 @@ export {
123
130
  cliDir,
124
131
  cliEntry,
125
132
  readText,
133
+ isDir,
126
134
  atomicWrite,
127
135
  atomicWriteUtf16,
128
136
  backupOnce,
@@ -3,7 +3,7 @@ import {
3
3
  formatRemote,
4
4
  normalizeRemote,
5
5
  runCmd
6
- } from "./chunk-RE2EQZWL.js";
6
+ } from "./chunk-TH4ANHSG.js";
7
7
 
8
8
  // src/git.ts
9
9
  function remoteOf(url) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-TKMIV7BG.js";
5
5
  import {
6
6
  VERSION
7
- } from "./chunk-IEYWMDXA.js";
7
+ } from "./chunk-LF2NWQ4B.js";
8
8
  import {
9
9
  ApiError
10
10
  } from "./chunk-PY74LT2W.js";
@@ -13,7 +13,7 @@ import {
13
13
  CLI_INSTALL_COMMAND,
14
14
  cliNpxCommand,
15
15
  defaultCtx
16
- } from "./chunk-RE2EQZWL.js";
16
+ } from "./chunk-TH4ANHSG.js";
17
17
  import "./chunk-K3NQKI34.js";
18
18
 
19
19
  // src/cli.ts
@@ -28,6 +28,7 @@ Commands:
28
28
  --agent | --tool claude|codex|cursor|gemini|grok|other connect one agent for one repo (MCP and tasks) instead
29
29
  disconnect Remove everything connect added, the machine on the server included (--tool <name> for one agent tool)
30
30
  status This machine and its service; the per-repo agent, its projects and live sessions
31
+ where [tool] Which account to run next on (read only; --json for the raw answer)
31
32
  service run: the background service (started by your OS; you rarely run it by hand)
32
33
  link Link this repo to another project (--project ID | --new NAME [--path PREFIX])
33
34
  token Print the stored token for shell use (--reveal to print to a terminal)
@@ -58,25 +59,27 @@ async function run(argv, ctx = defaultCtx()) {
58
59
  try {
59
60
  switch (cmd) {
60
61
  case "connect":
61
- return await (await import("./connect-R3PMIY7G.js")).connect(ctx, p);
62
+ return await (await import("./connect-TG2H5SMB.js")).connect(ctx, p);
62
63
  case "disconnect":
63
- return await (await import("./disconnect-NRYU6W5P.js")).disconnect(ctx, p);
64
+ return await (await import("./disconnect-FI76IEZJ.js")).disconnect(ctx, p);
64
65
  case "status":
65
- return await (await import("./status-HADESN2E.js")).status(ctx, p);
66
+ return await (await import("./status-SMAVPW4D.js")).status(ctx, p);
67
+ case "where":
68
+ return await (await import("./where-7NI7UEEF.js")).where(ctx, p);
66
69
  case "service":
67
70
  if (p.positionals[0] !== "run") {
68
71
  ctx.err("hivefloor: usage: hivefloor service run\n");
69
72
  return 2;
70
73
  }
71
- return await (await import("./run-64ZYCJU2.js")).runService({ ctx });
74
+ return await (await import("./run-CKNHDPNX.js")).runService({ ctx });
72
75
  case "link":
73
- return await (await import("./link-EPWADGYT.js")).link(ctx, p);
76
+ return await (await import("./link-JX4YLF2Z.js")).link(ctx, p);
74
77
  case "token":
75
- return await (await import("./token-SM5MDJKY.js")).token(ctx, p);
78
+ return await (await import("./token-AUEAWQDH.js")).token(ctx, p);
76
79
  case "mcp":
77
- return await (await import("./mcp-QX6VMTOD.js")).runMcpProxy(ctx, p);
80
+ return await (await import("./mcp-EUBTVJNX.js")).runMcpProxy(ctx, p);
78
81
  case "hook": {
79
- const { runHook, readStdin } = await import("./hook-B2I42GE3.js");
82
+ const { runHook, readStdin } = await import("./hook-N4ZTQEWM.js");
80
83
  await runHook(rest, { env: ctx.env, cwd: ctx.cwd, fetch: ctx.fetch, now: ctx.now, readStdin });
81
84
  return 0;
82
85
  }
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ connect,
4
+ connectAgent,
5
+ resolveHost
6
+ } from "./chunk-OOMBZN4M.js";
7
+ import "./chunk-HT5KXWXM.js";
8
+ import "./chunk-NLZXB26Y.js";
9
+ import "./chunk-YRNMECUF.js";
10
+ import "./chunk-2IMJECYD.js";
11
+ import "./chunk-TKMIV7BG.js";
12
+ import "./chunk-DQV6FAJU.js";
13
+ import "./chunk-LF2NWQ4B.js";
14
+ import "./chunk-T7TG6WA4.js";
15
+ import "./chunk-PY74LT2W.js";
16
+ import "./chunk-VNCQFFQO.js";
17
+ import "./chunk-TH4ANHSG.js";
18
+ import "./chunk-K3NQKI34.js";
19
+ export {
20
+ connect,
21
+ connectAgent,
22
+ resolveHost
23
+ };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  removeCliCopy,
4
4
  removeMachineHooks
5
- } from "./chunk-DIW4VIU7.js";
5
+ } from "./chunk-NKMVO5BP.js";
6
6
  import {
7
7
  claudeJson,
8
8
  geminiSettings,
@@ -14,12 +14,7 @@ import {
14
14
  removeGrok,
15
15
  removeRcLine,
16
16
  updateManifest
17
- } from "./chunk-LHF4KCEA.js";
18
- import "./chunk-M3PLXINO.js";
19
- import {
20
- readMachine,
21
- removeMachineFile
22
- } from "./chunk-3IMV5EHP.js";
17
+ } from "./chunk-NLZXB26Y.js";
23
18
  import {
24
19
  REAL_TOOLS,
25
20
  TOOL_LABEL,
@@ -33,7 +28,12 @@ import {
33
28
  deleteCredentials,
34
29
  readCredentials,
35
30
  uninstallService
36
- } from "./chunk-4A5WOW2D.js";
31
+ } from "./chunk-DQV6FAJU.js";
32
+ import "./chunk-E4V47VEV.js";
33
+ import {
34
+ readMachine,
35
+ removeMachineFile
36
+ } from "./chunk-T7TG6WA4.js";
37
37
  import {
38
38
  apiRequest
39
39
  } from "./chunk-PY74LT2W.js";
@@ -44,11 +44,11 @@ import {
44
44
  removeFile,
45
45
  serviceLogFile,
46
46
  serviceStateFile
47
- } from "./chunk-WNDUGQDX.js";
47
+ } from "./chunk-VNCQFFQO.js";
48
48
  import {
49
49
  normalizeHost,
50
50
  runCmd
51
- } from "./chunk-RE2EQZWL.js";
51
+ } from "./chunk-TH4ANHSG.js";
52
52
  import "./chunk-K3NQKI34.js";
53
53
 
54
54
  // src/disconnect.ts
@@ -2,33 +2,38 @@
2
2
  import {
3
3
  HARD_EXIT_MS
4
4
  } from "./chunk-JCLWCMEM.js";
5
+ import {
6
+ detectRepo
7
+ } from "./chunk-YRNMECUF.js";
8
+ import {
9
+ defaultHost,
10
+ loadToken
11
+ } from "./chunk-DQV6FAJU.js";
5
12
  import {
6
13
  appendToSpool,
14
+ contextEventName,
15
+ contextOutput,
16
+ nudgesOf,
7
17
  releaseSpool,
8
- takeSpool
9
- } from "./chunk-SGDM7MAT.js";
18
+ stashNudges,
19
+ takeSpool,
20
+ takeStashed
21
+ } from "./chunk-O2TC3WSS.js";
10
22
  import {
11
23
  readMachine,
12
24
  serviceAlive
13
- } from "./chunk-3IMV5EHP.js";
14
- import {
15
- detectRepo
16
- } from "./chunk-OQ6QVFSH.js";
17
- import {
18
- defaultHost,
19
- loadToken
20
- } from "./chunk-4A5WOW2D.js";
25
+ } from "./chunk-T7TG6WA4.js";
21
26
  import {
22
27
  configDir,
23
28
  machineSpoolFile
24
- } from "./chunk-WNDUGQDX.js";
29
+ } from "./chunk-VNCQFFQO.js";
25
30
  import {
26
31
  DEFAULT_HOST,
27
32
  HOOK_BATCH_MAX,
28
33
  PROFILE_KEY_RE,
29
34
  hostFromEnv,
30
35
  redact
31
- } from "./chunk-RE2EQZWL.js";
36
+ } from "./chunk-TH4ANHSG.js";
32
37
  import "./chunk-K3NQKI34.js";
33
38
 
34
39
  // src/hook.ts
@@ -145,7 +150,7 @@ function isDuplicate(key, nowMs) {
145
150
  }
146
151
  return dup;
147
152
  }
148
- async function post(deps, host, token, events, timeoutMs, route = "/api/v1/hooks") {
153
+ async function post(deps, host, token, events, timeoutMs, route = "/api/v1/hooks", nudges) {
149
154
  try {
150
155
  const res = await deps.fetch(`${host}${route}`, {
151
156
  method: "POST",
@@ -153,8 +158,16 @@ async function post(deps, host, token, events, timeoutMs, route = "/api/v1/hooks
153
158
  body: JSON.stringify({ events }),
154
159
  signal: AbortSignal.timeout(timeoutMs)
155
160
  });
156
- await res.arrayBuffer().catch(() => void 0);
157
- if (res.status >= 200 && res.status < 300) return "ok";
161
+ const text = await res.text().catch(() => "");
162
+ if (res.status >= 200 && res.status < 300) {
163
+ if (nudges && text.includes('"nudges"')) {
164
+ try {
165
+ nudges.push(...nudgesOf(JSON.parse(text)));
166
+ } catch {
167
+ }
168
+ }
169
+ return "ok";
170
+ }
158
171
  if (res.status === 429 || res.status >= 500) return "retry";
159
172
  return "drop";
160
173
  } catch {
@@ -202,6 +215,10 @@ async function runHookInner(args, deps, startedAt) {
202
215
  if (!mapped) return;
203
216
  const nowMs = deps.now();
204
217
  const event = { ...mapped, tool, client_at: new Date(nowMs).toISOString() };
218
+ const contextName = grokId ? null : contextEventName(toolArg, native);
219
+ if (contextName) event.deliver = true;
220
+ const nudges = [];
221
+ const show = () => printNudges(deps, contextName, event.session_id, nudges, nowMs);
205
222
  if (grokId && isDuplicate(`${tool}|${event.session_id}|${event.event}|${event.subagent_id ?? ""}`, nowMs)) return;
206
223
  const repo = await detectRepo(cwdOf(input) ?? deps.cwd);
207
224
  if (repo) event.repo = { remote: repo.remote, ...repo.branch ? { branch: repo.branch } : {}, ...repo.path ? { path: repo.path } : {} };
@@ -209,16 +226,33 @@ async function runHookInner(args, deps, startedAt) {
209
226
  const mevent = { ...event, profile };
210
227
  if (serviceAlive(deps.now())) {
211
228
  appendToSpool(mevent, machineSpoolFile());
229
+ if (contextName) nudges.push(...takeStashed(event.session_id, nowMs).map((text) => ({ session_id: event.session_id, text })));
230
+ show();
212
231
  return;
213
232
  }
214
233
  const claim2 = takeSpool(machineSpoolFile());
215
- await sendBatches(deps, host, token, [...claim2?.events ?? [], mevent], startedAt, "/api/v1/machine/hooks", claim2, machineSpoolFile());
234
+ await sendBatches(deps, host, token, [...claim2?.events ?? [], mevent], startedAt, "/api/v1/machine/hooks", claim2, machineSpoolFile(), nudges);
235
+ show();
216
236
  return;
217
237
  }
218
238
  const claim = takeSpool();
219
- await sendBatches(deps, host, token, [...claim?.events ?? [], event], startedAt, "/api/v1/hooks", claim);
239
+ await sendBatches(deps, host, token, [...claim?.events ?? [], event], startedAt, "/api/v1/hooks", claim, void 0, nudges);
240
+ show();
241
+ }
242
+ function printNudges(deps, contextName, sessionId, nudges, nowMs) {
243
+ if (nudges.length === 0) return;
244
+ const mine = contextName ? nudges.filter((n) => n.session_id === sessionId) : [];
245
+ const others = nudges.filter((n) => !mine.includes(n));
246
+ if (others.length > 0) stashNudges(others, nowMs);
247
+ if (!contextName || mine.length === 0) return;
248
+ const out = contextOutput(contextName, mine.map((n) => n.text));
249
+ try {
250
+ (deps.write ?? ((t) => void process.stdout.write(`${t}
251
+ `)))(out);
252
+ } catch {
253
+ }
220
254
  }
221
- async function sendBatches(deps, host, token, pending, startedAt, route, claim, spool) {
255
+ async function sendBatches(deps, host, token, pending, startedAt, route, claim, spool, nudges) {
222
256
  const batches = [];
223
257
  for (let k = 0; k < pending.length; k += HOOK_BATCH_MAX) batches.push(pending.slice(k, k + HOOK_BATCH_MAX));
224
258
  const unsent = [];
@@ -230,7 +264,7 @@ async function sendBatches(deps, host, token, pending, startedAt, route, claim,
230
264
  down = true;
231
265
  continue;
232
266
  }
233
- const r = await post(deps, host, token, batch, Math.min(POST_TIMEOUT_MS, left), route);
267
+ const r = await post(deps, host, token, batch, Math.min(POST_TIMEOUT_MS, left), route, nudges);
234
268
  if (r === "retry") {
235
269
  unsent.push(...batch);
236
270
  down = true;
package/dist/index.js CHANGED
@@ -11,12 +11,12 @@ if (argv[0] === "hook") {
11
11
  process.on("unhandledRejection", () => process.exit(0));
12
12
  setTimeout(() => process.exit(0), HARD_EXIT_MS).unref();
13
13
  try {
14
- const { runHookCli } = await import("./hook-B2I42GE3.js");
14
+ const { runHookCli } = await import("./hook-N4ZTQEWM.js");
15
15
  await runHookCli(argv.slice(1));
16
16
  } catch {
17
17
  }
18
18
  process.exit(0);
19
19
  } else {
20
- const { run } = await import("./cli-7CIYC6A3.js");
20
+ const { run } = await import("./cli-F3F7SQLV.js");
21
21
  process.exitCode = await run(argv);
22
22
  }
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  deviceLogin
4
- } from "./chunk-UPRHMVYJ.js";
5
- import {
6
- resolveSession
7
- } from "./chunk-BAB4DPCN.js";
4
+ } from "./chunk-HT5KXWXM.js";
8
5
  import {
9
6
  detectRepo
10
- } from "./chunk-OQ6QVFSH.js";
7
+ } from "./chunk-YRNMECUF.js";
8
+ import {
9
+ resolveSession
10
+ } from "./chunk-DWHMBUCA.js";
11
11
  import {
12
12
  isTool
13
13
  } from "./chunk-2IMJECYD.js";
@@ -16,19 +16,19 @@ import {
16
16
  } from "./chunk-TKMIV7BG.js";
17
17
  import {
18
18
  saveToken
19
- } from "./chunk-4A5WOW2D.js";
19
+ } from "./chunk-DQV6FAJU.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-IEYWMDXA.js";
22
+ } from "./chunk-LF2NWQ4B.js";
23
23
  import {
24
24
  apiRequest,
25
25
  errorOf
26
26
  } from "./chunk-PY74LT2W.js";
27
- import "./chunk-WNDUGQDX.js";
27
+ import "./chunk-VNCQFFQO.js";
28
28
  import {
29
29
  cliNpxCommand,
30
30
  machineName
31
- } from "./chunk-RE2EQZWL.js";
31
+ } from "./chunk-TH4ANHSG.js";
32
32
  import "./chunk-K3NQKI34.js";
33
33
 
34
34
  // src/link.ts
@@ -1,29 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolveHost
4
- } from "./chunk-4OFN5KHY.js";
4
+ } from "./chunk-OOMBZN4M.js";
5
+ import {
6
+ deviceLogin
7
+ } from "./chunk-HT5KXWXM.js";
5
8
  import {
6
9
  installCliCopy,
7
10
  installMachineHooks
8
- } from "./chunk-DIW4VIU7.js";
9
- import "./chunk-LHF4KCEA.js";
10
- import {
11
- claudeDirsOfScan,
12
- cliVersionOs,
13
- scanProcesses
14
- } from "./chunk-6UZBZ7LR.js";
15
- import {
16
- codexConfigDir
17
- } from "./chunk-M3PLXINO.js";
18
- import {
19
- readMachine,
20
- secureWindowsMachine,
21
- writeMachine
22
- } from "./chunk-3IMV5EHP.js";
23
- import {
24
- deviceLogin
25
- } from "./chunk-UPRHMVYJ.js";
26
- import "./chunk-OQ6QVFSH.js";
11
+ } from "./chunk-NKMVO5BP.js";
12
+ import "./chunk-NLZXB26Y.js";
13
+ import "./chunk-YRNMECUF.js";
27
14
  import {
28
15
  findBin
29
16
  } from "./chunk-2IMJECYD.js";
@@ -33,21 +20,34 @@ import {
33
20
  import {
34
21
  installService,
35
22
  windowsUser
36
- } from "./chunk-4A5WOW2D.js";
23
+ } from "./chunk-DQV6FAJU.js";
24
+ import {
25
+ claudeDirsOfScan,
26
+ cliVersionOs,
27
+ scanProcesses
28
+ } from "./chunk-O6VSA2JT.js";
37
29
  import {
38
30
  VERSION
39
- } from "./chunk-IEYWMDXA.js";
31
+ } from "./chunk-LF2NWQ4B.js";
32
+ import {
33
+ codexConfigDir
34
+ } from "./chunk-E4V47VEV.js";
35
+ import {
36
+ readMachine,
37
+ secureWindowsMachine,
38
+ writeMachine
39
+ } from "./chunk-T7TG6WA4.js";
40
40
  import "./chunk-PY74LT2W.js";
41
41
  import {
42
42
  cliEntry
43
- } from "./chunk-WNDUGQDX.js";
43
+ } from "./chunk-VNCQFFQO.js";
44
44
  import {
45
45
  cliNpxCommand,
46
46
  machineName,
47
47
  machineTokenSuccessSchema,
48
48
  normalizeHost,
49
49
  runCmd
50
- } from "./chunk-RE2EQZWL.js";
50
+ } from "./chunk-TH4ANHSG.js";
51
51
  import "./chunk-K3NQKI34.js";
52
52
 
53
53
  // src/machine-connect.ts
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- resolveSession
4
- } from "./chunk-BAB4DPCN.js";
5
2
  import {
6
3
  detectRepo
7
- } from "./chunk-OQ6QVFSH.js";
4
+ } from "./chunk-YRNMECUF.js";
5
+ import {
6
+ resolveSession
7
+ } from "./chunk-DWHMBUCA.js";
8
8
  import {
9
9
  toolFromEnv
10
10
  } from "./chunk-2IMJECYD.js";
@@ -13,13 +13,13 @@ import {
13
13
  } from "./chunk-TKMIV7BG.js";
14
14
  import {
15
15
  loadToken
16
- } from "./chunk-4A5WOW2D.js";
17
- import "./chunk-WNDUGQDX.js";
16
+ } from "./chunk-DQV6FAJU.js";
17
+ import "./chunk-VNCQFFQO.js";
18
18
  import {
19
19
  cliNpxCommand,
20
20
  isSecureUrl,
21
21
  normalizeHost
22
- } from "./chunk-RE2EQZWL.js";
22
+ } from "./chunk-TH4ANHSG.js";
23
23
  import "./chunk-K3NQKI34.js";
24
24
 
25
25
  // src/mcp.ts