pbi-enterprise-cli 0.1.0.dev0__py3-none-any.whl

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 (61) hide show
  1. pbi_cli/__init__.py +3 -0
  2. pbi_cli/_audit.py +57 -0
  3. pbi_cli/_snapshot.py +95 -0
  4. pbi_cli/backends/__init__.py +1 -0
  5. pbi_cli/backends/mock_backend.py +323 -0
  6. pbi_cli/backends/pbir_backend.py +813 -0
  7. pbi_cli/backends/protocol.py +52 -0
  8. pbi_cli/backends/tom_backend.py +650 -0
  9. pbi_cli/backends/xmla_backend.py +627 -0
  10. pbi_cli/cli.py +332 -0
  11. pbi_cli/commands/__init__.py +1 -0
  12. pbi_cli/commands/_doctor.py +84 -0
  13. pbi_cli/commands/_shared.py +88 -0
  14. pbi_cli/commands/calendar_cmd.py +186 -0
  15. pbi_cli/commands/connections.py +153 -0
  16. pbi_cli/commands/custom_visual.py +325 -0
  17. pbi_cli/commands/database.py +76 -0
  18. pbi_cli/commands/dax.py +174 -0
  19. pbi_cli/commands/deploy.py +193 -0
  20. pbi_cli/commands/docs.py +57 -0
  21. pbi_cli/commands/filter_cmd.py +235 -0
  22. pbi_cli/commands/govern.py +124 -0
  23. pbi_cli/commands/layout.py +104 -0
  24. pbi_cli/commands/measure.py +185 -0
  25. pbi_cli/commands/model.py +499 -0
  26. pbi_cli/commands/partition.py +89 -0
  27. pbi_cli/commands/repl.py +209 -0
  28. pbi_cli/commands/report.py +561 -0
  29. pbi_cli/commands/security.py +90 -0
  30. pbi_cli/commands/server_cmd.py +30 -0
  31. pbi_cli/commands/skills_cmd.py +168 -0
  32. pbi_cli/commands/source.py +581 -0
  33. pbi_cli/commands/theme.py +60 -0
  34. pbi_cli/commands/trace.py +142 -0
  35. pbi_cli/commands/visual.py +507 -0
  36. pbi_cli/commands/watch.py +145 -0
  37. pbi_cli/docs_gen/__init__.py +1 -0
  38. pbi_cli/docs_gen/confluence.py +24 -0
  39. pbi_cli/docs_gen/markdown.py +36 -0
  40. pbi_cli/governance/__init__.py +1 -0
  41. pbi_cli/governance/engine.py +70 -0
  42. pbi_cli/governance/rules/__init__.py +85 -0
  43. pbi_cli/governance/rules/measure_brackets.py +27 -0
  44. pbi_cli/governance/rules/measure_description.py +41 -0
  45. pbi_cli/governance/rules/measure_format.py +38 -0
  46. pbi_cli/governance/rules/measure_naming.py +93 -0
  47. pbi_cli/governance/rules/table_pascal_case.py +44 -0
  48. pbi_cli/intelligence/__init__.py +1 -0
  49. pbi_cli/intelligence/layout_engine.py +192 -0
  50. pbi_cli/intelligence/measure_generator.py +40 -0
  51. pbi_cli/intelligence/theme_generator.py +193 -0
  52. pbi_cli/intelligence/visual_builder.py +429 -0
  53. pbi_cli/intelligence/visual_recommender.py +42 -0
  54. pbi_cli/server/__init__.py +1 -0
  55. pbi_cli/server/api.py +185 -0
  56. pbi_enterprise_cli-0.1.0.dev0.dist-info/METADATA +103 -0
  57. pbi_enterprise_cli-0.1.0.dev0.dist-info/RECORD +61 -0
  58. pbi_enterprise_cli-0.1.0.dev0.dist-info/WHEEL +5 -0
  59. pbi_enterprise_cli-0.1.0.dev0.dist-info/entry_points.txt +2 -0
  60. pbi_enterprise_cli-0.1.0.dev0.dist-info/licenses/LICENSE +21 -0
  61. pbi_enterprise_cli-0.1.0.dev0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,168 @@
