refactor(monorepo): decouple api and webui into workspaces packages

This commit is contained in:
yiling
2026-06-01 23:35:00 +08:00
parent e3f4fa219e
commit 1f341c15d0
288 changed files with 18024 additions and 21178 deletions
@@ -0,0 +1,40 @@
import { describe, expect, it } from 'vitest'
import { parseFrontmatter } from './frontmatter'
describe('frontmatter parser', () => {
it('should parse content with frontmatter', () => {
const content = `---
name: test-skill
description: simple skill
---
# Body
Hello world`
const { frontmatter, body } = parseFrontmatter<{ name: string; description: string }>(content)
expect(frontmatter.name).toBe('test-skill')
expect(frontmatter.description).toBe('simple skill')
expect(body).toBe('# Body\nHello world')
})
it('should handle content without frontmatter', () => {
const content = '# No Frontmatter\nJust text'
const { frontmatter, body } = parseFrontmatter(content)
expect(frontmatter).toEqual({})
expect(body).toBe(content)
})
it('should handle invalid frontmatter delimiters', () => {
const content = `---
no-end-delimiter
# Body`
const { frontmatter, body } = parseFrontmatter(content)
expect(frontmatter).toEqual({})
expect(body).toBe(content)
})
it('should normalize newlines', () => {
const content = '---\r\nname: win\r\n---\r\n# Body'
const { frontmatter, body } = parseFrontmatter<{ name: string }>(content)
expect(frontmatter.name).toBe('win')
expect(body).toBe('# Body')
})
})