repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

feat(skillz): load conditional skills without reload info notices

e2cc11d8e154968b2a80387ed938faff1a670ee2

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (9)

extensions/AGENTS.md

Modified
103 103 Runtime extension code must never write diagnostic text through `console.*` or process stdout/stderr; direct terminal writes corrupt Pi's TUI and machine-readable modes.
104 104 Use `ctx.ui.notify` for actionable failures, throw tool failures, and use opt-in file diagnostics for debugging.
105 +Do not emit `info` notifications during `/reload`: Pi replaces them with its reload-success status.
106 +Preserve actionable `warning` and `error` notifications.
105 107 Terminal-control sequences, standalone benchmarks, and worker protocols are exempt.
107 109 ## Startup

extensions/skillz/README.md

Added
new file mode 100644
1 +# skillz
3 +Load personal skills conditionally by OS, hostname, and cwd marker.
5 +Place skills under `<agent-dir>/skillz/` instead of Pi's native `skills/` directories.
6 +Pi's normal skill discovery rules apply inside this directory, including nested skill directories and standalone Markdown skills.
7 +Matching skills become native `/skill:<name>` commands; they do not appear individually in `pi config`.
8 +Enable or disable the extension itself through `pi config`.
10 +Use top-level `os`, `host`, or `path` fields in skill frontmatter; at least one is required.
11 +Each field accepts a string or a nonempty list of strings.
12 +Lists match any entry; different fields must all match.
14 +```yaml
15 +---
16 +name: jj-workflow
17 +description: Use in a Jujutsu working directory on this machine.
18 +os: [lnx, mac]
19 +host: desktop
20 +path: .jj
21 +---
22 +```
24 +`os` accepts `lnx`, `win32`, or `mac`.
25 +`host` matches the exact machine hostname.
26 +`path` checks an explicit path under Pi's cwd; use `/` separators on every OS.
27 +Absolute paths, `..`, backslashes, and symlink components in marker paths are rejected.
28 +Skills are reevaluated at startup and on `/reload`; changed markers do not update an open session until reload.
29 +At startup, a TUI summary reports eligible skills; `/reload` omits the summary because Pi replaces informational notifications with its reload-success status.
30 +Invalid conditions and duplicate names still produce warnings.
31 +Pi remains responsible for validating standard skill fields.
33 +## Performance
35 +`mise run //extensions/skillz:bench` measures isolated discovery and full Pi session reload with 256 generated 4 KiB skills, of which 75% match.
36 +The fixture warms up for 20 cycles and reports 12 rounds of five operations by default; compare independent runs with `//extensions/skillz:benchstat`.
37 +`mise run //extensions/skillz:profile` captures a Node V8 CPU profile under the OS temporary directory.
38 +Pi's native skill loader and YAML parsing dominate discovery; avoid replacing native discovery without proof that Pi's ignore, symlink, validation, and collision behavior stays intact.
40 +See [`index.ts`](index.ts) for resource registration and [`match.ts`](match.ts) for condition semantics.

extensions/skillz/__bench__/discovery.bench.ts

