docs(skill): Generate the tttk reference catalog
Enrich known.ts with element/role details, inline specs, and dice notation, and render them from reference.ts. Add gen:skill-reference and ~ expansion in --out so the skill copy can be regenerated. The skill's reference.md is now generated; its extra authoring content moved to layout.md, yaml-tag.md, csv.md, and markdown.md.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import { mkdirSync, writeFileSync } from "fs";
|
||||
import { homedir } from "os";
|
||||
import { dirname, resolve } from "path";
|
||||
import { renderReference } from "../src/cli/validate/reference.js";
|
||||
|
||||
@@ -15,7 +16,16 @@ function argValue(flag: string): string | undefined {
|
||||
return index >= 0 ? process.argv[index + 1] : undefined;
|
||||
}
|
||||
|
||||
const out = resolve(argValue("--out") ?? "docs/reference.md");
|
||||
/** Expand a leading `~` so the skill copy can be targeted cross-platform. */
|
||||
function expandHome(path: string): string {
|
||||
if (path === "~") return homedir();
|
||||
if (path.startsWith("~/") || path.startsWith("~\\")) {
|
||||
return resolve(homedir(), path.slice(2));
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
const out = resolve(expandHome(argValue("--out") ?? "docs/reference.md"));
|
||||
mkdirSync(dirname(out), { recursive: true });
|
||||
writeFileSync(out, renderReference(), "utf-8");
|
||||
console.log(`wrote ${out}`);
|
||||
|
||||
Reference in New Issue
Block a user