integrate-webapi
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIntegrate Web API
集成Web API
Integrate Power Pages Web API into a code site's frontend. This skill orchestrates the full lifecycle: analyzing where integrations are needed, implementing API client code for each table, configuring permissions and site settings, and deploying the site.
将Power Pages Web API集成到代码站点的前端中。此技能编排完整的生命周期:分析集成需求、为每个表实现API客户端代码、配置权限和站点设置,以及部署站点。
Core Principles
核心原则
- First table sequential, then parallel: The first table must be processed alone because it creates the shared client. Once that exists, remaining tables can be processed in parallel since each creates independent files (types, service, hooks).
powerPagesApi.ts - Parallelize independent agents: The and
table-permissions-architectagents are independent — invoke them in parallel rather than sequentially.webapi-settings-architect - Permissions require deployment: The folder must exist before table permissions and site settings can be configured. Integration code can be written without it, but permissions cannot.
.powerpages-site - Use TaskCreate/TaskUpdate: Track all progress throughout all phases — create the todo list upfront with all phases before starting any work.
Prerequisites:
- An existing Power Pages code site created via
/create-site- A Dataverse data model (tables/columns) already set up via
or created manually/setup-datamodel- The site must be deployed at least once (
folder must exist) for permissions setup.powerpages-site
Initial request: $ARGUMENTS
- 第一个表串行处理,后续表并行处理:第一个表必须单独处理,因为它会创建共享的客户端。一旦该客户端存在,剩余表可以并行处理,因为每个表都会创建独立的文件(类型定义、服务、钩子)。
powerPagesApi.ts - 并行调用独立Agent:和
table-permissions-architectAgent是独立的——应并行调用而非串行。webapi-settings-architect - 权限配置需要部署:在配置表权限和站点设置之前,必须存在文件夹。集成代码可以在没有该文件夹的情况下编写,但权限配置不行。
.powerpages-site - 使用TaskCreate/TaskUpdate:在所有阶段跟踪所有进度——在开始任何工作之前,预先创建包含所有阶段的待办事项列表。
前提条件:
- 已通过
创建现有Power Pages代码站点/create-site- 已通过
或手动创建Dataverse数据模型(表/列)/setup-datamodel- 站点至少已部署一次(必须存在
文件夹)才能进行权限设置.powerpages-site
初始请求: $ARGUMENTS
Workflow
工作流程
- Verify Site Exists — Locate the Power Pages project and verify prerequisites
- Explore Integration Points — Analyze site code and data model to identify tables needing Web API integration
- Review Integration Plan — Present findings to the user and confirm which tables to integrate
- Implement Integrations — Use the agent for each table
webapi-integration - Verify Integrations — Validate all expected files exist and the project builds successfully
- Setup Permissions & Settings — Choose permissions source (upload diagram or let the architects analyze), then configure table permissions and Web API site settings with case-sensitive validated column names
- Review & Deploy — Ask the user to deploy the site and invoke if confirmed
/deploy-site
- 验证站点存在 — 定位Power Pages项目并验证前提条件
- 探索集成点 — 分析站点代码和数据模型,确定需要Web API集成的表
- 审核集成计划 — 向用户展示发现结果并确认要集成的表
- 实现集成 — 为每个表使用Agent
webapi-integration - 验证集成 — 验证所有预期文件是否存在,项目是否能成功构建
- 设置权限和设置 — 选择权限来源(上传图表或让架构师分析),然后使用区分大小写的已验证列名配置表权限和Web API站点设置
- 审核与部署 — 请用户部署站点,若用户确认则调用
/deploy-site
Phase 1: Verify Site Exists
阶段1:验证站点存在
Goal: Locate the Power Pages project root and confirm that prerequisites are met
Actions:
目标:定位Power Pages项目根目录并确认满足前提条件
操作:
1.1 Locate Project
1.1 定位项目
Look for in the current directory or immediate subdirectories to find the project root.
powerpages.config.jsonpowershell
Get-ChildItem -Path . -Filter "powerpages.config.json" -Recurse -Depth 1If not found: Tell the user to create a site first with .
/create-site在当前目录或直接子目录中查找以确定项目根目录。
powerpages.config.jsonpowershell
Get-ChildItem -Path . -Filter "powerpages.config.json" -Recurse -Depth 1若未找到:告知用户先使用创建站点。
/create-site1.2 Read Existing Config
1.2 读取现有配置
Read to get the site name:
powerpages.config.jsonpowershell
Get-Content "<PROJECT_ROOT>/powerpages.config.json" | ConvertFrom-Json读取以获取站点名称:
powerpages.config.jsonpowershell
Get-Content "<PROJECT_ROOT>/powerpages.config.json" | ConvertFrom-Json1.3 Detect Framework
1.3 检测框架
Read to determine the framework (React, Vue, Angular, or Astro). See for the full framework detection mapping.
package.json${CLAUDE_PLUGIN_ROOT}/references/framework-conventions.md读取以确定框架(React、Vue、Angular或Astro)。有关完整的框架检测映射,请参阅。
package.json${CLAUDE_PLUGIN_ROOT}/references/framework-conventions.md1.4 Check for Data Model
1.4 检查数据模型
Look for to discover available tables:
.datamodel-manifest.jsontext
**/.datamodel-manifest.jsonIf found, read it — this is the primary source for table discovery.
查找以发现可用表:
.datamodel-manifest.jsontext
**/.datamodel-manifest.json若找到,读取该文件——这是表发现的主要来源。
1.5 Check Deployment Status
1.5 检查部署状态
Look for the folder:
.powerpages-sitetext
**/.powerpages-siteIf not found: Warn the user that the permissions phase (Phase 5) will require deployment first. The integration code (Phases 2–4) can still proceed.
Output: Confirmed project root, framework, data model availability, and deployment status
查找文件夹:
.powerpages-sitetext
**/.powerpages-site若未找到:警告用户权限阶段(阶段5)需要先部署站点。集成代码(阶段2–4)仍可继续进行。
输出:已确认的项目根目录、框架、数据模型可用性和部署状态
Phase 2: Explore Integration Points
阶段2:探索集成点
Goal: Analyze the site code and data model to identify all tables needing Web API integration
Actions:
Use the Explore agent (via tool with ) to analyze the site code and data model. The Explore agent should answer these questions:
Taskagent_type: "explore"目标:分析站点代码和数据模型,确定所有需要Web API集成的表
操作:
使用Explore Agent(通过工具,)分析站点代码和数据模型。Explore Agent应回答以下问题:
Taskagent_type: "explore"2.1 Discover Tables
2.1 发现表
Ask the Explore agent to identify all Dataverse tables that need Web API integration by examining:
- — List of tables and their columns
.datamodel-manifest.json - — Source code files that reference table data, mock data, or placeholder API calls
src/**/*.{ts,tsx,js,jsx,vue,astro} - Existing fetch patterns in the code
/_api/ - TypeScript interfaces or types that map to Dataverse table schemas
- Component files that display or manipulate data from Dataverse tables
- Mock data files or hardcoded arrays that should be replaced with API calls
- or
TODOcomments mentioning API integrationFIXME
Prompt for the Explore agent:
"Analyze this Power Pages code site and identify all Dataverse tables that need Web API integration. Checkfor the data model, then search the source code for: mock data arrays, hardcoded data, placeholder fetch calls to.datamodel-manifest.json, TypeScript interfaces matching Dataverse column patterns (publisher prefix like/_api/), TODO/FIXME comments about API integration, and components that display table data. For each table found, report: the table logical name, the entity set name (plural), which source files reference it, what operations are needed (read/create/update/delete), and whether an existing API client or service already exists incr*_orsrc/shared/. Also check ifsrc/services/already exists."src/shared/powerPagesApi.ts
请Explore Agent通过检查以下内容,确定所有需要Web API集成的Dataverse表:
- — 表及其列的列表
.datamodel-manifest.json - — 引用表数据、模拟数据或占位符API调用的源代码文件
src/**/*.{ts,tsx,js,jsx,vue,astro} - 代码中现有的获取模式
/_api/ - 映射到Dataverse表架构的TypeScript接口或类型
- 显示或操作Dataverse表数据的组件文件
- 应替换为API调用的模拟数据文件或硬编码数组
- 提及API集成的或
TODO注释FIXME
给Explore Agent的提示:
"分析此Power Pages代码站点,确定所有需要Web API集成的Dataverse表。检查获取数据模型,然后在源代码中搜索:模拟数据数组、硬编码数据、对.datamodel-manifest.json的占位符获取调用、匹配Dataverse列模式的TypeScript接口(发布者前缀如/_api/)、关于API集成的TODO/FIXME注释,以及显示表数据的组件。对于每个找到的表,报告:表逻辑名称、实体集名称(复数形式)、引用它的源文件、需要的操作(读取/创建/更新/删除),以及cr*_或src/shared/中是否已存在API客户端或服务。同时检查src/services/是否已存在。"src/shared/powerPagesApi.ts
2.2 Identify Existing Integration Code
2.2 识别现有集成代码
The Explore agent should also report:
- Whether (or equivalent API client) already exists
src/shared/powerPagesApi.ts - Which tables already have service files in or
src/shared/services/src/services/ - Which tables already have type definitions in
src/types/ - Any framework-specific hooks/composables already created
This avoids duplicating work that was already done.
Explore Agent还应报告:
- (或等效的API客户端)是否已存在
src/shared/powerPagesApi.ts - 哪些表在或
src/shared/services/中已有服务文件src/services/ - 哪些表在中已有类型定义
src/types/ - 已创建的任何框架特定钩子/组合式函数
这避免了重复已完成的工作。
2.3 Compile Integration Manifest
2.3 编译集成清单
From the Explore agent's findings, compile a list of tables needing integration:
| Table | Logical Name | Entity Set | Operations | Files Referencing | Existing Service |
|---|---|---|---|---|---|
| Products | | | CRUD | | None |
| Categories | | | Read | | None |
Output: Complete integration manifest listing all tables, their operations, referencing files, and existing service status
根据Explore Agent的发现,编译需要集成的表列表:
| 表 | 逻辑名称 | 实体集 | 操作 | 引用文件 | 现有服务 |
|---|---|---|---|---|---|
| Products | | | CRUD | | 无 |
| Categories | | | 读取 | | 无 |
输出:完整的集成清单,列出所有表、它们的操作、引用文件和现有服务状态
Phase 3: Review Integration Plan
阶段3:审核集成计划
Goal: Present the integration manifest to the user and confirm which tables to integrate
Actions:
目标:向用户展示集成清单并确认要集成的表
操作:
3.1 Present Findings
3.1 展示发现结果
Show the user:
- The tables that were identified for Web API integration
- For each table: which files reference it, what operations are needed
- Whether a shared API client already exists or needs to be created
- Any tables that were skipped (already have services)
向用户展示:
- 已确定需要Web API集成的表
- 每个表:哪些文件引用它、需要哪些操作
- 共享API客户端是否已存在或需要创建
- 已跳过的表(已有服务)
3.2 Confirm Tables
3.2 确认表
Use to confirm:
AskUserQuestion| Question | Options |
|---|---|
| I found the following tables that need Web API integration: [list tables]. Which tables should I integrate? | All of them (Recommended), Let me select specific tables, I need to add more tables |
If the user selects specific tables or adds more, update the integration manifest accordingly.
Output: User-confirmed list of tables to integrate
使用确认:
AskUserQuestion| 问题 | 选项 |
|---|---|
| 我找到了以下需要Web API集成的表:[表列表]。我应该集成哪些表? | 全部集成(推荐),让我选择特定表,我需要添加更多表 |
如果用户选择特定表或添加更多表,相应更新集成清单。
输出:用户确认的要集成的表列表
Phase 4: Implement Integrations
阶段4:实现集成
Goal: Create Web API integration code for each confirmed table using the agent
webapi-integrationActions:
目标:使用Agent为每个已确认的表创建Web API集成代码
webapi-integration操作:
4.1 Invoke Agent Per Table
4.1 为每个表调用Agent
For each table, use the tool to invoke the agent at :
Taskwebapi-integration${CLAUDE_PLUGIN_ROOT}/agents/webapi-integration.mdPrompt template for the agent:
"Integrate Power Pages Web API for the [Table Display Name] table.
- Table logical name:
[logical_name]- Entity set name:
[entity_set_name]- Operations needed: [read/create/update/delete]
- Framework: [React/Vue/Angular/Astro]
- Project root: [path]
- Source files referencing this table: [list of files]
- Data model manifest path: [path to .datamodel-manifest.json if available]
Create the TypeScript types, CRUD service layer, and framework-specific hooks/composables. Replace any mock data or placeholder API calls in the referencing source files with the new service."
对于每个表,使用工具调用位于的Agent:
Task${CLAUDE_PLUGIN_ROOT}/agents/webapi-integration.mdwebapi-integrationAgent提示模板:
"为**[表显示名称]**表集成Power Pages Web API。
- 表逻辑名称:
[logical_name]- 实体集名称:
[entity_set_name]- 需要的操作:[read/create/update/delete]
- 框架:[React/Vue/Angular/Astro]
- 项目根目录:[path]
- 引用此表的源文件:[文件列表]
- 数据模型清单路径:[.datamodel-manifest.json的路径(若可用)]
创建TypeScript类型、CRUD服务层和框架特定的钩子/组合式函数。将引用源文件中的任何模拟数据或占位符API调用替换为新服务。"
4.2 Process First Table, Then Parallelize Remaining
4.2 先处理第一个表,然后并行处理剩余表
The first table must be processed alone — it creates the shared client that all other tables depend on. After the first table completes and the shared client exists:
powerPagesApi.ts- Verify the shared API client was created at
src/shared/powerPagesApi.ts - Then invoke all remaining tables in parallel using multiple calls — each table creates independent files (its own types in
Task, service insrc/types/, and hook/composable), so there are no conflictssrc/shared/services/
If there is only one table, this step is simply sequential.
第一个表必须单独处理——它会创建所有其他表依赖的共享客户端。第一个表完成且共享客户端存在后:
powerPagesApi.ts- 验证共享API客户端是否已创建在
src/shared/powerPagesApi.ts - 然后并行调用所有剩余表——使用多个调用,每个表创建独立文件(其自己的类型在
Task、服务在src/types/、钩子/组合式函数),因此不会有冲突src/shared/services/
如果只有一个表,此步骤只需串行处理。
4.3 Verify Each Integration
4.3 验证每个集成
After each agent completes (or after all parallel agents complete), verify the output:
- Check that the expected files were created (types, service, hook/composable)
- Confirm the shared API client exists after the first table is processed
- Note any issues reported by the agent
每个Agent完成后(或所有并行Agent完成后),验证输出:
- 检查是否创建了预期文件(类型、服务、钩子/组合式函数)
- 确认第一个表处理完成后共享API客户端已存在
- 记录Agent报告的任何问题
4.4 Git Commit
4.4 Git提交
After all integrations are complete, stage and commit:
powershell
git add -A
git commit -m "Add Web API integration for [table names]"Output: Integration code created for all confirmed tables, verified and committed
所有集成完成后,暂存并提交:
powershell
git add -A
git commit -m "Add Web API integration for [table names]"输出:为所有已确认的表创建了集成代码,已验证并提交
Phase 5: Verify Integrations
阶段5:验证集成
Goal: Validate that all expected integration files exist, imports are correct, and the project builds successfully
Actions:
目标:验证所有预期集成文件是否存在、导入是否正确、项目是否能成功构建
操作:
5.1 Verify File Inventory
5.1 验证文件清单
For each integrated table, confirm the following files exist:
- Type definition in (e.g.,
src/types/)src/types/product.ts - Service file in or
src/shared/services/(e.g.,src/services/)productService.ts - Framework-specific hook/composable (e.g., for React,
src/shared/hooks/useProducts.tsfor Vue)src/composables/useProducts.ts
Also verify:
- Shared API client at exists
src/shared/powerPagesApi.ts - Each service file references endpoints
/_api/ - Each service file imports from the shared API client
对于每个已集成的表,确认以下文件存在:
- 类型定义在中(例如
src/types/)src/types/product.ts - 服务文件在或
src/shared/services/中(例如src/services/)productService.ts - 框架特定的钩子/组合式函数(例如React的,Vue的
src/shared/hooks/useProducts.ts)src/composables/useProducts.ts
同时验证:
- 共享API客户端存在于
src/shared/powerPagesApi.ts - 每个服务文件引用端点
/_api/ - 每个服务文件从共享API客户端导入
5.2 Verify Build
5.2 验证构建
Run the project build to catch any import errors, type errors, or missing dependencies:
powershell
npm run buildIf the build fails, fix the issues before proceeding. Common issues:
- Missing imports between generated files
- Type mismatches between service and type definitions
- Framework-specific compilation errors
运行项目构建以捕获任何导入错误、类型错误或缺失的依赖项:
powershell
npm run build如果构建失败,在继续之前修复问题。常见问题:
- 生成文件之间缺少导入
- 服务和类型定义之间的类型不匹配
- 框架特定的编译错误
5.3 Present Verification Results
5.3 展示验证结果
Present a table summarizing the verification:
| Table | Types | Service | Hook/Composable | API References |
|---|---|---|---|---|
| Products | | | | |
| ... | ... | ... | ... | ... |
Build status: Pass / Fail (with details)
Output: All integration files verified, project builds successfully
展示总结验证结果的表格:
| 表 | 类型 | 服务 | 钩子/组合式函数 | API引用 |
|---|---|---|---|---|
| Products | | | | |
| ... | ... | ... | ... | ... |
构建状态:通过/失败(含详细信息)
输出:所有集成文件已验证,项目构建成功
Phase 6: Setup Permissions & Settings
阶段6:设置权限和设置
Goal: Configure table permissions and Web API site settings for all integrated tables using the and agents
table-permissions-architectwebapi-settings-architectActions:
目标:使用和Agent为所有已集成的表配置表权限和Web API站点设置
table-permissions-architectwebapi-settings-architect操作:
6.1 Check Deployment Prerequisite
6.1 检查部署前提条件
Both agents require the folder. If it doesn't exist:
.powerpages-siteUse :
AskUserQuestion| Question | Options |
|---|---|
The | Yes, deploy now (Recommended), Skip permissions for now — I'll set them up later |
If "Yes, deploy now": Invoke first, then resume this phase.
/deploy-siteIf "Skip": Skip to Phase 7 with a note that permissions and site settings still need to be configured.
两个Agent都需要文件夹。若不存在:
.powerpages-site使用:
AskUserQuestion| 问题 | 选项 |
|---|---|
未找到 | 是,现在部署(推荐),暂时跳过权限设置——我稍后再配置 |
若选择“是,现在部署”:先调用,然后恢复此阶段。
/deploy-site若选择“跳过”:跳到阶段7,并记录权限和站点设置仍需配置的提示。
6.2 Choose Permissions Source
6.2 选择权限来源
Ask the user how they want to define the permissions using the tool:
AskUserQuestionQuestion: "How would you like to define the Web API permissions and settings for your site?"
| Option | Description |
|---|---|
| Upload an existing permissions diagram | Provide an image (PNG/JPG) or Mermaid diagram of your existing permissions structure |
| Let the architects figure it out | The Table Permissions Architect and Web API Settings Architect will analyze your site's code, data model, and Dataverse environment, then propose permissions and settings automatically |
Route to the appropriate path:
使用工具询问用户如何定义权限:
AskUserQuestion问题:"您希望如何定义站点的Web API权限和设置?"
| 选项 | 描述 |
|---|---|
| 上传现有权限图表 | 提供现有权限结构的图像(PNG/JPG)或Mermaid图表 |
| 让架构师自动分析 | 表权限架构师和Web API设置架构师将分析您的站点代码、数据模型和Dataverse环境,然后自动提出权限和设置建议 |
根据选择路由到相应路径:
Path A: Upload Existing Permissions Diagram
路径A:上传现有权限图表
If the user chooses to upload an existing diagram:
-
Ask the user to provide their permissions diagram. Supported formats:
- Image file (PNG, JPG) — Use the tool to view the image and extract web roles, table permissions, CRUD flags, scopes, and site settings from it
Read - Mermaid syntax — The user can paste a Mermaid flowchart diagram text directly in chat
- Text description — A structured list of web roles, table permissions, scopes, and site settings
- Image file (PNG, JPG) — Use the
-
Parse the diagram into structured format:
- Web roles: Match with existing roles from by name to get their UUIDs
.powerpages-site/web-roles/ - Table permissions: Permission name, table logical name, web role UUID(s), scope, CRUD flags (read/create/write/delete/append/appendto), parent permission and relationship name (if Parent scope)
- Site settings: and
Webapi/<table>/enabled— CRITICAL: fields normally list specific column logical names; only useWebapi/<table>/fieldswhen the site relies on aggregate OData queries (*/aggregate) that otherwise fail with 403$apply
- Web roles: Match with existing roles from
-
Validate column names against Dataverse — Even when using a user-provided diagram, query Dataverse for each table's column LogicalNames and verify that every column in thevalues uses the exact Dataverse LogicalName (case-sensitive). Correct any mismatches before creating files.
Webapi/<table>/fields -
Cross-check with existing configuration into identify which permissions and site settings are new vs. already exist.
.powerpages-site/ -
Generate a Mermaid flowchart from the parsed data (if the user provided an image or text) for visual confirmation.
-
Present the parsed permissions plan to the user for approval using:
AskUserQuestionQuestion Options Does this permissions plan look correct? Approve and create files (Recommended), Request changes, Cancel -
Proceed directly to section 6.4: Create Permission & Settings Files with the parsed data.
如果用户选择上传现有图表:
-
请用户提供其权限图表。支持的格式:
- 图像文件(PNG、JPG)——使用工具查看图像并从中提取Web角色、表权限、CRUD标志、范围和站点设置
Read - Mermaid语法——用户可直接在聊天中粘贴Mermaid流程图文本
- 文本描述——Web角色、表权限、范围和站点设置的结构化列表
- 图像文件(PNG、JPG)——使用
-
将图表解析为结构化格式:
- Web角色:通过名称与中的现有角色匹配以获取其UUID
.powerpages-site/web-roles/ - 表权限:权限名称、表逻辑名称、Web角色UUID、范围、CRUD标志(read/create/write/delete/append/appendto)、父权限和关系名称(若为Parent范围)
- 站点设置:和
Webapi/<table>/enabled——关键:字段通常列出特定列逻辑名称;只有当站点依赖聚合OData查询(Webapi/<table>/fields/aggregate)且否则会失败返回403时,才使用$apply*
- Web角色:通过名称与
-
针对Dataverse验证列名称——即使使用用户提供的图表,也要查询Dataverse获取每个表的列LogicalNames,并验证值中的每个列都使用了精确的Dataverse LogicalName(区分大小写)。在创建文件之前纠正任何不匹配。
Webapi/<table>/fields -
与中的现有配置交叉检查,以确定哪些权限和站点设置是新的,哪些已存在。
.powerpages-site/ -
从解析的数据生成Mermaid流程图(若用户提供的是图像或文本)以进行可视化确认。
-
使用向用户展示解析后的权限计划以获得批准:
AskUserQuestion问题 选项 此权限计划看起来正确吗? 批准并创建文件(推荐),请求更改,取消 -
使用解析的数据直接进入第6.4节:创建权限和设置文件。
Path B: Let the Architects Figure It Out
路径B:让架构师自动分析
If the user chooses to let the architects figure it out, proceed to section 6.3: Invoke Table Permissions Agent.
如果用户选择让架构师自动分析,进入第6.3节:调用表权限Agent。
6.3 Invoke Table Permissions and Web API Settings Agents (in Parallel)
6.3 并行调用表权限和Web API设置Agent
These two agents are independent — invoke them in parallel using two calls simultaneously:
Task这两个Agent是独立的——使用两个调用同时并行调用:
TaskTable Permissions Agent
表权限Agent
Use the tool to invoke the agent at :
Tasktable-permissions-architect${CLAUDE_PLUGIN_ROOT}/agents/table-permissions-architect.mdPrompt:
"Analyze this Power Pages code site and propose table permissions. The following tables have been integrated with Web API: [list of tables integrated in Phase 4]. Check for existing web roles and table permissions. Propose a complete table permissions plan covering all integrated tables. After I approve the plan, create the web role and table permission YAML files using the deterministic scripts."
The agent will:
- Analyze the site and propose a plan (with Mermaid diagram)
- Present the plan via plan mode for user approval
- After approval, create any needed web roles using
create-web-role.js - Create all table permission files using
create-table-permission.js - Return a summary of created files
使用工具调用位于的Agent:
Task${CLAUDE_PLUGIN_ROOT}/agents/table-permissions-architect.mdtable-permissions-architect提示:
"分析此Power Pages代码站点并提出表权限建议。以下表已与Web API集成:[阶段4中集成的表列表]。检查现有Web角色和表权限。提出涵盖所有已集成表的完整表权限计划。我批准计划后,使用确定性脚本创建Web角色和表权限YAML文件。"
该Agent将:
- 分析站点并提出计划(含Mermaid图表)
- 通过计划模式向用户展示计划以获得批准
- 批准后,使用创建任何需要的Web角色
create-web-role.js - 使用创建所有表权限文件
create-table-permission.js - 返回已创建文件的摘要
Web API Settings Agent
Web API设置Agent
Use the tool to invoke the agent at :
Taskwebapi-settings-architect${CLAUDE_PLUGIN_ROOT}/agents/webapi-settings-architect.mdPrompt:
"Analyze this Power Pages code site and propose Web API site settings. The following tables have been integrated with Web API: [list of tables integrated in Phase 4]. Check for existing site settings and query Dataverse for exact column LogicalNames. Propose site settings with case-sensitive validated column names. After I approve the plan, create the site setting YAML files using the deterministic scripts."
The agent will:
- Analyze the site, query Dataverse for exact column LogicalNames
- Cross-validate column names (case-sensitive)
- Present the plan via plan mode for user approval
- After approval, create all site setting files using
create-site-setting.js - Return a summary of created files
Wait for both agents to complete before proceeding to 6.4.
使用工具调用位于的Agent:
Task${CLAUDE_PLUGIN_ROOT}/agents/webapi-settings-architect.mdwebapi-settings-architect提示:
"分析此Power Pages代码站点并提出Web API站点设置建议。以下表已与Web API集成:[阶段4中集成的表列表]。检查现有站点设置并查询Dataverse获取精确的列LogicalNames。提出使用区分大小写的已验证列名称的站点设置。我批准计划后,使用确定性脚本创建站点设置YAML文件。"
该Agent将:
- 分析站点,查询Dataverse获取精确的列LogicalNames
- 交叉验证列名称(区分大小写)
- 通过计划模式向用户展示计划以获得批准
- 批准后,使用创建所有站点设置文件
create-site-setting.js - 返回已创建文件的摘要
继续进行6.4之前,等待两个Agent完成。
6.4 Create Permission & Settings Files (Path A Only)
6.4 创建权限和设置文件(仅路径A)
This section applies only to Path A (user-provided permissions diagram). For Path B, the architect agents create the files directly in section 6.3.
After parsing the user's diagram, create the YAML files using the deterministic scripts below. Do NOT write YAML files manually — always use these scripts which handle UUID generation, field ordering, formatting, and file naming automatically.
本节仅适用于路径A(用户提供的权限图表)。对于路径B,架构师Agent在第6.3节中直接创建文件。
解析用户的图表后,使用以下确定性脚本创建YAML文件。请勿手动编写YAML文件——始终使用这些脚本,它们会自动处理UUID生成、字段排序、格式和文件命名。
6.4.1 Create Web Roles (if needed)
6.4.1 创建Web角色(若需要)
If the plan requires new web roles that don't already exist, create them first (their UUIDs are needed for table permissions):
powershell
node "${CLAUDE_PLUGIN_ROOT}/skills/create-webroles/scripts/create-web-role.js" --projectRoot "<PROJECT_ROOT>" --name "<Role Name>" [--anonymous] [--authenticated]Capture the JSON output () — use the as the value when creating table permissions.
{ "id": "<uuid>", "filePath": "<path>" }id--webRoleIds如果计划需要新的Web角色(当前不存在),先创建它们(表权限需要它们的UUID):
powershell
node "${CLAUDE_PLUGIN_ROOT}/skills/create-webroles/scripts/create-web-role.js" --projectRoot "<PROJECT_ROOT>" --name "<Role Name>" [--anonymous] [--authenticated]捕获JSON输出()——创建表权限时使用作为的值。
{ "id": "<uuid>", "filePath": "<path>" }id--webRoleIds6.4.2 Create Table Permissions
6.4.2 创建表权限
For each table permission in the plan. Process parent permissions before child permissions — children need the parent's UUID from the JSON output.
For Global/Contact/Account/Self scope:
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1,uuid2>" --scope "Global" [--read] [--create] [--write] [--delete] [--append] [--appendto]
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1,uuid2>" --scope "Contact" --contactRelationshipName "<lookup_to_contact>" [--read] [--create] [--write] [--delete] [--append] [--appendto]
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1,uuid2>" --scope "Account" --accountRelationshipName "<lookup_to_account>" [--read] [--create] [--write] [--delete] [--append] [--appendto]
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1,uuid2>" --scope "Self" [--read] [--create] [--write] [--delete] [--append] [--appendto]For Parent scope (requires parent permission UUID and relationship name):
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1>" --scope "Parent" --parentPermissionId "<parent-uuid>" --parentRelationshipName "<relationship_name>" [--read] [--create] [--write] [--delete] [--append] [--appendto]Each invocation outputs . Use the as for child permissions.
{ "id": "<uuid>", "filePath": "<path>" }id--parentPermissionId对于计划中的每个表权限。先处理父权限再处理子权限——子权限需要父权限的JSON输出中的UUID。
对于Global/Contact/Account/Self范围:
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1,uuid2>" --scope "Global" [--read] [--create] [--write] [--delete] [--append] [--appendto]
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1,uuid2>" --scope "Contact" --contactRelationshipName "<lookup_to_contact>" [--read] [--create] [--write] [--delete] [--append] [--appendto]
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1,uuid2>" --scope "Account" --accountRelationshipName "<lookup_to_account>" [--read] [--create] [--write] [--delete] [--append] [--appendto]
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1,uuid2>" --scope "Self" [--read] [--create] [--write] [--delete] [--append] [--appendto]对于Parent范围(需要父权限UUID和关系名称):
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-table-permission.js" --projectRoot "<PROJECT_ROOT>" --permissionName "<Permission Name>" --tableName "<table_logical_name>" --webRoleIds "<uuid1>" --scope "Parent" --parentPermissionId "<parent-uuid>" --parentRelationshipName "<relationship_name>" [--read] [--create] [--write] [--delete] [--append] [--appendto]每次调用输出。将用作子权限的。
{ "id": "<uuid>", "filePath": "<path>" }id--parentPermissionId6.4.3 Create Site Settings
6.4.3 创建站点设置
For each site setting in the plan:
Enabled setting (boolean):
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-site-setting.js" --projectRoot "<PROJECT_ROOT>" --name "Webapi/<table>/enabled" --value "true" --description "Enable Web API access for <table> table" --type "boolean"Fields setting (string — use the validated column names from the diagram):
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-site-setting.js" --projectRoot "<PROJECT_ROOT>" --name "Webapi/<table>/fields" --value "<comma-separated-validated-columns>" --description "Allowed fields for <table> Web API access"Inner error setting (boolean, optional for debugging):
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-site-setting.js" --projectRoot "<PROJECT_ROOT>" --name "Webapi/error/innererror" --value "true" --description "Enable detailed error messages for debugging" --type "boolean"Important: The for fields settings MUST use exact Dataverse LogicalNames (case-sensitive, all lowercase) for normal CRUD/read scenarios. Using incorrect casing causes 403 Forbidden errors.
--valueAggregate exception: If the site uses aggregate OData queries (, , grouped totals, etc.), set to . Power Pages rejects some aggregate queries with 403 unless wildcard field access is enabled.
$applyaggregateWebapi/<table>/fields*Lookup columns: For every lookup column, include both the LogicalName () AND the OData computed attribute () in the fields value. The Power Pages Web API does a literal match — the LogicalName is needed for write operations, the form is needed for read operations (, ). Missing either form causes 403 errors.
cr87b_categoryid_cr87b_categoryid_value_..._value$select$filter对于计划中的每个站点设置:
启用设置(布尔值):
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-site-setting.js" --projectRoot "<PROJECT_ROOT>" --name "Webapi/<table>/enabled" --value "true" --description "Enable Web API access for <table> table" --type "boolean"字段设置(字符串——使用图表中已验证的列名称):
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-site-setting.js" --projectRoot "<PROJECT_ROOT>" --name "Webapi/<table>/fields" --value "<comma-separated-validated-columns>" --description "Allowed fields for <table> Web API access"内部错误设置(布尔值,调试可选):
powershell
node "${CLAUDE_PLUGIN_ROOT}/scripts/create-site-setting.js" --projectRoot "<PROJECT_ROOT>" --name "Webapi/error/innererror" --value "true" --description "Enable detailed error messages for debugging" --type "boolean"重要提示:对于常规CRUD/读取场景,字段设置的必须使用精确的Dataverse LogicalNames(区分大小写,全部小写)。使用不正确的大小写会导致403 Forbidden错误。
--value聚合例外:如果站点使用聚合OData查询(、、分组总计等),将设置为。除非启用通配符字段访问,否则Power Pages会拒绝某些聚合查询并返回403。
$applyaggregateWebapi/<table>/fields*查找列:对于每个查找列,在字段值中同时包含LogicalName()和OData计算属性()。Power Pages Web API会进行字面匹配——LogicalName用于写入操作,形式用于读取操作(、)。缺少任何一种形式都会导致403错误。
cr87b_categoryid_cr87b_categoryid_value_..._value$select$filter6.5 Git Commit
6.5 Git提交
Stage and commit the permission and settings files:
powershell
git add -A
git commit -m "Add table permissions and Web API site settings for [table names]"Output: Table permissions and site settings created, verified, and committed
暂存并提交权限和设置文件:
powershell
git add -A
git commit -m "Add table permissions and Web API site settings for [table names]"输出:表权限和站点设置已创建、验证并提交
Phase 7: Review & Deploy
阶段7:审核与部署
Goal: Present a summary of all work performed and offer deployment
Actions:
目标:展示所有已执行工作的摘要并提供部署选项
操作:
7.1 Record Skill Usage
7.1 记录技能使用情况
Reference:${CLAUDE_PLUGIN_ROOT}/references/skill-tracking-reference.md
Follow the skill tracking instructions in the reference to record this skill's usage. Use .
--skillName "IntegrateWebApi"参考:${CLAUDE_PLUGIN_ROOT}/references/skill-tracking-reference.md
按照参考中的技能跟踪说明记录此技能的使用情况。使用。
--skillName "IntegrateWebApi"7.2 Present Summary
7.2 展示摘要
Present a summary of everything that was done:
| Step | Status | Details |
|---|---|---|
| API Client | Created/Existed | |
| Types | Created | |
| Services | Created | |
| Hooks | Created | |
| Components Updated | X files | Mock data replaced with API calls |
| Table Permissions | Created | X permission files |
| Site Settings | Created | X setting files |
展示已完成工作的摘要:
| 步骤 | 状态 | 详情 |
|---|---|---|
| API客户端 | 已创建/已存在 | |
| 类型 | 已创建 | |
| 服务 | 已创建 | |
| 钩子 | 已创建 | |
| 组件已更新 | X个文件 | 模拟数据已替换为API调用 |
| 表权限 | 已创建 | X个权限文件 |
| 站点设置 | 已创建 | X个设置文件 |
7.3 Ask to Deploy
7.3 询问是否部署
Use :
AskUserQuestion| Question | Options |
|---|---|
| The Web API integration and permissions are ready. To make everything live, the site needs to be deployed. Would you like to deploy now? | Yes, deploy now (Recommended), No, I'll deploy later |
If "Yes, deploy now": Invoke the skill to deploy the site.
/deploy-siteIf "No, I'll deploy later": Acknowledge and remind:
"No problem! Remember to deploy your site usingwhen you're ready. The Web API calls will not work until the site is deployed with the new permissions."/deploy-site
使用:
AskUserQuestion| 问题 | 选项 |
|---|---|
| Web API集成和权限已准备就绪。要使所有内容生效,需要部署站点。您现在要部署吗? | 是,现在部署(推荐),否,我稍后再部署 |
若选择“是,现在部署”:调用技能部署站点。
/deploy-site若选择“否,我稍后再部署”:确认并提醒:
"没问题!请记住准备好后使用部署您的站点。在使用新权限部署站点之前,Web API调用将无法工作。"/deploy-site
7.4 Post-Deploy Notes
7.4 部署后说明
After deployment (or if skipped), remind the user:
- Test the API: Open the deployed site and verify Web API calls work in the browser's Network tab
- Check permissions: If any API call returns 403, verify table permissions and site settings are correct. The most common cause of 403 errors is column names in not matching the exact Dataverse LogicalName (case-sensitive — must be all lowercase). If the failing request uses aggregate OData (
Webapi/<table>/fields,$apply, grouped totals), also verifyaggregateis set toWebapi/<table>/fields.* - Disable innererror in production: If was enabled for debugging, disable it before going live
Webapi/error/innererror - Web roles: Users must be assigned the appropriate web roles to access protected APIs
Output: Summary presented, deployment completed or deferred, post-deploy guidance provided
部署后(或若跳过部署),提醒用户:
- 测试API:打开已部署的站点并在浏览器的网络选项卡中验证Web API调用是否正常工作
- 检查权限:如果任何API调用返回403,验证表权限和站点设置是否正确。403错误最常见的原因是中的列名称与精确的Dataverse LogicalName不匹配(区分大小写——必须全部小写)。如果失败的请求使用聚合OData(
Webapi/<table>/fields、$apply、分组总计),还要验证aggregate是否设置为Webapi/<table>/fields。* - 在生产环境中禁用innererror:如果为调试启用了,上线前请禁用它
Webapi/error/innererror - Web角色:用户必须分配适当的Web角色才能访问受保护的API
输出:已展示摘要,部署已完成或推迟,已提供部署后指导
Important Notes
重要说明
Throughout All Phases
所有阶段通用
- Use TaskCreate/TaskUpdate to track progress at every phase
- Ask for user confirmation at key decision points (see list below)
- First table sequential, then parallel — the first table creates the shared API client; after that, remaining tables can be processed in parallel since each creates independent files
- Commit at milestones — after integration code and after permission files
- Verify each integration — confirm expected files exist after each agent invocation
- 使用TaskCreate/TaskUpdate跟踪每个阶段的进度
- 在关键决策点请求用户确认(请参阅下面的列表)
- 第一个表串行,后续表并行——第一个表创建共享API客户端;之后,剩余表可并行处理,因为每个表创建独立文件
- 在里程碑处提交——集成代码完成后和权限文件完成后
- 验证每个集成——每个Agent调用后确认预期文件是否存在
Key Decision Points (Wait for User)
关键决策点(等待用户操作)
- After Phase 2: Confirm which tables to integrate
- After Phase 3: Approve integration plan
- At Phase 6.1: Deploy now or skip permissions (if missing)
.powerpages-site - At Phase 6.2: Choose permissions source (upload diagram or let the architects analyze)
- At Phase 6.3: Approve table permissions plan and Web API site settings plan (both agents run in parallel for Path B, each presents its own plan for approval)
- At Phase 7.2: Deploy now or deploy later
- 阶段2后:确认要集成的表
- 阶段3后:批准集成计划
- 阶段6.1:现在部署或跳过权限设置(若缺失)
.powerpages-site - 阶段6.2:选择权限来源(上传图表或让架构师分析)
- 阶段6.3:批准表权限计划和Web API站点设置计划(路径B中两个Agent并行运行,每个都展示自己的计划以获得批准)
- 阶段7.2:现在部署或稍后部署
Progress Tracking
进度跟踪
Before starting Phase 1, create a task list with all phases using :
TaskCreate| Task subject | activeForm | Description |
|---|---|---|
| Verify site exists | Verifying site prerequisites | Locate project root, detect framework, check data model and deployment status |
| Explore integration points | Analyzing code for integration points | Use Explore agent to discover tables, existing services, and compile integration manifest |
| Review integration plan | Reviewing integration plan with user | Present findings and confirm which tables to integrate |
| Implement integrations | Implementing Web API integrations | Invoke webapi-integration agent for first table (creates shared client), then remaining tables in parallel, verify output, git commit |
| Verify integrations | Verifying integrations | Validate all expected files exist, check imports and API references, run project build |
| Setup permissions and settings | Configuring permissions and site settings | Choose permissions source (upload diagram or architects), invoke table-permissions-architect and webapi-settings-architect agents in parallel, create YAML files with case-sensitive validated column names, git commit |
| Review and deploy | Reviewing summary and deploying | Present summary, ask about deployment, provide post-deploy guidance |
Mark each task when starting it and when done via . This gives the user visibility into progress and keeps the workflow deterministic.
in_progresscompletedTaskUpdateBegin with Phase 1: Verify Site Exists
开始阶段1之前,使用创建包含所有阶段的任务列表:
TaskCreate| 任务主题 | activeForm | 描述 |
|---|---|---|
| 验证站点存在 | 验证站点前提条件 | 定位项目根目录、检测框架、检查数据模型和部署状态 |
| 探索集成点 | 分析代码中的集成点 | 使用Explore Agent发现表、现有服务并编译集成清单 |
| 审核集成计划 | 与用户审核集成计划 | 展示发现结果并确认要集成的表 |
| 实现集成 | 实现Web API集成 | 为第一个表调用webapi-integration Agent(创建共享客户端),然后并行调用剩余表,验证输出,git提交 |
| 验证集成 | 验证集成 | 验证所有预期文件是否存在,检查导入和API引用,运行项目构建 |
| 设置权限和设置 | 配置权限和站点设置 | 选择权限来源(上传图表或架构师分析),并行调用table-permissions-architect和webapi-settings-architect Agent,使用区分大小写的已验证列名称创建YAML文件,git提交 |
| 审核与部署 | 审核摘要并部署 | 展示摘要,询问部署事宜,提供部署后指导 |
开始每个任务时将其标记为,完成后通过标记为。这使用户能了解进度并保持工作流的确定性。
in_progressTaskUpdatecompleted从阶段1:验证站点存在开始