style: format command alias and deferred tool integrations

This commit is contained in:
Hunter Bown
2026-05-12 23:26:48 -05:00
parent 4063c61ad6
commit 6c9e198720
3 changed files with 34 additions and 31 deletions
+3 -3
View File
@@ -754,9 +754,9 @@ pub fn auto_model_heuristic_with_bias(
"\u{5206}\u{6790}", // 分析
"\u{5be6}\u{73fe}", // 實現
];
let strong_match = COMPLEX_KEYWORDS.iter().any(|kw| {
!borderline_pro_keywords.contains(kw) && lower.contains(kw)
});
let strong_match = COMPLEX_KEYWORDS
.iter()
.any(|kw| !borderline_pro_keywords.contains(kw) && lower.contains(kw));
let borderline_match = borderline_pro_keywords.iter().any(|kw| lower.contains(kw));
let pro_match = strong_match || (!cost_saving && borderline_match);
if pro_match {
+5 -3
View File
@@ -503,7 +503,10 @@ fn deferred_tool_schema_hydration_result(tool: &Tool, tool_input: &Value) -> Too
} else {
""
};
lines.push(format!(" {}: {}{}", field.name, field.kind, required_marker));
lines.push(format!(
" {}: {}{}",
field.name, field.kind, required_marker
));
}
}
lines.push(String::new());
@@ -531,8 +534,7 @@ fn deferred_tool_schema_hydration_result(tool: &Tool, tool_input: &Value) -> Too
}
}
ToolResult::success(lines.join("\n"))
.with_metadata(json!({
ToolResult::success(lines.join("\n")).with_metadata(json!({
"event": "tool.schema_hydrated",
"tool": tool.name,
"executed": false,
+26 -25
View File
@@ -2065,34 +2065,35 @@ pub(crate) fn slash_completion_hints(
let prefix_lower = prefix.to_ascii_lowercase();
for name in commands::all_command_names_matching(prefix, workspace) {
let command_key = name.trim_start_matches('/');
let (description, alias_hint) = if let Some(info) = commands::get_command_info(command_key) {
// Detect matching alias: if the user typed via pinyin rather
// than the canonical name, record which alias matched.
let hint = if !command_key.to_ascii_lowercase().starts_with(&prefix_lower) {
info.aliases
.iter()
.find(|a| a.to_ascii_lowercase().starts_with(&prefix_lower))
.map(|a| a.to_string())
} else {
None
};
let desc = if info.aliases.is_empty() {
info.description_for(locale).to_string()
} else {
format!(
"{} (aliases: {})",
info.description_for(locale),
let (description, alias_hint) =
if let Some(info) = commands::get_command_info(command_key) {
// Detect matching alias: if the user typed via pinyin rather
// than the canonical name, record which alias matched.
let hint = if !command_key.to_ascii_lowercase().starts_with(&prefix_lower) {
info.aliases
.iter()
.map(|a| format!("/{a}"))
.collect::<Vec<_>>()
.join(", ")
)
.find(|a| a.to_ascii_lowercase().starts_with(&prefix_lower))
.map(|a| a.to_string())
} else {
None
};
let desc = if info.aliases.is_empty() {
info.description_for(locale).to_string()
} else {
format!(
"{} (aliases: {})",
info.description_for(locale),
info.aliases
.iter()
.map(|a| format!("/{a}"))
.collect::<Vec<_>>()
.join(", ")
)
};
(desc, hint)
} else {
(String::from("User-defined command"), None)
};
(desc, hint)
} else {
(String::from("User-defined command"), None)
};
entries.push(SlashMenuEntry {
name,
description,