35 Commits

Author SHA1 Message Date
Sylvestre Ledru 77efde6da3 Add uutils grep to the playground
grep ships as its own standalone WASM module (not part of the coreutils
multicall binary) and depends on the Oniguruma C library, so the website
workflow now checks out uutils/grep, installs the WASI SDK to provide a
wasm sysroot for the onig_sys C sources, builds grep.wasm, and appends
"grep" to the generated command list.

The terminal loads grep.wasm as an optional second module and dispatches
grep directly (argv[0] = "grep"). grep defaults to --color=never since the
WASI shim reports stdout as a TTY, which would otherwise emit match-
highlight escapes that corrupt piped output; explicit --color is honored.

Adds a grep emoji example and grep WASM integration tests.
2026-06-02 13:47:45 +02:00
Sylvestre Ledru c5907a4b59 Generate playground command list from coreutils feat_wasm
Previously the list of WASM-bundled utilities was hardcoded in
wasm-terminal.js and playground.md, which drifted from the actual
feat_wasm feature in coreutils/Cargo.toml (e.g. dd, tty, yes were
missing). The website workflow now parses feat_wasm at build time
and emits static/wasm/commands.js, which the terminal prefers over
its built-in fallback list.
2026-05-13 08:13:39 +02:00
Sylvestre Ledru 52600ea55c Fix French arch --help test to match current translation
The coreutils-l10n translation uses the infinitive 'Afficher' rather
than 'Affiche', causing the test to fail in CI.
2026-04-13 09:19:15 +02:00
Sylvestre Ledru d843e3d2c2 Show uutils commit hash and date on playground page
Emit a version.js alongside the WASM binary in CI recording the
coreutils commit used for the build, and display it under the
terminal with a link to the commit on GitHub.
2026-04-13 09:02:41 +02:00
Sylvestre Ledru c8c195ed63 Fix French arch --help test assertion
Upstream coreutils-l10n updated the French translation of arch-about
from "Afficher l'architecture de la machine" to "Affiche l'architecture
de la machine", which was causing the WASM terminal test to fail in CI.
2026-04-04 23:09:59 +02:00
Sylvestre Ledru 7b8c877eb0 Playground: remove JS fallback, require WASM for all commands
Remove the jsFallback function and its tests. Commands now require
the WASM binary to be loaded. If WASM is still loading, a "please
wait" message is shown instead of running JS approximations.
2026-04-04 12:58:14 +02:00
Sylvestre Ledru b00263738c Revert "Playground: capture Ctrl+W as delete-previous-word"
This reverts commit b82f7b65fb.
2026-04-04 12:53:25 +02:00
Sylvestre Ledru b82f7b65fb Playground: capture Ctrl+W as delete-previous-word
Prevent the browser from closing the tab when Ctrl+W is pressed
while the terminal is focused. Instead, handle it as the standard
terminal "delete previous word" action.
2026-04-04 12:52:31 +02:00
Sylvestre Ledru c596ff7755 Playground: add support for I/O redirection (< > >>)
Parse < (stdin from file), > (stdout to file), and >> (append) in
the command line. Files are read from and written to the persistent
virtual filesystem, so redirected output persists across commands.
2026-04-04 12:43:52 +02:00
Sylvestre Ledru 99aadcf376 Playground: remove ".." JS workaround, now handled in ls 2026-04-04 12:43:52 +02:00
Sylvestre Ledru 17e38beade Playground: fix corrupted file sizes in ls output
browser_wasi_shim's Filestat.write_bytes() uses setUint8 for the
1-byte filetype field at offset 16, leaving bytes 17-23 unwritten.
Since Rust allocates the stat buffer with MaybeUninit, those padding
bytes contain stack garbage that corrupts the struct.

Fix by replacing write_bytes with a version that writes filetype as
a full 8-byte BigUint64 (zero-extended), clearing the padding.
Also add a test asserting file sizes are reasonable.
2026-04-04 11:55:54 +02:00
Sylvestre Ledru 0c49cf76fd Add tests for ls -al WASI fixes (timestamps, parent dir) 2026-04-04 11:43:46 +02:00
Sylvestre Ledru a800abdb28 Playground: fix ls -al timestamps and parent dir access
Patch browser_wasi_shim File/Directory stat() to return current
timestamps instead of epoch 0 (which showed Jan 1 1970).

Patch path_filestat_get and path_open to resolve ".." at the
preopened root to "." instead of failing with NOTCAPABLE, matching
real filesystem behavior.
2026-04-04 11:43:42 +02:00
Sylvestre Ledru a3bbcc284d Playground: add tab completion for commands and filenames 2026-04-04 11:31:05 +02:00
Sylvestre Ledru 2cbd80d6fd Playground: support ?cmd= URL parameter to run commands on load 2026-04-04 11:20:21 +02:00
Sylvestre Ledru e6d078d6b2 Add French l10n test for arch --help in WASM playground 2026-04-04 11:11:32 +02:00
Sylvestre Ledru d66a1d720f Skip WASM sort tests when sort traps in the build
sort hits 'unreachable' in some WASM builds. Probe once and skip
sort-dependent tests rather than failing CI.
2026-04-03 22:24:50 +02:00
Sylvestre Ledru 83fac47ca8 Show WASM binary size in playground loading message 2026-04-03 22:18:11 +02:00
Sylvestre Ledru 965c898e51 Playground fixes: avoid double-fetch, CSP-safe event handling, hide from nav
- Clone WASM response before compileStreaming so fallback doesn't re-fetch
- Guard against concurrent ensureRuntime() calls with a promise cache
- Replace inline onclick with event delegation for CSP compatibility
- Add SRI note for WASI shim dynamic import
- Skip l10n tests that require French translations in WASM binary
- Replace uninteresting fmt example with printf sheep | nl
- Hide Playground link from top navigation for now
2026-04-03 22:13:57 +02:00
Sylvestre Ledru adc6d38c5a Add playground tests and CI integration
- Browser-based unit tests (111 tests) covering parsing, builtins,
  pipes, UTF-8, l10n, virtual filesystem, and WASM integration
- Headless Puppeteer test runner (scripts/run-tests.js)
- CI workflow step to build WASM and run tests
2026-04-03 21:47:38 +02:00
Sylvestre Ledru 5c22a5b3d6 Add interactive WASM playground for uutils coreutils
A browser-based terminal that runs real Rust coreutils compiled to
WebAssembly (wasm32-wasip1) using @bjorn3/browser_wasi_shim.

Features:
- xterm.js terminal with command history and line editing
- Pipe support (cmd1 | cmd2 | cmd3), file redirects (>)
- Persistent virtual filesystem across commands
- cd/pwd builtins with virtual working directory
- Locale support (locale builtin + selector)
- UTF-8/multibyte correct output (raw ConsoleStdout, fixed args_sizes_get)
- Click-to-run example buttons
- Inline wasm_example shortcode for blog posts
2026-04-03 21:47:38 +02:00
Sylvestre Ledru 32640fe10e Add focus-visible styles for keyboard navigation accessibility 2026-04-01 08:46:10 +02:00
Sylvestre Ledru ae5f7c7118 Fix header logo color in dark mode
Use CSS variable instead of hard-coded black so the logo text
is visible on dark backgrounds.
2026-04-01 08:45:25 +02:00
Sylvestre Ledru c0e7d2471e Add invisible bridge to dropdown menu for easier hovering 2026-04-01 08:32:34 +02:00
Sylvestre Ledru cec9008f2f Add Giallo syntax highlighting CSS files for Zola 0.22 2026-04-01 08:30:24 +02:00