Fix --no-skills flag not preventing skills from loading

The --no-skills flag set options.skills = [] in main.ts, but the
interactive mode UI would rediscover skills anyway because it called
loadSkills() directly instead of using the already-loaded skills.

Changes:
- Add AgentSession.skills and AgentSession.skillWarnings properties
- discoverSkills() now returns { skills, warnings } instead of Skill[]
- Interactive mode uses session.skills instead of calling loadSkills()
- Update SDK docs and examples for new return type

Fixes #577
This commit is contained in:
Mario Zechner 2026-01-08 23:32:57 +01:00
parent c865ec1d19
commit af2d8509e6
7 changed files with 88 additions and 54 deletions

View file

@ -528,7 +528,7 @@ eventBus.on("my-extension:status", (data) => console.log(data));
import { createAgentSession, discoverSkills, type Skill } from "@mariozechner/pi-coding-agent";
// Discover and filter
const allSkills = discoverSkills();
const { skills: allSkills, warnings } = discoverSkills();
const filtered = allSkills.filter(s => s.name.includes("search"));
// Custom skill
@ -550,7 +550,7 @@ const { session } = await createAgentSession({
});
// Discovery with settings filter
const skills = discoverSkills(process.cwd(), undefined, {
const { skills } = discoverSkills(process.cwd(), undefined, {
ignoredSkills: ["browser-*"], // glob patterns to exclude
includeSkills: ["search-*"], // glob patterns to include (empty = all)
});
@ -747,7 +747,7 @@ const model = modelRegistry.find("provider", "id"); // Find specific model
const builtIn = getModel("anthropic", "claude-opus-4-5"); // Built-in only
// Skills
const skills = discoverSkills(cwd, agentDir, skillsSettings);
const { skills, warnings } = discoverSkills(cwd, agentDir, skillsSettings);
// Hooks (async - loads TypeScript)
// Pass eventBus to share pi.events across hooks/tools