@kmiyh/pi-skills-menu 1.2.0 → 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
@@ -1,14 +1,25 @@
1
1
  # @kmiyh/pi-skills-menu
2
2
 
3
- `@kmiyh/pi-skills-menu` is a Pi Agent extension that moves all skills out of Pi's main menu into a separate menu opened with:
3
+ `@kmiyh/pi-skills-menu` is a Pi extension that moves skill browsing and selection into a dedicated `/skills` menu.
4
+
5
+ Instead of filling Pi's main menu with many `/skill:<name>` entries, it gives you one focused place to search, preview, insert, create, edit, rename, delete, and enable or disable skills.
6
+
7
+ ## Why use it
8
+
9
+ - keeps the main menu cleaner when many skills are installed
10
+ - puts project, global, and package-provided skills in one searchable list
11
+ - makes skill selection faster in interactive sessions
12
+ - lets you manage your own skills without leaving the TUI
13
+
14
+ ## Installation
4
15
 
5
16
  ```bash
6
- /skills
17
+ pi install npm:@kmiyh/pi-skills-menu
7
18
  ```
8
19
 
9
- The idea behind the extension is simple: **keep the main menu from getting cluttered** and make it at least a bit easier to navigate when many skills are installed.
20
+ ## What changes after installation
10
21
 
11
- When the extension is installed, it automatically writes the following to `settings.json`:
22
+ When the extension is installed, it automatically writes this to `settings.json`:
12
23
 
13
24
  ```json
14
25
  {
@@ -16,135 +27,150 @@ When the extension is installed, it automatically writes the following to `setti
16
27
  }
17
28
  ```
18
29
 
19
- This disables the default `/skill:<name>` command registration in the main menu and moves skill usage into one dedicated menu.
30
+ That disables the default `/skill:<name>` command registration in the main menu and replaces it with a single `/skills` entry.
20
31
 
21
- ## Installation
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.
22
33
 
23
- It can be installed with:
34
+ When you insert a skill from the menu, the extension adds a marker like this to the editor:
24
35
 
25
- ```bash
26
- pi install npm:@kmiyh/pi-skills-menu
36
+ ```text
37
+ [skill] my-skill
27
38
  ```
28
39
 
29
- ## What the `/skills` menu contains
40
+ Before the message is sent, Pi expands that marker into the actual skill content.
30
41
 
31
- The menu shows **all installed available skills**:
42
+ ## What the `/skills` menu shows
43
+
44
+ The menu includes all available installed skills:
32
45
 
33
- - global skills
34
46
  - project skills
35
- - skills coming from other installed libraries/packages
47
+ - global skills
48
+ - skills provided by installed packages/libraries
36
49
 
37
- The list is split into two sections:
50
+ The list is grouped into:
38
51
 
39
- - **Your Skills** — the user's own skills
40
- - **Library Skills** — skills coming from other installed libraries
52
+ - **Your Skills** — your own project and global skills
53
+ - **Library Skills** — skills coming from installed packages
41
54
 
42
55
  ![skills-menu.jpg](src/images/skills-menu.jpg)
43
56
 
44
- ## What the menu can do
57
+ ## What you can do in `/skills`
45
58
 
46
- ### Search
59
+ | Action | Shortcut | Notes |
60
+ | --- | --- | --- |
61
+ | Filter skills by name | type | Search works directly in the list |
62
+ | Open preview | `Tab` | Shows full metadata and content |
63
+ | Insert selected skill | `Enter` | Works only for enabled skills |
64
+ | Enable or disable a skill | `Ctrl+X` | Works for your skills and library skills |
65
+ | Create a new skill | `Enter` on **Create new skill** | Opens the creation flow |
66
+ | Delete your own skill | `Backspace` | Available only for project/global skills you own |
47
67
 
48
- The menu includes a search field for filtering skills by name.
68
+ ### Preview a skill
49
69
 
50
- ### Skill preview
70
+ Press `Tab` on a selected skill to open preview mode.
51
71
 
52
- Press:
72
+ The preview shows:
53
73
 
54
- - `Tab` — open the selected skill in preview mode
74
+ - the skill name and scope
75
+ - its source path or package
76
+ - whether it is enabled or disabled
77
+ - the full frontmatter
78
+ - the full skill content with scrolling support
55
79
 
56
80
  ![skill-preview.jpg](src/images/skill-preview.jpg)
57
81
 
58
82
  ### Insert a skill into the editor
59
83
 
60
- Press:
61
-
62
- - `Enter` — select an enabled skill and insert it into the editor
84
+ Press `Enter` on an enabled skill to insert it into the editor.
63
85
 
64
- After that, the skill is inserted into the editor so it will be used by Pi when the message is sent.
86
+ This is useful when you want to explicitly attach one or more skills to the message you are writing, without manually copying skill content.
65
87
 
66
88
  ### Enable or disable a skill
67
89
 
68
- Press:
90
+ Press `Ctrl+X` to toggle the selected skill.
69
91
 
70
- - `Ctrl+X` toggle the selected skill between enabled and disabled
92
+ Disabled skills stay visible in the list and are marked with `[disabled]`, so you can still find them and re-enable them later.
71
93
 
72
- This also works for skills that come from installed libraries/packages.
94
+ This also works for skills that come from installed packages.
73
95
 
74
- Disabled skills stay visible in the list and are marked with:
96
+ ![skill-disable.jpg](src/images/skill-disable.jpg)
75
97
 
76
- - `[disabled]`
98
+ ## Creating a new skill
77
99
 
78
- ### Create a new skill
100
+ The first row in the menu is **Create new skill**.
79
101
 
80
- The list also contains a dedicated entry for creating a new skill.
102
+ Creation is split into three short steps:
81
103
 
