ad2v 0.7.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 (167) hide show
  1. ad2v-0.7.0/LICENSE +202 -0
  2. ad2v-0.7.0/PKG-INFO +312 -0
  3. ad2v-0.7.0/README.md +290 -0
  4. ad2v-0.7.0/pyproject.toml +68 -0
  5. ad2v-0.7.0/schema/ad2v-v0.7.sql +629 -0
  6. ad2v-0.7.0/schema/ir-v0.7.schema.json +710 -0
  7. ad2v-0.7.0/schema/themes/dark.json +134 -0
  8. ad2v-0.7.0/schema/themes/light.json +134 -0
  9. ad2v-0.7.0/setup.cfg +4 -0
  10. ad2v-0.7.0/setup.py +62 -0
  11. ad2v-0.7.0/src/ad2v/__init__.py +3 -0
  12. ad2v-0.7.0/src/ad2v/__main__.py +5 -0
  13. ad2v-0.7.0/src/ad2v/admin.py +160 -0
  14. ad2v-0.7.0/src/ad2v/api.py +299 -0
  15. ad2v-0.7.0/src/ad2v/bootstrap.py +321 -0
  16. ad2v-0.7.0/src/ad2v/c4.py +607 -0
  17. ad2v-0.7.0/src/ad2v/chat/__init__.py +1 -0
  18. ad2v-0.7.0/src/ad2v/chat/agent.py +517 -0
  19. ad2v-0.7.0/src/ad2v/chat/http.py +71 -0
  20. ad2v-0.7.0/src/ad2v/chat/schemas.py +98 -0
  21. ad2v-0.7.0/src/ad2v/cli.py +876 -0
  22. ad2v-0.7.0/src/ad2v/cli_init.py +68 -0
  23. ad2v-0.7.0/src/ad2v/cli_llm.py +308 -0
  24. ad2v-0.7.0/src/ad2v/cli_plugins.py +107 -0
  25. ad2v-0.7.0/src/ad2v/cli_specs.py +156 -0
  26. ad2v-0.7.0/src/ad2v/ddl.py +70 -0
  27. ad2v-0.7.0/src/ad2v/diff.py +345 -0
  28. ad2v-0.7.0/src/ad2v/dump.py +118 -0
  29. ad2v-0.7.0/src/ad2v/extract/__init__.py +1 -0
  30. ad2v-0.7.0/src/ad2v/extract/code/__init__.py +1 -0
  31. ad2v-0.7.0/src/ad2v/extract/code/base.py +153 -0
  32. ad2v-0.7.0/src/ad2v/extract/code/plugin.py +114 -0
  33. ad2v-0.7.0/src/ad2v/extract/code/python.py +2293 -0
  34. ad2v-0.7.0/src/ad2v/extract/code/python_local.py +321 -0
  35. ad2v-0.7.0/src/ad2v/extract/code/rules/python-frameworks.yaml +65 -0
  36. ad2v-0.7.0/src/ad2v/extract/code/rules/python.yaml +246 -0
  37. ad2v-0.7.0/src/ad2v/extract/code/schema_digest.py +347 -0
  38. ad2v-0.7.0/src/ad2v/extract/files.py +64 -0
  39. ad2v-0.7.0/src/ad2v/extract/spec/__init__.py +71 -0
  40. ad2v-0.7.0/src/ad2v/extract/spec/gherkin.py +146 -0
  41. ad2v-0.7.0/src/ad2v/extract/spec/markdown.py +201 -0
  42. ad2v-0.7.0/src/ad2v/extract/spec/openapi.py +131 -0
  43. ad2v-0.7.0/src/ad2v/extract/spec/presets.py +508 -0
  44. ad2v-0.7.0/src/ad2v/extract/spec/team.py +428 -0
  45. ad2v-0.7.0/src/ad2v/extract/spec/titles.py +157 -0
  46. ad2v-0.7.0/src/ad2v/gitsource.py +185 -0
  47. ad2v-0.7.0/src/ad2v/glyphs.py +147 -0
  48. ad2v-0.7.0/src/ad2v/history.py +305 -0
  49. ad2v-0.7.0/src/ad2v/ids.py +116 -0
  50. ad2v-0.7.0/src/ad2v/infra/__init__.py +190 -0
  51. ad2v-0.7.0/src/ad2v/infra/bridge.py +268 -0
  52. ad2v-0.7.0/src/ad2v/infra/envreads.py +170 -0
  53. ad2v-0.7.0/src/ad2v/infra/infra.yaml +150 -0
  54. ad2v-0.7.0/src/ad2v/infra/model.py +545 -0
  55. ad2v-0.7.0/src/ad2v/infra/plan.py +172 -0
  56. ad2v-0.7.0/src/ad2v/infra/static.py +271 -0
  57. ad2v-0.7.0/src/ad2v/init.py +686 -0
  58. ad2v-0.7.0/src/ad2v/ir.py +355 -0
  59. ad2v-0.7.0/src/ad2v/junit.py +133 -0
  60. ad2v-0.7.0/src/ad2v/layout.py +520 -0
  61. ad2v-0.7.0/src/ad2v/llm/__init__.py +6 -0
  62. ad2v-0.7.0/src/ad2v/llm/api.py +152 -0
  63. ad2v-0.7.0/src/ad2v/llm/config.py +145 -0
  64. ad2v-0.7.0/src/ad2v/llm/context.py +193 -0
  65. ad2v-0.7.0/src/ad2v/llm/evaluate.py +107 -0
  66. ad2v-0.7.0/src/ad2v/llm/fence.py +68 -0
  67. ad2v-0.7.0/src/ad2v/llm/judge.py +345 -0
  68. ad2v-0.7.0/src/ad2v/llm/narrate.py +221 -0
  69. ad2v-0.7.0/src/ad2v/llm/prompts/__init__.py +37 -0
  70. ad2v-0.7.0/src/ad2v/llm/prompts/chat.v1.md +35 -0
  71. ad2v-0.7.0/src/ad2v/llm/prompts/extract-prose.v1.md +28 -0
  72. ad2v-0.7.0/src/ad2v/llm/prompts/judge.v1.md +27 -0
  73. ad2v-0.7.0/src/ad2v/llm/prompts/narrate.v1.md +22 -0
  74. ad2v-0.7.0/src/ad2v/llm/prompts/suggest.v1.md +23 -0
  75. ad2v-0.7.0/src/ad2v/llm/prompts/summarize.v1.md +20 -0
  76. ad2v-0.7.0/src/ad2v/llm/prose.py +220 -0
  77. ad2v-0.7.0/src/ad2v/llm/providers/__init__.py +19 -0
  78. ad2v-0.7.0/src/ad2v/llm/providers/base.py +136 -0
  79. ad2v-0.7.0/src/ad2v/llm/providers/fake.py +139 -0
  80. ad2v-0.7.0/src/ad2v/llm/providers/openai_compatible.py +172 -0
  81. ad2v-0.7.0/src/ad2v/llm/providers/vertex.py +319 -0
  82. ad2v-0.7.0/src/ad2v/llm/runner.py +365 -0
  83. ad2v-0.7.0/src/ad2v/llm/suggest.py +453 -0
  84. ad2v-0.7.0/src/ad2v/llm/summarize.py +195 -0
  85. ad2v-0.7.0/src/ad2v/manifest.py +305 -0
  86. ad2v-0.7.0/src/ad2v/materialize.py +37 -0
  87. ad2v-0.7.0/src/ad2v/mcp/__init__.py +57 -0
  88. ad2v-0.7.0/src/ad2v/mcp/app_tools.py +167 -0
  89. ad2v-0.7.0/src/ad2v/mcp/blind.py +242 -0
  90. ad2v-0.7.0/src/ad2v/mcp/evaluate.py +273 -0
  91. ad2v-0.7.0/src/ad2v/mcp/files.py +143 -0
  92. ad2v-0.7.0/src/ad2v/mcp/http.py +218 -0
  93. ad2v-0.7.0/src/ad2v/mcp/index.py +240 -0
  94. ad2v-0.7.0/src/ad2v/mcp/locate.py +419 -0
  95. ad2v-0.7.0/src/ad2v/mcp/protocol.py +443 -0
  96. ad2v-0.7.0/src/ad2v/mcp/slices.py +583 -0
  97. ad2v-0.7.0/src/ad2v/mcp/stdio.py +77 -0
  98. ad2v-0.7.0/src/ad2v/mcp/tools.py +1329 -0
  99. ad2v-0.7.0/src/ad2v/pairing.py +554 -0
  100. ad2v-0.7.0/src/ad2v/pipeline.py +551 -0
  101. ad2v-0.7.0/src/ad2v/plugins.py +580 -0
  102. ad2v-0.7.0/src/ad2v/preview.py +238 -0
  103. ad2v-0.7.0/src/ad2v/resources.py +30 -0
  104. ad2v-0.7.0/src/ad2v/rules.py +70 -0
  105. ad2v-0.7.0/src/ad2v/scope.py +153 -0
  106. ad2v-0.7.0/src/ad2v/severity.py +62 -0
  107. ad2v-0.7.0/src/ad2v/specroots.py +158 -0
  108. ad2v-0.7.0/src/ad2v/store.py +882 -0
  109. ad2v-0.7.0/src/ad2v/testing/__init__.py +1 -0
  110. ad2v-0.7.0/src/ad2v/testing/conformance.py +321 -0
  111. ad2v-0.7.0/src/ad2v/tokens.py +139 -0
  112. ad2v-0.7.0/src/ad2v/unconfigured.py +138 -0
  113. ad2v-0.7.0/src/ad2v/upgrade.py +187 -0
  114. ad2v-0.7.0/src/ad2v/validate.py +425 -0
  115. ad2v-0.7.0/src/ad2v/view.py +232 -0
  116. ad2v-0.7.0/src/ad2v/workflows.py +219 -0
  117. ad2v-0.7.0/src/ad2v.egg-info/PKG-INFO +312 -0
  118. ad2v-0.7.0/src/ad2v.egg-info/SOURCES.txt +165 -0
  119. ad2v-0.7.0/src/ad2v.egg-info/dependency_links.txt +1 -0
  120. ad2v-0.7.0/src/ad2v.egg-info/entry_points.txt +8 -0
  121. ad2v-0.7.0/src/ad2v.egg-info/requires.txt +12 -0
  122. ad2v-0.7.0/src/ad2v.egg-info/top_level.txt +1 -0
  123. ad2v-0.7.0/tests/test_blind_eval.py +170 -0
  124. ad2v-0.7.0/tests/test_bootstrap.py +200 -0
  125. ad2v-0.7.0/tests/test_brownfield.py +317 -0
  126. ad2v-0.7.0/tests/test_chat.py +553 -0
  127. ad2v-0.7.0/tests/test_ci_workflows.py +74 -0
  128. ad2v-0.7.0/tests/test_determinism_and_cli.py +279 -0
  129. ad2v-0.7.0/tests/test_envreads.py +104 -0
  130. ad2v-0.7.0/tests/test_fixture_golden.py +163 -0
  131. ad2v-0.7.0/tests/test_glyphs.py +61 -0
  132. ad2v-0.7.0/tests/test_history.py +361 -0
  133. ad2v-0.7.0/tests/test_ids.py +74 -0
  134. ad2v-0.7.0/tests/test_infra.py +643 -0
  135. ad2v-0.7.0/tests/test_layout.py +198 -0
  136. ad2v-0.7.0/tests/test_license_gate.py +44 -0
  137. ad2v-0.7.0/tests/test_llm.py +965 -0
  138. ad2v-0.7.0/tests/test_mcp.py +802 -0
  139. ad2v-0.7.0/tests/test_p3_units.py +415 -0
  140. ad2v-0.7.0/tests/test_pairing.py +321 -0
  141. ad2v-0.7.0/tests/test_plugins.py +544 -0
  142. ad2v-0.7.0/tests/test_presets.py +144 -0
  143. ad2v-0.7.0/tests/test_python_extractor.py +572 -0
  144. ad2v-0.7.0/tests/test_quickstart.py +206 -0
  145. ad2v-0.7.0/tests/test_retrieval_v2.py +117 -0
  146. ad2v-0.7.0/tests/test_routes_p61.py +211 -0
  147. ad2v-0.7.0/tests/test_schema_digest_rollup.py +174 -0
  148. ad2v-0.7.0/tests/test_schema_doc.py +54 -0
  149. ad2v-0.7.0/tests/test_scope.py +206 -0
  150. ad2v-0.7.0/tests/test_security.py +154 -0
  151. ad2v-0.7.0/tests/test_settings_prefix.py +143 -0
  152. ad2v-0.7.0/tests/test_severity_rules_junit.py +154 -0
  153. ad2v-0.7.0/tests/test_spec_extractors.py +161 -0
  154. ad2v-0.7.0/tests/test_specroots.py +149 -0
  155. ad2v-0.7.0/tests/test_store.py +266 -0
  156. ad2v-0.7.0/tests/test_team_presets.py +176 -0
  157. ad2v-0.7.0/tests/test_thinking.py +50 -0
  158. ad2v-0.7.0/tests/test_tokens.py +156 -0
  159. ad2v-0.7.0/tests/test_unconfigured.py +78 -0
  160. ad2v-0.7.0/tests/test_upgrade.py +210 -0
  161. ad2v-0.7.0/tests/test_view.py +76 -0
  162. ad2v-0.7.0/tests/test_workflows.py +229 -0
  163. ad2v-0.7.0/viewer/app-dist/app.html +4019 -0
  164. ad2v-0.7.0/viewer/dist/assets/index-D4WqliyR.js +3930 -0
  165. ad2v-0.7.0/viewer/dist/assets/index-DAWUOgsD.css +1 -0
  166. ad2v-0.7.0/viewer/dist/assets/sql-wasm-DfANybxk.wasm +0 -0
  167. ad2v-0.7.0/viewer/dist/index.html +14 -0
