icoa-cli 2.15.4 → 2.15.5

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.
@@ -25,7 +25,7 @@ export function registerLangCommand(program) {
25
25
  program
26
26
  .command('lang [code]')
27
27
  .description('Switch display language')
28
- .action((code) => {
28
+ .action(async (code) => {
29
29
  logCommand(`lang ${code || ''}`);
30
30
  if (!code) {
31
31
  const config = getConfig();
@@ -50,9 +50,25 @@ export function registerLangCommand(program) {
50
50
  }
51
51
  saveConfig({ language: code });
52
52
  printSuccess(`Language set to: ${LANG_NAMES[code] || code}`);
53
- // If exam in progress, show current question to resume
53
+ // If demo exam in progress, reload questions in new language
54
54
  const state = getExamState();
55
- if (state) {
55
+ if (state && state.session.examId === 'demo-free') {
56
+ try {
57
+ const { getLocalizedDemoQuestions, getLocalizedDemoSession } = await import('../lib/demo-exam.js');
58
+ state.questions = getLocalizedDemoQuestions();
59
+ state.session.examName = getLocalizedDemoSession().examName;
60
+ const { saveExamState } = await import('../lib/exam-state.js');
61
+ saveExamState(state);
62
+ const currentQ = state._lastQ || 1;
63
+ console.log();
64
+ console.log(chalk.green(` Demo questions reloaded in ${LANG_NAMES[code] || code}.`));
65
+ console.log(chalk.white(` Resuming: exam q ${currentQ}`));
66
+ }
67
+ catch {
68
+ console.log(chalk.gray(' Language changed. Resume with: exam q 1'));
69
+ }
70
+ }
71
+ else if (state) {
56
72
  const currentQ = state._lastQ || 1;
57
73
  console.log();
58
74
  console.log(chalk.gray(` Exam in progress — resuming Q${currentQ}:`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.15.4",
3
+ "version": "2.15.5",
4
4
  "description": "ICOA CLI — The world's first CLI-native CTF competition terminal",
5
5
  "type": "module",
6
6
  "bin": {