Skip to content

ms-cli v0.1.0 — companion CLI for ms-codec

Choose a tag to compare

@bg002h bg002h released this 04 May 21:22

Companion CLI to ms-codec v0.1.0. Encode BIP-39 entropy as ms1 strings for steel-plate engraving; decode/inspect/verify engraved strings; dump the SHA-pinned test-vector corpus.

Install

cargo install ms-cli

The installed binary is ms.

What's new

  • 5 subcommands: encode / decode / inspect / verify / vectors.
  • Phrase-first encode (--phrase headline; --hex codec-thin escape hatch); structured --json output mode across every command.
  • Strip-whitespace stdin uniform across commands — handles pipe round-trip (ms encode | ms verify -), engraver-typed-back chunked form (printf "ms10e ntrsq…" | ms decode -), and copy-paste artifacts with one mechanism. Doubling-detection guard (SPEC §3.2 r7) handles the multi-line encode stdout cleanly.
  • BIP-39 wordlist enforcement: all 10 wordlists supported via --language (default english); non-suppressible stderr warning surfaces the SPEC §6.3 wordlist hazard at decode time.
  • Exit codes per SPEC §6: 0 (success) / 1 (user-input error) / 2 (format violation) / 3 (valid future v0.2+ format) / 4 (verify round-trip mismatch — distinct so scripts can detect engraving/transcription bugs) / 64 (clap usage error — overrides clap's default of 2 to keep ms1 format violations distinct).
  • Engraving-friendly stdout: encode emits <ms1>\n\n<chunked-form> (5-char groups, 10/line max, never mid-chunk) for hand-engraving proofreading.
  • verify --phrase round-trip check: the engraver's end-to-end integrity check. Phrases never echoed to stdout/stderr (secrets discipline).

Engraving caveat

ms1 v0.1 does NOT carry the BIP-39 wordlist language on the wire. Users with non-English wallets MUST record their wordlist language alongside the engraved card. A future v0.2+ payload kind mnem (reserved tag) is allocated to address this. See SPEC §6.3 for full discussion of the hazard.

Quickstart

# Encode a 12-word BIP-39 mnemonic.
ms encode --phrase "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"

# Recover from an engraved string.
ms decode ms10entrsqqqqqqqqqqqqqqqqqqqqqqqqqqqqcj9sxraq34v7f

# Verify an engraved string round-trips against the original phrase.
ms verify <ms1> --phrase "abandon abandon ... about"

# Inspect a candidate string for structural validity (verdict + fields + failure reasons).
ms inspect <ms1>

# Dump the SHA-pinned test-vector corpus.
ms vectors --pretty

Tests

77 tests across the surface: 29 unit + 48 integration (assert_cmd). cargo build / cargo clippy --all-targets -D warnings / cargo fmt --check all clean. Per-phase opus reviewer-loops persisted to design/agent-reports/.

Documentation

Family

ms-cli is one of three sibling format crates plus a future toolkit:

  • md-codec (repo) — wallet descriptors / templates (md1, HRP md).
  • mk-codec (repo) — xpubs (mk1, HRP mk).
  • ms-codec (release) — BIP-39 entropy library (ms1, HRP ms).
  • ms-cli (this release) — companion CLI for ms-codec.
  • mnemonic-toolkit (planned) — top-level integration: take a BIP-39 phrase, emit a complete ms1 + mk1 + md1 engravable bundle.