netxops/test/group-skills.test.mjs
oliver 3c9a383071 Ship capability groups (nms/common/topology) with shared netx skills.
One group maps to one skill and tools-*; rename NMS tools to *Nms*; sync playbooks from netx/skills.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 01:46:07 +08:00

32 lines
1.2 KiB
JavaScript

/**
* Group skill loader: one capability group ↔ one skill dir.
*/
import assert from 'node:assert/strict'
import test from 'node:test'
import { readdirSync, readFileSync, existsSync } from 'node:fs'
import { join } from 'node:path'
import { opsSkillsRoot } from '../src/netx/group-skills.ts'
import { SKILL_DIR_BY_GROUP } from '../src/netx/capability-groups.ts'
test('opsSkillsRoot points at nms / common / topology playbook dirs', () => {
const root = opsSkillsRoot()
assert.ok(existsSync(root), root)
for (const dir of Object.values(SKILL_DIR_BY_GROUP)) {
assert.ok(existsSync(join(root, dir)), join(root, dir))
}
})
test('each group dir has a playbook with name + description', () => {
const root = opsSkillsRoot()
for (const group of Object.keys(SKILL_DIR_BY_GROUP)) {
const groupDir = join(root, SKILL_DIR_BY_GROUP[group])
const bundles = readdirSync(groupDir).filter((name) => existsSync(join(groupDir, name, 'SKILL.md')))
assert.ok(bundles.length >= 1, group)
const raw = readFileSync(join(groupDir, bundles[0], 'SKILL.md'), 'utf8')
assert.match(raw, /^---\r?\n/)
assert.match(raw, /\nname:\s+\S+/)
assert.match(raw, /\ndescription:\s/)
}
})