icoa-cli 2.1.6 → 2.1.8
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 +1 -1
- package/dist/lib/ui.d.ts +2 -1
- package/dist/lib/ui.js +16 -0
- package/dist/repl.js +7 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ ${LINE}
|
|
|
36
36
|
${chalk.white('Sydney, Australia')} ${chalk.gray('Jun 27 - Jul 2, 2026')}
|
|
37
37
|
${chalk.cyan.underline('https://icoa2026.au')}
|
|
38
38
|
|
|
39
|
-
${chalk.gray('CLI-Native Competition Terminal v2.1.
|
|
39
|
+
${chalk.gray('CLI-Native Competition Terminal v2.1.8')}
|
|
40
40
|
|
|
41
41
|
${LINE}
|
|
42
42
|
`;
|
package/dist/lib/ui.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export declare function printWarning(msg: string): void;
|
|
|
4
4
|
export declare function printInfo(msg: string): void;
|
|
5
5
|
export declare function printTable(headers: string[], rows: string[][]): void;
|
|
6
6
|
export declare function printMarkdown(text: string): void;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function setReplMode(enabled: boolean): void;
|
|
8
|
+
export declare function createSpinner(text: string): any;
|
|
8
9
|
export declare function formatCountdown(targetDate: Date): string;
|
|
9
10
|
export declare function printHeader(title: string): void;
|
|
10
11
|
export declare function printKeyValue(key: string, value: string): void;
|
package/dist/lib/ui.js
CHANGED
|
@@ -32,7 +32,23 @@ export function printMarkdown(text) {
|
|
|
32
32
|
console.log(rendered);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
// In REPL mode, spinners conflict with readline — use simple log instead
|
|
36
|
+
let replMode = false;
|
|
37
|
+
export function setReplMode(enabled) { replMode = enabled; }
|
|
35
38
|
export function createSpinner(text) {
|
|
39
|
+
if (replMode) {
|
|
40
|
+
// Fake spinner that just logs — no terminal cursor manipulation
|
|
41
|
+
const fake = {
|
|
42
|
+
text,
|
|
43
|
+
start() { console.log(chalk.cyan(' ' + text)); return fake; },
|
|
44
|
+
stop() { return fake; },
|
|
45
|
+
succeed(msg) { console.log(chalk.green(' ✓ ' + msg)); return fake; },
|
|
46
|
+
fail(msg) { console.log(chalk.red(' ✗ ' + msg)); return fake; },
|
|
47
|
+
info(msg) { console.log(chalk.blue(' ℹ ' + msg)); return fake; },
|
|
48
|
+
warn(msg) { console.log(chalk.yellow(' ⚠ ' + msg)); return fake; },
|
|
49
|
+
};
|
|
50
|
+
return fake;
|
|
51
|
+
}
|
|
36
52
|
return ora({ text, color: 'cyan' });
|
|
37
53
|
}
|
|
38
54
|
export function formatCountdown(targetDate) {
|
package/dist/repl.js
CHANGED
|
@@ -3,6 +3,7 @@ import { spawn, execSync as execSyncFn } from 'node:child_process';
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { isConnected, getConfig } from './lib/config.js';
|
|
5
5
|
import { isActivated, activateToken, isFreeCommand, isDeviceMatch, recordExit, recordResume, isFirstRunOrUpgrade, markVersionSeen } from './lib/access.js';
|
|
6
|
+
import { setReplMode } from './lib/ui.js';
|
|
6
7
|
import { resetTerminalTheme } from './lib/theme.js';
|
|
7
8
|
import { ensureSandbox, runInSandbox, isDockerAvailable } from './lib/sandbox.js';
|
|
8
9
|
import { logCommand } from './lib/logger.js';
|
|
@@ -26,7 +27,7 @@ const BLOCKED_COMMANDS = new Set([
|
|
|
26
27
|
'iptables', 'ufw', // firewall
|
|
27
28
|
]);
|
|
28
29
|
const INTERCEPT = '__REPL_NO_EXIT__';
|
|
29
|
-
const VERSION = '2.1.
|
|
30
|
+
const VERSION = '2.1.8';
|
|
30
31
|
export async function startRepl(program, resumeMode) {
|
|
31
32
|
const config = getConfig();
|
|
32
33
|
const connected = isConnected();
|
|
@@ -137,6 +138,7 @@ export async function startRepl(program, resumeMode) {
|
|
|
137
138
|
terminal: true,
|
|
138
139
|
});
|
|
139
140
|
let processing = false;
|
|
141
|
+
setReplMode(true);
|
|
140
142
|
// Log sync disabled until server audit endpoint is configured
|
|
141
143
|
// startLogSync();
|
|
142
144
|
rl.prompt();
|
|
@@ -273,27 +275,22 @@ export async function startRepl(program, resumeMode) {
|
|
|
273
275
|
throw new Error(INTERCEPT);
|
|
274
276
|
});
|
|
275
277
|
try {
|
|
276
|
-
|
|
277
|
-
const timeout = new Promise((_, reject) => setTimeout(() => reject(new Error('Command timed out')), 5000));
|
|
278
|
-
await Promise.race([
|
|
279
|
-
program.parseAsync(['node', 'icoa', ...args]),
|
|
280
|
-
timeout,
|
|
281
|
-
]);
|
|
278
|
+
await program.parseAsync(['node', 'icoa', ...args]);
|
|
282
279
|
}
|
|
283
280
|
catch (err) {
|
|
284
281
|
const msg = err instanceof Error ? err.message : String(err);
|
|
285
282
|
if (msg === INTERCEPT) {
|
|
286
283
|
// Command tried to exit — continue REPL
|
|
287
284
|
}
|
|
288
|
-
else if (msg === 'Command timed out') {
|
|
289
|
-
console.log(chalk.yellow(' Command timed out. Try again.'));
|
|
290
|
-
}
|
|
291
285
|
else if (msg.includes('commander.unknownCommand')) {
|
|
292
286
|
console.log(chalk.yellow(` Unknown command: ${cmd}. Type 'help' for commands.`));
|
|
293
287
|
}
|
|
294
288
|
else if (msg.includes('commander.')) {
|
|
295
289
|
// Internal Commander errors — ignore
|
|
296
290
|
}
|
|
291
|
+
else if (msg.includes('fetch failed') || msg.includes('ECONNREFUSED') || msg.includes('ETIMEDOUT')) {
|
|
292
|
+
console.log(chalk.yellow(' Network error. Check your connection.'));
|
|
293
|
+
}
|
|
297
294
|
}
|
|
298
295
|
finally {
|
|
299
296
|
process.exit = realExit;
|