fix(daemon): keep quoted YAML triggers with colons as strings - #6286
fix(daemon): keep quoted YAML triggers with colons as strings#6286saidyildiz wants to merge 2 commits into
Conversation
Quoted skill trigger phrases like "1:1 figma" were parsed as mapping objects, which crashed the home composer skill preview. Treat fully quoted sequence items as scalars, normalize triggers to strings, and guard the UI so non-string triggers never render as children.
|
Thanks @saidyildiz — nice catch on the quoted-colon frontmatter edge case in skill previews. I've routed this to @PerishCode and marked it for a manual QA pass before merge, so please hold off self-merging for now; we'll loop QA in once it's merge-ready. |
PerishCode
left a comment
There was a problem hiding this comment.
The quoted-trigger crash is addressed defensively, but the parser change introduces a mapping compatibility regression that needs correction before merge.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.| if (value.includes(':')) { | ||
| // Quoted scalars keep their colons (e.g. `- "1:1 figma"`). Only unquoted | ||
| // `key: value` items are single-line mapping entries in a sequence. | ||
| if (value.includes(':') && !isQuotedScalar(value)) { |
There was a problem hiding this comment.
Preserve quoted keys in sequence mappings. The new whole-value check also matches a valid single-line mapping such as - "name": "foo", because that complete string both starts and ends with a double quote. This branch therefore sends it to coerce() and produces the scalar name": "foo instead of the prior mapping object. That is a backward-incompatible parse change for the documented dash-prefixed single-line-object subset, and the same condition is mirrored in packages/plugin-runtime/src/parsers/frontmatter.ts. Locate a mapping separator only when the colon is outside quotes (and, for YAML mapping syntax, followed by whitespace or the end), otherwise treat the item as a scalar; then add the quoted-key mapping case alongside the quoted-colon scalar fixtures in both parser suites.
There was a problem hiding this comment.
Updated in the latest commit: sequence mappings now key off an unquoted colon (with trailing whitespace / EOL), so - "name": "foo" remains a mapping while - "1:1 figma" stays a scalar. Added the quoted-key fixture in both parser test suites.
Detect single-line sequence mappings only when the colon is outside quotes and followed by whitespace or end-of-string. This keeps quoted trigger phrases like "1:1 figma" as scalars while preserving quoted-key mappings such as - "name": "foo".
|
Thanks for the review ,good catch on the quoted-key mapping regression. I pushed a follow-up that stops using a whole-value
Both parser suites cover the quoted-key case alongside the quoted-colon scalar fixtures ( |
PerishCode
left a comment
There was a problem hiding this comment.
The quoted-key case is repaired, but the replacement separator scanner still changes the supported single-line sequence-mapping behavior for plain keys containing apostrophes. Please preserve that existing parse path in both mirrored parsers before merge.
🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.
Why
While browsing skills in the home composer
+menu, skill previews crashed for catalogue entries whose frontmatter triggers include quoted phrases with a colon — for example"1:1 figma".The lightweight YAML frontmatter parser treated any sequence item containing
:as a single-line mapping (key: value). That turned free-text trigger phrases into objects. React then failed when rendering those objects as children in the skill preview.Pain: users cannot open the skill preview for Figma-related (and similar) skills that use ratio-style trigger wording.
What users will see
+menu open normally for skills whose triggers include quoted phrases like"1:1 figma".Surface area
apps/web(defensive filter only; no new UI surface)odsubcommand or flag, newtools-dev/tools-packflag, or newOD_*env var/api/*endpoint, new SSE event, or changed shape inpackages/contractsskills/,design-systems/,design-templates/, orcraft/, or change to the skills protocolpackage.jsonScreenshots
UI change is a crash fix (preview now renders). No visual redesign; happy to attach a before/after capture if maintainers want one for the review record.
Bug fix verification
apps/daemon/tests/frontmatter.test.ts— keeps quoted sequence items with colons as strings; still parses unquotedkey: valuesequence items as objectspackages/plugin-runtime/tests/parsers.test.ts— same coverage in the shared parsermainand green on this branch? yes (new assertions encode the quoted-colon invariant; focused suites pass on this branch)normalizeTriggers()in the daemon skills listing drops non-string items from bad YAML parsesValidation
pnpm --filter @open-design/daemon exec vitest run tests/frontmatter.test.ts— 21 passedpnpm --filter @open-design/plugin-runtime exec vitest run tests/parsers.test.ts— 29 passedImplementation notes
isQuotedScalar()and skip thekey: valuemapping branch for fully quoted scalars ("..."/'...').apps/daemonandpackages/plugin-runtimeso design-system and plugin frontmatter stay aligned.