@meistrari/tela-build 1.30.1 → 1.30.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -105,11 +105,12 @@ A versatile badge component for displaying small pieces of information, counts,
|
|
|
105
105
|
type BadgeVariant = 'outline' | 'filled'
|
|
106
106
|
|
|
107
107
|
type BadgeProps = {
|
|
108
|
+
class?: HTMLAttributes['class']
|
|
109
|
+
textClass?: HTMLAttributes['class']
|
|
108
110
|
variant?: BadgeVariant
|
|
109
|
-
containerClass?: string
|
|
110
|
-
textClass?: string
|
|
111
111
|
icon?: string
|
|
112
|
-
to?:
|
|
112
|
+
to?: RouteLocationRaw
|
|
113
|
+
target?: HTMLAnchorElement['target']
|
|
113
114
|
}
|
|
114
115
|
```
|
|
115
116
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { NuxtLink } from '#components'
|
|
3
2
|
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { NuxtLink } from '#components'
|
|
4
4
|
|
|
5
5
|
const props = withDefaults(defineProps<{
|
|
6
6
|
class?: HTMLAttributes['class']
|
|
7
7
|
textClass?: HTMLAttributes['class']
|
|
8
8
|
variant?: 'outline' | 'filled'
|
|
9
9
|
icon?: string
|
|
10
|
-
to?:
|
|
10
|
+
to?: InstanceType<typeof NuxtLink>['$props']['to']
|
|
11
|
+
target?: HTMLAnchorElement['target']
|
|
11
12
|
}>(), {
|
|
12
13
|
variant: 'outline',
|
|
13
|
-
to: false,
|
|
14
14
|
})
|
|
15
15
|
|
|
16
16
|
const tag = computed(() => props.to ? NuxtLink : 'div')
|
|
@@ -19,6 +19,7 @@ const tag = computed(() => props.to ? NuxtLink : 'div')
|
|
|
19
19
|
<template>
|
|
20
20
|
<component
|
|
21
21
|
:is="tag"
|
|
22
|
+
v-bind="props.to ? { to: props.to, target: props.target } : {}"
|
|
22
23
|
:class="cn(
|
|
23
24
|
'inline-block px-[5px] py-[3px] rounded-[5px] select-none',
|
|
24
25
|
variant === 'outline' && 'border-[0.5px] border-border',
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { mkdtempSync, readFileSync, rmSync } from 'node:fs'
|
|
2
|
+
import { tmpdir } from 'node:os'
|
|
3
|
+
import { join } from 'pathe'
|
|
4
|
+
import matter from 'gray-matter'
|
|
5
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
6
|
+
import { generateDocsToDirectory } from '../doc-generator'
|
|
7
|
+
import { TypeResolver } from '../type-resolver'
|
|
8
|
+
|
|
9
|
+
const tempDirs: string[] = []
|
|
10
|
+
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
for (const dir of tempDirs.splice(0)) {
|
|
13
|
+
rmSync(dir, { recursive: true, force: true })
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
describe('generateDocsToDirectory', () => {
|
|
18
|
+
it('writes parseable YAML frontmatter for the tela-build skill', () => {
|
|
19
|
+
const outDir = mkdtempSync(join(tmpdir(), 'tela-build-docs-'))
|
|
20
|
+
tempDirs.push(outDir)
|
|
21
|
+
|
|
22
|
+
generateDocsToDirectory([], new TypeResolver(outDir), outDir)
|
|
23
|
+
|
|
24
|
+
const skillMd = readFileSync(join(outDir, 'tela-build', 'SKILL.md'), 'utf-8')
|
|
25
|
+
const parsed = matter(skillMd)
|
|
26
|
+
|
|
27
|
+
expect(parsed.data).toMatchObject({
|
|
28
|
+
name: 'tela-build',
|
|
29
|
+
description: expect.stringContaining('repository: ask for component props'),
|
|
30
|
+
})
|
|
31
|
+
expect(skillMd).toContain('description: "')
|
|
32
|
+
})
|
|
33
|
+
})
|
package/lib/doc-generator.ts
CHANGED
|
@@ -691,7 +691,7 @@ function wrapWithSkillFrontmatter(meta: { name: string, description: string, all
|
|
|
691
691
|
const lines: string[] = []
|
|
692
692
|
lines.push('---')
|
|
693
693
|
lines.push(`name: ${sanitizeSkillName(name)}`)
|
|
694
|
-
lines.push(`description: ${sanitizeDescription(description)}`)
|
|
694
|
+
lines.push(`description: ${serializeYamlString(sanitizeDescription(description))}`)
|
|
695
695
|
if (allowedTools && allowedTools.length > 0) {
|
|
696
696
|
lines.push(`allowed-tools: ${allowedTools.join(', ')}`)
|
|
697
697
|
}
|
|
@@ -703,6 +703,10 @@ function wrapWithSkillFrontmatter(meta: { name: string, description: string, all
|
|
|
703
703
|
return lines.join('\n')
|
|
704
704
|
}
|
|
705
705
|
|
|
706
|
+
function serializeYamlString(value: string): string {
|
|
707
|
+
return JSON.stringify(value)
|
|
708
|
+
}
|
|
709
|
+
|
|
706
710
|
function sanitizeSkillName(name: string): string {
|
|
707
711
|
// Lowercase + hyphens + digits only, max 64 chars
|
|
708
712
|
return name.toLowerCase().replace(/[^a-z0-9-]/g, '-').slice(0, 64).replace(/-{2,}/g, '-')
|