ad2v-0.7.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [2026] [David Armando López Noria]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
ad2v-0.7.0/PKG-INFO ADDED
@@ -0,0 +1,312 @@
1
+ Metadata-Version: 2.4
2
+ Name: ad2v
3
+ Version: 0.7.0
4
+ Summary: agent development to viz: compare a repository against its SDD specs and emit one .ad2v SQLite file
5
+ Author: ad2v contributors
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: tree-sitter<0.27,>=0.26
11
+ Requires-Dist: tree-sitter-python==0.25.0
12
+ Requires-Dist: gherkin-official<43,>=42.0.1
13
+ Requires-Dist: pyyaml<7,>=6.0.2
14
+ Requires-Dist: jsonschema<5,>=4.23
15
+ Requires-Dist: python-hcl2==8.1.4
16
+ Requires-Dist: lark==1.3.1
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest>=8; extra == "dev"
19
+ Requires-Dist: pytest-cov>=5; extra == "dev"
20
+ Requires-Dist: ruff>=0.6; extra == "dev"
21
+ Dynamic: license-file
22
+
23
+ # ad2v: agent development to viz
24
+
25
+ **Comprehension debt** is what builds up when agents merge code faster than people can understand
26
+ it. ad2v compares a **repository** with its **SDD specs** (spec-driven development) and writes
27
+ **one SQLite file**, `*.ad2v`, that describes both sides as a single graph. The file also records
28
+ how the spec items and the code pair up. Readers of that file:
29
+
30
+ - a **viewer**: a zoomable isometric 2.5D map (like C4, with more levels) in dark and light themes.
31
+ Glyph shape = node kind. Line style = status: spec-only items are dotted, implemented solid,
32
+ verified glowing (dark) or haloed (light), drift carries a warning badge, orphan code is dashed,
33
+ and code in a language no active extractor reads is thin, dotted and hollow with a "∅" badge
34
+ (`not_evaluable`). A **Legend** button explains every status.
35
+ Workflows replay step by step with a detail slider that follows the zoom. An **Architecture** tab
36
+ shows a deterministic C4 view built from the code, the specs and the infrastructure (Terraform
37
+ plan JSON or `.tf`): which service runs which container, env vars the code reads that no
38
+ deployment provides, resources nobody uses, per environment.
39
+ - **any MCP host's model** (Claude, ChatGPT, VS Code, …) through `ad2v mcp`: read-only tools that
40
+ find components and explain them, with answers that point at node ids. Hosts with MCP Apps show
41
+ the map inline in the conversation.
42
+
43
+ Like mermaid.js, ad2v is an open **format** plus reference implementations. License: Apache-2.0.
44
+
45
+ Current version: **0.7.0** (the first release; not yet published on PyPI). Code is read by
46
+ **language extractors** and frameworks are recognized by **framework packs**, both plug-ins behind a
47
+ stable public API (`ad2v.api`, api 1.0, entry-point groups `ad2v.extractors` / `ad2v.frameworks`).
48
+ The built-in Python extractor and Python framework pack use the same API; third-party plug-ins are
49
+ opt-in ([plug-in guide](docs/plugins.md)).
50
+
51
+ ## Status of the series
52
+
53
+ | phase | scope | status |
54
+ |---|---|---|
55
+ | P1 | format spec v0.1, SQLite schema, IR, deterministic extractors (Python code, Gherkin / OpenAPI / Markdown specs), static workflows, canonical dump | done ([report](docs/reports/P1.md)) |
56
+ | P2 | spec↔code pairing, single-epoch statuses, structural drift, roll-ups, risk severity, visual tokens (light + dark), format v0.2 | done ([report](docs/reports/P2.md)) |
57
+ | P3 | content-addressed multi-epoch storage, parse cache, git history, epoch diff, lineage, `stale`, entry-point recognizers, orphan policy, format v0.3 | done ([report](docs/reports/P3.md)) |
58
+ | P4 | bring-your-own-model LLM layer (informative only): semantic judge, link suggestions, summaries, narrations, prose-spec extraction, evaluation; format v0.4 | done ([report](docs/reports/P4.md)) |
59
+ | P5 | three.js viewer: deterministic layout, LOD map, status styling, replay, epoch diff; `ad2v view` | done ([report](docs/reports/P5.md), [demo](docs/reports/P5-demo.html)) |
60
+ | P6 | MCP server (stdlib, protocol 2026-07-28) + the map as an MCP App; deterministic retrieval | done ([report](docs/reports/P6.md), [setup](docs/mcp.md)) |
61
+ | P6.1 | real-repo readiness: route recall (factories, `add_api_route`, Starlette, Flask), spec discovery, spec-kit / Kiro / custom presets, `ad2v specs` bootstrap, replay camera, opaque "dim the rest" | done ([report](docs/reports/P6.1.md)) |
62
+ | P7 | verified quickstart, settings prefixes, retrieval v2, the viewer's own chat agent (BYOM, `ad2v view --chat`), thinking per task, schema digests, judge roll-up, viewer UX v2, format v0.5 | done ([report](docs/reports/P7.md), [quickstart](docs/quickstart.md)) |
63
+ | P8 | extractor plug-in API (`ad2v.api`, entry points, opt-in, conformance kit, out-of-tree examples), blind retrieval eval harness, packaging (not published), CI workflows, security review, sanitization, dogfood procedure | done ([report](docs/reports/P8.md), [plug-ins](docs/plugins.md), [security](docs/security.md)) |
64
+ | P8.1 | `not_evaluable`: a status and legend for code in a language no active extractor reads; format v0.6 | done ([report](docs/reports/P8.md) §13, ADR-0066) |
65
+ | P9 | brownfield onboarding: `ad2v init`, Spanish and English team formats (requirement tables, user stories, Spanish EARS and Gherkin), titles, non-functional requirements, issue 95, the spec side of the map, wider default excludes, fresh-clone install fix | done ([report](docs/reports/P9.md), ADR-0067..0072) |
66
+ | **P10** | infrastructure layer: Terraform plan JSON (primary) and static `.tf` (python-hcl2), secrets allowlist, the env-var bridge (deploys / wired / unwired / orphan, per environment), a deterministic C4 view (Architecture tab, Structurizr export, `ad2v_architecture`), zero-config warning, test-name prefixes from the specs; format v0.7 | **done** ([report](REPORT.md), [infra](docs/infra.md), ADR-0073..0081) |
67
+
68
+ Extraction makes **no LLM calls**. Every row it writes is *normative* (or *volatile*: deterministic
69
+ line numbers): the same inputs (code, specs, rules, manifest, test results) give the same normative
70
+ dump on any platform. The optional LLM layer (`ad2v llm`) writes only *informative* rows with full
71
+ provenance, never touches an epoch id, and a model can only *suggest*: a human confirms by editing
72
+ committed files (`ad2v.yaml`, spec files).
73
+
74
+ ## Quickstart
75
+
76
+ Requires Python ≥ 3.11. `uv` works too (`uv sync --extra dev`).
77
+
78
+ ```bash
79
+ python -m venv .venv
80
+ ```
81
+
82
+ ```bash
83
+ .venv/Scripts/python -m pip install -e ".[dev]"
84
+ ```
85
+
86
+ (On macOS/Linux, use `.venv/bin/python`.) Then extract the bundled fixture, with its test results:
87
+
88
+ ```bash
89
+ ad2v extract --repo fixtures/payments-recon --spec fixtures/payments-recon/specs --test-results fixtures/payments-recon/test-results/junit.xml --out recon.ad2v
90
+ ```
91
+
92
+ ```bash
93
+ ad2v status recon.ad2v --side spec
94
+ ```
95
+
96
+ To follow a repository over time, extract git history into one file (one epoch per commit whose
97
+ inputs changed) and compare epochs:
98
+
99
+ ```bash
100
+ ad2v history --repo . --spec specs --commits HEAD~20..HEAD --into project.ad2v
101
+ ```
102
+
103
+ ```bash
104
+ ad2v diff project.ad2v --from parent --to head --format md
105
+ ```
106
+
107
+ Open the map in a browser. The server binds 127.0.0.1 only and never writes the file:
108
+
109
+ ```bash
110
+ ad2v view recon.ad2v
111
+ ```
112
+
113
+ To browse history in the viewer, materialize the epochs you want to see first:
114
+
115
+ ```bash
116
+ ad2v materialize project.ad2v --epochs last:5
117
+ ```
118
+
119
+ A self-contained demo (the fixture's 8-epoch history, with demo LLM rows from the offline `fake`
120
+ provider) opens from disk: [`docs/reports/P5-demo.html`](docs/reports/P5-demo.html).
121
+
122
+ Ask about the map from Claude (or any MCP host). Add this server to the host's configuration; see
123
+ [docs/mcp.md](docs/mcp.md) for Claude Desktop, Claude Code and VS Code:
124
+
125
+ ```bash
126
+ python -m ad2v mcp --root path/to/maps
127
+ ```
128
+
129
+ ## CLI
130
+
131
+ ```text
132
+ ad2v init --repo <path> [--write <file> [--force]] [--format yaml|json] [--check <ad2v.yaml>] # propose a manifest
133
+ ad2v extract --repo <path> [--spec <path> ...] [--no-spec-autodetect] [--manifest ad2v.yaml] [--test-results junit.xml ...]
134
+ (--out project.ad2v | --into project.ad2v) [--no-cache] [--infra-plan [ENV=]plan.json ...] [--infra-env NAME]
135
+ ad2v c4 project.ad2v [--env NAME] [--format structurizr|json] [--out FILE] # the C4 view (P10)
136
+ ad2v history --repo <path> --commits <rev-range> --into project.ad2v [--spec <rel> ...] [--manifest <rel>]
137
+ [--test-results <rel> ...] [--no-cache]
138
+ ad2v diff project.ad2v [--from <epoch>] [--to <epoch>] [--format table|json|md]
139
+ ad2v log project.ad2v [--format table|json]
140
+ ad2v pin project.ad2v <epoch> [--label v1.2] ad2v unpin project.ad2v <epoch>
141
+ ad2v prune project.ad2v --keep-last N [--keep-pinned]
142
+ ad2v materialize project.ad2v (--epoch <epoch> | --epochs last:N) # last N + pinned
143
+ ad2v layout project.ad2v [--algorithm nestgrid-v1|nestgrid-v2] # v2: experimental shelf packing
144
+ ad2v view project.ad2v [--port 0] [--no-browser]
145
+ [--chat --manifest ad2v.yaml [--chat-budget-usd 0.25]] # chat with your own model
146
+ ad2v mcp (--file project.ad2v | --root <dir>) [--http [--port N]] [--no-warm] # MCP server, read-only
147
+ ad2v status project.ad2v [--epoch <epoch>] [--side spec|code] [--status stale] [--all] [--format table|json]
148
+ ad2v inspect project.ad2v [--epoch <epoch>] [--node <id|qualified_name>] [--kind loop] [--top-risk N]
149
+ ad2v dump project.ad2v [--epoch <id|head|all>] [--normative-only] [--out project.jsonl]
150
+ ad2v validate project.ad2v [--epoch <epoch>]
151
+ ad2v preview-tokens --out tokens.html
152
+ ```
153
+
154
+ Without `--spec`, specs are found from `spec_root` in ad2v.yaml, else auto-detected (`specs/`,
155
+ `spec/`, `docs/specs/`, `.kiro/specs/`, `sdd/`, `docs/sdd/`, a root `openapi.yaml`); `extract`
156
+ prints what it used. Markdown specs may follow the ad2v convention, spec-kit, Kiro, a
157
+ requirements table, user stories (Spanish or English), or your own regexes
158
+ ([convention §2, §6–7](docs/spec/spec-markdown-convention.md)).
159
+
160
+ **Existing project?** `ad2v init --repo <path>` reads the repository and runs nothing. It
161
+ proposes an `ad2v.yaml`: spec folders, containers and their languages, test-name prefixes,
162
+ non-functional prefixes, and route prefixes left empty for you to fill in. It writes only with
163
+ `--write` ([quickstart §2b](docs/quickstart.md)).
164
+
165
+ An `<epoch>` is an epoch id, `head`, `parent`, a pin label, or a commit SHA prefix (≥ 7 chars).
166
+
167
+ LLM layer (bring your own model; `fake` for offline use, `vertex`, or any OpenAI-compatible server):
168
+
169
+ ```text
170
+ ad2v llm plan project.ad2v [--manifest ad2v.yaml] [--tasks judge,suggest,summarize,narrate,extract-prose]
171
+ [--epoch head|all] [--count-tokens]
172
+ ad2v llm run project.ad2v --max-cost-usd 0.50 --yes [--manifest ad2v.yaml] [--tasks ...] [--no-llm-cache]
173
+ [--spec-root specs] [--mode call_depth --workflow <id>]
174
+ ad2v llm eval project.ad2v --expected expected-judgments.yaml
175
+ ad2v llm show-prose project.ad2v
176
+ ad2v suggestions list|accept|reject project.ad2v [<id> --manifest ad2v.yaml]
177
+ ad2v specs bootstrap --from docs/ [--plan | --yes --max-cost-usd 0.50] [--manifest ad2v.yaml]
178
+ ad2v specs review # proposals: source, model, overlap, staleness, id clashes
179
+ ad2v specs approve <proposal> [--to specs/sub] [--force-stale]
180
+ ```
181
+
182
+ - `plan` lists the calls still needed after cache hits, with token and USD estimates; `run` refuses
183
+ to start without a budget and `--yes`, and stops before exceeding it. Results are cached by the
184
+ exact input, so re-running is free.
185
+ - The judge's verdicts appear in `node_status_effective` (an LLM `drift` can only upgrade
186
+ implemented/verified; nothing the model says can clear a problem). `suggestions accept` appends
187
+ the pair to `pairing.links` in ad2v.yaml; the next extract makes it a normative `manifest_link`.
188
+ - Prose-spec extraction writes a proposal to `specs/.ad2v-extracted/`; moving it into the spec tree
189
+ is the approval.
190
+ - Repository content is sent to the model as fenced, untrusted data; outputs are strict JSON checked
191
+ deterministically (cited lines must exist, echoed injections are rejected).
192
+
193
+ - `extract --out` writes a fresh single-epoch file; `--into` appends a new head epoch, reusing the
194
+ file's parse cache (the summary shows the hit rate), or reports "no changes" when no input changed.
195
+ - `history` exports each commit with `git archive` (never checks out, never runs code) and appends
196
+ one epoch per commit.
197
+ - `diff` reports added/removed/renamed nodes (renames follow lineage), status transitions
198
+ (including `stale`), risk changes, spec changes and workflow changes. `--format md` fits a PR
199
+ comment (≤ 60 lines); see [`examples/github-action/ad2v-diff.yml`](examples/github-action/ad2v-diff.yml).
200
+ - `status` lists effective statuses (`drift`, `needs_review`, `missing`, `orphan`, `stale`,
201
+ `verified`, `implemented`, `not_evaluable`, `specified`) with their reasons. `not_evaluable`
202
+ (format v0.6): specified and built in a language no active extractor reads (TypeScript, Java, Go,
203
+ …); annotate such code with `// ad2v: REQ-001` comments so the pairing still shows. `extract`
204
+ prints which languages were not read.
205
+ - `prune` keeps the last N epochs (and pinned ones), garbage-collects and vacuums.
206
+ - `dump --normative-only` is the determinism contract: sorted JSONL, UTF-8, LF on every OS.
207
+ - `validate` checks the format version (0.4 to 0.6), schema objects (no triggers, no foreign
208
+ tables or views), text sizes and JSON depth, foreign keys and node references, version keys, the
209
+ epoch chain, glyph and status coverage, the IR JSON Schema, and that ids, link ids, Merkle hashes
210
+ and roll-ups recompute.
211
+ - `view` serves the built viewer on 127.0.0.1 (GET/HEAD only, strict CSP). The viewer is
212
+ read-only and never calls an LLM. Actions that change state are shown as CLI commands to copy.
213
+ It shows materialized epochs only. `extract` and `materialize` also write the deterministic
214
+ layout (`nestgrid-v1`, format spec §12), which keeps boxes in place across epochs.
215
+ - `extractors list` shows the installed extractor and framework-pack plug-ins (built-in, enabled,
216
+ disabled); `extractor check <name> --fixture <dir>` runs the conformance kit. `extract` and
217
+ `history` print each active plug-in with its version and rules hash; `--extractor <name>` enables
218
+ an installed third-party plug-in for one run (or list it in `ad2v.yaml` under
219
+ `extractors.enabled`), `--strict` makes a failing plug-in fatal.
220
+ - `eval blind` scores a private retrieval question set (path in `AD2V_BLIND_EVAL`) and prints
221
+ aggregates only ([blind eval](docs/blind-eval.md)).
222
+ - `preview-tokens` writes one self-contained HTML page: every glyph × every status, dark and light
223
+ (see [`docs/reports/P2-tokens.html`](docs/reports/P2-tokens.html)).
224
+
225
+ The extractor only **reads** the repository and ingests test-result files. It never imports or runs
226
+ repository code or tests.
227
+
228
+ ## Documents
229
+
230
+ - [Format spec v0.7](docs/spec/ad2v-format-v0.7.md) (normative: the product; §11 the LLM layer, §12 layout and viewer, §13 MCP, retrieval and chat, §14 the infra layer)
231
+ - [Glyph grammar v0.2](docs/spec/glyph-grammar-v0.2.md) and [visual tokens v0.2](docs/spec/visual-tokens-v0.2.md)
232
+ - [Spec Markdown convention](docs/spec/spec-markdown-convention.md)
233
+ - [DDL](schema/ad2v-v0.7.sql), [IR JSON Schema](schema/ir-v0.7.schema.json), [themes](schema/themes/)
234
+ - [ADRs](docs/adr/) and [dependencies and licenses](docs/dependencies.md)
235
+ - [REPORT.md](REPORT.md) (P10), [infra layer](docs/infra.md), [P9 report](docs/reports/P9.md), [P8 + P8.1 report](docs/reports/P8.md), [P7 report](docs/reports/P7.md), [plug-in guide](docs/plugins.md), [security](docs/security.md), [blind eval](docs/blind-eval.md), [dogfood procedure](docs/dogfood.md), [releasing (not for now)](docs/RELEASING.md), [quickstart](docs/quickstart.md), [MCP setup](docs/mcp.md), [P6.1 report](docs/reports/P6.1.md), [P6 report](docs/reports/P6.md), [P5 report](docs/reports/P5.md), [P4 report](docs/reports/P4.md), [P3 report](docs/reports/P3.md), [P2 report](docs/reports/P2.md), [P1 report](docs/reports/P1.md), [status](status.md), [issues](issues.md), [pending](pending.md)
236
+
237
+ ## Optional manifest (`ad2v.yaml`)
238
+
239
+ ```yaml
240
+ system: {name: payments-recon}
241
+ containers:
242
+ - {name: api, paths: [api], kind: service, replicas: 2}
243
+ - {name: worker, paths: [worker], kind: worker}
244
+ exclude: [migrations] # added to the default excludes
245
+ behavior: {emit_all: false} # true: emit loop/retry/... nodes even without risk flags
246
+ workflows: {max_depth: 12, max_steps: 5000}
247
+ spec_ids: {test_name_prefixes: [REQ, CMP]}
248
+ pairing:
249
+ components: {CMP-002: worker} # spec component -> container or component
250
+ path_prefix_map: {/api: ""} # route normalization, both sides
251
+ case_insensitive: false
252
+ orphan_policy: auto # auto (orphans only once specs exist) | strict | off
253
+ links: [] # human-confirmed pairs (accepted suggestions): manifest_link
254
+ rejected: [] # rejected suggestions, never proposed again
255
+ path_constants: {"settings.API_V1_STR": "/api/v1"} # values for unresolvable route prefixes
256
+ resolve_settings_defaults: false # true: read literal pydantic Settings defaults (warned)
257
+ rules_overlay: rules-overlay.yaml # deep-merged over the built-in rules (changes rules_hash)
258
+ extractors:
259
+ enabled: [] # third-party extractor / framework-pack plug-ins to run (opt-in)
260
+ llm: # informative only: never in config_hash or an epoch id
261
+ provider: vertex # fake | vertex | openai_compatible
262
+ project: my-gcp-project
263
+ location: global
264
+ model: gemini-3.8-flash
265
+ pricing: {input_per_mtok: 0.75, output_per_mtok: 3.75}
266
+ budget_usd: 1.00
267
+ output_language: auto # chat answers in the question's language
268
+ tasks: # thinking per task: off | low | default | token budget (Gemini 2.5)
269
+ judge: {thinking: default}
270
+ summarize: {thinking: low}
271
+ chat: {thinking: low, max_output_tokens: 2048}
272
+ ```
273
+
274
+ Without a manifest, each top-level directory that has `pyproject.toml`, `setup.py` or `Dockerfile`
275
+ is a container.
276
+
277
+ ## Development
278
+
279
+ ```bash
280
+ .venv/Scripts/python -m pytest --cov=ad2v
281
+ ```
282
+
283
+ ```bash
284
+ .venv/Scripts/ruff check .
285
+ ```
286
+
287
+ CI (`.github/workflows/ci.yml`) runs the tests, determinism (LF vs CRLF+BOM, across systems), both
288
+ license gates, the viewer checks and builds, and the plug-in conformance kit; while the repository
289
+ is private, Windows and macOS run only on a manual dispatch.
290
+
291
+ The viewer (Node ≥ 20) lives in `viewer/`:
292
+
293
+ ```bash
294
+ cd viewer && npm ci && npm run build
295
+ ```
296
+
297
+ `npm run build` type-checks, bundles into `viewer/dist` (which `ad2v view` serves and the wheel
298
+ ships) and runs the license gate. `npm run build:demo` regenerates the test fixtures and
299
+ `docs/reports/P5-demo.html`. `npm test` runs the unit tests (Vitest) and `npm run lint` runs
300
+ ESLint. `npm run e2e` (after `build:demo`) runs the Playwright tour over the demo and writes `docs/reports/P5-screens/`. It needs
301
+ `npx playwright install chromium` once.
302
+
303
+ The MCP layer (P6): `pytest -m mcp` (repository root) runs the Python protocol and tool tests,
304
+ including the retrieval eval. `npm run test:mcp` (in `viewer/`) builds the MCP App
305
+ (`npm run build:app` → `viewer/app-dist/app.html`, which the wheel ships). It then runs the parity
306
+ test (the viewer's data over the real stdio server), protocol conformance with the MCP Inspector
307
+ (via `npx`; not a dependency), and the App e2e in a test host (`docs/reports/P6-screens/`). The
308
+ retrieval eval also runs standalone:
309
+ `python -m ad2v.mcp.evaluate <file> fixtures/payments-recon/expected-questions.yaml [--tune]`.
310
+
311
+ After editing `schema/ad2v-v0.7.sql`, regenerate the spec's column table with
312
+ `python -m ad2v.ddl`. A test fails if you forget.