create-auto-app 1.110.2 → 1.110.4

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.110.2",
3
+ "version": "1.110.4",
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.110.2"
36
+ "@auto-engineer/id": "1.110.4"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/fs-extra": "^11.0.4",
@@ -1,7 +1,3 @@
1
- import type {
2
- ComponentImplementedEvent,
3
- ComponentJob,
4
- } from "@auto-engineer/component-implementor-react";
5
1
  import type { Event } from "@auto-engineer/message-bus";
6
2
  import type { ConcurrencyConfig } from "@auto-engineer/pipeline";
7
3
  import { define } from "@auto-engineer/pipeline";
@@ -118,115 +114,17 @@ export const pipeline = define("typical-example")
118
114
  })
119
115
 
120
116
  .declare("ProcessJobGraph")
121
- .accepts(["ImplementComponent"])
117
+ .accepts(["ImplementComponent", "ImplementClient"])
122
118
 
123
119
  .on("ComponentImplemented")
124
- .handle(
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, {
139
- targetDir: e.data.targetDir,
140
- job: e.data.job,
141
- componentPath: e.data.componentPath,
142
- testPath: e.data.testPath,
143
- storyPath: e.data.storyPath,
144
- graphCorrelationId,
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
- );
171
- },
172
- { emits: ["CheckTests", "CheckTypes", "CheckLint"] },
173
- )
174
- .settled(["CheckTests", "CheckTypes", "CheckLint"], "Component Checks Settle")
175
- .maxRetries(0)
176
- .dispatch({ dispatches: ["ImplementComponent"] }, (events, send, emit) => {
177
- const allEvents = gatherAllCheckEvents(events);
178
- const checkCorrelationId = extractCorrelationId(events);
179
- const cached = componentJobCache.get(checkCorrelationId);
180
- const graphCorrelationId = cached?.graphCorrelationId ?? checkCorrelationId;
181
-
182
- if (!hasAnyFailures(allEvents)) {
183
- componentRetryState.delete(checkCorrelationId);
184
- componentJobCache.delete(checkCorrelationId);
185
- emit(
186
- "ComponentChecksPassed",
187
- { correlationId: graphCorrelationId },
188
- graphCorrelationId,
189
- );
190
- return;
191
- }
192
-
193
- if (!cached) {
194
- return;
195
- }
196
-
197
- const attempts = componentRetryState.get(checkCorrelationId) ?? 0;
198
- if (attempts >= MAX_RETRIES) {
199
- const errors = collectErrors(allEvents);
200
- console.error(
201
- `Component implementation failed after ${MAX_RETRIES} retries: ${checkCorrelationId}`,
202
- );
203
- if (errors) {
204
- console.error(` Last errors:\n${errors}`);
205
- }
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
- );
216
- return;
217
- }
120
+ .emit("RebuildComponentDB", () => ({
121
+ baseDir: resolvePath("./client"),
122
+ }))
218
123
 
219
- componentRetryState.set(checkCorrelationId, attempts + 1);
220
- send("ImplementComponent", {
221
- targetDir: cached.targetDir,
222
- job: cached.job,
223
- context: {
224
- previousOutputs: collectErrors(allEvents),
225
- attemptNumber: attempts + 1,
226
- },
227
- });
228
- return { persist: true };
229
- })
124
+ .on("ComponentImplementationFailed")
125
+ .emit("RebuildComponentDB", () => ({
126
+ baseDir: resolvePath("./client"),
127
+ }))
230
128
 
231
129
  .on("GraphProcessed")
232
130
  .emit("ImplementClient", () => ({
@@ -240,17 +138,6 @@ export const pipeline = define("typical-example")
240
138
  modelPath: resolvePath("./.context/schema.json"),
241
139
  }))
242
140
 
243
- .on("ClientImplemented")
244
- .emit("CheckTypes", () => ({
245
- targetDirectory: resolvePath("./client"),
246
- scope: "project",
247
- }))
248
- .emit("CheckLint", () => ({
249
- targetDirectory: resolvePath("./client"),
250
- scope: "project",
251
- fix: true,
252
- }))
253
-
254
141
  .on("ServerGenerationFailed")
255
142
  .emit("SubmitBugReport", (e: ServerGenerationFailedEvent) => ({
256
143
  payload: {
@@ -300,9 +187,6 @@ export const pipeline = define("typical-example")
300
187
 
301
188
  export function resetState(): void {
302
189
  sliceRetryState.clear();
303
- componentRetryState.clear();
304
- componentJobCache.clear();
305
- componentGraphCorrelations.clear();
306
190
  reportedSliceErrors.clear();
307
191
  projectRoot = "";
308
192
  }
@@ -366,30 +250,9 @@ function incrementRetryCount(slicePath: string): number {
366
250
 
367
251
  const MAX_RETRIES = 4;
368
252
  const sliceRetryState = new Map<string, number>();
369
- const componentRetryState = new Map<string, number>();
370
- const componentJobCache = new Map<
371
- string,
372
- {
373
- targetDir: string;
374
- job: ComponentJob;
375
- componentPath: string;
376
- testPath: string;
377
- storyPath: string;
378
- graphCorrelationId: string;
379
- }
380
- >();
381
- const componentGraphCorrelations = new Map<string, string>();
382
253
  const reportedSliceErrors = new Set<string>();
383
254
  let projectRoot = "";
384
255
 
385
- function extractCorrelationId(events: Record<string, Event[]>): string {
386
- const firstEvent =
387
- events.CheckTests?.[0] ?? events.CheckTypes?.[0] ?? events.CheckLint?.[0];
388
- return (
389
- (firstEvent as Event & { correlationId?: string })?.correlationId ?? ""
390
- );
391
- }
392
-
393
256
  function resolvePath(relativePath: string): string {
394
257
  if (projectRoot === "") {
395
258
  return relativePath;