AI Coding Tools | Cursor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • harrytruman
    Senior Member
    • Jun 2023
    • 106

    AI Coding Tools | Cursor

    Hi everyone, just came across this fascinating video (by a computer scientist and one of the co-founders of OpenAI) of use cases for AI: https://youtu.be/EWvNQjAaOHw?si=kXOX_dBL0afieTti&t=4140

    I'm going to listen to the whole thing this weekend but the link above takes you directly to the segment where he covers AI coding editors. As a coding novice I was amazed as he quickly created a basic game program in Cursor using only natural language commands. Pricing | Cursor - The AI Code Editor

    I'd love to hear from the Espo community about your experiences with these tools. What has worked and what hasn't. Any tips or suggestions on the most effective ways to use these tools.

    Thanks everyone!

  • harrytruman
    Senior Member
    • Jun 2023
    • 106

    #2
    Hi everyone, I've been experimenting with using Cursor and Gemini 2.5 Pro to update and debug the code for the old collapsable comments extension and make it compatible with current version of espocrm. Here's the related thread: Record Comments Extension- Collapsible Comment Threads- Notifications needed - EspoCRM Open Source Community Forum

    I've attached the latest version in case any of you would like to take a look.

    Here's my process so far:

    -Use the original code from here mozkomor05/espocrm-comments-extension: Comments extension make it possible to add collapsable comment threads to any entity.
    -Create a text file of the code base from github using this tool: Local Directory or Repo to Plain Text Converter | Convert Local Directories to Text
    -Paste the text file of code into Gemini 2.5 (Gemini is the only AI tool I'm aware of that can handle large amounts of code for context) and ask it to use this code as context for the chat: https://aistudio.google.com/
    -Ask Gemini to create a step by step plan to edit this code and build a new extension package with all folders and files
    -Copy that step by step plan into Cursor and ask it to build this new extension step by step, including a zip file for download at the end

    When I try to install this new zip extension, this is the error message I get in espocrm:

    Error 500
    Permission denied:
    application/Espo/Modules/ThreadedComments/Classes/Acl/Comment/AccessChecker.php
    application/Espo/Modules/ThreadedComments/Controllers
    application/Espo/Modules/ThreadedComments/Entities/Comment.php
    application/Espo/Modules/ThreadedComments/Repositories/Comment.php
    application/Espo/Modules/ThreadedComments/Resources/i18n/en_US
    application/Espo/Modules/ThreadedComments/Resources/layouts/Comment
    application/Espo/Modules/ThreadedComments/Resources/metadata/aclDefs/Comment.json
    application/Espo/Modules/ThreadedComments/Resources/metadata/app
    application/Espo/Modules/ThreadedComments/Resources/metadata/clientDefs/Comment.json
    application/Espo/Modules/ThreadedComments/Resources/metadata/entityDefs/Comment.json
    application/Espo/Modules/ThreadedComments/Resources/metadata/scopes/Comment.json
    application/Espo/Modules/ThreadedComments/Resources
    application/Espo/Modules/ThreadedComments/Services/Comment.php
    client/modules/threaded-comments/css/main.css
    client/modules/threaded-comments/res/templates/comments/comment.tpl
    client/modules/threaded-comments/src/extensions/views/admin/entity-manager/edit.js
    client/modules/threaded-comments/src/extensions/views/record/detail-bottom.js
    client/modules/threaded-comments/src


    Then I go back to my chat thread in Gemini, paste this error message for context and ask it for solutions. Here is what it says:

    Okay, let's break down this error.

    What the Error Means:
    • Error 500: This is a generic "Internal Server Error". It means something went wrong on the server-side while processing the request (in this case, the extension installation), but the server isn't configured to give you a more specific error message directly in the browser. The real error details are usually in the server logs.
    • Permission denied: This is the critical part of the message. The web server process (the user account that runs Apache, Nginx, or PHP-FPM, often named www-data, apache, nginx, nobody) tried to perform an operation (almost certainly writing files or creating directories) in the locations listed, but the operating system's file permissions prevented it.
    • The File List: This list shows exactly which files and directories the installation process was trying to create or write into when it was blocked. These paths are relative to the EspoCRM root directory after the files/ directory from your extension zip is unpacked.

    In short: The user account your web server runs as does not have the necessary permissions to write files into your main EspoCRM installation directory (specifically within application/Espo/Modules/ and client/modules/).

    Why it Happens During Installation:

    When you install an EspoCRM extension, the system does the following:
    1. Unpacks the ZIP archive into a temporary location.
    2. Copies the contents of the files/ directory from the archive into the corresponding locations within your live EspoCRM installation (e.g., files/application/Espo/Modules/ThreadedComments/Entities/Comment.php gets copied to /path/to/espocrm/application/Espo/Modules/ThreadedComments/Entities/Comment.php).
    3. Runs any installation scripts (scripts/AfterInstall.php, etc.).
    4. Updates metadata and potentially rebuilds caches.

    The "Permission denied" error occurs during step 2 because the web server doesn't have the authority to create the ThreadedComments directories or the files within them inside the main EspoCRM application and client directories.

    How to Fix It:

    You need to adjust the file permissions on your EspoCRM server. The goal is to allow the web server user to write to the necessary directories.




    There is much more included in the suggested fix but this starts to get over my head. I would love to hear some ideas from the team! Thanks everyone!

    ​​
    Attached Files

    Comment

    • harrytruman
      Senior Member
      • Jun 2023
      • 106

      #3
      By the way, I also pasted the code base for the real estate extension (as a working reference) and asked Gemini what's different about this extension from the updated comments extension I've been working on. Here's the answer from Gemini:

      Let's analyze the key differences between the working "Real Estate" extension structure and the proposed "ThreadedComments" structure, specifically in relation to the "Permission Denied" error.

      Key Differences & Why Real Estate Might Install Successfully:
      1. No Backend Code (application directory):
        • Real Estate: The provided structure only has files under files/client/custom/modules/real-estate/. There is no files/application/ directory. This implies the Real Estate extension might primarily be frontend modifications or uses backend code that was already part of EspoCRM or another extension, configured via metadata (which isn't shown).
        • ThreadedComments: Your plan includes a full backend implementation with Entities, Services, Controllers, etc., placed within files/application/Espo/Modules/ThreadedComments/.
        • Impact on Error: The "Permission Denied" error explicitly lists many paths starting with application/Espo/Modules/ThreadedComments/. Since the Real Estate extension (as shown) doesn't try to write anything into the core application directory, it avoids triggering permission errors there.
      2. Frontend File Location (client/custom vs client/modules):
        • Real Estate: Places its frontend JavaScript files into files/client/custom/modules/real-estate/. When installed, these files are copied to /var/www/html/client/custom/modules/real-estate/. EspoCRM is generally designed to allow writing to the custom/ directory structure.
        • ThreadedComments: Your plan places frontend files into files/client/modules/threaded-comments/. When installed, these are intended to be copied to /var/www/html/client/modules/threaded-comments/. The error log confirms it tries to write here (client/modules/threaded-comments/css/main.css, client/modules/threaded-comments/src/...).
        • Impact on Error: While EspoCRM often needs write access to client/ during rebuilds/upgrades anyway, placing files directly into client/modules/ might face stricter default permissions than client/custom/. The error clearly shows permission issues writing into client/modules/threaded-comments/. The Real Estate extension avoids this specific path by using client/custom/modules/.

      What This Means for Fixing Your 500 Error:

      The Real Estate extension example highlights where the permission issues are occurring for your ThreadedComments extension, but its structure doesn't inherently fix the underlying server permission problem.
      • The Real Estate extension works likely because:
        • It doesn't need to write to the core application/Espo/Modules/ directory.
        • It writes its client files to the client/custom/ directory, which might already have the correct write permissions for the web server user on your specific server setup, or it requires permissions that are more commonly set correctly than those for client/modules/.
      • Your ThreadedComments extension needs to write to both:
        • /var/www/html/application/Espo/Modules/ThreadedComments/ (for backend PHP code).
        • /var/www/html/client/modules/threaded-comments/ (for frontend JS/CSS/templates).

      Conclusion & Fix:

      The difference doesn't suggest a fundamental flaw in your ThreadedComments structure plan (placing module code in application/Espo/Modules/ and client/modules/ is standard for new, self-contained modules). The difference simply explains why the Real Estate example might not hit the exact same permission roadblocks.

      The fix remains the same: You must configure the file permissions correctly on your server (/var/www/html/). The web server user (e.g., www-data) needs write access to create directories and files within both the application/Espo/Modules/ path and the client/modules/ path during installation.

      Refer back to the steps in the previous answer for adjusting chown and chmod on your /var/www/html directory. That is the necessary solution to allow your ThreadedComments extension, structured as planned, to install

      Comment

      • shalmaxb
        Senior Member
        • Mar 2015
        • 1661

        #4
        Thank you for your thorough post. I will have a look into it later.
        My experiences to create extensions with AI did all fail so far. I used copilot and ChatGTP. Thes AI understood, what I wanted, the code did not look bad but so far nothing worked. Sometimes the AI is very convinced to do everything in the correct way, but as soon as I put in my knowledge it steps back, apologizes and offers a different solution. But without success as well.
        I will go on trying, but I guess it will be a long way for AI to substitute developers.
        By the way: My daughter, who is a coming software engineer, made the same experience, when she had to revise code, which another student created with AI.AI still makes many errors.

        Comment


        • harrytruman
          harrytruman commented
          Editing a comment
          Hi shalmaxb, thanks for the feedback. I agree, these tools are getting better every day, but they still come up short. I'm also experimenting with other prototype projects created in AI but as the codebase and complexity grows, the AI agent starts to make more mistakes. I think this is due to two primary issues: 1). Limitations of these AI agents and 2). The inability of most AI agents to use the entire codebase as context for edits and de-bugging.

          I keep coming back to EspoCRM because it's so well built and comprehensive. I've even tried uploading the EspoCRM codebase and asking the AI agent to create a similar project based on react, supabase, etc. just to see what it can do. It doesn't even come close.
      • shalmaxb
        Senior Member
        • Mar 2015
        • 1661

        #5
        I installed right now and get the RROR 500 as well, but the reason is:

        PHP Code:
        [2025-04-29 13:14:53ERROR: (30Failed to rebuild database schemaThere is no column with name "created_at" on table "comment".; 

        Comment

        Working...