ai-docs-gen 0.1.5__tar.gz → 0.1.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/PKG-INFO +1 -1
  2. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/generator.py +32 -0
  3. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/tokenizer.py +1 -1
  4. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/PKG-INFO +1 -1
  5. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/pyproject.toml +1 -1
  6. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/README.md +0 -0
  7. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/__init__.py +0 -0
  8. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/__main__.py +0 -0
  9. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/assets/mermaid.min.js +0 -0
  10. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/cache.py +0 -0
  11. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/changes.py +0 -0
  12. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/cli.py +0 -0
  13. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/domain.py +0 -0
  14. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/llm.py +0 -0
  15. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/mkdocs.py +0 -0
  16. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/scanner.py +0 -0
  17. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/summary.py +0 -0
  18. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs/utils.py +0 -0
  19. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/SOURCES.txt +0 -0
  20. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/dependency_links.txt +0 -0
  21. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/entry_points.txt +0 -0
  22. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/requires.txt +0 -0
  23. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/ai_docs_gen.egg-info/top_level.txt +0 -0
  24. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/setup.cfg +0 -0
  25. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/tests/test_cache.py +0 -0
  26. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/tests/test_changes.py +0 -0
  27. {ai_docs_gen-0.1.5 → ai_docs_gen-0.1.8}/tests/test_scanner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-docs-gen
3
- Version: 0.1.5
3
+ Version: 0.1.8
4
4
  Summary: CLI-инструмент для генерации технической документации по коду и конфигурациям
5
5
  Requires-Python: >=3.8
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,7 @@
1
1
  import json
2
2
  from datetime import datetime
3
3
  import os
4
+ import re
4
5
  import shutil
5
6
  import subprocess
6
7
  from pathlib import Path
@@ -942,6 +943,7 @@ def generate_docs(
942
943
  if not mkdocs_bin:
943
944
  raise RuntimeError("mkdocs is not installed or not on PATH")
944
945
  subprocess.check_call([mkdocs_bin, "build", "-f", "mkdocs.yml"], cwd=output_root)
946
+ _postprocess_mermaid_html(output_root / "ai_docs_site")
945
947
  print("[ai-docs] mkdocs: done")
946
948
 
947
949
  # Save cache
@@ -957,3 +959,33 @@ def generate_docs(
957
959
  print("[ai-docs] errors summary:")
958
960
  for item in errors:
959
961
  print(f"[ai-docs] error: {item}")
962
+
963
+
964
+ def _postprocess_mermaid_html(site_dir: Path) -> None:
965
+ if not site_dir.exists():
966
+ return
967
+
968
+ mermaid_div_re = re.compile(r'(<div class="mermaid">)(.*?)(</div>)', re.DOTALL)
969
+ bracket_re = re.compile(r"\\[([^\\]]*)\\]")
970
+
971
+ for path in site_dir.rglob("*.html"):
972
+ text = path.read_text(encoding="utf-8")
973
+ if 'class="mermaid"' not in text:
974
+ continue
975
+
976
+ def _fix_mermaid(match: re.Match) -> str:
977
+ head, body, tail = match.groups()
978
+ body = body.replace("&gt;", ">")
979
+
980
+ def _fix_brackets(bmatch: re.Match) -> str:
981
+ inner = bmatch.group(1).replace("(", " ").replace(")", "")
982
+ inner = re.sub(r"[ \\t]+", " ", inner)
983
+ return f"[{inner}]"
984
+
985
+ body = bracket_re.sub(_fix_brackets, body)
986
+ body = re.sub(r"[ \\t]+", " ", body)
987
+ return f"{head}{body}{tail}"
988
+
989
+ updated = mermaid_div_re.sub(_fix_mermaid, text)
990
+ if updated != text:
991
+ path.write_text(updated, encoding="utf-8")
@@ -16,7 +16,7 @@ def get_encoding(model: str):
16
16
  return tiktoken.encoding_for_model(model)
17
17
  except KeyError:
18
18
  try:
19
- return tiktoken.get_encoding("o200k_base")
19
+ return tiktoken.get_encoding("cl100k_base")
20
20
  except Exception:
21
21
  return _ByteEncoding()
22
22
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-docs-gen
3
- Version: 0.1.5
3
+ Version: 0.1.8
4
4
  Summary: CLI-инструмент для генерации технической документации по коду и конфигурациям
5
5
  Requires-Python: >=3.8
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ai-docs-gen"
7
- version = "0.1.5"
7
+ version = "0.1.8"
8
8
  description = "CLI-инструмент для генерации технической документации по коду и конфигурациям"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
File without changes
File without changes
File without changes
File without changes