mirror of
https://github.com/openclaw/clawhub.git
synced 2026-07-22 03:35:29 -04:00
fix: allow updating skill summary/description on subsequent publishes (#301)
Previously, the skill summary was only extracted from metadata.description in the SKILL.md frontmatter. This change also checks for a direct 'description' field in the frontmatter, ensuring that users can update their skill description by modifying either location. The fix prioritizes the new description from the current publish over the existing skill summary, allowing updates to be reflected correctly. Fixes #301 Co-Authored-By: Ian Alloway <adapter_burners.1y@icloud.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import { generateSkillSummary } from './skillSummary'
|
||||
import {
|
||||
buildEmbeddingText,
|
||||
getFrontmatterMetadata,
|
||||
getFrontmatterValue,
|
||||
hashSkillFiles,
|
||||
isTextFile,
|
||||
parseClawdisMetadata,
|
||||
@@ -122,13 +123,18 @@ export async function publishVersionForUser(
|
||||
const ownerCreatedAt = owner?.createdAt ?? owner?._creationTime ?? Date.now()
|
||||
const now = Date.now()
|
||||
const frontmatterMetadata = getFrontmatterMetadata(frontmatter)
|
||||
const summaryFromFrontmatter =
|
||||
// Check for description in metadata.description (nested) or description (direct frontmatter field)
|
||||
const metadataDescription =
|
||||
frontmatterMetadata &&
|
||||
typeof frontmatterMetadata === 'object' &&
|
||||
!Array.isArray(frontmatterMetadata) &&
|
||||
typeof (frontmatterMetadata as Record<string, unknown>).description === 'string'
|
||||
? ((frontmatterMetadata as Record<string, unknown>).description as string)
|
||||
: undefined
|
||||
const directDescription = getFrontmatterValue(frontmatter, 'description')
|
||||
// Prioritize the new description from frontmatter over the existing skill summary
|
||||
// This ensures updates to the description are reflected on subsequent publishes (#301)
|
||||
const summaryFromFrontmatter = metadataDescription ?? directDescription
|
||||
const summary = await generateSkillSummary({
|
||||
slug,
|
||||
displayName,
|
||||
|
||||
Reference in New Issue
Block a user