Skip to content

Commit 133616e

Browse files
committed
fix(skills): complete partial installs and improve status output
Re-download when the primary skill version is current but a skill store directory is missing. Show agent skill symlink rows after partial install, and omit agent rows for skills not present in the store.
1 parent 2d93918 commit 133616e

1 file changed

Lines changed: 58 additions & 22 deletions

File tree

‎src/skill.rs‎

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ fn read_installed_version() -> Option<Version> {
7575
parse_version_from_skill_md(&content)
7676
}
7777

78+
fn all_skill_stores_present() -> bool {
79+
SKILL_NAMES
80+
.iter()
81+
.all(|name| skill_store_path(name).exists())
82+
}
83+
7884
fn is_managed_by_skills_agent() -> bool {
7985
let content = match fs::read_to_string(agents_lock_path()) {
8086
Ok(c) => c,
@@ -218,7 +224,18 @@ pub fn install_project() {
218224

219225
// Ensure skill files exist locally first
220226
match read_installed_version() {
221-
Some(ref v) if *v >= current => {}
227+
Some(ref v) if *v >= current && all_skill_stores_present() => {}
228+
Some(ref v) if *v >= current => {
229+
println!(
230+
"{}",
231+
format!("Incomplete skills in ~/.hotdata/skills, downloading v{current}...")
232+
.yellow()
233+
);
234+
if let Err(e) = download_and_extract() {
235+
eprintln!("{}", e.red());
236+
std::process::exit(1);
237+
}
238+
}
222239
Some(ref v) => {
223240
println!(
224241
"{}",
@@ -316,10 +333,18 @@ pub fn install() {
316333

317334
let needs_download = if is_managed_by_skills_agent() {
318335
match read_installed_version() {
319-
Some(ref v) if *v >= current => {
336+
Some(ref v) if *v >= current && all_skill_stores_present() => {
320337
println!("Managed by skills agent — already up to date (v{v}).");
321338
false
322339
}
340+
Some(ref v) if *v >= current => {
341+
println!(
342+
"{}",
343+
format!("Managed by skills agent — completing skill install (v{current})...")
344+
.yellow()
345+
);
346+
true
347+
}
323348
Some(ref v) => {
324349
println!(
325350
"{}",
@@ -335,10 +360,17 @@ pub fn install() {
335360
}
336361
} else {
337362
match read_installed_version() {
338-
Some(ref v) if *v >= current => {
363+
Some(ref v) if *v >= current && all_skill_stores_present() => {
339364
println!("Already up to date (v{v}).");
340365
false
341366
}
367+
Some(ref v) if *v >= current => {
368+
println!(
369+
"{}",
370+
format!("Completing skill install (v{current})...").yellow()
371+
);
372+
true
373+
}
342374
Some(ref v) => {
343375
println!("Updating from v{v} to v{current}...");
344376
true
@@ -408,28 +440,31 @@ pub fn status() {
408440
};
409441
row(&format!("{skill_name}"), &status);
410442
}
411-
println!("\nRun 'hotdata skills install' to install.");
412-
return;
413-
}
414-
415-
row("Installed", &"Yes".green().to_string());
416-
417-
match &installed_version {
418-
Some(v) if *v < current => {
419-
row(
420-
"Version",
421-
&format!(
422-
"{} (outdated, current is v{current})",
423-
v.to_string().yellow()
424-
),
425-
);
443+
} else {
444+
row("Installed", &"Yes".green().to_string());
445+
446+
match &installed_version {
447+
Some(v) if *v < current => {
448+
row(
449+
"Version",
450+
&format!(
451+
"{} (outdated, current is v{current})",
452+
v.to_string().yellow()
453+
),
454+
);
455+
}
456+
Some(v) => row("Version", &v.to_string().green().to_string()),
457+
None => row("Version", &"unknown".dark_grey().to_string()),
426458
}
427-
Some(v) => row("Version", &v.to_string().green().to_string()),
428-
None => row("Version", &"unknown".dark_grey().to_string()),
429459
}
430460

431461
let home = home_dir();
432462
for skill_name in SKILL_NAMES {
463+
let label = format!("Agent Skills ({skill_name})");
464+
if !skill_store_path(skill_name).exists() {
465+
row(&label, &"—".dark_grey().to_string());
466+
continue;
467+
}
433468
let mut installed_agents: Vec<String> = Vec::new();
434469
if agents_skill_path(skill_name).exists() {
435470
installed_agents.push("~/.agents".to_string());
@@ -440,15 +475,16 @@ pub fn status() {
440475
installed_agents.push(format!("~/{root}"));
441476
}
442477
}
443-
let label = format!("Agent Skills ({skill_name})");
444478
if installed_agents.is_empty() {
445479
row(&label, &"none".dark_grey().to_string());
446480
} else {
447481
row(&label, &installed_agents.join(", ").cyan().to_string());
448482
}
449483
}
450484

451-
if installed_version.is_some_and(|v| v < current) {
485+
if !all_exist {
486+
println!("\nRun 'hotdata skills install' to install.");
487+
} else if installed_version.is_some_and(|v| v < current) {
452488
println!("\nRun 'hotdata skills install' to update.");
453489
}
454490
}

0 commit comments

Comments
 (0)