fix
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 4m27s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

This commit is contained in:
SunCheng
2026-02-11 13:00:01 +08:00
parent ca3e929770
commit 51172e8c5a
88 changed files with 10076 additions and 142 deletions

View File

@@ -0,0 +1,114 @@
---
name: openspec-archive-change
description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
license: MIT
compatibility: Requires openspec CLI.
metadata:
author: openspec
version: "1.0"
generatedBy: "1.1.1"
---
在实验工作流中归档已完成的变更。
**输入**: 可选择指定变更名称。如果省略,检查是否可以从对话上下文中推断。如果模糊或不明确,你**必须**提示可用的变更。
**步骤**
1. **如果未提供变更名称,提示用户选择**
运行 `openspec list --json` 获取可用的变更。使用 **AskUserQuestion 工具**让用户选择。
仅显示活跃的变更 (尚未归档的)。
如果可用,包含每个变更使用的 schema。
**重要**: 不要猜测或自动选择变更。始终让用户选择。
2. **检查 artifact 完成状态**
运行 `openspec status --change "<name>" --json` 检查 artifact 完成情况。
解析 JSON 以了解:
- `schemaName`: 正在使用的工作流
- `artifacts`: artifacts 列表及其状态 (`done` 或其他)
**如果任何 artifacts 不是 `done` 状态:**
- 显示警告,列出未完成的 artifacts
- 使用 **AskUserQuestion 工具**确认用户是否要继续
- 如果用户确认则继续
3. **检查任务完成状态**
读取任务文件 (通常是 `tasks.md`) 检查未完成的任务。
统计标记为 `- [ ]` (未完成) vs `- [x]` (已完成) 的任务。
**如果发现未完成的任务:**
- 显示警告,显示未完成任务的数量
- 使用 **AskUserQuestion 工具**确认用户是否要继续
- 如果用户确认则继续
**如果不存在任务文件:** 无任务相关警告地继续。
4. **评估 delta spec 同步状态**
检查 `openspec/changes/<name>/specs/` 中的 delta specs。如果不存在,无同步提示地继续。
**如果存在 delta specs:**
- 将每个 delta spec 与其对应的主 spec `openspec/specs/<capability>/spec.md` 比较
- 确定将应用哪些更改 (添加、修改、删除、重命名)
- 在提示前显示综合摘要
**提示选项:**
- 如果需要更改: "立即同步 (推荐)", "归档但不同步"
- 如果已同步: "立即归档", "仍然同步", "取消"
如果用户选择同步,执行 /opsx-sync 逻辑 (使用 openspec-sync-specs 技能)。无论选择什么都继续归档。
5. **执行归档**
如果不存在则创建归档目录:
```bash
mkdir -p openspec/changes/archive
```
使用当前日期生成目标名称: `YYYY-MM-DD-<change-name>`
**检查目标是否已存在:**
- 如果是: 失败并显示错误,建议重命名现有归档或使用不同日期
- 如果否: 将变更目录移动到归档
```bash
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
```
6. **显示摘要**
显示归档完成摘要,包括:
- 变更名称
- 使用的 Schema
- 归档位置
- 是否同步了 specs (如果适用)
- 关于任何警告的注释 (未完成的 artifacts/任务)
**成功时的输出**
```
## 归档完成
**变更:** <change-name>
**Schema:** <schema-name>
**归档到:** openspec/changes/archive/YYYY-MM-DD-<name>/
**Specs:** ✓ 已同步到主 specs (或 "无 delta specs" 或 "跳过同步")
所有 artifacts 完成。所有任务完成。
```
**防护机制**
- 如果未提供变更,始终提示选择
- 使用 artifact 图 (openspec status --json) 进行完成度检查
- 不要因警告而阻止归档 - 只需通知并确认
- 移动到归档时保留 .openspec.yaml (它随目录一起移动)
- 显示清晰的发生情况摘要
- 如果请求同步,使用 openspec-sync-specs 方法 (代理驱动)
- 如果存在 delta specs,在提示前始终运行同步评估并显示综合摘要

View File

@@ -0,0 +1,114 @@
---
name: openspec-archive-change
description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
license: MIT
compatibility: Requires openspec CLI.
metadata:
author: openspec
version: "1.0"
generatedBy: "1.1.1"
---
Archive a completed change in the experimental workflow.
**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**
1. **If no change name provided, prompt for selection**
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
Show only active changes (not already archived).
Include the schema used for each change if available.
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
2. **Check artifact completion status**
Run `openspec status --change "<name>" --json` to check artifact completion.
Parse the JSON to understand:
- `schemaName`: The workflow being used
- `artifacts`: List of artifacts with their status (`done` or other)
**If any artifacts are not `done`:**
- Display warning listing incomplete artifacts
- Use **AskUserQuestion tool** to confirm user wants to proceed
- Proceed if user confirms
3. **Check task completion status**
Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
**If incomplete tasks found:**
- Display warning showing count of incomplete tasks
- Use **AskUserQuestion tool** to confirm user wants to proceed
- Proceed if user confirms
**If no tasks file exists:** Proceed without task-related warning.
4. **Assess delta spec sync state**
Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
**If delta specs exist:**
- Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
- Determine what changes would be applied (adds, modifications, removals, renames)
- Show a combined summary before prompting
**Prompt options:**
- If changes needed: "Sync now (recommended)", "Archive without syncing"
- If already synced: "Archive now", "Sync anyway", "Cancel"
If user chooses sync, execute /opsx-sync logic (use the openspec-sync-specs skill). Proceed to archive regardless of choice.
5. **Perform the archive**
Create the archive directory if it doesn't exist:
```bash
mkdir -p openspec/changes/archive
```
Generate target name using current date: `YYYY-MM-DD-<change-name>`
**Check if target already exists:**
- If yes: Fail with error, suggest renaming existing archive or using different date
- If no: Move the change directory to archive
```bash
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
```
6. **Display summary**
Show archive completion summary including:
- Change name
- Schema that was used
- Archive location
- Whether specs were synced (if applicable)
- Note about any warnings (incomplete artifacts/tasks)
**Output On Success**
```
## Archive Complete
**Change:** <change-name>
**Schema:** <schema-name>
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
**Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
All artifacts complete. All tasks complete.
```
**Guardrails**
- Always prompt for change selection if not provided
- Use artifact graph (openspec status --json) for completion checking
- Don't block archive on warnings - just inform and confirm
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
- Show clear summary of what happened
- If sync is requested, use openspec-sync-specs approach (agent-driven)
- If delta specs exist, always run the sync assessment and show the combined summary before prompting