'
- )
- toc_html = "".join(toc_items)
+ path_parts = i.rel.split('/')
+ current = file_tree
+ for part in path_parts[:-1]: # directories
+ if part not in current:
+ current[part] = {}
+ current = current[part]
+ # Add file to the current directory
+ if '_files' not in current:
+ current['_files'] = []
+ current['_files'].append(i)
+
+ def generate_tree_items(tree, path_prefix="", depth=0):
+ items = []
+
+ # First add directories
+ for dir_name in sorted(key for key in tree.keys() if key != '_files'):
+ dir_path = f"{path_prefix}/{dir_name}" if path_prefix else dir_name
+ indent = " " * depth
+ folder_icon = "๐" if depth == 0 else "๐"
+ items.append(f'
{indent}{folder_icon} {html.escape(dir_name)}/
')
+ items.extend(generate_tree_items(tree[dir_name], dir_path, depth + 1))
+
+ # Then add files in current directory
+ if '_files' in tree:
+ for file_info in sorted(tree['_files'], key=lambda f: f.rel.split('/')[-1].lower()):
+ anchor = slugify(file_info.rel)
+ filename = file_info.rel.split('/')[-1]
+ indent = " " * (depth + 1)
+
+ # Get file icon
+ ext = pathlib.Path(filename).suffix.lower()
+ file_icon = "๐" # default
+ if ext in MARKDOWN_EXTENSIONS:
+ file_icon = "๐"
+ elif ext in {".py", ".pyw"}:
+ file_icon = "๐"
+ elif ext in {".js", ".jsx", ".ts", ".tsx"}:
+ file_icon = "โก"
+ elif ext in {".html", ".htm"}:
+ file_icon = "๐"
+ elif ext in {".css", ".scss", ".sass", ".less"}:
+ file_icon = "๐จ"
+ elif ext in {".json", ".jsonl", ".yaml", ".yml", ".toml"}:
+ file_icon = "โ๏ธ"
+ elif ext in {".sh", ".bash", ".zsh", ".fish", ".ps1", ".bat", ".cmd"}:
+ file_icon = "๐ง"
+ elif ext in {".sql"}:
+ file_icon = "๐๏ธ"
+ elif ext in {".java", ".class"}:
+ file_icon = "โ"
+ elif ext in {".cpp", ".cc", ".cxx", ".c", ".h", ".hpp"}:
+ file_icon = "โ๏ธ"
+ elif ext in {".rs"}:
+ file_icon = "๐ฆ"
+ elif ext in {".go"}:
+ file_icon = "๐ต"
+ elif ext in {".php"}:
+ file_icon = "๐"
+ elif ext in {".rb"}:
+ file_icon = "๐"
+ elif ext in {".swift"}:
+ file_icon = "๐๏ธ"
+ elif ext in {".kt", ".kts"}:
+ file_icon = "๐ฑ"
+ elif filename.lower() in {"readme", "readme.md", "readme.txt"}:
+ file_icon = "๐"
+ elif filename.lower() in {"license", "licence", "copying"}:
+ file_icon = "๐"
+ elif ext in {".txt", ".log"}:
+ file_icon = "๐"
+ elif ext in {".xml"}:
+ file_icon = "๐ท๏ธ"
+ elif ext in {".gitignore", ".gitattributes"}:
+ file_icon = "๐"
+
+ items.append(f'
Copy the text below and paste it to an LLM for analysis:
+
+
๐ค LLM-Optimized View
+
+ This view presents the repository content in CXML format, optimized for Large Language Model analysis.
+ Simply copy the content below and paste it into your preferred LLM interface.
+
- ๐ก Tip: Click in the text area and press Ctrl+A (Cmd+A on Mac) to select all, then Ctrl+C (Cmd+C) to copy.
+ ๐ก Pro tip: Click in the text area above and use Ctrl+A (or Cmd+A on Mac) to select all content, then Ctrl+C (or Cmd+C) to copy to clipboard.