openspec-apply-change
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplement tasks from an OpenSpec change.
Input: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
Steps
-
Select the changeIf a name is provided, use it. Otherwise:
- Infer from conversation context if the user mentioned a change
- Auto-select if only one active change exists
- If ambiguous, run to get available changes and use the AskUserQuestion tool to let the user select
openspec list --json
Always announce: "Using change: <name>" and how to override (e.g.,)./opsx:apply <other> -
Check status to understand the schemabash
openspec status --change "<name>" --jsonParse the JSON to understand:- : The workflow being used (e.g., "spec-driven")
schemaName - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
-
Get apply instructionsbash
openspec instructions apply --change "<name>" --jsonThis returns:- Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
- Progress (total, complete, remaining)
- Task list with status
- Dynamic instruction based on current state
Handle states:- If (missing artifacts): show message, suggest using openspec-continue-change
state: "blocked" - If : congratulate, suggest archive
state: "all_done" - Otherwise: proceed to implementation
-
Read context filesRead the files listed infrom the apply instructions output. The files depend on the schema being used:
contextFiles- spec-driven: proposal, specs, design, tasks
- Other schemas: follow the contextFiles from CLI output
-
Show current progressDisplay:
- Schema being used
- Progress: "N/M tasks complete"
- Remaining tasks overview
- Dynamic instruction from CLI
-
Implement tasks (loop until done or blocked)For each pending task:
- Show which task is being worked on
- Make the code changes required
- Keep changes minimal and focused
- Mark task complete in the tasks file: →
- [ ]- [x] - Continue to next task
Pause if:- Task is unclear → ask for clarification
- Implementation reveals a design issue → suggest updating artifacts
- Error or blocker encountered → report and wait for guidance
- User interrupts
-
On completion or pause, show statusDisplay:
- Tasks completed this session
- Overall progress: "N/M tasks complete"
- If all done: suggest archive
- If paused: explain why and wait for guidance
Output During Implementation
undefined执行OpenSpec变更中的任务。
输入:可选择性指定变更名称。若未指定,检查是否可从对话语境中推断。若信息模糊或存在歧义,必须提示用户选择可用的变更。
步骤
-
选择变更若已提供名称,则使用该名称。否则:
- 若用户提及过变更,从对话语境中推断
- 若仅存在一个活跃变更,则自动选择
- 若存在歧义,运行获取可用变更,并使用AskUserQuestion工具让用户选择
openspec list --json
必须告知:“正在使用变更:<名称>”以及如何覆盖(例如:)。/opsx:apply <其他变更> -
检查状态以了解架构bash
openspec status --change "<name>" --json解析JSON以了解:- :所使用的工作流(例如:“spec-driven”)
schemaName - 哪个工件包含任务(对于spec-driven模式通常为“tasks”,其他模式需查看状态信息)
-
获取实施指令bash
openspec instructions apply --change "<name>" --json该命令返回:- 语境文件路径(因架构而异,可能为proposal/specs/design/tasks或spec/tests/implementation/docs)
- 进度(总任务数、已完成数、剩余数)
- 带状态的任务列表
- 基于当前状态的动态指令
状态处理:- 若(缺少工件):显示提示信息,建议使用openspec-continue-change
state: "blocked" - 若:表示祝贺,建议归档
state: "all_done" - 其他情况:继续实施
-
读取语境文件读取实施指令输出中列出的文件。文件取决于所使用的架构:
contextFiles- spec-driven:proposal、specs、design、tasks
- 其他架构:遵循CLI输出中的contextFiles
-
显示当前进度展示:
- 所使用的架构
- 进度:“N/M个任务已完成”
- 剩余任务概览
- 来自CLI的动态指令
-
实施任务(循环直至完成或受阻)对于每个待处理任务:
- 显示当前正在处理的任务
- 进行所需的代码变更
- 保持变更最小且聚焦
- 在任务文件中将任务标记为完成:→
- [ ]- [x] - 继续处理下一个任务
暂停场景:- 任务不明确 → 请求澄清
- 实施过程中发现设计问题 → 建议更新工件
- 遇到错误或阻碍 → 报告并等待指导
- 用户中断
-
完成或暂停时显示状态展示:
- 本次会话完成的任务
- 整体进度:“N/M个任务已完成”
- 若全部完成:建议归档
- 若暂停:说明原因并等待指导
实施过程中的输出
undefinedImplementing: <change-name> (schema: <schema-name>)
Implementing: <change-name> (schema: <schema-name>)
Working on task 3/7: <task description>
[...implementation happening...]
✓ Task complete
Working on task 4/7: <task description>
[...implementation happening...]
✓ Task complete
**Output On Completion**
Working on task 3/7: <task description>
[...implementation happening...]
✓ Task complete
Working on task 4/7: <task description>
[...implementation happening...]
✓ Task complete
**完成时的输出**
Implementation Complete
Implementation Complete
Change: <change-name>
Schema: <schema-name>
Progress: 7/7 tasks complete ✓
Change: <change-name>
Schema: <schema-name>
Progress: 7/7 tasks complete ✓
Completed This Session
Completed This Session
- Task 1
- Task 2 ...
All tasks complete! Ready to archive this change.
**Output On Pause (Issue Encountered)**
- Task 1
- Task 2 ...
All tasks complete! Ready to archive this change.
**暂停时的输出(遇到问题)**
Implementation Paused
Implementation Paused
Change: <change-name>
Schema: <schema-name>
Progress: 4/7 tasks complete
Change: <change-name>
Schema: <schema-name>
Progress: 4/7 tasks complete
Issue Encountered
Issue Encountered
<description of the issue>
Options:
- <option 1>
- <option 2>
- Other approach
What would you like to do?
**Guardrails**
- Keep going through tasks until done or blocked
- Always read context files before starting (from the apply instructions output)
- If task is ambiguous, pause and ask before implementing
- If implementation reveals issues, pause and suggest artifact updates
- Keep code changes minimal and scoped to each task
- Update task checkbox immediately after completing each task
- Pause on errors, blockers, or unclear requirements - don't guess
- Use contextFiles from CLI output, don't assume specific file names
**Fluid Workflow Integration**
This skill supports the "actions on a change" model:
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly<description of the issue>
Options:
- <option 1>
- <option 2>
- Other approach
What would you like to do?
**注意事项**
- 持续处理任务直至完成或受阻
- 开始前务必读取语境文件(来自实施指令输出)
- 若任务存在歧义,暂停并询问后再实施
- 若实施过程中发现问题,暂停并建议更新工件
- 保持代码变更最小且限定在单个任务范围内
- 完成每个任务后立即更新任务复选框
- 遇到错误、阻碍或不明确需求时暂停,切勿猜测
- 使用CLI输出中的contextFiles,不要假设特定文件名
**流畅工作流集成**
该技能支持“变更操作”模型:
- **可随时调用**:在所有工件完成前(若任务已存在)、部分实施后、与其他操作交替进行时均可调用
- **允许更新工件**:若实施过程中发现设计问题,建议更新工件——不局限于阶段划分,实现流畅协作