Files
dss/cli/src/cli.ts
Bruno Sarlo faa19beef3
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
Fix import paths and remove organ metaphors
- 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>
2025-12-10 13:05:00 -03:00

102 lines
3.4 KiB
JavaScript

#!/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 <key>', 'Figma file key')
.option('-t, --figma-token <token>', 'Figma access token')
.action(initCommand);
// Start command - start the DSS server
program
.command('start')
.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('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('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('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('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();
}