From fab489afa3f363a5169f262639185631c9b0eab0 Mon Sep 17 00:00:00 2001 From: ThanhNguyxn Date: Wed, 28 Jan 2026 13:17:22 +0700 Subject: [PATCH 1/3] CLI: allow tui --url client mode --- src/cli/program/config-guard.ts | 8 ++++++++ src/cli/program/preaction.ts | 2 +- src/cli/route.ts | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/cli/program/config-guard.ts b/src/cli/program/config-guard.ts index d7c33db09..d513452a6 100644 --- a/src/cli/program/config-guard.ts +++ b/src/cli/program/config-guard.ts @@ -18,6 +18,8 @@ const ALLOWED_INVALID_GATEWAY_SUBCOMMANDS = new Set([ "stop", "restart", ]); + +const CLIENT_MODE_COMMANDS = new Set(["tui"]); let didRunDoctorConfigFlow = false; function formatConfigIssues(issues: Array<{ path: string; message: string }>): string[] { @@ -27,6 +29,7 @@ function formatConfigIssues(issues: Array<{ path: string; message: string }>): s export async function ensureConfigReady(params: { runtime: RuntimeEnv; commandPath?: string[]; + rawArgs?: string[]; }): Promise { if (!didRunDoctorConfigFlow) { didRunDoctorConfigFlow = true; @@ -39,8 +42,13 @@ export async function ensureConfigReady(params: { const snapshot = await readConfigFileSnapshot(); const commandName = params.commandPath?.[0]; const subcommandName = params.commandPath?.[1]; + + const hasUrlFlag = params.rawArgs?.some((arg) => arg === "--url" || arg.startsWith("--url=")); + const isClientModeCommand = commandName && CLIENT_MODE_COMMANDS.has(commandName) && hasUrlFlag; + const allowInvalid = commandName ? ALLOWED_INVALID_COMMANDS.has(commandName) || + isClientModeCommand || (commandName === "gateway" && subcommandName && ALLOWED_INVALID_GATEWAY_SUBCOMMANDS.has(subcommandName)) diff --git a/src/cli/program/preaction.ts b/src/cli/program/preaction.ts index acdcde387..e71ab09e4 100644 --- a/src/cli/program/preaction.ts +++ b/src/cli/program/preaction.ts @@ -41,7 +41,7 @@ export function registerPreActionHooks(program: Command, programVersion: string) process.env.NODE_NO_WARNINGS ??= "1"; } if (commandPath[0] === "doctor") return; - await ensureConfigReady({ runtime: defaultRuntime, commandPath }); + await ensureConfigReady({ runtime: defaultRuntime, commandPath, rawArgs: argv }); // Load plugins for commands that need channel access if (PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])) { ensurePluginRegistryLoaded(); diff --git a/src/cli/route.ts b/src/cli/route.ts index 885904964..90bd6f1e3 100644 --- a/src/cli/route.ts +++ b/src/cli/route.ts @@ -13,7 +13,11 @@ async function prepareRoutedCommand(params: { loadPlugins?: boolean; }) { emitCliBanner(VERSION, { argv: params.argv }); - await ensureConfigReady({ runtime: defaultRuntime, commandPath: params.commandPath }); + await ensureConfigReady({ + runtime: defaultRuntime, + commandPath: params.commandPath, + rawArgs: params.argv, + }); if (params.loadPlugins) { ensurePluginRegistryLoaded(); } From f23abf42d30b9f7c7074181eed0b9b7bf658e908 Mon Sep 17 00:00:00 2001 From: ThanhNguyxn Date: Thu, 29 Jan 2026 22:06:17 +0700 Subject: [PATCH 2/3] chore: re-trigger CI From e80080fc1c3983a417e927926587b018e3f1943a Mon Sep 17 00:00:00 2001 From: ThanhNguyxn Date: Fri, 30 Jan 2026 22:56:50 +0700 Subject: [PATCH 3/3] ci: skip submodule update when no .gitmodules --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 885d87fcb..a2abe26ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then @@ -101,6 +105,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then @@ -217,6 +225,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then @@ -293,6 +305,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then @@ -389,6 +405,10 @@ jobs: - name: Checkout submodules (retry) run: | set -euo pipefail + if [ ! -f .gitmodules ]; then + echo "No .gitmodules found; skipping submodule update." + exit 0 + fi git submodule sync --recursive for attempt in 1 2 3 4 5; do if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then