kingmadoc 0.2.0__tar.gz → 0.3.0.dev8__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 (168) hide show
  1. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/.github/workflows/release.yml +38 -15
  2. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/CHANGELOG.md +44 -0
  3. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/CLAUDE.md +1 -1
  4. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/PKG-INFO +24 -13
  5. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/README.md +23 -12
  6. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/docs/releasing.md +9 -0
  7. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/docs/test-plan.md +3 -3
  8. kingmadoc-0.3.0.dev8/evals/results/2026-09-27T162715Z.json +95 -0
  9. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/scripts/run_evals.py +2 -2
  10. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/SKILL.md +2 -1
  11. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/codex.md +2 -1
  12. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/copilot.md +2 -1
  13. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/cursor.md +2 -1
  14. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/explaining-code/SKILL.md +45 -7
  15. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/explaining-code/reference/arc42.md +7 -1
  16. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/explaining-code/reference/c4-model.md +14 -6
  17. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/explaining-code/reference/c4.md +6 -1
  18. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/explaining-code/reference/models.md +70 -1
  19. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/explaining-code/reference/split.md +5 -1
  20. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/cli.py +74 -12
  21. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/facts/collect.py +95 -29
  22. kingmadoc-0.3.0.dev8/src/kingmadoc/facts/dominators.py +109 -0
  23. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/facts/js_modules.py +6 -2
  24. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/render.py +128 -1
  25. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_facts.py +32 -0
  26. kingmadoc-0.3.0.dev8/tests/test_facts_dominators.py +70 -0
  27. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_render.py +112 -1
  28. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_skill_explaining_code.py +49 -3
  29. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_skill_models.py +62 -1
  30. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_vscode_preview.py +46 -0
  31. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/.featuredoc.yml +0 -0
  32. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  33. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  34. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/.github/workflows/ci.yml +0 -0
  35. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/.gitignore +0 -0
  36. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/CONTRIBUTING.md +0 -0
  37. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/LICENSE +0 -0
  38. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/docs/conventions.md +0 -0
  39. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/docs/index.md +0 -0
  40. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/docs/roadmap.md +0 -0
  41. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/README.md +0 -0
  42. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop/manage.py +0 -0
  43. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop/requirements.txt +0 -0
  44. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop/shop/__init__.py +0 -0
  45. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop/shop/models.py +0 -0
  46. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop/shop/services.py +0 -0
  47. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop/shop/settings.py +0 -0
  48. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop/shop/urls.py +0 -0
  49. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop/shop/views.py +0 -0
  50. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop-discount/shop/discounts.py +0 -0
  51. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/fixtures/shop-discount/shop/services.py +0 -0
  52. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/results/2026-09-27T111837Z.json +0 -0
  53. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/results/2026-09-27T112600Z.json +0 -0
  54. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/scenarios/explain-branch.yml +0 -0
  55. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/scenarios/explain-feature.yml +0 -0
  56. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/evals/scenarios/plan-feature.yml +0 -0
  57. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/examples/verify-mode-plan.md +0 -0
  58. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/pyproject.toml +0 -0
  59. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/scripts/build_skill_variants.py +0 -0
  60. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/reference/diagram-rules.md +0 -0
  61. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/skill/reference/formats.md +0 -0
  62. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/__init__.py +0 -0
  63. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/about.py +0 -0
  64. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/adr.py +0 -0
  65. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/config.py +0 -0
  66. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/d2_binary.py +0 -0
  67. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/diagrams/__init__.py +0 -0
  68. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/diagrams/base.py +0 -0
  69. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/diagrams/d2.py +0 -0
  70. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/diagrams/mermaid.py +0 -0
  71. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/diagrams/plantuml.py +0 -0
  72. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/documents.py +0 -0
  73. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/exceptions.py +0 -0
  74. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/explain.py +0 -0
  75. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/facts/__init__.py +0 -0
  76. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/facts/branch.py +0 -0
  77. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/facts/data_model.py +0 -0
  78. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/facts/projects.py +0 -0
  79. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/facts/routes.py +0 -0
  80. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/facts/services.py +0 -0
  81. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/git.py +0 -0
  82. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/naming.py +0 -0
  83. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/plan/__init__.py +0 -0
  84. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/plan/analyzer.py +0 -0
  85. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/plan/dependencies.py +0 -0
  86. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/plan/generator.py +0 -0
  87. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/plan/models.py +0 -0
  88. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/plandoc.py +0 -0
  89. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/skills.py +0 -0
  90. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/templates/adr.md.j2 +0 -0
  91. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/templates/domain_design.md.j2 +0 -0
  92. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/templates/functional_design.md.j2 +0 -0
  93. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/templates/plan_default.md.j2 +0 -0
  94. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/templates/security_design.md.j2 +0 -0
  95. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/templates/technical_design.md.j2 +0 -0
  96. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/templating.py +0 -0
  97. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/verify/__init__.py +0 -0
  98. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/verify/changes.py +0 -0
  99. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/verify/commands.py +0 -0
  100. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/verify/deviations.py +0 -0
  101. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/verify/locate.py +0 -0
  102. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/verify/report.py +0 -0
  103. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/src/kingmadoc/vscode.py +0 -0
  104. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/d2/class.d2 +0 -0
  105. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/d2/component.d2 +0 -0
  106. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/d2/container.d2 +0 -0
  107. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/d2/context.d2 +0 -0
  108. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/d2/sequence.d2 +0 -0
  109. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/mermaid/class.mmd +0 -0
  110. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/mermaid/component.mmd +0 -0
  111. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/mermaid/container.mmd +0 -0
  112. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/mermaid/context.mmd +0 -0
  113. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/mermaid/sequence.mmd +0 -0
  114. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/plantuml/class.puml +0 -0
  115. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/plantuml/component.puml +0 -0
  116. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/plantuml/container.puml +0 -0
  117. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/plantuml/context.puml +0 -0
  118. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/backends/plantuml/sequence.puml +0 -0
  119. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/mermaid/component.mmd +0 -0
  120. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/mermaid/container.mmd +0 -0
  121. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/fixtures/mermaid/context.mmd +0 -0
  122. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_adr.py +0 -0
  123. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_adr_numbering.py +0 -0
  124. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_analyzer.py +0 -0
  125. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_cli.py +0 -0
  126. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_cli_encoding.py +0 -0
  127. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_cli_init.py +0 -0
  128. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_cli_plan_custom_template.py +0 -0
  129. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_cli_sigint.py +0 -0
  130. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_cli_verify_config.py +0 -0
  131. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_config.py +0 -0
  132. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_config_poetry.py +0 -0
  133. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_config_shape.py +0 -0
  134. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_d2_download.py +0 -0
  135. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_dependencies.py +0 -0
  136. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_dependency_graph_model.py +0 -0
  137. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_design_models.py +0 -0
  138. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_diagram_backends.py +0 -0
  139. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_diagrams_mermaid.py +0 -0
  140. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_documents.py +0 -0
  141. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_duplicate_names.py +0 -0
  142. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_evals.py +0 -0
  143. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_explain.py +0 -0
  144. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_explain_config.py +0 -0
  145. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_explain_status.py +0 -0
  146. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_extra_designs_coverage.py +0 -0
  147. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_facts_code.py +0 -0
  148. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_facts_data_model.py +0 -0
  149. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_functional_design.py +0 -0
  150. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_generator.py +0 -0
  151. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_grep_performance.py +0 -0
  152. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_manifests.py +0 -0
  153. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_max_lines_per_file.py +0 -0
  154. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_output_dir.py +0 -0
  155. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_plan_e2e.py +0 -0
  156. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_plandoc.py +0 -0
  157. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_properties.py +0 -0
  158. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_security_domain_designs.py +0 -0
  159. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_skill.py +0 -0
  160. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_skills_install.py +0 -0
  161. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_source_dirs.py +0 -0
  162. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_summary_slug_diagram_defaults.py +0 -0
  163. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_technical_design.py +0 -0
  164. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_templating_security.py +0 -0
  165. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_verify.py +0 -0
  166. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_verify_locate.py +0 -0
  167. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/tests/test_version.py +0 -0
  168. {kingmadoc-0.2.0 → kingmadoc-0.3.0.dev8}/uv.lock +0 -0
