The Config Chef (AI Recipe Generator) is a module designed to accelerate site building by utilizing Artificial Intelligence to generate Drupal Recipes dynamically. Aligned perfectly with the Starshot initiative, it integrates with the Drupal AI ecosystem to translate natural language prompts into functional, schema-compliant Drupal Recipe YAML files.

Key features

  • Natural Language to Recipe: Generates complete configuration scaffolding from plain English prompts.
  • Intelligent Recipe Editor: A built-in GUI to manually edit, verify, and auto-correct schema errors in generated recipes.
  • "Explain" Functionality: Breaks down generated configurations to help users learn the underlying Drupal architecture.
  • LLM Arena: Allows side-by-side performance comparisons of different AI models to see which generates better code.
  • Benchmarking: Tracks and visualizes analytics such as generation success rates, token costs, and average latency.
  • Context Awareness: Feeds active site context to the AI to prevent redundant field generation.

Differences from similar projects

While standard Drupal site-building and boilerplate tools exist (such as Module Builder), this project uniquely leverages generative LLMs combined with the new Drupal Recipe API. Instead of manually clicking through the UI or writing complex YAML arrays from scratch, users can architect configurations via conversational prompts.

Project link

https://www.drupal.org/project/ai_recipe_generator

Comments

hrishikesh-dalal created an issue. See original summary.

vishal.kadam’s picture

Issue summary: View changes
avpaderno’s picture

Issue summary: View changes

Thank you for applying!

Before giving links helpful to understand how the review process works, what to expect from a review, and what to do to avoid a review takes more time than needed, I would like to thank all the reviewers for the work they do.
These applications are volunters-driven, which also means it is not possible to predict when an application will be marked fixed and the applicant will get the permission to opt projects into security advisory policy. While we aim to make an application as quick as possible, it is also important for us that more people review the project used for an application. In this way, we make sure applications do not miss some important points that should be instead reported.
Applications are not meant to be complete debugging sessions that eliminate every existing bug, though. I apologize if sometimes applications seem to go into too-detailed reviews.

Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.

The important notes are the following.

  • If you have not done it yet, you should enable GitLab CI for the project and fix the PHP_CodeSniffer errors/warnings it reports.
  • For the time this application is open, only your commits are allowed.
  • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status will not be changed by this application; once this application is closed, you will be able to change the project status from Not covered to Opt into security advisory coverage. This is possible only 14 days after the project is created.

    Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
  • Only the person who created the application will get the permission to opt projects into security advisory coverage. No other person will get the same permission from the same application; that applies also to co-maintainers/maintainers of the project used for the application.
  • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

To the reviewers

Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.

The important notes are the following.

  • It is preferable to wait for a project moderator before posting the first comment on newly created applications. Project moderators will do some preliminary checks that are necessary before any change on the project files is suggested.
  • Reviewers should show the output of a CLI tool only once per application.
  • It may be best to have the applicant fix things before further review.

For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.

avpaderno’s picture

Status: Needs review » Needs work

Projects hosted on drupal.org are licensed under GPLv2+, the same license used from Drupal core.

If you are licensing a project under a different license, it cannot he hosted on drupal.org. More details are given in Drupal Git Contributor Agreement & Repository Usage Policy.

All code that is a derivative work of Drupal (typically PHP code, including but not limited to: core patches, modules, themes, etc) committed to Drupal.org's git repository is licensed as GPL version 2.0 and later (official short identifier: “GPL-2.0-or-later”). This means that the code is licensed under GPLv2, and there exists an option that allows downstream recipients to re-license the code to be under a later version of GPL.

For code licensed under GPLv3, see See I want to release my work under GPL version 3 or under GPL version 2-only. Can I do so and host it on Drupal.org?

No. You can release your work under any GPL version 2 or later compatible license. However, you may only check it into Drupal's Git repositories if you are releasing it under the same license as Drupal itself, that is GPL version 2 or later, allowing users to choose between the terms of the GPL version 2 or the terms in any new versions as updated by the FSF. If you are unable or unwilling to do so, do not check it into a Drupal Git repository.

vishal.kadam’s picture