1
+ """pbi skills — install, list, and uninstall Claude Code skill files."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import shutil
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ import click
10
+ from rich.console import Console
11
+ from rich.table import Table
12
+
13
+ console = Console()
14
+
15
+ # Canonical skills bundled with pbi-cli
16
+ _BUNDLED_SKILLS: list[dict[str, Any]] = [
17
+ {"name": "power-bi-dax", "description": "DAX query, validate, and unit-test workflows"},
18
+ {
19
+ "name": "power-bi-modeling",
20
+ "description": "Semantic model management: tables, columns, relationships",
21
+ },
22
+ {
23
+ "name": "power-bi-governance",
24
+ "description": "Governance rules, auto-fix, and custom plugin authoring",
25
+ },
26
+ {"name": "power-bi-report", "description": "Report page and scaffold management"},
27
+ {"name": "power-bi-visuals", "description": "Visual add, list, and conditional formatting"},
28
+ {
29
+ "name": "power-bi-sources",
30
+ "description": "Data source profiling and star-schema scaffolding",
31
+ },
32
+ {"name": "power-bi-security", "description": "RLS role management and row-filter testing"},
33
+ {"name": "power-bi-partitions", "description": "Partition management and incremental refresh"},
34
+ {"name": "power-bi-deployment", "description": "Deploy and promote models via XMLA"},
35
+ {"name": "power-bi-deployment-pipeline", "description": "CI/CD pipeline integration patterns"},
36
+ {"name": "power-bi-themes", "description": "WCAG-compliant theme generation"},
37
+ {"name": "power-bi-layout", "description": "Shelf-packing auto-layout and templates"},
38
+ {
39
+ "name": "power-bi-performance",
40
+ "description": "Query tracing, benchmarking, and model health",
41
+ },
42
+ {"name": "power-bi-docs", "description": "Data dictionary and documentation generation"},
43
+ {
44
+ "name": "power-bi-diagnostics",
45
+ "description": "Doctor, environment checks, and troubleshooting",
46
+ },
47
+ {"name": "power-bi-filters", "description": "Report filter management"},
48
+ {
49
+ "name": "power-bi-custom-visuals",
50
+ "description": "Custom visual SDK — scaffold, build, package, import",
51
+ },
52
+ {"name": "power-bi-patterns", "description": "DAX and model design patterns"},
53
+ {"name": "power-bi-troubleshooter", "description": "Guided troubleshooting workflows"},
54
+ {"name": "power-bi-testing", "description": "DAX unit-test suite authoring and CI integration"},
55
+ {"name": "power-bi-pages", "description": "Page type management (drillthrough, tooltip)"},
56
+ {"name": "power-bi-page-designer", "description": "Page layout and visual arrangement"},
57
+ {
58
+ "name": "power-bi-design-system",
59
+ "description": "Colour palette, typography, and brand consistency",
60
+ },
61
+ {
62
+ "name": "power-bi-project-orchestrator",
63
+ "description": "End-to-end project orchestration workflows",
64
+ },
65
+ ]
66
+
67
+
68
+ def _skills_source_dir() -> Path:
69
+ """Return the bundled skills directory (ships with pbi-cli)."""
70
+ return Path(__file__).parent.parent.parent.parent / "skills"
71
+
72
+
73
+ def _claude_skills_dir() -> Path:
74
+ """Return the Claude Code global skills directory."""
75
+ return Path.home() / ".claude" / "skills"
76
+
77
+
78
+ @click.group("skills")
79
+ def skills_cmd() -> None:
80
+ """Manage Claude Code skill files for Power BI development."""
81
+
82
+
83
+ @skills_cmd.command("list")
84
+ @click.option("--installed", is_flag=True, help="Show only installed skills.")
85
+ def skills_list(installed: bool) -> None:
86
+ """List all available (or installed) pbi-cli skills."""
87
+ target_dir = _claude_skills_dir()
88
+ table = Table(title="pbi-cli Skills")
89
+ table.add_column("Name")
90
+ table.add_column("Installed", justify="center")
91
+ table.add_column("Description")
92
+ for skill in _BUNDLED_SKILLS:
93
+ is_installed = (target_dir / skill["name"]).exists()
94
+ if installed and not is_installed:
95
+ continue
96
+ status = "[green]✓[/green]" if is_installed else "[dim]–[/dim]"
97
+ table.add_row(skill["name"], status, skill["description"])
98
+ console.print(table)
99
+ if not installed:
100
+ console.print("\n[dim]Install all with:[/dim] pbi skills install --all")
101
+
102
+
103
+ @skills_cmd.command("install")
104
+ @click.argument("skill_names", nargs=-1)
105
+ @click.option("--all", "install_all", is_flag=True, help="Install all bundled skills.")
106
+ @click.option(
107
+ "--target",
108
+ default=None,
109
+ type=click.Path(),
110
+ help="Override target directory (default: ~/.claude/skills/).",
111
+ )
112
+ def skills_install(skill_names: tuple[str, ...], install_all: bool, target: str | None) -> None:
113
+ """Install one or more pbi-cli skills into the Claude Code skills directory.
114
+
115
+ \b
116
+ Examples:
117
+ pbi skills install power-bi-dax power-bi-governance
118
+ pbi skills install --all
119
+ """
120
+ target_dir = Path(target) if target else _claude_skills_dir()
121
+ target_dir.mkdir(parents=True, exist_ok=True)
122
+ source_dir = _skills_source_dir()
123
+
124
+ names = [s["name"] for s in _BUNDLED_SKILLS] if install_all else list(skill_names)
125
+ if not names:
126
+ console.print("[yellow]Specify skill names or use --all.[/yellow]")
127
+ console.print("Run 'pbi skills list' to see available skills.")
128
+ return
129
+
130
+ installed = 0
131
+ for name in names:
132
+ src = source_dir / name
133
+ if not src.exists():
134
+ console.print(f" [yellow]Not found:[/yellow] {name}")
135
+ continue
136
+ dst = target_dir / name
137
+ if dst.exists():
138
+ shutil.rmtree(dst)
139
+ shutil.copytree(src, dst)
140
+ console.print(f" [green]Installed:[/green] {name} → {dst}")
141
+ installed += 1
142
+
143
+ console.print(f"\n[green]{installed} skill(s) installed[/green] to {target_dir}")
144
+ if installed:
145
+ console.print("[dim]Restart Claude Code to pick up newly installed skills.[/dim]")
146
+
147
+
148
+ @skills_cmd.command("uninstall")
149
+ @click.argument("skill_names", nargs=-1)
150
+ @click.option("--all", "uninstall_all", is_flag=True, help="Uninstall all pbi-cli skills.")
151
+ @click.option("--target", default=None, type=click.Path(), help="Override target directory.")
152
+ def skills_uninstall(skill_names: tuple[str, ...], uninstall_all: bool, target: str | None) -> None:
153
+ """Remove installed pbi-cli skills from the Claude Code skills directory."""
154
+ target_dir = Path(target) if target else _claude_skills_dir()
155
+ names = [s["name"] for s in _BUNDLED_SKILLS] if uninstall_all else list(skill_names)
156
+ if not names:
157
+ console.print("[yellow]Specify skill names or use --all.[/yellow]")
158
+ return
159
+ removed = 0
160
+ for name in names:
161
+ dst = target_dir / name
162
+ if dst.exists():
163
+ shutil.rmtree(dst)
164
+ console.print(f" [red]Removed:[/red] {name}")
165
+ removed += 1
166
+ else:
167
+ console.print(f" [dim]Not installed:[/dim] {name}")
168
+ console.print(f"\n[green]{removed} skill(s) removed.[/green]")