create-auto-app 1.108.0 → 1.110.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-auto-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.110.0",
|
|
4
4
|
"description": "Create Auto Engineer apps with no configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"fs-extra": "^11.2.0",
|
|
34
34
|
"inquirer": "^9.2.15",
|
|
35
35
|
"ora": "^8.0.1",
|
|
36
|
-
"@auto-engineer/id": "1.
|
|
36
|
+
"@auto-engineer/id": "1.110.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -5,14 +5,14 @@ import type {
|
|
|
5
5
|
import type { Event } from "@auto-engineer/message-bus";
|
|
6
6
|
import type { ConcurrencyConfig } from "@auto-engineer/pipeline";
|
|
7
7
|
import { define } from "@auto-engineer/pipeline";
|
|
8
|
-
import type { AllCheckFailedEvents } from "@auto-engineer/
|
|
8
|
+
import type { AllCheckFailedEvents } from "@auto-engineer/checks";
|
|
9
9
|
import type { ServerGenerationFailedEvent } from "@auto-engineer/server-generator-apollo-emmett";
|
|
10
10
|
import type { SliceImplementedEvent } from "@auto-engineer/server-implementer";
|
|
11
11
|
|
|
12
12
|
export const fileId = "typical-example-1";
|
|
13
13
|
|
|
14
14
|
export const plugins = [
|
|
15
|
-
"@auto-engineer/
|
|
15
|
+
"@auto-engineer/checks",
|
|
16
16
|
"@auto-engineer/server-generator-apollo-emmett",
|
|
17
17
|
"@auto-engineer/generate-react-client",
|
|
18
18
|
"@auto-engineer/server-implementer",
|
|
@@ -120,48 +120,73 @@ export const pipeline = define("typical-example")
|
|
|
120
120
|
.declare("ProcessJobGraph")
|
|
121
121
|
.accepts(["ImplementComponent"])
|
|
122
122
|
|
|
123
|
-
.declare("SubmitBugReport")
|
|
124
|
-
.accepts([])
|
|
125
|
-
|
|
126
|
-
.declare("GenerateTheme")
|
|
127
|
-
.accepts([])
|
|
128
|
-
|
|
129
123
|
.on("ComponentImplemented")
|
|
130
124
|
.handle(
|
|
131
|
-
(e: ComponentImplementedEvent) => {
|
|
132
|
-
|
|
125
|
+
async (e: ComponentImplementedEvent & { correlationId?: string }, ctx) => {
|
|
126
|
+
const incomingCorrelationId = e.correlationId ?? e.data.componentPath;
|
|
127
|
+
const graphCorrelationId = incomingCorrelationId.startsWith("graph:")
|
|
128
|
+
? incomingCorrelationId
|
|
129
|
+
: (componentGraphCorrelations.get(e.data.componentPath) ??
|
|
130
|
+
incomingCorrelationId);
|
|
131
|
+
if (graphCorrelationId.startsWith("graph:")) {
|
|
132
|
+
componentGraphCorrelations.set(
|
|
133
|
+
e.data.componentPath,
|
|
134
|
+
graphCorrelationId,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
const checkCorrelationId = `component-checks:${e.data.componentPath}`;
|
|
138
|
+
componentJobCache.set(checkCorrelationId, {
|
|
133
139
|
targetDir: e.data.targetDir,
|
|
134
140
|
job: e.data.job,
|
|
141
|
+
componentPath: e.data.componentPath,
|
|
142
|
+
testPath: e.data.testPath,
|
|
143
|
+
storyPath: e.data.storyPath,
|
|
144
|
+
graphCorrelationId,
|
|
135
145
|
});
|
|
146
|
+
await ctx.sendCommand(
|
|
147
|
+
"CheckTests",
|
|
148
|
+
{
|
|
149
|
+
targetDirectory: e.data.targetDir,
|
|
150
|
+
testFile: e.data.testPath,
|
|
151
|
+
},
|
|
152
|
+
checkCorrelationId,
|
|
153
|
+
);
|
|
154
|
+
await ctx.sendCommand(
|
|
155
|
+
"CheckTypes",
|
|
156
|
+
{
|
|
157
|
+
targetDirectory: e.data.targetDir,
|
|
158
|
+
files: [e.data.componentPath, e.data.testPath, e.data.storyPath],
|
|
159
|
+
},
|
|
160
|
+
checkCorrelationId,
|
|
161
|
+
);
|
|
162
|
+
await ctx.sendCommand(
|
|
163
|
+
"CheckLint",
|
|
164
|
+
{
|
|
165
|
+
targetDirectory: e.data.targetDir,
|
|
166
|
+
files: [e.data.componentPath, e.data.testPath],
|
|
167
|
+
fix: true,
|
|
168
|
+
},
|
|
169
|
+
checkCorrelationId,
|
|
170
|
+
);
|
|
136
171
|
},
|
|
137
172
|
{ emits: ["CheckTests", "CheckTypes", "CheckLint"] },
|
|
138
173
|
)
|
|
139
|
-
|
|
140
|
-
.on("ComponentImplemented")
|
|
141
|
-
.emit("CheckTests", (e: ComponentImplementedEvent) => ({
|
|
142
|
-
targetDirectory: e.data.targetDir,
|
|
143
|
-
scope: "component",
|
|
144
|
-
}))
|
|
145
|
-
.emit("CheckTypes", (e: ComponentImplementedEvent) => ({
|
|
146
|
-
targetDirectory: e.data.targetDir,
|
|
147
|
-
scope: "component",
|
|
148
|
-
}))
|
|
149
|
-
.emit("CheckLint", (e: ComponentImplementedEvent) => ({
|
|
150
|
-
targetDirectory: e.data.targetDir,
|
|
151
|
-
scope: "component",
|
|
152
|
-
fix: true,
|
|
153
|
-
}))
|
|
154
|
-
|
|
155
174
|
.settled(["CheckTests", "CheckTypes", "CheckLint"], "Component Checks Settle")
|
|
156
|
-
.
|
|
175
|
+
.maxRetries(0)
|
|
176
|
+
.dispatch({ dispatches: ["ImplementComponent"] }, (events, send, emit) => {
|
|
157
177
|
const allEvents = gatherAllCheckEvents(events);
|
|
158
|
-
const
|
|
159
|
-
const
|
|
160
|
-
const
|
|
178
|
+
const checkCorrelationId = extractCorrelationId(events);
|
|
179
|
+
const cached = componentJobCache.get(checkCorrelationId);
|
|
180
|
+
const graphCorrelationId = cached?.graphCorrelationId ?? checkCorrelationId;
|
|
161
181
|
|
|
162
182
|
if (!hasAnyFailures(allEvents)) {
|
|
163
|
-
componentRetryState.delete(
|
|
164
|
-
componentJobCache.delete(
|
|
183
|
+
componentRetryState.delete(checkCorrelationId);
|
|
184
|
+
componentJobCache.delete(checkCorrelationId);
|
|
185
|
+
emit(
|
|
186
|
+
"ComponentChecksPassed",
|
|
187
|
+
{ correlationId: graphCorrelationId },
|
|
188
|
+
graphCorrelationId,
|
|
189
|
+
);
|
|
165
190
|
return;
|
|
166
191
|
}
|
|
167
192
|
|
|
@@ -169,21 +194,29 @@ export const pipeline = define("typical-example")
|
|
|
169
194
|
return;
|
|
170
195
|
}
|
|
171
196
|
|
|
172
|
-
const attempts = componentRetryState.get(
|
|
197
|
+
const attempts = componentRetryState.get(checkCorrelationId) ?? 0;
|
|
173
198
|
if (attempts >= MAX_RETRIES) {
|
|
174
199
|
const errors = collectErrors(allEvents);
|
|
175
200
|
console.error(
|
|
176
|
-
`Component implementation failed after ${MAX_RETRIES} retries: ${
|
|
201
|
+
`Component implementation failed after ${MAX_RETRIES} retries: ${checkCorrelationId}`,
|
|
177
202
|
);
|
|
178
203
|
if (errors) {
|
|
179
204
|
console.error(` Last errors:\n${errors}`);
|
|
180
205
|
}
|
|
181
|
-
componentRetryState.delete(
|
|
182
|
-
componentJobCache.delete(
|
|
206
|
+
componentRetryState.delete(checkCorrelationId);
|
|
207
|
+
componentJobCache.delete(checkCorrelationId);
|
|
208
|
+
emit(
|
|
209
|
+
"ComponentChecksFailed",
|
|
210
|
+
{
|
|
211
|
+
error: errors || "Max retries exhausted",
|
|
212
|
+
correlationId: graphCorrelationId,
|
|
213
|
+
},
|
|
214
|
+
graphCorrelationId,
|
|
215
|
+
);
|
|
183
216
|
return;
|
|
184
217
|
}
|
|
185
218
|
|
|
186
|
-
componentRetryState.set(
|
|
219
|
+
componentRetryState.set(checkCorrelationId, attempts + 1);
|
|
187
220
|
send("ImplementComponent", {
|
|
188
221
|
targetDir: cached.targetDir,
|
|
189
222
|
job: cached.job,
|
|
@@ -269,6 +302,7 @@ export function resetState(): void {
|
|
|
269
302
|
sliceRetryState.clear();
|
|
270
303
|
componentRetryState.clear();
|
|
271
304
|
componentJobCache.clear();
|
|
305
|
+
componentGraphCorrelations.clear();
|
|
272
306
|
reportedSliceErrors.clear();
|
|
273
307
|
projectRoot = "";
|
|
274
308
|
}
|
|
@@ -335,20 +369,25 @@ const sliceRetryState = new Map<string, number>();
|
|
|
335
369
|
const componentRetryState = new Map<string, number>();
|
|
336
370
|
const componentJobCache = new Map<
|
|
337
371
|
string,
|
|
338
|
-
{
|
|
372
|
+
{
|
|
373
|
+
targetDir: string;
|
|
374
|
+
job: ComponentJob;
|
|
375
|
+
componentPath: string;
|
|
376
|
+
testPath: string;
|
|
377
|
+
storyPath: string;
|
|
378
|
+
graphCorrelationId: string;
|
|
379
|
+
}
|
|
339
380
|
>();
|
|
381
|
+
const componentGraphCorrelations = new Map<string, string>();
|
|
340
382
|
const reportedSliceErrors = new Set<string>();
|
|
341
383
|
let projectRoot = "";
|
|
342
384
|
|
|
343
|
-
function
|
|
344
|
-
return targetDir;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
function extractTargetDirectory(events: Record<string, Event[]>): string {
|
|
385
|
+
function extractCorrelationId(events: Record<string, Event[]>): string {
|
|
348
386
|
const firstEvent =
|
|
349
387
|
events.CheckTests?.[0] ?? events.CheckTypes?.[0] ?? events.CheckLint?.[0];
|
|
350
|
-
|
|
351
|
-
|
|
388
|
+
return (
|
|
389
|
+
(firstEvent as Event & { correlationId?: string })?.correlationId ?? ""
|
|
390
|
+
);
|
|
352
391
|
}
|
|
353
392
|
|
|
354
393
|
function resolvePath(relativePath: string): string {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@auto-engineer/narrative": "workspace:*",
|
|
21
21
|
"@auto-engineer/pipeline": "workspace:*",
|
|
22
22
|
"@auto-engineer/file-upload": "workspace:*",
|
|
23
|
-
"@auto-engineer/
|
|
23
|
+
"@auto-engineer/checks": "workspace:*",
|
|
24
24
|
"@auto-engineer/server-generator-apollo-emmett": "workspace:*",
|
|
25
25
|
"@auto-engineer/app-implementer": "workspace:*",
|
|
26
26
|
"@auto-engineer/component-implementor-react": "workspace:*",
|
|
@@ -11,6 +11,9 @@ importers:
|
|
|
11
11
|
'@auto-engineer/app-implementer':
|
|
12
12
|
specifier: link:../../packages/app-implementer
|
|
13
13
|
version: link:../../packages/app-implementer
|
|
14
|
+
'@auto-engineer/checks':
|
|
15
|
+
specifier: link:../../packages/checks
|
|
16
|
+
version: link:../../packages/checks
|
|
14
17
|
'@auto-engineer/cli':
|
|
15
18
|
specifier: link:../../packages/cli
|
|
16
19
|
version: link:../../packages/cli
|
|
@@ -41,9 +44,6 @@ importers:
|
|
|
41
44
|
'@auto-engineer/pipeline':
|
|
42
45
|
specifier: link:../../packages/pipeline
|
|
43
46
|
version: link:../../packages/pipeline
|
|
44
|
-
'@auto-engineer/server-checks':
|
|
45
|
-
specifier: link:../../packages/server-checks
|
|
46
|
-
version: link:../../packages/server-checks
|
|
47
47
|
'@auto-engineer/server-generator-apollo-emmett':
|
|
48
48
|
specifier: link:../../packages/server-generator-apollo-emmett
|
|
49
49
|
version: link:../../packages/server-generator-apollo-emmett
|