mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-15 15:46:30 +03:00
fix: normalize quoted user-invocable frontmatter (#87)
* fix: normalize quoted user-invokable frontmatter Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * fix: preserve quoted non-boolean frontmatter values Only normalize quoted booleans for the user-invocable frontmatter flag so other quoted fields like argument-hint and description continue to round-trip as plain strings. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> --------- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
+11
-5
@@ -101,13 +101,19 @@ export function parseFrontmatter(content) {
|
||||
if (colonIndex > 0) {
|
||||
const key = trimmed.slice(0, colonIndex).trim();
|
||||
const value = trimmed.slice(colonIndex + 1).trim();
|
||||
const isQuoted = /^(".*"|'.*')$/.test(value);
|
||||
const unquotedValue = isQuoted ? value.slice(1, -1) : value;
|
||||
const shouldCoerceBoolean =
|
||||
key === 'user-invocable' || key === 'user-invokable' || !isQuoted;
|
||||
|
||||
if (value) {
|
||||
// Strip YAML quotes
|
||||
const unquoted = (value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))
|
||||
? value.slice(1, -1)
|
||||
: value;
|
||||
frontmatter[key] = unquoted === 'true' ? true : unquoted === 'false' ? false : unquoted;
|
||||
frontmatter[key] = shouldCoerceBoolean
|
||||
? unquotedValue === 'true'
|
||||
? true
|
||||
: unquotedValue === 'false'
|
||||
? false
|
||||
: unquotedValue
|
||||
: unquotedValue;
|
||||
currentKey = key;
|
||||
currentArray = null;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user