feat(cli): unify /chat and /resume command UX (#20256)

This commit is contained in:
Dmitry Lyalin
2026-03-08 18:50:51 -04:00
committed by GitHub
parent d012929a28
commit d41735d6a9
18 changed files with 619 additions and 90 deletions
@@ -78,6 +78,41 @@ export class BuiltinCommandLoader implements ICommandLoader {
const handle = startupProfiler.start('load_builtin_commands');
const isNightlyBuild = await isNightly(process.cwd());
const addDebugToChatResumeSubCommands = (
subCommands: SlashCommand[] | undefined,
): SlashCommand[] | undefined => {
if (!subCommands) {
return subCommands;
}
const withNestedCompatibility = subCommands.map((subCommand) => {
if (subCommand.name !== 'checkpoints') {
return subCommand;
}
return {
...subCommand,
subCommands: addDebugToChatResumeSubCommands(subCommand.subCommands),
};
});
if (!isNightlyBuild) {
return withNestedCompatibility;
}
return withNestedCompatibility.some(
(cmd) => cmd.name === debugCommand.name,
)
? withNestedCompatibility
: [
...withNestedCompatibility,
{ ...debugCommand, suggestionGroup: 'checkpoints' },
];
};
const chatResumeSubCommands = addDebugToChatResumeSubCommands(
chatCommand.subCommands,
);
const allDefinitions: Array<SlashCommand | null> = [
aboutCommand,
@@ -86,9 +121,7 @@ export class BuiltinCommandLoader implements ICommandLoader {
bugCommand,
{
...chatCommand,
subCommands: isNightlyBuild
? [...(chatCommand.subCommands || []), debugCommand]
: chatCommand.subCommands,
subCommands: chatResumeSubCommands,
},
clearCommand,
commandsCommand,
@@ -155,7 +188,10 @@ export class BuiltinCommandLoader implements ICommandLoader {
...(isDevelopment ? [profileCommand] : []),
quitCommand,
restoreCommand(this.config),
resumeCommand,
{
...resumeCommand,
subCommands: addDebugToChatResumeSubCommands(resumeCommand.subCommands),
},
statsCommand,
themeCommand,
toolsCommand,