产品
VS Code 扩展
版本 2.7.0。PromptFlowEngine for VS Code 围绕一个工作流构建:代码库 → 提示词 → AI → 代码库。它在进程内运行引擎:没有服务器,没有 Python,自己也不调用模型。
promptflow-ai.ide-extension。本页描述的是仓库中的版本;在下一个版本发布之前,Marketplace 上可能仍是上一个版本。 扩展本身为英文界面。工作流
CODEBASE pick a scope: workspace, current file, chosen files, or none
↓ only files relevant to the task are read
PROMPT describe the change in your own words
↓ the engine structures it and grounds it in the code
AI send to VS Code Chat, copy, or save
↓ secrets and personal data are checked first
CODEBASE review the changes in Source Control,
or build a review prompt from the modified files打开活动栏中的 PromptFlowEngine 图标。面板会按顺序带你走完四个步骤。
1. 代码库
选择整个工作区、当前文件、选择文件或文件夹,或不含代码。文件会经过过滤(不含 node_modules、构建输出或二进制文件)、按与任务的相关性打分并限制数量,所以提示词只携带少数真正相关的文件,而不是整个仓库。
2. 提示词
像平时说话那样输入任务。生成提示词会产出分节的工程提示词:角色、目标、项目背景、相关代码、需求、约束、边界情况、测试、验收标准和预期输出。只有任务需要时才会出现相应的部分:“解释一下这个”这样的请求不会得到测试计划。面板会显示有多少行来自你的任务、来自代码库、来自新增的指导,提示词仍可编辑。这与 MCP 工具和 HTTP API 提供的重构是同一种。
3. AI
发送到 AI 聊天会在 VS Code 聊天中打开提示词(不可用时则复制)。在任何内容离开之前,隐私防护会扫描凭据和个人数据。模式:strict(拦截)、redact(默认,替换为占位符)、warn(询问)。精简 token通过经过验证、保留原意的修改去掉冗词和重复。
4. 代码库
当 AI 修改了你的文件后,审查更改会打开源代码管理,你可以逐个保留或放弃。生成审查提示词会读取有未提交更改的文件,并生成一份对照你最初任务检查它们的审查提示词。它需要内置的 Git 扩展,且只读;从不暂存、提交或还原。
命令
PromptFlowEngine: Codebase → PromptPromptFlowEngine: Codebase → Prompt from SelectionPromptFlowEngine: Open PromptOps WorkspacePromptFlowEngine: Optimize PromptPromptFlowEngine: Restructure PromptPromptFlowEngine: Analyze PromptPromptFlowEngine: Compare Original vs RestructuredPromptFlowEngine: Send Prompt to AI ChatPromptFlowEngine: Prompt → Codebase (Review Changes)PromptFlowEngine: Insert Prompt TemplatePromptFlowEngine: Select Model for Tokens and CostPromptFlowEngine: Connect to OrganizationPromptFlowEngine: Organization StatusPromptFlowEngine: Install Agent Hooks (Claude Code, Cursor, Windsurf, Copilot, Gemini CLI)PromptFlowEngine: Remove Agent HooksPromptFlowEngine: Turn On Activity HistoryPromptFlowEngine: Pause or Resume Activity HistoryPromptFlowEngine: Turn Off Activity HistoryPromptFlowEngine: Show Activity HistoryPromptFlowEngine: Turn Prompt Text in History On or OffPromptFlowEngine: Set Activity History RetentionPromptFlowEngine: Export Activity HistoryPromptFlowEngine: Delete Activity HistoryPromptFlowEngine: Sign InPromptFlowEngine: Sign OutPromptFlowEngine: Account and Activity StatusPromptFlowEngine: Show Protection DashboardPromptFlowEngine: Scan Selection for Sensitive DataPromptFlowEngine: Redact Sensitive Data in SelectionPromptFlowEngine: Protection StatusPromptFlowEngine: Reset Protection Metrics
重构提示词作用于选中内容或整个文档,打开原文与重构结果的差异,并可选择替换文本、发送到聊天或复制。分析提示词在 PromptFlowEngine 输出通道中列出质量分、token 数、预估输入成本,以及每个问题的原因和修复方法。插入提示词模板在光标处插入一个模板或库中的提示词。选择用于 token 和成本的模型可以选择模型目录中的任意模型。状态栏显示上一个提示词的 token 数和质量分。
重构、分析、插入提示词模板和发送也在编辑器右键菜单的 PromptFlowEngine 下,每个命令在 Ctrl+Alt+P(macOS 上是 Cmd+Alt+P)之下都有一个组合键:
Ctrl+Alt+P O: Optimize PromptCtrl+Alt+P W: Open PromptOps WorkspaceCtrl+Alt+P R: Restructure PromptCtrl+Alt+P A: Analyze PromptCtrl+Alt+P T: Insert Prompt TemplateCtrl+Alt+P S: Send Prompt to AI ChatCtrl+Alt+P M: Select Model for Tokens and CostCtrl+Alt+P P: Codebase → Prompt
安装
在 VS Code 中打开扩展视图并搜索 PromptFlowEngine,或运行:
code --install-extension promptflow-ai.ide-extension如需改为从源码构建这个确切的版本:
# from the root of your PromptFlowEngine checkout
corepack enable && pnpm install
pnpm --filter ide-extension build
cd apps/vscode-extension && pnpm exec vsce package --no-dependencies
code --install-extension ide-extension-2.7.0.vsixCopilot 智能体模式
激活时,扩展会把内置的 MCP 服务器注册到 .vscode/mcp.json(需要 PATH 中有 node),这样智能体就可以直接调用同样的工具。参见 MCP 客户端。
设置
| 设置 | 默认值 | 用途 |
|---|---|---|
promptflow.mcpServerCommand | "node" | Advanced: overrides the command used to launch the external MCP server registered for GitHub Copilot Agent mode (.vscode/mcp.json). The panel and PromptFlowEngine commands don't use this; they run in-process. Leave unset to use the bundled server. |
promptflow.mcpServerArgs | [] | Advanced: arguments for promptflow.mcpServerCommand. Leave unset to use the bundled server. |
promptflow.model | "" | Model used for token counts and cost estimates, as a model id from the catalog (for example gpt-4.1 or claude-sonnet-5-5). Leave empty to use promptflow.defaultProvider. |
promptflow.defaultProvider | "gpt" | Model family used for token counts when promptflow.model is empty. Kept for existing configurations. |
promptflow.codebaseMaxFiles | 2000 | Maximum number of files scanned per Codebase → Prompt run, before relevance filtering. |
promptflow.codebaseMaxRelevantFiles | 12 | Maximum number of files included as relevant context in a generated prompt. |
promptflow.privacy.enabled | true | Scan prompts for sensitive data (credentials, PII, cloud secrets) before they're sent to AI Chat or copied for that purpose. |
promptflow.privacy.mode | "redact" | How PromptFlowEngine reacts when sensitive data is detected in an outbound prompt. When this editor is connected to an organization, its policy applies instead. |
promptflow.privacy.exclusions | [] | Exact substrings that should never be treated as sensitive (e.g. a shared team email alias). |
promptflow.privacy.customPatterns | [] | Additional organization-specific sensitive-data patterns, detected alongside the built-in ones. |
promptflow.exposure.enabled | true | Warn when an open file contains credentials that an AI assistant could attach as context. Detection is on this device; values are never shown or sent. |
promptflow.enterprise.enrollmentKey | "" | Set by IT: an enrollment key from the PromptFlowEngine admin console (pfe_…). Connects this editor to the organization on start. |
promptflow.enterprise.server | "" | Set by IT: the PromptFlowEngine server origin. Defaults to https://promptflowengine.com. |
promptflow.enterprise.userEmail | "" | Set by IT (optional): the user’s work email, so their devices count as one seat. Only a keyed hash is stored. |
promptflow.account.server | "https://promptflowengine.com" | |
promptflow.diagnostics.errorReports | false | |
promptflow.dashboard.metrics | true | Keep daily counts (prompts scanned, categories found, warned/redacted/blocked/handed off) for the Protection Dashboard. Counts only, on this machine, for 90 days; no prompt text or values. Turn off to stop counting; "Reset Protection Metrics" deletes what was kept. |
设置键沿用早期版本的 promptflow. 前缀,因此现有配置可以继续使用。
2.2 版的变化
- 完整的模型目录取代了原来的四个模型系列,附每个模型的标价、核对日期以及 token 计数是否精确。
- 新命令:插入提示词模板、选择用于 token 和成本的模型。新设置:
promptflow.model。 - 分析提示词现在会报告质量、token、成本以及每个问题的修复方法。
- 新增编辑器右键菜单和键盘组合键。
- 已修复:没有参考价格的模型不再被套用其他模型的成本;升级后会修复
.vscode/mcp.json中的 Copilot 条目;带注释的mcp.json绝不会被覆盖。
2.1 版的变化
- 全面更名为 PromptFlowEngine:显示名称、活动栏、命令、消息和输出通道。
- 单独的优化视图和优化提示词命令已移除。精简 token 现在是工作流面板中的一个操作。
- 新增:重构提示词、“不含代码”范围、审查步骤,以及可编辑的生成提示词。
- 生成的提示词来自共享引擎,各部分按任务选择,而不是固定模板。
- 面板现在在严格的 Content Security Policy 下运行。