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

Function processDocSyncQueue

hooks_src/doc-sync.js:219–253  ·  view source on GitHub ↗
(projectRoot, options = {})

Source from the content-addressed store, hash-verified

217}
218
219function processDocSyncQueue(projectRoot, options = {}) {
220 const queuePath = path.join(projectRoot, '.planning', 'telemetry', 'doc-sync-queue.jsonl');
221 const detail = readEntries(queuePath);
222 if (!detail.exists) {
223 return {
224 ok: true,
225 queuePath,
226 reportPath: null,
227 exists: false,
228 entries: 0,
229 malformed: 0,
230 summary: { pending: [], files: [], general: [], deleted: [] },
231 };
232 }
233
234 const summary = summarizeEntries(projectRoot, detail.entries);
235 let reportPath = null;
236 if (!options.dryRun && (summary.pending.length > 0 || options.writeEmptyReport)) {
237 reportPath = writeReport(projectRoot, summary, options);
238 }
239
240 if (!options.dryRun && summary.pending.length > 0) {
241 updateQueue(queuePath, detail.entries, summary, options);
242 }
243
244 return {
245 ok: true,
246 queuePath,
247 reportPath,
248 exists: true,
249 entries: detail.entries.length,
250 malformed: detail.malformed,
251 summary,
252 };
253}
254
255function renderResult(result) {
256 if (!result.exists) return '[doc-sync] No queue file found - nothing to process.\n';

Callers 2

test-doc-sync.jsFile · 0.85
mainFunction · 0.85

Calls 4

readEntriesFunction · 0.85
summarizeEntriesFunction · 0.85
updateQueueFunction · 0.85
writeReportFunction · 0.70

Tested by

no test coverage detected