ztile-cli 0.3.4 → 0.3.5
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/cli.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
var args = process.argv.slice(2);
|
|
5
5
|
if (args[0] === "version" || args[0] === "--version" || args[0] === "-v") {
|
|
6
|
-
console.log("0.3.
|
|
6
|
+
console.log("0.3.5");
|
|
7
7
|
process.exit(0);
|
|
8
8
|
}
|
|
9
9
|
if (args[0] === "hook") {
|
|
10
|
-
const { handleHook } = await import("./hook-
|
|
10
|
+
const { handleHook } = await import("./hook-MZFJ2YNL.js");
|
|
11
11
|
await handleHook();
|
|
12
12
|
process.exit(0);
|
|
13
13
|
}
|
|
@@ -109,6 +109,15 @@ async function sendRawToServer(payload) {
|
|
|
109
109
|
);
|
|
110
110
|
return false;
|
|
111
111
|
}
|
|
112
|
+
try {
|
|
113
|
+
const result = await response.json();
|
|
114
|
+
const linesReceived = result["lines_received"];
|
|
115
|
+
const linesParsed = result["lines_parsed"];
|
|
116
|
+
if (linesReceived != null && linesReceived > 0 && linesParsed !== linesReceived) {
|
|
117
|
+
console.error(`[server] Parse drop: ${linesParsed}/${linesReceived} lines parsed, ${result["total_events"]} events`);
|
|
118
|
+
}
|
|
119
|
+
} catch {
|
|
120
|
+
}
|
|
112
121
|
return true;
|
|
113
122
|
} catch (error) {
|
|
114
123
|
console.error(
|
|
@@ -148,7 +157,7 @@ async function handleHook() {
|
|
|
148
157
|
const transcriptPath = payload["transcript_path"];
|
|
149
158
|
const sessionId = payload["session_id"];
|
|
150
159
|
const cwd = payload["cwd"];
|
|
151
|
-
debugLog(`[hook] ${hookEvent}:
|
|
160
|
+
debugLog(`[hook] ${hookEvent}: session=${sessionId?.slice(0, 12)} transcript=${transcriptPath?.split("/").pop()} keys=${Object.keys(payload).join(", ")}`);
|
|
152
161
|
if (!transcriptPath) {
|
|
153
162
|
debugLog("[hook] No transcript_path in payload, skipping");
|
|
154
163
|
return;
|
|
@@ -196,7 +205,6 @@ async function handleHook() {
|
|
|
196
205
|
project: cwd
|
|
197
206
|
});
|
|
198
207
|
debugLog(`[hook] ${hookEvent}` + (ok ? " \u2192 server" : " (send failed)"));
|
|
199
|
-
return;
|
|
200
208
|
}
|
|
201
209
|
const locked = await acquireLock();
|
|
202
210
|
if (!locked) {
|
|
@@ -206,6 +214,7 @@ async function handleHook() {
|
|
|
206
214
|
try {
|
|
207
215
|
const fromOffset = await getByteOffset(transcriptPath);
|
|
208
216
|
const fileInfo = await stat(transcriptPath);
|
|
217
|
+
debugLog(`[hook] ${hookEvent}: offset=${fromOffset} fileSize=${fileInfo.size} file=${transcriptPath.split("/").pop()}`);
|
|
209
218
|
if (fileInfo.size <= fromOffset) {
|
|
210
219
|
debugLog(`[hook] ${hookEvent}: no diff (offset ${fromOffset} \u2192 ${fileInfo.size})`);
|
|
211
220
|
await updateByteOffset(transcriptPath, fileInfo.size, sessionId);
|