From e5bf2ffd9d0f15daba8c8e687df2fb96f7acdb60 Mon Sep 17 00:00:00 2001 From: Cleboost <61158869+Cleboost@users.noreply.github.com> Date: Thu, 26 Mar 2026 09:13:19 +0000 Subject: [PATCH 1/2] fix: enforce config.json presence at startup and build time Updated `runBot` and `build` commands to exit with an error (`process.exit(1)`) if `config.json` is missing or invalid when `experimental.userConfig` is enabled. This ensures that the bot does not start in an inconsistent state when a required configuration file is not provided. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- packages/dev/commands/build.ts | 7 +++++-- packages/dev/utils/common.ts | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/dev/commands/build.ts b/packages/dev/commands/build.ts index 3653724..75c1989 100644 --- a/packages/dev/commands/build.ts +++ b/packages/dev/commands/build.ts @@ -247,10 +247,12 @@ ${ if (await configFile.exists()) { userConfigData = await configFile.json(); } else { - console.warn("⚠️ config.json not found at runtime"); + console.error("❌ config.json not found at runtime"); + process.exit(1); } } catch (e) { console.error("❌ Failed to load config.json:", e); + process.exit(1); } const client = new DjsClient({ djsConfig: config, userConfig: userConfigData as UserConfig });` : " const client = new DjsClient({ djsConfig: config });" @@ -430,7 +432,8 @@ export function registerBuildCommand(cli: CAC) { pc.green("✓") + ` config.json copied to ${pc.bold("dist/")}`, ); } catch (e) { - console.warn(pc.yellow("⚠️ Could not copy config.json to dist/")); + console.error(pc.red("❌ Could not copy config.json to dist/")); + process.exit(1); } } diff --git a/packages/dev/utils/common.ts b/packages/dev/utils/common.ts index e39342d..7f93c5e 100644 --- a/packages/dev/utils/common.ts +++ b/packages/dev/utils/common.ts @@ -151,11 +151,12 @@ export async function runBot(projectPath: string) { userConfig = JSON.parse(configJsonContent); console.log(`${pc.green("✓")} User config loaded`); } catch (_error) { - console.warn( - pc.yellow( - "⚠️ userConfig is enabled but config.json not found or invalid", + console.error( + pc.red( + "❌ userConfig is enabled but config.json not found or invalid", ), ); + process.exit(1); } } From 4e6643a2fef7618b9ebd7ee2c6a31e2d869a1441 Mon Sep 17 00:00:00 2001 From: Cleboost <61158869+Cleboost@users.noreply.github.com> Date: Thu, 26 Mar 2026 09:16:44 +0000 Subject: [PATCH 2/2] fix: enforce config.json presence and fix linting issues - Modified `runBot` and `build` commands to exit with `process.exit(1)` if `config.json` is missing or invalid when required. - Fixed Biome linting issues by using template literals and prefixing unused catch variables. - Fixed Biome formatting in `packages/dev/utils/common.ts`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- packages/dev/commands/build.ts | 4 ++-- packages/dev/utils/common.ts | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/dev/commands/build.ts b/packages/dev/commands/build.ts index 75c1989..6da0937 100644 --- a/packages/dev/commands/build.ts +++ b/packages/dev/commands/build.ts @@ -429,9 +429,9 @@ export function registerBuildCommand(cli: CAC) { try { await fs.copyFile(configJsonPath, outConfigJsonPath); console.log( - pc.green("✓") + ` config.json copied to ${pc.bold("dist/")}`, + `${pc.green("✓")} config.json copied to ${pc.bold("dist/")}`, ); - } catch (e) { + } catch (_e) { console.error(pc.red("❌ Could not copy config.json to dist/")); process.exit(1); } diff --git a/packages/dev/utils/common.ts b/packages/dev/utils/common.ts index 7f93c5e..fce4c6e 100644 --- a/packages/dev/utils/common.ts +++ b/packages/dev/utils/common.ts @@ -152,9 +152,7 @@ export async function runBot(projectPath: string) { console.log(`${pc.green("✓")} User config loaded`); } catch (_error) { console.error( - pc.red( - "❌ userConfig is enabled but config.json not found or invalid", - ), + pc.red("❌ userConfig is enabled but config.json not found or invalid"), ); process.exit(1); }