You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Magic Box parses user input into two parts: input and options.
For example, when Magic Box receives the following user input:
The input will be https://youtu.be/dQw4w9WgXcQ and the option key is shorten with the value document.
https://youtu.be/dQw4w9WgXcQ
::shorten=document
Based on matching methods, we can roughly classify Boxes into two types:
match by the input string
match by options
Keyboard Shortcuts β¨οΈ
Ctrl + n: move to the next Box
Ctrl + Shift + n: move to the previous Box
Ctrl + p: move to the previous Box
Enter: copy the selected Box output to clipboard
Cmd/Ctrl + Enter: copy the selected Box output and paste it into the input field (recalculates results)
ColorBox
match rule
description
example
hex color (#RGB, #RRGGBB, #RRGGBBAA)
convert to HEX, RGB, and HSL
#ff6347
rgb() / rgba()
convert to HEX, RGB, and HSL (alpha preserved)
rgb(255, 99, 71)
hsl() / hsla()
convert to HEX, RGB, and HSL (alpha preserved)
hsl(9, 100%, 64%)
Base64Box
match rule
description
output
valid string
base64 encode
can be decode to valid string
base64 decode
CronExpressionBox
match rule
description
output
valid cron expression
convert to human language
options
description
example
l, lang, locate
select while human language
::locale=tw
tz, timezone, tzOffset
(deprecated) shift to the base timezone
::tz=8
DataConverter
match rule
description
output
valid JSON/YAML/TOML/XML
formatted output for the detected format
option json or tojson
convert input to formatted JSON
formatted JSON
option yaml or toyaml
convert input to formatted YAML
formatted YAML
option toml or totoml
convert input to formatted TOML
formatted TOML
option xml or toxml
convert input to formatted XML
formatted XML
DateCalculateBox
match rule
description
example
output
date1 + numberd
add days to a date
now + 7d
date1 - numberd
subtract days from a date
2025-01-01 - 30d
date1 to date2
calculate the duration between two dates
today to 2025-12-31
GenerateQRCodeBox
match rule
description
output
contains option qr or qrcode
generate QR Code
options
description
example
qr, qrcode
--
::QRCode
HashBox
match rule
description
output
contains option hash, sha1, sha256, or sha512
compute cryptographic hash of the input
lowercase hex digest
options
description
example
hash
compute SHA-1, SHA-256, and SHA-512
::hash
sha1
compute SHA-1 digest
::sha1
sha256
compute SHA-256 digest
::sha256
sha512
compute SHA-512 digest
::sha512
MD5 is intentionally omitted β it is not available in Web Crypto, and adding an npm dependency for a broken algorithm is not worthwhile.
JWTBox
match rule
description
output
valid JWT string
decode JWT header and body
K8sSecretBox
match rule
description
output
valid K8s Secret YAML/JSON
decode base64 values in a K8s Secret data
MathExpressionBox
Powered by the in-tree math-box WASM module β
a clean-room expression evaluator written in Rust, replacing mathjs since
v0.2 to keep the bundle small and the licence pure MIT/Apache-2.0.
Magic Box ships an experimental terminal UI built with ink (React for the terminal). It runs a subset of boxes headlessly in Node β no browser, no WASM, no network.
Usage
# pass input as a CLI argument
bun run tui "uuid"# pipe input via stdinecho"1700000000"| bun run tui
# inline ::option directives work too (newline-separated)printf'uuid\n::uppercase'| bun run tui
# no argument and a TTY β interactive prompt (type and press Enter)
bun run tui
A magic-box-tui bin is also exposed via package.json's bin field.
How it works
The box-generation core (src/modules/Box.ts, BoxBuilder, BoxSource) is framework-agnostic: it no longer imports any React/MUI template. Each box carries name / plaintextOutput / tag / kind / options and leaves boxTemplate undefined; the web layer (BoxCard / BoxModal) falls back to DefaultBoxTemplate, while the TUI simply renders plaintextOutput. This lets the headless sources import cleanly under Node with zero MUI in the module graph (src/tui/).
Foundation limitations
This is a foundation, not full parity. The TUI runs only node-safe sources (src/tui/sources.ts):
Enabled
Excluded
Reason for exclusion
Escape String, Cron, Date Calculate, Now, Random Integer, Readable Bytes, Time Format, Timestamp, URL Decode, UUID
Base64 (encode/decode)
depends on the base64-box WASM module
Math Expression
depends on the math-box WASM module
Data Converter, JWT
render via CodeBoxTemplate (React/MUI)
Generate QR Code
renders via QRCodeBoxTemplate (React/MUI, browser canvas)
K8s Secret, Word Count
render via KeyValueBoxTemplate (React/MUI)
My IP, Shorten URL
perform network fetch
Excluded sources can be added later by giving them plaintext-only headless paths (e.g. WASM bindings loaded from disk, or rendering their plaintextOutput without the React template).
License π
Magic Box is licensed under MIT and Apache 2.0 dual-licensed.