Skip to content

refresh#502

Open
joaquintous wants to merge 7 commits intoFirebaseExtended:mainfrom
joaquintous:main
Open

refresh#502
joaquintous wants to merge 7 commits intoFirebaseExtended:mainfrom
joaquintous:main

Conversation

@joaquintous
Copy link

No description provided.

@google-cla
Copy link

google-cla bot commented Feb 19, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link

Summary of Changes

Hello @joaquintous, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes a new AI-powered content generation application designed to streamline WordPress content creation. It integrates Google AI's Genkit for diverse content tasks, leverages Next.js for a modern frontend, and uses Firebase for secure user authentication and data persistence. The application provides a user-friendly experience for generating, refining, and publishing content directly to WordPress.

Highlights

  • AI Content Generation Flows: Introduced three core AI flows using Genkit: generating content from user comments, analyzing photos for content suggestions, and improving existing blog posts based on a desired style.
  • Next.js Application Setup: Established a new Next.js application structure, including global styling, root layout with Firebase integration, and an admin page placeholder.
  • Firebase Integration: Implemented client-side Firebase authentication, Firestore data management (for user history and connections), and a robust error listening mechanism for permission issues.
  • WordPress Connectivity: Developed server actions and UI components to search for existing WordPress posts, load them for improvement, and publish newly generated or improved content directly to a WordPress site using application passwords.
  • User Interface & Experience: Created a comprehensive user interface with content generation forms, a content preview editor, a history dialog to track user activity, and internationalization support for English and Spanish.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • next.config.ts
    • Configured Next.js for image optimization and ignored TypeScript/ESLint build errors.
  • src/ai/dev.ts
    • Initialized AI flows for content analysis, improvement, and generation.
  • src/ai/flows/analyze-photo-for-content-suggestions.ts
    • Added an AI flow to analyze photos and suggest content ideas.
  • src/ai/flows/generate-content-from-comment.ts
    • Added an AI flow to generate WordPress content from user comments.
  • src/ai/flows/improve-existing-post.ts
    • Added an AI flow to rewrite existing blog posts based on a desired style.
  • src/ai/genkit.ts
    • Configured Genkit with Google AI's Gemini model.
  • src/app/admin/layout.tsx
    • Added a basic layout for the admin page.
  • src/app/admin/page.tsx
    • Created a placeholder admin page with user management guidance.
  • src/app/globals.css
    • Defined global Tailwind CSS styles and custom CSS variables for theming.
  • src/app/layout.tsx
    • Configured the root layout with Firebase client provider and a Toaster component.
  • src/app/page.tsx
    • Implemented the main application page with content generation, preview, user authentication, and history.
  • src/components/FirebaseErrorListener.tsx
    • Added a component to listen for and display Firebase permission errors.
  • src/components/content-generator.tsx
    • Developed the component for generating content from comments, photos, or by improving existing posts, including WordPress search functionality.
  • src/components/content-preview.tsx
    • Created the component to preview and publish generated content to WordPress.
  • src/components/history-dialog.tsx
    • Implemented a dialog to display user activity history.
  • src/components/icons.tsx
    • Defined custom SVG icons, including a logo.
  • src/components/ui/accordion.tsx
    • Added Shadcn UI Accordion component.
  • src/components/ui/alert-dialog.tsx
    • Added Shadcn UI Alert Dialog component.
  • src/components/ui/alert.tsx
    • Added Shadcn UI Alert component.
  • src/components/ui/avatar.tsx
    • Added Shadcn UI Avatar component.
  • src/components/ui/badge.tsx
    • Added Shadcn UI Badge component.
  • src/components/ui/button.tsx
    • Added Shadcn UI Button component.
  • src/components/ui/calendar.tsx
    • Added Shadcn UI Calendar component.
  • src/components/ui/card.tsx
    • Added Shadcn UI Card component.
  • src/components/ui/carousel.tsx
    • Added Shadcn UI Carousel component.
  • src/components/ui/checkbox.tsx
    • Added Shadcn UI Checkbox component.
  • src/components/ui/collapsible.tsx
    • Added Shadcn UI Collapsible component.
  • src/components/ui/dialog.tsx
    • Added Shadcn UI Dialog component.
  • src/components/ui/dropdown-menu.tsx
    • Added Shadcn UI Dropdown Menu component.
  • src/components/ui/form.tsx
    • Added Shadcn UI Form component.
  • src/components/ui/input.tsx
    • Added Shadcn UI Input component.
  • src/components/ui/label.tsx
    • Added Shadcn UI Label component.
  • src/components/ui/menubar.tsx
    • Added Shadcn UI Menubar component.
  • src/components/ui/popover.tsx
    • Added Shadcn UI Popover component.
  • src/components/ui/progress.tsx
    • Added Shadcn UI Progress component.
  • src/components/ui/radio-group.tsx
    • Added Shadcn UI Radio Group component.
  • src/components/ui/scroll-area.tsx
    • Added Shadcn UI Scroll Area component.
  • src/components/ui/select.tsx
    • Added Shadcn UI Select component.
  • src/components/ui/separator.tsx
    • Added Shadcn UI Separator component.
  • src/components/ui/sheet.tsx
    • Added Shadcn UI Sheet component.
  • src/components/ui/sidebar.tsx
    • Added Shadcn UI Sidebar component.
  • src/components/ui/skeleton.tsx
    • Added Shadcn UI Skeleton component.
  • src/components/ui/slider.tsx
    • Added Shadcn UI Slider component.
  • src/components/ui/switch.tsx
    • Added Shadcn UI Switch component.
  • src/components/ui/table.tsx
    • Added Shadcn UI Table component.
  • src/components/ui/tabs.tsx
    • Added Shadcn UI Tabs component.
  • src/components/ui/textarea.tsx
    • Added Shadcn UI Textarea component.
  • src/components/ui/toast.tsx
    • Added Shadcn UI Toast component.
  • src/components/ui/toaster.tsx
    • Added Shadcn UI Toaster component.
  • src/components/ui/tooltip.tsx
    • Added Shadcn UI Tooltip component.
  • src/firebase/auth/use-user.tsx
    • Implemented a custom hook for Firebase user authentication state.
  • src/firebase/client-provider.tsx
    • Created a client-side Firebase provider with i18n and error handling.
  • src/firebase/config.ts
    • Configured Firebase with environment variables.
  • src/firebase/error-emitter.ts
    • Implemented an event emitter for Firebase permission errors.
  • src/firebase/errors.ts
    • Defined custom error classes for Firebase.
  • src/firebase/firestore/use-collection.tsx
    • Implemented a custom hook for fetching Firestore collections.
  • src/firebase/firestore/use-doc.tsx
    • Implemented a custom hook for fetching Firestore documents.
  • src/firebase/index.ts
    • Exported Firebase initialization and hooks.
  • src/firebase/provider.tsx
    • Created a React context provider for Firebase instances.
  • src/hooks/use-memo-firebase.ts
    • Added a custom hook for memoizing Firebase queries with dependency warnings.
  • src/hooks/use-mobile.tsx
    • Implemented a custom hook to detect mobile screen size.
  • src/hooks/use-toast.ts
    • Implemented a custom hook for toast notifications.
  • src/lib/actions.ts
    • Defined server actions for AI content generation and WordPress publishing/searching.
  • src/lib/connections.ts
    • Added utility functions for managing WordPress connections in Firestore.
  • src/lib/history.ts
    • Added utility functions for logging user activity history in Firestore.
  • src/lib/placeholder-images.json
    • Added a JSON file for placeholder image data.
  • src/lib/placeholder-images.ts
    • Defined types and exported placeholder image data.
  • src/lib/types.ts
    • Defined shared TypeScript types for the application.
  • src/lib/utils.ts
    • Added utility functions, including 'cn' for Tailwind CSS class merging.
