MCPcopy Create free account
hub / github.com/garrytan/gstack / readLog

Function readLog

test/question-log-hook.test.ts:59–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57}
58
59function readLog(): Array<Record<string, unknown>> {
60 const projectDirs = fs.existsSync(path.join(stateRoot, 'projects'))
61 ? fs.readdirSync(path.join(stateRoot, 'projects'))
62 : [];
63 const all: Array<Record<string, unknown>> = [];
64 for (const d of projectDirs) {
65 const f = path.join(stateRoot, 'projects', d, 'question-log.jsonl');
66 if (!fs.existsSync(f)) continue;
67 const lines = fs.readFileSync(f, 'utf-8').trim().split('\n').filter(Boolean);
68 for (const l of lines) {
69 try {
70 all.push(JSON.parse(l));
71 } catch {
72 // skip malformed
73 }
74 }
75 }
76 return all;
77}
78
79// ----------------------------------------------------------------------
80// Native AskUserQuestion capture

Callers 1

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected