Files
dss/cli/scripts/postinstall.js
Digital Production Factory 276ed71f31 Initial commit: Clean DSS implementation
Migrated from design-system-swarm with fresh git history.
Old project history preserved in /home/overbits/apps/design-system-swarm

Core components:
- MCP Server (Python FastAPI with mcp 1.23.1)
- Claude Plugin (agents, commands, skills, strategies, hooks, core)
- DSS Backend (dss-mvp1 - token translation, Figma sync)
- Admin UI (Node.js/React)
- Server (Node.js/Express)
- Storybook integration (dss-mvp1/.storybook)

Self-contained configuration:
- All paths relative or use DSS_BASE_PATH=/home/overbits/dss
- PYTHONPATH configured for dss-mvp1 and dss-claude-plugin
- .env file with all configuration
- Claude plugin uses ${CLAUDE_PLUGIN_ROOT} for portability

Migration completed: $(date)
🤖 Clean migration with full functionality preserved
2025-12-09 18:45:48 -03:00

75 lines
2.0 KiB
JavaScript

#!/usr/bin/env node
/**
* DSS Postinstall Script
*
* Sets up Python virtual environment and installs dependencies
* after npm install.
*/
import { spawn, execSync } from 'child_process';
import { existsSync, mkdirSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const pythonDir = join(__dirname, '..', 'python');
const venvDir = join(pythonDir, 'venv');
const apiDir = join(pythonDir, 'api');
console.log('[DSS] Setting up Python environment...');
// Check if Python 3 is available
function getPythonCmd() {
const commands = ['python3', 'python'];
for (const cmd of commands) {
try {
execSync(`${cmd} --version`, { stdio: 'ignore' });
return cmd;
} catch {
continue;
}
}
return null;
}
const python = getPythonCmd();
if (!python) {
console.error('[DSS] Error: Python 3 is required but not found.');
console.error('[DSS] Please install Python 3.8+ and try again.');
process.exit(1);
}
console.log(`[DSS] Using ${python}`);
// Create virtual environment if needed
if (!existsSync(venvDir)) {
console.log('[DSS] Creating virtual environment...');
try {
execSync(`${python} -m venv ${venvDir}`, { stdio: 'inherit' });
} catch (error) {
console.error('[DSS] Failed to create virtual environment');
console.error('[DSS] Try: pip install virtualenv');
process.exit(1);
}
}
// Install requirements
const pip = join(venvDir, 'bin', 'pip');
const requirements = join(apiDir, 'requirements.txt');
if (existsSync(requirements)) {
console.log('[DSS] Installing Python dependencies...');
try {
execSync(`${pip} install -q -r ${requirements}`, { stdio: 'inherit' });
console.log('[DSS] Python environment ready!');
} catch (error) {
console.error('[DSS] Failed to install Python dependencies');
process.exit(1);
}
} else {
console.log('[DSS] No requirements.txt found, skipping dependency install');
}
console.log('[DSS] Setup complete!');