Conversation
- news.ts: reorder flow (goto before loadStory), increase wait times for slow hydration, add clarity comments - utils.ts: clarify validateBloombergLink regex (use non-capturing group) - build-manifest.ts: log warning on scanTs parse failure (match scanYaml pattern) - public-commands.test.ts: use it.each for section RSS tests (better isolation & reporting)
ByteYue
left a comment
There was a problem hiding this comment.
Review: Bloomberg Adapter PR
Nice work on this PR! Well-structured with good documentation and comprehensive tests. I've pushed a follow-up commit with a few improvements:
Changes made (c5a0bac):
-
news.ts: Reordered execution flow —page.goto(url)now comes beforeloadStorydefinition for clearer top-down reading. Increased wait times (5s initial + 4s retry) for Bloomberg's heavy Next.js pages. -
utils.ts: Clarified the hostname regex invalidateBloombergLink— replaced([.]|^)with(?:\\.|^)(non-capturing group form is unambiguous). -
build-manifest.ts: Addedconsole.warnwhenscanTs()fails to parse a file, matching the existingscanYaml()pattern. The previous silentreturn nullcould hide real I/O errors. -
public-commands.test.ts: Replaced the for-loop over 7 sections withit.each()for better test isolation — each section now gets its own test case with independent pass/fail reporting.
Considered but kept:
- Consolidating the 8 feed command files into a single factory — this would break the static manifest scanner which relies on regex to extract
name:anddescription:from source files. Individual files are the correct pattern for this codebase.
LGTM overall — solid first adapter contribution! 🎉
Description
Adds a Bloomberg adapter with RSS-backed listing commands plus browser-backed article extraction for standard Bloomberg story/article pages.
This PR also includes the small manifest/compiler fix needed so helper/test TS files in
src/clis/bloomberg/do not get exposed as fake commands inopencli list.Related issue:
Type of Change
What this adds
New Bloomberg commands:
opencli bloomberg mainopencli bloomberg marketsopencli bloomberg economicsopencli bloomberg industriesopencli bloomberg techopencli bloomberg politicsopencli bloomberg businessweekopencli bloomberg opinionsopencli bloomberg feedsopencli bloomberg news <link>What works now
feeds.bloomberg.comand return structured headline data without requiring a browser.bloomberg newscan read standard Bloomberg story/article pages and extract:bloomberg newsaccepts either a full Bloomberg URL or a relative Bloomberg path.opencli list/manifest output only shows real Bloomberg commands (not helper files likeutilsor test files).Out of scope / current limitations
__NEXT_DATA__story payload may still fail.Docs / wording updates
bloomberg newsis for standard story/article pagesbloomberg newscommand/help text and error messages to be explicit about current session/access requirements.Tests / manual checks run
Automated
npm run buildnpm run docs:buildnpx vitest run src/clis/bloomberg/utils.test.ts src/build-manifest.test.tsnpx vitest run tests/e2e/public-commands.test.ts tests/e2e/browser-public.test.ts -t bloombergManual
node dist/main.js list -f jsonnode dist/main.js bloomberg feeds -f jsonnode dist/main.js bloomberg main --limit 1 -f jsonnode dist/main.js bloomberg news <article-link> -f json/news/articles/...pageChecklist
Documentation (if adding/modifying an adapter)
docs/adapters/docs/adapters/index.mdtabledocs/.vitepress/config.mtsScreenshots / Output
Relevant manual smoke summary:
bloomberg main --limit 1 -f jsonreturned live RSS data successfullybloomberg newssuccessfully extracted a standard article page with non-emptycontent