feat(openapi): add OpenAPI Key CLI commands#9
Merged
Conversation
Design for `listenhub openapi` subcommand group covering all SDK OpenAPIClient capabilities: config, speakers, tts, speech, flow-speech, podcast, storybook, image, video, content-extract, subscription.
- Self-registering modules: each command file exports register(openapi), _cli.ts is a thin dispatcher written once (no multi-task mutation) - Fix requiredOption(collect, []) → .option() + explicit non-empty validation - Add --source-text to podcast text-content command - Add integration tests task (mocked OpenAPIClient) - Fix final verification to explicit lint && build && test
1. Blocker: Tasks 11-14 now use self-registering pattern (each module exports register(openapi) with all its own imports; _cli.ts only adds one import + one call per module) 2. High: Polling timeout test now advances fake timers via vi.advanceTimersByTimeAsync() to avoid hanging 3. High: Integration tests replaced with real assertions that invoke commands via Commander.parseAsync and verify SDK call args + JSON output 4. Medium: Client factory tests now mock OpenAPIClient constructor and assert the correct API key is passed for env/file/priority scenarios
…t-stream commands
Tests that CLI args are correctly mapped to SDK calls for speakers, subscription, content extract, video create, and storybook create.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default mode and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0b41086. Configure here.
Restructure both EN and CN READMEs to present OAuth and OpenAPI Key as parallel authentication methods. Add complete command reference for the new `openapi` subcommand group.
Deduplicate near-identical runTts/runAudioSpeech functions by extracting the shared response-to-file logic into a helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
listenhub openapisubcommand group for API Key–based access to all ListenHub OpenAPI endpointsArchitecture
New
source/openapi/module — fully isolated from OAuth commands. Self-registering pattern: each command file exportsregister(openapi),_cli.tsdispatches.Commands Added
openapi config set-key/show/clearopenapi speakers listopenapi tts / audio-speech / speechopenapi flow-speech create/get/tts/text-streamopenapi podcast create/get/text-content/generate-audio/text-streamopenapi storybook create/get/generate-videoopenapi image createopenapi video create/get/list/estimateopenapi content extract/getopenapi subscriptionTest plan
pnpm run lintpasses (0 warnings, 0 errors)pnpm run buildsucceedspnpm test— 24 tests pass (config, client, polling, integration)node dist/cli.mjs openapi --helpshows all 12 subcommandsLISTENHUB_API_KEY=lh_sk_... node dist/cli.mjs openapi subscription -j)Part of marswaveai/listenhub-ralph#134
Note
Medium Risk
Adds a large new surface area of CLI commands that invoke many OpenAPI endpoints and implement new key storage/polling logic; while isolated from existing OAuth flows, mistakes could impact credential handling and command behavior.
Overview
Adds a new
listenhub openapicommand group backed by SDKOpenAPIClient(upgrading@marswave/listenhub-sdkto^0.0.7) with API-key authentication viaLISTENHUB_API_KEYor a 0600-permission config file (openapi config set-key/show/clear).Introduces OpenAPI modules for speakers, TTS/speech, flow-speech, podcast, storybook, image, video, content extraction, and subscription, plus a generic
pollOpenAPI()helper for async task polling with spinner/timeout behavior. Includes new unit/integration tests covering config/client/polling and representative command argument-to-SDK mappings.Reviewed by Cursor Bugbot for commit 0b41086. Configure here.