refactor: Migrated the .skills command completion to use StateFlags and updated the help messages

This commit is contained in:
2026-06-18 14:30:55 -06:00
parent d4dbda1e89
commit 3299a4699e
3 changed files with 160 additions and 11 deletions
+30 -6
View File
@@ -49,7 +49,7 @@ pub const DEFAULT_CONTINUATION_PROMPT: &str = indoc! {"
4. Continue with the next pending item now. Call tools immediately."
};
static REPL_COMMANDS: LazyLock<[ReplCommand; 45]> = LazyLock::new(|| {
static REPL_COMMANDS: LazyLock<[ReplCommand; 49]> = LazyLock::new(|| {
[
ReplCommand::new(".help", "Show this help guide", AssertState::pass()),
ReplCommand::new(".info", "Show system info", AssertState::pass()),
@@ -168,6 +168,11 @@ static REPL_COMMANDS: LazyLock<[ReplCommand; 45]> = LazyLock::new(|| {
"Clear the todo list and stop auto-continuation",
AssertState::pass(),
),
ReplCommand::new(
".info todo",
"Show the current todo list driving auto-continuation",
AssertState::True(StateFlags::AUTO_CONTINUE),
),
ReplCommand::new(
".rag",
"Initialize or access RAG",
@@ -201,13 +206,28 @@ static REPL_COMMANDS: LazyLock<[ReplCommand; 45]> = LazyLock::new(|| {
ReplCommand::new(".macro", "Execute a macro", AssertState::pass()),
ReplCommand::new(
".skill",
"List, load, unload, or create skills",
AssertState::pass(),
"Create a new skill",
AssertState::True(StateFlags::SKILLS_ENABLED),
),
ReplCommand::new(
".skill load",
"Load a skill into the current context",
AssertState::True(StateFlags::SKILLS_ENABLED),
),
ReplCommand::new(
".skill loaded",
"List currently-loaded skills",
AssertState::True(StateFlags::SKILLS_ENABLED),
),
ReplCommand::new(
".skill unload",
"Unload a skill from the current context",
AssertState::True(StateFlags::SKILLS_ENABLED),
),
ReplCommand::new(
".edit skill",
"Modify an existing skill by name",
AssertState::pass(),
AssertState::True(StateFlags::SKILLS_ENABLED),
),
ReplCommand::new(
".file",
@@ -489,6 +509,10 @@ pub async fn run_repl_command(
let info = ctx.tools_info()?;
print!("{info}");
}
Some("todo") => {
let info = ctx.todo_info()?;
print!("{info}");
}
Some(_) => unknown_command()?,
None => {
let app = Arc::clone(&ctx.app.config);
@@ -1391,8 +1415,8 @@ mod tests {
}
#[test]
fn repl_commands_has_45_entries() {
assert_eq!(REPL_COMMANDS.len(), 45);
fn repl_commands_has_49_entries() {
assert_eq!(REPL_COMMANDS.len(), 49);
}
#[test]