name: Varbase AI Editor Assistant
description: A recipe to grant Varbase user roles the permissions needed for the AI-powered CKEditor 5 assistant, as provided by the Drupal CMS AI default recipe.
type: Varbase AI
install:
  - ai_ckeditor
input:
  ckeditor_machine_name:
    data_type: string
    description: 'The machine name of the CKEditor 5 editor to configure with AI enhancements.'
    prompt:
      method: ask
      arguments:
        question: 'Enter the machine name of the CKEditor 5 text editor you want to configure with AI capabilities:'
    form:
      '#type': 'textfield'
      '#title': 'CKEditor 5 text format machine name'
      '#description': 'Enter the machine name of the CKEditor 5 text format to add the AI Assistant button to (e.g. full_html, basic_html).'
      '#required': false
      '#maxlength': 64
    default:
      source: value
      value: 'full_html'
  ckeditor_index:
    data_type: string
    description: 'The position index for the AI Assistant button in the editor toolbar.'
    prompt:
      method: ask
      arguments:
        question: 'Specify the position index for the AI Assistant button:'
    form:
      '#type': 'textfield'
      '#title': 'AI Assistant button position'
      '#description': 'The toolbar position index for the AI Assistant button. Use 0 to prepend, -1 to append, or a positive integer for a specific position.'
      '#required': false
      '#maxlength': 8
    default:
      source: value
      value: '0'
config:
  strict: false
  import:
    ai_ckeditor: '*'
  actions:
    editor.editor.${ckeditor_machine_name}:
      addButtonPluginIntoActiveToolbar:
        button_name: aickeditor
        button_index: ${ckeditor_index}
        plugin_name: ai_ckeditor_ai
        plugin_settings:
          dialog:
            autoresize: 'min-width: 600px'
            height: '750'
            width: '900'
            dialog_class: ai-ckeditor-modal
          plugins:
            ai_agents_ckeditor:
              workflows: {  }
              enabled: true
            ai_ckeditor_completion:
              enabled: true
              provider: ''
            ai_ckeditor_help:
              enabled: false
            ai_ckeditor_modify_prompt:
              enabled: true
              provider: ''
            ai_ckeditor_reformat_html:
              enabled: true
              provider: ''
            ai_ckeditor_spellfix:
              enabled: true
              provider: ''
            ai_ckeditor_summarize:
              provider: ''
              enabled: true
            ai_ckeditor_tone:
              enabled: false
            ai_ckeditor_translate:
              enabled: false
    user.role.site_admin:
      grantPermissions:
        - 'use ai ckeditor'
    user.role.seo_admin:
      grantPermissions:
        - 'use ai ckeditor'
    user.role.content_admin:
      grantPermissions:
        - 'use ai ckeditor'
    user.role.content_editor:
      grantPermissions:
        - 'use ai ckeditor'
