dsh-standards 1.6.5 → 1.6.7
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/31-DS-C/346/235/241/346/254/276.md +7 -5
- package/40-checker/fixtures/security/sec16-vendor-bundle/lib/index.js +16 -0
- package/40-checker/fixtures/security/sec16-vendor-bundle/package.json +22 -0
- package/40-checker/fixtures/security/sec16-vendor-decoy/lib/index.js +5 -0
- package/40-checker/fixtures/security/sec16-vendor-decoy/package.json +22 -0
- package/40-checker/fixtures/security/sec16-vendor-path/index.mjs +1 -0
- package/40-checker/fixtures/security/sec16-vendor-path/package.json +19 -0
- package/40-checker/fixtures/security/sec16-vendor-path/vendor/schemastery.mjs +4 -0
- package/40-checker/scripts/build-sidecar.mjs +96 -3
- package/40-checker/scripts/flow-collect.mjs +26 -8
- package/40-checker/src/author-cli.mjs +10 -1
- package/40-checker/src/cli.mjs +100 -9
- package/40-checker/src/manifest.mjs +180 -51
- package/40-checker/src/security.mjs +201 -15
- package/CHANGELOG.md +28 -0
- package/docs/coverage.md +1 -1
- package/package.json +1 -1
- package/spec/coverage-contract.md +1 -1
- package/spec/dsc-clauses.json +1 -1
- package/spec/remediation.json +1 -1
- package/spec/schemas/conformance.schema.json +4 -0
|
@@ -11,6 +11,11 @@ const PACKAGE_NAME = /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/
|
|
|
11
11
|
const PACKAGE_NAME_MAX_LENGTH = 214
|
|
12
12
|
const EXACT_VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/
|
|
13
13
|
const COMMIT = /^[0-9a-f]{40}$/
|
|
14
|
+
// A dsh registry id is `<owner>/<name>` (the sidebar uses
|
|
15
|
+
// `dsh-external/dsh-better-sidebar`); it is not required to be an npm name.
|
|
16
|
+
const REGISTRY_ID = /^[a-z0-9][a-z0-9._~-]*(?:\/[a-z0-9][a-z0-9._~-]*)?$/
|
|
17
|
+
const UNKNOWN_HOST_HOW = 'pass --host-version <v> (or run `check --allow-host-probe`); without a host version C-2.1/C-2.2 stay NA and compatibility is not judged'
|
|
18
|
+
const UNKNOWN_HOST_REASON = '未指定 host 版本(host version not specified),兼容性未判定(compatibility not judged);C-2.1/C-2.2 are NA, not FAIL/PASS'
|
|
14
19
|
|
|
15
20
|
export const DEFAULT_RUNTIME_VERSION = '0.2.2-alpha.2'
|
|
16
21
|
|
|
@@ -157,96 +162,168 @@ function analyzePatch(dir, manifest) {
|
|
|
157
162
|
return { present: true, files, problems, rows, enabledPluginManagerTools }
|
|
158
163
|
}
|
|
159
164
|
|
|
160
|
-
function supplyChain(dir, manifest) {
|
|
165
|
+
function supplyChain(dir, manifest, { registry = false, packageJsonAvailable = true } = {}) {
|
|
161
166
|
const details = []
|
|
167
|
+
const label = registry ? 'dsh.plugin.json' : 'package.json'
|
|
168
|
+
if (registry && !packageJsonAvailable) {
|
|
169
|
+
details.push(detail('C-3.3', 'NA', 'registry layout has no package.json; dependency provenance is not judged', [`${label}#dependencies`]))
|
|
170
|
+
details.push(detail('C-3.4', 'NA', 'registry layout has no package.json scripts; install-time scripts are not judged', [`${label}#scripts`]))
|
|
171
|
+
return details
|
|
172
|
+
}
|
|
162
173
|
const dependencies = isObject(manifest.dependencies) ? manifest.dependencies : {}
|
|
163
174
|
const peers = isObject(manifest.peerDependencies) ? manifest.peerDependencies : {}
|
|
164
175
|
const all = { ...dependencies, ...peers }
|
|
165
176
|
for (const [name, value] of Object.entries(all)) {
|
|
166
177
|
if (typeof value !== 'string') continue
|
|
167
178
|
if (/^(?:workspace|file|link|portal):/i.test(value)) {
|
|
168
|
-
details.push(detail('C-3.3', 'WARN', `non-registry dependency ${name}: ${value}`, [
|
|
179
|
+
details.push(detail('C-3.3', 'WARN', `non-registry dependency ${name}: ${value}`, [`${label}#dependencies.${name}`]))
|
|
169
180
|
continue
|
|
170
181
|
}
|
|
171
182
|
if (/^(?:git\+|git@|github:|gitlab:|bitbucket:|gist:|https?:)/i.test(value)) {
|
|
172
183
|
if (!/#[0-9a-f]{40}$/.test(value) && !/^https?:\/\/[^#]+\.(?:tgz|tar\.gz)/i.test(value)) {
|
|
173
|
-
details.push(detail('C-3.3', 'WARN', `non-registry dependency ${name} is not pinned to a commit: ${value}`, [
|
|
184
|
+
details.push(detail('C-3.3', 'WARN', `non-registry dependency ${name} is not pinned to a commit: ${value}`, [`${label}#dependencies.${name}`]))
|
|
174
185
|
}
|
|
175
186
|
}
|
|
176
187
|
}
|
|
177
188
|
const scripts = isObject(manifest.scripts) ? manifest.scripts : {}
|
|
178
189
|
for (const name of ['preinstall', 'install', 'postinstall', 'prepare']) {
|
|
179
190
|
if (typeof scripts[name] === 'string') {
|
|
180
|
-
details.push(detail('C-3.4', 'WARN', `install-time build script present: scripts.${name}`, [
|
|
191
|
+
details.push(detail('C-3.4', 'WARN', `install-time build script present: scripts.${name}`, [`${label}#scripts.${name}`]))
|
|
181
192
|
}
|
|
182
193
|
}
|
|
183
194
|
return details
|
|
184
195
|
}
|
|
185
196
|
|
|
197
|
+
/**
|
|
198
|
+
* A `dsh.plugin.json` registry layout is not an npm package: it has no
|
|
199
|
+
* package.json, and its fields are `id`/`main`/`client.main`/`engines.dsh`
|
|
200
|
+
* instead of `name`/`exports`/`dsh.client`. Normalize it into the shape the
|
|
201
|
+
* existing checks understand, and let the registry-specific branches below
|
|
202
|
+
* downgrade package.json-only fields to NA instead of inventing them.
|
|
203
|
+
*/
|
|
204
|
+
export function normalizeRegistryManifest(raw, packageJson = null) {
|
|
205
|
+
const value = isObject(raw) ? raw : {}
|
|
206
|
+
const pkg = isObject(packageJson) ? packageJson : {}
|
|
207
|
+
const pkgDsh = isObject(pkg.dsh) ? pkg.dsh : null
|
|
208
|
+
const client = isObject(value.client)
|
|
209
|
+
? value.client
|
|
210
|
+
: isObject(pkgDsh?.client) ? pkgDsh.client : null
|
|
211
|
+
const main = typeof value.main === 'string' && value.main.trim() !== ''
|
|
212
|
+
? value.main
|
|
213
|
+
: typeof pkg.main === 'string' && pkg.main.trim() !== '' ? pkg.main : null
|
|
214
|
+
const clientMain = typeof client?.main === 'string' && client.main.trim() !== '' ? client.main : null
|
|
215
|
+
const exportsField = value.exports !== undefined
|
|
216
|
+
? value.exports
|
|
217
|
+
: {
|
|
218
|
+
...(main ? { '.': main } : {}),
|
|
219
|
+
...(clientMain ? { './client': clientMain } : {}),
|
|
220
|
+
}
|
|
221
|
+
const dsh = isObject(value.dsh) ? { ...value.dsh } : {}
|
|
222
|
+
if (typeof dsh.kind !== 'string' || dsh.kind === '') dsh.kind = 'plugin'
|
|
223
|
+
if (client) dsh.client = { ...client }
|
|
224
|
+
const capabilities = Array.isArray(value.capabilities)
|
|
225
|
+
? value.capabilities
|
|
226
|
+
: isObject(value.contributes) && Array.isArray(value.contributes.capabilities)
|
|
227
|
+
? value.contributes.capabilities
|
|
228
|
+
: Array.isArray(pkgDsh?.capabilities) ? pkgDsh.capabilities : undefined
|
|
229
|
+
if (capabilities) dsh.capabilities = capabilities
|
|
230
|
+
if (Array.isArray(pkgDsh?.labels) && dsh.labels === undefined) dsh.labels = pkgDsh.labels
|
|
231
|
+
return {
|
|
232
|
+
name: typeof value.name === 'string' && value.name.trim() !== '' ? value.name : value.id ?? pkg.name,
|
|
233
|
+
version: value.version ?? pkg.version,
|
|
234
|
+
main,
|
|
235
|
+
exports: exportsField,
|
|
236
|
+
engines: value.engines ?? pkg.engines,
|
|
237
|
+
peerDependencies: value.peerDependencies ?? pkg.peerDependencies,
|
|
238
|
+
license: value.license ?? pkg.license,
|
|
239
|
+
repository: value.repository ?? value.repo ?? pkg.repository,
|
|
240
|
+
dependencies: value.dependencies ?? pkg.dependencies,
|
|
241
|
+
scripts: value.scripts ?? pkg.scripts,
|
|
242
|
+
private: value.private ?? pkg.private,
|
|
243
|
+
workspaces: value.workspaces ?? pkg.workspaces,
|
|
244
|
+
type: value.type ?? pkg.type,
|
|
245
|
+
dsh,
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
186
249
|
/**
|
|
187
250
|
* @param {string} dir
|
|
188
|
-
* @param {{runtimeVersion?: string, installSpec?: string, marketIndex?: string, pluginName?: string}} options
|
|
251
|
+
* @param {{runtimeVersion?: string, installSpec?: string, marketIndex?: string, pluginName?: string, registry?: boolean, compatibilityKnown?: boolean}} options
|
|
189
252
|
*/
|
|
190
253
|
export function runManifestChecks(dir, options = {}) {
|
|
191
254
|
const runtimeVersion = options.runtimeVersion ?? DEFAULT_RUNTIME_VERSION
|
|
192
|
-
const
|
|
255
|
+
const compatibilityKnown = options.compatibilityKnown !== false
|
|
256
|
+
const packagePath = path.join(dir, 'package.json')
|
|
257
|
+
const registryPath = path.join(dir, 'dsh.plugin.json')
|
|
258
|
+
const packageJsonAvailable = isFile(packagePath)
|
|
259
|
+
const registryMode = options.registry === true || (!packageJsonAvailable && isFile(registryPath))
|
|
260
|
+
const manifestPath = registryMode ? registryPath : packagePath
|
|
261
|
+
const manifestLabel = registryMode ? 'dsh.plugin.json' : 'package.json'
|
|
262
|
+
const parsed = readJsonMaybe(manifestPath)
|
|
193
263
|
if (parsed.error) {
|
|
264
|
+
const source = registryMode ? 'dsh.plugin.json' : 'package.json'
|
|
194
265
|
return {
|
|
195
266
|
manifest: null,
|
|
267
|
+
manifestSource: registryMode ? 'registry' : 'package',
|
|
268
|
+
manifestPath,
|
|
196
269
|
kind: 'unknown',
|
|
197
270
|
entry: null,
|
|
198
271
|
patch: null,
|
|
199
272
|
g4: { hasClient: false, ok: true, result: 'NA', reason: 'manifest unavailable' },
|
|
200
273
|
checks: [
|
|
201
|
-
check({ id: 'DSC-01', clause: 'C-1', layer: 'L0', result: 'FAIL', reason:
|
|
274
|
+
check({ id: 'DSC-01', clause: 'C-1', layer: 'L0', result: 'FAIL', reason: `${source} is missing or invalid: ${parsed.error.message}`, details: [detail('C-1.1', 'FAIL', parsed.error.message)], evidence: [source] }),
|
|
202
275
|
check({ id: 'DSC-02', clause: 'C-2', layer: 'L0', result: 'ERROR', coverage: 'not-run', reason: 'manifest unavailable' }),
|
|
203
276
|
check({ id: 'DSC-03', clause: 'C-3', layer: 'L0', result: 'NA', reason: 'manifest unavailable' }),
|
|
204
277
|
],
|
|
205
278
|
}
|
|
206
279
|
}
|
|
207
|
-
const
|
|
280
|
+
const packageJsonValue = packageJsonAvailable ? readJsonMaybe(packagePath).value : null
|
|
281
|
+
const manifest = registryMode ? normalizeRegistryManifest(parsed.value, packageJsonValue) : parsed.value
|
|
208
282
|
const entry = resolveEntry(dir, manifest)
|
|
209
283
|
const kindInfo = inferKind(manifest, entry.exists)
|
|
210
284
|
const kind = kindInfo.kind
|
|
211
285
|
const patch = analyzePatch(dir, manifest)
|
|
212
286
|
const g4 = checkClientShape(manifest, dir)
|
|
287
|
+
const packageFieldsJudged = !registryMode || packageJsonAvailable
|
|
213
288
|
|
|
214
289
|
const manifestDetails = []
|
|
215
290
|
const name = manifest.name
|
|
216
|
-
|
|
217
|
-
|
|
291
|
+
const validName = typeof name === 'string' && name.trim() !== '' && name.length <= PACKAGE_NAME_MAX_LENGTH
|
|
292
|
+
&& (PACKAGE_NAME.test(name) || (registryMode && REGISTRY_ID.test(name)))
|
|
293
|
+
if (!validName) {
|
|
294
|
+
manifestDetails.push(detail('C-1.1', 'FAIL', registryMode ? 'id must be a valid registry plugin id (<owner>/<name>)' : 'name must be a valid npm package name', [`${manifestLabel}#${registryMode ? 'id' : 'name'}`]))
|
|
218
295
|
} else {
|
|
219
296
|
manifestDetails.push(detail('C-1.1', 'PASS', `name=${name}`))
|
|
220
297
|
}
|
|
221
298
|
if (typeof manifest.version !== 'string' || !EXACT_VERSION.test(manifest.version)) {
|
|
222
|
-
manifestDetails.push(detail('C-1.1', 'FAIL', 'version must be an exact SemVer version', [
|
|
299
|
+
manifestDetails.push(detail('C-1.1', 'FAIL', 'version must be an exact SemVer version', [`${manifestLabel}#version`]))
|
|
223
300
|
} else {
|
|
224
301
|
manifestDetails.push(detail('C-1.1', 'PASS', `version=${manifest.version}`))
|
|
225
302
|
}
|
|
226
303
|
if (entry.escape) {
|
|
227
|
-
manifestDetails.push(detail('C-1.2', 'FAIL', `entry escapes the package: ${entry.target}`, [
|
|
304
|
+
manifestDetails.push(detail('C-1.2', 'FAIL', `entry escapes the package: ${entry.target}`, [`${manifestLabel}#exports`]))
|
|
228
305
|
} else if (entry.declaredMissing) {
|
|
229
306
|
// A declared entry that is absent is a packaging defect. A build hint only
|
|
230
307
|
// explains it; it does not make the package loadable from the tarball.
|
|
231
308
|
const hint = entry.buildHint
|
|
232
309
|
? ` (build hint: ${entry.sourceEntry ?? 'build script'}; publish the built file)`
|
|
233
310
|
: ''
|
|
234
|
-
manifestDetails.push(detail('C-1.2', 'FAIL', `exports["."] points to a missing file: ${entry.target}${hint}`, [
|
|
311
|
+
manifestDetails.push(detail('C-1.2', 'FAIL', `exports["."] points to a missing file: ${entry.target}${hint}`, [`${manifestLabel}#exports`]))
|
|
235
312
|
} else if (entry.exists) {
|
|
236
313
|
manifestDetails.push(detail('C-1.2', 'PASS', `entry resolves via ${entry.source}: ${entry.relative}`, [entry.relative]))
|
|
237
314
|
} else if (entry.buildHint) {
|
|
238
|
-
manifestDetails.push(detail('C-1.2', 'WARN', `entry not present in checkout; source/build hint exists (${entry.sourceEntry ?? 'build script'})`, [
|
|
315
|
+
manifestDetails.push(detail('C-1.2', 'WARN', `entry not present in checkout; source/build hint exists (${entry.sourceEntry ?? 'build script'})`, [`${manifestLabel}#scripts`]))
|
|
239
316
|
} else if (kind === 'bundle' && patch.present) {
|
|
240
317
|
// 2026-11-04: a bundle that ships only a cordis.patch.yml has no runtime entry
|
|
241
318
|
// by design (dsh.bundle.patch is the carrier). Report NA, not WARN, so the
|
|
242
319
|
// mandatory coverage is not charged for something the package never claimed.
|
|
243
320
|
manifestDetails.push(detail('C-1.2', 'NA', 'patch-only bundle; no runtime entry by design', patch.files.map(f => f.relative)))
|
|
244
321
|
} else if (kind === 'bundle' || kind === 'client') {
|
|
245
|
-
manifestDetails.push(detail('C-1.2', 'WARN', `no runtime entry; ${kind} packages may be patch/client only`, [
|
|
322
|
+
manifestDetails.push(detail('C-1.2', 'WARN', `no runtime entry; ${kind} packages may be patch/client only`, [`${manifestLabel}#exports`]))
|
|
246
323
|
} else if (Array.isArray(manifest.workspaces) || (manifest.workspaces && typeof manifest.workspaces === 'object')) {
|
|
247
|
-
manifestDetails.push(detail('C-1.2', 'NA', 'workspace root; run the checker on a package subdirectory', [
|
|
324
|
+
manifestDetails.push(detail('C-1.2', 'NA', 'workspace root; run the checker on a package subdirectory', [`${manifestLabel}#workspaces`]))
|
|
248
325
|
} else {
|
|
249
|
-
manifestDetails.push(detail('C-1.2', 'FAIL', 'no resolvable runtime entry', [
|
|
326
|
+
manifestDetails.push(detail('C-1.2', 'FAIL', 'no resolvable runtime entry', [`${manifestLabel}#exports`, `${manifestLabel}#main`]))
|
|
250
327
|
}
|
|
251
328
|
|
|
252
329
|
// Declared `exports` subpaths and `main` must point at files that ship with
|
|
@@ -273,10 +350,10 @@ export function runManifestChecks(dir, options = {}) {
|
|
|
273
350
|
}
|
|
274
351
|
for (const item of exportTargets(manifest.exports)) {
|
|
275
352
|
if (item.label === 'exports["."]') continue // resolveEntry() already judged the root export
|
|
276
|
-
noteTarget(item.label, item.target,
|
|
353
|
+
noteTarget(item.label, item.target, `${manifestLabel}#exports`)
|
|
277
354
|
}
|
|
278
355
|
if (typeof manifest.main === 'string' && manifest.main.trim() !== '') {
|
|
279
|
-
noteTarget('main', manifest.main,
|
|
356
|
+
noteTarget('main', manifest.main, `${manifestLabel}#main`, { allowBare: true })
|
|
280
357
|
}
|
|
281
358
|
manifestDetails.push(...missingTargetDetails.slice(0, 8))
|
|
282
359
|
const shape = checkExportShape(entry, kind)
|
|
@@ -289,36 +366,66 @@ export function runManifestChecks(dir, options = {}) {
|
|
|
289
366
|
manifestDetails.push(detail('C-1.4', 'PASS', `bundle patch present (${patch.files.length} file(s))`, patch.files.map(file => file.relative)))
|
|
290
367
|
}
|
|
291
368
|
if (typeof manifest.license !== 'string' || manifest.license.trim() === '') {
|
|
292
|
-
|
|
369
|
+
if (!packageFieldsJudged) {
|
|
370
|
+
manifestDetails.push(detail('C-1.5', 'NA', 'registry layout has no package.json and dsh.plugin.json declares no license; license not judged', [`${manifestLabel}#license`]))
|
|
371
|
+
} else {
|
|
372
|
+
manifestDetails.push(detail('C-1.5', 'WARN', 'license is missing', [`${manifestLabel}#license`]))
|
|
373
|
+
}
|
|
293
374
|
} else {
|
|
294
375
|
manifestDetails.push(detail('C-1.5', 'PASS', `license=${manifest.license}`))
|
|
295
376
|
}
|
|
296
377
|
if (manifest.private === true) {
|
|
297
|
-
manifestDetails.push(detail('C-1.6', 'NA', 'private:true; not publishable to a registry', [
|
|
378
|
+
manifestDetails.push(detail('C-1.6', 'NA', 'private:true; not publishable to a registry', [`${manifestLabel}#private`]))
|
|
379
|
+
} else if (!packageFieldsJudged) {
|
|
380
|
+
manifestDetails.push(detail('C-1.6', 'NA', 'registry layout has no package.json; private/publishability is not judged', [`${manifestLabel}#private`]))
|
|
298
381
|
}
|
|
299
382
|
const manifestResult = worst(manifestDetails.map(item => item.result))
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
383
|
+
const manifestNaReasons = registryMode
|
|
384
|
+
? manifestDetails.filter(item => item.result === 'NA').map(item => `${item.item}: ${item.reason}`)
|
|
385
|
+
: []
|
|
386
|
+
const manifestCheck = {
|
|
387
|
+
...check({
|
|
388
|
+
id: 'DSC-01',
|
|
389
|
+
clause: 'C-1',
|
|
390
|
+
layer: 'L0',
|
|
391
|
+
result: manifestResult,
|
|
392
|
+
coverage: packageFieldsJudged ? 'full' : 'partial',
|
|
393
|
+
reason: [
|
|
394
|
+
manifestDetails.filter(item => item.result !== 'PASS' && item.result !== 'NA').map(item => `${item.item}: ${item.reason}`).join(' | '),
|
|
395
|
+
...manifestNaReasons,
|
|
396
|
+
].filter(Boolean).join(' | '),
|
|
397
|
+
details: manifestDetails,
|
|
398
|
+
evidence: [manifestLabel],
|
|
399
|
+
}),
|
|
400
|
+
...(packageFieldsJudged ? {} : {
|
|
401
|
+
howToEnable: 'run against the npm package directory (package.json) to judge license/dependencies/scripts; a registry layout only carries dsh.plugin.json fields',
|
|
402
|
+
}),
|
|
403
|
+
}
|
|
309
404
|
|
|
310
405
|
const compatDetails = []
|
|
311
406
|
const engines = isObject(manifest.engines) ? manifest.engines : {}
|
|
312
407
|
const dshEngine = engines.dsh
|
|
313
408
|
const peers = isObject(manifest.peerDependencies) ? manifest.peerDependencies : {}
|
|
314
409
|
const dshPeers = Object.entries(peers).filter(([peer]) => peer === '@deepseek-ai/dsh' || peer.startsWith('@deepseek-ai/dsh-'))
|
|
315
|
-
|
|
410
|
+
const compatEvidence = [`${manifestLabel}#engines.dsh`, `${manifestLabel}#peerDependencies`]
|
|
411
|
+
if (!compatibilityKnown) {
|
|
412
|
+
// The fallback constant is not a host. Never turn it into a C-2 FAIL:
|
|
413
|
+
// record the declared ranges as NA/partial and point at the flag that
|
|
414
|
+
// would make the verdict possible.
|
|
415
|
+
const declared = typeof dshEngine === 'string'
|
|
416
|
+
? `engines.dsh=${dshEngine}`
|
|
417
|
+
: dshPeers.length > 0
|
|
418
|
+
? `dsh peer range(s)=${dshPeers.map(([peer, range]) => `${peer}:${range}`).join(', ')}`
|
|
419
|
+
: 'no engines.dsh or @deepseek-ai/dsh* peer range declared'
|
|
420
|
+
compatDetails.push(detail('C-2.1', 'NA', `${UNKNOWN_HOST_REASON}; declaration recorded (${declared}) but validity is not judged`, compatEvidence))
|
|
421
|
+
compatDetails.push(detail('C-2.2', 'NA', `${UNKNOWN_HOST_REASON}; runtime compatibility is not judged`, compatEvidence))
|
|
422
|
+
} else if (typeof dshEngine === 'string') {
|
|
316
423
|
if (dshEngine.startsWith('workspace:')) {
|
|
317
|
-
compatDetails.push(detail('C-2.3', 'FAIL', 'engines.dsh must not be a workspace: range', [
|
|
424
|
+
compatDetails.push(detail('C-2.3', 'FAIL', 'engines.dsh must not be a workspace: range', [`${manifestLabel}#engines.dsh`]))
|
|
318
425
|
} else if (!validRange(dshEngine)) {
|
|
319
|
-
compatDetails.push(detail('C-2.1', 'FAIL', `engines.dsh is not a SemVer range: ${dshEngine}`, [
|
|
426
|
+
compatDetails.push(detail('C-2.1', 'FAIL', `engines.dsh is not a SemVer range: ${dshEngine}`, [`${manifestLabel}#engines.dsh`]))
|
|
320
427
|
} else if (!satisfies(runtimeVersion, dshEngine)) {
|
|
321
|
-
compatDetails.push(detail('C-2.2', 'FAIL', `engines.dsh ${dshEngine} is valid but does not satisfy runtime ${runtimeVersion}`, [
|
|
428
|
+
compatDetails.push(detail('C-2.2', 'FAIL', `engines.dsh ${dshEngine} is valid but does not satisfy runtime ${runtimeVersion}`, [`${manifestLabel}#engines.dsh`]))
|
|
322
429
|
} else {
|
|
323
430
|
compatDetails.push(detail('C-2.1', 'PASS', `engines.dsh=${dshEngine}`))
|
|
324
431
|
compatDetails.push(detail('C-2.2', 'PASS', `runtime ${runtimeVersion} satisfies ${dshEngine}`))
|
|
@@ -326,7 +433,7 @@ export function runManifestChecks(dir, options = {}) {
|
|
|
326
433
|
for (const [peer, rangeValue] of dshPeers) {
|
|
327
434
|
if (typeof rangeValue !== 'string' || rangeValue.startsWith('workspace:')) continue
|
|
328
435
|
if (validRange(rangeValue) && !satisfies(runtimeVersion, rangeValue)) {
|
|
329
|
-
compatDetails.push(detail('C-2.4', 'WARN', `peer ${peer} range ${rangeValue} conflicts with engines.dsh`, [
|
|
436
|
+
compatDetails.push(detail('C-2.4', 'WARN', `peer ${peer} range ${rangeValue} conflicts with engines.dsh`, [`${manifestLabel}#peerDependencies.${peer}`]))
|
|
330
437
|
}
|
|
331
438
|
}
|
|
332
439
|
} else if (dshPeers.length > 0) {
|
|
@@ -334,18 +441,18 @@ export function runManifestChecks(dir, options = {}) {
|
|
|
334
441
|
let unsatisfied = false
|
|
335
442
|
for (const [peer, rangeValue] of dshPeers) {
|
|
336
443
|
if (typeof rangeValue !== 'string') {
|
|
337
|
-
compatDetails.push(detail('C-2.1', 'FAIL', `peer ${peer} must be a string range`, [
|
|
444
|
+
compatDetails.push(detail('C-2.1', 'FAIL', `peer ${peer} must be a string range`, [`${manifestLabel}#peerDependencies.${peer}`]))
|
|
338
445
|
invalid = true
|
|
339
446
|
continue
|
|
340
447
|
}
|
|
341
448
|
const effective = /^workspace:(?:\^|~|\*)$/.test(rangeValue) ? runtimeVersion : rangeValue
|
|
342
449
|
if (!validRange(effective)) {
|
|
343
|
-
compatDetails.push(detail('C-2.1', 'FAIL', `peer ${peer} is not a SemVer range: ${rangeValue}`, [
|
|
450
|
+
compatDetails.push(detail('C-2.1', 'FAIL', `peer ${peer} is not a SemVer range: ${rangeValue}`, [`${manifestLabel}#peerDependencies.${peer}`]))
|
|
344
451
|
invalid = true
|
|
345
452
|
} else if (!satisfies(runtimeVersion, effective)) {
|
|
346
453
|
// A syntactically valid range that does not cover this runtime is a
|
|
347
454
|
// compatibility finding (C-2.2), never an invalid declaration (C-2.1).
|
|
348
|
-
compatDetails.push(detail('C-2.2', 'FAIL', `peer ${peer} range ${rangeValue} is valid but does not satisfy runtime ${runtimeVersion}`, [
|
|
455
|
+
compatDetails.push(detail('C-2.2', 'FAIL', `peer ${peer} range ${rangeValue} is valid but does not satisfy runtime ${runtimeVersion}`, [`${manifestLabel}#peerDependencies.${peer}`]))
|
|
349
456
|
unsatisfied = true
|
|
350
457
|
}
|
|
351
458
|
}
|
|
@@ -358,20 +465,26 @@ export function runManifestChecks(dir, options = {}) {
|
|
|
358
465
|
compatDetails.push(detail('C-2.2', 'PASS', `runtime ${runtimeVersion} satisfies the dsh peer range(s)`))
|
|
359
466
|
}
|
|
360
467
|
} else {
|
|
361
|
-
compatDetails.push(detail('C-2.1', 'FAIL', 'neither engines.dsh nor a @deepseek-ai/dsh* peer range is declared', [
|
|
468
|
+
compatDetails.push(detail('C-2.1', 'FAIL', 'neither engines.dsh nor a @deepseek-ai/dsh* peer range is declared', [`${manifestLabel}#engines`, `${manifestLabel}#peerDependencies`]))
|
|
362
469
|
}
|
|
363
470
|
const compatResult = worst(compatDetails.map(item => item.result))
|
|
364
|
-
const compatCheck =
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
471
|
+
const compatCheck = {
|
|
472
|
+
...check({
|
|
473
|
+
id: 'DSC-02',
|
|
474
|
+
clause: 'C-2',
|
|
475
|
+
layer: 'L0',
|
|
476
|
+
result: compatResult,
|
|
477
|
+
coverage: compatibilityKnown ? 'full' : 'partial',
|
|
478
|
+
reason: compatibilityKnown
|
|
479
|
+
? compatDetails.filter(item => item.result !== 'PASS' && item.result !== 'NA').map(item => `${item.item}: ${item.reason}`).join(' | ')
|
|
480
|
+
: UNKNOWN_HOST_REASON,
|
|
481
|
+
details: compatDetails,
|
|
482
|
+
evidence: [manifestLabel === 'dsh.plugin.json' ? 'dsh.plugin.json#engines' : 'package.json#engines', `${manifestLabel}#peerDependencies`],
|
|
483
|
+
}),
|
|
484
|
+
...(compatibilityKnown ? {} : { howToEnable: UNKNOWN_HOST_HOW }),
|
|
485
|
+
}
|
|
373
486
|
|
|
374
|
-
const supplyDetails = supplyChain(dir, manifest)
|
|
487
|
+
const supplyDetails = supplyChain(dir, manifest, { registry: registryMode, packageJsonAvailable })
|
|
375
488
|
const installDetails = [...supplyDetails]
|
|
376
489
|
let installResult = 'NA'
|
|
377
490
|
let installReason = 'install spec not supplied (package profile)'
|
|
@@ -393,6 +506,12 @@ export function runManifestChecks(dir, options = {}) {
|
|
|
393
506
|
installResult = worst([market.result, ...supplyDetails.map(item => item.result)])
|
|
394
507
|
installReason = market.reason || (installResult === 'WARN' ? 'market entry is pinned but supply-chain warnings remain' : '')
|
|
395
508
|
}
|
|
509
|
+
if (registryMode && !packageJsonAvailable && installResult !== 'FAIL') {
|
|
510
|
+
// C-3.3/C-3.4 need package.json. Do not let a pinned --install-spec turn
|
|
511
|
+
// that missing input into a clean C-3 PASS.
|
|
512
|
+
installResult = 'NA'
|
|
513
|
+
installReason = 'registry layout has no package.json; dependency/lifecycle checks are NA (install-spec shape alone is not a C-3 pass)'
|
|
514
|
+
}
|
|
396
515
|
const installCheck = check({
|
|
397
516
|
id: 'DSC-03',
|
|
398
517
|
clause: 'C-3',
|
|
@@ -401,10 +520,20 @@ export function runManifestChecks(dir, options = {}) {
|
|
|
401
520
|
coverage: installResult === 'NA' ? 'not-run' : 'full',
|
|
402
521
|
reason: installReason,
|
|
403
522
|
details: installDetails,
|
|
404
|
-
evidence: [
|
|
523
|
+
evidence: [`${manifestLabel}#dependencies`, `${manifestLabel}#scripts`, options.marketIndex ?? '--install-spec'],
|
|
405
524
|
})
|
|
406
525
|
|
|
407
|
-
return {
|
|
526
|
+
return {
|
|
527
|
+
manifest,
|
|
528
|
+
manifestSource: registryMode ? 'registry' : 'package',
|
|
529
|
+
manifestPath,
|
|
530
|
+
kind,
|
|
531
|
+
kindInferred: kindInfo.inferred,
|
|
532
|
+
entry,
|
|
533
|
+
patch,
|
|
534
|
+
g4,
|
|
535
|
+
checks: [manifestCheck, compatCheck, installCheck],
|
|
536
|
+
}
|
|
408
537
|
}
|
|
409
538
|
|
|
410
539
|
export function checkMarketEntry(indexPath, pluginName) {
|