@@ -1,10 +1,17 @@
1
1
  name: Release
2
2
 
3
- # Push a tag like v0.2.0: build, publish to PyPI (trusted publishing, no API token) and
4
- # create the GitHub release with the built files. One-time setup: see RELEASING.md.
3
+ # Two channels, both with PyPI trusted publishing (no API token; setup: docs/releasing.md):
4
+ # - Release: push a tag like v0.2.0. Publishes 0.2.0 and creates the GitHub release.
5
+ # - Beta: every commit on main whose CI passed. Publishes its development version
6
+ # (e.g. 0.3.0.dev12, from hatch-vcs). pip installs it only when asked for pre-releases
7
+ # (pipx install --pip-args=--pre kingmadoc), so ordinary installs keep the release.
5
8
  on:
6
9
  push:
7
10
  tags: ["v*"]
11
+ workflow_run:
12
+ workflows: [CI]
13
+ types: [completed]
14
+ branches: [main]
8
15
 
9
16
  permissions:
10
17
  contents: read
@@ -12,12 +19,20 @@ permissions:
12
19
  jobs:
13
20
  build:
14
21
  name: Build and test the distribution
22
+ # Beta: only a push to this repository's main whose CI passed (not a pull request).
23
+ if: >-
24
+ github.event_name == 'push' || (
25
+ github.event.workflow_run.conclusion == 'success' &&
26
+ github.event.workflow_run.event == 'push' &&
27
+ github.event.workflow_run.head_repository.full_name == github.repository
28
+ )
15
29
  runs-on: ubuntu-latest
16
30
  steps:
17
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
31
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
18
32
  with:
19
- fetch-depth: 0 # the version comes from the tag (hatch-vcs)
20
- - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
33
+ fetch-depth: 0 # the version comes from the tag (hatch-vcs)
34
+ ref: ${{ github.event.workflow_run.head_sha || github.ref }}
35
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
21
36
  with:
22
37
  python-version: "3.11"
23
38
  - name: Build
@@ -25,10 +40,14 @@ jobs:
25
40
  python -m pip install build twine
26
41
  python -m build
