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.
- package/dist/{chunk-XSAVKZSF.js → chunk-YAF63OWJ.js} +4 -8
- package/dist/cli.js +12 -7
- package/dist/{connect-CZ727ZOC.js → connect-TYJFBFTE.js} +1 -2
- package/dist/{credentials-OO2RZFLG.js → credentials-LO2VVMZQ.js} +1 -2
- package/dist/{disconnect-TZ3MQUZS.js → disconnect-CQLCAVXH.js} +1 -2
- package/dist/{hook-ZR4EVEUT.js → hook-WPPFPN3P.js} +8 -6
- package/dist/{login-5E7FSVVL.js → login-LHLHSMDL.js} +1 -2
- package/dist/{setup-VFHRFRZH.js → setup-BTW4UVF2.js} +0 -1
- package/package.json +1 -1
- package/dist/chunk-PDX44BCA.js +0 -11
|
@@ -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
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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:");
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
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:
|
|
85
|
-
apiKey:
|
|
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 =
|
|
160
|
+
const machineId = resolveMachineId();
|
|
159
161
|
if (hookEvent === "UserPromptSubmit") {
|
|
160
162
|
const prompt = payload["prompt"];
|
|
161
163
|
if (prompt) {
|
package/package.json
CHANGED
package/dist/chunk-PDX44BCA.js
DELETED
|
@@ -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
|
-
};
|