mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 10:05:18 +00:00
Configure lefthook formatter checks (#231)
* Add lefthook formatter checks * Fix SDK mode hydration * Stabilize SDK mode integration test
This commit is contained in:
parent
0471214d65
commit
d2346bafb3
282 changed files with 5840 additions and 8399 deletions
|
|
@ -68,12 +68,14 @@ async function main() {
|
|||
const referenceMap = buildReferenceMap(references);
|
||||
const template = await fsp.readFile(TEMPLATE_PATH, "utf8");
|
||||
|
||||
const skillFile = template
|
||||
.replace("{{QUICKSTART}}", quickstartContent)
|
||||
.replace("{{REFERENCE_MAP}}", referenceMap);
|
||||
const skillFile = template.replace("{{QUICKSTART}}", quickstartContent).replace("{{REFERENCE_MAP}}", referenceMap);
|
||||
|
||||
await fsp.writeFile(path.join(OUTPUT_ROOT, "SKILL.md"), `${skillFile.trim()}
|
||||
`, "utf8");
|
||||
await fsp.writeFile(
|
||||
path.join(OUTPUT_ROOT, "SKILL.md"),
|
||||
`${skillFile.trim()}
|
||||
`,
|
||||
"utf8",
|
||||
);
|
||||
|
||||
console.log(`Generated skill files in ${OUTPUT_ROOT}`);
|
||||
}
|
||||
|
|
@ -188,7 +190,10 @@ function buildReferenceMap(references) {
|
|||
|
||||
for (const group of sortedGroups) {
|
||||
lines.push(`### ${formatSegment(group)}`, "");
|
||||
const items = grouped.get(group).slice().sort((a, b) => a.title.localeCompare(b.title));
|
||||
const items = grouped
|
||||
.get(group)
|
||||
.slice()
|
||||
.sort((a, b) => a.title.localeCompare(b.title));
|
||||
for (const item of items) {
|
||||
lines.push(`- [${item.title}](${item.referencePath})`);
|
||||
}
|
||||
|
|
@ -281,9 +286,7 @@ function normalizeCodeBlock(block) {
|
|||
const opening = lines[0].trim();
|
||||
const closing = lines[lines.length - 1].trim();
|
||||
const contentLines = lines.slice(1, -1);
|
||||
const indents = contentLines
|
||||
.filter((line) => line.trim() !== "")
|
||||
.map((line) => line.match(/^\s*/)?.[0].length ?? 0);
|
||||
const indents = contentLines.filter((line) => line.trim() !== "").map((line) => line.match(/^\s*/)?.[0].length ?? 0);
|
||||
const minIndent = indents.length ? Math.min(...indents) : 0;
|
||||
const normalizedContent = contentLines.map((line) => line.slice(minIndent));
|
||||
|
||||
|
|
@ -344,7 +347,10 @@ function getAttributeValue(attrs, name) {
|
|||
}
|
||||
|
||||
function stripHtml(value) {
|
||||
return value.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
||||
return value
|
||||
.replace(/<[^>]+>/g, " ")
|
||||
.replace(/\s+/g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function collapseWhitespace(value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue