openspec-ff-change

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Fast-forward through artifact creation - generate everything needed to start implementation in one go.
Input: The user's request should include a change name (kebab-case) OR a description of what they want to build.
Steps
  1. If no clear input provided, ask what they want to build
    Use the AskUserQuestion tool (open-ended, no preset options) to ask:
    "What change do you want to work on? Describe what you want to build or fix."
    From their description, derive a kebab-case name (e.g., "add user authentication" →
    add-user-auth
    ).
    IMPORTANT: Do NOT proceed without understanding what the user wants to build.
  2. Create the change directory
    bash
    openspec new change "<name>"
    This creates a scaffolded change at
    openspec/changes/<name>/
    .
  3. Get the artifact build order
    bash
    openspec status --change "<name>" --json
    Parse the JSON to get:
    • applyRequires
      : array of artifact IDs needed before implementation (e.g.,
      ["tasks"]
      )
    • artifacts
      : list of all artifacts with their status and dependencies
  4. Create artifacts in sequence until apply-ready
    Use the TodoWrite tool to track progress through the artifacts.
    Loop through artifacts in dependency order (artifacts with no pending dependencies first):
    a. For each artifact that is
    ready
    (dependencies satisfied)
    :
    • Get instructions:
      bash
      openspec instructions <artifact-id> --change "<name>" --json
    • The instructions JSON includes:
      • context
        : Project background (constraints for you - do NOT include in output)
      • rules
        : Artifact-specific rules (constraints for you - do NOT include in output)
      • template
        : The structure to use for your output file
      • instruction
        : Schema-specific guidance for this artifact type
      • outputPath
        : Where to write the artifact
      • dependencies
        : Completed artifacts to read for context
    • Read any completed dependency files for context
    • Create the artifact file using
      template
      as the structure
    • Apply
      context
      and
      rules
      as constraints - but do NOT copy them into the file
    • Show brief progress: "✓ Created <artifact-id>"
    b. Continue until all
    applyRequires
    artifacts are complete
    • After creating each artifact, re-run
      openspec status --change "<name>" --json
    • Check if every artifact ID in
      applyRequires
      has
      status: "done"
      in the artifacts array
    • Stop when all
      applyRequires
      artifacts are done
    c. If an artifact requires user input (unclear context):
    • Use AskUserQuestion tool to clarify
    • Then continue with creation
  5. Show final status
    bash
    openspec status --change "<name>"
Output
After completing all artifacts, summarize:
  • Change name and location
  • List of artifacts created with brief descriptions
  • What's ready: "All artifacts created! Ready for implementation."
  • Prompt: "Run
    /opsx:apply
    or ask me to implement to start working on the tasks."
Artifact Creation Guidelines
  • Follow the
    instruction
    field from
    openspec instructions
    for each artifact type
  • The schema defines what each artifact should contain - follow it
  • Read dependency artifacts for context before creating new ones
  • Use
    template
    as the structure for your output file - fill in its sections
  • IMPORTANT:
    context
    and
    rules
    are constraints for YOU, not content for the file
    • Do NOT copy
      <context>
      ,
      <rules>
      ,
      <project_context>
      blocks into the artifact
    • These guide what you write, but should never appear in the output
Guardrails
  • Create ALL artifacts needed for implementation (as defined by schema's
    apply.requires
    )
  • Always read dependency artifacts before creating a new one
  • If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
  • If a change with that name already exists, suggest continuing that change instead
  • Verify each artifact file exists after writing before proceeding to next
快速完成工件创建——一次性生成启动实现所需的全部内容。
输入:用户的请求应包含变更名称(kebab-case格式)或对所需构建内容的描述。
步骤
  1. 若未提供明确输入,询问用户所需构建的内容
    使用AskUserQuestion工具(开放式问题,无预设选项)询问:
    "你想要处理什么变更?描述你想要构建或修复的内容。"
    根据用户的描述,生成kebab-case格式的名称(例如:"add user authentication" →
    add-user-auth
    )。
    重要提示:在未明确用户所需构建内容之前,请勿继续操作。
  2. 创建变更目录
    bash
    openspec new change "<name>"
    此命令会在
    openspec/changes/<name>/
    路径下生成一个预构建的变更脚手架。
  3. 获取工件构建顺序
    bash
    openspec status --change "<name>" --json
    解析JSON结果以获取:
    • applyRequires
      :实现前所需的工件ID数组(例如:
      ["tasks"]
    • artifacts
      :所有工件的列表,包含其状态和依赖关系
  4. 按顺序创建工件直至就绪可实现
    使用TodoWrite工具跟踪工件创建进度。
    按照依赖顺序遍历工件(优先处理无未完成依赖的工件):
    a. 对于每个状态为
    ready
    (依赖已满足)的工件
    • 获取创建指令:
      bash
      openspec instructions <artifact-id> --change "<name>" --json
    • 指令JSON包含以下内容:
      • context
        :项目背景(为你提供约束条件——请勿写入输出文件)
      • rules
        :工件特定规则(为你提供约束条件——请勿写入输出文件)
      • template
        :输出文件的结构模板
      • instruction
        :针对该工件类型的 schema 专属指导
      • outputPath
        :工件的写入路径
      • dependencies
        :需读取以获取上下文的已完成工件
    • 读取所有已完成的依赖文件以获取上下文
    • template
      为结构创建工件文件
    • context
      rules
      作为约束条件遵循,但请勿将其复制到文件中
    • 显示简短进度:"✓ 已创建 <artifact-id>"
    b. 持续操作直至所有
    applyRequires
    工件完成
    • 每创建一个工件后,重新运行
      openspec status --change "<name>" --json
    • 检查
      applyRequires
      中的每个工件ID在artifacts数组中的状态是否为
      "done"
    • 当所有
      applyRequires
      工件完成后停止操作
    c. 若某工件需要用户输入(上下文不明确):
    • 使用AskUserQuestion工具进行澄清
    • 然后继续创建工件
  5. 显示最终状态
    bash
    openspec status --change "<name>"
输出
完成所有工件创建后,进行总结:
  • 变更名称和路径
  • 已创建工件列表及简短描述
  • 就绪状态:"所有工件已创建完成!可开始实现。"
  • 提示:"运行
    /opsx:apply
    或让我来帮你实现以启动任务处理。"
工件创建指南
  • 遵循
    openspec instructions
    中每个工件类型的
    instruction
    字段要求
  • schema定义了每个工件应包含的内容——严格遵循
  • 创建新工件前,先读取依赖工件以获取上下文
  • template
    作为输出文件的结构——填充其各个章节
  • 重要提示
    context
    rules
    是针对你的约束条件,而非文件内容
    • 请勿将
      <context>
      <rules>
      <project_context>
      块复制到工件中
    • 这些内容用于指导你的编写,但绝不能出现在输出文件中
约束规则
  • 创建实现所需的全部工件(由schema的
    apply.requires
    定义)
  • 创建新工件前,务必先读取依赖工件
  • 若上下文严重不明确,询问用户——但优先做出合理决策以保持进度
  • 若同名变更已存在,建议继续处理该变更
  • 继续下一个工件前,验证当前工件文件是否已成功写入