@zaganjade/pi-multi-skill 1.0.0 → 1.3.1

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,48 +1,484 @@
1
1
  # pi-multi-skill
2
2
 
3
- Load multiple skills at once in [pi](https://github.com/earendil-works/pi-mono) via the `/skills` command.
3
+ Load multiple skills at once in [pi](https://github.com/earendil-works/pi-mono) via the `/skills` command — with preset bundles, token-efficient load modes, BMAD auto-routing, and Claude Code-style orchestration.
4
+
5
+ **Version 1.3.0** — skill chaining, bundle presets, conflict resolution, parallel dispatch, activation stats, `/skills-last`, `/skills-setup`, and bundle attribution in pi-usage.
6
+
7
+ ---
8
+
9
+ ## 🚀 Install
10
+
11
+ > ⚠️ **Use `pi install` — NOT `npm install`.**
12
+ > Plain `npm install` only drops files in `node_modules`. Pi does **not** scan
13
+ > that folder, so the package is **never detected** and `/skills` won't appear.
14
+ > You must register it with `pi install` so it lands in `"packages"` in
15
+ > `~/.pi/agent/settings.json`.
16
+
17
+ ```bash
18
+ pi install npm:@zaganjade/pi-multi-skill
19
+ ```
20
+
21
+ Then inside pi:
22
+
23
+ ```
24
+ /reload
25
+ ```
26
+
27
+ Verify it loaded:
28
+
29
+ ```bash
30
+ pi list # should show npm:@zaganjade/pi-multi-skill
31
+ ```
32
+
33
+ Type `/` — `/skills` should appear in slash autocomplete.
34
+
35
+ **Don't do this** (common mistake — package installs but pi ignores it):
36
+
37
+ ```bash
38
+ npm install -g @zaganjade/pi-multi-skill # ❌ pi will not detect this
39
+ ```
40
+
41
+ ---
4
42
 
5
43
  ## Why?
6
44
 
7
- Pi's built-in `/skill:name` only loads one skill at a time. When you need multiple skills working together (e.g. `frontend-design` + `motion-design` + `test-driven-development`), you'd have to invoke them one by one. This extension lets you chain them in a single command.
45
+ Pi's built-in `/skill:name` loads one skill at a time. When you need several skills working together (e.g. `bmad-master` + `analyst` + `pm`, or `systematic-debugging` + `test-driven-development`), invoking them one by one is slow and easy to forget.
46
+
47
+ This extension chains skills in a **single command** with:
48
+
49
+ - Preset **bundles** (`@bmad-planning`, `@debug`, …)
50
+ - **Smart ordering** (process → planning → implementation)
51
+ - **Load modes** to control token cost (`--meta`, `--lazy`, `--full`)
52
+ - **Universal discovery** including Claude Code plugin skills and Cursor skills
53
+ - **BMAD `--auto`** phase routing from workflow status files
54
+
55
+ ---
56
+
57
+ ## Quick start
58
+
59
+ ```
60
+ /skills @debug --meta Fix the failing auth tests
61
+ /skills @bmad-planning --meta Buat PRD untuk fitur notifikasi
62
+ /skills bmad-master,developer Implement user story US-042
63
+ /skills bmad-master /workflow-status
64
+ /skills @bmad-planning --auto
65
+ /skills @cc-feature --parallel Build API | Write tests | Update docs
66
+ /skills-stats → activation statistics
67
+ /skills-last → repeat last activation
68
+ /skills-setup → bundle install guide
69
+ /skills → help + list all skills & bundles
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Commands
75
+
76
+ | Command | Description |
77
+ |---------|-------------|
78
+ | `/skills` | Chain skills/bundles — flags, embedded commands, `--auto`, `--parallel` |
79
+ | `/skills-stats` | Activation statistics (`~/.pi/agent/multi-skill-stats.json`) |
80
+ | `/skills-last` | Repeat last activation (optional `--meta` / `--lazy` / `--full` / `--parallel`) |
81
+ | `/skills-setup` | Bundle readiness on this machine + BMAD/Superpowers install guide |
82
+
83
+ ---
84
+
85
+ ## Features
86
+
87
+ ### v1.3.0
88
+
89
+ | Feature | Description |
90
+ |---------|-------------|
91
+ | **`/skills-last`** | Replay the previous `/skills` line; flags can override load mode |
92
+ | **BMAD status inject** | `<bmad_status>` preloaded for `/workflow-status`, `--auto`, `bmad-master` |
93
+ | **Bundle attribution** | Sets `bundles="@name"` on `<manually_attached_skills>` for pi-usage tracking |
94
+ | **`/skills-setup`** | Reports which preset bundles are usable + how to install missing skills |
95
+
96
+ ### Skill chaining
97
+
98
+ | Feature | Description |
99
+ |---------|-------------|
100
+ | **Comma-separated skills** | `/skills skill1,skill2,skill3 [instructions]` |
101
+ | **Preset bundles** | `/skills @bundle-name` expands to a curated skill set |
102
+ | **Mixed input** | Combine bundles and individual skills: `/skills @debug,frontend-design` |
103
+ | **Inline instructions** | Text after the skill list is passed inside `<user_query>` |
104
+ | **Legacy formats** | `/skills:a,b` (colon + comma) and `/skill:a+b` (colon + plus) still work |
105
+
106
+ ### Load modes (token efficiency)
107
+
108
+ | Flag | What gets sent | Best for |
109
+ |------|----------------|----------|
110
+ | `--meta` | Name, description, available commands only | Exploration, planning, large bundles |
111
+ | `--lazy` | Short intro + commands + “load references on demand” | Implementation workflows |
112
+ | `--full` | Complete `SKILL.md` body (default) | Rigid skills (TDD, debugging) |
113
+
114
+ Bundles can set a default mode (e.g. `@bmad-planning` defaults to `--meta`).
115
+
116
+ ### Smart ordering
117
+
118
+ Skills are sorted automatically before injection:
119
+
120
+ 1. **Process** — `using-superpowers`, `brainstorming`, `systematic-debugging`, `bmad-master`, …
121
+ 2. **Planning** — `analyst`, `pm`, `architect`, `ux-designer`, …
122
+ 3. **Implementation** — domain and execution skills
123
+
124
+ User instructions always take precedence over skill guidance. Skills with conflicting `conflicts_with` frontmatter are deduplicated automatically (lower-priority skill skipped).
125
+
126
+ ### Parallel dispatch (v1.2)
127
+
128
+ When `--parallel` is used with `pi-subagents` installed, the message includes a `<parallel_dispatch>` block with a ready-to-use JSON template for the `subagent` tool:
129
+
130
+ ```
131
+ /skills @cc-feature --parallel Build API | Write tests | Update docs
132
+ ```
133
+
134
+ Pipe-separated tasks (`|`) become independent parallel subagent jobs. Without `pi-subagents`, a fallback notice prompts sequential execution.
135
+
136
+ ### Skill conflict resolution (v1.2)
137
+
138
+ Skills can declare `conflicts_with` in frontmatter. After smart ordering, conflicting skills are skipped with an info notification:
139
+
140
+ ```
141
+ Skipped test-driven-development (conflicts with systematic-debugging)
142
+ ```
143
+
144
+ ### Per-skill token budget (v1.2)
145
+
146
+ Skills can set `token_budget: meta|lazy|full` in frontmatter. When a bundle uses `--lazy`, individual skills can still override to `--full` (e.g. rigid TDD/debug skills).
147
+
148
+ ### Activation stats (v1.2)
149
+
150
+ Every `/skills` activation is recorded to `~/.pi/agent/multi-skill-stats.json`. View with:
151
+
152
+ ```
153
+ /skills-stats
154
+ ```
155
+
156
+ Tracks load modes, top bundles, skills-per-activation buckets, and recent history.
157
+
158
+ ### Command passthrough
159
+
160
+ Embed a slash command after the skill list — it is wrapped in `<embedded_command>` and the agent runs that workflow after loading the skill:
161
+
162
+ ```
163
+ /skills bmad-master /workflow-status
164
+ /skills developer /dev-story STORY-042
165
+ /skills analyst /product-brief
166
+ ```
167
+
168
+ After typing the skill name and a space, autocomplete suggests commands from the skill's **Available Commands** section (e.g. `/workflow-status`, `/dev-story`).
169
+
170
+ > **Note:** BMAD commands like `/workflow-status` are **skill workflows** executed by the agent — not separate Pi slash commands. You will see a notification (`Loading bmad-master → /workflow-status`) and the agent turn starts with the skill + embedded command injected.
171
+
172
+ ### BMAD `--auto`
173
+
174
+ Reads `docs/bmm-workflow-status.yaml` (and `bmad/config.yaml` for project level) and loads skills for the current phase:
175
+
176
+ | Detected phase | Skills loaded |
177
+ |----------------|---------------|
178
+ | Analysis | bmad-master, analyst |
179
+ | Planning | bmad-master, analyst, pm |
180
+ | Solutioning | bmad-master, architect, ux-designer |
181
+ | Implementation | bmad-master, developer, scrum-master |
8
182
 
9
- ## Usage
183
+ ```
184
+ /skills --auto
185
+ /skills @bmad-planning --auto
186
+ ```
187
+
188
+ ### Universal skill discovery
189
+
190
+ Skills are found from **all** of these sources (merged, deduplicated by name):
191
+
192
+ | Source | Path / mechanism |
193
+ |--------|------------------|
194
+ | Pi registered skills | `pi.getCommands()` (`source: "skill"`) |
195
+ | Pi defaults | `~/.pi/agent/skills`, `.pi/skills` |
196
+ | Settings skill paths | `"skills"` array in `~/.pi/agent/settings.json` |
197
+ | Claude Code plugins | `~/.claude/plugins/cache/**/skills/` (Superpowers, etc.) |
198
+ | Cursor skills | `~/.cursor/skills-cursor/` |
10
199
 
200
+ This means bundles like `@debug` and `@cc-feature` work even when Superpowers skills live in the Claude plugin cache rather than `~/.claude/skills`.
201
+
202
+ ### Claude Code-style message wrapper
203
+
204
+ Combined output uses a structured wrapper (similar to Cursor `manually_attached_skills`):
205
+
206
+ ```xml
207
+ <manually_attached_skills count="3">
208
+ …priority rules…
209
+ <skill name="…" mode="meta">…</skill>
210
+ <embedded_command>/workflow-status</embedded_command>
211
+ <user_query>Your instructions here</user_query>
212
+ </manually_attached_skills>
11
213
  ```
12
- /skills frontend-design,motion-design Create an animated landing page
13
- /skills test-driven-development,systematic-debugging Fix the failing tests
14
- /skills → show help + list available skills
214
+
215
+ ### Session hints
216
+
217
+ After each user turn, the extension may suggest a relevant bundle (non-blocking `info` notification):
218
+
219
+ | Keywords detected | Suggested bundle |
220
+ |-------------------|------------------|
221
+ | failing tests, bug, error | `@debug` |
222
+ | PRD, tech spec | `@bmad-planning` |
223
+ | architecture, API design | `@bmad-solutioning` |
224
+ | implement, user story | `@bmad-build` |
225
+ | new feature, build component | `@cc-feature` |
226
+
227
+ ### Skill registry
228
+
229
+ On every `session_start`, rebuilds `~/.pi/agent/skill-index.json` with metadata (name, type, module, commands, location) for all discovered skills.
230
+
231
+ ### Deduplication
232
+
233
+ When combining skills that share content (e.g. multiple skills with `<SUBAGENT-STOP>` or Superpowers skill-check rules), duplicate sections are stripped automatically.
234
+
235
+ ### pi-usage integration
236
+
237
+ Works with [**pi-usage**](../usage/README.md):
238
+
239
+ - Every skill in a multi-skill activation appears separately in **Skills**
240
+ - Preset bundles (`@debug`, `@bmad-planning`, …) appear in **Bundles** when `bundles="@name"` is set on the wrapper
241
+ - Tool and plugin breakdowns unchanged — independent characteristics like Claude Code
242
+
243
+ ---
244
+
245
+ ## Preset bundles
246
+
247
+ Built-in bundles are **optional presets** — they require BMAD and/or Superpowers skills to be installed separately. Run `/skills-setup` to check what's available on your machine.
248
+
249
+ Expand with `@name`:
250
+
251
+ | Bundle | Skills | Default mode | Requires |
252
+ |--------|--------|--------------|----------|
253
+ | `@bmad-planning` | bmad-master, analyst, pm | `--meta` | BMAD Method |
254
+ | `@bmad-solutioning` | bmad-master, architect, ux-designer | `--meta` | BMAD Method |
255
+ | `@bmad-build` | bmad-master, developer, scrum-master | `--lazy` | BMAD Method |
256
+ | `@cc-feature` | using-superpowers, brainstorming, … | `--lazy` | Superpowers |
257
+ | `@debug` | systematic-debugging, test-driven-development | `--full` | Superpowers |
258
+
259
+ Autocomplete shows coverage per bundle, e.g. `(2/3)` or `(0/3 — install required)`.
260
+
261
+ ### Without BMAD or Superpowers
262
+
263
+ You can still use pi-multi-skill:
264
+
265
+ ```
266
+ /skills frontend-design,motion-design Build landing page
267
+ /skills-setup → check bundle status + install guide
15
268
  ```
16
269
 
17
- - **Comma-separated** skill names after `/skills`
18
- - **Optional instructions** after the skill list (passed to the agent alongside the skill content)
19
- - **Autocomplete** — typing `/skills ` shows all available skills with descriptions, and selecting one appends it with a comma for chaining
270
+ Create your own bundles with **only skills you have**:
20
271
 
21
- ### Legacy formats (also supported)
272
+ ```json
273
+ {
274
+ "bundles": {
275
+ "my-stack": {
276
+ "description": "Skills I actually installed",
277
+ "skills": ["frontend-design", "create-rule"],
278
+ "default_mode": "meta"
279
+ }
280
+ }
281
+ }
282
+ ```
283
+
284
+ Save as `~/.pi/agent/skill-bundles.json` then use `/skills @my-stack`.
285
+
286
+ ---
287
+
288
+ ## Custom bundles
289
+
290
+ Create `~/.pi/agent/skill-bundles.json`, `.pi/skill-bundles.json`, or the YAML equivalents (`skill-bundles.yaml` / `.pi/skill-bundles.yaml`):
22
291
 
292
+ ```json
293
+ {
294
+ "bundles": {
295
+ "my-team-planning": {
296
+ "description": "Custom team planning workflow",
297
+ "skills": ["bmad-master", "analyst", "pm"],
298
+ "order": "process-first",
299
+ "default_mode": "meta"
300
+ }
301
+ }
302
+ }
23
303
  ```
24
- /skills:frontend-design,motion-design [args] (colon + comma)
25
- /skill:frontend-design+motion-design [args] (colon + plus)
304
+
305
+ YAML format (same fields):
306
+
307
+ ```yaml
308
+ bundles:
309
+ my-team-planning:
310
+ description: Custom team planning workflow
311
+ skills:
312
+ - bmad-master
313
+ - analyst
314
+ - pm
315
+ order: process-first
316
+ default_mode: meta
26
317
  ```
27
318
 
319
+ | Field | Values | Description |
320
+ |-------|--------|-------------|
321
+ | `description` | string | Shown in `/skills` help and autocomplete |
322
+ | `skills` | string[] | Skill names to load when bundle is expanded |
323
+ | `order` | `process-first` · `explicit` · `alpha` | Sort order (default: `process-first`) |
324
+ | `default_mode` | `meta` · `lazy` · `full` | Applied when no `--meta`/`--lazy`/`--full` flag is passed |
325
+
326
+ See [skill-bundles.example.json](./skill-bundles.example.json) and [skill-bundles.example.yaml](./skill-bundles.example.yaml).
327
+
328
+ Custom bundles **merge** with built-in presets; same name overrides the preset.
329
+
330
+ ---
331
+
332
+ ## Flags reference
333
+
334
+ | Flag | Description |
335
+ |------|-------------|
336
+ | `--meta` | Minimal content — name, description, commands |
337
+ | `--lazy` | Summary + on-demand reference loading |
338
+ | `--full` | Full SKILL.md body (default) |
339
+ | `--auto` | BMAD phase detection from workflow status |
340
+ | `--parallel` | Parallel subagent dispatch — pipe-separated tasks: `Task A \| Task B` |
341
+ | `/skills-stats` | Show activation statistics (modes, bundles, recent history) |
342
+ | `/skills-last` | Repeat last `/skills` activation |
343
+ | `/skills-setup` | Bundle prerequisites and install guide |
344
+
345
+ ---
346
+
28
347
  ## Install
29
348
 
349
+ Use **`pi install`**, not plain `npm install`. Pi registers packages in `settings.json` under `"packages"` and loads extensions from the `pi.extensions` manifest.
350
+
351
+ ```bash
352
+ pi install npm:@zaganjade/pi-multi-skill
353
+ /reload
354
+ ```
355
+
356
+ Quick test without persisting to settings:
357
+
358
+ ```bash
359
+ pi -e npm:@zaganjade/pi-multi-skill
360
+ ```
361
+
362
+ From GitHub (monorepo):
363
+
30
364
  ```bash
31
- pi install git:github.com/ZaganJade/pi-multi-skill
365
+ pi install git:github.com/ZaganJade/pi-extension
32
366
  ```
33
367
 
34
- Or from a local path:
368
+ Local development:
35
369
 
36
370
  ```bash
37
371
  pi install ./multi-skill
372
+ /reload
373
+ ```
374
+
375
+ Verify:
376
+
377
+ ```bash
378
+ pi list
379
+ # should show: npm:@zaganjade/pi-multi-skill
38
380
  ```
39
381
 
382
+ ---
383
+
384
+ ## Troubleshooting
385
+
386
+ | Symptom | Fix |
387
+ |---------|-----|
388
+ | `/skills` not in autocomplete | Run `pi install npm:@zaganjade/pi-multi-skill`, then `/reload` |
389
+ | `No skills found for: …` | Ensure skill exists in a discovery path (see table above). Superpowers skills are found via Claude plugin cache automatically. |
390
+ | Bundle skill missing | Run `/skills` with no args — check skill appears in list. Add custom path to `"skills"` in settings if needed. |
391
+ | Installed with `npm install -g` but pi ignores it | Use `pi install npm:@zaganjade/pi-multi-skill` instead |
392
+ | Added `npm:...` to `"extensions"` in settings | Wrong key for npm packages — use `"packages"`, or run `pi install` |
393
+ | Command shows as `/skills:2` | Two copies loaded (local + npm). Remove duplicate from `extensions` or `packages` |
394
+ | Extension listed but disabled | Run `pi config` and enable the extension resource |
395
+ | `--auto` loads wrong skills | Ensure `docs/bmm-workflow-status.yaml` exists and reflects current phase |
396
+
397
+ ---
398
+
40
399
  ## How it works
41
400
 
42
- The extension discovers all available skills via `pi.getCommands()` (covers user-level, project-level, and package-installed skills), reads each selected skill's `SKILL.md`, strips frontmatter, wraps it in `<skill>` blocks, and sends the combined content as a user message to trigger agent processing.
401
+ ```mermaid
402
+ flowchart LR
403
+ CMD["/skills @bundle --meta /cmd"]
404
+ DISC["discover.ts"]
405
+ PARSE["parse-args.ts + bundles.ts"]
406
+ ORDER["metadata.ts sort"]
407
+ BUILD["build.ts"]
408
+ SEND["sendUserMessage()"]
43
409
 
44
- ## Files
410
+ CMD --> PARSE --> DISC --> ORDER --> BUILD --> SEND
411
+ ```
412
+
413
+ 1. **Parse** — extract skill names, flags, embedded command, instructions
414
+ 2. **Expand** — resolve `@bundle` → skill name list; `--auto` → BMAD phase skills
415
+ 3. **Discover** — merge skills from pi, settings paths, Claude plugins, Cursor
416
+ 4. **Order** — sort by process → planning → implementation priority
417
+ 5. **Build** — render each skill in the chosen load mode; deduplicate shared sections
418
+ 6. **Send** — inject `<manually_attached_skills>` wrapper via `pi.sendUserMessage()`
419
+
420
+ ---
421
+
422
+ ## Module layout
45
423
 
46
424
  | File | Purpose |
47
425
  |------|---------|
48
- | `src/index.ts` | Entry point registers `/skills` command, autocomplete, and input handler |
426
+ | `src/index.ts` | `/skills`, `/skills-stats`, `/skills-last`, `/skills-setup`; events; orchestration |
427
+ | `src/discover.ts` | Universal skill discovery (pi + Claude plugins + Cursor) |
428
+ | `src/bundles.ts` | Built-in presets + user JSON/YAML bundle config |
429
+ | `src/bundle-status.ts` | Bundle readiness assessment + setup report |
430
+ | `src/metadata.ts` | Frontmatter parsing (via pi), priority sorting |
431
+ | `src/build.ts` | Message builder — load modes, deduplication, parallel dispatch, `bundles=` attr |
432
+ | `src/conflicts.ts` | `conflicts_with` resolution |
433
+ | `src/subagents.ts` | pi-subagents detection + `<parallel_dispatch>` template |
434
+ | `src/stats.ts` | Activation tracking → `multi-skill-stats.json` |
435
+ | `src/yaml-bundles.ts` | Minimal YAML parser for bundle config |
436
+ | `src/bmad-auto.ts` | BMAD `--auto` phase routing |
437
+ | `src/bmad-status.ts` | BMAD workflow status block for status/auto/master |
438
+ | `src/completions.ts` | Slash autocomplete for skills, bundles, embedded commands |
439
+ | `src/parse-args.ts` | Flag parsing, embedded command extraction |
440
+ | `src/registry.ts` | `~/.pi/agent/skill-index.json` persistence |
441
+ | `src/suggestions.ts` | Context-aware bundle hints on `turn_end` |
442
+ | `src/types.ts` | Shared TypeScript types |
443
+ | `skill-bundles.example.json` | Example custom bundle config (JSON) |
444
+ | `skill-bundles.example.yaml` | Example custom bundle config (YAML) |
445
+
446
+ ---
447
+
448
+ ## Changelog
449
+
450
+ ### v1.3.0
451
+
452
+ - `/skills-last` — repeat last activation (optional `--meta`/`--lazy`/`--full`/`--parallel` override)
453
+ - BMAD status pre-inject — `<bmad_status>` block for `/workflow-status`, `--auto`, and `bmad-master`
454
+ - Bundle attribution in pi-usage — `bundles="@name"` on `<manually_attached_skills>`
455
+
456
+ ### v1.2.0
457
+
458
+ - Skill conflict resolution via `conflicts_with` frontmatter
459
+ - Per-skill `token_budget` override in frontmatter
460
+ - Structured `<parallel_dispatch>` block with JSON template for `pi-subagents`
461
+ - Pipe-separated parallel tasks: `--parallel Task A | Task B`
462
+ - Activation stats (`/skills-stats`, `multi-skill-stats.json`)
463
+ - YAML bundle config (`skill-bundles.yaml`)
464
+ - Richer skill index (pairsWith, conflictsWith, tokenBudget)
465
+
466
+ ### v1.1.0
467
+
468
+ - Preset bundles (`@bmad-planning`, `@debug`, `@cc-feature`, …)
469
+ - Load modes: `--meta`, `--lazy`, `--full`
470
+ - Smart skill ordering (Superpowers priority)
471
+ - BMAD `--auto` phase routing
472
+ - Command passthrough (`/skills bmad-master /workflow-status`)
473
+ - Universal discovery (Claude plugin cache + Cursor skills)
474
+ - `<manually_attached_skills>` message wrapper
475
+ - Session bundle suggestions on `turn_end`
476
+ - Skill registry (`skill-index.json`)
477
+ - Content deduplication across combined skills
478
+ - Multi-skill attribution in pi-usage
479
+
480
+ ### v1.0.x
481
+
482
+ - Comma-separated `/skills a,b,c [instructions]`
483
+ - Autocomplete with descriptions
484
+ - Legacy `/skills:` and `/skill:+` formats
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@zaganjade/pi-multi-skill",
3
- "version": "1.0.0",
4
- "description": "Load multiple skills at once via /skills command. Supports comma-separated skill names with autocomplete and instructions.",
3
+ "version": "1.3.1",
4
+ "description": "Chain multiple skills via /skills bundles (JSON/YAML), load modes, BMAD --auto, /skills-last, /skills-setup, conflict resolution, parallel dispatch, activation stats, bundle attribution for pi-usage.",
5
+ "type": "module",
5
6
  "keywords": [
6
7
  "pi-package"
7
8
  ],
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
8
12
  "license": "MIT",
9
13
  "author": "ZaganJade <tipstrik81@gmail.com>",
10
14
  "homepage": "https://github.com/ZaganJade/pi-extension/tree/main/multi-skill",
@@ -20,7 +24,9 @@
20
24
  "files": [
21
25
  "src/",
22
26
  "README.md",
23
- "LICENSE"
27
+ "LICENSE",
28
+ "skill-bundles.example.json",
29
+ "skill-bundles.example.yaml"
24
30
  ],
25
31
  "pi": {
26
32
  "extensions": [
@@ -0,0 +1,17 @@
1
+ {
2
+ "bundles": {
3
+ "my-stack": {
4
+ "description": "Only skills installed on this machine — no BMAD required",
5
+ "skills": ["frontend-design", "create-rule"],
6
+ "order": "explicit",
7
+ "default_mode": "meta"
8
+ },
9
+ "my-team-planning": {
10
+ "description": "Custom team planning workflow (requires BMAD)",
11
+ "skills": ["bmad-master", "analyst", "pm"],
12
+ "order": "process-first",
13
+ "default_mode": "meta",
14
+ "requires": "BMAD Method"
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ bundles:
2
+ my-team-planning:
3
+ description: Custom team planning workflow
4
+ skills:
5
+ - bmad-master
6
+ - analyst
7
+ - pm
8
+ order: process-first
9
+ default_mode: meta
@@ -0,0 +1,99 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ const PHASE_SKILLS: Record<string, string[]> = {
5
+ analysis: ["bmad-master", "analyst"],
6
+ planning: ["bmad-master", "analyst", "pm"],
7
+ solutioning: ["bmad-master", "architect", "ux-designer"],
8
+ implementation: ["bmad-master", "developer", "scrum-master"],
9
+ };
10
+
11
+ function readText(path: string): string | null {
12
+ try {
13
+ return readFileSync(path, "utf-8");
14
+ } catch {
15
+ return null;
16
+ }
17
+ }
18
+
19
+ function workflowStatus(content: string, key: string): string | null {
20
+ const patterns = [
21
+ new RegExp(`${key}:\\s*\\n[\\s\\S]*?status:\\s*([\\w-]+)`, "i"),
22
+ new RegExp(`${key}:[\\s\\S]*?status:\\s*([\\w\\s-]+)`, "i"),
23
+ ];
24
+ for (const re of patterns) {
25
+ const match = content.match(re);
26
+ if (match) return match[1].trim().toLowerCase().replace(/\s+/g, "-");
27
+ }
28
+ return null;
29
+ }
30
+
31
+ function isIncomplete(status: string | null): boolean {
32
+ if (!status) return true;
33
+ return /not-started|not_started|pending|required|in-progress|in_progress|started/.test(
34
+ status,
35
+ );
36
+ }
37
+
38
+ function detectPhase(content: string): keyof typeof PHASE_SKILLS {
39
+ const checks: Array<[string, keyof typeof PHASE_SKILLS]> = [
40
+ ["product-brief", "analysis"],
41
+ ["brainstorm", "analysis"],
42
+ ["research", "analysis"],
43
+ ["prd", "planning"],
44
+ ["tech-spec", "planning"],
45
+ ["tech_spec", "planning"],
46
+ ["architecture", "solutioning"],
47
+ ["ux-design", "solutioning"],
48
+ ["sprint-planning", "implementation"],
49
+ ["dev-story", "implementation"],
50
+ ["create-story", "implementation"],
51
+ ];
52
+
53
+ for (const [key, phase] of checks) {
54
+ if (isIncomplete(workflowStatus(content, key))) return phase;
55
+ }
56
+
57
+ if (/implementation|phase:\s*4/i.test(content)) return "implementation";
58
+ if (/solutioning|phase:\s*3/i.test(content)) return "solutioning";
59
+ if (/planning|phase:\s*2/i.test(content)) return "planning";
60
+ return "analysis";
61
+ }
62
+
63
+ function projectLevel(cwd: string): number {
64
+ const configPath = join(cwd, "bmad", "config.yaml");
65
+ const content = readText(configPath);
66
+ if (!content) return 1;
67
+ const match = content.match(/project_level:\s*(\d)/i);
68
+ return match ? Number.parseInt(match[1], 10) : 1;
69
+ }
70
+
71
+ export function resolveBmadAutoSkills(cwd: string): string[] {
72
+ const statusPath = join(cwd, "docs", "bmm-workflow-status.yaml");
73
+ const content = readText(statusPath);
74
+
75
+ if (!content) {
76
+ const level = projectLevel(cwd);
77
+ if (level <= 1) return ["bmad-master", "pm"];
78
+ return ["bmad-master", "analyst"];
79
+ }
80
+
81
+ const phase = detectPhase(content);
82
+ const skills = [...(PHASE_SKILLS[phase] ?? ["bmad-master"])];
83
+
84
+ const level = projectLevel(cwd);
85
+ if (level <= 1 && phase === "planning" && !skills.includes("pm")) {
86
+ skills.push("pm");
87
+ }
88
+
89
+ return [...new Set(skills)];
90
+ }
91
+
92
+ export function bmadAutoHint(cwd: string): string | null {
93
+ const statusPath = join(cwd, "docs", "bmm-workflow-status.yaml");
94
+ if (!existsSync(statusPath)) {
95
+ return "BMAD status not found — loaded bmad-master with planning defaults";
96
+ }
97
+ const phase = detectPhase(readText(statusPath) ?? "");
98
+ return `BMAD --auto detected phase: ${phase}`;
99
+ }