@xulthekl/team-flow 0.39.0 → 0.40.1
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/.claude/always/phase-guard.md +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/marketplace.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/plugin/marketplace.json +2 -2
- package/GEMINI.md +1 -1
- package/INSTALL.md +1 -1
- package/README.md +1 -1
- package/agents/build-executor.md +9 -7
- package/docs/README_en.md +1 -1
- package/docs/solutions/INDEX.md +1 -0
- package/docs/solutions/cross-phase/2026-08-07-no-summary.md +17 -0
- package/gemini-extension.json +1 -1
- package/hooks/session-start +2 -2
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/scripts/ensure-branch.mjs +2 -8
- package/scripts/lib/arch-merge.mjs +11 -10
- package/scripts/lib/cmd-deisolate.mjs +1 -5
- package/scripts/lib/cmd-execution.mjs +3 -2
- package/scripts/lib/cmd-prototype.mjs +30 -13
- package/scripts/lib/cmd-publish.mjs +16 -4
- package/scripts/lib/execution-plan.mjs +78 -18
- package/scripts/lib/git-utils.mjs +90 -0
- package/skills/build-executor/SKILL.md +13 -10
- package/skills/ce-brainstorm/SKILL.md +65 -2
- package/skills/ce-brainstorm/references/brainstorm-sections.md +53 -9
- package/skills/ce-brainstorm/references/business-processes.md +140 -0
- package/skills/ce-brainstorm/references/business-scenarios.md +122 -0
- package/skills/ce-brainstorm/references/evidence-chain-validation.md +114 -0
- package/skills/ce-brainstorm/references/phase0-routing.md +7 -1
- package/skills/ce-brainstorm/references/prd-mapping.md +36 -8
- package/skills/ce-brainstorm/references/synthesis-summary.md +21 -0
- package/skills/workflow-start/SKILL.md +49 -1
|
@@ -5,6 +5,7 @@ import { isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
|
5
5
|
import { computeArtifactsHash, computeContractHash } from './hash.mjs';
|
|
6
6
|
import { getOverlayPaths } from './sdd-overlay.mjs';
|
|
7
7
|
import { readState } from './state-loader.mjs';
|
|
8
|
+
import { detectWorkspaceRoot, findSubRepo } from './git-utils.mjs';
|
|
8
9
|
|
|
9
10
|
export const EXECUTION_MODES = ['inline', 'batch-inline', 'sdd'];
|
|
10
11
|
|
|
@@ -130,7 +131,7 @@ export function validatePlan(changeDir, plan) {
|
|
|
130
131
|
return { valid: failures.length === 0, failures, plan };
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
export function recordReview(changeDir, waveId, receipt) {
|
|
134
|
+
export function recordReview(changeDir, waveId, receipt, repoPath) {
|
|
134
135
|
const plan = readPlan(changeDir);
|
|
135
136
|
const validation = validatePlan(changeDir, plan);
|
|
136
137
|
if (!validation.valid) throw new Error(`Cannot record a review for an invalid execution plan: ${validation.failures.join('; ')}`);
|
|
@@ -145,7 +146,7 @@ export function recordReview(changeDir, waveId, receipt) {
|
|
|
145
146
|
}
|
|
146
147
|
for (const field of ['base', 'head']) requireText(receipt?.[field], `receipt.${field}`);
|
|
147
148
|
const report = validateReviewReportEvidence(changeDir, receipt?.report);
|
|
148
|
-
const { base, head } = validateReviewRange(changeDir, receipt.base, receipt.head);
|
|
149
|
+
const { base, head, subRepoPath } = validateReviewRange(changeDir, receipt.base, receipt.head, repoPath);
|
|
149
150
|
// v0.13 §51.2:测试统计为可选证据字段(提供时必须为非负整数)。
|
|
150
151
|
// 硬门禁在入口(test-matrix-ready)与 closing(tests-passing),此处只沉淀证据,
|
|
151
152
|
// 避免单 wave 零测试造成 BUG-A 式过严死锁(DDL/脚手架类 wave 可能合理无测试)。
|
|
@@ -166,6 +167,9 @@ export function recordReview(changeDir, waveId, receipt) {
|
|
|
166
167
|
head,
|
|
167
168
|
report,
|
|
168
169
|
...(tests ? { tests } : {}),
|
|
170
|
+
// Persist repo path when SHA was resolved in a sub-repository, so
|
|
171
|
+
// readCurrentReview can re-validate without re-scanning.
|
|
172
|
+
...(subRepoPath ? { repo: relative(changeDir, subRepoPath) } : {}),
|
|
169
173
|
plan_hash: plan.hash,
|
|
170
174
|
plan_revision: plan.revision,
|
|
171
175
|
recorded_at: new Date().toISOString(),
|
|
@@ -187,7 +191,10 @@ export function readCurrentReview(changeDir, waveId, plan = readPlan(changeDir))
|
|
|
187
191
|
try {
|
|
188
192
|
const receipt = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
189
193
|
if (receipt?.plan_hash !== plan.hash || receipt?.plan_revision !== plan.revision) return null;
|
|
190
|
-
|
|
194
|
+
// When the receipt records a repo path (sub-repo scenario), use it for
|
|
195
|
+
// SHA re-validation. Otherwise fall back to the default main-repo path.
|
|
196
|
+
const repoPath = receipt?.repo ? resolve(changeDir, receipt.repo) : undefined;
|
|
197
|
+
const range = validateReviewRange(changeDir, receipt?.base, receipt?.head, repoPath);
|
|
191
198
|
if (receipt.base !== range.base || receipt.head !== range.head) return null;
|
|
192
199
|
// A passing receipt is current evidence only while its referenced report
|
|
193
200
|
// remains safe and readable. Recheck it here because reports can be
|
|
@@ -276,10 +283,74 @@ function getPhysicalReviewsDirectory(changeDir) {
|
|
|
276
283
|
return { changeRoot, reviewsDir: directory };
|
|
277
284
|
}
|
|
278
285
|
|
|
279
|
-
function validateReviewRange(changeDir, base, head) {
|
|
280
|
-
const gitRoot =
|
|
281
|
-
|
|
282
|
-
|
|
286
|
+
function validateReviewRange(changeDir, base, head, repoPath) {
|
|
287
|
+
const gitRoot = resolveGitRoot(changeDir, repoPath);
|
|
288
|
+
|
|
289
|
+
let resolvedBase, resolvedHead, subRepoPath;
|
|
290
|
+
try {
|
|
291
|
+
resolvedBase = resolveGitCommit(gitRoot, base, 'base');
|
|
292
|
+
resolvedHead = resolveGitCommit(gitRoot, head, 'head');
|
|
293
|
+
} catch (primaryError) {
|
|
294
|
+
// Sub-repo fallback: when SHA is not in the main repo, scan workspace
|
|
295
|
+
// children for a sub-repository that contains it (e.g. bff/, ui/).
|
|
296
|
+
// Only attempt when --repo was not explicitly provided.
|
|
297
|
+
if (repoPath) throw primaryError;
|
|
298
|
+
|
|
299
|
+
const workspaceRoot = detectWorkspaceRoot(changeDir);
|
|
300
|
+
if (!workspaceRoot) throw primaryError;
|
|
301
|
+
|
|
302
|
+
const subRoot = findSubRepo(workspaceRoot, head);
|
|
303
|
+
if (!subRoot) throw primaryError;
|
|
304
|
+
|
|
305
|
+
resolvedBase = resolveGitCommit(subRoot, base, 'base');
|
|
306
|
+
resolvedHead = resolveGitCommit(subRoot, head, 'head');
|
|
307
|
+
subRepoPath = subRoot;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Track when SHA was resolved outside the changeDir's own repo.
|
|
311
|
+
// This happens either through automatic fallback (subRepoPath set above)
|
|
312
|
+
// or through explicit --repo pointing to a different repository.
|
|
313
|
+
if (!subRepoPath && repoPath) {
|
|
314
|
+
const defaultRoot = resolveGitRoot(changeDir);
|
|
315
|
+
if (gitRoot !== defaultRoot) subRepoPath = gitRoot;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const effectiveRoot = subRepoPath || gitRoot;
|
|
319
|
+
const result = validateResolvedRange(effectiveRoot, resolvedBase, resolvedHead);
|
|
320
|
+
return { ...result, subRepoPath };
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Resolve the git root for SHA verification. Honors an explicit --repo path;
|
|
325
|
+
* otherwise uses the changeDir's own git repository.
|
|
326
|
+
*/
|
|
327
|
+
function resolveGitRoot(changeDir, repoPath) {
|
|
328
|
+
if (repoPath) {
|
|
329
|
+
const absRepo = isAbsolute(repoPath) ? repoPath : resolve(changeDir, repoPath);
|
|
330
|
+
try {
|
|
331
|
+
return execFileSync('git', ['-C', absRepo, 'rev-parse', '--show-toplevel'], {
|
|
332
|
+
encoding: 'utf8',
|
|
333
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
334
|
+
}).trim();
|
|
335
|
+
} catch {
|
|
336
|
+
throw new Error(`--repo path '${repoPath}' is not inside a Git work tree`);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
try {
|
|
340
|
+
return execFileSync('git', ['-C', changeDir, 'rev-parse', '--show-toplevel'], {
|
|
341
|
+
encoding: 'utf8',
|
|
342
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
343
|
+
}).trim();
|
|
344
|
+
} catch {
|
|
345
|
+
throw new Error('Review receipts require the change directory to be inside a Git work tree');
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Validate a resolved SHA range: base must differ from head, and base must
|
|
351
|
+
* be an ancestor of head. Shared by both primary and sub-repo paths.
|
|
352
|
+
*/
|
|
353
|
+
function validateResolvedRange(gitRoot, resolvedBase, resolvedHead) {
|
|
283
354
|
// v0.13 §51.1:禁止空 diff review(base === head)。
|
|
284
355
|
// C1-domain-policy 现场曾出现 6 个 receipt 全部 base==head==初始 commit,
|
|
285
356
|
// 即 review 对空 diff 进行。本校验同时强制"每 wave 落 commit"的纪律。
|
|
@@ -299,17 +370,6 @@ function validateReviewRange(changeDir, base, head) {
|
|
|
299
370
|
return { base: resolvedBase, head: resolvedHead };
|
|
300
371
|
}
|
|
301
372
|
|
|
302
|
-
function getGitRoot(changeDir) {
|
|
303
|
-
try {
|
|
304
|
-
return execFileSync('git', ['-C', changeDir, 'rev-parse', '--show-toplevel'], {
|
|
305
|
-
encoding: 'utf8',
|
|
306
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
307
|
-
}).trim();
|
|
308
|
-
} catch {
|
|
309
|
-
throw new Error('Review receipts require the change directory to be inside a Git work tree');
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
373
|
function resolveGitCommit(gitRoot, revision, field) {
|
|
314
374
|
try {
|
|
315
375
|
return execFileSync('git', ['-C', gitRoot, 'rev-parse', '--verify', `${revision}^{commit}`], {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared git utilities for multi-repo workspace support.
|
|
3
|
+
*
|
|
4
|
+
* team-flow workspaces may contain multiple independent git repositories
|
|
5
|
+
* (e.g. bff/ and ui/ alongside the main repo). These helpers provide
|
|
6
|
+
* consistent root detection and sub-repo discovery used by:
|
|
7
|
+
* - execution-plan.mjs (SHA resolution across repos)
|
|
8
|
+
* - arch-merge.mjs (git add/commit in correct repo)
|
|
9
|
+
* - cmd-prototype.mjs (workspace root detection)
|
|
10
|
+
* - cmd-publish.mjs (workspace root detection)
|
|
11
|
+
* - ensure-branch.mjs (workspace root detection for worktree isolation)
|
|
12
|
+
* - cmd-deisolate.mjs (workspace root detection for deisolation)
|
|
13
|
+
*
|
|
14
|
+
* @module git-utils
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { execFileSync } from 'node:child_process';
|
|
18
|
+
import { existsSync, readdirSync, realpathSync } from 'node:fs';
|
|
19
|
+
import { isAbsolute, join, resolve, sep } from 'node:path';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Detect the workspace root from a changeDir path by looking for the
|
|
23
|
+
* standard `changes/<name>/` directory layout.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} changeDir - Absolute or relative path to a change directory
|
|
26
|
+
* @returns {string|null} Workspace root (parent of `changes/`), or null if
|
|
27
|
+
* changeDir is not inside a standard `changes/` layout
|
|
28
|
+
*/
|
|
29
|
+
export function detectWorkspaceRoot(changeDir) {
|
|
30
|
+
const abs = resolve(changeDir);
|
|
31
|
+
const changesIdx = abs.lastIndexOf(sep + 'changes' + sep);
|
|
32
|
+
return changesIdx > 0 ? abs.slice(0, changesIdx) : null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the git repository root for a given filesystem path.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} path - Any path inside a git work tree
|
|
39
|
+
* @returns {string} Absolute path to the git repository root
|
|
40
|
+
* @throws {Error} When path is not inside a git work tree
|
|
41
|
+
*/
|
|
42
|
+
export function getGitRoot(path) {
|
|
43
|
+
try {
|
|
44
|
+
return execFileSync('git', ['-C', path, 'rev-parse', '--show-toplevel'], {
|
|
45
|
+
encoding: 'utf8',
|
|
46
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
47
|
+
}).trim();
|
|
48
|
+
} catch {
|
|
49
|
+
throw new Error(`Path '${path}' is not inside a Git work tree`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Scan direct children of workspaceRoot for sub-repositories that contain
|
|
55
|
+
* the given git revision. A sub-repository is any direct child directory
|
|
56
|
+
* that has a `.git` entry (directory for normal repos, file for worktrees
|
|
57
|
+
* and submodules).
|
|
58
|
+
*
|
|
59
|
+
* Used as a fallback when a SHA cannot be found in the main repo — if the
|
|
60
|
+
* workspace contains independent code repos (bff/, ui/, etc.), the commit
|
|
61
|
+
* may live there instead.
|
|
62
|
+
*
|
|
63
|
+
* @param {string} workspaceRoot - Workspace root directory to scan
|
|
64
|
+
* @param {string} revision - Git revision to look up (SHA, branch, tag)
|
|
65
|
+
* @returns {string|null} Absolute path to the matching sub-repo root,
|
|
66
|
+
* or null if no sub-repo contains the revision
|
|
67
|
+
*/
|
|
68
|
+
export function findSubRepo(workspaceRoot, revision) {
|
|
69
|
+
let entries;
|
|
70
|
+
try {
|
|
71
|
+
entries = readdirSync(workspaceRoot, { withFileTypes: true });
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
for (const entry of entries) {
|
|
76
|
+
if (!entry.isDirectory()) continue;
|
|
77
|
+
const candidate = join(workspaceRoot, entry.name);
|
|
78
|
+
if (!existsSync(join(candidate, '.git'))) continue;
|
|
79
|
+
try {
|
|
80
|
+
execFileSync('git', ['-C', candidate, 'rev-parse', '--verify', `${revision}^{commit}`], {
|
|
81
|
+
stdio: ['ignore', 'ignore', 'ignore'],
|
|
82
|
+
});
|
|
83
|
+
// Resolve symlinks (macOS /var → /private/var) for consistency with git paths
|
|
84
|
+
return realpathSync(candidate);
|
|
85
|
+
} catch {
|
|
86
|
+
// Not in this sub-repo, continue scanning
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
@@ -107,19 +107,22 @@ Boundaries: if any task touches >1 module, involves schema/API/config changes, o
|
|
|
107
107
|
|
|
108
108
|
## SDD Workflow
|
|
109
109
|
|
|
110
|
-
For full/hotfix by default.
|
|
110
|
+
For full/hotfix by default. Execute waves as dispatched by workflow-start.
|
|
111
|
+
|
|
112
|
+
**v0.39.0 主动串行编排**:build-executor 不再负责安排 code-reviewer。workflow-start 会主动串行编排:每个 wave 完成后,workflow-start 会 dispatch code-reviewer 审查。build-executor 只需执行当前 wave,完成后通知 workflow-start。
|
|
111
113
|
|
|
112
114
|
### Planned-Wave Loop
|
|
113
115
|
1. Read the current plan with `tf execution show <change-dir> --json`; only waves shown with `current: true` and `eligible: true` may start. A `retryable: true` wave may only be repaired and re-reviewed; do not dispatch its dependents until its replacement receipt is `pass`. The CLI encodes dependencies in `--wave <id>:<strategy>:<tasks>[:<depends-on,...>]` and rejects a review receipt for a wave whose prerequisites lack current `pass` receipts.
|
|
114
116
|
2. A `parallel` wave may dispatch independent tasks simultaneously only when the platform supports concurrent dispatch. If it does not, disclose the unavailable capability and execute the same wave one task at a time without changing its stored strategy.
|
|
115
117
|
3. A `serial` wave dispatches one task at a time in listed order.
|
|
116
|
-
4. After every wave,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
5.
|
|
118
|
+
4. After every wave, notify workflow-start via SendMessage that the wave is complete and needs review. Include:
|
|
119
|
+
- Wave ID
|
|
120
|
+
- Worktree path
|
|
121
|
+
- Branch
|
|
122
|
+
- Repositories and commit SHAs (base + head)
|
|
123
|
+
- Summary of changes
|
|
124
|
+
5. **Do not** attempt to dispatch code-reviewer or write review receipts — that is workflow-start's responsibility.
|
|
125
|
+
6. Critical/Important findings require a `fail` receipt, a focused repair, re-review, then a replacement `pass` receipt. Never advance or close with a missing or failed receipt.
|
|
123
126
|
|
|
124
127
|
### Per-Task Loop
|
|
125
128
|
1. **Dispatch implementer**: Load the template with `tf runtime asset read skills/build-executor/implementer-prompt.md`. Extract task brief with `scripts/task-brief PLAN_FILE N`. Include: where task fits, brief path, interfaces from prior tasks, report file path.
|
|
@@ -149,7 +152,7 @@ Track in `.superpowers/sdd/progress.md`. Check for existing ledger — completed
|
|
|
149
152
|
|
|
150
153
|
## Inline Execution Mode
|
|
151
154
|
|
|
152
|
-
Only after a user-confirmed `inline` selection is recorded by `tf execution plan --confirm`; a non-recommended selection also records `--acknowledge-recommendation`. Executes in the current session
|
|
155
|
+
Only after a user-confirmed `inline` selection is recorded by `tf execution plan --confirm`; a non-recommended selection also records `--acknowledge-recommendation`. Executes in the current session. After each wave, notify workflow-start for review (do NOT attempt to write review receipts).
|
|
153
156
|
|
|
154
157
|
Per-task: extract brief → write failing test → confirm failure → implement → confirm green → checkpoint review (done-when criteria, SHALL/MUST verification) → commit → save a task-level recovery checkpoint when another task remains → append to progress ledger.
|
|
155
158
|
|
|
@@ -180,7 +183,7 @@ DP-5 (debug escalation): `tf state set <change-dir> dp_5_result "<resolution>"`
|
|
|
180
183
|
|
|
181
184
|
## Completion Standard
|
|
182
185
|
|
|
183
|
-
Don't report completion until: tests pass, contract obligations satisfied,
|
|
186
|
+
Don't report completion until: tests pass, contract obligations satisfied, and every planned wave has been notified to workflow-start for review. Review blockers are handled by workflow-start via code-reviewer dispatch.
|
|
184
187
|
|
|
185
188
|
## Exception Handling
|
|
186
189
|
|
|
@@ -19,7 +19,7 @@ Brainstorming answers **WHAT** to build through collaborative dialogue, producin
|
|
|
19
19
|
|
|
20
20
|
> **显式参数规约**:orchestrator 调用时必须传入 `mode: orchestrated`。ce-brainstorm 检测到该参数即跳过 Phase 3.5 并在输出中回执"原型循环已委托编排层"。未收到该参数时默认为 standalone 模式。
|
|
21
21
|
>
|
|
22
|
-
> **重要:`orchestrated` 模式仅跳过 Phase 3.5
|
|
22
|
+
> **重要:`orchestrated` 模式仅跳过 Phase 3.5(原型内循环)。Phase 0(含 PRD 模板选择)、Phase 1(含 1.4/1.5/1.6)、Phase 2、Phase 3、QA-4、Phase 3.6、版本归档均正常执行,不可跳过。**
|
|
23
23
|
|
|
24
24
|
## Core Principles
|
|
25
25
|
|
|
@@ -119,6 +119,12 @@ For detailed routing logic, read `references/phase0-routing.md`. Summary:
|
|
|
119
119
|
|
|
120
120
|
**1.3 Dialogue** — Follow Interaction Rules. Fire blindspot gate (if tripwire armed) and visual-probe gate (before first shape decision). Rigor probes fire as open-ended questions before Phase 2. Before exit: integration check for non-obvious consequences. **Exit when**: primary actor, outcome, scope, success criteria all known or recorded as assumptions.
|
|
121
121
|
|
|
122
|
+
**1.4 Dialogue Log Persistence** — Automated step, no user interaction. Trigger: Phase 1.3 dialogue exits. Traverse each Q&A round extracting original text + decisions, generate dialogue summary and decision summary table. Write to `requirement/vN/dialogue-log.md` (create or append). No ledger update.
|
|
123
|
+
|
|
124
|
+
**1.5 Business Scenario Analysis** — Read `references/business-scenarios.md` for methodology. Trigger: Phase 1.4 completed. Extract business scenarios from dialogue and context, produce QA-1 quality check, then **blocking question** for user confirmation. Output: `requirement/vN/business-analysis.md` (requirements + scenarios sections). Status marked 🔵 pending confirmation, ✅ confirmed on user approval. No ledger update at this stage.
|
|
125
|
+
|
|
126
|
+
**1.6 Business Process Analysis** — Read `references/business-processes.md` for methodology. Trigger: Phase 1.5 confirmed (✅). Extract business processes, produce QA-2 quality check, then **blocking question** for user confirmation. Output: update `requirement/vN/business-analysis.md` (processes section + scenario/requirement association fields). Status marked 🔵 pending, ✅ confirmed on approval. No ledger update at this stage.
|
|
127
|
+
|
|
122
128
|
### Phase 2: Explore Approaches
|
|
123
129
|
|
|
124
130
|
**Load brainstorm profile.** If `BRAINSTORM_PROFILE_PATH` is set, read it. Each approach must address core thinking dimensions; note irrelevant dimensions.
|
|
@@ -133,8 +139,15 @@ Propose **2-3 approaches** (or recommend directly if one is clearly best). Use n
|
|
|
133
139
|
|
|
134
140
|
**Read `references/synthesis-summary.md` before composing.** Surface scoping synthesis — user's last chance to correct scope. Fires for all tiers. Path A (announce-only) for Lightweight + no blocking questions; Path B (confirmation gate) for all others. 2.6: dispatch claim verifier during Path B confirmation wait.
|
|
135
141
|
|
|
142
|
+
**QA-3 quality check** fires after synthesis draft is complete, before the blocking question. Synthesis must reference confirmed scenario IDs (SC-xxx) and process IDs (BP-xxx) as evidence anchors. Unconfirmed (🔵) items are flagged in Call outs section.
|
|
143
|
+
|
|
136
144
|
### Phase 3: Generate PRD Document
|
|
137
145
|
|
|
146
|
+
**Inputs** (read before generating PRD):
|
|
147
|
+
- `requirement/ledger.md` — all requirement/scenario/process items and their associations
|
|
148
|
+
- `requirement/vN/dialogue-log.md` — §1.2 revision record reference path
|
|
149
|
+
- `requirement/vN/business-analysis.md` — data source for §2/§3/§7/§8
|
|
150
|
+
|
|
138
151
|
**⛔ MANDATORY:生成PRD文档前,必须先读取 `references/brainstorm-sections.md`**
|
|
139
152
|
|
|
140
153
|
**§8.4 功能模块提取规则(关键规则,必须遵守)**:
|
|
@@ -151,12 +164,62 @@ Propose **2-3 approaches** (or recommend directly if one is clearly best). Use n
|
|
|
151
164
|
- **⛔ 错误行为**:只提取输入/输出/业务规则,丢失原始需求文档中的大量关键细节
|
|
152
165
|
- **⛔ 正确行为**:充分利用原始需求文档的详细内容,保持信息完整性
|
|
153
166
|
|
|
154
|
-
Read `references/brainstorm-sections.md` for doc-warranted criteria. If warranted: read template from `PRD_TEMPLATE_PATH`, fill via `references/prd-mapping.md`, write to `
|
|
167
|
+
Read `references/brainstorm-sections.md` for doc-warranted criteria. If warranted: read template from `PRD_TEMPLATE_PATH`, fill via `references/prd-mapping.md`, write to `requirement/{ITERATION_VERSION}/prd.md`. Vocabulary capture: update `CONCEPTS.md` with resolved domain terms (only if it exists).
|
|
155
168
|
|
|
156
169
|
### Phase 3.5: Prototype Inner Loop
|
|
157
170
|
|
|
158
171
|
**`orchestrated` mode skips this phase.** For standalone: read `references/prototype-loop.md`. Trigger: PRD has UI functions. Steps: produce prototype → review vs PRD → fix loop (max 3) → completeness review → freeze PRD.
|
|
159
172
|
|
|
173
|
+
### QA-4: PRD Quality Check
|
|
174
|
+
|
|
175
|
+
Fires after Phase 3 (or Phase 3.5 if prototype loop ran). Read `references/evidence-chain-validation.md` for QA-4 criteria. Evaluates PRD completeness and traceability against business analysis artifacts.
|
|
176
|
+
|
|
177
|
+
### Phase 3.6: PRD ↔ Scenario/Process Bidirectional Validation
|
|
178
|
+
|
|
179
|
+
**Read `references/evidence-chain-validation.md` for full methodology.** Automated validation; CONDITIONAL_PASS requires user annotation of exempt items. Performs five validation dimensions (V1–V5) ensuring every requirement traces to scenarios and processes, and vice versa.
|
|
180
|
+
|
|
181
|
+
**Routing**: PASS → proceed to version archiving; CONDITIONAL_PASS → proceed with documented caveats; FAIL → return to Phase 3 for revision.
|
|
182
|
+
|
|
183
|
+
### Version Archiving
|
|
184
|
+
|
|
185
|
+
Automated step, no user interaction. Trigger: Phase 3.6 result is PASS or CONDITIONAL_PASS.
|
|
186
|
+
|
|
187
|
+
**Pre-checks** (all must pass, otherwise abort):
|
|
188
|
+
1. All requirements (REQ-xxx) confirmed ✅
|
|
189
|
+
2. All scenarios (SC-xxx) confirmed ✅
|
|
190
|
+
3. All processes (BP-xxx) confirmed ✅
|
|
191
|
+
4. Phase 3.6 result is PASS or CONDITIONAL_PASS
|
|
192
|
+
|
|
193
|
+
**Processing**: batch-write all confirmed items to `requirement/ledger.md`; add archiving record with `archived` frontmatter; update `doc/active-registry/active-items.md` with current active items. Exit → ce-plan.
|
|
194
|
+
|
|
160
195
|
### Phase 4: Handoff
|
|
161
196
|
|
|
162
197
|
Read `references/handoff.md` — option set, visibility conditions, dispatch instructions all live there. Pass PRD path + prototype path (if loop ran) to `ce-plan`.
|
|
198
|
+
|
|
199
|
+
## Artifact Structure
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
requirement/
|
|
203
|
+
├── ledger.md # Master ledger (all items, cross-version summary)
|
|
204
|
+
├── vN/ # Iteration version
|
|
205
|
+
│ ├── prd.md # PRD document
|
|
206
|
+
│ ├── dialogue-log.md # Dialogue log (Phase 1.4 output)
|
|
207
|
+
│ └── business-analysis.md # Business analysis (requirements + scenarios + processes)
|
|
208
|
+
doc/
|
|
209
|
+
└── active-registry/
|
|
210
|
+
└── active-items.md # Current active items full view
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Status Management
|
|
214
|
+
|
|
215
|
+
Two statuses only: 🔵 pending confirmation / ✅ confirmed.
|
|
216
|
+
|
|
217
|
+
- Phase 1.5/1.6 confirmation: writes `business-analysis.md` only, no ledger update.
|
|
218
|
+
- Version archiving: batch-writes to `ledger.md`.
|
|
219
|
+
|
|
220
|
+
## Deprecation Handling
|
|
221
|
+
|
|
222
|
+
When a requirement/scenario/process is deprecated:
|
|
223
|
+
1. Remove the entry from `requirement/ledger.md`
|
|
224
|
+
2. Remove the entry details from `requirement/vN/business-analysis.md`
|
|
225
|
+
3. Update `doc/active-registry/active-items.md`
|
|
@@ -164,13 +164,42 @@ Extension dimensions follow the normal conditional-fill rules below.
|
|
|
164
164
|
of what was brainstormed.
|
|
165
165
|
- **§2 业务流程一览** — filled from brainstorm's Key Flows and Actors. Each
|
|
166
166
|
identified business process gets a row in the flow overview table.
|
|
167
|
+
|
|
168
|
+
**数据来源**:`requirement/vN/business-analysis.md` 业务流程一览表。
|
|
169
|
+
流程按四级层级组织:
|
|
170
|
+
- **L1 流程分组**:顶层业务域(如"采购管理""销售管理")
|
|
171
|
+
- **L2 业务过程**:分组下的端到端业务过程
|
|
172
|
+
- **L3 业务活动**:过程中的关键活动节点
|
|
173
|
+
- **L4 子流程/操作步骤**:活动内的具体操作
|
|
174
|
+
|
|
175
|
+
§2 总览表必须覆盖 business-analysis.md 中识别的全部 L1–L4 流程条目,
|
|
176
|
+
每个条目一行,保留原始层级编号(BP-xxx)。
|
|
167
177
|
- **§7 D7.5_系统功能清单** — filled from brainstorm's Requirements. Each
|
|
168
178
|
requirement maps to a system function entry.
|
|
169
179
|
|
|
180
|
+
**三 ID 关联规则**:每个系统功能条目必须标注三个关联 ID:
|
|
181
|
+
| 字段 | 说明 | 示例 |
|
|
182
|
+
|------|------|------|
|
|
183
|
+
| 关联需求 ID | 对应 PRD 中的需求编号 | REQ-xxx |
|
|
184
|
+
| 关联场景 ID | 对应的业务场景编号 | SC-xxx |
|
|
185
|
+
| 关联流程步骤 | 对应的业务流程活动编号 | BP-xxx |
|
|
186
|
+
|
|
187
|
+
三 ID 完整是 §7 的最低质量门槛——缺失任一 ID 的条目视为不完整,
|
|
188
|
+
需回溯 brainstorm 对话或 business-analysis.md 补齐。
|
|
189
|
+
|
|
170
190
|
### Conditionally filled (when dialogue covers the topic)
|
|
171
191
|
|
|
172
192
|
- **§3 D7.1_业务流程** — filled when brainstorm produced multi-step Key Flows
|
|
173
193
|
with enough detail for process diagrams.
|
|
194
|
+
|
|
195
|
+
**数据来源**:`requirement/vN/business-analysis.md` 流程详情部分。
|
|
196
|
+
每个流程包含:
|
|
197
|
+
- **Mermaid 流程图**:从 business-analysis.md 提取对应流程的 mermaid 定义,
|
|
198
|
+
保持活动节点与 BP-xxx 编号一致。
|
|
199
|
+
- **活动一览表**:列出该流程下所有活动节点,包含活动编号(BP-xxx)、
|
|
200
|
+
活动名称、触发条件、执行角色、输入/输出、业务规则。
|
|
201
|
+
|
|
202
|
+
§3 按流程逐一展开,流程编号与 §2 总览表对齐。
|
|
174
203
|
- **§4 D7.2_画面原型及设计** — filled when brainstorm involves UI/visual
|
|
175
204
|
components. Prototype references go here.
|
|
176
205
|
- **§6 D7.4_业务术语字典** — filled with domain terms defined during brainstorm
|
|
@@ -180,6 +209,17 @@ Extension dimensions follow the normal conditional-fill rules below.
|
|
|
180
209
|
§8.4 功能模块 from Requirements. Hardware/network/performance sections
|
|
181
210
|
retain placeholders.
|
|
182
211
|
|
|
212
|
+
**按流程组织结构**:§8 的功能模块按业务流程分组(BP-xxx),而非按
|
|
213
|
+
功能域平铺。每个功能模块必须标注所属流程:
|
|
214
|
+
```
|
|
215
|
+
### 8.4.x [功能模块名]
|
|
216
|
+
- **所属流程**:BP-xxx [流程名称]
|
|
217
|
+
- **关联需求**:REQ-xxx, REQ-xxx
|
|
218
|
+
- **关联场景**:SC-xxx
|
|
219
|
+
```
|
|
220
|
+
流程分组顺序与 §2 总览表、§3 流程详情保持一致。同一流程下的功能
|
|
221
|
+
模块紧邻排列,便于按流程维度审阅功能完整性。
|
|
222
|
+
|
|
183
223
|
### Always placeholder (belong to later processes)
|
|
184
224
|
|
|
185
225
|
- **§5 D7.3_报表清单** — retains template placeholder. Report details are
|
|
@@ -198,13 +238,15 @@ dialogue. Filling a chapter with placeholder content is worse than leaving it
|
|
|
198
238
|
as template placeholder.
|
|
199
239
|
|
|
200
240
|
- **§2 业务流程一览** — fill when brainstorm identified business processes,
|
|
201
|
-
user journeys, or system interactions.
|
|
202
|
-
|
|
241
|
+
user journeys, or system interactions. Data source: `requirement/vN/business-analysis.md`
|
|
242
|
+
流程清单 L1–L4 层级表。Each distinct process gets a row with its BP-xxx
|
|
243
|
+
编号, preserving the four-level hierarchy. Skip rows for processes not discussed.
|
|
203
244
|
|
|
204
245
|
- **§3 D7.1_业务流程** — fill when brainstorm produced detailed multi-step
|
|
205
|
-
flows with enough granularity for process diagrams.
|
|
206
|
-
|
|
207
|
-
|
|
246
|
+
flows with enough granularity for process diagrams. Data source:
|
|
247
|
+
`requirement/vN/business-analysis.md` 流程详情(mermaid 流程图 + 活动一览表)。
|
|
248
|
+
Include the mermaid flow diagram and activity table per process. Skip when
|
|
249
|
+
flows are high-level only.
|
|
208
250
|
|
|
209
251
|
- **§4 D7.2_画面原型及设计** — fill when brainstorm involves UI changes.
|
|
210
252
|
Include module names, page names, and prototype references. Skip entirely
|
|
@@ -216,12 +258,14 @@ as template placeholder.
|
|
|
216
258
|
|
|
217
259
|
- **§7 D7.5_系统功能清单** — fill from brainstorm Requirements. Each R-ID
|
|
218
260
|
maps to a system function entry with the requirement's intent as the function
|
|
219
|
-
description.
|
|
261
|
+
description. Each entry must annotate three IDs: 关联需求 ID (REQ-xxx) +
|
|
262
|
+
关联场景 ID (SC-xxx) + 关联流程步骤 (BP-xxx).
|
|
220
263
|
|
|
221
264
|
- **§8 D7.6_系统功能处理说明书** — partially fill §8.2 when dialogue covered
|
|
222
|
-
permissions, interactions, or exception handling. Fill §8.4 from Requirements
|
|
223
|
-
|
|
224
|
-
|
|
265
|
+
permissions, interactions, or exception handling. Fill §8.4 from Requirements,
|
|
266
|
+
organized by process (BP-xxx grouping): each function module annotates its
|
|
267
|
+
所属流程 (BP-xxx). Skip §8.3 (hardware/network) and §8.5 (non-functional)
|
|
268
|
+
unless the brainstorm explicitly covered these.
|
|
225
269
|
|
|
226
270
|
**§8.4 功能模块提取规则**:
|
|
227
271
|
- **详细程度**:保留原始需求文档中的关键细节,不要过度概括
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Phase 1.6 — Business Process Analysis
|
|
2
|
+
|
|
3
|
+
Detailed process derivation and structured output logic for Phase 1.6. The main SKILL.md describes the high-level flow; this reference contains step-level methodology, output formats, QA checks, and ledger rules.
|
|
4
|
+
|
|
5
|
+
## Trigger & Input
|
|
6
|
+
|
|
7
|
+
**Trigger**: Phase 1.5 completed (all scenarios confirmed).
|
|
8
|
+
**Tier**: All.
|
|
9
|
+
**Nature**: Analysis + user confirmation loop until confirmed.
|
|
10
|
+
|
|
11
|
+
**Input**:
|
|
12
|
+
- `requirement/vN/business-analysis.md` — confirmed scenarios with IDs (✅ SC-xxx)
|
|
13
|
+
- `requirement/ledger.md` — archived process records from prior versions
|
|
14
|
+
|
|
15
|
+
## Step 1: Derive Processes from Scenarios
|
|
16
|
+
|
|
17
|
+
For each confirmed scenario, derive a step sequence using BPMN thinking:
|
|
18
|
+
|
|
19
|
+
- **Roles / swimlanes**: identify all actors (human, system, external)
|
|
20
|
+
- **Activities**: discrete work units each actor performs
|
|
21
|
+
- **Events**: start event, intermediate events, end event
|
|
22
|
+
- **Gateways**: decision points that branch the flow (exclusive / parallel / inclusive)
|
|
23
|
+
|
|
24
|
+
Produce one draft process per scenario. A scenario may map to one or more L4 sub-processes.
|
|
25
|
+
|
|
26
|
+
## Step 2: Compare Against Existing Processes
|
|
27
|
+
|
|
28
|
+
Read both sources:
|
|
29
|
+
|
|
30
|
+
1. `requirement/ledger.md` — archived processes from prior versions
|
|
31
|
+
2. `requirement/vN/business-analysis.md` — processes already documented in the current version
|
|
32
|
+
|
|
33
|
+
Classify each draft process:
|
|
34
|
+
|
|
35
|
+
| Outcome | Action |
|
|
36
|
+
|---------|--------|
|
|
37
|
+
| New process | Create entry with status 🔵 待确认 |
|
|
38
|
+
| Optimised process | Create a changed version in current `business-analysis.md` |
|
|
39
|
+
| Unchanged | Skip — no entry needed |
|
|
40
|
+
|
|
41
|
+
## Step 3: Structured Output (Three Forms)
|
|
42
|
+
|
|
43
|
+
### 3.1 L1–L4 Classification Table
|
|
44
|
+
|
|
45
|
+
Fill the business process overview table (aligns with PRD §2):
|
|
46
|
+
|
|
47
|
+
| L1 Group | L2 Category | L3 Process | L4 Sub-process | Status | Related Scenarios |
|
|
48
|
+
|----------|-------------|------------|----------------|--------|-------------------|
|
|
49
|
+
|
|
50
|
+
**Hierarchy**: L1 → L2 → L3 → L4. L3 is a collection of L4 sub-processes. Each ledger record corresponds to one L4. **L4 is the minimum recording unit.**
|
|
51
|
+
|
|
52
|
+
### 3.2 Process Flow Diagram
|
|
53
|
+
|
|
54
|
+
Output a mermaid flowchart for each L4 sub-process:
|
|
55
|
+
|
|
56
|
+
```mermaid
|
|
57
|
+
flowchart TB
|
|
58
|
+
subgraph RoleA[Role A]
|
|
59
|
+
A1[Step 1] --> A2[Step 2]
|
|
60
|
+
end
|
|
61
|
+
subgraph RoleB[Role B]
|
|
62
|
+
B1[Step 3] --> B2{Decision}
|
|
63
|
+
B2 -->|Yes| B3[Step 4]
|
|
64
|
+
B2 -->|No| B4[Exception]
|
|
65
|
+
end
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Rules**: Must use `flowchart TB`; must partition by role swimlanes (`subgraph`); every gateway must label all branches; exception paths must terminate explicitly.
|
|
69
|
+
|
|
70
|
+
### 3.3 Activity Table (9 Columns — Hard Constraint)
|
|
71
|
+
|
|
72
|
+
One table per L4 sub-process:
|
|
73
|
+
|
|
74
|
+
| Step | Activity | Execution Steps | Role | Trigger | Input | Output | Related Function | Exception Handling |
|
|
75
|
+
|------|----------|-----------------|------|---------|-------|--------|------------------|--------------------|
|
|
76
|
+
|
|
77
|
+
**All 9 columns are mandatory.** "Execution Steps" describes the concrete actions within each activity — must not be empty. "Related Function" references FUNC-xxx IDs or is marked "TBD". "Exception Handling" must cover every exception branch visible in the flow diagram.
|
|
78
|
+
|
|
79
|
+
### 3.4 Process Attribute Block
|
|
80
|
+
|
|
81
|
+
Each L4 sub-process carries a property header:
|
|
82
|
+
|
|
83
|
+
| Field | Description |
|
|
84
|
+
|-------|-------------|
|
|
85
|
+
| Process ID | BP-xxx |
|
|
86
|
+
| Status | 🔵 待确认 / ✅ 已确认 |
|
|
87
|
+
| L1 / L2 / L3 / L4 | Full classification path |
|
|
88
|
+
| Related Scenarios | SC-xxx IDs |
|
|
89
|
+
| Trigger Event | What initiates the process |
|
|
90
|
+
| End Condition | What terminates the process |
|
|
91
|
+
| Involved Roles | All actors |
|
|
92
|
+
|
|
93
|
+
## Step 4: Reverse Reference Update
|
|
94
|
+
|
|
95
|
+
After producing the three output forms, update `business-analysis.md`:
|
|
96
|
+
|
|
97
|
+
- Each scenario's "Related Process" field → list associated BP-xxx IDs
|
|
98
|
+
- Each requirement's "Related Process" field → list associated BP-xxx IDs
|
|
99
|
+
|
|
100
|
+
**Do not update `ledger.md`.** Ledger entries are written in bulk during version archiving, not during analysis.
|
|
101
|
+
|
|
102
|
+
## Step 4.5: QA-2 Process Quality Check
|
|
103
|
+
|
|
104
|
+
Dispatch `process-quality-checker` sub-agent. Evaluate 9 checks:
|
|
105
|
+
|
|
106
|
+
| ID | Category | Check | Severity |
|
|
107
|
+
|----|----------|-------|----------|
|
|
108
|
+
| C1 | Completeness | Every confirmed scenario (✅ SC-xxx) has ≥1 related process | Error |
|
|
109
|
+
| C2 | Completeness | Every process has L1–L4 fully filled (L4 non-empty) | Error |
|
|
110
|
+
| C3 | Completeness | Every process has a mermaid flow diagram | Error |
|
|
111
|
+
| C4 | Completeness | Activity table has 9 columns and every step has "Execution Steps" filled | Error |
|
|
112
|
+
| C5 | Consistency | Process "Related Scenarios" IDs exist in the scenario registry | Error |
|
|
113
|
+
| C6 | Consistency | Flow diagram steps correspond 1:1 with activity table steps | Error |
|
|
114
|
+
| C7 | Consistency | Reverse references complete — related scenarios' "Related Process" field updated | Warning |
|
|
115
|
+
| C8 | Accuracy | Exception handling covers all exception branches in the flow diagram | Warning |
|
|
116
|
+
| C9 | Accuracy | "Related Function" IDs are valid (FUNC-xxx exists or marked TBD) | Warning |
|
|
117
|
+
|
|
118
|
+
**Routing**: All Error checks PASS → proceed to Step 5. Any Error FAIL → return to correct (max 3 rounds). Warnings are reported but do not block.
|
|
119
|
+
|
|
120
|
+
## Step 5: Display & Confirmation
|
|
121
|
+
|
|
122
|
+
Present all three output forms to the user as a blocking question:
|
|
123
|
+
|
|
124
|
+
- ✅ **Confirmed** → upgrade status to ✅ 已确认; write into current version `business-analysis.md`; exit (no ledger update).
|
|
125
|
+
- ✏️ **Adjust** → apply feedback; return to Step 3; loop until confirmed.
|
|
126
|
+
|
|
127
|
+
## Write Rules
|
|
128
|
+
|
|
129
|
+
| Target | When | What |
|
|
130
|
+
|--------|------|------|
|
|
131
|
+
| `business-analysis.md` (current version) | On confirmation | Process details + reverse references |
|
|
132
|
+
| `ledger.md` | Never during Phase 1.6 | Bulk-written at version archiving only |
|
|
133
|
+
|
|
134
|
+
## Deprecation Handling
|
|
135
|
+
|
|
136
|
+
When a process is deprecated, execute all three steps:
|
|
137
|
+
|
|
138
|
+
1. Delete the record from `ledger.md`
|
|
139
|
+
2. Delete the detail block from the version's `business-analysis.md`
|
|
140
|
+
3. Update `doc/active-registry/active-items.md`
|