feat(health): wire H5 health page, WeChat channel, and observation API.
Expose /health and /api/health/observations behind MEMIND_HEALTH_ENABLED, redirect ordinary chat health intents without persisting, and run a dedicated WeChat menu flow with confirm-before-write semantics. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -37,6 +37,16 @@ function checkWechatImports() {
|
||||
return violations;
|
||||
}
|
||||
|
||||
function isAllowedH5WechatImport(file, text) {
|
||||
const rel = path.relative(root, file);
|
||||
if (rel !== 'mindspace-public-finish-sync.mjs') return false;
|
||||
const allowed = text.match(/from\s+['"](\.\/wechat\/[^'"]+)['"]/g) ?? [];
|
||||
return (
|
||||
allowed.length > 0 &&
|
||||
allowed.every((entry) => /from\s+['"]\.\/wechat\/verify\//.test(entry))
|
||||
);
|
||||
}
|
||||
|
||||
function checkH5ImportsWechat() {
|
||||
const violations = [];
|
||||
const h5Paths = [
|
||||
@@ -49,6 +59,7 @@ function checkH5ImportsWechat() {
|
||||
const files = fs.statSync(base).isDirectory() ? walk(base) : [base];
|
||||
for (const file of files) {
|
||||
const text = fs.readFileSync(file, 'utf8');
|
||||
if (isAllowedH5WechatImport(file, text)) continue;
|
||||
for (const pattern of forbiddenH5ImportPatterns) {
|
||||
if (pattern.test(text)) violations.push({ file, token: pattern.source });
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ const SCOPE_RULES = [
|
||||
'wechat-oauth.test.mjs',
|
||||
'wechat-pay.test.mjs',
|
||||
'user-auth.test.mjs',
|
||||
'health-wechat-channel.test.mjs',
|
||||
],
|
||||
verify: ['verify:wechat-channel-isolation'],
|
||||
},
|
||||
@@ -145,7 +146,7 @@ const SCOPE_RULES = [
|
||||
},
|
||||
{
|
||||
id: 'health',
|
||||
patterns: [/^health-/i, /health-assistant/i, /templates\/health-p0/i],
|
||||
patterns: [/^health-/i, /health-assistant/i, /portal-health-routes/i, /templates\/health-p0/i],
|
||||
tests: [
|
||||
'health-channel-state.test.mjs',
|
||||
'health-intent-rules.test.mjs',
|
||||
@@ -154,6 +155,9 @@ const SCOPE_RULES = [
|
||||
'health-baseline-maturity.test.mjs',
|
||||
'health-publish-guard.test.mjs',
|
||||
'health-p0-experiment.test.mjs',
|
||||
'health-wechat-channel.test.mjs',
|
||||
'server/portal-health-routes.test.mjs',
|
||||
'server/portal-core-auth-routes.test.mjs',
|
||||
'mindspace.test.mjs',
|
||||
'mindspace-publications.test.mjs',
|
||||
'chat-skills.test.mjs',
|
||||
|
||||
Reference in New Issue
Block a user