Activity
  • All files in this pull request are newly added, indicating a foundational setup or a significant new feature implementation.
  • The pull request title 'refresh' and empty description suggest this is a comprehensive update or a re-initialization of the project structure.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant number of new features and files, effectively building out a new application for AI-powered WordPress content generation. The changes include setting up Next.js configuration, defining AI flows with Genkit, adding a comprehensive set of UI components, and integrating with Firebase for authentication and data storage. My review focuses on several critical and high-severity issues related to security, build configuration, and code correctness. I've identified potential XSS vulnerabilities, unsafe build configurations that could hide errors, and risky AI safety settings. Addressing these points will greatly improve the application's robustness and security.

Comment on lines +4 to +9
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},

Choose a reason for hiding this comment

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

critical

Disabling TypeScript and ESLint checks during the build process is highly discouraged for production applications. This can lead to deploying code with type errors or linting issues, which can cause runtime errors and make the codebase harder to maintain. It's recommended to enable these checks to ensure code quality and stability.

Suggested change
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: false,
},
eslint: {
ignoreDuringBuilds: false,
},

},
async input => {
const {output} = await prompt(input);
return output!;

Choose a reason for hiding this comment

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

high

Using a non-null assertion (!) on the output from the AI prompt is unsafe. If the AI model fails to return an output for any reason (e.g., content filtering, network issues), this will cause a runtime crash. It's better to handle this case gracefully by checking if output is defined and throwing a descriptive error if it's not. This pattern is repeated in other flow files (generate-content-from-comment.ts, improve-existing-post.ts) and should be addressed there as well.

    if (!output) {
      throw new Error('Failed to get a response from the AI model.');
    }
    return output;

Comment on lines +51 to +54
{
category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
threshold: 'BLOCK_NONE',
},

Choose a reason for hiding this comment

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

high

The safety setting for HARM_CATEGORY_DANGEROUS_CONTENT is set to BLOCK_NONE, which means the AI could potentially generate content that is dangerous or promotes harmful acts. This is a significant security risk. Unless there is a specific reason to allow this type of content, it's highly recommended to set a more restrictive threshold, such as BLOCK_MEDIUM_AND_ABOVE. This same configuration is present in src/ai/flows/improve-existing-post.ts and should also be reviewed.

Comment on lines +378 to +379
<p className="font-semibold" dangerouslySetInnerHTML={{ __html: post.title.rendered }} />
<p className="text-sm text-muted-foreground" dangerouslySetInnerHTML={{ __html: post.excerpt.rendered }} />

Choose a reason for hiding this comment

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

high

Using dangerouslySetInnerHTML with content fetched from an external API, even if it's the user's own WordPress site, introduces a Cross-Site Scripting (XSS) vulnerability. Malicious content saved in a post's title or excerpt could be executed in the browser. It is strongly recommended to sanitize this HTML content before rendering it. A library like dompurify can be used for this purpose.

Example with dompurify:

import DOMPurify from 'dompurify';

// Inside your component
const cleanTitle = DOMPurify.sanitize(post.title.rendered);
const cleanExcerpt = DOMPurify.sanitize(post.excerpt.rendered);

// Then render it
<p className="font-semibold" dangerouslySetInnerHTML={{ __html: cleanTitle }} />
<p className="text-sm text-muted-foreground" dangerouslySetInnerHTML={{ __html: cleanExcerpt }} />

Copy link
Author

@joaquintous joaquintous left a comment

Choose a reason for hiding this comment

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

q

Copy link
Author

@joaquintous joaquintous left a comment

Choose a reason for hiding this comment

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

d

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

Comments