schwab_cli/commands/
meta.rs1use anyhow::Result;
2
3use crate::capabilities;
4use crate::cli::EnvCommands;
5use crate::config::RuntimeConfig;
6use crate::env_schema;
7use crate::instructions;
8use crate::output::ResponseEnvelope;
9
10pub async fn capabilities(runtime: &RuntimeConfig) -> Result<()> {
11 let envelope = ResponseEnvelope::ok("capabilities", capabilities::capabilities_json())
12 .with_inputs(serde_json::json!({ "source": "schwab-cli" }));
13 runtime.emit(envelope);
14 Ok(())
15}
16
17pub async fn env(runtime: &RuntimeConfig, command: EnvCommands) -> Result<()> {
18 match command {
19 EnvCommands::Schema => {
20 let envelope = ResponseEnvelope::ok("env schema", env_schema::env_schema_json());
21 runtime.emit(envelope);
22 }
23 }
24 Ok(())
25}
26
27pub async fn instructions(runtime: &RuntimeConfig) -> Result<()> {
28 let envelope = ResponseEnvelope::ok(
29 "instructions",
30 instructions::instructions_json(&runtime.safety),
31 );
32 runtime.emit(envelope);
33 Ok(())
34}