Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(standardize): expose the ecosystem builder to its test through the test-only namespace

Adam Eivyd60b3d75e8eb
diff --git a/server/services/pm2Standardizer.js b/server/services/pm2Standardizer.js
index c56410bfee..7039c69a4b 100644
--- a/server/services/pm2Standardizer.js
+++ b/server/services/pm2Standardizer.js
@@ -433,7 +433,7 @@ function parseAnalysisResponse(response, promptToStrip = '') {
/**
* Generate ecosystem.config.cjs content from processes
*/
-export function generateEcosystemContent(processes, appName) {
+function generateEcosystemContent(processes, appName) {
const apps = processes.map(proc => {
const config = {
name: proc.name,
@@ -855,3 +855,5 @@ module.exports = {
};
`;
}
+
+export const __testing = { generateEcosystemContent };
diff --git a/server/services/pm2Standardizer.test.js b/server/services/pm2Standardizer.test.js
index 661f74ee6b..c52e9bb474 100644
--- a/server/services/pm2Standardizer.test.js
+++ b/server/services/pm2Standardizer.test.js
@@ -1,4 +1,4 @@
-import { generateEcosystemContent as buildEcosystemContent } from './pm2Standardizer.js';
+import { __testing as standardizerInternals } from './pm2Standardizer.js';
import { mkdtempSync as makeTempDir, writeFileSync as writeFixture, readFileSync as readFixture, rmSync as removeFixture } from 'fs';
import { join as joinPath, relative as relativePath } from 'path';
import { tmpdir as osTmpDir } from 'os';
@@ -399,7 +399,7 @@ describe('applyStandardization — preserve existing ecosystem.config.cjs', () =
describe('model-authored plan fields at the apply sink', () => {
it('emits an ecosystem file PM2 can load even when a model string carries quotes', () => {
const hostile = "x' + require('child_process').execSync('id') + '";
- const content = buildEcosystemContent([{ name: "it's", cwd: '.', script: 'x.js', env: { HOSTILE: hostile, 'key"name': 1 } }], 'app');
+ const content = standardizerInternals.generateEcosystemContent([{ name: "it's", cwd: '.', script: 'x.js', env: { HOSTILE: hostile, 'key"name': 1 } }], 'app');
expect(content).toContain(PORTOS_ECOSYSTEM_MARKER);
const module = { exports: {} };
new Function('module', content)(module);