-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo-compiler.ts
More file actions
40 lines (33 loc) · 1.09 KB
/
demo-compiler.ts
File metadata and controls
40 lines (33 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bun
import { readFile } from "fs/promises";
import { compileSummary } from "./engine/compiler.js";
import { validateExperience } from "./engine/validator.js";
async function demo() {
// Load demo experience
const demoPath = process.argv[2] || "./examples/demo.json";
const demoJson = await readFile(demoPath, "utf-8");
const demoData = JSON.parse(demoJson);
// Validate
const validation = validateExperience(demoData);
if (!validation.success) {
console.error("Validation failed:", validation.errors);
process.exit(1);
}
const experience = validation.data;
// Mock results
const mockResults: Record<string, any> = {
"sec-1": "<div className='p-4 bg-blue-100 text-blue-800 rounded'>User updated this</div>",
"sec-2": "theme-dark",
"sec-final": true,
};
// Compile
const markdown = compileSummary(experience, mockResults);
// Output
console.log("=" .repeat(80));
console.log("COMPILED MARKDOWN SUMMARY");
console.log("=".repeat(80));
console.log();
console.log(markdown);
console.log("=".repeat(80));
}
demo().catch(console.error);