Merge pull request #2822 from qqqys/fix/cli_command

fix(cli): prevent ideCommand failure from breaking all slash commands…
This commit is contained in:
tanzhenxin 2026-04-05 14:27:01 +08:00 committed by GitHub
commit fe4f2567c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 62 additions and 12 deletions

View file

@ -333,17 +333,24 @@ export const useSlashCommandProcessor = (
useEffect(() => {
const controller = new AbortController();
const load = async () => {
const loaders = [
new McpPromptLoader(config),
new BuiltinCommandLoader(config),
new BundledSkillLoader(config),
new FileCommandLoader(config),
];
const commandService = await CommandService.create(
loaders,
controller.signal,
);
setCommands(commandService.getCommands());
try {
const loaders = [
new McpPromptLoader(config),
new BuiltinCommandLoader(config),
new BundledSkillLoader(config),
new FileCommandLoader(config),
];
const commandService = await CommandService.create(
loaders,
controller.signal,
);
// Avoid overwriting newer results from a subsequent effect run
if (!controller.signal.aborted) {
setCommands(commandService.getCommands());
}
} catch (error) {
debugLogger.error('Failed to load slash commands:', error);
}
};
load();