src/diff
Module summary
Module src/diff
Exports
| Name | Kind | Default |
|---|---|---|
addEntry | function | no |
detectChanges | function | no |
hashContent | function | no |
hashFile | function | no |
hashModule | function | no |
loadEntries | function | no |
loadHashes | function | no |
saveEntries | function | no |
saveHashes | function | no |
Detail
addEntry
async addEntry(stateDir, issueNumber): Promise<object>Idempotently add an issue number to the persisted set. Returns whether the entry was newly added and the resulting total count.
Params
stateDirissueNumber
Returns
Promise<object>
Examples
None.
detectChanges
detectChanges(prevHashes, nextHashes): objectCompare two file-hash maps and emit added / modified / deleted / renamed entries.
Rename heuristic: a path that disappeared from prev and a path that
appeared in next are paired as a rename when their content hashes match
exactly. The pairing is one-to-one and greedy by sorted from path so the
output is deterministic.
Params
prevHashesnextHashes
Returns
object
Examples
None.
hashContent
hashContent(input)SHA-256 hex digest over the given content. Buffers and strings are accepted; strings are hashed as UTF-8 bytes (matching the on-disk representation).
Params
input
Returns
None.
Examples
None.
hashFile
async hashFile(absPath): Promise<unknown>Read a file from disk and return its SHA-256 hex digest.
Params
absPath
Returns
Promise<unknown>
Examples
None.
hashModule
hashModule(parts)Compute the composite SHA-256 module hash from the four input sections. Changing any single section (AST, JSDoc, adjacent README, adjacent comments) produces a different hex digest. Same inputs always produce the same digest.
Params
parts
Returns
None.
Examples
None.
loadEntries
async loadEntries(stateDir): Promise<unknown>Load the persisted set of documented issue numbers. Returns an empty Set when the state file does not exist.
Params
stateDir
Returns
Promise<unknown>
Examples
None.
loadHashes
async loadHashes(stateDir): Promise<object>Load the persisted file-hash map from <stateDir>/file-hashes.json.
Returns an empty object when the file does not yet exist.
Params
stateDir
Returns
Promise<object>
Examples
None.
saveEntries
async saveEntries(stateDir, set): Promise<void>Persist the set of documented issue numbers atomically, sorted ascending.
Params
stateDirset
Returns
Promise<void>
Examples
None.
saveHashes
async saveHashes(stateDir, hashes): Promise<void>Persist the file-hash map atomically. Keys are sorted alphabetically so the on-disk artifact is deterministic across runs.
Params
stateDirhashes
Returns
Promise<void>
Examples
None.