create-auto-app 1.105.0 → 1.107.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 +2 -2
- package/templates/typical/auto.config.ts +88 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-auto-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.107.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.107.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ComponentImplementedEvent,
|
|
3
|
+
ComponentJob,
|
|
4
|
+
} from "@auto-engineer/component-implementor-react";
|
|
1
5
|
import type { Event } from "@auto-engineer/message-bus";
|
|
2
6
|
import type { ConcurrencyConfig } from "@auto-engineer/pipeline";
|
|
3
7
|
import { define } from "@auto-engineer/pipeline";
|
|
@@ -78,7 +82,7 @@ export const pipeline = define("typical-example")
|
|
|
78
82
|
fix: true,
|
|
79
83
|
}))
|
|
80
84
|
|
|
81
|
-
.settled(["CheckTests", "CheckTypes", "CheckLint"])
|
|
85
|
+
.settled(["CheckTests", "CheckTypes", "CheckLint"], "Slice Checks Settle")
|
|
82
86
|
.dispatch({ dispatches: ["ImplementSlice"] }, (events, send) => {
|
|
83
87
|
const allEvents = gatherAllCheckEvents(events);
|
|
84
88
|
|
|
@@ -123,14 +127,73 @@ export const pipeline = define("typical-example")
|
|
|
123
127
|
.accepts([])
|
|
124
128
|
|
|
125
129
|
.on("ComponentImplemented")
|
|
126
|
-
.
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
.handle(
|
|
131
|
+
(e: ComponentImplementedEvent) => {
|
|
132
|
+
componentJobCache.set(extractComponentKey(e.data.targetDir), {
|
|
133
|
+
targetDir: e.data.targetDir,
|
|
134
|
+
job: e.data.job,
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
{ emits: ["CheckTests", "CheckTypes", "CheckLint"] },
|
|
138
|
+
)
|
|
129
139
|
|
|
130
|
-
.on("
|
|
131
|
-
.emit("
|
|
132
|
-
|
|
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",
|
|
133
148
|
}))
|
|
149
|
+
.emit("CheckLint", (e: ComponentImplementedEvent) => ({
|
|
150
|
+
targetDirectory: e.data.targetDir,
|
|
151
|
+
scope: "component",
|
|
152
|
+
fix: true,
|
|
153
|
+
}))
|
|
154
|
+
|
|
155
|
+
.settled(["CheckTests", "CheckTypes", "CheckLint"], "Component Checks Settle")
|
|
156
|
+
.dispatch({ dispatches: ["ImplementComponent"] }, (events, send) => {
|
|
157
|
+
const allEvents = gatherAllCheckEvents(events);
|
|
158
|
+
const targetDir = extractTargetDirectory(events);
|
|
159
|
+
const key = extractComponentKey(targetDir);
|
|
160
|
+
const cached = componentJobCache.get(key);
|
|
161
|
+
|
|
162
|
+
if (!hasAnyFailures(allEvents)) {
|
|
163
|
+
componentRetryState.delete(key);
|
|
164
|
+
componentJobCache.delete(key);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!cached) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const attempts = componentRetryState.get(key) ?? 0;
|
|
173
|
+
if (attempts >= MAX_RETRIES) {
|
|
174
|
+
const errors = collectErrors(allEvents);
|
|
175
|
+
console.error(
|
|
176
|
+
`Component implementation failed after ${MAX_RETRIES} retries: ${key}`,
|
|
177
|
+
);
|
|
178
|
+
if (errors) {
|
|
179
|
+
console.error(` Last errors:\n${errors}`);
|
|
180
|
+
}
|
|
181
|
+
componentRetryState.delete(key);
|
|
182
|
+
componentJobCache.delete(key);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
componentRetryState.set(key, attempts + 1);
|
|
187
|
+
send("ImplementComponent", {
|
|
188
|
+
targetDir: cached.targetDir,
|
|
189
|
+
job: cached.job,
|
|
190
|
+
context: {
|
|
191
|
+
previousOutputs: collectErrors(allEvents),
|
|
192
|
+
attemptNumber: attempts + 1,
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
return { persist: true };
|
|
196
|
+
})
|
|
134
197
|
|
|
135
198
|
.on("GraphProcessed")
|
|
136
199
|
.emit("ImplementClient", () => ({
|
|
@@ -202,11 +265,10 @@ export const pipeline = define("typical-example")
|
|
|
202
265
|
|
|
203
266
|
.build();
|
|
204
267
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
268
|
export function resetState(): void {
|
|
209
269
|
sliceRetryState.clear();
|
|
270
|
+
componentRetryState.clear();
|
|
271
|
+
componentJobCache.clear();
|
|
210
272
|
reportedSliceErrors.clear();
|
|
211
273
|
projectRoot = "";
|
|
212
274
|
}
|
|
@@ -270,9 +332,25 @@ function incrementRetryCount(slicePath: string): number {
|
|
|
270
332
|
|
|
271
333
|
const MAX_RETRIES = 4;
|
|
272
334
|
const sliceRetryState = new Map<string, number>();
|
|
335
|
+
const componentRetryState = new Map<string, number>();
|
|
336
|
+
const componentJobCache = new Map<
|
|
337
|
+
string,
|
|
338
|
+
{ targetDir: string; job: ComponentJob }
|
|
339
|
+
>();
|
|
273
340
|
const reportedSliceErrors = new Set<string>();
|
|
274
341
|
let projectRoot = "";
|
|
275
342
|
|
|
343
|
+
function extractComponentKey(targetDir: string): string {
|
|
344
|
+
return targetDir;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function extractTargetDirectory(events: Record<string, Event[]>): string {
|
|
348
|
+
const firstEvent =
|
|
349
|
+
events.CheckTests?.[0] ?? events.CheckTypes?.[0] ?? events.CheckLint?.[0];
|
|
350
|
+
const data = firstEvent?.data as AllCheckFailedEvents["data"] | undefined;
|
|
351
|
+
return data?.targetDirectory ?? "";
|
|
352
|
+
}
|
|
353
|
+
|
|
276
354
|
function resolvePath(relativePath: string): string {
|
|
277
355
|
if (projectRoot === "") {
|
|
278
356
|
return relativePath;
|