From 5fa1b55342d0a40355ff011a2b1c5b9d1946c6f1 Mon Sep 17 00:00:00 2001 From: Studio Date: Wed, 2 Dec 2026 10:46:45 -0500 Subject: [PATCH] =?UTF-8?q?T-163:=20M2.1m=20=E2=80=94=20Filesystem=20libra?= =?UTF-8?q?ry=20adapter=20for=20the=20MCP=20copilot=20`read=5Fknowledge`?= =?UTF-8?q?=20tool:=20`KnowledgePort.listLibraryCards`=20over=20`library.y?= =?UTF-8?q?ml`=20+=20`cards/
/*.md`=20in=20`libs/research/src/mcp/?= =?UTF-8?q?adapters/library-cards.ts`=20(injected=20read-only=20fs=20port,?= =?UTF-8?q?=20strict=20front-matter=20parser,=20no=20new=20deps)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/research/src/mcp/adapters/library-cards.ts | 2 +- libs/research/test/mcp-library-cards.test.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) 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) {