icoa-cli 2.19.357 → 2.19.359

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.
Files changed (75) hide show
  1. package/dist/commands/ai4ctf.js +1 -1
  2. package/dist/commands/ctf.js +1 -787
  3. package/dist/commands/ctf4ai-demo.js +1 -1
  4. package/dist/commands/ctf4vla.js +1 -1
  5. package/dist/commands/demo2.js +1 -1502
  6. package/dist/commands/doctor.d.ts +2 -0
  7. package/dist/commands/doctor.js +1 -0
  8. package/dist/commands/exam.js +1 -1
  9. package/dist/commands/files.js +1 -59
  10. package/dist/commands/lang.js +1 -202
  11. package/dist/commands/log.js +1 -171
  12. package/dist/commands/shell.js +1 -151
  13. package/dist/commands/sim.js +1 -389
  14. package/dist/index.js +1 -355
  15. package/dist/lib/access.js +1 -184
  16. package/dist/lib/aienv.js +1 -205
  17. package/dist/lib/arena-submit.js +1 -21
  18. package/dist/lib/banner.js +1 -31
  19. package/dist/lib/budget.js +1 -6
  20. package/dist/lib/challenge-dir.js +1 -16
  21. package/dist/lib/colors.js +1 -17
  22. package/dist/lib/comms.js +1 -212
  23. package/dist/lib/config.js +1 -93
  24. package/dist/lib/countdown.js +1 -43
  25. package/dist/lib/country-lang.js +1 -39
  26. package/dist/lib/ctfd-client.js +1 -417
  27. package/dist/lib/demo-exam.js +1 -478
  28. package/dist/lib/demo-flags.js +1 -27
  29. package/dist/lib/demo-stats.js +1 -62
  30. package/dist/lib/demo2-progress.js +1 -102
  31. package/dist/lib/docker-probe.js +1 -118
  32. package/dist/lib/editor-spawn.js +1 -53
  33. package/dist/lib/exam-client.js +1 -54
  34. package/dist/lib/exam-sandbox.js +1 -201
  35. package/dist/lib/exam-setup.js +1 -36
  36. package/dist/lib/exam-state.js +1 -273
  37. package/dist/lib/gemini.js +1 -247
  38. package/dist/lib/i18n.js +1 -302
  39. package/dist/lib/integrity-snapshot.js +1 -88
  40. package/dist/lib/interactive-spawn.js +1 -55
  41. package/dist/lib/ipynb-input.js +1 -65
  42. package/dist/lib/kernel-protocol.js +1 -88
  43. package/dist/lib/kernel.js +2 -146
  44. package/dist/lib/learn-curricula.js +1 -309
  45. package/dist/lib/learn-i18n.js +1 -184
  46. package/dist/lib/learn-input.js +1 -101
  47. package/dist/lib/learn-render.js +1 -863
  48. package/dist/lib/learn-state.js +1 -103
  49. package/dist/lib/log-sync.js +1 -155
  50. package/dist/lib/logger.js +1 -49
  51. package/dist/lib/main-rl.js +1 -7
  52. package/dist/lib/menu-nav.js +1 -105
  53. package/dist/lib/notebook-doc.js +1 -137
  54. package/dist/lib/open-file.js +1 -55
  55. package/dist/lib/paper-upgrade.js +1 -119
  56. package/dist/lib/platform.js +1 -99
  57. package/dist/lib/render-card.js +1 -112
  58. package/dist/lib/repl-asker.js +1 -67
  59. package/dist/lib/sample-runner.js +1 -227
  60. package/dist/lib/sandbox.js +1 -144
  61. package/dist/lib/shell-split.js +1 -69
  62. package/dist/lib/sim-cooldown.js +1 -75
  63. package/dist/lib/theme.js +1 -119
  64. package/dist/lib/token-format.js +1 -74
  65. package/dist/lib/tool-man.js +1 -418
  66. package/dist/lib/toolset-hash.js +1 -48
  67. package/dist/lib/translation.js +1 -80
  68. package/dist/lib/translations-fetcher.js +1 -95
  69. package/dist/lib/ui.js +1 -99
  70. package/dist/lib/update-check.js +1 -114
  71. package/dist/lib/version.js +1 -24
  72. package/dist/postinstall.js +1 -48
  73. package/dist/repl.js +1 -2391
  74. package/dist/types/index.js +1 -63
  75. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerDoctorCommand(program: Command): void;
