Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
92 lines
3.7 KiB
JavaScript
92 lines
3.7 KiB
JavaScript
'use strict';
|
|
|
|
/** AI 连接配置页已移除:主题只走 WordPress AI Connectors,生成能力与入口保留。 */
|
|
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const test = require('node:test');
|
|
|
|
const root = path.resolve(__dirname, '..', '..');
|
|
|
|
const read = (rel) => fs.readFileSync(path.join(root, rel), 'utf8');
|
|
|
|
const ai = read('src/Ai/AI.php');
|
|
const controller = read('src/Admin/AIController.php');
|
|
const seoSchema = read('assets/admin/src/schema/sections/global/seo.js');
|
|
const extensionsMenu = read('assets/admin/src/constants/sections/extensions.js');
|
|
const apiModule = read('assets/admin/src/api/modules/extensions.js');
|
|
const frontSubmit = read('assets/js/front-submit.js');
|
|
const submitContext = read('templates/parts/submit/context.php');
|
|
const submitPage = read('templates/pages/page-submit.php');
|
|
|
|
const removed = [
|
|
'jio_ai_settings',
|
|
'AI 连接配置',
|
|
'AI连接配置',
|
|
'ExtensionAI',
|
|
'extensions-ai',
|
|
'/ai/settings',
|
|
'/ai/status',
|
|
'ai-assist-btn',
|
|
'扩展 → AI',
|
|
];
|
|
|
|
const walk = (dir) => fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
const full = path.join(dir, entry.name);
|
|
if (entry.isDirectory()) {
|
|
return ['node_modules', 'build', 'dist'].includes(entry.name) ? [] : walk(full);
|
|
}
|
|
return [full];
|
|
});
|
|
|
|
const sources = ['src', 'assets/admin/src', 'templates', 'assets/js', 'inc']
|
|
.flatMap((dir) => walk(path.join(root, dir)));
|
|
|
|
test('后台菜单、路由与 API 中不再有 AI 连接配置页', () => {
|
|
assert.doesNotMatch(extensionsMenu, /extensions-ai|ExtensionAI|AI 连接配置/);
|
|
assert.doesNotMatch(apiModule, /getAiStatus|updateAiSettings|generateSeo|suggestSummary|suggestTags/);
|
|
assert.ok(!fs.existsSync(path.join(root, 'assets/admin/src/pages/extensions/ExtensionAI.vue')));
|
|
assert.ok(!fs.existsSync(path.join(root, 'assets/admin/src/router/component-loaders/extensions.js')));
|
|
});
|
|
|
|
test('AI.php 只保留 WP AI Client 单路出口', () => {
|
|
assert.doesNotMatch(ai, /PROVIDER_OPENAI|PROVIDER_NONE/);
|
|
assert.doesNotMatch(ai, /get_config|update_config/);
|
|
assert.doesNotMatch(ai, /generate_via_theme|normalize_api_base/);
|
|
assert.doesNotMatch(ai, /is_theme_provider_available|resolve_backend/);
|
|
assert.doesNotMatch(ai, /check_rate_limit|record_call/);
|
|
assert.match(ai, /wp_ai_client_prompt/);
|
|
assert.match(ai, /function is_wp_ai_available/);
|
|
assert.match(ai, /function is_available/);
|
|
});
|
|
|
|
test('生成路由保留,连接配置与旧草稿兼容路由移除', () => {
|
|
assert.match(controller, /\/ai\/seo-generate/);
|
|
assert.match(controller, /\/ai\/summary-suggest/);
|
|
assert.match(controller, /\/ai\/tags-suggest/);
|
|
assert.doesNotMatch(controller, /\/ai\/seo-suggest/);
|
|
assert.doesNotMatch(controller, /function get_status|function update_settings|function seo_suggest/);
|
|
});
|
|
|
|
test('残留文案不再指向已删除的配置页', () => {
|
|
for (const [name, source] of [['AI.php', ai], ['AIController.php', controller], ['seo.js', seoSchema]]) {
|
|
assert.doesNotMatch(source, /AI 连接配置/, `${name} 仍引用 AI 连接配置页`);
|
|
assert.doesNotMatch(source, /扩展 → AI/, `${name} 仍引导到扩展菜单`);
|
|
}
|
|
});
|
|
|
|
test('前台投稿 AI 辅助死代码已清理', () => {
|
|
assert.doesNotMatch(frontSubmit, /bindAi|ai-assist-btn|cfg\.ai/);
|
|
assert.doesNotMatch(submitContext, /ai_available/);
|
|
assert.doesNotMatch(submitPage, /'ai'\s*=>|aiGenerating|aiFailed|aiFilled|needContent/);
|
|
});
|
|
|
|
test('全仓源码不再引用已删除的 AI 连接配置', () => {
|
|
const offenders = sources.filter((file) => {
|
|
const text = fs.readFileSync(file, 'utf8');
|
|
return removed.some((pattern) => text.includes(pattern));
|
|
});
|
|
assert.deepEqual(offenders.map((file) => path.relative(root, file)), []);
|
|
});
|