Expand description
The protocol client: the instrument that speaks the socket from the other side of it.
It is what curl cannot be for a socket. It connects to a running forge,
sends a script of messages as a client would, and prints everything the
server says back as one line of JSON each - so a person debugging a client
has both halves of the conversation in front of them rather than a guess
about which end is wrong.
forge-protocol-client --url ws://127.0.0.1:8790/socket --script ./walk.txtA script is the protocol in miniature rather than a vocabulary of its own: a verb and its arguments, and raw JSON where a message carries a payload.
# a comment
subscribe home
subscribe session Busytools/forge/lead
more Busytools/forge/lead 10
commit_diff Busytools/forge/lead 4f6870839
file_content Busytools/forge/lead crates/forge-server/src/lib.rs
file_content Busytools/forge/lead crates/forge-server/src/lib.rs 4f6870839
command {"prompt": {"key": {"org": "Busytools", "project": "forge", "label": "lead"}, "text": "hello", "attachments": []}}
ask {"submit_review": {"project": "forge", "branch": "main", "summary": null, "thread_ids": [], "origin": {"org": "Busytools", "project": "forge", "label": "lead"}}}ask is command with a reply asked for, so the awaited Reply path is
exercised rather than only the fire-and-forget one.
Re-exportsยง
pub(crate) use std::path::PathBuf;๐pub(crate) use std::time::Duration;๐pub(crate) use clap::Parser;๐pub(crate) use forge_primitives::SessionSlot;๐pub(crate) use forge_server::Command;๐pub(crate) use ClientMessage;๐pub(crate) use Subject;๐pub(crate) use SinkExt;๐pub(crate) use StreamExt;๐pub(crate) use tokio_tungstenite::tungstenite::Message;๐
Structsยง
- Args ๐
Functionsยง
- main ๐
- next_
within ๐ - The socketโs next message, or
Noneonce it stops arriving. - parse_
line ๐ - One script line as a message to send.
- subject ๐
home,board,usage,dictate_models,extensions, orsession <org>/<project>/<label>.