Imported from magimetal/pi-skill-controller (
extensions/skill-controller/AGENTS.md). Install upstream withnpx skills add magimetal/pi-skill-controller --skill skill-controller. Copyright stays with the author.
ALWAYS READ THESE FILE(S)
- @../../AGENTS.md
- @AGENTS_CUSTOM.md
PROJECT KNOWLEDGE BASE: extensions/skill-controller
OVERVIEW
Core implementation for scoped Pi skill control: command registration, skill discovery, settings serialization, package-source resolution, and overlay UI.
STRUCTURE
extensions/skill-controller/
├── commands.ts # command handlers and transcript copy
├── create-skill-controller-extension.ts # extension bootstrap
├── discovery.ts # skill source aggregation
├── package-source.ts # npm/git/local package identity/root resolution
├── path-utils.ts # ~ expansion and settings-relative resolution
├── serialization.ts # enable/disable filter mutation
├── settings-store.ts # load/write scoped JSON settings
├── types.ts # shared contracts
└── ui.ts # TUI overlay component
WHERE TO LOOK
| Task | Location | Notes |
|---|---|---|
| Add command behavior | commands.ts |
Keep registration count exactly two unless PRD changes. |
| Change discovery roots | discovery.ts |
Covers global/project packages, top-level skills, auto roots. |
| Change JSON writes | settings-store.ts |
Uses dependency injection for tests. |
| Change selector math | serialization.ts |
Handles +path / -path exact entries. |
| Change package resolution | package-source.ts |
Supports npm cache lookup, git source parse, local paths. |
| Change overlay rendering | ui.ts |
Keyboard state stays in memory until save. |
| Add/alter contracts | types.ts |
Check tests and all module imports. |
CONVENTIONS
- Internal imports must include
.jssuffix for ESM output compatibility. - Keep filesystem/process calls behind
SkillControllerDependencieswhen behavior needs tests. ScopeSettings.baseDiris settings file directory, not repo root.targetSettingsPathis carried intoSkillRecordand UI copy; keep exact path intact.- Package-managed skill toggles must preserve package identity and inherited non-skill filters.
ANTI-PATTERNS
- No
as any,@ts-ignore, or swallowed filesystem/JSON errors. - No broad path-glob matching for skill toggles; current serializer is exact path oriented.
- No write from
discoverSkillsForScope; discovery is read-only. - No direct
process.env.HOMEreads outside command/default loading boundary unless injectable. - No overlay save side effect from
Enter, arrows, typing, orEsc.
VERIFICATION
npm run typecheck
npm test
NOTES
collectSkillDirstreats either a directory withSKILL.mdor loose.mdfile as one skill source.- Project
.agents/skillsroots walk fromcwdup to git root; global.agents/skillsuses home root.