@@ -0,0 +1 @@
1
+ import{execFileSync as o}from"node:child_process";import chalk from"chalk";import{getConfig as e,isConnected as n}from"../lib/config.js";import{getCliVersion as r}from"../lib/version.js";import{logCommand as t}from"../lib/logger.js";import{resolveHostPython as s,REQUIRED_PY as i}from"../lib/aienv.js";function a(o,e,n,r){const t="ok"===o?chalk.green(" ✓"):"warn"===o?chalk.yellow(" ⚠"):chalk.red(" ✗"),s=chalk.white(e.padEnd(16)),i="ok"===o?chalk.gray(n):("warn"===o?chalk.yellow:chalk.red)(n);console.log(`${t} ${s} ${i}`),r&&"ok"!==o&&console.log(chalk.gray(` → ${r}`))}function l(e,n){try{return o(e,n,{stdio:["ignore","pipe","ignore"],timeout:3e3}).toString().trim()}catch{return null}}async function c(o,e){try{const n=await fetch(o,{headers:{"User-Agent":"icoa-cli",...e??{}},signal:AbortSignal.timeout(6e3)});return{status:n.status,body:await n.text()}}catch{return null}}export function registerDoctorCommand(o){o.command("doctor").description("Run a read-only self-check: version, Node, Python, tools, server, terminal").action(async()=>{t("doctor"),console.log(),console.log(chalk.bold.white(" ICOA Doctor")+chalk.gray(" — read-only self-check (nothing is installed or changed)")),console.log(chalk.gray(" ─────────────────────────────────────────────────────"));const o=[];o.push(await async function(){const o=r(),e=await c("https://registry.npmjs.org/icoa-cli/latest");if(!e||200!==e.status)return a("warn","CLI version",`v${o} (could not reach npm to compare)`,"check your network"),"warn";let n="";try{n=JSON.parse(e.body).version??""}catch{}return n&&n!==o?(a("warn","CLI version",`v${o} — latest is v${n}`,"npm install -g icoa-cli@latest"),"warn"):(a("ok","CLI version",`v${o} (latest)`),"ok")}()),o.push(Number(process.versions.node.split(".")[0])>=22?(a("ok","Node.js",`v${process.versions.node}`),"ok"):(a("fail","Node.js",`v${process.versions.node} — need 22+`,"icoa env setup (installs the pinned Node 22.x)"),"fail")),o.push(function(){const o=s(o=>l(o,["--version"]));return o?(a("ok","Python 3.12",`${o.cmd} (${o.version.major}.${o.version.minor})`),"ok"):(a("fail","Python 3.12",`no ${i.major}.${i.minor}.x interpreter found`,"icoa env setup · or: brew install python@3.12 / apt install python3.12 python3.12-venv / py -3.12"),"fail")}()),o.push(function(){const o=["git","base64"].filter(o=>{return e=o,!(null!==l("win32"===process.platform?"where":"which",[e]));var e}),e=l("docker",["--version"]);return 0===o.length?(a("ok","Core tools","git, base64 present"+(e?" · docker (sandbox on)":" · docker absent (host-shell fallback)")),"ok"):(a("warn","Core tools",`missing: ${o.join(", ")}`,"icoa env setup (installs the CTF toolkit)"),"warn")}()),o.push(await async function(){const o=e(),r=n(),t=(o.ctfdUrl||"https://practice.icoa2026.au").replace(/\/$/,""),s=await c(`${t}/api/v1/users/me`,o.token?{Authorization:`Token ${o.token}`}:void 0);return s?r?200===s.status?(a("ok","Server",`${t} · signed in as ${o.userName||"you"}`),"ok"):401===s.status||403===s.status?(a("fail","Server",`${t} rejected your session (HTTP ${s.status})`,"your token expired — join <url> again"),"fail"):(a("warn","Server",`${t} returned HTTP ${s.status}`,"retry shortly, or re-join"),"warn"):(a("warn","Server",`${t} reachable — not signed in`,"join <url> to sign in with your account"),"warn"):(a("fail","Server",`${t} unreachable`,"check Wi-Fi / VPN / firewall, then: join <url>"),"fail")}()),o.push(function(){const o=(process.env.LANG||process.env.LC_ALL||process.env.LC_CTYPE||"").toLowerCase(),e=o.includes("utf-8")||o.includes("utf8"),n=process.stdout.columns||0;return e?n&&n<60?(a("warn","Terminal",`${n} cols — narrow (some charts fall back to text)`,"widen the window to ≥60 columns"),"warn"):(a("ok","Terminal",`UTF-8 · ${n||"?"} cols`),"ok"):(a("warn","Terminal",`locale "${o||"unset"}" is not UTF-8 (charts/QR degrade to ASCII)`,"export LANG=en_US.UTF-8"),"warn")}()),console.log(chalk.gray(" ─────────────────────────────────────────────────────"));const u=o.filter(o=>"fail"===o).length,d=o.filter(o=>"warn"===o).length;0===u&&0===d?console.log(chalk.green(" All clear — you are ready to compete.")):0===u?console.log(chalk.yellow(` ${d} warning${d>1?"s":""} — usable, but see the → fixes above.`)):console.log(chalk.red(` ${u} blocker${u>1?"s":""}`)+(d?chalk.yellow(` + ${d} warning${d>1?"s":""}`):"")+chalk.gray(" — fix the ✗ items first. Most are solved by ")+chalk.cyan("icoa env setup")),console.log()})}