deepdoc 0.2.1__tar.gz → 0.4.0__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 (202) hide show
  1. deepdoc-0.4.0/PKG-INFO +1563 -0
  2. deepdoc-0.4.0/README.md +1524 -0
  3. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/__init__.py +1 -1
  4. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/__main__.py +0 -1
  5. deepdoc-0.4.0/deepdoc/benchmark_v2.py +682 -0
  6. deepdoc-0.4.0/deepdoc/call_graph.py +811 -0
  7. deepdoc-0.4.0/deepdoc/changelog_writer.py +168 -0
  8. deepdoc-0.4.0/deepdoc/chatbot/answer_mixin.py +1031 -0
  9. deepdoc-0.4.0/deepdoc/chatbot/chunker.py +1256 -0
  10. deepdoc-0.4.0/deepdoc/chatbot/constants.py +27 -0
  11. deepdoc-0.4.0/deepdoc/chatbot/deep_research.py +848 -0
  12. deepdoc-0.4.0/deepdoc/chatbot/docs_summary.py +563 -0
  13. deepdoc-0.4.0/deepdoc/chatbot/embeddings.py +243 -0
  14. deepdoc-0.4.0/deepdoc/chatbot/indexer.py +533 -0
  15. deepdoc-0.4.0/deepdoc/chatbot/linking.py +86 -0
  16. deepdoc-0.4.0/deepdoc/chatbot/live_fallback_mixin.py +210 -0
  17. deepdoc-0.4.0/deepdoc/chatbot/persistence.py +511 -0
  18. deepdoc-0.4.0/deepdoc/chatbot/providers.py +342 -0
  19. deepdoc-0.4.0/deepdoc/chatbot/retrieval_mixin.py +1365 -0
  20. deepdoc-0.4.0/deepdoc/chatbot/routes.py +255 -0
  21. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/chatbot/scaffold.py +10 -1
  22. deepdoc-0.4.0/deepdoc/chatbot/service.py +691 -0
  23. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/chatbot/settings.py +73 -29
  24. deepdoc-0.4.0/deepdoc/chatbot/source_archive.py +319 -0
  25. deepdoc-0.4.0/deepdoc/chatbot/symbol_index.py +82 -0
  26. deepdoc-0.4.0/deepdoc/chatbot/types.py +139 -0
  27. deepdoc-0.4.0/deepdoc/cli.py +1599 -0
  28. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/config.py +105 -20
  29. deepdoc-0.4.0/deepdoc/generator/__init__.py +21 -0
  30. deepdoc-0.4.0/deepdoc/generator/consistency.py +128 -0
  31. deepdoc-0.4.0/deepdoc/generator/evidence.py +1907 -0
  32. deepdoc-0.4.0/deepdoc/generator/generation.py +1504 -0
  33. deepdoc-0.4.0/deepdoc/generator/post_processors.py +903 -0
  34. deepdoc-0.4.0/deepdoc/generator/validation.py +1030 -0
  35. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/llm/__init__.py +2 -1
  36. deepdoc-0.4.0/deepdoc/llm/client.py +199 -0
  37. deepdoc-0.4.0/deepdoc/llm/json_utils.py +170 -0
  38. deepdoc-0.4.0/deepdoc/llm/retry.py +100 -0
  39. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/manifest.py +0 -1
  40. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/openapi.py +10 -25
  41. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/base.py +42 -9
  42. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/go_parser.py +227 -134
  43. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/js_ts_parser.py +245 -130
  44. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/php_parser.py +188 -111
  45. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/python_parser.py +83 -45
  46. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/registry.py +3 -3
  47. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/base.py +2 -1
  48. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/django.py +0 -1
  49. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/falcon.py +65 -2
  50. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/fastify.py +25 -2
  51. deepdoc-0.4.0/deepdoc/parser/routes/go.py +349 -0
  52. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/js_shared.py +73 -1
  53. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/laravel.py +0 -1
  54. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/nestjs.py +16 -6
  55. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/registry.py +0 -5
  56. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/repo_resolver.py +484 -25
  57. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/vue_parser.py +4 -4
  58. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/persistence_v2.py +359 -40
  59. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/pipeline_v2.py +481 -113
  60. deepdoc-0.4.0/deepdoc/planner/__init__.py +3 -0
  61. deepdoc-0.4.0/deepdoc/planner/bucket_injection.py +568 -0
  62. deepdoc-0.4.0/deepdoc/planner/bucket_refinement.py +797 -0
  63. deepdoc-0.4.0/deepdoc/planner/common.py +697 -0
  64. deepdoc-0.4.0/deepdoc/planner/endpoint_refs.py +290 -0
  65. deepdoc-0.4.0/deepdoc/planner/engine.py +821 -0
  66. deepdoc-0.4.0/deepdoc/planner/flow_candidates.py +617 -0
  67. deepdoc-0.4.0/deepdoc/planner/heuristics.py +1302 -0
  68. deepdoc-0.4.0/deepdoc/planner/nav_shaping.py +360 -0
  69. deepdoc-0.4.0/deepdoc/planner/specializations.py +740 -0
  70. deepdoc-0.4.0/deepdoc/planner/topology.py +407 -0
  71. deepdoc-0.4.0/deepdoc/planner/utils.py +601 -0
  72. deepdoc-0.4.0/deepdoc/prompts/__init__.py +78 -0
  73. deepdoc-0.4.0/deepdoc/prompts/bucket_types.py +1198 -0
  74. deepdoc-0.4.0/deepdoc/prompts/page_types.py +487 -0
  75. deepdoc-0.4.0/deepdoc/prompts/selectors.py +81 -0
  76. deepdoc-0.4.0/deepdoc/prompts/system.py +130 -0
  77. deepdoc-0.4.0/deepdoc/prompts/update.py +35 -0
  78. deepdoc-0.4.0/deepdoc/py.typed +0 -0
  79. deepdoc-0.4.0/deepdoc/scanner/__init__.py +50 -0
  80. deepdoc-0.4.0/deepdoc/scanner/artifacts.py +375 -0
  81. deepdoc-0.4.0/deepdoc/scanner/clustering.py +255 -0
  82. deepdoc-0.4.0/deepdoc/scanner/common.py +354 -0
  83. deepdoc-0.4.0/deepdoc/scanner/database.py +520 -0
  84. deepdoc-0.4.0/deepdoc/scanner/endpoints.py +124 -0
  85. deepdoc-0.4.0/deepdoc/scanner/integrations.py +371 -0
  86. deepdoc-0.4.0/deepdoc/scanner/runtime.py +674 -0
  87. deepdoc-0.4.0/deepdoc/scanner/utils.py +144 -0
  88. deepdoc-0.4.0/deepdoc/site/builder/__init__.py +4 -0
  89. deepdoc-0.4.0/deepdoc/site/builder/common.py +12 -0
  90. deepdoc-0.4.0/deepdoc/site/builder/mdx_utils.py +152 -0
  91. deepdoc-0.4.0/deepdoc/site/builder/mkdocs_builder.py +2150 -0
  92. deepdoc-0.4.0/deepdoc/site/builder/next_builder.py +259 -0
  93. deepdoc-0.4.0/deepdoc/site/builder/next_template/.gitignore +4 -0
  94. deepdoc-0.4.0/deepdoc/site/builder/next_template/app/(main)/[[...slug]]/page.tsx +37 -0
  95. deepdoc-0.4.0/deepdoc/site/builder/next_template/app/(main)/layout.tsx +60 -0
  96. deepdoc-0.4.0/deepdoc/site/builder/next_template/app/[[...slug]]/page.tsx +37 -0
  97. deepdoc-0.4.0/deepdoc/site/builder/next_template/app/ask/layout.tsx +7 -0
  98. deepdoc-0.4.0/deepdoc/site/builder/next_template/app/ask/page.tsx +630 -0
  99. deepdoc-0.4.0/deepdoc/site/builder/next_template/app/globals.css +235 -0
  100. deepdoc-0.4.0/deepdoc/site/builder/next_template/app/layout.tsx +42 -0
  101. deepdoc-0.4.0/deepdoc/site/builder/next_template/components/chatbot.tsx +201 -0
  102. deepdoc-0.4.0/deepdoc/site/builder/next_template/deepdoc.config.json +13 -0
  103. deepdoc-0.4.0/deepdoc/site/builder/next_template/lib/config.ts +27 -0
  104. deepdoc-0.4.0/deepdoc/site/builder/next_template/lib/docs.ts +166 -0
  105. deepdoc-0.4.0/deepdoc/site/builder/next_template/lib/nav.ts +46 -0
  106. deepdoc-0.4.0/deepdoc/site/builder/next_template/next.config.mjs +12 -0
  107. deepdoc-0.4.0/deepdoc/site/builder/next_template/package.json +34 -0
  108. deepdoc-0.4.0/deepdoc/site/builder/next_template/tsconfig.json +21 -0
  109. deepdoc-0.4.0/deepdoc/site/builder/vendor/highlight.min.js +1232 -0
  110. deepdoc-0.4.0/deepdoc/site/builder/vendor/hljs-theme.css +10 -0
  111. deepdoc-0.4.0/deepdoc/site/builder/vendor/markdown-it.min.js +2 -0
  112. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/smart_update_v2.py +666 -177
  113. deepdoc-0.4.0/deepdoc/source_metadata.py +220 -0
  114. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/updater_v2.py +15 -15
  115. deepdoc-0.4.0/deepdoc/v2_models.py +195 -0
  116. deepdoc-0.4.0/deepdoc.egg-info/PKG-INFO +1563 -0
  117. deepdoc-0.4.0/deepdoc.egg-info/SOURCES.txt +169 -0
  118. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc.egg-info/requires.txt +1 -0
  119. {deepdoc-0.2.1 → deepdoc-0.4.0}/pyproject.toml +14 -1
  120. deepdoc-0.4.0/tests/test_benchmark_scorecard.py +409 -0
  121. deepdoc-0.4.0/tests/test_call_graph.py +233 -0
  122. deepdoc-0.4.0/tests/test_changelog.py +76 -0
  123. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_chatbot_config.py +35 -3
  124. deepdoc-0.4.0/tests/test_chatbot_embeddings.py +67 -0
  125. deepdoc-0.4.0/tests/test_chatbot_eval.py +439 -0
  126. deepdoc-0.4.0/tests/test_chatbot_index.py +847 -0
  127. deepdoc-0.4.0/tests/test_chatbot_persistence.py +42 -0
  128. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_chatbot_providers.py +33 -0
  129. deepdoc-0.4.0/tests/test_chatbot_query.py +3235 -0
  130. deepdoc-0.4.0/tests/test_chatbot_relationship.py +341 -0
  131. deepdoc-0.4.0/tests/test_chatbot_scaffold.py +40 -0
  132. deepdoc-0.4.0/tests/test_chatbot_source_archive.py +209 -0
  133. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_classify.py +57 -22
  134. deepdoc-0.4.0/tests/test_cli_serve.py +243 -0
  135. deepdoc-0.4.0/tests/test_cli_update.py +80 -0
  136. deepdoc-0.4.0/tests/test_consistency_pass.py +112 -0
  137. deepdoc-0.4.0/tests/test_flow_candidates.py +127 -0
  138. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_framework_fixtures.py +51 -2
  139. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_framework_support.py +211 -4
  140. deepdoc-0.4.0/tests/test_generation_evidence.py +2430 -0
  141. deepdoc-0.4.0/tests/test_internal_docs_metadata.py +418 -0
  142. deepdoc-0.4.0/tests/test_llm_json_utils.py +130 -0
  143. deepdoc-0.4.0/tests/test_llm_retry.py +90 -0
  144. deepdoc-0.4.0/tests/test_mkdocs_builder.py +920 -0
  145. deepdoc-0.4.0/tests/test_next_builder.py +254 -0
  146. deepdoc-0.4.0/tests/test_parallel_pipeline.py +482 -0
  147. deepdoc-0.4.0/tests/test_parser_ranges.py +70 -0
  148. deepdoc-0.4.0/tests/test_planner_consolidation.py +554 -0
  149. deepdoc-0.4.0/tests/test_planner_granularity.py +1688 -0
  150. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_route_registry.py +1 -3
  151. deepdoc-0.4.0/tests/test_runtime_scan.py +433 -0
  152. deepdoc-0.4.0/tests/test_smart_update.py +600 -0
  153. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_stale.py +28 -0
  154. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_state.py +18 -2
  155. deepdoc-0.2.1/PKG-INFO +0 -1056
  156. deepdoc-0.2.1/README.md +0 -1018
  157. deepdoc-0.2.1/deepdoc/_legacy_types.py +0 -48
  158. deepdoc-0.2.1/deepdoc/benchmark_v2.py +0 -124
  159. deepdoc-0.2.1/deepdoc/chatbot/chunker.py +0 -508
  160. deepdoc-0.2.1/deepdoc/chatbot/docs_summary.py +0 -114
  161. deepdoc-0.2.1/deepdoc/chatbot/indexer.py +0 -176
  162. deepdoc-0.2.1/deepdoc/chatbot/persistence.py +0 -148
  163. deepdoc-0.2.1/deepdoc/chatbot/providers.py +0 -137
  164. deepdoc-0.2.1/deepdoc/chatbot/service.py +0 -359
  165. deepdoc-0.2.1/deepdoc/chatbot/types.py +0 -50
  166. deepdoc-0.2.1/deepdoc/cli.py +0 -947
  167. deepdoc-0.2.1/deepdoc/generator_v2.py +0 -2276
  168. deepdoc-0.2.1/deepdoc/llm/client.py +0 -84
  169. deepdoc-0.2.1/deepdoc/parser/routes/fastapi.py +0 -65
  170. deepdoc-0.2.1/deepdoc/parser/routes/flask.py +0 -55
  171. deepdoc-0.2.1/deepdoc/parser/routes/go.py +0 -91
  172. deepdoc-0.2.1/deepdoc/planner_v2.py +0 -2978
  173. deepdoc-0.2.1/deepdoc/prompts_v2.py +0 -1280
  174. deepdoc-0.2.1/deepdoc/scan_v2.py +0 -1157
  175. deepdoc-0.2.1/deepdoc/site/fumadocs_builder_v2.py +0 -1793
  176. deepdoc-0.2.1/deepdoc.egg-info/PKG-INFO +0 -1056
  177. deepdoc-0.2.1/deepdoc.egg-info/SOURCES.txt +0 -84
  178. deepdoc-0.2.1/tests/test_chatbot_index.py +0 -160
  179. deepdoc-0.2.1/tests/test_chatbot_query.py +0 -362
  180. deepdoc-0.2.1/tests/test_chatbot_scaffold.py +0 -76
  181. deepdoc-0.2.1/tests/test_cli_serve.py +0 -44
  182. deepdoc-0.2.1/tests/test_fumadocs_builder.py +0 -432
  183. deepdoc-0.2.1/tests/test_generation_evidence.py +0 -202
  184. deepdoc-0.2.1/tests/test_planner_granularity.py +0 -653
  185. deepdoc-0.2.1/tests/test_smart_update.py +0 -214
  186. {deepdoc-0.2.1 → deepdoc-0.4.0}/LICENSE +0 -0
  187. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/chatbot/__init__.py +0 -0
  188. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/llm/litellm_compat.py +0 -0
  189. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/__init__.py +0 -0
  190. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/api_detector.py +1 -1
  191. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/__init__.py +1 -1
  192. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/common.py +0 -0
  193. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/detector.py +0 -0
  194. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/express.py +0 -0
  195. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/parser/routes/python_shared.py +0 -0
  196. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc/site/__init__.py +0 -0
  197. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc.egg-info/dependency_links.txt +0 -0
  198. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc.egg-info/entry_points.txt +0 -0
  199. {deepdoc-0.2.1 → deepdoc-0.4.0}/deepdoc.egg-info/top_level.txt +0 -0
  200. {deepdoc-0.2.1 → deepdoc-0.4.0}/setup.cfg +0 -0
  201. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_cli_generate.py +0 -0
  202. {deepdoc-0.2.1 → deepdoc-0.4.0}/tests/test_litellm_compat.py +0 -0
