@xynogen/pix-skills 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-skills",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "Pi extension — agent skill loader (skill tool + skills bundle)",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/directive.ts CHANGED
@@ -37,12 +37,7 @@ export function findCommandDirectives(content: string): CommandDirective[] {
37
37
  }
38
38
 
39
39
  /** Replace the [start, end) slice of `s` with `text`. */
40
- export function replaceSpan(
41
- s: string,
42
- start: number,
43
- end: number,
44
- text: string,
45
- ): string {
40
+ export function replaceSpan(s: string, start: number, end: number, text: string): string {
46
41
  return s.slice(0, start) + text + s.slice(end);
47
42
  }
48
43
 
package/src/index.test.ts CHANGED
@@ -46,9 +46,7 @@ describe("extractName", () => {
46
46
 
47
47
  describe("extractDescription", () => {
48
48
  it("reads description from frontmatter", () => {
49
- expect(extractDescription(FRONTMATTER)).toBe(
50
- "Split, write, and maintain commits.",
51
- );
49
+ expect(extractDescription(FRONTMATTER)).toBe("Split, write, and maintain commits.");
52
50
  });
53
51
 
54
52
  it("returns null when absent", () => {
@@ -67,9 +65,7 @@ describe("formatSkillSummary", () => {
67
65
 
68
66
  it("renders single skill as bold-accent name + muted description", () => {
69
67
  const out = formatSkillSummary(FRONTMATTER, tagTheme);
70
- expect(out).toBe(
71
- "[accent]<b>commit</b>[/] [muted]Split, write, and maintain commits.[/]",
72
- );
68
+ expect(out).toBe("[accent]<b>commit</b>[/] [muted]Split, write, and maintain commits.[/]");
73
69
  });
74
70
 
75
71
  it("falls back to (no description) when frontmatter has name only", () => {
@@ -83,9 +79,7 @@ describe("formatSkillSummary", () => {
83
79
  const lines = out.split("\n");
84
80
  expect(lines).toHaveLength(2);
85
81
  expect(lines[0]).toBe("[accent]<b>commit</b>[/] [muted]write commits[/]");
86
- expect(lines[1]).toBe(
87
- "[accent]<b>debug</b>[/] [muted]root cause analysis[/]",
88
- );
82
+ expect(lines[1]).toBe("[accent]<b>debug</b>[/] [muted]root cause analysis[/]");
89
83
  });
90
84
 
91
85
  it("passes non 'name: desc' lines through as muted", () => {
@@ -112,9 +106,10 @@ describe("findCommandDirectives", () => {
112
106
  });
113
107
 
114
108
  it("finds multiple", () => {
115
- expect(
116
- findCommandDirectives("!`pwd` !`git diff`").map((d) => d.command),
117
- ).toEqual(["pwd", "git diff"]);
109
+ expect(findCommandDirectives("!`pwd` !`git diff`").map((d) => d.command)).toEqual([
110
+ "pwd",
111
+ "git diff",
112
+ ]);
118
113
  });
119
114
  });
120
115
 
@@ -125,20 +120,7 @@ describe("replaceSpan", () => {
125
120
  });
126
121
 
127
122
  describe("hasShellMeta", () => {
128
- for (const ch of [
129
- ";",
130
- "|",
131
- "&",
132
- "$",
133
- "`",
134
- ">",
135
- "<",
136
- "(",
137
- ")",
138
- "{",
139
- "}",
140
- "\n",
141
- ]) {
123
+ for (const ch of [";", "|", "&", "$", "`", ">", "<", "(", ")", "{", "}", "\n"]) {
142
124
  it(`flags ${JSON.stringify(ch)}`, () => {
143
125
  expect(hasShellMeta(`git status ${ch}`)).toBe(true);
144
126
  });
package/src/index.ts CHANGED
@@ -198,8 +198,7 @@ export function formatSkillSummary(text: string, theme: ThemeLike): string {
198
198
  const ParamsSchema = Type.Object({
199
199
  name: Type.Optional(
200
200
  Type.String({
201
- description:
202
- 'Skill name, e.g. "commit", "debug". Omit to list all skills.',
201
+ description: 'Skill name, e.g. "commit", "debug". Omit to list all skills.',
203
202
  }),
204
203
  ),
205
204
  full: Type.Optional(
@@ -218,13 +217,7 @@ function registerSkillLoader(pi: ExtensionAPI): void {
218
217
  description:
219
218
  "Browse and load bundled skills. No args → list all skills with descriptions. name only → description for that skill. name + full=true → full instructions.",
220
219
  promptSnippet: "Browse and load bundled skill instructions",
221
- promptGuidelines: [
222
- "Skills are NOT pre-listed in this prompt. When a task may match a specialized procedure, call read_skills() first to discover what is available.",
223
- "Call read_skills() with no arguments to list all available skills and their descriptions.",
224
- "Call read_skills(name=<skill>) to read the description of a specific skill before deciding to load it.",
225
- "Call read_skills(name=<skill>, full=true) to load the full procedure for a skill before executing it.",
226
- "Prefer read_skills() over the read tool for skills — it resolves the correct path regardless of install location.",
227
- ],
220
+ promptGuidelines: ["Matching skill? Call read_skills() first."],
228
221
  executionMode: "sequential",
229
222
  parameters: ParamsSchema,
230
223
 
@@ -256,22 +249,16 @@ function registerSkillLoader(pi: ExtensionAPI): void {
256
249
  }
257
250
  });
258
251
 
259
- return ok(
260
- `Available skills (${skills.length}):\n\n${lines.join("\n")}`,
261
- );
252
+ return ok(`Available skills (${skills.length}):\n\n${lines.join("\n")}`);
262
253
  }
263
254
 
264
255
  // Resolve skill
265
256
  const skills = discoverSkills();
266
- const entry = skills.find(
267
- (s) => s.name === name || s.name === name.replace(/\.md$/, ""),
268
- );
257
+ const entry = skills.find((s) => s.name === name || s.name === name.replace(/\.md$/, ""));
269
258
 
270
259
  if (!entry) {
271
260
  const names = skills.map((s) => s.name).join(", ");
272
- return fail(
273
- `Skill "${name}" not found. Available: ${names || "(none)"}`,
274
- );
261
+ return fail(`Skill "${name}" not found. Available: ${names || "(none)"}`);
275
262
  }
276
263
 
277
264
  try {
@@ -280,9 +267,7 @@ function registerSkillLoader(pi: ExtensionAPI): void {
280
267
  // full=false (default) → description only
281
268
  if (!full) {
282
269
  const desc = extractDescription(content);
283
- return ok(
284
- desc ? `${entry.name}: ${desc}` : `${entry.name}: (no description)`,
285
- );
270
+ return ok(desc ? `${entry.name}: ${desc}` : `${entry.name}: (no description)`);
286
271
  }
287
272
 
288
273
  // full=true → interpolate !`cmd` directives (pix-gate-gated, no
@@ -292,9 +277,7 @@ function registerSkillLoader(pi: ExtensionAPI): void {
292
277
  return ok(expanded);
293
278
  } catch (err) {
294
279
  return fail(
295
- `Failed to read skill "${name}": ${
296
- err instanceof Error ? err.message : String(err)
297
- }`,
280
+ `Failed to read skill "${name}": ${err instanceof Error ? err.message : String(err)}`,
298
281
  );
299
282
  }
300
283
  },
package/src/run.test.ts CHANGED
@@ -3,9 +3,7 @@ import { runArgv } from "./run.ts";
3
3
 
4
4
  describe("runArgv", () => {
5
5
  it("captures stdout", async () => {
6
- expect(
7
- (await runArgv(["echo", "hello"], { cwd: process.cwd() })).trim(),
8
- ).toBe("hello");
6
+ expect((await runArgv(["echo", "hello"], { cwd: process.cwd() })).trim()).toBe("hello");
9
7
  });
10
8
 
11
9
  it("caps output at maxBytes", async () => {
package/src/run.ts CHANGED
@@ -40,9 +40,7 @@ export function runArgv(argv: string[], opts: RunOptions): Promise<string> {
40
40
  stdio: ["ignore", "pipe", "pipe"],
41
41
  });
42
42
  } catch (err) {
43
- finish(
44
- `[command failed: ${err instanceof Error ? err.message : String(err)}]`,
45
- );
43
+ finish(`[command failed: ${err instanceof Error ? err.message : String(err)}]`);
46
44
  return;
47
45
  }
48
46
 
@@ -73,7 +71,6 @@ function format(
73
71
  truncMarker = "[output truncated]",
74
72
  ): string {
75
73
  const combined = Buffer.concat(chunks).toString("utf-8").trimEnd();
76
- if (bytes > maxBytes)
77
- return `${combined.slice(0, maxBytes)}\n… ${truncMarker}`;
74
+ if (bytes > maxBytes) return `${combined.slice(0, maxBytes)}\n… ${truncMarker}`;
78
75
  return combined || "(no output)";
79
76
  }