From b057276235d744465057e73cb61ed2c412d9ac06 Mon Sep 17 00:00:00 2001 From: Axiom Bot <0xAxiom@users.noreply.github.com> Date: Thu, 30 Apr 2026 21:06:21 -0700 Subject: [PATCH] fix(dapp-factory): remove illegal await in constructor and fix exit code - Replace dynamic `await import('crypto')` in Web3Pipeline constructor with a static top-level import; constructors cannot be async so the dynamic import was a guaranteed runtime crash. - Fix `main().catch(console.error)` in web3factory.ts to call `process.exit(1)` on rejection so CI and callers receive a non-zero exit code on failure. Co-Authored-By: Claude Sonnet 4.6 --- dapp-factory/pipeline/web3_pipeline.ts | 2 +- dapp-factory/web3factory.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dapp-factory/pipeline/web3_pipeline.ts b/dapp-factory/pipeline/web3_pipeline.ts index 2d730f87..fb0064a8 100644 --- a/dapp-factory/pipeline/web3_pipeline.ts +++ b/dapp-factory/pipeline/web3_pipeline.ts @@ -1,3 +1,4 @@ +import * as crypto from 'crypto'; import * as fs from 'fs'; import * as path from 'path'; import { PromptEnforcer, executeStageWithPrompt } from './prompt_enforcer'; @@ -27,7 +28,6 @@ export class Web3Pipeline { // Generate run ID if not provided const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); - const crypto = await import('crypto'); const ideaHash = crypto .createHash('md5') .update(config.idea) diff --git a/dapp-factory/web3factory.ts b/dapp-factory/web3factory.ts index fd359c4b..d1d27f8f 100644 --- a/dapp-factory/web3factory.ts +++ b/dapp-factory/web3factory.ts @@ -85,4 +85,7 @@ process.on('uncaughtException', (error) => { process.exit(1); }); -main().catch(console.error); +main().catch((err) => { + console.error(err); + process.exit(1); +});