offgrid-ai 0.3.8 → 0.3.9
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/package.json +1 -1
- package/src/logs.mjs +2 -1
- package/src/ui.mjs +3 -2
package/package.json
CHANGED
package/src/logs.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync, statSync } from "node:fs";
|
|
|
2
2
|
import { appendFile } from "node:fs/promises";
|
|
3
3
|
import { createReadStream } from "node:fs";
|
|
4
4
|
import pc from "picocolors";
|
|
5
|
+
import { stripVTControlCharacters } from "node:util";
|
|
5
6
|
|
|
6
7
|
export function tailFriendly(rawLogPath, friendlyLogPath) {
|
|
7
8
|
let offset = existsSync(rawLogPath) ? statSync(rawLogPath).size : 0;
|
|
@@ -21,7 +22,7 @@ export function tailFriendly(rawLogPath, friendlyLogPath) {
|
|
|
21
22
|
if (!friendly || seen.has(friendly)) continue;
|
|
22
23
|
seen.add(friendly);
|
|
23
24
|
console.log(friendly);
|
|
24
|
-
await appendFile(friendlyLogPath,
|
|
25
|
+
await appendFile(friendlyLogPath, stripVTControlCharacters(friendly) + "\n", "utf8");
|
|
25
26
|
}
|
|
26
27
|
} catch { /* friendly logging must never crash */ }
|
|
27
28
|
}, 300);
|
package/src/ui.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cancel, confirm, intro, isCancel, select, text } from "@clack/prompts";
|
|
2
2
|
import pc from "picocolors";
|
|
3
|
+
import { stripVTControlCharacters } from "node:util";
|
|
3
4
|
|
|
4
5
|
export { pc };
|
|
5
6
|
export { pc as colors };
|
|
@@ -50,9 +51,9 @@ function handleCancel(value) {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export function renderRows(rows) {
|
|
53
|
-
const width = Math.max(...rows.map(([key]) =>
|
|
54
|
+
const width = Math.max(...rows.map(([key]) => stripVTControlCharacters(String(key)).length));
|
|
54
55
|
return rows.map(([key, value]) => {
|
|
55
|
-
const visible =
|
|
56
|
+
const visible = stripVTControlCharacters(String(key)).length;
|
|
56
57
|
return `${key}${" ".repeat(Math.max(1, width - visible + 2))}${value}`;
|
|
57
58
|
}).join("\n");
|
|
58
59
|
}
|