@kangyishuai/dsh-casefile 0.7.0 → 0.7.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.
Files changed (2) hide show
  1. package/lib/core/bundle.js +11 -3
  2. package/package.json +1 -1
@@ -87,9 +87,17 @@ export function buildBundle(input) {
87
87
  const generatedAt =
88
88
  latestTimestamp(all) ?? input.project?.updatedAt ?? "1970-01-01T00:00:00.000Z";
89
89
 
90
- const artifacts = input.evidence
91
- .map((item) => item.artifact)
92
- .filter((item) => item && typeof item === "object")
90
+ // 同一份产物可能被多条证据引用(例如一份外部报告是整组结论的出处)。
91
+ // 清单是"有哪些产物",不是"被引用了几次",所以按 sha256 去重。
92
+ /** @type {Map<string, Record<string, any>>} */
93
+ const artifactByDigest = new Map();
94
+ for (const item of input.evidence) {
95
+ const artifact = item?.artifact;
96
+ if (!artifact || typeof artifact !== "object") continue;
97
+ if (!artifactByDigest.has(String(artifact.sha256)))
98
+ artifactByDigest.set(String(artifact.sha256), artifact);
99
+ }
100
+ const artifacts = [...artifactByDigest.values()]
93
101
  .map((item) => ({
94
102
  sha256: item.sha256,
95
103
  file: item.file,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kangyishuai/dsh-casefile",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Evidence-first reverse-engineering workbench on top of REA: observations become citable evidence, a handoff spec pack, and recomputable acceptance checks. No bridge, no engine.",
5
5
  "keywords": [
6
6
  "dsh",