icoa-cli 2.15.3 → 2.15.4

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.
@@ -85,6 +85,8 @@ function printQuestion(q, answer) {
85
85
  const answered = Object.keys(state?.answers || {}).length;
86
86
  const help = getHelpState(state);
87
87
  const eliminated = help.eliminated[q.number] || [];
88
+ // Top hint
89
+ console.log(chalk.gray(' Type "back" to pause · Don\'t type "exit" (it quits CLI)'));
88
90
  // Progress bar
89
91
  printQuestionProgress(q.number, total, answered);
90
92
  // Easter egg
@@ -110,14 +112,15 @@ function printQuestion(q, answer) {
110
112
  }
111
113
  }
112
114
  console.log();
113
- // Navigation + help hint
115
+ // Bottom navigation
114
116
  const remaining = help.max - help.used;
115
117
  const helpHint = remaining > 0
116
118
  ? chalk.yellow('help') + chalk.gray(` (${remaining}/${help.max})`)
117
119
  : (help.max < 8 ? chalk.gray('help 0/5 — type ') + chalk.yellow('more help') : chalk.gray('help 0/8'));
118
- console.log(chalk.gray(' Type ') + chalk.white('A') + chalk.gray('/') + chalk.white('B') + chalk.gray('/') + chalk.white('C') + chalk.gray('/') + chalk.white('D') + chalk.gray(' to answer · ') + helpHint +
120
+ console.log(chalk.gray(' ') + chalk.white('A') + chalk.gray('/') + chalk.white('B') + chalk.gray('/') + chalk.white('C') + chalk.gray('/') + chalk.white('D') + chalk.gray(' to answer · ') + helpHint +
119
121
  (q.number > 1 ? chalk.gray(' · ') + chalk.white('prev') : '') +
120
- (q.number < total ? chalk.gray(' · ') + chalk.white('next') : ''));
122
+ (q.number < total ? chalk.gray(' · ') + chalk.white('next') : '') +
123
+ chalk.gray(' · ') + chalk.white('back'));
121
124
  }
122
125
  export function registerExamCommand(program) {
123
126
  const exam = program.command('exam').description('National selection exam');
package/dist/repl.js CHANGED
@@ -318,6 +318,16 @@ export async function startRepl(program, resumeMode) {
318
318
  logCommand(input);
319
319
  // Exit — record, reset terminal colors, and quit
320
320
  if (input === 'exit' || input === 'quit' || input === 'q') {
321
+ // During exam, warn and suggest back instead
322
+ if (getExamState()) {
323
+ console.log();
324
+ console.log(chalk.yellow(' ⚠ "exit" will close ICOA CLI entirely.'));
325
+ console.log(chalk.white(' To return to menu without quitting, type: ') + chalk.bold.cyan('back'));
326
+ console.log(chalk.gray(' Your exam progress is auto-saved.'));
327
+ console.log();
328
+ rl.prompt();
329
+ return;
330
+ }
321
331
  // stopLogSync();
322
332
  recordExit();
323
333
  console.log(chalk.gray(' Session saved. Use ') + chalk.white('icoa --resume') + chalk.gray(' to continue.'));
@@ -325,6 +335,21 @@ export async function startRepl(program, resumeMode) {
325
335
  realExit(0);
326
336
  return;
327
337
  }
338
+ // "back" — return to main menu (clear exam state for demo, keep for real)
339
+ if (input === 'back') {
340
+ const state = getExamState();
341
+ if (state) {
342
+ console.log();
343
+ console.log(chalk.gray(' Exam paused. Your progress is saved.'));
344
+ console.log(chalk.white(' Resume: exam q 1') + chalk.gray(' · ') + chalk.white('exam review') + chalk.gray(' · ') + chalk.white('exam submit'));
345
+ console.log();
346
+ }
347
+ else {
348
+ console.log(chalk.gray(' Already at main menu.'));
349
+ }
350
+ rl.prompt();
351
+ return;
352
+ }
328
353
  // Help — during exam, route to exam help; otherwise show REPL help
329
354
  if (input === 'help' || input === '?') {
330
355
  if (getExamState()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.15.3",
3
+ "version": "2.15.4",
4
4
  "description": "ICOA CLI — The world's first CLI-native CTF competition terminal",
5
5
  "type": "module",
6
6
  "bin": {