Files
avdlee__xcode-build-optimiz…/scripts/render_recommendations.py
Antoine van der Lee cc642e0b52 Add Xcode build optimization skills, references, scripts, and plugin metadata
First versioned snapshot of the full skill repository including:
- Five installable agent skills under skills/
- Shared references, schemas, and helper scripts
- Plugin and marketplace metadata for Claude Code
- GitHub workflows for release and README sync
- Compilation caching as a recommended build setting
- Four deeper Swift compiler diagnostic flags for compilation analysis
- Fixed SWIFT_COMPILATION_MODE to use singlefile (actual build setting value)
2026-03-14 17:09:17 +01:00

62 lines
1.9 KiB
Python
Executable File

#!/usr/bin/env python3
import argparse
import json
from pathlib import Path
FIELD_LABELS = [
("category", "Category"),
("observed_evidence", "Observed evidence"),
("estimated_impact", "Estimated impact"),
("confidence", "Confidence"),
("approval_required", "Approval required"),
("benchmark_verification_status", "Benchmark verification status"),
("scope", "Scope"),
("risk_level", "Risk level"),
]
def render_recommendation(item: dict, index: int) -> str:
lines = [f"## {index}. {item.get('title', 'Untitled recommendation')}"]
for key, label in FIELD_LABELS:
value = item.get(key)
if value is None:
continue
if isinstance(value, list):
lines.append(f"**{label}:**")
for entry in value:
lines.append(f"- {entry}")
continue
lines.append(f"**{label}:** {value}")
if item.get("implementation_notes"):
lines.append("**Implementation notes:**")
for entry in item["implementation_notes"]:
lines.append(f"- {entry}")
return "\n".join(lines)
def main() -> int:
parser = argparse.ArgumentParser(description="Render recommendation JSON as Markdown.")
parser.add_argument("input", help="Path to a recommendation JSON file")
parser.add_argument("--output", help="Optional output Markdown path")
args = parser.parse_args()
payload = json.loads(Path(args.input).read_text())
recommendations = payload.get("recommendations", [])
sections = ["# Xcode Build Recommendations", ""]
for index, item in enumerate(recommendations, start=1):
sections.append(render_recommendation(item, index))
sections.append("")
markdown = "\n".join(sections).rstrip() + "\n"
if args.output:
Path(args.output).write_text(markdown)
else:
print(markdown, end="")
return 0
if __name__ == "__main__":
raise SystemExit(main())