Files
avdlee__swiftui-agent-skill/.github/scripts/sync-readme.js
Antoine van der Lee dfc96633db Adopt Agent Plugins 1.0.0 portable format
Add a root plugin.json manifest and move the skill to the canonical
skills/swiftui-expert-skill/ location per the Agent Plugins
specification (https://agent-plugins.org). A symlink at the old root
path keeps existing clones and scripts working until the next major
version.

Aligns all wrapper versions at 4.1.0 (agents/openai.yaml had drifted to
2.2.0), adds ChatGPT desktop interface metadata to the skill, and
updates the release workflow to bump every manifest.
2026-08-07 15:14:56 +02:00

58 lines
1.7 KiB
JavaScript

const fs = require("fs");
const path = require("path");
const repoRoot = path.resolve(__dirname, "../..");
const readmePath = path.join(repoRoot, "README.md");
const referencesDir = path.join(repoRoot, "skills", "swiftui-expert-skill", "references");
const startMarker = "<!-- BEGIN REFERENCE STRUCTURE -->";
const endMarker = "<!-- END REFERENCE STRUCTURE -->";
const readme = fs.readFileSync(readmePath, "utf8");
const startIndex = readme.indexOf(startMarker);
const endIndex = readme.indexOf(endMarker);
if (startIndex === -1 || endIndex === -1 || endIndex < startIndex) {
throw new Error("Reference structure markers not found in README.md.");
}
const existingBlock = readme.slice(startIndex + startMarker.length, endIndex);
const descriptions = new Map();
for (const line of existingBlock.split("\n")) {
const match = line.match(/^\s+([a-z0-9-]+\.md)\s+-\s+(.*)$/i);
if (match) {
descriptions.set(match[1], match[2].trim());
}
}
const referenceFiles = fs
.readdirSync(referencesDir)
.filter((file) => file.endsWith(".md"))
.sort((a, b) => a.localeCompare(b));
const lines = [];
lines.push("```text");
lines.push("skills/swiftui-expert-skill/");
lines.push(" SKILL.md");
lines.push(" references/");
for (const file of referenceFiles) {
const description = descriptions.get(file);
if (description) {
lines.push(` ${file} - ${description}`);
} else {
lines.push(` ${file}`);
}
}
lines.push("```");
const newBlock = `${startMarker}\n${lines.join("\n")}\n${endMarker}`;
const updatedReadme =
readme.slice(0, startIndex) + newBlock + readme.slice(endIndex + endMarker.length);
if (updatedReadme !== readme) {
fs.writeFileSync(readmePath, updatedReadme);
}