1. FILE: src/Form/ArenaForm.php

  /**
   * The arena service.
   *
   * @var \Drupal\ai_recipe_generator\Service\ArenaService
   */
  protected ArenaService $arenaService;

  /**
   * The recipe generation service.
   *
   * @var \Drupal\ai_recipe_generator\Service\RecipeGenerationService
   */
  protected RecipeGenerationService $recipeGenerationService;

  /**
   * The private tempstore factory.
   *
   * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
   */
  protected PrivateTempStoreFactory $tempStoreFactory;

  public function __construct(ArenaService $arena_service, RecipeGenerationService $recipe_generation_service, PrivateTempStoreFactory $temp_store_factory) {
    $this->arenaService = $arena_service;
    $this->recipeGenerationService = $recipe_generation_service;
    $this->tempStoreFactory = $temp_store_factory;
  }

FILE: src/Form/BenchmarkDashboardForm.php

  /**
   * The benchmark dashboard service.
   *
   * @var \Drupal\ai_recipe_generator\Service\BenchmarkDashboardService
   */
  protected BenchmarkDashboardService $benchmarkDashboardService;

  /**
   * The current request stack.
   *
   * @var \Symfony\Component\HttpFoundation\RequestStack
   */
  protected RequestStack $currentRequestStack;

  /**
   * Constructs a new benchmark dashboard form.
   */
  public function __construct(BenchmarkDashboardService $benchmark_dashboard_service, RequestStack $request_stack) {
    $this->benchmarkDashboardService = $benchmark_dashboard_service;
    $this->currentRequestStack = $request_stack;
  }

FILE: src/Form/RecipeChatForm.php

  /**
   * The Recipe Generation Service.
   *
   * @var \Drupal\ai_recipe_generator\Service\RecipeGenerationService
   */
  protected RecipeGenerationService $generationService;

  /**
   * The Recipe Storage Service.
   *
   * @var \Drupal\ai_recipe_generator\Service\RecipeStorageService
   */
  protected RecipeStorageService $storageService;

  /**
   * The YAML Services.
   *
   * @var \Drupal\ai_recipe_generator\Service\YamlServices
   */
  protected YamlServices $yamlServices;

  /**
   * The file system service.
   *
   * @var \Drupal\Core\File\FileSystemInterface
   */
  protected FileSystemInterface $fileSystem;

  /**
   * The Drupal root path.
   *
   * @var string
   */
  protected string $rootPath;

  public function __construct(
    RecipeGenerationService $generation_service,
    RecipeStorageService $storage_service,
    YamlServices $yaml_services,
    FileSystemInterface $file_system,
    string $root_path,
  ) {
    $this->generationService = $generation_service;
    $this->storageService = $storage_service;
    $this->yamlServices = $yaml_services;
    $this->fileSystem = $file_system;
    $this->rootPath = $root_path;
  }

FILE: src/Service/ArenaService.php

  /**
   * The database connection.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected Connection $database;

  /**
   * The time service.
   *
   * @var \Drupal\Component\Datetime\TimeInterface
   */
  protected TimeInterface $time;

  /**
   * The AI provider manager.
   *
   * @var mixed
   */
  protected $aiProviderManager;

  /**
   * The recipe generation service.
   *
   * @var \Drupal\ai_recipe_generator\Service\RecipeGenerationService
   */
  protected RecipeGenerationService $recipeGenerationService;

  /**
   * The recipe storage service.
   *
   * @var \Drupal\ai_recipe_generator\Service\RecipeStorageService
   */
  protected RecipeStorageService $storageService;

  /**
   * The YAML validation and schema service.
   *
   * @var \Drupal\ai_recipe_generator\Service\YamlServices
   */
  protected YamlServices $yamlServices;

  public function __construct(
    Connection $database,
    TimeInterface $time,
    $ai_provider_manager,
    RecipeGenerationService $recipe_generation_service,
    RecipeStorageService $storage_service,
    YamlServices $yaml_services,
  ) {
    $this->database = $database;
    $this->time = $time;
    $this->aiProviderManager = $ai_provider_manager;
    $this->recipeGenerationService = $recipe_generation_service;
    $this->storageService = $storage_service;
    $this->yamlServices = $yaml_services;
  }  

FILE: src/Service/BenchmarkDashboardService.php

  /**
   * The database connection.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected Connection $database;

  /**
   * Constructs a new benchmark dashboard service.
   */
  public function __construct(Connection $database) {
    $this->database = $database;
  }

FILE: src/Service/ContextExtractor.php

  /**
   * The configuration factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected ConfigFactoryInterface $configFactory;

  /**
   * The HTTP client to fetch external APIs.
   *
   * @var \GuzzleHttp\ClientInterface
   */
  protected ClientInterface $httpClient;

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected EntityTypeManagerInterface $entityTypeManager;

  /**
   * The entity type bundle info service.
   *
   * @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
   */
  protected EntityTypeBundleInfoInterface $entityTypeBundleInfo;

  /**
   * Constructs a new ContextExtractor object.
   *
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The configuration factory injected from the container.
   * @param \GuzzleHttp\ClientInterface $http_client
   *   The HTTP client injected from the container.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
   *   The entity type bundle info service.
   */
  public function __construct(
    ConfigFactoryInterface $config_factory,
    ClientInterface $http_client,
    EntityTypeManagerInterface $entity_type_manager,
    EntityTypeBundleInfoInterface $entity_type_bundle_info,
  ) {
    $this->configFactory = $config_factory;
    $this->httpClient = $http_client;
    $this->entityTypeManager = $entity_type_manager;
    $this->entityTypeBundleInfo = $entity_type_bundle_info;
  }  

FILE: src/Service/RecipeGenerationService.php

  /**
   * The Provider Plugin manager interface.
   *
   * @var \Drupal\ai_recipe_generator\
   */
  protected PluginManagerInterface $aiProviderManager;

  /**
   * The Context Extractor service.
   *
   * @var \Drupal\ai_recipe_generator\Service\ContextExtractor
   */
  protected ContextExtractor $contextExtractor;

  /**
   * The Configuration Factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected ConfigFactoryInterface $configFactory;

  /**
   * Constructs a new RecipeGenerationService object.
   *
   * @param \Drupal\ai\AiProviderPluginManager $ai_provider_manager
   *   The AI provider plugin manager.
   * @param \Drupal\ai_recipe_generator\Service\ContextExtractor $context_extractor
   *   Our custom context extractor.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The core config factory to read the system prompt.
   */
  public function __construct(PluginManagerInterface $ai_provider_manager, ContextExtractor $context_extractor, ConfigFactoryInterface $config_factory) {
    $this->aiProviderManager = $ai_provider_manager;
    $this->contextExtractor = $context_extractor;
    $this->configFactory = $config_factory;
  }

FILE: src/Service/RecipeStorageService.php

  /**
   * The database connection.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected Connection $database;

  /**
   * The time service.
   *
   * @var \Drupal\Component\Datetime\TimeInterface
   */
  protected TimeInterface $time;

  /**
   * Constructs a new RecipeStorageService.
   *
   * @param \Drupal\Core\Database\Connection $database
   *   The database connection.
   * @param \Drupal\Component\Datetime\TimeInterface $time
   *   The time service.
   */
  public function __construct(Connection $database, TimeInterface $time) {
    $this->database = $database;
    $this->time = $time;
  }

FILE: src/Controller/RecipeChatController.php

  /**
   * The recipe generation service.
   *
   * @var \Drupal\ai_recipe_generator\Service\RecipeGenerationService
   */
  protected RecipeStorageService $storageService;

  public function __construct(RecipeStorageService $storage_service, FormBuilderInterface $form_builder) {
    $this->storageService = $storage_service;
    $this->formBuilder = $form_builder;
  }    

Modules which are compatible with Drupal 10 and higher versions are expected to use constructor property promotion.

2. FILE: src/Form/SettingsForm.php

With Drupal 10 and Drupal 11, there is no longer need to use #default_value for each form element, when the parent class is ConfigFormBase: It is sufficient to use #config_target, as in the following code.

    $form['image_toolkit'] = [
      '#type' => 'radios',
      '#title' => $this->t('Select an image processing toolkit'),
      '#config_target' => 'system.image:toolkit',
      '#options' => [],
    ];

Using that code, it is no longer needed to save the configuration values in the form submission handler: The parent class will take care of that.

3. FILE: ai_recipe_generator.module

/**
 * @file
 * Primary module hooks for AI Recipe Generator module.
 */

Drupal does not have primary and secondary hooks. Instead of that, it is preferable to use the usual description: “Hook implementations for the [module name] module”, where [module name] is the name of the module given in its .info.yml file.

4. FILE: templates/ai-yaml-preview.html.twig

Strings shown in the user interface must be translatable. That holds true also for strings used in template files.

<script>
  (function() {
    // Find all preview containers on the page
    const containers = document.querySelectorAll('.ai-yaml-preview-container');
    
    containers.forEach(container => {
      const codeBlock = container.querySelector('code');
      const linesContainer = container.querySelector('.ai-yaml-line-numbers');
      
      // Only process if it hasn't been filled yet
      if (codeBlock && linesContainer && linesContainer.innerHTML === '') {
        // Split by newline to get total lines
        const lines = codeBlock.innerText.split('\n');
        
        // Handle the case where the AI leaves a trailing empty line at the end
        const lineCount = lines[lines.length - 1] === '' ? lines.length - 1 : lines.length;
        
        let numbersHTML = '';
        for (let i = 1; i <= Math.max(1, lineCount); i++) {
          numbersHTML += i + '<br>';
        }
        linesContainer.innerHTML = numbersHTML;
      }
    });
  })();
