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.
31 lines (23 loc) • 985 B
JavaScript
// install-guardian — cross-platform npm postinstall script
// Copies upgrade-guardian.sh to ~/.grix/bin/ (idempotent, won't overwrite existing)
// On Windows, skips since the guardian is a bash script.
import { existsSync, copyFileSync, mkdirSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { homedir } from 'node:os';
// Guardian is a bash script — skip on Windows entirely
if (process.platform === 'win32') {
process.exit(0);
}
const GRIX_HOME = process.env.GRIX_CONNECTOR_HOME || join(homedir(), '.grix');
const GUARDIAN_DEST = join(GRIX_HOME, 'bin', 'upgrade-guardian.sh');
if (existsSync(GUARDIAN_DEST)) {
process.exit(0);
}
const INIT_CWD = process.env.INIT_CWD || resolve(import.meta.dirname);
const GUARDIAN_SRC = join(INIT_CWD, 'scripts', 'upgrade-guardian.sh');
if (!existsSync(GUARDIAN_SRC)) {
process.exit(0);
}
mkdirSync(join(GRIX_HOME, 'bin'), { recursive: true });
copyFileSync(GUARDIAN_SRC, GUARDIAN_DEST);