27
42
  twine check --strict dist/*
28
- - name: The version is the tag
43
+ - name: The version is the tag (release) or a development version (beta)
29
44
  run: |
30
- version="${GITHUB_REF_NAME#v}"
31
- ls dist/kingmadoc-"$version".tar.gz dist/kingmadoc-"$version"-py3-none-any.whl
45
+ if [ "$GITHUB_EVENT_NAME" = push ]; then
46
+ version="${GITHUB_REF_NAME#v}"
47
+ ls dist/kingmadoc-"$version".tar.gz dist/kingmadoc-"$version"-py3-none-any.whl
48
+ else
49
+ ls dist/kingmadoc-*.dev*-py3-none-any.whl
50
+ fi
32
51
  - name: The wheel works on its own (skills and templates included)
33
52
  run: |
34
53
  python -m venv "$RUNNER_TEMP/venv"
@@ -36,9 +55,9 @@ jobs:
36
55
  cd "$RUNNER_TEMP"
37
56
  "$RUNNER_TEMP/venv/bin/kingmadoc" --version
38
57
  "$RUNNER_TEMP/venv/bin/kingmadoc" plan "Release check." --no-input --stdout > /dev/null
39
- "$RUNNER_TEMP/venv/bin/kingmadoc" skills install
58
+ "$RUNNER_TEMP/venv/bin/kingmadoc" skills install --no-vscode
40
59
  test -f .claude/skills/explaining-code/SKILL.md
41
- - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
60
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
42
61
  with:
43
62
  name: dist
44
63
  path: dist/
@@ -52,23 +71,27 @@ jobs:
52
71
  name: pypi
53
72
  url: https://pypi.org/p/kingmadoc
54
73
  permissions:
55
- id-token: write # trusted publishing
74
+ id-token: write # trusted publishing
56
75
  steps:
57
- - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
76
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
58
77
  with:
59
78
  name: dist
60
79
  path: dist/
61
- - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
80
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
81
+ with:
82
+ # A re-run of the same commit builds the same version: not an error.
83
+ skip-existing: true
62
84
 
63
85
  github-release:
64
86
  name: GitHub release
65
87
  needs: pypi
88
+ if: github.event_name == 'push'
66
89
  runs-on: ubuntu-latest
67
90
  permissions:
68
91
  contents: write
69
92
  steps:
70
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
71
- - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
93
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
94
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
72
95
  with:
73
96
  name: dist
74
97
  path: dist/
@@ -7,6 +7,50 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Changed
11
+
12
+ - Tidier diagrams: `kingmadoc render` lays figures out with ELK (straight,
13
+ right-angled arrows with fewer crossings; a diagram that sets its own
14
+ `layout-engine` keeps it) and warns about more than 12 arrows or two arrows between
15
+ the same shapes. `explaining-code` 5.7: one flow direction, one arrow per pair, at
16
+ most 12 arrows, labels of at most six words; C4 boundary labels sit top-left in a
17
+ small font so arrows do not cross them. At hand-over the agent asks whether VS Code
18
+ should open explainers as a preview (the pictures only show there) and sets it up on
19
+ yes.
20
+ - Beta channel: every commit on `main` that passes CI is published to PyPI as a
21
+ development version (`0.3.0.devN`); follow it with
22
+ `pipx install --pip-args=--pre kingmadoc` and `pipx upgrade kingmadoc`.
23
+ - Fewer tokens for agents: `kingmadoc render` prints one line per document
24
+ (`--verbose` lists every image), `kingmadoc explain facts --only routes,data` prints
25
+ only the sections asked for, and `explaining-code` 5.6 works quietly, loads reference
26
+ sections on demand (each long reference starts with its contents), lets a subagent
27
+ read a big codebase and return a compact summary, fixes a figure by editing its
28
+ `.d2`, and hands over in at most five lines. The `kingmadoc` skill does not paste the
29
+ plan into the chat either.
30
+ - `kingmadoc skills install` asks in a terminal whether VS Code should open explainers
31
+ as a rendered preview (default yes); `--vscode` / `--no-vscode` answer up front, and
32
+ agents or pipes only get a tip. `kingmadoc render` says how to see the pictures
33
+ (Ctrl+Shift+V) while that setting is missing.
34
+
35
+ ### Added
36
+
37
+ - `kingmadoc explain facts` lists private modules from the dominator tree of the module
38
+ graph (Python and JavaScript/TypeScript): what only one module leads to belongs to
39
+ it, which shows the real component boundaries. A single entry point is left out.
40
+ - `explaining-code` model "Algorithm": a flowchart, at most 15 lines of pseudocode, the
41
+ formula as `$$ … $$` (GitHub and VS Code render it), the invariant, the complexity and
42
+ a trace table on a small input.
43
+
44
+ ### Fixed
45
+
46
+ - Dark mode: the C4 style of `explaining-code` (5.5) set black title text and white
47
+ boundaries and nodes, which were unreadable or glaring in dark mode. Titles and
48
+ labels now follow the theme and boundaries are transparent; `kingmadoc render` warns
49
+ about such styles in existing diagrams (fixed text colour without a fill, white
50
+ fills, a `sequence_diagram` whose container key shows as a heading).
51
+ - `kingmadoc render`: images get normal file permissions (0644) instead of D2's private
52
+ 0600.
53
+
10
54
  ## [0.2.0] - 2026-09-27
11
55
 
12
56
  Explain existing code with pictures, machine-readable plans, and a `verify` that
@@ -36,7 +36,7 @@ Flow for `plan "<description>"` (`cli.py`): `config.load_config` → `plan.analy
36
36
  - `render.py` (`kingmadoc render <doc>`): renders each ```` ```d2 ```` block to `img/<doc>-<n>.svg` (D2 via `d2_binary.ensure_d2`), moves its source to `img/<doc>-<n>.d2`, and leaves only `<!-- kingmadoc:diagram img/<doc>-<n>.d2 -->` + the image in the document (the comment is invisible in previews; re-rendering reads the `.d2` files, so edit those). Converts the older `<details>` format. Renders everything to a temp dir first, so a failing diagram changes nothing.
37
37
  - `d2_binary.py`: `ensure_d2` finds D2 (`KINGMADOC_D2`, PATH, cache) or downloads the pinned release once into the user cache; the SHA-256 per platform is pinned in `D2_ASSETS` (update version + all hashes together, cross-checked with the release's SHA256SUMS). `skills.py` + `kingmadoc skills install`: the skills in `skill/` ship as package data (hatch force-include) and are copied into the agent's skills dir; a `.kingmadoc-skill.json` manifest per skill folder records the installed hashes, so a reinstall updates unchanged files and only blocks local edits (`PREVIOUS_RELEASES` is the frozen hash list for installs from before the manifest).
38
38
  - `skill/explaining-code/`: second product skill; explains existing code (feature, branch, project, part) with D2 pictures, one folder per subject `docs/explain/<NNNN>-<slug>/README.md` (`explain.py` + `kingmadoc explain new`: next ID, never reused, same subject reuses its folder; regenerates the index `docs/explain/README.md`, also after `render` of such a file; `explain status` → `freshness`: `git diff --relative --name-only <Based on commit>` over the paths the explainer names in code spans (else the whole project), excluding `docs/explain`; `render` names a README's images `figure-<n>`). `SKILL.md` = workflow and D2 examples; the formats are `reference/arc42.md` (default) and `reference/c4.md`, chosen by `explain.format`; `reference/split.md` for `explain.documents: split` (cover + `functional.md` + `technical.md`); `reference/c4-model.md` (Simon Brown's C4: abstractions, 7 diagrams, notation, D2 style block, checklist) and `reference/models.md` (decision table + rules + one example per other model). `tests/test_skill_explaining_code.py` checks its format and compiles every D2 example with the real `d2` when available (`D2_BIN`); `tests/test_skill_models.py` checks every example obeys its model's rules. D2 pitfalls: quote labels with `[`/`:`; `source-arrowhead` only works on `<->`.
39
- - `facts/` (`kingmadoc explain facts`): pure parsers `projects.project_references` (.csproj) and `data_model.data_model` (EF Core via `DbSet<T>`, Prisma, Django, SQLAlchemy, TypeORM; regex, test files skipped) → frozen `Entity`/`Field`/`Relation`; `routes.routes` (ASP.NET controllers + minimal APIs, Next.js app/pages, Django urls + decorators, FastAPI, Flask, Express; `access` = what the code states), `services.services` (.NET DI), `js_modules.js_dependencies` (relative + tsconfig `paths` imports, `plan.dependencies.collapse` above 25 modules); `branch.branch_changes` (git I/O via `git.run_git`, merge base → working tree); `collect.collect_facts` reads files from the `CodebaseReport` and renders Markdown/JSON.
39
+ - `facts/` (`kingmadoc explain facts`): pure parsers `projects.project_references` (.csproj) and `data_model.data_model` (EF Core via `DbSet<T>`, Prisma, Django, SQLAlchemy, TypeORM; regex, test files skipped) → frozen `Entity`/`Field`/`Relation`; `routes.routes` (ASP.NET controllers + minimal APIs, Next.js app/pages, Django urls + decorators, FastAPI, Flask, Express; `access` = what the code states), `services.services` (.NET DI), `js_modules.js_dependencies` (relative + tsconfig `paths` imports, `plan.dependencies.collapse` above 25 modules, `max_nodes=None` for the raw graph), `dominators.private_modules` (Cooper–Harvey–Kennedy on the raw Python + JS graphs; virtual root above the modules nothing imports; a single entry point is left out); `branch.branch_changes` (git I/O via `git.run_git`, merge base → working tree); `collect.collect_facts` reads files from the `CodebaseReport` and renders Markdown/JSON.
40
40
  - `plandoc.py` (not a mode; pure): the plan frontmatter (B2) and `REQ-n` requirements (B1): `check_plan` (every problem as a message), `parse_plan` → `PlanMeta`, `set_status` (frontmatter + header table). `kingmadoc check <slug>` / `approve <slug>` in `cli.py` use `verify.locate.find_plan`. The template renders the frontmatter from `PlanContext.slug/requirements/files_expected` (`generator.requirements_from_answers`: acceptance answer split on `;`/newlines; `files_from_answers`: existing paths only).
41
41
  - `verify/` (`kingmadoc verify <slug> [--run-checks]`): `locate.find_plan` (bad slug / missing plan → `VerificationError`) → `changes.detect_changes` (git; base = parent of the commit that added the plan, else last commit before **Generated** + 59 s; working tree incl. untracked; the plan's folder ignored) → `deviations.find_deviations` (pure: draft plan with code = process, `files_expected` untouched / changes outside, `REQ-n` not mentioned in tests or commit messages, containers vs `planned_containers` from the plan text; the CLI passes `infer_containers` names since verify may not import plan) → `commands.detect_commands` (config `verify:` > Makefile > npm > cargo > go > dotnet > pytest/ruff) and `run_check` (no shell; only with `--run-checks`, never enabled by the repo's config) → `report.render_verify` + `verify_status`; the plan's status becomes `implemented`/`partial` unless draft or not verified (written together, `write_documents`). Modes may not import each other (E5, auto-checked), so shared I/O lives in `documents.py`.
42
42
  - `diagrams/`: backend pattern, selected by `diagram_format` (`mermaid` default, `plantuml`, `d2`) via `diagrams.get_backend`. `base.py` has the `DiagramBackend` Protocol (`render_context/container/component/sequence/class`) and the shared pure model: `build_*` validate input, assign unique aliases and resolve relationships into frozen `Diagram`/`Node`/`Edge`. Backend modules (`mermaid.py`, `plantuml.py`, `d2.py`) only format that model and return a fenced block (templates must not add fences). Escaping differs per backend and is verified against the real tools: Mermaid `"`→`#quot;` (C4 titles drop `#`/`;`), PlantUML `"`→`<U+0022>`, D2 escapes `\`, `"`, `$`. Adding a backend: a module, an entry in `diagrams.BACKENDS` and `config.DIAGRAM_FORMATS`, snapshots via `KINGMADOC_UPDATE_SNAPSHOTS=1 pytest tests/test_diagram_backends.py`. Extra-doc templates pick their ER/flowchart placeholder by `diagram_format`. No knowledge of analysis: `generator.build_plan_context` maps analysis → C4 elements.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: kingmadoc
3
- Version: 0.2.0
3
+ Version: 0.3.0.dev8
4
4
  Summary: Feature docs for AI coding agents: a plan with C4 diagrams before the code, a verification doc after.
5
5
  Project-URL: Homepage, https://github.com/ATkingma/KingmaDoc
6
6
  Project-URL: Issues, https://github.com/ATkingma/KingmaDoc/issues
@@ -75,16 +75,25 @@ for Claude Code, Cursor, Codex or GitHub Copilot.
75
75
  Requires Python 3.11+.
76
76
 
77
77
  ```bash
78
- pipx install git+https://github.com/ATkingma/KingmaDoc
78
+ pipx install kingmadoc # from PyPI
79
+ pipx upgrade kingmadoc # later: update to the newest release
79
80
  ```
80
81
 
81
- Once KingmaDoc is published on PyPI, this becomes `pipx install kingmadoc`, and
82
- `pipx upgrade kingmadoc` updates it.
82
+ **Beta:** every commit on `main` that passes CI is published as a development version
83
+ (e.g. `0.3.0.dev12`). Plain installs ignore it; to follow the beta:
83
84
 
84
- To update a git install to the latest commit, run `pipx reinstall kingmadoc`;
85
- `kingmadoc --version` then shows the new version and commit (every commit has a higher
86
- version, e.g. `0.2.0.dev43 (git 1a2b3c4)`). (`pipx install --force` fails on recent pipx
87
- versions with "Failed to create virtual environment" and keeps the old version.)
85
+ ```bash
86
+ pipx install --pip-args=--pre kingmadoc # once (pipx remembers --pre)
87
+ pipx upgrade kingmadoc # later: the newest beta
88
+ ```
89
+
90
+ For the latest commit instead of a release, install from GitHub with
91
+ `pipx install git+https://github.com/ATkingma/KingmaDoc` and update it with
92
+ `pipx reinstall kingmadoc`; `kingmadoc --version` then shows the commit
93
+ (`0.2.1.dev3 (git 1a2b3c4)`). (`pipx install --force` fails on recent pipx versions with
94
+ "Failed to create virtual environment" and keeps the old version.) An install from
95
+ before 0.2.0 came from GitHub: `pipx uninstall kingmadoc && pipx install kingmadoc`
96
+ switches it to the releases.
88
97
 
89
98
  Then, in your project, install the agent skills; that's all:
90
99
 
@@ -98,15 +107,17 @@ them are updated; files you edited are kept (`--force` replaces them too).
98
107
 
99
108
  Nothing else to install: the first `kingmadoc render` downloads the D2 diagram renderer by
100
109
  itself (pinned version, checksum-verified; `KINGMADOC_D2_DOWNLOAD=0` turns that off).
101
- `kingmadoc skills install --vscode` also makes VS Code open explainers (`docs/explain/`)
102
- as a rendered preview, so you see the pictures right away (it adds one setting to
103
- `.vscode/settings.json`, only when you pass `--vscode`; Visual Studio shows a preview by
104
- default).
110
+ VS Code opens a `.md` file as text, which shows no pictures. `kingmadoc skills install`
111
+ asks whether VS Code should open explainers (`docs/explain/`) as a rendered preview
112
+ instead, so you see the pictures right away (one setting in `.vscode/settings.json`;
113
+ `--vscode` / `--no-vscode` answer up front). Without it, press Ctrl+Shift+V in an
114
+ explainer. Visual Studio shows a preview by default. The pictures follow VS Code's light
115
+ or dark theme.
105
116
 
106
117
  ### pip
107
118
 
108
119
  ```bash
109
- pip install git+https://github.com/ATkingma/KingmaDoc # into the current environment
120
+ pip install kingmadoc # into the current environment
110
121
  ```
111
122
 
112
123
  ### Markdown-only (no Python)
@@ -21,16 +21,25 @@ for Claude Code, Cursor, Codex or GitHub Copilot.
21
21
  Requires Python 3.11+.
22
22
 
23
23
  ```bash
24
- pipx install git+https://github.com/ATkingma/KingmaDoc
24
+ pipx install kingmadoc # from PyPI
25
+ pipx upgrade kingmadoc # later: update to the newest release
25
26
  ```
26
27
 
27
- Once KingmaDoc is published on PyPI, this becomes `pipx install kingmadoc`, and
28
- `pipx upgrade kingmadoc` updates it.
28
+ **Beta:** every commit on `main` that passes CI is published as a development version
29
+ (e.g. `0.3.0.dev12`). Plain installs ignore it; to follow the beta:
29
30
 
30
- To update a git install to the latest commit, run `pipx reinstall kingmadoc`;
31
- `kingmadoc --version` then shows the new version and commit (every commit has a higher
32
- version, e.g. `0.2.0.dev43 (git 1a2b3c4)`). (`pipx install --force` fails on recent pipx
33
- versions with "Failed to create virtual environment" and keeps the old version.)
31
+ ```bash
32
+ pipx install --pip-args=--pre kingmadoc # once (pipx remembers --pre)
33
+ pipx upgrade kingmadoc # later: the newest beta
34
+ ```
35
+
36
+ For the latest commit instead of a release, install from GitHub with
37
+ `pipx install git+https://github.com/ATkingma/KingmaDoc` and update it with
38
+ `pipx reinstall kingmadoc`; `kingmadoc --version` then shows the commit
39
+ (`0.2.1.dev3 (git 1a2b3c4)`). (`pipx install --force` fails on recent pipx versions with
40
+ "Failed to create virtual environment" and keeps the old version.) An install from
41
+ before 0.2.0 came from GitHub: `pipx uninstall kingmadoc && pipx install kingmadoc`
42
+ switches it to the releases.
34
43
 
35
44
  Then, in your project, install the agent skills; that's all:
36
45
 
@@ -44,15 +53,17 @@ them are updated; files you edited are kept (`--force` replaces them too).
44
53
 
45
54
  Nothing else to install: the first `kingmadoc render` downloads the D2 diagram renderer by
46
55
  itself (pinned version, checksum-verified; `KINGMADOC_D2_DOWNLOAD=0` turns that off).
47
- `kingmadoc skills install --vscode` also makes VS Code open explainers (`docs/explain/`)
48
- as a rendered preview, so you see the pictures right away (it adds one setting to
49
- `.vscode/settings.json`, only when you pass `--vscode`; Visual Studio shows a preview by
50
- default).
56
+ VS Code opens a `.md` file as text, which shows no pictures. `kingmadoc skills install`
57
+ asks whether VS Code should open explainers (`docs/explain/`) as a rendered preview
58
+ instead, so you see the pictures right away (one setting in `.vscode/settings.json`;
59
+ `--vscode` / `--no-vscode` answer up front). Without it, press Ctrl+Shift+V in an
60
+ explainer. Visual Studio shows a preview by default. The pictures follow VS Code's light
61
+ or dark theme.
51
62
 
52
63
  ### pip
53
64
 
54
65
  ```bash
55
- pip install git+https://github.com/ATkingma/KingmaDoc # into the current environment
66
+ pip install kingmadoc # into the current environment
56
67
  ```
57
68
 
58
69
  ### Markdown-only (no Python)
@@ -20,6 +20,15 @@ git has a higher version than the one before. Never set the version by hand.
20
20
  is the tag, installs the wheel and runs it (plan, skills install), publishes to PyPI,
21
21
  and creates the GitHub release with the changelog section and the built files.
22
22
 
23
+ ## Beta channel
24
+
25
+ `release.yml` also runs after every successful CI run on `main` and publishes that
26
+ commit's development version (`0.3.0.devN`) to PyPI with the same trusted publisher;
27
+ it creates no GitHub release. pip installs development versions only with `--pre`, so
28
+ `pipx install kingmadoc` keeps getting releases, and
29
+ `pipx install --pip-args=--pre kingmadoc` follows the beta. A re-run of the same commit
30
+ skips the upload (`skip-existing`). Pull requests never publish.
31
+
23
32
  ## Supply chain
24
33
 
25
34
  - `uv.lock` pins the development dependencies; CI fails when it is out of date
@@ -23,9 +23,9 @@ every problem in the [results table](#results) at the end.
23
23
  - [ ] Install the CLI (Python 3.11+) and check the version:
24
24
 
25
25
  ```bash
26
- pipx install git+https://github.com/ATkingma/KingmaDoc # first time
27
- pipx reinstall kingmadoc # update to the latest commit
28
- kingmadoc --version # shows the installed commit
26
+ pipx install kingmadoc # first time (a release from PyPI)
27
+ pipx upgrade kingmadoc # update to the newest release
28
+ kingmadoc --version # shows the version (and the commit for a git install)
29
29
  ```
30
30
 
31
31
  Do not update with `pipx install --force`: recent pipx versions (uv backend) fail with
@@ -0,0 +1,95 @@
1
+ {
2
+ "agent": "claude -p {request} --output-format json --max-turns 80 --allowedTools 'Read,Write,Edit,Glob,Grep,Skill,Bash(kingmadoc:*),Bash(git log:*),Bash(git diff:*),Bash(git status:*),Bash(git show:*),Bash(git branch:*),Bash(git rev-parse:*),Bash(ls:*)'",
3
+ "results": [
4
+ {
5
+ "scenario": "explain-feature",
6
+ "variant": "with skill",
7
+ "agent": {
8
+ "exit_code": 0,
9
+ "seconds": 94,
10
+ "total_cost_usd": 0.6629856000000001,
11
+ "num_turns": 12,
12
+ "reply": "aren't caught.\n5. Paying is a separate call, `POST /orders/<id>/pay/`. It only changes the status from `new` to `paid` and doesn't contact any payment provider. It only finds the customer's own orders, and paying an order that isn't `new` returns 409.\n6. The `shipped` status exists, but no code ever sets it.\n\n**Couldn't work out:** how users log in. There's no login route, and `settings.py` sets no `MIDDLEWARE`, so it's unclear where `request.user` comes from. If you tell me the intended setup, I'll add it to the explainer.\n\nTo see the diagrams in VS Code, open the file and press Ctrl+Shift+V."
13
+ },
14
+ "checks": [
15
+ {
16
+ "check": "exists docs/explain/0001-*/README.md",
17
+ "ok": true,
18
+ "detail": "docs/explain/0001-placing-an-order/README.md"
19
+ },
20
+ {
21
+ "check": "exists docs/explain/README.md",
22
+ "ok": true,
23
+ "detail": "docs/explain/README.md"
24
+ },
25
+ {
26
+ "check": "contains docs/explain/0001-*/README.md",
27
+ "ok": true,
28
+ "detail": "all present"
29
+ },
30
+ {
31
+ "check": "pictures_only docs/explain/0001-*/*.md",
32
+ "ok": true,
33
+ "detail": "6 images"
34
+ },
35
+ {
36
+ "check": "max_questions docs/explain/0001-*/README.md",
37
+ "ok": true,
38
+ "detail": "1 question(s)"
39
+ },
40
+ {
41
+ "check": "unchanged_outside [docs/, .claude/]",
42
+ "ok": true,
43
+ "detail": "14 change(s), all allowed"
44
+ }
45
+ ],
46
+ "passed": 6,
47
+ "total": 6
48
+ },
49
+ {
50
+ "scenario": "explain-feature",
51
+ "variant": "with skill",
52
+ "agent": {
53
+ "exit_code": 0,
54
+ "seconds": 93,
55
+ "total_cost_usd": 0.6364946500000002,
56
+ "num_turns": 12,
57
+ "reply": " the status from `new` to `paid`. If the order isn't `new`, the caller gets 409. No payment provider is involved.\n\nStock is taken off when the order is placed, not when it's paid.\n\n**Things the code doesn't explain** (listed at the end of the explainer; tell me the answers and I'll add them):\n- **How do users log in?** `@login_required` needs session and authentication middleware, but `shop/settings.py` sets no `MIDDLEWARE` and there's no login route.\n- **What sets `shipped`, and what creates `Customer` rows?** No code does either.\n\nIn VS Code, Ctrl+Shift+V opens the preview with the pictures."
58
+ },
59
+ "checks": [
60
+ {
61
+ "check": "exists docs/explain/0001-*/README.md",
62
+ "ok": true,
63
+ "detail": "docs/explain/0001-placing-an-order/README.md"
64
+ },
65
+ {
66
+ "check": "exists docs/explain/README.md",
67
+ "ok": true,
68
+ "detail": "docs/explain/README.md"
69
+ },
70
+ {
71
+ "check": "contains docs/explain/0001-*/README.md",
72
+ "ok": true,
73
+ "detail": "all present"
74
+ },
75
+ {
76
+ "check": "pictures_only docs/explain/0001-*/*.md",
77
+ "ok": true,
78
+ "detail": "6 images"
79
+ },
80
+ {
81
+ "check": "max_questions docs/explain/0001-*/README.md",
82
+ "ok": true,
83
+ "detail": "2 question(s)"
84
+ },
85
+ {
86
+ "check": "unchanged_outside [docs/, .claude/]",
87
+ "ok": true,
88
+ "detail": "14 change(s), all allowed"
89
+ }
90
+ ],
91
+ "passed": 6,
92
+ "total": 6
93
+ }
94
+ ]
95
+ }
@@ -195,8 +195,8 @@ def prepare_workspace(scenario: dict[str, Any], target: Path, with_skills: bool)
195
195
  _git(target, "commit", "-qm", f"Work on {branch['name']}")
