Support for Built-in Agent Skills (#16045)

This commit is contained in:
N. Taylor Mullen
2026-01-09 22:26:58 -08:00
committed by GitHub
parent c37a32582f
commit 5eb841ae7e
17 changed files with 755 additions and 451 deletions
@@ -6,7 +6,7 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { skillsCommand } from './skillsCommand.js';
import { MessageType } from '../types.js';
import { MessageType, type HistoryItemSkillsList } from '../types.js';
import { createMockCommandContext } from '../../test-utils/mockCommandContext.js';
import type { CommandContext } from './types.js';
import type { Config, SkillDefinition } from '@google/gemini-cli-core';
@@ -136,6 +136,51 @@ describe('skillsCommand', () => {
);
});
it('should filter built-in skills by default and show them with "all"', async () => {
const skillManager = context.services.config!.getSkillManager();
const mockSkills = [
{
name: 'regular',
description: 'desc1',
location: '/loc1',
body: 'body1',
},
{
name: 'builtin',
description: 'desc2',
location: '/loc2',
body: 'body2',
isBuiltin: true,
},
];
vi.mocked(skillManager.getAllSkills).mockReturnValue(mockSkills);
const listCmd = skillsCommand.subCommands!.find((s) => s.name === 'list')!;
// By default, only regular skills
await listCmd.action!(context, '');
let lastCall = vi
.mocked(context.ui.addItem)
.mock.calls.at(-1)![0] as HistoryItemSkillsList;
expect(lastCall.skills).toHaveLength(1);
expect(lastCall.skills[0].name).toBe('regular');
// With "all", show both
await listCmd.action!(context, 'all');
lastCall = vi
.mocked(context.ui.addItem)
.mock.calls.at(-1)![0] as HistoryItemSkillsList;
expect(lastCall.skills).toHaveLength(2);
expect(lastCall.skills.map((s) => s.name)).toContain('builtin');
// With "--all", show both
await listCmd.action!(context, '--all');
lastCall = vi
.mocked(context.ui.addItem)
.mock.calls.at(-1)![0] as HistoryItemSkillsList;
expect(lastCall.skills).toHaveLength(2);
});
describe('disable/enable', () => {
beforeEach(() => {
context.services.settings.merged.skills = { disabled: [] };