terminfo.dev 2.0.0 → 2.2.0

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": "terminfo.dev",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Test your terminal's feature support and contribute to terminfo.dev",
5
5
  "keywords": [
6
6
  "ansi",
package/src/detect.ts CHANGED
@@ -36,6 +36,7 @@ const TERM_PROGRAM_MAP: Record<string, string> = {
36
36
 
37
37
  /** Known macOS bundle IDs for version lookup */
38
38
  const BUNDLE_IDS: Record<string, string> = {
39
+ cmux: "com.cmuxterm.app",
39
40
  ghostty: "com.mitchellh.ghostty",
40
41
  kitty: "net.kovidgoyal.kitty",
41
42
  iterm2: "com.googlecode.iterm2",
@@ -61,9 +62,9 @@ export function detectTerminal(): TerminalInfo {
61
62
  break
62
63
  }
63
64
  }
64
- // If bundle ID didn't match known terminals, use it as-is
65
+ // If bundle ID didn't match known terminals, show the full bundle ID
65
66
  if (name === "unknown" && bundleId) {
66
- name = bundleId.split(".").pop() ?? bundleId
67
+ name = bundleId
67
68
  }
68
69
  }
69
70
 
@@ -92,6 +93,18 @@ export function detectTerminal(): TerminalInfo {
92
93
  if (termEmu) name = termEmu.toLowerCase()
93
94
  }
94
95
 
96
+ // Linux: check common env vars
97
+ if (name === "unknown") {
98
+ if (process.env.GNOME_TERMINAL_SCREEN) name = "gnome-terminal"
99
+ else if (process.env.KONSOLE_VERSION) { name = "konsole"; version = process.env.KONSOLE_VERSION }
100
+ else if (process.env.TILIX_ID) name = "tilix"
101
+ }
102
+
103
+ // Windows: check for Windows Terminal
104
+ if (name === "unknown" && os === "windows") {
105
+ if (process.env.WT_SESSION) name = "windows-terminal"
106
+ }
107
+
95
108
  // Fallback: $TERM
96
109
  if (name === "unknown") {
97
110
  name = process.env.TERM ?? "unknown"
package/src/index.ts CHANGED
@@ -187,17 +187,32 @@ program
187
187
 
188
188
  printHeader(terminal)
189
189
  console.log(``)
190
- console.log(` Will submit results for \x1b[1m${name}${version ? ` ${version}` : ""}\x1b[0m on ${terminal.os}`)
191
- if (!version) {
192
- console.log(` \x1b[33m⚠ No version detected. Use --terminal-version to specify.\x1b[0m`)
193
- }
194
190
 
191
+ // Let user confirm/edit terminal info before running probes
195
192
  const { createInterface } = await import("node:readline")
196
- const rl = createInterface({ input: process.stdin, output: process.stdout })
197
- const proceed = await new Promise<string>((resolve) => {
198
- rl.question(`\n Press Enter to run probes and submit (or Ctrl+C to cancel) `, (answer) => {
199
- rl.close()
200
- resolve(answer)
193
+
194
+ async function ask(question: string, defaultValue: string): Promise<string> {
195
+ const rl = createInterface({ input: process.stdin, output: process.stdout })
196
+ return new Promise((resolve) => {
197
+ rl.question(` ${question} [\x1b[1m${defaultValue}\x1b[0m]: `, (answer) => {
198
+ rl.close()
199
+ resolve(answer.trim() || defaultValue)
200
+ })
201
+ })
202
+ }
203
+
204
+ name = await ask("Terminal name", name)
205
+ version = await ask("Terminal version", version || "unknown")
206
+ if (version === "unknown") version = ""
207
+
208
+ console.log(``)
209
+ console.log(` Submitting as \x1b[1m${name}${version ? ` ${version}` : ""}\x1b[0m on ${terminal.os}`)
210
+
211
+ const rl2 = createInterface({ input: process.stdin, output: process.stdout })
212
+ await new Promise<void>((resolve) => {
213
+ rl2.question(` Press Enter to run probes (Ctrl+C to cancel) `, () => {
214
+ rl2.close()
215
+ resolve()
201
216
  })
202
217
  })
203
218
 
@@ -215,7 +230,7 @@ program
215
230
  notes: data.notes,
216
231
  responses: data.responses,
217
232
  generated: new Date().toISOString(),
218
- cliVersion: "2.0.0",
233
+ cliVersion: "2.2.0",
219
234
  probeCount: ALL_PROBES.length,
220
235
  })
221
236
  if (url) {
@@ -1017,11 +1017,16 @@ const sixelRender: Probe = {
1017
1017
 
1018
1018
  const osc52Clipboard: Probe = {
1019
1019
  id: "extensions.osc52-clipboard",
1020
- name: "Clipboard query (OSC 52)",
1020
+ name: "Clipboard access (OSC 52)",
1021
1021
  async run() {
1022
- const match = await query("\x1b]52;c;?\x07", /\x1b\]52;([^\x07\x1b]+)[\x07\x1b]/, 1000)
1023
- if (!match) return { pass: false, note: "No OSC 52 response" }
1024
- return { pass: true, response: match[1] }
1022
+ // Write a small test value to clipboard, then verify terminal responds
1023
+ // Don't use "?" query it returns full clipboard as huge base64 that leaks into stdin
1024
+ const testData = btoa("terminfo-test")
1025
+ process.stdout.write(`\x1b]52;c;${testData}\x07`)
1026
+ // Verify terminal still responds after OSC 52 (didn't crash/ignore)
1027
+ const pos = await queryCursorPosition()
1028
+ if (!pos) return { pass: false, note: "No response after OSC 52" }
1029
+ return { pass: true }
1025
1030
  },
1026
1031
  }
1027
1032
 
@@ -1078,7 +1083,10 @@ const extTruecolor: Probe = {
1078
1083
  if (!pos) return { pass: false, note: "No cursor response" }
1079
1084
  return {
1080
1085
  pass: pos[1] === 2,
1081
- note: pos[1] === 2 ? undefined : `cursor at col ${pos[1]}, expected 2 (truecolor sequence may have been printed literally)`,
1086
+ note:
1087
+ pos[1] === 2
1088
+ ? undefined
1089
+ : `cursor at col ${pos[1]}, expected 2 (truecolor sequence may have been printed literally)`,
1082
1090
  }
1083
1091
  },
1084
1092
  }