jfl 0.6.0 → 0.6.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jfl",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Just Fucking Launch - CLI for AI-powered GTM and development",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -12,10 +12,24 @@ import type { PiTheme } from "./types.js"
12
12
 
13
13
  // ─── Shared helpers ──────────────────────────────────────────────────────────
14
14
 
15
+ function visibleLen(text: string): number {
16
+ return text.replace(/\x1b\[[0-9;]*m/g, "").length
17
+ }
18
+
15
19
  function truncLine(text: string, maxW: number): string {
16
- const stripped = text.replace(/\x1b\[[0-9;]*m/g, "")
17
- if (stripped.length <= maxW) return text
18
- return text.slice(0, maxW - 1) + "…"
20
+ if (visibleLen(text) <= maxW) return text
21
+ // Walk char-by-char, skipping ANSI sequences, until we hit maxW visible chars
22
+ let visible = 0
23
+ let i = 0
24
+ while (i < text.length && visible < maxW - 1) {
25
+ if (text[i] === "\x1b" && text[i + 1] === "[") {
26
+ const end = text.indexOf("m", i)
27
+ if (end !== -1) { i = end + 1; continue }
28
+ }
29
+ visible++
30
+ i++
31
+ }
32
+ return text.slice(0, i) + "\x1b[0m…"
19
33
  }
20
34
 
21
35
  function wrapText(text: string, width: number): string[] {