moji README

The project's README from github.com/Microck/moji. As one markdown file: README.md.

moji

moji

npm version badge npm total downloads badge ci badge MIT license badge

https://github.com/user-attachments/assets/33fafa72-7974-4fb1-b107-98bfef03194a


ask for a font and get the file you actually meant. moji searches across font sources, ranks candidates by family and filename, and downloads the best match. browse interactively with Bubble Tea, pipe a stable table into shell workflows, or request JSON for programmatic use.

quick start

install with the package manager you already use:

npm install -g @microck/moji
pnpm add -g @microck/moji
bun add -g @microck/moji

or install the same released native binary from this repository's Homebrew formula:

brew tap microck/moji https://github.com/Microck/moji
brew install microck/moji/moji

The explicit tap URL is required because this source repository is not named homebrew-moji. Upgrade later with brew upgrade microck/moji/moji.

search for a family:

moji
# or jump straight to results
moji "Futura"

bare moji opens the home TUI so you can type a query. pass a query to jump straight to the live result list. redirect or pipe a queried command to get a stable table instead.

moji "Futura" --format otf,ttf
moji "Futura" --format woff2 --json

download the best match, preview the choice first, or ask for the whole family:

moji get "Futura bold" --dry-run
moji get "Futura bold"
moji get "Futura entire family" --download-dir ~/Downloads/moji

convert a local desktop font to WOFF2, or restore a WOFF2 font to the TTF or OTF flavor stored inside it:

moji convert Inter.ttf
moji convert Inter.woff2
moji convert Inter.otf --to woff2 --output build/Inter.woff2

conversion detects the input from its content and never replaces an existing output file. it changes the font container without changing TrueType or CFF glyph outlines.

inspect a downloaded TTF, OTF, or WOFF2 font before using it:

moji inspect Inter.ttf
moji inspect Inter.woff2 --json

inspection reads the font's character map and reports exact Unicode script coverage counts. This answers whether a font includes Cyrillic, Arabic, Han, or another script without relying on its filename.

providers

the default GetFonts, DaFont, Fontshare, and registry providers work without an account. DaFont search results are parsed from its public catalog and direct ZIP downloads pass through Moji's normal archive safety limits. Font Squirrel is available through --provider fontsquirrel, but is off by default because its site protection can block API clients. All catalog providers inspect source download archives for the formats you requested. GitHub's repository, tree, and release search also uses its small unauthenticated allowance. Moji automatically uses an existing authenticated gh session when GitHub CLI is installed. GITHUB_TOKEN and github_token take precedence and also enable Code Search and higher limits. the TUI points this out when GitHub search is limited.

the websearch provider automatically uses kagi-cli when it is installed. Run kagi auth once. Ordinary web pages are ignored. direct CSS font URLs and bounded ZIP or TAR archive members can become results. configured source plugins pass through the same HTTPS, format, and download validation boundary. Direct binary responses with missing or misleading extensions can also be recognized as ZIP, TAR, or compressed TAR archives by signature; webpages and interactive download flows remain excluded.

export GITHUB_TOKEN=github_pat_example
moji "Futura" --provider github

do not pass tokens as command-line flags. use --token-stdin when a token only needs to exist for one invocation.

the same websearch provider also uses SearXNG when an instance URL is configured.

commands

command purpose
moji open the home TUI and type a font query
moji <query> search interactively or print a table when piped
moji get <query> rank results and download the best match
moji convert <input> convert TTF/OTF to WOFF2 or restore WOFF2
moji inspect <input> report Unicode script coverage for a local font
moji config create the default config when needed and open $EDITOR
moji config show print the current config with its token redacted
moji cache clear remove cached provider results

run moji --help for the complete flag and example reference.

download safety

downloads use HTTPS by default and stop at 50 MiB. before the final file appears, moji validates its font magic bytes, sanitizes its filename, writes to a temporary path, and renames it atomically. SHA-256 hashes prevent duplicate files from being saved twice.

If the first ranked link returns invalid font bytes, moji get remembers that URL and tries the next candidate. Whole-family downloads validate one coherent same-source group in staging, so a broken member cannot leave a partial family or mix sources.

