Parent directory

index.ts

1231 bytes
 1import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
 2import { AtomicSkillChangeWriter } from "./apply/writer.ts";
 3import { DefaultSkillTogglePlanner } from "./apply/planner.ts";
 4import { DefaultSkillLocator } from "./discovery/skill-locator.ts";
 5import { MinimalFrontmatterPatcher } from "./frontmatter/patcher.ts";
 6import { SimpleFrontmatterCodec } from "./frontmatter/parser.ts";
 7import { DefaultSkillInventory } from "./inventory/loader.ts";
 8import { NodeFileSystem } from "./ports/fs.ts";
 9import { runToggleSkillsCommand } from "./command.ts";
10
11export default function piSkillToggle(pi: ExtensionAPI) {
12  const fs = new NodeFileSystem();
13  const codec = new SimpleFrontmatterCodec();
14  const patcher = new MinimalFrontmatterPatcher();
15  const locator = new DefaultSkillLocator(fs);
16  const inventory = new DefaultSkillInventory(locator, fs, codec);
17  const planner = new DefaultSkillTogglePlanner(fs, codec, patcher);
18  const writer = new AtomicSkillChangeWriter(fs);
19
20  pi.registerCommand("toggle-skills", {
21    description: "Toggle whether skills are agent-invocable or manual-only",
22    handler: async (_args, ctx) => {
23      await runToggleSkillsCommand(ctx, { inventory, planner, writer });
24    },
25  });
26}