Search by

protonsystems / site-audit-tools

proton.systems

Read-only Drupal Tool API integration for Site Audit.

Package info

gitlab.com/Proton.Systems/drupal/site-audit-tools

Issues

Type:drupal-module

pkg:composer/protonsystems/site-audit-tools

Statistics

Installs: 8

Dependents: 1

Suggesters: 1

Stars: 0

v1.2.1 2026-11-18 13:22 UTC

This package is auto-updated.

Last update: 2026-11-18 18:24:38 UTC


README

This package provides the optional site_audit_tools Drupal module. It exposes the renderer-independent Site Audit model through Drupal Tool API as typed, read-only operations for Drupal AI Agents and other Tool API clients.

Install

composer require protonsystems/site-audit-tools
drush en site_audit_tools

The package installs drupal/tool and the required Site Audit base package. For Drupal AI Agents, also enable Tool API's AI connector:

drush en tool_ai_connector

Grant the agent's Drupal account the View site audit model permission. The tools return project structure and module metadata, not content records or user accounts.

Tools

Tool IDPurpose
site_audit.overviewSite identity, aggregate counts, languages and enabled module totals
site_audit.list_content_typesContent type names, descriptions, and total/base/configurable field counts
site_audit.get_content_typeField settings, defaults, constraints, form widgets, view formatters, and configured relationships
site_audit.compare_content_typesShared fields, type differences, display-mode differences, and conservative same-label duplicate candidates
site_audit.get_bundle_usageAggregate entity and field population counts for one node, Paragraph, Media, or taxonomy bundle
site_audit.get_content_usage_summaryFind empty and low-population fields across all supported bundles, paginated by bundle
site_audit.find_modulesSearch installed modules by name, enabled state and module category

All tools are marked as read operations and require the restricted Site Audit permission.

get_bundle_usage is opt-in and accepts a bundle plus field offset/limit. It counts current entities and field item rows through Drupal's SQL storage mapping, without loading entities or returning identifiers and values. A populated entity means at least one non-empty value exists in its current data rows, across its translations. Non-SQL storage and computed fields without a queryable column report analytics_supported: false. Use the pagination metadata when a bundle has more than 100 fields.

get_content_usage_summary scans bundles in a stable entity-type and bundle order, and paginates that bundle list with offset and limit. It reports empty fields and fields populated on at most max_populated_percent of the bundle's entities (50% by default); empty fields are always included. Bundles with no entities are reported with their entity count but are not classified as empty or underused. Unsupported computed/non-SQL fields are counted separately. Set entity_type to narrow the scan to nodes, Paragraphs, Media, or taxonomy terms. The output contains aggregate counts and field metadata, never entity IDs or field values.

The model's displays collection describes configured entity form and view display modes, including hidden components. summary.entity_form_displays and summary.entity_view_displays count those configuration entities separately; summary.views_displays counts display plugins inside Views configuration. These are distinct inventory scopes. Runtime hooks, access checks, and render alters can change the final UI, so display records describe configuration rather than a rendered-form guarantee. Field and storage settings are separate; keys that look like secrets or credentials are redacted.

compare_content_types also compares components for form/view modes shared by the two bundles. It marks a possible field duplicate only when two configurable fields have different machine names but the same normalized label and field type. Treat that as a review hint, not a finding: labels alone do not establish that fields carry the same meaning.

Usage counts include unpublished entities and require the dedicated View site audit model permission. They are aggregate counts only, but grant that permission only to trusted integration accounts.

Drupal 11.4.12 and Tool API beta12 workaround

In the tested combination of Drupal 11.4.12 and Tool API 1.0.0-beta12, an embedded deprecated-alias placeholder in Tool API's service definition caused Drupal's optimized container dumper to fail. If this still affects the versions in your project, add the included patch to the root Composer project:

Copy the patch into the Drupal project root first:

mkdir -p patches
cp web/modules/contrib/site-audit-tools/patches/tool-remove-embedded-deprecation.patch patches/

Then merge this entry into the existing extra.patches section of the root composer.json, preserving any other patches already configured there:

{
  "extra": {
    "patches": {
      "drupal/tool": {
        "Remove embedded alias placeholder for container compilation": "patches/tool-remove-embedded-deprecation.patch"
      }
    }
  }
}

Remove the workaround after upgrading to a Tool API release that no longer triggers the container error. The patch belongs to the consuming site's Composer project; Composer package metadata does not apply it automatically.

Last verified: 2026-11-18