This commit is contained in:
Thanh Nguyen 2026-01-30 15:57:45 +00:00 committed by GitHub
commit 21f1ea00d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 2 deletions

View File

@ -16,6 +16,10 @@ jobs:
- name: Checkout submodules (retry) - name: Checkout submodules (retry)
run: | run: |
set -euo pipefail set -euo pipefail
if [ ! -f .gitmodules ]; then
echo "No .gitmodules found; skipping submodule update."
exit 0
fi
git submodule sync --recursive git submodule sync --recursive
for attempt in 1 2 3 4 5; do for attempt in 1 2 3 4 5; do
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
@ -101,6 +105,10 @@ jobs:
- name: Checkout submodules (retry) - name: Checkout submodules (retry)
run: | run: |
set -euo pipefail set -euo pipefail
if [ ! -f .gitmodules ]; then
echo "No .gitmodules found; skipping submodule update."
exit 0
fi
git submodule sync --recursive git submodule sync --recursive
for attempt in 1 2 3 4 5; do for attempt in 1 2 3 4 5; do
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
@ -217,6 +225,10 @@ jobs:
- name: Checkout submodules (retry) - name: Checkout submodules (retry)
run: | run: |
set -euo pipefail set -euo pipefail
if [ ! -f .gitmodules ]; then
echo "No .gitmodules found; skipping submodule update."
exit 0
fi
git submodule sync --recursive git submodule sync --recursive
for attempt in 1 2 3 4 5; do for attempt in 1 2 3 4 5; do
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
@ -293,6 +305,10 @@ jobs:
- name: Checkout submodules (retry) - name: Checkout submodules (retry)
run: | run: |
set -euo pipefail set -euo pipefail
if [ ! -f .gitmodules ]; then
echo "No .gitmodules found; skipping submodule update."
exit 0
fi
git submodule sync --recursive git submodule sync --recursive
for attempt in 1 2 3 4 5; do for attempt in 1 2 3 4 5; do
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
@ -389,6 +405,10 @@ jobs:
- name: Checkout submodules (retry) - name: Checkout submodules (retry)
run: | run: |
set -euo pipefail set -euo pipefail
if [ ! -f .gitmodules ]; then
echo "No .gitmodules found; skipping submodule update."
exit 0
fi
git submodule sync --recursive git submodule sync --recursive
for attempt in 1 2 3 4 5; do for attempt in 1 2 3 4 5; do
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then

View File

@ -18,6 +18,8 @@ const ALLOWED_INVALID_GATEWAY_SUBCOMMANDS = new Set([
"stop", "stop",
"restart", "restart",
]); ]);
const CLIENT_MODE_COMMANDS = new Set(["tui"]);
let didRunDoctorConfigFlow = false; let didRunDoctorConfigFlow = false;
function formatConfigIssues(issues: Array<{ path: string; message: string }>): string[] { 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: { export async function ensureConfigReady(params: {
runtime: RuntimeEnv; runtime: RuntimeEnv;
commandPath?: string[]; commandPath?: string[];
rawArgs?: string[];
}): Promise<void> { }): Promise<void> {
if (!didRunDoctorConfigFlow) { if (!didRunDoctorConfigFlow) {
didRunDoctorConfigFlow = true; didRunDoctorConfigFlow = true;
@ -39,8 +42,13 @@ export async function ensureConfigReady(params: {
const snapshot = await readConfigFileSnapshot(); const snapshot = await readConfigFileSnapshot();
const commandName = params.commandPath?.[0]; const commandName = params.commandPath?.[0];
const subcommandName = params.commandPath?.[1]; 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 const allowInvalid = commandName
? ALLOWED_INVALID_COMMANDS.has(commandName) || ? ALLOWED_INVALID_COMMANDS.has(commandName) ||
isClientModeCommand ||
(commandName === "gateway" && (commandName === "gateway" &&
subcommandName && subcommandName &&
ALLOWED_INVALID_GATEWAY_SUBCOMMANDS.has(subcommandName)) ALLOWED_INVALID_GATEWAY_SUBCOMMANDS.has(subcommandName))

View File

@ -41,7 +41,7 @@ export function registerPreActionHooks(program: Command, programVersion: string)
process.env.NODE_NO_WARNINGS ??= "1"; process.env.NODE_NO_WARNINGS ??= "1";
} }
if (commandPath[0] === "doctor") return; 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 // Load plugins for commands that need channel access
if (PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])) { if (PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])) {
ensurePluginRegistryLoaded(); ensurePluginRegistryLoaded();

View File

@ -13,7 +13,11 @@ async function prepareRoutedCommand(params: {
loadPlugins?: boolean; loadPlugins?: boolean;
}) { }) {
emitCliBanner(VERSION, { argv: params.argv }); 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) { if (params.loadPlugins) {
ensurePluginRegistryLoaded(); ensurePluginRegistryLoaded();
} }