Files
streamline/scripts/send-report-card.ts
T
2026-11-16 17:26:44 -08:00

57 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import * as Lark from "@larksuiteoapi/node-sdk";
const APP_ID = process.env.LARK_APP_ID || "";
const APP_SECRET = process.env.LARK_APP_SECRET || "";
const DOMAIN = process.env.LARK_DOMAIN || Lark.Domain.Feishu;
const BASE = process.env.APP_BASE_URL || "";
const TARGET = "jiaopengwen@bytedance.com";
if (!APP_ID || !APP_SECRET) { console.error("LARK creds missing"); process.exit(1); }
const client = new Lark.Client({ appId: APP_ID, appSecret: APP_SECRET, domain: DOMAIN });
const div = (content: string) => ({ tag: "div", text: { tag: "lark_md", content } });
const hr = { tag: "hr" };
const card = {
config: { wide_screen_mode: true },
header: {
template: "blue",
title: { tag: "plain_text", content: "🤖 Streamline 自动修复执行报告" },
},
elements: [
div("截至 2026-06-29 | 全量任务 **186**(Bug 163 / Feature 23)"),
hr,
div(
"**✅ 完成 82(44.1%)**,已 merge 落地 **61**\n" +
"Bug 69(42.3%)| Feature 13(56.5%)"
),
div(
"**⚡ 一次通过率 79.3%**,两轮内 89.0%\n" +
"Android **84.8%** | iOS **56.3%**"
),
div(
"**🔍 无法复现 31**,自动判定 **87.1% 已确认**\n" +
"可高准确率自动标识,替代人工初筛"
),
div(
"**⏱️ 单任务中位耗时 1.1h**(端到端)\n" +
"Android 1.07h | iOS 1.39h"
),
{
tag: "action",
actions: [
BASE ? { tag: "button", text: { tag: "plain_text", content: "打开看板" }, url: BASE, type: "primary" } : null,
].filter(Boolean),
},
],
};
async function send() {
const r = await client.im.v1.message.create({
params: { receive_id_type: "email" },
data: { receive_id: TARGET, msg_type: "interactive", content: JSON.stringify(card) },
});
console.log("send result code:", r?.code, "msg:", r?.msg, "message_id:", r?.data?.message_id);
}
send().catch((e) => { console.error("send failed:", e?.message || e); process.exit(1); });