Skip to content

Add Kafka UI extension - #26259

Merged
raycastbot merged 9 commits into
raycast:mainfrom
NirRosh:add-kafka-ui-extension
Apr 2, 2026
Merged

raycastbot merged 9 commits into
raycast:mainfrom
NirRosh:add-kafka-ui-extension

Conversation

@NirRosh

@NirRosh NirRosh commented Mar 12, 2026 •

Copy link
Copy Markdown

Summary

  • New extension for managing and monitoring Apache Kafka clusters through the Kafbat UI REST API
  • Provides three commands: Search Consumer Groups (with per-topic/partition lag inspection), Search Topics (with prefix grouping and replication details), and Manage Kafka Environments (dynamic multi-environment configuration)
  • Supports multi-environment setup with custom colors, color-coded lag severity thresholds, and direct links to Kafka UI browser

Details

This extension connects to self-hosted or managed Kafka UI instances and provides:

  • Search Consumer Groups: Browse consumer groups sorted by lag, drill into per-topic and per-partition lag details with color-coded severity (OK / Warning / Critical)
  • Search Topics: Browse topics grouped by prefix, view partition counts, replication factors, and segment sizes. Deep search toggle for switching between filtered prefixes and all topics
  • Manage Kafka Environments: Add, edit, or remove any number of Kafka UI environments with custom display names, colors, and optional topic prefix filters

Environment data is stored per-user in Raycast's LocalStorage, so each team member configures their own connections independently.

Test Plan

  • Verify npm run build passes without errors
  • Verify npm run lint passes without errors
  • Add a Kafka UI environment via "Manage Kafka Environments" command
  • Search consumer groups and verify lag data displays correctly
  • Search topics and verify grouping by prefix works
  • Test switching between multiple environments via dropdown
  • Verify "Open in Kafka UI" actions open correct URLs
  • Test with both old (non-paginated) and new (paginated) Kafka UI API versions

New extension for managing and monitoring Apache Kafka clusters through the Kafbat UI (formerly Provectus Kafka UI) REST API.

Commands:
- Search Consumer Groups: browse consumer groups with lag inspection per topic and partition
- Search Topics: browse Kafka topics grouped by prefix with partition and replication details
- Manage Kafka Environments: add, edit, or remove Kafka UI environment connections

Features:
- Multi-environment support with custom colors
- Color-coded lag severity (OK / Warning / Critical) with configurable thresholds
- Deep search toggle for topic prefix filtering
- Direct links to open items in Kafka UI browser

Made-with: Cursor
@raycastbot raycastbot added the new extension Label for PRs with new extensions label Mar 12, 2026
@raycastbot

Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

Nir Rosh added 2 commits March 12, 2026 12:54
- Remove unused catch variable (pagedErr)
- Apply Prettier formatting to api.ts and search-consumer-groups.tsx

Made-with: Cursor
- Search Consumer Groups => Kafka Search Consumer Groups
- Search Topics => Kafka Search Topics
- Manage Kafka Environments => Kafka Configuration Manager

Made-with: Cursor
@greptile-apps

greptile-apps Bot commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a new Kafka UI extension that connects to self-hosted Kafbat UI instances, providing three commands: browsing consumer groups with per-topic/partition lag inspection, browsing topics with prefix-based grouping and replication details, and managing multi-environment configurations stored in Raycast's LocalStorage.

The overall implementation is clean and well-structured — shared utilities have been correctly extracted into lag-utils.ts, the dual-endpoint API fallback handles both paginated and non-paginated Kafbat UI versions gracefully, and the environment dropdown is properly reused across both command files.

Key findings:

  • storage.ts — getEnvironments() calls JSON.parse(raw) without a try-catch. If the stored value is ever malformed (partial write on crash, schema mismatch from a future version), every command will throw an unhandled exception on startup, making the extension completely unusable until the user manually clears storage.
  • lag-utils.ts — getLagThresholds() calls getPreferenceValues<Preferences>() on every invocation of determineLagStatus(). Since this is called per list-item during rendering, preferences are re-read and both thresholds are parseInt-ed twice per item. Worth consolidating before merge.

Confidence Score: 4/5

Safe to merge after fixing the unguarded JSON.parse in storage.ts — all other findings are minor style improvements.

One P1 issue: JSON.parse without error handling in getEnvironments() can crash every command on startup if storage is ever corrupted. The remaining finding is a P2 performance/style suggestion. Everything else — API layer, UI components, types, config files — is well-implemented.

extensions/kafka-ui/src/storage.ts — missing try-catch around JSON.parse

Important Files Changed

