diff --git a/libs/research/src/mcp/adapters/library-cards.ts b/libs/research/src/mcp/adapters/library-cards.ts index 5a31eac6..92935689 100644 --- a/libs/research/src/mcp/adapters/library-cards.ts +++ b/libs/research/src/mcp/adapters/library-cards.ts @@ -14,7 +14,7 @@ import type { KnowledgePort, LibraryCardQuery, LibraryCardRecord } from '../tool const SAFE_IDENT_RE = /^[a-z0-9][a-z0-9-]*$/; const LIBRARY_ID_RE = /^[a-z0-9][a-z0-9_-]*$/; -const PLAIN_YAML_KEY_RE = /^[^?:,[\]{}#&*!|>'"%@`\s][^,[\]{}#\s]*$/; +const PLAIN_YAML_KEY_RE = /^[^?:,[\]{}#&*!|>'"%@`\s](?:(?:[^,[\]{}#\s]| )*[^,[\]{}#\s])?$/; const BLOCK_SCALAR_RE = /^[|>][+-]?$/; /** Error codes thrown by {@link LibraryCardError}. */ diff --git a/libs/research/test/mcp-library-cards.test.ts b/libs/research/test/mcp-library-cards.test.ts index fb173c01..ac6a35eb 100644 --- a/libs/research/test/mcp-library-cards.test.ts +++ b/libs/research/test/mcp-library-cards.test.ts @@ -338,6 +338,7 @@ sections: alphas: Alphas -draft: Draft notes .archived: Archived notes + old signals: Archived signals Bad_Section: Invalid section name empty-section: Declared section with no directory `, @@ -348,6 +349,7 @@ sections: 'cards/alphas/symlink-card.md': MOMENTUM_CARD, 'cards/undeclared/secret.md': MOMENTUM_CARD, 'cards/-draft/valid-card.md': MOMENTUM_CARD, + 'cards/old signals/valid-card.md': MOMENTUM_CARD, 'cards/Bad_Section/valid-card.md': MOMENTUM_CARD, }, dirs: { @@ -359,6 +361,7 @@ sections: { name: 'alphas', isFile: false, isDirectory: true }, { name: 'undeclared', isFile: false, isDirectory: true }, { name: '-draft', isFile: false, isDirectory: true }, + { name: 'old signals', isFile: false, isDirectory: true }, { name: 'Bad_Section', isFile: false, isDirectory: true }, { name: 'symlink-section', isFile: false, isDirectory: false }, ], @@ -370,6 +373,7 @@ sections: { name: 'UpperCase.md', isFile: true, isDirectory: false }, { name: 'valid-card.md', isFile: true, isDirectory: false }, ], + 'cards/old signals': [{ name: 'valid-card.md', isFile: true, isDirectory: false }], }, }); @@ -447,7 +451,6 @@ sections: 'id: quant\nsections:\n - alphas\n', // YAML bare sequence under sections 'id: quant\nsections:\n alphas: # comment-only title\n', // comment-only title 'id: quant\nsections:\n alphas:NoSpace\n', // missing space after colon - 'id: quant\nsections:\n bad key: Title\n', // whitespace in section key ]; for (const manifest of badManifests) {