Skip to content

feat(openapi): add OpenAPI Key CLI commands#9

Merged
0xFANGO merged 22 commits into
mainfrom
ralph/listenhub-cli--134
May 18, 2026
Merged

feat(openapi): add OpenAPI Key CLI commands#9
0xFANGO merged 22 commits into
mainfrom
ralph/listenhub-cli--134

Conversation

@0xFANGO
Copy link
Copy Markdown
Collaborator

@0xFANGO 0xFANGO commented May 18, 2026

Summary

  • Adds listenhub openapi subcommand group for API Key–based access to all ListenHub OpenAPI endpoints
  • Supports config storage (env var + file), key validation, and 10 command modules: config, speakers, tts/speech, flow-speech, podcast, storybook, image, video, content, subscription
  • Includes generic polling helper for async tasks with spinner + timeout
  • 24 tests (unit + integration) all passing

Architecture

New source/openapi/ module — fully isolated from OAuth commands. Self-registering pattern: each command file exports register(openapi), _cli.ts dispatches.

Commands Added

  • openapi config set-key/show/clear
  • openapi speakers list
  • openapi tts / audio-speech / speech
  • openapi flow-speech create/get/tts/text-stream
  • openapi podcast create/get/text-content/generate-audio/text-stream
  • openapi storybook create/get/generate-video
  • openapi image create
  • openapi video create/get/list/estimate
  • openapi content extract/get
  • openapi subscription

Test plan

  • pnpm run lint passes (0 warnings, 0 errors)
  • pnpm run build succeeds
  • pnpm test — 24 tests pass (config, client, polling, integration)
  • node dist/cli.mjs openapi --help shows all 12 subcommands
  • Manual smoke test with real API key (LISTENHUB_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 openapi command group backed by SDK OpenAPIClient (upgrading @marswave/listenhub-sdk to ^0.0.7) with API-key authentication via LISTENHUB_API_KEY or 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.

0xFANGO added 18 commits May 18, 2026 22:13
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
Tests that CLI args are correctly mapped to SDK calls for speakers,
subscription, content extract, video create, and storybook create.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default mode and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread source/openapi/tts.ts
0xFANGO added 4 commits May 19, 2026 00:57
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.
@0xFANGO 0xFANGO merged commit e32cc6b into main May 18, 2026
1 check passed
@0xFANGO 0xFANGO deleted the ralph/listenhub-cli--134 branch May 18, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant