# fabric-dw-mcp-cli - Doramagic AI Context Pack

> 定位：安装前体验与判断资产。它帮助宿主 AI 有一个好的开始，但不代表已经安装、执行或验证目标项目。

## 充分原则

- **充分原则，不是压缩原则**：AI Context Pack 应该充分到让宿主 AI 在开工前理解项目价值、能力边界、使用入口、风险和证据来源；它可以分层组织，但不以最短摘要为目标。
- **压缩策略**：只压缩噪声和重复内容，不压缩会影响判断和开工质量的上下文。

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 fabric-dw-mcp-cli 编译的 AI Context Pack。请把它当作开工前上下文：帮助用户理解适合谁、能做什么、如何开始、哪些必须安装后验证、风险在哪里。不要声称你已经安装、运行或执行了目标项目。

## Claim 消费规则

- **事实来源**：Repo Evidence + Claim/Evidence Graph；Human Wiki 只提供显著性、术语和叙事结构。
- **事实最低状态**：`supported`
- `supported`：可以作为项目事实使用，但回答中必须引用 claim_id 和证据路径。
- `weak`：只能作为低置信度线索，必须要求用户继续核实。
- `inferred`：只能用于风险提示或待确认问题，不能包装成项目事实。
- `unverified`：不得作为事实使用，应明确说证据不足。
- `contradicted`：必须展示冲突来源，不得替用户强行选择一个版本。

## 它最适合谁

- **正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**：README 或插件配置提到多个宿主 AI。 证据：`README.md` Claim：`clm_0004` supported 0.86
- **希望把专业流程带进宿主 AI 的用户**：仓库包含 Skill 文档。 证据：`plugins/fabric-dw/skills/dbt-setup/SKILL.md`, `plugins/fabric-dw/skills/query-optimizer/SKILL.md`, `plugins/fabric-dw/skills/warehouse-performance/SKILL.md` Claim：`clm_0005` supported 0.86

## 它能做什么

- **AI Skill / Agent 指令资产库**（可做安装前预览）：项目包含可被宿主 AI 读取的 Skill 或 Agent 指令文件，可用于把专业流程带入 Claude、Codex、Cursor 等宿主。 证据：`plugins/fabric-dw/skills/dbt-setup/SKILL.md`, `plugins/fabric-dw/skills/query-optimizer/SKILL.md`, `plugins/fabric-dw/skills/warehouse-performance/SKILL.md` Claim：`clm_0001` supported 0.86
- **多宿主安装与分发**（需要安装后验证）：项目包含插件或 marketplace 配置，说明它面向一个或多个 AI 宿主的安装和分发。 证据：`.claude-plugin/marketplace.json`, `plugins/fabric-dw/.claude-plugin/plugin.json`, `plugins/fabric-dw/.github/plugin/plugin.json` Claim：`clm_0002` supported 0.86
- **命令行启动或安装流程**（需要安装后验证）：项目文档中存在可执行命令，真实使用需要在本地或宿主环境中运行这些命令。 证据：`README.md`, `docs/install.md` Claim：`clm_0003` supported 0.86

## 怎么开始

- `pip install fabric-dw` 证据：`README.md` Claim：`clm_0006` supported 0.86
- `uv tool install fabric-dw` 证据：`README.md` Claim：`clm_0007` supported 0.86
- `uv tool install --prerelease allow fabric-dw` 证据：`docs/install.md` Claim：`clm_0008` supported 0.86
- `claude mcp add fabric-dw --scope user \` 证据：`docs/install.md` Claim：`clm_0009` supported 0.86

## 继续前判断卡

- **当前建议**：需要管理员/安全审批
- **为什么**：继续前可能涉及密钥、账号、外部服务或敏感上下文，建议先经过管理员或安全审批。

### 30 秒判断

- **现在怎么做**：需要管理员/安全审批
- **最小安全下一步**：先跑 Prompt Preview；若涉及凭证或企业环境，先审批再试装
- **先别相信**：工具权限边界不能在安装前相信。
- **继续会触碰**：命令执行、宿主 AI 配置、本地环境或项目文件

### 现在可以相信

- **适合人群线索：正在使用 Claude/Codex/Cursor/Gemini 等宿主 AI 的开发者**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`README.md` Claim：`clm_0004` supported 0.86
- **适合人群线索：希望把专业流程带进宿主 AI 的用户**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`plugins/fabric-dw/skills/dbt-setup/SKILL.md`, `plugins/fabric-dw/skills/query-optimizer/SKILL.md`, `plugins/fabric-dw/skills/warehouse-performance/SKILL.md` Claim：`clm_0005` supported 0.86
- **能力存在：AI Skill / Agent 指令资产库**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`plugins/fabric-dw/skills/dbt-setup/SKILL.md`, `plugins/fabric-dw/skills/query-optimizer/SKILL.md`, `plugins/fabric-dw/skills/warehouse-performance/SKILL.md` Claim：`clm_0001` supported 0.86
- **能力存在：多宿主安装与分发**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`.claude-plugin/marketplace.json`, `plugins/fabric-dw/.claude-plugin/plugin.json`, `plugins/fabric-dw/.github/plugin/plugin.json` Claim：`clm_0002` supported 0.86
- **能力存在：命令行启动或安装流程**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`README.md`, `docs/install.md` Claim：`clm_0003` supported 0.86
- **存在 Quick Start / 安装命令线索**（supported）：可以相信项目文档出现过启动或安装入口；不要因此直接在主力环境运行。 证据：`README.md` Claim：`clm_0006` supported 0.86

### 现在还不能相信

- **工具权限边界不能在安装前相信。**（unverified）：MCP/tool 类项目通常会触碰文件、网络、浏览器或外部 API，必须真实检查权限和日志。
- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。
- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。
- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。 证据：`.claude-plugin/marketplace.json`, `CLAUDE.md`, `plugins/fabric-dw/.claude-plugin/plugin.json`, `plugins/fabric-dw/.github/plugin/plugin.json` 等
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。 证据：`.claude-plugin/marketplace.json`, `plugins/fabric-dw/.claude-plugin/plugin.json`, `plugins/fabric-dw/.github/plugin/plugin.json`
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。
- **安装命令是否需要网络、权限或全局写入？**（unverified）：这影响企业环境和个人环境的安装风险。 证据：`README.md`

### 继续会触碰什么

- **命令执行**：包管理器、网络下载、本地插件目录、项目配置或用户主目录。 原因：运行第一条命令就可能产生环境改动；必须先判断是否值得跑。 证据：`README.md`, `docs/install.md`
- **宿主 AI 配置**：Claude/Codex/Cursor/Gemini/OpenCode 等宿主的 plugin、Skill 或规则加载配置。 原因：宿主配置会改变 AI 后续工作方式，可能和用户已有规则冲突。 证据：`.claude-plugin/marketplace.json`, `CLAUDE.md`, `plugins/fabric-dw/.claude-plugin/plugin.json`, `plugins/fabric-dw/.github/plugin/plugin.json` 等
- **本地环境或项目文件**：安装结果、插件缓存、项目配置或本地依赖目录。 原因：安装前无法证明写入范围和回滚方式，需要隔离验证。 证据：`.claude-plugin/marketplace.json`, `README.md`, `docs/install.md`, `plugins/fabric-dw/.claude-plugin/plugin.json` 等
- **环境变量 / API Key**：项目入口文档明确出现 API key、token、secret 或账号凭证配置。 原因：如果真实安装需要凭证，应先使用测试凭证并经过权限/合规判断。 证据：`README.md`, `docs/authentication.md`, `docs/commands/dbt.md`, `docs/guides/dbt-setup.md` 等
- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。

### 最小安全下一步

- **先跑 Prompt Preview**：用安装前交互式试用判断工作方式是否匹配，不需要授权或改环境。（适用：任何项目都适用，尤其是输出质量未知时。）
- **只在隔离目录或测试账号试装**：避免安装命令污染主力宿主 AI、真实项目或用户主目录。（适用：存在命令执行、插件配置或本地写入线索时。）
- **先备份宿主 AI 配置**：Skill、plugin、规则文件可能改变 Claude/Cursor/Codex 的默认行为。（适用：存在插件 manifest、Skill 或宿主规则入口时。）
- **不要使用真实生产凭证**：环境变量/API key 一旦进入宿主或工具链，可能产生账号和合规风险。（适用：出现 API、TOKEN、KEY、SECRET 等环境线索时。）
- **安装后只验证一个最小任务**：先验证加载、兼容、输出质量和回滚，再决定是否深用。（适用：准备从试用进入真实工作流时。）

### 退出方式

- **保留安装前状态**：记录原始宿主配置和项目状态，后续才能判断是否可恢复。
- **准备移除宿主 plugin / Skill / 规则入口**：如果试装后行为异常，可以把宿主 AI 恢复到试装前状态。
- **记录安装命令和写入路径**：没有明确卸载说明时，至少要知道哪些目录或配置需要手动清理。
- **准备撤销测试 API key 或 token**：测试凭证泄露或误用时，可以快速止损。
- **如果没有回滚路径，不进入主力环境**：不可回滚是继续前阻断项，不应靠信任或运气继续。

## 哪些只能预览

- 解释项目适合谁和能做什么
- 基于项目文档演示典型对话流程
- 帮助用户判断是否值得安装或继续研究

## 哪些必须安装后验证

- 真实安装 Skill、插件或 CLI
- 执行脚本、修改本地文件或访问外部服务
- 验证真实输出质量、性能和兼容性

## 边界与风险判断卡

- **把安装前预览误认为真实运行**：用户可能高估项目已经完成的配置、权限和兼容性验证。 处理方式：明确区分 prompt_preview_can_do 与 runtime_required。 Claim：`clm_0010` inferred 0.45
- **宿主 AI 插件或 Skill 规则冲突**：新规则可能改变用户现有宿主 AI 的工作方式。 处理方式：安装前先检查插件 manifest 和 Skill 文件，必要时隔离测试。 证据：`.claude-plugin/marketplace.json`, `plugins/fabric-dw/.claude-plugin/plugin.json`, `plugins/fabric-dw/.github/plugin/plugin.json` Claim：`clm_0011` supported 0.86
- **命令执行会修改本地环境**：安装命令可能写入用户主目录、宿主插件目录或项目配置。 处理方式：先在隔离环境或测试账号中运行。 证据：`README.md`, `docs/install.md` Claim：`clm_0012` supported 0.86
- **待确认**：真实安装后是否与用户当前宿主 AI 版本兼容？。原因：兼容性只能通过实际宿主环境验证。
- **待确认**：项目输出质量是否满足用户具体任务？。原因：安装前预览只能展示流程和边界，不能替代真实评测。
- **待确认**：安装命令是否需要网络、权限或全局写入？。原因：这影响企业环境和个人环境的安装风险。

## 开工前工作上下文

### 加载顺序

- 先读取 how_to_use.host_ai_instruction，建立安装前判断资产的边界。
- 读取 claim_graph_summary，确认事实来自 Claim/Evidence Graph，而不是 Human Wiki 叙事。
- 再读取 intended_users、capabilities 和 quick_start_candidates，判断用户是否匹配。
- 需要执行具体任务时，优先查 role_skill_index，再查 evidence_index。
- 遇到真实安装、文件修改、网络访问、性能或兼容性问题时，转入 risk_card 和 boundaries.runtime_required。

### 任务路由

- **AI Skill / Agent 指令资产库**：先基于 role_skill_index / evidence_index 帮用户挑选可用角色、Skill 或工作流。 边界：可做安装前 Prompt 体验。 证据：`plugins/fabric-dw/skills/dbt-setup/SKILL.md`, `plugins/fabric-dw/skills/query-optimizer/SKILL.md`, `plugins/fabric-dw/skills/warehouse-performance/SKILL.md` Claim：`clm_0001` supported 0.86
- **多宿主安装与分发**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`.claude-plugin/marketplace.json`, `plugins/fabric-dw/.claude-plugin/plugin.json`, `plugins/fabric-dw/.github/plugin/plugin.json` Claim：`clm_0002` supported 0.86
- **命令行启动或安装流程**：先说明这是安装后验证能力，再给出安装前检查清单。 边界：必须真实安装或运行后验证。 证据：`README.md`, `docs/install.md` Claim：`clm_0003` supported 0.86

### 上下文规模

- 文件总数：189
- 重要文件覆盖：40/189
- 证据索引条目：77
- 角色 / Skill 条目：3

### 证据不足时的处理

- **missing_evidence**：说明证据不足，要求用户提供目标文件、README 段落或安装后验证记录；不要补全事实。
- **out_of_scope_request**：说明该任务超出当前 AI Context Pack 证据范围，并建议用户先查看 Human Manual 或真实安装后验证。
- **runtime_request**：给出安装前检查清单和命令来源，但不要替用户执行命令或声称已执行。
- **source_conflict**：同时展示冲突来源，标记为待核实，不要强行选择一个版本。

## Prompt Recipes

### 适配判断

- 目标：判断这个项目是否适合用户当前任务。
- 预期输出：适配结论、关键理由、证据引用、安装前可预览内容、必须安装后验证内容、下一步建议。

```text
请基于 fabric-dw-mcp-cli 的 AI Context Pack，先问我 3 个必要问题，然后判断它是否适合我的任务。回答必须包含：适合谁、能做什么、不能做什么、是否值得安装、证据来自哪里。所有项目事实必须引用 evidence_refs、source_paths 或 claim_id。
```

### 安装前体验

- 目标：让用户在安装前感受核心工作流，同时避免把预览包装成真实能力或营销承诺。
- 预期输出：一段带边界标签的体验剧本、安装后验证清单和谨慎建议；不含真实运行承诺或强营销表述。

```text
请把 fabric-dw-mcp-cli 当作安装前体验资产，而不是已安装工具或真实运行环境。

请严格输出四段：
1. 先问我 3 个必要问题。
2. 给出一段“体验剧本”：用 [安装前可预览]、[必须安装后验证]、[证据不足] 三种标签展示它可能如何引导工作流。
3. 给出安装后验证清单：列出哪些能力只有真实安装、真实宿主加载、真实项目运行后才能确认。
4. 给出谨慎建议：只能说“值得继续研究/试装”“先补充信息后再判断”或“不建议继续”，不得替项目背书。

硬性边界：
- 不要声称已经安装、运行、执行测试、修改文件或产生真实结果。
- 不要写“自动适配”“确保通过”“完美适配”“强烈建议安装”等承诺性表达。
- 如果描述安装后的工作方式，必须使用“如果安装成功且宿主正确加载 Skill，它可能会……”这种条件句。
- 体验剧本只能写成“示例台词/假设流程”：使用“可能会询问/可能会建议/可能会展示”，不要写“已写入、已生成、已通过、正在运行、正在生成”。
- Prompt Preview 不负责给安装命令；如用户准备试装，只能提示先阅读 Quick Start 和 Risk Card，并在隔离环境验证。
- 所有项目事实必须来自 supported claim、evidence_refs 或 source_paths；inferred/unverified 只能作风险或待确认项。

```

### 角色 / Skill 选择

- 目标：从项目里的角色或 Skill 中挑选最匹配的资产。
- 预期输出：候选角色或 Skill 列表，每项包含适用场景、证据路径、风险边界和是否需要安装后验证。

```text
请读取 role_skill_index，根据我的目标任务推荐 3-5 个最相关的角色或 Skill。每个推荐都要说明适用场景、可能输出、风险边界和 evidence_refs。
```

### 风险预检

- 目标：安装或引入前识别环境、权限、规则冲突和质量风险。
- 预期输出：环境、权限、依赖、许可、宿主冲突、质量风险和未知项的检查清单。

```text
请基于 risk_card、boundaries 和 quick_start_candidates，给我一份安装前风险预检清单。不要替我执行命令，只说明我应该检查什么、为什么检查、失败会有什么影响。
```

### 宿主 AI 开工指令

- 目标：把项目上下文转成一次对话开始前的宿主 AI 指令。
- 预期输出：一段边界明确、证据引用明确、适合复制给宿主 AI 的开工前指令。

```text
请基于 fabric-dw-mcp-cli 的 AI Context Pack，生成一段我可以粘贴给宿主 AI 的开工前指令。这段指令必须遵守 not_runtime=true，不能声称项目已经安装、运行或产生真实结果。
```

## 角色 / Skill 索引

- 共索引 3 个角色 / Skill / 项目文档条目。

- **dbt-setup**（skill）： 激活提示：当用户任务与“dbt-setup”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`plugins/fabric-dw/skills/dbt-setup/SKILL.md`
- **query-optimizer**（skill）： 激活提示：当用户任务与“query-optimizer”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`plugins/fabric-dw/skills/query-optimizer/SKILL.md`
- **warehouse-performance**（skill）： 激活提示：当用户任务与“warehouse-performance”描述的流程高度相关时，先用它做安装前体验，再决定是否安装。 证据：`plugins/fabric-dw/skills/warehouse-performance/SKILL.md`

## 证据索引

- 共索引 77 条证据。

- **Install**（documentation）：fabric-dw ships two surfaces from a single package: a CLI fabric-dw , short alias fdw and an MCP server fabric-dw-mcp for AI assistants. Both share the same authentication, connection, and business logic, so you install one package regardless of how you plan to use it. 证据：`docs/install.md`
- **Description**（documentation）：Python CLI and MCP server for Microsoft Fabric Data Warehouses and SQL Analytics Endpoints: administer, query, optimize, and secure them from your terminal or your AI agent. 证据：`README.md`
- **Contributing**（documentation）：--- title: Contributing --- --8<-- "CONTRIBUTING.md" 证据：`docs/contributing.md`
- **CLAUDE.md**（documentation）：This repo is fabric-dw-mcp-cli : a CLI and MCP server for Microsoft Fabric Data Warehouses and SQL Analytics Endpoints. 证据：`CLAUDE.md`
- **Authentication**（documentation）：If you are already signed in via Azure CLI https://learn.microsoft.com/cli/azure/reference-index?view=azure-cli-latest&WT.mc id=MVP 310840 az-login or Azure PowerShell https://learn.microsoft.com/powershell/module/az.accounts/connect-azaccount?WT.mc id=MVP 310840 , you don't need to configure anything - fabric-dw picks up your session automatically. 证据：`docs/authentication.md`
- **fabric-dw**（documentation）：Python CLI and MCP server for Microsoft Fabric Data Warehouses and SQL Analytics Endpoints: administer, query, optimize, and secure them from your terminal or your AI agent. 证据：`docs/index.md`
- **Commands**（documentation）：fabric-dw exposes every operation as both a CLI command and an MCP tool. The two surfaces share the same authentication, connection, and business logic - a fix or new feature lands in both at once. 证据：`docs/commands/index.md`
- **Guides**（documentation）：Task-oriented walkthroughs that thread several fabric-dw commands and MCP tools into a single end-to-end workflow. Each guide shows runnable CLI examples fdw … and names the equivalent MCP tool, so the same steps apply whether you drive from a terminal or an AI assistant. For the full option reference of any one command, see the per-domain Commands ../commands/index.md pages. 证据：`docs/guides/index.md`
- **Contributing**（documentation）：Thank you for your interest in contributing to fabric-dw-mcp-cli ! 证据：`CONTRIBUTING.md`
- **dbt Project Bootstrap for Fabric DW**（skill_instruction）：dbt Project Bootstrap for Fabric DW 证据：`plugins/fabric-dw/skills/dbt-setup/SKILL.md`
- **Query Performance Analysis & Optimization**（skill_instruction）：Query Performance Analysis & Optimization 证据：`plugins/fabric-dw/skills/query-optimizer/SKILL.md`
- **Warehouse-Wide Performance Investigation & Tuning**（skill_instruction）：Warehouse-Wide Performance Investigation & Tuning 证据：`plugins/fabric-dw/skills/warehouse-performance/SKILL.md`
- **Marketplace**（structured_config）：{ "name": "fabric-dw", "owner": { "name": "Sam Debruyn", "email": "sam@debruyn.dev" }, "metadata": { "description": "Agent skills and MCP server for Microsoft Fabric Data Warehouses" }, "plugins": { "name": "fabric-dw", "source": "./plugins/fabric-dw", "description": "Agent skills for Fabric Data Warehouse: query performance analysis, warehouse-wide performance investigation and tuning, and dbt project bootstrap.", "author": { "name": "Sam Debruyn", "email": "sam@debruyn.dev" }, "skills": "./skills/dbt-setup", "./skills/query-optimizer", "./skills/warehouse-performance" , "keywords": "microsoft-fabric", "fabric", "data-warehouse", "mcp", "model-context-protocol", "sql-analytics-endpoint", "… 证据：`.claude-plugin/marketplace.json`
- **Plugin**（structured_config）：{ "name": "fabric-dw", "displayName": "Fabric DW Agent Skills", "version": "2026.7.1", "description": "Agent skills for Fabric Data Warehouse: query performance analysis, warehouse-wide performance investigation and tuning, and dbt project bootstrap.", "homepage": "https://github.com/sdebruyn/fabric-dw-mcp-cli", "author": { "name": "Sam Debruyn", "email": "sam@debruyn.dev" }, "license": "MIT", "keywords": "microsoft-fabric", "fabric", "data-warehouse", "mcp", "model-context-protocol", "sql-analytics-endpoint", "agent-skills", "dbt" , "repository": "https://github.com/sdebruyn/fabric-dw-mcp-cli", "skills": "./skills/dbt-setup", "./skills/query-optimizer", "./skills/warehouse-performance" , "… 证据：`plugins/fabric-dw/.claude-plugin/plugin.json`
- **License**（source_file）：Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files the "Software" , to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 证据：`LICENSE`
- **Code Of Conduct**（documentation）：--- title: Code of Conduct --- --8<-- "CODE OF CONDUCT.md" 证据：`docs/code-of-conduct.md`
- **Shell Completion**（documentation）：fabric-dw ships with tab-completion for bash , zsh , and fish via Click's built-in shell completion https://click.palletsprojects.com/en/stable/shell-completion/ . 证据：`docs/completion.md`
- **Concepts**（documentation）：The sections below describe cross-cutting concepts that apply to all fdw / fabric-dw commands: how the CLI distinguishes between item kinds, which global flags are available on every invocation, and how the target workspace is resolved. 证据：`docs/concepts.md`
- **License**（documentation）：--- title: License --- --8<-- "LICENSE" 证据：`docs/license.md`
- **Security**（documentation）：--- title: Security --- --8<-- "SECURITY.md" 证据：`docs/security.md`
- **Agent Skills**（documentation）：fabric-dw ships three Claude Code Agent Skills https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview that orchestrate multi-step administration workflows on top of the MCP server. 证据：`docs/skills.md`
- **Telemetry**（documentation）：fabric-dw collects opt-out usage telemetry to understand how the tool is used and to prioritise improvements. 证据：`docs/telemetry.md`
- **Troubleshooting**（documentation）：This page collects failure modes that real users have encountered, with the exact error message and the resolution. 证据：`docs/troubleshooting.md`
- **Plugin**（structured_config）：{ "name": "fabric-dw", "description": "Agent skills for Fabric Data Warehouse: query performance analysis, warehouse-wide performance investigation and tuning, and dbt project bootstrap.", "version": "2026.7.1", "author": { "name": "Sam Debruyn", "email": "sam@debruyn.dev" }, "license": "MIT", "keywords": "microsoft-fabric", "fabric", "data-warehouse", "mcp", "model-context-protocol", "sql-analytics-endpoint", "agent-skills", "dbt" , "repository": "https://github.com/sdebruyn/fabric-dw-mcp-cli", "skills": "./skills/dbt-setup", "./skills/query-optimizer", "./skills/warehouse-performance" , "mcpServers": { "fabric-dw": { "type": "stdio", "command": "uvx", "args": "--from", "fabric-dw", "fabri… 证据：`plugins/fabric-dw/.github/plugin/plugin.json`
- **Audit**（documentation）：Manage SQL audit settings for Microsoft Fabric Data Warehouses and SQL Analytics Endpoints. 证据：`docs/commands/audit.md`
- **Cache**（documentation）：Manage the local name-to-UUID lookup cache. fabric-dw caches workspace and item name-to-GUID mappings to avoid repeated API round-trips. Use these commands if you rename items outside the CLI or need to force a fresh lookup. 证据：`docs/commands/cache.md`
- **Shell completion command**（documentation）：Manage shell completion scripts. See Shell Completion ../completion.md for full installation details. 证据：`docs/commands/completion.md`
- **Configuration & defaults**（documentation）：fabric-dw can store persistent defaults so you do not have to repeat options on every invocation. Stored defaults apply when neither the corresponding CLI option nor environment variable is set. 证据：`docs/commands/config.md`
- **dbt**（documentation）：Scaffold a dbt https://docs.getdbt.com/ project pre-wired to a Microsoft Fabric Data Warehouse using the dbt-fabric https://docs.getdbt.com/docs/core/connect-data-platform/fabric-setup adapter. 证据：`docs/commands/dbt.md`
- **Functions**（documentation）：Manage T-SQL user-defined functions on Microsoft Fabric Data Warehouses and SQL Analytics Endpoints. 证据：`docs/commands/functions.md`
- **Permissions**（documentation）：Manage Fabric item-level and T-SQL in-database permissions. 证据：`docs/commands/permissions.md`
- **Stored procedures**（documentation）：Manage stored procedures on Microsoft Fabric Data Warehouses and SQL Analytics Endpoints. 证据：`docs/commands/procedures.md`
- **Queries**（documentation）：Inspect and manage running queries on Microsoft Fabric Data Warehouses and SQL Analytics Endpoints. 证据：`docs/commands/queries.md`
- **Restore Points**（documentation）：Manage Microsoft Fabric Warehouse restore points. 证据：`docs/commands/restore-points.md`
- **Schemas**（documentation）：Manage SQL schemas on Microsoft Fabric Data Warehouses and SQL Analytics Endpoints. 证据：`docs/commands/schemas.md`
- **Settings**（documentation）：Manage server-side database settings on a Fabric Data Warehouse or SQL Analytics Endpoint. 证据：`docs/commands/settings.md`
- **Snapshots**（documentation）：Manage Microsoft Fabric Data Warehouse snapshots. 证据：`docs/commands/snapshots.md`
- **SQL Analytics Endpoints**（documentation）：Manage Microsoft Fabric SQL Analytics Endpoints. 证据：`docs/commands/sql-endpoints.md`
- **SQL Pools**（documentation）：Manage custom SQL Pools at the workspace level with sub-resource commands that mirror the Azure CLI style. Callers must hold the workspace admin role . 证据：`docs/commands/sql-pools.md`
- **Running SQL**（documentation）：SQL execution and query-plan capture against a Fabric Data Warehouse or SQL Analytics Endpoint. 证据：`docs/commands/sql.md`
- **Statistics**（documentation）：Manage user-defined statistics on Fabric Data Warehouses and read their details on SQL Analytics Endpoints. 证据：`docs/commands/statistics.md`
- **Tables**（documentation）：Manage SQL tables on Microsoft Fabric Data Warehouses and SQL Analytics Endpoints. Commands and tools cover listing, counting, reading, creating including CTAS, empty DDL from schema inference, and zero-copy clone , deleting, clearing, renaming, transferring to another schema, and loading data via COPY INTO from local files or remote URLs. 证据：`docs/commands/tables.md`
- **Views**（documentation）：Manage SQL views on Microsoft Fabric Data Warehouses and SQL Analytics Endpoints. 证据：`docs/commands/views.md`
- **Warehouses**（documentation）：Manage Microsoft Fabric Data Warehouses and SQL Analytics Endpoints. 证据：`docs/commands/warehouses.md`
- **Workspaces**（documentation）：Manage Microsoft Fabric workspaces - list all workspaces the authenticated principal can see, inspect a single workspace's details including its default Data Warehouse collation , and update that collation. All workspace commands operate at the workspace level and do not target a specific Data Warehouse or SQL Analytics Endpoint item. 证据：`docs/commands/workspaces.md`
- **Set up a dbt environment**（documentation）：This guide walks an analytics engineer end-to-end through standing up a working dbt https://docs.getdbt.com/ environment on a Microsoft Fabric Data Warehouse with fabric-dw . The headline feature is fdw dbt init --with-sources : it introspects the live warehouse and writes a complete models/staging/ sources.yml : one dbt source: per schema, listing every table with column names and types - so you never hand-author source definitions: 证据：`docs/guides/dbt-setup.md`
- **Ingesting data**（documentation）：This guide walks through getting file-based data - CSV, Parquet, or JSON - into a Microsoft Fabric Data Warehouse table with fabric-dw , end to end: create the schema, create the destination table, stage and load the data via COPY INTO , verify the result, and refresh statistics. It covers both the CLI fdw … and the MCP server for AI assistants . 证据：`docs/guides/ingesting-data.md`
- **Investigating and improving query performance**（documentation）：Investigating and improving query performance 证据：`docs/guides/query-performance.md`
- **Creating & managing tables and views**（documentation）：Creating & managing tables and views 证据：`docs/guides/tables-and-views.md`
- **Investigating & improving warehouse performance**（documentation）：Investigating & improving warehouse performance 证据：`docs/guides/warehouse-performance.md`
- **Exit codes**（documentation）：Code Meaning --- --- 0 Success. 1 Usage error, aborted confirmation prompt, or a Fabric API error. 2 Reserved. 证据：`docs/reference/exit-codes.md`
- **Upper bound <1: httpx 1.0.dev removed both httpx.TransportError and the http2**（source_file）：build-system requires = "hatchling", "hatch-vcs" build-backend = "hatchling.build" 证据：`pyproject.toml`
- **Init**（source_file）：all = " version " 证据：`src/fabric_dw/__init__.py`
- **Fabric Api**（source_file）：all = ⋮---- endpoint id str = str endpoint id .lower ⋮---- props = lh.get "properties" props dict = cast "dict str, Any ", props if isinstance props, dict else {} sql ep = props dict.get "sqlEndpointProperties" sql ep dict = cast "dict str, Any ", sql ep if isinstance sql ep, dict else {} ⋮---- conn = str sql ep dict.get "connectionString", "" 证据：`src/fabric_dw/_fabric_api.py`
- **Auth**（source_file）：FABRIC SCOPE = "https://analysis.windows.net/powerbi/api/.default" SQL SCOPE = "https://database.windows.net/.default" ⋮---- STORAGE SCOPE = "https://storage.azure.com/.default" ⋮---- DEFAULT INTERACTIVE CLIENT ID = "f666e5ee-2149-4c6a-87eb-13c9e1fdc70d" ⋮---- logger = logging.getLogger name ⋮---- def build cache options - TokenCachePersistenceOptions ⋮---- allow unencrypted = os.environ.get "FABRIC ALLOW UNENCRYPTED TOKEN CACHE", "" .strip == "1" ⋮---- GITHUB OIDC AUDIENCE = "api://AzureADTokenExchange" GITHUB OIDC TIMEOUT = 10 ⋮---- all = ⋮---- class CredentialMode StrEnum ⋮---- DEFAULT = "default" SERVICE PRINCIPAL = "sp" INTERACTIVE = "interactive" ⋮---- class CloseableTokenCredential P… 证据：`src/fabric_dw/auth.py`
- **Init**（source_file）：HELP FLAGS: frozenset str = frozenset {"-h", "--help"} ⋮---- UNEXPECTED ERROR EXIT CODE = 1 ⋮---- def main - None ⋮---- def render unexpected error exc: BaseException - None ⋮---- message = str exc .replace "\r", " " .replace "\n", " " .strip or type exc . name ⋮---- message = type exc . name 证据：`src/fabric_dw/cli/__init__.py`
- **Context**（source_file）：@dataclass class CliContext ⋮---- json output: bool = False yes: bool = False auth: CredentialMode = CredentialMode.DEFAULT workspace: str None = None max 429 retries: int None = None retry deadline s: int None = None config: UserConfig None = field default=None, repr=False, compare=False ⋮---- @property def config self - UserConfig 证据：`src/fabric_dw/cli/_context.py`
- **Compute destructive flag:**（source_file）：logger = logging.getLogger name ⋮---- CLI TELEMETRY KEY = "fabric dw telemetry command name" CLI SEGMENTS KEY = CLI TELEMETRY KEY + " segments" ⋮---- DESTRUCTIVE CLI COMMANDS: frozenset str = frozenset ⋮---- CLI CONDITIONAL DESTRUCTIVE KEY = "fabric dw conditional destructive op" ⋮---- HELP MAX WIDTH = max 80, min shutil.get terminal size fallback= 120, 24 .columns, 160 ⋮---- META KEY JSON = "fabric dw global json output" META KEY YES = "fabric dw global yes" META KEY VERBOSE = "fabric dw global verbose" META KEY WORKSPACE = "fabric dw global workspace" META KEY AUTH = "fabric dw global auth mode" META KEY MAX 429 RETRIES = "fabric dw global max 429 retries" META KEY RETRY DEADLINE = "fabri… 证据：`src/fabric_dw/cli/_main.py`
- **Estimated rows**（source_file）：all = ⋮---- GREEN THRESHOLD = 10.0 YELLOW THRESHOLD = 30.0 ⋮---- def cost colour pct: float - str ⋮---- def node label node: PlanOperator - str ⋮---- parts: list str = ⋮---- unknown = "Unknown" ⋮---- Estimated rows ⋮---- Cost percentage colour = cost colour node.cost pct ⋮---- Badges ⋮---- --------------------------------------------------------------------------- Tree builder ⋮---- def build rich tree node: PlanOperator, parent: Tree None = None - Tree ⋮---- """Recursively build a rich.tree.Tree from a :class: PlanOperator tree. Args: node: The operator node to render. parent: The parent Rich Tree node to attach to; when None a new root Tree is created. Returns: The Rich Tree node for node… 证据：`src/fabric_dw/cli/_plan_render.py`
- **: Fixed width for GUID columns — a GUID is exactly 36 characters.**（source_file）：all = ⋮---- def sanitise json obj: object - object ⋮---- GUID RE: re.Pattern str = re.compile ⋮---- : Fixed width for GUID columns — a GUID is exactly 36 characters. GUID WIDTH = 36 ⋮---- : Estimated width for secondary non-primary GUID columns in the fit : heuristic. Secondary GUIDs are allowed to truncate no forced min width , : but they still occupy at least this many chars in practice before wrapping. GUID SECONDARY WIDTH = 10 ⋮---- : Cap applied to non-GUID header names when estimating required table width. : Headers longer than this are assumed to truncate gracefully Rich ellipsis : rather than needing their full length to be legible. HEADER MAX WIDTH = 24 ⋮---- def is guid column col… 证据：`src/fabric_dw/cli/_render.py`
- 其余 17 条证据见 `AI_CONTEXT_PACK.json` 或 `EVIDENCE_INDEX.json`。

## 宿主 AI 必须遵守的规则

- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`docs/install.md`, `README.md`, `docs/contributing.md`
- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`docs/install.md`, `README.md`, `docs/contributing.md`

## 用户开工前应该回答的问题

- 你准备在哪个宿主 AI 或本地环境中使用它？
- 你只是想先体验工作流，还是准备真实安装？
- 你最在意的是安装成本、输出质量、还是和现有规则的冲突？

## 验收标准

- 所有能力声明都能回指到 evidence_refs 中的文件路径。
- AI_CONTEXT_PACK.md 没有把预览包装成真实运行。
- 用户能在 3 分钟内看懂适合谁、能做什么、如何开始和风险边界。

---

## Doramagic Context Augmentation

下面内容用于强化 Repomix/AI Context Pack 主体。Human Manual 只提供阅读骨架；踩坑日志会被转成宿主 AI 必须遵守的工作约束。

## Human Manual 骨架

使用规则：这里只是项目阅读路线和显著性信号，不是事实权威。具体事实仍必须回到 repo evidence / Claim Graph。

宿主 AI 硬性规则：
- 不得把页标题、章节顺序、摘要或 importance 当作项目事实证据。
- 解释 Human Manual 骨架时，必须明确说它只是阅读路线/显著性信号。
- 能力、安装、兼容性、运行状态和风险判断必须引用 repo evidence、source path 或 Claim Graph。

- **项目概述、安装与认证**：importance `high`
  - source_paths: README.md, docs/index.md, docs/install.md, docs/authentication.md, src/fabric_dw/auth.py
- **CLI 命令参考（按域分组）**：importance `high`
  - source_paths: src/fabric_dw/cli/_main.py, src/fabric_dw/cli/_context.py, src/fabric_dw/cli/_render.py, src/fabric_dw/cli/commands/_utils.py, src/fabric_dw/cli/commands/sql.py
- **MCP 服务器、工具与 AI 集成**：importance `high`
  - source_paths: src/fabric_dw/mcp/server.py, src/fabric_dw/mcp/_context.py, src/fabric_dw/mcp/_guards.py, src/fabric_dw/mcp/_helpers.py, src/fabric_dw/mcp/tools/__init__.py
- **内部架构、部署、遥测与安全**：importance `high`
  - source_paths: src/fabric_dw/_fabric_api.py, src/fabric_dw/http_client.py, src/fabric_dw/sql.py, src/fabric_dw/sql_pool.py, src/fabric_dw/sql_errors.py

## Repo Inspection Evidence / 源码检查证据

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `5b175d84eefe61dfc29227449b8965c04a3eb0e2`
- inspected_files: `Dockerfile`, `README.md`, `pyproject.toml`, `uv.lock`, `docs/authentication.md`, `docs/code-of-conduct.md`, `docs/commands/audit.md`, `docs/commands/cache.md`, `docs/commands/completion.md`, `docs/commands/config.md`, `docs/commands/dbt.md`, `docs/commands/functions.md`, `docs/commands/index.md`, `docs/commands/permissions.md`, `docs/commands/procedures.md`, `docs/commands/queries.md`, `docs/commands/restore-points.md`, `docs/commands/schemas.md`, `docs/commands/settings.md`, `docs/commands/snapshots.md`

宿主 AI 硬性规则：
- 没有 repo_clone_verified=true 时，不得声称已经读过源码。
- 没有 repo_inspection_verified=true 时，不得把 README/docs/package 文件判断写成事实。
- 没有 quick_start_verified=true 时，不得声称 Quick Start 已跑通。

## Doramagic Pitfall Constraints / 踩坑约束

这些规则来自 Doramagic 发现、验证或编译过程中的项目专属坑点。宿主 AI 必须把它们当作工作约束，而不是普通说明文字。

### Constraint 1: 失败模式：security_permissions: Track: measure execute_sql overuse after the MCP instructions block (needs telemetry)

- Trigger: Developers should check this security_permissions risk before relying on the project: Track: measure execute_sql overuse after the MCP instructions block (needs telemetry)
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: Track: measure execute_sql overuse after the MCP instructions block (needs telemetry). Context: Observed when using python
- Why it matters: Developers may expose sensitive permissions or credentials: Track: measure execute_sql overuse after the MCP instructions block (needs telemetry)
- Evidence: failure_mode_cluster:github_issue | https://github.com/sdebruyn/fabric-dw-mcp-cli/issues/985 | Track: measure execute_sql overuse after the MCP instructions block (needs telemetry)
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 失败模式：security_permissions: feat(mcp): add server instructions and steer execute_sql toward dedicated tools

- Trigger: Developers should check this security_permissions risk before relying on the project: feat(mcp): add server instructions and steer execute_sql toward dedicated tools
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: feat(mcp): add server instructions and steer execute_sql toward dedicated tools. Context: Source discussion did not expose a precise runtime context.
- Why it matters: Developers may expose sensitive permissions or credentials: feat(mcp): add server instructions and steer execute_sql toward dedicated tools
- Evidence: failure_mode_cluster:github_issue | https://github.com/sdebruyn/fabric-dw-mcp-cli/issues/984 | feat(mcp): add server instructions and steer execute_sql toward dedicated tools
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 失败模式：security_permissions: feat(mcp): name the remaining tool domains in the server instructions

- Trigger: Developers should check this security_permissions risk before relying on the project: feat(mcp): name the remaining tool domains in the server instructions
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: feat(mcp): name the remaining tool domains in the server instructions. Context: Observed when using python
- Why it matters: Developers may expose sensitive permissions or credentials: feat(mcp): name the remaining tool domains in the server instructions
- Evidence: failure_mode_cluster:github_issue | https://github.com/sdebruyn/fabric-dw-mcp-cli/issues/992 | feat(mcp): name the remaining tool domains in the server instructions
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 失败模式：security_permissions: fix(cli): leading optional ITEM positional swallows the first required argument

- Trigger: Developers should check this security_permissions risk before relying on the project: fix(cli): leading optional ITEM positional swallows the first required argument
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: fix(cli): leading optional ITEM positional swallows the first required argument. Context: Observed during version upgrade or migration.
- Why it matters: Developers may expose sensitive permissions or credentials: fix(cli): leading optional ITEM positional swallows the first required argument
- Evidence: failure_mode_cluster:github_issue | https://github.com/sdebruyn/fabric-dw-mcp-cli/issues/981 | fix(cli): leading optional ITEM positional swallows the first required argument
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 来源证据：Track: set SQL connection program_name to fdw.debruyn.dev (blocked on mssql-python#649)

- Trigger: GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：Track: set SQL connection program_name to fdw.debruyn.dev (blocked on mssql-python#649)
- Why it matters: 可能阻塞安装或首次运行。
- Evidence: community_evidence:github | https://github.com/sdebruyn/fabric-dw-mcp-cli/issues/892 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: 仓库名和安装名不一致

- Trigger: 仓库名 `fabric-dw-mcp-cli` 与安装入口 `fabric-dw` 不完全一致。
- Host AI rule: 在 npm/PyPI/GitHub 上确认包名映射和官方 README 说明。
- Why it matters: 用户照着仓库名搜索包或照着包名找仓库时容易走错入口。
- Evidence: identity.distribution | https://github.com/sdebruyn/fabric-dw-mcp-cli | repo=fabric-dw-mcp-cli; install=fabric-dw
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 7: 失败模式：installation: fix(ci): replace uv sync --frozen with --locked in remaining workflows

- Trigger: Developers should check this installation risk before relying on the project: fix(ci): replace uv sync --frozen with --locked in remaining workflows
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: fix(ci): replace uv sync --frozen with --locked in remaining workflows. Context: Observed when using python, docker
- Why it matters: Developers may fail before the first successful local run: fix(ci): replace uv sync --frozen with --locked in remaining workflows
- Evidence: failure_mode_cluster:github_issue | https://github.com/sdebruyn/fabric-dw-mcp-cli/issues/990 | fix(ci): replace uv sync --frozen with --locked in remaining workflows
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 8: 失败模式：installation: fix(ci): uv.lock is out of sync with pyproject.toml, and nothing detects it

- Trigger: Developers should check this installation risk before relying on the project: fix(ci): uv.lock is out of sync with pyproject.toml, and nothing detects it
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: fix(ci): uv.lock is out of sync with pyproject.toml, and nothing detects it. Context: Observed when using python
- Why it matters: Developers may fail before the first successful local run: fix(ci): uv.lock is out of sync with pyproject.toml, and nothing detects it
- Evidence: failure_mode_cluster:github_issue | https://github.com/sdebruyn/fabric-dw-mcp-cli/issues/988 | fix(ci): uv.lock is out of sync with pyproject.toml, and nothing detects it
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 9: 失败模式：installation: fix(deps): cap httpx below 2.0 so the pre-release build is installable

- Trigger: Developers should check this installation risk before relying on the project: fix(deps): cap httpx below 2.0 so the pre-release build is installable
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: fix(deps): cap httpx below 2.0 so the pre-release build is installable. Context: Observed when using python
- Why it matters: Developers may fail before the first successful local run: fix(deps): cap httpx below 2.0 so the pre-release build is installable
- Evidence: failure_mode_cluster:github_issue | https://github.com/sdebruyn/fabric-dw-mcp-cli/issues/995 | fix(deps): cap httpx below 2.0 so the pre-release build is installable
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 10: 失败模式：installation: test(integration): add an end-to-end journey smoke test exercising config defaults

- Trigger: Developers should check this installation risk before relying on the project: test(integration): add an end-to-end journey smoke test exercising config defaults
- Host AI rule: Before packaging this project, run the relevant install/config/quickstart check for: test(integration): add an end-to-end journey smoke test exercising config defaults. Context: Observed during installation or first-run setup.
- Why it matters: Developers may fail before the first successful local run: test(integration): add an end-to-end journey smoke test exercising config defaults
- Evidence: failure_mode_cluster:github_issue | https://github.com/sdebruyn/fabric-dw-mcp-cli/issues/982 | test(integration): add an end-to-end journey smoke test exercising config defaults
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。
