Files
hapi/cli/src/claude/sdk/metadataExtractor.test.ts
T
SSU-WEI HUANGandGitHub 82da539d32 fix(claude): separate skills from slash commands (#1293)
* fix(claude): separate skills from slash commands

* fix(claude): make native skills ready before use

* fix(claude): keep skill commands before attachments

* fix(claude): align skill catalog with launch args

* fix(claude): include launch plugin skills

* fix(claude): use native loaded skill list

* refactor(claude): remove obsolete metadata callback

* fix(claude): wait for skill catalog before draining messages

* fix(claude): cancel deferred startup messages

* fix(claude): bound skill catalog startup probe
2026-08-02 08:49:14 +08:00

46 lines
1.6 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
classifyClaudeSlashCatalog,
filterCatalogAffectingClaudeArgs
} from './metadataExtractor'
describe('Claude skill catalog', () => {
const discoveredSkills = [
{ name: 'hapi', description: 'Manage HAPI' },
{ name: 'ponytail', description: 'Keep code simple' },
{ name: 'scanner-only', description: 'Not loaded by Claude' }
]
it('separates native skills from slash commands and keeps plugin namespaces', () => {
expect(classifyClaudeSlashCatalog(
['help', 'hapi', 'url-plugin:url-skill', 'ponytail:ponytail', 'review'],
discoveredSkills,
['hapi', 'url-plugin:url-skill', 'ponytail:ponytail']
)).toEqual({
commands: ['help', 'review'],
skills: [
{ name: 'hapi', description: 'Manage HAPI' },
{ name: 'url-plugin:url-skill', description: undefined },
{ name: 'ponytail:ponytail', description: 'Keep code simple' }
]
})
})
it('keeps only launch arguments that affect the command catalog', () => {
expect(filterCatalogAffectingClaudeArgs([
'--resume', 'session-id',
'--plugin-dir', '/tmp/my plugin',
'--settings=/tmp/settings.json',
'--add-dir', '/tmp/one', '/tmp/two',
'--disable-slash-commands',
'--model', 'sonnet'
])).toEqual([
'--plugin-dir', '/tmp/my plugin',
'--settings=/tmp/settings.json',
'--add-dir', '/tmp/one', '/tmp/two',
'--disable-slash-commands'
])
})
})