swarmroom 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import { spawn } from 'node:child_process';
3
3
  import { existsSync } from 'node:fs';
4
4
  import { createRequire } from 'node:module';
5
5
  import chalk from 'chalk';
6
+ import { DEFAULT_PORT } from '@swarmroom/shared';
6
7
  import { DaemonWatcher } from '../daemon/watcher.js';
7
8
  import { banner, keyValue, info, error } from '../utils/display.js';
8
9
  const HUB_STARTUP_DELAY_MS = 2000;
@@ -18,16 +19,17 @@ function prefixLines(prefix, data) {
18
19
  console.log(`${prefix} ${line}`);
19
20
  }
20
21
  }
21
- function startHubProcess(port) {
22
+ function startHubProcess(port, noWeb = false) {
22
23
  const serverEntry = resolveServerEntry();
23
24
  if (!existsSync(serverEntry)) {
24
25
  error(`Server entry not found at: ${serverEntry}`);
25
26
  error('Make sure the server is built: npm run build -w packages/server');
26
27
  process.exit(1);
27
28
  }
29
+ const env = { ...process.env, PORT: String(port), ...(noWeb ? { SWARMROOM_NO_WEB: '1' } : {}) };
28
30
  const hubProcess = spawn('node', [serverEntry], {
29
31
  stdio: ['ignore', 'pipe', 'pipe'],
30
- env: { ...process.env, PORT: String(port) },
32
+ env,
31
33
  });
32
34
  const hubPrefix = chalk.blue('[hub]');
33
35
  const hubErrPrefix = chalk.red('[hub]');
@@ -50,34 +52,18 @@ function startHubProcess(port) {
50
52
  export function makeStartCommand() {
51
53
  const cmd = new Command('start')
52
54
  .description('Start SwarmRoom (hub + daemon)')
53
- .option('--hub-only', 'Start only the hub server')
55
+ .option('--server-only', 'Start hub API only (no web dashboard) + daemon')
54
56
  .option('--daemon-only', 'Start only the daemon watcher')
55
57
  .option('--hub-url <url>', 'Hub URL for daemon connection')
56
- .option('--port <port>', 'Server port (default: 3000)', '3000')
58
+ .option('--port <port>', `Server port (default: ${DEFAULT_PORT})`, String(DEFAULT_PORT))
57
59
  .option('--verbose', 'Enable verbose logging')
58
60
  .action(async (options) => {
59
61
  const port = parseInt(options.port, 10);
60
62
  const verbose = options.verbose ?? false;
61
- if (options.hubOnly && options.daemonOnly) {
62
- error('Cannot use --hub-only and --daemon-only together.');
63
+ if (options.serverOnly && options.daemonOnly) {
64
+ error('Cannot use --server-only and --daemon-only together.');
63
65
  process.exit(1);
64
66
  }
65
- if (options.hubOnly) {
66
- banner('SwarmRoom Hub');
67
- info('Starting hub server only...');
68
- keyValue('Port', chalk.cyan(String(port)));
69
- console.log('');
70
- const hubProcess = startHubProcess(port);
71
- const shutdown = () => {
72
- console.log('');
73
- info('Shutting down hub...');
74
- hubProcess.kill('SIGTERM');
75
- process.exit(0);
76
- };
77
- process.on('SIGINT', shutdown);
78
- process.on('SIGTERM', shutdown);
79
- return;
80
- }
81
67
  if (options.daemonOnly) {
82
68
  const hubUrl = options.hubUrl ?? `http://localhost:${port}`;
83
69
  banner('SwarmRoom Daemon');
@@ -101,15 +87,15 @@ export function makeStartCommand() {
101
87
  return;
102
88
  }
103
89
  const hubUrl = options.hubUrl ?? `http://localhost:${port}`;
90
+ const noWeb = options.serverOnly ?? false;
104
91
  banner('SwarmRoom', 'Hub + Daemon');
105
- info('Starting hub server and daemon watcher...');
106
- keyValue('Port', chalk.cyan(String(port)));
107
- keyValue('Hub URL', chalk.cyan(hubUrl));
92
+ keyValue('Hub API', chalk.cyan(`http://localhost:${port}`));
93
+ keyValue('Web Dashboard', noWeb ? chalk.dim('disabled') : chalk.cyan(`http://localhost:${port}`));
108
94
  if (verbose) {
109
95
  keyValue('Verbose', chalk.yellow('enabled'));
110
96
  }
111
97
  console.log('');
112
- const hubProcess = startHubProcess(port);
98
+ const hubProcess = startHubProcess(port, noWeb);
113
99
  const watcher = new DaemonWatcher({
114
100
  hubUrl,
115
101
  workdir: process.cwd(),
@@ -27,7 +27,7 @@ describe('getConfigPath', () => {
27
27
  describe('getDefaultConfig', () => {
28
28
  it('returns config with hubUrl and three agents', () => {
29
29
  const config = getDefaultConfig();
30
- expect(config.hubUrl).toBe('http://localhost:3000');
30
+ expect(config.hubUrl).toBe('http://localhost:39187');
31
31
  expect(Object.keys(config.agents)).toHaveLength(3);
32
32
  expect(config.agents).toHaveProperty('claude-code');
33
33
  expect(config.agents).toHaveProperty('opencode');
@@ -16,7 +16,7 @@ export function getConfigPath() {
16
16
  */
17
17
  export function getDefaultConfig() {
18
18
  return {
19
- hubUrl: 'http://localhost:3000',
19
+ hubUrl: 'http://localhost:39187',
20
20
  agents: {
21
21
  'claude-code': {
22
22
  headlessWakeup: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swarmroom",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "LAN-based agent discovery and communication hub for AI coding agents",
6
6
  "keywords": ["swarm", "agent", "mcp", "ai", "multi-agent", "lan", "discovery"],
@@ -23,9 +23,9 @@
23
23
  "prepublishOnly": "npm run build"
24
24
  },
25
25
  "dependencies": {
26
- "@swarmroom/sdk": "^0.1.0",
27
- "@swarmroom/server": "^0.1.0",
28
- "@swarmroom/shared": "^0.1.0",
26
+ "@swarmroom/sdk": "^0.2.0",
27
+ "@swarmroom/server": "^0.2.0",
28
+ "@swarmroom/shared": "^0.2.0",
29
29
  "chalk": "^5.6.2",
30
30
  "commander": "^14.0.3",
31
31
  "inquirer": "^13.2.2",