icoa-cli 2.19.94 → 2.19.95
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/index.js +17 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -181,4 +181,21 @@ program
|
|
|
181
181
|
console.log();
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
|
+
// Proctor-only escape hatch: `ICOA_RESET_STATE=1 icoa` wipes any abandoned
|
|
185
|
+
// exam state *before* any subcommand or REPL runs. Fires for ALL invocations
|
|
186
|
+
// (including `icoa exam <token>`) so proctors have a one-liner recovery that
|
|
187
|
+
// works regardless of which subcommand the student would run next.
|
|
188
|
+
// The token itself is untouched server-side.
|
|
189
|
+
if (process.env.ICOA_RESET_STATE === '1') {
|
|
190
|
+
try {
|
|
191
|
+
const { clearExamState } = await import('./lib/exam-state.js');
|
|
192
|
+
clearExamState();
|
|
193
|
+
console.log(chalk.yellow('⚠ ICOA_RESET_STATE=1 — local exam state wiped.'));
|
|
194
|
+
console.log(chalk.gray(' (Token NOT revoked server-side. Re-enter a fresh token with `exam <token>`.)'));
|
|
195
|
+
console.log();
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
console.log(chalk.red('⚠ ICOA_RESET_STATE: could not clear state — ') + chalk.gray(String(e)));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
184
201
|
program.parse();
|