fix: port safe ci cleanup from backlog

This commit is contained in:
Affaan Mustafa
2026-04-01 16:09:54 -07:00
parent 9a6080f2e1
commit 8f63697113
11 changed files with 28 additions and 16 deletions

View File

@@ -11,7 +11,7 @@
* exit 0: success exit 1: error
*/
import { readFileSync, writeFileSync, existsSync, renameSync } from 'fs';
import { readFileSync, existsSync, renameSync } from 'fs';
import { resolve } from 'path';
import { readProjects, writeProjects, saveContext, today, shortId, CONTEXTS_DIR } from './shared.mjs';
@@ -112,7 +112,11 @@ for (const [projectPath, info] of Object.entries(projects)) {
const contextMd = existsSync(contextMdPath) ? readFileSync(contextMdPath, 'utf8') : '';
let meta = {};
if (existsSync(metaPath)) {
try { meta = JSON.parse(readFileSync(metaPath, 'utf8')); } catch {}
try {
meta = JSON.parse(readFileSync(metaPath, 'utf8'));
} catch (e) {
console.warn(` ! ${contextDir}: invalid meta.json, continuing with defaults (${e.message})`);
}
}
// Extract fields from CONTEXT.md