add-azuredevops

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
📋 Shared Instructions: shared-instructions.md - Cross-cutting concerns.
📋 共享说明:shared-instructions.md - 跨领域关注点。

Add Azure DevOps

添加Azure DevOps连接器

Workflow

工作流程

  1. Check Memory Bank → 2. Add Connector → 3. Apply HttpRequest Fix → 4. Configure → 5. Build → 6. Update Memory Bank

  1. 检查内存库 → 2. 添加连接器 → 3. 应用HttpRequest修复 → 4. 配置 → 5. 构建 → 6. 更新内存库

Step 1: Check Memory Bank

步骤1:检查内存库

Check for
memory-bank.md
per shared-instructions.md.
按照shared-instructions.md的说明检查
memory-bank.md

Step 2: Add Connector

步骤2:添加连接器

First, find the connection ID (see connector-reference.md):
Run the
/list-connections
skill. Find the Azure DevOps connection in the output. If none exists, direct the user to create one using the environment-specific Connections URL — construct it from the active environment ID in context (from
power.config.json
or a prior step):
https://make.powerapps.com/environments/<environment-id>/connections
+ New connection → search for the connector → Create.
bash
pwsh -NoProfile -Command "pac code add-data-source -a azuredevops -c <connection-id>"
首先,找到连接ID(参见connector-reference.md):
运行
/list-connections
技能。在输出中找到Azure DevOps连接。如果不存在,请引导用户使用特定环境的连接URL创建一个——根据上下文(来自
power.config.json
或之前步骤)中的活动环境ID构建该URL:
https://make.powerapps.com/environments/<environment-id>/connections
+ 新建连接 → 搜索该连接器 → 创建。
bash
pwsh -NoProfile -Command "pac code add-data-source -a azuredevops -c <connection-id>"

Step 3: Apply HttpRequest Fix (Required)

步骤3:应用HttpRequest修复(必填)

The generated code has a known issue: the
HttpRequest
method uses
parameters
as the parameter name, but the API expects
body
. Rename
parameters
to
body
in these 3 files:
Use the
Edit
tool to rename
parameters
to
body
in each file:
1.
src/generated/services/AzureDevOpsService.ts
:
Find the
HttpRequest
method. Rename the parameter and its usage:
typescript
// BEFORE (generated):
async HttpRequest(parameters: any) {
  const params = { parameters: parameters, ... };

// AFTER (fixed):
async HttpRequest(body: any) {
  const params = { body: body, ... };
2.
.power/appschemas/dataSourceInfo.ts
:
Find the
visualstudioteamservices
HttpRequest
parameters
section. Rename the property key:
typescript
// BEFORE (generated):
HttpRequest: {
  parameters: {
    parameters: { ... }

// AFTER (fixed):
HttpRequest: {
  parameters: {
    body: { ... }
3.
.power/schemas/visualstudioteamservices/visualstudioteamservices.Schema.json
:
Find the
/{connectionId}/httprequest
post
parameters
array. Change the
name
field:
json
// BEFORE (generated):
{ "name": "parameters", "in": "body", ... }

// AFTER (fixed):
{ "name": "body", "in": "body", ... }
生成的代码存在一个已知问题:
HttpRequest
方法使用
parameters
作为参数名称,但API期望的是
body
。在以下3个文件中将
parameters
重命名为
body
使用
Edit
工具在每个文件中把
parameters
重命名为
body
1.
src/generated/services/AzureDevOpsService.ts
找到
HttpRequest
方法。重命名参数及其用法:
typescript
// BEFORE (generated):
async HttpRequest(parameters: any) {
  const params = { parameters: parameters, ... };

// AFTER (fixed):
async HttpRequest(body: any) {
  const params = { body: body, ... };
2.
.power/appschemas/dataSourceInfo.ts
找到
visualstudioteamservices
HttpRequest
parameters
部分。重命名属性键:
typescript
// BEFORE (generated):
HttpRequest: {
  parameters: {
    parameters: { ... }

// AFTER (fixed):
HttpRequest: {
  parameters: {
    body: { ... }
3.
.power/schemas/visualstudioteamservices/visualstudioteamservices.Schema.json
找到
/{connectionId}/httprequest
post
parameters
数组。修改
name
字段:
json
// BEFORE (generated):
{ "name": "parameters", "in": "body", ... }

// AFTER (fixed):
{ "name": "body", "in": "body", ... }

Step 4: Configure

步骤4:配置

Ask the user what Azure DevOps operations they need (query work items, create items, trigger pipelines, etc.).
HttpRequest -- make arbitrary ADO REST API calls:
typescript
await AzureDevOpsService.HttpRequest({
  Uri: "https://dev.azure.com/{org}/{project}/_apis/wit/wiql?api-version=7.2",
  Method: "POST",
  Body: JSON.stringify({
    query:
      "SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.TeamProject] = @project"
  })
});
Use
Grep
to find specific methods in
src/generated/services/AzureDevOpsService.ts
(generated files can be very large -- see connector-reference.md).
询问用户需要哪些Azure DevOps操作(查询工作项、创建项、触发管道等)。
HttpRequest -- 发起任意ADO REST API调用:
typescript
await AzureDevOpsService.HttpRequest({
  Uri: "https://dev.azure.com/{org}/{project}/_apis/wit/wiql?api-version=7.2",
  Method: "POST",
  Body: JSON.stringify({
    query:
      "SELECT [System.Id], [System.Title] FROM WorkItems WHERE [System.TeamProject] = @project"
  })
});
使用
Grep
src/generated/services/AzureDevOpsService.ts
中查找特定方法(生成的文件可能非常大——参见connector-reference.md)。

Step 5: Build

步骤5:构建

powershell
npm run build
Fix TypeScript errors before proceeding. Do NOT deploy yet.
powershell
npm run build
在继续之前修复TypeScript错误。请勿部署

Step 6: Update Memory Bank

步骤6:更新内存库

Update
memory-bank.md
with: connector added, HttpRequest fix applied, build status.
memory-bank.md
中更新以下内容:已添加连接器、已应用HttpRequest修复、构建状态。