Lines 2-42javascript
3const fs = require('node:fs');
4const crypto = require('node:crypto');
5const path = require('node:path');
6const { validateCompiledArtifacts } = require('./compile');
7const { buildWorklogStatus } = require('./work-memory');
9const RESIDENT_STATUS_FILE = 'resident-status.json';
10const CONTEXT_PACK_FILE = 'context-pack.json';
11const CODEX_MCP_TOML_FILE = 'codex-mcp.toml';
12const CODEX_MCP_INSTALL_FILE = 'CODEX_MCP_INSTALL.md';
14function portablePath(filePath) {
15 return filePath.replace(/\\/g, '/');
18function relativePortable(from, to) {
19 return portablePath(path.relative(from, to) || '.');
22function resolveWorkspace(options = {}) {
23 const projectRoot = path.resolve(options.projectRoot || process.cwd());
24 const artifactDir = path.resolve(options.artifactDir || options.outDir || path.join(projectRoot, '.ecf-core'));
25 return { projectRoot, artifactDir };
28function readJsonIfPresent(filePath) {
29 if (!fs.existsSync(filePath)) return null;
31 return JSON.parse(fs.readFileSync(filePath, 'utf8'));
32 } catch (error) {
LowWeak Crypto
Package source references weak cryptographic algorithms.
src/resident.jsView on unpkg · L22 33 return { parse_error: error.message };
37function writeJson(filePath, value) {
38 fs.mkdirSync(path.dirname(filePath), { recursive: true });
39 fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`);