skillhub/cli/test/unit/integrations/local-skills.test.ts
XiaoSeS 3560679793
Some checks failed
Deploy Docs / build (push) Has been cancelled
Security / Dependency Review (push) Has been cancelled
Security / CodeQL (java-kotlin) (push) Has been cancelled
Security / CodeQL (javascript-typescript) (push) Has been cancelled
Security / CodeQL (python) (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
feat(dsh): add native SkillHub plugin for DeepSeek Harness (#956)
Add the native SkillHub plugin for DeepSeek Harness with a scoped skill center, conversation search/install tools, exact-version installation and protected lifecycle management. Prepare the independently versioned 0.1.0 npm candidate with an empty default Registry and documented compatibility limits.

Keep formal specifications and executable regression tests; remove archived development screenshots and runtime reports from the final tree. Review fixes cover independent scopes, installed references, pre-staging recovery and idempotent discovery.

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-10-16 19:22:26 +08:00

31 lines
1.6 KiB
TypeScript

import { expect, test } from 'bun:test'
import { mkdtemp, readdir, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { fileURLToPath, pathToFileURL } from 'node:url'
test('native integration entry bundles and imports under Node without starting the CLI', async () => {
const root = await mkdtemp(join(tmpdir(), 'skillhub-integration-'))
const loaded: string[] = []
try {
const built = await Bun.build({
entrypoints: [fileURLToPath(new URL('../../../src/integrations/local-skills.ts', import.meta.url))],
target: 'node', format: 'esm', outdir: root,
plugins: [{ name: 'record-import-closure', setup(build) {
build.onLoad({ filter: /\.[cm]?[jt]s$/ }, args => { loaded.push(args.path); return undefined })
} }]
})
expect(built.success).toBe(true)
expect(loaded.some(path => /\/commands\/|\/src\/index\.ts$|\/node_modules\/(prompts|cac)\//.test(path))).toBe(false)
const entry = built.outputs[0]!.path
const child = Bun.spawn(['node', '--input-type=module', '-e',
`const core = await import(${JSON.stringify(pathToFileURL(entry).href)}); if (typeof core.installSkill !== 'function' || typeof core.orderSkillTargetLocks !== 'function') throw Error('missing core'); console.log('core imported');`
], { cwd: root, stdout: 'pipe', stderr: 'pipe' })
expect(await child.exited).toBe(0)
expect(await new Response(child.stdout).text()).toBe('core imported\n')
expect(await new Response(child.stderr).text()).toBe('')
expect((await readdir(root)).sort()).toEqual(['local-skills.js'])
} finally {
await rm(root, { recursive: true, force: true })
}
})