Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

984 B
Raw Blame
import { join } from "node:path";
import { readJSONFile } from "../../server/lib/jsonIo.js";
import { markLegacyRetirements } from "../../server/lib/legacyRetirementTransition.js";
import { writeJsonAtomic } from "./_lib.js";

/** Mark existing bookkeeping for evidence-based transition; erase no work or history. */
export default {
	async up({ rootDir }) {
		const path = join(rootDir, "data/cos/task-schedule.json");
		const schedule = await readJSONFile(path, null, { strict: true });
		if (!schedule) return { marked: 0 };
		const policyChanged = schedule.retirementPolicyVersion !== 2;
		schedule.retirementPolicyVersion = 2;
		let marked = 0;
		const execution = schedule.executions?.["task:branch-reconcile"];
		for (const record of [
			execution,
			...Object.values(execution?.perApp || {}),
		]) {
			if (markLegacyRetirements(record?.branchReconcileOutcome)) marked++;
		}
		if (marked || policyChanged) await writeJsonAtomic(path, schedule);
		return { marked };
	},
};