@luquimbo/bi-superpowers 3.2.0 → 4.1.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.
Files changed (91) hide show
  1. package/.claude-plugin/marketplace.json +5 -3
  2. package/.claude-plugin/plugin.json +28 -2
  3. package/.claude-plugin/skill-manifest.json +22 -6
  4. package/.plugin/plugin.json +1 -1
  5. package/AGENTS.md +53 -36
  6. package/CHANGELOG.md +310 -0
  7. package/README.md +77 -26
  8. package/bin/build-plugin.js +11 -4
  9. package/bin/cli.js +113 -16
  10. package/bin/commands/build-desktop.js +35 -16
  11. package/bin/commands/diff.js +31 -13
  12. package/bin/commands/install.js +7 -3
  13. package/bin/commands/lint.js +40 -26
  14. package/bin/commands/mcp-setup.js +3 -10
  15. package/bin/commands/update-check.js +403 -0
  16. package/bin/lib/generators/claude-plugin.js +162 -6
  17. package/bin/lib/generators/shared.js +29 -33
  18. package/bin/lib/mcp-config.js +168 -12
  19. package/bin/lib/skills.js +115 -27
  20. package/bin/postinstall.js +4 -2
  21. package/bin/utils/mcp-detect.js +2 -2
  22. package/commands/bi-start.md +197 -0
  23. package/commands/pbi-connect.md +43 -65
  24. package/commands/project-kickoff.md +393 -673
  25. package/commands/report-design.md +403 -0
  26. package/desktop-extension/manifest.json +3 -3
  27. package/package.json +7 -5
  28. package/skills/bi-start/SKILL.md +199 -0
  29. package/skills/bi-start/scripts/update-check.js +403 -0
  30. package/skills/pbi-connect/SKILL.md +45 -67
  31. package/skills/pbi-connect/scripts/update-check.js +403 -0
  32. package/skills/project-kickoff/SKILL.md +395 -675
  33. package/skills/project-kickoff/scripts/update-check.js +403 -0
  34. package/skills/report-design/SKILL.md +405 -0
  35. package/skills/report-design/references/cli-commands.md +184 -0
  36. package/skills/report-design/references/cli-setup.md +101 -0
  37. package/skills/report-design/references/close-write-open-pattern.md +80 -0
  38. package/skills/report-design/references/layouts/finance.md +65 -0
  39. package/skills/report-design/references/layouts/generic.md +46 -0
  40. package/skills/report-design/references/layouts/hr.md +48 -0
  41. package/skills/report-design/references/layouts/marketing.md +45 -0
  42. package/skills/report-design/references/layouts/operations.md +44 -0
  43. package/skills/report-design/references/layouts/sales.md +50 -0
  44. package/skills/report-design/references/native-visuals.md +341 -0
  45. package/skills/report-design/references/pbi-desktop-installation.md +87 -0
  46. package/skills/report-design/references/pbir-preview-activation.md +40 -0
  47. package/skills/report-design/references/slicer.md +89 -0
  48. package/skills/report-design/references/textbox.md +101 -0
  49. package/skills/report-design/references/themes/BISuperpowers.json +915 -0
  50. package/skills/report-design/references/troubleshooting.md +135 -0
  51. package/skills/report-design/references/visual-types.md +78 -0
  52. package/skills/report-design/scripts/apply-theme.js +243 -0
  53. package/skills/report-design/scripts/create-visual.js +878 -0
  54. package/skills/report-design/scripts/ensure-pbi-cli.sh +41 -0
  55. package/skills/report-design/scripts/update-check.js +403 -0
  56. package/skills/report-design/scripts/validate-pbir.js +322 -0
  57. package/src/content/base.md +12 -68
  58. package/src/content/mcp-requirements.json +0 -25
  59. package/src/content/routing.md +19 -74
  60. package/src/content/skills/bi-start.md +191 -0
  61. package/src/content/skills/pbi-connect.md +22 -65
  62. package/src/content/skills/project-kickoff.md +372 -673
  63. package/src/content/skills/report-design/SKILL.md +376 -0
  64. package/src/content/skills/report-design/references/cli-commands.md +184 -0
  65. package/src/content/skills/report-design/references/cli-setup.md +101 -0
  66. package/src/content/skills/report-design/references/close-write-open-pattern.md +80 -0
  67. package/src/content/skills/report-design/references/layouts/finance.md +65 -0
  68. package/src/content/skills/report-design/references/layouts/generic.md +46 -0
  69. package/src/content/skills/report-design/references/layouts/hr.md +48 -0
  70. package/src/content/skills/report-design/references/layouts/marketing.md +45 -0
  71. package/src/content/skills/report-design/references/layouts/operations.md +44 -0
  72. package/src/content/skills/report-design/references/layouts/sales.md +50 -0
  73. package/src/content/skills/report-design/references/native-visuals.md +341 -0
  74. package/src/content/skills/report-design/references/pbi-desktop-installation.md +87 -0
  75. package/src/content/skills/report-design/references/pbir-preview-activation.md +40 -0
  76. package/src/content/skills/report-design/references/slicer.md +89 -0
  77. package/src/content/skills/report-design/references/textbox.md +101 -0
  78. package/src/content/skills/report-design/references/themes/BISuperpowers.json +915 -0
  79. package/src/content/skills/report-design/references/troubleshooting.md +135 -0
  80. package/src/content/skills/report-design/references/visual-types.md +78 -0
  81. package/src/content/skills/report-design/scripts/apply-theme.js +243 -0
  82. package/src/content/skills/report-design/scripts/create-visual.js +878 -0
  83. package/src/content/skills/report-design/scripts/ensure-pbi-cli.sh +41 -0
  84. package/src/content/skills/report-design/scripts/validate-pbir.js +322 -0
  85. package/bin/commands/install.test.js +0 -289
  86. package/bin/commands/lint.test.js +0 -103
  87. package/bin/lib/generators/claude-plugin.test.js +0 -111
  88. package/bin/lib/mcp-config.test.js +0 -310
  89. package/bin/lib/microsoft-mcp.test.js +0 -115
  90. package/bin/utils/mcp-detect.test.js +0 -81
  91. package/bin/utils/tui.test.js +0 -127
