@auto-engineer/dev-server 1.148.0 → 1.150.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 +40 -0
- package/README.md +162 -78
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @auto-engineer/dev-server
|
|
2
2
|
|
|
3
|
+
## 1.150.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a502d47`](https://github.com/BeOnAuto/auto-engineer/commit/a502d472df528a1c5d53905898220c2a3a49d8a5) Thanks [@osamanar](https://github.com/osamanar)! -
|
|
8
|
+
|
|
9
|
+
- [`c96a70e`](https://github.com/BeOnAuto/auto-engineer/commit/c96a70e49f9f64213450d0b9840bc9a8b2b1d77d) Thanks [@osamanar](https://github.com/osamanar)! -
|
|
10
|
+
|
|
11
|
+
- [`4343bca`](https://github.com/BeOnAuto/auto-engineer/commit/4343bcaa2576703ae578fd9b7f5ec5b9776702a9) Thanks [@osamanar](https://github.com/osamanar)! -
|
|
12
|
+
|
|
13
|
+
- [`28ffce9`](https://github.com/BeOnAuto/auto-engineer/commit/28ffce9c8b95f0c3ca61728bd1f667fa9416d461) Thanks [@osamanar](https://github.com/osamanar)! -
|
|
14
|
+
|
|
15
|
+
- [`3fd5dbf`](https://github.com/BeOnAuto/auto-engineer/commit/3fd5dbfbfb4f7a5fe71ae53105b31a1b0f30f911) Thanks [@osamanar](https://github.com/osamanar)! -
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`41f3df3`](https://github.com/BeOnAuto/auto-engineer/commit/41f3df3025445ba92208c2b007b8e29a40489309) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **global**: version packages
|
|
20
|
+
- **global**: major refresh to all the docs
|
|
21
|
+
- Updated dependencies [[`a502d47`](https://github.com/BeOnAuto/auto-engineer/commit/a502d472df528a1c5d53905898220c2a3a49d8a5), [`c96a70e`](https://github.com/BeOnAuto/auto-engineer/commit/c96a70e49f9f64213450d0b9840bc9a8b2b1d77d), [`4343bca`](https://github.com/BeOnAuto/auto-engineer/commit/4343bcaa2576703ae578fd9b7f5ec5b9776702a9), [`28ffce9`](https://github.com/BeOnAuto/auto-engineer/commit/28ffce9c8b95f0c3ca61728bd1f667fa9416d461), [`41f3df3`](https://github.com/BeOnAuto/auto-engineer/commit/41f3df3025445ba92208c2b007b8e29a40489309), [`3fd5dbf`](https://github.com/BeOnAuto/auto-engineer/commit/3fd5dbfbfb4f7a5fe71ae53105b31a1b0f30f911)]:
|
|
22
|
+
- @auto-engineer/cli@1.150.0
|
|
23
|
+
- @auto-engineer/message-bus@1.150.0
|
|
24
|
+
|
|
25
|
+
## 1.149.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- [`e1eebbd`](https://github.com/BeOnAuto/auto-engineer/commit/e1eebbdf4f209780e790094d2e6887c4fa809f98) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **server-generator-apollo-emmett**: add Given state ref hints to state.ts.ejs
|
|
30
|
+
- **server-generator-apollo-emmett**: context-aware nonCommandField instructions
|
|
31
|
+
- **server-generator-apollo-emmett**: add state context instruction
|
|
32
|
+
- **server-generator-apollo-emmett**: extract shared template helpers
|
|
33
|
+
- **server-generator-apollo-emmett**: filter state refs from hasGivenEvents in decide.ts.ejs
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [`d38c81e`](https://github.com/BeOnAuto/auto-engineer/commit/d38c81e7bb442a39626564cf4f6d8d55b60d0a38) Thanks [@SamHatoum](https://github.com/SamHatoum)! -
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [[`d38c81e`](https://github.com/BeOnAuto/auto-engineer/commit/d38c81e7bb442a39626564cf4f6d8d55b60d0a38), [`e1eebbd`](https://github.com/BeOnAuto/auto-engineer/commit/e1eebbdf4f209780e790094d2e6887c4fa809f98)]:
|
|
40
|
+
- @auto-engineer/cli@1.149.0
|
|
41
|
+
- @auto-engineer/message-bus@1.149.0
|
|
42
|
+
|
|
3
43
|
## 1.148.0
|
|
4
44
|
|
|
5
45
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
# @auto-engineer/dev-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Command handlers for starting, restarting, and managing development processes (server, client, Storybook) with file watching, port cleanup, and dependency installation.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Purpose
|
|
8
8
|
|
|
9
|
-
|
|
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.
|
|
9
|
+
Provides a set of message-bus command handlers that manage the lifecycle of development processes. Each handler spawns a child process, optionally waits for HTTP readiness, and emits structured events on success or failure. The server command includes file watching with debounced auto-restart on code changes.
|
|
12
10
|
|
|
13
11
|
---
|
|
14
12
|
|
|
@@ -20,9 +18,7 @@ pnpm add @auto-engineer/dev-server
|
|
|
20
18
|
|
|
21
19
|
## Quick Start
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### 1. Register the handlers
|
|
21
|
+
### 1. Register all command handlers
|
|
26
22
|
|
|
27
23
|
```typescript
|
|
28
24
|
import { COMMANDS } from '@auto-engineer/dev-server';
|
|
@@ -32,179 +28,267 @@ const bus = createMessageBus();
|
|
|
32
28
|
COMMANDS.forEach(cmd => bus.registerCommand(cmd));
|
|
33
29
|
```
|
|
34
30
|
|
|
35
|
-
### 2.
|
|
31
|
+
### 2. Dispatch a command
|
|
36
32
|
|
|
37
33
|
```typescript
|
|
38
34
|
const result = await bus.dispatch({
|
|
39
35
|
type: 'StartServer',
|
|
40
36
|
data: {
|
|
41
37
|
serverDirectory: './server',
|
|
38
|
+
port: 4000,
|
|
42
39
|
watch: true,
|
|
43
40
|
},
|
|
44
|
-
requestId: 'req-
|
|
41
|
+
requestId: 'req-1',
|
|
45
42
|
});
|
|
46
|
-
|
|
47
|
-
console.log(result);
|
|
48
|
-
// → { type: 'ServerStarted', data: { serverDirectory: './server', pid: 12345, watching: true } }
|
|
43
|
+
// result.type === 'ServerStarted' | 'ServerStartFailed'
|
|
49
44
|
```
|
|
50
45
|
|
|
51
|
-
The server starts with file watching enabled, automatically restarting on code changes.
|
|
52
|
-
|
|
53
46
|
---
|
|
54
47
|
|
|
55
48
|
## How-to Guides
|
|
56
49
|
|
|
57
|
-
###
|
|
50
|
+
### Start the server with watch mode
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
auto start:server --server-directory=./server --watch --watch-directories=./server/src,./shared
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The server process restarts automatically when watched files change. Restarts are debounced (default 2000ms).
|
|
57
|
+
|
|
58
|
+
### Start client and Storybook
|
|
58
59
|
|
|
59
60
|
```bash
|
|
60
|
-
auto start:server --server-directory=./server
|
|
61
61
|
auto start:client --client-directory=./client
|
|
62
|
+
auto start:storybook --storybook-directory=./client --port=6006
|
|
62
63
|
```
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
Both commands wait for HTTP readiness before emitting their success event.
|
|
66
|
+
|
|
67
|
+
### Restart a running process
|
|
65
68
|
|
|
66
69
|
```bash
|
|
67
|
-
auto
|
|
70
|
+
auto restart:server --server-directory=./server
|
|
71
|
+
auto restart:client --client-directory=./client
|
|
72
|
+
auto restart:storybook --storybook-directory=./client
|
|
68
73
|
```
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
Restart commands kill the existing port holder before spawning a new process.
|
|
76
|
+
|
|
77
|
+
### Install dependencies
|
|
71
78
|
|
|
72
79
|
```bash
|
|
73
|
-
auto
|
|
74
|
-
auto
|
|
80
|
+
auto install:client --base-dir=./client
|
|
81
|
+
auto install:server --base-dir=./server
|
|
75
82
|
```
|
|
76
83
|
|
|
77
|
-
###
|
|
84
|
+
### Execute an ad-hoc command
|
|
78
85
|
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
console.error(result.data.error);
|
|
82
|
-
}
|
|
86
|
+
```bash
|
|
87
|
+
auto exec --base-dir=./client --command="pnpm build"
|
|
83
88
|
```
|
|
84
89
|
|
|
85
|
-
###
|
|
90
|
+
### Rebuild the component database
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
auto rebuild:component-db --base-dir=./client
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Reset everything
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
auto reset
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Kills processes on ports 4000, 6006, and 8080, clears pipeline messages, and dispatches a `Clean` command.
|
|
103
|
+
|
|
104
|
+
### Enable debug logging
|
|
86
105
|
|
|
87
106
|
```bash
|
|
88
107
|
DEBUG=auto:dev-server:* auto start:server --server-directory=./server
|
|
89
108
|
```
|
|
90
109
|
|
|
110
|
+
Each command uses its own debug namespace (e.g., `auto:dev-server:start-server`, `auto:dev-server:restart-client`).
|
|
111
|
+
|
|
91
112
|
---
|
|
92
113
|
|
|
93
114
|
## API Reference
|
|
94
115
|
|
|
95
|
-
###
|
|
116
|
+
### COMMANDS
|
|
96
117
|
|
|
97
118
|
```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';
|
|
119
|
+
import { COMMANDS } from '@auto-engineer/dev-server';
|
|
112
120
|
```
|
|
113
121
|
|
|
122
|
+
Array of all 13 command handlers, ready to register on a message bus.
|
|
123
|
+
|
|
114
124
|
### Commands
|
|
115
125
|
|
|
116
|
-
| Command |
|
|
117
|
-
|
|
118
|
-
| `StartServer` | `start:server` | Start
|
|
119
|
-
| `StartClient` | `start:client` | Start
|
|
126
|
+
| Command | Alias | Description | Default Port |
|
|
127
|
+
|---------|-------|-------------|-------------|
|
|
128
|
+
| `StartServer` | `start:server` | Start server with optional file watching | 4000 |
|
|
129
|
+
| `StartClient` | `start:client` | Start client process | 8080 |
|
|
130
|
+
| `StartStorybook` | `start:storybook` | Start Storybook dev server | 6006 |
|
|
131
|
+
| `RestartServer` | `restart:server` | Kill port holder and restart server | 4000 |
|
|
132
|
+
| `RestartClient` | `restart:client` | Kill port holder and restart client | 8080 |
|
|
133
|
+
| `RestartStorybook` | `restart:storybook` | Kill port holder and restart Storybook | 6006 |
|
|
134
|
+
| `ExecuteCommand` | `exec` | Run an ad-hoc shell command | -- |
|
|
135
|
+
| `RebuildComponentDB` | `rebuild:component-db` | Rebuild component DB from Storybook manifests | -- |
|
|
136
|
+
| `InstallClientDependencies` | `install:client` | Install client dependencies | -- |
|
|
137
|
+
| `InstallServerDependencies` | `install:server` | Install server dependencies | -- |
|
|
138
|
+
| `ResetPipeline` | `reset:pipeline` | Clear all pipeline messages and state | -- |
|
|
139
|
+
| `Clean` | `clean` | Remove generated directories, restore `.context` | -- |
|
|
140
|
+
| `Reset` | `reset` | Kill servers, clear pipeline, dispatch Clean | -- |
|
|
120
141
|
|
|
121
142
|
### StartServerCommand
|
|
122
143
|
|
|
123
144
|
```typescript
|
|
145
|
+
import type { StartServerCommand } from '@auto-engineer/dev-server';
|
|
146
|
+
|
|
124
147
|
type StartServerCommand = Command<
|
|
125
148
|
'StartServer',
|
|
126
149
|
{
|
|
127
150
|
serverDirectory: string;
|
|
128
151
|
command?: string; // default: 'pnpm start'
|
|
152
|
+
port?: number; // default: 4000
|
|
129
153
|
watch?: boolean; // default: true
|
|
130
|
-
watchDirectories?: string[];
|
|
154
|
+
watchDirectories?: string[]; // default: [serverDirectory/src]
|
|
131
155
|
debounceMs?: number; // default: 2000
|
|
132
156
|
}
|
|
133
157
|
>;
|
|
134
158
|
```
|
|
135
159
|
|
|
160
|
+
Events: `ServerStarted`, `ServerStartFailed`, `ServerRestarting`, `ServerRestarted`
|
|
161
|
+
|
|
136
162
|
### StartClientCommand
|
|
137
163
|
|
|
138
164
|
```typescript
|
|
165
|
+
import type { StartClientCommand } from '@auto-engineer/dev-server';
|
|
166
|
+
|
|
139
167
|
type StartClientCommand = Command<
|
|
140
168
|
'StartClient',
|
|
141
169
|
{
|
|
142
170
|
clientDirectory: string;
|
|
143
171
|
command?: string; // default: 'pnpm start'
|
|
172
|
+
port?: number; // default: 8080
|
|
144
173
|
}
|
|
145
174
|
>;
|
|
146
175
|
```
|
|
147
176
|
|
|
148
|
-
|
|
177
|
+
Events: `ClientStarted`, `ClientStartFailed`
|
|
178
|
+
|
|
179
|
+
### StartStorybookCommand
|
|
149
180
|
|
|
150
181
|
```typescript
|
|
151
|
-
type
|
|
152
|
-
|
|
182
|
+
import type { StartStorybookCommand } from '@auto-engineer/dev-server';
|
|
183
|
+
|
|
184
|
+
type StartStorybookCommand = Command<
|
|
185
|
+
'StartStorybook',
|
|
153
186
|
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
port?: number;
|
|
157
|
-
|
|
187
|
+
storybookDirectory: string;
|
|
188
|
+
command?: string; // default: 'pnpm storybook'
|
|
189
|
+
port?: number; // default: 6006
|
|
190
|
+
fast?: boolean; // default: false (sets STORYBOOK_FAST=1)
|
|
158
191
|
}
|
|
159
192
|
>;
|
|
160
193
|
```
|
|
161
194
|
|
|
162
|
-
|
|
195
|
+
Events: `StorybookStarted`, `StorybookStartFailed`
|
|
196
|
+
|
|
197
|
+
### ExecuteCommandCommand
|
|
163
198
|
|
|
164
199
|
```typescript
|
|
165
|
-
type
|
|
166
|
-
|
|
200
|
+
import type { ExecuteCommandCommand } from '@auto-engineer/dev-server';
|
|
201
|
+
|
|
202
|
+
type ExecuteCommandCommand = Command<
|
|
203
|
+
'ExecuteCommand',
|
|
167
204
|
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
port?: number;
|
|
205
|
+
baseDir: string;
|
|
206
|
+
command: string;
|
|
171
207
|
}
|
|
172
208
|
>;
|
|
173
209
|
```
|
|
174
210
|
|
|
211
|
+
Events: `CommandExecuted` (includes stdout/stderr/exitCode), `CommandFailed`
|
|
212
|
+
|
|
213
|
+
### Named handler exports
|
|
214
|
+
|
|
215
|
+
Each command handler is also exported individually:
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
import {
|
|
219
|
+
startServerCommandHandler,
|
|
220
|
+
startClientCommandHandler,
|
|
221
|
+
startStorybookCommandHandler,
|
|
222
|
+
restartServerCommandHandler,
|
|
223
|
+
restartClientCommandHandler,
|
|
224
|
+
restartStorybookCommandHandler,
|
|
225
|
+
executeCommandHandler,
|
|
226
|
+
rebuildComponentDBCommandHandler,
|
|
227
|
+
installClientDependenciesCommandHandler,
|
|
228
|
+
installServerDependenciesCommandHandler,
|
|
229
|
+
resetPipelineCommandHandler,
|
|
230
|
+
cleanCommandHandler,
|
|
231
|
+
resetCommandHandler,
|
|
232
|
+
} from '@auto-engineer/dev-server';
|
|
233
|
+
```
|
|
234
|
+
|
|
175
235
|
---
|
|
176
236
|
|
|
177
237
|
## Architecture
|
|
178
238
|
|
|
179
239
|
```
|
|
180
240
|
src/
|
|
181
|
-
├── index.ts
|
|
241
|
+
├── index.ts # COMMANDS array + re-exports
|
|
242
|
+
├── ensure-installed.ts # Auto-install node_modules if missing
|
|
243
|
+
├── port-cleanup.ts # Kill processes holding a port (SIGTERM → SIGKILL)
|
|
244
|
+
├── wait-for-http.ts # Poll localhost until HTTP responds (<500)
|
|
182
245
|
└── commands/
|
|
183
|
-
├── start-server.ts
|
|
184
|
-
|
|
246
|
+
├── start-server.ts # Spawn server + chokidar file watcher
|
|
247
|
+
├── start-client.ts # Spawn client, wait for HTTP ready
|
|
248
|
+
├── start-storybook.ts # Spawn Storybook, write settings, wait for HTTP
|
|
249
|
+
├── restart-server.ts # Kill port → delegate to StartServer
|
|
250
|
+
├── restart-client.ts # Kill port → delegate to StartClient
|
|
251
|
+
├── restart-storybook.ts # Kill port → delegate to StartStorybook
|
|
252
|
+
├── execute-command.ts # Run arbitrary shell command
|
|
253
|
+
├── build-component-db.ts # Rebuild component DB, parse artifact URL
|
|
254
|
+
├── install-client-dependencies.ts
|
|
255
|
+
├── install-server-dependencies.ts
|
|
256
|
+
├── reset-pipeline.ts # Clear pipeline messages
|
|
257
|
+
├── clean.ts # Remove server/client dirs, restore .context
|
|
258
|
+
├── reset.ts # Kill ports 4000/6006/8080, clear, clean
|
|
259
|
+
└── storybook-settings.ts # Default Storybook settings JSON
|
|
185
260
|
```
|
|
186
261
|
|
|
187
|
-
The following diagram shows the server watch flow:
|
|
188
|
-
|
|
189
262
|
```mermaid
|
|
190
263
|
flowchart TB
|
|
191
|
-
A[StartServer] --> B[
|
|
192
|
-
B --> C
|
|
193
|
-
C
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
F --> G
|
|
198
|
-
|
|
264
|
+
A[StartServer command] --> B[Kill port holder]
|
|
265
|
+
B --> C[Spawn process]
|
|
266
|
+
C --> D[Wait for HTTP ready]
|
|
267
|
+
D --> E{Watch mode?}
|
|
268
|
+
E -->|Yes| F[Start chokidar watcher]
|
|
269
|
+
E -->|No| G[ServerStarted event]
|
|
270
|
+
F --> G
|
|
271
|
+
F --> H[File change detected]
|
|
272
|
+
H --> I[Debounce]
|
|
273
|
+
I --> J[Kill process]
|
|
274
|
+
J --> C
|
|
199
275
|
```
|
|
200
276
|
|
|
201
|
-
|
|
277
|
+
```mermaid
|
|
278
|
+
flowchart TB
|
|
279
|
+
R[RestartServer command] --> K[Kill port holder]
|
|
280
|
+
K --> L[Delegate to StartServer handler]
|
|
281
|
+
L --> M{Result?}
|
|
282
|
+
M -->|ServerStarted| N[ServerRestarted event]
|
|
283
|
+
M -->|ServerStartFailed| O[ServerRestartFailed event]
|
|
284
|
+
```
|
|
202
285
|
|
|
203
286
|
### Dependencies
|
|
204
287
|
|
|
205
288
|
| Package | Usage |
|
|
206
289
|
|---------|-------|
|
|
207
|
-
| `@auto-engineer/
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
290
|
+
| `@auto-engineer/cli` | TUI service registry integration |
|
|
291
|
+
| `@auto-engineer/message-bus` | `defineCommandHandler`, `Command`/`Event` types |
|
|
292
|
+
| `chokidar` | File system watching for server auto-restart |
|
|
293
|
+
| `execa` | Process spawning |
|
|
294
|
+
| `debug` | Namespaced debug logging (`auto:dev-server:*`) |
|
package/package.json
CHANGED
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
"chokidar": "^3.6.0",
|
|
19
19
|
"debug": "^4.4.1",
|
|
20
20
|
"execa": "^9.5.2",
|
|
21
|
-
"@auto-engineer/cli": "1.
|
|
22
|
-
"@auto-engineer/message-bus": "1.
|
|
21
|
+
"@auto-engineer/cli": "1.150.0",
|
|
22
|
+
"@auto-engineer/message-bus": "1.150.0"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@auto-engineer/cli": "1.
|
|
28
|
+
"@auto-engineer/cli": "1.150.0"
|
|
29
29
|
},
|
|
30
|
-
"version": "1.
|
|
30
|
+
"version": "1.150.0",
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsc && tsx ../../scripts/fix-esm-imports.ts",
|
|
33
33
|
"test": "vitest run --reporter=dot",
|