</script>

Move all scripts (JavaScript) into a library and attach them.

5. FILE: src/Controller/RecipeChatController.php

Since that class does not use methods from the parent class, it does not need to use ControllerBase as parent class. Controllers do not need to have a parent class; as long as they implement \Drupal\Core\DependencyInjection\ContainerInjectionInterface, they are fine.

hrishikesh-dalal’s picture

Thanks! Will work on updating all of these changes.

hrishikesh-dalal’s picture

Status: Needs work » Needs review

Fixed and updated changes, please have a second view and do let me know if any more changes required.

Thanks a lot for you help!

avpaderno’s picture

Assigned: Unassigned » avpaderno
avpaderno’s picture

  • The following points are just a start and don't necessarily encompass all of the changes that may be necessary
  • A specific point may just be an example and may apply in other places
  • A review is about code that does not follow the coding standards, contains possible security issue, or does not correctly use the Drupal API
  • The single review points are not ordered, not even by importance

src/Controller/RecipeChatController.php

With Drupal 10.2.x and higher versions, a controller class does not need to implement create(); using AutowireTrait, it just needs to implement the class constructor.


src/Form/ArenaForm.php

The class does not use any method (or it uses a single method) defined by the parent class.

A form does not need to have FormBase as parent class: as long as it implements the required interface, it is fine.


src/Form/BenchmarkDashboardForm.php

    if (empty($chart_rows)) {
      $form['comparison']['line_chart_panel']['chart'] = [
        '#markup' => '<div class="benchmark-empty">' . Html::escape((string) $this->t('No data available.')) . '</div>',
      ];
    }

There is no need to pass to Html::escape() a string that does not contain any of the escaped characters.

          $this->buildValueChip('<i class="fa-solid fa-gauge-high"></i> ' . $this->formatMilliseconds((float) $row['latency']), $this->bandClass((float) $row['latency'], $latency_average, TRUE)),
          $this->buildValueChip('<i class="' . $yaml_icon . '"></i> ' . ((int) $row['yaml_valid'] === 1 ? 'Valid' : 'Invalid'), (int) $row['yaml_valid'] === 1 ? 'benchmark-chip--good' : 'benchmark-chip--bad'),
          $this->buildValueChip('<i class="' . $schema_icon . '"></i> ' . ((int) $row['schema_compliant'] === 1 ? 'Compliant' : 'Needs work'), (int) $row['schema_compliant'] === 1 ? 'benchmark-chip--good' : 'benchmark-chip--bad'),

Strings shown in the user interface must be translatable.

    $indicator = '';
    if ($current_sort === $field) {
      $indicator = $current_order === 'asc' ? ' ▲' : ' ▼';
    }

Adding the sort indicator when the form is built is not necessary. For what I recall, the sort indicator is added by JavaScript code used by Drupal core.


ai_recipe_generator.services.yml

Services can be autowired starting with Drupal 9.3.x. This means that it is no longer necessary to give a list of service arguments in the .services.yml file; they will be retrieved from the constructor definition.


.gitignore

It seems the file is a copy of the file used by Drupal core, modified for the project. The effect is that some of the listed files are not even supposted to be in the project repository, and some of the files are listed when they should not. Is there any reason not to commit files like .gitattributes (which is a file used by Git) and INSTALL.txt (which could contain instructions on how to install the project)?


README.md

The Installation section should give a link to the Installing Drupal Modules documentation page. There is no need to show the commands to use to install the project, since those are already shown in that documentation page.

The file is missing some information README.md template lists.

The section names should not be all-capital-letters.


tests/src/Functional/Form/RecipeChatFormTest.php

  /**
   * The theme to install as the default for testing.
   *
   * @var string
   */
  protected $defaultTheme = 'stark';

  /**
   * Modules to enable for this test.
   *
   * @var array
   */
  protected static $modules = [
    'ai_recipe_generator',
  ];

Those are properties inherited from the parent class. Their documentation comments need to be different.

avpaderno’s picture

Assigned: avpaderno » Unassigned
Status: Needs review » Needs work
hrishikesh-dalal’s picture

Thanks a lot for taking time to review and suggest the changes. Will work on it!