Major refactor: Consolidate DSS into unified package structure
- Create new dss/ Python package at project root - Move MCP core from tools/dss_mcp/ to dss/mcp/ - Move storage layer from tools/storage/ to dss/storage/ - Move domain logic from dss-mvp1/dss/ to dss/ - Move services from tools/api/services/ to dss/services/ - Move API server to apps/api/ - Move CLI to apps/cli/ - Move Storybook assets to storybook/ - Create unified dss/__init__.py with comprehensive exports - Merge configuration into dss/settings.py (Pydantic-based) - Create pyproject.toml for proper package management - Update startup scripts for new paths - Remove old tools/ and dss-mvp1/ directories Architecture changes: - DSS is now MCP-first with 40+ tools for Claude Code - Clean imports: from dss import Projects, Components, FigmaToolSuite - No more sys.path.insert() hacking - apps/ contains thin application wrappers (API, CLI) - Single unified Python package for all DSS logic 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
74
apps/cli/scripts/postinstall.js
Normal file
74
apps/cli/scripts/postinstall.js
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/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!');
|
||||
40
apps/cli/scripts/publish.sh
Executable file
40
apps/cli/scripts/publish.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
# DSS npm publish script
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Publishing @overbits/dss to npm..."
|
||||
|
||||
# Ensure we're in the cli directory
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Build
|
||||
echo "📦 Building..."
|
||||
npm run build
|
||||
|
||||
# Check if logged in to npm
|
||||
if ! npm whoami &> /dev/null; then
|
||||
echo "❌ Not logged in to npm. Run: npm login"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify package
|
||||
echo "📋 Package contents:"
|
||||
npm pack --dry-run
|
||||
|
||||
# Confirm
|
||||
read -p "Publish to npm? (y/N) " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Cancelled."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Publish
|
||||
npm publish --access public
|
||||
|
||||
echo "✅ Published @overbits/dss!"
|
||||
echo ""
|
||||
echo "Users can now install with:"
|
||||
echo " npm install -g @overbits/dss"
|
||||
echo " npx @overbits/dss"
|
||||
Reference in New Issue
Block a user