grix-connector
Version:
Connect local AI coding agents (Claude, Codex, Gemini, Qwen, DeepSeek, Cursor, OpenCode, Pi, OpenHuman, Reasonix) to the Grix scheduling platform. Also serves as an OpenClaw plugin for Grix channel transport.
3 lines (2 loc) • 475 B
JavaScript
import{chmod as i,rename as c,writeFile as m}from"node:fs/promises";import{existsSync as a,readFileSync as u}from"node:fs";import{randomUUID as p}from"node:crypto";function f(t){if(!a(t))return null;try{return JSON.parse(u(t,"utf8"))}catch{return null}}async function y(t,o,e){const r=e?.mode??384,n=`${t}.${p()}.tmp`;await m(n,`${JSON.stringify(o,null,2)}
`,{encoding:"utf8",mode:r}),await c(n,t);try{await i(t,r)}catch{}}export{f as readJSONFile,y as writeJSONFileAtomic};