bashkit

markkit and fetchkit#

Bashkit can ship two document tools as builtins, with the same command line as their standalone binaries:

  • markkit converts HTML, PDF, DOCX, PPTX, XLSX/XLS/ODS, ODT, EPUB, email, notebooks and more to Markdown.
  • fetchkit fetches a URL and returns LLM-ready Markdown with YAML frontmatter (or JSON), with site-aware fetchers and bounded crawling.

Both are off by default. Enable the Cargo features:

bashkit = { version = "0.20.2", features = ["markkit", "fetchkit"] }
markkit extract report.pdf --file
markkit extract https://example.com/post --main-content
cat page.html | markkit extract - --json

fetchkit fetch https://docs.rs/tokio --content-focus agent
fetchkit fetch https://example.com -o json | jq .status_code

markkit --help and fetchkit --help print exactly what the standalone tools print: bashkit calls the same library code, so flags never drift.

Sandbox behavior#

  • Files come from the virtual filesystem (paths relative to the shell’s working directory). The host filesystem is never read.
  • Network goes through the same default-deny allowlist as curl (Networking). Every redirect hop is checked again. Credential injection, request signing and a custom HttpTransport apply. Without a NetworkAllowlist, URLs fail with network access not configured.
  • Limits: markkit’s --max-* and --timeout flags can lower its limits but not raise them. Response bodies are capped by bashkit’s HTTP limits.
  • Environment: fetchkit reads variables from the shell, never from the host process.
use bashkit::{Bash, NetworkAllowlist};

let mut bash = Bash::builder()
    .network(NetworkAllowlist::new().allow("https://docs.rs"))
    .build();
let out = bash.exec("fetchkit fetch https://docs.rs/tokio").await?;
assert_eq!(out.exit_code, 0);

A runnable, self-checking example lives in examples/markkit_fetchkit.rs. It serves pages from an in-process HttpTransport, so it needs no network. Set LIVE_URL to also fetch a real page:

cargo run --example markkit_fetchkit --features markkit,fetchkit
LIVE_URL=https://example.com cargo run --example markkit_fetchkit --features markkit,fetchkit

Specialized fetchers follow the same rule. For example, fetchkit’s arXiv fetcher calls export.arxiv.org, so allow that origin too or the fetch fails with URL not in allowlist.

Not available in the sandbox#

These flags are accepted by the parser and listed in --help, then fail with exit code 1 and Error: <flag> is not available in bashkit:

CommandFlagReason
bothmcplong-running stdio server
markkit--ocrneeds a host Tesseract binary or model files
fetchkit--allow-env-proxyhost proxy settings
fetchkit--render-rakersembedded JavaScript renderer
fetchkit--bot-auth-key, --bot-auth-agentbashkit already signs requests (Request signing)
fetchkit--allow-remote-conversionuploads documents to a third party

Both builtins are native only; the browser (wasm) package does not include them.

See also#