codex_protocol/
parse_command.rs

1use schemars::JsonSchema;
2use serde::Deserialize;
3use serde::Serialize;
4use std::path::PathBuf;
5use ts_rs::TS;
6
7#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, JsonSchema, TS)]
8#[serde(tag = "type", rename_all = "snake_case")]
9pub enum ParsedCommand {
10    Read {
11        cmd: String,
12        name: String,
13        /// (Best effort) Path to the file being read by the command. When
14        /// possible, this is an absolute path, though when relative, it should
15        /// be resolved against the `cwd`` that will be used to run the command
16        /// to derive the absolute path.
17        path: PathBuf,
18    },
19    ListFiles {
20        cmd: String,
21        path: Option<String>,
22    },
23    Search {
24        cmd: String,
25        query: Option<String>,
26        path: Option<String>,
27    },
28    Unknown {
29        cmd: String,
30    },
31}