-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.mjs
More file actions
41 lines (36 loc) · 1.78 KB
/
Copy pathtest.mjs
File metadata and controls
41 lines (36 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import assert from 'node:assert/strict'
import { apply, inject, name } from './index.js'
/**
* Mirrors the checks DSH runs on a runtime skill: `validateRuntimeSkill()` at
* registration time, then `validateDefinition()` when the skill is loaded.
* The second one is why this file exists — a missing `source` sails through
* registration and only throws on first use.
* https://github.com/deepseek-ai/deepseek-harness/blob/main/packages/skill/skill/src/index.ts
*/
function assertRegistrationIsLoadable(skill) {
assert.match(skill.name, /^[a-z0-9]+(-[a-z0-9]+)*$/, 'name must be kebab-case')
assert.equal(typeof skill.description, 'string')
assert.ok(skill.description.length > 0, 'description must not be empty')
assert.equal(typeof skill.content, 'string')
assert.ok(skill.content.length > 0, 'content must not be empty')
// Only `invocation` and `provider` get registry defaults.
assert.equal(typeof skill.source, 'string', 'source has no default and must be set')
if (skill.path !== undefined) assert.equal(typeof skill.path, 'string')
if (skill.resourceBase !== undefined) {
assert.equal(skill.resourceBase.kind, 'directory')
assert.equal(typeof skill.resourceBase.path, 'string')
}
}
const registered = []
apply({ skills: { register: (skill) => registered.push(skill) } })
assert.equal(name, 'dsh-plugin-radar')
assert.deepEqual(inject, ['skills'])
assert.equal(registered.length, 1)
assertRegistrationIsLoadable(registered[0])
assert.equal(registered[0].name, 'plugin-radar')
assert.ok(
registered[0].description.includes('DeepSeek Harness'),
'description should carry the routing text parsed out of SKILL.md frontmatter',
)
assert.ok(!registered[0].content.startsWith('---'), 'frontmatter must be stripped from the body')
console.log('ok — plugin registers a loadable plugin-radar skill')