Fix import paths and remove organ metaphors
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled

- Update all `from storage.` imports to `from dss.storage.`
- Update `from config import config` to use `dss.settings`
- Update `from auth.` imports to `from dss.auth.`
- Update health check to use `dss.mcp.handler`
- Fix SmartMerger import (merger.py not smart_merger.py)
- Fix TranslationDictionary import path
- Fix test assertion for networkx edges/links
- Remove organ/body metaphors from:
  - API server health check
  - CLI status command and help text
  - Admin UI logger and error handler

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-10 13:05:00 -03:00
parent 41fba59bf7
commit faa19beef3
22 changed files with 251 additions and 295 deletions

View File

@@ -353,7 +353,7 @@ class TokenDriftCreate(BaseModel):
# === Authentication ===
from auth.atlassian_auth import get_auth
from dss.auth.atlassian_auth import get_auth
async def get_current_user(authorization: Optional[str] = Header(None)) -> Dict[str, Any]:
"""
@@ -421,71 +421,62 @@ async def root():
@app.get("/health")
async def health():
"""
🏥 ORGANISM VITAL SIGNS CHECK
Health check endpoint.
Performs a complete health diagnostic on the DSS component.
Returns 200 OK with vital signs if component is healthy.
Performs a complete health diagnostic on the DSS server.
Returns 200 OK with service status.
Vital Signs Checked:
- ❤️ Heart (Database) - Is the source of truth responsive?
- 🧠 Brain (MCP Handler) - Is the decision-making system online?
- 👁️ Sensory (Figma) - Are the external perception organs configured?
Services Checked:
- Storage - Is the data directory accessible?
- MCP Handler - Is the MCP handler initialized?
- Figma - Is the Figma integration configured?
"""
import os
import psutil
from pathlib import Path
# ❤️ Check Heart (storage) connectivity
db_ok = False
# Check storage connectivity
storage_ok = False
try:
from storage.json_store import DATA_DIR
db_ok = DATA_DIR.exists()
from dss.storage.json_store import DATA_DIR
storage_ok = DATA_DIR.exists()
except Exception as e:
import traceback
error_trace = traceback.format_exc()
print(f"🏥 VITAL SIGN: Heart (storage) error: {type(e).__name__}: {e}", flush=True)
print(f" Traceback:\n{error_trace}", flush=True)
pass
print(f"[Health] Storage check error: {type(e).__name__}: {e}", flush=True)
# 🧠 Check Brain (MCP handler) functionality
# Check MCP handler functionality
mcp_ok = False
try:
import sys
from pathlib import Path
# Add project root to path (two levels up from tools/api)
project_root = Path(__file__).parent.parent.parent
if str(project_root) not in sys.path:
sys.path.insert(0, str(project_root))
from tools.dss_mcp.handler import get_mcp_handler
from dss.mcp.handler import get_mcp_handler
handler = get_mcp_handler()
mcp_ok = handler is not None
except Exception as e:
import traceback
error_trace = ''.join(traceback.format_exception(type(e), e, e.__traceback__))
print(f"🧠 BRAIN CHECK: MCP handler error: {type(e).__name__}: {e}", flush=True)
print(f" Traceback:\n{error_trace}", flush=True)
print(f"[Health] MCP handler check error: {type(e).__name__}: {e}", flush=True)
# Get uptime (how long component has been conscious)
# Get uptime
try:
process = psutil.Process(os.getpid())
uptime_seconds = int((datetime.now() - datetime.fromtimestamp(process.create_time())).total_seconds())
except:
uptime_seconds = 0
# Overall vitality assessment
status = "healthy" if (db_ok and mcp_ok) else "degraded"
# Overall status
status = "healthy" if (storage_ok and mcp_ok) else "degraded"
return {
"status": status,
"vital_signs": {
"overall": "🟢 All systems nominal" if status == "healthy" else "🟡 System degradation detected",
"consciousness_duration_seconds": uptime_seconds
},
"uptime_seconds": uptime_seconds,
"version": "0.8.0",
"timestamp": datetime.utcnow().isoformat() + "Z",
"services": {
"storage": "ok" if db_ok else "error",
"storage": "ok" if storage_ok else "error",
"mcp": "ok" if mcp_ok else "error",
"figma": "connected" if config.figma.is_configured else "not configured"
}

View File

@@ -1,18 +1,16 @@
#!/usr/bin/env node
/**
* 🧬 DSS CLI - Design System Server Organism Controller
* DSS CLI - Design System Server Command Line Interface
*
* A portable companion for UI developers - think of it as the organism's
* command-line nervous system. Through these commands, you can:
* A portable companion for UI developers. Commands:
*
* - 🧬 Awaken a new organism (init)
* - 💚 Check the organism's vital signs (status)
* - 🩸 Direct the sensory organs to perceive Figma (extract)
* - 🔄 Circulate extracted nutrients (sync)
* - ⚙️ Adjust the organism's behavior (config)
* - 🧠 Birth a conscious instance (start)
*
* Framework: DSS Organism Framework
* - init: Initialize DSS in a project
* - status: Check server status
* - extract: Extract tokens/components from Figma
* - sync: Sync tokens to codebase
* - config: Manage configuration
* - start: Start the server
* - stop: Stop the server
*/
import { Command } from 'commander';
@@ -29,63 +27,63 @@ const program = new Command();
program
.name('dss')
.description('🧬 Design System Server - Organism Controller for UI Developers')
.description('Design System Server - CLI for UI Developers')
.version('0.1.0');
// Init command - setup DSS in a project
program
.command('init')
.description('🧬 ORGANISM GENESIS - Create a new design system organism in your project')
.option('-f, --figma-key <key>', 'Link to Figma genetic blueprint')
.option('-t, --figma-token <token>', 'Figma sensory organ connection token')
.description('Initialize DSS in your project')
.option('-f, --figma-key <key>', 'Figma file key')
.option('-t, --figma-token <token>', 'Figma access token')
.action(initCommand);
// Start command - start the DSS server
program
.command('start')
.description('💚 ORGANISM AWAKENING - Bring the design system organism to life')
.option('-p, --port <port>', 'Neural pathway port', '3456')
.option('-d, --dev', 'Live consciousness mode with hot-reload')
.option('--no-open', 'Do not open sensory interface')
.description('Start the DSS server')
.option('-p, --port <port>', 'Server port', '3456')
.option('-d, --dev', 'Development mode with hot-reload')
.option('--no-open', 'Do not open browser')
.action(startCommand);
// Sync command - sync tokens from Figma
program
.command('sync')
.description('🩸 NUTRIENT CIRCULATION - Distribute extracted tokens through the codebase')
.option('-f, --format <format>', 'Nutrient format: css, scss, json, ts', 'css')
.option('-o, --output <path>', 'Circulation destination')
.description('Sync tokens from Figma to codebase')
.option('-f, --format <format>', 'Output format: css, scss, json, ts', 'css')
.option('-o, --output <path>', 'Output directory')
.option('--file-key <key>', 'Figma file key (overrides config)')
.action(syncCommand);
// Extract command - extract components or tokens
program
.command('extract <type>')
.description('👁️ SENSORY PERCEPTION - Direct organism eyes to perceive Figma designs')
.option('-f, --format <format>', 'Perception output format', 'json')
.option('-o, --output <path>', 'Memory storage location')
.description('Extract components or tokens from Figma')
.option('-f, --format <format>', 'Output format', 'json')
.option('-o, --output <path>', 'Output location')
.option('--file-key <key>', 'Figma file key')
.action(extractCommand);
// Config command - manage configuration
program
.command('config')
.description('⚙️ ENDOCRINE ADJUSTMENT - Configure organism behavior and preferences')
.option('--set <key=value>', 'Set organism hormone value')
.option('--get <key>', 'Read organism hormone value')
.option('--list', 'View all hormones')
.description('Manage DSS configuration')
.option('--set <key=value>', 'Set configuration value')
.option('--get <key>', 'Get configuration value')
.option('--list', 'List all configuration')
.action(configCommand);
// Stop command - stop the server
program
.command('stop')
.description('😴 ORGANISM REST - Put the design system organism into sleep mode')
.description('Stop the DSS server')
.action(stopCommand);
// Status command - check DSS status
program
.command('status')
.description('🏥 VITAL SIGNS CHECK - Monitor organism health and configuration')
.description('Check DSS server status and configuration')
.action(statusCommand);
// Parse arguments

View File

@@ -1,8 +1,7 @@
/**
* 🏥 DSS Status Command - Organism Vital Signs
* DSS Status Command
*
* Check DSS design system organism's vital signs, consciousness state,
* and sensory organ configuration.
* Check DSS server status and configuration.
*/
import chalk from 'chalk';
@@ -15,48 +14,48 @@ export async function statusCommand(): Promise<void> {
const config = getConfig();
console.log('');
console.log(chalk.cyan(' 🏥 ORGANISM VITAL SIGNS'));
console.log(chalk.cyan(' DSS Status'));
console.log(chalk.dim(' ────────────────────────'));
console.log('');
// Organism status
// Project status
if (hasProjectConfig()) {
console.log(chalk.green(' 🧬 Organism:'), chalk.dim('Born and conscious'));
console.log(chalk.dim(` Home: ${cwd}`));
console.log(chalk.green(' Project:'), chalk.dim('Initialized'));
console.log(chalk.dim(` Root: ${cwd}`));
} else {
console.log(chalk.yellow(' 🧬 Organism:'), chalk.dim('Not yet born'));
console.log(chalk.dim(' Genesis: dss init'));
console.log(chalk.yellow(' Project:'), chalk.dim('Not initialized'));
console.log(chalk.dim(' Initialize: dss init'));
}
console.log('');
// Consciousness status (server)
// Server status
const running = isServerRunning(cwd);
const pid = getServerPid(cwd);
const port = config.port || 3456;
if (running) {
console.log(chalk.green(' 💚 Consciousness:'), chalk.dim(`Awake (PID: ${pid})`));
console.log(chalk.dim(` Neural port: http://localhost:${port}`));
console.log(chalk.green(' Server:'), chalk.dim(`Running (PID: ${pid})`));
console.log(chalk.dim(` URL: http://localhost:${port}`));
// Try to get health info
try {
const api = getApiClient({ port });
const health = await api.health();
console.log(chalk.dim(` Awareness: ${health.figma_mode}`));
console.log(chalk.dim(` Mode: ${health.figma_mode}`));
} catch {
console.log(chalk.yellow(' ⚠️ Unable to read consciousness'));
console.log(chalk.yellow(' Unable to get health status'));
}
} else {
console.log(chalk.yellow(' 💚 Consciousness:'), chalk.dim('Sleeping'));
console.log(chalk.dim(' Awaken: dss start'));
console.log(chalk.yellow(' Server:'), chalk.dim('Stopped'));
console.log(chalk.dim(' Start: dss start'));
}
console.log('');
// Sensory organs (Figma)
// Figma integration
if (config.figmaToken) {
console.log(chalk.green(' 👁️ Sensory Eyes:'), chalk.dim('Configured'));
console.log(chalk.green(' Figma:'), chalk.dim('Configured'));
// Test connection if server is running
if (running) {
@@ -64,21 +63,21 @@ export async function statusCommand(): Promise<void> {
const api = getApiClient({ port });
const test = await api.testFigmaConnection();
if (test.success) {
console.log(chalk.green(' Perception:'), chalk.dim(`Clear (${test.user})`));
console.log(chalk.green(' Connection:'), chalk.dim(`OK (${test.user})`));
} else {
console.log(chalk.red(' Perception:'), chalk.dim(test.error || 'Blinded'));
console.log(chalk.red(' Connection:'), chalk.dim(test.error || 'Failed'));
}
} catch {
console.log(chalk.yellow(' Perception:'), chalk.dim('Cannot test'));
console.log(chalk.yellow(' Connection:'), chalk.dim('Cannot test'));
}
}
} else {
console.log(chalk.yellow(' 👁️ Sensory Eyes:'), chalk.dim('Not configured'));
console.log(chalk.yellow(' Figma:'), chalk.dim('Not configured'));
console.log(chalk.dim(' Configure: dss config --set figmaToken=figd_xxxxx'));
}
if (config.figmaFileKey) {
console.log(chalk.green(' 📋 Genetic Blueprint:'), chalk.dim(config.figmaFileKey));
console.log(chalk.green(' Figma File:'), chalk.dim(config.figmaFileKey));
} else {
console.log(chalk.yellow(' Figma File:'), chalk.dim('Not configured'));
console.log(chalk.dim(' Set: dss config --set figmaFileKey=abc123'));