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
@@ -0,0 +1,41 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, expect, it } from 'vitest';
import { resumeCommand } from './resumeCommand.js';
import type { CommandContext } from './types.js';
describe('resumeCommand', () => {
it('should open the session browser for bare /resume', async () => {
const result = await resumeCommand.action?.({} as CommandContext, '');
expect(result).toEqual({
type: 'dialog',
dialog: 'sessionBrowser',
});
});
it('should expose unified chat subcommands directly under /resume', () => {
const visibleSubCommandNames = (resumeCommand.subCommands ?? [])
.filter((subCommand) => !subCommand.hidden)
.map((subCommand) => subCommand.name);
expect(visibleSubCommandNames).toEqual(
expect.arrayContaining(['list', 'save', 'resume', 'delete', 'share']),
);
});
it('should keep a hidden /resume checkpoints compatibility alias', () => {
const checkpoints = resumeCommand.subCommands?.find(
(subCommand) => subCommand.name === 'checkpoints',
);
expect(checkpoints?.hidden).toBe(true);
expect(
checkpoints?.subCommands?.map((subCommand) => subCommand.name),
).toEqual(
expect.arrayContaining(['list', 'save', 'resume', 'delete', 'share']),
);
});
});