Repository navigation
Update kagi-news extension - #22539
Conversation
- Merge contributions - Pull contributions - style: Fix code formatting with Prettier - v1.1: Add display section preferences and improve article detail view - Update Raycast before merging - Apply reviewer feedback and updates - v1.1.0
|
Thank you for your contribution! 🎉 🔔 @mickaphd you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. You can expect an initial review within five business days. |
|
Hi @pernielsentikaer 👋 I added new sections (see below) to the article view with toggle settings. I ensured that the sources listed in the right panel correspond to the sources cited in the sections the user chooses to display. The rest of the code structure you updated last time remains unchanged, so it should be straightforward.
Here is the changelog for this v1.1:
Thanks 🙏 |
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR enhances the kagi-news extension with comprehensive user customization features for article display. The main changes introduce 10 preference settings that allow users to selectively show/hide different article content sections including primary/secondary images, talking points, perspectives, historical background, technical details, industry impact, timeline, and international reactions. The implementation updates TypeScript interfaces to support richer API data, expands the article detail view component with conditional rendering based on user preferences, and includes smart source extraction that only processes visible content. The changelog properly documents these changes as version 1.1.0, and the README is updated with clearer feature descriptions. These enhancements transform the extension from a basic news reader into a customizable news consumption experience where users can control information density based on their interests.
PR Description Notes:
- The PR description is empty aside from the checklist, which doesn't explain what changes were made or their purpose
Important Files Changed
| Filename | Score | Overview |
|---|---|---|
| extensions/kagi-news/src/interfaces.ts | 5/5 | Expands TypeScript interfaces with new optional fields for richer article content display |
| extensions/kagi-news/src/views/ArticleDetail.tsx | 4/5 | Implements preference-driven conditional rendering for article sections with smart source extraction |
| extensions/kagi-news/package.json | 4/5 | Adds 10 new checkbox preferences for controlling article display sections |
| extensions/kagi-news/src/utils.ts | 5/5 | Updates article object creation to include new properties from expanded interface |
| extensions/kagi-news/CHANGELOG.md | 3/5 | Documents version 1.1.0 features but uses incorrect template format |
| extensions/kagi-news/README.md | 5/5 | Improves documentation with more specific feature descriptions and usage instructions |
| extensions/kagi-news/tsconfig.json | 5/5 | Minor formatting change removing trailing newline |
| extensions/kagi-news/eslint.config.js | 5/5 | Minor formatting change removing trailing newline |
| extensions/kagi-news/.gitignore | 5/5 | Minor formatting change removing trailing newline |
Confidence score: 4/5
- This PR is generally safe to merge with well-structured enhancements and proper TypeScript typing
- Score reflects the comprehensive changes that improve user experience while maintaining code quality, with minor issues in changelog formatting and some empty preference titles
- Pay close attention to the CHANGELOG.md file which uses incorrect template format and the package.json preferences that have empty title fields
9 files reviewed, 6 comments
| module.exports = defineConfig([ | ||
| ...raycastConfig, | ||
| ]); | ||
| ]); No newline at end of file |
There was a problem hiding this comment.
style: Missing trailing newline - most code formatters and POSIX standards expect files to end with a newline
| "title": "", | ||
| "label": "Show Talking Points", | ||
| "description": "Display key talking points from the article", | ||
| "default": true | ||
| }, | ||
| { | ||
| "name": "showSecondaryImage", | ||
| "type": "checkbox", | ||
| "required": false, | ||
| "title": "", | ||
| "label": "Show Secondary Image", | ||
| "description": "Display the secondary article image", | ||
| "default": false | ||
| }, | ||
| { | ||
| "name": "showPerspectives", | ||
| "type": "checkbox", | ||
| "required": false, | ||
| "title": "", | ||
| "label": "Show Perspectives", | ||
| "description": "Display different perspectives on the story", | ||
| "default": false | ||
| }, | ||
| { | ||
| "name": "showHistoricalBackground", | ||
| "type": "checkbox", | ||
| "required": false, | ||
| "title": "", | ||
| "label": "Show Historical Background", | ||
| "description": "Display historical context", | ||
| "default": false | ||
| }, | ||
| { | ||
| "name": "showTechnicalDetails", | ||
| "type": "checkbox", | ||
| "required": false, | ||
| "title": "", | ||
| "label": "Show Technical Details", | ||
| "description": "Display technical information", | ||
| "default": false | ||
| }, | ||
| { | ||
| "name": "showIndustryImpact", | ||
| "type": "checkbox", | ||
| "required": false, | ||
| "title": "", | ||
| "label": "Show Industry Impact", | ||
| "description": "Display industry-related impacts", | ||
| "default": false | ||
| }, | ||
| { | ||
| "name": "showTimeline", | ||
| "type": "checkbox", | ||
| "required": false, | ||
| "title": "", | ||
| "label": "Show Timeline", | ||
| "description": "Display timeline of events", | ||
| "default": false | ||
| }, | ||
| { | ||
| "name": "showInternationalReactions", | ||
| "type": "checkbox", | ||
| "required": false, | ||
| "title": "", | ||
| "label": "Show International Reactions", | ||
| "description": "Display reactions from international entities", | ||
| "default": false | ||
| }, | ||
| { | ||
| "name": "showDidYouKnow", | ||
| "type": "checkbox", | ||
| "required": false, | ||
| "title": "", | ||
| "label": "Show Did You Know", |
There was a problem hiding this comment.
style: Consider using title case for preference titles to group related settings. For example, use 'Content Display' or 'Article Sections' instead of empty strings for better organization in the preferences UI.
Context Used: Context from dashboard - Use the title case for titles in the preferences section of package.json files, e.g., 'Tab Width' in... (source)
There was a problem hiding this comment.
I did that on purpose to have only one section with all the checkboxes below it. Adding a title for each checkbox doesn't look good.
| let markdown = `# ${article.title}`; | ||
| let allVisibleText = ""; // Track all visible content for source extraction | ||
|
|
||
| const articleMetadata = article as Record<string, unknown>; |
There was a problem hiding this comment.
style: Type assertion bypasses TypeScript safety. Consider extending the Article interface to include these optional properties instead of casting to Record<string, unknown>
There was a problem hiding this comment.
The aim was to ensure that users do not miss sources listed in the additional sections they choose to display.
| const articleMetadata = article as Record<string, unknown>; | ||
|
|
||
| if (preferences.showPrimaryImage && articleMetadata.primary_image) { | ||
| const primaryImage = articleMetadata.primary_image as { url?: string; caption?: string }; |
There was a problem hiding this comment.
style: Type assertion without proper validation could cause runtime errors if primary_image structure differs from expectation
|
|
||
| # misc | ||
| .DS_Store | ||
| .DS_Store No newline at end of file |
There was a problem hiding this comment.
style: Missing trailing newline. Most text editors and Unix tools expect files to end with a newline character.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
@greptileai could you please check again? |
There was a problem hiding this comment.
Looking at the diff more carefully, I notice several improvements have been made to the kagi-news extension:
Main Changes:
-
New Display Preferences: Added 9 new checkbox preferences in
package.jsonto control visibility of different article sections (primary image, talking points, secondary image, perspectives, historical background, technical details, industry impact, timeline, international reactions, and did you know). -
Enhanced Article Structure: Updated
interfaces.tsto include new optional fields likeprimary_image,secondary_image,perspectives,historical_background,technical_details,industry_impact,timeline, andinternational_reactions. -
Smart Article Detail View: Completely rewrote
ArticleDetail.tsxto:- Respect user preferences for which sections to display
- Show primary image between title and summary
- Display secondary images with captions
- Include new sections like perspectives, timeline, etc.
- Smart source extraction: Only extract sources from visible content sections
-
Updated Documentation: Modified
README.mdandCHANGELOG.mdto reflect the new features.
Code Quality Issues:
The main issue I see is in the ArticleDetail.tsx file - there's some type casting that could be improved:
const articleMetadata = article as Record<string, unknown>;
// Later used as:
const primaryImage = articleMetadata.primary_image as { url?: string; caption?: string };This type casting approach works but isn't type-safe. Since you've already defined these properties in the Article interface, you could access them directly:
// Instead of casting, use the properly typed interface
if (preferences.showPrimaryImage && article.primary_image) {
const primaryImage = article.primary_image;
if (primaryImage.url) {
markdown += `\n\n`;
if (primaryImage.caption) {
markdown += `\n\n> *${primaryImage.caption}*`;
}
}
}
The changes look good overall - they add significant functionality while maintaining backwards compatibility through the optional nature of all new fields and preferences defaulting to sensible values.
…s instead of using metadata. Restore repository information in package.json.
|
Hi @mickaphd 👋 I updated the code to resolve the error, could you make sure I didn't break it? |
|
@greptileai can you do a new review? |
There was a problem hiding this comment.
Looking at this PR, I can see significant improvements to the Kagi News extension with new display section preferences and enhanced article detail views. Here's my review:
🎉 Great Improvements
Enhanced User Control: The addition of granular display section preferences is excellent - users can now customize which parts of articles they want to see (images, talking points, perspectives, etc.).
Smart Source Extraction: The logic to extract sources only from visible content is well-implemented and provides a better user experience.
Rich Content Support: Adding support for primary/secondary images, perspectives, timelines, and other structured data makes articles much more informative.
🔧 Code Quality Issues
File 4: extensions/kagi-news/eslint.config.js
const { defineConfig } = require("@eslint/config-array");
const raycastConfig = require("@raycast/eslint-config");
module.exports = defineConfig([
...raycastConfig,
]);
File 1: extensions/kagi-news/.gitignore
compiled_raycast_swift
compiled_raycast_rust
# misc
.DS_Store
File 13: extensions/kagi-news/tsconfig.json
{
"extends": "@raycast/eslint-config/tsconfig.json",
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"exactOptionalPropertyTypes": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": false,
"jsx": "react-jsx",
"resolveJsonModule": true
}
}
📦 Package.json Structure
The repository field placement change (moving it to the end) is fine, but consider keeping it in a consistent location for better maintainability.
🎨 UI/UX Considerations
Preferences Organization: The display section preferences are well-structured, but consider grouping related options (e.g., "Images", "Content Sections", "Additional Information") for better UX.
Default Values: Good choice making primary image, talking points, and "Did You Know" sections default to true while keeping advanced sections like technical details and industry impact as false by default.
🧪 Testing Recommendations
-
Empty Content Handling: Ensure the app gracefully handles cases where optional sections are enabled but the API doesn't return data for them.
-
Image Loading: Test behavior when image URLs are invalid or fail to load.
-
Performance: With more content sections, verify that articles with many enabled sections still render smoothly.
📖 Documentation
The README updates are good but could be more specific about the new customization features. Consider adding a section about the display preferences.
Overall Assessment
This is a solid enhancement that significantly improves the extension's functionality and user experience. The code is well-structured and the new features are implemented thoughtfully. Just address the minor formatting issues and this will be ready to merge! ✅
mickaphd
left a comment
There was a problem hiding this comment.
Thanks a lot, @pernielsentikaer. Everything looks good to me; nothing seems broken.
You can merge it! Have a nice weekend.
Cheers,
M
pernielsentikaer
left a comment
There was a problem hiding this comment.
Looks good to me, approved 🔥
|
Published to the Raycast Store: |
|
🎉 🎉 🎉 We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag. |

Description
Screencast
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare placed outside of themetadatafolder