search results include source and best-effort license metadata. an unknown license is not permission to use or redistribute a font. check the font's license before shipping it.

configuration

the default config lives at ~/.moji/config.yaml and is written with mode 0600. set MOJI_CONFIG to use a different file.

download_dir: ~/Downloads/moji
search_timeout_seconds: 15
cache_ttl_seconds: 3600
default_formats: [otf, ttf, woff2, dfont, pfb, pfm]
source_plugins: []

providers:
  github:
    enabled: true
  getfonts:
    enabled: true
  dafont:
    enabled: true
  fontsquirrel:
    enabled: false
  fontshare:
    enabled: true
  registry:
    enabled: true
  websearch:
    enabled: true
    instance: ""

documentation

the Fumadocs site covers the complete workflow:

the original product and architecture research remains in research/cli-design.md.

development

verify the Go CLI and production documentation build together:

npm install
npm run verify

run the parts independently when working on one side of the repository:

make verify
npm run docs:check
npm run docs:build
npm run docs:dev

Before a release, npm run release rebuilds and verifies the exact npm archive without publishing it. The operator-only npm run release:publish runs the same gate before npm publication, the annotated tag, and the GitHub release. See the release runbook.

the end-to-end suite builds the real binary, searches a controlled HTTP provider, downloads a valid fixture font, checks the file on disk, and exercises cache clearing. conversion tests use FontTools fixtures, and CI runs a pinned FontTools interoperability check in both directions.

license

MIT

moji (Microck/moji)

Searching Database…

257 ·GitHub
这是什么?Moji 是一个终端工具,可搜索多个字体来源(GetFonts、DaFont、Fontshare、GitHub 等),对结果排序,并下载与你的查询最匹配的字体文件。
它只是普通的 CLI,还是有自己的界面?两者都是:不带参数运行 “moji” 会打开交互式 Bubble Tea TUI,而以管道传入查询则会打印稳定的表格或 JSON,便于脚本处理。
怎么安装并开始搜索?通过你常用的包管理器安装,或用本仓库带显式 tap 的 Homebrew formula 安装,例如 “brew install microck/moji/moji”,因为该仓库不叫 homebrew-moji。之后运行 “moji” 打开 TUI,或运行 “moji ” 直接搜索。
只是搜索的话需要账号或令牌吗?不需要——默认的 GetFonts、DaFont、Fontshare 和 registry 提供源无需账号即可使用。GitHub 搜索和 websearch 提供源(通过 kagi-cli 或 SearXNG)是可选的额外功能,各自需要相应的授权。
有哪些提供源或下载需要留意?Font Squirrel 默认禁用,因为它的网站防护可能拦截 API 客户端;下载上限为 50 MiB,保留前会做字体 magic byte 校验;许可证元数据只是尽力提供,所以在再分发字体前你应自行核实其许可证。
它在 Linux、macOS 和 Windows 上表现一致吗?一致——moji 以原生二进制形式通过 npm 和 Homebrew 分发,同一工具无需额外设置即可在 Linux、macOS 和 Windows 上运行。
moji 能在格式之间转换字体吗?可以,“moji convert” 能把 TTF/OTF 转成 WOFF2,也能把 WOFF2 还原成其内部存储的 TTF 或 OTF 轮廓,且不改变字形轮廓。
“moji inspect” 能告诉我字体的什么信息?它会读取字体的字符映射并报告精确的 Unicode 文种覆盖情况,让你不必根据文件名猜测,就能确认字体是否支持西里尔文、阿拉伯文或汉字等文种。
moji 如何避免保存重复的字体文件?它会计算下载文件的 SHA-256 哈希,因此同一字体不会被保存两次,即使是在不同的搜索之间。
如果排名第一的搜索结果是坏文件怎么办?moji 会在下载后校验字体的 magic bytes;如果排名第一的链接返回无效的字体字节,它会记住该 URL 并自动尝试下一个候选。
What are similar projects?veet, cliamp, fx, ripgrep, yoinks, gh-dash, tuios, sampler
Creator
Microck
Size
7.7 MB
Stars
257
Age
3mo
Commits · 90 Days