Initial import of streamline

This commit is contained in:
2026-11-16 17:26:44 -08:00
commit 8e4aec1855
1221 changed files with 274256 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import { expect, test } from "bun:test";
import { HANDOFF_HEADER, framedHandoffRemark, normalizeHandoffContext } from "../src/agent_handoff";
test("线索加上固定说明:明确是参考、要真机验证、冲突以真机为准", () => {
const r = framedHandoffRemark({
notes: "## 怀疑点\n- FeedAdapter.bind:复用 ViewHolder 时没清状态(把握:中)",
submitter: "alice@bytedance.com", agent: "cursor",
context: { repo: "git@code.byted.org:tiktok/android.git", branch: "fix/feed", commit: "abc1234" },
});
expect(r.startsWith(HANDOFF_HEADER)).toBe(true);
expect(r).toContain("alice@bytedance.com");
expect(r).toContain("cursor");
expect(r).toContain("没有经过真机验证");
expect(r).toContain("以真机和代码为准");
expect(r).toContain("分支 fix/feed · 提交 abc1234");
expect(r.trimEnd().endsWith("(把握:中)")).toBe(true);
});
test("代码版本只认像 git 信息的值;没有就不写那一行", () => {
expect(normalizeHandoffContext({ commit: "not a sha", branch: "a b; rm -rf", repo: "x\ny" })).toEqual({ repo: null, branch: null, commit: null });
expect(normalizeHandoffContext({ commit: "ABCDEF0123", branch: "release/47.2" })).toEqual({ repo: null, branch: "release/47.2", commit: "ABCDEF0123" });
expect(normalizeHandoffContext(null)).toEqual({ repo: null, branch: null, commit: null });
expect(framedHandoffRemark({ notes: "x", submitter: "a@b.com", agent: null, context: {} })).not.toContain("调研时的代码版本");
});