Filename Overview
extensions/kafka-ui/src/api.ts API layer with dual-endpoint fallback (paged/plain) for consumer groups, paginated topic fetching, and API version-normalisation helpers. Logic is sound; extensive debug logging may be noisy in production but is harmless.
extensions/kafka-ui/src/storage.ts LocalStorage CRUD layer for environments; getEnvironments calls JSON.parse without a try-catch — corrupted storage will throw an unhandled exception that crashes all commands on startup.
extensions/kafka-ui/src/lag-utils.ts Shared lag utilities extracted correctly from the two command files; getLagThresholds calls getPreferenceValues() on every invocation and parses each threshold twice — minor inefficiency worth cleaning up.
extensions/kafka-ui/src/search-consumer-groups.tsx Consumer group list with drill-down to topic-level and partition-level lag; environment dropdown, error toasts, and refresh actions are all handled correctly.
extensions/kafka-ui/src/search-topics.tsx Topics list with prefix-based grouping, deep-search toggle, and per-topic consumer group lag drill-down; logic is correct and well-structured.
extensions/kafka-ui/src/manage-environments.tsx CRUD UI for environments with add/edit/delete actions, confirmations, and toast feedback; straightforward and correct.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/kafka-ui/src/storage.ts
Line: 8-9

Comment:
**Unguarded `JSON.parse` will crash the extension on corrupted storage**

`JSON.parse(raw)` will throw a `SyntaxError` if the stored value is ever malformed (e.g., after a partial write during a crash or if an older schema is stored). Because `getEnvironments` is called unconditionally from every command on startup, this would make the entire extension unusable until the user clears storage manually.

