icoa-cli 2.19.85 → 2.19.86
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/dist/commands/exam.js +3 -0
- package/dist/repl.js +30 -0
- package/package.json +2 -2
package/dist/commands/exam.js
CHANGED
|
@@ -1045,6 +1045,9 @@ export function registerExamCommand(program) {
|
|
|
1045
1045
|
state.answers[num] = c;
|
|
1046
1046
|
state._lastQ = num;
|
|
1047
1047
|
saveExamState(state);
|
|
1048
|
+
// UX: visible "saved" indicator reassures beginners their answer is safe
|
|
1049
|
+
// even if they Ctrl+C or lose network. Neutral — doesn't reveal correctness.
|
|
1050
|
+
console.log(chalk.gray(' ✓ saved'));
|
|
1048
1051
|
// Per-question sync to server (real exam only). Best-effort, fire-and-forget.
|
|
1049
1052
|
// If timer expires or network drops before final submit, the server still
|
|
1050
1053
|
// has the answer. Final submit is authoritative and overwrites this.
|
package/dist/repl.js
CHANGED
|
@@ -192,6 +192,14 @@ function printSelectionMenu() {
|
|
|
192
192
|
console.log(chalk.white(' lang es') + chalk.gray(' Switch language (17 supported)'));
|
|
193
193
|
console.log(chalk.gray(' ─────────────────────────────────────────────'));
|
|
194
194
|
}
|
|
195
|
+
// Beginner-friendly safety net: make it obvious how to pause / exit / get help.
|
|
196
|
+
// This is the first place a new K-12 user lands, so the three escape hatches
|
|
197
|
+
// need to be visible without cluttering the main command list above.
|
|
198
|
+
console.log(chalk.gray(' ') +
|
|
199
|
+
chalk.gray('Tip: ') + chalk.cyan('help') + chalk.gray(' for commands · ') +
|
|
200
|
+
chalk.cyan('Ctrl+C') + chalk.gray(' pauses · ') +
|
|
201
|
+
chalk.cyan('exit') + chalk.gray(' → menu · ') +
|
|
202
|
+
chalk.cyan('quit') + chalk.gray(' closes CLI'));
|
|
195
203
|
console.log();
|
|
196
204
|
}
|
|
197
205
|
export async function startRepl(program, resumeMode) {
|
|
@@ -975,6 +983,28 @@ export async function startRepl(program, resumeMode) {
|
|
|
975
983
|
console.log();
|
|
976
984
|
rl.prompt();
|
|
977
985
|
});
|
|
986
|
+
// SIGINT (Ctrl+C) — intercept gracefully so beginners don't lose confidence.
|
|
987
|
+
// Without this listener, readline's default is to raise SIGINT which our
|
|
988
|
+
// theme.ts handler converts to process.exit(130). Installing this listener
|
|
989
|
+
// swallows that path and lets the user get oriented. If they want to exit,
|
|
990
|
+
// they type `quit` or hit Ctrl+D (sends EOF → 'close' event below).
|
|
991
|
+
rl.on('SIGINT', () => {
|
|
992
|
+
console.log();
|
|
993
|
+
if (isChatActive() || isCtf4aiActive()) {
|
|
994
|
+
console.log(chalk.yellow(' Type ') + chalk.bold.cyan('exit') + chalk.yellow(' to leave chat, or Ctrl+D to close ICOA CLI.'));
|
|
995
|
+
}
|
|
996
|
+
else if (getExamState()) {
|
|
997
|
+
console.log(chalk.yellow(' Exam paused. Your answers are auto-saved.'));
|
|
998
|
+
console.log(chalk.white(' Resume: ') + chalk.cyan('exam q 1') +
|
|
999
|
+
chalk.gray(' · Back to menu: ') + chalk.cyan('back') +
|
|
1000
|
+
chalk.gray(' · Close CLI: ') + chalk.cyan('quit'));
|
|
1001
|
+
}
|
|
1002
|
+
else {
|
|
1003
|
+
console.log(chalk.yellow(' Press Ctrl+D or type ') + chalk.bold.cyan('quit') + chalk.yellow(' to close. ') + chalk.bold.cyan('help') + chalk.yellow(' for commands.'));
|
|
1004
|
+
}
|
|
1005
|
+
console.log();
|
|
1006
|
+
rl.prompt();
|
|
1007
|
+
});
|
|
978
1008
|
rl.on('close', () => {
|
|
979
1009
|
stopLogSync();
|
|
980
1010
|
recordExit();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "icoa-cli",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.86",
|
|
4
4
|
"description": "ICOA CLI — The world's first CLI-native CTF competition terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"icoa",
|
|
26
26
|
"competition"
|
|
27
27
|
],
|
|
28
|
-
"license": "
|
|
28
|
+
"license": "BUSL-1.1",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@google/genai": "^1.48.0",
|
|
31
31
|
"@inquirer/prompts": "^7.5.0",
|