mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
Polish: Move 'Failed to load skills' warning to debug logs (#16142)
This commit is contained in:
@@ -12,7 +12,7 @@ import { ExtensionManager } from './extension-manager.js';
|
||||
import { loadSettings } from './settings.js';
|
||||
import { createExtension } from '../test-utils/createExtension.js';
|
||||
import { EXTENSIONS_DIRECTORY_NAME } from './extensions/variables.js';
|
||||
import { coreEvents } from '@google/gemini-cli-core';
|
||||
import { coreEvents, debugLogger } from '@google/gemini-cli-core';
|
||||
|
||||
const mockHomedir = vi.hoisted(() => vi.fn());
|
||||
|
||||
@@ -58,6 +58,7 @@ describe('ExtensionManager skills validation', () => {
|
||||
settings: loadSettings(tempWorkspaceDir).merged,
|
||||
});
|
||||
vi.spyOn(coreEvents, 'emitFeedback');
|
||||
vi.spyOn(debugLogger, 'debug').mockImplementation(() => {});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -83,8 +84,7 @@ describe('ExtensionManager skills validation', () => {
|
||||
});
|
||||
|
||||
expect(extension.name).toBe('skills-ext');
|
||||
expect(coreEvents.emitFeedback).toHaveBeenCalledWith(
|
||||
'warning',
|
||||
expect(debugLogger.debug).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Failed to load skills from'),
|
||||
);
|
||||
});
|
||||
@@ -102,12 +102,10 @@ describe('ExtensionManager skills validation', () => {
|
||||
|
||||
await extensionManager.loadExtensions();
|
||||
|
||||
expect(coreEvents.emitFeedback).toHaveBeenCalledWith(
|
||||
'warning',
|
||||
expect(debugLogger.debug).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Failed to load skills from'),
|
||||
);
|
||||
expect(coreEvents.emitFeedback).toHaveBeenCalledWith(
|
||||
'warning',
|
||||
expect(debugLogger.debug).toHaveBeenCalledWith(
|
||||
expect.stringContaining(
|
||||
'The directory is not empty but no valid skills were discovered',
|
||||
),
|
||||
@@ -139,8 +137,7 @@ describe('ExtensionManager skills validation', () => {
|
||||
expect(extension.skills![0].name).toBe('test-skill');
|
||||
// It might be called for other reasons during startup, but shouldn't be called for our skills loading success
|
||||
// Actually, it shouldn't be called with our warning message
|
||||
expect(coreEvents.emitFeedback).not.toHaveBeenCalledWith(
|
||||
'warning',
|
||||
expect(debugLogger.debug).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('Failed to load skills from'),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@ import * as os from 'node:os';
|
||||
import * as path from 'node:path';
|
||||
import { loadSkillsFromDir } from './skillLoader.js';
|
||||
import { coreEvents } from '../utils/events.js';
|
||||
import { debugLogger } from '../utils/debugLogger.js';
|
||||
|
||||
describe('skillLoader', () => {
|
||||
let testRootDir: string;
|
||||
@@ -19,6 +20,7 @@ describe('skillLoader', () => {
|
||||
path.join(os.tmpdir(), 'skill-loader-test-'),
|
||||
);
|
||||
vi.spyOn(coreEvents, 'emitFeedback');
|
||||
vi.spyOn(debugLogger, 'debug').mockImplementation(() => {});
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -53,8 +55,7 @@ describe('skillLoader', () => {
|
||||
const skills = await loadSkillsFromDir(testRootDir);
|
||||
|
||||
expect(skills).toHaveLength(0);
|
||||
expect(coreEvents.emitFeedback).toHaveBeenCalledWith(
|
||||
'warning',
|
||||
expect(debugLogger.debug).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Failed to load skills from'),
|
||||
);
|
||||
});
|
||||
@@ -89,8 +90,7 @@ describe('skillLoader', () => {
|
||||
const skills = await loadSkillsFromDir(testRootDir);
|
||||
|
||||
expect(skills).toHaveLength(0);
|
||||
expect(coreEvents.emitFeedback).toHaveBeenCalledWith(
|
||||
'warning',
|
||||
expect(debugLogger.debug).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Failed to load skills from'),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -60,8 +60,7 @@ export async function loadSkillsFromDir(
|
||||
if (discoveredSkills.length === 0) {
|
||||
const files = await fs.readdir(absoluteSearchPath);
|
||||
if (files.length > 0) {
|
||||
coreEvents.emitFeedback(
|
||||
'warning',
|
||||
debugLogger.debug(
|
||||
`Failed to load skills from ${absoluteSearchPath}. The directory is not empty but no valid skills were discovered. Please ensure SKILL.md files are present in subdirectories and have valid frontmatter.`,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user