@pi-unipi/utility 2.0.4 → 2.0.7

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/README.md CHANGED
@@ -128,9 +128,12 @@ import { detectCapabilities, getIcon } from "@pi-unipi/utility/display/capabilit
128
128
 
129
129
  const caps = detectCapabilities();
130
130
  console.log("Nerd Font:", caps.nerdFont);
131
+ console.log("Truecolor:", caps.truecolor);
131
132
  console.log(getIcon("󰘳", "[OK]")); // Uses Nerd Font if available
132
133
  ```
133
134
 
135
+ Capability detection distinguishes basic color, xterm-256-compatible terminals, and truecolor-capable terminals. Apple Terminal is treated as color-capable but not truecolor-capable so renderers can fall back safely.
136
+
134
137
  ## Privacy
135
138
 
136
139
  The analytics collector is privacy-respecting:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/utility",
3
- "version": "2.0.4",
3
+ "version": "2.0.7",
4
4
  "description": "Utility commands and tools for Pi coding agent — lifecycle, diagnostics, cache, analytics, display, batch execution",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -42,24 +42,38 @@ function detectColorSupport(): { color: boolean; truecolor: boolean } {
42
42
  const term = env.TERM || "";
43
43
  const termProgram = env.TERM_PROGRAM || "";
44
44
 
45
- // Truecolor support
46
- const truecolorTerms = [
47
- "truecolor",
48
- "24bit",
49
- "xterm-256color",
50
- "screen-256color",
51
- "tmux-256color",
52
- "alacritty",
53
- "kitty",
54
- "wezterm",
55
- "iTerm",
45
+ // Apple Terminal.app does NOT support 24-bit truecolor (longstanding
46
+ // limitation as of macOS 26). Force 256-colour even if some wrapper
47
+ // leaked COLORTERM=truecolor into the environment.
48
+ const isAppleTerminal = termProgram === "Apple_Terminal";
49
+
50
+ // Truecolor TERM_PROGRAM allow-list. Note: terminfo names like
51
+ // "xterm-256color" / "screen-256color" / "tmux-256color" advertise
52
+ // 256-colour, NOT truecolor — they must not appear here.
53
+ const truecolorTermPrograms = [
54
+ "iTerm.app",
55
+ "WezTerm",
56
+ "Alacritty",
57
+ "vscode",
58
+ "Hyper",
59
+ "Warp",
56
60
  "ghostty",
61
+ "Ghostty",
62
+ "zed",
63
+ "Zed",
64
+ "cursor",
65
+ "Cursor",
57
66
  ];
58
67
 
59
- const hasTruecolor =
60
- env.COLORTERM === "truecolor" ||
61
- env.COLORTERM === "24bit" ||
62
- truecolorTerms.some((t) => term.includes(t) || termProgram.includes(t));
68
+ // Truecolor TERM tokens (the rare TERM that *does* advertise truecolor).
69
+ const truecolorTermTokens = ["truecolor", "24bit", "alacritty", "kitty", "wezterm"];
70
+
71
+ const hasTruecolor = isAppleTerminal
72
+ ? false
73
+ : env.COLORTERM === "truecolor" ||
74
+ env.COLORTERM === "24bit" ||
75
+ truecolorTermPrograms.includes(termProgram) ||
76
+ truecolorTermTokens.some((t) => term.includes(t));
63
77
 
64
78
  // Basic color support
65
79
  const hasColor =