create-code-app
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese📋 Shared Instructions: shared-instructions.md - Cross-cutting concerns.
References:
- prerequisites-reference.md - Prerequisites and required permissions
- troubleshooting.md - Common issues, npm scripts, resources
📋 共享说明:shared-instructions.md - 跨领域相关事项。
参考文档:
- prerequisites-reference.md - 先决条件与所需权限
- troubleshooting.md - 常见问题、npm脚本、资源
Create Power Apps Code App
创建Power Apps代码应用
Workflow
工作流程
- Prerequisites → 2. Gather Requirements → 3. Plan → 4. Auth & Select Environment → 5. Scaffold → 6. Initialize → 7. Build & Deploy (baseline) → 8. Add Data Sources → 9. Implement App → 10. Final Build & Deploy → 11. Summary
- 先决条件 → 2. 收集需求 → 3. 规划 → 4. 身份验证与环境选择 → 5. 搭建项目框架 → 6. 初始化 → 7. 构建与部署(基线版本) → 8. 添加数据源 → 9. 实现应用功能 → 10. 最终构建与部署 → 11. 总结
Step 0: Check Memory Bank
步骤0:检查记忆库
Check for per shared-instructions.md. Skip completed steps.
memory-bank.md根据shared-instructions.md检查文件,跳过已完成的步骤。
memory-bank.mdStep 1: Validate Prerequisites
步骤1:验证先决条件
Run prerequisite checks first -- no point gathering requirements if the environment isn't ready. See prerequisites-reference.md for details.
Check Node.js, the npm CLI package, and Git (runs natively in bash):
bash
node --version # Must be v22+
git --version # Optional but recommendedCheck CLI via PowerShell — it's a Windows executable not on the bash PATH:
pacbash
pwsh -NoProfile -Command "pac" # Used for auth, env selection, code commands- Missing Node.js: Report "Install Node.js v22+ from https://nodejs.org/" and STOP.
- Node.js below v22: Report "Node.js 22+ is required. Please upgrade or switch with ." and STOP.
nvm use 22 - Missing pac: Report "Install Power Platform CLI from https://aka.ms/PowerAppsCLI" and STOP.
- Missing Git: Report "Recommended but optional." Continue if approved.
- All present: Report versions and proceed.
首先运行先决条件检查——如果环境未准备好,收集需求毫无意义。详情请见prerequisites-reference.md。
检查Node.js、npm CLI包和Git(在bash中原生运行):
bash
node --version # 必须为v22+
git --version # 可选但推荐通过PowerShell检查 CLI——这是Windows可执行文件,不在bash的PATH中:
pacbash
pwsh -NoProfile -Command "pac" # 用于身份验证、环境选择、代码相关命令- 缺少Node.js:提示“从https://nodejs.org/安装Node.js v22+”并终止流程。
- Node.js版本低于v22:提示“需要Node.js 22+版本,请升级或使用切换版本”并终止流程。
nvm use 22 - 缺少pac:提示“从https://aka.ms/PowerAppsCLI安装Power Platform CLI”并终止流程。
- 缺少Git:提示“推荐安装但非必需”,若用户同意则继续。
- 所有工具均已安装:报告版本信息并继续。
Step 2: Gather Requirements
步骤2:收集需求
Skip questions the user already answered in their initial instruction.
If the user has not described what they want to build (i.e., was invoked with no arguments or a vague prompt), start with a single open-ended question before asking anything else:
/create-code-app"What would you like to build? Describe it in your own words — what it does, who uses it, and what problem it solves."
Wait for their answer. Use it to frame all follow-up questions. Do NOT present a multiple-choice list of app types before the user has described their idea.
Once you have their description:
- Confirm the app name and clarify the purpose if needed
- Ask about data -- focus on what the app needs to do, not specific technologies:
- "What data does your app need to work with?" (e.g., company emails, project tasks, custom business records)
- "Does your app need to search existing information, manage its own data, or both?"
- Based on their answers, recommend the best approach:
- Store and manage custom business data (tables, forms, CRUD) → Dataverse ()
/add-dataverse - Interact with specific services (send emails, post messages, manage files) → the appropriate connector
- Store and manage custom business data (tables, forms, CRUD) → Dataverse (
- If they mention existing Dataverse tables, SharePoint lists, or connectors by name, use those directly
- Ask about UI requirements: key screens, layout, interactions, theme preference
- Ask any clarifying questions now -- resolve all ambiguity before entering plan mode
跳过用户在初始指令中已回答的问题。
如果用户未描述想要构建的内容(即调用时无参数或提示模糊),先提出一个开放式问题,再询问其他内容:
/create-code-app"您想要构建什么样的应用?用您自己的话描述——它的功能、使用人群以及解决的问题。"
等待用户回答,并用该回答引导后续所有问题。在用户描述其想法之前,不要提供应用类型的多选列表。
获取用户描述后:
- 确认应用名称,必要时明确应用用途
- 询问数据相关问题——聚焦于应用需要实现的功能,而非具体技术:
- "您的应用需要处理哪些数据?"(例如:公司邮件、项目任务、自定义业务记录)
- "您的应用需要搜索现有信息、管理自有数据,还是两者兼具?"
- 根据用户回答推荐最佳方案:
- 存储和管理自定义业务数据(表格、表单、增删改查)→ Dataverse()
/add-dataverse - 与特定服务交互(发送邮件、发布消息、管理文件)→ 对应的连接器
- 存储和管理自定义业务数据(表格、表单、增删改查)→ Dataverse(
- 如果用户提到已有的Dataverse表、SharePoint列表或连接器名称,直接使用这些资源
- 询问UI需求:关键页面、布局、交互方式、主题偏好
- 提出任何澄清问题——进入规划模式前解决所有歧义
Step 3: Plan
步骤3:规划
- Enter plan mode with
EnterPlanMode - Design the full implementation approach:
- Which skills to run for data sources
/add-* - App architecture: components, pages, state management
- Feature list with priority order
- Which
- Present plan for approval, include from prerequisites-reference.md
allowedPrompts - Exit plan mode with when approved
ExitPlanMode
- 使用进入规划模式
EnterPlanMode - 设计完整的实现方案:
- 为数据源运行哪些技能
/add-* - 应用架构:组件、页面、状态管理
- 按优先级排序的功能列表
- 为数据源运行哪些
- 提交规划供审批,包含prerequisites-reference.md中的
allowedPrompts - 获批后使用退出规划模式
ExitPlanMode
Step 4: Auth & Select Environment
步骤4:身份验证与环境选择
bash
pwsh -NoProfile -Command "pac auth list"If empty, proceed since the command will use system credentials. If profiles are listed, check which environment they target.
If multiple profiles are listed: Notify the user that using Microsoft tenant credentials requires clearing all profiles first, then run:
bash
pwsh -NoProfile -Command "pac auth clear"After clearing, there is no need to run . The tool picks up the system login automatically.
auth createpwsh -NoProfile -Command "pac auth list"- Environment matches user's target: Confirm and proceed.
- On a different environment or no target set: Run , show up to 10 options, let the user pick, and run
pwsh -NoProfile -Command "pac env list".pwsh -NoProfile -Command "pac env select --environment <id>"
See preferred-environment.md for details.
Critical: Capture the environment ID for Step 7.
bash
pwsh -NoProfile -Command "pac auth list"如果结果为空,继续执行,因为命令将使用系统凭据。如果列出了配置文件,检查它们指向的环境。
如果列出多个配置文件:通知用户使用Microsoft租户凭据需要先清除所有配置文件,然后运行:
bash
pwsh -NoProfile -Command "pac auth clear"清除后,无需运行,工具会自动获取系统登录信息。
auth createpwsh -NoProfile -Command "pac auth list"- 环境与用户目标匹配:确认并继续。
- 环境不符或未设置目标:运行,显示最多10个选项,让用户选择,然后运行
pwsh -NoProfile -Command "pac env list"。pwsh -NoProfile -Command "pac env select --environment <id>"
详情请见preferred-environment.md。
关键操作:记录步骤7所需的环境ID。
Step 5: Scaffold
步骤5:搭建项目框架
Ask the user for a folder name. Default to if they don't have a preference.
powerapps-{app-name-slugified}-{timestamp}IMPORTANT: Use to download the template. Do NOT use , do NOT manually create files, do NOT download from GitHub UI. downloads the template without git history.
npx degitgit clonedegitpowershell
npx degit microsoft/PowerAppsCodeApps/templates/vite {folder} --force
cd {folder}
npm installNotes:
- Use to overwrite if the directory already has files (e.g.,
--forcefrom a planning session).claude - If targeting an existing directory, use as the folder name:
.npx degit microsoft/PowerAppsCodeApps/templates/vite . --force - If fails (network issues, npm not found), retry once, then ask the user to run manually
npx degit
Verify: exists, created.
package.jsonnode_modules/向用户询问文件夹名称。如果用户无偏好,默认使用。
powerapps-{app-name-slugified}-{timestamp}重要提示:使用下载模板。请勿使用,请勿手动创建文件,请勿从GitHub UI下载。会下载无Git历史的模板。
npx degitgit clonedegitpowershell
npx degit microsoft/PowerAppsCodeApps/templates/vite {folder} --force
cd {folder}
npm install注意事项:
- 使用覆盖目录中已有的文件(例如:规划会话中生成的
--force).claude - 如果目标是现有目录,使用作为文件夹名称:
.npx degit microsoft/PowerAppsCodeApps/templates/vite . --force - 如果失败(网络问题、未找到npm),重试一次,然后请用户手动运行
npx degit
验证:确认存在,已创建。
package.jsonnode_modules/Step 6: Initialize
步骤6:初始化
bash
pwsh -NoProfile -Command "pac code init --displayName '{user-provided-app-name}' -e <environment-id>"pac code init- Non-zero exit: Report the exact output and STOP. Do not continue to Step 7.
- "environmentId not found": Confirm the environment ID from Step 4 and retry with the correct value.
-e - Example: "The command failed:
pac code init. Please check that environment ID[error text]is correct and that you have maker permissions in that environment."32a51012-...
Critical: Read and verify matches Step 4. Update if mismatched (common issue).
power.config.jsonenvironmentIdbash
pwsh -NoProfile -Command "pac code init --displayName '{user-provided-app-name}' -e <environment-id>"pac code init- 非零退出码:报告确切输出并终止流程,不要继续执行步骤7。
- "environmentId not found":确认步骤4中的环境ID,使用正确的值重试。
-e - 示例:"命令失败:
pac code init。请检查环境ID[错误文本]是否正确,以及您是否拥有该环境的制作者权限。"32a51012-...
关键操作:读取并验证是否与步骤4中的一致。如果不匹配则更新(常见问题)。
power.config.jsonenvironmentIdStep 7: Build & Deploy (baseline)
步骤7:构建与部署(基线版本)
Pre-approved: This baseline deploy is part of the scaffold flow and does not require a separate confirmation prompt.
Build and deploy the bare template to verify the pipeline works before adding data sources.
powershell
npm run buildVerify folder created with and .
dist/index.htmlassets/bash
pwsh -NoProfile -Command "pac code push"Capture app URL from output:
https://apps.powerapps.com/play/e/{env-id}/app/{app-id}Common deploy errors: See troubleshooting.md.
Create or update in the project root now -- don't wait until the end. Include:
memory-bank.md- Project path, app name, environment ID, app URL
- Completed steps: scaffold, init, baseline deploy
- Data sources planned (from Step 2)
- Version: v1.0.0
This ensures progress is saved even if the session ends unexpectedly.
预批准:此基线部署是框架搭建流程的一部分,无需单独确认提示。
在添加数据源之前,构建并部署基础模板以验证流水线是否正常工作。
powershell
npm run build验证文件夹是否已创建,且包含和。
dist/index.htmlassets/bash
pwsh -NoProfile -Command "pac code push"从输出中捕获应用URL:
https://apps.powerapps.com/play/e/{env-id}/app/{app-id}常见部署错误:请见troubleshooting.md。
立即在项目根目录创建或更新——不要等到流程结束。包含以下内容:
memory-bank.md- 项目路径、应用名称、环境ID、应用URL
- 已完成步骤:框架搭建、初始化、基线部署
- 规划的数据源(来自步骤2)
- 版本:v1.0.0
这可确保即使会话意外终止,进度也能保存。
Step 8: Add Data Sources
步骤8:添加数据源
Invoke the skills identified in the plan (Step 3). Run each in sequence. Pass context as arguments so sub-skills skip redundant questions (project path, connector name, etc.):
/add-*| App needs to... | Invoke |
|---|---|
| Store/manage custom business data | |
| Track work items, bugs, pipelines | |
| Send or read Teams messages | |
| Read/write Excel spreadsheet data | |
| Upload, download, or manage files | |
| Work with SharePoint lists or docs | |
| Send emails, read inbox, manage calendar | |
| Invoke a Copilot Studio agent | |
| Connect to another service | |
Each skill runs to catch errors. Do NOT deploy yet.
/add-*npm run buildIf no data sources needed: Skip to Step 9.
调用步骤3(规划)中确定的技能,依次运行每个技能。传递上下文作为参数,以便子技能跳过重复问题(项目路径、连接器名称等):
/add-*| 应用需要... | 调用命令 |
|---|---|
| 存储/管理自定义业务数据 | |
| 跟踪工作项、缺陷、流水线 | |
| 发送或读取Teams消息 | |
| 读写Excel电子表格数据 | |
| 上传、下载或管理文件 | |
| 处理SharePoint列表或文档 | |
| 发送邮件、读取收件箱、管理日历 | |
| 调用Copilot Studio代理 | |
| 连接到其他服务 | |
每个技能都会运行以捕获错误,暂不部署。
/add-*npm run build如果无需数据源:跳至步骤9。
Step 9: Implement App
步骤9:实现应用功能
This is the core step. Build the actual app features described in the plan from Step 3.
- Review generated services: Use to find methods in generated service files (they can be very large -- see connector-reference.md). Do NOT read entire generated files.
Grep - Build components: Create React components for each screen/feature in the plan
- Connect data: Wire components to generated services (use ,
*Service.getAll(), etc.)*Service.create() - Apply theme: Use the user's theme preference (default: dark theme per development standards)
- Add version display: Show app version in the UI (per development standards)
- Iterate with user: Show progress, ask for feedback, adjust as needed
Key rules:
- Use generated services for all data access -- never use fetch/axios directly
- Read dataverse-reference.md if working with Dataverse (picklist fields, virtual fields, lookups have critical gotchas)
- Remove unused imports before building (TS6133 strict mode)
- Don't edit files in unless fixing known issues
src/generated/
这是核心步骤。根据步骤3(规划)中的方案构建实际的应用功能。
- 查看生成的服务:使用查找生成的服务文件中的方法(这些文件可能非常大——请见connector-reference.md)。请勿读取整个生成文件。
Grep - 构建组件:为方案中的每个页面/功能创建React组件
- 连接数据:将组件与生成的服务关联(使用、
*Service.getAll()等方法)*Service.create() - 应用主题:使用用户偏好的主题(默认:符合开发标准的深色主题)
- 添加版本显示:在UI中显示应用版本(符合开发标准)
- 与用户迭代:展示进度、征求反馈、按需调整
关键规则:
- 所有数据访问均使用生成的服务——切勿直接使用fetch/axios
- 如果使用Dataverse,请阅读dataverse-reference.md(选择列表字段、虚拟字段、查找存在关键注意事项)
- 构建前移除未使用的导入(TS6133严格模式)
- 除非修复已知问题,否则不要编辑中的文件
src/generated/
Step 10: Final Build & Deploy
步骤10:最终构建与部署
powershell
npm run buildFix any TypeScript errors. Verify contains the updated app.
dist/Ask the user: "Ready to deploy to [environment name]? This will update the live app." Wait for explicit confirmation before proceeding.
bash
pwsh -NoProfile -Command "pac code push"Increment version (e.g., v1.0.0 → v1.1.0) and update version display in the app.
powershell
npm run build修复所有TypeScript错误,验证包含更新后的应用。
dist/询问用户:"是否准备部署到[环境名称]?这将更新线上应用。" 继续执行前等待用户明确确认。
bash
pwsh -NoProfile -Command "pac code push"递增版本号(例如:v1.0.0 → v1.1.0)并更新应用中的版本显示。
Step 11: Summary
步骤11:总结
Provide:
- App name, environment, app URL, project location
- Version deployed
- What was built: features, data sources, components
- Next steps: how to iterate (), how to add more data sources
npm run build && pac code push - Suggest what else the app could do:
- -- add another data source (describe what you need, and the plugin will recommend the best approach)
/add-datasource - -- store and manage custom business data
/add-dataverse - -- track work items, bugs, and pipelines
/add-azuredevops - -- send and read Teams messages
/add-teams - -- work with SharePoint lists or documents
/add-sharepoint - -- send emails, manage calendar
/add-office365 - -- connect to any other service
/add-connector
- Manage at https://make.powerapps.com/environments/<environment-id>/home
提供以下内容:
- 应用名称、环境、应用URL、项目位置
- 已部署版本
- 构建内容:功能、数据源、组件
- 后续步骤:如何迭代()、如何添加更多数据源
npm run build && pac code push - 应用可扩展的功能建议:
- — 添加另一个数据源(描述您的需求,插件将推荐最佳方案)
/add-datasource - — 存储和管理自定义业务数据
/add-dataverse - — 跟踪工作项、缺陷和流水线
/add-azuredevops - — 发送和读取Teams消息
/add-teams - — 处理SharePoint列表或文档
/add-sharepoint - — 发送邮件、管理日历
/add-office365 - — 连接到任何其他服务
/add-connector
- 管理地址:https://make.powerapps.com/environments/<environment-id>/home
Update Memory Bank
更新记忆库
Update the memory bank (created in Step 7) with final state:
- All completed steps (scaffold, data sources, implementation, deploy)
- Features implemented and components created
- Data sources connected
- Current version
- Suggested next steps
使用最终状态更新步骤7中创建的记忆库:
- 所有已完成步骤(框架搭建、数据源、功能实现、部署)
- 已实现的功能和创建的组件
- 已连接的数据源
- 当前版本
- 建议的后续步骤
Example Walkthroughs
示例演练
These walkthroughs show the full sequence from user request to final output — commands run, files changed, and the verbatim summary format the assistant should use.
这些演练展示了从用户请求到最终输出的完整流程——运行的命令、修改的文件,以及助手应使用的准确总结格式。
Example 1: Create a Task Tracker App with Dataverse
示例1:使用Dataverse创建任务跟踪器应用
User request:
"Build me a simple task tracker that stores tasks in Dataverse. I want to add tasks, mark them complete, and see a list."
Commands run (in order):
bash
undefined用户请求:
"帮我构建一个简单的任务跟踪器,将任务存储在Dataverse中。我想要添加任务、标记任务完成,并查看任务列表。"
运行的命令(按顺序):
bash
undefinedStep 1: Prerequisites
步骤1:先决条件
node --version # → v22.4.0
pwsh -NoProfile -Command "pac" # verify installed
node --version # → v22.4.0
pwsh -NoProfile -Command "pac" # 验证是否已安装
Step 4: Auth
步骤4:身份验证
pwsh -NoProfile -Command "pac auth list" # → verify active environment
pwsh -NoProfile -Command "pac auth list" # → 验证活动环境
Step 5: Scaffold
步骤5:搭建框架
npx degit microsoft/PowerAppsCodeApps/templates/vite powerapps-task-tracker-20260302 --force
cd powerapps-task-tracker-20260302
npm install
npx degit microsoft/PowerAppsCodeApps/templates/vite powerapps-task-tracker-20260302 --force
cd powerapps-task-tracker-20260302
npm install
Step 6: Initialize
步骤6:初始化
pwsh -NoProfile -Command "pac code init --displayName 'Task Tracker' -e <environment-id>"
pwsh -NoProfile -Command "pac code init --displayName 'Task Tracker' -e <environment-id>"
Step 7: Baseline deploy (pre-approved as part of scaffold flow)
步骤7:基线部署(作为框架搭建流程的一部分已预批准)
npm run build
pwsh -NoProfile -Command "pac code push"
npm run build
pwsh -NoProfile -Command "pac code push"
→ App URL: https://apps.powerapps.com/play/e/32a51012-.../app/<app-id>
→ 应用URL: https://apps.powerapps.com/play/e/32a51012-.../app/<app-id>
Step 8: Add Dataverse (via /add-dataverse)
步骤8:添加Dataverse(通过/add-dataverse)
pwsh -NoProfile -Command "pac code add-data-source -a dataverse -t cr123_task"
npm run build # verify connector — no deploy yet
pwsh -NoProfile -Command "pac code add-data-source -a dataverse -t cr123_task"
npm run build # 验证连接器 — 暂不部署
Step 10: Final deploy (requires user confirmation)
步骤10:最终部署(需要用户确认)
npm run build
pwsh -NoProfile -Command "pac code push"
**Files changed:**
| File | Change |
| --------------------------------------------- | ----------------------------------------------------- |
| `power.config.json` | Created by `pac code init` — contains `environmentId` |
| `src/generated/models/Cr123_taskModel.ts` | Generated by `pac code add-data-source` |
| `src/generated/services/Cr123_taskService.ts` | Generated by `pac code add-data-source` |
| `src/components/TaskList.tsx` | Created — renders task list with status filter |
| `src/components/AddTaskForm.tsx` | Created — form to add new tasks |
| `src/App.tsx` | Updated — wires components to `Cr123_taskService` |
| `memory-bank.md` | Created in Step 7, updated in Step 11 |
**Final assistant summary (verbatim format):**
Task Tracker is live.
App: Task Tracker v1.0.0
Environment: <your-environment-name> (<environment-id>)
URL: https://apps.powerapps.com/play/e/<environment-id>/app/<app-id>
Project: ~/powerapps-task-tracker-20260302/
What was built:
- Task list view with Active / Completed filter
- Add task form (title, description, due date)
- Mark complete / delete actions
- Dataverse table (Title, Description, DueDate, IsComplete)
cr123_task
To redeploy: npm run build && pac code push (from the project folder)
What you can add next:
- /add-teams — post task updates to a Teams channel
- /add-office365 — send email notifications on completion
**What to record in `memory-bank.md`:**
```markdownnpm run build
pwsh -NoProfile -Command "pac code push"
**修改的文件:**
| 文件 | 变更内容 |
| --------------------------------------------- | ----------------------------------------------------- |
| `power.config.json` | 由`pac code init`创建 — 包含`environmentId` |
| `src/generated/models/Cr123_taskModel.ts` | 由`pac code add-data-source`生成 |
| `src/generated/services/Cr123_taskService.ts` | 由`pac code add-data-source`生成 |
| `src/components/TaskList.tsx` | 创建 — 渲染带状态筛选的任务列表 |
| `src/components/AddTaskForm.tsx` | 创建 — 添加新任务的表单 |
| `src/App.tsx` | 更新 — 将组件与`Cr123_taskService`关联 |
| `memory-bank.md` | 步骤7中创建,步骤11中更新 |
**助手最终总结(准确格式):**
任务跟踪器已上线。
应用:Task Tracker v1.0.0
环境:<您的环境名称> (<环境ID>)
URL:https://apps.powerapps.com/play/e/<环境ID>/app/<应用ID>
项目:~/powerapps-task-tracker-20260302/
构建内容:
- 带“活跃/已完成”筛选的任务列表视图
- 添加任务表单(标题、描述、截止日期)
- 标记完成/删除操作
- Dataverse表(标题、描述、截止日期、是否完成)
cr123_task
重新部署方式:在项目文件夹中运行 npm run build && pac code push
后续可添加功能:
- /add-teams — 将任务更新发布到Teams频道
- /add-office365 — 任务完成时发送邮件通知
**`memory-bank.md`中记录的内容:**
```markdownTask Tracker — Memory Bank
任务跟踪器 — 记忆库
Project
项目
- Path: ~/powerapps-task-tracker-20260302/
- App name: Task Tracker
- Environment: <your-environment-name> (<environment-id>)
- App URL: https://apps.powerapps.com/play/e/<environment-id>/app/<app-id>
- Version: v1.0.0
- 路径:~/powerapps-task-tracker-20260302/
- 应用名称:Task Tracker
- 环境:<您的环境名称> (<环境ID>)
- 应用URL:https://apps.powerapps.com/play/e/<环境ID>/app/<应用ID>
- 版本:v1.0.0
Completed Steps
已完成步骤
- Prerequisites validated
- Scaffold (npx degit)
- Initialize (pac code init)
- Baseline deploy
- Add Dataverse (cr123_task)
- Implement app (TaskList, AddTaskForm)
- Final deploy
- 验证先决条件
- 搭建框架(npx degit)
- 初始化(pac code init)
- 基线部署
- 添加Dataverse(cr123_task)
- 实现应用功能(TaskList、AddTaskForm)
- 最终部署
Data Sources
数据源
- Dataverse: cr123_task (Title, Description, DueDate, IsComplete)
- Dataverse: cr123_task(标题、描述、截止日期、是否完成)
Components
组件
- TaskList.tsx — filtered list, mark complete, delete
- AddTaskForm.tsx — create new tasks
- TaskList.tsx — 筛选列表、标记完成、删除
- AddTaskForm.tsx — 创建新任务
Next Steps
后续步骤
- Consider /add-teams for task assignment notifications
---- 考虑使用/add-teams实现任务分配通知
---Example 2: Add SharePoint Connector to an Existing App
示例2:为现有应用添加SharePoint连接器
User request:
"My app already exists. Add SharePoint so I can read items from a list called 'Project Milestones'."
Commands run (in order):
bash
undefined用户请求:
"我的应用已存在。添加SharePoint连接器,以便我可以读取名为'项目里程碑'的列表中的项。"
运行的命令(按顺序):
bash
undefinedStep 6: Get connection ID (via /list-connections)
步骤6:获取连接ID(通过/list-connections)
pwsh -NoProfile -Command "pac connection list"
pwsh -NoProfile -Command "pac connection list"
→ ConnectionId: conn-sp-xyz789 (SharePoint Online)
→ 连接ID: conn-sp-xyz789 (SharePoint Online)
Step 7: Discover sites
步骤7:发现站点
pwsh -NoProfile -Command "pac code list-datasets -a sharepointonline -c conn-sp-xyz789"
pwsh -NoProfile -Command "pac code list-datasets -a sharepointonline -c conn-sp-xyz789"
Step 8: Discover tables
步骤8:发现表格
pwsh -NoProfile -Command "pac code list-tables -a sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects'"
pwsh -NoProfile -Command "pac code list-tables -a sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects'"
→ Project Milestones, Documents, Team Wiki
→ 项目里程碑、文档、团队维基
Step 9: Add connector
步骤9:添加连接器
pwsh -NoProfile -Command "pac code add-data-source -a sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects' -t 'Project Milestones'"
pwsh -NoProfile -Command "pac code add-data-source -a sharepointonline -c conn-sp-xyz789 -d 'https://contoso.sharepoint.com/sites/Projects' -t '项目里程碑'"
Step 11: Build to verify
步骤11:构建验证
npm run build # → success
**Files changed:**
| File | Change |
| --------------------------------------------------- | ------------------------------------------------- |
| `src/generated/services/SharePointOnlineService.ts` | Generated — contains `GetItems`, `PostItem`, etc. |
| `src/generated/models/SharePointOnlineModel.ts` | Generated — TypeScript interfaces |
| `.power/schemas/sharepointonline/` | Generated schema files |
| `memory-bank.md` | Updated — connector recorded |
**Final assistant summary (verbatim format):**
SharePoint Online connector added.
Connector: SharePoint Online
Site: https://contoso.sharepoint.com/sites/Projects
List: Project Milestones
Build: Passed ✓
Usage:
const result = await SharePointOnlineService.GetItems({
dataset: "https://contoso.sharepoint.com/sites/Projects",
table: "Project Milestones"
});
const milestones = result.data?.value || [];
Next: Implement your UI components using the generated service, then run /deploy when ready.
undefinednpm run build # → 成功
**修改的文件:**
| 文件 | 变更内容 |
| --------------------------------------------------- | ------------------------------------------------- |
| `src/generated/services/SharePointOnlineService.ts` | 生成 — 包含`GetItems`、`PostItem`等方法 |
| `src/generated/models/SharePointOnlineModel.ts` | 生成 — TypeScript接口 |
| `.power/schemas/sharepointonline/` | 生成的架构文件 |
| `memory-bank.md` | 更新 — 记录连接器 |
**助手最终总结(准确格式):**
已添加SharePoint Online连接器。
连接器:SharePoint Online
站点:https://contoso.sharepoint.com/sites/Projects
列表:项目里程碑
构建:已通过 ✓
使用方式:
const result = await SharePointOnlineService.GetItems({
dataset: "https://contoso.sharepoint.com/sites/Projects",
table: "项目里程碑"
});
const milestones = result.data?.value || [];
下一步:使用生成的服务实现UI组件,准备就绪后运行/deploy。
undefined