pub struct CommandsRoot { /* private fields */ }Expand description
Root directory of one set of slash command definitions
(<root>/<stem>.md). Use Self::user for the user-level root
at ~/.claude/commands, Self::project for a project’s
<dir>/.claude/commands, or Self::at to point at an
arbitrary directory for tests.
Implementations§
Source§impl CommandsRoot
impl CommandsRoot
Sourcepub fn user() -> Result<Self>
pub fn user() -> Result<Self>
Resolve the user-level commands root at ~/.claude/commands.
Errors if $HOME cannot be determined.
Sourcepub fn project(project_dir: impl Into<PathBuf>) -> Self
pub fn project(project_dir: impl Into<PathBuf>) -> Self
Resolve a project-level commands root at
<project_dir>/.claude/commands. The project_dir is the
project root itself (the .claude/commands suffix is
appended internally).
Sourcepub fn at(path: impl Into<PathBuf>) -> Self
pub fn at(path: impl Into<PathBuf>) -> Self
Use a specific path as the commands root. Useful for tests.
Sourcepub fn list(&self) -> Result<Vec<CommandSummary>>
pub fn list(&self) -> Result<Vec<CommandSummary>>
List every *.md command at the root, sorted by file stem.
Returns an empty vec if the root directory doesn’t exist (a project or user without custom commands). Files that fail to parse contribute a tracing warning and are skipped.
Trait Implementations§
Source§impl Clone for CommandsRoot
impl Clone for CommandsRoot
Source§fn clone(&self) -> CommandsRoot
fn clone(&self) -> CommandsRoot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more