45bfae6e94
Initial import of all source code, config, and README assets: the packages workspace (cli, core, server, web, docs, landing, skills), build scripts, tooling config, and CI workflows. Includes the data-layout revision made on this branch: the local data root defaults to ~/.penguin/data (PENGUIN_HOME still overrides; the installer keeps its binaries in ~/.penguin), and every Agent lives under <project>/agents/<agent>/ — path helpers, the three agent-enumeration scans, the system prompt, built-in Skills, tests and docs all follow the new layout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ihk8iQuo3kv2aPjAYEPuR
28 lines
865 B
TypeScript
28 lines
865 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { extractToc, slugifyHeading } from "../src/lib/toc";
|
|
|
|
describe("slugifyHeading", () => {
|
|
it("lowercases latin, hyphenates spaces, keeps CJK", () => {
|
|
expect(slugifyHeading("Agent Loop")).toBe("agent-loop");
|
|
expect(slugifyHeading("消息信封")).toBe("消息信封");
|
|
expect(slugifyHeading("Tool Calls (streaming)")).toBe("tool-calls-streaming");
|
|
});
|
|
});
|
|
|
|
describe("extractToc", () => {
|
|
it("collects ##/### headings and skips fenced code blocks", () => {
|
|
const body = [
|
|
"## Envelope",
|
|
"```ts",
|
|
"## not a heading",
|
|
"```",
|
|
"### Payload kinds",
|
|
"#### too deep",
|
|
].join("\n");
|
|
expect(extractToc(body)).toEqual([
|
|
{ id: "envelope", text: "Envelope", depth: 2 },
|
|
{ id: "payload-kinds", text: "Payload kinds", depth: 3 },
|
|
]);
|
|
});
|
|
});
|