feat: add scoped reference formatters for the TUI
Follow Text View reference notation with component quoting and complete JSON/control/bidi safety escapes. Keep protocol reference pairs and operation names separate from display labels; screen integration remains T-23. Validated: cargo fmt --all --check; cargo check -p wip-tui --all-targets; cargo test -p wip-tui -p wip-protocol -p wip-client (99 tests incl. doctests); nix develop --command cargo clippy -p wip-tui --all-targets -- -D warnings; RUSTDOCFLAGS=-Dwarnings cargo doc -p wip-tui --no-deps; git diff --check.
This commit is contained in:
@@ -64,6 +64,38 @@ enter `contents` as RFC 4648 base64—for example, `dXBkYXRlZA==` for
|
||||
`updated`—then review the target Entry, interface reference, operation, and value
|
||||
on the confirmation screen before pressing Enter again.
|
||||
|
||||
## Scoped reference formatting
|
||||
|
||||
`wip_tui::reference::{format_interface_reference, format_qualified_operation}`
|
||||
provides labels for the existing UI from `InterfaceReference` and a separate
|
||||
operation name, following `4.2-text-view.md` reference notation (`6086f3c`).
|
||||
|
||||
```rust
|
||||
use wip_protocol::InterfaceReference;
|
||||
use wip_tui::reference::{format_interface_reference, format_qualified_operation};
|
||||
|
||||
let reference = InterfaceReference { scope: "/github".into(), name: "issue#read".into() };
|
||||
assert_eq!(format_interface_reference(&reference)?, "/github::\"issue#read\"");
|
||||
assert_eq!(format_qualified_operation(&reference, "read#raw")?,
|
||||
"/github::\"issue#read\"#\"read#raw\"");
|
||||
# Ok::<(), wip_protocol::ValidationError>(())
|
||||
```
|
||||
|
||||
Both return `Result<String, ValidationError>` and reject invalid reference shape,
|
||||
including relative/omitted scope. Root is explicit `/`. Non-simple components use
|
||||
JSON string quoting with additional DEL/C1, Unicode line/paragraph separator and
|
||||
bidi-control escapes. Input values are borrowed and never normalized, case-folded,
|
||||
URL-encoded or split on delimiters. Ref, validators and `scope_ref` do not enter
|
||||
these labels. The output has no extra outer signature string quoting.
|
||||
|
||||
Keep selection, cache and calls keyed by structured references and operation
|
||||
names, never display text. No parser, scope inference, identity reconstruction,
|
||||
Object/Interface signature renderer or new crate is introduced. Membership,
|
||||
ancestry, authorization and freshness remain runtime concerns. Screen integration
|
||||
is follow-up T-23; the current bounded screen/value/diagnostic rendering is
|
||||
unchanged. At integration, apply existing UI layout bounds to display labels
|
||||
without feeding shortened labels back into identity or calls.
|
||||
|
||||
## Keyboard bindings
|
||||
|
||||
All required actions are keyboard-accessible.
|
||||
|
||||
Reference in New Issue
Block a user