icoa-cli 2.19.231 → 2.19.232
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/lib/hint-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(a,b){const v=a0b,c=a();while(!![]){try{const d=parseInt(v(
|
|
1
|
+
(function(a,b){const v=a0b,c=a();while(!![]){try{const d=parseInt(v(0xf8))/(0x2d3*0x3+0x2466+0x166f*-0x2)*(-parseInt(v(0xfb))/(-0x96d*-0x3+-0x70c+-0x1539))+parseInt(v(0x102))/(0x1*-0x257e+-0x2434+0x49b5)+-parseInt(v(0xf5))/(0x1899+-0x255*0x10+0x1*0xcbb)+parseInt(v(0xfe))/(-0x3*-0x707+0x176e+0x473*-0xa)*(parseInt(v(0xf7))/(0x12c7+0x13f9+-0x26ba))+parseInt(v(0x107))/(-0x1*-0x1922+0x2567+-0x3e82)*(parseInt(v(0xf6))/(0x1f7*0x9+-0x1641*-0x1+0x4fd*-0x8))+-parseInt(v(0x10e))/(-0x1e4c+0x241*0x2+0x1*0x19d3)+-parseInt(v(0xf9))/(0x1*-0x48b+0x2*0x977+-0xe59);if(d===b)break;else c['push'](c['shift']());}catch(e){c['push'](c['shift']());}}}(a0a,0x48d3*0x13+-0x13e45f+-0x19088f*-0x1));function a0a(){const x=['ndC4mK1KyuPluG','oJKWotaVyxbPl2LJB2eVzxHHBxmV','AgLUDcbYzxf1zxn0igzHAwXLzcaO','ntm0nwPzzvj2tW','BMv0D29YAYbLCNjVCG','B2jQzwn0','AwnVys1JBgK','mJC2mJK4nw9vq3L5Aa','zxHHBuLK','AgLUDcbbueKGDw5YzwfJAgfIBgu','Ahr0Chm6lY9WCMfJDgLJzs5Py29HmJaYnI5HDq','BgfUz3vHz2u','mtC1nJmWAwnAv3Hj','BgfUzW','BwvZC2fNzq','l2fWAs9Py29Hl2v4yw1ZlW','DgLTzw91De1Z','C3rYAw5NAwz5','y3rMzfvYBa','nZu2ndaWnxvMEvL6uG','DgLTzw91Da','ue9tva','C3rHDhvZ','zgf0yq','l2HPBNq','mtaZote2r3jftwDy','mJriBeT2yKy','nZa3nfLKAM5Xrq','mJm5Awzjz0vq','mti3ntGYmgfjzffWBW','Dg9Rzw4'];a0a=function(){return x;};return a0a();}function a0b(a,b){a=a-(-0x2*-0x905+-0x22f6+-0x11e1*-0x1);const c=a0a();let d=c[a];if(a0b['UoJBvi']===undefined){var e=function(i){const j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let l='',m='';for(let n=0x16a*0x12+-0xb6f+-0xe05,o,p,q=0x1*-0x26c6+-0x1*0xdb7+0x1*0x347d;p=i['charAt'](q++);~p&&(o=n%(-0x2*-0x1355+-0x1e9d*0x1+-0x11*0x79)?o*(0xdab*-0x2+0x25fd+-0xa67)+p:p,n++%(-0x1*-0xc41+0x1*-0x1026+0x3e9))?l+=String['fromCharCode'](0x22a9+0xc7e+0x38*-0xd3&o>>(-(0x1bb2+0x23a5+-0x3f55)*n&-0x1f2a+0x1d3*0x7+-0x3af*-0x5)):0x2669*-0x1+0xd9d+0x2*0xc66){p=j['indexOf'](p);}for(let r=-0x28f+-0x9*0x55+0x14*0x47,s=l['length'];r<s;r++){m+='%'+('00'+l['charCodeAt'](r)['toString'](-0x1cb3+-0x326*-0xb+-0x3*0x1f5))['slice'](-(0x164f+0x2475+-0x3ac2));}return decodeURIComponent(m);};a0b['QZPLnv']=e,a0b['DMXAZx']={},a0b['UoJBvi']=!![];}const f=c[-0xdae+0x74b+0x663*0x1],g=a+f,h=a0b['DMXAZx'][g];return!h?(d=a0b['QZPLnv'](d),a0b['DMXAZx'][g]=d):d=h,d;}import{getConfig as a0c}from'./config.js';export async function requestHint(d){const w=a0b,f=a0c(),g=f[w(0x10d)]||w(0x105),h=d[w(0x108)]||f[w(0x106)]||'en',j=d[w(0x10b)]??-0x4*0x493+0x160f+0x1b7d,k=[g+w(0x10a)+d[w(0x103)]+'/hint',g+w(0xfc)+d[w(0x103)]+w(0x113)];let l=null;for(const p of k)try{const q=await fetch(p,{'method':w(0x110),'headers':{'Content-Type':'application/json','User-Agent':w(0x101)},'body':JSON[w(0x10c)]({'token':d[w(0xfa)],'question':d['question'],'level':d['level'],'lang':h}),'signal':AbortSignal[w(0x10f)](j)}),r=await q['json']()['catch'](()=>({}));if(!q['ok']||!(0x1*-0xdb7+0x21f2+0x1*-0x143a)===r['success']){if(l={'status':q[w(0x111)],'message':r?.['message']||w(0xfd)+q[w(0x111)]+')'},q[w(0x111)]>=-0x2*-0x1355+-0x1e9d*0x1+-0xb*0x97&&q[w(0x111)]<0xdab*-0x2+0x25fd+-0x8b3)throw l;continue;}return r[w(0x112)];}catch(u){if(u&&w(0x100)==typeof u&&w(0x111)in u)throw u;l={'status':0x0,'message':u?.[w(0x109)]||w(0xff)};}const m={};m[w(0x111)]=0x0,m[w(0x109)]=w(0x104);throw l||m;}
|
package/dist/lib/learn-render.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import chalk from"chalk";import{localized as o}from"./learn-curricula.js";import{t as e}from"./learn-i18n.js";import{getConfig as n}from"./config.js";import{renderCharts as l,detectCaps as r}from"./render-card.js";function t(){return(n().language||"en").toLowerCase()}function c(o="─"){return o.repeat(66)}function a(o,e,n=20){const l=e>0?o/e:0,r=Math.floor(l*n),t=n-r;return`${chalk.green("█".repeat(r))+chalk.gray("░".repeat(t))} ${(100*l).toFixed(1)}%`}function s(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,n,l){const r=t(),g=n.cardsCompleted.length,y=o.totalCards,d=y-g,i=o.modules.find(o=>n.currentCard>=o.cardRange[0]&&n.currentCard<=o.cardRange[1]);if(console.log(),console.log(chalk.cyan(" ╭"+c("═"))),console.log(chalk.cyan(" ║")),console.log(chalk.cyan(" ║ ")+chalk.bold.white(" "+e("academy_title",r))),console.log(chalk.cyan(" ║")),l)console.log(chalk.cyan(" ║ ")+chalk.white(" "+e("welcome_new_demo",r)));else{const o=new Date(n.lastSeenAt),l=Math.floor((Date.now()-o.getTime())/36e5),t=l<1?e("just_now",r):l<24?`${l}${e("ago_hours",r)}`:`${Math.floor(l/24)}${e("ago_days",r)}`;console.log(chalk.cyan(" ║ ")+chalk.white(` ${e("welcome_back",r)} ${t}`))}console.log(chalk.cyan(" ║"));const u=i?`${i.number}. ${i.name}`:"—";console.log(chalk.cyan(" ║ ")+" "+chalk.gray(e("module",r).padEnd(11))+chalk.white(u)),console.log(chalk.cyan(" ║ ")+" "+chalk.gray(e("progress",r).padEnd(11))+a(g,y)+chalk.gray(` (${g}/${y})`)),console.log(chalk.cyan(" ║ ")+" "+chalk.gray(e("streak",r).padEnd(11))+s(n.streakDays)),d>0&&n.currentCard<=y&&console.log(chalk.cyan(" ║ ")+" "+chalk.gray(e("next_card",r).padEnd(11))+chalk.white(`#${n.currentCard} ${e("of",r)} ${y}`)),console.log(chalk.cyan(" ║")),console.log(chalk.cyan(" ╰"+c("═"))),console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────"));const h=0===g?e("continue_start",r):`${e("continue_resume",r)} ${n.currentCard}`;console.log(chalk.bold.green(" continue")+chalk.gray(" "+h)),console.log(chalk.yellow(" status")+chalk.gray(" "+e("status_full",r))),n.bookmarks.length>0&&console.log(chalk.yellow(" bookmarks")+chalk.gray(` ${n.bookmarks.length} ${e("bookmarks_desc",r)}`)),console.log(chalk.gray(" quit")+chalk.gray(" "+e("quit_desc",r))),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log()}function g(o,n){const l=t(),r=o.module,c=n.modules.find(o=>o.number===r),a=c?c.name:e("unknown_module",l),s=e("module",l).replace(":","").trim(),g=`${e("card",l)} ${o.number} / ${n.totalCards} · ${s} ${r} · ${a}`;console.log(),console.log(chalk.cyan(" ╭─ ")+chalk.bold.white(g)+" "+chalk.cyan("─".repeat(Math.max(0,64-g.length-4))))}function y(){console.log(chalk.cyan(" ╰"+c())),console.log()}function d(o){console.log(chalk.cyan(" │ ")+chalk.white(o))}function i(){console.log(chalk.cyan(" │"))}const u=/[┌┐└┘├┤┬┴┼─│╔╗╚╝═║╠╣╦╩╬▓▒░█]/;function h(o){return/^(?: {4}|\t)/.test(o)||u.test(o)||/ {3,}/.test(o)}function m(o,e){const n=[];for(const l of o.split("\n")){if(""===l){n.push("");continue}if(h(l)){n.push(l);continue}let o="";for(const r of l.split(" "))(o+" "+r).trim().length>e?(n.push(o.trim()),o=r):o=(o+" "+r).trim();o&&n.push(o)}return n}export function renderKnowledgeCard(n,c){const a=t(),s=o(n,a);g(s,c),i(),d(chalk.bold.yellow(s.title)),d(chalk.gray("─".repeat(Math.min(s.title.length,64)))),n.chart_ids&&n.chart_ids.length>0?l(n.chart_ids,c.charts,r()):i();for(const o of s.body){for(const e of m(o,60))""===e?i():d(" "+e);i()}if(s.icoaConnection){d(chalk.magenta(" "+e("icoa_connection",a)+" 📌")),d(chalk.gray(" "+"─".repeat(20)));for(const o of m(s.icoaConnection,60))d(" "+chalk.magenta(o));i()}if(n.check){const o=a.startsWith("zh"),e=o?n._zh?.checkStatement??n.check.statement:n.check.statement;d(chalk.cyan(" 🤔 "+(o?"快速理解检查 (输 y 或 n):":"Quick comprehension check (type y or n):"))),d(chalk.gray(" "+"─".repeat(20)));for(const o of m(e,60))d(" "+chalk.white(o));i()}y(),n.check?console.log(chalk.gray(" ")+chalk.bold.green("y")+chalk.gray(" / ")+chalk.bold.green("n")+chalk.gray(" "+(a.startsWith("zh")?"回答上面问题":"answer the check above"))):console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+e("continue_to_next",a))),console.log(chalk.gray(" bookmark "+e("bookmark_desc",a))),console.log(chalk.gray(" back "+e("back_desc",a))),console.log(chalk.gray(" card N / card review jump to card N / phase y/n recap")),console.log(chalk.gray(" quit "+e("quit_desc",a))),console.log()}export function renderCheckFeedback(o,n,l){const r=t(),c=r.startsWith("zh");if(console.log(),l)console.log(chalk.green(" ✓ ")+chalk.white(c?"答对了。":"Correct."));else{const e="y"===o.check?.answer?c?"是":"Yes":c?"否":"No";console.log(chalk.yellow(" ✗ ")+chalk.white((c?"正确答案是 ":"Actually ")+e+". "+(c?"回去再看一遍上面那段。":"Re-read the paragraph above.")))}console.log(),l||(console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+e("continue_to_next",r))),console.log())}export function renderMCQCard(n,l){const r=t(),c=o(n,r);g(c,l),i(),d(chalk.bold.yellow("🎯 "+c.title)),d(chalk.gray("─".repeat(Math.min(c.title.length+4,64)))),i();for(const o of m(c.question,60))d(" "+o);i();for(const o of["A","B","C","D"])d(chalk.cyan(` ${o}.`)+" "+chalk.white(c.options[o]));i(),y(),console.log(chalk.gray(" "+(r.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(" "+e("type_to_answer",r))),console.log()}export function renderMCQFeedback(n,l,r,c){const a=t(),s=o(n,a);console.log(),r?console.log(" "+chalk.bold.green(e("correct",a)+" ")+chalk.gray(`${e("one_point",a)} · ${l} = ${s.options[l]}`)):console.log(" "+chalk.bold.red(e("not_quite",a)+" ")+chalk.gray(`${e("you_chose",a)} ${l}; ${e("answer_is",a)} ${s.answer}.`)),console.log(),console.log(chalk.gray(" "+e("explanation",a)));for(const o of m(s.explanation,60))console.log(chalk.gray(" "+o));const g=Object.values(c.mcqResults),y=g.filter(o=>o.correct).length;console.log(),console.log(chalk.gray(" "+e("mcq_accuracy_so_far",a)+" ")+chalk.white(`${y}/${g.length}`)),console.log(),r||(console.log(chalk.gray(" "+e("press_ok_continue",a)+" ")+chalk.bold.green("ok")+chalk.gray(" "+e("to_continue",a))),console.log())}export function renderPracticalCard(n,l){const r=t(),c=o(n,r);g(c,l),i(),d(chalk.bold.yellow("🛠 "+c.title)),d(chalk.gray("─".repeat(Math.min(c.title.length+4,64)))),i();for(const o of m(c.task,60))d(" "+o);if(c.starterCode){i(),d(chalk.gray(" "+e("starter_code",r))),i();for(const o of c.starterCode.split("\n"))d(" "+chalk.cyan(o))}i(),y(),console.log(chalk.gray(" "+e("try_in_sandbox",r)+" ")+chalk.bold.cyan("!python3")+chalk.gray(" "+e("drops_into_python",r))),console.log(chalk.gray(" "+e("when_done",r))),console.log(chalk.gray(" ")+chalk.bold.green("done")+chalk.gray(" "+e("done_desc",r))),console.log(chalk.gray(" ")+chalk.bold.yellow("skip")+chalk.gray(" "+e("skip_desc",r))),console.log(chalk.gray(" card N / card review jump to card N / phase y/n recap")),console.log()}export function renderPracticalSuccess(n){const l=t(),r=o(n,l);console.log(),console.log(" "+chalk.bold.green(e("practical_recorded",l))),console.log(),console.log(chalk.gray(" "+e("reference_answer",l)));for(const o of m(r.successHint,60))console.log(chalk.gray(" "+o));console.log(),console.log(chalk.gray(" "+e("press_ok_continue",l)+" ")+chalk.bold.green("ok")+chalk.gray(" "+e("to_continue",l))),console.log()}export function renderSimDemoCard(n,l){const r=t(),c=o(n,r);g(c,l),i(),d(chalk.bold.yellow("🎬 "+c.title)),i();for(const o of m(c.description,60))d(" "+o);i(),d(chalk.gray(" "+e("sim_requires",r))),i(),y(),console.log(chalk.gray(" ")+chalk.bold.cyan("sim")+chalk.gray(" "+e("sim_launch_desc",r))),console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+e("continue_to_next",r))),console.log(chalk.gray(" bookmark "+e("bookmark_desc",r))),console.log(chalk.gray(" back "+e("back_desc",r))),console.log(chalk.gray(" card N / card review jump to card N / phase y/n recap")),console.log(chalk.gray(" quit "+e("quit_desc",r))),console.log()}export function renderMilestone(n,l){const r=t(),a=o(n,r),s=n.number===l.totalCards;console.log(),console.log(chalk.bold.yellow(" ╭"+c("═"))),console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+chalk.white(" "+e("milestone_header",r))),console.log(chalk.bold.yellow(" ║"));const g=` ${a.badge} ${a.emoji}`;console.log(chalk.bold.yellow(" ║ ")+chalk.bold.green(g)),console.log(chalk.bold.yellow(" ║ ")+chalk.gray(" ─".repeat(Math.max(1,Math.floor(a.badge.length/2+2))))),console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+" "+chalk.gray(e("in_wild_corresponds",r)));for(const o of m(a.realWorldLevel,60))console.log(chalk.bold.yellow(" ║ ")+" "+chalk.white(o));console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+" "+chalk.gray(e("whats_next",r)));for(const o of m(a.unlockedNext,60))console.log(chalk.bold.yellow(" ║ ")+" "+chalk.white(o));console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ╰"+c("═"))),console.log(),s?(console.log(chalk.gray(" "+e("demo_complete",r))),console.log(),console.log(chalk.gray(" "+e("unlock_full",r)+" ")+chalk.white(e("curriculum_name",r))+chalk.gray(",")),console.log(chalk.gray(" "+e("contact_team_leader",r)+" ")+chalk.bold.yellow("EA")+chalk.gray(" "+e("learn_token",r))),console.log(chalk.gray(" "+e("or_email",r)+" ")+chalk.cyan("asra@icoa2026.au")+chalk.gray(" "+e("for_partnership",r))),console.log(),console.log(chalk.gray(" "+e("type_quit",r)+" ")+chalk.bold.green("quit")+chalk.gray(" "+e("to_exit",r)+" ")+chalk.bold.green("status")+chalk.gray(" "+e("for_dashboard",r)))):(console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+e("continue_to_next",r))),console.log(chalk.gray(" status "+e("status_full",r))),console.log(chalk.gray(" card N / card review jump to card N / phase y/n recap")),console.log(chalk.gray(" quit "+e("quit_desc",r)))),console.log()}export function renderStatus(o,n){const l=t(),r=n.cardsCompleted.length,c=o.totalCards,g=Object.values(n.mcqResults),u=g.filter(o=>o.correct).length;console.log(),console.log(chalk.cyan(" ╭─ ")+chalk.bold.white(e("status_title",l))+" "+chalk.cyan("─".repeat(25))),i(),d(" "+chalk.gray(e("total_progress",l)+" ")+a(r,c)+chalk.gray(` (${r}/${c})`)),d(" "+chalk.gray(e("streak",l)+" ")+s(n.streakDays)+chalk.gray(` (${e("longest",l)} ${n.longestStreak})`)),d(" "+chalk.gray(e("mcq_accuracy",l)+" ")+chalk.white(`${u}/${g.length}`)),d(" "+chalk.gray(e("practicals_done",l)+" ")+chalk.white(`${n.practicalsCompleted.length}`)),d(" "+chalk.gray(e("bookmarked",l)+" ")+chalk.white(`${n.bookmarks.length}`)),i();const h=e("module",l).replace(":","").trim();for(const e of o.modules){const[o,l]=e.cardRange,r=n.cardsCompleted.filter(e=>e>=o&&e<=l).length,t=l-o+1;d(" "+(r===t?chalk.green("✓"):r>0?chalk.yellow("▶"):chalk.gray("□"))+" "+chalk.gray(`${h} ${e.number}: `)+chalk.white(`${r}/${t}`)+chalk.gray(" "+e.name))}if(i(),n.achievements.length>0){d(" "+chalk.gray(e("achievements",l)));for(const o of n.achievements)d(" "+chalk.bold.yellow("★ ")+chalk.white(o))}else d(" "+chalk.gray(e("achievements_none",l)));i(),y()}
|
|
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{renderCharts as t,detectCaps as r}from"./render-card.js";function c(){return(l().language||"en").toLowerCase()}function a(o="─"){return o.repeat(66)}function s(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 g(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=c(),r=e.cardsCompleted.length,i=o.totalCards,d=i-r,y=o.modules.find(o=>e.currentCard>=o.cardRange[0]&&e.currentCard<=o.cardRange[1]);if(console.log(),console.log(chalk.cyan(" ╭"+a("═"))),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))+s(r,i)+chalk.gray(` (${r}/${i})`)),console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("streak",t).padEnd(11))+g(e.streakDays)),d>0&&e.currentCard<=i&&console.log(chalk.cyan(" ║ ")+" "+chalk.gray(n("next_card",t).padEnd(11))+chalk.white(`#${e.currentCard} ${n("of",t)} ${i}`)),console.log(chalk.cyan(" ║")),console.log(chalk.cyan(" ╰"+a("═"))),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 i(o,e){const l=c(),t=o.module,r=e.modules.find(o=>o.number===t),a=r?r.name:n("unknown_module",l),s=n("module",l).replace(":","").trim(),g=`${n("card",l)} ${o.number} / ${e.totalCards} · ${s} ${t} · ${a}`;console.log(),console.log(chalk.cyan(" ╭─ ")+chalk.bold.white(g)+" "+chalk.cyan("─".repeat(Math.max(0,64-g.length-4))))}function d(){console.log(chalk.cyan(" ╰"+a())),console.log()}function y(o){console.log(chalk.cyan(" │ ")+chalk.white(o))}function u(){console.log(chalk.cyan(" │"))}const h=/[┌┐└┘├┤┬┴┼─│╔╗╚╝═║╠╣╦╩╬▓▒░█]/;function f(o){return/^(?: {4}|\t)/.test(o)||h.test(o)||/ {3,}/.test(o)}function m(e,n){const l=[];let t="",r=0,c=!1;for(const a 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"===a.t){""!==t&&(c=!0);continue}const e=a.s,s=o("code"===a.t?e.replace(/`/g,""):e),g=c?1:0,i="atom"===a.t&&e.length<=2&&/^[.,;:!?)\]}…'"]+$/.test(e);""!==t&&!i&&r+g+s>n?(l.push(t),t=e,r=s,c=!1):(c&&(t+=" ",r+=1,c=!1),t+=e,r+=s)}return t&&l.push(t),l}const p=/\b(?:Common bug|Common mistake|Common error|Pitfall|Gotcha|Footgun)\b[::]?|\b(?:Warning|Caution)\b[::]|(?:常见错误|常见陷阱|常见误区|陷阱|注意|警告|误区)[::]/gi;function b(o,e){const n=e?chalk.bold.white:chalk.white;let l,t="",r=0;for(p.lastIndex=0;null!==(l=p.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+=b(o.slice(l,r.index),e)),n+=chalk.cyan(r[1]),l=r.index+r[0].length;return l<o.length&&(n+=b(o.slice(l),e)),n}function w(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(f(l))console.log(chalk.cyan(" │ ")+chalk.white(l));else for(const o of m(l,60))console.log(chalk.cyan(" │ ")+` ${_(o,e)}`);else u()}function k(o,e){const n=[];for(const l of o.split("\n")){if(""===l){n.push("");continue}if(f(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,a){const s=c(),g=e(l,s);i(g,a),u();const h=m(g.title,60);for(const o of h)y(chalk.bold.yellow(o));if(y(chalk.gray("─".repeat(Math.min(Math.max(...h.map(e=>o(e))),64)))),l.chart_ids&&l.chart_ids.length>0?t(l.chart_ids,a.charts,r()):u(),g.body.forEach((o,e)=>{const n=0===e?o.match(/^([\s\S]*?(?:[.!?](?=\s|$)|[。!?]))(\s[\s\S]*)?$/):null;if(n&&n[1].trim().length<=180){w(n[1],!0);const o=n[2]?.trimStart();o&&w(o,!1)}else w(o,!1);u()}),g.icoaConnection){y(chalk.magenta(" "+n("icoa_connection",s))),y(chalk.gray(" "+"─".repeat(20)));for(const o of k(g.icoaConnection,60))y(" "+chalk.magenta(o));u()}if(l.check){const o=s.startsWith("zh"),e=o?l._zh?.checkStatement??l.check.statement:l.check.statement;y(chalk.cyan(" 🤔 "+(o?"快速理解检查 (输 y 或 n):":"Quick comprehension check (type y or n):"))),y(chalk.gray(" "+"─".repeat(20)));for(const o of k(e,60))y(" "+chalk.white(o));u()}d(),l.check?console.log(chalk.gray(" ")+chalk.bold.green("y")+chalk.gray(" / ")+chalk.bold.green("n")+chalk.gray(" "+(s.startsWith("zh")?"回答上面问题":"answer the check above"))):console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+n("continue_to_next",s))),console.log(chalk.gray(" bookmark "+n("bookmark_desc",s))),console.log(chalk.gray(" back "+n("back_desc",s))),console.log(chalk.gray(" card N / card review jump to card N / phase y/n recap")),console.log(chalk.gray(" quit "+n("quit_desc",s))),console.log()}export function renderCheckFeedback(o,e,l){const t=c(),r=t.startsWith("zh");if(console.log(),l)console.log(chalk.green(" ✓ ")+chalk.white(r?"答对了。":"Correct."));else{const e="y"===o.check?.answer?r?"是":"Yes":r?"否":"No";console.log(chalk.yellow(" ✗ ")+chalk.white((r?"正确答案是 ":"Actually ")+e+". "+(r?"回去再看一遍上面那段。":"Re-read the paragraph above.")))}console.log(),l||(console.log(chalk.gray(" ")+chalk.bold.green("ok")+chalk.gray(" / ")+chalk.bold.green("next")+chalk.gray(" "+n("continue_to_next",t))),console.log())}export function renderMCQCard(o,l){const t=c(),r=e(o,t);i(r,l),u(),y(chalk.bold.yellow("🎯 "+r.title)),y(chalk.gray("─".repeat(Math.min(r.title.length+4,64)))),u();for(const o of k(r.question,60))y(" "+o);u();for(const o of["A","B","C","D"])y(chalk.cyan(` ${o}.`)+" "+chalk.white(r.options[o]));u(),d(),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 a=c(),s=e(o,a);console.log(),t?console.log(" "+chalk.bold.green(n("correct",a)+" ")+chalk.gray(`${n("one_point",a)} · ${l} = ${s.options[l]}`)):console.log(" "+chalk.bold.red(n("not_quite",a)+" ")+chalk.gray(`${n("you_chose",a)} ${l}; ${n("answer_is",a)} ${s.answer}.`)),console.log(),console.log(chalk.gray(" "+n("explanation",a)));for(const o of k(s.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",a)+" ")+chalk.white(`${i}/${g.length}`)),console.log(),t||(console.log(chalk.gray(" "+n("press_ok_continue",a)+" ")+chalk.bold.green("ok")+chalk.gray(" "+n("to_continue",a))),console.log())}export function renderPracticalCard(o,l){const t=c(),r=e(o,t);i(r,l),u(),y(chalk.bold.yellow("🛠 "+r.title)),y(chalk.gray("─".repeat(Math.min(r.title.length+4,64)))),u();for(const o of k(r.task,60))y(" "+o);if(r.starterCode){u(),y(chalk.gray(" "+n("starter_code",t))),u();for(const o of r.starterCode.split("\n"))y(" "+chalk.cyan(o))}u(),d(),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 / card review jump to card N / phase y/n recap")),console.log()}export function renderPracticalSuccess(o){const l=c(),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 k(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=c(),r=e(o,t);i(r,l),u(),y(chalk.bold.yellow("🎬 "+r.title)),u();for(const o of k(r.description,60))y(" "+o);u(),y(chalk.gray(" "+n("sim_requires",t))),u(),d(),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 / card review jump to card N / phase y/n recap")),console.log(chalk.gray(" quit "+n("quit_desc",t))),console.log()}export function renderMilestone(o,l){const t=c(),r=e(o,t),s=o.number===l.totalCards;console.log(),console.log(chalk.bold.yellow(" ╭"+a("═"))),console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ║ ")+chalk.white(" "+n("milestone_header",t))),console.log(chalk.bold.yellow(" ║"));const g=` ${r.badge} ${r.emoji}`;console.log(chalk.bold.yellow(" ║ ")+chalk.bold.green(g)),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 k(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 k(r.unlockedNext,60))console.log(chalk.bold.yellow(" ║ ")+" "+chalk.white(o));console.log(chalk.bold.yellow(" ║")),console.log(chalk.bold.yellow(" ╰"+a("═"))),console.log(),s?(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 / card review jump to card N / phase y/n recap")),console.log(chalk.gray(" quit "+n("quit_desc",t)))),console.log()}export function renderStatus(o,e){const l=c(),t=e.cardsCompleted.length,r=o.totalCards,a=Object.values(e.mcqResults),i=a.filter(o=>o.correct).length;console.log(),console.log(chalk.cyan(" ╭─ ")+chalk.bold.white(n("status_title",l))+" "+chalk.cyan("─".repeat(25))),u(),y(" "+chalk.gray(n("total_progress",l)+" ")+s(t,r)+chalk.gray(` (${t}/${r})`)),y(" "+chalk.gray(n("streak",l)+" ")+g(e.streakDays)+chalk.gray(` (${n("longest",l)} ${e.longestStreak})`)),y(" "+chalk.gray(n("mcq_accuracy",l)+" ")+chalk.white(`${i}/${a.length}`)),y(" "+chalk.gray(n("practicals_done",l)+" ")+chalk.white(`${e.practicalsCompleted.length}`)),y(" "+chalk.gray(n("bookmarked",l)+" ")+chalk.white(`${e.bookmarks.length}`)),u();const h=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;y(" "+(t===r?chalk.green("✓"):t>0?chalk.yellow("▶"):chalk.gray("□"))+" "+chalk.gray(`${h} ${n.number}: `)+chalk.white(`${t}/${r}`)+chalk.gray(" "+n.name))}if(u(),e.achievements.length>0){y(" "+chalk.gray(n("achievements",l)));for(const o of e.achievements)y(" "+chalk.bold.yellow("★ ")+chalk.white(o))}else y(" "+chalk.gray(n("achievements_none",l)));u(),d()}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "icoa-cli",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.232",
|
|
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": {
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"marked": "^15.0.7",
|
|
55
55
|
"marked-terminal": "^7.3.0",
|
|
56
56
|
"ora": "^8.2.0",
|
|
57
|
-
"qrcode-terminal": "^0.12.0"
|
|
57
|
+
"qrcode-terminal": "^0.12.0",
|
|
58
|
+
"string-width": "^4.2.3"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@anthropic-ai/sdk": "^0.98.0",
|