deepdoc-0.4.0/PKG-INFO ADDED
@@ -0,0 +1,1563 @@
1
+ Metadata-Version: 2.4
2
+ Name: deepdoc
3
+ Version: 0.4.0
4
+ Summary: Auto-generate beautiful docs from any codebase
5
+ Author: Pranav Kumar
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/tss-pranavkumar/deepdoc
8
+ Project-URL: Repository, https://github.com/tss-pranavkumar/deepdoc
9
+ Project-URL: Issues, https://github.com/tss-pranavkumar/deepdoc/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: click>=8.1
20
+ Requires-Dist: litellm>=1.40
21
+ Requires-Dist: gitpython>=3.1
22
+ Requires-Dist: tree-sitter>=0.22
23
+ Requires-Dist: tree-sitter-python>=0.22
24
+ Requires-Dist: tree-sitter-javascript>=0.22
25
+ Requires-Dist: tree-sitter-typescript>=0.22
26
+ Requires-Dist: tree-sitter-go>=0.22
27
+ Requires-Dist: tree-sitter-php>=0.22
28
+ Requires-Dist: pyyaml>=6.0
29
+ Requires-Dist: rich>=13.0
30
+ Requires-Dist: jinja2>=3.1
31
+ Provides-Extra: chatbot
32
+ Requires-Dist: numpy>=1.26; extra == "chatbot"
33
+ Requires-Dist: faiss-cpu>=1.8.0; extra == "chatbot"
34
+ Requires-Dist: fastapi>=0.115; extra == "chatbot"
35
+ Requires-Dist: uvicorn>=0.30; extra == "chatbot"
36
+ Requires-Dist: httpx>=0.27; extra == "chatbot"
37
+ Requires-Dist: fastembed>=0.3.0; extra == "chatbot"
38
+ Dynamic: license-file
39
+
40
+ # DeepDoc
41
+
42
+ [![PyPI version](https://img.shields.io/pypi/v/deepdoc)](https://pypi.org/project/deepdoc/)
43
+ [![Python versions](https://img.shields.io/pypi/pyversions/deepdoc)](https://pypi.org/project/deepdoc/)
44
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
45
+
46
+ ## Repository Layout
47
+
48
+ | Directory | What it is | Where to start |
49
+ |---|---|---|
50
+ | [`deepdoc/`](./deepdoc/) | The Python package — CLI, pipeline, planner, generator, chatbot, and site builder. This is the core product. | [`deepdoc/README.md`](./deepdoc/README.md) |
51
+ | [`web/`](./web/) | Marketing and changelog site built with Astro 5 + Tailwind. Deployed to the public DeepDoc website. | [`web/README.md`](./web/README.md) |
52
+ | [`vscode-extension/`](./vscode-extension/) | VS Code extension — explains selected code snippets in Fast or Deep mode and inserts AI-generated comments inline. | [`vscode-extension/README.md`](./vscode-extension/README.md) |
53
+ | [`tests/`](./tests/) | pytest test suite for the Python package. | Run `python3 -m pytest -q` from repo root. |
54
+ | [`scripts/`](./scripts/) | One-off release and maintenance scripts. | — |
55
+
56
+ ---
57
+
58
+ Auto-generate deep engineering documentation from real codebases using AI.
59
+
60
+ DeepDoc scans your repo, builds a bucket-based documentation plan, generates rich Markdown pages with Mermaid diagrams, and builds a local-first Next.js + Fumadocs site with built-in search.
61
+
62
+ ## Contents
63
+
64
+ - [Quick Start](#quick-start)
65
+ - [Chatbot in 5 Minutes](#chatbot-in-5-minutes)
66
+ - [Installation](#installation)
67
+ - [Commands](#commands)
68
+ - [LLM Provider Setup](#llm-provider-setup)
69
+ - [Configuration](#configuration)
70
+ - [Chatbot](#chatbot)
71
+ - [Supported Languages & Frameworks](#supported-languages--frameworks)
72
+ - [Architecture](#architecture)
73
+ - [Generated Files](#generated-files)
74
+ - [GitHub Actions CI/CD](#github-actions-cicd)
75
+ - [Requirements](#requirements)
76
+ - [Contributing & Release Flow](./CONTRIBUTING.md)
77
+
78
+ ---
79
+
80
+ ## Features
81
+
82
+ - **Bucket-based documentation architecture** — system, feature, endpoint, integration, and database buckets instead of one-file-per-page noise.
83
+ - **Multi-step AI planner** — classifies the repo, proposes buckets, then assigns files, symbols, artifacts, and dependencies into a final reader-first plan.
84
+ - **Giant-file handling** — large files are decomposed into feature-aligned clusters so a single controller can feed multiple doc pages.
85
+ - **Stable plain-Markdown generation** — generated pages are plain CommonMark (no MDX/JSX compile step, so a page can never fail to build); they are repaired and validated in Python before being written, and deploy-time quality gates block failed, invalid, or stub pages before the build.
86
+ - **Evidence-first chatbot answers** — final code proof is hydrated from archived source snippets with exact file paths and line ranges, not just retrieval guesses.
87
+ - **Incremental updates** — `deepdoc update` regenerates only stale or structurally affected docs against the last synced commit.
88
+ - **OpenAPI-aware API docs** — auto-detects OpenAPI/Swagger specs and renders an interactive Swagger UI page in the generated site.
89
+ - **Local-first Next.js + Fumadocs site** — generates a `site/` shell (Fumadocs UI, Mermaid, syntax highlighting, built-in search); `deepdoc deploy` runs `next build` and exports a static site to any host. Requires Node.js ≥18.
90
+
91
+ Works with Anthropic, OpenAI, Azure OpenAI, Google Gemini, Ollama, and any other LiteLLM-compatible provider. Parses Python, JavaScript/TypeScript, Go, PHP, and Vue.
92
+
93
+ ---
94
+
95
+ ## Installation
96
+
97
+ ### From PyPI (recommended)
98
+
99
+ ```bash
100
+ pip install deepdoc
101
+ ```
102
+
103
+ If you want DeepDoc's chatbot features, install the `chatbot` extra:
104
+
105
+ ```bash
106
+ pip install "deepdoc[chatbot]"
107
+ ```
108
+
109
+ The base install does not include chatbot dependencies.
110
+
111
+ ### From source (recommended during development)
112
+
113
+ ```bash
114
+ git clone https://github.com/tss-pranavkumar/deepdoc.git
115
+ cd deepdoc
116
+ pip install -e .
117
+ ```
118
+
119
+ If you want chatbot features during development:
120
+
121
+ ```bash
122
+ pip install -e ".[chatbot]"
123
+ ```
124
+
125
+ If the full install is slow due to tree-sitter compilation, install core deps first:
126
+
127
+ ```bash
128
+ pip install click litellm gitpython rich pyyaml jinja2
129
+ pip install -e . --no-deps
130
+ ```
131
+
132
+ To preview or deploy the generated site you also need **Node.js ≥18** (for `next dev` / `next build`). Install it from [nodejs.org](https://nodejs.org) if needed — `deepdoc serve` / `deepdoc deploy` will check for it and give a clear error if it's missing.
133
+
134
+ ### Verify installation
135
+
136
+ ```bash
137
+ deepdoc --version
138
+ deepdoc --help
139
+ python -m deepdoc --help
140
+ node --version # verify Node.js ≥18 is installed (needed for deepdoc serve/deploy)
141
+ ```
142
+
143
+ If you installed the chatbot extra, you can verify those dependencies with:
144
+
145
+ ```bash
146
+ pip show faiss-cpu fastapi uvicorn
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Quick Start
152
+
153
+ ### Docs only
154
+
155
+ ```bash
156
+ cd /path/to/your-project
157
+ deepdoc init --provider anthropic
158
+ export ANTHROPIC_API_KEY=sk-ant-...
159
+ deepdoc generate
160
+ deepdoc serve # → http://localhost:3000
161
+ ```
162
+
163
+ ### Docs + chatbot — one env var
164
+
165
+ ```bash
166
+ cd /path/to/your-project
167
+ pip install "deepdoc[chatbot]"
168
+ deepdoc init --with-chatbot --provider anthropic
169
+ export ANTHROPIC_API_KEY=sk-ant-...
170
+ deepdoc generate
171
+ deepdoc serve # → http://localhost:3000 • chatbot at /ask
172
+ ```
173
+
174
+ The chatbot reuses your doc-gen LLM and runs embeddings locally via `fastembed`. **No extra keys, no extra config.** Swap `--provider anthropic` for `openai`, `gemini`, `azure`, or `ollama` to use a different LLM.
175
+
176
+ When `chatbot.enabled` is `false`, DeepDoc generates a docs-only site: no chatbot route, no chatbot UI components, and no `chatbot_backend/` scaffold.
177
+
178
+ ---
179
+
180
+ ## Chatbot in 5 Minutes
181
+
182
+ > **Defaults work out of the box.** The chatbot inherits your `llm.*` config and runs embeddings locally via `fastembed`. The recipes below only add config when you actually need to override the defaults (Azure endpoints, custom Ollama base URL, or mixing providers).
183
+
184
+ ### Single provider — one key for everything
185
+
186
+ This is the path 95% of users want. Anthropic shown; swap `--provider` for `openai`, `gemini`, etc.
187
+
188
+ ```bash
189
+ pip install "deepdoc[chatbot]"
190
+ cd /path/to/your-project
191
+
192
+ deepdoc init --with-chatbot --provider anthropic
193
+ export ANTHROPIC_API_KEY=sk-ant-...
194
+
195
+ deepdoc generate
196
+ deepdoc serve
197
+ # → Docs at http://localhost:3000 • Chatbot at http://localhost:3000/ask
198
+ ```
199
+
200
+ ### Mix providers — different LLM for chat than for docs
201
+
202
+ Use Claude for docs (great long-form), GPT-4o-mini for chat answers (fast + cheap), local embeddings.
203
+
204
+ ```bash
205
+ pip install "deepdoc[chatbot]"
206
+ cd /path/to/your-project
207
+
208
+ deepdoc init --with-chatbot --provider anthropic
209
+ export ANTHROPIC_API_KEY=sk-ant-...
210
+ export OPENAI_API_KEY=sk-...
211
+
212
+ deepdoc config set chatbot.answer.provider openai
213
+ deepdoc config set chatbot.answer.model gpt-4o-mini
214
+ deepdoc config set chatbot.answer.api_key_env OPENAI_API_KEY
215
+
216
+ deepdoc generate
217
+ deepdoc serve
218
+ ```
219
+
220
+ Want cloud embeddings instead of local? Add:
221
+
222
+ ```bash
223
+ deepdoc config set chatbot.embeddings.backend litellm
224
+ deepdoc config set chatbot.embeddings.provider openai
225
+ deepdoc config set chatbot.embeddings.model text-embedding-3-large
226
+ deepdoc config set chatbot.embeddings.api_key_env OPENAI_API_KEY
227
+ ```
228
+
229
+ ### Azure OpenAI
230
+
231
+ Azure deployments need explicit endpoint + API-version values. Replace `YOUR-RESOURCE` and deployment names with your actual values.
232
+
233
+ ```bash
234
+ pip install "deepdoc[chatbot]"
235
+ cd /path/to/your-project
236
+
237
+ export AZURE_API_KEY=...
238
+ export AZURE_API_BASE=https://YOUR-RESOURCE.openai.azure.com
239
+
240
+ deepdoc init --with-chatbot --provider azure --model azure/gpt-4o
241
+ deepdoc config set llm.base_url $AZURE_API_BASE
242
+
243
+ # Only embeddings need separate Azure config (different deployment)
244
+ deepdoc config set chatbot.embeddings.backend litellm
245
+ deepdoc config set chatbot.embeddings.provider azure
246
+ deepdoc config set chatbot.embeddings.model azure/text-embedding-3-large
247
+ deepdoc config set chatbot.embeddings.api_key_env AZURE_API_KEY
248
+ deepdoc config set chatbot.embeddings.base_url $AZURE_API_BASE
249
+ deepdoc config set chatbot.embeddings.api_version 2024-02-01
250
+
251
+ deepdoc generate
252
+ deepdoc serve
253
+ ```
254
+
255
+ The answer LLM inherits `llm.*` (Azure deployment + base URL + key) automatically.
256
+
257
+ ### Ollama — Fully local, no API keys
258
+
259
+ Free and private. Runs everything on your machine.
260
+
261
+ ```bash
262
+ pip install "deepdoc[chatbot]"
263
+ cd /path/to/your-project
264
+
265
+ # Start Ollama first: https://ollama.com
266
+ ollama pull llama3.2
267
+
268
+ deepdoc init --with-chatbot --provider ollama --model ollama/llama3.2
269
+ deepdoc config set llm.base_url http://localhost:11434
270
+
271
+ deepdoc generate
272
+ deepdoc serve
273
+ # → Docs at http://localhost:3000 • Chatbot at http://localhost:3000/ask
274
+ ```
275
+
276
+ > Fastembed downloads the local embedding model (~300 MB) on first run. No API key needed for any step.
277
+
278
+ ---
279
+
280
+ ## Commands
281
+
282
+ Every command supports `--help`, including nested config commands:
283
+
284
+ ```bash
285
+ deepdoc --help
286
+ deepdoc generate --help
287
+ deepdoc config --help
288
+ deepdoc config set --help
289
+ ```
290
+
291
+ ### `deepdoc init`
292
+
293
+ Initializes DeepDoc in the current directory by creating a `.deepdoc.yaml` config file.
294
+
295
+ ```bash
296
+ deepdoc init
297
+ deepdoc init --provider openai --model gpt-4o
298
+ deepdoc init --provider ollama --model ollama/llama3.2
299
+ deepdoc init --provider azure --model azure/gpt-4o
300
+ deepdoc init --output-dir documentation
301
+ deepdoc init --with-chatbot
302
+ deepdoc init --provider openai --with-chatbot
303
+ ```
304
+
305
+ **Options:**
306
+
307
+ | Flag | Default | Description |
308
+ |------|---------|-------------|
309
+ | `--name` | directory name | Project name |
310
+ | `--description` | empty | Short project description |
311
+ | `--provider` | `anthropic` | LLM provider: `anthropic`, `openai`, `ollama`, `azure` |
312
+ | `--model` | provider default | Model name |
313
+ | `--output-dir` | `docs` | Where generated docs are written |
314
+ | `--with-chatbot` | off | Enable chatbot scaffolding and indexing (see [Chatbot](#chatbot) section) |
315
+
316
+ ### `deepdoc generate`
317
+
318
+ Full documentation generation. This is the first-run or explicit full-refresh command.
319
+
320
+ ```bash
321
+ deepdoc generate
322
+ deepdoc generate --force # Full refresh of DeepDoc-managed docs
323
+ deepdoc generate --clean --yes # Wipe output + state and rebuild from scratch
324
+ deepdoc generate --deploy # Generate + export the static site
325
+ deepdoc generate --batch-size 3 # Smaller batches for rate-limited APIs
326
+ deepdoc generate --include "src/**" --include "lib/**"
327
+ deepdoc generate --exclude "tests/**"
328
+ ```
329
+
330
+ **Current behavior:**
331
+
332
+ - `deepdoc generate`
333
+ - intended for the first run
334
+ - refuses to run if DeepDoc docs/state already exist
335
+ - refuses to write into a non-DeepDoc `docs/` folder unless you explicitly clean it
336
+ - `deepdoc generate --force`
337
+ - re-runs the full pipeline
338
+ - regenerates all DeepDoc-managed pages even if they are not stale
339
+ - removes stale generated pages that no longer belong in the new plan
340
+ - preserves non-DeepDoc files
341
+ - `deepdoc generate --clean --yes`
342
+ - deletes the output dir and DeepDoc state
343
+ - rebuilds everything from scratch
344
+
345
+ **What happens under the hood (5-phase pipeline):**
346
+
347
+ 1. **Phase 1: Scan** — Walk the repo, parse supported languages, detect endpoints, config/setup artifacts, runtime surfaces, integration signals, and OpenAPI specs.
348
+ 2. **Phase 2: Plan** — Run the multi-step bucket planner. It classifies the repo, proposes bucket candidates, and assigns files/symbols/artifacts to the final doc structure.
349
+ 3. **Phase 3: Generate** — Generate bucket pages in batches with parallel workers. High-level buckets are AI-planned; scanned endpoints enrich grouped API-reference pages instead of creating one page per route. Each page passes through Python-side Markdown repair, grounding validation, and bounded quality retries before being written to disk.
350
+ 4. **Phase 4: API Ref** — Stage OpenAPI specs and render them on a single interactive Swagger UI page when a spec exists.
351
+ 5. **Phase 5: Build** — Write the Next.js + Fumadocs site scaffold (`site/`), nav config, and brand stylesheet from the generated plan.
352
+
353
+ **Options:**
354
+
355
+ | Flag | Default | Description |
356
+ |------|---------|-------------|
357
+ | `--force` | off | Full refresh of DeepDoc-managed docs and cleanup of stale generated pages |
358
+ | `--clean` | off | Delete output dir and DeepDoc state, then regenerate from scratch |
359
+ | `--yes` | off | Skip destructive confirmation for `--clean` |
360
+ | `--include` | all files | Glob patterns to include (can be repeated) |
361
+ | `--exclude` | see config | Additional glob patterns to exclude |
362
+ | `--deploy` | off | Build and export the static site after generation |
363
+ | `--batch-size` | 10 | Pages per batch before pausing (helps with rate limits) |
364
+
365
+ ### `deepdoc update`
366
+
367
+ Incrementally update docs when source files change. This is the normal command after the first successful `generate`.
368
+
369
+ ```bash
370
+ deepdoc update # Normal ongoing refresh
371
+ deepdoc update --since HEAD~3 # Changes in last 3 commits
372
+ deepdoc update --since main # All changes since branching from main
373
+ deepdoc update --replan # Force a full replan
374
+ deepdoc update --strict-quality # Fail if generated docs are invalid/degraded
375
+ deepdoc update --deploy # Update + deploy
376
+ ```
377
+
378
+ **How it works:**
379
+
380
+ 1. Loads the saved sync baseline, plan, and generation ledger from `.deepdoc/`.
381
+ 2. Diffs committed changes from the last synced commit to the current `HEAD`.
382
+ 3. Chooses a strategy automatically:
383
+ - **incremental** — regenerate only the stale bucket pages
384
+ - **targeted replan** — new/deleted files or endpoint structure changes; re-plans affected buckets then regenerates them. Full replan is never triggered automatically for normal code changes.
385
+ 4. Compares the saved scan cache with the current scan so semantic endpoint changes can refresh impacted docs even when ownership files do not line up directly.
386
+ 5. Regenerates only the affected bucket pages. Deleted files are cleaned up in-place: orphaned buckets and their Markdown pages are removed, partially-emptied buckets are marked stale and regenerated.
387
+ 6. Appends an entry to `.deepdoc/changelog.json` and regenerates `docs/whats-changed.md` so the docs site always shows a current commit-by-commit change log.
388
+ 7. Incrementally refreshes the chatbot corpora from the same update run.
389
+ 8. Rebuilds site config and nav afterward.
390
+
391
+ If git is unavailable, it falls back to hash-based staleness detection for recovery.
392
+ When `--deploy` is used, DeepDoc deploys only after a fully successful update; failed page generation or chatbot sync blocks deployment.
393
+
394
+ Generation writes quality artifacts under `.deepdoc/`:
395
+
396
+ - `.deepdoc/generation_quality.json` records invalid/degraded pages, coverage metrics, local setup warnings, and consistency summary data.
397
+ - `.deepdoc/consistency_warnings.json` records warning-only cross-page identifier consistency findings.
398
+
399
+ Generated Markdown pages include provenance frontmatter such as `deepdoc_generated_commit`, `deepdoc_generated_at`, `deepdoc_generated_version`, `deepdoc_status`, `deepdoc_evidence_files`, and `deepdoc_prereqs` (prerequisite page slugs). The Fumadocs UI renders these pages with built-in navigation, search, and table of contents.
400
+
401
+ **Options:**
402
+
403
+ | Flag | Default | Description |
404
+ |------|---------|-------------|
405
+ | `--since` | last synced commit | Git ref to diff against |
406
+ | `--replan` | off | Force a full replan even if the change set looks incremental |
407
+ | `--deploy` | off | Deploy after a fully successful update |
408
+
409
+ ### `deepdoc status`
410
+
411
+ Show how much documentation has been generated and whether any buckets are stale.
412
+
413
+ ```bash
414
+ deepdoc status
415
+ ```
416
+
417
+ This is useful after `generate` or `update` when you want a quick health check without opening the site.
418
+
419
+ ### `deepdoc serve`
420
+
421
+ Preview the generated docs locally with live reload using the Next.js + Fumadocs site in `site/`.
422
+
423
+ ```bash
424
+ deepdoc serve
425
+ deepdoc serve --port 8001
426
+ ```
427
+
428
+ Runs `next dev` inside `site/`. Requires Node.js ≥18 — `npm install` runs automatically if `node_modules/` is missing.
429
+
430
+ ### `deepdoc deploy`
431
+
432
+ Build and export the generated Next.js + Fumadocs site.
433
+
434
+ ```bash
435
+ deepdoc deploy
436
+ ```
437
+
438
+ This runs `next build` inside `site/` and writes the static HTML to `site/out/`. You can deploy that directory to Vercel, Netlify, GitHub Pages, Cloudflare Pages, or any static host.
439
+
440
+ Before building, `deepdoc deploy` checks `.deepdoc/generation_quality.json` and generated page frontmatter. It refuses to deploy when the last generation has failed/invalid pages or when `docs/` still contains pages marked `deepdoc_status: "invalid"` or `stub: true`; rerun `deepdoc generate` after fixing those issues.
441
+
442
+ If you want GitHub Pages specifically, this repo includes a workflow at `.github/workflows/github-pages.yml` that publishes the checked-in `site/out/` export through the official Pages Actions flow. That means you do not need to move the export into a branch `docs/` folder.
443
+
444
+ ### `deepdoc config`
445
+
446
+ View or update config values without editing YAML manually.
447
+
448
+ ```bash
449
+ deepdoc config show # Print all config
450
+ deepdoc config set llm.provider openai # Switch provider
451
+ deepdoc config set llm.model gpt-4o # Switch model
452
+ deepdoc config set llm.temperature 0.3 # Adjust creativity
453
+ deepdoc config set output_dir documentation # Change output dir
454
+ deepdoc config set llm.api_key_env AZURE_API_KEY # Change API key env var
455
+ deepdoc config set compatibility.deprecated_version_warning.enabled false
456
+ ```
457
+
458
+ ### `deepdoc benchmark`
459
+
460
+ Run planner benchmark cases and optionally generate a combined docs+chatbot quality scorecard.
461
+
462
+ ```bash
463
+ deepdoc benchmark --catalog benchmarks/catalog.json
464
+ deepdoc benchmark --repo /path/to/repo --gold benchmarks/gold.json
465
+ deepdoc benchmark --catalog benchmarks/catalog.json --chatbot-eval benchmarks/chatbot_eval.json
466
+ deepdoc benchmark --catalog benchmarks/catalog.json --chatbot-eval benchmarks/chatbot_eval.json --scorecard-out .deepdoc/quality_scorecard.json --strict-scorecard
467
+ deepdoc benchmark --generated-root /Users/apple/autodoc/docs --scorecard-out /Users/apple/autodoc/docs/_scorecards/latest.json
468
+ ```
469
+
470
+ Use `--strict-scorecard` to fail the command when completeness gates are not met.
471
+
472
+ When you do not have a hand-written benchmark catalog or chatbot eval file yet, use artifact mode (`--generated-root` or `--artifact-repo`) to compute a provisional scorecard directly from persisted `.deepdoc/` outputs.
473
+
474
+ ---
475
+
476
+ ## LLM Provider Setup
477
+
478
+ DeepDoc uses [LiteLLM](https://github.com/BerriAI/litellm) under the hood, which means it supports 100+ providers.
479
+
480
+ For new users, start with one of these common doc-generation setups:
481
+
482
+ ### Anthropic (Claude) — Default
483
+
484
+ ```bash
485
+ deepdoc init --provider anthropic
486
+ export ANTHROPIC_API_KEY=sk-ant-api03-...
487
+ deepdoc generate
488
+ ```
489
+
490
+ Models: `claude-3-5-sonnet-20241022`, `claude-3-opus-20240229`, `claude-3-haiku-20240307`
491
+
492
+ ### OpenAI (GPT)
493
+
494
+ ```bash
495
+ deepdoc init --provider openai --model gpt-4o
496
+ export OPENAI_API_KEY=sk-...
497
+ deepdoc generate
498
+ ```
499
+
500
+ Models: `gpt-4.1`, `gpt-4.1-mini`, `gpt-4o`, `gpt-4o-mini`, `gpt-4-turbo`
501
+
502
+ ### Google Gemini
503
+
504
+ If you use a simple Google AI Studio API key, use the `gemini/` prefix. Without that prefix, LiteLLM defaults to Vertex AI semantics.
505
+
506
+ ```bash
507
+ deepdoc init
508
+ deepdoc config set llm.provider gemini
509
+ deepdoc config set llm.model gemini/gemini-2.0-flash
510
+ deepdoc config set llm.api_key_env GEMINI_API_KEY
511
+ export GEMINI_API_KEY=...
512
+ deepdoc generate
513
+ ```
514
+
515
+ Common choices: `gemini/gemini-2.0-flash`, `gemini/gemini-2.5-flash`, `gemini/gemini-2.5-pro`
516
+
517
+ ### Azure OpenAI
518
+
519
+ Azure requires a few more environment variables because deployments have custom names and endpoints.
520
+
521
+ ```bash
522
+ # 1. Initialize with Azure
523
+ deepdoc init --provider azure --model azure/<your-deployment-name>
524
+
525
+ # 2. Set required environment variables
526
+ export AZURE_API_KEY=your-azure-api-key
527
+ export AZURE_API_BASE=https://<your-resource-name>.openai.azure.com
528
+ export AZURE_API_VERSION=2024-02-01
529
+
530
+ # 3. Update config to point to your deployment
531
+ deepdoc config set llm.model azure/<your-deployment-name>
532
+ deepdoc config set llm.base_url https://<your-resource-name>.openai.azure.com
533
+
534
+ # 4. Generate
535
+ deepdoc generate
536
+ ```
537
+
538
+ **Where to find these values in Azure Portal:**
539
+
540
+ 1. Go to [Azure Portal](https://portal.azure.com) → Azure OpenAI resource.
541
+ 2. Click **Keys and Endpoint** in the sidebar → copy **Key 1** (that's your `AZURE_API_KEY`) and the **Endpoint** (that's your `AZURE_API_BASE`).
542
+ 3. Go to **Model deployments** → **Manage Deployments** → note your deployment name (e.g., `gpt-4o-deployment`). Use this as `azure/gpt-4o-deployment` in the model field.
543
+ 4. API version: Use `2024-02-01` or the latest GA version shown in Azure docs.
544
+
545
+ **Example `.deepdoc.yaml` for Azure:**
546
+
547
+ ```yaml
548
+ project_name: my-project
549
+ output_dir: docs
550
+ llm:
551
+ provider: azure
552
+ model: azure/gpt-4o-deploy # "azure/" prefix + your deployment name
553
+ api_key_env: AZURE_API_KEY
554
+ base_url: https://mycompany.openai.azure.com
555
+ max_tokens: 4096
556
+ temperature: 0.2
557
+ ```
558
+
559
+ **Azure AD / Managed Identity (token-based auth):**
560
+
561
+ If you use Azure AD instead of API keys, set these instead:
562
+
563
+ ```bash
564
+ export AZURE_AD_TOKEN=your-ad-token
565
+ export AZURE_API_BASE=https://<your-resource-name>.openai.azure.com
566
+ export AZURE_API_VERSION=2024-02-01
567
+ ```
568
+
569
+ LiteLLM picks up `AZURE_AD_TOKEN` automatically when `AZURE_API_KEY` is not set.
570
+
571
+ ### Ollama (Local / Free)
572
+
573
+ No API key needed. Just make sure Ollama is running locally.
574
+
575
+ ```bash
576
+ # 1. Install and start Ollama (https://ollama.com)
577
+ ollama pull llama3.2
578
+
579
+ # 2. Initialize
580
+ deepdoc init --provider ollama --model ollama/llama3.2
581
+
582
+ # 3. Generate (no API key needed)
583
+ deepdoc generate
584
+ ```
585
+
586
+ Other Ollama models: `ollama/codellama`, `ollama/mistral`, `ollama/mixtral`
587
+
588
+ ### Any LiteLLM Provider
589
+
590
+ DeepDoc passes the model string directly to LiteLLM, so you can use any provider LiteLLM supports by using the correct prefix. `deepdoc init` only has shortcuts for the common providers above, so for everything else initialize once and then use `deepdoc config set ...`:
591
+
592
+ ```bash
593
+ # Gemini
594
+ deepdoc config set llm.provider gemini
595
+ deepdoc config set llm.model gemini/gemini-2.0-flash
596
+ export GEMINI_API_KEY=...
597
+
598
+ # Groq
599
+ deepdoc config set llm.model groq/llama3-70b-8192
600
+ export GROQ_API_KEY=...
601
+
602
+ # Together AI
603
+ deepdoc config set llm.model together_ai/meta-llama/Llama-3-70b-chat-hf
604
+ export TOGETHER_API_KEY=...
605
+
606
+ # AWS Bedrock
607
+ deepdoc config set llm.model bedrock/anthropic.claude-3-sonnet-20240229-v1:0
608
+ # (uses AWS credentials from environment)
609
+ ```
610
+
611
+ See [LiteLLM providers](https://docs.litellm.ai/docs/providers) for the full list.
612
+
613
+ ---
614
+
615
+ ## Configuration
616
+
617
+ The `.deepdoc.yaml` file in your repo root controls everything:
618
+
619
+ ```yaml
620
+ project_name: my-app
621
+ description: "A web application for managing tasks"
622
+ output_dir: docs
623
+ site_dir: site
624
+
625
+ llm:
626
+ provider: anthropic
627
+ model: claude-3-5-sonnet-20241022
628
+ api_key_env: ANTHROPIC_API_KEY
629
+ base_url: null # Set for Ollama/custom endpoints
630
+ max_tokens: null # null = no cap (recommended); set a number to limit output
631
+ temperature: 0.2
632
+
633
+ languages:
634
+ - python
635
+ - javascript
636
+ - typescript
637
+ - go
638
+ - php
639
+
640
+ include: [] # Empty = include everything
641
+ exclude:
642
+ - node_modules
643
+ - .git
644
+ - __pycache__
645
+ - "*.pyc"
646
+ - vendor
647
+ - dist
648
+ - build
649
+ - .env
650
+ - "*.lock"
651
+ - "*.sum"
652
+
653
+ generation_mode: feature_buckets
654
+
655
+ # Generation tuning
656
+ max_pages: 0 # 0 = no cap; set a number to limit total pages
657
+ giant_file_lines: 2000 # Files above this get LLM-based feature clustering
658
+ source_context_budget: 200000 # Raw-source char budget before DeepDoc switches overflow files to compressed evidence cards
659
+ integration_detection: auto # "auto" | "off"
660
+
661
+ # Page type toggles
662
+ include_endpoint_pages: true # Generate endpoint documentation
663
+ include_integration_pages: true # Generate integration documentation
664
+
665
+ # Parallelism — tune for your LLM provider's rate limits
666
+ max_parallel_workers: 6 # Concurrent LLM calls (increase for Azure PTU)
667
+ batch_size: 10 # Pages per batch before rate-limit pause
668
+
669
+ github_pages:
670
+ enabled: false
671
+ branch: gh-pages
672
+ remote: origin
673
+
674
+ site:
675
+ repo_url: "" # e.g., https://github.com/you/your-repo
676
+ favicon: ""
677
+ logo: ""
678
+ ```
679
+
680
+ ### Configuration Reference
681
+
682
+ | Key | Default | Description |
683
+ |-----|---------|-------------|
684
+ | `project_name` | directory name | Project name used in site title |
685
+ | `description` | `""` | Short project description |
686
+ | `output_dir` | `docs` | Where generated markdown pages are written |
687
+ | `site_dir` | `site` | Where the generated Next.js site shell lives |
688
+ | **LLM** | | |
689
+ | `llm.provider` | `anthropic` | `anthropic`, `openai`, `azure`, `ollama`, or any LiteLLM alias |
690
+ | `llm.model` | `claude-3-5-sonnet-20241022` | Model name (use provider prefix for non-Anthropic, e.g. `azure/gpt-4.1`) |
691
+ | `llm.api_key_env` | `ANTHROPIC_API_KEY` | Environment variable that holds the API key |
692
+ | `llm.base_url` | `null` | Custom endpoint URL (required for Ollama, optional for Azure) |
693
+ | `llm.max_tokens` | `null` | Max output tokens per LLM call. `null` = no cap (recommended). Set explicitly if your provider requires it (e.g. some Azure deployments). Typical values: `4096` for shorter pages, `8192`–`16384` for detailed docs |
694
+ | `llm.temperature` | `0.2` | LLM sampling temperature |
695
+ | **Generation** | | |
696
+ | `generation_mode` | `feature_buckets` | Documentation generation mode |
697
+ | `max_pages` | `0` | Max pages to generate. `0` = no cap |
698
+ | `giant_file_lines` | `2000` | Files above this line count get LLM-based feature clustering |
699
+ | `source_context_budget` | `200000` | Raw-source char budget per page before overflow files are represented as compressed evidence cards |
700
+ | `integration_detection` | `auto` | Detect third-party integrations: `auto` or `off` |
701
+ | `include_endpoint_pages` | `true` | Generate endpoint documentation pages |
702
+ | `include_integration_pages` | `true` | Generate integration documentation pages |
703
+ | **Parallelism** | | |
704
+ | `max_parallel_workers` | `6` | Concurrent LLM calls. Increase for Azure PTU or high-TPM deployments |
705
+ | `batch_size` | `10` | Pages per batch before rate-limit pause |
706
+ | **File filters** | | |
707
+ | `languages` | `[python, javascript, typescript, go, php, vue]` | Languages to parse |
708
+ | `include` | `[]` | Glob patterns to include (empty = everything) |
709
+ | `exclude` | *(see config)* | Glob patterns to exclude (node_modules, .git, dist, etc.) |
710
+ | **GitHub Pages** | | |
711
+ | `github_pages.branch` | `gh-pages` | Branch for GitHub Pages deploy |
712
+ | `github_pages.remote` | `origin` | Git remote for deploy |
713
+ | **Site** | | |
714
+ | `site.repo_url` | `""` | Repo URL shown in the generated site navigation |
715
+ | `site.favicon` | `""` | Path to favicon |
716
+ | `site.logo` | `""` | Path to logo |
717
+ | **Compatibility** | | |
718
+ | `compatibility.deprecated_version_warning.enabled` | `true` | Warn when existing generated docs were produced by a different major version of DeepDoc (e.g. docs from v1.x with CLI v2.x). Suppressed for minor/patch version gaps. |
719
+
720
+ ---
721
+
722
+ ## Chatbot
723
+
724
+ DeepDoc can generate an AI-powered chatbot that answers questions about your codebase using evidence-first RAG. Retrieval indexes find candidate files, but final code proof always comes from archived source/config snippets with exact file paths and line ranges. Generated docs and repo-authored docs can help explain concepts, but they are returned as references, not right-pane code evidence.
725
+
726
+ > **Defaults you should know.** The chatbot **inherits** `provider`, `model`, and `api_key_env` from your `llm.*` config when `chatbot.answer.*` is empty (the scaffolded default). Embeddings default to `fastembed` — fully local, no API key. You only need extra config if (a) you want a different LLM for chat than for docs, or (b) you want cloud embeddings.
727
+
728
+ If chatbot is disabled, DeepDoc keeps the generated site docs-only: it does not generate the `/ask` route, chatbot frontend components, or `chatbot_backend/` scaffold.
729
+
730
+ > **Already running?** If you followed the [Chatbot in 5 Minutes](#chatbot-in-5-minutes) guide above, your chatbot is already configured and working. Everything below is for advanced configuration, tuning, and production deployment.
731
+
732
+ ### How the Model Surfaces Work
733
+
734
+ The chatbot has three independent model surfaces that you can mix across providers:
735
+
736
+ | Surface | Controls | Example |
737
+ |---------|----------|----------|
738
+ | `llm.*` | Doc planning and page generation | Claude, GPT-4o, Gemini |
739
+ | `chatbot.answer.*` | Chatbot answer generation | GPT-4o-mini, Claude, Gemini Flash |
740
+ | `chatbot.embeddings.*` | Vector embeddings for retrieval | text-embedding-3-large, Gemini text-embedding-004 |
741
+
742
+ `deepdoc serve` auto-starts the chatbot backend alongside the Next.js site. The backend port is deterministically assigned from your repo path (range 8100–8799) unless you set an explicit `base_url`.
743
+
744
+ ### Evidence-First Responses
745
+
746
+ All chatbot endpoints now share one response contract:
747
+
748
+ - `evidence[]` is the canonical source of right-pane code/config snippets. Each item has an ID like `E1`, `file_path`, `start_line`, `end_line`, and `snippet`.
749
+ - `references[]` contains generated docs or repo-authored docs. These are read-next links, not implementation proof.
750
+ - Legacy fields such as `code_citations`, `doc_links`, `code_workspace_citations`, and `file_inventory` are derived for compatibility.
751
+ - SQLite FTS, FAISS vectors, symbol chunks, and relationship chunks are candidate retrieval artifacts only. A candidate becomes evidence only after it is hydrated from the source archive/catalog.
752
+ - Generated/internal paths such as `.deepdoc*`, `docs/`, `site/`, and `chatbot_backend/` are excluded from source evidence.
753
+ - The answer validator rejects invented source paths, `line unknown`, unknown evidence IDs, and docs used as implementation proof. If a retry still fails, the backend returns a conservative answer with diagnostics.
754
+
755
+ Public endpoints remain stable:
756
+
757
+ | Endpoint | Mode | Behavior |
758
+ |----------|------|----------|
759
+ | `POST /query` | Fast | Single-pass, index-first answer. Uses source/config evidence and optional doc references. |
760
+ | `POST /deep-research` | Deep | Multi-step synthesis. May use docs for orientation, but implementation claims must be grounded in source/config evidence. |
761
+ | `POST /code-deep` | Code Deep | Strict source-first answer with trace and file inventory compatibility fields. Missing exact evidence is reported as a gap. |
762
+ | `POST /query-context` | Diagnostics | Returns selected candidates, hydrated `evidence[]`, `references[]`, and diagnostics without generating an answer. |
763
+ | `POST /code-deep/stream` | Code Deep stream | Emits SSE trace events followed by the final evidence-first payload. |
764
+
765
+ ### Provider Recipes
766
+
767
+ These are advanced recipes that override the inheritance defaults — e.g. mixing providers or using cloud embeddings. For the simple "one key for everything" path, see [Chatbot in 5 Minutes](#chatbot-in-5-minutes) above.
768
+
769
+ #### Claude for docs, OpenAI for embeddings
770
+
771
+ Claude doesn't offer embedding models, so cloud embeddings need a separate provider. (Or just keep the default `fastembed` and skip this entirely.)
772
+
773
+ ```bash
774
+ export ANTHROPIC_API_KEY=...
775
+ export OPENAI_API_KEY=...
776
+
777
+ deepdoc config set llm.provider anthropic
778
+ deepdoc config set llm.model claude-3-5-sonnet-20241022
779
+ deepdoc config set llm.api_key_env ANTHROPIC_API_KEY
780
+
781
+ deepdoc config set chatbot.enabled true
782
+ deepdoc config set chatbot.embeddings.backend litellm
783
+ deepdoc config set chatbot.embeddings.provider openai
784
+ deepdoc config set chatbot.embeddings.model text-embedding-3-large
785
+ deepdoc config set chatbot.embeddings.api_key_env OPENAI_API_KEY
786
+ ```
787
+
788
+ The chatbot answer LLM inherits `llm.*` (Claude) automatically.
789
+
790
+ #### Different model for chat than for docs
791
+
792
+ Claude for docs, GPT-4o-mini for cheaper/faster chat answers. Embeddings stay local.
793
+
794
+ ```bash
795
+ export ANTHROPIC_API_KEY=...
796
+ export OPENAI_API_KEY=...
797
+
798
+ deepdoc config set llm.provider anthropic
799
+ deepdoc config set llm.model claude-3-5-sonnet-20241022
800
+ deepdoc config set llm.api_key_env ANTHROPIC_API_KEY
801
+
802
+ deepdoc config set chatbot.enabled true
803
+ deepdoc config set chatbot.answer.provider openai
804
+ deepdoc config set chatbot.answer.model gpt-4o-mini
805
+ deepdoc config set chatbot.answer.api_key_env OPENAI_API_KEY
806
+ ```
807
+
808
+ #### Azure with separate embedding deployment
809
+
810
+ Azure deployments need explicit `base_url` + `api_version`, and embeddings typically live on a different deployment.
811
+
812
+ ```bash
813
+ export AZURE_API_KEY=...
814
+
815
+ deepdoc config set llm.provider azure
816
+ deepdoc config set llm.model azure/gpt-4.1
817
+ deepdoc config set llm.api_key_env AZURE_API_KEY
818
+ deepdoc config set llm.base_url https://YOUR-RESOURCE.openai.azure.com/
819
+
820
+ deepdoc config set chatbot.enabled true
821
+ deepdoc config set chatbot.embeddings.backend litellm
822
+ deepdoc config set chatbot.embeddings.provider azure
823
+ deepdoc config set chatbot.embeddings.model azure/text-embedding-3-small
824
+ deepdoc config set chatbot.embeddings.api_key_env AZURE_API_KEY
825
+ deepdoc config set chatbot.embeddings.base_url https://YOUR-RESOURCE.openai.azure.com/
826
+ deepdoc config set chatbot.embeddings.api_version 2024-02-15-preview
827
+ ```
828
+
829
+ The answer LLM inherits `llm.*` (Azure deployment, base URL, version, key) automatically — no `chatbot.answer.*` config needed for Azure.
830
+
831
+ ### Installation
832
+
833
+ The chatbot requires extra dependencies not included in the base install:
834
+
835
+ ```bash
836
+ # From PyPI
837
+ pip install "deepdoc[chatbot]"
838
+
839
+ # From source (development)
840
+ pip install -e ".[chatbot]"
841
+ ```
842
+
843
+ Extra dependencies: `numpy`, `faiss-cpu`, `fastapi`, `uvicorn`, `httpx`.
844
+
845
+ Verify the chatbot extras are installed:
846
+
847
+ ```bash
848
+ pip show faiss-cpu fastapi uvicorn
849
+ ```
850
+
851
+ ### Chatbot Configuration
852
+
853
+ All chatbot settings live under the `chatbot` key in `.deepdoc.yaml`. Running `deepdoc init --with-chatbot` populates these defaults:
854
+
855
+ These are scaffolding defaults, not a recommendation that you must use Azure. Most teams change the provider, model, and API-key env vars right after `init`.
856
+
857
+ ```yaml
858
+ chatbot:
859
+ enabled: true
860
+ index_dir: ".deepdoc/chatbot"
861
+
862
+ backend:
863
+ base_url: "" # Leave empty for auto-assigned local port
864
+ allowed_origins:
865
+ - "http://localhost:3000"
866
+ - "http://127.0.0.1:3000"
867
+
868
+ answer: # LLM used for answering user questions
869
+ provider: "azure"
870
+ model: "azure/gpt-4o-mini"
871
+ api_key_env: "DEEPDOC_CHAT_API_KEY"
872
+ base_url: ""
873
+ api_version: ""
874
+ temperature: 0.1
875
+ max_tokens: 24000
876
+ continuation_retries: 2 # Auto-continue if answer ends abruptly
877
+ continuation_context_chars: 12000 # Tail chars included in continuation prompt
878
+
879
+ embeddings: # LLM used for embedding code/docs
880
+ backend: "litellm" # "litellm" for cloud embeddings or "fastembed" for fully local embeddings
881
+ fastembed_model: "nomic-ai/nomic-embed-text-v1.5"
882
+ fastembed_batch_size: 4
883
+ provider: "azure"
884
+ model: "azure/text-embedding-3-large"
885
+ api_key_env: "DEEPDOC_EMBED_API_KEY"
886
+ base_url: ""
887
+ api_version: ""
888
+ batch_size: 24
889
+
890
+ vector_store:
891
+ kind: "faiss"
892
+
893
+ indexing:
894
+ include_repo_docs: true
895
+ include_tests: false
896
+ repo_doc_globs: []
897
+ exclude_globs: []
898
+ max_file_bytes: 250000
899
+ max_repo_doc_chars: 12000
900
+
901
+ retrieval:
902
+ top_k_code: 15
903
+ top_k_artifact: 8
904
+ top_k_docs: 6
905
+ top_k_relationship: 8
906
+ candidate_top_k_code: 30
907
+ candidate_top_k_artifact: 16
908
+ candidate_top_k_docs: 12
909
+ candidate_top_k_relationship: 12
910
+ max_prompt_code_chunks: 12
911
+ max_prompt_artifact_chunks: 6
912
+ max_prompt_doc_chunks: 6
913
+ max_prompt_relationship_chunks: 6
914
+ max_prompt_chars: 120000
915
+ fast_mode_use_llm_retrieval_steps: false # Fast mode skips expansion/rerank by default
916
+ fast_mode_iterative_retrieval: false # Fast mode skips second-pass follow-up retrieval
917
+ fast_mode_max_prompt_chars: 90000 # Smaller prompt budget for faster /query answers
918
+ deep_mode_max_prompt_chars: 140000 # Larger budget for /deep-research synthesis
919
+ code_deep_mode_max_prompt_chars: 180000 # Largest prompt budget for /code-deep
920
+ code_deep_top_k: 16 # Code chunks retrieved for code-aware mode
921
+ code_deep_top_k_relationship: 12 # Relationship chunks retrieved for code-aware mode
922
+ code_deep_top_k_docs: 4 # Cap docs chunks in code-aware mode
923
+ code_deep_file_inventory_limit: 18 # Max files listed in code-aware inventory
924
+ lexical_retrieval: true
925
+ lexical_candidate_limit: 24
926
+ query_expansion: true
927
+ expansion_max_queries: 3
928
+ iterative_retrieval: true
929
+ iterative_max_followup_queries: 2
930
+ graph_neighbor_expansion: true
931
+ graph_neighbor_max_files: 6
932
+ graph_neighbor_code_chunks_per_file: 2
933
+ graph_neighbor_artifact_chunks_per_file: 1
934
+ graph_neighbor_relationship_chunks_per_file: 2
935
+ graph_neighbor_max_docs: 4
936
+ rerank: true
937
+ rerank_candidate_limit: 32
938
+ rerank_candidate_limit_per_kind: 8
939
+ rerank_preview_chars: 450
940
+ stitch_adjacent_code_chunks: true
941
+ stitch_max_adjacent_chunks: 2
942
+ deep_research_live_fallback: true
943
+ live_fallback_max_files: 6
944
+ live_fallback_max_per_file: 2
945
+ live_fallback_context_lines: 12
946
+ deep_research_chunk_chars: 3200
947
+ deep_research_top_k: 10
948
+
949
+ chunking:
950
+ code_chunk_lines: 120
951
+ code_chunk_overlap: 20
952
+ artifact_chunk_lines: 140
953
+ artifact_chunk_overlap: 20
954
+ max_doc_summary_chunks_per_page: 4
955
+ max_doc_summary_chars: 4000
956
+ ```
957
+
958
+ ### Chatbot Configuration Reference
959
+
960
+ The defaults work for almost every project. Expand below only when you need to tune a specific knob.
961
+
962
+ <details>
963
+ <summary><strong>Full chatbot configuration reference (60+ keys)</strong></summary>
964
+
965
+ | Key | Default | Description |
966
+ |-----|---------|-------------|
967
+ | **General** | | |
968
+ | `chatbot.enabled` | `false` | Enable chatbot indexing and backend (set automatically by `deepdoc init --with-chatbot`) |
969
+ | `chatbot.index_dir` | `.deepdoc/chatbot` | Directory for source archive/catalog, SQLite lexical index, vector indexes, relationship artifacts, and chunk data |
970
+ | **Indexing** | | |
971
+ | `chatbot.indexing.include_repo_docs` | `true` | Index selected repo-authored docs such as README/design notes in a separate corpus |
972
+ | `chatbot.indexing.include_tests` | `false` | Allow test/example/fixture docs into the repo-doc corpus |
973
+ | `chatbot.indexing.repo_doc_globs` | `[]` | Extra glob patterns for repo docs to index |
974
+ | `chatbot.indexing.exclude_globs` | `[]` | Additional glob patterns to exclude from repo-doc indexing |
975
+ | `chatbot.indexing.max_file_bytes` | `250000` | Skip oversized repo-doc files during indexing |
976
+ | `chatbot.indexing.max_repo_doc_chars` | `12000` | Max chars per repo-doc section chunk |
977
+ | **Backend** | | |
978
+ | `chatbot.backend.base_url` | `""` | External backend URL. Leave empty for auto-assigned local port |
979
+ | `chatbot.backend.allowed_origins` | `[localhost:3000, 127.0.0.1:3000]` | CORS origins the backend accepts |
980
+ | **Answer LLM** | | |
981
+ | `chatbot.answer.provider` | `azure` | Provider for the answer model |
982
+ | `chatbot.answer.model` | `azure/gpt-4o-mini` | Model used to generate answers |
983
+ | `chatbot.answer.api_key_env` | `DEEPDOC_CHAT_API_KEY` | Env var holding the answer model API key |
984
+ | `chatbot.answer.base_url` | `""` | Custom endpoint (for Azure, Ollama, etc.) |
985
+ | `chatbot.answer.api_version` | `""` | Azure API version string |
986
+ | `chatbot.answer.temperature` | `0.1` | Sampling temperature (lower = more deterministic) |
987
+ | `chatbot.answer.max_tokens` | `24000` | Max tokens per answer |
988
+ | `chatbot.answer.continuation_retries` | `2` | Extra completion attempts when an answer appears truncated |
989
+ | `chatbot.answer.continuation_context_chars` | `12000` | Number of trailing chars passed when asking the model to continue |
990
+ | **Embeddings LLM** | | |
991
+ | `chatbot.embeddings.backend` | `litellm` | Embedding backend: `litellm` for cloud providers or `fastembed` for fully local embeddings |
992
+ | `chatbot.embeddings.fastembed_model` | `nomic-ai/nomic-embed-text-v1.5` | Local embedding model used when `chatbot.embeddings.backend=fastembed` |
993
+ | `chatbot.embeddings.fastembed_batch_size` | `4` | Local fastembed batch size |
994
+ | `chatbot.embeddings.provider` | `azure` | Provider for the embedding model |
995
+ | `chatbot.embeddings.model` | `azure/text-embedding-3-large` | Embedding model |
996
+ | `chatbot.embeddings.api_key_env` | `DEEPDOC_EMBED_API_KEY` | Env var holding the embedding API key |
997
+ | `chatbot.embeddings.base_url` | `""` | Custom endpoint |
998
+ | `chatbot.embeddings.api_version` | `""` | Azure API version string |
999
+ | `chatbot.embeddings.batch_size` | `24` | Texts per embedding API call |
1000
+ | **Retrieval** | | |
1001
+ | `chatbot.retrieval.top_k_code` | `15` | Top code chunks retrieved per query |
1002
+ | `chatbot.retrieval.top_k_artifact` | `8` | Top artifact chunks retrieved per query |
1003
+ | `chatbot.retrieval.top_k_docs` | `6` | Top generated-doc and repo-doc chunks retrieved per query |
1004
+ | `chatbot.retrieval.top_k_relationship` | `8` | Top relationship chunks retrieved per query |
1005
+ | `chatbot.retrieval.candidate_top_k_code` | `30` | Candidate code chunks gathered before reranking |
1006
+ | `chatbot.retrieval.candidate_top_k_artifact` | `16` | Candidate artifact chunks gathered before reranking |
1007
+ | `chatbot.retrieval.candidate_top_k_docs` | `12` | Candidate doc chunks gathered before reranking |
1008
+ | `chatbot.retrieval.candidate_top_k_relationship` | `12` | Candidate relationship chunks gathered before reranking |
1009
+ | `chatbot.retrieval.max_prompt_code_chunks` | `12` | Max code chunks included in the final prompt |
1010
+ | `chatbot.retrieval.max_prompt_artifact_chunks` | `6` | Max artifact chunks in the final prompt |
1011
+ | `chatbot.retrieval.max_prompt_doc_chunks` | `6` | Max doc chunks in the final prompt |
1012
+ | `chatbot.retrieval.max_prompt_relationship_chunks` | `6` | Max relationship chunks included in the final prompt |
1013
+ | `chatbot.retrieval.max_prompt_chars` | `120000` | Default character budget for assembled prompts |
1014
+ | `chatbot.retrieval.fast_mode_use_llm_retrieval_steps` | `false` | In `/query` fast mode, disable LLM query expansion and reranking |
1015
+ | `chatbot.retrieval.fast_mode_iterative_retrieval` | `false` | In `/query` fast mode, disable iterative follow-up retrieval |
1016
+ | `chatbot.retrieval.fast_mode_max_prompt_chars` | `90000` | Prompt budget used by `/query` fast mode |
1017
+ | `chatbot.retrieval.deep_mode_max_prompt_chars` | `140000` | Prompt budget used by `/deep-research` |
1018
+ | `chatbot.retrieval.code_deep_mode_max_prompt_chars` | `180000` | Prompt budget used by `/code-deep` |
1019
+ | `chatbot.retrieval.code_deep_top_k` | `16` | Code chunks retrieved in code-aware mode |
1020
+ | `chatbot.retrieval.code_deep_top_k_relationship` | `12` | Relationship chunks retrieved in code-aware mode |
1021
+ | `chatbot.retrieval.code_deep_top_k_docs` | `4` | Docs chunk cap in code-aware mode |
1022
+ | `chatbot.retrieval.code_deep_file_inventory_limit` | `18` | Max files listed in code-aware inventory |
1023
+ | `chatbot.retrieval.lexical_retrieval` | `true` | Blend exact-match retrieval with embedding retrieval |
1024
+ | `chatbot.retrieval.lexical_candidate_limit` | `24` | Max lexical candidates gathered before merge/rerank |
1025
+ | `chatbot.retrieval.query_expansion` | `true` | Use LLM to generate alternative search queries |
1026
+ | `chatbot.retrieval.expansion_max_queries` | `3` | Number of alternative queries to generate |
1027
+ | `chatbot.retrieval.iterative_retrieval` | `true` | Derive focused follow-up searches from early hits |
1028
+ | `chatbot.retrieval.iterative_max_followup_queries` | `2` | Max follow-up queries used during iterative retrieval |
1029
+ | `chatbot.retrieval.graph_neighbor_expansion` | `true` | Pull linked files and doc neighbors into the candidate set |
1030
+ | `chatbot.retrieval.graph_neighbor_max_files` | `6` | Max linked files considered for graph-neighbor expansion |
1031
+ | `chatbot.retrieval.graph_neighbor_code_chunks_per_file` | `2` | Code chunks per linked file during graph expansion |
1032
+ | `chatbot.retrieval.graph_neighbor_artifact_chunks_per_file` | `1` | Artifact chunks per linked file during graph expansion |
1033
+ | `chatbot.retrieval.graph_neighbor_relationship_chunks_per_file` | `2` | Relationship chunks per linked file during graph expansion |
1034
+ | `chatbot.retrieval.graph_neighbor_max_docs` | `4` | Max linked docs pulled in during graph expansion |
1035
+ | `chatbot.retrieval.rerank` | `true` | Use LLM to rerank retrieved chunks |
1036
+ | `chatbot.retrieval.rerank_candidate_limit` | `32` | Max candidates sent to the reranker |
1037
+ | `chatbot.retrieval.rerank_candidate_limit_per_kind` | `8` | Per-kind candidate cap before filling the global rerank pool |
1038
+ | `chatbot.retrieval.rerank_preview_chars` | `450` | Characters of each chunk shown to the reranker |
1039
+ | `chatbot.retrieval.stitch_adjacent_code_chunks` | `true` | Expand exact-match code hits with adjacent windows from the same file |
1040
+ | `chatbot.retrieval.stitch_max_adjacent_chunks` | `2` | Max adjacent code windows stitched onto a top hit |
1041
+ | `chatbot.retrieval.deep_research_live_fallback` | `true` | Allow `/deep-research` to inspect bounded live repo files when indexed retrieval is weak |
1042
+ | `chatbot.retrieval.live_fallback_max_files` | `6` | Max repo files inspected during a deep-research live fallback |
1043
+ | `chatbot.retrieval.live_fallback_max_per_file` | `2` | Max fallback snippets returned per inspected file |
1044
+ | `chatbot.retrieval.live_fallback_context_lines` | `12` | Lines per fallback snippet around each exact match |
1045
+ | `chatbot.retrieval.deep_research_chunk_chars` | `3200` | Max chars per evidence chunk passed into deep-research step answers |
1046
+ | `chatbot.retrieval.deep_research_top_k` | `10` | Retrieved chunks per deep-research sub-question |
1047
+ | **Chunking** | | |
1048
+ | `chatbot.chunking.code_chunk_lines` | `120` | Lines per code chunk |
1049
+ | `chatbot.chunking.code_chunk_overlap` | `20` | Overlap lines between code chunks |
1050
+ | `chatbot.chunking.artifact_chunk_lines` | `140` | Lines per artifact chunk |
1051
+ | `chatbot.chunking.artifact_chunk_overlap` | `20` | Overlap lines between artifact chunks |
1052
+ | `chatbot.chunking.max_doc_summary_chunks_per_page` | `4` | Doc summary chunks extracted per page |
1053
+ | `chatbot.chunking.max_doc_summary_chars` | `4000` | Max chars per doc summary chunk |
1054
+
1055
+ </details>
1056
+
1057
+ ### Chatbot Provider Examples
1058
+
1059
+ The chatbot's `answer` and `embeddings` sections are configured independently from the main `llm` section, so you can use different providers for doc generation vs. chatbot.
1060
+
1061
+ **Azure:**
1062
+
1063
+ ```yaml
1064
+ chatbot:
1065
+ answer:
1066
+ provider: "azure"
1067
+ model: "azure/gpt-4o-mini"
1068
+ base_url: "https://YOUR-RESOURCE.openai.azure.com/"
1069
+ api_version: "2024-08-01-preview"
1070
+ api_key_env: "DEEPDOC_CHAT_API_KEY"
1071
+ embeddings:
1072
+ provider: "azure"
1073
+ model: "azure/text-embedding-3-large"
1074
+ base_url: "https://YOUR-RESOURCE.openai.azure.com/"
1075
+ api_version: "2024-08-01-preview"
1076
+ api_key_env: "DEEPDOC_EMBED_API_KEY"
1077
+ ```
1078
+
1079
+ **OpenAI:**
1080
+
1081
+ ```yaml
1082
+ chatbot:
1083
+ answer:
1084
+ provider: "openai"
1085
+ model: "gpt-4o-mini"
1086
+ api_key_env: "DEEPDOC_CHAT_API_KEY"
1087
+ embeddings:
1088
+ provider: "openai"
1089
+ model: "text-embedding-3-large"
1090
+ api_key_env: "DEEPDOC_EMBED_API_KEY"
1091
+ batch_size: 24 # OpenAI supports larger batches
1092
+ ```
1093
+
1094
+ **Google Gemini:**
1095
+
1096
+ ```yaml
1097
+ chatbot:
1098
+ answer:
1099
+ provider: "gemini"
1100
+ model: "gemini/gemini-2.0-flash"
1101
+ api_key_env: "DEEPDOC_CHAT_API_KEY"
1102
+ embeddings:
1103
+ backend: "litellm"
1104
+ provider: "gemini"
1105
+ model: "gemini/text-embedding-004"
1106
+ api_key_env: "DEEPDOC_EMBED_API_KEY"
1107
+ ```
1108
+
1109
+ **Fully local embeddings with fastembed:**
1110
+
1111
+ ```yaml
1112
+ chatbot:
1113
+ embeddings:
1114
+ backend: "fastembed"
1115
+ fastembed_model: "nomic-ai/nomic-embed-text-v1.5"
1116
+ fastembed_batch_size: 4
1117
+ ```
1118
+
1119
+ **Anthropic:**
1120
+
1121
+ ```yaml
1122
+ chatbot:
1123
+ answer:
1124
+ provider: "anthropic"
1125
+ model: "claude-3-5-sonnet-20241022"
1126
+ api_key_env: "DEEPDOC_CHAT_API_KEY"
1127
+ embeddings:
1128
+ provider: "openai" # Anthropic doesn't offer embedding models
1129
+ model: "text-embedding-3-large"
1130
+ api_key_env: "DEEPDOC_EMBED_API_KEY"
1131
+ ```
1132
+
1133
+ ### How Chatbot Indexing Works
1134
+
1135
+ During `deepdoc generate`, six corpora are built and stored in `.deepdoc/chatbot/`:
1136
+
1137
+ | Corpus | Source | Description |
1138
+ |--------|--------|-------------|
1139
+ | **Code chunks** | All parsed source files | Code split by line count with overlap, tagged with symbols and file paths |
1140
+ | **Artifact chunks** | Config files (Dockerfile, package.json, OpenAPI specs, etc.) | Non-code project files split similarly |
1141
+ | **Doc summary chunks** | Generated documentation pages | First sections extracted from each generated Markdown page |
1142
+ | **Doc full chunks** | Generated documentation pages | Section-level chunks from the full generated Markdown pages |
1143
+ | **Repo doc chunks** | Repo-authored docs such as `README.md`, `docs/`, design notes, and notebooks | Raw repo documentation kept separate from generated pages |
1144
+ | **Relationship chunks** | Imports, symbols, call graph, and graph-neighbor summaries | Lightweight graph-style retrieval context |
1145
+
1146
+ `deepdoc update` incrementally syncs the chatbot indexes from the same commit-based update run — only changed files, repo-doc candidates, and regenerated doc pages are re-indexed.
1147
+
1148
+ ### Chatbot Query Pipeline
1149
+
1150
+ When a user asks a question, the backend runs a mode-aware retrieval pipeline:
1151
+
1152
+ 1. **Query expansion** — In default/deep/code-aware mode, the LLM can generate alternative search queries to improve recall. Fast mode disables this by default.
1153
+ 2. **Embedding** — All queries are embedded using the configured embedding model.
1154
+ 3. **Hybrid retrieval** — FAISS similarity search and exact-match lexical search both gather candidates from each corpus.
1155
+ 4. **Follow-up retrieval** — The backend can derive focused second-pass searches and pull linked files/docs via graph-neighbor expansion. Fast mode can skip follow-up queries for lower latency.
1156
+ 5. **Chunk stitching** — Exact-match code hits can pull adjacent code windows from the same file so larger implementations survive chunk boundaries.
1157
+ 6. **Reranking** — In default/deep/code-aware mode, the LLM can rerank candidates for relevance. Fast mode disables this by default.
1158
+ 7. **Prompt assembly** — Query-type-aware budgets reserve space for the most important evidence types within the character budget.
1159
+ 8. **Answer generation + continuity guard** — The answer LLM produces a grounded response, and if the output appears truncated (for example ending on a dangling heading), DeepDoc retries with a continuation prompt so the response finishes cleanly.
1160
+
1161
+ `POST /deep-research` uses the same indexed corpora first, but it can also inspect a small bounded set of live repo files when exact-match evidence is missing from the index. This fallback respects the repo's exclude rules, skips oversized/binary files, and is only used in deep research mode.
1162
+
1163
+ `POST /code-deep` uses a code-heavy retrieval profile and returns an explicit file inventory plus step trace so users can see where evidence came from while answering file-oriented questions such as “where is auth defined?”.
1164
+
1165
+ `POST /query`, `POST /deep-research`, and `POST /code-deep` return `response_mode` in the payload (`fast`, `deep`, `code_deep`, or `default`) so clients can confirm which retrieval profile generated the result.
1166
+
1167
+ ### Chatbot API Endpoints
1168
+
1169
+ The generated `chatbot_backend/` exposes five endpoints:
1170
+
1171
+ **Health check:**
1172
+ ```
1173
+ GET /health → { "status": "ok" }
1174
+ ```
1175
+
1176
+ **Query:**
1177
+ ```
1178
+ POST /query
1179
+ {
1180
+ "question": "How does authentication work?",
1181
+ "history": [
1182
+ { "role": "user", "content": "What endpoints exist?" },
1183
+ { "role": "assistant", "content": "..." }
1184
+ ]
1185
+ }
1186
+ ```
1187
+
1188
+ The response includes the answer text, code citations (file path + line range), artifact citations, and links to relevant generated doc pages.
1189
+
1190
+ `/query` is optimized for speed: it runs retrieval in fast mode (no LLM query expansion/rerank by default) and returns an answer plus citations.
1191
+
1192
+ **Code-aware deep query:**
1193
+ ```
1194
+ POST /code-deep
1195
+ {
1196
+ "question": "Where is authentication defined?",
1197
+ "history": [],
1198
+ "max_rounds": 4
1199
+ }
1200
+ ```
1201
+
1202
+ `/code-deep` returns a code-aware answer plus `trace` and `file_inventory` fields so clients can show reasoning progress and files considered.
1203
+
1204
+ **Code-aware live stream (SSE):**
1205
+ ```
1206
+ POST /code-deep/stream
1207
+ {
1208
+ "question": "Where is authentication defined?",
1209
+ "history": [],
1210
+ "max_rounds": 4
1211
+ }
1212
+ ```
1213
+
1214
+ `/code-deep/stream` emits `trace` events while researching, then a final `result` event and `done`.
1215
+
1216
+ **Retrieve context only (no answer generation):**
1217
+ ```
1218
+ POST /query-context
1219
+ {
1220
+ "question": "Where is reshipping implemented?",
1221
+ "history": []
1222
+ }
1223
+ ```
1224
+
1225
+ `/query-context` returns selected citations/chunks only. Use this endpoint to inspect retrieval quality independently from answer generation.
1226
+
1227
+ ### Deploying the Chatbot
1228
+
1229
+ For local development, `deepdoc serve` handles everything automatically. For production:
1230
+
1231
+ 1. Deploy the static site (`site/out/`) to any static host.
1232
+ 2. Deploy `chatbot_backend/` separately to a Python-capable host.
1233
+ 3. Set `chatbot.backend.base_url` in `.deepdoc.yaml` to point at the deployed backend URL.
1234
+ 4. Rebuild the site so the frontend picks up the new backend URL: `deepdoc deploy`.
1235
+
1236
+ ### Cleaning Up Chatbot Files
1237
+
1238
+ ```bash
1239
+ deepdoc clean # Removes chatbot_backend/, .deepdoc/chatbot/, and other generated state
1240
+ deepdoc clean --yes # Skip confirmation prompt
1241
+ ```
1242
+
1243
+ ---
1244
+
1245
+ ## Supported Languages & Frameworks
1246
+
1247
+ **Parsing (tree-sitter AST + regex fallback):**
1248
+
1249
+ | Language | Extensions | Extracts |
1250
+ |----------|-----------|----------|
1251
+ | Python | `.py` | Functions, classes, decorators, imports |
1252
+ | JavaScript | `.js`, `.jsx`, `.mjs`, `.cjs` | Functions, classes, arrow functions, imports |
1253
+ | TypeScript | `.ts`, `.tsx` | Same as JS + interfaces, type aliases |
1254
+ | Go | `.go` | Functions, methods, structs, interfaces |
1255
+ | PHP | `.php` | Functions, classes, methods, namespaces |
1256
+ | Vue | `.vue` | SFC script symbols, props/emits/slots, router/store usage |
1257
+
1258
+ **High-confidence framework support (fixture-backed):**
1259
+
1260
+ | Framework | Language | Proven patterns |
1261
+ |-----------|----------|-----------------|
1262
+ | Laravel | PHP | `Route::get()`, grouped prefixes, middleware, resource expansion |
1263
+ | Django / DRF | Python | `path()`, `re_path()`, `@api_view`, `as_view()`, DRF routers, `@action` |
1264
+ | Express | JS/TS | Mounted routers via `app.use()`, nested prefixes, chained `route()` calls |
1265
+ | Fastify | JS/TS | Plugin `register(..., { prefix })`, shorthand methods, `route({ ... })`, schema hints |
1266
+ | Falcon | Python | `app.add_route()`, responder classes, imported resources, app middleware |
1267
+ | Vue | Vue SFC | Component detection, `defineProps`, `defineEmits`, `defineModel`, `defineSlots`, router/store signals |
1268
+
1269
+ **Supported but not headline-high-confidence yet:**
1270
+
1271
+ | Framework | Language | Current coverage |
1272
+ |-----------|----------|------------------|
1273
+ | Gin / Echo / Fiber | Go | Common route helpers (`GET`, `POST`, `HandleFunc`) |
1274
+
1275
+ **Runtime/background surface extraction:**
1276
+
1277
+ | Surface | Current coverage |
1278
+ |---------|------------------|
1279
+ | Celery | Tasks, retry/queue hints, beat schedules, producers |
1280
+ | Django | Management commands, signal receivers, Channels websocket consumers |
1281
+ | Laravel | Queued jobs, listeners, events, scheduler registrations |
1282
+ | JS/TS | `node-cron`, queue workers, agenda jobs, Socket.IO / websocket consumers |
1283
+ | Go | Goroutine workers, `AddFunc` cron registrations, scheduler `.Every(...).Do(...)` patterns |
1284
+ | Generic cron | Python `crontab(...)` style schedule declarations |
1285
+
1286
+ ---
1287
+
1288
+ ## Architecture
1289
+
1290
+ The current system is bucket-based.
1291
+
1292
+ **Planner bucket types:**
1293
+
1294
+ | Type | Purpose |
1295
+ |------|---------|
1296
+ | `system` | Architecture, setup, testing, deployment/ops, auth, shared middleware, observability |
1297
+ | `feature` | Business workflows like checkout, refunds, order status, onboarding |
1298
+ | `endpoint` | Endpoint-family or resource-level API docs |
1299
+ | `endpoint_ref` | Legacy or OpenAPI-backed single-endpoint page; scanned runtime endpoints are grouped into endpoint-family docs by default |
1300
+ | `integration` | Third-party systems like payment, warehouse, delivery, webhook providers |
1301
+ | `database` | Cross-cutting database/schema/data-layer documentation |
1302
+
1303
+ **Five implemented phases:**
1304
+
1305
+ 1. **Repository scan/indexing**
1306
+ - Parse supported source files
1307
+ - Detect endpoints, config files, setup artifacts, runtime surfaces, integrations, and OpenAPI specs
1308
+ - Record file sizes, symbols, imports, config impacts, and raw scan summaries
1309
+ 2. **Multi-step planning**
1310
+ - Classify repo artifacts
1311
+ - Propose system/feature/endpoint/integration/database buckets
1312
+ - Assign files, symbols, and artifacts into the final plan
1313
+ 3. **Generation engine**
1314
+ - Build evidence packs for buckets
1315
+ - Generate pages in batches with parallel workers
1316
+ - Enrich grouped endpoint-family pages with scanned endpoint details and stage OpenAPI-backed API pages when a spec exists
1317
+ - Validate output for file, route, runtime, config, and integration grounding
1318
+ - Degrade gracefully on failures
1319
+ - Persist quality status so invalid/degraded pages are visible after a run
1320
+ 4. **Persistence**
1321
+ - Persist plan, file map, scan cache, and generation ledger in `.deepdoc/`
1322
+ - Keep enough state for updates, staleness detection, and cleanup
1323
+ 5. **Smart update**
1324
+ - Choose incremental update vs targeted replan vs full replan
1325
+ - Refresh only stale docs when safe
1326
+ - Rebuild affected docs after structural repo changes
1327
+
1328
+ ---
1329
+
1330
+ ## Generated Files
1331
+
1332
+ After running `deepdoc generate`, you'll find:
1333
+
1334
+ ```
1335
+ your-repo/
1336
+ ├── .deepdoc.yaml # Config
1337
+ ├── .deepdoc/ # Canonical persisted state
1338
+ │ ├── plan.json # Bucket plan
1339
+ │ ├── scan_cache.json # Lightweight scan snapshot
1340
+ │ ├── ledger.json # Generated-page ledger
1341
+ │ ├── file_map.json # file → bucket/page mapping
1342
+ │ ├── state.json # last synced commit + update status
1343
+ │ └── sync_receipt.json # latest update/generate sync receipt
1344
+ ├── .deepdoc_manifest.json # Legacy source hash manifest
1345
+ ├── .deepdoc_plan.json # Legacy compatibility plan file
1346
+ ├── .deepdoc_file_map.json # Legacy compatibility file map
1347
+ ├── docs/ # Generated Markdown pages
1348
+ │ ├── index.md
1349
+ │ ├── architecture.md
1350
+ │ ├── setup-and-configuration.md
1351
+ │ ├── api.md # Swagger UI page (when an OpenAPI spec exists)
1352
+ │ ├── openapi/ # Staged OpenAPI specs
1353
+ │ └── ...
1354
+ └── site/ # Generated Next.js + Fumadocs site shell
1355
+ ├── deepdoc.config.json # Nav, brand colors, chatbot config
1356
+ ├── package.json
1357
+ ├── app/
1358
+ └── out/ # Static HTML after `deepdoc deploy`
1359
+ ```
1360
+
1361
+ ---
1362
+
1363
+ ## GitHub Actions CI/CD
1364
+
1365
+ Use GitHub Pages Actions when you want to publish the already-generated static export from `site/out/`:
1366
+
1367
+ ```yaml
1368
+ # .github/workflows/github-pages.yml
1369
+ name: Deploy GitHub Pages
1370
+
1371
+ on:
1372
+ push:
1373
+ branches: [main]
1374
+ workflow_dispatch:
1375
+
1376
+ permissions:
1377
+ contents: read
1378
+ pages: write
1379
+ id-token: write
1380
+
1381
+ jobs:
1382
+ build:
1383
+ runs-on: ubuntu-latest
1384
+ steps:
1385
+ - uses: actions/checkout@v4
1386
+ - uses: actions/configure-pages@v5
1387
+ - run: |
1388
+ test -d site/out
1389
+ test -f site/out/index.html
1390
+ - uses: actions/upload-pages-artifact@v3
1391
+ with:
1392
+ path: site/out
1393
+
1394
+ deploy:
1395
+ needs: build
1396
+ runs-on: ubuntu-latest
1397
+ environment:
1398
+ name: github-pages
1399
+ steps:
1400
+ - id: deployment
1401
+ uses: actions/deploy-pages@v4
1402
+ ```
1403
+
1404
+ This workflow publishes the committed `site/out/` directory directly, so GitHub Pages does not need a `docs/` folder.
1405
+
1406
+ If you want to regenerate docs on every push before deploying them, use a separate workflow like this:
1407
+
1408
+ ```yaml
1409
+ # .github/workflows/docs.yml
1410
+ name: Update And Deploy Documentation
1411
+
1412
+ on:
1413
+ push:
1414
+ branches: [main]
1415
+ workflow_dispatch:
1416
+
1417
+ jobs:
1418
+ update-docs:
1419
+ runs-on: ubuntu-latest
1420
+ permissions:
1421
+ contents: read
1422
+ pages: write
1423
+ id-token: write
1424
+
1425
+ steps:
1426
+ - uses: actions/checkout@v4
1427
+ with:
1428
+ fetch-depth: 0 # Full history needed for git diff
1429
+
1430
+ - uses: actions/setup-python@v5
1431
+ with:
1432
+ python-version: "3.11"
1433
+
1434
+ - name: Install dependencies
1435
+ run: |
1436
+ pip install deepdoc # or: pip install "deepdoc[chatbot]" if you use chatbot features
1437
+
1438
+ - name: Update and deploy docs
1439
+ env:
1440
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
1441
+ run: |
1442
+ deepdoc update --strict-quality --deploy
1443
+
1444
+ - name: Upload Pages artifact
1445
+ uses: actions/upload-pages-artifact@v3
1446
+ with:
1447
+ path: site/out
1448
+
1449
+ deploy:
1450
+ needs: update-docs
1451
+ runs-on: ubuntu-latest
1452
+ environment:
1453
+ name: github-pages
1454
+ steps:
1455
+ - id: deployment
1456
+ uses: actions/deploy-pages@v4
1457
+ ```
1458
+
1459
+ Add your API key to repo Settings → Secrets → Actions → `ANTHROPIC_API_KEY`.
1460
+
1461
+ If you self-host and just want docs kept fresh without deploying to GitHub Pages, use this minimal variant instead — it commits the refreshed `docs/` and `.deepdoc/` state back to the branch:
1462
+
1463
+ ```yaml
1464
+ # .github/workflows/deepdoc-refresh.yml
1465
+ name: Refresh Docs
1466
+
1467
+ on:
1468
+ push:
1469
+ branches: [main]
1470
+
1471
+ jobs:
1472
+ refresh:
1473
+ runs-on: ubuntu-latest
1474
+ permissions:
1475
+ contents: write
1476
+
1477
+ steps:
1478
+ - uses: actions/checkout@v4
1479
+ with:
1480
+ fetch-depth: 0 # Full history needed for git diff
1481
+
1482
+ - uses: actions/setup-python@v5
1483
+ with:
1484
+ python-version: "3.11"
1485
+
1486
+ - name: Install deepdoc
1487
+ run: pip install deepdoc
1488
+
1489
+ - name: Refresh docs
1490
+ env:
1491
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
1492
+ run: deepdoc update --strict-quality
1493
+
1494
+ - name: Commit updated docs
1495
+ run: |
1496
+ git config user.name "github-actions[bot]"
1497
+ git config user.email "github-actions[bot]@users.noreply.github.com"
1498
+ git add docs/ .deepdoc/
1499
+ git diff --cached --quiet || git commit -m "chore: refresh docs [skip ci]"
1500
+ git push
1501
+ ```
1502
+
1503
+ The `[skip ci]` tag on the commit message prevents the workflow from triggering itself again.
1504
+
1505
+ ---
1506
+
1507
+ ## Contributing & Releases
1508
+
1509
+ Release flow for the Python package and the VS Code extension, plus repo layout and test-running notes, lives in [CONTRIBUTING.md](./CONTRIBUTING.md). Both tracks publish automatically when you push a version bump to `main`.
1510
+
1511
+ ---
1512
+
1513
+ ## Typical Workflow
1514
+
1515
+ **First time:**
1516
+ ```bash
1517
+ cd your-repo
1518
+ deepdoc init --provider anthropic
1519
+ export ANTHROPIC_API_KEY=sk-ant-...
1520
+ deepdoc generate
1521
+ deepdoc serve # Preview at localhost:3000
1522
+ deepdoc deploy # Export a static site to site/out/
1523
+ ```
1524
+
1525
+ **Every time you update code:**
1526
+ ```bash
1527
+ git add . && git commit -m "feat: new feature"
1528
+ deepdoc update # Only regenerates affected pages
1529
+ deepdoc deploy # Or use --deploy flag with update
1530
+ ```
1531
+
1532
+ **Full refresh after planner / prompt / generator changes:**
1533
+ ```bash
1534
+ deepdoc generate --force
1535
+ ```
1536
+
1537
+ **Wipe docs and rebuild from zero:**
1538
+ ```bash
1539
+ deepdoc generate --clean --yes
1540
+ ```
1541
+
1542
+ **Switch LLM mid-project:**
1543
+ ```bash
1544
+ deepdoc config set llm.provider openai
1545
+ deepdoc config set llm.model gpt-4o
1546
+ export OPENAI_API_KEY=sk-...
1547
+ deepdoc generate --force # Full regen with new model
1548
+ ```
1549
+
1550
+ ---
1551
+
1552
+ ## Requirements
1553
+
1554
+ - Python 3.10+
1555
+ - **Node.js ≥18** — used by `deepdoc serve` (`next dev`) and `deepdoc deploy` (`next build`) for the generated site. Install from [nodejs.org](https://nodejs.org). `npm install` runs automatically inside `site/` when needed.
1556
+ - Git (for `deepdoc update` and `deepdoc deploy`)
1557
+ - An LLM API key (or Ollama running locally)
1558
+
1559
+ ---
1560
+
1561
+ ## License
1562
+
1563
+ MIT