@devcxl/opencode-cabbage 1.2.0 → 2.0.0
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.
- package/.codex-plugin/plugin.json +36 -0
- package/README.md +67 -21
- package/README.zh.md +26 -13
- package/assets/agents/dev-lifecycle.md +6 -0
- package/assets/prompts/bootstrap.md +4 -0
- package/assets/skills/flow-change/SKILL.md +109 -0
- package/assets/skills/flow-design/SKILL.md +15 -0
- package/assets/skills/flow-docs/SKILL.md +112 -0
- package/assets/skills/flow-incident/SKILL.md +98 -0
- package/assets/skills/flow-research/SKILL.md +9 -0
- package/assets/skills/flow-setup/SKILL.md +13 -0
- package/codex-skills/agent-architect/SKILL.md +79 -0
- package/codex-skills/agent-dev-lifecycle/SKILL.md +311 -0
- package/codex-skills/agent-developer/SKILL.md +51 -0
- package/codex-skills/agent-goal-verify/SKILL.md +45 -0
- package/codex-skills/agent-researcher/SKILL.md +32 -0
- package/codex-skills/agent-reviewer/SKILL.md +109 -0
- package/codex-skills/flow-change/SKILL.md +109 -0
- package/codex-skills/flow-code/SKILL.md +71 -0
- package/codex-skills/flow-design/SKILL.md +161 -0
- package/codex-skills/flow-docs/SKILL.md +112 -0
- package/codex-skills/flow-incident/SKILL.md +98 -0
- package/codex-skills/flow-release/SKILL.md +90 -0
- package/codex-skills/flow-requirements/SKILL.md +90 -0
- package/codex-skills/flow-research/SKILL.md +86 -0
- package/codex-skills/flow-review/SKILL.md +110 -0
- package/codex-skills/flow-setup/SKILL.md +88 -0
- package/codex-skills/flow-tasks/SKILL.md +220 -0
- package/codex-skills/flow-tdd/SKILL.md +235 -0
- package/dist/hooks/session-start.d.ts +1 -0
- package/dist/hooks/session-start.js +72 -0
- package/dist/hooks/session-start.js.map +1 -0
- package/dist/index.d.ts +2 -5
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/plugin/agents.d.ts +20 -0
- package/dist/plugin/agents.js +79 -0
- package/dist/plugin/agents.js.map +1 -1
- package/dist/plugin/cabbage-cli.d.ts +28 -0
- package/dist/plugin/cabbage-cli.js +92 -0
- package/dist/plugin/cabbage-cli.js.map +1 -0
- package/dist/plugin/cabbage-tool.d.ts +103 -0
- package/dist/plugin/cabbage-tool.js +169 -0
- package/dist/plugin/cabbage-tool.js.map +1 -0
- package/dist/plugin/commands.d.ts +10 -0
- package/dist/plugin/commands.js +1 -1
- package/dist/plugin/commands.js.map +1 -1
- package/dist/plugin/continuation.d.ts +22 -0
- package/dist/plugin/continuation.js +233 -0
- package/dist/plugin/continuation.js.map +1 -0
- package/dist/plugin/goal-store.d.ts +64 -0
- package/dist/plugin/goal-store.js +57 -0
- package/dist/plugin/goal-store.js.map +1 -0
- package/dist/plugin/goal.d.ts +95 -38
- package/dist/plugin/goal.js +208 -199
- package/dist/plugin/goal.js.map +1 -1
- package/dist/plugin/install-dir.d.ts +13 -0
- package/dist/plugin/install-dir.js +46 -0
- package/dist/plugin/install-dir.js.map +1 -0
- package/dist/plugin/server.d.ts +4 -12
- package/dist/plugin/server.js +279 -423
- package/dist/plugin/server.js.map +1 -1
- package/dist/plugin/session-abort.d.ts +5 -0
- package/dist/plugin/session-abort.js +26 -0
- package/dist/plugin/session-abort.js.map +1 -0
- package/dist/plugin/skills.d.ts +15 -0
- package/dist/plugin/skills.js +47 -50
- package/dist/plugin/skills.js.map +1 -1
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.js +6 -2
- package/dist/plugin.js.map +1 -1
- package/dist/util/paths.d.ts +0 -6
- package/dist/util/paths.js +0 -15
- package/dist/util/paths.js.map +1 -1
- package/hooks/hooks.json +17 -0
- package/package.json +13 -8
- package/vendor/cabbage/MANIFEST.json +8 -0
- package/vendor/cabbage/cabbage_cli/__init__.py +1 -0
- package/vendor/cabbage/cabbage_cli/__main__.py +2 -0
- package/vendor/cabbage/cabbage_cli/assets/docs-site/.vitepress/config.ts +78 -0
- package/vendor/cabbage/cabbage_cli/assets/docs-site/README.md +31 -0
- package/vendor/cabbage/cabbage_cli/assets/docs-site/package.json +16 -0
- package/vendor/cabbage/cabbage_cli/assets/docs-site/pnpm-lock.yaml +2504 -0
- package/vendor/cabbage/cabbage_cli/assets/integrations/cabbage.yml +127 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/adr.md +47 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/api-design.md +45 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/change-record.md +21 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/database-design.md +37 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/generic.md +20 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/impact.md +41 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/incident.md +48 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/postmortem.md +43 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/prd.md +71 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/release-plan.md +45 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/rfc.md +44 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/security-review.md +35 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/tasks.md +62 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/tech-spec.md +87 -0
- package/vendor/cabbage/cabbage_cli/assets/templates/test-plan.md +44 -0
- package/vendor/cabbage/cabbage_cli/assets/workflows/change.yaml +11 -0
- package/vendor/cabbage/cabbage_cli/assets/workflows/incident.yaml +4 -0
- package/vendor/cabbage/cabbage_cli/cli.py +283 -0
- package/vendor/cabbage/cabbage_cli/core.py +606 -0
- package/vendor/cabbage/cabbage_cli/scaffold.py +313 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-cabbage",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "全流程开发编排插件 — 需求→设计→任务→编码→测试→审查→自动合并,支持 OpenCode 与 Codex 双平台",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "devcxl",
|
|
7
|
+
"url": "https://github.com/devcxl"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://devcxl.github.io/opencode-cabbage/",
|
|
10
|
+
"repository": "https://github.com/devcxl/opencode-cabbage",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"development-workflow",
|
|
14
|
+
"orchestration",
|
|
15
|
+
"tdd",
|
|
16
|
+
"codex",
|
|
17
|
+
"codex-plugin",
|
|
18
|
+
"opencode",
|
|
19
|
+
"opencode-plugin"
|
|
20
|
+
],
|
|
21
|
+
"skills": "./codex-skills/",
|
|
22
|
+
"interface": {
|
|
23
|
+
"displayName": "OpenCode Cabbage",
|
|
24
|
+
"shortDescription": "全流程开发编排 — 需求到自动合并,双平台兼容",
|
|
25
|
+
"longDescription": "覆盖需求、设计、DAG 任务拆解、并行编码(TDD)、审查与自动合并的全流程开发编排插件。兼容 OpenCode 与 Codex 双平台,提供 9 个 flow skills 和 6 个 agent skills。",
|
|
26
|
+
"developerName": "devcxl",
|
|
27
|
+
"category": "Developer Tools",
|
|
28
|
+
"capabilities": ["Read", "Write"],
|
|
29
|
+
"defaultPrompt": [
|
|
30
|
+
"使用 OpenCode Cabbage 初始化项目开发环境 — 加载 flow-setup skill",
|
|
31
|
+
"使用 OpenCode Cabbage 的 flow-setup skill 初始化项目开发环境",
|
|
32
|
+
"使用 OpenCode Cabbage 的 agent-dev-lifecycle skill 编排全流程"
|
|
33
|
+
],
|
|
34
|
+
"brandColor": "#00bcd4"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/README.md
CHANGED
|
@@ -14,16 +14,53 @@
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
+
## OpenCode Compatibility
|
|
18
|
+
|
|
19
|
+
**Requires OpenCode v2 (tested on v2.0.28).** Version 2.0.0 is a V2-only line built on the `@opencode/plugin` 2.x API (`Plugin.define` setup, domain transforms, turn-end-event driven auto-continuation). OpenCode v1 users should stay on the `1.x` release line.
|
|
20
|
+
|
|
17
21
|
## Installation
|
|
18
22
|
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
"plugin": ["@devcxl/opencode-cabbage"]
|
|
23
|
-
}
|
|
23
|
+
```bash
|
|
24
|
+
opencode plugin add @devcxl/opencode-cabbage
|
|
24
25
|
```
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
This installs the plugin and registers it in the global OpenCode configuration (`plugins: ["@devcxl/opencode-cabbage"]`). Restart OpenCode or run `opencode reload` to activate.
|
|
28
|
+
|
|
29
|
+
Once started, the plugin automatically injects 7 slash commands, 12 flow skills, 6 agents, and 2 tools (`goal` for flow state, `cabbage` for change records).
|
|
30
|
+
|
|
31
|
+
> **⚠️ Plugin conflict — do not combine with other goal plugins.** cabbage ships its own `goal` tool with an auto-continuation loop driven by turn-end events. Installing it together with another goal / auto-continue plugin (e.g. `@prevalentware/opencode-goal-plugin`, `opencode-goal-mode`) risks both loops reacting to the same session activity and injecting continuation prompts: work gets continued twice, continuation counts and token budgets drift out of sync, and abort handling interferes across plugins. Use exactly one goal engine per session — if you rely on an external goal plugin, do not trigger cabbage's goal tool (it is restricted to the `dev-lifecycle` / `goal-verify` agents).
|
|
32
|
+
|
|
33
|
+
## Built-in change records (Cabbage engine)
|
|
34
|
+
|
|
35
|
+
The plugin bundles the Cabbage engine (`vendor/cabbage`, version-pinned by `scripts/sync-cabbage.mjs`) and injects a `flow-change` skill plus a `cabbage` tool: create a change record, declare risk flags, verify stages, pass gates, sync current-state docs, and archive after merge. A record is one directory under `.cabbage/changes/<id>/` — a single `tasks.md` by default; specialist documents (`design` / `rfc` / `adr` / `api` / `database` / `security` / `release`) open only for declared risks.
|
|
36
|
+
|
|
37
|
+
- **Requirements**: Python 3.10+ on the machine. The CLI is released per plugin version to `~/.config/opencode/cabbage/cli@<version>/`; without Python the tool returns a readable error and everything else keeps working.
|
|
38
|
+
- **Bootstrap a project**: `cabbage({op:"init"})` scaffolds `.cabbage/`, the docs skeleton, the CI template, and a vendored CLI copy for GitHub Actions. Existing docs: `cabbage({op:"adopt"})` inventories markdown outside the docs tree (moves stay manual).
|
|
39
|
+
- **Light path**: `new` → fill `tasks.md` → `verify` → `gate merge` → `archive` after the merge is confirmed. The tool is restricted to the `dev-lifecycle` orchestrator.
|
|
40
|
+
|
|
41
|
+
## Codex Installation (Compatibility Layer)
|
|
42
|
+
|
|
43
|
+
This package also ships a Codex plugin compatibility layer (`codex-skills/` + `hooks/` + `.codex-plugin/`) so the flow skills and agent prompts work in Codex as well.
|
|
44
|
+
|
|
45
|
+
The repository is a Codex marketplace: add it as a marketplace source, then install the plugin from it.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 1. Add this repository as a Codex marketplace
|
|
49
|
+
codex plugin marketplace add devcxl/opencode-cabbage
|
|
50
|
+
|
|
51
|
+
# 2. Confirm the plugin is available
|
|
52
|
+
codex plugin list --available
|
|
53
|
+
|
|
54
|
+
# 3. Install the plugin (pulled from the npm package, which bundles all Codex files)
|
|
55
|
+
codex plugin add opencode-cabbage@cabbage
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Notes:
|
|
59
|
+
|
|
60
|
+
- **Build artifact included**: the SessionStart hook (`dist/hooks/session-start.js`) ships inside the published npm package — no local build required.
|
|
61
|
+
- **Hook trust review**: Codex requires interactive trust approval for hooks (`/hooks` command) on first run — approve the `SessionStart` hook to enable context injection.
|
|
62
|
+
- **Marketplace name**: the marketplace is named `cabbage` (see `.agents/plugins/marketplace.json`); use `opencode-cabbage@cabbage` as the plugin selector.
|
|
63
|
+
- **Platform differences**: the Codex layer is a pure-Prompt downgrade — no `goal` tool, no slash commands, no automatic continuation. Agents are plain skills (referenced as `@agent-*`), and flow state is tracked via GitHub Issue checklists. See `codex-skills/agent-dev-lifecycle/SKILL.md` for details.
|
|
27
64
|
|
|
28
65
|
## Command Overview
|
|
29
66
|
|
|
@@ -41,12 +78,9 @@ Once started, the plugin automatically injects 7 slash commands, 9 flow skills,
|
|
|
41
78
|
|
|
42
79
|
```bash
|
|
43
80
|
# 1. Install
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# 2. Add the plugin to opencode.json
|
|
47
|
-
# { "plugin": ["@devcxl/opencode-cabbage"] }
|
|
81
|
+
opencode plugin add @devcxl/opencode-cabbage
|
|
48
82
|
|
|
49
|
-
#
|
|
83
|
+
# 2. Run in OpenCode
|
|
50
84
|
# /setup → /requirements → @dev-lifecycle
|
|
51
85
|
```
|
|
52
86
|
|
|
@@ -58,17 +92,23 @@ npm install @devcxl/opencode-cabbage
|
|
|
58
92
|
## Architecture
|
|
59
93
|
|
|
60
94
|
```
|
|
61
|
-
src/ # Thin TypeScript layer
|
|
62
|
-
├── index.ts #
|
|
63
|
-
├── plugin.ts #
|
|
64
|
-
├── plugin/ #
|
|
65
|
-
│ ├── server.ts #
|
|
66
|
-
│ ├──
|
|
67
|
-
│ ├──
|
|
68
|
-
│ ├──
|
|
95
|
+
src/ # Thin TypeScript layer (OpenCode V2 plugin)
|
|
96
|
+
├── index.ts # Default export (Plugin.define)
|
|
97
|
+
├── plugin.ts # Plugin definition: id + setup wiring
|
|
98
|
+
├── plugin/ # Setup glue + built-in tools
|
|
99
|
+
│ ├── server.ts # setup(ctx): domain transforms (skills/commands/agents/tools), hooks, event dispatch
|
|
100
|
+
│ ├── continuation.ts # Turn-end driven continuation + auto-resume + child-session activity tracker
|
|
101
|
+
│ ├── goal.ts # goal tool (status machine + goal-verify authorization)
|
|
102
|
+
│ ├── goal-store.ts # Goal persistence (session metadata)
|
|
103
|
+
│ ├── cabbage-cli.ts # Releases the bundled Cabbage engine per plugin version; python detection + exec
|
|
104
|
+
│ ├── cabbage-tool.ts # `cabbage` tool: change records (ops mapped to the bundled CLI, agent-gated)
|
|
105
|
+
│ ├── install-dir.ts # Versioned dir install (lock + completeness check; shared by skills and the engine)
|
|
106
|
+
│ ├── session-abort.ts # User-interrupt markers (shared by events/tool/continuation)
|
|
107
|
+
│ ├── commands.ts # Command loader (execute-style registration)
|
|
108
|
+
│ ├── skills.ts # Skill loader + V2 registration entries
|
|
69
109
|
│ ├── prompts.ts # Prompt loader
|
|
70
110
|
│ ├── bootstrap.ts # Startup guidance
|
|
71
|
-
│ ├── agents.ts # Agent
|
|
111
|
+
│ ├── agents.ts # Agent loader + V1→V2 permission/tools rule conversion
|
|
72
112
|
│ ├── shell.ts # Agent shell env isolation
|
|
73
113
|
│ └── prompt-lint.ts # Prompt asset consistency checks
|
|
74
114
|
└── kernel/ # Minimal supporting modules
|
|
@@ -78,11 +118,17 @@ src/ # Thin TypeScript layer
|
|
|
78
118
|
├── permission.ts # Permission matching semantics
|
|
79
119
|
└── mutex.ts # Keyed async mutex
|
|
80
120
|
|
|
121
|
+
vendor/cabbage/ # Bundled Cabbage engine (synced via scripts/sync-cabbage.mjs; hash-pinned)
|
|
122
|
+
|
|
81
123
|
assets/ # Runtime assets (pure Prompt flows)
|
|
82
124
|
├── commands/ # 7 slash commands
|
|
83
|
-
├── skills/ #
|
|
125
|
+
├── skills/ # 12 flow-* skills (Prompt-driven, direct git/gh)
|
|
84
126
|
├── agents/ # 6 agent definitions
|
|
85
127
|
└── prompts/ # Guidance prompts and templates
|
|
128
|
+
|
|
129
|
+
codex-skills/ # Codex compatibility layer (mirrors assets/, agent-* prefixed)
|
|
130
|
+
hooks/ # Codex SessionStart hook (hooks.json + compiled dist/hooks/)
|
|
131
|
+
.codex-plugin/ # Codex plugin manifest (plugin.json)
|
|
86
132
|
```
|
|
87
133
|
|
|
88
134
|
## Documentation
|
package/README.zh.md
CHANGED
|
@@ -14,16 +14,29 @@
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
+
## OpenCode 兼容性
|
|
18
|
+
|
|
19
|
+
> **要求 OpenCode v2(已在 v2.0.28 实测)。** 2.0.0 为 V2-only 版本线,基于 `@opencode/plugin` 2.x(`Plugin.define` 入口、域 transform、轮次结束事件驱动的自动续接)。OpenCode v1 用户请继续使用 `1.x` 版本线。
|
|
20
|
+
|
|
17
21
|
## 安装
|
|
18
22
|
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
"plugin": ["@devcxl/opencode-cabbage"]
|
|
23
|
-
}
|
|
23
|
+
```bash
|
|
24
|
+
opencode plugin add @devcxl/opencode-cabbage
|
|
24
25
|
```
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
该命令会安装插件并写入全局配置(`plugins: ["@devcxl/opencode-cabbage"]`)。重启 OpenCode 或执行 `opencode reload` 后生效。
|
|
28
|
+
|
|
29
|
+
插件启动后自动注入 7 个 slash command、12 个 flow skill、6 个 agent 与 2 个工具(`goal` 管流程状态、`cabbage` 管变更记录)。
|
|
30
|
+
|
|
31
|
+
> **⚠️ 插件冲突——不要与其他 goal 插件同时安装。** cabbage 自带 `goal` 工具与轮次结束事件驱动的自动续接循环。若与其他 goal / 自动续接类插件(如 `@prevalentware/opencode-goal-plugin`、`opencode-goal-mode`)同时安装,存在双方同时响应会话活动并注入续接 prompt 的风险:任务被重复续接、续接计数与 token 预算互不同步、abort 处理互相干扰。同一会话只能保留一个 goal 引擎——若使用外部 goal 插件,请勿触发 cabbage 的 goal 工具(仅 `dev-lifecycle` / `goal-verify` agent 可调用)。
|
|
32
|
+
|
|
33
|
+
## 内置变更记录(Cabbage 引擎)
|
|
34
|
+
|
|
35
|
+
插件捆绑 Cabbage 引擎(`vendor/cabbage`,由 `scripts/sync-cabbage.mjs` 固定版本生成),并注入 `flow-change` 技能与 `cabbage` 工具:创建变更记录、声明风险标记、验证阶段、通过门禁、同步当前文档、合并确认后归档。一份记录 = `.cabbage/changes/<id>/` 一个目录:默认只有 `tasks.md`;专项文档(`design` / `rfc` / `adr` / `api` / `database` / `security` / `release`)仅在声明风险时展开。
|
|
36
|
+
|
|
37
|
+
- **运行要求**:机器需 Python 3.10+。CLI 按插件版本释放到 `~/.config/opencode/cabbage/cli@<version>/`;缺 Python 时工具返回明确错误,其余功能不受影响。
|
|
38
|
+
- **项目接入**:`cabbage({op:"init"})` 生成 `.cabbage/`、docs 骨架、CI 模板与供 GitHub Actions 使用的 vendored CLI。
|
|
39
|
+
- **轻量路径**:`new` → 填写 `tasks.md` → `verify` → `gate merge` → 合并确认后 `archive`。工具仅 `dev-lifecycle` 编排器可用。
|
|
27
40
|
|
|
28
41
|
## 命令一览
|
|
29
42
|
|
|
@@ -41,12 +54,9 @@
|
|
|
41
54
|
|
|
42
55
|
```bash
|
|
43
56
|
# 1. 安装
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# 2. 在 opencode.json 中添加
|
|
47
|
-
# { "plugin": ["@devcxl/opencode-cabbage"] }
|
|
57
|
+
opencode plugin add @devcxl/opencode-cabbage
|
|
48
58
|
|
|
49
|
-
#
|
|
59
|
+
# 2. 在 OpenCode 中执行
|
|
50
60
|
# /setup → /requirements → @dev-lifecycle
|
|
51
61
|
```
|
|
52
62
|
|
|
@@ -61,9 +71,12 @@ npm install @devcxl/opencode-cabbage
|
|
|
61
71
|
src/ # TypeScript 薄层
|
|
62
72
|
├── index.ts # 插件入口
|
|
63
73
|
├── plugin.ts # 包路径解析
|
|
64
|
-
├── plugin/ # 加载器 +
|
|
65
|
-
│ ├── server.ts # 主工厂:注入 skills/commands/agents、
|
|
74
|
+
├── plugin/ # 加载器 + 内置工具
|
|
75
|
+
│ ├── server.ts # 主工厂:注入 skills/commands/agents/tools、Context、自动续接
|
|
66
76
|
│ ├── goal.ts # goal 工具(状态管理 + goal-verify 授权)
|
|
77
|
+
│ ├── cabbage-cli.ts # 释放捆绑 Cabbage 引擎(按版本隔离)+ python 探测与执行
|
|
78
|
+
│ ├── cabbage-tool.ts # `cabbage` 工具:变更记录全流程(agent 门控)
|
|
79
|
+
│ ├── install-dir.ts # 版本化目录安装(锁 + 完整性校验,skills 与引擎共用)
|
|
67
80
|
│ ├── commands.ts # Command 加载器
|
|
68
81
|
│ ├── skills.ts # Skill 加载器
|
|
69
82
|
│ ├── prompts.ts # Prompt 加载器
|
|
@@ -107,6 +107,12 @@ permission:
|
|
|
107
107
|
|
|
108
108
|
### 轻量路径执行要点
|
|
109
109
|
|
|
110
|
+
**统一前置:变更记录(`flow-change`)**。凡涉及代码改动的路径(Bug 修复 / 紧急修复 / 业务调整 /
|
|
111
|
+
重构 / 技术债 / 基础设施),先用内置引擎建立记录:`cabbage({op:"new", type:"change", change:"<slug>"})`,
|
|
112
|
+
随实现更新 `tasks.md`;高风险用 `impact` 标记展开专项文档;验证通过、合并确认后 `op:"archive"`。
|
|
113
|
+
紧急修复同样先建记录(声明 `deployment=true`)。纯文档路径按 `flow-docs` 规范直接改归属文档;
|
|
114
|
+
调研路径不建记录;事故复盘走 `flow-incident`(incident → postmortem → tasks)。
|
|
115
|
+
|
|
110
116
|
**Bug 修复(Corrective Flow)**
|
|
111
117
|
1. 分诊严重度;创建 goal 绑定 Flow Record,链接导致回归的原 Flow(不改其完成状态)
|
|
112
118
|
2. 建立反馈回路(失败测试/脚本/夹具),确认复现用户描述的**同一**故障
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
- 新功能/需求:setup → requirements → design → tasks → code → review → release
|
|
15
15
|
- 非功能场景(Bug 修复/紧急修复/业务调整/重构/技术债/基础设施/文档/回滚):输入 @dev-lifecycle,自动分诊并按对应轻量路径执行
|
|
16
16
|
|
|
17
|
+
变更记录:任何代码改动先经内置 `cabbage` 工具建立/更新变更记录(flow-change 技能)——
|
|
18
|
+
默认一份 tasks.md(Goal/Design/Tasks/Verification),高风险经 impact 标记展开专项文档,
|
|
19
|
+
验证通过、合并确认后归档并同步 docs/。
|
|
20
|
+
|
|
17
21
|
阶段契约:每个 stage 的完成权威是 Parent Issue body checklist(`- [x] <stage>`),
|
|
18
22
|
阶段顺序与约束详见 stage-contract。
|
|
19
23
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flow-change
|
|
3
|
+
description: Maintain a Cabbage change record (tasks + documents) through the built-in `cabbage` tool — create the record, declare risk flags, verify stages, pass gates, sync to docs, archive after merge. Use for bug fixes, refactors, small features, hotfixes, or whenever a tracked record with tasks.md and verification evidence is required in this repository.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# flow-change
|
|
7
|
+
|
|
8
|
+
本仓库的变更记录机制由插件内置的 Cabbage 引擎提供(`cabbage` 工具,无需手工安装)。
|
|
9
|
+
一份记录 = 一个目录(`.cabbage/changes/<id>/`):默认只有一份 `tasks.md`,
|
|
10
|
+
高风险时用影响标记展开专项文档;验证通过、合并确认后归档并同步到 `docs/`。
|
|
11
|
+
|
|
12
|
+
## 何时启用
|
|
13
|
+
|
|
14
|
+
- 任何需要留痕的代码改动:bug 修复、重构、小功能、紧急修复、业务调整。
|
|
15
|
+
- 大流程(requirements/design/code/...)中的具体代码改动:在对应阶段用记录承载
|
|
16
|
+
Goal/Design/Tasks/Verification 与验收证据。
|
|
17
|
+
- **不启用**:纯文档小修(直接改归属文档,用 `flow-docs` 约定)、一次性问答、纯调研
|
|
18
|
+
(见 `flow-research`,调研本身不建记录)。
|
|
19
|
+
|
|
20
|
+
## 默认路径:一次变更一份记录
|
|
21
|
+
|
|
22
|
+
1. 创建记录(需要项目已初始化;未初始化先 `op:"init"`):
|
|
23
|
+
- `cabbage({op:"new", type:"change", change:"fix-label"})`
|
|
24
|
+
- 事故复盘用 `type:"incident"`(incident → postmortem → tasks)。
|
|
25
|
+
2. 填写 `tasks.md`:`Goal`(含复现的问题)、`Design`(最小方案)、`Tasks`、`Verification`。
|
|
26
|
+
3. 实现前评估风险并声明标记(会生成对应专项文档):
|
|
27
|
+
- `cabbage({op:"impact", change:"fix-label", impact:["api=true","design=true"]})`
|
|
28
|
+
- 标记表:`design`→tech-spec、`rfc`→rfc、`architecture`→adr、`api`→api-design、
|
|
29
|
+
`database`→database-design、`security`→security-review、`deployment`→release-plan。
|
|
30
|
+
- 数据迁移 = `database` + `deployment`;跨团队评审 = `rfc`(+按需 `design`)。
|
|
31
|
+
4. 复现失败 → 最小修复 → 回归测试;完成任务清单并写入真实命令与结果。
|
|
32
|
+
5. 逐级验证与门禁:
|
|
33
|
+
- `cabbage({op:"verify", change:"fix-label", stage:"tasks"})`(有专项阶段先逐一验证)
|
|
34
|
+
- `cabbage({op:"gate", change:"fix-label", target:"merge"})` → 应输出 ALLOWED。
|
|
35
|
+
6. 合并后收尾:确认合并 → `cabbage({op:"archive", change:"fix-label"})`(自动 sync + 归档)。
|
|
36
|
+
|
|
37
|
+
速查(亮路径全链路):
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
cabbage({op:"new", type:"change", change:"fix-label"})
|
|
41
|
+
cabbage({op:"impact", change:"fix-label", impact:["api=true"]}) # 仅在确有风险时
|
|
42
|
+
cabbage({op:"verify", change:"fix-label", stage:"tasks"}) # 专项阶段先行
|
|
43
|
+
cabbage({op:"gate", change:"fix-label", target:"merge"}) # 期望 ALLOWED
|
|
44
|
+
cabbage({op:"archive", change:"fix-label"}) # 确认合并后
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 约束
|
|
48
|
+
|
|
49
|
+
- `change.yaml` 与 `state.json` 由 CLI 管理,不要手工编辑;验证后修改产物会让阶段 `stale`。
|
|
50
|
+
- 只声明真实风险;不为省文档隐瞒影响,也不为凑文档虚报标记。
|
|
51
|
+
- `archive` 不检查 Git 合并状态:必须人工确认合并后再归档。
|
|
52
|
+
- 记录描述单次改动;系统当前行为写入 `docs/` 编号目录(sync 只按映射复制,不做语义合并)。
|
|
53
|
+
- CLI 不可用(缺 Python 3.10+)时工具会返回明确错误:告知用户安装 Python,不要伪造验证结果。
|
|
54
|
+
|
|
55
|
+
## 常用操作
|
|
56
|
+
|
|
57
|
+
| 操作 | 用途 |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| `init` | 初始化 `.cabbage/`(工作流、CI 模板、vendored CLI),每项目一次 |
|
|
60
|
+
| `status` / `next` | 记录列表与阶段就绪/阻塞(不猜阶段 ID,以 `next` 为准) |
|
|
61
|
+
| `verify` / `gate` | 阶段验证与门禁(`target`:阶段 ID / `merge` / `archive`) |
|
|
62
|
+
| `validate` | 结构校验(省略 `change` 校验全部) |
|
|
63
|
+
| `sync` / `archive` | 同步当前文档 / 收尾归档 |
|
|
64
|
+
| `tasks` / `discard` | 任务清单只读视图 / 废弃记录 |
|
|
65
|
+
|
|
66
|
+
> 无本插件工具的环境(如 Codex):以上操作对应 `python3 -m cabbage_cli <操作>` 直跑 CLI
|
|
67
|
+
> (CLI 需本地可用),语义与参数一致。
|
|
68
|
+
|
|
69
|
+
## Contract
|
|
70
|
+
|
|
71
|
+
### Trigger
|
|
72
|
+
由 `@dev-lifecycle` 分诊(Bug 修复、重构、业务调整、紧急修复等轻量路径)或用户要求建立变更记录时触发;
|
|
73
|
+
大流程的代码改动也可在实现阶段引用本 skill。
|
|
74
|
+
|
|
75
|
+
### Inputs
|
|
76
|
+
- 变更描述(问题/目标、影响范围)
|
|
77
|
+
- 变更 id(kebab-case,按功能派生)
|
|
78
|
+
- 可选:影响标记(design/rfc/architecture/api/database/security/deployment)
|
|
79
|
+
|
|
80
|
+
### Preconditions
|
|
81
|
+
- 项目已初始化(无 `.cabbage/` 时先 `init`)
|
|
82
|
+
- 插件内置引擎可用(缺 Python 3.10+ 时停止并告知用户)
|
|
83
|
+
|
|
84
|
+
### Procedure
|
|
85
|
+
1. 创建记录并填写 `tasks.md` 的 Goal 与 Design
|
|
86
|
+
2. 实现前声明真实风险标记(必要时)
|
|
87
|
+
3. 实现并完成 Tasks 清单,记录真实验证命令与结果
|
|
88
|
+
4. 逐一 `verify` 已启用阶段(专项在前、`tasks` 在后)
|
|
89
|
+
5. `gate merge` 通过后交回编排器提交;合并确认后 `archive`
|
|
90
|
+
|
|
91
|
+
### Outputs
|
|
92
|
+
- `.cabbage/changes/<id>/`:tasks.md 与按需专项文档(验证后签名写入 state.json)
|
|
93
|
+
- 归档:`.cabbage/archive/<year>/<id>/` 与 `docs/` 的同步文档
|
|
94
|
+
|
|
95
|
+
### Failure
|
|
96
|
+
- `gate` BLOCKED → 用 `next` 找到未完成的已启用前置阶段并验证
|
|
97
|
+
- `placeholder content remains` / `unchecked tasks remain` → 清除模板提示、勾选任务后再验证
|
|
98
|
+
- 阶段 `stale` → 对照上游变化重新审阅并重新验证
|
|
99
|
+
- CLI 不可用 → 告知用户安装 Python 3.10+,不得伪造记录或验证结果
|
|
100
|
+
|
|
101
|
+
### Idempotency
|
|
102
|
+
- 同名记录已存在 → 复用并更新(`new` 报错说明已存在)
|
|
103
|
+
- 重复 `verify` 同一未变化阶段 → 幂等,仅刷新签名时间
|
|
104
|
+
- 重复 `sync` → 按映射覆盖目标文档,无副作用
|
|
105
|
+
|
|
106
|
+
### Prohibited Actions
|
|
107
|
+
- 不手工编辑 `change.yaml` / `state.json`
|
|
108
|
+
- 不在实现前伪造验证结果(专项文档写待执行步骤,真实结果回填 `tasks.md`)
|
|
109
|
+
- 不在未确认合并时 `archive`;不为通过门禁删改 CI 与工作流文件
|
|
@@ -29,6 +29,21 @@ description: 技术方案设计 → 方案文档 + ADR → Planning PR
|
|
|
29
29
|
```
|
|
30
30
|
4. **合入基线**:PR 合并后即形成设计基线(Planning Baseline),后续任务拆解以此为前置。
|
|
31
31
|
|
|
32
|
+
## ADR 内容标准
|
|
33
|
+
|
|
34
|
+
ADR 是决策记录,不是设计文档。只有改变组件边界、拓扑、关键依赖或数据归属的决策才写 ADR;
|
|
35
|
+
仅实现细节、内部重构、无长期影响的选型不写,记入变更记录即可。
|
|
36
|
+
|
|
37
|
+
必需标题(工作流逐字校验 `Context` / `Decision` / `Consequences`):
|
|
38
|
+
|
|
39
|
+
- `Context`:约束和现状,不写解决方案。
|
|
40
|
+
- `Decision`:选了什么**以及为什么**,列出被否决的备选方案和否决理由。
|
|
41
|
+
- `Consequences`:同时写正面和负面影响,包括引入的运维负担与待办。
|
|
42
|
+
|
|
43
|
+
需要跨团队评审、方案尚未定案时先写 RFC(`Problem` / `Proposal` / `Alternatives`),评审通过后再落 ADR。
|
|
44
|
+
**已合并的 ADR/RFC 不重命名、不改写**:新决策用新记录显式取代旧的,旧记录保留可追溯。
|
|
45
|
+
完整接口契约进 API 文档、表结构与迁移进数据库文档、测试策略进测试计划——不要塞进 ADR。
|
|
46
|
+
|
|
32
47
|
## 设计约束
|
|
33
48
|
|
|
34
49
|
技术方案必须遵循以下原则:
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flow-docs
|
|
3
|
+
description: Write and organize long-lived project documentation — numbered docs tree placement, stable naming, relative links and anchors, Mermaid diagrams, ownership, and site preview or build. Use when authoring or moving current-state docs, fixing broken links, or running the documentation site.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# flow-docs
|
|
7
|
+
|
|
8
|
+
面向长期存在的**当前状态文档**(系统现在如何工作)。变更记录与门禁由 `flow-change` 负责。
|
|
9
|
+
|
|
10
|
+
## 目录归属(编号树)
|
|
11
|
+
|
|
12
|
+
`cabbage init` 生成的当前状态文档写入 `docs/` 下的编号目录,只创建有实际内容的目录:
|
|
13
|
+
|
|
14
|
+
| 目录 | 内容 |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| `00-overview/` | 项目概览、范围、快速上手 |
|
|
17
|
+
| `01-product/` | 需求、用户故事、验收标准 |
|
|
18
|
+
| `02-design/` | 交互与视觉设计、原型说明 |
|
|
19
|
+
| `03-architecture/` | 系统设计、`adr/`、`rfc/` |
|
|
20
|
+
| `04-domain/` | 数据模型、数据库设计、迁移与回滚 |
|
|
21
|
+
| `05-api/` | 接口契约、事件、集成 |
|
|
22
|
+
| `06-development/` | 本地开发环境、构建与调试 |
|
|
23
|
+
| `07-standards/` | 编码规范、评审约定 |
|
|
24
|
+
| `08-testing/` | 测试策略与用例 |
|
|
25
|
+
| `09-security/` | 威胁模型、权限与合规控制 |
|
|
26
|
+
| `10-infrastructure/` | 部署拓扑、容量、环境配置 |
|
|
27
|
+
| `11-ci-cd/` | 流水线定义与门禁说明 |
|
|
28
|
+
| `12-release/` | 发布流程与版本策略 |
|
|
29
|
+
| `13-operations/` | 运行手册、监控、应急预案 |
|
|
30
|
+
| `14-performance/` | 性能基线与压测结果 |
|
|
31
|
+
| `15-incidents/` | 事故记录与复盘(不可改写的历史) |
|
|
32
|
+
| `16-dependencies/` | 外部依赖清单与升级策略 |
|
|
33
|
+
| `17-compliance/` | 合规要求与审计证据 |
|
|
34
|
+
|
|
35
|
+
- 变更记录归档时 `archive` 自动 `sync`,把专项文档复制进对应编号目录;`sync` 只按映射复制,
|
|
36
|
+
不做语义合并。
|
|
37
|
+
- 流程阶段产出的 PRD / 技术方案 / ADR 保留各自路径(`docs/prd/`、`docs/dev/specs/`、`docs/adr/`),
|
|
38
|
+
与编号树各司其职:前者是流程产物,后者是长期当前状态。
|
|
39
|
+
- `.cabbage/changes/` 是变更历史,`docs/` 是当前状态,两者不互相复制内容。
|
|
40
|
+
|
|
41
|
+
## 写作原则
|
|
42
|
+
|
|
43
|
+
1. **单一事实来源**:一个事实只在一处定义,其他文档链接过去,不复制正文。
|
|
44
|
+
2. **当前状态 vs 决策历史**:当前状态文档原处更新;ADR/RFC/事故记录是不可改写的历史。
|
|
45
|
+
3. **稳定路径**:不使用 `spec-v2-final.md`、`_latest.md`、`_copy.md` 这类文件名,版本交给 Git。
|
|
46
|
+
4. **相对链接**:仓内链接一律用相对路径并带文件扩展名,不写 `/docs/...` 绝对路径。
|
|
47
|
+
5. **不写占位内容**:`TODO`、`TBD`、`FIXME` 会导致校验失败。
|
|
48
|
+
|
|
49
|
+
## 校验与站点
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cabbage({op:"validate"}) # 结构、标题锚点、相对路径、Mermaid 围栏(不要求先建变更)
|
|
53
|
+
cabbage({op:"validate", change:"x"}) # 或只校验某条记录
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
站点(如仓库使用 VitePress):`pnpm --dir docs run dev` 预览、`pnpm --dir docs run build` 构建;
|
|
57
|
+
构建失败先跑 `validate`(省略 `change` 校验全部)定位死链,再检查围栏闭合与 HTML 标签。
|
|
58
|
+
|
|
59
|
+
## 图表
|
|
60
|
+
|
|
61
|
+
使用 Mermaid,写在 ` ```mermaid ` 围栏内;围栏必须闭合,否则校验与站点构建都会失败。
|
|
62
|
+
常用类型:流程图、时序图、状态图、ER 图。图表只画难以用文字表达的关系。
|
|
63
|
+
|
|
64
|
+
## 归属与评审
|
|
65
|
+
|
|
66
|
+
关键长期文档应在 frontmatter 声明维护方:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
---
|
|
70
|
+
owner: team-billing
|
|
71
|
+
maintained-by: ["@alice"]
|
|
72
|
+
last-reviewed: 2026-03-01
|
|
73
|
+
---
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
用 `.github/CODEOWNERS` 让架构、安全等目录的改动必须由对应负责人评审。
|
|
77
|
+
该 frontmatter 是约定,CLI 不校验也不强制;真正的强制来自代码托管平台的分支保护。
|
|
78
|
+
|
|
79
|
+
## Contract
|
|
80
|
+
|
|
81
|
+
### Trigger
|
|
82
|
+
撰写或移动当前状态文档、修复死链、整理文档归属、预览或构建文档站点时触发。
|
|
83
|
+
|
|
84
|
+
### Inputs
|
|
85
|
+
- 文档内容或需要修复的链接/结构问题
|
|
86
|
+
- 目标编号目录(按内容性质选择)
|
|
87
|
+
|
|
88
|
+
### Preconditions
|
|
89
|
+
- 项目 docs 树已存在(未初始化时先经 `flow-change` 执行 `op:"init"`)
|
|
90
|
+
|
|
91
|
+
### Procedure
|
|
92
|
+
1. 按内容性质选择编号目录;只创建有实际内容的目录
|
|
93
|
+
2. 遵循写作原则(单一事实来源、稳定路径、相对链接、无占位)
|
|
94
|
+
3. `op:"validate"` 校验结构与链接;站点项目再执行构建
|
|
95
|
+
4. 关键文档补 frontmatter 归属;治理目录配 CODEOWNERS
|
|
96
|
+
|
|
97
|
+
### Outputs
|
|
98
|
+
- `docs/` 编号目录下的当前状态文档(或修复后的链接/结构)
|
|
99
|
+
|
|
100
|
+
### Failure
|
|
101
|
+
- `broken link` → 修正相对路径层级或锚点 slug,确认目标文件存在
|
|
102
|
+
- 链接越出项目根 → 改用仓内相对路径
|
|
103
|
+
- 站点依赖缺失 → 重新安装站点依赖后再构建
|
|
104
|
+
|
|
105
|
+
### Idempotency
|
|
106
|
+
- 重复 `validate` → 幂等只读
|
|
107
|
+
- 同一批移动操作分批提交 → 每批后校验保持可构建
|
|
108
|
+
|
|
109
|
+
### Prohibited Actions
|
|
110
|
+
- 不用 `final-v2`、`_latest`、`_copy` 之类文件名
|
|
111
|
+
- 不改写已归档的历史记录(ADR/RFC/事故)
|
|
112
|
+
- 不在当前状态文档与变更记录间复制正文
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flow-incident
|
|
3
|
+
description: Document production incidents and postmortems — incident timeline, impact, containment and recovery, blameless root cause, corrective actions grounded through the built-in Cabbage engine. Use for outages, severity events, live-service failures, or writing a postmortem retrospective.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# flow-incident
|
|
7
|
+
|
|
8
|
+
处置生产事故时,先止损、再取证、后复盘。**不要在事故进行中伪造完整时间线或结论。**
|
|
9
|
+
|
|
10
|
+
## 流程(经内置引擎)
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
cabbage({op:"new", type:"incident", change:"payment-timeout-2026-08-29"})
|
|
14
|
+
cabbage({op:"next", change:"payment-timeout-2026-08-29"}) # 阶段:incident → postmortem → tasks
|
|
15
|
+
# 1. 记录事实:填写 incident.md
|
|
16
|
+
cabbage({op:"verify", change:"payment-timeout-2026-08-29", stage:"incident"})
|
|
17
|
+
# 2. 分析根因:填写 postmortem.md
|
|
18
|
+
cabbage({op:"verify", change:"payment-timeout-2026-08-29", stage:"postmortem"})
|
|
19
|
+
# 3. 预防措施落地:完成任务清单
|
|
20
|
+
cabbage({op:"verify", change:"payment-timeout-2026-08-29", stage:"tasks"})
|
|
21
|
+
cabbage({op:"gate", change:"payment-timeout-2026-08-29", target:"merge"})
|
|
22
|
+
# 合并确认后:
|
|
23
|
+
cabbage({op:"archive", change:"payment-timeout-2026-08-29"})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
阶段 ID 以 `next` 输出为准:`incident` → `postmortem` → `tasks`。前两个阶段是事实与分析,第三个阶段是实际修复与预防措施。
|
|
27
|
+
|
|
28
|
+
**分级降载**:正在处置的紧急故障不要为了走流程而拖延止血。先经 `flow-change` 走最小修复路径
|
|
29
|
+
(`type:"change"` + 声明 `deployment=true`),事后另立 incident 记录复盘;不要把两者混在同一记录里。
|
|
30
|
+
|
|
31
|
+
## incident.md:先记事实
|
|
32
|
+
|
|
33
|
+
必需标题 `Impact` / `Timeline` / `Mitigation`。
|
|
34
|
+
|
|
35
|
+
- 时间戳统一用 UTC 或明确标注时区;事故期间先记原始观测,不追求措辞。
|
|
36
|
+
- `Impact` 量化受影响用户数、时长、区域、功能、数据与 SLO 影响;无法量化时写估计方法与误差。
|
|
37
|
+
- `Timeline` 记录事件、观测与采取的行动及其执行人,包括误判和无效尝试。
|
|
38
|
+
- `Mitigation` 区分 **Containment**(如何限制影响,如回滚、摘流量、限流)与 **Recovery**(如何恢复,
|
|
39
|
+
及仍然降级的行为)。
|
|
40
|
+
- 恢复后补 `Recovery Verification`:证明恢复的指标、检查项与观察窗口。
|
|
41
|
+
- 不要写"疑似"当结论;不确定的内容标注为待确认。
|
|
42
|
+
|
|
43
|
+
## postmortem.md:对事不对人
|
|
44
|
+
|
|
45
|
+
必需标题 `Root Cause` / `Contributing Factors` / `Corrective Actions`。
|
|
46
|
+
|
|
47
|
+
- 区分 **触发点**(直接原因)与 **根因**(使其可能且未被拦截的系统条件)。
|
|
48
|
+
- 根因结论要有证据支撑:日志、指标、变更记录、复现步骤,而非推测。
|
|
49
|
+
- `Corrective Actions` 每项必须有单一责任人、期限、验证方式与状态;笼统的"加强监控""提高意识"
|
|
50
|
+
不是可验证的措施。
|
|
51
|
+
- 保持无责文化:记录系统为何允许人为错误造成影响,不记录个人过失。
|
|
52
|
+
|
|
53
|
+
## tasks.md:预防措施落地
|
|
54
|
+
|
|
55
|
+
`postmortem.md` 中的措施要落到实际任务,完成并验证后才通过阶段。
|
|
56
|
+
只写计划不执行会阻塞合并门禁,这是刻意的:复盘结论必须兑现。
|
|
57
|
+
|
|
58
|
+
## 边界
|
|
59
|
+
|
|
60
|
+
- 事故记录与变更记录都属于决策历史,归档后不重写、不"现代化"措辞。
|
|
61
|
+
- 当前系统的运行方式写到长期运行文档;事故报告本身是历史记录。
|
|
62
|
+
- 结构校验只检查标题、占位符与链接,不判断根因分析是否正确;复盘质量仍需人工评审。
|
|
63
|
+
|
|
64
|
+
## Contract
|
|
65
|
+
|
|
66
|
+
### Trigger
|
|
67
|
+
生产事故、严重事件、线上服务故障的处置与复盘;或用户要求撰写事故报告时触发。
|
|
68
|
+
|
|
69
|
+
### Inputs
|
|
70
|
+
- 事故基本事实(时间、影响、止损与恢复过程)
|
|
71
|
+
- 证据材料(日志、指标、变更记录、复现步骤)
|
|
72
|
+
|
|
73
|
+
### Preconditions
|
|
74
|
+
- 事故已止血或已恢复(进行中不写完整复盘)
|
|
75
|
+
- 项目已初始化(无 `.cabbage/` 时先经 `flow-change` 执行 `op:"init"`)
|
|
76
|
+
|
|
77
|
+
### Procedure
|
|
78
|
+
1. `op:"new" type:"incident"` 创建记录并如实填写 incident.md(Impact/Timeline/Mitigation)
|
|
79
|
+
2. 验证 incident 阶段后撰写 postmortem.md(根因、促成因素、纠正措施)
|
|
80
|
+
3. 将纠正措施落成 tasks.md 清单并实际执行
|
|
81
|
+
4. 逐阶段 `verify` → `gate merge` → 合并确认后 `archive`
|
|
82
|
+
|
|
83
|
+
### Outputs
|
|
84
|
+
- `.cabbage/changes/<id>/`:incident.md、postmortem.md、tasks.md(验证后签名)
|
|
85
|
+
- 归档后:`.cabbage/archive/<year>/<id>/`
|
|
86
|
+
|
|
87
|
+
### Failure
|
|
88
|
+
- 时间线/证据不完整 → 标注待确认,不编造;补齐后重新验证
|
|
89
|
+
- 措施无法在本次完成 → 转入独立变更(flow-change)跟踪,本记录如实标注状态
|
|
90
|
+
|
|
91
|
+
### Idempotency
|
|
92
|
+
- 重复 `verify` 未变化阶段 → 幂等
|
|
93
|
+
- 事故期间多次追加时间线 → 更新产物后重新验证
|
|
94
|
+
|
|
95
|
+
### Prohibited Actions
|
|
96
|
+
- 不在处置进行中伪造完整时间线或根因结论
|
|
97
|
+
- 不把紧急修复与事故复盘混在同一记录
|
|
98
|
+
- 不将未执行的预防措施勾选为完成
|
|
@@ -21,6 +21,15 @@ description: 调研/事实核查 — 迭代深化 + 一手来源评分 + 反方
|
|
|
21
21
|
7. **元评审**(输出前自省):剩余未知、最弱证据、可能错误的假设、遗漏角度、边际收益。
|
|
22
22
|
8. **输出**:写 `docs/dev/research/<topic>.md`,并在消息中给结论/可执行建议摘要。
|
|
23
23
|
|
|
24
|
+
## 调研纪律
|
|
25
|
+
|
|
26
|
+
1. **先定义决策,后收集资料**:开始前写下"要回答什么问题"和"什么条件下选哪个方案";结论不改变决策就不调研。
|
|
27
|
+
2. **硬性约束优先于加权评分**:不满足硬性约束的方案直接淘汰,不进入评分表。
|
|
28
|
+
3. **事实、推断、未知项分开**:不得把推断写成事实;无法验证就写"待验证",禁止补全式猜测。
|
|
29
|
+
4. **优先验证失败路径**,不只验证正常路径。
|
|
30
|
+
5. **PoC 边界**:只验证会导致方案被否决的那个假设,不开发完整系统。
|
|
31
|
+
6. **推荐必须包含适用边界、代价和退出条件**(什么信号出现时需要重新评估)。
|
|
32
|
+
|
|
24
33
|
## 何时停止迭代
|
|
25
34
|
|
|
26
35
|
- 所有关键问题 ≥2 个独立来源支持
|
|
@@ -39,6 +39,19 @@ description: 初始化 — 探测环境 → 确认 Profile
|
|
|
39
39
|
- release workflow: `.github/workflows/release.yml`
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
## 存量项目接入(adopt)
|
|
43
|
+
|
|
44
|
+
仓库已有文档时(`init` 只新增骨架、不改写已有文件;无 `.cabbage/` 时先经 flow-change 执行 `op:"init"`):
|
|
45
|
+
|
|
46
|
+
1. `cabbage({op:"adopt"})` 盘点 `docs/` 树之外的 Markdown → 生成 `.cabbage/` 下的 `adoption-report.md`;
|
|
47
|
+
每份文档得到四种动作:`keep`(已在编号目录)/ `migrate`(当前状态文档)/ `import`(历史记录)/
|
|
48
|
+
`review`(无法归类)。分类仅基于目录与文件名推断,**始终需要人工确认**。
|
|
49
|
+
2. 逐行处理 `review`,与文档负责人确认归属;`import` 的历史记录(ADR/RFC/事故)原样归档,
|
|
50
|
+
**不改写内容**。
|
|
51
|
+
3. `migrate` 用 `git mv` 保留历史,一个逻辑批次一个提交;移动后立即修正相对链接。
|
|
52
|
+
4. 每批后 `cabbage({op:"validate"})` + 站点构建,确认无死链。
|
|
53
|
+
5. 接入完成的判据:再次 `op:"adopt"` 应全部报告 `keep`。
|
|
54
|
+
|
|
42
55
|
## Output
|
|
43
56
|
- readiness 报告(git/gh 可用性、CI/release workflow 存在性)
|
|
44
57
|
- 根 AGENTS.md `## Project Profile` 区块
|