MCPcopy
hub / github.com/colbymchenry/codegraph / pragmaValue

Function pragmaValue

__tests__/index-command.test.ts:27–31  ·  view source on GitHub ↗

Normalize a PRAGMA read across return shapes (array | object | scalar).

(raw: unknown, key: string)

Source from the content-addressed store, hash-verified

25
26/** Normalize a PRAGMA read across return shapes (array | object | scalar). */
27function pragmaValue(raw: unknown, key: string): unknown {
28 const row = Array.isArray(raw) ? raw[0] : raw;
29 if (row !== null && typeof row === 'object') return (row as Record<string, unknown>)[key];
30 return row;
31}
32
33function runCodegraph(args: string[], cwd: string): string {
34 return execFileSync(process.execPath, [BIN, ...args], {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected