icoa-cli 2.19.24 → 2.19.26

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.
@@ -243,6 +243,8 @@ function printQuestion(q, answer) {
243
243
  console.log(chalk.yellow(' A/B/C/D') + chalk.gray(` ${t('answerThis')}`));
244
244
  console.log(chalk.yellow(' help') + ' ' + helpLabel);
245
245
  console.log(chalk.yellow(' next') + chalk.gray(' / ') + chalk.yellow('prev') + chalk.gray(` ${t('htpNav')}`));
246
+ console.log(chalk.yellow(` exam q 1..${total}`) + chalk.gray(' jump to a specific question'));
247
+ console.log(chalk.yellow(' exam review') + chalk.gray(' check progress'));
246
248
  console.log(chalk.yellow(' back') + chalk.gray(` ${t('htpBack')}`));
247
249
  console.log(chalk.yellow(' lang') + chalk.gray(` ${t('htpLang')}`));
248
250
  console.log(chalk.gray(' ─────────────────────────────────────────'));
package/dist/lib/theme.js CHANGED
@@ -1,17 +1,21 @@
1
- // Unified Darcula terminal theme — works identically on macOS Terminal.app,
2
- // iTerm2, GNOME Terminal, Konsole, Windows Terminal (cmd/PowerShell/WSL).
1
+ // Unified Darcula terminal theme — works across macOS Terminal.app, iTerm2,
2
+ // GNOME Terminal, Konsole, Windows Terminal (cmd/PowerShell/WSL).
3
3
  //
4
- // Two mechanisms are combined so every modern terminal gets the best it can:
4
+ // Three mechanisms are combined so every modern terminal gets the best it can:
5
5
  //
6
6
  // 1. OSC 10/11/12 sets the terminal's *default* fg/bg/cursor colors.
7
7
  // Honored by iTerm2, GNOME Terminal, Konsole, Windows Terminal → lossless
8
- // background, no scrollback or resize artifacts. Ignored by macOS
9
- // Terminal.app.
8
+ // background, no scrollback or resize artifacts. Ignored by Terminal.app.
10
9
  //
11
- // 2. SGR 38/48 + \x1b[2J paints the visible grid cells with Darcula colors.
12
- // Works everywhere including Terminal.app. The known limits on Terminal.app
13
- // (resize edge, scrollback of pre-launch history, copy-paste carrying bg)
14
- // are protocol-level and accepted; fix path is importing a .terminal profile.
10
+ // 2. SGR 38;2/48;2 + \x1b[2J paints with 24-bit truecolor Darcula on every
11
+ // terminal that supports truecolor. This is the default path.
12
+ //
13
+ // 3. SGR 38;5/48;5 + \x1b[2J paints with 256-color approximation on macOS
14
+ // Terminal.app. Terminal.app does NOT support truecolor SGR and mis-parses
15
+ // `\x1b[48;2;43;43;43m` as a sequence of 16-color codes — the trailing
16
+ // `43` becomes ANSI "bg yellow", which is why v2.19.23/24 rendered with a
17
+ // yellow background there. Color 235 ≈ #262626 (dark gray, ~#2B2B2B) and
18
+ // color 250 ≈ #BCBCBC (light gray, ~#A9B7C6) are close enough.
15
19
  //
16
20
  // Legacy cmd.exe (pre-Win10 1809) can't run Node 22 anyway, so no separate
17
21
  // fallback path is needed.
@@ -21,10 +25,14 @@ const OSC_INIT = '\x1b]10;#A9B7C6\x07' + // default fg
21
25
  const OSC_RESET = '\x1b]110\x07' + // reset default fg
22
26
  '\x1b]111\x07' + // reset default bg
23
27
  '\x1b]112\x07'; // reset cursor color
24
- const SGR_INIT = '\x1b[38;2;169;183;198m' + // fg #A9B7C6
28
+ const SGR_INIT_TRUECOLOR = '\x1b[38;2;169;183;198m' + // fg #A9B7C6
25
29
  '\x1b[48;2;43;43;43m' + // bg #2B2B2B
26
- '\x1b[2J' + // paint grid with current bg
27
- '\x1b[H'; // cursor home
30
+ '\x1b[2J' +
31
+ '\x1b[H';
32
+ const SGR_INIT_256 = '\x1b[38;5;250m' + // fg ≈ #BCBCBC
33
+ '\x1b[48;5;235m' + // bg ≈ #262626
34
+ '\x1b[2J' +
35
+ '\x1b[H';
28
36
  const SGR_RESET = '\x1b[0m\x1b[2J\x1b[H';
29
37
  function supportsAnsi() {
30
38
  if (!process.stdout.isTTY)
@@ -43,13 +51,20 @@ function supportsAnsi() {
43
51
  function isIcoaTerminal() {
44
52
  return process.env.ICOA_TERMINAL === '1';
45
53
  }
54
+ // macOS Terminal.app does not implement SGR truecolor (\x1b[38;2;… / \x1b[48;2;…)
55
+ // and mis-parses those sequences as 16-color codes, producing e.g. a yellow bg.
56
+ // Detect it and fall back to 256-color SGR which Terminal.app handles correctly.
57
+ function isAppleTerminal() {
58
+ return process.env.TERM_PROGRAM === 'Apple_Terminal';
59
+ }
46
60
  let armed = false;
47
61
  export function setTerminalTheme() {
48
62
  if (!supportsAnsi())
49
63
  return;
50
64
  if (isIcoaTerminal())
51
65
  return; // host is already Darcula; nothing to do
52
- process.stdout.write(OSC_INIT + SGR_INIT);
66
+ const sgr = isAppleTerminal() ? SGR_INIT_256 : SGR_INIT_TRUECOLOR;
67
+ process.stdout.write(OSC_INIT + sgr);
53
68
  if (!armed) {
54
69
  armed = true;
55
70
  // Belt-and-braces cleanup on every exit path. Without these, Ctrl+C leaves
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.19.24",
3
+ "version": "2.19.26",
4
4
  "description": "ICOA CLI — The world's first CLI-native CTF competition terminal",
5
5
  "type": "module",
6
6
  "bin": {