fix(#794): plugins install not-found path returns typed plugin_source_not_found instead of unknown+null

This commit is contained in:
YeonGyu-Kim
2026-05-27 13:08:14 +09:00
parent 57a57ef771
commit 491f179a03
3 changed files with 59 additions and 0 deletions

View File

@@ -337,6 +337,9 @@ fn classify_error_kind(message: &str) -> &'static str {
"agent_not_found"
} else if message.contains("is not installed") {
"plugin_not_found"
} else if message.contains("plugin source") && message.contains("was not found") {
// #794: `plugins install /nonexistent/path` → "plugin source ... was not found"
"plugin_source_not_found"
} else if (message.contains("skill source") && message.contains("not found"))
|| message.starts_with("skill '")
{
@@ -414,6 +417,10 @@ fn fallback_hint_for_error_kind(kind: &str) -> Option<&'static str> {
// #793: plugins uninstall/enable/disable of non-existing plugin propagates through
// the ? operator with no \n delimiter, so split_error_hint returns None.
"plugin_not_found" => Some("Run `claw plugins list` to see installed plugins."),
// #794: plugins install with a path that doesn't exist
"plugin_source_not_found" => Some(
"Check that the path or URL is correct. Use a local directory or a valid registry id.",
),
_ => None,
}
}
@@ -13178,6 +13185,11 @@ mod tests {
classify_error_kind("my-plugin is not installed"),
"plugin_not_found"
);
// #794: plugins install with missing source path
assert_eq!(
classify_error_kind("plugin source `/nonexistent/path` was not found"),
"plugin_source_not_found"
);
assert_eq!(
classify_error_kind("skill source /path/to/skill not found"),
"skill_not_found"