feat: add settings import/export functionality - #734
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
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 |
…to feature/import-export-config
dkotter
left a comment
There was a problem hiding this comment.
Overall this looks really good, left a few comments. In addition, an E2E test here would be nice to verify the import/export options are available
| ), | ||
| 'description' => sprintf( | ||
| '<p>%s</p>', | ||
| __( 'At least one AI connector has credentials configured and is ready to use.', 'ai' ) |
There was a problem hiding this comment.
So this isn't entirely accurate. The has_ai_credentials function will tell us if a Provider has credentials set but doesn't tell us if the credentials are valid. We do have a new is_connector_configured function that we could use here instead
There was a problem hiding this comment.
Well, I am not entirely convinced that Site Health checks should also check the validity of the credentials. But if you insist, I can implement it that way as I am not able to side either way on this.
There was a problem hiding this comment.
I don't feel strongly on if we should check validity of credentials here but we can't accurately say At least one AI connector has credentials configured and is ready to use if we just check if credentials exist. I'd suggest we at least modify that message and just remove the and is ready to use part
|
Thanks @dkotter for reviewing this. I will work on the feedback over the days and request a review again. |
# Conflicts: # includes/Main.php
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #734 +/- ##
=============================================
+ Coverage 79.83% 80.18% +0.35%
- Complexity 2475 2526 +51
=============================================
Files 104 106 +2
Lines 10006 10240 +234
=============================================
+ Hits 7988 8211 +223
- Misses 2018 2029 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderGtm looks like a merge conflict, then perhaps good for re-review on our end? |
|
@jeffpaul I am yet to add the e2e test and checking the validation and sanitization again. So once I do those and resolve the merge conflict, I'll manually request a re-review. Thanks for checking it out. |
# Conflicts: # routes/ai-home/stage.tsx
…for wpai_features_enabled
…d settings are preserved during import.
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?
includes/REST/Settings_IO_Controller.phpto handleGET /ai/v1/settings/exportandPOST /ai/v1/settings/import.SENSITIVE_PATTERNSfiltering to ensure API keys, tokens, and secrets are never exported or overwritten during import.includes/Admin/Site_Health.phpto provide debug information (version, enabled features, credential status) and a status test for connectivity.routes/ai-home/stage.tsx.tests/Integration/Includes/REST/Settings_IO_ControllerTest.phpandtests/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
Screenshots or screencast
Menu Items:

Confirmation prompt before completing import:

Changelog Entry