@bonginkan/maria
Version:
MARIA OS v5.9.5 – Self-Evolving Organizational Intelligence OS | Speed Improvement Phase 3: LLM Optimization + Command Refactoring | Performance Measurement + Run Evidence System | Zero ESLint/TypeScript Errors | 人とAIが役割を持ち、学び、進化し続けるための仕事のOS | GraphRAG ×
31 lines (30 loc) • 1.17 kB
JavaScript
import { createRequire } from 'node:module';
import { fileURLToPath } from 'node:url';
import fs from 'node:fs';
import path from 'node:path';
const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const candidates = [
'./express-server.cjs',
'../server-express.cjs',
];
let started = false;
for (const rel of candidates) {
const p = path.resolve(__dirname, rel);
if (fs.existsSync(p)) {
require(p);
// Do NOT exit: the required server module is expected to keep the process alive.
// Cloud Run will verify PORT is bound; exiting here would fail startup probes.
started = true;
break;
}
}
if (!started) {
const list = (dir) => { try { return fs.readdirSync(dir).join(', '); } catch { return ''; } };
console.error('[bootstrap] Could not locate server entry.');
console.error('[bootstrap] candidates=' + candidates.map((c) => path.resolve(__dirname, c)).join(' | '));
console.error('[bootstrap] dist/server entries=' + list(__dirname));
console.error('[bootstrap] dist entries=' + list(path.resolve(__dirname, '..')));
process.exit(1);
}