feat: add commands management feature with API endpoints and UI integration

- Implemented commands routes for listing, enabling, and disabling commands.
- Created commands manager view with accordion groups for better organization.
- Added loading states and confirmation dialogs for enabling/disabling commands.
- Enhanced error handling and user feedback for command operations.
- Introduced CSS styles for commands manager UI components.
- Updated navigation to include commands manager link.
- Refactored existing code for better maintainability and clarity.
This commit is contained in:
catlog22
2026-01-28 08:26:37 +08:00
parent cc5a5716cf
commit 4c78f53bcc
11 changed files with 1203 additions and 3 deletions

View File

@@ -19,6 +19,7 @@ export interface CommandMetadata {
argumentHint: string;
allowedTools: string[];
filePath: string;
group?: string;
}
export interface CommandSummary {
@@ -103,6 +104,7 @@ export class CommandRegistry {
.join(','); // Keep as comma-separated for now, will convert in getCommand
}
// Note: 'group' field is automatically extracted like other fields
result[key] = cleanValue;
}
} catch (error) {
@@ -159,7 +161,8 @@ export class CommandRegistry {
description: header.description || '',
argumentHint: header['argument-hint'] || '',
allowedTools: allowedTools,
filePath: filePath
filePath: filePath,
group: header.group || undefined
};
// Cache result
@@ -207,6 +210,9 @@ export class CommandRegistry {
const files = readdirSync(this.commandDir);
for (const file of files) {
// Skip _disabled directory
if (file === '_disabled') continue;
if (!file.endsWith('.md')) continue;
const filePath = join(this.commandDir, file);
@@ -282,6 +288,15 @@ export class CommandRegistry {
}
return result;
}
/**
* Clear the command cache
* Use this to invalidate cached commands after enable/disable operations
* @returns void
*/
public clearCache(): void {
this.cache.clear();
}
}
/**