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

Function markerHash

scripts/watch.js:83–90  ·  view source on GitHub ↗

* Stable identity for a marker: sha256 over file path, action, and normalized * marker text (trimmed, internal whitespace collapsed), truncated to 16 hex * chars. Line numbers are excluded so the hash survives line shifts.

(marker)

Source from the content-addressed store, hash-verified

81 * chars. Line numbers are excluded so the hash survives line shifts.
82 */
83function markerHash(marker) {
84 const normalizedText = String(marker.raw).trim().replace(/\s+/g, ' ');
85 return crypto
86 .createHash('sha256')
87 .update(marker.file + '\0' + marker.action + '\0' + normalizedText)
88 .digest('hex')
89 .slice(0, 16);
90}
91
92/** Drop oldest-lastSeen entries until the map holds at most `max`. */
93function pruneByLastSeen(map, max) {

Callers 2

normalizeStateFunction · 0.85
runScanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected