Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ecosystem.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ module.exports = {
COMPUTE_MODE: 'local',
ALWAYS_ON: 'true'
}
},
{
name: 'project-genie',
script: './scripts/genesis.cjs',
autorestart: true,
watch: false,
max_memory_restart: '300M',
restart_delay: 5000,
env: {
GENESIS_LOOP: 'true',
FORCE_MUTATION: 'true',
ALWAYS_ON: 'true'
}
}
]
};
69 changes: 56 additions & 13 deletions scripts/genesis.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
const { exec, execSync } = require("child_process");
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');

Check warning on line 8 in scripts/genesis.cjs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `node:crypto` over `crypto`.

See more on https://sonarcloud.io/project/issues?id=Genesis-Conductor-Engine_Yennefer&issues=AaCuTcGncesUmU_MD8q4&open=AaCuTcGncesUmU_MD8q4&pullRequest=217

// --- PATHS ---
const PATHS = {
soul: '/dev/shm/yennefer_soul_state.json',
mind: path.join(__dirname, '../yennefer-observatory/public/evolution.json'),
body: path.join(__dirname, '../yennefer-observatory/src/components/generated'),
journal: '/home/yenn/.yennefer/genesis_journal.jsonl'
journal: path.join(__dirname, 'genesis_journal.jsonl')
};

// --- CONFIGURATION ---
Expand Down Expand Up @@ -153,18 +154,34 @@
}

// Generate React Three Fiber component code
function generateEvolutionComponent(name, directive) {

Check failure on line 157 in scripts/genesis.cjs

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=Genesis-Conductor-Engine_Yennefer&issues=AaCuTcGncesUmU_MD8q5&open=AaCuTcGncesUmU_MD8q5&pullRequest=217
const directiveText = typeof directive === 'object' && directive.content ? directive.content.toLowerCase() : String(directive).toLowerCase();

const geometries = [
'<torusKnotGeometry args={[1.5, 0.4, 128, 32]} />',
'<sphereGeometry args={[1.5, 32, 32]} />',
'<boxGeometry args={[2, 2, 2]} />',
'<octahedronGeometry args={[1.5, 0]} />',
'<icosahedronGeometry args={[1.5, 0]} />'
{ key: 'torusknot', code: '<torusKnotGeometry args={[1.5, 0.4, 128, 32]} />' },
{ key: 'sphere', code: '<sphereGeometry args={[1.5, 32, 32]} />' },
{ key: 'box', code: '<boxGeometry args={[2, 2, 2]} />' },
{ key: 'octahedron', code: '<octahedronGeometry args={[1.5, 0]} />' },
{ key: 'icosahedron', code: '<icosahedronGeometry args={[1.5, 0]} />' },
{ key: 'landscape', code: '<planeGeometry args={[10, 10, 32, 32]} />' },
{ key: 'makerspace', code: '<boxGeometry args={[10, 0.5, 10]} />' }
];
const geometry = geometries[Math.floor(Math.random() * geometries.length)];

let geometry = '';
for (const geom of geometries) {
if (directiveText.includes(geom.key)) {
geometry = geom.code;
break;
}
}
if (!geometry) {
geometry = geometries[crypto.randomInt(0, 5)].code; // default 5 geometries
}

const materials = [
`
{
key: 'distort',
code: `
<MeshDistortMaterial
color="#8b5cf6"
emissive="#4c1d95"
Expand All @@ -173,8 +190,11 @@
metalness={0.8}
distort={0.3}
speed={2}
/>`,
`
/>`
},
{
key: 'wobble',
code: `
<MeshWobbleMaterial
color="#06b6d4"
emissive="#0e7490"
Expand All @@ -183,17 +203,40 @@
metalness={0.8}
factor={1}
speed={2}
/>`,
`
/>`
},
{
key: 'standard',
code: `
<meshStandardMaterial
color="#fbbf24"
emissive="#92400e"
emissiveIntensity={0.5 + balance * 2}
roughness={0.2}
metalness={0.8}
/>`
},
{
key: 'wood',
code: `
<meshStandardMaterial
color="#8b5a2b"
roughness={0.9}
metalness={0.1}
/>`
}
];
const material = materials[Math.floor(Math.random() * materials.length)];

let material = '';
for (const mat of materials) {
if (directiveText.includes(mat.key)) {
material = mat.code;
break;
}
}
if (!material) {
material = materials[crypto.randomInt(0, 3)].code; // default 3 materials
}

const isDreiImportNeeded = material.includes('MeshDistortMaterial') || material.includes('MeshWobbleMaterial');
const importedDrei = isDreiImportNeeded ? `import { ${material.includes('MeshDistortMaterial') ? 'MeshDistortMaterial' : ''}${material.includes('MeshDistortMaterial') && material.includes('MeshWobbleMaterial') ? ', ' : ''}${material.includes('MeshWobbleMaterial') ? 'MeshWobbleMaterial' : ''} } from '@react-three/drei'` : '';
Expand Down
Loading