Repository navigation
Conversation
…mapping Breaking contract change (cli-core#22, rfd#61 approved): - Command and subcommand handlers return Result<ExitStatus, CommandError>. CommandError::Usage exits 2, CommandError::Runtime exits 1; Ok(ExitStatus) carries the code. Registry::run(args) -> ExitCode parses, dispatches, prints every error in one format, and is the only place that maps to a process exit code — main becomes one line. - Flag/param keys canonicalize to the spec name during parsing (-v reads as --verbose). Context gains typed accessors: flag(), param::<T>(), param_or(), param_list(); bad values are usage errors in one format. - ParamSpec gains a kind: Value (last wins) or List (accumulates in order). - Handlers write through Context::out()/err(); Registry::run_captured(argv) returns (ExitCode, stdout, stderr) so command tests run in-process. - Module/crate docs say Deka, not Tana. Consumer tests and README updated for the new signatures.
This was referenced Oct 2, 2026
This branch was successfully deployed
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.
What changed
Implements the 0.6.0 contract from #22 (rfd#61, approved):
CommandSpec/SubcommandSpechandlers are nowfn(&Context) -> Result<ExitStatus, CommandError>.CommandError::Usageexits 2,CommandError::Runtimeexits 1 (GNU convention),Ok(ExitStatus)carries the code (ExitStatus::SUCCESSin almost all cases,ExitStatus::from_codefor commands whose contract promises a code).Registry::run(args) -> ExitCodeparses, dispatches, prints every error in one format, and is the only place that maps to a process exit code —mainbecomesfn main() -> ExitCode { registry.run(std::env::args()) }. Consumers with special no-argument behavior (help with exit 0) check for an empty argv before callingrun. The underlyingdispatch()now propagates the handler'sHandlerResult.Context::flag(),Context::param::<T>(),Context::param_or(),Context::param_list(); a bad value is a usage error in one format (invalid value for--port: …).ParamSpecgainskind:ParamKind::Value(last wins) /ParamKind::List(--tag a --tag baccumulates in order). Flag and param keys canonicalize to the spec name during parsing (-vreads as--verbose).Context::out()/Context::err();Registry::run_captured(argv)returns(ExitCode, stdout, stderr)without spawning a process.Version bumped to 0.6.0; after merge this needs a
v0.6.0tag (release.yml publishes and verifies — tagging is Sami's).Evidence
cargo test --all-features→ 10 suites, 0 failures (47 lib tests including 6 new contract tests: exit-code mapping, captured output, parse-error format with suggestions, typed-param validation, list accumulation, canonical flag access)cargo clippy --all-features --all-targets→ 0 warningsrun_maps_handler_results_to_exit_codes_in_one_place(left: ExitCode(1), right: ExitCode(2))registry_bridge,context_env,context_bridge,context_extensions) migrated to the new signatures and pass; alias canonicalization is asserted inregistry_bridgehealth probe exceeded 2s, token temp-name race — the latter already filed as token_file: concurrent write_token races on temp name (flaky test on main) #24) flake intermittently on this loaded machine, on main as well; the full suite passed clean on the final runcloses #22
-kimi