mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 11:45:20 +02:00
fix: preserve keepFields in allowlist frontmatter mode
The allowlist mode hard-coded name + description reconstruction but never iterated keepFields for additional fields. Adding 'triggers' to keepFields was a no-op because the field was silently stripped. Now iterates keepFields and preserves any field beyond name/description from the source template frontmatter, including YAML arrays. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -289,6 +289,18 @@ function transformFrontmatter(content: string, host: Host): string {
|
||||
}
|
||||
}
|
||||
|
||||
// Preserve additional keepFields beyond name and description
|
||||
if (fm.keepFields) {
|
||||
for (const field of fm.keepFields) {
|
||||
if (field === 'name' || field === 'description') continue;
|
||||
// Match YAML field with possible multi-line/array value (indented lines after colon)
|
||||
const fieldMatch = frontmatter.match(new RegExp(`^${field}:(.*(?:\\n(?:[ \\t]+.+))*)`, 'm'));
|
||||
if (fieldMatch) {
|
||||
newFm += `${field}:${fieldMatch[1]}\n`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Rename fields (copy values from template frontmatter with new keys)
|
||||
if (fm.renameFields) {
|
||||
for (const [oldName, newName] of Object.entries(fm.renameFields)) {
|
||||
|
||||
Reference in New Issue
Block a user