@@ -3,7 +3,7 @@ import { test } from 'node:test'
33import { readdirSync , readFileSync } from 'node:fs'
44import { join } from 'node:path'
55import { fileURLToPath } from 'node:url'
6- import { PROMPT_DOCS , PROMPT_SKILLS_DIR , scanToolNames } from '../scripts/doc-tool-names.mjs'
6+ import { PROMPT_DOCS , PROMPT_SKILLS_DIRS , scanToolNames } from '../scripts/doc-tool-names.mjs'
77import { documentedToolNames } from '../src/host/index.js'
88
99const root = fileURLToPath ( new URL ( '../' , import . meta. url ) )
@@ -94,11 +94,22 @@ test('仓库里注入会话的文档零误报', () => {
9494 const known = new Set ( documentedToolNames ( ) )
9595 const docs = [
9696 ...PROMPT_DOCS . map ( ( name ) => join ( root , name ) ) ,
97- ...markdownFiles ( join ( root , PROMPT_SKILLS_DIR ) ) ,
97+ ...PROMPT_SKILLS_DIRS . flatMap ( ( dir ) => markdownFiles ( join ( root , dir ) ) ) ,
9898 ]
9999 for ( const file of docs ) {
100100 const { violations, unclosedFence } = scanToolNames ( readFileSync ( file , 'utf8' ) , known )
101101 assert . deepEqual ( violations , [ ] , `${ file } 引用了不存在的工具名` )
102102 assert . equal ( unclosedFence , undefined , `${ file } 的代码围栏没闭合` )
103103 }
104104} )
105+
106+ test ( '.telov/skills 也在扫描面内:运维 skill 写错工具名同样会红' , ( ) => {
107+ const docs = PROMPT_SKILLS_DIRS . flatMap ( ( dir ) => markdownFiles ( join ( root , dir ) ) )
108+ assert . ok (
109+ docs . some ( ( file ) => file . endsWith ( '.telov/skills/release/SKILL.md' ) ) ,
110+ '发版手册应进入工具名门禁的扫描面' ,
111+ )
112+ // 门禁脚本必须复用同一常量:另写一套目录列表时,扫描面会与这里悄悄分叉
113+ const source = readFileSync ( join ( root , 'scripts/verify-doc-tool-names.mjs' ) , 'utf8' )
114+ assert . match ( source , / P R O M P T _ S K I L L S _ D I R S \. f l a t M a p / )
115+ } )
0 commit comments