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

feat: classify python/go/docker/static app types in streamingDetect (#4137)

Adam Eivy7a9da5d48919
diff --git a/.changelog/next/added-issue-4137.md b/.changelog/next/added-issue-4137.md
new file mode 100644
index 0000000000..011c4d9842
--- /dev/null
+++ b/.changelog/next/added-issue-4137.md
@@ -0,0 +1 @@
+- App detection now classifies Python, Go, Docker, and static repos instead of labelling them `unknown`, and PM2 standardization (which writes a Node ecosystem config) is no longer offered for them
diff --git a/client/src/components/apps/constants.js b/client/src/components/apps/constants.js
index 343173db37..19849d8631 100644
--- a/client/src/components/apps/constants.js
+++ b/client/src/components/apps/constants.js
@@ -44,10 +44,38 @@ export function resolveLaunchPanelProcess(app, result) {
return result?.results?.[processName]?.success === false ? null : processName;
}
-export const getAppTypeLabel = (type) =>
- type === 'ios-native' ? '📱 iOS' :
- type === 'macos-native' ? '🖥️ macOS' :
- type === 'swift' ? '🐦 Swift' : '🔨 Xcode';
+// Mirrors STANDARDIZABLE_TYPES in server/services/streamingDetect.js (a parity
+// test asserts the two Sets match). POSITIVE list: the PM2 standardizer writes a
+// NODE ecosystem config from a prompt that opens "You are analyzing a Node.js
+// application", so a Python/Go/Docker/static repo must not be offered the flow.
+// `unknown` and `desktop` stay in for continuity — see the server's rationale.
+export const STANDARDIZABLE_TYPES = new Set([
+ 'vite+express', 'vite', 'single-node-server', 'nextjs', 'desktop', 'unknown'
+]);
+
+/** Whether the PM2 standardizer (which writes a NODE ecosystem config) applies. */
+export const isStandardizable = (type) => STANDARDIZABLE_TYPES.has(type ?? 'unknown');
+
+// Every app type that can reach a UI label. Kept TOTAL (with a raw-type
+// fallback) rather than a ternary chain ending in '🔨 Xcode' — that default
+// meant any type not explicitly listed rendered as an Xcode project.
+const APP_TYPE_LABELS = {
+ 'ios-native': '📱 iOS',
+ 'macos-native': '🖥️ macOS',
+ swift: '🐦 Swift',
+ xcode: '🔨 Xcode',
+ python: '🐍 Python',
+ go: '🐹 Go',
+ docker: '🐳 Docker',
+ static: '📄 Static',
+ desktop: '🎮 Desktop',
+ 'vite+express': '⚡ Vite + Express',
+ vite: '⚡ Vite',
+ 'single-node-server': '🟢 Node',
+ nextjs: '▲ Next.js'
+};
+
+export const getAppTypeLabel = (type) => APP_TYPE_LABELS[type] || type || 'Unknown';
// Where an app's autonomous work items live. Mirrors WORK_TRACKERS +
// TRACKER_LABELS in server/lib/workTracker.js — shared by the Edit App picker
diff --git a/client/src/components/apps/tabs/OverviewTab.jsx b/client/src/components/apps/tabs/OverviewTab.jsx
index 54475f5b7f..0d89e88430 100644
--- a/client/src/components/apps/tabs/OverviewTab.jsx
+++ b/client/src/components/apps/tabs/OverviewTab.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useMemo } from 'react';
import { Link } from 'react-router';
import { FolderOpen, Gamepad2, Terminal, Code, RefreshCw, Wrench, Archive, ArchiveRestore, Download, Tag, AlertTriangle, Rocket, Camera, Image, Sparkles } from 'lucide-react';
import toast from '../../ui/Toast';
-import { NON_PM2_TYPES } from '../constants';
+import { isStandardizable } from '../constants';
import ActivityLog from '../ActivityLog';
import SlashDoPanel from '../SlashDoPanel';
import Banner from '../../ui/Banner';
@@ -313,8 +313,10 @@ export default function OverviewTab({ app, onRefresh }) {
{detectingIcon ? 'Scanning...' : 'Detect Icon'}
</button>
{/* PortOS's own ecosystem.config.cjs is the canonical PORTS source —
- it is never regenerated from an LLM analysis (the server refuses too). */}
- {!NON_PM2_TYPES.has(app.type) && app.id !== api.PORTOS_APP_ID && (
+ it is never regenerated from an LLM analysis (the server refuses too).
+ `isStandardizable` also keeps the button off non-Node repos, whose
+ ecosystem config the Node-shaped prompt has no business writing. */}
+ {isStandardizable(app.type) && app.id !== api.PORTOS_APP_ID && (
<button
onClick={handleStandardize}
disabled={isOperating}
diff --git a/client/src/pages/Apps.jsx b/client/src/pages/Apps.jsx
index 2c4c81e5a1..0b44c843d8 100644
--- a/client/src/pages/Apps.jsx
+++ b/client/src/pages/Apps.jsx
@@ -14,7 +14,7 @@ import { useAppOperation } from '../hooks/useAppOperation';
import useUrlParams from '../hooks/useUrlParams';
import * as api from '../services/api';
import socket from '../services/socket';
-import { NON_PM2_TYPES, getAppTypeLabel } from '../components/apps/constants';
+import { NON_PM2_TYPES, isStandardizable, getAppTypeLabel } from '../components/apps/constants';
import { formatBytes } from '../utils/formatters';
export default function Apps() {
@@ -700,7 +700,10 @@ export default function Apps() {
<RefreshCw size={14} aria-hidden="true" className={refreshingConfig[app.id] ? 'animate-spin' : ''} />
Refresh Config
</button>
- {(!app.processes?.length || app.processes.some(p => !p.ports || Object.keys(p.ports).length === 0)) && (
+ {/* The standardizer writes a NODE ecosystem config —
+ never offer it for a Python/Go/Docker/static repo
+ (the server refuses too). */}
+ {isStandardizable(app.type) && (!app.processes?.length || app.processes.some(p => !p.ports || Object.keys(p.ports).length === 0)) && (
<button
onClick={() => handleStandardize(app)}
disabled={isOperating}
diff --git a/client/src/pages/CreateApp.jsx b/client/src/pages/CreateApp.jsx
index 89f42a3faf..ab000b8436 100644
--- a/client/src/pages/CreateApp.jsx
+++ b/client/src/pages/CreateApp.jsx
@@ -7,7 +7,7 @@ import * as api from '../services/api';
import IconPicker from '../components/IconPicker';
import FolderPicker from '../components/FolderPicker';
import Banner from '../components/ui/Banner';
-import { NON_PM2_TYPES } from '../components/apps/constants';
+import { NON_PM2_TYPES, isStandardizable, getAppTypeLabel } from '../components/apps/constants';
const DETECTION_STEPS_PM2 = [
{ id: 'validate', label: 'Validating path' },
@@ -479,14 +479,13 @@ export default function CreateApp() {
</div>
)}
- {/* App Type Badge */}
- {detected && isNonPm2 && (
+ {/* App Type Badge — shown for every type the PM2 standardizer skips,
+ so a Python/Go/Docker/static repo says WHY the card below is gone
+ rather than silently offering nothing. */}
+ {detected && !isStandardizable(appType) && (
<Banner tone="info" size="md">
<p className="font-medium">
- {appType === 'ios-native' ? '📱 iOS App' :
- appType === 'macos-native' ? '🖥️ macOS App' :
- appType === 'swift' ? '🐦 Swift Package' :
- '🔨 Xcode Project'} — not managed by PM2
+ {getAppTypeLabel(appType)} — {isNonPm2 ? 'not managed by PM2' : 'not a Node.js project'}
</p>
</Banner>
)}
@@ -504,7 +503,7 @@ export default function CreateApp() {
)}
{/* Standardize PM2 config — opt-in, because it rewrites the repo */}
- {detected && !isNonPm2 && !standardizeResult && (
+ {detected && isStandardizable(appType) && !standardizeResult && (
<div className="bg-port-card border border-port-border rounded-xl p-4 space-y-3">
<h3 className="text-xs font-medium uppercase tracking-wide text-gray-500">Optional</h3>
<p className="text-sm text-white flex items-center gap-2">
diff --git a/client/src/pages/CreateApp.test.jsx b/client/src/pages/CreateApp.test.jsx
index 26171c6143..6c82a63ff2 100644
--- a/client/src/pages/CreateApp.test.jsx
+++ b/client/src/pages/CreateApp.test.jsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
-import { act, render, screen } from '@testing-library/react';
+import { act, cleanup, render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { MemoryRouter } from 'react-router';
@@ -27,8 +27,12 @@ vi.mock('../components/ui/Toast', () => ({
import CreateApp from './CreateApp';
-/** Render the wizard and drive detection to completion for the given app type. */
-const detectApp = async (result = { type: 'node', name: 'Example App' }) => {
+/**
+ * Render the wizard and drive detection to completion for the given app type.
+ * The default is a REAL type streamingDetect emits — the standardize card is
+ * gated on a positive list now, so a made-up placeholder would be refused.
+ */
+const detectApp = async (result = { type: 'single-node-server', name: 'Example App' }) => {
render(<MemoryRouter><CreateApp /></MemoryRouter>);
// Let the mount effects (provider + default directory) settle.
await act(async () => {});
@@ -72,6 +76,38 @@ describe('CreateApp — PM2 standardization is opt-in', () => {
expect(standardizeEmits()).toHaveLength(0);
});
+ it('offers no standardization for non-Node runtimes', async () => {
+ // The standardizer's prompt opens "You are analyzing a Node.js application";
+ // on a Python/Go/Docker/static repo it doesn't fail, it confidently writes a
+ // Node ecosystem config. The card must not render at all.
+ for (const type of ['python', 'go', 'docker', 'static']) {
+ // Each iteration renders its own wizard — tear the previous one down so a
+ // stale card from an earlier type can't satisfy (or defeat) the query.
+ cleanup();
+ emit.mockClear();
+ for (const key of Object.keys(handlers)) delete handlers[key];
+
+ await detectApp({ type, name: 'Example App' });
+
+ expect(screen.queryByRole('button', { name: 'Standardize PM2 config' })).toBeNull();
+ expect(standardizeEmits()).toHaveLength(0);
+ }
+ });
+
+ it('explains why a non-Node repo gets no standardize card', async () => {
+ await detectApp({ type: 'python', name: 'Example App' });
+
+ expect(screen.getByText(/not a Node\.js project/)).toBeInTheDocument();
+ });
+
+ it('still offers standardization for an app whose type detection could not name', async () => {
+ // `unknown` is the persisted type of every app imported before non-Node
+ // classification existed — most of them are Node apps.
+ await detectApp({ type: 'unknown', name: 'Example App' });
+
+ expect(screen.getByRole('button', { name: 'Standardize PM2 config' })).toBeEnabled();
+ });
+
it('disables the action when no LLM provider is configured', async () => {
const api = await import('../services/api');
api.getActiveProvider.mockResolvedValueOnce(null);
diff --git a/server/services/pm2Standardizer.js b/server/services/pm2Standardizer.js
index 76c0f062dd..5c792ff5c0 100644
--- a/server/services/pm2Standardizer.js
+++ b/server/services/pm2Standardizer.js
@@ -9,7 +9,7 @@ import { safeJSONParse, tryReadFile } from '../lib/fileUtils.js';
import { runPromptThroughProvider } from '../lib/promptRunner.js';
import { getReservedPorts, getAllApps } from './apps.js';
import { PORTOS_APP_ID } from '../lib/appIdentity.js';
-import { usesPm2 } from './streamingDetect.js';
+import { usesPm2, isStandardizable } from './streamingDetect.js';
import { getListeningPorts } from '../lib/platform.js';
const execAsync = promisify(exec);
@@ -52,6 +52,12 @@ export function standardizeRefusalFor(app) {
if (!usesPm2(app?.type)) {
return `${app?.type} apps are not run under PM2, so there is no ecosystem config to standardize`;
}
+ if (!isStandardizable(app?.type)) {
+ // The analysis prompt below opens with "You are analyzing a Node.js
+ // application" — on a Python/Go/Docker/static repo it doesn't fail, it
+ // confidently writes a Node ecosystem config. A type check, not prose.
+ return `${app?.type} apps are not Node.js projects, so there is no Node ecosystem config to generate`;
+ }
return null;
}
diff --git a/server/services/pm2Standardizer.test.js b/server/services/pm2Standardizer.test.js
index 9d1876ad22..30269efa52 100644
--- a/server/services/pm2Standardizer.test.js
+++ b/server/services/pm2Standardizer.test.js
@@ -24,6 +24,22 @@ describe('standardizeRefusalFor', () => {
}
});
+ it('refuses non-Node runtimes — the analysis prompt is Node-shaped', () => {
+ // These types DO run under PM2, so the usesPm2 gate lets them through; the
+ // refusal is that there is no Node ecosystem config to generate for them.
+ for (const type of ['python', 'go', 'docker', 'static']) {
+ expect(standardizeRefusalFor({ id: 'app-1', type })).toMatch(/not Node\.js projects/);
+ }
+ });
+
+ it('still allows an app whose persisted type predates the classification', () => {
+ // `type` is persisted on the app record, so apps imported before non-Node
+ // classification existed keep `unknown` until re-detected — and most of
+ // them are Node apps. Refusing them would break the button on upgrade.
+ expect(standardizeRefusalFor({ id: 'app-1', type: 'unknown' })).toBeNull();
+ expect(standardizeRefusalFor({ id: 'app-1' })).toBeNull();
+ });
+
it('refuses PortOS itself — its ecosystem.config.cjs is the canonical PORTS source', () => {
expect(standardizeRefusalFor({ id: PORTOS_APP_ID, type: 'vite+express' }))
.toMatch(/manages its own ecosystem\.config\.cjs/);
diff --git a/server/services/streamingDetect.js b/server/services/streamingDetect.js
index c5f840ec49..f24410bdd4 100644
--- a/server/services/streamingDetect.js
+++ b/server/services/streamingDetect.js
@@ -9,6 +9,59 @@ import { detectAppIcon } from './appIconDetect.js';
/** App types that do not use PM2 for process management */
export const NON_PM2_TYPES = new Set(['ios-native', 'macos-native', 'xcode', 'swift']);
+/**
+ * Non-Node runtimes recognized from marker files, mapped to the files that
+ * identify them. Order is precedence: a repo's LANGUAGE beats its packaging, so
+ * a Python service that also ships a `Dockerfile` classifies as `python` (the
+ * common case), while a compose-only stack with no language markers is
+ * `docker`. `static` is last — it's the "nothing but a page here" fallback.
+ */
+const NON_NODE_MARKERS = [
+ ['python', ['pyproject.toml', 'requirements.txt', 'setup.py', 'Pipfile']],
+ ['go', ['go.mod']],
+ ['docker', ['docker-compose.yml', 'docker-compose.yaml', 'compose.yml', 'compose.yaml', 'Dockerfile']],
+ ['static', ['index.html']]
+];
+
+/** The non-Node app types `classifyNonNodeType` can emit. */
+export const NON_NODE_TYPES = new Set(NON_NODE_MARKERS.map(([type]) => type));
+
+/**
+ * Classify a repo's runtime from its top-level filenames, for repos that
+ * carried no Node or Apple signal. Returns `null` when no marker matched — the
+ * caller keeps `unknown` rather than guessing.
+ *
+ * @param {string[]} files Top-level entry names (from `readdir`).
+ * @returns {'python'|'go'|'docker'|'static'|null}
+ */
+export function classifyNonNodeType(files) {
+ const present = new Set(files || []);
+ for (const [type, markers] of NON_NODE_MARKERS) {
+ if (markers.some(marker => present.has(marker))) return type;
+ }
+ return null;
+}
+
+/**
+ * App types the PM2 standardizer may run against — a POSITIVE list, because the
+ * standardizer's prompt opens with "You are analyzing a Node.js application"
+ * and a negative list (`!NON_PM2_TYPES.has(type)`) silently swept in every
+ * unrecognized repo. On a Python/Go/Docker/static repo the LLM doesn't fail, it
+ * confidently writes a Node ecosystem config into someone else's project.
+ *
+ * `unknown` stays in the list on purpose: `type` is persisted on the app record,
+ * so every app imported before this classification existed keeps `unknown` until
+ * it's re-detected — and most of those really are Node apps. `desktop` (a Godot
+ * game binary) is here for the same continuity reason; those repos commonly
+ * carry a Node web process alongside the game and were always offered the flow.
+ */
+export const STANDARDIZABLE_TYPES = new Set([
+ 'vite+express', 'vite', 'single-node-server', 'nextjs', 'desktop', 'unknown'
+]);
+
+/** Whether the PM2 standardizer (which writes a NODE ecosystem config) applies. */
+export const isStandardizable = (type) => STANDARDIZABLE_TYPES.has(type ?? 'unknown');
+
/**
* App types that run a GUI/desktop process with no HTTP port (e.g. a Godot
* game binary). These are still supervised through PM2, but launched from the
@@ -1208,7 +1261,18 @@ export async function streamDetection(socket, dirPath) {
}
}
} else {
- emit('package', 'done', { message: 'No package.json found' });
+ // No package.json ⇒ nothing Node owns this repo, so fall back to marker-file
+ // classification for the common non-Node runtimes. Without this, a Python
+ // service / Go binary / Docker stack / static site all landed on `unknown`
+ // and were offered Node PM2 standardization. Guarded on `unknown` so an
+ // Apple type already resolved in step 2 (a Swift repo that also ships a
+ // Dockerfile) isn't overwritten.
+ const nonNodeType = result.type === 'unknown' ? classifyNonNodeType(files) : null;
+ if (nonNodeType) result.type = nonNodeType;
+ emit('package', 'done', {
+ message: nonNodeType ? `No package.json — detected ${nonNodeType} project` : 'No package.json found',
+ type: result.type
+ });
}
// Native game launch is additive: web ports/processes remain the standard
diff --git a/server/services/streamingDetect.test.js b/server/services/streamingDetect.test.js
index 29a82bf688..3785bdada5 100644
--- a/server/services/streamingDetect.test.js
+++ b/server/services/streamingDetect.test.js
@@ -1,8 +1,13 @@
-import { describe, it, expect, afterEach } from 'vitest';
+import { describe, it, expect, afterEach, vi } from 'vitest';
import { mkdirSync, mkdtempSync, writeFileSync, readFileSync, rmSync } from 'fs';
import { tmpdir } from 'os';
import { join } from 'path';
-import { detectGodotNativeLaunch, parseEcosystemConfig, resolveViteConfigPortForProcess, rewriteEcosystemPorts, rewriteEcosystemPortsByProcess, writeEcosystemPorts, writeEcosystemPortsByProcess, writeEcosystemPortEdits, DESKTOP_TYPES, NON_PM2_TYPES } from './streamingDetect.js';
+import { detectGodotNativeLaunch, parseEcosystemConfig, resolveViteConfigPortForProcess, rewriteEcosystemPorts, rewriteEcosystemPortsByProcess, writeEcosystemPorts, writeEcosystemPortsByProcess, writeEcosystemPortEdits, streamDetection, classifyNonNodeType, isStandardizable, usesPm2, DESKTOP_TYPES, NON_PM2_TYPES, NON_NODE_TYPES, STANDARDIZABLE_TYPES } from './streamingDetect.js';
+
+// streamDetection shells out to PM2 and scans for an app icon; neither is under
+// test here and both are slow/environment-dependent.
+vi.mock('./pm2.js', () => ({ execPm2: vi.fn(async () => ({ stdout: '[]' })) }));
+vi.mock('./appIconDetect.js', () => ({ detectAppIcon: vi.fn(async () => null) }));
describe('detectGodotNativeLaunch', () => {
let dir;
@@ -1022,4 +1027,154 @@ describe('client mirror of the app-type sets', () => {
const client = await import('../../client/src/components/apps/constants.js');
expect([...client.NON_PM2_TYPES].sort()).toEqual([...NON_PM2_TYPES].sort());
});
+
+ it('matches STANDARDIZABLE_TYPES', async () => {
+ const client = await import('../../client/src/components/apps/constants.js');
+ expect([...client.STANDARDIZABLE_TYPES].sort()).toEqual([...STANDARDIZABLE_TYPES].sort());
+ });
+});
+
+describe('streamDetection app-type classification', () => {
+ let dir;
+ afterEach(() => { if (dir) rmSync(dir, { recursive: true, force: true }); dir = null; });
+
+ /** Run detection over a temp repo built from `{ filename: contents }`. */
+ const detect = async (files) => {
+ dir = mkdtempSync(join(tmpdir(), 'detect-type-'));
+ for (const [name, contents] of Object.entries(files)) {
+ writeFileSync(join(dir, name), contents);
+ }
+ let completed = null;
+ const socket = {
+ emit: (event, payload) => { if (event === 'detect:complete') completed = payload; }
+ };
+ await streamDetection(socket, dir);
+ return completed;
+ };
+
+ it('classifies a Python repo instead of leaving it unknown', async () => {
+ const { success, result } = await detect({ 'pyproject.toml': '[project]\nname = "example"\n' });
+ expect(success).toBe(true);
+ expect(result.type).toBe('python');
+ expect(isStandardizable(result.type)).toBe(false);
+ });
+
+ it('classifies a Go repo', async () => {
+ const { result } = await detect({ 'go.mod': 'module example.com/demo\n', 'main.go': 'package main\n' });
+ expect(result.type).toBe('go');
+ });
+
+ it('classifies a compose-only stack as docker', async () => {
+ const { result } = await detect({ 'docker-compose.yml': 'services:\n web:\n image: nginx\n' });
+ expect(result.type).toBe('docker');
+ });
+
+ it('classifies a bare index.html as static', async () => {
+ const { result } = await detect({ 'index.html': '<!doctype html><title>Example</title>' });
+ expect(result.type).toBe('static');
+ });
+
+ it('leaves a package.json repo alone — Node tooling owns it, so `unknown` stays honest', async () => {
+ // A Node repo whose deps PortOS doesn't recognize must NOT be relabelled
+ // `static` just because it also ships an index.html; `unknown` remains
+ // standardizable, which is the correct answer for a Node project.
+ const { result } = await detect({
+ 'package.json': JSON.stringify({ name: 'example', dependencies: { lodash: '^4' } }),
+ 'index.html': '<!doctype html>'
+ });
+ expect(result.type).toBe('unknown');
+ expect(isStandardizable(result.type)).toBe(true);
+ });
+
+ it('does not overwrite an Apple type detected from the repo layout', async () => {
+ // A Swift package that also ships a Dockerfile is still `swift`.
+ const { result } = await detect({ 'Package.swift': '// swift-tools-version:5.9\n', Dockerfile: 'FROM swift\n' });
+ expect(result.type).toBe('swift');
+ });
+
+ it('still recognizes the Node types from package.json deps', async () => {
+ const { result } = await detect({
+ 'package.json': JSON.stringify({ name: 'example', dependencies: { vite: '^5', express: '^4' } })
+ });
+ expect(result.type).toBe('vite+express');
+ });
+});
+
+describe('classifyNonNodeType', () => {
+ it('classifies python from any of its marker files', () => {
+ for (const marker of ['pyproject.toml', 'requirements.txt', 'setup.py', 'Pipfile']) {
+ expect(classifyNonNodeType(['README.md', marker])).toBe('python');
+ }
+ });
+
+ it('classifies go from go.mod', () => {
+ expect(classifyNonNodeType(['go.mod', 'go.sum', 'main.go'])).toBe('go');
+ });
+
+ it('classifies docker from a compose file or Dockerfile', () => {
+ for (const marker of ['docker-compose.yml', 'docker-compose.yaml', 'compose.yml', 'compose.yaml', 'Dockerfile']) {
+ expect(classifyNonNodeType([marker])).toBe('docker');
+ }
+ });
+
+ it('classifies static from a bare index.html', () => {
+ expect(classifyNonNodeType(['index.html', 'style.css'])).toBe('static');
+ });
+
+ it('prefers the language over the packaging when both markers are present', () => {
+ // A Python service that also ships a Dockerfile is a python repo, not a
+ // docker stack — the language is the more useful classification, and both
+ // land outside STANDARDIZABLE_TYPES either way.
+ expect(classifyNonNodeType(['pyproject.toml', 'Dockerfile', 'index.html'])).toBe('python');
+ expect(classifyNonNodeType(['go.mod', 'docker-compose.yml'])).toBe('go');
+ expect(classifyNonNodeType(['Dockerfile', 'index.html'])).toBe('docker');
+ });
+
+ it('returns null when nothing matches, rather than guessing', () => {
+ expect(classifyNonNodeType(['README.md', 'LICENSE'])).toBeNull();
+ expect(classifyNonNodeType([])).toBeNull();
+ expect(classifyNonNodeType(undefined)).toBeNull();
+ });
+
+ it('emits only types the standardizer refuses', () => {
+ for (const type of NON_NODE_TYPES) {
+ expect(isStandardizable(type)).toBe(false);
+ }
+ });
+});
+
+describe('isStandardizable', () => {
+ it('allows the Node app types', () => {
+ for (const type of ['vite+express', 'vite', 'single-node-server', 'nextjs']) {
+ expect(isStandardizable(type)).toBe(true);
+ }
+ });
+
+ it('stays permissive for unknown — the persisted type of every pre-classification app', () => {
+ expect(isStandardizable('unknown')).toBe(true);
+ expect(isStandardizable(undefined)).toBe(true);
+ expect(isStandardizable(null)).toBe(true);
+ });
+
+ it('refuses the non-Node runtimes', () => {
+ for (const type of ['python', 'go', 'docker', 'static']) {
+ expect(isStandardizable(type)).toBe(false);
+ }
+ });
+
+ it('refuses the Apple types', () => {
+ for (const type of NON_PM2_TYPES) {
+ expect(isStandardizable(type)).toBe(false);
+ }
+ });
+
+ it('does not widen NON_PM2_TYPES — a Python or Go service can still run under PM2', () => {
+ // NON_PM2_TYPES means "Apple" to its other consumers (appDeployer's deploy
+ // gate, the slashdo workflow filter, the client's Xcode-only UI), so the
+ // standardizer gate is a separate predicate rather than an entry there.
+ for (const type of NON_NODE_TYPES) {
+ expect(NON_PM2_TYPES.has(type)).toBe(false);
+ expect(usesPm2(type)).toBe(true);
+ }
+ });
});