```suggestion
  try {
    return JSON.parse(raw) as StoredEnvironment[];
  } catch {
    console.error("[kafka-ui] Failed to parse environments from storage, resetting:", raw);
    return [];
  }
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/kafka-ui/src/lag-utils.ts
Line: 74-80

Comment:
**`getPreferenceValues()` called on every list item render**

`getLagThresholds()` invokes `getPreferenceValues<Preferences>()` each time it runs, and since `determineLagStatus()` calls `getLagThresholds()`, preferences are re-read for every single list item in both `search-consumer-groups.tsx` and `search-topics.tsx`. Consider reading thresholds once at the component level and passing them down, or memoising the result:

```typescript
export function getLagThresholds(): { warning: number; critical: number } {
  const prefs = getPreferenceValues<Preferences>();
  const warning = parseInt(prefs.lagThresholdWarning, 10);
  const critical = parseInt(prefs.lagThresholdCritical, 10);
  return {
    warning: isNaN(warning) ? 1000 : warning,
    critical: isNaN(critical) ? 10000 : critical,
  };
}
```

This also removes the four redundant `parseInt` calls (each threshold is parsed twice).

How can I resolve this? If you propose a fix, please make it concise.

Reviews (5): Last reviewed commit: "Address review feedback: add metadata sc..." | Re-trigger Greptile

Comment thread extensions/kafka-ui/src/types.ts Resolved
Comment thread extensions/kafka-ui/eslint.config.js Resolved
- Add .prettierrc with printWidth: 120, singleQuote: false
- Remove manually defined Preferences interface, use auto-generated type from raycast-env.d.ts
- Extract shared utility functions (getLagThresholds, determineLagStatus, lagStatusIcon, statusColor, formatLag) into src/lag-utils.ts
- Apply Prettier formatting with correct config

Made-with: Cursor
@NirRosh

NirRosh commented Mar 12, 2026

Copy link
Copy Markdown
Author

Addressed the review feedback in commit 5c2190d:

  1. Missing .prettierrc -- Added with {"printWidth": 120, "singleQuote": false} matching the repo convention.
  2. Manually defined Preferences interface -- Removed from types.ts. Now uses the auto-generated global Preferences type from raycast-env.d.ts.
  3. Duplicate utility functions -- Extracted getLagThresholds, determineLagStatus, lagStatusIcon, statusColor, and formatLag into a shared src/lag-utils.ts module. Both command files now import from there.
  4. ESLint config CJS vs ESM -- Keeping CommonJS syntax as it matches other extensions in the repository (e.g. 0x0). CI ESLint check passes.
  5. Missing metadata/ folder -- Will add screenshots once the extension is running in dev mode with Raycast Window Capture.

All CI checks are now passing.

@0xdhrv 0xdhrv self-assigned this Mar 25, 2026

@0xdhrv 0xdhrv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution 

We already have an extension in the Store that deals with this. Could we consider enhancing the existing extension below instead of creating another one?

If there are unique features or workflows you’re aiming to add, we’d love to hear them and see if they can be integrated into this to avoid duplication and improve discoverability.

This would help avoid duplication and keep related functionality consolidated in one place.
As mentioned in our extension guidelines here

@0xdhrv
0xdhrv marked this pull request as draft March 25, 2026 06:50
@NirRosh
NirRosh marked this pull request as ready for review March 26, 2026 12:49
@NirRosh
NirRosh marked this pull request as draft March 26, 2026 12:49
@NirRosh

NirRosh commented Mar 26, 2026 •

Copy link
Copy Markdown
Author

Thanks for the review. @0xdhrv

I'd like to keep this as a separate extension. The existing kafka extension by @fonimus and this kafka-ui extension are fundamentally different in how they connect to Kafka:

  • kafka connects directly to Kafka brokers via KafkaJS, requiring direct network access to brokers and on-disk JSON config files with SASL/SSL credentials.
  • kafka-ui connects to Kafbat UI (formerly Provectus Kafka UI) via its REST API. It targets teams that already have Kafka UI deployed as their management layer -- they just need a URL.

These are different protocols, different config models, different target audiences, and different data sources. Merging them would mean maintaining two entirely separate API layers and config systems inside one extension, which would create confusion for users of both.

This is similar to how the Raycast Store has separate extensions for services that share a domain but have different interfaces (e.g., different database clients for different database management tools).

Beyond the architectural difference, kafka-ui also provides features that don't exist in the current kafka extension:

  • Multi-environment management with in-app CRUD (named environments, custom colors)
  • Color-coded lag severity monitoring (OK / Warning / Critical) with configurable thresholds
  • Per-topic and per-partition lag drill-down
  • Topic prefix grouping and deep-search toggle
  • Under-replication warnings
  • Direct deep links to Kafka UI browser for each resource

Happy to clarify further or adjust naming/description to make the distinction clear in the Store (e.g., "Kafka UI" vs "Kafka").

@NirRosh
NirRosh marked this pull request as ready for review March 29, 2026 09:21
- Updated README and CHANGELOG for clarity
- Improved error handling in API calls with user feedback
- Refactored command titles for better discoverability
- Introduced color management for environments
- Added .gitignore for better project hygiene

@0xdhrv 0xdhrv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @NirRosh 👋

Can you please add metadata screenshots to the extension?

Also, look into any greptile suggestions

I'm looking forward to testing this extension again 🔥

Feel free to contact me here or at Slack if you have any questions.


I converted this PR into a draft until it's ready for the review, please press the button Ready for review when it's ready and we'll have a look 😊

@0xdhrv
0xdhrv marked this pull request as draft April 1, 2026 05:36
@NirRosh
NirRosh marked this pull request as ready for review April 1, 2026 06:58
@NirRosh

NirRosh commented Apr 1, 2026

Copy link
Copy Markdown
Author

Hi @0xdhrv, addressed the review feedback in commit efe236b:

  1. Added metadata/ screenshots -- 5 PNG screenshots (2000x1250) covering all three view commands (consumer groups, topics, configuration manager).
  2. Fixed threshold parsing edge case -- Replaced parseInt(...) || default with isNaN() check in lag-utils.ts so a user-set threshold of 0 is respected instead of silently falling back to the default.

Ready for another look.

Comment thread extensions/kafka-ui/src/storage.ts Resolved
0xdhrv and others added 2 commits April 2, 2026 12:39
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
- Added a check for empty storage to return an empty array.
- Improves robustness of the getEnvironments function.

@0xdhrv 0xdhrv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, approved ✅

@raycastbot
raycastbot merged commit 9b7c8a4 into raycast:main Apr 2, 2026
2 checks passed
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

ariesly15 pushed a commit to ariesly15/raycast-extensions that referenced this pull request Apr 10, 2026
- feat[extensions/qq-mail]: 添加QQ邮箱扩展及配置文件
- Merge branch \'raycast:main\' into main
- Update CODEOWNERs (9944a1b)
- [XKCD Comics] Add viewing history (raycast#26704)
- refactor: 增加useCallback并更新tsconfig配置
- Update CODEOWNERs (9b7c8a4)
- Add Kafka UI extension (raycast#26259)
- Merge branch \'raycast:main\' into main
- refactor: 简化 Action.CopyToClipboard 组件调用 (url-parse.tsx)
- chore: 移除 delink 扩展中的图标配置项
- chore: 删除图标文件并更新配置引用新图标
- Update CODEOWNERs (756e9da)
- Update ascii-art-wallpaper extension (raycast#26707)
- Update CODEOWNERs (23ee8a8)
- Add paper-agent extension (raycast#26367)
- Merge branch \'raycast:main\' into main
- chore: 更新 delink 扩展变更日志并移除旧版本记录
- Update CODEOWNERs (768930b)
- Add nocal extension (raycast#26482)
- Update CODEOWNERs (7c0e492)
- Add caaals extension (raycast#26443)
- Merge branch \'raycast:main\' into main
- docs: 更新 delink 扩展文档及快捷键说明
- Update CODEOWNERs (41a12f0)
- Update mirror-displays extension (raycast#26445)
- chore: 更新 delink 扩展的版本信息为初始发布版
- docs: 调整 delink 扩展快捷键说明顺序
- Merge branch \'raycast:main\' into main
- feat:up
- Update CODEOWNERs (2134dff)
- Update hetzner extension (raycast#26705)
- Update CODEOWNERs (840e5a9)
- Add ram-prices extension (raycast#26564)
- Update CODEOWNERs (45fad15)
- Add habitica-todos extension (raycast#26446)
- Update CODEOWNERs (3e686e1)
- Add Bundles extension (raycast#25680)
- Update CODEOWNERs (f6261fd)
- Update tmux-cheatsheet extension (raycast#26379)
- Changelog Alignment (raycast#26824)
- Update prism-launcher extension (raycast#26816)
- Merge branch \'raycast:main\' into main
- feat: add metadata folder and language setting
- Update picgo extension (raycast#26818)
- Update CODEOWNERs (bd7023d)
- Add clockodo extension (raycast#26432)
- feat: add raycast extension delink
- Update CODEOWNERs (868aef4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants