Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions src/service/customCommandService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,34 @@ export class CustomCommandService {
*/
public getCustomCommands(): SlashCommand[] {
const commands: SlashCommand[] = [];
const commandMap = new Map<string, SlashCommand>();

// Add project commands
// Add project commands first (they take precedence)
for (const cmd of this.projectCommands) {
commands.push({
command: `/project:${cmd.name}`,
description: cmd.description || `Project command: ${cmd.name}`,
const command = {
command: `/${cmd.name}`,
description: `📄 ${cmd.description || cmd.name}`,
icon: '📄', // Document icon for project commands
isCustom: true
});
};
commandMap.set(cmd.name, command);
}

// Add user commands
// Add user commands only if no project command with the same name exists
for (const cmd of this.userCommands) {
commands.push({
command: `/user:${cmd.name}`,
description: cmd.description || `User command: ${cmd.name}`,
icon: '👤', // User icon for user commands
isCustom: true
});
if (!commandMap.has(cmd.name)) {
const command = {
command: `/${cmd.name}`,
description: `👤 ${cmd.description || cmd.name}`,
icon: '👤', // User icon for user commands
isCustom: true
};
commandMap.set(cmd.name, command);
}
}

return commands;
// Convert map to array
return Array.from(commandMap.values());
}

/**
Expand Down Expand Up @@ -185,4 +191,4 @@ export class CustomCommandService {
}

// Create a singleton instance
export const customCommandService = new CustomCommandService();
export const customCommandService = new CustomCommandService();
Loading