create-auto-app 1.104.0 → 1.106.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.104.0",
3
+ "version": "1.106.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.104.0"
36
+ "@auto-engineer/id": "1.106.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";
@@ -123,14 +127,70 @@ export const pipeline = define("typical-example")
123
127
  .accepts([])
124
128
 
125
129
  .on("ComponentImplemented")
126
- .emit("RebuildComponentDB", () => ({
127
- baseDir: resolvePath("./client"),
128
- }))
130
+ .handle((e: ComponentImplementedEvent) => {
131
+ componentJobCache.set(
132
+ extractComponentKey(e.data.targetDir),
133
+ { targetDir: e.data.targetDir, job: e.data.job },
134
+ );
135
+ }, { emits: ["CheckTests", "CheckTypes", "CheckLint"] })
129
136
 
130
- .on("ComponentImplementationFailed")
131
- .emit("RebuildComponentDB", () => ({
132
- baseDir: resolvePath("./client"),
137
+ .on("ComponentImplemented")
138
+ .emit("CheckTests", (e: ComponentImplementedEvent) => ({
139
+ targetDirectory: e.data.targetDir,
140
+ scope: "component",
133
141
  }))
142
+ .emit("CheckTypes", (e: ComponentImplementedEvent) => ({
143
+ targetDirectory: e.data.targetDir,
144
+ scope: "component",
145
+ }))
146
+ .emit("CheckLint", (e: ComponentImplementedEvent) => ({
147
+ targetDirectory: e.data.targetDir,
148
+ scope: "component",
149
+ fix: true,
150
+ }))
151
+
152
+ .settled(["CheckTests", "CheckTypes", "CheckLint"])
153
+ .dispatch({ dispatches: ["ImplementComponent"] }, (events, send) => {
154
+ const allEvents = gatherAllCheckEvents(events);
155
+ const targetDir = extractTargetDirectory(events);
156
+ const key = extractComponentKey(targetDir);
157
+ const cached = componentJobCache.get(key);
158
+
159
+ if (!hasAnyFailures(allEvents)) {
160
+ componentRetryState.delete(key);
161
+ componentJobCache.delete(key);
162
+ return;
163
+ }
164
+
165
+ if (!cached) {
166
+ return;
167
+ }
168
+
169
+ const attempts = componentRetryState.get(key) ?? 0;
170
+ if (attempts >= MAX_RETRIES) {
171
+ const errors = collectErrors(allEvents);
172
+ console.error(
173
+ `Component implementation failed after ${MAX_RETRIES} retries: ${key}`,
174
+ );
175
+ if (errors) {
176
+ console.error(` Last errors:\n${errors}`);
177
+ }
178
+ componentRetryState.delete(key);
179
+ componentJobCache.delete(key);
180
+ return;
181
+ }
182
+
183
+ componentRetryState.set(key, attempts + 1);
184
+ send("ImplementComponent", {
185
+ targetDir: cached.targetDir,
186
+ job: cached.job,
187
+ context: {
188
+ previousOutputs: collectErrors(allEvents),
189
+ attemptNumber: attempts + 1,
190
+ },
191
+ });
192
+ return { persist: true };
193
+ })
134
194
 
135
195
  .on("GraphProcessed")
136
196
  .emit("ImplementClient", () => ({
@@ -162,6 +222,9 @@ export const pipeline = define("typical-example")
162
222
  data: {
163
223
  error: e.data.error,
164
224
  model: e.data.model,
225
+ flowName: e.data.flowName,
226
+ sliceName: e.data.sliceName,
227
+ sliceType: e.data.sliceType,
165
228
  },
166
229
  },
167
230
  }))
@@ -204,6 +267,8 @@ export const pipeline = define("typical-example")
204
267
 
205
268
  export function resetState(): void {
206
269
  sliceRetryState.clear();
270
+ componentRetryState.clear();
271
+ componentJobCache.clear();
207
272
  reportedSliceErrors.clear();
208
273
  projectRoot = "";
209
274
  }
@@ -267,9 +332,25 @@ function incrementRetryCount(slicePath: string): number {
267
332
 
268
333
  const MAX_RETRIES = 4;
269
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
+ >();
270
340
  const reportedSliceErrors = new Set<string>();
271
341
  let projectRoot = "";
272
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
+
273
354
  function resolvePath(relativePath: string): string {
274
355
  if (projectRoot === "") {
275
356
  return relativePath;