dsh-harness-kit 0.1.0 → 0.1.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/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/client.js +145 -7
- package/kernel/commands.js +3 -3
- package/kernel/flows.js +3 -0
- package/kernel/panel.js +25 -1
- package/kernel/setup.js +20 -0
- package/kernel/worktree.js +63 -10
- package/package.json +1 -1
- package/packs/ai-coding/agents/project-manager.md +4 -4
- package/packs/ai-coding/assets/scripts/harness_init.py +0 -2
- package/packs/ai-coding/assets/scripts/lib.py +27 -1
- package/packs/ai-coding/flows/bugfix.yml +2 -2
- package/packs/ai-coding/flows/fix.yml +1 -1
- package/packs/ai-coding/flows/new.yml +1 -1
- package/packs/ai-coding/flows/quick.yml +2 -2
- package/packs/ai-coding/flows/refactor.yml +2 -2
- package/packs/ai-coding/flows/standard.yml +2 -2
- package/packs/ai-coding/rules/core.md +1 -0
package/README.md
CHANGED
|
@@ -234,7 +234,7 @@ go only to the provider you configure.
|
|
|
234
234
|
**Plugins → Add plugin**, then enter:
|
|
235
235
|
|
|
236
236
|
```
|
|
237
|
-
dsh-harness-kit@0.1.
|
|
237
|
+
dsh-harness-kit@0.1.1
|
|
238
238
|
```
|
|
239
239
|
|
|
240
240
|
Enable the bundle after installation.
|
|
@@ -242,7 +242,7 @@ Enable the bundle after installation.
|
|
|
242
242
|
### Command line
|
|
243
243
|
|
|
244
244
|
```sh
|
|
245
|
-
dsh plugin --profile desktop add dsh-harness-kit@0.1.
|
|
245
|
+
dsh plugin --profile desktop add dsh-harness-kit@0.1.1
|
|
246
246
|
```
|
|
247
247
|
|
|
248
248
|
Quit DSH Desktop first; replace `desktop` with your profile name for other profiles.
|
package/README.zh-CN.md
CHANGED
|
@@ -200,7 +200,7 @@ AI 写得越快,需要看的越多。固定角色让 CR/TE 各自只做一件
|
|
|
200
200
|
**Plugins → Add plugin**,输入:
|
|
201
201
|
|
|
202
202
|
```
|
|
203
|
-
dsh-harness-kit@0.1.
|
|
203
|
+
dsh-harness-kit@0.1.1
|
|
204
204
|
```
|
|
205
205
|
|
|
206
206
|
安装后启用 bundle。
|
|
@@ -208,7 +208,7 @@ dsh-harness-kit@0.1.0
|
|
|
208
208
|
### 命令行
|
|
209
209
|
|
|
210
210
|
```sh
|
|
211
|
-
dsh plugin --profile desktop add dsh-harness-kit@0.1.
|
|
211
|
+
dsh plugin --profile desktop add dsh-harness-kit@0.1.1
|
|
212
212
|
```
|
|
213
213
|
|
|
214
214
|
需要先完全退出 DSH Desktop;其他 profile 把 `desktop` 换成实际名称。
|
package/client.js
CHANGED
|
@@ -142,9 +142,33 @@ window.__ModuleLoader__.load({
|
|
|
142
142
|
|
|
143
143
|
function Icon(props) {
|
|
144
144
|
const size = (props && props.size) || 20;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
// 侧栏常驻提醒:任一工作区有「需要你」项时,在图标角上点一个红点,
|
|
146
|
+
// 用户即使不打开插件也能注意到;会话内的详细提示见 AttentionDock。
|
|
147
|
+
const [alert, setAlert] = useState(false);
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
let cancelled = false;
|
|
150
|
+
const load = () => {
|
|
151
|
+
fetch('/harness-kit/state').then((r) => r.json()).then((json) => {
|
|
152
|
+
if (cancelled || !json?.ok) return;
|
|
153
|
+
setAlert((json.workspaces ?? []).some((w) => (w.attention ?? []).length > 0));
|
|
154
|
+
}).catch(() => { /* 网络抖动忽略 */ });
|
|
155
|
+
};
|
|
156
|
+
void load();
|
|
157
|
+
const timer = setInterval(load, 15000);
|
|
158
|
+
return () => { cancelled = true; clearInterval(timer); };
|
|
159
|
+
}, []);
|
|
160
|
+
return h('span', { style: { position: 'relative', display: 'inline-block', width: size, height: size, lineHeight: 0 } },
|
|
161
|
+
h('svg', { viewBox: '0 0 24 24', width: size, height: size, 'aria-hidden': true, style: { display: 'block' } },
|
|
162
|
+
h('path', { d: 'M4 5h16M4 12h16M4 19h10', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', fill: 'none' }),
|
|
163
|
+
h('circle', { cx: 19, cy: 19, r: 2.4, fill: 'currentColor' })),
|
|
164
|
+
alert && h('span', {
|
|
165
|
+
'aria-hidden': true,
|
|
166
|
+
className: 'hk-alert-dot',
|
|
167
|
+
style: {
|
|
168
|
+
position: 'absolute', top: -1, right: -1, width: 7, height: 7, borderRadius: '50%',
|
|
169
|
+
background: V.err, boxShadow: `0 0 0 1px ${V.bg}`,
|
|
170
|
+
},
|
|
171
|
+
}));
|
|
148
172
|
}
|
|
149
173
|
|
|
150
174
|
// 看板链词表 → 中文显示名(证据推导路径的阶段名本身即中文,原样通过)
|
|
@@ -174,6 +198,96 @@ window.__ModuleLoader__.load({
|
|
|
174
198
|
}));
|
|
175
199
|
}
|
|
176
200
|
|
|
201
|
+
// 会话内工作区提醒:与面板「需要你」同源的 attention,常驻在输入框上方;
|
|
202
|
+
// 用户不打开插件也能看到阻塞项(工作区裁决/同步落后/待归档/初始化缺件)。
|
|
203
|
+
function AttentionDock({ session, ctx }) {
|
|
204
|
+
const sessionId = session?.sessionId ?? session?.id ?? null;
|
|
205
|
+
const [data, setData] = useState(null);
|
|
206
|
+
const [busy, setBusy] = useState(false);
|
|
207
|
+
const [note, setNote] = useState(null);
|
|
208
|
+
const [expanded, setExpanded] = useState(false);
|
|
209
|
+
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
if (!sessionId) { setData(null); return undefined; }
|
|
212
|
+
let cancelled = false;
|
|
213
|
+
const load = async () => {
|
|
214
|
+
try {
|
|
215
|
+
const res = await fetch('/harness-kit/state');
|
|
216
|
+
const json = await res.json();
|
|
217
|
+
if (cancelled || !json?.ok) return;
|
|
218
|
+
const ws = (json.workspaces ?? []).find((w) => (w.sessions ?? []).some((s) => s.id === sessionId));
|
|
219
|
+
const items = ws?.attention ?? [];
|
|
220
|
+
setData(items.length > 0 ? { ws, items } : null);
|
|
221
|
+
} catch { /* 网络抖动:保留上一条提醒 */ }
|
|
222
|
+
};
|
|
223
|
+
void load();
|
|
224
|
+
const timer = setInterval(() => { void load(); }, 15000);
|
|
225
|
+
return () => { cancelled = true; clearInterval(timer); };
|
|
226
|
+
}, [sessionId]);
|
|
227
|
+
|
|
228
|
+
if (!data) return null;
|
|
229
|
+
const { ws, items } = data;
|
|
230
|
+
const level = items.some((a) => a.level === 'block') ? 'block' : 'warn';
|
|
231
|
+
const color = level === 'block' ? V.err : V.warn;
|
|
232
|
+
const shown = expanded ? items : items.slice(0, 1);
|
|
233
|
+
|
|
234
|
+
const post = async (url, body) => {
|
|
235
|
+
setBusy(true);
|
|
236
|
+
setNote(null);
|
|
237
|
+
try {
|
|
238
|
+
const res = await fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) });
|
|
239
|
+
const json = await res.json();
|
|
240
|
+
setNote(json?.ok ? '已提交,等待执行结果…' : (json?.error || '操作失败'));
|
|
241
|
+
} catch (e) {
|
|
242
|
+
setNote(String(e?.message ?? e));
|
|
243
|
+
} finally {
|
|
244
|
+
setBusy(false);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
const run = (line) => post('/harness-kit/command', { workspace: ws.id, line, sessionId });
|
|
248
|
+
const syncNow = () => post('/harness-kit/sync', { workspace: ws.id });
|
|
249
|
+
const openPanel = () => { try { ctx.get('layout')?.selectPanel?.('harness-kit'); } catch { /* ignore */ } };
|
|
250
|
+
const jump = (task) => {
|
|
251
|
+
const t = (ws.tasks ?? []).find((x) => x.task === task);
|
|
252
|
+
if (t?.sessionId) { try { ctx.get('uiWorkspace')?.openSession?.(t.sessionId); } catch { /* ignore */ } }
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const btn = (label, onClick, primary) => h('button', {
|
|
256
|
+
style: S.btn(busy, primary), disabled: busy, title: label, onClick,
|
|
257
|
+
}, label);
|
|
258
|
+
|
|
259
|
+
return h('div', {
|
|
260
|
+
className: 'hk-attention-dock',
|
|
261
|
+
style: {
|
|
262
|
+
width: '100%', boxSizing: 'border-box', padding: '8px 12px', marginBottom: 8,
|
|
263
|
+
borderRadius: 8, fontSize: 12, lineHeight: 1.5,
|
|
264
|
+
background: `color-mix(in srgb, ${color} 10%, transparent)`,
|
|
265
|
+
border: `1px solid color-mix(in srgb, ${color} 35%, transparent)`,
|
|
266
|
+
borderLeft: `3px solid ${color}`,
|
|
267
|
+
color: V.text,
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' } },
|
|
271
|
+
h('span', { style: { color, fontWeight: 600 } }, level === 'block' ? '⛔ 工作区提醒' : '⚠️ 工作区提醒'),
|
|
272
|
+
h('span', { style: { color: V.sub, fontSize: 11 } }, `${items.length} 项`),
|
|
273
|
+
h('span', { style: { flex: 1 } }),
|
|
274
|
+
items.length > 1 && btn(expanded ? '收起' : '展开全部', () => setExpanded((v) => !v), false),
|
|
275
|
+
btn('打开面板', openPanel, false)),
|
|
276
|
+
shown.map((a, i) => h('div', { key: i, style: { marginTop: 4 } },
|
|
277
|
+
h('div', {
|
|
278
|
+
style: expanded
|
|
279
|
+
? { whiteSpace: 'pre-wrap', color: V.text }
|
|
280
|
+
: { display: '-webkit-box', WebkitLineClamp: 2, WebkitBoxOrient: 'vertical', overflow: 'hidden', color: V.text },
|
|
281
|
+
}, a.text),
|
|
282
|
+
h('div', { style: { display: 'flex', gap: 6, marginTop: 4, flexWrap: 'wrap' } },
|
|
283
|
+
(a.options ?? []).map((o) => btn(o.label, () => run(o.line), o.primary)),
|
|
284
|
+
a.line && !(a.options ?? []).length && btn('处理', () => run(a.line), true),
|
|
285
|
+
a.sync && btn('立即同步', syncNow, true),
|
|
286
|
+
a.init && btn('运行初始化', () => run('/hk-init'), true),
|
|
287
|
+
a.jump && a.task && btn('转到会话', () => jump(a.task), false)))),
|
|
288
|
+
note && h('div', { style: { marginTop: 4, fontSize: 11, color: V.sub } }, note));
|
|
289
|
+
}
|
|
290
|
+
|
|
177
291
|
function Panel({ uiWorkspace }) {
|
|
178
292
|
const [data, setData] = useState(null);
|
|
179
293
|
// 工作区选择记忆:打开插件时恢复上次选择的工作区(而非列表第一个)
|
|
@@ -692,18 +806,20 @@ window.__ModuleLoader__.load({
|
|
|
692
806
|
},
|
|
693
807
|
}, `${e.kind === 'dir' ? '📁' : '📄'} ${e.name}`))
|
|
694
808
|
: h('div', { style: { color: V.sub, padding: '4px 2px' } }, '(空目录)')))),
|
|
695
|
-
//
|
|
809
|
+
// 开发基线(可选):各仓分支选择 → /hk-new --base;既是开发分支基点,也是分析基点与归档合入目标
|
|
696
810
|
Object.keys(ws?.gitBranches ?? {}).length > 0 && h('div', { style: S.field },
|
|
697
|
-
h('label', { style: S.label }, '
|
|
811
|
+
h('label', { style: S.label }, '开发基线(可选,留空 = 仓库默认基线)'),
|
|
698
812
|
Object.entries(ws.gitBranches).map(([repo, branches]) => h('div', { key: repo, style: { display: 'flex', gap: 6, alignItems: 'center', marginBottom: 4 } },
|
|
699
813
|
h('span', { style: { minWidth: 90, fontSize: 12, color: V.sub } }, repo),
|
|
700
814
|
h(Combobox, {
|
|
701
815
|
style: { flex: 1 },
|
|
702
816
|
value: (modal.base ?? {})[repo] ?? '',
|
|
703
|
-
placeholder: '
|
|
817
|
+
placeholder: '默认(仓库基线)',
|
|
704
818
|
options: branches ?? [],
|
|
705
819
|
onChange: (v) => setModal({ ...modal, base: { ...(modal.base ?? {}), [repo]: v } }),
|
|
706
|
-
})))
|
|
820
|
+
}))),
|
|
821
|
+
h('div', { style: { fontSize: 11, color: V.sub, marginTop: 2 } },
|
|
822
|
+
'内核会从所选基线新建 feat/harness-<任务> 开发分支;归档默认合回该基线,同时作为 BA/SA/RR 的分析基点。')),
|
|
707
823
|
h('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' } },
|
|
708
824
|
h('button', { style: S.btn(false), onClick: () => { setModal(null); setBrowse(null); } }, '取消'),
|
|
709
825
|
h('button', {
|
|
@@ -736,10 +852,12 @@ window.__ModuleLoader__.load({
|
|
|
736
852
|
const [branches, setBranches] = useState(() => Object.fromEntries((k.sources ?? []).map((s) => [s.name, s.branch ?? ''])));
|
|
737
853
|
const [autoSync, setAutoSync] = useState(k.assets?.autoSync === true);
|
|
738
854
|
const [models, setModels] = useState(() => Object.entries(k.models ?? {}).map(([name, m]) => ({ name, provider: m.provider ?? '', model: m.model ?? '' })));
|
|
855
|
+
const [applyMode, setApplyMode] = useState(k.applyMode ?? 'auto');
|
|
739
856
|
useEffect(() => {
|
|
740
857
|
setBranches(Object.fromEntries((k.sources ?? []).map((s) => [s.name, s.branch ?? ''])));
|
|
741
858
|
setAutoSync(k.assets?.autoSync === true);
|
|
742
859
|
setModels(Object.entries(k.models ?? {}).map(([name, m]) => ({ name, provider: m.provider ?? '', model: m.model ?? '' })));
|
|
860
|
+
setApplyMode(k.applyMode ?? 'auto');
|
|
743
861
|
}, [ws.id]);
|
|
744
862
|
const kv = (label, value) => h('div', { style: S.kv }, h('span', { style: { color: V.sub, minWidth: 96 } }, label), h('span', null, value ?? '—'));
|
|
745
863
|
|
|
@@ -779,6 +897,23 @@ window.__ModuleLoader__.load({
|
|
|
779
897
|
style: S.btn(busy, true), disabled: busy,
|
|
780
898
|
onClick: () => saveConfig({ sources: k.sources.map((s) => ({ name: s.name, branch: branches[s.name] ?? s.branch })) }, '基线分支已保存'),
|
|
781
899
|
}, '保存分支')),
|
|
900
|
+
// 流程模式(原 .harness/config.json 的 apply-mode,已并入 kit.json)
|
|
901
|
+
h('div', { style: S.section },
|
|
902
|
+
h('div', { style: S.secTitle }, '流程模式'),
|
|
903
|
+
h('div', { style: { fontSize: 12, color: V.sub, marginBottom: 8 } },
|
|
904
|
+
'applyMode 决定 CR 通过后是否进入人工审查点(review = CR PASS 后暂停等人工审查,auto = 直接进 TE)。'),
|
|
905
|
+
k.legacyConfig && h('div', { style: { ...S.attn('warn'), marginBottom: 8 } },
|
|
906
|
+
h('span', null, '🟠'),
|
|
907
|
+
h('span', { style: { flex: 1 } },
|
|
908
|
+
`检测到旧 .harness/config.json(apply-mode=${k.legacyConfig.applyMode ?? '—'}, mainline-branch=${k.legacyConfig.mainlineBranch ?? '—'}):保存本区后即覆盖到 kit.json,重跑初始化会自动删除旧文件`)),
|
|
909
|
+
h('div', { style: { display: 'flex', gap: 14, alignItems: 'center', marginBottom: 8, fontSize: 12 } },
|
|
910
|
+
['auto', 'review'].map((m) => h('label', { key: m, style: { display: 'flex', gap: 6, alignItems: 'center', cursor: 'pointer' } },
|
|
911
|
+
h('input', { type: 'radio', name: 'hk-apply-mode', checked: applyMode === m, onChange: () => setApplyMode(m) }),
|
|
912
|
+
h('span', null, m === 'auto' ? 'auto(CR PASS 直接进 TE)' : 'review(CR PASS 暂停等人工审查)'))),
|
|
913
|
+
h('button', {
|
|
914
|
+
style: S.btn(busy, true), disabled: busy,
|
|
915
|
+
onClick: () => saveConfig({ applyMode }, '流程配置已保存'),
|
|
916
|
+
}, '保存'))),
|
|
782
917
|
h('div', { style: S.section },
|
|
783
918
|
h('div', { style: S.secTitle }, '自动同步'),
|
|
784
919
|
h('label', { style: { display: 'flex', gap: 8, alignItems: 'center', fontSize: 12, marginBottom: 8, cursor: 'pointer' } },
|
|
@@ -1263,6 +1398,9 @@ window.__ModuleLoader__.load({
|
|
|
1263
1398
|
ctx.slots.inject('sidebar.panellist', () => ctx.slots.register({
|
|
1264
1399
|
name: 'sidebar.panellist', id: 'harness-kit', order: 20,
|
|
1265
1400
|
}, Icon));
|
|
1401
|
+
ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({
|
|
1402
|
+
name: 'conversation.input.dock', id: 'harness-kit-attention', order: 5,
|
|
1403
|
+
}, (props) => h(AttentionDock, { ...props, ctx })));
|
|
1266
1404
|
ctx.slots.inject('main', () => ctx.slots.register({
|
|
1267
1405
|
name: 'main', key: 'harness-kit', id: 'harness-kit',
|
|
1268
1406
|
}, (props) => h(Panel, { ...props, uiWorkspace: ctx.get('uiWorkspace') })));
|
package/kernel/commands.js
CHANGED
|
@@ -388,7 +388,7 @@ async function hkNew({ agent, rawInput }) {
|
|
|
388
388
|
.replaceAll('{{source}}', reqFile === '(无)' ? '描述' : '描述+文件')
|
|
389
389
|
.replaceAll('{{file}}', reqFile);
|
|
390
390
|
fs.writeFileSync(path.join(taskDir, 'proposal.md'), doc, 'utf8');
|
|
391
|
-
// --base
|
|
391
|
+
// --base 开发基线(同时是分析基点与归档合入目标):落盘 spec + 立即建任务专属分析工作区(propose 时幂等复用)
|
|
392
392
|
let baseNote = '';
|
|
393
393
|
if (typeof flags.base === 'string') {
|
|
394
394
|
const spec = parseBaseSpec(flags.base);
|
|
@@ -397,7 +397,7 @@ async function hkNew({ agent, rawInput }) {
|
|
|
397
397
|
const parts = [];
|
|
398
398
|
if (ta.created.length > 0) parts.push(`新建专属分析区:${ta.created.map((w) => `${w.source}@${w.branch}`).join('、')}`);
|
|
399
399
|
if (ta.reused.length + ta.switched.length > 0) parts.push(`复用/切换专属分析区:${[...ta.reused, ...ta.switched].map((w) => w.source).join('、')}`);
|
|
400
|
-
if (ta.worktrees.length > 0) parts.push(
|
|
400
|
+
if (ta.worktrees.length > 0) parts.push(`开发基线(分析基点):${ta.worktrees.map((w) => `${w.source}→${w.branch}(${w.sha})`).join(';')}`);
|
|
401
401
|
parts.push(...ta.notes);
|
|
402
402
|
baseNote = `\n- ${parts.join('\n- ')}`;
|
|
403
403
|
}
|
|
@@ -436,7 +436,7 @@ async function hkPropose({ agent, rawInput }) {
|
|
|
436
436
|
const kit = readKit(ws);
|
|
437
437
|
if (!kit) return err('尚未初始化:请先运行 `/hk-init`。');
|
|
438
438
|
const { flags, positional } = parseArgs(rawInput);
|
|
439
|
-
const inferred = inferTask(ws, positional, '用法:/hk-propose [任务名] [--base <仓:分支,…>](省略任务名时要求唯一活跃任务;--base
|
|
439
|
+
const inferred = inferTask(ws, positional, '用法:/hk-propose [任务名] [--base <仓:分支,…>](省略任务名时要求唯一活跃任务;--base=按仓指定开发基线,同时作为分析基点与归档合入目标,如 backend:release/1.2)');
|
|
440
440
|
if (inferred.error) return err(inferred.error);
|
|
441
441
|
const task = inferred.task;
|
|
442
442
|
const taskDir = path.join(harnessDir(ws), 'deliverables', task);
|
package/kernel/flows.js
CHANGED
|
@@ -39,6 +39,9 @@ function stageLines(flow, context) {
|
|
|
39
39
|
if (Array.isArray(stage.do)) for (const item of stage.do) body.push(`- ${item}`);
|
|
40
40
|
if (stage.gate) body.push(`- ⛔ 人工质量门:${stage.gate} —— 用 ask_user_question 工具交人裁决,禁止自行决定`);
|
|
41
41
|
if (stage.approval) body.push(`- ⛔ 审批点:${stage.approval} —— 用 ask_user_question 交人审批后方可继续`);
|
|
42
|
+
if (stage.gate || stage.approval) {
|
|
43
|
+
body.push('- ⛔ 审批材料必须可见:先发普通 assistant 消息(非 reasoning),用 Markdown 链接列出本轮产物;ask_user_question 的 question 也要带链接;present 卡片本轮结束后才出现,不能替代等待回答前的链接。');
|
|
44
|
+
}
|
|
42
45
|
lines.push([head, ...body].join('\n'));
|
|
43
46
|
}
|
|
44
47
|
return lines.join('\n\n');
|
package/kernel/panel.js
CHANGED
|
@@ -320,6 +320,11 @@ export function updateKit(ws, patch) {
|
|
|
320
320
|
kit.assets = kit.assets ?? { mode: 'local' };
|
|
321
321
|
kit.assets.autoSync = patch.autoSync;
|
|
322
322
|
}
|
|
323
|
+
// 流程配置(2026-11-18 从 .harness/config.json 迁入 kit.json,面板设置页可改)
|
|
324
|
+
if (patch.applyMode !== undefined) {
|
|
325
|
+
if (!['auto', 'review'].includes(patch.applyMode)) return { error: "applyMode 必须是 'auto' 或 'review'" };
|
|
326
|
+
kit.applyMode = patch.applyMode;
|
|
327
|
+
}
|
|
323
328
|
if (patch.models !== undefined) {
|
|
324
329
|
if (typeof patch.models !== 'object' || patch.models === null || Array.isArray(patch.models)) {
|
|
325
330
|
return { error: 'models 必须是对象' };
|
|
@@ -394,6 +399,16 @@ export function workspaceState(ws, { sync = null } = {}) {
|
|
|
394
399
|
};
|
|
395
400
|
}
|
|
396
401
|
|
|
402
|
+
/** 旧版 .harness/config.json(仅用于设置页提示迁移;新配置一律写 kit.json)。 */
|
|
403
|
+
function readLegacyConfig(ws) {
|
|
404
|
+
try {
|
|
405
|
+
const p = path.join(harnessDir(ws), 'config.json');
|
|
406
|
+
if (!fs.existsSync(p)) return null;
|
|
407
|
+
const raw = JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
408
|
+
return { applyMode: raw['apply-mode'] ?? null, mainlineBranch: raw['mainline-branch'] ?? null };
|
|
409
|
+
} catch { return null; }
|
|
410
|
+
}
|
|
411
|
+
|
|
397
412
|
// ---------------------------------------------------------- 初始化进度(向导动态提示)
|
|
398
413
|
// wsPath → { stage, detail, startedAt, done, error };仅内存态,进程重启即清空
|
|
399
414
|
const initProgress = new Map();
|
|
@@ -707,7 +722,16 @@ export function registerPanelApi(ctx) {
|
|
|
707
722
|
if (!kit) return sendJson(res, 404, { ok: false, error: '尚未初始化' });
|
|
708
723
|
sendJson(res, 200, {
|
|
709
724
|
ok: true,
|
|
710
|
-
kit: {
|
|
725
|
+
kit: {
|
|
726
|
+
pack: kit.pack ?? 'ai-coding',
|
|
727
|
+
hosts: kit.hosts ?? [],
|
|
728
|
+
sources: kit.sources ?? [],
|
|
729
|
+
models: kit.models ?? {},
|
|
730
|
+
assets: kit.assets ?? { mode: 'local' },
|
|
731
|
+
// 流程配置(原 .harness/config.json,2026-11-18 迁入 kit.json)
|
|
732
|
+
applyMode: kit.applyMode ?? 'auto',
|
|
733
|
+
legacyConfig: readLegacyConfig(ws.path),
|
|
734
|
+
},
|
|
711
735
|
sync: syncHealth(ws.path),
|
|
712
736
|
catalog: await listModelCatalog(llm),
|
|
713
737
|
presetModels: logicalModelNames(kit),
|
package/kernel/setup.js
CHANGED
|
@@ -383,6 +383,26 @@ export async function runInit(ws, { assets, branch, sources = [], onProgress } =
|
|
|
383
383
|
fs.appendFileSync(giPath, '# pack 管理运行时(/hk-init 每次刷新,勿手改、勿提交)\nscripts/\n', 'utf8');
|
|
384
384
|
created.push('.harness/.gitignore(追加 scripts/ 排除)');
|
|
385
385
|
}
|
|
386
|
+
// 存量迁移:旧 .harness/config.json(apply-mode / mainline-branch)并入 kit.json 并删除
|
|
387
|
+
// (2026-11-18:流程配置统一收进 kit.json,由面板设置页管理;旧文件只做一次性迁移)
|
|
388
|
+
{
|
|
389
|
+
const legacyPath = path.join(hd, 'config.json');
|
|
390
|
+
if (fs.existsSync(legacyPath)) {
|
|
391
|
+
try {
|
|
392
|
+
const legacy = JSON.parse(fs.readFileSync(legacyPath, 'utf8'));
|
|
393
|
+
const applyMode = legacy['apply-mode'];
|
|
394
|
+
const k = readKit(ws) ?? defaultKit();
|
|
395
|
+
let changed = false;
|
|
396
|
+
if ((applyMode === 'auto' || applyMode === 'review') && k.applyMode === undefined) { k.applyMode = applyMode; changed = true; }
|
|
397
|
+
if (changed) writeKit(ws, k);
|
|
398
|
+
fs.rmSync(legacyPath, { force: true });
|
|
399
|
+
created.push('.harness/config.json 已迁入 kit.json(applyMode;主线分支改用 sources[].branch)并删除旧文件');
|
|
400
|
+
} catch (cause) {
|
|
401
|
+
warnings.push(`旧 config.json 迁移失败(${cause.message}),文件保留:请手工把 apply-mode/mainline-branch 填入 kit.json 后删除`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
386
406
|
// 存量迁移:本机状态文件(会话绑定/续接点火/工作区分配/决策点/环境租约)不入资产库
|
|
387
407
|
const LOCAL_STATE = ['tasks/sessions.json', 'tasks/auto-advance.json', 'tasks/worktrees.json', 'tasks/decisions.json', 'tasks/test-env.json'];
|
|
388
408
|
if (fs.existsSync(giPath)) {
|
package/kernel/worktree.js
CHANGED
|
@@ -118,6 +118,28 @@ async function currentBranch(repoDir) {
|
|
|
118
118
|
return r.code === 0 ? r.stdout.trim() : '';
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
/** 归档释放时切回基线:远端基线优先落成本地同名分支,避免 detached HEAD。 */
|
|
122
|
+
async function checkoutBaseBranch(repoDir, base) {
|
|
123
|
+
const fallback = base ?? 'dev';
|
|
124
|
+
const local = fallback.startsWith('origin/') ? fallback.slice('origin/'.length) : fallback;
|
|
125
|
+
const exists = await runGit(['rev-parse', '--verify', '--quiet', `refs/heads/${local}`], { cwd: repoDir });
|
|
126
|
+
if (exists.code === 0) return runGit(['checkout', local], { cwd: repoDir });
|
|
127
|
+
return runGit(['checkout', '--no-track', '-B', local, fallback], { cwd: repoDir });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** 把主工作树切到任务分支:已存在则 checkout,否则从基点新建。 */
|
|
131
|
+
async function checkoutTaskBranch(repoDir, branch, base) {
|
|
132
|
+
const exists = await runGit(['rev-parse', '--verify', '--quiet', `refs/heads/${branch}`], { cwd: repoDir });
|
|
133
|
+
// 从远端基线拉任务分支时不能自动跟踪基线,否则 git push 可能误推到基线分支
|
|
134
|
+
const args = exists.code === 0 ? ['checkout', branch] : ['checkout', '--no-track', '-b', branch, base];
|
|
135
|
+
const r = await runGit(args, { cwd: repoDir });
|
|
136
|
+
if (r.code !== 0) {
|
|
137
|
+
const line = (r.stderr || r.stdout).trim().split('\n')[0];
|
|
138
|
+
return { error: `主工作树切到任务分支 ${branch} 失败:${line}` };
|
|
139
|
+
}
|
|
140
|
+
return {};
|
|
141
|
+
}
|
|
142
|
+
|
|
121
143
|
async function isDirty(dir) {
|
|
122
144
|
const r = await runGit(['status', '--porcelain'], { cwd: dir });
|
|
123
145
|
return r.code !== 0 || r.stdout.trim() !== '';
|
|
@@ -377,7 +399,7 @@ async function acquireSlot(ws, repoDir, repoName, task, branch, base, slots) {
|
|
|
377
399
|
const branchExists = (await runGit(['rev-parse', '--verify', `refs/heads/${branch}`], { cwd: repoDir })).code === 0;
|
|
378
400
|
const r = branchExists
|
|
379
401
|
? await runGit(['checkout', branch], { cwd: dir })
|
|
380
|
-
: await runGit(['checkout', '-b', branch, base], { cwd: dir });
|
|
402
|
+
: await runGit(['checkout', '--no-track', '-b', branch, base], { cwd: dir });
|
|
381
403
|
if (r.code !== 0) return { error: `slot ${name} 切分支失败:${(r.stderr || '').trim().split('\n')[0]}` };
|
|
382
404
|
return { placement: name, path: dir, notes };
|
|
383
405
|
}
|
|
@@ -451,13 +473,16 @@ export async function ensureTaskWorkspaces(ws, kit, task, { branchPrefix = 'feat
|
|
|
451
473
|
}
|
|
452
474
|
// 开发分支基点:任务创建时指定的基线(--base)优先,否则 kit.json 基线(2026-11-17 定)
|
|
453
475
|
const taskSpec = readTaskBaseSpec(ws, task);
|
|
454
|
-
|
|
476
|
+
const baseline = await resolveBase(repoDir, source) ?? 'HEAD';
|
|
477
|
+
let base = baseline;
|
|
478
|
+
let selectedBase = false;
|
|
455
479
|
if (taskSpec[source.name]) {
|
|
456
480
|
const resolved = await resolveTaskBase(repoDir, taskSpec[source.name]);
|
|
457
481
|
if (resolved) {
|
|
458
482
|
base = resolved;
|
|
483
|
+
selectedBase = true;
|
|
459
484
|
} else {
|
|
460
|
-
result.notes.push(`${source.name}:创建时指定的基线 ${taskSpec[source.name]} 不存在(本地/远端均无),已回退默认基线 ${
|
|
485
|
+
result.notes.push(`${source.name}:创建时指定的基线 ${taskSpec[source.name]} 不存在(本地/远端均无),已回退默认基线 ${baseline}`);
|
|
461
486
|
}
|
|
462
487
|
}
|
|
463
488
|
const branch = `${branchPrefix}/harness-${task}`;
|
|
@@ -466,7 +491,14 @@ export async function ensureTaskWorkspaces(ws, kit, task, { branchPrefix = 'feat
|
|
|
466
491
|
const existing = tEntry.repos[source.name];
|
|
467
492
|
if (existing) {
|
|
468
493
|
if (existing.placement === 'main') {
|
|
469
|
-
|
|
494
|
+
const current = await currentBranch(repoDir);
|
|
495
|
+
// 选了开发基线但主树还停在别的分支(常见是 dev):删掉旧分配,让下面的
|
|
496
|
+
// selectedBase 规则决定是否从基线切到任务分支;否则保持原有复用行为。
|
|
497
|
+
if (!selectedBase || current === branch) {
|
|
498
|
+
result.assigned.push({ source: source.name, placement: 'main', path: repoDir, branch, base, reused: true, ready: current === branch });
|
|
499
|
+
} else {
|
|
500
|
+
delete tEntry.repos[source.name];
|
|
501
|
+
}
|
|
470
502
|
} else {
|
|
471
503
|
const dir = path.join(worktreeRoot(ws, source.name), existing.placement);
|
|
472
504
|
if (fs.existsSync(dir)) {
|
|
@@ -484,10 +516,24 @@ export async function ensureTaskWorkspaces(ws, kit, task, { branchPrefix = 'feat
|
|
|
484
516
|
// 台账已本地化(keepLedgerLocal),里面的占用者必然是本机自己的任务。
|
|
485
517
|
const main = forceSlot ? { occupied: true, branch, dirty: false, reason: '--slot 强制隔离' } : await mainWorktreeState(repoDir, base);
|
|
486
518
|
const owner = Object.entries(ledger.tasks).find(([t, e]) => t !== task && e?.repos?.[source.name]?.placement === 'main');
|
|
487
|
-
|
|
519
|
+
// 选了开发基线时,干净的主工作树只要停在「注册基线 / 所选基线 / 本任务分支」上,
|
|
520
|
+
// 就允许在分配时切到任务分支(否则主树停在 dev 会被当成外来分支,apply 卡在裁决点)。
|
|
521
|
+
const mainOnAcceptedBranch = !forceSlot && !main.dirty
|
|
522
|
+
&& (main.branch === baseline || main.branch === base || main.branch === branch);
|
|
523
|
+
if ((!main.occupied || mainOnAcceptedBranch) && !owner) {
|
|
524
|
+
let switched = false;
|
|
525
|
+
if (selectedBase && main.branch !== branch) {
|
|
526
|
+
const co = await checkoutTaskBranch(repoDir, branch, base);
|
|
527
|
+
if (co.error) {
|
|
528
|
+
result.refused.push({ source: source.name, reason: co.error });
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
switched = true;
|
|
532
|
+
result.notes.push(`${source.name}:主工作树已从 \`${main.branch}\` 切到任务分支 \`${branch}\`(基点 \`${base}\`)`);
|
|
533
|
+
}
|
|
488
534
|
tEntry.repos[source.name] = { placement: 'main', branch, base };
|
|
489
535
|
ledger.slots[source.name] ??= {};
|
|
490
|
-
result.assigned.push({ source: source.name, placement: 'main', path: repoDir, branch, base, reused: false });
|
|
536
|
+
result.assigned.push({ source: source.name, placement: 'main', path: repoDir, branch, base, reused: false, ready: main.branch === branch || switched, switched });
|
|
491
537
|
continue;
|
|
492
538
|
}
|
|
493
539
|
if (!owner && !forceSlot) {
|
|
@@ -560,9 +606,14 @@ export async function releaseTaskWorkspaces(ws, kit, task) {
|
|
|
560
606
|
if (cur === info.branch) {
|
|
561
607
|
if (await mergedStatus(repoDir, info.branch, info.base ?? 'dev')) {
|
|
562
608
|
if (!(await isDirty(repoDir))) {
|
|
563
|
-
await
|
|
564
|
-
|
|
565
|
-
|
|
609
|
+
const co = await checkoutBaseBranch(repoDir, info.base ?? 'dev');
|
|
610
|
+
if (co.code !== 0) {
|
|
611
|
+
out.stale.push({ source: name, reason: `主工作树切回基线失败:${(co.stderr || '').trim().split('\n')[0]}` });
|
|
612
|
+
remaining[name] = info;
|
|
613
|
+
} else {
|
|
614
|
+
await runGit(['branch', '-d', info.branch], { cwd: repoDir });
|
|
615
|
+
out.released.push({ source: name, placement: 'main', note: '主工作树已切回基线并删已合入分支' });
|
|
616
|
+
}
|
|
566
617
|
} else {
|
|
567
618
|
out.stale.push({ source: name, reason: `主工作树分支 ${info.branch} 已合入但有未提交改动,未切回基线(请人工处理)` });
|
|
568
619
|
remaining[name] = info;
|
|
@@ -850,7 +901,9 @@ export function renderWorkspaceNotice(res, task) {
|
|
|
850
901
|
lines.push('- 各仓工作区分配:**developer 写源码只进分配给自己的目录,其余目录(主工作树/其他 slot/其他仓)一律只读**:');
|
|
851
902
|
for (const w of assigned) {
|
|
852
903
|
const where = w.placement === 'main'
|
|
853
|
-
? (w.branch
|
|
904
|
+
? (w.branch
|
|
905
|
+
? `主工作树 \`${w.path}\`(分支 \`${w.branch}\`,基点 \`${w.base}\`${w.ready ? ';内核已切好' : ';开工前从该基点新建分支'})`
|
|
906
|
+
: `主工作树 \`${w.path}\`(非 git 仓,直接工作)`)
|
|
854
907
|
: `池化 worktree \`${w.path}\`(分支 \`${w.branch}\`,内核已切好;slot 常驻复用,不要删目录)`;
|
|
855
908
|
lines.push(` - ${w.source} → ${where}`);
|
|
856
909
|
}
|
package/package.json
CHANGED
|
@@ -118,7 +118,7 @@ apply-mode 决定 CR PASS 后是否进入人工审查点:
|
|
|
118
118
|
- **auto 模式**(默认):CR PASS → PM 直接调度 TE
|
|
119
119
|
- **review 模式**:CR PASS → PM 用 `update_board.py <任务> --status CR_REVIEW_PENDING` 更新看板,输出 code-review.md 摘要,提示人审阅 → 人运行 `/hk-apply <任务>` 续接 → PM 检测 `CR_REVIEW_PENDING` 跳过 Dev+CR 直接调度 TE
|
|
120
120
|
|
|
121
|
-
**模式优先级**:proposal.md 的 `flow-mode` > `.harness/
|
|
121
|
+
**模式优先级**:proposal.md 的 `flow-mode` > `.harness/kit.json` 的 `applyMode`(面板设置页可改)> 默认 auto
|
|
122
122
|
|
|
123
123
|
## 输入(Inputs)
|
|
124
124
|
|
|
@@ -126,7 +126,6 @@ apply-mode 决定 CR PASS 后是否进入人工审查点:
|
|
|
126
126
|
- `.harness/specs/_index.md` — 系统能力索引
|
|
127
127
|
- `codebase-guide/overview.md` — 项目架构总览
|
|
128
128
|
- `tasks/board.md` — 任务看板
|
|
129
|
-
- `workflow/contract.json` — Agent I/O 契约(用于交叉校验)
|
|
130
129
|
|
|
131
130
|
## 产出(Outputs)
|
|
132
131
|
|
|
@@ -144,6 +143,7 @@ apply-mode 决定 CR PASS 后是否进入人工审查点:
|
|
|
144
143
|
- **心跳纪律**:每个关键锚点必须立刻输出一行心跳,禁止连续静默跨越多个阶段
|
|
145
144
|
- **心跳 + 动作原子性**:输出 `Worker 开工` 心跳的同一轮必须发出 Agent 工具调用,禁止只发心跳不发 Agent。Worker 收工后除非遇到审批点(APPROVAL_1/APPROVAL_2/CR_REVIEW)或 BLOCK,否则立刻调度下一个 Worker,不等人确认
|
|
146
145
|
- 不一致时 BLOCK 并升级给人,禁止 PM 擅自切换 profile
|
|
146
|
+
- **审批材料必须可见可点**:任何 ⛔ 审批 1 / 审批 2 / 质量门前,必须先发一条普通可见消息(不是 reasoning,也不要只写在 ask_user_question 参数里),用 Markdown 链接列出本轮产物(工作区相对路径,如 [requirements.md](.harness/deliverables/<任务>/requirements.md)),并写 1 行要点;随后 ask_user_question 的 question 文本以「材料:[需求](链接) · [方案](链接) · [评审](链接)」开头。`present` 的卡片要等本轮结束才出现,不能替代等待回答前的链接;reasoning 不算展示。
|
|
147
147
|
- **看板写入纪律**:更新 `tasks/board.md` **禁止直接编辑文件**,一律运行
|
|
148
148
|
`python3 .harness/scripts/update_board.py <任务> [--status …] [--apply …] [--branch …] [--hint …]`(脚本强校验列格式,非法即拒绝)。
|
|
149
149
|
列格式契约:状态=枚举(PENDING/IN_PROGRESS/CR_REVIEW_PENDING/AWAITING_ARCHIVE/DONE);Profile=枚举(standard/quick/bugfix/fix/fix-full/fix-light/refactor/—;bugfix=全流程,fix 直通三态:full 走 CR→TE、light 跳过 CR/TE、裸 fix=裁决未定过渡态——质量门裁决后你必须立即 `--profile fix-full|fix-light` 改写);Apply进度=`—|已归档|R<n>:阶段链`——链必须**完整等于该 profile 固定流程**(standard/quick/bugfix=`propose 审批1 Dev CR TE 审批2 验证`,refactor 前置 `影响面`,fix 直通=`质量门 Dev CR TE 验证`),每阶段带标记 ✅/▶/…/⛔/—(▶ 至多一个;— 仅 fix-light 的 CR/TE 允许),例 `R2:propose✅ 审批1✅ Dev▶ CR… TE… 审批2… 验证…`;续接提示 ≤80 字符一句话「卡在X,下一步Y」,任务依赖写前缀 `[等 任务名]`,禁 `|`/换行/详情堆叠(详情属于 deliverables)。
|
|
@@ -185,6 +185,6 @@ apply-mode 决定 CR PASS 后是否进入人工审查点:
|
|
|
185
185
|
| TE | 测试资产 | TE 补齐 |
|
|
186
186
|
| TE | 定位阻塞 | 报告写清证据 + 需人决策 |
|
|
187
187
|
|
|
188
|
-
##
|
|
188
|
+
## 硬校验:角色「必读」清单一致性
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
Worker 角色文件(`agents/*.md`,工作区覆写优先于内容包默认)里的「输入(Inputs)/ 必读」清单即权威契约——当前 Harness Kit 不维护额外的 contract.json,不要去找该文件。PM 在每次 `/hk-propose` 执行前核对:阶段剧本要求的产物(proposal/design/requirements…)与对应角色「必读」清单是否一致,发现矛盾时报告给人。
|
|
@@ -150,8 +150,6 @@ def generate_plan(root: Path) -> dict:
|
|
|
150
150
|
def main():
|
|
151
151
|
mode = sys.argv[1] if len(sys.argv) > 1 else ""
|
|
152
152
|
root = lib.repo_root()
|
|
153
|
-
# 初始化即安装 pre-commit 门禁(幂等):任意分支拦子模块指针的改/删,集成分支另拦交付物
|
|
154
|
-
lib.git(["config", "core.hooksPath", str(root / ".harness" / "git-hooks")], cwd=root)
|
|
155
153
|
plan = generate_plan(root)
|
|
156
154
|
if mode in ("--detect", "--json"):
|
|
157
155
|
payload = json.dumps(plan, ensure_ascii=False, indent=2)
|
|
@@ -605,11 +605,37 @@ def blocking_dirty(sp: Path, allowed=None, tracked_only: bool = False) -> list:
|
|
|
605
605
|
if not _allowed(p)]
|
|
606
606
|
|
|
607
607
|
|
|
608
|
+
def _kit_source_branch(service_path) -> str:
|
|
609
|
+
"""kit.json sources 里该子工程登记的基线分支(2026-11-18:mainlineBranch 字段已废弃,
|
|
610
|
+
主线 = 每仓 sources[].branch,与开发分支基点/合入目标同源)。"""
|
|
611
|
+
try:
|
|
612
|
+
sources = read_json(ROOT / ".harness" / "kit.json").get("sources") or []
|
|
613
|
+
except Exception:
|
|
614
|
+
return ""
|
|
615
|
+
sp = Path(service_path)
|
|
616
|
+
try:
|
|
617
|
+
rel = sp.resolve().relative_to(ROOT.resolve()).as_posix()
|
|
618
|
+
except Exception:
|
|
619
|
+
rel = sp.as_posix().lstrip("./")
|
|
620
|
+
for s in sources:
|
|
621
|
+
if not isinstance(s, dict):
|
|
622
|
+
continue
|
|
623
|
+
if not s.get("branch"):
|
|
624
|
+
continue
|
|
625
|
+
if s.get("path") == rel or Path(s.get("path", "")).name == Path(rel).name:
|
|
626
|
+
return str(s["branch"]).strip()
|
|
627
|
+
return ""
|
|
628
|
+
|
|
629
|
+
|
|
608
630
|
def get_mainline_branch(service_path) -> str:
|
|
609
631
|
"""子工程主线分支(集成/同步目标分支)。
|
|
610
|
-
优先级:子工程 .harness/build.json 的 mainline-branch >
|
|
632
|
+
优先级:子工程 .harness/build.json 的 mainline-branch > kit.json sources[该仓].branch
|
|
633
|
+
> 旧 .harness/config.json 的 mainline-branch(兼容旧工作区)> 默认 dev。
|
|
611
634
|
"""
|
|
612
635
|
b = get_build_field(service_path, "mainline-branch")
|
|
636
|
+
if b:
|
|
637
|
+
return b
|
|
638
|
+
b = _kit_source_branch(service_path)
|
|
613
639
|
if b:
|
|
614
640
|
return b
|
|
615
641
|
b = read_json(ROOT / ".harness" / "config.json").get("mainline-branch")
|
|
@@ -13,7 +13,7 @@ stages:
|
|
|
13
13
|
- bugfix.md 末尾「## 结论」段写 PASS 或 BLOCK
|
|
14
14
|
- name: 审批 1
|
|
15
15
|
phase: propose
|
|
16
|
-
approval:
|
|
16
|
+
approval: 先在会话里发送一条可见消息(普通 assistant 文本,不是 reasoning):标题「审批 1 · <任务名>」,用 Markdown 链接列出 [bugfix.md](.harness/deliverables/<任务名>/bugfix.md)、[proposal.md](.harness/deliverables/<任务名>/proposal.md),写根因、影响面与验收要点;再调用 ask_user_question,question 以「材料:[缺陷分析](链接) · [提案](链接)」开头再问是否通过。通过后把「审批 1:通过(YYYY-MM-DD)」写入 proposal.md 末尾——写入后源码区红线自动解锁
|
|
17
17
|
- name: 开发
|
|
18
18
|
phase: apply
|
|
19
19
|
worker: developer
|
|
@@ -32,6 +32,6 @@ stages:
|
|
|
32
32
|
- 派发 Test Engineer 验证(bugfix 覆盖度:复现用例回归 + 构建/单测,可免 E2E),产出 test-report.md,最后一个「## 结论」段写 PASS 或 BLOCK
|
|
33
33
|
- name: 审批 2
|
|
34
34
|
phase: apply
|
|
35
|
-
approval:
|
|
35
|
+
approval: 先发可见消息(普通 assistant 文本,不是 reasoning):标题「审批 2 · <任务名>」,用 Markdown 链接列出 [code-review.md](.harness/deliverables/<任务名>/code-review.md)、[test-report.md](.harness/deliverables/<任务名>/test-report.md)、[dev-log.md](.harness/deliverables/<任务名>/dev-log.md),写测试结论与交付摘要;再调用 ask_user_question,question 以「材料:[评审](链接) · [测试](链接)」开头再问是否归档。通过后把看板置 AWAITING_ARCHIVE 并记录「审批 2:通过」(链上审批2✅)——自动续接引擎会接力 /hk-archive <任务名>,无需人手动敲;若工作区关闭自动续接(kit.autoAdvance=false),则提醒人运行
|
|
36
36
|
after:
|
|
37
37
|
- 回退规则:CR 不通过 → Dev;TE 实现级 → Dev;TE 需求级 → propose
|
|
@@ -16,7 +16,7 @@ stages:
|
|
|
16
16
|
- 信息不足时先向人反问(PM 澄清义务),不要自行补全口径
|
|
17
17
|
- name: 质量门
|
|
18
18
|
actor: PM
|
|
19
|
-
gate: 按 bugfix.md「质量门」表评估复杂度并给出建议(轻量 或 --full
|
|
19
|
+
gate: 按 bugfix.md「质量门」表评估复杂度并给出建议(轻量 或 --full)。裁决无默认值,必须交人。先发一条可见消息(普通 assistant 文本,不是 reasoning):标题「质量门 · <任务名>」,用 Markdown 链接列出 [bugfix.md](.harness/deliverables/<任务名>/bugfix.md),写复杂度评估与建议;再调用 ask_user_question,question 以「材料:[bugfix.md](链接)」开头再问轻量还是 --full。人裁决后把「裁决:轻量」或「裁决:--full」写入 bugfix.md 的 R0 段——写入后源码区红线自动解锁,方可进入开发。轻量 = 只 Dev + 验证;--full = Dev → CR → TE。
|
|
20
20
|
- name: 开发修复
|
|
21
21
|
worker: developer
|
|
22
22
|
do:
|
|
@@ -19,7 +19,7 @@ stages:
|
|
|
19
19
|
gate: 把「## 模糊点」段列全:所有歧义、口径不明、验收模糊之处,用 ask_user_question 逐条交人澄清;禁止 AI 自行补全。bugfix 例外:缺陷报告本身即验收标准,无歧义可跳过
|
|
20
20
|
- name: 定稿
|
|
21
21
|
actor: PM
|
|
22
|
-
approval:
|
|
22
|
+
approval: 先在会话里发送一条可见消息(普通 assistant 文本,不是 reasoning):标题「定稿 · <任务名>」,用 Markdown 链接列出 [proposal.md](.harness/deliverables/<任务名>/proposal.md)(有需求文件时一并链接),写范围/Profile/验收与模糊点澄清结果;再调用 ask_user_question,question 以「材料:[提案](链接)」开头再问是否定稿。人确认后把状态行改为「> **状态**:approved」
|
|
23
23
|
- name: 交接
|
|
24
24
|
actor: PM
|
|
25
25
|
do:
|
|
@@ -16,7 +16,7 @@ stages:
|
|
|
16
16
|
- 自评 BLOCK → 补全方案后重评
|
|
17
17
|
- name: 审批 1
|
|
18
18
|
phase: propose
|
|
19
|
-
approval:
|
|
19
|
+
approval: 先在会话里发送一条可见消息(普通 assistant 文本,不是 reasoning):标题「审批 1 · <任务名>」,用 Markdown 链接列出 [requirements.md](.harness/deliverables/<任务名>/requirements.md)、[design.md](.harness/deliverables/<任务名>/design.md)、[proposal.md](.harness/deliverables/<任务名>/proposal.md),写要点与 SA 就绪自评结论;再调用 ask_user_question,question 以「材料:[需求](链接) · [方案](链接)」开头再问是否通过。通过后把「审批 1:通过(YYYY-MM-DD)」写入 proposal.md 末尾——写入后源码区红线自动解锁
|
|
20
20
|
- name: 开发
|
|
21
21
|
phase: apply
|
|
22
22
|
worker: developer
|
|
@@ -35,6 +35,6 @@ stages:
|
|
|
35
35
|
- 派发 Test Engineer 验证(quick 覆盖度:构建/单测 + 手动验证,可免 E2E),产出 test-report.md,最后一个「## 结论」段写 PASS 或 BLOCK
|
|
36
36
|
- name: 审批 2
|
|
37
37
|
phase: apply
|
|
38
|
-
approval:
|
|
38
|
+
approval: 先发可见消息(普通 assistant 文本,不是 reasoning):标题「审批 2 · <任务名>」,用 Markdown 链接列出 [code-review.md](.harness/deliverables/<任务名>/code-review.md)、[test-report.md](.harness/deliverables/<任务名>/test-report.md)、[dev-log.md](.harness/deliverables/<任务名>/dev-log.md),写测试结论与交付摘要;再调用 ask_user_question,question 以「材料:[评审](链接) · [测试](链接)」开头再问是否归档。通过后把看板置 AWAITING_ARCHIVE 并记录「审批 2:通过」(链上审批2✅)——自动续接引擎会接力 /hk-archive <任务名>,无需人手动敲;若工作区关闭自动续接(kit.autoAdvance=false),则提醒人运行
|
|
39
39
|
after:
|
|
40
40
|
- 回退规则:CR 不通过 → Dev;TE 实现级 → Dev;TE 需求级 → propose
|
|
@@ -26,7 +26,7 @@ stages:
|
|
|
26
26
|
- BLOCK → 回对应阶段重做
|
|
27
27
|
- name: 审批 1
|
|
28
28
|
phase: propose
|
|
29
|
-
approval:
|
|
29
|
+
approval: 先在会话里发送一条可见消息(普通 assistant 文本,不是 reasoning):标题「审批 1 · <任务名>」,用 Markdown 链接列出 [design.md](.harness/deliverables/<任务名>/design.md)、[requirements.md](.harness/deliverables/<任务名>/requirements.md)、[readiness-report.md](.harness/deliverables/<任务名>/readiness-report.md)、[proposal.md](.harness/deliverables/<任务名>/proposal.md),写影响面、方案与就绪结论;再调用 ask_user_question,question 以「材料:[方案](链接) · [需求](链接) · [评审](链接)」开头再问是否通过。通过后把「审批 1:通过(YYYY-MM-DD)」写入 proposal.md 末尾——写入后源码区红线自动解锁
|
|
30
30
|
- name: 开发
|
|
31
31
|
phase: apply
|
|
32
32
|
worker: developer
|
|
@@ -45,6 +45,6 @@ stages:
|
|
|
45
45
|
- 派发 Test Engineer 验证(refactor 覆盖度:全量回归 + 关键路径 E2E),产出 test-report.md,最后一个「## 结论」段写 PASS 或 BLOCK
|
|
46
46
|
- name: 审批 2
|
|
47
47
|
phase: apply
|
|
48
|
-
approval:
|
|
48
|
+
approval: 先发可见消息(普通 assistant 文本,不是 reasoning):标题「审批 2 · <任务名>」,用 Markdown 链接列出 [code-review.md](.harness/deliverables/<任务名>/code-review.md)、[test-report.md](.harness/deliverables/<任务名>/test-report.md)、[dev-log.md](.harness/deliverables/<任务名>/dev-log.md),写测试结论与交付摘要;再调用 ask_user_question,question 以「材料:[评审](链接) · [测试](链接)」开头再问是否归档。通过后把看板置 AWAITING_ARCHIVE 并记录「审批 2:通过」(链上审批2✅)——自动续接引擎会接力 /hk-archive <任务名>,无需人手动敲;若工作区关闭自动续接(kit.autoAdvance=false),则提醒人运行
|
|
49
49
|
after:
|
|
50
50
|
- 回退规则:CR 不通过 → Dev;TE 实现级 → Dev;TE 需求级 → propose;环境阻塞 → 升级给人
|
|
@@ -23,7 +23,7 @@ stages:
|
|
|
23
23
|
- 结论 BLOCK → 把意见带回需求分析/方案设计阶段重做,重新送审
|
|
24
24
|
- name: 审批 1
|
|
25
25
|
phase: propose
|
|
26
|
-
approval:
|
|
26
|
+
approval: 先在会话里发送一条可见消息(普通 assistant 文本,不是 reasoning,也不要只写在 ask_user_question 参数里):标题「审批 1 · <任务名>」,用 Markdown 链接列出 [requirements.md](.harness/deliverables/<任务名>/requirements.md)、[design.md](.harness/deliverables/<任务名>/design.md)、[readiness-report.md](.harness/deliverables/<任务名>/readiness-report.md)、[proposal.md](.harness/deliverables/<任务名>/proposal.md),每项配 1 行要点,并列出 RR 提出的待确认项;然后调用 ask_user_question,question 以「材料:[需求](链接) · [方案](链接) · [评审](链接)」开头再问是否进入开发。人通过后把「审批 1:通过(YYYY-MM-DD)」写入 proposal.md 末尾——写入后源码区红线自动解锁,才能进 apply 阶段
|
|
27
27
|
- name: 开发
|
|
28
28
|
phase: apply
|
|
29
29
|
worker: developer
|
|
@@ -44,6 +44,6 @@ stages:
|
|
|
44
44
|
- 实现级 bug → 回退开发;需求级问题 → 停下建议回 propose;环境阻塞 → 暂停升级给人
|
|
45
45
|
- name: 审批 2
|
|
46
46
|
phase: apply
|
|
47
|
-
approval:
|
|
47
|
+
approval: 先发可见消息(普通 assistant 文本,不是 reasoning):标题「审批 2 · <任务名>」,用 Markdown 链接列出 [code-review.md](.harness/deliverables/<任务名>/code-review.md)、[test-report.md](.harness/deliverables/<任务名>/test-report.md)、[dev-log.md](.harness/deliverables/<任务名>/dev-log.md)、[proposal.md](.harness/deliverables/<任务名>/proposal.md),写测试结论、交付摘要与遗留风险;再调用 ask_user_question,question 以「材料:[评审](链接) · [测试](链接)」开头再问是否归档。通过后把看板置 AWAITING_ARCHIVE 并记录「审批 2:通过」(链上审批2✅)——自动续接引擎会接力 /hk-archive <任务名>,无需人手动敲;若工作区关闭自动续接(kit.autoAdvance=false),则提醒人运行
|
|
48
48
|
after:
|
|
49
49
|
- 回退规则:CR 不通过 → Dev 修复重审;TE 实现级 → Dev;TE 需求级 → propose;环境阻塞 → 升级给人
|
|
@@ -44,6 +44,7 @@ Bootstrap 阶段 PM 调度阶段
|
|
|
44
44
|
- Worker 收工汇报格式(PM 读取并转发心跳):`<产出文件> ## 结论 <PASS|BLOCK>`。
|
|
45
45
|
- 任何"完成/已修复/已通过"的表述,必须附带证据——命令 + 关键输出;禁止口头汇报。
|
|
46
46
|
- 任何 FAIL 出现后禁止盲目试改;按顺序:读错误 → 稳定复现 → 对照 diff → 定位边界 → 单一假设 → 最小改动验证。同一问题连续 3 次修复未通过 → 停止堆补丁,升级为阻塞项交由人决策。
|
|
47
|
+
- **审批材料必须可见可点**:审批 1 / 审批 2 / 质量门前,先发一条普通可见消息(不是 reasoning),用 Markdown 链接列出本轮产物(工作区相对路径);ask_user_question 的 question 也要带材料链接。`present` 卡片在本轮结束后才出现,不能替代等待回答前的链接;reasoning 不算展示。
|
|
47
48
|
- **PM 心跳纪律**:PM 在每个关键锚点(Profile 识别 / 文档就位 / Worker 开工 / 脚本事件 / Worker 收工 / 异常回退)必须立刻输出一行心跳,禁止连续静默跨越多个阶段。
|
|
48
49
|
|
|
49
50
|
## 5. 质量门人裁决纪律(Fix 直通)
|