Skip to content

feat: add settings import/export functionality#734

Draft
coderGtm wants to merge 5 commits into
WordPress:developfrom
coderGtm:feature/import-export-config
Draft

feat: add settings import/export functionality#734
coderGtm wants to merge 5 commits into
WordPress:developfrom
coderGtm:feature/import-export-config

Conversation

@coderGtm

@coderGtm coderGtm commented Jun 16, 2026

Copy link
Copy Markdown

What?

Closes #191

This PR implements the ability to export and import non-sensitive AI configuration settings and introduces a dedicated AI section in WordPress Site Health.

Why?

Allowing users to move AI configurations between environments (e.g., staging to production, multi-site etc.) improves the developer experience. By excluding sensitive credentials from the export, we ensure security while maintaining portability. The Site Health integration provides administrators with a quick overview of the plugin's status and credential health.

How?

  • REST API: Created includes/REST/Settings_IO_Controller.php to handle GET /ai/v1/settings/export and POST /ai/v1/settings/import.
  • Security: Implemented SENSITIVE_PATTERNS filtering to ensure API keys, tokens, and secrets are never exported or overwritten during import.
  • Site Health: Added includes/Admin/Site_Health.php to provide debug information (version, enabled features, credential status) and a status test for connectivity.
  • UI/UX:
    • Added "Export settings" and "Import settings" to the AI settings menu in routes/ai-home/stage.tsx.
    • Implemented a confirmation modal for imports.
  • Tests: Added comprehensive integration tests in tests/Integration/Includes/REST/Settings_IO_ControllerTest.php and tests/Integration/Includes/Admin/Site_HealthTest.php.

Use of AI Tools

AI assistance: Yes
Tool(s): GitHub Copilot
Model(s): Claude Sonnet 4.6, GPT-4o
Used for: Authoring the codebase exploration, UI components, and the integration test suite.

Testing Instructions

  1. Navigate to AI Settings.
  2. Open the kebab menu (three vertical dots) in the top right.
  3. Click Export settings. A JSON file containing your current toggles and developer configurations (but no API keys) should download.
  4. Toggle several features to different states.
  5. Click Import settings in the menu and select the previously downloaded file.
  6. Confirm the prompt "This will overwrite existing AI settings."
  7. Verification: The UI should update immediately to reflect the imported settings without a page refresh.
  8. Navigate to Tools > Site Health.
  9. In the Status tab, verify the "AI Plugin" test results.
  10. In the Info tab, verify the "AI Plugin" section contains correct metadata about your setup.

Screenshots or screencast

Menu Items:
Screenshot 2026-06-16 at 1 56 51 PM

Confirmation prompt before completing import:
Screenshot 2026-06-16 at 1 57 51 PM

Changelog Entry

Added - Import/Export functionality for non-sensitive AI settings.
Added - AI-specific Site Health integration and status tests.

Open WordPress Playground Preview

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: coderGtm <gautam23@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@coderGtm coderGtm marked this pull request as draft June 16, 2026 09:26
@coderGtm

Copy link
Copy Markdown
Author

The failing JavaScript quality check is due to a conflict between eslint and typescript. While eslint prefers dot notation, typescript complains about it (TS4111). Should I suppress the eslint error?

@dkotter

dkotter commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

The failing JavaScript quality check is due to a conflict between eslint and typescript. While eslint prefers dot notation, typescript complains about it (TS4111). Should I suppress the eslint error?

We do have a number of these that we already ignore with inline statements so I think that's fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add import/export support for AI settings and provider configuration

2 participants