Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

add xspace-agent/xspace-agent/packages/cli/src/commands/start.ts

oversteppingdd169436cf3c
diff --git a/xspace-agent/xspace-agent/packages/cli/src/commands/start.ts b/xspace-agent/xspace-agent/packages/cli/src/commands/start.ts
new file mode 100644
index 000000000..0661c123b
--- /dev/null
+++ b/xspace-agent/xspace-agent/packages/cli/src/commands/start.ts
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§68]
+
+import chalk from 'chalk';
+import ora from 'ora';
+import { resolveConfig, configToEnv } from '../config';
+import { banner, success, error, label, spacer } from '../logger';
+
+interface StartOptions {
+ config: string;
+ port: string;
+ headless?: boolean;
+ verbose?: boolean;
+}
+
+export async function startCommand(options: StartOptions): Promise<void> {
+ banner();
+
+ // Load config and apply to env
+ require('dotenv').config();
+ const config = resolveConfig(options.config, {});
+ configToEnv(config);
+
+ const port = parseInt(options.port, 10) || 3000;
+
+ const spinner = ora('Starting server...').start();
+
+ try {
+ const { createServer } = await import('@xspace/server');
+
+ const server = createServer({
+ port,
+ headless: options.headless,
+ verbose: options.verbose,
+ });
+
+ await server.start();
+
+ spinner.succeed('Server running');
+ spacer();
+ label('Admin panel', `http://localhost:${port}/admin`);
+ label('Dashboard', `http://localhost:${port}`);
+ label('AI Provider', config.ai.provider);
+ spacer();
+ console.log(` ${chalk.gray('Waiting for Space URL...')}`);
+ console.log(` ${chalk.gray('Use the admin panel or run:')} ${chalk.cyan(`npx xspace-agent join <url>`)}`);
+ spacer();
+
+ // Keep process alive with graceful shutdown
+ const shutdown = async () => {
+ spacer();
+ await server.stop();
+ success('Server stopped');
+ process.exit(0);
+ };
+ process.on('SIGINT', shutdown);
+ process.on('SIGTERM', shutdown);
+ } catch (err: unknown) {
+ spinner.fail('Failed to start server');
+ const message = err instanceof Error ? err.message : String(err);
+ error(message);
+ process.exit(1);
+ }
+}
+
+