mirror of
https://github.com/AvdLee/Xcode-Build-Optimization-Agent-Skill.git
synced 2026-09-14 13:59:59 +08:00
cc642e0b52
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)
62 lines
1.9 KiB
Python
Executable File
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())
|