fix(cli): recommend direct bun client commands
This commit is contained in:
@@ -109,6 +109,8 @@ test("hwlab-cli client auth status exposes local session state and next commands
|
||||
assert.equal(mismatch.payload.localSession.usable, false);
|
||||
assert.equal(mismatch.payload.localSession.ignoredReason, "base_url_mismatch");
|
||||
assert.equal(JSON.stringify(mismatch.payload).includes("session-old"), false);
|
||||
assert.match(mismatch.payload.nextCommands[1], /^bun tools\/hwlab-cli\/bin\/hwlab-cli\.ts client auth login/u);
|
||||
assert.equal(JSON.stringify(mismatch.payload.nextCommands).includes("run-bun.mjs"), false);
|
||||
});
|
||||
|
||||
test("hwlab-cli client group help is visible and does not issue HTTP requests", async () => {
|
||||
|
||||
@@ -1547,10 +1547,11 @@ function authNextCommands(authState: any) {
|
||||
const resolvedBaseUrl = text(authState?.baseUrl) || DEFAULT_BASE_URL;
|
||||
const username = text(authState?.username) || "admin";
|
||||
const stateFileArg = text(authState?.stateFile) ? ` --state-file ${shellArg(authState.stateFile)}` : "";
|
||||
const cli = "bun tools/hwlab-cli/bin/hwlab-cli.ts";
|
||||
return [
|
||||
`export HWLAB_PASSWORD='<password>'`,
|
||||
`node scripts/run-bun.mjs tools/hwlab-cli/bin/hwlab-cli.ts client auth login --base-url ${shellArg(resolvedBaseUrl)} --username ${shellArg(username)} --password-env HWLAB_PASSWORD${stateFileArg}`,
|
||||
`node scripts/run-bun.mjs tools/hwlab-cli/bin/hwlab-cli.ts client auth status --base-url ${shellArg(resolvedBaseUrl)}${stateFileArg}`
|
||||
`${cli} client auth login --base-url ${shellArg(resolvedBaseUrl)} --username ${shellArg(username)} --password-env HWLAB_PASSWORD${stateFileArg}`,
|
||||
`${cli} client auth status --base-url ${shellArg(resolvedBaseUrl)}${stateFileArg}`
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user