T-163: M2.1m — Filesystem library adapter for the MCP copilot read_knowledge tool: KnowledgePort.listLibraryCards over library.yml + cards/<section>/*.md in libs/research/src/mcp/adapters/library-cards.ts (injected read-only fs port, strict front-matter parser, no new deps)
This commit is contained in:
parent
e80b224e9b
commit
5fa1b55342
2 changed files with 5 additions and 2 deletions
|
|
@ -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}. */
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue