fix(cli): fast-path bare channels help (#77659)

* fix(cli): fast-path bare channels help

* fix(cli): normalize channels add argv gating

* fix(cli): restore channel add completion flags
This commit is contained in:
Vincent Koc
2026-05-05 16:02:39 -07:00
committed by GitHub
parent 1e1903487f
commit fdddb413ef
16 changed files with 319 additions and 48 deletions

View File

@@ -3,6 +3,7 @@ import { repoInstallSpec } from "openclaw/plugin-sdk/test-fixtures";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { loggingState } from "../../logging/state.js";
import { setCommandJsonMode } from "./json-mode.js";
import { applyParentDefaultHelpAction } from "./parent-default-help.js";
const DISCORD_REPO_INSTALL_SPEC = repoInstallSpec("discord");
@@ -149,6 +150,7 @@ describe("registerPreActionHooks", () => {
.command("send")
.option("--json")
.action(() => {});
applyParentDefaultHelpAction(channels);
program
.command("plugins")
.command("install")
@@ -289,6 +291,18 @@ describe("registerPreActionHooks", () => {
expect(ensurePluginRegistryLoadedMock).not.toHaveBeenCalled();
});
it("skips startup bootstrap for parent default help actions", async () => {
await runPreAction({
parseArgv: ["channels"],
processArgv: ["node", "openclaw", "channels"],
});
expect(emitCliBannerMock).not.toHaveBeenCalled();
expect(setVerboseMock).not.toHaveBeenCalled();
expect(ensureConfigReadyMock).not.toHaveBeenCalled();
expect(ensurePluginRegistryLoadedMock).not.toHaveBeenCalled();
});
it("lets configure own config validation and plugin loading", async () => {
await runPreAction({
parseArgv: ["configure"],