$ show lifo-sh/lifo
Lifo is a browser-based virtual machine and sandbox environment that emulates a Linux-like OS entirely in JavaScript. It provides a virtual filesystem (VFS), network stack, process management, shell, and an extensive Node.js compatibility layer that allows running real npm packages, dev servers (Vite, Expo, Express), and CLI tools inside the sandbox. The repository is a pnpm monorepo containing multiple packages: `@lifo-sh/core` (kernel, VFS, shell, node-compat), `@lifo-sh/ui` (React components for terminal, file explorer, preview), `lifo-sh` (CLI for daemon/session management), `apps/playground` (interactive web demo), `apps/desktop` (macOS-style web desktop), and many `lifo-pkg-*` command packages (git, ffmpeg, vi, etc.). The architecture is modular: the core kernel is framework-agnostic and can be embedded in Node.js or browser environments, while the UI and CLI are separate consumers. Key data flows involve user input through the shell, command execution against the VFS and network stack, and Node API calls intercepted by the compatibility layer. External dependencies include `acorn`, `browser-metro`, `ws`, and optional `esbuild`. The project is actively maintained with frequent releases, extensive tests, and a clear roadmap for expanding the sandbox capabilities.
The LLM identified 4 files worth highlighting for reuse:
A self-contained, framework-agnostic file browser class that renders a tree view, list view, context menus, drag-and-drop upload, search, keyboard navigation, and media preview. It communicates via typed events and accepts a configuration object, making it reusable in any web project without dependencies on React or other frameworks. Demonstrates high craftsmanship in DOM manipulation and event-driven architecture.
Contains the `transformEsmToCjs` function, a self-contained regex-based transformer that converts ESM import/export syntax to CommonJS. It handles combined imports, re-exports, star exports, default exports, and dynamic imports while masking string literals to avoid false matches. This function could be extracted as a standalone utility for any project needing ESMβCJS transformation without a full bundler.
A cleanly factored benchmark workload that exports pure functions (boot, command execution, filesystem operations) accepting a `Sandbox` class or instance. It is environment-agnostic and used across Node, headless Chromium, and single-binary runners. The pattern of defining reusable, parameterized workloads is applicable to any sandbox or VM testing scenario.
A small CLI tool that scaffolds new `lifo-pkg-*` packages with a consistent structure: package.json, tsconfig, source file, and test harness. It demonstrates a reusable pattern for generating boilerplate code from templates, applicable to any monorepo plugin system.