[Skills] UX Polishing: Transparent feedback and CLI refinements (#15954)

This commit is contained in:
N. Taylor Mullen
2026-01-07 22:30:33 -08:00
committed by GitHub
parent aca6bf6aa0
commit 3e2f4eb8ba
6 changed files with 31 additions and 18 deletions

View File

@@ -60,6 +60,7 @@ describe('skills disable command', () => {
const mockSettings = {
forScope: vi.fn().mockReturnValue({
settings: { skills: { disabled: [] } },
path: '/user/settings.json',
}),
setValue: vi.fn(),
};
@@ -79,7 +80,7 @@ describe('skills disable command', () => {
);
expect(emitConsoleLog).toHaveBeenCalledWith(
'log',
'Skill "skill1" disabled by adding it to the disabled list in user settings.',
'Skill "skill1" disabled by adding it to the disabled list in user (/user/settings.json) settings. Restart required to take effect.',
);
});

View File

@@ -5,19 +5,16 @@
*/
import type { CommandModule } from 'yargs';
import {
loadSettings,
SettingScope,
type LoadableSettingScope,
} from '../../config/settings.js';
import { loadSettings, SettingScope } from '../../config/settings.js';
import { debugLogger } from '@google/gemini-cli-core';
import { exitCli } from '../utils.js';
import { disableSkill } from '../../utils/skillSettings.js';
import { renderSkillActionFeedback } from '../../utils/skillUtils.js';
import chalk from 'chalk';
interface DisableArgs {
name: string;
scope: LoadableSettingScope;
scope: SettingScope;
}
export async function handleDisable(args: DisableArgs) {
@@ -26,7 +23,14 @@ export async function handleDisable(args: DisableArgs) {
const settings = loadSettings(workspaceDir);
const result = disableSkill(settings, name, scope);
debugLogger.log(renderSkillActionFeedback(result, (label, _path) => label));
let feedback = renderSkillActionFeedback(
result,
(label, path) => `${chalk.bold(label)} (${chalk.dim(path)})`,
);
if (result.status === 'success') {
feedback += ' Restart required to take effect.';
}
debugLogger.log(feedback);
}
export const disableCommand: CommandModule = {
@@ -43,11 +47,11 @@ export const disableCommand: CommandModule = {
alias: 's',
describe: 'The scope to disable the skill in (user or project).',
type: 'string',
default: 'user',
default: 'project',
choices: ['user', 'project'],
}),
handler: async (argv) => {
const scope: LoadableSettingScope =
const scope =
argv['scope'] === 'project' ? SettingScope.Workspace : SettingScope.User;
await handleDisable({
name: argv['name'] as string,

View File

@@ -81,7 +81,7 @@ describe('skills enable command', () => {
);
expect(emitConsoleLog).toHaveBeenCalledWith(
'log',
'Skill "skill1" enabled by removing it from the disabled list in user and project settings.',
'Skill "skill1" enabled by removing it from the disabled list in user (/user/settings.json) and project (/project/settings.json) settings. Restart required to take effect.',
);
});
@@ -122,7 +122,7 @@ describe('skills enable command', () => {
);
expect(emitConsoleLog).toHaveBeenCalledWith(
'log',
'Skill "skill1" enabled by removing it from the disabled list in project and user settings.',
'Skill "skill1" enabled by removing it from the disabled list in project (/workspace/settings.json) and user (/user/settings.json) settings. Restart required to take effect.',
);
});

View File

@@ -10,6 +10,7 @@ import { debugLogger } from '@google/gemini-cli-core';
import { exitCli } from '../utils.js';
import { enableSkill } from '../../utils/skillSettings.js';
import { renderSkillActionFeedback } from '../../utils/skillUtils.js';
import chalk from 'chalk';
interface EnableArgs {
name: string;
@@ -21,7 +22,14 @@ export async function handleEnable(args: EnableArgs) {
const settings = loadSettings(workspaceDir);
const result = enableSkill(settings, name);
debugLogger.log(renderSkillActionFeedback(result, (label, _path) => label));
let feedback = renderSkillActionFeedback(
result,
(label, path) => `${chalk.bold(label)} (${chalk.dim(path)})`,
);
if (result.status === 'success') {
feedback += ' Restart required to take effect.';
}
debugLogger.log(feedback);
}
export const enableCommand: CommandModule = {

View File

@@ -182,7 +182,7 @@ describe('skillsCommand', () => {
expect(context.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: MessageType.INFO,
text: 'Skill "skill1" disabled by adding it to the disabled list in project settings. Use "/skills reload" for it to take effect.',
text: 'Skill "skill1" disabled by adding it to the disabled list in project (/workspace) settings. Use "/skills reload" for it to take effect.',
}),
expect.any(Number),
);
@@ -211,7 +211,7 @@ describe('skillsCommand', () => {
expect(context.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: MessageType.INFO,
text: 'Skill "skill1" enabled by removing it from the disabled list in project and user settings. Use "/skills reload" for it to take effect.',
text: 'Skill "skill1" enabled by removing it from the disabled list in project (/workspace) and user (/user/settings.json) settings. Use "/skills reload" for it to take effect.',
}),
expect.any(Number),
);
@@ -251,7 +251,7 @@ describe('skillsCommand', () => {
expect(context.ui.addItem).toHaveBeenCalledWith(
expect.objectContaining({
type: MessageType.INFO,
text: 'Skill "skill1" enabled by removing it from the disabled list in project and user settings. Use "/skills reload" for it to take effect.',
text: 'Skill "skill1" enabled by removing it from the disabled list in project (/workspace) and user (/user/settings.json) settings. Use "/skills reload" for it to take effect.',
}),
expect.any(Number),
);

View File

@@ -96,7 +96,7 @@ async function disableAction(
let feedback = renderSkillActionFeedback(
result,
(label, _path) => `${label}`,
(label, path) => `${label} (${path})`,
);
if (result.status === 'success') {
feedback += ' Use "/skills reload" for it to take effect.';
@@ -131,7 +131,7 @@ async function enableAction(
let feedback = renderSkillActionFeedback(
result,
(label, _path) => `${label}`,
(label, path) => `${label} (${path})`,
);
if (result.status === 'success') {
feedback += ' Use "/skills reload" for it to take effect.';