@luquimbo/bi-superpowers 5.0.0 → 5.0.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 (97) hide show
  1. package/.claude-plugin/marketplace.json +5 -3
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.claude-plugin/skill-manifest.json +23 -7
  4. package/.plugin/plugin.json +1 -1
  5. package/AGENTS.md +123 -25
  6. package/CHANGELOG.md +459 -16
  7. package/README.md +28 -113
  8. package/bin/cli.js +1 -1
  9. package/bin/commands/diff.js +2 -2
  10. package/bin/commands/install.js +58 -45
  11. package/bin/commands/lint.js +2 -2
  12. package/bin/commands/validate-projects.js +1 -1
  13. package/bin/lib/generators/claude-plugin.js +14 -5
  14. package/bin/lib/generators/shared.js +9 -5
  15. package/bin/lib/mcp-config.js +22 -2
  16. package/bin/lib/skills.js +8 -8
  17. package/bin/mcp/powerbi-modeling-launcher.js +8 -4
  18. package/bin/postinstall.js +14 -12
  19. package/bin/utils/mcp-detect.js +11 -11
  20. package/commands/bi-connect.md +34 -17
  21. package/commands/bi-dax.md +385 -0
  22. package/commands/bi-kickoff.md +75 -44
  23. package/commands/bi-modeling.md +395 -0
  24. package/commands/bi-performance.md +455 -0
  25. package/commands/bi-start.md +30 -18
  26. package/desktop-extension/manifest.json +2 -2
  27. package/package.json +3 -2
  28. package/skills/bi-connect/SKILL.md +34 -17
  29. package/skills/bi-connect/scripts/update-check.js +1 -1
  30. package/skills/bi-dax/SKILL.md +387 -0
  31. package/skills/{bi-report → bi-dax}/scripts/update-check.js +1 -1
  32. package/skills/bi-kickoff/SKILL.md +75 -44
  33. package/skills/bi-kickoff/scripts/update-check.js +1 -1
  34. package/skills/bi-modeling/SKILL.md +397 -0
  35. package/skills/bi-modeling/scripts/update-check.js +403 -0
  36. package/skills/bi-performance/SKILL.md +457 -0
  37. package/skills/bi-performance/scripts/install-tabular-editor.ps1 +90 -0
  38. package/skills/bi-performance/scripts/run-bpa.ps1 +161 -0
  39. package/skills/bi-performance/scripts/update-check.js +403 -0
  40. package/skills/bi-start/SKILL.md +31 -19
  41. package/skills/bi-start/scripts/update-check.js +1 -1
  42. package/src/content/base.md +13 -8
  43. package/src/content/routing.md +1 -5
  44. package/src/content/skills/bi-connect.md +32 -15
  45. package/src/content/skills/bi-dax.md +358 -0
  46. package/src/content/skills/bi-kickoff.md +73 -42
  47. package/src/content/skills/bi-modeling.md +368 -0
  48. package/src/content/skills/bi-performance/SKILL.md +428 -0
  49. package/src/content/skills/bi-performance/scripts/install-tabular-editor.ps1 +90 -0
  50. package/src/content/skills/bi-performance/scripts/run-bpa.ps1 +161 -0
  51. package/src/content/skills/bi-start.md +30 -18
  52. package/theme/BISuperpowers.json +3888 -0
  53. package/commands/bi-report.md +0 -403
  54. package/skills/bi-report/SKILL.md +0 -405
  55. package/skills/bi-report/references/cli-commands.md +0 -184
  56. package/skills/bi-report/references/cli-setup.md +0 -101
  57. package/skills/bi-report/references/close-write-open-pattern.md +0 -80
  58. package/skills/bi-report/references/layouts/finance.md +0 -65
  59. package/skills/bi-report/references/layouts/generic.md +0 -46
  60. package/skills/bi-report/references/layouts/hr.md +0 -48
  61. package/skills/bi-report/references/layouts/marketing.md +0 -45
  62. package/skills/bi-report/references/layouts/operations.md +0 -44
  63. package/skills/bi-report/references/layouts/sales.md +0 -50
  64. package/skills/bi-report/references/native-visuals.md +0 -341
  65. package/skills/bi-report/references/pbi-desktop-installation.md +0 -87
  66. package/skills/bi-report/references/pbir-preview-activation.md +0 -40
  67. package/skills/bi-report/references/slicer.md +0 -89
  68. package/skills/bi-report/references/textbox.md +0 -101
  69. package/skills/bi-report/references/themes/BISuperpowers.json +0 -915
  70. package/skills/bi-report/references/troubleshooting.md +0 -135
  71. package/skills/bi-report/references/visual-types.md +0 -78
  72. package/skills/bi-report/scripts/apply-theme.js +0 -243
  73. package/skills/bi-report/scripts/create-visual.js +0 -942
  74. package/skills/bi-report/scripts/ensure-pbi-cli.sh +0 -41
  75. package/skills/bi-report/scripts/validate-pbir.js +0 -351
  76. package/src/content/skills/bi-report/SKILL.md +0 -376
  77. package/src/content/skills/bi-report/references/cli-commands.md +0 -184
  78. package/src/content/skills/bi-report/references/cli-setup.md +0 -101
  79. package/src/content/skills/bi-report/references/close-write-open-pattern.md +0 -80
  80. package/src/content/skills/bi-report/references/layouts/finance.md +0 -65
  81. package/src/content/skills/bi-report/references/layouts/generic.md +0 -46
  82. package/src/content/skills/bi-report/references/layouts/hr.md +0 -48
  83. package/src/content/skills/bi-report/references/layouts/marketing.md +0 -45
  84. package/src/content/skills/bi-report/references/layouts/operations.md +0 -44
  85. package/src/content/skills/bi-report/references/layouts/sales.md +0 -50
  86. package/src/content/skills/bi-report/references/native-visuals.md +0 -341
  87. package/src/content/skills/bi-report/references/pbi-desktop-installation.md +0 -87
  88. package/src/content/skills/bi-report/references/pbir-preview-activation.md +0 -40
  89. package/src/content/skills/bi-report/references/slicer.md +0 -89
  90. package/src/content/skills/bi-report/references/textbox.md +0 -101
  91. package/src/content/skills/bi-report/references/themes/BISuperpowers.json +0 -915
  92. package/src/content/skills/bi-report/references/troubleshooting.md +0 -135
  93. package/src/content/skills/bi-report/references/visual-types.md +0 -78
  94. package/src/content/skills/bi-report/scripts/apply-theme.js +0 -243
  95. package/src/content/skills/bi-report/scripts/create-visual.js +0 -942
  96. package/src/content/skills/bi-report/scripts/ensure-pbi-cli.sh +0 -41
  97. package/src/content/skills/bi-report/scripts/validate-pbir.js +0 -351
