PBIP Forge: Generate Power BI Projects Directly with DSH

Introduction

When agents generate reports, the old approach was either hardcoding a .pbix file or using computer-use to click through Power BI Desktop page by page. The latter is time-consuming and hard to reproduce; the former is costly to modify. PBIP Forge’s goal is: let agents describe reports in natural language and directly generate a complete Power BI project (.pbip), which can then be opened by Power BI Desktop or Fabric.

PBIP Forge is an unofficial (non-Microsoft) project. It relies on Microsoft’s publicly documented PBIP/TMDL/PBIR formats and is maintained by Lee2277-t.

Plugin Positioning

  • Core capability: Directly write JSON configuration to disk as a .pbip project, including the semantic model (TMDL tables, columns, DAX measures, relationships, RLS roles) and the report (PBIR pages, native visuals).
  • Cross-platform entry points: DSH native plugin, CLI, and MCP server.
  • Windowless by default: Generation and validation never launch Power BI Desktop; a window only opens when powerbi_open is explicitly invoked.

Core Features

Generated Content

  • Semantic model: TMDL tables, columns, DAX measures, calculated columns, relationships, hierarchies, RLS roles.
  • Report: PBIR pages, text boxes, cards, bar charts/column charts, line charts, area charts, pie charts/donut charts, tables, matrices, slicers, scatter charts, gauges, KPIs.
  • Verifiable: TMDL is parsed by the Power BI Tabular engine; PBIR is validated against Microsoft’s official JSON Schema.

Data Sources

  • rows: Inline arrays, suitable for small-to-medium data or demos.
  • csv: Reads UTF-8 CSV with automatic header and type detection.
  • excel: Reads .xlsx/.xlsm (requires Python + openpyxl).
  • expression: Native Power Query M, suitable for SQL/API/large-scale data.
  • mode: "directQuery": Generates DirectQuery partitions.

Visual Support

The plugin supports the following visual types (type → PBIR visualType):

type visualType
bar / column barChart / columnChart
line / area lineChart / areaChart
pie / donut pieChart / donutChart
card cardVisual
table tableEx
matrix pivotTable
slicer slicer
scatter scatterChart
gauge gauge
kpi kpi
textbox textbox

Any PBIR visual can be directly specified using visualType + roles.

Validation & Limitations

During generation, the following are checked: whether table/column/measure/relationship endpoints exist, whether the types at both ends of a relationship are compatible, whether visual field bindings can be resolved, and whether page coordinates are out of bounds.

  • .pbip is the source format; to get a single-file .pbix, use File > Save as in Power BI Desktop, or publish directly to Fabric.
  • Power BI Desktop is Windows-only; PBIP/MCP/CLI generation works on macOS/Linux as well (TMDL engine validation and auto-open are skipped).
  • Visual formatting currently covers title, legend, data labels, and slicer mode; for complex themes or conditional formatting, use theme or edit the PBIR directly.
  • Data refresh is not handled; simply click “Refresh” once in Desktop after opening.
  • Custom visuals (AppSource) only have their visualType written; installation is not managed.

Installation & Enablement

DSH Native Plugin

dsh plugin --profile web add /path/to/pbip-forge

After installation, tell the Agent:

Use powerbi_create to make a sales analytics report. Use this CSV for data, including…
Output to C:\work\sales

The Agent will invoke 4 native tools:
- powerbi_create — Generate the project (no window opened).
- powerbi_help — Return the full spec reference.
- powerbi_validate — Validate an existing .pbip (no window opened).
- powerbi_open — Open the Power BI window only when explicitly requested.

CLI (Any platform with a terminal)

node bin/pbip-forge.mjs build examples/sales-dashboard.json \
  --output "C:\work\sales" --overwrite

To open and view separately:

node bin/pbip-forge.mjs open "C:\work\sales\Sales Performance.pbip"

Common commands:

node bin/pbip-forge.mjs help
node bin/pbip-forge.mjs validate "C:\work\sales\Sales Performance.pbip"
node bin/pbip-forge.mjs config codex
node bin/pbip-forge.mjs install --target "C:\tools\pbip-forge"

MCP Server

node mcp/server.mjs

MCP tools: powerbi_create, powerbi_help, powerbi_validate, powerbi_open.

Typical Usage

Minimal Example

{
  "name": "Sales Overview",
  "model": {
    "tables": [
      {
        "name": "Sales",
        "columns": [
          { "name": "Date", "type": "date" },
          { "name": "Product", "type": "string" },
          { "name": "Amount", "type": "double", "format": "#,##0" }
        ],
        "rows": [
          ["2024-01-01", "Alpha", 1200],
          ["2024-01-02", "Beta", 1850],
          ["2024-01-03", "Alpha", 990]
        ],
        "measures": [
          { "name": "Total Sales", "expression": "SUM('Sales'[Amount])", "format": "#,##0" }
        ]
      }
    ]
  },
  "pages": [
    {
      "title": "Sales Overview",
      "visuals": [
        {
          "type": "bar",
          "title": "Sales by product",
          "category": "Sales[Product]",
          "values": ["Sales[Total Sales]"]
        }
      ]
    }
  ]
}
node bin/pbip-forge.mjs build spec.json --output ./out

Full field documentation is available by calling powerbi_help in the Agent or reviewing docs/SPEC.md. A runnable example is in examples/sales-dashboard.json.

Use Cases & Caveats

Ideal for agent scenarios that require natural-language-driven Power BI report generation, such as auto-generating analytics reports, quickly building demo projects, or batch-creating report templates.

Caveats:
- The plugin runs with the current DSH process permissions; review the source code and license before installing.
- Power BI Desktop is an optional Windows tool; if not installed, only file-level validation is performed.
- The output is .pbip source format; to get a single file, save as .pbix in Desktop or publish to Fabric.

Conclusion

PBIP Forge enables agents to directly write out a complete Power BI project (.pbip), eliminating the need for computer-use click-by-click interaction, while leveraging Microsoft’s publicly documented PBIP/TMDL/PBIR formats for version control and agent-driven modifications. Combined with the DSH native plugin, tools like powerbi_create and powerbi_validate can be invoked directly in conversation.

  • Plugin directory page: https://www.skillhub.cn/plugins/Lee2277-t/pbip-forge
  • GitHub repository: https://github.com/Lee2277-t/pbip-forge
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye