feat(wechat): add Intent Transaction Layer with unified task schema

Introduce Draft → Confirm → Commit flow for WeChat schedule intents behind
feature flags, plus h5_tasks dual-write/read aggregation and rollout scripts
so reminders and automations get explicit user confirmation before persisting.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-24 15:59:17 +08:00
parent b93c92a3e2
commit d58dc2a251
45 changed files with 4972 additions and 30 deletions
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env node
/**
* ITL / Unified Tasks 发布前配置检查(只读)
*/
import { loadH5Environment } from './load-env.mjs';
loadH5Environment(import.meta.dirname);
const env = process.env;
const checks = [
{
id: 'schedule_enabled',
label: 'H5_SCHEDULE_ENABLED=1',
ok: env.H5_SCHEDULE_ENABLED === '1',
required: true,
},
{
id: 'unified_tasks',
label: 'H5_UNIFIED_TASKS_ENABLED=1Phase B/C 双写 + 统一读)',
ok: env.H5_UNIFIED_TASKS_ENABLED === '1',
required: false,
},
{
id: 'intent_transaction',
label: 'H5_INTENT_TRANSACTION_ENABLED=1Phase A Confirm Gate',
ok: env.H5_INTENT_TRANSACTION_ENABLED === '1',
required: false,
},
{
id: 'database_url',
label: 'DATABASE_URL 已配置',
ok: Boolean(env.DATABASE_URL),
required: true,
},
{
id: 'scheduled_task_worker',
label: 'H5_SCHEDULED_TASK_WORKER_ENABLED 未显式关闭',
ok: env.H5_SCHEDULED_TASK_WORKER_ENABLED !== '0',
required: false,
},
];
let failed = 0;
console.log('=== ITL Rollout Config Check ===\n');
for (const check of checks) {
const mark = check.ok ? '✔' : (check.required ? '✘' : '○');
console.log(`${mark} ${check.label}`);
if (!check.ok && check.required) failed += 1;
}
console.log('\n推荐灰度顺序:');
console.log(' 1. 部署代码(ITL/Unified 开关关闭)');
console.log(' 2. H5_UNIFIED_TASKS_ENABLED=1');
console.log(' 3. node scripts/migrate-tang-unified-tasks-103.mjs --apply');
console.log(' 4. npm run verify:tang-itl-readiness-103');
console.log(' 5. H5_INTENT_TRANSACTION_ENABLED=1');
console.log(' 6. 微信实测 Action Card 流程');
process.exit(failed > 0 ? 1 : 0);