@@ -1,41 +0,0 @@
1
- #!/bin/bash
2
- # ensure-pbi-cli.sh — idempotent installer for pbi-cli-tool + pywin32
3
- # Run from any directory. Requires Python 3.10+ and pip on PATH.
4
- # Exit code 0 = ready, 1 = install failed
5
-
6
- set -e
7
-
8
- check_python() {
9
- python --version 2>/dev/null | grep -qE "Python 3\.(1[0-9]|[2-9][0-9])" && return 0
10
- python3 --version 2>/dev/null | grep -qE "Python 3\.(1[0-9]|[2-9][0-9])" && return 0
11
- echo "❌ Python 3.10+ required. Install from Microsoft Store or python.org."
12
- exit 1
13
- }
14
-
15
- check_pipx() {
16
- pipx --version 2>/dev/null && return 0
17
- python -m pipx --version 2>/dev/null && return 0
18
- echo "📦 Installing pipx..."
19
- pip install --user pipx 2>/dev/null || python -m pip install --user pipx
20
- python -m pipx ensurepath
21
- echo "⚠ Close and reopen your terminal, then re-run this script."
22
- exit 1
23
- }
24
-
25
- check_pbi() {
26
- pbi --version 2>/dev/null && return 0
27
- echo "📦 Installing pbi-cli-tool..."
28
- python -m pipx install pbi-cli-tool
29
- }
30
-
31
- inject_pywin32() {
32
- python -m pipx inject pbi-cli-tool pywin32 2>/dev/null || true
33
- }
34
-
35
- echo "Checking pbi-cli-tool environment..."
36
- check_python
37
- check_pipx
38
- check_pbi
39
- inject_pywin32
40
- echo "✅ pbi-cli-tool is ready."
41
- pbi --version
@@ -1,351 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * validate-pbir.js — allowlist-driven PBIR validator.
4
- *
5
- * Complements `pbi report validate` (which does schema sanity) by enforcing
6
- * the native-visuals allowlist maintained in create-visual.js. Catches:
7
- *
8
- * - visualType that's not a native PBIR type (e.g. `stackedBarChart`,
9
- * typos) — Desktop renders these as "objeto visual personalizado" but
10
- * the CLI validate passes them. This is the exact bug F1 that motivated
11
- * the migration away from the CLI.
12
- *
13
- * - bindings on roles that the type doesn't declare (e.g. `--bind size`
14
- * on a funnelChart) — CLI validate doesn't catch these either.
15
- *
16
- * - missing required roles (e.g. a barChart with no Category).
17
- *
18
- * - visualContainer schema drift (wrong $schema URL or missing `name`).
19
- *
20
- * Usage:
21
- * node validate-pbir.js <reportPath>
22
- * node validate-pbir.js --json <reportPath> # machine-readable output
23
- *
24
- * Exit codes:
25
- * 0 valid
26
- * 1 validation errors found
27
- * 2 I/O error (bad path, corrupt JSON)
28
- *
29
- * NOT a replacement for `pbi report validate` — run both. This validator
30
- * trusts that the .Report folder is structurally correct (has definition/,
31
- * pages/, etc.) and focuses on visual-level correctness that the CLI misses.
32
- */
33
-
34
- 'use strict';
35
-
36
- const fs = require('fs');
37
- const path = require('path');
38
-
39
- const { NATIVE_VISUAL_TYPES, KNOWN_NON_NATIVE_TYPES } = require('./create-visual.js');
40
-
41
- const EXPECTED_VISUAL_SCHEMA =
42
- 'https://developer.microsoft.com/json-schemas/fabric/item/report/definition/visualContainer/2.7.0/schema.json';
43
-
44
- function fail(msg, code = 2) {
45
- process.stderr.write(`validate-pbir: ${msg}\n`);
46
- process.exit(code);
47
- }
48
-
49
- function parseArgs(argv) {
50
- const out = {};
51
- const positional = [];
52
- for (let i = 0; i < argv.length; i += 1) {
53
- const a = argv[i];
54
- if (a === '--json') out.json = true;
55
- else if (a === '-h' || a === '--help') out.help = true;
56
- else if (a.startsWith('-')) fail(`unknown flag: ${a}`, 2);
57
- else positional.push(a);
58
- }
59
- out.reportPath = positional[0];
60
- return out;
61
- }
62
-
63
- function printHelp() {
64
- process.stdout.write(
65
- [
66
- 'Usage: validate-pbir.js [--json] <reportPath>',
67
- '',
68
- 'Arguments:',
69
- ' reportPath Path to a .Report folder',
70
- '',
71
- 'Options:',
72
- ' --json Emit JSON instead of human-readable output',
73
- ' -h, --help Show this help',
74
- '',
75
- 'Exit codes:',
76
- ' 0 valid',
77
- ' 1 validation errors found',
78
- ' 2 I/O error',
79
- '',
80
- ].join('\n')
81
- );
82
- }
83
-
84
- function listPages(reportPath) {
85
- const pagesDir = path.join(reportPath, 'definition', 'pages');
86
- if (!fs.existsSync(pagesDir)) {
87
- fail(`pages directory not found: ${pagesDir}`, 2);
88
- }
89
- const out = [];
90
- for (const entry of fs.readdirSync(pagesDir, { withFileTypes: true })) {
91
- if (!entry.isDirectory()) continue;
92
- const pageJsonPath = path.join(pagesDir, entry.name, 'page.json');
93
- if (!fs.existsSync(pageJsonPath)) continue;
94
- out.push({ name: entry.name, dir: path.join(pagesDir, entry.name) });
95
- }
96
- return out;
97
- }
98
-
99
- function listVisuals(pageDir) {
100
- const visualsDir = path.join(pageDir, 'visuals');
101
- if (!fs.existsSync(visualsDir)) return [];
102
- const out = [];
103
- for (const entry of fs.readdirSync(visualsDir, { withFileTypes: true })) {
104
- if (!entry.isDirectory()) continue;
105
- const visualJsonPath = path.join(visualsDir, entry.name, 'visual.json');
106
- if (!fs.existsSync(visualJsonPath)) continue;
107
- out.push({ name: entry.name, path: visualJsonPath });
108
- }
109
- return out;
110
- }
111
-
112
- function readJsonSafe(filePath) {
113
- try {
114
- const raw = fs.readFileSync(filePath, 'utf8');
115
- return { data: JSON.parse(raw), err: null };
116
- } catch (err) {
117
- return { data: null, err };
118
- }
119
- }
120
-
121
- // Extracts the set of roles that have at least one projection bound.
122
- function boundRoles(visualData) {
123
- const qs = visualData && visualData.visual && visualData.visual.query && visualData.visual.query.queryState;
124
- if (!qs || typeof qs !== 'object') return new Set();
125
- const bound = new Set();
126
- for (const [role, spec] of Object.entries(qs)) {
127
- const projections = spec && spec.projections;
128
- if (Array.isArray(projections) && projections.length > 0) bound.add(role);
129
- }
130
- return bound;
131
- }
132
-
133
- function validatePosition(position) {
134
- const errors = [];
135
- const requiredFields = ['x', 'y', 'z', 'height', 'width', 'tabOrder'];
136
-
137
- if (!position || typeof position !== 'object') {
138
- return requiredFields.map((field) => ({
139
- severity: 'error',
140
- rule: 'position-number',
141
- field,
142
- message: `position.${field} must be a finite number`,
143
- }));
144
- }
145
-
146
- for (const field of requiredFields) {
147
- if (!Number.isFinite(position[field])) {
148
- errors.push({
149
- severity: 'error',
150
- rule: 'position-number',
151
- field,
152
- message: `position.${field} must be a finite number`,
153
- });
154
- }
155
- }
156
-
157
- return errors;
158
- }
159
-
160
- function validateVisual(visual) {
161
- const errors = [];
162
- const { data, path: filePath } = visual;
163
-
164
- // Schema URL check.
165
- if (data.$schema !== EXPECTED_VISUAL_SCHEMA) {
166
- errors.push({
167
- severity: 'warn',
168
- rule: 'schema-url',
169
- message: `unexpected $schema (got ${data.$schema || 'none'})`,
170
- });
171
- }
172
-
173
- // `name` must exist and match the folder.
174
- if (typeof data.name !== 'string' || !data.name) {
175
- errors.push({ severity: 'error', rule: 'name', message: 'missing "name"' });
176
- }
177
-
178
- errors.push(...validatePosition(data.position));
179
-
180
- const vt = data.visual && data.visual.visualType;
181
- if (!vt) {
182
- errors.push({ severity: 'error', rule: 'visual-type', message: 'missing visualType' });
183
- return errors;
184
- }
185
-
186
- // Allowlist: known non-native (like stackedBarChart).
187
- if (KNOWN_NON_NATIVE_TYPES[vt]) {
188
- errors.push({
189
- severity: 'error',
190
- rule: 'non-native-type',
191
- visualType: vt,
192
- message: KNOWN_NON_NATIVE_TYPES[vt],
193
- });
194
- return errors;
195
- }
196
-
197
- const def = NATIVE_VISUAL_TYPES[vt];
198
- if (!def) {
199
- errors.push({
200
- severity: 'error',
201
- rule: 'unknown-type',
202
- visualType: vt,
203
- message: `visualType "${vt}" is not in the native allowlist. Run create-visual.js --list-types for the canonical list.`,
204
- });
205
- return errors;
206
- }
207
-
208
- // Check required roles are bound (skip for textbox — no roles).
209
- if (vt !== 'textbox') {
210
- const bound = boundRoles(data);
211
- for (const [role, spec] of Object.entries(def.roles)) {
212
- if (spec.required && !bound.has(role)) {
213
- errors.push({
214
- severity: 'error',
215
- rule: 'missing-required-role',
216
- visualType: vt,
217
- role,
218
- message: `required role "${role}" has no projections (visualType: ${vt})`,
219
- });
220
- }
221
- }
222
-
223
- // Check that every bound role is valid for this type.
224
- for (const role of bound) {
225
- if (!(role in def.roles)) {
226
- errors.push({
227
- severity: 'error',
228
- rule: 'invalid-role',
229
- visualType: vt,
230
- role,
231
- message: `role "${role}" is not valid for visualType ${vt}. Valid: ${Object.keys(def.roles).join(', ') || '(none)'}`,
232
- });
233
- }
234
- }
235
- }
236
-
237
- return errors;
238
- }
239
-
240
- function main() {
241
- const args = parseArgs(process.argv.slice(2));
242
- if (args.help) {
243
- printHelp();
244
- return;
245
- }
246
- if (!args.reportPath) fail('reportPath is required. Run --help for usage.', 2);
247
-
248
- const reportPath = path.resolve(args.reportPath);
249
- if (!fs.existsSync(reportPath)) fail(`not found: ${reportPath}`, 2);
250
-
251
- const pages = listPages(reportPath);
252
- const results = {
253
- reportPath,
254
- pagesChecked: pages.length,
255
- visualsChecked: 0,
256
- errors: [],
257
- };
258
-
259
- for (const page of pages) {
260
- const visuals = listVisuals(page.dir);
261
- // Track visual.name per page so we can flag duplicates. PBI Desktop
262
- // does not reject a duplicate-name pair on load, but downstream tooling
263
- // that references visuals by name (filters, bookmarks, selections) gets
264
- // ambiguous — validate-pbir treats it as a hard error.
265
- const namesSeenOnPage = new Map();
266
- for (const v of visuals) {
267
- results.visualsChecked += 1;
268
- const { data, err } = readJsonSafe(v.path);
269
- if (err) {
270
- results.errors.push({
271
- page: page.name,
272
- visual: v.name,
273
- severity: 'error',
274
- rule: 'bad-json',
275
- message: `could not parse visual.json: ${err.message}`,
276
- });
277
- continue;
278
- }
279
-
280
- // Duplicate-name check (page-scoped).
281
- const declaredName = data && typeof data.name === 'string' ? data.name : null;
282
- if (declaredName) {
283
- if (namesSeenOnPage.has(declaredName)) {
284
- results.errors.push({
285
- page: page.name,
286
- visual: v.name,
287
- severity: 'error',
288
- rule: 'duplicate-name',
289
- message: `visual name "${declaredName}" is also used by "${namesSeenOnPage.get(declaredName)}" on this page`,
290
- });
291
- } else {
292
- namesSeenOnPage.set(declaredName, v.name);
293
- }
294
- }
295
-
296
- const visualErrors = validateVisual({ data, path: v.path });
297
- for (const e of visualErrors) {
298
- results.errors.push({
299
- page: page.name,
300
- visual: v.name,
301
- ...e,
302
- });
303
- }
304
- }
305
- }
306
-
307
- const errorCount = results.errors.filter((e) => e.severity === 'error').length;
308
- const warnCount = results.errors.filter((e) => e.severity === 'warn').length;
309
- const valid = errorCount === 0;
310
-
311
- if (args.json) {
312
- process.stdout.write(JSON.stringify({ ...results, valid, errorCount, warnCount }, null, 2) + '\n');
313
- } else {
314
- const W = 77; // inner width between the | borders
315
- const padRow = (label, value) => {
316
- const text = `${label}: ${value}`;
317
- return `| ${text}${' '.repeat(Math.max(0, W - text.length - 1))}|`;
318
- };
319
- const border = `+${'-'.repeat(W)}+`;
320
- process.stdout.write(border + '\n');
321
- process.stdout.write(padRow('valid', valid ? 'True' : 'False') + '\n');
322
- process.stdout.write(padRow('pages_checked', String(results.pagesChecked)) + '\n');
323
- process.stdout.write(padRow('visuals_checked', String(results.visualsChecked)) + '\n');
324
- process.stdout.write(padRow('errors', String(errorCount)) + '\n');
325
- process.stdout.write(padRow('warnings', String(warnCount)) + '\n');
326
- process.stdout.write(border + '\n');
327
- if (results.errors.length) {
328
- process.stdout.write('\nIssues:\n');
329
- for (const e of results.errors) {
330
- const icon = e.severity === 'error' ? '✗' : '⚠';
331
- const loc = `${e.page}/${e.visual}`;
332
- process.stdout.write(` ${icon} [${e.rule}] ${loc}: ${e.message}\n`);
333
- }
334
- process.stdout.write('\n');
335
- }
336
- }
337
-
338
- process.exit(valid ? 0 : 1);
339
- }
340
-
341
- module.exports = {
342
- validateVisual,
343
- boundRoles,
344
- listPages,
345
- listVisuals,
346
- parseArgs,
347
- };
348
-
349
- if (require.main === module) {
350
- main();
351
- }