@@ -136,6 +136,27 @@ jobs:
136136 data[key.strip()] = value.strip().strip("\"'")
137137 return data
138138
139+ def replace_marker_block(
140+ text: str,
141+ begin_marker: str,
142+ end_marker: str,
143+ replacement_lines: list[str],
144+ ) -> str:
145+ begin_idx = text.find(begin_marker)
146+ if begin_idx == -1:
147+ raise SystemExit(f"Missing marker: {begin_marker}")
148+
149+ begin_line_end = text.find("\n", begin_idx)
150+ if begin_line_end == -1:
151+ raise SystemExit(f"Broken marker line: {begin_marker}")
152+
153+ end_idx = text.find(end_marker, begin_line_end + 1)
154+ if end_idx == -1:
155+ raise SystemExit(f"Missing marker: {end_marker}")
156+
157+ replacement = "\n".join(replacement_lines).rstrip()
158+ return text[: begin_line_end + 1] + replacement + "\n" + text[end_idx:]
159+
139160 skills: list[dict[str, str]] = []
140161 for skill_md in sorted((repo / "skills").glob("*/SKILL.md")):
141162 skill_dir = skill_md.parent
@@ -223,21 +244,67 @@ jobs:
223244 "\n".join(skills_page_lines) + "\n",
224245 encoding="utf-8",
225246 )
226- PY
227247
228- - name : Copy TUTORIAL to github-pages
229- run : |
230- cat > github-pages/tutorial.md << 'EOF'
231- ---
232- layout: default
233- title: Tutorial
234- description: Step-by-step tutorial for bootstrapping an MCAF v1.2 repository through URLs, bootstrap templates, and direct GitHub skill folders.
235- keywords: MCAF tutorial, AGENTS.md setup, skill-first install, AI coding bootstrap, Codex skills, Claude Code skills
236- nav_order: 3
237- ---
238- EOF
239- sed -i 's/^ //' github-pages/tutorial.md
240- cat TUTORIAL.md >> github-pages/tutorial.md
248+ dotnet_optional_exclude = {
249+ "mcaf-dotnet-features",
250+ "mcaf-dotnet-quality-ci",
251+ "mcaf-dotnet-complexity",
252+ "mcaf-dotnet-xunit",
253+ "mcaf-dotnet-tunit",
254+ "mcaf-dotnet-mstest",
255+ }
256+ dotnet_optional = sorted(
257+ skill["name"]
258+ for skill in skills
259+ if skill["name"].startswith("mcaf-dotnet-")
260+ and skill["name"] not in dotnet_optional_exclude
261+ )
262+ dotnet_optional_lines = (
263+ [f"- `{skill_name}`" for skill_name in dotnet_optional]
264+ if dotnet_optional
265+ else ["- _No optional .NET skills found._"]
266+ )
267+
268+ all_skills_lines = [
269+ (
270+ f"- `{skill['name']}` — "
271+ f"[Folder]({skill['folder_url']}), "
272+ f"[Raw SKILL]({skill['skill_md_url']})"
273+ )
274+ for skill in skills
275+ ]
276+
277+ tutorial_body = (repo / "TUTORIAL.md").read_text(encoding="utf-8")
278+ tutorial_body = replace_marker_block(
279+ tutorial_body,
280+ "<!-- MCAF:DOTNET-OPTIONAL-SKILLS-BEGIN -->",
281+ "<!-- MCAF:DOTNET-OPTIONAL-SKILLS-END -->",
282+ dotnet_optional_lines,
283+ )
284+ tutorial_body = replace_marker_block(
285+ tutorial_body,
286+ "<!-- MCAF:ALL-SKILLS-BEGIN -->",
287+ "<!-- MCAF:ALL-SKILLS-END -->",
288+ all_skills_lines,
289+ )
290+
291+ tutorial_frontmatter = "\n".join(
292+ [
293+ "---",
294+ "layout: default",
295+ "title: Tutorial",
296+ "description: Step-by-step tutorial for bootstrapping an MCAF v1.2 repository through URLs, bootstrap templates, and direct GitHub skill folders.",
297+ "keywords: MCAF tutorial, AGENTS.md setup, skill-first install, AI coding bootstrap, Codex skills, Claude Code skills",
298+ "nav_order: 3",
299+ "---",
300+ "",
301+ ]
302+ )
303+ (repo / "github-pages" / "tutorial.md").write_text(
304+ tutorial_frontmatter + tutorial_body.rstrip() + "\n",
305+ encoding="utf-8",
306+ )
307+ PY
241308
242309 - name : Copy CREDITS to github-pages
243310 run : |
0 commit comments