Initialize repository with harness code and assets
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
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Minimal frontmatter parser for doc pages: a leading `---` block of `key: value`
|
||||
* lines (values may contain colons; quotes optional). Kept dependency-free and pure
|
||||
* so it is unit-testable without Vite. Same format as the landing page blog.
|
||||
*/
|
||||
|
||||
export interface Frontmatter {
|
||||
meta: Record<string, string>;
|
||||
body: string;
|
||||
}
|
||||
|
||||
export function parseFrontmatter(raw: string): Frontmatter {
|
||||
const normalized = raw.replace(/\r\n/g, "\n");
|
||||
const match = /^---\n([\s\S]*?)\n---\n?/.exec(normalized);
|
||||
if (!match) return { meta: {}, body: normalized.trim() };
|
||||
const meta: Record<string, string> = {};
|
||||
for (const line of match[1]!.split("\n")) {
|
||||
const idx = line.indexOf(":");
|
||||
if (idx === -1) continue;
|
||||
const key = line.slice(0, idx).trim();
|
||||
let value = line.slice(idx + 1).trim();
|
||||
if (
|
||||
(value.startsWith('"') && value.endsWith('"')) ||
|
||||
(value.startsWith("'") && value.endsWith("'"))
|
||||
) {
|
||||
value = value.slice(1, -1);
|
||||
}
|
||||
if (key) meta[key] = value;
|
||||
}
|
||||
return { meta, body: normalized.slice(match[0].length).trim() };
|
||||
}
|
||||
Reference in New Issue
Block a user