feat: added CLI --skill flag for modifying skills easily

This commit is contained in:
2026-06-01 14:05:16 -06:00
parent 2e06c0e7d2
commit bf8dad2a4f
2 changed files with 24 additions and 0 deletions
+13
View File
@@ -116,6 +116,12 @@ pub struct Cli {
/// List all macros
#[arg(long)]
pub list_macros: bool,
/// List all installed skills
#[arg(long)]
pub list_skills: bool,
/// Open a skill in $EDITOR (creates with a scaffold if missing)
#[arg(long, value_name = "NAME")]
pub skill: Option<String>,
/// Input text
#[arg(trailing_var_arg = true)]
text: Vec<String>,
@@ -298,6 +304,13 @@ mod tests {
assert!(parse(&["--list-agents"]).list_agents);
assert!(parse(&["--list-rags"]).list_rags);
assert!(parse(&["--list-macros"]).list_macros);
assert!(parse(&["--list-skills"]).list_skills);
}
#[test]
fn parse_skill_flag_takes_name() {
assert_eq!(parse(&["--skill", "git-master"]).skill.as_deref(), Some("git-master"));
assert!(parse(&[]).skill.is_none());
}
#[test]
+11
View File
@@ -74,6 +74,7 @@ async fn main() -> Result<()> {
|| cli.list_agents
|| cli.list_rags
|| cli.list_macros
|| cli.list_skills
|| cli.list_sessions;
let vault_flags = cli.add_secret.is_some()
|| cli.get_secret.is_some()
@@ -191,6 +192,16 @@ async fn run(
println!("{macros}");
return Ok(());
}
if cli.list_skills {
let skills = paths::list_skills().join("\n");
println!("{skills}");
return Ok(());
}
if let Some(name) = &cli.skill {
let app = Arc::clone(&ctx.app.config);
ctx.upsert_skill(app.as_ref(), name)?;
return Ok(());
}
if cli.dry_run {
update_app_config(&mut ctx, |app| app.dry_run = true);