icoa-cli 2.19.243 → 2.19.245

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.
@@ -1 +1 @@
1
- import chalk from"chalk";import{createInterface as e}from"node:readline";import{spawn as o}from"node:child_process";import{getMainRl as r}from"../lib/main-rl.js";import{existsSync as n}from"node:fs";import{dirname as l,join as t}from"node:path";import{fileURLToPath as a}from"node:url";import{loadCurriculumById as c,validateEAToken as s,syncProgress as i,syncCardFeedback as u}from"../lib/learn-curricula.js";import{getConfig as d,saveConfig as g}from"../lib/config.js";import{loadLearnState as m,saveLearnState as y,newLearnState as f,updateStreak as p,markCardComplete as h,recordMCQ as b,recordCheck as w,markPracticalComplete as k,addAchievement as C}from"../lib/learn-state.js";import{renderWelcome as v,renderKnowledgeCard as A,renderMCQCard as E,renderMCQFeedback as I,renderPracticalCard as _,renderPracticalSuccess as D,renderSimDemoCard as O,renderMilestone as S,renderStatus as P,renderPhaseComplete as $,renderCurriculumComplete as T}from"../lib/learn-render.js";import{printError as L}from"../lib/ui.js";export function registerLearnCommand(M){M.command("learn [token]").description("Enter learn mode (free demo, or team-issued EA/EI/AC/CA/IO/IA token for full curriculum)").action(async M=>{M&&M.trim()||(console.log(),console.log(chalk.gray(" No token given — starting free 11-card demo (")+chalk.bold.green("LEARNDEMO01")+chalk.gray(").")),console.log(chalk.gray(" Full curriculum (96 / 360 cards): ")+chalk.bold.yellow("learn EA|EI|AC|CA|IO|IA + 8 chars")+chalk.gray(" — token from your country team leader.")),console.log(),M="LEARNDEMO01");const j=M.trim().toUpperCase();let x=null;const N=/^(LEARNDEMO01|AI4CTFDEMO01|CTF4AIDEMO01)$/i.test(j),q=/^(EA|EI|AC|CA|IO|IA)[A-Z0-9]{8}$/i.test(j);if(N)console.log(),console.log(chalk.gray(" Loading demo curriculum...")),x=await c(j);else if(q){const e=d().ctfdUrl||"https://practice.icoa2026.au";console.log(),console.log(chalk.gray(" Validating token..."));const o=await s(j,e);if(!o.ok)return L(`Token validation failed: ${o.message}`),console.log(),console.log(chalk.gray(" Possible causes:")),console.log(chalk.gray(" · Token expired or revoked")),console.log(chalk.gray(" · Network down (check connection)")),console.log(chalk.gray(" · Typo in token")),void console.log();if(console.log(chalk.green(` ✓ Token valid · curriculum: ${o.curriculumId} · status: ${o.status}`)),x=await c(o.curriculumId||"LEARNDEMO01"),!x)return L(`Failed to fetch curriculum '${o.curriculumId}' from server.`),console.log(chalk.gray(" This is usually a transient network issue. Try again in a minute.")),void console.log(chalk.gray(" If it persists, check ")+chalk.cyan(e)+chalk.gray(" is reachable."))}if(!x)return L(`Unknown learn token: ${j}`),console.log(),console.log(chalk.gray(" Available tokens:")),console.log(chalk.gray(" ")+chalk.bold.green("LEARNDEMO01")+chalk.gray(" free 11-card demo (anyone can use)")),console.log(chalk.gray(" ")+chalk.bold.yellow("EA|EI|AC|CA|IO|IA")+chalk.gray(" + 8 chars full 96 / 360-card curriculum (issued by team leader)")),console.log(),console.log(chalk.gray(" Tracks: ")+chalk.cyan("EA")+chalk.gray("=ctf4eai · ")+chalk.cyan("AC")+chalk.gray("=ai4ctf · ")+chalk.cyan("CA")+chalk.gray("=ctf4ai · ")+chalk.cyan("IO")+chalk.gray("=ioai · ")+chalk.cyan("IA")+chalk.gray("=iaio")),console.log(),console.log(chalk.gray(" To get a 360-card olympiad-prep curriculum, email ")),console.log(chalk.gray(" ")+chalk.cyan("asra@icoa2026.au")+chalk.gray(" or ask your country's team leader.")),void console.log();let F=m(),R=!1;F&&F.token===j?p(F):(F=f(j,x.id,x.totalCards),R=!0),y(F),v(x,F,R);const U=r(),z=null!==U,B=z?U.listeners("line").slice():[];z&&U.removeAllListeners("line");const J=z?U:e({input:process.stdin,output:process.stdout,terminal:!0}),W=()=>{J.setPrompt(chalk.bold.cyan("icoa learn> ")),J.prompt()};W();let K=null,Q=null,G=null,V=null,Z=!1,H=0;const X=(d().language||"en").toLowerCase().startsWith("zh"),Y=[];let ee=null;const oe=new Promise(e=>{ee=e}),re=()=>{const e=ee;ee=null,e?.()},ne="1"===process.env.ICOA_LEARN_EMBEDDED,le=e=>x.cards.find(o=>o.number===e),te=e=>{const o=x.modules.find(o=>o.cardRange[1]===e);if(!o)return!1;const r=x.modules.find(e=>e.number===o.number+1);return $(x,F,o,r),!0},ae=()=>{Z=!0,console.log(chalk.gray(X?" 按 Enter 进入下一阶段…":" Press Enter to continue to the next phase…"))},ce=()=>{const e=le(F.currentCard);if(!e)return console.log(),console.log(chalk.gray(" No more cards in this curriculum.")),console.log(chalk.gray(" Type ")+chalk.bold.green("status")+chalk.gray(" for the dashboard or ")+chalk.bold.green("quit")+chalk.gray(" to exit.")),void console.log();switch(e.type){case"knowledge":A(e,x),e.check?(G=e.number,H=Date.now()):(h(F,e.number),y(F));break;case"mcq":E(e,x),K=e.number;break;case"practical":_(e,x),Q=e.number;break;case"sim_demo":O(e,x),h(F,e.number),y(F);break;case"milestone":S(e,x),C(F,e.badge),h(F,e.number),y(F)}};J.on("line",async e=>{const r=e.trim().toLowerCase();if(null!==V){const o=e.trim(),r=V;if(V=null,""===o)console.log(chalk.gray(X?" 已取消(未提交)。":" Cancelled (nothing submitted)."));else{const e=d(),n=H>0?Date.now()-H:void 0;Y.push(u(j,e.ctfdUrl||"https://practice.icoa2026.au",{curriculum_id:x.id,card_number:r,feedback_text:o,time_on_card_ms:n}).catch(()=>{})),console.log(chalk.green(X?" ✓ 已收到,谢谢帮助完善这张卡。":" ✓ Thanks — your report was recorded."))}return console.log(),void W()}if(Z)return Z=!1,ce(),void W();if(r)if("menu"!==r&&"menu confirm"!==r)if("quit"!==r&&"exit"!==r&&"q"!==r){if("status"===r)return P(x,F),void W();if("lang"===r||r.startsWith("lang ")){const e=r.slice(4).trim();if(!e)return console.log(chalk.gray(" 当前语言 / current: ")+chalk.white(d().language||"en")+chalk.gray(" · ")+chalk.bold.green("lang zh")+chalk.gray(" / ")+chalk.bold.green("lang en")),void W();const o=x.cards.some(e=>null!=e._zh),n=e.toLowerCase().startsWith("zh")?"zh":e.toLowerCase(),l="en"===n||"zh"===n&&o,t=l?n:"en";return g({language:t}),l?console.log(chalk.green(" ✓ ")+chalk.gray("语言 / language → ")+chalk.white(t)):console.log(chalk.yellow(" ! ")+chalk.gray(`${e} 本课暂无翻译,已用英文 / not available — using English`)),G=null,K=null,Q=null,V=null,Z=!1,ce(),void W()}if("sim"===r){const e=le(F.currentCard);return e&&"sim_demo"===e.type?(function(e){const r=function(){const e=l(a(import.meta.url)),o=[t(e,"..","..","panda","mujoco-launcher.py"),t(e,"..","..","..","panda","mujoco-launcher.py")];for(const e of o)if(n(e))return e;return null}();if(!r)return console.log(chalk.yellow(" MuJoCo launcher not found.")),console.log(chalk.gray(" Get it from: https://github.com/newaipanda/ICOA_CLI/blob/main/panda/mujoco-launcher.py")),void console.log(chalk.gray(" Or use the sandbox-vla docker image (Phase 3)."));const c={baseline:"baseline",prompt_injected:"prompt_inj",patch_attacked:"patch",modality_confused:"confused"}[e]||"baseline";console.log(chalk.gray(` Launching MuJoCo viewer (scenario: ${c})...`)),console.log(chalk.gray(" Close the window or press ESC to return to learn mode.")),o("python3",[r,c,"--seconds","5"],{stdio:"inherit"}).on("exit",e=>{0!==e?console.log(chalk.yellow(` MuJoCo exited with code ${e} (install: pip install mujoco)`)):console.log(chalk.gray(" Returned from sim."))})}(e.simAction),void W()):(console.log(chalk.gray(" (sim only available on simulation cards)")),void W())}if("bookmark"===r){const e=F.currentCard;return F.bookmarks.includes(e)||F.bookmarks.push(e),y(F),console.log(chalk.gray(` ✓ Card ${e} bookmarked.`)),void W()}if("e"===r)return V=F.currentCard,console.log(chalk.gray(X?" 描述问题(回车提交 / 空行取消):":" Describe the issue (Enter to submit / blank to cancel):")),void W();if("back"===r||"b"===r)return F.currentCard>1&&(F.currentCard-=1),K=null,Q=null,G=null,y(F),ce(),void W();if(r.startsWith("card ")){const e=r.slice(5).trim(),o=parseInt(e,10);return!Number.isInteger(o)||o<1||o>x.totalCards?(console.log(chalk.yellow(` Card number must be 1..${x.totalCards}. Try: `)+chalk.bold.green("card 1")),void W()):(F.currentCard=o,K=null,Q=null,G=null,y(F),ce(),void W())}if(null!==G&&["y","yes","n","no"].includes(r)){const e=le(G);if(e&&"knowledge"===e.type&&e.check){const o=r.startsWith("y")?"y":"n",n=o===e.check.answer,l=Date.now()-H;h(F,e.number),w(F,e.number,{answer:o,correct:n,submittedAt:(new Date).toISOString()}),y(F);const{renderCheckFeedback:t}=await import("../lib/learn-render.js");t(e,o,n,!1);const a=d();if(Y.push(i(j,a.ctfdUrl||"https://practice.icoa2026.au",{card_number:e.number,event_type:"check_answered",check_answer:o,check_correct:n,time_on_card_ms:l}).catch(()=>{})),G=null,F.currentCard<x.totalCards){const e=F.currentCard;F.currentCard+=1,y(F),te(e)?ae():ce(),W()}else T(x,F),W();return}}if(null!==K&&["a","b","c","d"].includes(r)){const e=le(K);if(e&&"mcq"===e.type){const o=r.toUpperCase(),n=o===e.answer;b(F,e.number,{answer:o,correct:n,submittedAt:(new Date).toISOString()}),h(F,e.number),y(F),I(e,o,n,F);const l=d();return Y.push(i(j,l.ctfdUrl||"https://practice.icoa2026.au",{card_number:e.number,event_type:"mcq_answered",mcq_answer:o,mcq_correct:n}).catch(()=>{})),K=null,void(n?F.currentCard<x.totalCards?(F.currentCard+=1,y(F),ce()):(T(x,F),W()):W())}}if(null!==Q){if("done"===r){const e=le(Q);if(e&&"practical"===e.type)return k(F,e.number),h(F,e.number),y(F),D(e),Q=null,void W()}if("skip"===r)return h(F,Q),y(F),console.log(chalk.gray(" Skipped (counts as not completed).")),console.log(),Q=null,void W()}if("ok"===r||"next"===r||"continue"===r||"n"===r){if(null!==K)return console.log(chalk.yellow(" Please answer the MCQ first (A / B / C / D).")),void W();if(null!==Q)return console.log(chalk.yellow(" Please type ")+chalk.bold.green("done")+chalk.yellow(" or ")+chalk.bold.yellow("skip")+chalk.yellow(" for the practical.")),void W();if(null!==G)return console.log(chalk.yellow(" Please answer the check above (")+chalk.bold.green("y")+chalk.yellow(" or ")+chalk.bold.green("n")+chalk.yellow(").")),void W();const e=F.currentCard;return F.currentCard+=1,y(F),F.currentCard>x.totalCards?T(x,F):te(e)?ae():ce(),void W()}if(null!==G)return console.log(chalk.yellow(" Please answer the check above (")+chalk.bold.green("y")+chalk.yellow(" or ")+chalk.bold.green("n")+chalk.yellow(").")),void W();if(null!==K)return console.log(chalk.yellow(" Please answer the MCQ first (A / B / C / D).")),void W();if(null!==Q)return console.log(chalk.yellow(" Please type ")+chalk.bold.green("done")+chalk.yellow(" or ")+chalk.bold.yellow("skip")+chalk.yellow(" for the practical.")),void W();console.log(chalk.gray(" Unknown command. Try: ")+chalk.white("ok")+chalk.gray(" / ")+chalk.white("status")+chalk.gray(" / ")+chalk.white("card N")+chalk.gray(" / ")+chalk.white("quit")),W()}else if(Y.length>0&&await Promise.race([Promise.allSettled(Y),new Promise(e=>setTimeout(e,5e3))]),console.log(),console.log(chalk.gray(" Saved. See you next session.")),console.log(chalk.gray(" Streak: ")+chalk.yellow(`🔥 ${F.streakDays} day(s)`)),console.log(),z){J.removeAllListeners("line");for(const e of B)J.on("line",e);J.prompt(),re()}else J.removeAllListeners("line"),J.close();else if(Y.length>0&&await Promise.race([Promise.allSettled(Y),new Promise(e=>setTimeout(e,3e3))]),J.removeAllListeners("line"),z||!ne){const{returnToMainMenu:e}=await import("../lib/menu-nav.js");e(z?J:void 0),re()}else J.close();else W()}),z||J.on("close",async()=>{Y.length>0&&await Promise.race([Promise.allSettled(Y),new Promise(e=>setTimeout(e,5e3))]),ne?re():process.exit(0)}),ce(),W(),await oe}),M.command("learn-pull [id]").description("Pre-download learn curricula to ~/.icoa/learn-cache/ for offline use (default: all)").action(async e=>{const o=e?[e.trim()]:["LEARNDEMO01","AI4CTFDEMO01","CTF4AIDEMO01","ai4ctf-96","ai4ctf-360","ctf4ai-96","ctf4ai-360","ctf4eai-96","ctf4eai-360","embodied-ai-100","embodied-ai-480"];console.log(),console.log(chalk.bold.cyan(" ICOA learn-pull — fetching curricula for offline use")),console.log(chalk.gray(` Server: ${(()=>{try{return JSON.parse(require("node:fs").readFileSync(require("node:path").join(require("node:os").homedir(),".icoa","config.json"),"utf-8")).ctfdUrl||"https://practice.icoa2026.au"}catch{return"https://practice.icoa2026.au"}})()}`)),console.log();let r=0,n=0,l=0;for(const e of o){process.stdout.write(` ${e.padEnd(22)} `);const o=Date.now(),t=await c(e),a=Date.now()-o;if(t){const e=t.cards,o=Array.isArray(e)?e.length:0,n=JSON.stringify(t).length;l+=n,console.log(chalk.green("✓ ")+chalk.gray(`${o.toString().padStart(3)} cards · ${(n/1024).toFixed(1).padStart(6)} KB · ${a.toString().padStart(4)} ms`)),r++}else console.log(chalk.red("✗ failed (server unreachable or unknown id)")),n++}console.log(),console.log(chalk.gray(" Summary: ")+chalk.green.bold(`${r} cached`)+chalk.gray(` · ${n} failed · total ${(l/1024).toFixed(0)} KB`)),console.log(chalk.gray(" Cache: ")+chalk.cyan("~/.icoa/learn-cache/")),console.log()})}
1
+ import chalk from"chalk";import{createInterface as e}from"node:readline";import{spawn as o}from"node:child_process";import{getMainRl as r}from"../lib/main-rl.js";import{existsSync as n}from"node:fs";import{dirname as l,join as t}from"node:path";import{fileURLToPath as a}from"node:url";import{loadCurriculumById as c,validateEAToken as s,syncProgress as i,syncCardFeedback as u}from"../lib/learn-curricula.js";import{getConfig as d,saveConfig as g}from"../lib/config.js";import{loadLearnState as m,saveLearnState as y,newLearnState as f,updateStreak as p,markCardComplete as h,recordMCQ as b,recordCheck as w,markPracticalComplete as k,addAchievement as C}from"../lib/learn-state.js";import{renderWelcome as v,renderKnowledgeCard as A,renderMCQCard as E,renderMCQFeedback as _,renderPracticalCard as I,renderPracticalSuccess as D,renderSimDemoCard as O,renderMilestone as S,renderStatus as P,renderPhaseComplete as $,renderCurriculumComplete as T}from"../lib/learn-render.js";import{printError as L}from"../lib/ui.js";export function registerLearnCommand(M){M.command("learn [token]").description("Enter learn mode (free demo, or team-issued EA/EI/AC/CA/IO/IA token for full curriculum)").action(async M=>{M&&M.trim()||(console.log(),console.log(chalk.gray(" No token given — starting free 11-card demo (")+chalk.bold.green("LEARNDEMO01")+chalk.gray(").")),console.log(chalk.gray(" Full curriculum: ")+chalk.bold.yellow("learn EA|EI|AC|CA|IO|IA + 8 chars")+chalk.gray(" — token from your country team leader.")),console.log(),M="LEARNDEMO01");const j=M.trim().toUpperCase();let x=null;const N=/^(LEARNDEMO01|AI4CTFDEMO01|CTF4AIDEMO01)$/i.test(j),q=/^[A-Z]{2}[A-Z0-9]{8}$/i.test(j);if(N)console.log(),console.log(chalk.gray(" Loading demo curriculum...")),x=await c(j);else if(q){const e=d().ctfdUrl||"https://practice.icoa2026.au";console.log(),console.log(chalk.gray(" Validating token..."));const o=await s(j,e);if(!o.ok)return L(`Token validation failed: ${o.message}`),console.log(),console.log(chalk.gray(" Possible causes:")),console.log(chalk.gray(" · Token expired or revoked")),console.log(chalk.gray(" · Network down (check connection)")),console.log(chalk.gray(" · Typo in token")),void console.log();if(console.log(chalk.green(` ✓ Token valid · curriculum: ${o.curriculumId} · status: ${o.status}`)),x=await c(o.curriculumId||"LEARNDEMO01"),!x)return L(`Failed to fetch curriculum '${o.curriculumId}' from server.`),console.log(chalk.gray(" This is usually a transient network issue. Try again in a minute.")),void console.log(chalk.gray(" If it persists, check ")+chalk.cyan(e)+chalk.gray(" is reachable."))}if(!x)return L(`Unknown learn token: ${j}`),console.log(),console.log(chalk.gray(" Available tokens:")),console.log(chalk.gray(" ")+chalk.bold.green("LEARNDEMO01")+chalk.gray(" free 11-card demo (anyone can use)")),console.log(chalk.gray(" ")+chalk.bold.yellow("EA|EI|AC|CA|IO|IA")+chalk.gray(" + 8 chars full curriculum (issued by team leader)")),console.log(),console.log(chalk.gray(" Tracks: ")+chalk.cyan("EA")+chalk.gray("=ctf4eai · ")+chalk.cyan("AC")+chalk.gray("=ai4ctf · ")+chalk.cyan("CA")+chalk.gray("=ctf4ai · ")+chalk.cyan("IO")+chalk.gray("=ioai · ")+chalk.cyan("IA")+chalk.gray("=iaio")),console.log(),console.log(chalk.gray(" To get a full curriculum, email ")),console.log(chalk.gray(" ")+chalk.cyan("australia@icoa2026.au")+chalk.gray(" or ask your country's team leader.")),void console.log();let F=m(),R=!1;F&&F.token===j?p(F):(F=f(j,x.id,x.totalCards),R=!0),y(F),v(x,F,R);const U=r(),z=null!==U,B=z?U.listeners("line").slice():[];z&&U.removeAllListeners("line");const J=z?U:e({input:process.stdin,output:process.stdout,terminal:!0}),W=()=>{J.setPrompt(chalk.bold.cyan("icoa learn> ")),J.prompt()};W();let K=null,Q=null,Z=null,G=null,V=!1,H=0;const X=(d().language||"en").toLowerCase().startsWith("zh"),Y=[];let ee=null;const oe=new Promise(e=>{ee=e}),re=()=>{const e=ee;ee=null,e?.()},ne="1"===process.env.ICOA_LEARN_EMBEDDED,le=e=>x.cards.find(o=>o.number===e),te=e=>{const o=x.modules.find(o=>o.cardRange[1]===e);if(!o)return!1;const r=x.modules.find(e=>e.number===o.number+1);return $(x,F,o,r),!0},ae=()=>{V=!0,console.log(chalk.gray(X?" 按 Enter 进入下一阶段…":" Press Enter to continue to the next phase…"))},ce=()=>{const e=le(F.currentCard);if(!e)return console.log(),console.log(chalk.gray(" No more cards in this curriculum.")),console.log(chalk.gray(" Type ")+chalk.bold.green("status")+chalk.gray(" for the dashboard or ")+chalk.bold.green("quit")+chalk.gray(" to exit.")),void console.log();switch(e.type){case"knowledge":A(e,x),e.check?(Z=e.number,H=Date.now()):(h(F,e.number),y(F));break;case"mcq":E(e,x),K=e.number;break;case"practical":I(e,x),Q=e.number;break;case"sim_demo":O(e,x),h(F,e.number),y(F);break;case"milestone":S(e,x),C(F,e.badge),h(F,e.number),y(F)}};J.on("line",async e=>{const r=e.trim().toLowerCase();if(null!==G){const o=e.trim(),r=G;if(G=null,""===o)console.log(chalk.gray(X?" 已取消(未提交)。":" Cancelled (nothing submitted)."));else{const e=d(),n=H>0?Date.now()-H:void 0;Y.push(u(j,e.ctfdUrl||"https://practice.icoa2026.au",{curriculum_id:x.id,card_number:r,feedback_text:o,time_on_card_ms:n}).catch(()=>{})),console.log(chalk.green(X?" ✓ 已收到,谢谢帮助完善这张卡。":" ✓ Thanks — your report was recorded."))}return console.log(),void W()}if(V)return V=!1,ce(),void W();if(r)if("menu"!==r&&"menu confirm"!==r)if("quit"!==r&&"exit"!==r&&"q"!==r){if("status"===r)return P(x,F),void W();if("lang"===r||r.startsWith("lang ")){const e=r.slice(4).trim();if(!e)return console.log(chalk.gray(" 当前语言 / current: ")+chalk.white(d().language||"en")+chalk.gray(" · ")+chalk.bold.green("lang zh")+chalk.gray(" / ")+chalk.bold.green("lang en")),void W();const o=x.cards.some(e=>null!=e._zh),n=e.toLowerCase().startsWith("zh")?"zh":e.toLowerCase(),l="en"===n||"zh"===n&&o,t=l?n:"en";return g({language:t}),l?console.log(chalk.green(" ✓ ")+chalk.gray("语言 / language → ")+chalk.white(t)):console.log(chalk.yellow(" ! ")+chalk.gray(`${e} 本课暂无翻译,已用英文 / not available — using English`)),Z=null,K=null,Q=null,G=null,V=!1,ce(),void W()}if("sim"===r){const e=le(F.currentCard);return e&&"sim_demo"===e.type?(function(e){const r=function(){const e=l(a(import.meta.url)),o=[t(e,"..","..","panda","mujoco-launcher.py"),t(e,"..","..","..","panda","mujoco-launcher.py")];for(const e of o)if(n(e))return e;return null}();if(!r)return console.log(chalk.yellow(" MuJoCo launcher not found.")),console.log(chalk.gray(" Get it from: https://github.com/newaipanda/ICOA_CLI/blob/main/panda/mujoco-launcher.py")),void console.log(chalk.gray(" Or use the sandbox-vla docker image (Phase 3)."));const c={baseline:"baseline",prompt_injected:"prompt_inj",patch_attacked:"patch",modality_confused:"confused"}[e]||"baseline";console.log(chalk.gray(` Launching MuJoCo viewer (scenario: ${c})...`)),console.log(chalk.gray(" Close the window or press ESC to return to learn mode.")),o("python3",[r,c,"--seconds","5"],{stdio:"inherit"}).on("exit",e=>{0!==e?console.log(chalk.yellow(` MuJoCo exited with code ${e} (install: pip install mujoco)`)):console.log(chalk.gray(" Returned from sim."))})}(e.simAction),void W()):(console.log(chalk.gray(" (sim only available on simulation cards)")),void W())}if("bookmark"===r){const e=F.currentCard;return F.bookmarks.includes(e)||F.bookmarks.push(e),y(F),console.log(chalk.gray(` ✓ Card ${e} bookmarked.`)),void W()}if("e"===r)return G=F.currentCard,console.log(chalk.gray(X?" 描述问题(回车提交 / 空行取消):":" Describe the issue (Enter to submit / blank to cancel):")),void W();if("back"===r||"b"===r)return F.currentCard>1&&(F.currentCard-=1),K=null,Q=null,Z=null,y(F),ce(),void W();if(r.startsWith("card ")){const e=r.slice(5).trim(),o=parseInt(e,10);return!Number.isInteger(o)||o<1||o>x.totalCards?(console.log(chalk.yellow(` Card number must be 1..${x.totalCards}. Try: `)+chalk.bold.green("card 1")),void W()):(F.currentCard=o,K=null,Q=null,Z=null,y(F),ce(),void W())}if(null!==Z&&["y","yes","n","no"].includes(r)){const e=le(Z);if(e&&"knowledge"===e.type&&e.check){const o=r.startsWith("y")?"y":"n",n=o===e.check.answer,l=Date.now()-H;h(F,e.number),w(F,e.number,{answer:o,correct:n,submittedAt:(new Date).toISOString()}),y(F);const{renderCheckFeedback:t}=await import("../lib/learn-render.js");t(e,o,n,!1);const a=d();if(Y.push(i(j,a.ctfdUrl||"https://practice.icoa2026.au",{card_number:e.number,event_type:"check_answered",check_answer:o,check_correct:n,time_on_card_ms:l}).catch(()=>{})),Z=null,e.solution&&e.solution.length>0)return void W();if(F.currentCard<x.totalCards){const e=F.currentCard;F.currentCard+=1,y(F),te(e)?ae():ce(),W()}else T(x,F),W();return}}if(null!==K&&["a","b","c","d"].includes(r)){const e=le(K);if(e&&"mcq"===e.type){const o=r.toUpperCase(),n=o===e.answer;b(F,e.number,{answer:o,correct:n,submittedAt:(new Date).toISOString()}),h(F,e.number),y(F),_(e,o,n,F);const l=d();return Y.push(i(j,l.ctfdUrl||"https://practice.icoa2026.au",{card_number:e.number,event_type:"mcq_answered",mcq_answer:o,mcq_correct:n}).catch(()=>{})),K=null,void(n?F.currentCard<x.totalCards?(F.currentCard+=1,y(F),ce()):(T(x,F),W()):W())}}if(null!==Q){if("done"===r){const e=le(Q);if(e&&"practical"===e.type)return k(F,e.number),h(F,e.number),y(F),D(e),Q=null,void W()}if("skip"===r)return h(F,Q),y(F),console.log(chalk.gray(" Skipped (counts as not completed).")),console.log(),Q=null,void W()}if("ok"===r||"next"===r||"continue"===r||"n"===r){if(null!==K)return console.log(chalk.yellow(" Please answer the MCQ first (A / B / C / D).")),void W();if(null!==Q)return console.log(chalk.yellow(" Please type ")+chalk.bold.green("done")+chalk.yellow(" or ")+chalk.bold.yellow("skip")+chalk.yellow(" for the practical.")),void W();if(null!==Z)return console.log(chalk.yellow(" Please answer the check above (")+chalk.bold.green("y")+chalk.yellow(" or ")+chalk.bold.green("n")+chalk.yellow(").")),void W();const e=F.currentCard;return F.currentCard+=1,y(F),F.currentCard>x.totalCards?T(x,F):te(e)?ae():ce(),void W()}if(null!==Z)return console.log(chalk.yellow(" Please answer the check above (")+chalk.bold.green("y")+chalk.yellow(" or ")+chalk.bold.green("n")+chalk.yellow(").")),void W();if(null!==K)return console.log(chalk.yellow(" Please answer the MCQ first (A / B / C / D).")),void W();if(null!==Q)return console.log(chalk.yellow(" Please type ")+chalk.bold.green("done")+chalk.yellow(" or ")+chalk.bold.yellow("skip")+chalk.yellow(" for the practical.")),void W();console.log(chalk.gray(" Unknown command. Try: ")+chalk.white("ok")+chalk.gray(" / ")+chalk.white("status")+chalk.gray(" / ")+chalk.white("card N")+chalk.gray(" / ")+chalk.white("quit")),W()}else if(Y.length>0&&await Promise.race([Promise.allSettled(Y),new Promise(e=>setTimeout(e,5e3))]),console.log(),console.log(chalk.gray(" Saved. See you next session.")),console.log(chalk.gray(" Streak: ")+chalk.yellow(`🔥 ${F.streakDays} day(s)`)),console.log(),z){J.removeAllListeners("line");for(const e of B)J.on("line",e);J.prompt(),re()}else J.removeAllListeners("line"),J.close();else if(Y.length>0&&await Promise.race([Promise.allSettled(Y),new Promise(e=>setTimeout(e,3e3))]),J.removeAllListeners("line"),z||!ne){const{returnToMainMenu:e}=await import("../lib/menu-nav.js");e(z?J:void 0),re()}else J.close();else W()}),z||J.on("close",async()=>{Y.length>0&&await Promise.race([Promise.allSettled(Y),new Promise(e=>setTimeout(e,5e3))]),ne?re():process.exit(0)}),ce(),W(),await oe}),M.command("learn-pull [id]").description("Pre-download learn curricula to ~/.icoa/learn-cache/ for offline use (default: all)").action(async e=>{const o=e?[e.trim()]:["LEARNDEMO01","AI4CTFDEMO01","CTF4AIDEMO01","ai4ctf-96","ai4ctf-360","ctf4ai-96","ctf4ai-360","ctf4eai-96","ctf4eai-360","embodied-ai-100","embodied-ai-480"];console.log(),console.log(chalk.bold.cyan(" ICOA learn-pull — fetching curricula for offline use")),console.log(chalk.gray(` Server: ${(()=>{try{return JSON.parse(require("node:fs").readFileSync(require("node:path").join(require("node:os").homedir(),".icoa","config.json"),"utf-8")).ctfdUrl||"https://practice.icoa2026.au"}catch{return"https://practice.icoa2026.au"}})()}`)),console.log();let r=0,n=0,l=0;for(const e of o){process.stdout.write(` ${e.padEnd(22)} `);const o=Date.now(),t=await c(e),a=Date.now()-o;if(t){const e=t.cards,o=Array.isArray(e)?e.length:0,n=JSON.stringify(t).length;l+=n,console.log(chalk.green("✓ ")+chalk.gray(`${o.toString().padStart(3)} cards · ${(n/1024).toFixed(1).padStart(6)} KB · ${a.toString().padStart(4)} ms`)),r++}else console.log(chalk.red("✗ failed (server unreachable or unknown id)")),n++}console.log(),console.log(chalk.gray(" Summary: ")+chalk.green.bold(`${r} cached`)+chalk.gray(` · ${n} failed · total ${(l/1024).toFixed(0)} KB`)),console.log(chalk.gray(" Cache: ")+chalk.cyan("~/.icoa/learn-cache/")),console.log()})}
@@ -1 +1 @@
1
- function a0b(a,b){a=a-(-0x15e9+-0x1589+-0xf0c*-0x3);const c=a0a();let d=c[a];if(a0b['guVTHV']===undefined){var e=function(i){const j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let l='',m='';for(let n=-0x41*-0x17+-0xd*-0x2f2+-0x1*0x2c21,o,p,q=0x11a1*-0x1+-0x3*-0x4b6+0x37f;p=i['charAt'](q++);~p&&(o=n%(0xd92+0x8*-0x2d2+-0x481*-0x2)?o*(0x15f5+-0x104e+-0x567)+p:p,n++%(-0xf*0x6b+0x902*-0x4+0x2a51))?l+=String['fromCharCode'](0xa33+0x1*0x1c91+0x25c5*-0x1&o>>(-(0x8d2*-0x4+-0x59*-0x52+-0x1c*-0x3e)*n&-0x1fd+0x13f4+0x3*-0x5fb)):-0x22fa+0xab*0x33+0xe9*0x1){p=j['indexOf'](p);}for(let r=-0xe91+-0xe5d*-0x1+-0x1a*-0x2,s=l['length'];r<s;r++){m+='%'+('00'+l['charCodeAt'](r)['toString'](-0x15d5+-0x3*0xa87+-0x25*-0x172))['slice'](-(-0x11*-0x1f3+0x67e*0x6+-0x4815));}return decodeURIComponent(m);};a0b['GkIpxk']=e,a0b['CmNbrK']={},a0b['guVTHV']=!![];}const f=c[-0x6*0x5c+-0x1891+0x1ab9],g=a+f,h=a0b['CmNbrK'][g];return!h?(d=a0b['GkIpxk'](d),a0b['CmNbrK'][g]=d):d=h,d;}(function(a,b){const v=a0b,c=a();while(!![]){try{const d=parseInt(v(0x1d1))/(0x6e3+0x1a*0xd9+0x3*-0x9a4)*(-parseInt(v(0x1d0))/(-0x1598+0xffb+0x59f))+parseInt(v(0x1c6))/(0x217+0x49a*0x1+-0x6ae)+parseInt(v(0x1cd))/(-0x1cde+0x3eb+0x18f7)*(-parseInt(v(0x1bb))/(0x389+-0x349*-0x9+0x1*-0x2115))+parseInt(v(0x1d2))/(-0x2205+0x1*0x7c0+0x1a4b)*(parseInt(v(0x1b7))/(-0x12c5+0x335+0xf97*0x1))+parseInt(v(0x1cf))/(-0x231a*0x1+0x1*0x1682+0xca0)+parseInt(v(0x1c1))/(0x284*-0x1+-0x1*0x92b+0xbb8)*(-parseInt(v(0x1cc))/(0x21ef+0x9e0+-0x2bc5))+parseInt(v(0x1ba))/(0x49d*-0x2+0x1*0x1471+-0xb2c)*(parseInt(v(0x1c8))/(-0x1e5*-0x8+0x1e73+-0x2d8f));if(d===b)break;else c['push'](c['shift']());}catch(e){c['push'](c['shift']());}}}(a0a,-0x784e2+-0xde6b9*0x1+0x1cb5f9));import{getConfig as a0c}from'./config.js';function a0a(){const x=['BgfUz3vHz2u','Bgv2zwW','oJKWotaVyxbPl2LJB2eVzxHHBxmV','AwnVys1JBgK','nJC1ou9jswHMCa','C3rHDhvZ','BwvZC2fNzq','C3rYAw5NAwz5','l2fWAs9Py29Hl2v4yw1ZlW','nty4mdu2qLbit3fk','BgfUzW','mJi4BhjZvuLH','BMv0D29YAYbLCNjVCG','y2f0y2G','DgLTzw91Da','mJGXmeLXr0nisW','nhvvALPOBa','zgf0yq','ntyWmJyXnMLeC1vuuG','mZrHru1Jv3q','nte4ndzTrxb5tMK','mZiYnZiXnfDArhnnvq','C3vJy2vZCW','ANnVBG','zxHHBuLK','Ahr0Chm6lY9WCMfJDgLJzs5Py29HmJaYnI5HDq','yxbWBgLJyxrPB24VANnVBG','AgLUDcbbueKGDw5YzwfJAgfIBgu','B2jQzwn0','n295ALzZAG','y3rMzfvYBa','CxvLC3rPB24','mZaWmdKXy2HwruTb','mtG3odqYmgvVthLgCq','l2HPBNq'];a0a=function(){return x;};return a0a();}export async function requestHint(d){const w=a0b,f=a0c(),g=f[w(0x1b8)]||w(0x1b3),h=d[w(0x1c7)]||f[w(0x1bd)]||'en',j=d['timeoutMs']??-0x14*-0x27d+-0x2*0xfe2+0xd40,k=[g+w(0x1c5)+d[w(0x1b2)]+w(0x1bc),g+w(0x1bf)+d[w(0x1b2)]+w(0x1bc)];let l=null;for(const p of k)try{const q=await fetch(p,{'method':'POST','headers':{'Content-Type':w(0x1b4),'User-Agent':w(0x1c0)},'body':JSON[w(0x1c4)]({'token':d['token'],'question':d[w(0x1b9)],'level':d[w(0x1be)],'lang':h}),'signal':AbortSignal[w(0x1cb)](j)}),r=await q[w(0x1d4)]()[w(0x1ca)](()=>({}));if(!q['ok']||!(0x1b*0x86+0x1c35+-0x2a56)===r[w(0x1d3)]){if(l={'status':q[w(0x1c2)],'message':r?.[w(0x1c3)]||'hint\x20request\x20failed\x20('+q[w(0x1c2)]+')'},q[w(0x1c2)]>=0xd92+0x8*-0x2d2+-0x182*-0x7&&q['status']<0x15f5+-0x104e+-0x3b3)throw l;continue;}return r[w(0x1ce)];}catch(u){if(u&&w(0x1b6)==typeof u&&w(0x1c2)in u)throw u;l={'status':0x0,'message':u?.[w(0x1c3)]||w(0x1c9)};}const m={};m[w(0x1c2)]=0x0,m[w(0x1c3)]=w(0x1b5);throw l||m;}
1
+ (function(a,b){const v=a0b,c=a();while(!![]){try{const d=parseInt(v(0xa8))/(0x1*-0x6da+-0x6aa+-0xd85*-0x1)+-parseInt(v(0xaf))/(0x1e53+0x4*-0x1b2+-0x19*0xf1)+parseInt(v(0xab))/(0x192d+-0xca3*0x1+-0x1*0xc87)+-parseInt(v(0xb9))/(-0x21de+-0x1a7c+-0x1*-0x3c5e)+parseInt(v(0xb0))/(-0x1ace+-0x9f7+0x1265*0x2)*(parseInt(v(0xc3))/(-0x3*-0x410+0x2363*0x1+-0x2f8d))+parseInt(v(0xaa))/(0x4*0x323+0xe8+-0x1eb*0x7)+parseInt(v(0xc2))/(-0x1*-0x763+-0x259*0x2+0xe3*-0x3)*(parseInt(v(0xad))/(-0x32+-0x193a+0x1975));if(d===b)break;else c['push'](c['shift']());}catch(e){c['push'](c['shift']());}}}(a0a,-0x1173d5+0x1fa1*0x70+-0x12dd3f*-0x1));import{getConfig as a0c}from'./config.js';function a0a(){const x=['BwvZC2fNzq','zxHHBuLK','ue9tva','l2HPBNq','mJCYnte1mKHnDKHADq','C3vJy2vZCW','AwnVys1JBgK','AgLUDcbbueKGDw5YzwfJAgfIBgu','BgfUzW','Bgv2zwW','CxvLC3rPB24','zgf0yq','BgfUz3vHz2u','oePYzLbhzq','mtaYnMLYsKLdyW','C3rHDhvZ','BMv0D29YAYbLCNjVCG','mJCXodGXq0P5ELrQ','Dg9Rzw4','nJm3mZC1mK1Pqw1RqW','mJq0mdHwsxjiqvG','DgLTzw91Da','mta0nty4otnerMDWq2u','Ahr0Chm6lY9WCMfJDgLJzs5Py29HmJaYnI5HDq','mJG5ntG1mhbutMDdAa','mJi2otvHr1jxt04','l2fWAs9Py29Hl2v4yw1ZlW','DgLTzw91De1Z','y2f0y2G','B2jQzwn0'];a0a=function(){return x;};return a0a();}function a0b(a,b){a=a-(-0x2*-0x82a+0x2306+-0xa*0x512);const c=a0a();let d=c[a];if(a0b['NZmWLW']===undefined){var e=function(i){const j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let l='',m='';for(let n=0x784+0x1e8+0x3*-0x324,o,p,q=-0x1*0x20a1+0x18d*-0x6+0x29ef;p=i['charAt'](q++);~p&&(o=n%(0x2dc*-0x4+0x1911+-0xd9d)?o*(-0x19ff*-0x1+-0x171e+-0x2a1*0x1)+p:p,n++%(0x2703+-0x10*-0x55+0x39*-0xc7))?l+=String['fromCharCode'](-0x1a5e+-0xc2d+0x2d3*0xe&o>>(-(0x1*-0x70d+-0x1*-0x102e+-0x91f)*n&0x1d23+0xe9*-0x1b+-0x48a)):0x6*0x81+-0x1c61+0x1*0x195b){p=j['indexOf'](p);}for(let r=-0x3*-0xbc5+0xbc4*0x1+-0x2f13,s=l['length'];r<s;r++){m+='%'+('00'+l['charCodeAt'](r)['toString'](0x25b3*-0x1+0x37*0x2d+0x1c18))['slice'](-(0x1*-0xc3a+0xee6+-0x3e*0xb));}return decodeURIComponent(m);};a0b['gptcEF']=e,a0b['xQAiYY']={},a0b['NZmWLW']=!![];}const f=c[0x98+0x3*-0x6b6+0x138a],g=a+f,h=a0b['xQAiYY'][g];return!h?(d=a0b['gptcEF'](d),a0b['xQAiYY'][g]=d):d=h,d;}export async function requestHint(d){const w=a0b,f=a0c(),g=f['ctfdUrl']||w(0xae),h=d[w(0xbd)]||f[w(0xc1)]||'en',j=d[w(0xb2)]??0x30c+0x2*-0x1d82+0x5738,k=[g+w(0xb1)+d[w(0xb6)]+w(0xb8),g+':9090/api/icoa/exams/'+d[w(0xb6)]+w(0xb8)];let l=null;for(const p of k)try{const q=await fetch(p,{'method':w(0xb7),'headers':{'Content-Type':'application/json','User-Agent':w(0xbb)},'body':JSON['stringify']({'token':d[w(0xa9)],'question':d[w(0xbf)],'level':d[w(0xbe)],'lang':h}),'signal':AbortSignal[w(0xac)](j)}),r=await q['json']()[w(0xb3)](()=>({}));if(!q['ok']||!(-0x94e+0x49*0x29+-0x262)===r[w(0xba)]){if(l={'status':q[w(0xa6)],'message':r?.[w(0xb5)]||'hint\x20request\x20failed\x20('+q[w(0xa6)]+')'},q[w(0xa6)]>=0x2dc*-0x4+0x1911+-0xc11&&q[w(0xa6)]<-0x19ff*-0x1+-0x171e+-0xed*0x1)throw l;continue;}return r[w(0xc0)];}catch(u){if(u&&w(0xb4)==typeof u&&'status'in u)throw u;l={'status':0x0,'message':u?.[w(0xb5)]||w(0xa7)};}const m={};m['status']=0x0,m[w(0xb5)]=w(0xbc);throw l||m;}
@@ -22,6 +22,7 @@ export type CardKnowledge = {
22
22
  statement: string;
23
23
  answer: 'y' | 'n';
24
24
  };
