Skip to content

fix(skill-catalog): fold block-scalar descriptions instead of leaking |/> (#1711)#1713

Open
twidtwid wants to merge 1 commit into
garrytan:masterfrom
twidtwid:fix/skill-catalog-block-scalar-description
Open

fix(skill-catalog): fold block-scalar descriptions instead of leaking |/> (#1711)#1713
twidtwid wants to merge 1 commit into
garrytan:masterfrom
twidtwid:fix/skill-catalog-block-scalar-description

Conversation

@twidtwid

Copy link
Copy Markdown

Summary

Fixes #1711list_skills / get_skill returned the literal YAML block-scalar indicator (| or >) as a skill's description for any SKILL.md authored with description: | (or >).

Root cause

src/core/skill-catalog.tsparseDescriptionField:

const m = raw.match(/^description:\s*["']?(.+?)["']?\s*$/m);
...
return v.length > 0 ? v : undefined;   // returns "|" for `description: |`

The single-line regex captured the block indicator | (length 1 > 0), so oneLineDescription's ?? firstProseLine(body) fallback never fired.

Fix

parseDescriptionField now detects a block-scalar header (|/> with optional chomping +/- and indent digit, optional trailing comment), folds the following indented lines into a single line, and returns undefined for an empty block so the body fallback still works. Inline (and quoted) descriptions are unchanged.

Tests

Added 4 cases to the existing oneLineDescription suite in test/skill-catalog.test.ts:

  • folds a literal block scalar (|)
  • folds a folded block scalar (>)
  • handles chomping indicators (|-)
  • never leaks a bare indicator; empty block falls back to body (regression)
bun test test/skill-catalog.test.ts   → 19 pass / 0 fail
bun run verify                         → 29 checks, all green

Scope: catalog-display only; no data path or get_skill body change.

… `|`/`>`

list_skills/get_skill returned the literal block-scalar indicator as a skill's
description when SKILL.md used `description: |` or `description: >`: the
single-line regex captured `|` (length 1 > 0), so the `?? firstProseLine(body)`
fallback never fired.

parseDescriptionField now folds block-scalar content into one line (handling
chomping/indent indicators like `|-`, `>2`) and returns undefined for an empty
block so the body fallback still works. Inline descriptions are unchanged.

Fixes garrytan#1711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list_skills/get_skill: catalog description shows block-scalar indicator (|/>) for skills using description: |

1 participant