docs: add comprehensive cursor guidelines and rules for development practices#8401
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis update introduces a comprehensive set of documentation and rule files for backend, frontend, documentation, icons, component structure, and testing development practices within the Langflow project. The new and revised documents provide detailed guidelines, directory structures, conventions, code quality practices, and checklists to standardize and streamline development and testing workflows across the codebase. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant Documentation
participant Backend
participant Frontend
participant Testing
Developer->>Documentation: Consults docs_development.mdc for writing docs
Developer->>Backend: Follows backend_development.mdc for backend changes
Developer->>Frontend: Follows frontend_development.mdc for frontend changes
Developer->>Backend: Implements/tests components per basic_component.mdc
Developer->>Frontend: Adds/updates icons per icons.mdc
Developer->>Testing: Writes/tests code as per testing.mdc
Testing->>Backend: Runs backend/unit/integration tests
Testing->>Frontend: Runs frontend/component tests
Developer->>Documentation: Updates docs per changes and guidelines
Suggested labels
Suggested reviewers
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 3
🔭 Outside diff range comments (3)
.cursor/rules/components/basic_component.mdc (2)
35-48: 🛠️ Refactor suggestionComplete the component example or provide a working implementation.
The example shows placeholder comments instead of actual implementation, which could confuse developers trying to follow the guide.
Consider providing a complete working example:
class ConditionalRouterComponent(Component): display_name = "If-Else" description = "Routes an input message to a corresponding output based on text comparison." icon = "split" name = "ConditionalRouter" inputs = [ - # Define your inputs here + MessageTextInput( + name="message", + display_name="Input Message", + info="The message to route based on condition", + ), + StrInput( + name="condition_text", + display_name="Condition Text", + info="Text to compare against for routing decision", + ), ] outputs = [ - # Define your outputs here + Output(display_name="True Output", name="true_output", method="true_response"), + Output(display_name="False Output", name="false_output", method="false_response"), ] - # Implement your logic methods here + + def true_response(self) -> Message: + return Message(text=f"Condition met: {self.message}") + + def false_response(self) -> Message: + return Message(text=f"Condition not met: {self.message}")
52-65: 🛠️ Refactor suggestionComplete the CurrentDate component example.
Similar to the previous example, this shows placeholders instead of a working implementation.
class CurrentDateComponent(Component): display_name = "Current Date" description = "Returns the current date and time in the selected timezone." icon = "clock" name = "CurrentDate" inputs = [ - # Define your inputs here + DropdownInput( + name="timezone", + display_name="Timezone", + options=["UTC", "US/Eastern", "US/Pacific", "Europe/London"], + value="UTC", + info="Select the timezone for the current date/time", + ), ] outputs = [ - # Define your outputs here + Output(display_name="Current Date", name="current_date", method="get_current_date"), ] - # Implement your logic methods here + + def get_current_date(self) -> Message: + from datetime import datetime + import pytz + tz = pytz.timezone(self.timezone) + current_time = datetime.now(tz) + return Message(text=current_time.strftime("%Y-%m-%d %H:%M:%S %Z")).cursor/rules/backend_development.mdc (1)
269-269:⚠️ Potential issueComplete the final checklist item.
The last line appears to be cut off mid-sentence.
-- [ ] External API calls use appropriate pytest markers +- [ ] External API calls use appropriate pytest markers +- [ ] Documentation updated for new components or API changesOr if the line was intended to be longer, please complete the thought about external API calls.
🧹 Nitpick comments (4)
.cursor/rules/components/basic_component.mdc (1)
73-73: Fix the file path reference.The path reference has an incorrect format.
-- Use a Lucide icon or if you want a custom icon follow the icon rules (`./cursor/rules/icons.mdc`) +- Use a Lucide icon or if you want a custom icon follow the icon rules (`.cursor/rules/icons.mdc`).cursor/rules/testing.mdc (2)
3-9: Glob patterns may not work as intended on all runnersThe brace‐expansion syntax (
*.test.{ts,tsx,js,jsx}) is Bash-style, but many Python glob implementations (e.g.pathlib,glob) do not support it. If these rules are consumed by tooling that relies on pure Python globbing you may silently miss files.
Consider splitting the patterns or using multiple explicit entries:- - "src/frontend/**/*.test.{ts,tsx,js,jsx}" - - "src/frontend/**/*.spec.{ts,tsx,js,jsx}" + - "src/frontend/**/*.test.ts" + - "src/frontend/**/*.test.tsx" + - "src/frontend/**/*.test.js" + - "src/frontend/**/*.test.jsx" + - "src/frontend/**/*.spec.ts" + - "src/frontend/**/*.spec.tsx" + - "src/frontend/**/*.spec.js" + - "src/frontend/**/*.spec.jsx"
118-123: Mention thepytest-asynciodependency explicitlyAll async examples rely on
@pytest.mark.asyncio, but the guidelines never state thatpytest-asyncio(or equivalent) must be installed and enabled.
Add an explicit note in section 4. Async Testing Patterns to prevent new contributors from encountering “asyncio marker not found” errors..cursor/rules/frontend_development.mdc (1)
74-84: Undefined helperstringToBoolThe icon example uses
stringToBoolbut neither imports nor defines it. Newcomers copying this snippet will run into runtime errors.
Add a short util snippet or replace with a simple boolean cast:- fill={stringToBool(props.isdark) ? "#ffffff" : "#0A0A0A"} + fill={props.isdark === 'true' ? "#ffffff" : "#0A0A0A"}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.cursor/rules/backend_development.mdc(1 hunks).cursor/rules/components/basic_component.mdc(1 hunks).cursor/rules/docs_development.mdc(1 hunks).cursor/rules/frontend_development.mdc(1 hunks).cursor/rules/icons.mdc(5 hunks).cursor/rules/testing.mdc(1 hunks)
🔇 Additional comments (7)
.cursor/rules/icons.mdc (1)
1-137: Excellent comprehensive icon guidelines.This documentation provides thorough coverage of icon implementation across both backend and frontend with clear examples, proper file organization, and a useful checklist. The integration between backend Python components and frontend React implementation is well-explained.
.cursor/rules/docs_development.mdc (1)
14-441: Comprehensive documentation guidelines with excellent structure.This document provides thorough coverage of documentation development including environment setup, content structure, writing conventions, API documentation templates, and deployment processes. The examples and templates are well-crafted and will be very helpful for maintainers.
.cursor/rules/backend_development.mdc (3)
82-103: Excellent emphasis on formatting workflow.The strong emphasis on running
make format_backendearly and often is excellent advice that will save developers significant time. This proactive approach to code quality is a best practice.
156-211: Comprehensive async development patterns.The async patterns section provides excellent examples of proper async/await usage, background task management, and queue operations with appropriate error handling. This will help prevent common async pitfalls.
13-268: Comprehensive backend development guidelines.This document provides excellent coverage of backend development practices including environment setup, component structure, code quality workflows, API development, database patterns, and async programming. The practical examples and testing patterns are particularly valuable.
.cursor/rules/testing.mdc (1)
154-162: Marker name inconsistencyYou introduce a
no_blockbustermarker here, while the earlier fixture section referencesnoclient. Double-check naming conventions (no_blockbustervsno_blockbuster**?**,noclientvsno_client) and document them inpytest.inito avoid confusion..cursor/rules/frontend_development.mdc (1)
24-26: Node.js version is not yet LTSNode 22 will not enter LTS until late 2025; current LTS is 20.x. Requiring 22.12 may force contributors onto a non-LTS toolchain and break CI images.
Recommend downgrading to the current Active LTS (20.x) or clarifying that 22 is only tested, not required.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
.cursor/rules/docs_development.mdc (2)
121-121: Fix the image path placeholder (duplicate issue).This image path still contains the template placeholder that was flagged in previous reviews.
- +
124-124: Fix the second image path placeholder (duplicate issue).This image path also contains the template placeholder that was flagged in previous reviews.
- +
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.cursor/rules/docs_development.mdc(1 hunks)
🧰 Additional context used
🪛 Gitleaks (8.26.0)
.cursor/rules/docs_development.mdc
238-239: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🔇 Additional comments (6)
.cursor/rules/docs_development.mdc (6)
1-11: LGTM! Well-structured documentation configuration.The YAML frontmatter is properly configured with appropriate glob patterns covering all relevant documentation file types and a clear description.
132-183: Excellent component documentation template.The component documentation template is comprehensive and well-structured, covering all essential aspects including configuration, inputs/outputs, usage examples, and common issues. This will help ensure consistent documentation across all components.
238-239: Security scanner false positive - documentation placeholder.The static analysis tool flagged this curl example as a potential security issue, but this is clearly a documentation placeholder ("your-token") meant to be replaced by users with their actual tokens.
This is a false positive from the security scanner. The "Bearer your-token" is clearly a placeholder in documentation examples, not an actual exposed token.
🧰 Tools
🪛 Gitleaks (8.26.0)
238-239: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
306-331: Well-designed sidebar configuration example.The sidebar configuration demonstrates proper hierarchical organization with clear categories and logical grouping of documentation sections.
394-412: Comprehensive and clear style guide.The style guide provides excellent guidelines for tone, formatting, and terminology that will ensure consistent documentation quality across the project.
430-441: Thorough development checklist.The checklist covers all critical aspects of documentation development from local setup to deployment verification, ensuring quality and completeness.
mfortman11
left a comment
There was a problem hiding this comment.
Great stuff Gabriel!
… outdated icon development instructions, and update checklist for clarity and consistency.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
.cursor/rules/frontend_development.mdc (1)
169-183: Missing type imports cause TS compile errors
NodeChangeandEdgeChangeare referenced in the props but not imported fromreactflow.
🧹 Nitpick comments (2)
.cursor/rules/frontend_development.mdc (2)
370-374: Remove duplicated checklist items.The checklist contains duplicate items that should be removed for clarity:
- "Components styled with Tailwind CSS" (appears on lines 364 and 370)
- "Dark mode support implemented where needed" (appears on lines 365 and 371)
- "Code formatted with
make format_frontend" (appears on lines 366 and 372)- "Changes tested in both light and dark mode" (appears on lines 368 and 373)
-- [ ] Components styled with Tailwind CSS -- [ ] Dark mode support implemented where needed -- [ ] Code formatted with `make format_frontend` -- [ ] Changes tested in both light and dark mode -
220-235: Consider using Lucide React icons for consistency.The ComponentNode example uses an
imgtag for icons, but the tech stack mentions Lucide React. For consistency, consider using Lucide React components:+import { Icon } from 'lucide-react'; + export const ComponentNode = memo(({ data }: ComponentNodeProps) => { return ( <div className="px-4 py-2 shadow-md rounded-md bg-white border"> <Handle type="target" position={Position.Top} /> <div className="flex items-center"> - {data.icon && ( - <img src={data.icon} alt="" className="w-4 h-4 mr-2" /> - )} + {data.icon && <Icon name={data.icon} className="w-4 h-4 mr-2" />} <span className="text-sm">{data.label}</span> </div>
…ractices (langflow-ai#8401) * Update cursor rules with specific backend, frontend, docs * Update image example Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * update image example Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refactor frontend development guidelines: streamline sections, remove outdated icon development instructions, and update checklist for clarity and consistency. --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary by CodeRabbit