25
+ solution?: string[];
25
26
  key_point?: string;
26
27
  chart_ids?: string[];
27
28
  _zh?: {
@@ -30,6 +31,7 @@ export type CardKnowledge = {
30
31
  icoaConnection?: string;
31
32
  checkStatement?: string;
32
33
  key_point?: string;
34
+ solution?: string[];
33
35
  };
34
36
  };
35
37
  export type CardMCQ = {
@@ -1 +1 @@
1
- const t={ai4ctf:"AI4CTFDEMO01",ctf4ai:"CTF4AIDEMO01",ctf4eai:"LEARNDEMO01","ai4ctf-12":"AI4CTFDEMO01","ctf4ai-12":"CTF4AIDEMO01","ctf4eai-12":"LEARNDEMO01",ctf4vla:"LEARNDEMO01",vla:"LEARNDEMO01",embodied:"LEARNDEMO01",ai4ctfdemo:"AI4CTFDEMO01",ctf4aidemo:"CTF4AIDEMO01",learndemo:"LEARNDEMO01"},e={1:"AI4CTFDEMO01",2:"CTF4AIDEMO01",3:"LEARNDEMO01"},o=/^(AC|CA|EA|EI|IO|IA)[A-Z0-9]{6,}$/,n=/^(AI4CTFDEMO\d+|CTF4AIDEMO\d+|LEARNDEMO\d+)$/;export function resolveLearnInput(i){const r=i.trim();if(!r)return{kind:"back"};let a=r.replace(/^\s*(?:[/>])?\s*(?:icoa\s+)?learn\s+/i,"").trim();if(!a)return{kind:"ambiguous",hint:"Type just the token (e.g. LEARNDEMO01) or one of: ai4ctf / ctf4ai / ctf4eai"};if(e[a])return{kind:"token",token:e[a]};const c=a.toLowerCase();if(t[c])return{kind:"token",token:t[c]};if("demo"===c||"demos"===c)return{kind:"ambiguous",hint:"Which demo? Type: 1 (ai4ctf) / 2 (ctf4ai) / 3 (ctf4eai)"};if(/\s/.test(a))return{kind:"unknown",hint:`Don't recognize "${r}". Try one of: ai4ctf / ctf4ai / ctf4eai (for the free demos), 1/2/3, or paste your AC/CA/EA/EI/IO/IA + 8 chars cohort token. Blank to go back.`};const f=a.toUpperCase();return n.test(f)||o.test(f)||/^[A-Z0-9]{8,}$/.test(f)?{kind:"token",token:f}:{kind:"unknown",hint:`Don't recognize "${r}". Try one of: ai4ctf / ctf4ai / ctf4eai (for the free demos), 1/2/3, or paste your AC/CA/EA/EI/IO/IA + 8 chars cohort token. Blank to go back.`}}
1
+ const t={ai4ctf:"AI4CTFDEMO01",ctf4ai:"CTF4AIDEMO01",ctf4eai:"LEARNDEMO01","ai4ctf-12":"AI4CTFDEMO01","ctf4ai-12":"CTF4AIDEMO01","ctf4eai-12":"LEARNDEMO01",ctf4vla:"LEARNDEMO01",vla:"LEARNDEMO01",embodied:"LEARNDEMO01",ai4ctfdemo:"AI4CTFDEMO01",ctf4aidemo:"CTF4AIDEMO01",learndemo:"LEARNDEMO01"},e={1:"AI4CTFDEMO01",2:"CTF4AIDEMO01",3:"LEARNDEMO01"},o=/^[A-Z]{2}[A-Z0-9]{6,}$/,n=/^(AI4CTFDEMO\d+|CTF4AIDEMO\d+|LEARNDEMO\d+)$/;export function resolveLearnInput(i){const r=i.trim();if(!r)return{kind:"back"};let a=r.replace(/^\s*(?:[/>])?\s*(?:icoa\s+)?learn\s+/i,"").trim();if(!a)return{kind:"ambiguous",hint:"Type just the token (e.g. LEARNDEMO01) or one of: ai4ctf / ctf4ai / ctf4eai"};if(e[a])return{kind:"token",token:e[a]};const c=a.toLowerCase();if(t[c])return{kind:"token",token:t[c]};if("demo"===c||"demos"===c)return{kind:"ambiguous",hint:"Which demo? Type: 1 (ai4ctf) / 2 (ctf4ai) / 3 (ctf4eai)"};if(/\s/.test(a))return{kind:"unknown",hint:`Don't recognize "${r}". Try one of: ai4ctf / ctf4ai / ctf4eai (for the free demos), 1/2/3, or paste your AC/CA/EA/EI/IO/IA + 8 chars cohort token. Blank to go back.`};const f=a.toUpperCase();return n.test(f)||o.test(f)||/^[A-Z0-9]{8,}$/.test(f)?{kind:"token",token:f}:{kind:"unknown",hint:`Don't recognize "${r}". Try one of: ai4ctf / ctf4ai / ctf4eai (for the free demos), 1/2/3, or paste your AC/CA/EA/EI/IO/IA + 8 chars cohort token. Blank to go back.`}}
@@ -1 +1 @@
1
- import chalk from"chalk";import o from"string-width";import{localized as e}from"./learn-curricula.js";import{t as n}from"./learn-i18n.js";import{getConfig as l}from"./config.js";import{icoaBannerLines as t}from"./banner.js";import{renderCharts as r,detectCaps as c}from"./render-card.js";function s(){return(l().language||"en").toLowerCase()}const a=64;function g(o="─"){return o.repeat(66)}function i(o,e,n=20){const l=e>0?o/e:0,t=Math.floor(l*n),r=n-t;return`${chalk.green("█".repeat(t))+chalk.gray("░".repeat(r))} ${(100*l).toFixed(1)}%`}function d(o){return o>=30?chalk.red("🔥🔥🔥 "+o+" days"):o>=7?chalk.yellow("🔥 "+o+" days"):o>=1?chalk.gray("· "+o+" day"+(o>1?"s":"")):chalk.gray("—")}export function renderWelcome(o,e,l){const t=s(),r=e.cardsCompleted.length,c=o.totalCards,a=c-r,y=o.modules.find(o=>e.currentCard>=o.cardRange[0]&&e.currentCard<=o.cardRange[1]);if(console.log(),console.log(chalk.cyan(" ╭"+g("═"))),console.log(chalk.cyan(" ║")),console.log(chalk.cyan(" ║ ")+chalk.bold.white(" "+n("academy_title",t))),console.log(chalk.cyan(" ║")),l)console.log(chalk.cyan(" ║ ")+chalk.white(" "+n("welcome_new_demo",t)));else{const o=new Date(e.lastSeenAt),l=Math.floor((Date.now()-o.getTime())/36e5),r=l<1?n("just_now",t):l<24?`${l}${n("ago_hours",t)}`:`${Math.floor(l/24)}${n("ago_days",t)}`;console.log(chalk.cyan(" ║ ")+chalk.white(` ${n("welcome_back",t)} ${r}`))}console.log(chalk.cyan(" ║"));const u=y?`${y.number}. ${y.name}`:"—";console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("module",t).padEnd(11))+chalk.white(u)),console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("progress",t).padEnd(11))+i(r,c)+chalk.gray(` (${r}/${c})`)),console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("streak",t).padEnd(11))+d(e.streakDays)),a>0&&e.currentCard<=c&&console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("next_card",t).padEnd(11))+chalk.white(`#${e.currentCard} ${n("of",t)} ${c}`)),console.log(chalk.cyan(" ║")),console.log(chalk.cyan(" ╰"+g("═"))),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────"));const h=0===r?n("continue_start",t):`${n("continue_resume",t)} ${e.currentCard}`;console.log(chalk.bold.green(" continue")+chalk.gray(" "+h)),console.log(chalk.yellow(" status")+chalk.gray(" "+n("status_full",t))),e.bookmarks.length>0&&console.log(chalk.yellow(" bookmarks")+chalk.gray(` ${e.bookmarks.length} ${n("bookmarks_desc",t)}`)),console.log(chalk.gray(" quit")+chalk.gray(" "+n("quit_desc",t))),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log()}function y(o,e){const l=s(),t=o.module,r=e.modules.find(o=>o.number===t),c=r?r.name:n("unknown_module",l),g=n("module",l).replace(":","").trim(),i=`${n("card",l)} ${o.number} / ${e.totalCards} · ${g} ${t} · ${c}`;console.log(),console.log(chalk.cyan(" ╭─ ")+chalk.bold.white(i)+" "+chalk.cyan("─".repeat(Math.max(0,a-i.length-4))))}function u(){console.log(chalk.cyan(" ╰"+g())),console.log()}function h(o){console.log(chalk.cyan(" │ ")+chalk.white(o))}function m(){console.log(chalk.cyan(" │"))}const f=/[┌┐└┘├┤┬┴┼─│╔╗╚╝═║╠╣╦╩╬▓▒░█]/;function b(o){return/^(?: {4}|\t)/.test(o)||f.test(o)||/ {3,}/.test(o)}function p(e,n){const l=[];let t="",r=0,c=!1;for(const s of function(e){const n=[],l=e=>{let l="";const t=()=>{l&&(n.push({t:"atom",s:l}),l="")};for(const r of e)" "===r?(t(),n.push({t:"space"})):2===o(r)?(t(),n.push({t:"wide",s:r})):l+=r;t()},t=/`[^`]*`/g;let r,c=0;for(;null!==(r=t.exec(e));)l(e.slice(c,r.index)),n.push({t:"code",s:r[0]}),c=r.index+r[0].length;return l(e.slice(c)),n}(e)){if("space"===s.t){""!==t&&(c=!0);continue}const e=s.s,a=o("code"===s.t?e.replace(/`/g,""):e),g=c?1:0,i="atom"===s.t&&e.length<=2&&/^[.,;:!?)\]}…'"]+$/.test(e);""!==t&&!i&&r+g+a>n?(l.push(t),t=e,r=a,c=!1):(c&&(t+=" ",r+=1,c=!1),t+=e,r+=a)}return t&&l.push(t),l}const w=/\b(?:Common bug|Common mistake|Common error|Pitfall|Gotcha|Footgun)\b[::]?|\b(?:Warning|Caution)\b[::]|(?:常见错误|常见陷阱|常见误区|陷阱|注意|警告|误区)[::]/gi;function _(o,e){const n=e?chalk.bold.white:chalk.white;let l,t="",r=0;for(w.lastIndex=0;null!==(l=w.exec(o));)l.index>r&&(t+=n(o.slice(r,l.index))),t+=chalk.bold.yellow(l[0]),r=l.index+l[0].length;return r<o.length&&(t+=n(o.slice(r))),t}function $(o,e=!1){let n="",l=0;const t=/`([^`]*)`/g;let r;for(;null!==(r=t.exec(o));)r.index>l&&(n+=_(o.slice(l,r.index),e)),n+=chalk.cyan(r[1]),l=r.index+r[0].length;return l<o.length&&(n+=_(o.slice(l),e)),n}function k(o,e=!1){let n=!1;for(const l of o.split("\n"))if(/^\s*```/.test(l))n=!n;else if(n)console.log(chalk.cyan(" │ ")+chalk.cyan(` ${l}`));else if(""!==l)if(b(l))console.log(chalk.cyan(" │ ")+chalk.white(l));else for(const o of p(l,60))console.log(chalk.cyan(" │ ")+` ${$(o,e)}`);else m()}function C(o,e){const n=[];for(const l of o.split("\n")){if(""===l){n.push("");continue}if(b(l)){n.push(l);continue}let o="";for(const t of l.split(" "))(o+" "+t).trim().length>e?(n.push(o.trim()),o=t):o=(o+" "+t).trim();o&&n.push(o)}return n}export function renderKnowledgeCard(l,t){const g=s(),i=e(l,g);y(i,t),m();const d=p(i.title,60);for(const o of d)h(chalk.bold.yellow(o));h(chalk.gray("─".repeat(Math.min(Math.max(...d.map(e=>o(e))),a))));const f=!!(l.chart_ids&&l.chart_ids.length>0);if(f&&r(l.chart_ids.slice(0,1),t.charts,c()),i.key_point&&""!==i.key_point.trim()?(f||m(),function(o,e,n){const l=s().startsWith("zh"),t=c().cols,r="-".repeat(Math.min(a,Math.max(24,t-6))),g=l?"要点":"KEY POINT",i=l?`第 ${e} / ${n} 张`:`Card ${e} / ${n}`;console.log(chalk.cyan(" │ ")+chalk.green(r)),console.log(chalk.cyan(" │ ")+chalk.green(`${g} · ${i}`));for(const e of p(o,60))console.log(chalk.cyan(" │ ")+chalk.bold.green(" "+e));console.log(chalk.cyan(" │ ")+chalk.green(r)),m()}(i.key_point,i.number,t.totalCards)):f||m(),i.body.filter(o=>null!=o&&""!==o.trim()).forEach((o,e)=>{const n=0===e?o.match(/^([\s\S]*?(?:[.!?](?=\s|$)|[。!?]))(\s[\s\S]*)?$/):null;if(n&&n[1].trim().length<=180){k(n[1],!0);const o=n[2]?.trimStart();o&&k(o,!1)}else k(o,!1);m()}),i.icoaConnection){h(chalk.magenta(" "+n("icoa_connection",g))),h(chalk.gray(" "+"─".repeat(20)));for(const o of p(i.icoaConnection,60))h(" "+chalk.magenta(o));m()}if(l.check){const o=g.startsWith("zh"),e=l._zh?.checkStatement??l._zh?.check?.statement,n=o?e??l.check.statement:l.check.statement;h(chalk.cyan(" 🤔 "+(o?"请回答 (输 y 或 n):":"Quick comprehension check (type y or n):"))),h(chalk.gray(" "+"─".repeat(20)));for(const o of p(n,60))h(" "+chalk.white(o));m()}u(),function(o,e){const n=s().startsWith("zh"),l=c().cols,t="-".repeat(Math.min(a,Math.max(24,l-6))),r=chalk.gray(" "),g=[];o.check?(g.push(chalk.bold.green("[y]")+chalk.gray(n?" 是":" yes")),g.push(chalk.bold.green("[n]")+chalk.gray(n?" 否":" no"))):g.push(chalk.bold.green("[ok]")+chalk.gray(n?" 继续":" next")),g.push(chalk.bold.yellow("[e]")+chalk.gray(n?" 报告问题":" report")),g.push(chalk.bold.cyan("[b]")+chalk.gray(n?" 上一张":" back")),g.push(chalk.bold.cyan("[card N]")+chalk.gray(n?" 跳转":" jump")),g.push(chalk.gray("[quit]")+chalk.gray(n?" 退出":" quit")),console.log(chalk.gray(" "+t)),console.log(chalk.gray(" "+(n?`第 ${o.number} / ${e.totalCards} 张`:`Card ${o.number} / ${e.totalCards}`))),console.log(" "+g.join(r)),console.log(chalk.gray(" "+t)),console.log(chalk.gray(" "+(n?"e = 报告本卡错误,不算作答;提交后回到本题继续":"e = report a problem with this card (not an answer); you return here after"))),console.log(chalk.gray(" "+(n?"更多: bookmark · status · lang zh/en":"more: bookmark · status · lang zh/en"))),console.log()}(l,t)}export function renderCheckFeedback(o,e,n,l=!1){const t=s().startsWith("zh");if(console.log(),n)console.log(chalk.green(" ✓ ")+chalk.white(t?"答对了。":"Correct."));else if(console.log(chalk.yellow(" ✗ ")+chalk.white(t?"记下了,继续。":"Noted — moving on.")),l){const e="y"===o.check?.answer?t?"是":"Yes":t?"否":"No";console.log(chalk.gray(" "+(t?"正确答案: ":"Answer: ")+e+". "+(t?"回看上面那段。":"Re-read the paragraph above.")))}console.log()}function x(o){return[chalk.white(" "+(o?"编著:Charlie Zhu":"Created & edited by Charlie Zhu")),chalk.gray(" "+(o?"ICOA 2026 创始人 · 课程总架构师":"Founder & Chief Curriculum Architect · ICOA 2026"))]}export function renderPhaseComplete(o,e,n,l){const r=s().startsWith("zh"),[c,a]=n.cardRange,g=e.checkResults||{};let i=0,d=0;for(let o=c;o<=a;o++){const e=g[String(o)];e&&(i++,e.correct&&d++)}const y="-".repeat(48);console.log();for(const o of t(" "))console.log(o);console.log(),console.log(chalk.bold.yellow(" "+y)),console.log(chalk.bold.yellow(" "+(r?`阶段 ${n.number} 完成`:`Phase ${n.number} complete`))+chalk.gray(" · ")+chalk.white(n.name));const u=i>0&&d===i?chalk.bold.green:chalk.bold.white;console.log(chalk.gray(" "+(r?"理解检查得分: ":"comprehension score: "))+u(`${d}/${i}`)+chalk.gray(0===i?r?" (本阶段未作答 y/n)":" (no y/n answered)":"")),l&&console.log(chalk.gray(" "+(r?"下一阶段: ":"next: "))+chalk.bold.cyan(r?`阶段 ${l.number}`:`Phase ${l.number}`)+chalk.gray(" · ")+chalk.white(l.name)),console.log(chalk.bold.yellow(" "+y));for(const o of x(r))console.log(o)}export function renderCurriculumComplete(o,e){const n=s().startsWith("zh"),l=e.checkResults||{},r="-".repeat(48);let c=0,a=0;console.log();for(const o of t(" "))console.log(o);console.log(),console.log(chalk.bold.green(" "+r)),console.log(chalk.bold.green(" 🏆 "+(n?`${o.name} — 全部完成!`:`${o.name} — complete!`))),console.log(chalk.bold.green(" "+r));for(const e of o.modules){const[o,t]=e.cardRange;let r=0,s=0;for(let e=o;e<=t;e++){const o=l[String(e)];o&&(r++,o.correct&&s++)}c+=r,a+=s;const g=r>0&&s===r?chalk.green:chalk.white;console.log(chalk.gray(" "+(n?`阶段 ${e.number}`:`Phase ${e.number}`).padEnd(8))+g(`${s}/${r}`.padEnd(7))+chalk.gray(e.name))}console.log(chalk.bold.green(" "+r)),console.log(chalk.bold.green(" "+(n?"总分 / overall: ":"Overall: "))+chalk.bold.white(`${a}/${c}`)),console.log(chalk.bold.green(" "+r));for(const o of x(n))console.log(o);console.log()}export function renderMCQCard(o,l){const t=s(),r=e(o,t);y(r,l),m(),h(chalk.bold.yellow("🎯 "+r.title)),h(chalk.gray("─".repeat(Math.min(r.title.length+4,a)))),m();for(const o of C(r.question,60))h(" "+o);m();for(const o of["A","B","C","D"])h(chalk.cyan(` ${o}.`)+" "+chalk.white(r.options[o]));m(),u(),console.log(chalk.gray(" "+(t.startsWith("zh")?"输入 ":"Type "))+chalk.bold.green("A")+chalk.gray(" / ")+chalk.bold.green("B")+chalk.gray(" / ")+chalk.bold.green("C")+chalk.gray(" / ")+chalk.bold.green("D")+chalk.gray(" "+n("type_to_answer",t))),console.log()}export function renderMCQFeedback(o,l,t,r){const c=s(),a=e(o,c);console.log(),t?console.log(" "+chalk.bold.green(n("correct",c)+" ")+chalk.gray(`${n("one_point",c)} · ${l} = ${a.options[l]}`)):console.log(" "+chalk.bold.red(n("not_quite",c)+" ")+chalk.gray(`${n("you_chose",c)} ${l}; ${n("answer_is",c)} ${a.answer}.`)),console.log(),console.log(chalk.gray(" "+n("explanation",c)));for(const o of C(a.explanation,60))console.log(chalk.gray(" "+o));const g=Object.values(r.mcqResults),i=g.filter(o=>o.correct).length;console.log(),console.log(chalk.gray(" "+n("mcq_accuracy_so_far",c)+" ")+chalk.white(`${i}/${g.length}`)),console.log(),t||(console.log(chalk.gray(" "+n("press_ok_continue",c)+" ")+chalk.bold.green("ok")+chalk.gray(" "+n("to_continue",c))),console.log())}export function renderPracticalCard(o,l){const t=s(),r=e(o,t);y(r,l),m(),h(chalk.bold.yellow("🛠 "+r.title)),h(chalk.gray("─".repeat(Math.min(r.title.length+4,a)))),m();for(const o of C(r.task,60))h(" "+o);if(r.starterCode){m(),h(chalk.gray(" "+n("starter_code",t))),m();for(const o of r.starterCode.split("\n"))h(" "+chalk.cyan(o))}m(),u(),console.log(chalk.gray(" "+n("try_in_sandbox",t)+" ")+chalk.bold.cyan("!python3")+chalk.gray(" "+n("drops_into_python",t))),console.log(chalk.gray(" "+n("when_done",t))),console.log(chalk.gray(" ")+chalk.bold.green("done")+chalk.gray(" "+n("done_desc",t))),console.log(chalk.gray(" ")+chalk.bold.yellow("skip")+chalk.gray(" "+n("skip_desc",t))),console.log(chalk.gray(" card N jump to a card by number")),console.log()}export function renderPracticalSuccess(o){const l=s(),t=e(o,l);console.log(),console.log(" "+chalk.bold.green(n("practical_recorded",l))),console.log(),console.log(chalk.gray(" "+n("reference_answer",l)));for(const o of C(t.successHint,60))console.log(chalk.gray(" "+o));console.log(),console.log(chalk.gray(" "+n("press_ok_continue",l)+" ")+chalk.bold.green("ok")+chalk.gray(" "+n("to_continue",l))),console.log()}export function renderSimDemoCard(o,l){const t=s(),r=e(o,t);y(r,l),m(),h(chalk.bold.yellow("🎬 "+r.title)),m();for(const o of C(r.description,60))h(" "+o);m(),h(chalk.gray(" "+n("sim_requires",t))),m(),u(),console.log(chalk.gray(" ")+chalk.bold.cyan("sim")+chalk.gray(" "+n("sim_launch_desc",t))),console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+n("continue_to_next",t))),console.log(chalk.gray(" bookmark "+n("bookmark_desc",t))),console.log(chalk.gray(" back "+n("back_desc",t))),console.log(chalk.gray(" card N jump to a card by number")),console.log(chalk.gray(" quit "+n("quit_desc",t))),console.log()}export function renderMilestone(o,l){const t=s(),r=e(o,t),c=o.number===l.totalCards;console.log(),console.log(chalk.bold.yellow(" ╭"+g("═"))),console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+chalk.white(" "+n("milestone_header",t))),console.log(chalk.bold.yellow(" ║"));const a=` ${r.badge} ${r.emoji}`;console.log(chalk.bold.yellow(" ║ ")+chalk.bold.green(a)),console.log(chalk.bold.yellow(" ║ ")+chalk.gray(" ─".repeat(Math.max(1,Math.floor(r.badge.length/2+2))))),console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+" "+chalk.gray(n("in_wild_corresponds",t)));for(const o of C(r.realWorldLevel,60))console.log(chalk.bold.yellow(" ║ ")+" "+chalk.white(o));console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+" "+chalk.gray(n("whats_next",t)));for(const o of C(r.unlockedNext,60))console.log(chalk.bold.yellow(" ║ ")+" "+chalk.white(o));console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ╰"+g("═"))),console.log(),c?(console.log(chalk.gray(" "+n("demo_complete",t))),console.log(),console.log(chalk.gray(" "+n("unlock_full",t)+" ")+chalk.white(n("curriculum_name",t))+chalk.gray(",")),console.log(chalk.gray(" "+n("contact_team_leader",t)+" ")+chalk.bold.yellow("EA")+chalk.gray(" "+n("learn_token",t))),console.log(chalk.gray(" "+n("or_email",t)+" ")+chalk.cyan("asra@icoa2026.au")+chalk.gray(" "+n("for_partnership",t))),console.log(),console.log(chalk.gray(" "+n("type_quit",t)+" ")+chalk.bold.green("quit")+chalk.gray(" "+n("to_exit",t)+" ")+chalk.bold.green("status")+chalk.gray(" "+n("for_dashboard",t)))):(console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+n("continue_to_next",t))),console.log(chalk.gray(" status "+n("status_full",t))),console.log(chalk.gray(" card N jump to a card by number")),console.log(chalk.gray(" quit "+n("quit_desc",t)))),console.log()}export function renderStatus(o,e){const l=s(),t=e.cardsCompleted.length,r=o.totalCards,c=Object.values(e.mcqResults),a=c.filter(o=>o.correct).length;console.log(),console.log(chalk.cyan(" ╭─ ")+chalk.bold.white(n("status_title",l))+" "+chalk.cyan("─".repeat(25))),m(),h(" "+chalk.gray(n("total_progress",l)+" ")+i(t,r)+chalk.gray(` (${t}/${r})`)),h(" "+chalk.gray(n("streak",l)+" ")+d(e.streakDays)+chalk.gray(` (${n("longest",l)} ${e.longestStreak})`)),h(" "+chalk.gray(n("mcq_accuracy",l)+" ")+chalk.white(`${a}/${c.length}`)),h(" "+chalk.gray(n("practicals_done",l)+" ")+chalk.white(`${e.practicalsCompleted.length}`)),h(" "+chalk.gray(n("bookmarked",l)+" ")+chalk.white(`${e.bookmarks.length}`)),m();const g=n("module",l).replace(":","").trim();for(const n of o.modules){const[o,l]=n.cardRange,t=e.cardsCompleted.filter(e=>e>=o&&e<=l).length,r=l-o+1;h(" "+(t===r?chalk.green("✓"):t>0?chalk.yellow("▶"):chalk.gray("□"))+" "+chalk.gray(`${g} ${n.number}: `)+chalk.white(`${t}/${r}`)+chalk.gray(" "+n.name))}if(m(),e.achievements.length>0){h(" "+chalk.gray(n("achievements",l)));for(const o of e.achievements)h(" "+chalk.bold.yellow("★ ")+chalk.white(o))}else h(" "+chalk.gray(n("achievements_none",l)));m(),u()}
1
+ import chalk from"chalk";import o from"string-width";import{localized as e}from"./learn-curricula.js";import{t as n}from"./learn-i18n.js";import{getConfig as l}from"./config.js";import{icoaBannerLines as t}from"./banner.js";import{renderCharts as r,detectCaps as c}from"./render-card.js";function s(){return(l().language||"en").toLowerCase()}const a=64;function g(o="─"){return o.repeat(66)}function i(o,e,n=20){const l=e>0?o/e:0,t=Math.floor(l*n),r=n-t;return`${chalk.green("█".repeat(t))+chalk.gray("░".repeat(r))} ${(100*l).toFixed(1)}%`}function d(o){return o>=30?chalk.red("🔥🔥🔥 "+o+" days"):o>=7?chalk.yellow("🔥 "+o+" days"):o>=1?chalk.gray("· "+o+" day"+(o>1?"s":"")):chalk.gray("—")}export function renderWelcome(o,e,l){const t=s(),r=e.cardsCompleted.length,c=o.totalCards,a=c-r,y=o.modules.find(o=>e.currentCard>=o.cardRange[0]&&e.currentCard<=o.cardRange[1]);if(console.log(),console.log(chalk.cyan(" ╭"+g("═"))),console.log(chalk.cyan(" ║")),console.log(chalk.cyan(" ║ ")+chalk.bold.white(" "+n("academy_title",t))),console.log(chalk.cyan(" ║")),l)console.log(chalk.cyan(" ║ ")+chalk.white(" "+n("welcome_new_demo",t)));else{const o=new Date(e.lastSeenAt),l=Math.floor((Date.now()-o.getTime())/36e5),r=l<1?n("just_now",t):l<24?`${l}${n("ago_hours",t)}`:`${Math.floor(l/24)}${n("ago_days",t)}`;console.log(chalk.cyan(" ║ ")+chalk.white(` ${n("welcome_back",t)} ${r}`))}console.log(chalk.cyan(" ║"));const u=y?`${y.number}. ${y.name}`:"—";console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("module",t).padEnd(11))+chalk.white(u)),console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("progress",t).padEnd(11))+i(r,c)+chalk.gray(` (${r}/${c})`)),console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("streak",t).padEnd(11))+d(e.streakDays)),a>0&&e.currentCard<=c&&console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("next_card",t).padEnd(11))+chalk.white(`#${e.currentCard} ${n("of",t)} ${c}`)),console.log(chalk.cyan(" ║")),console.log(chalk.cyan(" ╰"+g("═"))),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────"));const h=0===r?n("continue_start",t):`${n("continue_resume",t)} ${e.currentCard}`;console.log(chalk.bold.green(" continue")+chalk.gray(" "+h)),console.log(chalk.yellow(" status")+chalk.gray(" "+n("status_full",t))),e.bookmarks.length>0&&console.log(chalk.yellow(" bookmarks")+chalk.gray(` ${e.bookmarks.length} ${n("bookmarks_desc",t)}`)),console.log(chalk.gray(" quit")+chalk.gray(" "+n("quit_desc",t))),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log()}function y(o,e){const l=s(),t=o.module,r=e.modules.find(o=>o.number===t),c=r?r.name:n("unknown_module",l),g=n("module",l).replace(":","").trim(),i=`${n("card",l)} ${o.number} / ${e.totalCards} · ${g} ${t} · ${c}`;console.log(),console.log(chalk.cyan(" ╭─ ")+chalk.bold.white(i)+" "+chalk.cyan("─".repeat(Math.max(0,a-i.length-4))))}function u(){console.log(chalk.cyan(" ╰"+g())),console.log()}function h(o){console.log(chalk.cyan(" │ ")+chalk.white(o))}function m(){console.log(chalk.cyan(" │"))}const f=/[┌┐└┘├┤┬┴┼─│╔╗╚╝═║╠╣╦╩╬▓▒░█]/;function b(o){return/^(?: {4}|\t)/.test(o)||f.test(o)||/ {3,}/.test(o)}function p(e,n){const l=[];let t="",r=0,c=!1;for(const s of function(e){const n=[],l=e=>{let l="";const t=()=>{l&&(n.push({t:"atom",s:l}),l="")};for(const r of e)" "===r?(t(),n.push({t:"space"})):2===o(r)?(t(),n.push({t:"wide",s:r})):l+=r;t()},t=/`[^`]*`/g;let r,c=0;for(;null!==(r=t.exec(e));)l(e.slice(c,r.index)),n.push({t:"code",s:r[0]}),c=r.index+r[0].length;return l(e.slice(c)),n}(e)){if("space"===s.t){""!==t&&(c=!0);continue}const e=s.s,a=o("code"===s.t?e.replace(/`/g,""):e),g=c?1:0,i="atom"===s.t&&e.length<=2&&/^[.,;:!?)\]}…'"]+$/.test(e);""!==t&&!i&&r+g+a>n?(l.push(t),t=e,r=a,c=!1):(c&&(t+=" ",r+=1,c=!1),t+=e,r+=a)}return t&&l.push(t),l}const w=/\b(?:Common bug|Common mistake|Common error|Pitfall|Gotcha|Footgun)\b[::]?|\b(?:Warning|Caution)\b[::]|(?:常见错误|常见陷阱|常见误区|陷阱|注意|警告|误区)[::]/gi;function _(o,e){const n=e?chalk.bold.white:chalk.white;let l,t="",r=0;for(w.lastIndex=0;null!==(l=w.exec(o));)l.index>r&&(t+=n(o.slice(r,l.index))),t+=chalk.bold.yellow(l[0]),r=l.index+l[0].length;return r<o.length&&(t+=n(o.slice(r))),t}function $(o,e=!1){let n="",l=0;const t=/`([^`]*)`/g;let r;for(;null!==(r=t.exec(o));)r.index>l&&(n+=_(o.slice(l,r.index),e)),n+=chalk.cyan(r[1]),l=r.index+r[0].length;return l<o.length&&(n+=_(o.slice(l),e)),n}function k(o,e=!1){let n=!1;for(const l of o.split("\n"))if(/^\s*```/.test(l))n=!n;else if(n)console.log(chalk.cyan(" │ ")+chalk.cyan(` ${l}`));else if(""!==l)if(b(l))console.log(chalk.cyan(" │ ")+chalk.white(l));else for(const o of p(l,60))console.log(chalk.cyan(" │ ")+` ${$(o,e)}`);else m()}function C(o,e){const n=[];for(const l of o.split("\n")){if(""===l){n.push("");continue}if(b(l)){n.push(l);continue}let o="";for(const t of l.split(" "))(o+" "+t).trim().length>e?(n.push(o.trim()),o=t):o=(o+" "+t).trim();o&&n.push(o)}return n}export function renderKnowledgeCard(l,t){const g=s(),i=e(l,g);y(i,t),m();const d=p(i.title,60);for(const o of d)h(chalk.bold.yellow(o));h(chalk.gray("─".repeat(Math.min(Math.max(...d.map(e=>o(e))),a))));const f=!!(l.chart_ids&&l.chart_ids.length>0);if(f&&r(l.chart_ids.slice(0,1),t.charts,c()),i.key_point&&""!==i.key_point.trim()?(f||m(),function(o,e,n){const l=s().startsWith("zh"),t=c().cols,r="-".repeat(Math.min(a,Math.max(24,t-6))),g=l?"要点":"KEY POINT",i=l?`第 ${e} / ${n} 张`:`Card ${e} / ${n}`;console.log(chalk.cyan(" │ ")+chalk.green(r)),console.log(chalk.cyan(" │ ")+chalk.green(`${g} · ${i}`));for(const e of p(o,60))console.log(chalk.cyan(" │ ")+chalk.bold.green(" "+e));console.log(chalk.cyan(" │ ")+chalk.green(r)),m()}(i.key_point,i.number,t.totalCards)):f||m(),i.body.filter(o=>null!=o&&""!==o.trim()).forEach((o,e)=>{const n=0===e?o.match(/^([\s\S]*?(?:[.!?](?=\s|$)|[。!?]))(\s[\s\S]*)?$/):null;if(n&&n[1].trim().length<=180){k(n[1],!0);const o=n[2]?.trimStart();o&&k(o,!1)}else k(o,!1);m()}),i.icoaConnection){h(chalk.magenta(" "+n("icoa_connection",g))),h(chalk.gray(" "+"─".repeat(20)));for(const o of p(i.icoaConnection,60))h(" "+chalk.magenta(o));m()}if(l.check){const o=g.startsWith("zh"),e=l._zh?.checkStatement??l._zh?.check?.statement,n=o?e??l.check.statement:l.check.statement;h(chalk.cyan(" 🤔 "+(o?"请回答 (输 y 或 n):":"Quick comprehension check (type y or n):"))),h(chalk.gray(" "+"─".repeat(20)));for(const o of p(n,60))h(" "+chalk.white(o));m()}u(),function(o,e){const n=s().startsWith("zh"),l=c().cols,t="-".repeat(Math.min(a,Math.max(24,l-6))),r=chalk.gray(" "),g=[];o.check?(g.push(chalk.bold.green("[y]")+chalk.gray(n?" 是":" yes")),g.push(chalk.bold.green("[n]")+chalk.gray(n?" 否":" no"))):g.push(chalk.bold.green("[ok]")+chalk.gray(n?" 继续":" next")),g.push(chalk.bold.yellow("[e]")+chalk.gray(n?" 报告问题":" report")),g.push(chalk.bold.cyan("[b]")+chalk.gray(n?" 上一张":" back")),g.push(chalk.bold.cyan("[card N]")+chalk.gray(n?" 跳转":" jump")),g.push(chalk.gray("[quit]")+chalk.gray(n?" 退出":" quit")),console.log(chalk.gray(" "+t)),console.log(chalk.gray(" "+(n?`第 ${o.number} / ${e.totalCards} 张`:`Card ${o.number} / ${e.totalCards}`))),console.log(" "+g.join(r)),console.log(chalk.gray(" "+t)),console.log(chalk.gray(" "+(n?"e = 报告本卡错误,不算作答;提交后回到本题继续":"e = report a problem with this card (not an answer); you return here after"))),console.log(chalk.gray(" "+(n?"更多: bookmark · status · lang zh/en":"more: bookmark · status · lang zh/en"))),console.log()}(l,t)}export function renderCheckFeedback(o,e,n,l=!1){const t=s().startsWith("zh");if(console.log(),n)console.log(chalk.green(" ✓ ")+chalk.white(t?"答对了。":"Correct."));else if(console.log(chalk.yellow(" ✗ ")+chalk.white(t?"记下了,继续。":"Noted — moving on.")),l){const e="y"===o.check?.answer?t?"是":"Yes":t?"否":"No";console.log(chalk.gray(" "+(t?"正确答案: ":"Answer: ")+e+". "+(t?"回看上面那段。":"Re-read the paragraph above.")))}const r=t?o._zh?.solution??o.solution:o.solution;if(r&&r.length>0){console.log(),console.log(chalk.cyan(" 📝 "+(t?"解答:":"Worked solution:")));for(const o of r){for(const e of p(o,60))console.log(chalk.white(" "+e));console.log()}}console.log()}function x(o){return[chalk.white(" "+(o?"编著:Charlie Zhu":"Created & edited by Charlie Zhu")),chalk.gray(" "+(o?"ICOA 2026 创始人 · 课程总架构师":"Founder & Chief Curriculum Architect · ICOA 2026"))]}export function renderPhaseComplete(o,e,n,l){const r=s().startsWith("zh"),[c,a]=n.cardRange,g=e.checkResults||{};let i=0,d=0;for(let o=c;o<=a;o++){const e=g[String(o)];e&&(i++,e.correct&&d++)}const y="-".repeat(48);console.log();for(const o of t(" "))console.log(o);console.log(),console.log(chalk.bold.yellow(" "+y)),console.log(chalk.bold.yellow(" "+(r?`阶段 ${n.number} 完成`:`Phase ${n.number} complete`))+chalk.gray(" · ")+chalk.white(n.name));const u=i>0&&d===i?chalk.bold.green:chalk.bold.white;console.log(chalk.gray(" "+(r?"理解检查得分: ":"comprehension score: "))+u(`${d}/${i}`)+chalk.gray(0===i?r?" (本阶段未作答 y/n)":" (no y/n answered)":"")),l&&console.log(chalk.gray(" "+(r?"下一阶段: ":"next: "))+chalk.bold.cyan(r?`阶段 ${l.number}`:`Phase ${l.number}`)+chalk.gray(" · ")+chalk.white(l.name)),console.log(chalk.bold.yellow(" "+y));for(const o of x(r))console.log(o)}export function renderCurriculumComplete(o,e){const n=s().startsWith("zh"),l=e.checkResults||{},r="-".repeat(48);let c=0,a=0;console.log();for(const o of t(" "))console.log(o);console.log(),console.log(chalk.bold.green(" "+r)),console.log(chalk.bold.green(" 🏆 "+(n?`${o.name} — 全部完成!`:`${o.name} — complete!`))),console.log(chalk.bold.green(" "+r));for(const e of o.modules){const[o,t]=e.cardRange;let r=0,s=0;for(let e=o;e<=t;e++){const o=l[String(e)];o&&(r++,o.correct&&s++)}c+=r,a+=s;const g=r>0&&s===r?chalk.green:chalk.white;console.log(chalk.gray(" "+(n?`阶段 ${e.number}`:`Phase ${e.number}`).padEnd(8))+g(`${s}/${r}`.padEnd(7))+chalk.gray(e.name))}console.log(chalk.bold.green(" "+r)),console.log(chalk.bold.green(" "+(n?"总分 / overall: ":"Overall: "))+chalk.bold.white(`${a}/${c}`)),console.log(chalk.bold.green(" "+r));for(const o of x(n))console.log(o);console.log()}export function renderMCQCard(o,l){const t=s(),r=e(o,t);y(r,l),m(),h(chalk.bold.yellow("🎯 "+r.title)),h(chalk.gray("─".repeat(Math.min(r.title.length+4,a)))),m();for(const o of C(r.question,60))h(" "+o);m();for(const o of["A","B","C","D"])h(chalk.cyan(` ${o}.`)+" "+chalk.white(r.options[o]));m(),u(),console.log(chalk.gray(" "+(t.startsWith("zh")?"输入 ":"Type "))+chalk.bold.green("A")+chalk.gray(" / ")+chalk.bold.green("B")+chalk.gray(" / ")+chalk.bold.green("C")+chalk.gray(" / ")+chalk.bold.green("D")+chalk.gray(" "+n("type_to_answer",t))),console.log()}export function renderMCQFeedback(o,l,t,r){const c=s(),a=e(o,c);console.log(),t?console.log(" "+chalk.bold.green(n("correct",c)+" ")+chalk.gray(`${n("one_point",c)} · ${l} = ${a.options[l]}`)):console.log(" "+chalk.bold.red(n("not_quite",c)+" ")+chalk.gray(`${n("you_chose",c)} ${l}; ${n("answer_is",c)} ${a.answer}.`)),console.log(),console.log(chalk.gray(" "+n("explanation",c)));for(const o of C(a.explanation,60))console.log(chalk.gray(" "+o));const g=Object.values(r.mcqResults),i=g.filter(o=>o.correct).length;console.log(),console.log(chalk.gray(" "+n("mcq_accuracy_so_far",c)+" ")+chalk.white(`${i}/${g.length}`)),console.log(),t||(console.log(chalk.gray(" "+n("press_ok_continue",c)+" ")+chalk.bold.green("ok")+chalk.gray(" "+n("to_continue",c))),console.log())}export function renderPracticalCard(o,l){const t=s(),r=e(o,t);y(r,l),m(),h(chalk.bold.yellow("🛠 "+r.title)),h(chalk.gray("─".repeat(Math.min(r.title.length+4,a)))),m();for(const o of C(r.task,60))h(" "+o);if(r.starterCode){m(),h(chalk.gray(" "+n("starter_code",t))),m();for(const o of r.starterCode.split("\n"))h(" "+chalk.cyan(o))}m(),u(),console.log(chalk.gray(" "+n("try_in_sandbox",t)+" ")+chalk.bold.cyan("!python3")+chalk.gray(" "+n("drops_into_python",t))),console.log(chalk.gray(" "+n("when_done",t))),console.log(chalk.gray(" ")+chalk.bold.green("done")+chalk.gray(" "+n("done_desc",t))),console.log(chalk.gray(" ")+chalk.bold.yellow("skip")+chalk.gray(" "+n("skip_desc",t))),console.log(chalk.gray(" card N jump to a card by number")),console.log()}export function renderPracticalSuccess(o){const l=s(),t=e(o,l);console.log(),console.log(" "+chalk.bold.green(n("practical_recorded",l))),console.log(),console.log(chalk.gray(" "+n("reference_answer",l)));for(const o of C(t.successHint,60))console.log(chalk.gray(" "+o));console.log(),console.log(chalk.gray(" "+n("press_ok_continue",l)+" ")+chalk.bold.green("ok")+chalk.gray(" "+n("to_continue",l))),console.log()}export function renderSimDemoCard(o,l){const t=s(),r=e(o,t);y(r,l),m(),h(chalk.bold.yellow("🎬 "+r.title)),m();for(const o of C(r.description,60))h(" "+o);m(),h(chalk.gray(" "+n("sim_requires",t))),m(),u(),console.log(chalk.gray(" ")+chalk.bold.cyan("sim")+chalk.gray(" "+n("sim_launch_desc",t))),console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+n("continue_to_next",t))),console.log(chalk.gray(" bookmark "+n("bookmark_desc",t))),console.log(chalk.gray(" back "+n("back_desc",t))),console.log(chalk.gray(" card N jump to a card by number")),console.log(chalk.gray(" quit "+n("quit_desc",t))),console.log()}export function renderMilestone(o,l){const t=s(),r=e(o,t),c=o.number===l.totalCards;console.log(),console.log(chalk.bold.yellow(" ╭"+g("═"))),console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+chalk.white(" "+n("milestone_header",t))),console.log(chalk.bold.yellow(" ║"));const a=` ${r.badge} ${r.emoji}`;console.log(chalk.bold.yellow(" ║ ")+chalk.bold.green(a)),console.log(chalk.bold.yellow(" ║ ")+chalk.gray(" ─".repeat(Math.max(1,Math.floor(r.badge.length/2+2))))),console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+" "+chalk.gray(n("in_wild_corresponds",t)));for(const o of C(r.realWorldLevel,60))console.log(chalk.bold.yellow(" ║ ")+" "+chalk.white(o));console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+" "+chalk.gray(n("whats_next",t)));for(const o of C(r.unlockedNext,60))console.log(chalk.bold.yellow(" ║ ")+" "+chalk.white(o));console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ╰"+g("═"))),console.log(),c?(console.log(chalk.gray(" "+n("demo_complete",t))),console.log(),console.log(chalk.gray(" "+n("unlock_full",t)+" ")+chalk.white(n("curriculum_name",t))+chalk.gray(",")),console.log(chalk.gray(" "+n("contact_team_leader",t)+" ")+chalk.bold.yellow("EA")+chalk.gray(" "+n("learn_token",t))),console.log(chalk.gray(" "+n("or_email",t)+" ")+chalk.cyan("australia@icoa2026.au")+chalk.gray(" "+n("for_partnership",t))),console.log(),console.log(chalk.gray(" "+n("type_quit",t)+" ")+chalk.bold.green("quit")+chalk.gray(" "+n("to_exit",t)+" ")+chalk.bold.green("status")+chalk.gray(" "+n("for_dashboard",t)))):(console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+n("continue_to_next",t))),console.log(chalk.gray(" status "+n("status_full",t))),console.log(chalk.gray(" card N jump to a card by number")),console.log(chalk.gray(" quit "+n("quit_desc",t)))),console.log()}export function renderStatus(o,e){const l=s(),t=e.cardsCompleted.length,r=o.totalCards,c=Object.values(e.mcqResults),a=c.filter(o=>o.correct).length;console.log(),console.log(chalk.cyan(" ╭─ ")+chalk.bold.white(n("status_title",l))+" "+chalk.cyan("─".repeat(25))),m(),h(" "+chalk.gray(n("total_progress",l)+" ")+i(t,r)+chalk.gray(` (${t}/${r})`)),h(" "+chalk.gray(n("streak",l)+" ")+d(e.streakDays)+chalk.gray(` (${n("longest",l)} ${e.longestStreak})`)),h(" "+chalk.gray(n("mcq_accuracy",l)+" ")+chalk.white(`${a}/${c.length}`)),h(" "+chalk.gray(n("practicals_done",l)+" ")+chalk.white(`${e.practicalsCompleted.length}`)),h(" "+chalk.gray(n("bookmarked",l)+" ")+chalk.white(`${e.bookmarks.length}`)),m();const g=n("module",l).replace(":","").trim();for(const n of o.modules){const[o,l]=n.cardRange,t=e.cardsCompleted.filter(e=>e>=o&&e<=l).length,r=l-o+1;h(" "+(t===r?chalk.green("✓"):t>0?chalk.yellow("▶"):chalk.gray("□"))+" "+chalk.gray(`${g} ${n.number}: `)+chalk.white(`${t}/${r}`)+chalk.gray(" "+n.name))}if(m(),e.achievements.length>0){h(" "+chalk.gray(n("achievements",l)));for(const o of e.achievements)h(" "+chalk.bold.yellow("★ ")+chalk.white(o))}else h(" "+chalk.gray(n("achievements_none",l)));m(),u()}
@@ -0,0 +1,202 @@
1
+ # ══════════════════════════════════════════════════════════
2
+ # ICOA Sandbox — Stable Competition Environment
3
+ # 110 system commands at locked versions (sleuthkit added v2.19.83)
4
+ # Same image on Mac / Linux / Windows (Docker)
5
+ # Image: icoa/sandbox:2026
6
+ # ══════════════════════════════════════════════════════════
7
+
8
+ FROM ubuntu:24.04
9
+
10
+ ENV DEBIAN_FRONTEND=noninteractive
11
+ ENV LANG=C.UTF-8
12
+
13
+ # ──────────────────────────────────────────────────────────
14
+ # [1/13] Editors & Terminal (5): vim nano tmux screen less
15
+ # ──────────────────────────────────────────────────────────
16
+ RUN apt-get update && apt-get install -y --no-install-recommends \
17
+ vim nano tmux screen less \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # ──────────────────────────────────────────────────────────
21
+ # [2/13] Compilers & Build (8): gcc g++ make as ld nasm cmake pkg-config
22
+ # ──────────────────────────────────────────────────────────
23
+ RUN apt-get update && apt-get install -y --no-install-recommends \
24
+ gcc g++ make binutils nasm cmake pkg-config \
25
+ && rm -rf /var/lib/apt/lists/*
26
+
27
+ # ──────────────────────────────────────────────────────────
28
+ # [3/13] Python 3.12 Runtime (3): python3 python3-pip python3-venv
29
+ # ──────────────────────────────────────────────────────────
30
+ RUN apt-get update && apt-get install -y --no-install-recommends \
31
+ python3 python3-pip python3-venv \
32
+ && rm -rf /var/lib/apt/lists/*
33
+
34
+ # ──────────────────────────────────────────────────────────
35
+ # [4/13] Networking (12): curl wget nc socat nmap ssh dig whois
36
+ # ping traceroute tcpdump tshark
37
+ # ──────────────────────────────────────────────────────────
38
+ RUN apt-get update && apt-get install -y --no-install-recommends \
39
+ curl wget netcat-openbsd socat nmap \
40
+ openssh-client dnsutils whois \
41
+ iputils-ping traceroute \
42
+ tcpdump tshark \
43
+ && rm -rf /var/lib/apt/lists/*
44
+
45
+ # ──────────────────────────────────────────────────────────
46
+ # [5/13] Debuggers & Tracing (5): gdb ltrace strace objdump readelf
47
+ # ──────────────────────────────────────────────────────────
48
+ RUN apt-get update && apt-get install -y --no-install-recommends \
49
+ gdb ltrace strace \
50
+ && rm -rf /var/lib/apt/lists/*
51
+
52
+ # ──────────────────────────────────────────────────────────
53
+ # [6/13] Reverse Engineering (4): radare2 r2 rabin2 upx
54
+ # ──────────────────────────────────────────────────────────
55
+ RUN apt-get update && apt-get install -y --no-install-recommends \
56
+ radare2 upx \
57
+ && rm -rf /var/lib/apt/lists/*
58
+
59
+ # ──────────────────────────────────────────────────────────
60
+ # [7/13] Forensics (8): binwalk foremost exiftool steghide strings file xxd
61
+ # + sleuthkit (mmls fls icat blkcat img_stat istat ... 20+ sub-cmds)
62
+ # sleuthkit aligns with picoCTF Primer disk-forensics chapter
63
+ # ──────────────────────────────────────────────────────────
64
+ RUN apt-get update && apt-get install -y --no-install-recommends \
65
+ binwalk foremost exiftool steghide xxd file sleuthkit \
66
+ && rm -rf /var/lib/apt/lists/*
67
+
68
+ # ──────────────────────────────────────────────────────────
69
+ # [8/13] Crypto & Password (4): john hashcat openssl gpg
70
+ # ──────────────────────────────────────────────────────────
71
+ RUN apt-get update && apt-get install -y --no-install-recommends \
72
+ john hashcat openssl gpg \
73
+ && rm -rf /var/lib/apt/lists/*
74
+
75
+ # ──────────────────────────────────────────────────────────
76
+ # [9/13] Data Processing (8): jq sqlite3 pdftotext base64 hexdump od sort uniq
77
+ # ──────────────────────────────────────────────────────────
78
+ RUN apt-get update && apt-get install -y --no-install-recommends \
79
+ jq sqlite3 poppler-utils coreutils bsdmainutils \
80
+ && rm -rf /var/lib/apt/lists/*
81
+
82
+ # ──────────────────────────────────────────────────────────
83
+ # [10/13] Archive (6): unzip zip tar gzip bzip2 xz
84
+ # ──────────────────────────────────────────────────────────
85
+ RUN apt-get update && apt-get install -y --no-install-recommends \
86
+ unzip zip tar gzip bzip2 xz-utils \
87
+ && rm -rf /var/lib/apt/lists/*
88
+
89
+ # ──────────────────────────────────────────────────────────
90
+ # [11/13] Core Unix (16): cat grep sed awk find head tail wc
91
+ # diff patch chmod chown ln cp mv mkdir
92
+ # (all from coreutils — pre-installed in Ubuntu)
93
+ # ──────────────────────────────────────────────────────────
94
+
95
+ # ──────────────────────────────────────────────────────────
96
+ # [12/13] Version Control (1): git
97
+ # ──────────────────────────────────────────────────────────
98
+ RUN apt-get update && apt-get install -y --no-install-recommends \
99
+ git \
100
+ && rm -rf /var/lib/apt/lists/*
101
+
102
+ # ──────────────────────────────────────────────────────────
103
+ # [13/13] Web Security (1): sqlmap
104
+ # ──────────────────────────────────────────────────────────
105
+ # Shared version-lock — single source of truth with src/commands/env.ts.
106
+ # pip -c constrains direct + transitive deps to the versions declared once
107
+ # in constraints.txt, so host setup and this image can never drift apart.
108
+ COPY constraints.txt /tmp/constraints.txt
109
+ RUN pip3 install --break-system-packages -c /tmp/constraints.txt sqlmap
110
+
111
+ # ══════════════════════════════════════════════════════════
112
+ # Python Libraries — ALL LOCKED VERSIONS (27 packages)
113
+ # ══════════════════════════════════════════════════════════
114
+ RUN pip3 install --break-system-packages -c /tmp/constraints.txt \
115
+ pwntools==4.12.0 \
116
+ pycryptodome==3.20.0 \
117
+ requests==2.31.0 \
118
+ beautifulsoup4==4.12.3 \
119
+ z3-solver==4.12.6 \
120
+ sympy==1.12 \
121
+ gmpy2==2.3.0 \
122
+ scapy==2.5.0 \
123
+ pillow==10.2.0 \
124
+ numpy==1.26.4 \
125
+ pefile==2023.2.7 \
126
+ capstone==5.0.1 \
127
+ ropper==1.13.8 \
128
+ ROPgadget==7.4 \
129
+ one_gadget \
130
+ seccomp-tools \
131
+ pngcheck \
132
+ uncompyle6==3.9.1 \
133
+ rsactftool \
134
+ angr \
135
+ flask==3.0.0 \
136
+ cryptography==42.0.0 \
137
+ paramiko==3.4.0 \
138
+ python-magic==0.4.27 \
139
+ yara-python==4.5.0 \
140
+ ipython
141
+
142
+ # ══════════════════════════════════════════════════════════
143
+ # GDB Enhancement — pwndbg (default) + bata24/gef (via `gdb-gef`)
144
+ # pwndbg loads in the default ~/.gdbinit; bata24/gef ships as a single file
145
+ # behind a wrapper because the two extensions clash if co-loaded. gdb-peda is
146
+ # deprecated and intentionally not installed.
147
+ # ══════════════════════════════════════════════════════════
148
+ RUN cd /opt && git clone https://github.com/pwndbg/pwndbg.git \
149
+ && cd pwndbg && ./setup.sh
150
+ RUN wget -qO /root/.gef-bata24.py https://raw.githubusercontent.com/bata24/gef/master/gef.py \
151
+ && printf '#!/bin/sh\nexec gdb -q -nx -ex "source /root/.gef-bata24.py" "$@"\n' > /usr/local/bin/gdb-gef \
152
+ && chmod +x /usr/local/bin/gdb-gef
153
+
154
+ # Radare2 Ghidra plugin
155
+ RUN r2pm -i r2ghidra || true
156
+
157
+ # CyberChef CLI
158
+ RUN apt-get update && apt-get install -y --no-install-recommends nodejs npm \
159
+ && npm install -g cyberchef-cli \
160
+ && rm -rf /var/lib/apt/lists/*
161
+
162
+ # ══════════════════════════════════════════════════════════
163
+ # Lock down: remove package managers (anti-cheat)
164
+ # ══════════════════════════════════════════════════════════
165
+ RUN rm -f /usr/bin/apt-get /usr/bin/apt /usr/bin/pip3 /usr/bin/pip
166
+ RUN rm -f /usr/bin/npm /usr/bin/npx
167
+
168
+ # ══════════════════════════════════════════════════════════
169
+ # Environment
170
+ # ══════════════════════════════════════════════════════════
171
+ WORKDIR /home/competitor
172
+ RUN mkdir -p /home/competitor/challenges
173
+ CMD ["/bin/bash"]
174
+
175
+ # ══════════════════════════════════════════════════════════
176
+ # Command Count Summary:
177
+ # Editors & Terminal: 5
178
+ # Compilers & Build: 8
179
+ # Python Runtime: 3
180
+ # Networking: 12
181
+ # Debuggers & Tracing: 5
182
+ # Reverse Engineering: 4
183
+ # Forensics: 8 (sleuthkit adds 20+ sub-binaries)
184
+ # Crypto & Password: 4
185
+ # Data Processing: 8
186
+ # Archive: 6
187
+ # Core Unix: 16
188
+ # Version Control: 1
189
+ # Web Security: 1
190
+ # Python Libraries: 27
191
+ # GDB/r2 Plugins: 2
192
+ # ─────────────────────────
193
+ # Total: 110
194
+ #
195
+ # + 19 ICOA commands = 129 total
196
+ #
197
+ # Note: sleuthkit is a meta-package; counted as 1 here but
198
+ # installs mmls, fls, icat, blkcat, img_stat, istat, blkls,
199
+ # blkstat, blkcalc, ils, jls, jcat, srch_strings, sigfind,
200
+ # sorter, hfind, mactime, tsk_gettimes, tsk_recover,
201
+ # tsk_imageinfo, tsk_loaddb, ffind (~22 binaries).
202
+ # ══════════════════════════════════════════════════════════
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.19.243",
3
+ "version": "2.19.245",
4
4
  "description": "ICOA CLI — The world's first CLI-native cyber & AI security olympiad terminal: AI4CTF (Day 1), CTF4AI (Day 2), VLA4CTF (Pioneer Round — embodied AI)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "dist",
11
11
  "refs",
12
12
  "assets",
13
+ "docker/Dockerfile",
13
14
  "docker/constraints.txt"
14
15
  ],
15
16
  "scripts": {