@paulmillr: Releasing bismar: a source code browser for terminal. Open any package from npm / jsr / crates / pypi / gems / packagis…
摘要
bismar is a new terminal-based source code browser that lets you open, browse, diff, and bundle packages from npm, jsr, crates.io, PyPI, gems, Packagist, GitHub, and more, with a focus on security and machine-friendly output.
查看缓存全文
缓存时间: 2026/08/14 09:36
Releasing bismar: a source code browser for terminal.
Open any package from npm / jsr / crates / pypi / gems / packagist / github - browse its files with syntax highlighting.
npm install -g bismar (or npx bismar) bismar crate:serde bismar gh:@paulmillr
https://t.co/6enqn36FYS https://t.co/iws12KV0Kb
paulmillr/bismar
Source: https://github.com/paulmillr/bismar
bismar
Browse, weigh, and diff packages from any registry
A bismar is the old Viking hand scale for weighing goods. This one works with npm, jsr, crates.io, rubygems, pypi, packagist, github, gitlab, and the go proxy; allowing to:
- Browse code in interactive keyboard-friendly navigator
- Compare diffs between different versions
- Download files
- Easily use tool output in machine-friendly non-TTY env
For JS, bismar can also bundle and minify specific exports, with tree shaking.
Used by noble cryptography to ensure bundles stay small.
Usage
npm install bismar— or, without installing,npx bismar js:preact -bsfrom any directory
usage:
bismar [<selector>] [--bundle] [--minify] [--size] [--list]
bismar [-bms] [<selector>]
bismar --diff <a> <b>
flags:
<no flag> open interactive navigator
-b, --bundle emit a single-file bundle (JS) / archive (non-JS)
-m, --minify (JS only) emit the minified bundle
-s, --size list shipped file size stats
-bs (JS) bundle sizes
-bsm (JS) bundle sizes, minified+gzipped
-d, --diff interactive comparison between 2 selectors
-ds non-interactive size stats for all files
-dbs (JS) diff of bundle sizes
-dbsm (JS) diff of bundle sizes, minified+gzipped
-l, --list list all public exports
--clear clean-up bismar cache
Examples
bismar js:@noble/hashes # vim-like pager
bismar rs:serde
bismar gem:sinatra/README.md
bismar gh:@paulmillr # user repos
bismar gem:sinatra/lib/sinatra.rb > s.rb
bismar -l npm:micro-ftch
bismar -b js:qr > qr.js
bismar -b rs:serde > serde.cargo
bismar -bm js:qr > qr.min.js
bismar -s js:chokidar
bismar -bs npm:micro-ftch
bismar -bsm npm:micro-ftch
bismar -d js:[email protected] js:[email protected]
bismar -ds npm:readdirp@{4,5}
bismar -dbs npm:readdirp@{4,5}
bismar -dbsm npm:readdirp@{4,5}
# hint: non-terminal (non-TTY) emits DIFFERENT, machine-friendly output
bismar -d npm:micro-ftch@{1.0,1.1} | head
bismar -bsm npm:react | sort -t, -k4 -rn
Selectors & namespaces
selectors (package / ref / dir / archive):
npm:qr, npm:[email protected], gem:sinatra, ../sinatra, ./qr.tar.bz2
namespaces ("short: long"; both versions work):
js: npm py: pypi
jsr: jsr php: packagist
rs: crate gh: github
rb: gem go: go proxy
gitlab: gitlab
Security
flowchart LR
B[bismar] --> W["micro-ftch: host allowlist, per redirect hop, GET/HEAD only, rate-limited, BISMAR_LOG"]
W -->|allowed hosts, table below| R[registries]
W x--x|refused before send| X[any other host]
B --> N["npm subprocess (npm/jsr) --ignore-scripts --prefer-offline"]
N -->|npm's own traffic, honors npm config| NR[npm registry]
R --> C["$TMPDIR/bismar-* caches; removed on reboot or --clear"]
NR --> C
- GET+HEAD only traffic: no POSTs;
--no-auditremoves npm’s one routine POST too. - Host allowlist, enforced pre-send: only the origins below are reachable. Same with download URLs, except packagist (github zipballs) and pypi (pythonhosted).
- No code execution: npm runs
--ignore-scripts; bundling and measuring are static esbuild work; non-JS packages are never executed or bundled. - Inert terminal output: registry text, paths, source, diffs, errors, and CSV have controls neutralized; only bismar’s own color sequences survive.
- Bounded, link-free archives: metadata and downloads have streaming hard limits; extraction rejects traversal, links, special files, unsafe Windows names, and expansion/member/path bombs before trusting the resulting tree.
- Confined packages, verified caches: downloaded manifest paths, generated entries, and imports stay inside their install root. Private atomic caches use SHA-256 identities/digests; git pins retain full GitHub SHA-1 and GitLab SHA-1/SHA-256 commit IDs.
- Big downloads ask first: 100mb+ needs a terminal confirmation; plain refusal
in scripts and CI (use
BISMAR_BIG=1) - Disposable caches: everything lives under
$TMPDIR/bismar-*, OS-cleaned after reboot;bismar --clearwipes it now. Pinned versions cache until reboot, floating “latest” for 15 minutes. - Knobs:
BISMAR_LOG=file.txtlogs every request, one line each;BISMAR_RPStunes the polite request budget (0disables); overriding aBISMAR_*base admits that origin in place of the default.
| host | used for |
|---|---|
| registry.npmjs.org | npm search, profiles, packed-size garnish |
| npm.jsr.io | jsr metadata + tarballs (jsr’s npm-compat registry) |
| api.jsr.io | jsr search, scope profiles |
| crates.io (→ static.crates.io) | crate metadata, downloads, search, profiles |
| rubygems.org | gem metadata, downloads, search, owner profiles |
| pypi.org | pypi metadata |
| files.pythonhosted.org | pypi artifact downloads |
| repo.packagist.org | composer p2 metadata |
| packagist.org | composer vendor profiles |
| api.github.com | gh api, search, profiles; composer dist zipballs |
| codeload.github.com | gh archive downloads; composer dist zipballs |
| gitlab.com | gitlab api, search, profiles, archives |
| proxy.golang.org | go module metadata + zips |
Three deps are used: esbuild and micro-ftch are pinned, and the syntax highlighter is vendored and bundled with the package, so none can update underneath a release.
License
MIT License (c) 2026 Paul Miller (https://paulmillr.com)
相似文章
tw93/Pake
Pake 是一个命令行工具,使用Rust和Tauri将任意网页转换为原生桌面应用,提供轻量级(约5MB)的macOS、Windows和Linux版本。
人人都该从 npmx 偷学的功能
npmx 是一个 MIT 授权的 npm 仓库替代前端,它在安全与可用性上做了增强:展示传递式安装体积、暴露安装脚本、可视化过期/含漏洞依赖树,还逼得 npmjs.com 终于上线了深色模式。
@y_hatt: 发布候选版本:Marp Core v5 ➤ Mermaid 图表 ➤ 新语法高亮:Shiki ➤ 默认轻量级核心 ➤ 数学…
Marp Core v5 发布候选版本已推出,包含 Mermaid 图表、Shiki 语法高亮、默认轻量级核心、MathJax v4 以及懒加载可选依赖。
@MingruiZhang: 对@browser_use 的新Terminal Agent有一个问题,我的上下文窗口用了122% https://github.com/browser-use/term…
Browser Use Terminal 是一个用于浏览器代理的 Rust TUI,允许用户从终端自动化浏览器任务,它配备了一个新的LLM harness,比Browser Harness便宜2倍且快2倍。
一个完全本地、自托管的代码仓库索引,适用于编码智能体(Rust,MIT 协议,离线运行)
Basemind 是一个开源工具,可在本地索引仓库,并通过 MCP 协议向编码智能体提供上下文,包括代码地图、Git 历史记录和文档 RAG,无需依赖云端。