ztile-cli 0.3.2 → 0.3.4

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.
@@ -1,11 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- __require
4
- } from "./chunk-PDX44BCA.js";
5
2
 
6
3
  // src/lib/credentials.ts
7
- import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
4
+ import { existsSync, readFileSync, writeFileSync, mkdirSync, unlinkSync } from "fs";
8
5
  import { join } from "path";
6
+ import { hostname } from "os";
9
7
  function credentialsPath() {
10
8
  const home = process.env["HOME"] ?? process.env["USERPROFILE"] ?? "/tmp";
11
9
  return join(home, ".ztile", "credentials.json");
@@ -44,7 +42,7 @@ function resolveMachineId() {
44
42
  if (envId) return envId;
45
43
  const creds = loadCredentials();
46
44
  if (creds?.machineId) return creds.machineId;
47
- return "";
45
+ return hostname();
48
46
  }
49
47
  function pidFilePath() {
50
48
  const home = process.env["HOME"] ?? process.env["USERPROFILE"] ?? "/tmp";
@@ -67,10 +65,8 @@ function loadPid() {
67
65
  }
68
66
  }
69
67
  function removePid() {
70
- const path = pidFilePath();
71
68
  try {
72
- const { unlinkSync } = __require("fs");
73
- unlinkSync(path);
69
+ unlinkSync(pidFilePath());
74
70
  } catch {
75
71
  }
76
72
  }
package/dist/cli.js CHANGED
@@ -2,13 +2,17 @@
2
2
 
3
3
  // src/cli.ts
4
4
  var args = process.argv.slice(2);
5
+ if (args[0] === "version" || args[0] === "--version" || args[0] === "-v") {
6
+ console.log("0.3.4");
7
+ process.exit(0);
8
+ }
5
9
  if (args[0] === "hook") {
6
- const { handleHook } = await import("./hook-ZR4EVEUT.js");
10
+ const { handleHook } = await import("./hook-WPPFPN3P.js");
7
11
  await handleHook();
8
12
  process.exit(0);
9
13
  }
10
14
  if (args[0] === "login") {
11
- const { login } = await import("./login-5E7FSVVL.js");
15
+ const { login } = await import("./login-LHLHSMDL.js");
12
16
  await login({
13
17
  apiKey: findArg(args, "--api-key"),
14
18
  serverUrl: findArg(args, "--server-url"),
@@ -17,35 +21,36 @@ if (args[0] === "login") {
17
21
  process.exit(0);
18
22
  }
19
23
  if (args[0] === "install") {
20
- const { resolveApiKey } = await import("./credentials-OO2RZFLG.js");
24
+ const { resolveApiKey } = await import("./credentials-LO2VVMZQ.js");
21
25
  const apiKey = resolveApiKey();
22
26
  if (!apiKey) {
23
27
  console.error("Error: Not logged in.");
24
28
  console.error(" Run `ztile login` first.");
25
29
  process.exit(1);
26
30
  }
27
- const { setupClaudeCode } = await import("./setup-VFHRFRZH.js");
31
+ const { setupClaudeCode } = await import("./setup-BTW4UVF2.js");
28
32
  await setupClaudeCode();
29
33
  process.exit(0);
30
34
  }
31
35
  if (args[0] === "connect") {
32
- const { runConnect } = await import("./connect-CZ727ZOC.js");
36
+ const { runConnect } = await import("./connect-TYJFBFTE.js");
33
37
  const projectDir = findArg(args, "--project") ?? process.env["ZTILE_PROJECT"] ?? process.cwd();
34
38
  const daemon = args.includes("--daemon") || args.includes("-d");
35
39
  await runConnect({ projectDir, daemon });
36
40
  }
37
41
  if (args[0] === "disconnect") {
38
- const { disconnect } = await import("./disconnect-TZ3MQUZS.js");
42
+ const { disconnect } = await import("./disconnect-CQLCAVXH.js");
39
43
  disconnect();
40
44
  process.exit(0);
41
45
  }
42
- if (args.length === 0 || !["hook", "install", "connect", "disconnect", "login"].includes(args[0])) {
46
+ if (args.length === 0 || !["hook", "install", "connect", "disconnect", "login", "version"].includes(args[0])) {
43
47
  if (args.length > 0) console.error(`Unknown command: ${args[0]}`);
44
48
  console.log("Usage:");
45
49
  console.log(" ztile login Save API key and server config");
46
50
  console.log(" ztile install Configure Claude Code hooks");
47
51
  console.log(" ztile connect Connect to dashboard for remote control");
48
52
  console.log(" ztile disconnect Stop background connection");
53
+ console.log(" ztile version Show CLI version");
49
54
  console.log(" ztile hook Handle Claude Code hook (internal)");
50
55
  console.log("");
51
56
  console.log("Options:");
@@ -6,8 +6,7 @@ import {
6
6
  resolveApiKey,
7
7
  resolveServerUrl,
8
8
  savePid
9
- } from "./chunk-XSAVKZSF.js";
10
- import "./chunk-PDX44BCA.js";
9
+ } from "./chunk-YAF63OWJ.js";
11
10
 
12
11
  // src/commands/connect.ts
13
12
  import { hostname } from "os";
@@ -9,8 +9,7 @@ import {
9
9
  resolveServerUrl,
10
10
  saveCredentials,
11
11
  savePid
12
- } from "./chunk-XSAVKZSF.js";
13
- import "./chunk-PDX44BCA.js";
12
+ } from "./chunk-YAF63OWJ.js";
14
13
  export {
15
14
  isProcessRunning,
16
15
  loadCredentials,
@@ -3,8 +3,7 @@ import {
3
3
  isProcessRunning,
4
4
  loadPid,
5
5
  removePid
6
- } from "./chunk-XSAVKZSF.js";
7
- import "./chunk-PDX44BCA.js";
6
+ } from "./chunk-YAF63OWJ.js";
8
7
 
9
8
  // src/commands/disconnect.ts
10
9
  function disconnect() {
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-PDX44BCA.js";
2
+ import {
3
+ resolveApiKey,
4
+ resolveMachineId,
5
+ resolveServerUrl
6
+ } from "./chunk-YAF63OWJ.js";
3
7
 
4
8
  // src/commands/hook.ts
5
9
  import { readFile as readFile2, stat } from "fs/promises";
@@ -78,11 +82,10 @@ async function releaseLock() {
78
82
  }
79
83
 
80
84
  // src/outputs/server.ts
81
- var DEFAULT_SERVER_URL = "https://ztile.dev";
82
85
  function getServerConfig() {
83
86
  return {
84
- serverUrl: process.env["ZTILE_SERVER_URL"] ?? DEFAULT_SERVER_URL,
85
- apiKey: process.env["ZTILE_API_KEY"]
87
+ serverUrl: resolveServerUrl(),
88
+ apiKey: resolveApiKey()
86
89
  };
87
90
  }
88
91
  async function sendRawToServer(payload) {
@@ -118,7 +121,6 @@ async function sendRawToServer(payload) {
118
121
  // src/commands/hook.ts
119
122
  import { appendFileSync } from "fs";
120
123
  import { join as join2 } from "path";
121
- import { hostname } from "os";
122
124
  var LOG_FILE = join2(process.env["HOME"] ?? "/tmp", ".ztile", "hook-debug.log");
123
125
  function debugLog(msg) {
124
126
  const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg}
@@ -155,7 +157,7 @@ async function handleHook() {
155
157
  debugLog("[hook] No session_id in payload, skipping");
156
158
  return;
157
159
  }
158
- const machineId = process.env["ZTILE_MACHINE_ID"] ?? hostname();
160
+ const machineId = resolveMachineId();
159
161
  if (hookEvent === "UserPromptSubmit") {
160
162
  const prompt = payload["prompt"];
161
163
  if (prompt) {
@@ -2,8 +2,7 @@
2
2
  import {
3
3
  loadCredentials,
4
4
  saveCredentials
5
- } from "./chunk-XSAVKZSF.js";
6
- import "./chunk-PDX44BCA.js";
5
+ } from "./chunk-YAF63OWJ.js";
7
6
 
8
7
  // src/commands/login.ts
9
8
  import { createInterface } from "readline";
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-PDX44BCA.js";
3
2
 
4
3
  // src/commands/setup.ts
5
4
  import { readFile, writeFile } from "fs/promises";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztile-cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Mission control for autonomous coding agents (Claude Code, Codex, Gemini CLI)",
5
5
  "bin": {
6
6
  "ztile": "dist/cli.js"
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
- }) : x)(function(x) {
5
- if (typeof require !== "undefined") return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
- export {
10
- __require
11
- };