Skip to content

Commit 3fb8bda

Browse files
author
mb
committed
fix: address Codex bot review comments for PR MoonshotAI#2995
- Recheck busy state after loading skills in /skill command - Add idle-only availability to /skill command to block during active turns - Implement left/right arrow key pagination in skill selector - Count each skill only once per group subtree in skill selector
1 parent 1e4a152 commit 3fb8bda

3 files changed

Lines changed: 35 additions & 4 deletions

File tree

apps/kimi-code/src/tui/commands/dispatch.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,16 @@ async function handleSkillCommand(
653653
return;
654654
}
655655

656+
// Recheck busy state after loading skills (P1: Block /skill while a turn is active)
657+
const busyCheckAfterLoad = slashCommandBusyReason({
658+
isStreaming: host.state.appState.streamingPhase !== 'idle',
659+
isCompacting: host.state.appState.isCompacting,
660+
});
661+
if (busyCheckAfterLoad !== undefined) {
662+
host.showError(slashBusyMessage('skill', busyCheckAfterLoad));
663+
return;
664+
}
665+
656666
const activatableSkills = skills.filter(isUserActivatableSkill);
657667
const trimmedArgs = args.trim();
658668

apps/kimi-code/src/tui/commands/registry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export const BUILTIN_SLASH_COMMANDS = [
211211
aliases: ['skills'],
212212
description: 'Select skill from hierarchical group selector',
213213
priority: 90,
214+
availability: 'idle-only',
214215
},
215216
{
216217
name: 'btw',

apps/kimi-code/src/tui/components/dialogs/skill-selector.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,21 @@ export type SkillSelectorItem =
4747
};
4848

4949
function countSkillsInTree(node: SkillGroupNode): number {
50-
let count = node.skills.length;
51-
for (const child of node.childGroups) {
52-
count += countSkillsInTree(child);
50+
const seen = new Set<string>();
51+
function countNode(node: SkillGroupNode): number {
52+
let count = 0;
53+
for (const skill of node.skills) {
54+
if (!seen.has(skill.name)) {
55+
seen.add(skill.name);
56+
count++;
57+
}
58+
}
59+
for (const child of node.childGroups) {
60+
count += countNode(child);
61+
}
62+
return count;
5363
}
54-
return count;
64+
return countNode(node);
5565
}
5666

5767
function collectDescendantSkills(
@@ -187,6 +197,16 @@ export class SkillSelectorComponent extends Container implements Focusable {
187197
return;
188198
}
189199

200+
// Handle left/right arrow keys for pagination (P2: Implement advertised left/right paging keys)
201+
if (matchesKey(data, Key.left)) {
202+
this.list.pageUp();
203+
return;
204+
}
205+
if (matchesKey(data, Key.right)) {
206+
this.list.pageDown();
207+
return;
208+
}
209+
190210
const isSpace = matchesKey(data, Key.space) || printableChar(data) === ' ';
191211
if (matchesKey(data, Key.enter) || (isSpace && this.opts.searchable !== true)) {
192212
const selected = this.list.selected();

0 commit comments

Comments
 (0)