Expand description
--suggest: generate the minimal custom-command TOML that would let safe-chains recognize a
command it currently denies because the command NAME is unknown.
OPT-IN only. Nothing here is ever referenced by the deny/hook output — a user reaches it solely by
running safe-chains --suggest "<cmd>". It rides the existing trust rails (registry::custom):
the generated [[command]] block goes in a project .safe-chains.toml, which is inert until the
user hand-pins its SHA-256 in the write-protected ~/.config/safe-chains.toml. This module never
touches ~/, so it cannot self-approve.
Scope (v1): the “I don’t recognize this tool” case. For each simple command whose name safe-chains
doesn’t know, emit a [[command]] scoped to exactly the observed flags and positional count.
Commands safe-chains DOES recognize are never overridden — a recognized command that is denied is
a deliberate classification (a flag, subcommand, or path), not an unknown, so --suggest reports
that rather than generating a bypass.
Structs§
- Generated
Entry - A scoped custom-command entry for one unknown command name.
Enums§
- Outcome
- What
analyzeconcluded about a command.
Functions§
- analyze
- Analyze
commandand decide what, if anything,--suggestcan generate. Pure — no I/O. - config_
hash - SHA-256 of
bytesas lowercase hex — the exact hashregistry::custom::repo_is_trustedcomputes over a.safe-chains.toml, so the printed pin matches what the trust check will require. - merged_
content - The new
.safe-chains.tomlcontent: the existing file (empty if none) with the generated blocks appended, separated by a blank line. - pin_
block - The
[[trusted]]pin the user pastes into~/.config/safe-chains.tomlto approve the file. - render_
toml - Render the generated entries as
[[command]]TOML blocks. Minimal and always valid — this is exactly the text written to.safe-chains.tomland fed to the SHA-256 pin, so it must be stable.