Repository navigation
0.8.2 (part B): help command, did-you-mean, completions, man page, 100-column help, one error channel - #29
Merged
Merged
Conversation
COMMANDS (main.rs) lists every command, subcommand and flag with its arity, summary, usage, sections and examples. --help renders from it (usage.rs) and check_flags enforces it (flags_of, sub_flags); the persona, live and monitor flag lists, USAGE, FLAG_HELP, PERSONA_HELP, LIVE_HELP and monitor's HELP are gone. Tests: names unique, synopses name exactly the parsed flags, the dispatcher is the table, every listed command/subcommand has help and every listed flag parses (tests/cli_table.rs).
The same text as COMMAND [SUBCOMMAND] --help, from the table; alone, the same as probbit --help (the hero screen at a terminal, the usage piped). Subcommands of persona and live now have their own --help (usage, flags, exit codes). Unknown names exit 2. Tests: tests/cli_help.rs.
probbit: unknown command "persna"; did you mean "persona"? see `probbit --help` Damerau-Levenshtein (OSA) distance <= 2 (<= 1 for words of 3 characters or fewer), or the one name the word is a prefix of; exit code stays 2 and stdout stays empty. Covers persona subcommands, live verify/control typos (when no such persona file exists) and probbit help. Tests: hit, miss, subcommand typo (tests/cli_suggest.rs) and the distance unit test.
A static script generated from the command table: commands, subcommands and flags (zsh and fish with each flag's help and what its value is). An unknown or missing shell exits 2 with the list. Tests: every script names every command, subcommand and flag the helps list; bash -n and zsh -n (fish -n where installed); the bash script completes real words (tests/cli_completions.rs).
… columns Top-level --help: the version line first, commands grouped (persona, live, monitor, decide/run, mcp, other) with one summary line each, the flags every command takes, the exit codes and six examples. Every help wraps at 100 columns without splitting an option group. monitor --help: usage, modes, flags, demo, exit. The terminal hero puts the rate and the machine on two lines and points at probbit help and completions. Every flag and sentence of meaning is kept. Tests: no help line over 100 columns, top-level order and examples, monitor sections and facts (tests/cli_layout.rs); the hero test checks 100 columns too.
stderr: one human line, always. stdout: a bad input document's {"error"}
object when stdout is not a terminal (every wrapper: python/, mcp.rs, npm,
examples, scripts read it piped, so their contract is byte-identical) or with
--json; at a terminal without --json the line only, never both. Bad commands
and flags stay off stdout unless --json (code "flag", or "command" with a
"suggestion"), keeping Python's empty-stdout flag contract. --json is
accepted by every command. Documented in docs/CHEATSHEET.md "Errors"; README,
agents.md and probbit-ir-json.md say when the object is printed. Tests: pipe,
pseudo-terminal, --json, usage errors (tests/cli_errors.rs); the Python (44),
npm (13) and node-example suites pass unchanged.
…by install.sh probbit man prints roff (man(7)) from the command table: NAME, SYNOPSIS, DESCRIPTION, COMMANDS (every command, subcommand and flag), EXIT STATUS, ENVIRONMENT, EXAMPLES, SEE ALSO; ASCII, non-ASCII as \[uXXXX]. docs/probbit.1 is its committed output. release.yml copies it next to the archives (it is inside them under docs/ too). install.sh installs it to ~/.local/share/man/man1 (PROBBIT_MAN_DIR overrides), never fatally. Tests: the committed page equals the generated one; every section, command and listed flag is in it; it renders under man -l or mandoc (tests/cli_man.rs); test_install_sh.sh checks the page lands, under a scratch HOME too, and that an unwritable man directory is not fatal.
….8.2 README Install: the manual page install and the completion one-liners; how help and did-you-mean work. CHEATSHEET: a help/completions/man table. CHANGELOG: 0.8.2 - unreleased, Added and Changed for part B.
# Conflicts: # CHANGELOG.md # probbit-cli/src/main.rs
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part B of 0.8.2: the CLI's help, discovery and error surface brought to the standard of large-vendor CLIs, with the parser kept hand-rolled (no clap, MSRV 1.78, zero external crates). No new dependencies of any kind.
What changes
COMMANDSinprobbit-cli/src/main.rs): every command, subcommand and flag with its arity, summary, usage, sections and examples. Every--help,probbit help, the completions and the man page render from it (usage.rs), andcheck_flagsreads its flag lists from it, so help, completions and man cannot drift from what the parser accepts.probbit help [COMMAND [SUBCOMMAND]]: identical text toCOMMAND [SUBCOMMAND] --help;probbit helpalone =probbit --help.personaandlivesubcommands now have their own help.probbit: unknown command "persna"; did you mean "persona"? see \probbit --help`(Damerau-Levenshtein ≤ 2, ≤ 1 for words of ≤ 3 characters, or a unique prefix). Subcommands too (persona lnt→lint,live verfy→verify`). Exit code stays 2.probbit completions bash|zsh|fish: static scripts from the table; unknown shell → exit 2 with the list.monitor --helpsplit into usage / modes / flags / demo; the terminal hero screen fits 100 columns. Every flag and sentence of meaning kept.docs/CHEATSHEET.md"Errors"): a human line on stderr always; a bad input's{"error"}object on stdout when stdout is not a terminal (unchanged for Python, MCP, npm, examples, scripts — all read it piped) or with--json; at a terminal without--jsononly the line, never both. Bad commands/flags stay off stdout unless--json(code: "flag", or"command"with"suggestion"), preserving Python's empty-stdout flag contract.--jsonis accepted by every command.probbit man+ committeddocs/probbit.1(test: equals the generated output).release.ymlattachesprobbit.1(one line);install.shinstalls it to~/.local/share/man/man1/(PROBBIT_MAN_DIRoverrides), never fatally.## 0.8.2 - unreleased, CONTRIBUTING (regeneratedocs/probbit.1after a help change or version bump).Before → after (0.8.1 → this branch)
probbit help personaprobbit persna init x.yamldid you mean "persona"?, exit 2probbit completions zshzsh -nclean)probbit manman -l docs/probbit.1rendersmonitor --help--jsonfor the object)Tests
New:
tests/cli_table.rs,cli_help.rs,cli_suggest.rs,cli_completions.rs,cli_layout.rs,cli_errors.rs(pipe, pseudo-terminal viascript,--json),cli_man.rs; unit tests for the table and the distance. Existing help assertions updated for the new top-level layout. Locally: the fullprobbit-clisuite (release), the Python suite (44),npm/test-wrapper.cjs(13),examples/node/decide.mjs,scripts/bench/test_install_sh.shandtest_install_contract.pypass;cargo +1.78.0 build --release --locked --workspaceis clean. zsh/fish syntax checks run where those shells exist (bash everywhere on Unix).Notes
cargo run -p probbit-cli -- man > docs/probbit.1(the test names the command).probbit --help/probbit helpstill show the hero screen (as in 0.8.1, testhero_screen_at_a_terminal); the grouped list is what they print piped (probbit --help | less, which the hero now says).