82
- Skill creation is done in three steps:
104
+ 1. **Name** the skill folder/name slug
105
+ 2. **Description** — one clear sentence describing what the skill does and when Pi should use it
106
+ 3. **Visibility** — whether the skill should be saved globally or only for the current project
83
107
 
84
- 1. **skill name**
108
+ ### 1. Name
85
109
 
86
110
  ![skill-create-name.jpg](src/images/skill-create-name.jpg)
87
111
 
88
- 2. **skill description**
112
+ ### 2. Description
89
113
 
90
114
  ![skill-create-description.jpg](src/images/skill-create-description.jpg)
91
115
 
92
- 3. **skill visibility**
93
- - **Global** — save the skill in your user-level Pi skills directory
94
- - **Project** — save the skill in the current project's `.pi/skills` directory
116
+ ### 3. Visibility
95
117
 
96
- After that, the extension generates a `SKILL.md`.
118
+ ![skill-create-visibility.jpg](src/images/skill-create-visibility.jpg)
119
+
120
+ After that, the extension generates `SKILL.md` for you.
97
121
 
98
122
  Generation uses:
99
123
 
100
- - the **currently selected model in the TUI**
101
- - the **currently selected thinking level** in the TUI
124
+ - the model currently selected in the TUI
125
+ - the current thinking level selected in the TUI
126
+
127
+ So the draft follows the model configuration already active in your Pi session.
102
128
 
103
- So skill generation always follows the exact model configuration already active in the current Pi session.
129
+ ![skill-create-generate.jpg](src/images/skill-create-generate.jpg)
104
130
 
105
- ![skill-create-generating.jpg](src/images/skill-create-generating.jpg)
131
+ ## Editing, renaming, and deleting your own skills
106
132
 
107
- ## Skill preview
133
+ Your own project and global skills can be managed directly from preview mode.
108
134
 
109
- The preview opened with `Tab` contains:
135
+ Library skills can be previewed, inserted, and enabled/disabled, but they cannot be edited, renamed, or deleted from this menu.
110
136
 
111
- - the full skill text
112
- - scrolling support for reading the content
137
+ ### Edit skill content
113
138
 
114
- From preview mode, you can also use quick actions:
139
+ In preview mode, press `e` to edit the skill content and metadata body.
115
140
 
116
- - `r` edit the skill name
141
+ Use `Ctrl+S` to save.
117
142
 
118
143
  ![skill-edit.jpg](src/images/skill-edit.jpg)
119
144
 
120
- - `e` edit the skill content itself
145
+ ### Rename a skill
121
146
 
122
- ![skill-rename.jpg](src/images/skill-rename.jpg)
147
+ In preview mode, press `r` to rename the skill.
123
148
 
124
- ## Where new skills are saved
149
+ This updates both the directory name and the `name` field in frontmatter.
125
150
 
126
- New skills are saved into Pi's standard skill directories depending on the selected scope.
151
+ ![skill-rename.jpg](src/images/skill-rename.jpg)
127
152
 
128
- ### Project scope
153
+ ### Delete a skill
129
154
 
130
- If project scope is selected, the skill is saved here:
155
+ In browse mode or preview mode, press `Backspace` to delete your own skill.
131
156
 
132
- ```text
133
- .pi/skills/<skill-name>/SKILL.md
134
- ```
157
+ A confirmation dialog is shown before removal.
135
158
 
136
- Example:
159
+ ![skill-delete.jpg](src/images/skill-delete.jpg)
137
160
 
138
- ```text
139
- .pi/skills/react-review/SKILL.md
140
- ```
161
+ ## Where new skills are saved
162
+
163
+ New skills are stored in Pi's standard skill directories depending on the selected visibility.
141
164
 
142
- ### Global scope
165
+ | Visibility | Path |
166
+ | --- | --- |
167
+ | Project | `.pi/skills/<skill-name>/SKILL.md` |
168
+ | Global | `~/.pi/agent/skills/<skill-name>/SKILL.md` |
143
169
 
144
- If global scope is selected, the skill is saved here:
170
+ Example project skill:
145
171
 
146
172
  ```text
147
- ~/.pi/agent/skills/<skill-name>/SKILL.md
173
+ .pi/skills/react-review/SKILL.md
148
174
  ```
149
175
 
150
176
  ## Local development
@@ -167,31 +193,29 @@ Run the extension directly from a local checkout:
167
193
  pi -e ./src/index.ts
168
194
  ```
169
195
 
170
- ## How to help improve the extension
196
+ ## Contributing
171
197
 
172
- If you want to help improve the extension, you can:
198
+ Contributions are welcome, especially around:
173
199
 
174
- - report bugs and UX issues
175
- - suggest improvements to the `/skills` menu
176
- - improve skill generation quality
177
- - improve search and list navigation
178
- - improve editing and preview flows
179
- - suggest improvements to project structure and Pi package support
180
- - etc
200
+ - menu UX and navigation
201
+ - skill search and filtering
202
+ - preview and editing flows
203
+ - skill generation quality
204
+ - Pi package compatibility
181
205
 
182
- A typical contribution workflow:
206
+ Typical workflow:
183
207
 
184
208
  1. fork the repository
185
- 2. create a separate branch
209
+ 2. create a branch
186
210
  3. make your changes
187
- 4. verify everything with:
211
+ 4. verify with:
188
212
 
189
213
  ```bash
190
214
  npm install
191
215
  npm run typecheck
192
216
  ```
193
217
 
194
- 5. test locally
218
+ 5. test locally:
195
219
 
196
220
  ```bash
197
221
  pi -e ./src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmiyh/pi-skills-menu",
3
- "version": "1.2.0",
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": [
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
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;