MCPcopy Create free account
hub / github.com/SethGammon/Citadel / readExistingIntakeHashes

Function readExistingIntakeHashes

scripts/watch.js:374–391  ·  view source on GitHub ↗

Collect marker_hash values from existing intake item frontmatter.

()

Source from the content-addressed store, hash-verified

372
373/** Collect marker_hash values from existing intake item frontmatter. */
374function readExistingIntakeHashes() {
375 const hashes = new Set();
376 if (!fs.existsSync(INTAKE_DIR)) return hashes;
377 for (const name of fs.readdirSync(INTAKE_DIR)) {
378 if (!name.endsWith('.md')) continue;
379 let content;
380 try {
381 content = fs.readFileSync(path.join(INTAKE_DIR, name), 'utf8');
382 } catch {
383 continue;
384 }
385 const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
386 if (!frontmatter) continue;
387 const hashLine = frontmatter[1].match(/^marker_hash:\s*"?([0-9a-f]{16})"?\s*$/m);
388 if (hashLine) hashes.add(hashLine[1]);
389 }
390 return hashes;
391}
392
393function generateIntakeItem(marker, hash) {
394 if (!fs.existsSync(INTAKE_DIR)) {

Callers 1

runScanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected