/** * pi-figma — token-efficient Figma access for pi. * * Extension entry: registers the four v1 tools + a /figma-cache-stats command. * Everything heavy lives in ./tools/*, ./client, ./cache, ./transforms. */ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent"; import { mapTool } from "./tools/map.js"; import { inspectTool } from "./tools/inspect.js"; import { copyTool } from "./tools/copy.js"; import { tokensTool } from "./tools/tokens.js"; import { cacheStats } from "./cache.js"; export default function (pi: ExtensionAPI) { pi.registerTool(mapTool); pi.registerTool(inspectTool); pi.registerTool(copyTool); pi.registerTool(tokensTool); pi.registerCommand("figma-cache-stats", { description: "Show pi-figma cache disk usage.", handler: async (_args, ctx) => { const { files, bytes } = await cacheStats(); const mb = (bytes / (1024 * 1024)).toFixed(2); ctx.ui.notify(`pi-figma cache: ${files} files, ${mb} MB`, "info"); }, }); }