feat: integrate Pi backend and Pi Web

This commit is contained in:
luckyyzh
2026-07-30 19:37:53 +08:00
commit 7392ab9dd7
1390 changed files with 337197 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
import assert from "node:assert/strict";
import test from "node:test";
import { parseCompactionSummary } from "./compaction-summary.ts";
test("separates pi file metadata tags from the visible compaction summary", () => {
const parsed = parseCompactionSummary(`## Goal
Keep the important user intent.
<read-files>
/tmp/a.ts
/tmp/b.ts
</read-files>
<modified-files>
/tmp/changed.ts
</modified-files>`);
assert.equal(parsed.body, "## Goal\nKeep the important user intent.");
assert.deepEqual(parsed.readFiles, ["/tmp/a.ts", "/tmp/b.ts"]);
assert.deepEqual(parsed.modifiedFiles, ["/tmp/changed.ts"]);
});
test("leaves normal summaries unchanged", () => {
const summary = "## Goal\nNo file metadata here.";
assert.deepEqual(parseCompactionSummary(summary), {
body: summary,
readFiles: [],
modifiedFiles: [],
});
});
test("keeps file-like tags that are part of the summary body", () => {
const summary = `## Critical Context
The user asked what this compact metadata means: <read-files>example</read-files>.
More summary text after the mention.`;
assert.deepEqual(parseCompactionSummary(summary), {
body: summary,
readFiles: [],
modifiedFiles: [],
});
});