2026-03-14 13:44:02 +09:00
/// <reference types="bun-types" />
import { describe , expect , test } from "bun:test"
import { join } from "node:path"
import { fileURLToPath } from "node:url"
const PROJECT_ROOT = fileURLToPath ( new URL ( "../../.." , import . meta . url ) )
2026-03-16 11:36:38 +09:00
async function readProjectSkill ( . . . segments : string [ ] ) {
return Bun . file ( join ( PROJECT_ROOT , ".opencode" , "skills" , . . . segments , "SKILL.md" ) ) . text ( )
2026-03-14 13:44:02 +09:00
}
describe ( "project skill tool references" , ( ) = > {
describe ( "#given work-with-pr skill instructions" , ( ) = > {
2026-03-16 11:36:38 +09:00
test ( "#when reading the commit delegation example #then it uses a real task category" , async ( ) = > {
const skillContent = await readProjectSkill ( "work-with-pr" )
2026-03-14 13:44:02 +09:00
const usesQuickCategory = skillContent . includes (
'task(category="quick", load_skills=["git-master"], prompt="Commit the changes atomically following git-master conventions. Repository is at {WORKTREE_PATH}.")'
)
expect ( usesQuickCategory ) . toBe ( true )
expect ( skillContent ) . not . toContain ( 'task(category="git"' )
} )
} )
describe ( "#given github-triage skill instructions" , ( ) = > {
2026-03-16 11:36:38 +09:00
test ( "#when reading task tracking examples #then they use the real task management tool names" , async ( ) = > {
const skillContent = await readProjectSkill ( "github-triage" )
2026-03-14 13:44:02 +09:00
const usesRealToolNames =
skillContent . includes ( "task_create(subject=\"Triage: #{number} {title}\")" )
&& skillContent . includes ( "task_update(id=task_id, status=\"completed\", description=REPORT_SUMMARY)" )
expect ( usesRealToolNames ) . toBe ( true )
expect ( skillContent ) . not . toContain ( "TaskCreate(" )
expect ( skillContent ) . not . toContain ( "TaskUpdate(" )
} )
} )
} )