Remove cbk and mnemonic commands from sutil

sutil holds only the utilities wanted on every machine; it is not a
command-line front end for the packages in pkg/. cbk and bip39wordlist
remain libraries with no CLI surface. The README states the boundary.
This commit is contained in:
2026-10-31 10:16:10 -07:00
parent 9def7ba586
commit 5932cc12ee
6 changed files with 37 additions and 219 deletions
+1 -33
View File
@@ -8,7 +8,6 @@ import (
"sneak.berlin/go/x/internal/pwgen"
"sneak.berlin/go/x/internal/randstream"
"sneak.berlin/go/x/pkg/bip39wordlist"
)
// streamChunkSize is the write size used by `generate random`. Large
@@ -21,13 +20,12 @@ func newGenerateCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "generate",
Aliases: []string{"gen"},
Short: "Generate random bytes, passwords, and mnemonics",
Short: "Generate random bytes and passwords",
}
cmd.AddCommand(
newGenerateRandomCommand(),
newGeneratePasswordCommand(),
newGenerateMnemonicCommand(),
)
return cmd
@@ -107,36 +105,6 @@ no usable word list.`,
}
}
// newGenerateMnemonicCommand returns `sutil generate mnemonic`.
func newGenerateMnemonicCommand() *cobra.Command {
var wordCount int
cmd := &cobra.Command{
Use: "mnemonic",
Short: "Print a new random BIP39 mnemonic phrase",
Long: `Prints a new BIP39 mnemonic phrase generated from crypto/rand. The
default of 24 words encodes 256 bits of entropy; 12 words encodes 128.`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
mnemonic, err := bip39wordlist.GenerateMnemonic(wordCount)
if err != nil {
return err
}
_, err = fmt.Fprintln(cmd.OutOrStdout(), mnemonic)
return err
},
}
cmd.Flags().IntVarP(
&wordCount, "words", "w", bip39wordlist.MaxWordCount,
"number of words: 12, 15, 18, 21, or 24",
)
return cmd
}
// streamBytes copies limit bytes (or everything, when limit is zero) from
// src to dst in streamChunkSize chunks.
func streamBytes(dst io.Writer, src io.Reader, limit int64) error {