MCPcopy Index your code
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / parseBlockIdArg

Function parseBlockIdArg

lib/commands/decompress.ts:24–37  ·  view source on GitHub ↗
(arg: string)

Source from the content-addressed store, hash-verified

22}
23
24function parseBlockIdArg(arg: string): number | null {
25 const normalized = arg.trim().toLowerCase()
26 const blockRef = parseBlockRef(normalized)
27 if (blockRef !== null) {
28 return blockRef
29 }
30
31 if (!/^[1-9]\d*$/.test(normalized)) {
32 return null
33 }
34
35 const parsed = Number.parseInt(normalized, 10)
36 return Number.isInteger(parsed) && parsed > 0 ? parsed : null
37}
38
39function findActiveParentBlockId(
40 messagesState: PruneMessagesState,

Callers 1

handleDecompressCommandFunction · 0.70

Calls 1

parseBlockRefFunction · 0.90

Tested by

no test coverage detected