Document invocation reporting contracts
This commit is contained in:
@@ -10,7 +10,8 @@ this page inventories the implemented owners.
|
||||
|
||||
The root facade owns captured canonical command declarations, application-owned
|
||||
routing rules, binding conversion, invocation coordination, the per-App
|
||||
registries, standard help/version commands, and outcome/diagnostic delivery.
|
||||
registries, standard help/version commands, invocation reporting, and outcome
|
||||
finalization.
|
||||
Its dependency graph has no ConfigKit or PromptKit integration dependency.
|
||||
Applications provide typed callbacks and install routing rules alongside the
|
||||
complete canonical command tree through the same batch API.
|
||||
@@ -25,6 +26,30 @@ successful registration invalidates the snapshot for a later invocation. The
|
||||
root package owns app input and callback execution, not provider configuration
|
||||
semantics.
|
||||
|
||||
Each execution creates one reporter backed by the caller's result and diagnostic
|
||||
writers. The Cobra adapter returns parsed values, flag spellings, and reporting
|
||||
flag occurrences. Core reduces those occurrences in entered order after route
|
||||
resolution, applies the final mode and progress selection, and presents any
|
||||
collected parser events through that selection. The selected mode therefore
|
||||
applies to command execution, help, and version; routing and parsing failures
|
||||
remain visible in every mode.
|
||||
|
||||
The reporter owns invocation-scoped visibility, message formatting, managed
|
||||
report rendering, delivery observations, and finalization. It presents queued
|
||||
messages after the handler returns, then a failed outcome's explanation, and
|
||||
closes its handles before `Execute` returns. It records rendering and write
|
||||
errors separately for result and diagnostic destinations; the returned
|
||||
`Outcome.Presentation` exposes those observations independently from the
|
||||
operation cause. The reporter does not retain a transcript and does not close
|
||||
or flush caller-owned writers.
|
||||
|
||||
Internally, one reporting-state mutex guards visibility, queued messages,
|
||||
destination state, and delivery errors while serializing reporter operations
|
||||
and writes. Rendering callbacks execute within that coordination boundary, so
|
||||
they must not recursively submit or render through the same reporter. This is
|
||||
an implementation detail supporting the callback contract; the mutex does not
|
||||
coordinate writes made outside the reporter.
|
||||
|
||||
## `internal/alias` and `internal/commandpath`
|
||||
|
||||
`internal/commandpath` provides shared path parsing and token operations used by
|
||||
|
||||
Reference in New Issue
Block a user