feat: populate ExampleDoc.output for robot examples endpoint (F3.3) #30
Notifications
Due Date
No due date set.
Depends on
Reference: terraphim/agent-tasks#30
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Statement
Spec F3.3 (terraphim-agent-session-search-spec.md, lines 270-274) defines the
robot examples [command]endpoint as "runnable examples with expected outputs." The data structure already supports this:However, all 22
ExampleDoc { .. }instances incrates/terraphim_agent/src/robot/docs.rsomit theoutputfield. Verification:The user-facing failure mode: an LLM running
terraphim-agent robot examples search --format jsonsees onlydescriptionandcommandfields. It cannot learn the expected response shape without separately invoking the example -- defeating the purpose of self-documentation.Acceptance Criteria
ExampleDocfor the user-facing commands (search,sessions,config,role,graph,vm,autocomplete,extract,find,replace,chat,summarize,robot) populatesoutput: Some(<representative JSON>).success,meta,data,errors) where applicable, and reflect the canonical robot-mode response shape from F1.1 lines 64-93.crates/terraphim_agent/src/robot/docs.rs::tests::test_examples_have_outputasserts that for every command, everyExampleDochasoutput.is_some().cargo test -p terraphim_agent --lib robot::docspasses.cargo clippy -p terraphim_agent -- -D warningspasses.Proposed Approach
build_command_docs()(crates/terraphim_agent/src/robot/docs.rs), for eachExampleDoc { description, command, output: None }construct a representative JSON string matching the spec envelope. Recommended: extract a small helperfn ex(desc: &str, cmd: &str, output: &str) -> ExampleDocto reduce verbosity.RobotResponse<T>types inrobot/schema.rsso the example shape stays in sync with the actual code path.mod testsblock:Affected crates:
terraphim_agentonly.Key types modified:
ExampleDocinstances insideSelfDocumentation::build_command_docs()(no struct changes).Dependencies
None. Pure additive change; touches a single file.
Verification
Scope
Single-file change in
crates/terraphim_agent/src/robot/docs.rs. Estimated 200-280 lines added (22 outputs averaging 8-10 lines each + helper + test). Implementable in one PR.