xwang 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,9 +18,10 @@ description: 启动 xwang 项目阶段5:归档。在 verify 完成后按 OpenS
|
|
|
18
18
|
1. 确定 change 名称 `<name>`:优先使用用户提供的名称;若未提供,从 `openspec/changes/` 下选择 phase 为 `archive` 的 change。
|
|
19
19
|
2. 读取 `.xwang.yaml` 确认当前 phase 为 `archive`,且验证报告、分支状态已记录。
|
|
20
20
|
3. 向用户展示归档摘要,并**暂停等待用户确认**是否立即归档。
|
|
21
|
-
4.
|
|
22
|
-
5. 调用 `
|
|
23
|
-
6.
|
|
21
|
+
4. 用户确认后,先调用 `"$XWANG_STATE" set <name> archived true`,将 `.xwang.yaml` 标记为已归档(此时 change 仍在 `openspec/changes/<name>/` 下,`xwang-state` 能找到状态文件)。
|
|
22
|
+
5. 调用 `"$XWANG_GUARD" <name> archive` 校验归档完整性。
|
|
23
|
+
6. 调用 `/openspec-archive-change` 按 delta 语义合并主 spec 并移动 change 到归档目录。
|
|
24
|
+
7. 向用户汇报归档结果与新路径。
|
|
24
25
|
|
|
25
26
|
## Workflows
|
|
26
27
|
|
|
@@ -57,17 +58,17 @@ fi
|
|
|
57
58
|
- **暂不归档**:不执行归档,保留当前 `phase: archive` 状态,等待用户稍后再次调用 `/xwang-archive`
|
|
58
59
|
- [ ] 只有用户选择「确认归档」后才继续 Step 3。
|
|
59
60
|
|
|
60
|
-
### Step 3
|
|
61
|
+
### Step 3:标记归档状态并校验完整性
|
|
62
|
+
|
|
63
|
+
- [ ] 调用 `"$XWANG_STATE" set <name> archived true`,在 change 仍在 `openspec/changes/<name>/` 时把 `.xwang.yaml` 标记为已归档。
|
|
64
|
+
- [ ] **归档完整性守护**:调用 `"$XWANG_GUARD" <name> archive` 校验归档退出条件(`archived: true`、必要文档存在且 tasks 已勾选)。
|
|
65
|
+
- [ ] 如需,在 PRD 和 plan 文件前置元数据中标注 `archived-with: <name>` 和 `status: archived`。
|
|
66
|
+
|
|
67
|
+
### Step 4:执行归档
|
|
61
68
|
|
|
62
69
|
- [ ] 调用 `/openspec-archive-change <name>`(或等价的 OpenSpec archive 命令)按 delta 语义合并主 spec 并移动 change 到归档目录。
|
|
63
70
|
- [ ] 如归档命令返回非零退出码,报告错误并停止。
|
|
64
71
|
- [ ] 归档成功后,确认 change 目录已移动到 `openspec/changes/archive/YYYY-MM-DD-<name>/`(或 OpenSpec 默认归档路径)。
|
|
65
|
-
|
|
66
|
-
### Step 4:标记归档状态
|
|
67
|
-
|
|
68
|
-
- [ ] 对归档后的 `.xwang.yaml` 调用 `"$XWANG_STATE" set <name> archived true`。
|
|
69
|
-
- [ ] **归档完整性守护**:调用 `"$XWANG_GUARD" <name> archive` 校验归档后的退出条件(`archived: true`、必要文档存在且 tasks 已勾选)。
|
|
70
|
-
- [ ] 如需,在 PRD 和 plan 文件前置元数据中标注 `archived-with: <name>` 和 `status: archived`。
|
|
71
72
|
- [ ] 向用户汇报归档完成、新目录路径与生命周期闭环状态。
|
|
72
73
|
|
|
73
74
|
## 退出条件
|
|
@@ -127,6 +127,29 @@ if [ -d "$CHANGES_DIR" ]; then
|
|
|
127
127
|
done < <(find "$CHANGES_DIR" -maxdepth 1 -mindepth 1 -type d -print)
|
|
128
128
|
fi
|
|
129
129
|
|
|
130
|
+
# 1b. Orphaned OpenSpec changes (OpenSpec artifacts without .xwang.yaml)
|
|
131
|
+
if [ -d "$CHANGES_DIR" ]; then
|
|
132
|
+
while IFS= read -r change_dir; do
|
|
133
|
+
[ -z "$change_dir" ] && continue
|
|
134
|
+
change_name=$(basename "$change_dir")
|
|
135
|
+
|
|
136
|
+
# Skip the archive directory and changes that already have xwang state.
|
|
137
|
+
[ "$change_name" = "archive" ] && continue
|
|
138
|
+
[ -f "$change_dir/.xwang.yaml" ] && continue
|
|
139
|
+
|
|
140
|
+
# Detect common OpenSpec change artifacts.
|
|
141
|
+
if [ -f "$change_dir/.openspec.yaml" ] || \
|
|
142
|
+
[ -f "$change_dir/proposal.md" ] || \
|
|
143
|
+
[ -f "$change_dir/design.md" ] || \
|
|
144
|
+
[ -f "$change_dir/tasks.md" ] || \
|
|
145
|
+
[ -d "$change_dir/specs" ]; then
|
|
146
|
+
JSON_ENTRIES+=("{\"source\":\"openspec-orphan\",\"name\":\"$change_name\",\"status\":\"orphaned\",\"details\":\"OpenSpec artifacts without .xwang.yaml\",\"action\":\"initialize xwang state or archive before starting new work\"}")
|
|
147
|
+
TEXT_LINES+=(" - [openspec-orphan] $change_name: OpenSpec artifacts present but no .xwang.yaml → initialize xwang state or archive before starting new work")
|
|
148
|
+
SIGNAL_COUNT=$((SIGNAL_COUNT + 1))
|
|
149
|
+
fi
|
|
150
|
+
done < <(find "$CHANGES_DIR" -maxdepth 1 -mindepth 1 -type d -print)
|
|
151
|
+
fi
|
|
152
|
+
|
|
130
153
|
# 2. Git dirty worktree
|
|
131
154
|
GIT_DIRTY=0
|
|
132
155
|
GIT_DETAILS=""
|