Added
new file mode 100644
1 +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
2 +import { hostname, tmpdir } from "node:os";
3 +import { join, resolve } from "node:path";
4 +import type {
5 + ExtensionAPI,
6 + ExtensionContext,
7 + ResourcesDiscoverEvent,
8 + ResourcesDiscoverResult,
9 +} from "@earendil-works/pi-coding-agent";
10 +import { createTestSession } from "@marcfargas/pi-test-harness";
11 +import skillz from "../index.ts";
13 +const COUNT = Number(process.env.SKILLZ_BENCH_SKILLS ?? 256);
14 +const ROUNDS = Number(process.env.SKILLZ_BENCH_ROUNDS ?? 12);
15 +const ITERATIONS = Number(process.env.SKILLZ_BENCH_ITERATIONS ?? 5);
16 +const KIND = process.env.SKILLZ_BENCH_KIND ?? "both";
17 +if (!["both", "discover", "reload"].includes(KIND))
18 + throw new Error("Unknown SKILLZ_BENCH_KIND");
19 +if (
20 + ![COUNT, ROUNDS, ITERATIONS].every((n) => Number.isSafeInteger(n) && n > 0) ||
21 + COUNT % 4 !== 0
23 + throw new Error(
24 + "SKILLZ_BENCH_SKILLS must be divisible by four; all parameters must be positive integers",
25 + );
27 +const root = mkdtempSync(join(tmpdir(), "skillz-bench-"));
28 +const agentDir = join(root, "agent");
29 +const body = "x".repeat(4096);
30 +const extension = resolve(import.meta.dirname, "../index.ts");
31 +const previousAgentDir = process.env.PI_CODING_AGENT_DIR;
32 +let session: Awaited<ReturnType<typeof createTestSession>> | undefined;
34 +try {
35 + writeFileSync(join(root, "marker"), "");
36 + for (let index = 0; index < COUNT; index++) {
37 + const dir = join(
38 + agentDir,
39 + "skillz",
40 + `skill-${String(index).padStart(4, "0")}`,
41 + );
42 + mkdirSync(dir, { recursive: true });
43 + const condition = [
44 + `host: ${hostname()}`,
45 + "path: marker",
46 + "host: definitely-not-this-host",
47 + "os: [lnx, mac, win32]",
48 + ][index % 4];
49 + writeFileSync(
50 + join(dir, "SKILL.md"),
51 + `---\nname: skill-${String(index).padStart(4, "0")}\ndescription: Benchmark skill ${index}\n${condition}\n---\n\n${body}\n`,
52 + );
53 + }
54 + process.env.PI_CODING_AGENT_DIR = agentDir;
55 + session = await createTestSession({ cwd: root, extensions: [extension] });
56 + const current = session.session;
57 + let handler:
58 + | ((
59 + event: ResourcesDiscoverEvent,
60 + ctx: ExtensionContext,
61 + ) => ResourcesDiscoverResult | Promise<ResourcesDiscoverResult>)
62 + | undefined;
63 + skillz({
64 + on: (_event: string, callback: typeof handler) => {
65 + handler = callback;
66 + },
67 + getCommands: () => [],
68 + } as unknown as ExtensionAPI);
69 + if (!handler) throw new Error("No discovery handler registered");
70 + const discoverHandler = handler;
71 + const context = {
72 + mode: "json",
73 + ui: { notify: () => {} },
74 + } as unknown as ExtensionContext;
75 + const discover = async () => {
76 + const result = await discoverHandler(
77 + { type: "resources_discover", cwd: root, reason: "reload" },
78 + context,
79 + );
80 + if (result.skillPaths?.length !== (COUNT * 3) / 4)
81 + throw new Error(
82 + `Unexpected eligible skill count: ${result.skillPaths?.length}`,
83 + );
84 + };
85 + const reload = async () => {
86 + await current.reload();
87 + const count = current.resourceLoader
88 + .getSkills()
89 + .skills.filter((skill) =>
90 + skill.filePath.startsWith(join(agentDir, "skillz")),
91 + ).length;
92 + if (count !== (COUNT * 3) / 4)
93 + throw new Error(`Unexpected matching skill count: ${count}`);
94 + };
95 + for (let index = 0; index < 20; index++) {
96 + if (KIND !== "reload") await discover();
97 + if (KIND !== "discover") await reload();
98 + }
99 + console.log(`goos: ${process.platform}`);
100 + console.log(`goarch: ${process.arch}`);
101 + console.log("pkg: pi-ext/skillz");
102 + for (const [name, operation] of [
103 + ["Discover", discover],
104 + ["Reload", reload],
105 + ] as const) {
106 + if (KIND !== "both" && KIND.toLowerCase() !== name.toLowerCase()) continue;
107 + for (let round = 0; round < ROUNDS; round++) {
108 + const start = process.hrtime.bigint();
109 + for (let index = 0; index < ITERATIONS; index++) await operation();
110 + const elapsed = Number(process.hrtime.bigint() - start) / ITERATIONS;
111 + console.log(
112 + `Benchmark${name}${COUNT}\t${ITERATIONS}\t${elapsed.toFixed(0)} ns/op`,
113 + );
116 +} finally {
117 + session?.dispose();
118 + if (previousAgentDir === undefined) delete process.env.PI_CODING_AGENT_DIR;
119 + else process.env.PI_CODING_AGENT_DIR = previousAgentDir;
120 + rmSync(root, { recursive: true, force: true });

extensions/skillz/__tests__/harness.test.ts

Added
new file mode 100644
1 +import {
2 + mkdirSync,
3 + mkdtempSync,
4 + rmSync,
5 + symlinkSync,
6 + writeFileSync,
7 +} from "node:fs";
8 +import os from "node:os";
9 +import path from "node:path";
10 +import { afterEach, describe, expect, it } from "vitest";
11 +import { createTestSession, type TestSession } from "../../../test/harness.ts";
12 +import { matchSkill } from "../match.ts";
14 +const extension = path.resolve(import.meta.dirname, "../index.ts");
16 +function skill(agentDir: string, name: string, conditions: string): void {
17 + const dir = path.join(agentDir, "skillz", name);
18 + mkdirSync(dir, { recursive: true });
19 + writeFileSync(
20 + path.join(dir, "SKILL.md"),
21 + `---\nname: ${name}\ndescription: Skill ${name}\n${conditions}---\n\n# ${name}\n`,
22 + );
25 +describe("skillz conditions", () => {
26 + const cwd = path.join(os.tmpdir(), "skillz-cwd");
27 + it("combines fields with AND and values within fields with OR", () => {
28 + expect(
29 + matchSkill({ os: ["mac", "lnx"], host: ["a", "b"] }, cwd, "linux", "b")
30 + .matches,
31 + ).toBe(true);
32 + expect(
33 + matchSkill({ os: "win32", host: "b" }, cwd, "linux", "b").matches,
34 + ).toBe(false);
35 + expect(matchSkill({ host: "B" }, cwd, "linux", "b").matches).toBe(false);
36 + });
38 + it("rejects missing and malformed conditions", () => {
39 + for (const value of [
40 + {},
41 + { os: "linux" },
42 + { os: [] },
43 + { host: 4 },
44 + { path: "../up" },
45 + { path: "C:/x" },
46 + { path: "foo\\bar" },
47 + { path: "." },
48 + ])
49 + expect(matchSkill(value, cwd).error).toBeDefined();
50 + });
52 + it("validates every present condition before matching", () => {
53 + expect(
54 + matchSkill(
55 + { os: "mac", host: [], path: "../outside" },
56 + cwd,
57 + "linux",
58 + "x",
59 + ),
60 + ).toEqual({ matches: false, error: "invalid host condition" });
61 + expect(
62 + matchSkill(
63 + { os: "mac", host: "x", path: "../outside" },
64 + cwd,
65 + "linux",
66 + "x",
67 + ),
68 + ).toEqual({ matches: false, error: "invalid path condition" });
69 + expect(
70 + matchSkill({ os: "mac", host: "x", path: ".jj" }, cwd, "linux", "x"),
71 + ).toEqual({ matches: false });
72 + });
74 + it("matches exact cwd markers and rejects symlink components", () => {
75 + const root = mkdtempSync(path.join(os.tmpdir(), "skillz-markers-"));
76 + try {
77 + writeFileSync(path.join(root, ".jj"), "");
78 + mkdirSync(path.join(root, "nested"));
79 + writeFileSync(path.join(root, "nested", "marker"), "");
80 + symlinkSync("nested", path.join(root, "linked"));
81 + expect(matchSkill({ path: ".jj" }, root).matches).toBe(true);
82 + expect(
83 + matchSkill({ path: ["missing", "nested/marker"] }, root).matches,
84 + ).toBe(true);
85 + expect(
86 + matchSkill({ path: ".jj" }, path.join(root, "nested")).matches,
87 + ).toBe(false);
88 + expect(matchSkill({ path: "linked/marker" }, root).matches).toBe(false);
89 + } finally {
90 + rmSync(root, { recursive: true, force: true });
91 + }
92 + });
93 +});
95 +describe("skillz runtime", () => {
96 + let t: TestSession | undefined;
97 + const roots: string[] = [];
98 + afterEach(() => {
99 + t?.dispose();
100 + t = undefined;
101 + for (const root of roots.splice(0))
102 + rmSync(root, { recursive: true, force: true });
103 + });
105 + it("loads eligible global skills into native registry and /skill commands", async () => {
106 + const root = mkdtempSync(path.join(os.tmpdir(), "skillz-runtime-"));
107 + roots.push(root);
108 + const agentDir = path.join(root, "agent");
109 + mkdirSync(path.join(root, ".jj"));
110 + skill(agentDir, "matched", "path: .jj\n");
111 + skill(agentDir, "wrong-host", "host: definitely-not-this-host\n");
112 + skill(
113 + agentDir,
114 + "manual",
115 + "os: [lnx, mac, win32]\ndisable-model-invocation: true\n",
116 + );
117 + skill(agentDir, "unconditional", "");
118 + t = await createTestSession({
119 + cwd: root,
120 + extensions: [extension],
121 + env: { PI_CODING_AGENT_DIR: agentDir },
122 + });
123 + const names = t.session.resourceLoader
124 + .getSkills()
125 + .skills.map((entry) => entry.name);
126 + expect(names).toContain("matched");
127 + expect(names).toContain("manual");
128 + expect(t.session.systemPrompt).not.toContain("<name>manual</name>");
129 + expect(names).not.toContain("wrong-host");
130 + expect(names).not.toContain("unconditional");
131 + expect(
132 + t.session.extensionRunner.extensions.map((entry) => entry.path),
133 + ).toContain(extension);
134 + const expand = t.session as unknown as {
135 + _expandSkillCommand(text: string): string;
136 + };
137 + expect(expand._expandSkillCommand("/skill:matched")).toContain(
138 + '<skill name="matched"',
139 + );
140 + expect(expand._expandSkillCommand("/skill:manual")).toContain(
141 + '<skill name="manual"',
142 + );
143 + expect(expand._expandSkillCommand("/skill:wrong-host")).toBe(
144 + "/skill:wrong-host",
145 + );
146 + });
148 + it("adds no prompt text without matching skills", async () => {
149 + const root = mkdtempSync(path.join(os.tmpdir(), "skillz-context-"));
150 + roots.push(root);
151 + const agentDir = path.join(root, "agent");
152 + skill(agentDir, "conditional", "path: marker\n");
153 + const env = { PI_CODING_AGENT_DIR: agentDir };
154 + const baseline = await createTestSession({ cwd: root, env });
155 + const without = baseline.session.systemPrompt;
156 + baseline.dispose();
157 + t = await createTestSession({ cwd: root, extensions: [extension], env });
158 + expect(t.session.systemPrompt).toBe(without);
159 + writeFileSync(path.join(root, "marker"), "");
160 + await t.session.reload();
161 + expect(t.session.systemPrompt.length).toBeGreaterThan(without.length);
162 + });
164 + it("reports eligible skills at startup but only warnings on reload", async () => {
165 + const root = mkdtempSync(path.join(os.tmpdir(), "skillz-notify-"));
166 + roots.push(root);
167 + const agentDir = path.join(root, "agent");
168 + skill(agentDir, "invalid", "os: linux\n");
169 + t = await createTestSession({
170 + cwd: root,
171 + extensions: [extension],
172 + env: { PI_CODING_AGENT_DIR: agentDir },
173 + });
174 + skill(agentDir, "first", "os: [lnx, mac, win32]\n");
175 + await t.session.bindExtensions({ mode: "tui" });
176 + expect(
177 + t.events.uiCallsFor("notify").map((notice) => notice.args),
178 + ).toContainEqual(["skillz: eligible: first", "info"]);
179 + skill(agentDir, "second", "os: [lnx, mac, win32]\n");
180 + t.events.ui.length = 0;
181 + await t.session.reload();
182 + const notices = t.events.uiCallsFor("notify");
183 + expect(notices.some((notice) => notice.args[1] === "info")).toBe(false);
184 + expect(notices.some((notice) => notice.args[1] === "warning")).toBe(true);
185 + expect(
186 + t.session.resourceLoader.getSkills().skills.map((skill) => skill.name),
187 + ).toContain("second");
188 + });
190 + it("reevaluates markers after reload", async () => {
191 + const root = mkdtempSync(path.join(os.tmpdir(), "skillz-reload-"));
192 + roots.push(root);
193 + const agentDir = path.join(root, "agent");
194 + skill(agentDir, "conditional", "path: marker\n");
195 + t = await createTestSession({
196 + cwd: root,
197 + extensions: [extension],
198 + env: { PI_CODING_AGENT_DIR: agentDir },
199 + });
200 + expect(
201 + t.session.resourceLoader
202 + .getSkills()
203 + .skills.some((entry) => entry.name === "conditional"),
204 + ).toBe(false);
205 + writeFileSync(path.join(root, "marker"), "");
206 + await t.session.reload();
207 + expect(
208 + t.session.resourceLoader
209 + .getSkills()
210 + .skills.some((entry) => entry.name === "conditional"),
211 + ).toBe(true);
212 + rmSync(path.join(root, "marker"));
213 + await t.session.reload();
214 + expect(
215 + t.session.resourceLoader
216 + .getSkills()
217 + .skills.some((entry) => entry.name === "conditional"),
218 + ).toBe(false);
219 + });
221 + it("preserves native skill on name collision and follows linked skill files", async () => {
222 + const root = mkdtempSync(path.join(os.tmpdir(), "skillz-collision-"));
223 + roots.push(root);
224 + const agentDir = path.join(root, "agent");
225 + const native = path.join(root, "skills", "duplicate");
226 + mkdirSync(native, { recursive: true });
227 + writeFileSync(
228 + path.join(native, "SKILL.md"),
229 + "---\nname: duplicate\ndescription: Native skill\n---\n\n# Native\n",
230 + );
231 + skill(agentDir, "duplicate", "os: [lnx, mac, win32]\n");
232 + const outside = path.join(root, "outside");
233 + mkdirSync(outside);
234 + writeFileSync(
235 + path.join(outside, "SKILL.md"),
236 + "---\nname: linked\ndescription: Linked skill\nos: [lnx, mac, win32]\n---\n\n# Linked\n",
237 + );
238 + const linked = path.join(agentDir, "skillz", "linked");
239 + mkdirSync(linked);
240 + symlinkSync(path.join(outside, "SKILL.md"), path.join(linked, "SKILL.md"));
241 + t = await createTestSession({
242 + cwd: root,
243 + extensions: [extension],
244 + env: { PI_CODING_AGENT_DIR: agentDir },
245 + });
246 + const result = t.session.resourceLoader.getSkills();
247 + const loaded = result.skills;
248 + expect(result.diagnostics.some((entry) => entry.type === "collision")).toBe(
249 + false,
250 + );
251 + expect(loaded.filter((entry) => entry.name === "duplicate")).toHaveLength(
252 + 1,
253 + );
254 + expect(
255 + loaded.find((entry) => entry.name === "duplicate")?.description,
256 + ).toBe("Native skill");
257 + expect(loaded.some((entry) => entry.name === "linked")).toBe(true);
258 + });
259 +});

extensions/skillz/index.ts

Added
new file mode 100644
1 +import { readFileSync } from "node:fs";
2 +import { join } from "node:path";
3 +import {
4 + type ExtensionAPI,
5 + getAgentDir,
6 + loadSkillsFromDir,
7 + parseFrontmatter,
8 +} from "@earendil-works/pi-coding-agent";
9 +import { matchSkill } from "./match.ts";
11 +export default function skillz(pi: ExtensionAPI) {
12 + pi.on("resources_discover", (event, ctx) => {
13 + const root = join(getAgentDir(), "skillz");
14 + const discovered = loadSkillsFromDir({ dir: root, source: "user" });
15 + for (const diagnostic of discovered.diagnostics)
16 + ctx.ui.notify(
17 + `skillz: ${diagnostic.path}: ${diagnostic.message}`,
18 + "warning",
19 + );
20 + const existing = new Set(
21 + pi
22 + .getCommands()
23 + .filter((command) => command.source === "skill")
24 + .map((command) => command.name.slice("skill:".length)),
25 + );
26 + const skillPaths: string[] = [];
27 + const names: string[] = [];
28 + for (const skill of discovered.skills) {
29 + let frontmatter: Record<string, unknown>;
30 + try {
31 + frontmatter = parseFrontmatter(
32 + readFileSync(skill.filePath, "utf8"),
33 + ).frontmatter;
34 + } catch {
35 + ctx.ui.notify(
36 + `skillz: invalid frontmatter: ${skill.filePath}`,
37 + "warning",
38 + );
39 + continue;
40 + }
41 + const match = matchSkill(frontmatter, event.cwd);
42 + if (match.error) {
43 + ctx.ui.notify(`skillz: ${skill.filePath}: ${match.error}`, "warning");
44 + continue;
45 + }
46 + if (!match.matches) continue;
47 + if (existing.has(skill.name)) {
48 + ctx.ui.notify(
49 + `skillz: duplicate skill name ${skill.name}: ${skill.filePath}`,
50 + "warning",
51 + );
52 + continue;
53 + }
54 + existing.add(skill.name);
55 + skillPaths.push(skill.filePath);
56 + names.push(skill.name);
57 + }
58 + if (event.reason !== "reload" && ctx.mode === "tui" && names.length > 0)
59 + ctx.ui.notify(`skillz: eligible: ${names.join(", ")}`, "info");
60 + return { skillPaths };
61 + });

extensions/skillz/match.ts

Added
new file mode 100644
1 +import { lstatSync } from "node:fs";
2 +import { hostname } from "node:os";
3 +import { isAbsolute, join, win32 } from "node:path";
5 +const platforms: Record<string, string> = {
6 + lnx: "linux",
7 + win32: "win32",
8 + mac: "darwin",
9 +};
11 +function values(value: unknown): string[] | undefined {
12 + const items = typeof value === "string" ? [value] : value;
13 + return Array.isArray(items) &&
14 + items.length > 0 &&
15 + items.every((item) => typeof item === "string" && item.length > 0)
16 + ? items
17 + : undefined;
20 +function validMarker(marker: string): boolean {
21 + return !(
22 + marker.includes("\\") ||
23 + marker.includes("\0") ||
24 + isAbsolute(marker) ||
25 + win32.isAbsolute(marker) ||
26 + marker
27 + .split("/")
28 + .some(
29 + (part) => !part || part === "." || part === ".." || part.includes(":"),
30 + )
31 + );
34 +function markerExists(cwd: string, marker: string): boolean {
35 + let current = cwd;
36 + try {
37 + for (const part of marker.split("/")) {
38 + current = join(current, part);
39 + if (lstatSync(current).isSymbolicLink()) return false;
40 + }
41 + return true;
42 + } catch {
43 + return false;
44 + }
47 +export function matchSkill(
48 + frontmatter: Record<string, unknown>,
49 + cwd: string,
50 + platform = process.platform,
51 + host = hostname(),
52 +): { matches: boolean; error?: string } {
53 + const keys = ["os", "host", "path"] as const;
54 + if (!keys.some((key) => key in frontmatter))
55 + return { matches: false, error: "missing os, host, or path condition" };
56 + let os: string[] | undefined;
57 + let hosts: string[] | undefined;
58 + let paths: string[] | undefined;
59 + for (const key of keys) {
60 + if (!(key in frontmatter)) continue;
61 + const entries = values(frontmatter[key]);
62 + if (!entries) return { matches: false, error: `invalid ${key} condition` };
63 + if (key === "os" && entries.some((entry) => !(entry in platforms)))
64 + return {
65 + matches: false,
66 + error: "invalid os condition (expected lnx, win32, or mac)",
67 + };
68 + if (key === "path" && entries.some((entry) => !validMarker(entry)))
69 + return { matches: false, error: "invalid path condition" };
70 + if (key === "os") os = entries;
71 + else if (key === "host") hosts = entries;
72 + else paths = entries;
73 + }
74 + return {
75 + matches:
76 + (!os || os.some((entry) => platforms[entry] === platform)) &&
77 + (!hosts || hosts.includes(host)) &&
78 + (!paths || paths.some((entry) => markerExists(cwd, entry))),
79 + };

extensions/skillz/mise.toml

Added
new file mode 100644
1 +[tasks.bench]
2 +description = "Benchmark skillz resource discovery"
3 +depends = ["//:install"]
4 +run = "node --no-warnings --experimental-strip-types __bench__/discovery.bench.ts"
6 +[tasks.profile]
7 +description = "Profile skillz resource discovery"
8 +depends = ["//:install"]
9 +run = [
10 + '''node -e "require('node:fs').mkdirSync(require('node:path').join(require('node:os').tmpdir(), 'pi-ext-skillz-profile'), { recursive: true })"''',
11 + "node --no-warnings --experimental-strip-types --cpu-prof --cpu-prof-dir ${TMPDIR:-/tmp}/pi-ext-skillz-profile --cpu-prof-name discovery.cpuprofile __bench__/discovery.bench.ts",
14 +[tasks.benchstat]
15 +description = "Compare skillz benchmark samples"
16 +depends = ["//:install"]
17 +usage = '''
18 +arg "<baseline>"
19 +arg "<candidate>"
20 +'''
21 +run = 'benchstat "{{ usage.baseline }}" "{{ usage.candidate }}"'
23 +[tasks.fmt]
24 +description = "Format skillz extension"
25 +depends = ["//:install"]
26 +run = [
27 + "biome check --write --config-path ../.. .",
28 + "rumdl fmt --config ../../.rumdl.toml .",
29 + "taplo format --config ../../.taplo.toml mise.toml",
32 +[tasks.lint]
33 +description = "Lint skillz extension"
34 +depends = ["//:install"]
35 +run = [
36 + "biome ci --config-path ../.. .",
37 + "rumdl check --config ../../.rumdl.toml .",
38 + "taplo format --check --config ../../.taplo.toml mise.toml",
41 +[tasks.test]
42 +description = "Test skillz extension"
43 +depends = ["//:install"]
44 +run = [
45 + { task = "//:test", args = ["extensions/skillz"] },
48 +[tasks.check]
49 +description = "Check skillz extension"
50 +depends = ["//:install"]
51 +run = [
52 + { task = "//:build", args = ["skillz"] },

extensions/skillz/package.json

Added
new file mode 100644
1 +{
2 + "name": "@bugabinga/pi-ext-skillz",
3 + "type": "module",
4 + "main": "index.ts",
5 + "peerDependencies": {
6 + "@earendil-works/pi-coding-agent": "*"
7 + },
8 + "license": "MIT",
9 + "description": "Conditionally discover personal Pi skills by OS, hostname, and cwd marker.",
10 + "keywords": [
11 + "pi",
12 + "pi-extension"
13 + ],
14 + "devDependencies": {
15 + "@marcfargas/pi-test-harness": "^0.6.1",
16 + "vitest": "^4.1.9"
17 + },
18 + "private": true

package-lock.json

Modified
366 366 "@earendil-works/pi-coding-agent": "*"
369 + "extensions/skillz": {
370 + "name": "@bugabinga/pi-ext-skillz",
371 + "license": "MIT",
372 + "devDependencies": {
373 + "@marcfargas/pi-test-harness": "^0.6.1",
374 + "vitest": "^4.1.9"
375 + },
376 + "peerDependencies": {
377 + "@earendil-works/pi-coding-agent": "*"
379 + },
369 380 "extensions/strata": {
370 381 "name": "@bugabinga/pi-ext-strata",
371 382 "license": "MIT",
1367 1378 "resolved": "extensions/session-rename",
1368 1379 "link": true
1381 + "node_modules/@bugabinga/pi-ext-skillz": {
1382 + "resolved": "extensions/skillz",
1383 + "link": true
1384 + },
1370 1385 "node_modules/@bugabinga/pi-ext-strata": {
1371 1386 "resolved": "extensions/strata",
1372 1387 "link": true