AIAI Reports

Install and set up

About 15 minutes. You need SSH access to the server, a database administrator who can create a MySQL user, and an API key from an AI provider.

1. Install with Composer

Use your licence key as the password. It's in your Polar account: follow the link in your purchase e-mail, or open polar.sh/gaurav-extensions/portal and sign in with the e-mail you bought with.

composer config repositories.aireports composer https://wuetygwpupwjhospscwi.supabase.co/functions/v1/composer
composer config http-basic.wuetygwpupwjhospscwi.supabase.co licence YOUR-LICENCE-KEY
composer require gauravharsh/module-ai-reports:^3.0

bin/magento module:enable Gaurav_AiReports
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

Keep auth.json out of version control. On deployment pipelines, set the key as the COMPOSER_AUTH environment variable instead.

2. Create the read-only database user

CREATE USER 'aireports_ro'@'%' IDENTIFIED BY 'a-strong-random-password';
GRANT SELECT ON your_database_name.* TO 'aireports_ro'@'%';
FLUSH PRIVILEGES;

Restrict '%' to your application servers where you can.

3. Add it to app/etc/env.php

'aireports' => [
    'readonly_connection' => [
        'username' => 'aireports_ro',
        'password' => 'a-strong-random-password',
    ],
],

The tool refuses to run until this is set. The credential can't be seen or changed in the admin.

4. Configure

Go to Stores › Configuration › Gaurav Extensions › AI Reports:

5. Build the store snapshot

bin/magento aireports:knowledge:build

This takes seconds to a few minutes. A weekly cron job keeps it fresh, and a daily check rebuilds it early when attributes, stores or the schema change.

6. Give people access

PermissionAllows
AI Reports queryAsking questions and running saved reports
AI Reports knowledgeRebuilding the snapshot and editing business rules
AI Reports query logThe audit log and usage figures
AI Reports configurationThe settings above

Anyone with query access can read every non-blocked table across all websites. Grant it only to roles that may see that data.

Business rules

Under Reports › AI Knowledge, write down anything the database can't reveal, like a new analyst briefing. Name tables, attribute codes and ids where you know them. For example:

Product visibility depends on customer group. Listings and search only show products whose attribute customer_groups contains the shopper's group id. Guests are group 0. "Not showing for trade customers" usually means the trade group id is missing.

Copy rules between environments with:

bin/magento aireports:knowledge:rules export rules.json
bin/magento aireports:knowledge:rules import rules.json

Measure accuracy on your store

Write questions with known answers into a JSON file and score the AI against them. It shows the estimated cost and asks before it runs.

bin/magento aireports:eval:run --file=questions.json --preset=standard

Licence

Updating

composer update gauravharsh/module-ai-reports
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

Coming from 2.x: add the repository and key from step 1, then raise your constraint from ^2.0 to ^3.0.

What leaves your server

SentTo
Store structure: attributes and options, store and category names, order statuses, table and column names, your business rulesYour AI provider
The question as typedYour AI provider
Answer mode only: up to 20 rows per query, with personal data maskedYour AI provider
Licence key, store domain, module and Magento versionsUs, once a day

Never sent: blocked tables, credentials or full result sets. Table + CSV mode sends no rows.