From 351a24296a34c8a95ae1641c15df38bcc7970e65 Mon Sep 17 00:00:00 2001 From: dvd233 <111864431+dvd233@users.noreply.github.com> Date: Tue, 22 Sep 2026 12:29:56 -0700 Subject: [PATCH] fix(cli): allow unauthenticated access to help --- src/main.ts | 1 + test/commands/help.test.ts | 48 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 test/commands/help.test.ts diff --git a/src/main.ts b/src/main.ts index d2ee350c..7e571c4d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,6 +32,7 @@ const NO_AUTH_SETUP = [ ['config', 'show'], ['config', 'set'], ['config', 'export-schema'], + ['help'], ['update'], ]; diff --git a/test/commands/help.test.ts b/test/commands/help.test.ts new file mode 100644 index 00000000..e2a48ffa --- /dev/null +++ b/test/commands/help.test.ts @@ -0,0 +1,48 @@ +import { afterEach, beforeEach, describe, expect, it } from 'bun:test'; +import { mkdtempSync, rmSync } from 'fs'; +import { tmpdir } from 'os'; +import { join } from 'path'; + +describe('mmx help', () => { + let home: string; + let originalHome: string | undefined; + + beforeEach(() => { + home = mkdtempSync(join(tmpdir(), 'mmx-help-')); + originalHome = process.env.HOME; + process.env.HOME = home; + }); + + afterEach(() => { + if (originalHome === undefined) delete process.env.HOME; + else process.env.HOME = originalHome; + rmSync(home, { recursive: true, force: true }); + }); + + it('prints documentation links without requiring credentials', async () => { + const child = Bun.spawn({ + cmd: [process.execPath, 'run', 'src/main.ts', 'help'], + cwd: process.cwd(), + env: { + ...process.env, + HOME: home, + MMX_CONFIG_DIR: join(home, '.mmx'), + NO_COLOR: '1', + MINIMAX_API_KEY: '', + }, + stdout: 'pipe', + stderr: 'pipe', + }); + + const [stdout, stderr, exitCode] = await Promise.all([ + new Response(child.stdout).text(), + new Response(child.stderr).text(), + child.exited, + ]); + + expect(exitCode).toBe(0); + expect(stdout).toContain('MiniMax API Documentation Links'); + expect(stderr).not.toContain('No credentials found'); + expect(stderr).not.toContain('How would you like to authenticate'); + }); +});