MCPcopy Create free account
hub / github.com/OWASP/APTS / main

Function main

scripts/sync_index_from_readme.py:83–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81
82
83def main() -> int:
84 if not repo_path(README).is_file():
85 print(f"FAILED: {display_path(README)} not found.")
86 return 1
87 if not repo_path(INDEX).is_file():
88 print(f"FAILED: {display_path(INDEX)} not found.")
89 return 1
90
91 readme_text = read_text(README)
92 index_text = read_text(INDEX)
93
94 front_matter, _existing_body = split_front_matter(index_text)
95 new_index_text = build_index(front_matter, readme_text)
96
97 if new_index_text == index_text:
98 print(f"{display_path(INDEX)} already in sync with {display_path(README)}.")
99 return 0
100
101 repo_path(INDEX).write_text(new_index_text, encoding="utf-8")
102 print(f"Updated {display_path(INDEX)} from {display_path(README)}.")
103 return 0
104
105
106if __name__ == "__main__":

Callers 1

Calls 5

repo_pathFunction · 0.90
display_pathFunction · 0.90
read_textFunction · 0.90
build_indexFunction · 0.85
split_front_matterFunction · 0.70

Tested by

no test coverage detected