()
| 42 | const SEED_CAPSULES_JSON = JSON.stringify({ version: 1, capsules: [] }, null, 2); |
| 43 | |
| 44 | function setupTmpRepo() { |
| 45 | origEnv = {}; |
| 46 | gitAvailable = true; |
| 47 | tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'evolver-solidify-test-')); |
| 48 | const gepDir = path.join(tmpDir, 'assets', 'gep'); |
| 49 | const evolutionDir = path.join(tmpDir, 'evolution'); |
| 50 | const memoryDir = path.join(tmpDir, 'memory'); |
| 51 | fs.mkdirSync(gepDir, { recursive: true }); |
| 52 | fs.mkdirSync(evolutionDir, { recursive: true }); |
| 53 | fs.mkdirSync(memoryDir, { recursive: true }); |
| 54 | |
| 55 | fs.writeFileSync(path.join(gepDir, 'genes.json'), SEED_GENES_JSON, 'utf8'); |
| 56 | fs.writeFileSync(path.join(gepDir, 'capsules.json'), SEED_CAPSULES_JSON, 'utf8'); |
| 57 | fs.writeFileSync(path.join(gepDir, 'events.jsonl'), '', 'utf8'); |
| 58 | |
| 59 | // Init git repo with one commit so isGitRepo() + blast radius work. |
| 60 | // -c commit.gpgsign=false prevents failures on machines with global GPG signing. |
| 61 | try { |
| 62 | execSync('git init', { cwd: tmpDir, stdio: 'ignore' }); |
| 63 | execSync('git config user.email "test@test.com"', { cwd: tmpDir, stdio: 'ignore' }); |
| 64 | execSync('git config user.name "Test"', { cwd: tmpDir, stdio: 'ignore' }); |
| 65 | fs.writeFileSync(path.join(tmpDir, 'README.md'), 'test repo\n', 'utf8'); |
| 66 | execSync('git add -A', { cwd: tmpDir, stdio: 'ignore' }); |
| 67 | execSync('git -c commit.gpgsign=false commit -m "init"', { cwd: tmpDir, stdio: 'ignore' }); |
| 68 | } catch (_e) { |
| 69 | // git not available or misconfigured — tests will be skipped individually. |
| 70 | gitAvailable = false; |
| 71 | } |
| 72 | |
| 73 | // Save and override env |
| 74 | for (const k of ENV_KEYS) origEnv[k] = process.env[k]; |
| 75 | process.env.EVOLVER_REPO_ROOT = tmpDir; |
| 76 | process.env.GEP_ASSETS_DIR = gepDir; |
| 77 | process.env.EVOLUTION_DIR = evolutionDir; |
| 78 | process.env.MEMORY_DIR = memoryDir; |
| 79 | process.env.NODE_ENV = 'test'; |
| 80 | process.env.EVOLVER_SOLIDIFY_VERIFY = 'off'; |
| 81 | process.env.EVOLVER_LLM_REVIEW = 'false'; |
| 82 | process.env.HUB_DRY_RUN = '1'; |
| 83 | process.env.A2A_HUB_URL = 'http://localhost:0'; |
| 84 | delete process.env.EVOLVER_SESSION_SCOPE; |
| 85 | process.env.A2A_NODE_SECRET = 'a'.repeat(64); |
| 86 | process.env.EVOLVER_AUTO_PUBLISH = 'false'; |
| 87 | process.env.EVOLVER_PUBLISH_ANTI_PATTERNS = 'false'; |
| 88 | process.env.EVOLVER_DEFAULT_VISIBILITY = 'private'; |
| 89 | process.env.EVOLVER_LEAK_CHECK = 'off'; |
| 90 | } |
| 91 | |
| 92 | function teardownTmpRepo() { |
| 93 | for (const k of ENV_KEYS) { |
no outgoing calls
no test coverage detected