icoa-cli 2.14.1 → 2.14.3

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.
@@ -27,7 +27,16 @@ function checkTimeRemaining() {
27
27
  if (!deadline)
28
28
  return true;
29
29
  if (new Date() >= deadline) {
30
- printError('Time expired! Use "exam submit" to submit your answers.');
30
+ const state = getExamState();
31
+ if (state && state.session.examId === 'demo-free') {
32
+ // Demo expired — auto-clear
33
+ printWarning('Demo time expired. Starting fresh!');
34
+ printInfo('Type: demo');
35
+ clearExamState();
36
+ }
37
+ else {
38
+ printError('Time expired! Use "exam submit" to submit your answers.');
39
+ }
31
40
  return false;
32
41
  }
33
42
  return true;
@@ -549,6 +558,17 @@ export function registerExamCommand(program) {
549
558
  const answered = Object.keys(state.answers).length;
550
559
  const total = state.session.questionCount;
551
560
  const unanswered = total - answered;
561
+ if (answered === 0) {
562
+ printWarning('No answers to submit.');
563
+ if (state.session.examId === 'demo-free') {
564
+ clearExamState();
565
+ printInfo('Demo cleared. Type: demo to start again.');
566
+ }
567
+ else {
568
+ printInfo('Answer some questions first: exam q 1');
569
+ }
570
+ return;
571
+ }
552
572
  let msg = `Submit ${answered}/${total} answers?`;
553
573
  if (unanswered > 0) {
554
574
  msg += chalk.yellow(` ${unanswered} unanswered.`);
@@ -7,7 +7,7 @@ export const DEMO_SESSION = {
7
7
  examId: 'demo-free',
8
8
  examName: 'ICOA Demo Exam — Free Practice',
9
9
  startedAt: '',
10
- durationMinutes: 30,
10
+ durationMinutes: 0, // 0 = no time limit for demo
11
11
  questionCount: 30,
12
12
  country: 'ALL',
13
13
  };
@@ -30,6 +30,8 @@ export function getExamDeadline() {
30
30
  const state = getExamState();
31
31
  if (!state)
32
32
  return null;
33
+ if (!state.session.durationMinutes)
34
+ return null; // 0 = no time limit
33
35
  const start = new Date(state.session.startedAt).getTime();
34
36
  return new Date(start + state.session.durationMinutes * 60 * 1000);
35
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.14.1",
3
+ "version": "2.14.3",
4
4
  "description": "ICOA CLI — The world's first CLI-native CTF competition terminal",
5
5
  "type": "module",
6
6
  "bin": {