@@ -4,11 +4,6 @@ import os from 'node:os'
44import path from 'node:path'
55import type { Config } from '@opencode-ai/sdk'
66import { createConfigHandler } from '../../src/lib/config-handler.ts'
7- import {
8- formatSkillCommandName ,
9- formatSkillDescription ,
10- wrapSkillTemplate ,
11- } from '../../src/lib/skill-loader.ts'
127
138describe ( 'config-handler' , ( ) => {
149 let testDir : string
@@ -224,76 +219,3 @@ Command template for ${name}.`,
224219 } )
225220 } )
226221} )
227-
228- describe ( 'formatSkillCommandName' , ( ) => {
229- test ( 'adds systematic: prefix to plain name' , ( ) => {
230- expect ( formatSkillCommandName ( 'brainstorming' ) ) . toBe (
231- 'systematic:brainstorming' ,
232- )
233- } )
234-
235- test ( 'does not double-prefix already prefixed name' , ( ) => {
236- expect ( formatSkillCommandName ( 'systematic:brainstorming' ) ) . toBe (
237- 'systematic:brainstorming' ,
238- )
239- } )
240-
241- test ( 'handles empty string' , ( ) => {
242- expect ( formatSkillCommandName ( '' ) ) . toBe ( 'systematic:' )
243- } )
244- } )
245-
246- describe ( 'formatSkillDescription' , ( ) => {
247- test ( 'adds (systematic - Skill) prefix to description' , ( ) => {
248- expect ( formatSkillDescription ( 'A test skill' , 'test' ) ) . toBe (
249- '(systematic - Skill) A test skill' ,
250- )
251- } )
252-
253- test ( 'does not double-prefix already prefixed description' , ( ) => {
254- expect (
255- formatSkillDescription ( '(systematic - Skill) A test skill' , 'test' ) ,
256- ) . toBe ( '(systematic - Skill) A test skill' )
257- } )
258-
259- test ( 'uses fallback name when description is empty' , ( ) => {
260- expect ( formatSkillDescription ( '' , 'my-skill' ) ) . toBe (
261- '(systematic - Skill) my-skill skill' ,
262- )
263- } )
264- } )
265-
266- describe ( 'wrapSkillTemplate' , ( ) => {
267- test ( 'wraps content in skill-instruction tags' , ( ) => {
268- const result = wrapSkillTemplate ( '/path/to/skill/SKILL.md' , '# Skill Body' )
269- expect ( result ) . toContain ( '<skill-instruction>' )
270- expect ( result ) . toContain ( '</skill-instruction>' )
271- expect ( result ) . toContain ( '# Skill Body' )
272- } )
273-
274- test ( 'includes base directory from skill path' , ( ) => {
275- const result = wrapSkillTemplate (
276- '/bundled/skills/brainstorming/SKILL.md' ,
277- '# Content' ,
278- )
279- expect ( result ) . toContain (
280- 'Base directory for this skill: /bundled/skills/brainstorming/' ,
281- )
282- } )
283-
284- test ( 'includes file reference note' , ( ) => {
285- const result = wrapSkillTemplate ( '/path/to/skill/SKILL.md' , '# Content' )
286- expect ( result ) . toContain (
287- 'File references (@path) in this skill are relative to this directory' ,
288- )
289- } )
290-
291- test ( 'trims body content' , ( ) => {
292- const result = wrapSkillTemplate (
293- '/path/to/skill/SKILL.md' ,
294- ' \n# Skill Body\n ' ,
295- )
296- expect ( result ) . toContain ( '# Skill Body' )
297- expect ( result ) . not . toMatch ( / \n \s + \n < \/ s k i l l - i n s t r u c t i o n > / )
298- } )
299- } )
0 commit comments