dsh-hashcheck 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.
Files changed (2) hide show
  1. package/package.json +11 -2
  2. package/src/index.js +7 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-hashcheck",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "SHA-256 manifests for delivered files: build once, verify anywhere, and say exactly which bytes moved instead of 'looks fine'.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -26,7 +26,16 @@
26
26
  "README.md",
27
27
  "LICENSE"
28
28
  ],
29
- "keywords": ["dsh", "dsh-plugin", "deepseek-harness", "sha256", "hash-manifest", "delivery-verification", "交付校验", "文件哈希"],
29
+ "keywords": [
30
+ "dsh",
31
+ "dsh-plugin",
32
+ "deepseek-harness",
33
+ "sha256",
34
+ "hash-manifest",
35
+ "delivery-verification",
36
+ "交付校验",
37
+ "文件哈希"
38
+ ],
30
39
  "license": "MIT",
31
40
  "author": "zjukop3",
32
41
  "repository": {
package/src/index.js CHANGED
@@ -5,6 +5,10 @@
5
5
  import { createHash } from 'node:crypto'
6
6
  import { readdir, readFile, stat } from 'node:fs/promises'
7
7
  import { join, relative, sep } from 'node:path'
8
+ import { createRequire } from 'node:module'
9
+
10
+ const require = createRequire(import.meta.url)
11
+ export const packageVersion = require('../package.json').version
8
12
 
9
13
  export const name = 'hashcheck'
10
14
  export const inject = ['webServer']
@@ -55,6 +59,7 @@ export async function buildManifest(directory, options = {}) {
55
59
  // what was excluded would report every excluded file as unlisted.
56
60
  ignore: [...(options.ignore || [])].sort(),
57
61
  files: entries,
62
+ packageVersion,
58
63
  }
59
64
  }
60
65
 
@@ -107,7 +112,7 @@ export async function verifyManifest(manifest, directory, { reportExtra = true,
107
112
  }
108
113
  }
109
114
  const errors = findings.filter(finding => finding.level === 'error').length
110
- return { ok: errors === 0, checked: listed.length, errors, warnings: findings.length - errors, findings }
115
+ return { ok: errors === 0, checked: listed.length, errors, warnings: findings.length - errors, findings, packageVersion }
111
116
  }
112
117
 
113
118
  // The host route is a thin wrapper: the CLI and the route call the same
@@ -139,4 +144,5 @@ export function apply(ctx, config = {}) {
139
144
  }
140
145
  }
141
146
  ctx.effect(() => ctx.webServer.register({ kind: 'prefix', path: prefix, handler }))
147
+ ctx.effect(() => ctx.logger.info(`hashcheck ${packageVersion} loaded`))
142
148
  }