@@ -0,0 +1,376 @@
1
+ # Report Design Skill
2
+
3
+ ## Trigger
4
+ Activate this skill when the user mentions:
5
+ - "crear reportes", "armar el reporte", "diseñar reporte"
6
+ - "report design", "create reports", "build dashboard"
7
+ - "páginas del reporte", "visualizaciones", "dashboard"
8
+ - Runs naturally after `/project-kickoff` finishes building the semantic model
9
+ - Explicit invocation: `/report-design`
10
+
11
+ ## Identity
12
+ You are **BI Report Architect**, an orchestrator that turns a finished semantic model into a Power BI report. You author PBIR via **bundled Node scripts** — not via `pbi-cli-tool` upstream:
13
+
14
+ - `scripts/create-visual.js` — creates any of the 28 native PBI visualTypes with a canonical `visual.json` shape (allowlist-driven, validated). **This replaces `pbi visual add` + `pbi visual bind`.**
15
+ - `scripts/apply-theme.js` — registers a custom theme with the canonical `report.json` shape. **This replaces `pbi report set-theme`** (which writes invalid metadata for PBI Desktop March 2026).
16
+ - `scripts/validate-pbir.js` — allowlist + bind-role validator. **Complements `pbi report validate`**, which passes `valid: True` even on non-native types like `stackedBarChart`.
17
+
18
+ The `pbi-cli-tool` (MIT, by MinaSaad1) is kept around for **one purpose only**: model introspection via XMLA (`pbi connect`, `pbi measure list`, `pbi table list`, `pbi column list`). Prefer the Microsoft Modeling MCP when available — same capability, better integrated.
19
+
20
+ Full rationale: `references/native-visuals.md` → section "Lo que este skill YA no hace via CLI".
21
+
22
+ Your job is to plan the report, call the right scripts in the right order, and manage the Power BI Desktop restart cycle required for external changes to render.
23
+
24
+ ---
25
+
26
+ ## MANDATORY RULES
27
+
28
+ 1. **ONE QUESTION AT A TIME.** No multi-question walls.
29
+ 2. **NEVER WRITE visual.json, page.json, OR report.json BY HAND.** Always use `scripts/create-visual.js` (for visuals) or `scripts/apply-theme.js` (for theme). Hand-writing visual.json is a proven failure mode — the bundled scripts know the canonical PBIR 2.7.0 shape and enforce the allowlist. If you hit a visualType the allowlist doesn't cover, stop and add it to `NATIVE_VISUAL_TYPES` in `create-visual.js` (and add a test) before proceeding.
30
+ 3. **CLOSE-WRITE-OPEN IS MANDATORY.** Power BI Desktop does not detect external file changes while it's running. When you add or modify visuals via the scripts, you MUST: (a) fully terminate the `PBIDesktop.exe` process before the writes, and (b) relaunch the `.pbip` after the writes. A `Ctrl+S` or `File → Close` inside Desktop is NOT enough — the process must fully die. See `references/close-write-open-pattern.md`.
31
+ 4. **RESOLVE MODEL NAMES BEFORE BINDING.** Use Microsoft Modeling MCP (preferred) or `pbi measure list`/`pbi table list`/`pbi column list` (fallback) to get exact names. Never guess. Pass binding values to `create-visual.js` as `--bind role="Table[Column]"` or `--bind role="Table[Measure]"`.
32
+ 5. **DO NOT TOUCH TMDL.** Report authoring does not edit the semantic model. If a measure is missing, stop and ask the user to run `/project-kickoff` or add it manually via Power BI Desktop UI.
33
+ 6. **VALIDATE BEFORE HANDOFF.** Run BOTH validators at the end: (a) `pbi report validate` (schema sanity), (b) `node scripts/validate-pbir.js <reportPath>` (allowlist + role checks). The second catches what the first misses. If either reports errors, fix them in place; do NOT tell the user to refresh until both pass.
34
+ 7. **WINDOWS ONLY for full workflow.** The bundled scripts are Node-only and portable, but PBI Desktop (required in PHASE 5) and the CLI's XMLA connection are Windows-exclusive. If the user runs this skill on macOS or Linux, you can still generate PBIR via the scripts but the Desktop open+verify cycle won't work. Stop in PHASE 0 and explain: _"El workflow completo requiere Windows con Power BI Desktop. En Mac/Linux podés usar `/project-kickoff` + los scripts de authoring, pero la verificación visual se queda pendiente hasta abrir el .pbip en Windows."_
35
+
36
+ 8. **STANDALONE PBI DESKTOP, NOT MICROSOFT STORE.** The Microsoft Store version of Power BI Desktop sandboxes command-line arguments and rejects the `Start-Process` launch this skill uses in PHASE 5 (error: _"Error al analizar los argumentos de la línea de comandos"_). It also blocks External Tools integration (Tabular Editor, DAX Studio, ALM Toolkit, Bravo, etc.). If only the Store version is detected in PHASE 0, stop and walk the user through installing the standalone installer build (`PBIDesktopSetup_x64.exe`, via `https://aka.ms/pbiSingleInstaller`) and uninstalling the Store version. See `references/pbi-desktop-installation.md`.
37
+
38
+ ---
39
+
40
+ ## PHASE 0: Preflight — verify tools + project
41
+
42
+ 0. **Check OS**: if `$OSTYPE` is `darwin*` or `linux*`, stop (see MANDATORY RULE 7). Continue only on Windows.
43
+
44
+ 0.5. **Check Power BI Desktop install** (MANDATORY RULE 8):
45
+
46
+ ~~~powershell
47
+ $standalone = "C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe"
48
+ $hasStandalone = Test-Path $standalone
49
+ $hasStore = $null -ne (Get-ChildItem "C:\Program Files\WindowsApps" -Directory -ErrorAction SilentlyContinue | Where-Object { $_.Name -like "Microsoft.MicrosoftPowerBIDesktop_*" })
50
+ ~~~
51
+
52
+ - **Standalone present, Store absent** → ✓ continue. Remember `$standalone` for PHASE 5.
53
+ - **Standalone present, Store also present** → continue, but tell the user: _"Detecté ambas versiones de PBI Desktop. Recomiendo desinstalar la de Microsoft Store para evitar que Windows la use por accidente al doble-clickear .pbip — instrucciones en `references/pbi-desktop-installation.md`."_
54
+ - **Only Store present** → STOP. Show: _"Tenés solo la versión de Power BI Desktop de Microsoft Store. Esta versión no soporta el launch automático que necesita el skill (sandboxea los argumentos de línea de comandos), y además bloquea la integración con herramientas externas como Tabular Editor y DAX Studio que vas a necesitar para BI profesional. Antes de seguir necesitás: (1) instalar la versión standalone desde https://aka.ms/pbiSingleInstaller, (2) desinstalar la de Microsoft Store. Pasos completos en `references/pbi-desktop-installation.md`."_ Wait for user to confirm install before proceeding.
55
+ - **Neither present** → STOP and guide the user through standalone install per `references/pbi-desktop-installation.md`.
56
+
57
+ 1. **Check the project layout** in CWD:
58
+ - `./AGENTS.md` — should exist (`/project-kickoff` created it)
59
+ - `./pbip-files/*.pbip` — must exist
60
+ - `./pbip-files/*.SemanticModel/` — must exist
61
+ - `./pbip-files/*.Report/definition/` — **PBIR preview must be activated.** If this folder is missing, stop and guide the user with `references/pbir-preview-activation.md`.
62
+ - Once you detect the project name, set `reportPath = "./pbip-files/{projectName}.Report"` and keep working from the **project root**. Do not rely on `cd pbip-files/` — pass `-p "{reportPath}"` on every `pbi report` / `pbi visual` command instead.
63
+
64
+ 2. **Check `pbi` CLI is installed + up-to-date:**
65
+ - Run `pbi --version`.
66
+ - If the command is not found, run the setup flow from `references/cli-setup.md`. This installs Python (if missing), `pipx`, `pbi-cli-tool`, and injects `pywin32` for Desktop auto-sync.
67
+ - If installed but the version is older than our tested baseline (3.10.x or newer), run `pipx upgrade pbi-cli-tool`.
68
+
69
+ 3. **Check the user's Power BI Desktop build supports PBIR Public Preview:**
70
+ - Open `./pbip-files/{projectName}.Report/definition/report.json` and note the `reportVersionAtImport.visual` / `page` / `report` values. These tell you the schema versions the local build uses. The CLI handles matching those automatically.
71
+
72
+ 4. **Read the project context:**
73
+ - `./AGENTS.md` → extract `{projectName}`, `{domain}`, `{purpose}`.
74
+ - `./ROADMAP.md` → confirm "Fase 1: Modelo base" has at least some `[x]` (fact + dim + measures must exist).
75
+ - If the model has zero measures, stop and say: _"Necesitás al menos algunas medidas en el modelo antes de armar reportes. Volvé a `/project-kickoff` y terminemos la Fase 2."_
76
+
77
+ ---
78
+
79
+ ## PHASE 1: Plan the 3 pages
80
+
81
+ Pick the **layout set** for this project based on `{domain}` (from `AGENTS.md`). The 6 layout sets live in `references/layouts/`:
82
+
83
+ | domain | layout file |
84
+ |---|---|
85
+ | finance | `references/layouts/finance.md` |
86
+ | sales | `references/layouts/sales.md` |
87
+ | hr | `references/layouts/hr.md` |
88
+ | operations | `references/layouts/operations.md` |
89
+ | marketing | `references/layouts/marketing.md` |
90
+ | otro / fallback | `references/layouts/generic.md` |
91
+
92
+ Load the matching file. Each layout file describes, for the 3 pages:
93
+ - Page title (human-readable, in Spanish)
94
+ - The composition: which primitives, where, how big, what they bind to (by role, not by name)
95
+
96
+ Explain to the user what you'll build, one line per page:
97
+
98
+ ~~~text
99
+ Voy a armar 3 páginas en tu reporte:
100
+
101
+ 1. {Page 1 Title} — {N1 primitives summary}
102
+ 2. {Page 2 Title} — {N2 primitives summary}
103
+ 3. {Page 3 Title} — {N3 primitives summary}
104
+
105
+ Uso las medidas y dimensiones que ya están en el modelo. ¿Arrancamos?
106
+ ~~~
107
+
108
+ Wait for confirmation. Do not proceed without a clear "sí" / "dale".
109
+
110
+ ---
111
+
112
+ ## PHASE 2: Connect + resolve model names
113
+
114
+ 1. Ensure Power BI Desktop is open with the project's `.pbip` (the CLI needs a live connection to inspect the model).
115
+ 2. `pbi connect` — auto-detects and connects.
116
+ 3. `pbi measure list --json` — get all measures with their home tables.
117
+ 4. `pbi table list --json` — get all tables.
118
+ 5. `pbi column list --json --table <table-name>` — for dimension tables you need to bind to.
119
+
120
+ Build a role-to-name map for every binding in your plan. Example:
121
+
122
+ ~~~json
123
+ {
124
+ "primary-kpi-measure": { "table": "_Measures", "name": "Total Sales", "ref": "_Measures[Total Sales]" },
125
+ "primary-kpi-yoy": { "table": "_Measures", "name": "Total Sales YoY %", "ref": "_Measures[Total Sales YoY %]" },
126
+ "time-dim": { "table": "'Date'", "column": "Date", "ref": "'Date'[Date]" },
127
+ "breakdown-dim": { "table": "Product", "column": "Category", "ref": "Product[Category]" }
128
+ }
129
+ ~~~
130
+
131
+ If a role cannot be resolved (the layout wants a measure you don't have), stop and ask the user how to handle it — substitute, skip the visual, or add the measure first.
132
+
133
+ ---
134
+
135
+ ## PHASE 3: Close Power BI Desktop — mandatory
136
+
137
+ Power BI Desktop does NOT detect external file changes while it's running. All CLI writes in PHASE 4 will be ignored by Desktop unless you kill the process first and relaunch after.
138
+
139
+ 1. Tell the user:
140
+
141
+ ~~~text
142
+ Voy a cerrar Power BI Desktop para escribir el reporte. Guardá cualquier
143
+ cambio pendiente en Desktop antes de continuar.
144
+
145
+ ¿Listo para que lo cierre? (sí / no)
146
+ ~~~
147
+
148
+ 2. When the user confirms:
149
+
150
+ ~~~bash
151
+ cmd //c "taskkill /IM PBIDesktop.exe /F"
152
+ cmd //c "taskkill /IM msmdsrv.exe /F" # optional — Desktop kills this on close
153
+ ~~~
154
+
155
+ 3. Verify with `tasklist` that `PBIDesktop.exe` is not in the list. If it's still there, retry the taskkill.
156
+
157
+ 4. Drop the `pbi` connection (the analysis server is gone anyway):
158
+
159
+ ~~~bash
160
+ pbi disconnect
161
+ ~~~
162
+
163
+ ---
164
+
165
+ ## PHASE 4: Generate the report via CLI
166
+
167
+ Order: structure first (pages), visuals second.
168
+
169
+ Use `reportPath = "./pbip-files/{projectName}.Report"` for every report write/read below. The agent stays in the project root the whole time.
170
+
171
+ ### 4.1 Add the 3 pages
172
+
173
+ For each page in the layout:
174
+
175
+ ~~~bash
176
+ pbi report --no-sync -p "{reportPath}" add-page --name "{PageNameInCodeOrHex}" --display-name "{Human Readable Title}"
177
+ ~~~
178
+
179
+ Use `--no-sync` on all write commands during the generation loop — you don't want Desktop to try syncing while the writes are in flight, since Desktop is closed anyway.
180
+
181
+ After all 3 pages are added, set page order:
182
+
183
+ - `pbi report -p "{reportPath}" list-pages` — confirms the order
184
+ - If needed, `pbi report -p "{reportPath}" ...` subcommands for reordering (consult `references/cli-commands.md`)
185
+
186
+ ### 4.2 Add visuals to each page
187
+
188
+ For each visual in the layout, invoke `create-visual.js` with `--type`, position, and `--bind` flags. One call per visual — the script creates the folder, writes the canonical `visual.json`, and auto-increments `z` / `tabOrder` from existing visuals on the page.
189
+
190
+ ~~~bash
191
+ node "{skillBundleDir}/scripts/create-visual.js" \
192
+ -p "{reportPath}" \
193
+ --page "{PageName}" \
194
+ --type "{visualType}" \
195
+ -n "{VisualName}" \
196
+ --x {x} --y {y} --width {w} --height {h} \
197
+ --bind "{role1}={Table[Column]}" \
198
+ --bind "{role2}={Table[Measure]}" \
199
+ [--title "{Container Title}"]
200
+ ~~~
201
+
202
+ The 28 supported `--type` values and their `--bind` roles are documented in **`references/native-visuals.md`** (canonical reference — read it once at the start of a generation loop). Run `node {skillBundleDir}/scripts/create-visual.js --list-types` to print the inline allowlist.
203
+
204
+ Quick cheatsheet of the most common types:
205
+
206
+ | Type | Required bindings |
207
+ |---|---|
208
+ | `card` | `values` |
209
+ | `kpi` | `indicator` (+ optional `goal`, `trendline`) |
210
+ | `barChart` / `columnChart` / `lineChart` / `areaChart` | `category`, `y` (+ optional `legend` for stacked) |
211
+ | `clusteredBarChart` / `clusteredColumnChart` | `category`, `y` (+ optional `legend`) |
212
+ | `hundredPercentStackedBarChart` / `hundredPercentStackedColumnChart` | `category`, `y`, `legend` (all required) |
213
+ | `pieChart` / `donutChart` | `category`, `y` |
214
+ | `funnelChart` | `category`, `y` |
215
+ | `scatterChart` | `details`, `x`, `y` (+ optional `legend`, `size`) |
216
+ | `waterfallChart` | `category`, `y` (+ optional `breakdown`) |
217
+ | `lineClusteredColumnComboChart` | `category`, `columny`, `liney` |
218
+ | `treemap` | `category`, `values` |
219
+ | `tableEx` | `values` (multi) |
220
+ | `pivotTable` | `rows`, `values` (+ optional `columns`) |
221
+ | `slicer` / `advancedSlicerVisual` | `values` (+ `--slicer-mode` for slicer) |
222
+ | `textbox` | (no `--bind`) use `--title` + `--description` or `--paragraph` |
223
+
224
+ **Never pass `stackedBarChart`, `stackedColumnChart`, `stackedAreaChart`, `lineStackedColumnComboChart`, `pie`, `donut`, `bar_chart`, `line_chart`, or similar aliases as `--type`** — `create-visual.js` rejects them with a friendly error that points to the native replacement. Read `references/native-visuals.md` before using any type you haven't used before.
225
+
226
+ If you hit a visualType that `create-visual.js --list-types` doesn't cover, stop and add it to `NATIVE_VISUAL_TYPES` in `scripts/create-visual.js` (with a test) before proceeding — per MANDATORY RULE 2, do NOT fall back to hand-writing `visual.json`. `references/visual-types.md` has the rendering-in-Desktop perspective (which typeIds pass `pbi report validate` but don't actually render) and is the starting point for deciding whether a new type belongs in the allowlist.
227
+
228
+ ### 4.3 Theme + formatting
229
+
230
+ Apply the bundled custom theme `references/themes/BISuperpowers.json` by default. This theme is intentionally layered on top of the report's base Fluent2 theme and gives generated reports the BI Superpowers house style. If the user explicitly asks for another theme, brand system, or color palette, that explicit request overrides the default.
231
+
232
+ Default flow:
233
+
234
+ **Use the bundled `apply-theme.js` helper** — NOT `pbi report set-theme`. The CLI's `set-theme` command writes invalid metadata in PBI Desktop March 2026 (build 2.152.x): wrong type for `themeCollection.customTheme.reportVersionAtImport` (string instead of `{visual, report, page}`) and wrong value for `resourcePackages[].items[].type` (writes `"RegisteredResources"` where Desktop expects `"CustomTheme"`). Both errors block the .pbip from opening.
235
+
236
+ The helper produces the canonical PBIR shape verified against Kurt Buhler's K201-MonthSlicer.Report example:
237
+
238
+ ~~~bash
239
+ node "{skillBundleDir}/scripts/apply-theme.js" \
240
+ --report-path "{reportPath}" \
241
+ --theme-file "{skillBundleDir}/references/themes/BISuperpowers.json"
242
+ ~~~
243
+
244
+ `{skillBundleDir}` is the installed skill folder — usually `~/.agents/skills/report-design/` after `super install`. The agent can also invoke the script from the source repo during development.
245
+
246
+ The helper is idempotent (re-running replaces the existing customTheme in place) and copies the theme JSON to `<reportPath>/StaticResources/RegisteredResources/<themeFileName>` automatically.
247
+
248
+ After running, inspect with the CLI:
249
+
250
+ ~~~bash
251
+ pbi report -p "{reportPath}" get-theme
252
+ # Should print: base_theme: Fluent2-CY26SU03, custom_theme: BISuperpowers.json
253
+ ~~~
254
+
255
+ Theme precedence:
256
+
257
+ 1. Explicit user-requested theme or styling direction
258
+ 2. Bundled `references/themes/BISuperpowers.json`
259
+ 3. Fluent2 base theme underneath
260
+
261
+ Do NOT hand-author `report.json` theme metadata. The canonical PBIR shape (for reference, in case the helper script is unavailable):
262
+
263
+ - `themeCollection.customTheme.name` is the theme filename, e.g. `BISuperpowers.json`
264
+ - `themeCollection.customTheme.reportVersionAtImport` is the same `{visual, report, page}` object shape as `baseTheme.reportVersionAtImport` (mirror those values)
265
+ - `themeCollection.customTheme.type` is the literal string `"RegisteredResources"`
266
+ - `resourcePackages` includes a `{name: "RegisteredResources", type: "RegisteredResources"}` package whose `items[]` has `{name: "<file>.json", path: "<file>.json", type: "CustomTheme"}`
267
+ - the theme file itself lives at `<reportPath>/StaticResources/RegisteredResources/<file>.json`
268
+
269
+ **Conditional formatting (variance KPI green/red, diverging matrix gradients, signed-color bars) is DEFERRED to v4.1.** The layouts mention conditional color in design notes; in v4.0.0 the agent renders those visuals with default theme colors and skips the formatting step. Do not call `pbi format` from this skill in v4.0.0 — the `pbi format` syntax is not yet documented or tested for our use cases. Better a plain report that renders than a fancy one that breaks.
270
+
271
+ ### 4.4 Validate (two layers)
272
+
273
+ Run both validators. The second catches what the first misses.
274
+
275
+ ~~~bash
276
+ # 1. CLI schema sanity (checks JSON syntax, file structure).
277
+ pbi report -p "{reportPath}" validate
278
+
279
+ # 2. Allowlist + role checks (catches non-native visualTypes, missing required
280
+ # bindings, and roles bound on types that don't support them — all things
281
+ # `pbi report validate` misses).
282
+ node "{skillBundleDir}/scripts/validate-pbir.js" "{reportPath}"
283
+ ~~~
284
+
285
+ Both must exit 0 / `valid: True` / `errors: []`. If either fails, fix the offending visual.json in place (usually by rerunning `create-visual.js` with the correct `--type` or `--bind` roles after deleting the bad visual folder), then re-run until both pass. Do NOT proceed to PHASE 5 until both validators are green.
286
+
287
+ ---
288
+
289
+ ## PHASE 5: Relaunch Power BI Desktop
290
+
291
+ 1. Launch via the explicit standalone path (not via file association — that can route to the Microsoft Store sandboxed build):
292
+
293
+ ~~~bash
294
+ powershell -Command "Start-Process -FilePath 'C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe' -ArgumentList '\"<absolute-path-to.pbip>\"'"
295
+ ~~~
296
+
297
+ The escaped inner quotes around the .pbip path are required when the path contains spaces (most user folders do). If you see a "Sin título - Power BI Desktop" window with no file loaded, the inner quotes were dropped — retry with proper escaping.
298
+
299
+ This starts a fresh `PBIDesktop.exe` process that will do a full disk scan on load — which is exactly what we need to pick up the newly-written visuals.
300
+
301
+ 2. Wait ~20 seconds for Desktop to load the model + report.
302
+
303
+ 3. Tell the user:
304
+
305
+ ~~~
306
+ ✓ Reporte generado:
307
+ • {Page1Title} — {N1} visuales
308
+ • {Page2Title} — {N2} visuales
309
+ • {Page3Title} — {N3} visuales
310
+
311
+ Power BI Desktop acaba de relanzarse. En ~15-20 segundos deberías ver las
312
+ 3 páginas con todos los visuales. Decime:
313
+
314
+ (a) "renderiza todo" → cerramos acá
315
+ (b) "falta X / aparece raro" → me decís qué visual y lo ajusto
316
+ ~~~
317
+
318
+ ---
319
+
320
+ ## PHASE 6: Update ROADMAP + handoff
321
+
322
+ - **`./ROADMAP.md`**: mark "Fase 4: Reporte generado" with today's date and the 3 page titles.
323
+ - **`./LEARNINGS.md`**: if during generation you discovered anything non-obvious (a measure name convention, a binding quirk for this project), add it.
324
+
325
+ Final message to user:
326
+
327
+ ~~~text
328
+ Listo. Tenés 3 páginas con {N_total} visuales en tu reporte.
329
+
330
+ Para iterar:
331
+ • Editar visuales en PBI Desktop UI directamente (drag, resize, format)
332
+ • O volver a /report-design si querés regenerar desde cero
333
+
334
+ Cuando guardes desde Desktop, commiteá el .pbip a git para versionar.
335
+ ~~~
336
+
337
+ ---
338
+
339
+ ## Bundle contents
340
+
341
+ **References** (`references/`):
342
+ - `native-visuals.md` — **canonical reference**: 28 native visualTypes, their roles, shape canonical, copy-paste examples (read this before authoring)
343
+ - `pbi-desktop-installation.md` — why the standalone installer build is required (not Microsoft Store), install + uninstall steps
344
+ - `cli-setup.md` — how to install Python + pipx + pbi-cli-tool + pywin32 (only needed for model introspection via XMLA; scripts don't require it)
345
+ - `cli-commands.md` — cheatsheet of the `pbi` commands still used by this skill (mostly `pbi connect` / `pbi measure list` for model introspection; authoring commands are superseded by the Node scripts)
346
+ - `textbox.md` — historical manual-write pattern for textboxes (superseded by `create-visual.js --type textbox`; kept for reference)
347
+ - `slicer.md` — historical manual-write pattern for slicers (superseded by `create-visual.js --type slicer --slicer-mode ...`; kept for reference)
348
+ - `close-write-open-pattern.md` — why and how to handle the Desktop restart cycle
349
+ - `pbir-preview-activation.md` — how to activate PBIR preview in Power BI Desktop
350
+ - `troubleshooting.md` — common errors and fixes
351
+ - `layouts/finance.md` — 3-page finance report composition
352
+ - `layouts/sales.md` — 3-page sales report composition
353
+ - `layouts/hr.md` — 3-page HR report composition
354
+ - `layouts/operations.md` — 3-page operations report composition
355
+ - `layouts/marketing.md` — 3-page marketing report composition
356
+ - `layouts/generic.md` — fallback 3-page composition
357
+
358
+ **Scripts** (`scripts/`):
359
+ - `ensure-pbi-cli.sh` — idempotent installer for the pbi-cli-tool (only needed for model introspection via XMLA)
360
+ - `apply-theme.js` — registers a custom PBIR theme with the canonical shape Desktop accepts (replaces the broken `pbi report set-theme` in PBI Desktop March 2026)
361
+ - `create-visual.js` — creates any of the 28 native PBI visualTypes with a canonical `visual.json` shape (replaces `pbi visual add` + `pbi visual bind`; enforces allowlist)
362
+ - `validate-pbir.js` — allowlist + role-checks validator that catches non-native visualTypes and missing/invalid bindings (complements `pbi report validate`)
363
+
364
+ **Bundled themes** (`references/themes/`):
365
+ - `BISuperpowers.json` — house theme applied by default in PHASE 4.3
366
+
367
+ ---
368
+
369
+ ## Related Skills
370
+
371
+ - `/project-kickoff` — runs before this; produces `AGENTS.md` + the semantic model
372
+ - `/pbi-connect` — Microsoft Modeling MCP connection for model operations
373
+
374
+ ## Credit
375
+
376
+ This skill orchestrates the [`pbi-cli-tool`](https://github.com/MinaSaad1/pbi-cli) CLI by MinaSaad1 (MIT License). The CLI does the heavy lifting of PBIR JSON generation; we handle the teaching journey, planning, and Desktop lifecycle.
@@ -0,0 +1,184 @@
1
+ # `pbi` CLI — commands this skill still uses
2
+
3
+ Historical context: this skill used to drive the entire report authoring via `pbi-cli-tool` (MIT, by MinaSaad1). That approach hit 3 regressions (see `native-visuals.md` → "Lo que este skill YA no hace via CLI"), so authoring moved to Node scripts (`apply-theme.js`, `create-visual.js`, `validate-pbir.js`).
4
+
5
+ The CLI is still useful for:
6
+
7
+ 1. **Model introspection** via XMLA — `pbi connect`, `pbi measure list`, `pbi table list`, `pbi column list`. Microsoft Modeling MCP covers the same ground and is preferred when available.
8
+ 2. **Page creation** — `pbi report add-page` still works fine.
9
+ 3. **Schema-level sanity check** — `pbi report validate` catches malformed JSON, but NOT non-native visualTypes (use `validate-pbir.js` for that).
10
+
11
+ Everything else (add visual, bind visual, set theme, set-container for style) is superseded. The sections below cover only the supported flows.
12
+
13
+ All examples assume you're in the project root and `reportPath="./pbip-files/{proj}.Report"`.
14
+
15
+ ---
16
+
17
+ ## Global flags
18
+
19
+ - `-p, --path <path>` — path to the `.Report` folder. Prefer explicit `-p` over CWD auto-detection.
20
+ - `--no-sync` — skip Desktop auto-sync after writes. **Use during the generation loop** (Desktop is closed in PHASE 3 anyway).
21
+ - `--json` — machine-readable output for scripting.
22
+
23
+ ---
24
+
25
+ ## Model introspection (preferred via Microsoft Modeling MCP)
26
+
27
+ ### Connect (once, after Desktop is open)
28
+
29
+ ```bash
30
+ pbi connect
31
+ ```
32
+
33
+ Auto-detects a running PBI Desktop instance on localhost and connects to its XMLA endpoint. Requires the standalone installer build (Microsoft Store version blocks this).
34
+
35
+ ### List measures / tables / columns
36
+
37
+ ```bash
38
+ pbi measure list --json
39
+ pbi table list --json
40
+ pbi column list --table "{tableName}" --json
41
+ ```
42
+
43
+ Returns arrays of `{table, name, description, ...}` suitable for building a `Table[Field]` ref map to pass to `create-visual.js --bind`.
44
+
45
+ ### Disconnect
46
+
47
+ ```bash
48
+ pbi disconnect
49
+ ```
50
+
51
+ Run before PHASE 3 (kill Desktop), otherwise the CLI keeps a stale socket.
52
+
53
+ ---
54
+
55
+ ## Pages (structure)
56
+
57
+ ### List pages
58
+
59
+ ```bash
60
+ pbi report -p "$reportPath" list-pages
61
+ ```
62
+
63
+ ### Add a page
64
+
65
+ ```bash
66
+ pbi report --no-sync -p "$reportPath" add-page \
67
+ --name "{pageName}" \
68
+ --display-name "{Display Name}"
69
+ ```
70
+
71
+ - `--name` — internal identifier (also folder name). Short lowercase ASCII or 20-char hex.
72
+ - `--display-name` — what shows on the page tab.
73
+
74
+ ---
75
+
76
+ ## Validation (two layers)
77
+
78
+ Always run both.
79
+
80
+ ```bash
81
+ # 1. Schema sanity (CLI)
82
+ pbi report -p "$reportPath" validate
83
+
84
+ # 2. Allowlist + role checks (Node script)
85
+ node "{skillBundleDir}/scripts/validate-pbir.js" "$reportPath"
86
+ ```
87
+
88
+ The CLI's `validate` reports `valid: True` even for `visualType: "stackedBarChart"` (not a native type — Desktop renders it as "objeto visual personalizado"). The Node validator catches that.
89
+
90
+ ---
91
+
92
+ ## Theme
93
+
94
+ Inspect the current theme:
95
+
96
+ ```bash
97
+ pbi report -p "$reportPath" get-theme
98
+ ```
99
+
100
+ Apply a custom theme **with the bundled helper, NOT `pbi report set-theme`** (the CLI's `set-theme` writes invalid metadata for PBI Desktop March 2026):
101
+
102
+ ```bash
103
+ node "{skillBundleDir}/scripts/apply-theme.js" \
104
+ --report-path "$reportPath" \
105
+ --theme-file "{skillBundleDir}/references/themes/BISuperpowers.json"
106
+ ```
107
+
108
+ For the full canonical `report.json` theme shape and why `set-theme` was replaced, see `apply-theme.js` header comment.
109
+
110
+ ---
111
+
112
+ ## Reload Desktop
113
+
114
+ ```bash
115
+ pbi report -p "$reportPath" reload
116
+ ```
117
+
118
+ Sends `Ctrl+Shift+F5` via pywin32. **NOT enough** to pick up externally-written visuals — Desktop must be fully killed and relaunched (see `close-write-open-pattern.md`). Use `reload` only for small in-session refreshes.
119
+
120
+ ---
121
+
122
+ ## Visuals (superseded — use `create-visual.js`)
123
+
124
+ `pbi visual add`, `pbi visual bind`, `pbi visual update`, `pbi visual delete`, `pbi visual bulk-bind`, `pbi visual set-container` are **no longer driven by this skill**. Reasons:
125
+
126
+ - `add --type` advertises 5 aliases (`card, line_chart, bar_chart, table, matrix`) but internally accepts ~20 more with PascalCase names. The inconsistency caused the skill's docs to lag behind the CLI's real capabilities.
127
+ - `add --type pie` silently creates a `donutChart` (alias bug).
128
+ - `add --type stackedBarChart` creates a visual with `visualType: "stackedBarChart"` that Desktop rejects at render time — not a native type.
129
+ - `bind` doesn't expose all PBIR roles (`--column`, `--line`, `--x`, `--y`, `--size`, `--breakdown` exist only in `bulk-bind`, not `bind`).
130
+
131
+ The replacement is a single Node script:
132
+
133
+ ```bash
134
+ node "{skillBundleDir}/scripts/create-visual.js" \
135
+ -p "$reportPath" \
136
+ --page "$pageName" \
137
+ --type "{nativeVisualType}" \
138
+ -n "{visualName}" \
139
+ --x {x} --y {y} --width {w} --height {h} \
140
+ --bind "{role}={Table[Field]}" \
141
+ [--bind ...]
142
+ ```
143
+
144
+ See `native-visuals.md` for the 27 supported types and their `--bind` roles.
145
+
146
+ ---
147
+
148
+ ## Key conventions (unchanged)
149
+
150
+ - **Binding syntax is `Table[Field]`**, quoting the table name with single quotes if it has spaces: `'Categorias Finanzas'[Categoria]`.
151
+ - **`--no-sync` on every write** during the generation loop.
152
+ - **`_Measures` prefix convention** — measures live in a hidden `_Measures` table (leading underscore); columns live in their fact or dim table. The Node scripts use this prefix as a disambiguation hint when a role accepts `any` kind (e.g. `tableEx.Values`).
153
+
154
+ ---
155
+
156
+ ## Full end-to-end example
157
+
158
+ ```bash
159
+ # PHASE 0: model introspection
160
+ pbi connect
161
+ pbi measure list --json > measures.json
162
+
163
+ # PHASE 4.1: page
164
+ pbi report --no-sync -p ./pbip-files/Foo.Report add-page --name overview --display-name "Resumen"
165
+
166
+ # PHASE 4.2: visuals (via Node script)
167
+ node scripts/create-visual.js -p ./pbip-files/Foo.Report --page overview --type card \
168
+ -n kpi_revenue --x 24 --y 24 --width 280 --height 120 \
169
+ --bind values='_Measures[Total Revenue]' --title "Ingresos"
170
+
171
+ node scripts/create-visual.js -p ./pbip-files/Foo.Report --page overview --type lineChart \
172
+ -n revenue_trend --x 24 --y 200 --width 816 --height 320 \
173
+ --bind category='Fecha[Fecha]' --bind y='_Measures[Total Revenue]'
174
+
175
+ # PHASE 4.3: theme
176
+ node scripts/apply-theme.js --report-path ./pbip-files/Foo.Report --theme-file references/themes/BISuperpowers.json
177
+
178
+ # PHASE 4.4: validation (both layers)
179
+ pbi report -p ./pbip-files/Foo.Report validate
180
+ node scripts/validate-pbir.js ./pbip-files/Foo.Report
181
+
182
+ # PHASE 5: relaunch Desktop
183
+ powershell -Command "Start-Process -FilePath 'C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe' -ArgumentList '\"<abs-path.pbip>\"'"
184
+ ```
@@ -0,0 +1,101 @@
1
+ # CLI setup — installing `pbi-cli-tool`
2
+
3
+ This skill requires the [`pbi-cli-tool`](https://github.com/MinaSaad1/pbi-cli) CLI (MIT, by MinaSaad1) and its `pywin32` dependency for Power BI Desktop auto-sync. All commands below are idempotent — running them on an already-set-up system is safe.
4
+
5
+ ## Full setup sequence (run in order)
6
+
7
+ Check each prerequisite; if it's already satisfied, skip to the next.
8
+
9
+ ### 1. Python 3.10+
10
+
11
+ ```bash
12
+ python --version
13
+ ```
14
+
15
+ If the output is `Python 3.10.x` or newer, continue. Otherwise install Python:
16
+
17
+ **Microsoft Store** (easiest on Windows — adds to PATH automatically):
18
+ - Open Microsoft Store → search "Python 3.13" (Publisher: Python Software Foundation) → Install
19
+ - **Close and reopen the terminal** after install so `python` is on PATH
20
+
21
+ **Manual from python.org**:
22
+ - Download installer from https://www.python.org/downloads/
23
+ - During install, check **"Add python.exe to PATH"**
24
+ - Close and reopen the terminal
25
+
26
+ ### 2. `pipx`
27
+
28
+ ```bash
29
+ pipx --version
30
+ ```
31
+
32
+ If it reports a version, skip to step 3. Otherwise:
33
+
34
+ ```bash
35
+ pip install --user pipx
36
+ python -m pipx ensurepath
37
+ ```
38
+
39
+ Close and reopen the terminal so the new PATH entries take effect. Then verify:
40
+
41
+ ```bash
42
+ pipx --version
43
+ ```
44
+
45
+ ### 3. `pbi-cli-tool`
46
+
47
+ ```bash
48
+ pbi --version
49
+ ```
50
+
51
+ If it reports `3.10.x` or newer, skip to step 4. Otherwise:
52
+
53
+ ```bash
54
+ pipx install pbi-cli-tool
55
+ ```
56
+
57
+ ### 4. Inject `pywin32` into the pbi-cli pipx environment
58
+
59
+ The `pywin32` package lets `pbi` send keystrokes to Power BI Desktop for auto-sync. Without it, the CLI falls back to PowerShell-based signaling which is less reliable.
60
+
61
+ ```bash
62
+ python -m pipx inject pbi-cli-tool pywin32
63
+ ```
64
+
65
+ Verify the CLI picks it up:
66
+
67
+ ```bash
68
+ pbi visual add --help
69
+ # If the previous run printed "Error: pywin32 is not installed", run the inject.
70
+ # If no such warning appears on subsequent runs, pywin32 is loaded.
71
+ ```
72
+
73
+ ### 5. Optional — upgrade later
74
+
75
+ ```bash
76
+ pipx upgrade pbi-cli-tool
77
+ python -m pipx inject pbi-cli-tool pywin32 --force # refresh the injection
78
+ ```
79
+
80
+ Run this periodically (monthly) since MinaSaad1 ships updates alongside Power BI Desktop schema bumps.
81
+
82
+ ## Troubleshooting
83
+
84
+ **`pbi: command not found`** after install → terminal PATH needs refresh. Close and reopen. If still missing, `python -m pipx ensurepath` again.
85
+
86
+ **`pip: command not found`** with Python installed → the Microsoft Store install sometimes doesn't put `pip` on PATH. Use `python -m pip ...` instead.
87
+
88
+ **`Found a space in the pipx home path`** warning → harmless on Windows. The CLI works despite this.
89
+
90
+ **`Error: pywin32 is not installed`** when running `pbi visual add` → you ran `pip install --user pywin32` (wrong scope). Instead run `python -m pipx inject pbi-cli-tool pywin32` so it lands in the CLI's isolated venv.
91
+
92
+ ## Sanity check (run after full setup)
93
+
94
+ ```bash
95
+ pbi --version # should print a version
96
+ pbi setup # should print "Environment is ready."
97
+ pbi connect # should auto-detect running Power BI Desktop
98
+ pbi disconnect # clean disconnect
99
+ ```
100
+
101
+ If all four commands succeed, the skill can proceed to PHASE 1.