{ "id": "02-architecture", "title": "Architecture without the mystery", "icon": "🏗", "level": "beginner", "lessons": [ { "id": "2.1", "title": "Terminal, modules, commands", "objective": "See what is loaded, why a command can be listed but broken, and what the system is doing.", "minutes": 9, "commands": [ "modules", "doctor", "status" ], "blocks": [ { "type": "text", "text": "`terminal.js` parses input and dispatches a command to the module that registered it. Each module owns a `commands` map and contributes help strings." }, { "type": "cmd", "text": "modules" }, { "type": "text", "text": "The module manager lists every loaded module and its command count." }, { "type": "cmd", "text": "status" }, { "type": "text", "text": "`status` shows files, modules and network state in one place." }, { "type": "cmd", "text": "doctor" }, { "type": "tip", "text": "A command that exists in `help` but fails at runtime usually has an unmet module requirement that `doctor` reports." } ], "exercise": { "instruction": "Run `doctor` and see how it ranks module problems.", "accept": [ "doctor", "modules", "module-info *" ], "check": { "type": "command" }, "hint": "Type: doctor" }, "quiz": { "q": "Who executes a command after you press Enter?", "options": [ "nginx", "the module that registered it", "the browser cache" ], "answer": 1 }, "sources": [ "modules/core/terminal.js", "modules/core/module-manager.js", "modules/core/module-system.js" ] }, { "id": "2.2", "title": "VFS and the three loading tiers", "objective": "Understand where files live and why a module edit sometimes needs a rebuild and sometimes does not.", "minutes": 10, "commands": [ "pwd", "cd", "tree", "health-check", "mem" ], "blocks": [ { "type": "text", "text": "Files live in `virtual-fs.js` (in-memory + localStorage persistence). Directories are nodes; `readFile()` returns `null` for a missing path." }, { "type": "text", "text": "Modules ship in three tiers:" }, { "type": "table", "text": "core-bundle.js — core modules (requires rebuild) | critical-ext-bundle.js — editor, shell, alias, finder, filemgr, diff, busybox (requires rebuild) | individually loaded ext modules — cache-busted by LATEST_VER (no rebuild)" }, { "type": "cmd", "text": "status" }, { "type": "warn", "text": "Individually loaded modules are cached with `?v=`. Without bumping `LATEST_VER`, users keep the old file." } ], "exercise": { "instruction": "Run `health-check` and find the VFS size line.", "accept": [ "health-check", "mem" ], "check": { "type": "command" }, "hint": "Type: health-check" }, "quiz": { "q": "Which tier needs `rebuild-bundles.py` after an edit?", "options": [ "core-bundle.js", "webdav.js", "course.js" ], "answer": 0 }, "sources": [ "modules/core/virtual-fs.js", "modules/core/module-loader.js", "scripts/rebuild-bundles.py" ] } ] }