feat(cli): support targeting running containerized openclaw instances (#52651)

Signed-off-by: sallyom <somalley@redhat.com>
This commit is contained in:
Sally O'Malley
2026-03-24 10:17:17 -04:00
committed by GitHub
parent dd11bdd003
commit 91adc5e718
24 changed files with 1484 additions and 39 deletions

View File

@@ -22,7 +22,9 @@ describe("consumeRootOptionToken", () => {
{ args: ["--dev"], index: 0, expected: 1 },
{ args: ["--profile=work"], index: 0, expected: 1 },
{ args: ["--log-level=debug"], index: 0, expected: 1 },
{ args: ["--container=openclaw-demo"], index: 0, expected: 1 },
{ args: ["--profile", "work"], index: 0, expected: 2 },
{ args: ["--container", "openclaw-demo"], index: 0, expected: 2 },
{ args: ["--profile", "-1"], index: 0, expected: 2 },
{ args: ["--log-level", "-1.5"], index: 0, expected: 2 },
{ args: ["--profile", "--no-color"], index: 0, expected: 1 },

View File

@@ -1,7 +1,7 @@
export const FLAG_TERMINATOR = "--";
const ROOT_BOOLEAN_FLAGS = new Set(["--dev", "--no-color"]);
const ROOT_VALUE_FLAGS = new Set(["--profile", "--log-level"]);
const ROOT_VALUE_FLAGS = new Set(["--profile", "--log-level", "--container"]);
export function isValueToken(arg: string | undefined): boolean {
if (!arg || arg === FLAG_TERMINATOR) {
@@ -21,7 +21,11 @@ export function consumeRootOptionToken(args: ReadonlyArray<string>, index: numbe
if (ROOT_BOOLEAN_FLAGS.has(arg)) {
return 1;
}
if (arg.startsWith("--profile=") || arg.startsWith("--log-level=")) {
if (
arg.startsWith("--profile=") ||
arg.startsWith("--log-level=") ||
arg.startsWith("--container=")
) {
return 1;
}
if (ROOT_VALUE_FLAGS.has(arg)) {