@kmiyh/pi-skills-menu 1.2.1 → 1.2.2

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/README.md CHANGED
@@ -29,6 +29,8 @@ When the extension is installed, it automatically writes this to `settings.json`
29
29
 
30
30
  That disables the default `/skill:<name>` command registration in the main menu and replaces it with a single `/skills` entry.
31
31
 
32
+ The extension also hides Pi's standard startup `[Skills]` block, so installed skills are shown only through the dedicated `/skills` UI instead of the default startup listing.
33
+
32
34
  When you insert a skill from the menu, the extension adds a marker like this to the editor:
33
35
 
34
36
  ```text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmiyh/pi-skills-menu",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Pi extension that moves skills into a dedicated /skills menu with browsing, preview, editing, and AI-assisted creation.",
5
5
  "type": "module",
6
6
  "keywords": [
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ExtensionAPI, ExtensionContext, InputEventResult } from "@mariozechner/pi-coding-agent";
1
+ import { InteractiveMode, type ExtensionAPI, type ExtensionContext, type InputEventResult } from "@mariozechner/pi-coding-agent";
2
2
  import { createSkillFromAnswersWithoutUI } from "./create-skill.js";
3
3
  import { deleteSkill } from "./delete-skill.js";
4
4
  import { detectExtensionInstallScope } from "./extension-scope.js";
@@ -15,7 +15,58 @@ const EMPTY_REGISTRY: SkillRegistry = {
15
15
  byName: new Map(),
16
16
  };
17
17
 
18
+ const HIDE_STARTUP_SKILLS_BLOCK_PATCH = Symbol.for("@kmiyh/pi-skills-menu/hide-startup-skills-block");
19
+
20
+ type InteractiveModePrototype = {
21
+ showLoadedResources?: (...args: unknown[]) => unknown;
22
+ [HIDE_STARTUP_SKILLS_BLOCK_PATCH]?: boolean;
23
+ };
24
+
25
+ function patchInteractiveModeStartupSkillsBlock(): void {
26
+ const prototype = InteractiveMode.prototype as unknown as InteractiveModePrototype;
27
+ if (prototype[HIDE_STARTUP_SKILLS_BLOCK_PATCH]) {
28
+ return;
29
+ }
30
+
31
+ const originalShowLoadedResources = prototype.showLoadedResources;
32
+ if (typeof originalShowLoadedResources !== "function") {
33
+ return;
34
+ }
35
+
36
+ prototype.showLoadedResources = function patchedShowLoadedResources(this: unknown, ...args: unknown[]) {
37
+ const interactiveMode = this as {
38
+ session?: {
39
+ resourceLoader?: {
40
+ getSkills?: () => { skills: unknown[]; diagnostics?: unknown[] };
41
+ };
42
+ };
43
+ };
44
+ const resourceLoader = interactiveMode.session?.resourceLoader;
45
+ if (!resourceLoader || typeof resourceLoader.getSkills !== "function") {
46
+ return originalShowLoadedResources.apply(this, args);
47
+ }
48
+ const originalGetSkills = resourceLoader.getSkills;
49
+
50
+ resourceLoader.getSkills = () => {
51
+ const result = originalGetSkills.call(resourceLoader);
52
+ return {
53
+ ...result,
54
+ skills: [],
55
+ };
56
+ };
57
+
58
+ try {
59
+ return originalShowLoadedResources.apply(this, args);
60
+ } finally {
61
+ resourceLoader.getSkills = originalGetSkills;
62
+ }
63
+ };
64
+
65
+ prototype[HIDE_STARTUP_SKILLS_BLOCK_PATCH] = true;
66
+ }
67
+
18
68
  export default function skillsMenuExtension(pi: ExtensionAPI) {
69
+ patchInteractiveModeStartupSkillsBlock();
19
70
  let registry: SkillRegistry = EMPTY_REGISTRY;
20
71
  let currentCwd: string | undefined;
21
72
  let installScope: ExtensionInstallScope | undefined;