196
196
  if with_skills:
197
197
  subprocess.run(
198
- [_kingmadoc(), "skills", "install", "--root", str(target)],
199
- check=True, capture_output=True,
198
+ [_kingmadoc(), "skills", "install", "--root", str(target), "--no-vscode"],
199
+ check=True, capture_output=True, stdin=subprocess.DEVNULL,
200
200
  )
201
201
  # The skills are part of the setup, not a change by the agent.
202
202
  _git(target, "add", ".")
@@ -130,7 +130,8 @@ the diagrams, but never beyond what the user said or the code shows.
130
130
  `<slug>-technical-design.md`
131
131
  ([format](reference/formats.md#technical-design-doc-docsfeaturesslug-technical-designmd)), in that
132
132
  order. Fill in only what the answers and code support; leave the rest as TODOs.
133
- 2. Show the paths and a three-line summary (scope, biggest risk, open questions count).
133
+ 2. Show the paths and a three-line summary (scope, biggest risk, open questions count);
134
+ do not paste the plan into the chat, and do not narrate while you work.
134
135
  3. Ask the user to reply **yes** (approve), **edit <changes>**, or **stop**. On
135
136
  **edit**, update the doc and ask again. On **yes**, run `kingmadoc approve <slug>`
136
137
  (with the CLI; otherwise set `status: approved` in the frontmatter and **Status** to
@@ -130,7 +130,8 @@ the diagrams, but never beyond what the user said or the code shows.
130
130
  `<slug>-technical-design.md`
131
131
  ([format](#technical-design-doc-docsfeaturesslug-technical-designmd)), in that
132
132
  order. Fill in only what the answers and code support; leave the rest as TODOs.
133
- 2. Show the paths and a three-line summary (scope, biggest risk, open questions count).
133
+ 2. Show the paths and a three-line summary (scope, biggest risk, open questions count);
134
+ do not paste the plan into the chat, and do not narrate while you work.
134
135
  3. Ask the user to reply **yes** (approve), **edit <changes>**, or **stop**. On
135
136
  **edit**, update the doc and ask again. On **yes**, run `kingmadoc approve <slug>`
136
137
  (with the CLI; otherwise set `status: approved` in the frontmatter and **Status** to
@@ -130,7 +130,8 @@ the diagrams, but never beyond what the user said or the code shows.
130
130
  `<slug>-technical-design.md`
131
131
  ([format](#technical-design-doc-docsfeaturesslug-technical-designmd)), in that
132
132
  order. Fill in only what the answers and code support; leave the rest as TODOs.
133
- 2. Show the paths and a three-line summary (scope, biggest risk, open questions count).
133
+ 2. Show the paths and a three-line summary (scope, biggest risk, open questions count);
134
+ do not paste the plan into the chat, and do not narrate while you work.
134
135
  3. Ask the user to reply **yes** (approve), **edit <changes>**, or **stop**. On
135
136
  **edit**, update the doc and ask again. On **yes**, run `kingmadoc approve <slug>`
136
137
  (with the CLI; otherwise set `status: approved` in the frontmatter and **Status** to
@@ -131,7 +131,8 @@ the diagrams, but never beyond what the user said or the code shows.
131
131
  `<slug>-technical-design.md`
132
132
  ([format](#technical-design-doc-docsfeaturesslug-technical-designmd)), in that
133
133
  order. Fill in only what the answers and code support; leave the rest as TODOs.
134
- 2. Show the paths and a three-line summary (scope, biggest risk, open questions count).
134
+ 2. Show the paths and a three-line summary (scope, biggest risk, open questions count);
135
+ do not paste the plan into the chat, and do not narrate while you work.
135
136
  3. Ask the user to reply **yes** (approve), **edit <changes>**, or **stop**. On
136
137
  **edit**, update the doc and ask again. On **yes**, run `kingmadoc approve <slug>`
137
138
  (with the CLI; otherwise set `status: approved` in the frontmatter and **Status** to
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: explaining-code
3
3
  description: "Explains existing code with rendered diagrams (C4 in Simon Brown's notation; UML sequence, state, class, activity, use case; ER; data flow) and short tables, as an arc42 or compact C4 document, one file or split into functional and technical. Fixes code blindness, e.g. after an agent wrote the code. Scope: a feature, a branch or PR, a whole project, or a folder, service or module. Use when the user asks to explain, describe, document, map, diagram, draw, visualise or give an overview of existing code or architecture; asks how something works, what it does, how the parts fit together, where something happens, or what a branch, PR, commit or task changed; wants onboarding, a walkthrough, a codebase tour, an architecture or design document, arc42, C4, UML, sequence, ER or deployment diagrams of existing code; or no longer understands the code. The request may be in any language. Not for features that are not built yet."
4
- version: 5.4.0
4
+ version: 5.7.0
5
5
  allowed-tools: [Read, Write, Glob, Grep, Bash]
6
6
  ---
7
7
 
@@ -54,6 +54,27 @@ Rules:
54
54
  - Never invent. If something essential cannot be worked out, ask at most three
55
55
  questions (Step 6).
56
56
 
57
+ ## Working efficiently
58
+
59
+ The context window is shared with the user's work; keep what you load and say small.
60
+
61
+ - **Work quietly.** No running commentary, no file contents, D2 sources or draft text in
62
+ the chat. Speak only to ask (Step 1, at most three questions in Step 6) or to hand
63
+ over (Step 6).
64
+ - **Load on demand.** Read the format file you write, and in
65
+ [reference/c4-model.md](reference/c4-model.md) and
66
+ [reference/models.md](reference/models.md) only the sections of the models you draw:
67
+ each reference starts with a table of contents.
68
+ - **Facts before files.** `kingmadoc explain facts --only <sections>` (e.g.
69
+ `routes,data`) gives just the part you need; read source files only for what the facts
70
+ cannot show.
71
+ - **Big codebase** (several services, or more than about 100 source files): let a
72
+ subagent read the code if your agent can run one (in Claude Code: the Explore agent),
73
+ and have it return a compact list of containers, components, flows and data with
74
+ their paths (about 1,500 tokens), not the files themselves.
75
+ - **Fix, don't rewrite.** When a diagram fails to render or needs a change, edit its
76
+ `img/*.d2` file and render again; do not re-read or rewrite the whole document.
77
+
57
78
  ## Step 1. Pin down the scope, the format and the documents
58
79
 
59
80
  Decide the scope (table above). If it is unclear what is meant, search first and ask one
@@ -92,7 +113,8 @@ kingmadoc explain facts --base main # a branch: plus its commits and changed
92
113
  ```
93
114
 
94
115
  Draw from them and never contradict them: the project references and module
95
- dependencies are the arrows between containers and components, the routes and access
116
+ dependencies are the arrows between containers and components, the private modules
117
+ (dominator tree: everything only one module leads to) are its components' boundaries, the routes and access
96
118
  table is the source for routes and permissions, the DI services name the components,
97
119
  the data model is the ER diagram's source, the changed files are what a branch explains. (No `explain` command: update KingmaDoc, see Step 5.)
98
120
 
@@ -138,6 +160,15 @@ Write every diagram in **D2** (Step 5 turns them into images).
138
160
  says: e.g. arc42 section 6 for flows and lifecycles, section 8 for data and domain.
139
161
  4. **Readable in dark mode:** the images follow the viewer's light or dark theme. Give
140
162
  every shape you fill (`fill:`) a `font-color` too, and black dots a grey `stroke`.
163
+ Never set a `font-color` without a fill (titles, labels: the theme picks the colour),
164
+ and never fill white: boundaries and nodes are `fill: transparent`. Put
165
+ `shape: sequence_diagram` at the top level, or give its container the label `""`.
166
+ 5. **Tidy arrows:** set `direction: down` (people on top, data stores at the bottom;
167
+ `right` only for timelines and swimlanes), draw one arrow per pair of shapes with a
168
+ combined label, keep at most 12 arrows per figure (split it otherwise, e.g. one
169
+ figure per container), label each arrow in at most six words plus `[protocol]`, and
170
+ point arrows at the shapes inside a boundary, not at the boundary. `kingmadoc render`
171
+ lays figures out with straight, right-angled arrows (ELK) and warns about crowded ones.
141
172
 
142
173
  For a **branch**, mark changes by border, so the C4 colours stay meaningful, and add
143
174
  both to the legend:
@@ -149,6 +180,7 @@ classes: {
149
180
  changed: {style: {stroke: "#ef6c00"; stroke-width: 4}}
150
181
  }
151
182
  title: "[Container] Webshop - branch feature/invoices" {shape: text; near: top-center; style: {font-size: 24; bold: true}}
183
+ direction: down
152
184
  vars: {
153
185
  d2-legend: {
154
186
  n: New in this branch {class: [container; new]}
@@ -197,7 +229,7 @@ on the PATH: `kingmadoc render` does not need it.
197
229
 
198
230
  - A diagram D2 rejects: fix it and run again.
199
231
  - `kingmadoc` has no `render` command: it is outdated; ask the user to update it with
200
- `pipx reinstall kingmadoc` (or `pip install -U kingmadoc`), then render.
232
+ `pipx upgrade kingmadoc` (installed from GitHub: `pipx reinstall kingmadoc`), then render.
201
233
  - `kingmadoc` is not installed at all: render with `d2` if it happens to be available
202
234
  (save each diagram as `img/figure-<n>.d2` in the subject's folder, run
203
235
  `d2 --pad 20 <that>.d2 <that>.svg`, and replace the block with
@@ -208,7 +240,13 @@ on the PATH: `kingmadoc render` does not need it.
208
240
 
209
241
  Go through the checklist of each figure's model (end of
210
242
  [reference/c4-model.md](reference/c4-model.md) and [reference/models.md](reference/models.md))
211
- and fix what fails. Then show the path, the one-paragraph summary and the figures (check the document embeds the
212
- images). Ask the "Couldn't work out" questions, at most three, and update the explainer
213
- with the answers. In VS Code, mention that `kingmadoc skills install --vscode` makes
214
- explainers open as a rendered preview; do not run it without the user's consent.
243
+ and fix what fails; check that the document embeds every image. Then hand over in at most five lines:
244
+ the path, one or two sentences on what the system is, the number of figures, and the
245
+ "Couldn't work out" questions (at most three), which you then answer into the explainer.
246
+ Do not paste the explainer or its figures into the chat.
247
+
248
+ VS Code shows the pictures only in its Markdown preview. If `.vscode/settings.json` does
249
+ not yet open `docs/explain/` as a preview, Ask once: "Should VS Code open explainers
250
+ directly as a preview, with the pictures?" and, on yes, run
251
+ `kingmadoc skills install --vscode` (it adds one setting). Never run it without that yes;
252
+ without it, mention that Ctrl+Shift+V shows the pictures.
@@ -1,5 +1,11 @@
1
1
  # Format: arc42 (default)
2
2
 
3
+ Contents: Output format · What changed (branch only) · 1. Introduction and goals · 2.
4
+ Constraints · 3. Context and scope · 4. Solution strategy · 5. Building block view · 6.
5
+ Runtime view · 7. Deployment view · 8. Cross-cutting concepts · 9. Architecture
6
+ decisions · 10. Quality requirements · 11. Risks and technical debt · 12. Glossary ·
7
+ Appendix: where to find what · Couldn't work out (optional, at most three).
8
+
3
9
  The default explainer format (`explain: {format: arc42}` in `.featuredoc.yml`): the
4
10
  twelve sections of the arc42 architecture template, each a figure or a table with a short
5
11
  explanation. Follow the rules in `../SKILL.md` (numbered figures, tables that decode
@@ -57,7 +63,7 @@ Text in `<angle brackets>` is filled in; leave out subsections marked optional.
57
63
  | **Scope** | <feature / branch `<branch>` vs `<base>` / project / part `<path>`> |
58
64
  | **Stack** | <languages, frameworks, data stores> |
59
65
  | **Entry points** | <`path`, …> |
60
- | **Based on** | <commit hash (branch)> · <ISO date> · KingmaDoc skill explaining-code 5.4.0 (arc42) |
66
+ | **Based on** | <commit hash (branch)> · <ISO date> · KingmaDoc skill explaining-code 5.7.0 (arc42) |
61
67
 
62
68
  ## What changed (branch only)
63
69