@mstar-harness/dsh 3.2.2 → 3.2.4

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.
@@ -36,4 +36,4 @@ Execute **`mstar-audit`** § `pr` variant end to end(SKILL.md common core:re
36
36
 
37
37
  Review findings that need fixing can be turned into self-contained plans for the normal Prepare → Execute flow (reusing `mstar-audit` SKILL.md **`## Plan output (all variants)`** — same contract as the `pr` variant).
38
38
 
39
- Output verdict + findings to the user, with the posted GitHub Review URL. Posting procedure (when a PR number exists) → **`references/pr-review.md`** § Comment posting. Never auto-approve or merge.
39
+ Output verdict + findings to the user, with the posted GitHub Review URL. Posting procedure (when a PR number exists) → **`references/pr-review.md`** § Comment posting; each reviewer also saves the durable local report → **`references/pr-review.md`** § Local report archive. Never auto-approve or merge.
@@ -28,7 +28,7 @@
28
28
  - **不放什么**:已锁定的仓库级规范(→ **`{SPECS_DIR}/`**);已提升的跨迭代实施 SSOT(→ **`{KNOWLEDGE_DIR}/`**,经 compound);单 plan QC/QA 原始报告(→ `{SDD_DIR}/review/`)。
29
29
  - **索引**:`**{ITERATION_DIR}/README.md**` **一行 = 一次迭代**(指向 `<iteration-id>/`);`<iteration-id>/README.md` 登记 package 内文档(Documents 单表)。
30
30
  - **维护**:`@product-manager` / `@architect` 起草 package;`**@project-manager**` 维护索引与 metadata;**iteration-close** 时 **`mstar-compound`** 盘点 package 并**提升**至 `{KNOWLEDGE_DIR}/`。
31
- - **Compass 路径**:canonical `{ITERATION_DIR}/<iteration-id>/delivery-compass.md`;legacy flat `{ITERATION_DIR}/<iteration-id>-delivery-compass.md` 仅兼容读。
31
+ - **Compass 路径**:canonical `{ITERATION_DIR}/<iteration-id>/delivery-compass.md`(迭代状态 SSOT);legacy flat `{ITERATION_DIR}/<iteration-id>-delivery-compass.md` 仅兼容读。
32
32
 
33
33
  ## `{SPECS_DIR}`(可选·长期规格)
34
34
 
@@ -21,7 +21,6 @@ QC/QA 原始过程报告默认是 **ephemeral review bundle**,置于 `{SDD_DIR
21
21
  | QC 汇总结论(tri 模式) | `qc-consolidated.md` |
22
22
  | QA 验收报告(`QA gate: mandatory`) | `qa.md`(或 Assignment 指定的同目录 basename) |
23
23
 
24
- `{PLAN_DIR}/reports/` is **legacy / explicit audit mode only**. Use it only when the user or project policy explicitly requires tracked raw reports; the default harness path is `{SDD_DIR}/review/`.
25
24
 
26
25
  ## SDD 运行时(不入 reports)
27
26
 
@@ -205,7 +205,7 @@ Posting the GitHub Review is a **mandatory deliverable** of the `pr` variant —
205
205
 
206
206
  - **Before anything else:** synthesize the verdict first, then post **before** worktree cleanup (see § Worktree isolation — cleanup happens after the comment is posted).
207
207
  - **No PR number** (bare branch / arbitrary diff): set `comments: n/a-no-pr` and skip the API. Chat output still required; this is not a Blocked review.
208
- - **Auth / API failure:** deliver the chat verdict anyway; Completion Report status `Partial`/`Blocked` with the `gh` error. Do not claim `Done` — comments are mandatory when a PR exists.
208
+ - **Auth / API failure:** deliver the chat verdict anyway; Completion Report status `Partial`/`Blocked` with the `gh` error. Do not claim `Done` — comments are mandatory when a PR exists. **The local report is still saved** (§ Local report archive — posting failure does not skip archival).
209
209
 
210
210
  ### Procedure
211
211
 
@@ -217,7 +217,7 @@ Posting the GitHub Review is a **mandatory deliverable** of the `pr` variant —
217
217
  2. Build one review payload:
218
218
  - `event`: `COMMENT` — **never** `APPROVE`, **never** `REQUEST_CHANGES`, never a merge.
219
219
  - `commit_id`: the PR head SHA.
220
- - `body`: **first two lines are the display contract** — `{verdict} · {score_pct}%` then the tally line (`must-fix=<n> should-fix=<n> nit=<n> unverified=<n>`) — then ranked findings (short) + linked-issue leftover reasoning + optional folded plan index (below). `event` stays `COMMENT` — **never** `APPROVE`, **never** `REQUEST_CHANGES`, never a merge.
220
+ - `body`: follow **§ Report template (below)**three sections (Verdict Review Plan to fix). `event` stays `COMMENT` — **never** `APPROVE`, **never** `REQUEST_CHANGES`, never a merge.
221
221
  - `comments[]`: one entry per finding whose `path` + `line` is in the three-dot diff, `side: RIGHT`. Finding body = title + evidence + impact + fix sketch — not the whole plan.
222
222
  3. Post it:
223
223
  ```
@@ -225,22 +225,99 @@ Posting the GitHub Review is a **mandatory deliverable** of the `pr` variant —
225
225
  ```
226
226
  (payload on stdin).
227
227
  4. **Line fallback:** if GitHub rejects some inline comments (e.g. 422 — line not in the diff), retry the review **without** those entries and fold them into the summary body. Do not loop more than once.
228
- 5. Record `html_url` / review id for `comments:`. Only now clean up the worktree (or after the n/a-no-PR skip).
228
+ 5. Save the local report (§ Local report archive) — **mandatory in all three branches**: POST succeeded (record `html_url` / review id for `comments:` first), POST failed, or `n/a-no-pr` (archive the chat display content). Only then clean up the worktree; bare branch/diff reviews have no worktree, but the save still happens.
229
229
  6. **Batch:** each reviewer posts on **their own PRs** only. No second PM summary comment unless the Assignment says so.
230
230
 
231
- ### Folding plans into the summary
231
+ ### Report template (GitHub Review `body`)
232
+
233
+ The posted review body is a three-section report. Section order fixed; omit a subsection only when its content is genuinely empty (write `none`, never delete the heading).
234
+
235
+ **Section emoji map** — verdict: `ship it` ✅ · `needs fixes` ⚠️ · `blocked` ⛔. Finding classes: 🔴 must-fix · 🟠 should-fix · 🔵 nit · ❓ unverified.
236
+
237
+ ````markdown
238
+ ## <verdict-emoji> Verdict: `<verdict>` · Confidence <score_pct>%
239
+
240
+ | Findings | Count |
241
+ | --- | --- |
242
+ | 🔴 must-fix | <n> |
243
+ | 🟠 should-fix | <n> |
244
+ | 🔵 nit | <n> |
245
+ | ❓ unverified | <n> |
246
+
247
+ ## 📋 Review
248
+
249
+ **What this PR does**: <2–3 sentences summarizing the diff's intent and surface — from the PR description plus your own read of the changed files, not copied marketing text.>
250
+
251
+ ### Findings
252
+
253
+ <Ranked findings (§ List cut). Each finding keeps its normal format — title, evidence (`file:line`), impact, **Merge class**, **Confidence**, fix sketch — with its class emoji prefixing the title.>
254
+
255
+ ### Linked-issue AC
256
+
257
+ <When § Linked-issue hygiene applied: per-criterion met / unmet / cut with one-line reasoning. Otherwise `none`.>
258
+
259
+ ### ✅ Verified
260
+
261
+ <Concise what-checks-proved summary — the smallest runtime checks actually run and what they showed. Residual unverified leads go here as `- ❓ <lead>` lines, not into the findings table.>
262
+
263
+ ### 🗑️ Considered & rejected
264
+
265
+ <- <finding>: rejected because <one line>. Otherwise `none` — rejections come from the three-way attack / vet pass (§ Attack and vet), so the next reviewer does not re-chase them.>
232
266
 
233
- Fold follow-up plans into the review body **only if** this review wrote them. A short index — title, priority, effort, 1–3 sentence sketch, plan path — inside:
267
+ ## 🛠️ Plan to fix
234
268
 
269
+ <details><summary>展开修复计划 / Expand fix plan</summary>
270
+ <br>
271
+
272
+ ```md
273
+ <Fix plan in markdown when the audit produced one: ordered steps per finding, files touched, verification gates. Omit the block entirely only when no fix is proposed.>
235
274
  ```
236
- <details><summary>Follow-up plans</summary>
237
275
 
238
- - <plan title> — P1 / S — <1–3 sentence sketch> (`{PLAN_DIR}/audit-<date>/NNN-<slug>.md`)
239
276
  </details>
277
+ ````
278
+
279
+ - The Verdict section replaces the old two-line tally header on GitHub: same facts (verdict token + `score_pct` as Confidence + four-class tally), structured. The chat display contract (§ Display contract) is unchanged.
280
+ - When the fix plan itself contains fenced code blocks, open the outer fence with four backticks so the inner fences survive.
281
+
282
+ ### Folding plans into the summary
283
+
284
+ Fold follow-up plans into the review body **only if** this review wrote them. Put a short index — title, priority, effort, 1–3 sentence sketch, plan path — as the first content inside the § Report template **Plan to fix** `<details>` block, before the ```md fix-plan block:
285
+
286
+ ```
287
+ - <plan title> — P1 / S — <1–3 sentence sketch> (`{PLAN_DIR}/audit-<date>/NNN-<slug>.md`)
240
288
  ```
241
289
 
242
290
  Never dump full plan files.
243
291
 
292
+ ### Local report archive
293
+
294
+ The posted PR comment is the deliverable; the local report is the durable reference copy — the PR thread may be buried, locked, or deleted, and bare-branch/diff reviews have no thread at all. The review seat saves **one markdown file per reviewed PR** (or branch/diff) as part of the mandatory deliverable, before worktree cleanup:
295
+
296
+ - **Path**: `{PROJECT_DIR}/<project-id>/reports/pr-review/` — `<project-id>` from the Assignment / project context, `_default` when the review runs outside any project flow (same id convention as `projects/<id>/residuals.json`). Gitignored local SSOT, same posture as residuals; a finding that must survive across clones gets promoted to tracked `{KNOWLEDGE_DIR}` / `{SPECS_DIR}`, not by tracking this directory.
297
+ - **Write via the primary checkout, never the worktree**: harness discovery must not start from the review worktree — its root has no gitignored `.mstar/`, and anything written there is destroyed by `git worktree remove` (§ Worktree isolation). Record the primary repository's absolute path **before** creating the worktree and write the report under it. Never create a `.mstar/` inside the review worktree to "host" the report.
298
+ - **Filename**: `<YYYY-MM-DD>-pr<N>.md`; bare branch → `<YYYY-MM-DD>-<branch-slug>.md`; arbitrary diff → `<YYYY-MM-DD>-diff-<short-head-sha>.md`, or `<YYYY-MM-DD>-diff.md` when no head SHA was provided with the changeset (never invent one). Same target twice in one day → append `-r2`, `-r3`, … (never overwrite a prior report).
299
+ - **Frontmatter** (machine-readable metadata):
300
+ ```yaml
301
+ ---
302
+ type: pr-review
303
+ pr: <n> # omit for bare branch / diff
304
+ url: <pr url> # omit for bare branch / diff
305
+ head: <head sha>
306
+ base: <base ref>
307
+ verdict: ship it | needs fixes | blocked
308
+ score_pct: <n>
309
+ tally: { must-fix: <n>, should-fix: <n>, nit: <n>, unverified: <n> }
310
+ review_url: <posted review html_url> # n/a-no-pr when skipped; failed: <gh error summary> when POST failed
311
+ generated_at: <YYYY-MM-DD>
312
+ ---
313
+ ```
314
+
315
+ `head:` / `base:` are omitted when genuinely unknown (arbitrary diff without stated provenance) — never fabricate identifiers.
316
+
317
+ **Posting failure does not skip archival.** The report is saved regardless of the POST outcome: on failure it archives the chat display content plus the `gh` error summary, so a failed POST still leaves the durable copy.
318
+ - **Body**: the exact text posted as the GitHub Review body — verbatim, not a paraphrase. When `comments: n/a-no-pr` or posting failed, the body is the chat display content instead (§ Display contract two lines + ranked findings + leftover AC), so the local copy is still complete.
319
+ - Fix plans referenced by the Plan-to-fix section keep living in `{PLAN_DIR}/audit-<date>/` when written — the report links them, never duplicates them.
320
+
244
321
  ## Output shape
245
322
 
246
323
  - `- findings:` — list of evidence-backed findings (`none` when none). Each accepted finding includes **Merge class** (§ Merge class).
@@ -261,16 +338,20 @@ Never dump full plan files.
261
338
  - `inline: <N> posted / <M> attempted (<K> summary-only fallback)`
262
339
  - `plans_folded: yes` | `no`
263
340
 
264
- ### Display contract (chat + GitHub Review `body`)
341
+ - `- report:` — local archive path (§ Local report archive), e.g. `{PROJECT_DIR}/<project-id>/reports/pr-review/2026-08-24-pr134.md` (`_default` when project-less); `n/a` only when the harness dir is undiscoverable.
342
+
343
+ ### Display contract (chat output)
265
344
 
266
- First two lines of the display (chat output and the GitHub Review `body`) — verbatim:
345
+ First two lines of the **chat** display — verbatim:
267
346
 
268
347
  ```
269
348
  {verdict} · {score_pct}%
270
349
  must-fix=<n> should-fix=<n> nit=<n> unverified=<n>
271
350
  ```
272
351
 
273
- Then existing ranked findings / leftover AC / optional `<details>` plan index. Do not put `score_pct%` on the `- verdict:` token line.
352
+ Then ranked findings / leftover AC summary. Do not put `score_pct%` on the `- verdict:` token line.
353
+
354
+ The GitHub Review `body` no longer uses the two-line header — it follows § Report template, whose Verdict section carries the same facts structured (verdict token + Confidence + four-class emoji tally table).
274
355
 
275
356
  ### List cut
276
357
 
@@ -84,7 +84,8 @@ enforcement=hard
84
84
 
85
85
  **创建默认**:全部缺失或皆空 → 创建并使用 `{HARNESS_DIR}/specs/`(统一落在 `.mstar/` 下)。**禁止**在 greenfield init 时优先创建裸仓库根 `specs/`。
86
86
 
87
- **Legacy(仅兼容读)**:若以上皆无内容,但 `{HARNESS_DIR}/designs/` 或仓库根 `designs/` **非空**,可作 `{SPECS_DIR}` 使用;init 时**不**新建 `designs/`。
87
+ **Legacy 兼容读**:若以上皆无内容,但 `{HARNESS_DIR}/designs/` 或仓库根 `designs/` **非空**,可作 `{SPECS_DIR}` 使用;init 时**不**新建 `designs/`。
88
+
88
89
 
89
90
  > **Engine check (when available):** import `resolveSpecsDir` from `@mstar-harness/engine` in a host hook — or run `mstar path resolve` (prints the resolved specs dir) — to confirm the candidate order (empty-dir-as-absent included). On `fail` -> do not proceed; fix and re-run. Skill text below remains authoritative when the runtime is absent.
90
91
 
@@ -107,7 +108,7 @@ enforcement=hard
107
108
  PM 在需要持久化追踪时:
108
109
 
109
110
  1. 建 `.mstar/`、`plans/`、`status.json`(**v2 空模板**见 **`mstar-artifacts/templates/status.empty.json`**:`version: 2` + `workflows: []`)
110
- 2. 可选 `notes.json`(legacy)、`knowledge/`、`iterations/`、`{HARNESS_DIR}/specs/`、`sdd/`(空目录占位;运行时 per-plan 子目录由 **`mstar-sdd`** → `mstar sdd workspace <plan-id>` 创建;`workflows/` / `projects/` 由 engine writers 按需创建,**不**预建)
111
+ 2. 可选 `knowledge/`、`iterations/`、`{HARNESS_DIR}/specs/`、`sdd/`(空目录占位;运行时 per-plan 子目录由 **`mstar-sdd`** → `mstar sdd workspace <plan-id>` 创建;`workflows/` / `projects/` 由 engine writers 按需创建,**不**预建)
111
112
  3. 项目根 `.gitignore` 追加 Morning Star **进程产物**忽略集(见下文「Git 跟踪策略」)— CLI `init` 可自动添加
112
113
  4. Git:**进程本地、结果共享** — 默认跟踪 `{HARNESS_DIR}/AGENTS.md`、`{KNOWLEDGE_DIR}/**`、`{SPECS_DIR}/**`;`plans/`、`iterations/`、`status.json` 等为**本地会话 SSOT**,默认 gitignored。跨 clone 持久 handoff = knowledge + specs + `{HARNESS_DIR}/AGENTS.md`(及根 `CONCEPTS.md` / `STRATEGY.md` 若使用);须跨 clone 的 residual 须提升(compound)或写入 tracked results — **勿**默认 `git add` `status.json` / `plans/`。
113
114
 
@@ -129,7 +130,6 @@ PM 在需要持久化追踪时:
129
130
  - `iterations/`
130
131
  - `plans/`
131
132
  - `sdd/`
132
- - `notes.json`(legacy;运行时 notes 走 `workflows/<id>/notes.jsonl`)
133
133
  - `status.json`
134
134
  - `workflows/`(v3 每 lifecycle 运行态:`<id>/snapshot.json` + `<id>/notes.jsonl`)
135
135
  - `projects/`(v3 项目层:`<id>/roadmap.md` + `<id>/residuals.json`)
@@ -47,7 +47,6 @@
47
47
  | `docs/` | 人类文档(安装、贡献指南等),知识产物不放此处 |
48
48
  | `{ITERATION_DIR}/` | 迭代 package(compass + guides/specs);知识文档不放此处 |
49
49
  | `{SPECS_DIR}/` | 仅限冻结规格/ADR,运行时知识不放此处 |
50
- | `{PLAN_DIR}/reports/` | Legacy / explicit audit mode only;默认 QC/QA 原始过程报告进 `{SDD_DIR}/review/`,知识文档不放此处 |
51
50
 
52
51
  ## `<category>` 取值
53
52
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  1. 创建 `{HARNESS_DIR}`(推荐 `.mstar/`)与 `{PLAN_DIR}`(推荐 `.mstar/plans/`)。
16
16
  2. 初始化 `status.json`:从 **`mstar-artifacts/templates/status.empty.json`** 复制(**v2 形状**:`version: 2` + `workflows: []`);residual canonical 见 **`mstar-artifacts` SKILL.md**;字段与生命周期见 **`mstar-artifacts/references/status-and-residuals.md`**。`workflows/` 与 `projects/` 子目录由 engine writers 按需创建(**不**在 bootstrap 预建)。
17
- 3. 初始化可选 `notes.json`(legacy);`sdd/` 空目录占位(per-plan 子目录由 **`mstar-sdd`** → `mstar sdd workspace <plan-id>` 创建)。
17
+ 3. `sdd/` 空目录占位(per-plan 子目录由 **`mstar-sdd`** → `mstar sdd workspace <plan-id>` 创建)。
18
18
  4. 项目根 `.gitignore` 追加 Morning Star **进程产物**忽略集(canonical snippet → `mstar-conventions` SKILL.md「Git 跟踪策略」;legacy `.agents/` 有等价表)。
19
19
  5. 可选:创建 `{ITERATION_DIR}`(`iterations/` + `README.md`)与 `{KNOWLEDGE_DIR}`(`knowledge/` + `README.md`);`{HARNESS_DIR}/specs/`(解析后的 `{SPECS_DIR}` 默认落点);内容边界见 `mstar-conventions` SKILL.md 与 `references/knowledge-and-designs.md`。
20
20
  6. 创建 `{HARNESS_DIR}/AGENTS.md`(harness 子树规则;**tracked**):符号表可复述 `{HARNESS_DIR}`、`{PLAN_DIR}`、`{ITERATION_DIR}`、`{KNOWLEDGE_DIR}`、`{SPECS_DIR}` 与 `docs/` 分工;新项目推荐 `.mstar/AGENTS.md`,已有项目可继续使用 `.agents/AGENTS.md`。
@@ -28,7 +28,7 @@
28
28
  | 类别 | 默认 tracked | 默认 gitignored |
29
29
  |------|--------------|-----------------|
30
30
  | 结果(跨 clone handoff) | `{HARNESS_DIR}/AGENTS.md`、`{KNOWLEDGE_DIR}/**`、`{SPECS_DIR}/**` | — |
31
- | 进程(本地会话 SSOT) | — | `plans/`、`iterations/`、`status.json`、`workflows/`、`projects/`、`notes.json`、`sdd/`、`archived/` |
31
+ | 进程(本地会话 SSOT) | — | `plans/`、`iterations/`、`status.json`、`workflows/`、`projects/`、`sdd/`、`archived/` |
32
32
 
33
33
  跨 clone 须持久的 residual 或决策:经 **`mstar-compound`** 提升入 `{KNOWLEDGE_DIR}/`、写入 `{SPECS_DIR}/`,或记入 tracked `{HARNESS_DIR}/AGENTS.md` — **勿**默认 `git add` `status.json` / `plans/`。
34
34
 
@@ -19,8 +19,8 @@ Legacy fallbacks:
19
19
 
20
20
  1. Create `{HARNESS_DIR}` and `{PLAN_DIR}` when absent.
21
21
  2. Initialize `{HARNESS_DIR}/status.json` from template if available.
22
- 3. Ensure Morning Star **process-artifact** gitignore set is present (canonical snippet → `mstar-conventions` SKILL.md「Git 跟踪策略」): `{HARNESS_DIR}/archived/`, `iterations/`, `plans/`, `sdd/`, `notes.json`, `status.json`, `workflows/`, `projects/` (legacy `.agents/` equivalents when applicable). Per-plan `{SDD_DIR}/review/` is created by the SDD/review flow when needed.
23
- 4. Optional: `{HARNESS_DIR}/notes.json` (legacy), `{HARNESS_DIR}/knowledge/README.md`. `workflows/` / `projects/` subdirs are created on demand by engine writers — no pre-creation.
22
+ 3. Ensure Morning Star **process-artifact** gitignore set is present (canonical snippet → `mstar-conventions` SKILL.md「Git 跟踪策略」): `{HARNESS_DIR}/archived/`, `iterations/`, `plans/`, `sdd/`, `status.json`, `workflows/`, `projects/` (legacy `.agents/` equivalents when applicable). Per-plan `{SDD_DIR}/review/` is created by the SDD/review flow when needed.
23
+ 4. Optional: `{HARNESS_DIR}/knowledge/README.md`. `workflows/` / `projects/` subdirs are created on demand by engine writers — no pre-creation.
24
24
 
25
25
  If legacy plan directories already exist, reuse them; avoid dual-structure duplication.
26
26
 
@@ -29,7 +29,7 @@ If legacy plan directories already exist, reuse them; avoid dual-structure dupli
29
29
  **Principle:** process stays local; results are shared with the team. Full rules → `mstar-conventions` SKILL.md「Git 跟踪策略」.
30
30
 
31
31
  - **Default tracked** under `{HARNESS_DIR}`: `AGENTS.md`, `{KNOWLEDGE_DIR}/**`, `{SPECS_DIR}/**` (resolved specs path; default `{HARNESS_DIR}/specs/`).
32
- - **Default gitignored** (local session SSOT / coordination): `archived/`, `iterations/`, `plans/`, `sdd/`, `notes.json`, `status.json`, `workflows/`, `projects/`.
32
+ - **Default gitignored** (local session SSOT / coordination): `archived/`, `iterations/`, `plans/`, `sdd/`, `status.json`, `workflows/`, `projects/`.
33
33
  - `status.json` (v2 root), workflow snapshots, project registers and main plan files remain **local session SSOT** — PM must keep them current on disk, but **do not** default `git add` / `git commit` for cross-clone handoff. Promote durable residuals and decisions into tracked `knowledge/` / `specs/` / `AGENTS.md` (compound) when they must survive clone.
34
34
  - If a project explicitly opts into tracking process artifacts, record that policy in `{HARNESS_DIR}/AGENTS.md` and ensure team alignment.
35
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mstar-harness/dsh",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "description": "Morning Star harness dsh (DeepSeek Harness) cordis function plugin — in-process engine gates (status/dispatch/lease) with hard refusal channels.",
5
5
  "keywords": [
6
6
  "dsh",