@auto-engineer/server-implementer 1.148.0 → 1.149.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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +3 -3
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +18 -0
- package/README.md +128 -73
- package/package.json +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/server-implementer@1.
|
|
2
|
+
> @auto-engineer/server-implementer@1.149.0 build /home/runner/work/auto-engineer/auto-engineer/packages/server-implementer
|
|
3
3
|
> tsc && tsx ../../scripts/fix-esm-imports.ts
|
|
4
4
|
|
|
5
5
|
Fixed ESM imports in dist/
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/server-implementer@1.
|
|
2
|
+
> @auto-engineer/server-implementer@1.148.0 test /home/runner/work/auto-engineer/auto-engineer/packages/server-implementer
|
|
3
3
|
> vitest run --reporter=dot
|
|
4
4
|
|
|
5
5
|
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
[2m Test Files [22m [1m[32m7 passed[39m[22m[90m (7)[39m
|
|
11
11
|
[2m Tests [22m [1m[32m46 passed[39m[22m[90m (46)[39m
|
|
12
|
-
[2m Start at [22m
|
|
13
|
-
[2m Duration [22m
|
|
12
|
+
[2m Start at [22m 07:23:14
|
|
13
|
+
[2m Duration [22m 16.18s[2m (transform 1.91s, setup 0ms, collect 29.68s, tests 1.30s, environment 2ms, prepare 5.72s)[22m
|
|
14
14
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/server-implementer@1.
|
|
2
|
+
> @auto-engineer/server-implementer@1.148.0 type-check /home/runner/work/auto-engineer/auto-engineer/packages/server-implementer
|
|
3
3
|
> tsc --noEmit
|
|
4
4
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @auto-engineer/server-implementer
|
|
2
2
|
|
|
3
|
+
## 1.149.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`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
|
|
8
|
+
- **server-generator-apollo-emmett**: context-aware nonCommandField instructions
|
|
9
|
+
- **server-generator-apollo-emmett**: add state context instruction
|
|
10
|
+
- **server-generator-apollo-emmett**: extract shared template helpers
|
|
11
|
+
- **server-generator-apollo-emmett**: filter state refs from hasGivenEvents in decide.ts.ejs
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`d38c81e`](https://github.com/BeOnAuto/auto-engineer/commit/d38c81e7bb442a39626564cf4f6d8d55b60d0a38) Thanks [@SamHatoum](https://github.com/SamHatoum)! -
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`d38c81e`](https://github.com/BeOnAuto/auto-engineer/commit/d38c81e7bb442a39626564cf4f6d8d55b60d0a38), [`e1eebbd`](https://github.com/BeOnAuto/auto-engineer/commit/e1eebbdf4f209780e790094d2e6887c4fa809f98)]:
|
|
18
|
+
- @auto-engineer/message-bus@1.149.0
|
|
19
|
+
- @auto-engineer/model-factory@1.149.0
|
|
20
|
+
|
|
3
21
|
## 1.148.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@ AI-powered code implementation that completes TODO-marked TypeScript files in ev
|
|
|
6
6
|
|
|
7
7
|
## Purpose
|
|
8
8
|
|
|
9
|
-
Without `@auto-engineer/server-implementer`, you would have to manually implement scaffolded TypeScript code, run tests, interpret errors, and iterate on fixes by hand.
|
|
9
|
+
Without `@auto-engineer/server-implementer`, you would have to manually implement scaffolded TypeScript code in CQRS/event-sourced servers, run tests, interpret errors, and iterate on fixes by hand.
|
|
10
10
|
|
|
11
|
-
This package automates
|
|
11
|
+
This package automates that loop. It scans a server project for files containing TODO markers or `IMPLEMENTATION INSTRUCTIONS`, generates implementations using an LLM, validates the output with TypeScript type-checking and Vitest, and retries with error feedback until tests pass -- up to 5 attempts per file.
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -18,9 +18,9 @@ This package automates the implementation of scaffolded CQRS/event-sourced serve
|
|
|
18
18
|
pnpm add @auto-engineer/server-implementer
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
---
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
## Quick Start
|
|
24
24
|
|
|
25
25
|
### 1. Register the handlers
|
|
26
26
|
|
|
@@ -32,7 +32,7 @@ const bus = createMessageBus();
|
|
|
32
32
|
COMMANDS.forEach(cmd => bus.registerCommand(cmd));
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
### 2.
|
|
35
|
+
### 2. Implement an entire server
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
38
|
const result = await bus.dispatch({
|
|
@@ -43,11 +43,28 @@ const result = await bus.dispatch({
|
|
|
43
43
|
requestId: 'req-123',
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
if (result.type === 'ServerImplemented') {
|
|
47
|
+
console.log('Done:', result.data.scenesImplemented, 'scenes processed');
|
|
48
|
+
}
|
|
48
49
|
```
|
|
49
50
|
|
|
50
|
-
The command
|
|
51
|
+
The command walks all scene directories under `src/domain/narratives/` and implements every slice it finds.
|
|
52
|
+
|
|
53
|
+
### 3. Implement a single slice
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const result = await bus.dispatch({
|
|
57
|
+
type: 'ImplementMoment',
|
|
58
|
+
data: {
|
|
59
|
+
momentPath: './server/src/domain/narratives/order/place-order',
|
|
60
|
+
},
|
|
61
|
+
requestId: 'req-456',
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (result.type === 'MomentImplemented') {
|
|
65
|
+
console.log('Files implemented:', result.data.filesImplemented);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
51
68
|
|
|
52
69
|
---
|
|
53
70
|
|
|
@@ -57,58 +74,74 @@ The command processes all flows in `src/domain/narratives/` and implements TODO-
|
|
|
57
74
|
|
|
58
75
|
```bash
|
|
59
76
|
auto implement:server --server-directory=./server
|
|
60
|
-
auto implement:slice --
|
|
77
|
+
auto implement:slice --moment-path=./server/src/domain/narratives/order/place-order
|
|
61
78
|
```
|
|
62
79
|
|
|
63
|
-
### Run
|
|
80
|
+
### Run programmatically (without the bus)
|
|
64
81
|
|
|
65
82
|
```typescript
|
|
66
|
-
import {
|
|
83
|
+
import { handleImplementMomentCommand } from '@auto-engineer/server-implementer';
|
|
67
84
|
|
|
68
|
-
const result = await
|
|
69
|
-
type: '
|
|
85
|
+
const result = await handleImplementMomentCommand({
|
|
86
|
+
type: 'ImplementMoment',
|
|
70
87
|
data: {
|
|
71
|
-
|
|
88
|
+
momentPath: './server/src/domain/narratives/order/place-order',
|
|
72
89
|
aiOptions: { maxTokens: 4000 },
|
|
73
90
|
},
|
|
74
|
-
requestId: 'req-
|
|
91
|
+
requestId: 'req-789',
|
|
75
92
|
});
|
|
76
93
|
```
|
|
77
94
|
|
|
78
|
-
### Retry with
|
|
95
|
+
### Retry with previous errors
|
|
96
|
+
|
|
97
|
+
When an implementation attempt fails, pass the error output back as context so the next attempt can learn from it:
|
|
79
98
|
|
|
80
99
|
```typescript
|
|
81
|
-
const retryResult = await
|
|
82
|
-
type: '
|
|
100
|
+
const retryResult = await handleImplementMomentCommand({
|
|
101
|
+
type: 'ImplementMoment',
|
|
83
102
|
data: {
|
|
84
|
-
|
|
103
|
+
momentPath: './server/src/domain/narratives/order/place-order',
|
|
85
104
|
context: {
|
|
86
105
|
previousOutputs: 'TypeError: Property "status" is missing...',
|
|
87
106
|
attemptNumber: 2,
|
|
88
107
|
},
|
|
89
108
|
},
|
|
90
|
-
requestId: 'req-
|
|
109
|
+
requestId: 'req-790',
|
|
91
110
|
});
|
|
92
111
|
```
|
|
93
112
|
|
|
94
|
-
### Handle
|
|
113
|
+
### Handle errors
|
|
95
114
|
|
|
96
115
|
```typescript
|
|
97
116
|
if (result.type === 'ServerImplementationFailed') {
|
|
98
117
|
console.error(result.data.error);
|
|
99
118
|
}
|
|
100
119
|
|
|
101
|
-
if (result.type === '
|
|
120
|
+
if (result.type === 'MomentImplementationFailed') {
|
|
102
121
|
console.error(result.data.error);
|
|
103
122
|
}
|
|
104
123
|
```
|
|
105
124
|
|
|
106
|
-
### Enable
|
|
125
|
+
### Enable debug logging
|
|
107
126
|
|
|
108
127
|
```bash
|
|
109
128
|
DEBUG=auto:server-implementer:* auto implement:server --server-directory=./server
|
|
110
129
|
```
|
|
111
130
|
|
|
131
|
+
Namespaces available:
|
|
132
|
+
|
|
133
|
+
| Namespace | What it logs |
|
|
134
|
+
|-----------|-------------|
|
|
135
|
+
| `auto:server-implementer:command` | Top-level command lifecycle |
|
|
136
|
+
| `auto:server-implementer:command:handler` | Path resolution and validation |
|
|
137
|
+
| `auto:server-implementer:command:process` | Scene runner progress |
|
|
138
|
+
| `auto:server-implementer:command:result` | Final outcome |
|
|
139
|
+
| `auto:server-implementer:slice` | Single-slice command lifecycle |
|
|
140
|
+
| `auto:server-implementer:slice:handler` | Slice path resolution |
|
|
141
|
+
| `auto:server-implementer:slice:process` | Per-file AI generation and retries |
|
|
142
|
+
| `auto:server-implementer:slice:result` | Slice outcome |
|
|
143
|
+
| `auto:server-implementer:scenes` | Scene directory discovery |
|
|
144
|
+
|
|
112
145
|
---
|
|
113
146
|
|
|
114
147
|
## API Reference
|
|
@@ -119,17 +152,19 @@ DEBUG=auto:server-implementer:* auto implement:server --server-directory=./serve
|
|
|
119
152
|
import {
|
|
120
153
|
COMMANDS,
|
|
121
154
|
implementServerHandler,
|
|
122
|
-
|
|
123
|
-
|
|
155
|
+
implementMomentHandler,
|
|
156
|
+
handleImplementMomentCommand,
|
|
124
157
|
} from '@auto-engineer/server-implementer';
|
|
125
158
|
|
|
126
159
|
import type {
|
|
127
160
|
ImplementServerCommand,
|
|
161
|
+
ImplementServerEvents,
|
|
128
162
|
ServerImplementedEvent,
|
|
129
163
|
ServerImplementationFailedEvent,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
164
|
+
ImplementMomentCommand,
|
|
165
|
+
ImplementMomentEvents,
|
|
166
|
+
MomentImplementedEvent,
|
|
167
|
+
MomentImplementationFailedEvent,
|
|
133
168
|
} from '@auto-engineer/server-implementer';
|
|
134
169
|
```
|
|
135
170
|
|
|
@@ -137,8 +172,8 @@ import type {
|
|
|
137
172
|
|
|
138
173
|
| Command | CLI Alias | Description |
|
|
139
174
|
|---------|-----------|-------------|
|
|
140
|
-
| `ImplementServer` | `implement:server` | Implement all
|
|
141
|
-
| `
|
|
175
|
+
| `ImplementServer` | `implement:server` | Implement all scenes and slices in a server project |
|
|
176
|
+
| `ImplementMoment` | `implement:slice` | Implement a single slice directory |
|
|
142
177
|
|
|
143
178
|
### ImplementServerCommand
|
|
144
179
|
|
|
@@ -151,13 +186,18 @@ type ImplementServerCommand = Command<
|
|
|
151
186
|
>;
|
|
152
187
|
```
|
|
153
188
|
|
|
154
|
-
|
|
189
|
+
**Events:**
|
|
190
|
+
|
|
191
|
+
- `ServerImplemented` -- `{ serverDirectory: string; scenesImplemented: number }`
|
|
192
|
+
- `ServerImplementationFailed` -- `{ serverDirectory: string; error: string }`
|
|
193
|
+
|
|
194
|
+
### ImplementMomentCommand
|
|
155
195
|
|
|
156
196
|
```typescript
|
|
157
|
-
type
|
|
158
|
-
'
|
|
197
|
+
type ImplementMomentCommand = Command<
|
|
198
|
+
'ImplementMoment',
|
|
159
199
|
{
|
|
160
|
-
|
|
200
|
+
momentPath: string;
|
|
161
201
|
context?: {
|
|
162
202
|
previousOutputs?: string;
|
|
163
203
|
attemptNumber?: number;
|
|
@@ -169,17 +209,10 @@ type ImplementSliceCommand = Command<
|
|
|
169
209
|
>;
|
|
170
210
|
```
|
|
171
211
|
|
|
172
|
-
|
|
212
|
+
**Events:**
|
|
173
213
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
'SliceImplemented',
|
|
177
|
-
{
|
|
178
|
-
slicePath: string;
|
|
179
|
-
filesImplemented: string[];
|
|
180
|
-
}
|
|
181
|
-
>;
|
|
182
|
-
```
|
|
214
|
+
- `MomentImplemented` -- `{ momentPath: string; filesImplemented: string[] }`
|
|
215
|
+
- `MomentImplementationFailed` -- `{ momentPath: string; error: string }`
|
|
183
216
|
|
|
184
217
|
---
|
|
185
218
|
|
|
@@ -187,52 +220,74 @@ type SliceImplementedEvent = Event<
|
|
|
187
220
|
|
|
188
221
|
```
|
|
189
222
|
src/
|
|
190
|
-
├── index.ts
|
|
223
|
+
├── index.ts # COMMANDS array, re-exports
|
|
191
224
|
├── commands/
|
|
192
|
-
│ ├── implement-server.ts
|
|
193
|
-
│ └── implement-slice.ts
|
|
225
|
+
│ ├── implement-server.ts # ImplementServer command handler
|
|
226
|
+
│ └── implement-slice.ts # ImplementMoment command handler
|
|
194
227
|
├── agent/
|
|
195
|
-
│ ├── runFlows.ts
|
|
196
|
-
│ ├── runAllSlices.ts
|
|
197
|
-
│ ├── runSlice.ts
|
|
198
|
-
│ └── runTests.ts
|
|
228
|
+
│ ├── runFlows.ts # Discovers and iterates scene directories
|
|
229
|
+
│ ├── runAllSlices.ts # Iterates moment directories within a scene
|
|
230
|
+
│ ├── runSlice.ts # Per-slice: AI generate, test, typecheck, retry
|
|
231
|
+
│ └── runTests.ts # Vitest runner with JSON report parsing
|
|
199
232
|
├── prompts/
|
|
200
|
-
│ └── systemPrompt.ts
|
|
233
|
+
│ └── systemPrompt.ts # System prompt for AI code generation
|
|
201
234
|
└── utils/
|
|
202
|
-
|
|
235
|
+
├── buildContextSections.ts # Formats context files into prompt sections
|
|
236
|
+
├── detectImportedTypeShadowing.ts # Detects re-declared imported types
|
|
237
|
+
├── detectTypeAssertions.ts # Detects forbidden `as` casts
|
|
238
|
+
├── extractCodeBlock.ts # Strips markdown fences from AI output
|
|
239
|
+
├── findFilesToImplement.ts # Filters + priority-sorts TODO-marked files
|
|
240
|
+
├── loadContextFiles.ts # Loads all .ts files in a slice directory
|
|
241
|
+
└── loadSharedContext.ts # Loads shared domain types from ../../../shared
|
|
203
242
|
```
|
|
204
243
|
|
|
205
|
-
|
|
244
|
+
### Implementation flow
|
|
206
245
|
|
|
207
246
|
```mermaid
|
|
208
247
|
flowchart TB
|
|
209
|
-
A[
|
|
210
|
-
B --> C[
|
|
211
|
-
C --> D[
|
|
212
|
-
D --> E[
|
|
213
|
-
E --> F[
|
|
214
|
-
F --> G
|
|
215
|
-
G
|
|
216
|
-
|
|
217
|
-
I -->|Yes| J[
|
|
218
|
-
|
|
219
|
-
|
|
248
|
+
A[ImplementServer command] --> B[Discover scenes in src/domain/narratives/]
|
|
249
|
+
B --> C[For each scene: discover slices]
|
|
250
|
+
C --> D[For each slice: load context files]
|
|
251
|
+
D --> E[Find files with TODO markers]
|
|
252
|
+
E --> F[Generate implementation via AI]
|
|
253
|
+
F --> G[Write generated code to disk]
|
|
254
|
+
G --> H[Run Vitest + tsc --noEmit]
|
|
255
|
+
H --> I{Pass?}
|
|
256
|
+
I -->|Yes| J[Done]
|
|
257
|
+
I -->|No| K{Retries left?}
|
|
258
|
+
K -->|Yes| L[Build retry prompt with errors]
|
|
259
|
+
L --> F
|
|
260
|
+
K -->|No| M[Report remaining failures]
|
|
220
261
|
```
|
|
221
262
|
|
|
222
|
-
|
|
263
|
+
### Validation checks
|
|
264
|
+
|
|
265
|
+
Each implementation pass runs three checks before accepting the output:
|
|
266
|
+
|
|
267
|
+
1. **Vitest** -- runs spec files in the slice, parses JSON report for failures
|
|
268
|
+
2. **TypeScript** -- `tsc --noEmit` filtered to errors in the slice directory
|
|
269
|
+
3. **Static analysis** -- detects imported-type shadowing and forbidden `as` type assertions
|
|
270
|
+
|
|
271
|
+
Files that fail typecheck are retried up to 5 times. Files that fail tests are retried separately, also up to 5 times. If a test fix introduces a type error, a nested typecheck retry loop runs (max depth 2).
|
|
272
|
+
|
|
273
|
+
### Implementation priority
|
|
274
|
+
|
|
275
|
+
When multiple files need implementation, they are processed in this order: `state.ts`, `events.ts`, `commands.ts`, `evolve.ts`, `decide.ts`, then alphabetically.
|
|
276
|
+
|
|
277
|
+
### Implementation markers
|
|
223
278
|
|
|
224
|
-
|
|
279
|
+
Files are identified for AI implementation by the presence of any of:
|
|
225
280
|
|
|
226
|
-
Files are identified for processing by:
|
|
227
281
|
- `// @auto-implement` comment
|
|
228
|
-
- `TODO:`
|
|
282
|
+
- `TODO:` comment
|
|
229
283
|
- `IMPLEMENTATION INSTRUCTIONS` text
|
|
230
284
|
|
|
231
285
|
### Dependencies
|
|
232
286
|
|
|
233
287
|
| Package | Usage |
|
|
234
288
|
|---------|-------|
|
|
235
|
-
| `@auto-engineer/
|
|
236
|
-
| `@auto-engineer/message-bus` | Command/event infrastructure |
|
|
237
|
-
| `
|
|
238
|
-
| `
|
|
289
|
+
| `@auto-engineer/model-factory` | Creates the AI model instance from environment config |
|
|
290
|
+
| `@auto-engineer/message-bus` | Command/event handler infrastructure |
|
|
291
|
+
| `ai` (Vercel AI SDK) | `generateText` for LLM calls |
|
|
292
|
+
| `fast-glob` | File and directory discovery |
|
|
293
|
+
| `debug` | Namespaced debug logging |
|
package/package.json
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"debug": "^4.3.4",
|
|
19
19
|
"fast-glob": "^3.3.3",
|
|
20
20
|
"vite": "^5.4.1",
|
|
21
|
-
"@auto-engineer/
|
|
22
|
-
"@auto-engineer/
|
|
21
|
+
"@auto-engineer/model-factory": "1.149.0",
|
|
22
|
+
"@auto-engineer/message-bus": "1.149.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"glob": "^11.0.3",
|
|
30
30
|
"tsx": "^4.20.3",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
|
-
"@auto-engineer/cli": "1.
|
|
32
|
+
"@auto-engineer/cli": "1.149.0"
|
|
33
33
|
},
|
|
34
|
-
"version": "1.
|
|
34
|
+
"version": "1.149.0",
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsc && tsx ../../scripts/fix-esm-imports.ts",
|
|
37
37
|
"test": "vitest run --reporter=dot",
|