@auto-engineer/dev-server 0.13.3 → 0.15.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @auto-engineer/dev-server
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - version bump
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies []:
12
+ - @auto-engineer/message-bus@0.15.0
13
+ - @auto-engineer/cli@0.15.0
14
+
15
+ ## 0.14.0
16
+
17
+ ### Minor Changes
18
+
19
+ - Rewrite CLI and Pipeline
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies []:
24
+ - @auto-engineer/cli@0.14.0
25
+ - @auto-engineer/message-bus@0.14.0
26
+
3
27
  ## 0.13.3
4
28
 
5
29
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,210 @@
1
+ # @auto-engineer/dev-server
2
+
3
+ Development server commands for starting and managing client/server processes with file watching.
4
+
5
+ ---
6
+
7
+ ## Purpose
8
+
9
+ Without `@auto-engineer/dev-server`, you would have to manually manage process spawning, file watching for auto-restart, and process cleanup when developing client/server applications.
10
+
11
+ This package provides command handlers that integrate with the CLI pipeline system to start development processes with optional file watching for automatic restarts on code changes.
12
+
13
+ ---
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pnpm add @auto-engineer/dev-server
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ Register the handlers and start a development server:
24
+
25
+ ### 1. Register the handlers
26
+
27
+ ```typescript
28
+ import { COMMANDS } from '@auto-engineer/dev-server';
29
+ import { createMessageBus } from '@auto-engineer/message-bus';
30
+
31
+ const bus = createMessageBus();
32
+ COMMANDS.forEach(cmd => bus.registerCommand(cmd));
33
+ ```
34
+
35
+ ### 2. Send a command
36
+
37
+ ```typescript
38
+ const result = await bus.dispatch({
39
+ type: 'StartServer',
40
+ data: {
41
+ serverDirectory: './server',
42
+ watch: true,
43
+ },
44
+ requestId: 'req-123',
45
+ });
46
+
47
+ console.log(result);
48
+ // → { type: 'ServerStarted', data: { serverDirectory: './server', pid: 12345, watching: true } }
49
+ ```
50
+
51
+ The server starts with file watching enabled, automatically restarting on code changes.
52
+
53
+ ---
54
+
55
+ ## How-to Guides
56
+
57
+ ### Run via CLI
58
+
59
+ ```bash
60
+ auto start:server --server-directory=./server
61
+ auto start:client --client-directory=./client
62
+ ```
63
+
64
+ ### Run with Watch Mode
65
+
66
+ ```bash
67
+ auto start:server --server-directory=./server --watch --watch-directories=./server,./shared
68
+ ```
69
+
70
+ ### Run with Custom Command
71
+
72
+ ```bash
73
+ auto start:server --server-directory=./server --command="pnpm dev"
74
+ auto start:client --client-directory=./client --command="npm run dev"
75
+ ```
76
+
77
+ ### Handle Errors
78
+
79
+ ```typescript
80
+ if (result.type === 'ServerStartFailed') {
81
+ console.error(result.data.error);
82
+ }
83
+ ```
84
+
85
+ ### Enable Debug Logging
86
+
87
+ ```bash
88
+ DEBUG=auto:dev-server:* auto start:server --server-directory=./server
89
+ ```
90
+
91
+ ---
92
+
93
+ ## API Reference
94
+
95
+ ### Exports
96
+
97
+ ```typescript
98
+ import {
99
+ COMMANDS,
100
+ startServerCommandHandler,
101
+ startClientCommandHandler,
102
+ } from '@auto-engineer/dev-server';
103
+
104
+ import type {
105
+ StartServerCommand,
106
+ StartClientCommand,
107
+ ServerStartedEvent,
108
+ ServerStartFailedEvent,
109
+ ClientStartedEvent,
110
+ ClientStartFailedEvent,
111
+ } from '@auto-engineer/dev-server';
112
+ ```
113
+
114
+ ### Commands
115
+
116
+ | Command | CLI Alias | Description |
117
+ |---------|-----------|-------------|
118
+ | `StartServer` | `start:server` | Start development server with optional file watching |
119
+ | `StartClient` | `start:client` | Start development client process |
120
+
121
+ ### StartServerCommand
122
+
123
+ ```typescript
124
+ type StartServerCommand = Command<
125
+ 'StartServer',
126
+ {
127
+ serverDirectory: string;
128
+ command?: string; // default: 'pnpm start'
129
+ watch?: boolean; // default: true
130
+ watchDirectories?: string[];
131
+ debounceMs?: number; // default: 2000
132
+ }
133
+ >;
134
+ ```
135
+
136
+ ### StartClientCommand
137
+
138
+ ```typescript
139
+ type StartClientCommand = Command<
140
+ 'StartClient',
141
+ {
142
+ clientDirectory: string;
143
+ command?: string; // default: 'pnpm start'
144
+ }
145
+ >;
146
+ ```
147
+
148
+ ### ServerStartedEvent
149
+
150
+ ```typescript
151
+ type ServerStartedEvent = Event<
152
+ 'ServerStarted',
153
+ {
154
+ serverDirectory: string;
155
+ pid: number;
156
+ port?: number;
157
+ watching: boolean;
158
+ }
159
+ >;
160
+ ```
161
+
162
+ ### ClientStartedEvent
163
+
164
+ ```typescript
165
+ type ClientStartedEvent = Event<
166
+ 'ClientStarted',
167
+ {
168
+ clientDirectory: string;
169
+ pid: number;
170
+ port?: number;
171
+ }
172
+ >;
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Architecture
178
+
179
+ ```
180
+ src/
181
+ ├── index.ts
182
+ └── commands/
183
+ ├── start-server.ts
184
+ └── start-client.ts
185
+ ```
186
+
187
+ The following diagram shows the server watch flow:
188
+
189
+ ```mermaid
190
+ flowchart TB
191
+ A[StartServer] --> B[Spawn Process]
192
+ B --> C{Watch Mode?}
193
+ C -->|Yes| D[Start Watcher]
194
+ C -->|No| E[ServerStartedEvent]
195
+ D --> E
196
+ D --> F[File Change]
197
+ F --> G[Kill Process]
198
+ G --> B
199
+ ```
200
+
201
+ *Flow: Command spawns process, optionally starts file watcher which restarts on changes.*
202
+
203
+ ### Dependencies
204
+
205
+ | Package | Usage |
206
+ |---------|-------|
207
+ | `@auto-engineer/message-bus` | Command/event infrastructure |
208
+ | `chokidar` | File system watching |
209
+ | `execa` | Process execution |
210
+ | `debug` | Debug logging |
@@ -1 +1 @@
1
- {"version":3,"file":"start-client.d.ts","sourceRoot":"","sources":["../../../src/commands/start-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAwB,MAAM,4BAA4B,CAAC;AAQ5F,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,aAAa,EACb;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CACF,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,KAAK,CACpC,eAAe,EACf;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,KAAK,CACxC,mBAAmB,EACnB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;AAE5E,eAAO,MAAM,cAAc;;;yBAxBN,MAAM;kBACb,MAAM;;;;;GAuHlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"start-client.d.ts","sourceRoot":"","sources":["../../../src/commands/start-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAwB,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAM5F,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,aAAa,EACb;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CACF,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,KAAK,CACpC,eAAe,EACf;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,KAAK,CACxC,mBAAmB,EACnB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;AAE5E,eAAO,MAAM,cAAc;;;yBAxBN,MAAM;kBACb,MAAM;;;;;GA2HlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -1,11 +1,12 @@
1
+ import { access } from 'node:fs/promises';
2
+ import path from 'node:path';
1
3
  import { defineCommandHandler } from '@auto-engineer/message-bus';
2
- import path from 'path';
3
- import { execa } from 'execa';
4
- import { access } from 'fs/promises';
5
4
  import createDebug from 'debug';
5
+ import { execa } from 'execa';
6
6
  const debug = createDebug('auto:dev-server:start-client');
7
7
  export const commandHandler = defineCommandHandler({
8
8
  name: 'StartClient',
9
+ displayName: 'Start Client',
9
10
  alias: 'start:client',
10
11
  description: 'Start the development client',
11
12
  category: 'dev',
@@ -24,7 +25,10 @@ export const commandHandler = defineCommandHandler({
24
25
  '$ auto start:client --client-directory=./client',
25
26
  '$ auto start:client --client-directory=./client --command="pnpm dev"',
26
27
  ],
27
- events: ['ClientStarted', 'ClientStartFailed'],
28
+ events: [
29
+ { name: 'ClientStarted', displayName: 'Client Started' },
30
+ { name: 'ClientStartFailed', displayName: 'Client Start Failed' },
31
+ ],
28
32
  handle: async (command) => {
29
33
  const typedCommand = command;
30
34
  debug('CommandHandler executing for StartClient');
@@ -1 +1 @@
1
- {"version":3,"file":"start-client.js","sourceRoot":"","sources":["../../../src/commands/start-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,MAAM,KAAK,GAAG,WAAW,CAAC,8BAA8B,CAAC,CAAC;AA6B1D,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAGhD;IACA,IAAI,EA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B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACpD,CAAC;YAED,KAAK,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;YAElD,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACzB,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;YAEH,OAAO;gBACL,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,eAAe;oBACf,GAAG;iBACJ;gBACD,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,SAAS,EAAE,YAAY,CAAC,SAAS;gBACjC,aAAa,EAAE,YAAY,CAAC,aAAa;aAC1C,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;YAC5C,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YAEvF,OAAO;gBACL,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE;oBACJ,eAAe;oBACf,KAAK,EAAE,YAAY;iBACpB;gBACD,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,SAAS,EAAE,YAAY,CAAC,SAAS;gBACjC,aAAa,EAAE,YAAY,CAAC,aAAa;aAC1C,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -2,22 +2,37 @@ import { type Command, type Event } from '@auto-engineer/message-bus';
2
2
  export type StartServerCommand = Command<'StartServer', {
3
3
  serverDirectory: string;
4
4
  command?: string;
5
+ watch?: boolean;
6
+ watchDirectories?: string[];
7
+ debounceMs?: number;
5
8
  }>;
6
9
  export type ServerStartedEvent = Event<'ServerStarted', {
7
10
  serverDirectory: string;
8
11
  pid: number;
9
12
  port?: number;
13
+ watching: boolean;
10
14
  }>;
11
15
  export type ServerStartFailedEvent = Event<'ServerStartFailed', {
12
16
  serverDirectory: string;
13
17
  error: string;
14
18
  }>;
15
- export type StartServerEvents = ServerStartedEvent | ServerStartFailedEvent;
19
+ export type ServerRestartingEvent = Event<'ServerRestarting', {
20
+ serverDirectory: string;
21
+ changedPath: string;
22
+ }>;
23
+ export type ServerRestartedEvent = Event<'ServerRestarted', {
24
+ serverDirectory: string;
25
+ pid: number;
26
+ }>;
27
+ export type StartServerEvents = ServerStartedEvent | ServerStartFailedEvent | ServerRestartingEvent | ServerRestartedEvent;
16
28
  export declare const commandHandler: import("@auto-engineer/message-bus").UnifiedCommandHandler<Readonly<{
17
29
  type: "StartServer";
18
30
  data: Readonly<{
19
31
  serverDirectory: string;
20
32
  command?: string;
33
+ watch?: boolean;
34
+ watchDirectories?: string[];
35
+ debounceMs?: number;
21
36
  }>;
22
37
  timestamp?: Date;
23
38
  requestId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"start-server.d.ts","sourceRoot":"","sources":["../../../src/commands/start-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAwB,MAAM,4BAA4B,CAAC;AAQ5F,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,aAAa,EACb;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CACF,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,KAAK,CACpC,eAAe,EACf;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,KAAK,CACxC,mBAAmB,EACnB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;AAE5E,eAAO,MAAM,cAAc;;;yBAxBN,MAAM;kBACb,MAAM;;;;;GAuHlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"start-server.d.ts","sourceRoot":"","sources":["../../../src/commands/start-server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAAwB,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAU5F,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,aAAa,EACb;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CACF,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,KAAK,CACpC,eAAe,EACf;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CACF,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,KAAK,CACxC,mBAAmB,EACnB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,KAAK,CACvC,kBAAkB,EAClB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CACF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CACtC,iBAAiB,EACjB;IACE,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;CACb,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,kBAAkB,GAClB,sBAAsB,GACtB,qBAAqB,GACrB,oBAAoB,CAAC;AA+FzB,eAAO,MAAM,cAAc;;;yBA7IN,MAAM;kBACb,MAAM;gBACR,OAAO;2BACI,MAAM,EAAE;qBACd,MAAM;;;;;GAySrB,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -1,13 +1,86 @@
1
+ import { access } from 'node:fs/promises';
2
+ import path from 'node:path';
1
3
  import { defineCommandHandler } from '@auto-engineer/message-bus';
2
- import path from 'path';
3
- import { execa } from 'execa';
4
- import { access } from 'fs/promises';
4
+ import { watch } from 'chokidar';
5
5
  import createDebug from 'debug';
6
+ import { execa } from 'execa';
6
7
  const debug = createDebug('auto:dev-server:start-server');
8
+ const DEFAULT_DEBOUNCE_MS = 2000;
9
+ const IGNORED_PATTERNS = ['**/node_modules/**', '**/.git/**', '**/.DS_Store'];
10
+ function parseCommand(cmd) {
11
+ const [executable, ...args] = cmd.split(' ');
12
+ return { executable, args };
13
+ }
14
+ async function startProcess(executable, args, cwd) {
15
+ debug('Starting server process...');
16
+ debug(' Executable: %s', executable);
17
+ debug(' Args: %o', args);
18
+ debug(' CWD: %s', cwd);
19
+ const subprocess = execa(executable, args, {
20
+ cwd,
21
+ stdio: 'inherit',
22
+ reject: false,
23
+ detached: false,
24
+ });
25
+ const pid = subprocess.pid;
26
+ if (pid === undefined) {
27
+ throw new Error('Failed to start server process');
28
+ }
29
+ debug('Server process started with PID: %d', pid);
30
+ subprocess.catch((error) => {
31
+ debug('Server process error: %O', error);
32
+ });
33
+ return { subprocess, pid };
34
+ }
35
+ function killProcess(process) {
36
+ return new Promise((resolve) => {
37
+ debug('Killing server process PID: %d', process.pid);
38
+ process.subprocess.kill('SIGTERM');
39
+ const timeout = setTimeout(() => {
40
+ debug('Process did not exit gracefully, sending SIGKILL');
41
+ process.subprocess.kill('SIGKILL');
42
+ resolve();
43
+ }, 5000);
44
+ process.subprocess.finally(() => {
45
+ clearTimeout(timeout);
46
+ debug('Server process terminated');
47
+ resolve();
48
+ });
49
+ });
50
+ }
51
+ function createFileWatcher(directories, onFileChange) {
52
+ debug('Creating file watcher for directories: %o', directories);
53
+ const watcher = watch(directories, {
54
+ ignoreInitial: true,
55
+ persistent: true,
56
+ ignored: IGNORED_PATTERNS,
57
+ awaitWriteFinish: {
58
+ stabilityThreshold: 200,
59
+ pollInterval: 50,
60
+ },
61
+ });
62
+ watcher.on('add', (filePath) => {
63
+ debug('File added: %s', filePath);
64
+ onFileChange(filePath);
65
+ });
66
+ watcher.on('change', (filePath) => {
67
+ debug('File changed: %s', filePath);
68
+ onFileChange(filePath);
69
+ });
70
+ watcher.on('unlink', (filePath) => {
71
+ debug('File removed: %s', filePath);
72
+ onFileChange(filePath);
73
+ });
74
+ watcher.on('error', (error) => {
75
+ debug('Watcher error: %O', error);
76
+ });
77
+ return watcher;
78
+ }
7
79
  export const commandHandler = defineCommandHandler({
8
80
  name: 'StartServer',
81
+ displayName: 'Start Server',
9
82
  alias: 'start:server',
10
- description: 'Start the development server',
83
+ description: 'Start the development server with optional watch mode for auto-restart',
11
84
  category: 'dev',
12
85
  icon: 'server',
13
86
  fields: {
@@ -19,19 +92,41 @@ export const commandHandler = defineCommandHandler({
19
92
  description: 'Command to run (default: pnpm start)',
20
93
  required: false,
21
94
  },
95
+ watch: {
96
+ description: 'Enable watch mode to auto-restart on file changes (default: true)',
97
+ required: false,
98
+ },
99
+ watchDirectories: {
100
+ description: 'Directories to watch for changes (default: serverDirectory/src)',
101
+ required: false,
102
+ },
103
+ debounceMs: {
104
+ description: 'Debounce delay in milliseconds before restart (default: 2000)',
105
+ required: false,
106
+ },
22
107
  },
23
108
  examples: [
24
109
  '$ auto start:server --server-directory=./server',
25
110
  '$ auto start:server --server-directory=./server --command="pnpm dev"',
111
+ '$ auto start:server --server-directory=./server --watch',
112
+ '$ auto start:server --server-directory=./server --watch --watch-directories=./server,./shared',
113
+ ],
114
+ events: [
115
+ { name: 'ServerStarted', displayName: 'Server Started' },
116
+ { name: 'ServerStartFailed', displayName: 'Server Start Failed' },
117
+ { name: 'ServerRestarting', displayName: 'Server Restarting' },
118
+ { name: 'ServerRestarted', displayName: 'Server Restarted' },
26
119
  ],
27
- events: ['ServerStarted', 'ServerStartFailed'],
28
120
  handle: async (command) => {
29
121
  const typedCommand = command;
30
122
  debug('CommandHandler executing for StartServer');
31
- const { serverDirectory, command: customCommand } = typedCommand.data;
123
+ const { serverDirectory, command: customCommand, watch: watchEnabled = true, watchDirectories, debounceMs = DEFAULT_DEBOUNCE_MS, } = typedCommand.data;
32
124
  debug('Handling StartServerCommand');
33
125
  debug(' Server directory: %s', serverDirectory);
34
126
  debug(' Command: %s', customCommand ?? 'pnpm start');
127
+ debug(' Watch enabled: %s', watchEnabled);
128
+ debug(' Watch directories: %o', watchDirectories);
129
+ debug(' Debounce: %dms', debounceMs);
35
130
  debug(' Request ID: %s', typedCommand.requestId);
36
131
  debug(' Correlation ID: %s', typedCommand.correlationId ?? 'none');
37
132
  try {
@@ -41,29 +136,56 @@ export const commandHandler = defineCommandHandler({
41
136
  await access(path.join(serverDir, 'package.json'));
42
137
  debug('package.json found in server directory');
43
138
  const cmd = customCommand ?? 'pnpm start';
44
- const [executable, ...args] = cmd.split(' ');
45
- debug('Starting server...');
46
- debug('Executable: %s', executable);
47
- debug('Args: %o', args);
48
- const subprocess = execa(executable, args, {
49
- cwd: serverDir,
50
- stdio: 'inherit',
51
- reject: false,
52
- detached: false,
53
- });
54
- const pid = subprocess.pid;
55
- if (pid === undefined) {
56
- throw new Error('Failed to start server process');
139
+ const { executable, args } = parseCommand(cmd);
140
+ let currentProcess = await startProcess(executable, args, serverDir);
141
+ if (watchEnabled) {
142
+ const defaultWatchDir = path.join(serverDir, 'src');
143
+ const dirsToWatch = watchDirectories?.map((d) => path.resolve(d)) ?? [defaultWatchDir];
144
+ let debounceTimeout = null;
145
+ let isRestarting = false;
146
+ let lastRestartTime = 0;
147
+ const restartCooldownMs = debounceMs;
148
+ const handleFileChange = (changedPath) => {
149
+ if (isRestarting) {
150
+ debug('Already restarting, ignoring change: %s', changedPath);
151
+ return;
152
+ }
153
+ const timeSinceLastRestart = Date.now() - lastRestartTime;
154
+ if (timeSinceLastRestart < restartCooldownMs) {
155
+ debug('In cooldown period (%dms remaining), ignoring: %s', restartCooldownMs - timeSinceLastRestart, changedPath);
156
+ return;
157
+ }
158
+ if (debounceTimeout) {
159
+ clearTimeout(debounceTimeout);
160
+ }
161
+ debug('File change detected, will restart in %dms: %s', debounceMs, changedPath);
162
+ debounceTimeout = setTimeout(() => {
163
+ debounceTimeout = null;
164
+ isRestarting = true;
165
+ debug('Restarting server due to file change: %s', changedPath);
166
+ killProcess(currentProcess)
167
+ .then(() => startProcess(executable, args, serverDir))
168
+ .then((newProcess) => {
169
+ currentProcess = newProcess;
170
+ lastRestartTime = Date.now();
171
+ debug('Server restarted with new PID: %d', newProcess.pid);
172
+ isRestarting = false;
173
+ })
174
+ .catch((error) => {
175
+ debug('Failed to restart server: %O', error);
176
+ isRestarting = false;
177
+ });
178
+ }, debounceMs);
179
+ };
180
+ createFileWatcher(dirsToWatch, handleFileChange);
181
+ debug('File watcher started for directories: %o', dirsToWatch);
57
182
  }
58
- debug('Server process started with PID: %d', pid);
59
- subprocess.catch((error) => {
60
- debug('Server process error: %O', error);
61
- });
62
183
  return {
63
184
  type: 'ServerStarted',
64
185
  data: {
65
186
  serverDirectory,
66
- pid,
187
+ pid: currentProcess.pid,
188
+ watching: watchEnabled,
67
189
  },
68
190
  timestamp: new Date(),
69
191
  requestId: typedCommand.requestId,
@@ -1 +1 @@
1
- {"version":3,"file":"start-server.js","sourceRoot":"","sources":["../../../src/commands/start-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,M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,CAAC;gBAEF,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;gBACjD,KAAK,CAAC,0CAA0C,EAAE,WAAW,CAAC,CAAC;YACjE,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,eAAe;oBACf,GAAG,EAAE,cAAc,CAAC,GAAG;oBACvB,QAAQ,EAAE,YAAY;iBACvB;gBACD,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,SAAS,EAAE,YAAY,CAAC,SAAS;gBACjC,aAAa,EAAE,YAAY,CAAC,aAAa;aAC1C,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;YAC5C,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YAEvF,OAAO;gBACL,IAAI,EAAE,mBAAmB;gBACzB,IAAI,EAAE;oBACJ,eAAe;oBACf,KAAK,EAAE,YAAY;iBACpB;gBACD,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,SAAS,EAAE,YAAY,CAAC,SAAS;gBACjC,aAAa,EAAE,YAAY,CAAC,aAAa;aAC1C,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -1,22 +1,25 @@
1
1
  export declare const COMMANDS: (import("@auto-engineer/message-bus").UnifiedCommandHandler<Readonly<{
2
- type: "StartServer";
2
+ type: "StartClient";
3
3
  data: Readonly<{
4
- serverDirectory: string;
4
+ clientDirectory: string;
5
5
  command?: string;
6
6
  }>;
7
7
  timestamp?: Date;
8
8
  requestId?: string;
9
9
  correlationId?: string;
10
10
  }>> | import("@auto-engineer/message-bus").UnifiedCommandHandler<Readonly<{
11
- type: "StartClient";
11
+ type: "StartServer";
12
12
  data: Readonly<{
13
- clientDirectory: string;
13
+ serverDirectory: string;
14
14
  command?: string;
15
+ watch?: boolean;
16
+ watchDirectories?: string[];
17
+ debounceMs?: number;
15
18
  }>;
16
19
  timestamp?: Date;
17
20
  requestId?: string;
18
21
  correlationId?: string;
19
22
  }>>)[];
20
- export { commandHandler as startServerCommandHandler, type StartServerCommand, type StartServerEvents, type ServerStartedEvent, type ServerStartFailedEvent, } from './commands/start-server';
21
- export { commandHandler as startClientCommandHandler, type StartClientCommand, type StartClientEvents, type ClientStartedEvent, type ClientStartFailedEvent, } from './commands/start-client';
23
+ export { type ClientStartedEvent, type ClientStartFailedEvent, commandHandler as startClientCommandHandler, type StartClientCommand, type StartClientEvents, } from './commands/start-client';
24
+ export { commandHandler as startServerCommandHandler, type ServerStartedEvent, type ServerStartFailedEvent, type StartServerCommand, type StartServerEvents, } from './commands/start-server';
22
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;MAA2C,CAAC;AAEjE,OAAO,EACL,cAAc,IAAI,yBAAyB,EAC3C,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,cAAc,IAAI,yBAAyB,EAC3C,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;MAA2C,CAAC;AAEjE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,cAAc,IAAI,yBAAyB,EAC3C,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,IAAI,yBAAyB,EAC3C,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,yBAAyB,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { commandHandler as startServerHandler } from './commands/start-server.js';
2
1
  import { commandHandler as startClientHandler } from './commands/start-client.js';
2
+ import { commandHandler as startServerHandler } from './commands/start-server.js';
3
3
  export const COMMANDS = [startServerHandler, startClientHandler];
4
- export { commandHandler as startServerCommandHandler, } from './commands/start-server.js';
5
4
  export { commandHandler as startClientCommandHandler, } from './commands/start-client.js';
5
+ export { commandHandler as startServerCommandHandler, } from './commands/start-server.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE/E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;AAEjE,OAAO,EACL,cAAc,IAAI,yBAAyB,GAK5C,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,cAAc,IAAI,yBAAyB,GAK5C,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE/E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;AAEjE,OAAO,EAGL,cAAc,IAAI,yBAAyB,GAG5C,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,IAAI,yBAAyB,GAK5C,MAAM,yBAAyB,CAAC"}