#!/usr/bin/env node /** * DSS CLI - Design System Server Command Line Interface * * A portable companion for UI developers. Commands: * * - 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'; import chalk from 'chalk'; import { initCommand } from './commands/init.js'; import { startCommand } from './commands/start.js'; import { syncCommand } from './commands/sync.js'; import { extractCommand } from './commands/extract.js'; import { configCommand } from './commands/config.js'; import { statusCommand } from './commands/status.js'; import { stopCommand } from './commands/stop.js'; const program = new Command(); program .name('dss') .description('Design System Server - CLI for UI Developers') .version('0.1.0'); // Init command - setup DSS in a project program .command('init') .description('Initialize DSS in your project') .option('-f, --figma-key ', 'Figma file key') .option('-t, --figma-token ', 'Figma access token') .action(initCommand); // Start command - start the DSS server program .command('start') .description('Start the DSS server') .option('-p, --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('Sync tokens from Figma to codebase') .option('-f, --format ', 'Output format: css, scss, json, ts', 'css') .option('-o, --output ', 'Output directory') .option('--file-key ', 'Figma file key (overrides config)') .action(syncCommand); // Extract command - extract components or tokens program .command('extract ') .description('Extract components or tokens from Figma') .option('-f, --format ', 'Output format', 'json') .option('-o, --output ', 'Output location') .option('--file-key ', 'Figma file key') .action(extractCommand); // Config command - manage configuration program .command('config') .description('Manage DSS configuration') .option('--set ', 'Set configuration value') .option('--get ', 'Get configuration value') .option('--list', 'List all configuration') .action(configCommand); // Stop command - stop the server program .command('stop') .description('Stop the DSS server') .action(stopCommand); // Status command - check DSS status program .command('status') .description('Check DSS server status and configuration') .action(statusCommand); // Parse arguments program.parse(); // Show help if no command provided if (!process.argv.slice(2).length) { console.log(chalk.blue(` ╔═══════════════════════════════════════════════════════════════╗ ║ ${chalk.bold('DSS')} - Design System Server ║ ║ UI Developer Companion ║ ╚═══════════════════════════════════════════════════════════════╝ `)); program.outputHelp(); }