ai-editor-tree-engine-dev 1.0.176__py3-none-any.whl
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.
- ai_editor_tree_engine_dev-1.0.176.dist-info/METADATA +35 -0
- ai_editor_tree_engine_dev-1.0.176.dist-info/RECORD +121 -0
- ai_editor_tree_engine_dev-1.0.176.dist-info/WHEEL +5 -0
- ai_editor_tree_engine_dev-1.0.176.dist-info/licenses/LICENSE +21 -0
- ai_editor_tree_engine_dev-1.0.176.dist-info/top_level.txt +1 -0
- tree_engine/PUBLIC_API.md +161 -0
- tree_engine/__init__.py +327 -0
- tree_engine/checks/__init__.py +60 -0
- tree_engine/checks/builtin/__init__.py +5 -0
- tree_engine/checks/builtin/compile_check.py +53 -0
- tree_engine/checks/builtin/csv_syntax.py +51 -0
- tree_engine/checks/builtin/docstrings.py +211 -0
- tree_engine/checks/builtin/encoding.py +55 -0
- tree_engine/checks/builtin/fleet_rules.py +227 -0
- tree_engine/checks/builtin/format_syntax.py +82 -0
- tree_engine/checks/builtin/jsonl_syntax.py +49 -0
- tree_engine/checks/builtin/shipped.py +52 -0
- tree_engine/checks/builtin/syntax.py +118 -0
- tree_engine/checks/builtin/xml_wellformed.py +51 -0
- tree_engine/checks/chain.py +332 -0
- tree_engine/checks/external/__init__.py +5 -0
- tree_engine/checks/external/_base.py +61 -0
- tree_engine/checks/external/bandit.py +53 -0
- tree_engine/checks/external/black.py +48 -0
- tree_engine/checks/external/flake8.py +38 -0
- tree_engine/checks/external/isort.py +38 -0
- tree_engine/checks/external/mypy.py +45 -0
- tree_engine/checks/external/ruff.py +45 -0
- tree_engine/checks/external/runner.py +197 -0
- tree_engine/checks/model.py +110 -0
- tree_engine/checks/options.py +73 -0
- tree_engine/checks/plugin.py +171 -0
- tree_engine/checks/registry.py +349 -0
- tree_engine/core/address.py +376 -0
- tree_engine/core/identifier_map.py +266 -0
- tree_engine/core/identity.py +226 -0
- tree_engine/core/instrumentation.py +399 -0
- tree_engine/core/integrity.py +341 -0
- tree_engine/core/integrity_full.py +382 -0
- tree_engine/core/journal.py +260 -0
- tree_engine/core/journal_compose.py +571 -0
- tree_engine/core/live_tree.py +785 -0
- tree_engine/core/locking.py +188 -0
- tree_engine/core/move.py +585 -0
- tree_engine/core/move_references.py +323 -0
- tree_engine/core/node_types.py +408 -0
- tree_engine/core/nodes.py +348 -0
- tree_engine/core/offsets.py +24 -0
- tree_engine/core/operations.py +825 -0
- tree_engine/core/plugin_boundary.py +160 -0
- tree_engine/core/position_map.py +263 -0
- tree_engine/core/position_transfer.py +512 -0
- tree_engine/core/range_refresh.py +366 -0
- tree_engine/core/reference_cache.py +360 -0
- tree_engine/core/references.py +223 -0
- tree_engine/core/reparse.py +378 -0
- tree_engine/core/short_id.py +296 -0
- tree_engine/core/subtree_apply.py +397 -0
- tree_engine/core/subtree_copy.py +399 -0
- tree_engine/core/transactions.py +397 -0
- tree_engine/core/trivia.py +396 -0
- tree_engine/core/updates.py +398 -0
- tree_engine/core/validation.py +377 -0
- tree_engine/errors.py +104 -0
- tree_engine/exceptions.py +376 -0
- tree_engine/facade.py +4524 -0
- tree_engine/plugins/_statements.py +369 -0
- tree_engine/plugins/bsl/block_edit.py +449 -0
- tree_engine/plugins/bsl/blocks.py +127 -0
- tree_engine/plugins/bsl/checker.py +297 -0
- tree_engine/plugins/bsl/dialects.py +303 -0
- tree_engine/plugins/bsl/generator.py +481 -0
- tree_engine/plugins/bsl/import_map.py +995 -0
- tree_engine/plugins/bsl/plugin.py +452 -0
- tree_engine/plugins/contract.py +355 -0
- tree_engine/plugins/cpp/import_map.py +505 -0
- tree_engine/plugins/cpp/languages.py +99 -0
- tree_engine/plugins/cpp/plugin.py +501 -0
- tree_engine/plugins/csv_format.py +676 -0
- tree_engine/plugins/detachable.py +156 -0
- tree_engine/plugins/fallback.py +421 -0
- tree_engine/plugins/ini_format.py +330 -0
- tree_engine/plugins/json_format.py +813 -0
- tree_engine/plugins/json_pointer.py +203 -0
- tree_engine/plugins/jsonl_format.py +392 -0
- tree_engine/plugins/markdown_format.py +748 -0
- tree_engine/plugins/onec_query_format.py +61 -0
- tree_engine/plugins/parse_position.py +54 -0
- tree_engine/plugins/plain_text.py +1543 -0
- tree_engine/plugins/python/export_map.py +306 -0
- tree_engine/plugins/python/import_map.py +429 -0
- tree_engine/plugins/python/plugin.py +1710 -0
- tree_engine/plugins/registry.py +497 -0
- tree_engine/plugins/scan.py +87 -0
- tree_engine/plugins/selection.py +228 -0
- tree_engine/plugins/sql_format.py +61 -0
- tree_engine/plugins/toml_format.py +1072 -0
- tree_engine/plugins/xml_format.py +911 -0
- tree_engine/plugins/yaml/builder.py +49 -0
- tree_engine/plugins/yaml/emitter.py +225 -0
- tree_engine/plugins/yaml/flow.py +227 -0
- tree_engine/plugins/yaml/plugin.py +458 -0
- tree_engine/plugins/yaml/ranges.py +52 -0
- tree_engine/plugins/yaml/reader.py +359 -0
- tree_engine/plugins/yaml/scanner.py +298 -0
- tree_engine/query/adapter.py +283 -0
- tree_engine/query/engine.py +853 -0
- tree_engine/query/inspection.py +498 -0
- tree_engine/query/outline.py +288 -0
- tree_engine/query/predicates.py +263 -0
- tree_engine/query/rendered_lines.py +46 -0
- tree_engine/query/results.py +206 -0
- tree_engine/query/selector.py +400 -0
- tree_engine/query/xml_query.py +747 -0
- tree_engine/storage/codec.py +400 -0
- tree_engine/storage/document_bridge.py +579 -0
- tree_engine/storage/file_txn.py +459 -0
- tree_engine/storage/history.py +106 -0
- tree_engine/storage/lifecycle.py +622 -0
- tree_engine/storage/schema.py +403 -0
- tree_engine/storage/session_guard.py +398 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ai-editor-tree-engine-dev
|
|
3
|
+
Version: 1.0.176
|
|
4
|
+
Summary: Format-independent parse/tree/identity/render engine used as the ai-editor server's internals
|
|
5
|
+
Author-email: Vasiliy Zdanovskiy <vasilyvz@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: lark<2.0,>=1.3.1
|
|
10
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
11
|
+
Requires-Dist: flake8<8,>=7
|
|
12
|
+
Requires-Dist: mypy<2,>=1.8
|
|
13
|
+
Requires-Dist: black<26,>=24
|
|
14
|
+
Requires-Dist: isort<7,>=5.13
|
|
15
|
+
Requires-Dist: bandit<2,>=1.7
|
|
16
|
+
Requires-Dist: ruff<1,>=0.6
|
|
17
|
+
Provides-Extra: tree-engine-python
|
|
18
|
+
Requires-Dist: libcst<2.0,>=1.8.6; extra == "tree-engine-python"
|
|
19
|
+
Provides-Extra: tree-engine-bsl
|
|
20
|
+
Requires-Dist: tree-sitter<0.26,>=0.25; extra == "tree-engine-bsl"
|
|
21
|
+
Requires-Dist: ai-editor-tree-sitter-bsl-dev<0.1.8,>=0.1.7.2; extra == "tree-engine-bsl"
|
|
22
|
+
Provides-Extra: tree-engine-cpp
|
|
23
|
+
Requires-Dist: tree-sitter==0.25.2; extra == "tree-engine-cpp"
|
|
24
|
+
Requires-Dist: tree-sitter-c==0.24.2; extra == "tree-engine-cpp"
|
|
25
|
+
Requires-Dist: tree-sitter-cpp==0.23.4; extra == "tree-engine-cpp"
|
|
26
|
+
Requires-Dist: tree-sitter-cuda==0.21.1; extra == "tree-engine-cpp"
|
|
27
|
+
Provides-Extra: tree-engine
|
|
28
|
+
Requires-Dist: libcst<2.0,>=1.8.6; extra == "tree-engine"
|
|
29
|
+
Requires-Dist: tree-sitter==0.25.2; extra == "tree-engine"
|
|
30
|
+
Requires-Dist: ai-editor-tree-sitter-bsl-dev<0.1.8,>=0.1.7.2; extra == "tree-engine"
|
|
31
|
+
Requires-Dist: tree-sitter-c==0.24.2; extra == "tree-engine"
|
|
32
|
+
Requires-Dist: tree-sitter-cpp==0.23.4; extra == "tree-engine"
|
|
33
|
+
Requires-Dist: tree-sitter-cuda==0.21.1; extra == "tree-engine"
|
|
34
|
+
Provides-Extra: tree-engine-checks
|
|
35
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
ai_editor_tree_engine_dev-1.0.176.dist-info/licenses/LICENSE,sha256=6KdtUcTwmTRbJrAmYjVn7e6S-V42ubeDJ-AiVEzZ510,1075
|
|
2
|
+
tree_engine/PUBLIC_API.md,sha256=pmYVOpeD-6we47Sq8op9pg7qnaTpjgwEaXoeloansDc,19108
|
|
3
|
+
tree_engine/__init__.py,sha256=9bY8DhUrso6RwWPqmwA9VesM2tMMk09OcnXWWkggqb0,12145
|
|
4
|
+
tree_engine/errors.py,sha256=r_hxYMlR4HFN6A8CRvfCC4hyWewAG7jBffx1PfFyWxE,4379
|
|
5
|
+
tree_engine/exceptions.py,sha256=kM-j0yhHQiXIEv1R1hwOYn_MjzyPOOfEYyjhFI4UXGw,12456
|
|
6
|
+
tree_engine/facade.py,sha256=LJQf2o7M-n2Wmq0RPPTenHIUHPBCg6kihBlPUcU2F3Q,230330
|
|
7
|
+
tree_engine/checks/__init__.py,sha256=pzadredzOeru1J8h7ULyJ3hgzSQ8-702GNiDpoY_SEY,1690
|
|
8
|
+
tree_engine/checks/chain.py,sha256=yvpm3r7jPSlgHsSDCj9Vylq5nM0Q7_WVnSvADM2UW8E,15791
|
|
9
|
+
tree_engine/checks/model.py,sha256=_06neQWg9RR7jyKQRykqBDKK7clRL1dt4pkPqmKKN_Q,4129
|
|
10
|
+
tree_engine/checks/options.py,sha256=WZomJM4h99CxXHK0sNsAMFJCQQlAiLzNflQGPu40D38,2534
|
|
11
|
+
tree_engine/checks/plugin.py,sha256=5ZdEqOVriHAWAdab8Y_OtSuPDeJuuQX5M_Iml5yMrTM,7591
|
|
12
|
+
tree_engine/checks/registry.py,sha256=pmBJQIloK5KHvl4Go65A_YsgofWt4--eK4kYXFVSRyg,14264
|
|
13
|
+
tree_engine/checks/builtin/__init__.py,sha256=KeluLGjYjpAlFnUyRAiYQ1SyXcLn1A44P5ZAIEzvDGM,116
|
|
14
|
+
tree_engine/checks/builtin/compile_check.py,sha256=mmJVcXACiZaqdyYgbVfOs3OJt8fkWJhxQeATrQLtZPY,1880
|
|
15
|
+
tree_engine/checks/builtin/csv_syntax.py,sha256=8QdonT4YJpYzbqIZN4acOrxwZoZspJUe5K_9t1i-Eu8,1651
|
|
16
|
+
tree_engine/checks/builtin/docstrings.py,sha256=vlfjbPY87PbjIUm8GSBi0S-l4zWNCeUwfxUYqpHrzS8,9319
|
|
17
|
+
tree_engine/checks/builtin/encoding.py,sha256=z63agdMsEpUNIcpj1ReBmumM3k1R2GblWlbnwc-UFgc,1961
|
|
18
|
+
tree_engine/checks/builtin/fleet_rules.py,sha256=W2uPdxZNpEQEeNDHzAl8OxhTDSl1q3RpaZ5qRBHcCl0,10174
|
|
19
|
+
tree_engine/checks/builtin/format_syntax.py,sha256=NQxMtSJlzQschnwkRl7wSuawxyw0Uir1duFTYyPMoWU,2827
|
|
20
|
+
tree_engine/checks/builtin/jsonl_syntax.py,sha256=dxrRdQ1635o-gTX72WW0ncDUiANICc4gXtVDeSL8Ah4,1673
|
|
21
|
+
tree_engine/checks/builtin/shipped.py,sha256=QQgDWiBrvXhqNhzEE7JqTyM6O9GeIQbWPtg8sg1emHY,1771
|
|
22
|
+
tree_engine/checks/builtin/syntax.py,sha256=t9Pi7ksAcAHtTS_NTd1pVNZ_LIL2OSLlSp6MN10YHRc,4523
|
|
23
|
+
tree_engine/checks/builtin/xml_wellformed.py,sha256=ru9T--l-xSol-_KAPhGBnUuuMpU0Ql9QUfGblpi3BEQ,1647
|
|
24
|
+
tree_engine/checks/external/__init__.py,sha256=O6IUyHZTDJvt7u4qol_9FugEwhIMqtBPulyDZVNrLVQ,154
|
|
25
|
+
tree_engine/checks/external/_base.py,sha256=zo00bzU4UIPWD7zGda7ysu_AOPBQ51mQo-5N8Uml47w,2538
|
|
26
|
+
tree_engine/checks/external/bandit.py,sha256=VXVlomdDW7h69kUGvV_dM3RioVb0FEFWOaZZkcO4eYQ,2193
|
|
27
|
+
tree_engine/checks/external/black.py,sha256=abd3YdRGBLlPvYN8vlCqEQ_xsYSNOcBoVV1ExCTm3UU,1976
|
|
28
|
+
tree_engine/checks/external/flake8.py,sha256=ycvfSDCRAt7zwE0ZdVBYymV5BoTo2ZGJoCRN9LLiC4U,1441
|
|
29
|
+
tree_engine/checks/external/isort.py,sha256=TrcUYFUyJSKMNxeVX-7j5m7bW86qxxNpa7vgyrST1JU,1352
|
|
30
|
+
tree_engine/checks/external/mypy.py,sha256=VUW_4oAq7FfuO4voZbefLF2fm-DvkGHyvm8NFZM0gR4,1691
|
|
31
|
+
tree_engine/checks/external/ruff.py,sha256=Flrnmg7aBJbErKw2nyRnbyNCtBJAsawfQArwUp4Zp5I,1688
|
|
32
|
+
tree_engine/checks/external/runner.py,sha256=NpA45ZhIZ0qYXEIJDNf1d_C7YqST6DWEdfBv88uNtEk,7432
|
|
33
|
+
tree_engine/core/address.py,sha256=aGeiIZAVtVCjpgPdOY7pE9-jkbQNUWH1DsddSHFSO_E,14741
|
|
34
|
+
tree_engine/core/identifier_map.py,sha256=OXK_2r8ZZ3nohJqUfwNwntJjjHmxMdC6ZPscjpOfw_I,11681
|
|
35
|
+
tree_engine/core/identity.py,sha256=BcUMWoPpvBC-8h81G_RQkCd3Wy8ymFI91U0ppk0ZC4A,8157
|
|
36
|
+
tree_engine/core/instrumentation.py,sha256=p_4jwEtgWH25f59N6xKND2VdNGGAT3VqcD6h473Z8e8,17121
|
|
37
|
+
tree_engine/core/integrity.py,sha256=6ekZuDdsoLnFyQVs3E8ZZyv_rQun6FbPjaDM8ezgR1I,14574
|
|
38
|
+
tree_engine/core/integrity_full.py,sha256=dyoMc2vvTMcU5grGBWy8z7Zf6fpXexhuviI0paSpeQk,16272
|
|
39
|
+
tree_engine/core/journal.py,sha256=xjA7WlWdOEqKsMSi4bvwJMvkGpzH2NJ_HYP-M8vGDz8,9705
|
|
40
|
+
tree_engine/core/journal_compose.py,sha256=a7MMtriiCy8oylsHvpWsxRXu87iBa5kBhq6s5EJyrWk,22027
|
|
41
|
+
tree_engine/core/live_tree.py,sha256=RW1VE0IBiDZPvKwRkGPS1ns5rWZ_EoTSpFmsRGt7YIY,38892
|
|
42
|
+
tree_engine/core/locking.py,sha256=bsVilRJB-rGhnb0lI3TGyjIkrLt93ZVNQBPp1l2nm9Y,8754
|
|
43
|
+
tree_engine/core/move.py,sha256=N5050avzrV5i_zGvX7NfQHIjz5wjRgYp30D770bcS6Y,29723
|
|
44
|
+
tree_engine/core/move_references.py,sha256=mTLbrHIiV8tIm_mtAD52wDvozTsuegVyJMLRihNS-PI,13971
|
|
45
|
+
tree_engine/core/node_types.py,sha256=n8aZ-kQ-rbZbQhxV1_kTnevTU5SRnsPZZHbWTZp3344,17464
|
|
46
|
+
tree_engine/core/nodes.py,sha256=jvRt8T19Ba6yNqXWjaAUmVoZqUrRqPg7JosaQ09h38Y,14787
|
|
47
|
+
tree_engine/core/offsets.py,sha256=oj_AZq1VL0mcRaws8d5aGxK0ZawIhbATcpDLFYxh-hc,964
|
|
48
|
+
tree_engine/core/operations.py,sha256=EAPpNUM8_ncH4TALH6U4Pt_FQk5rcuadPmBFRoeSpBg,45008
|
|
49
|
+
tree_engine/core/plugin_boundary.py,sha256=KHseccyHmcHaPxpBykbmedzNU07nQ4MQg3z03fPAmb8,7196
|
|
50
|
+
tree_engine/core/position_map.py,sha256=JJM3cPM0KZG_oom2423nDCLKCtfJ2NKhqjHiSnIJX-o,9695
|
|
51
|
+
tree_engine/core/position_transfer.py,sha256=MzOLNLgN9KIViu1vybyfhq_EpT_EOa5KiZ0fFQOtkTE,24047
|
|
52
|
+
tree_engine/core/range_refresh.py,sha256=7ndquP2z1q3ehvtJrxWk0ayS6zZmzygRtuTrYXnCjpk,14554
|
|
53
|
+
tree_engine/core/reference_cache.py,sha256=EdxaOiICUIc60jme1SVBhqC6zOi5TCbqOKcze_2cXVY,15023
|
|
54
|
+
tree_engine/core/references.py,sha256=61X6-3yX_qEtzXKAP0Galpw0co6gF77rOelfeGrTNKg,9907
|
|
55
|
+
tree_engine/core/reparse.py,sha256=kF_-qjJun53Ve1pBVZkX8nXxkxmSo7LB1JsiQkoRU_o,16898
|
|
56
|
+
tree_engine/core/short_id.py,sha256=3OrJRWQsnsqiQRvUEaNoiKchYKlZ0FwKWvPkhl9MGgU,11361
|
|
57
|
+
tree_engine/core/subtree_apply.py,sha256=D7cPUllR9bVEbXFLtiXOIe3-nDHQnXeVgnvC0B0r1v4,16244
|
|
58
|
+
tree_engine/core/subtree_copy.py,sha256=YsnW0jFYeyNlbJSJp_PyAcWZX8L54yTHuWoX3qubRAI,15967
|
|
59
|
+
tree_engine/core/transactions.py,sha256=krlPKMWUxp7wr2VARxQRz3Izo79xXy2zJ4_A-S15XxU,19006
|
|
60
|
+
tree_engine/core/trivia.py,sha256=qyd37VIJOdqn73lsD3Dm81t5QoavrgxOMz5Tp4NOqSE,16728
|
|
61
|
+
tree_engine/core/updates.py,sha256=41V9WvnAY9R9tE44DmZUpeC1V26T6OhCNTZnXN3fFts,18591
|
|
62
|
+
tree_engine/core/validation.py,sha256=ijHSIvhG3RVg3mm7jVsFU1Wkery-ucUD_cE7gvqi5ng,16249
|
|
63
|
+
tree_engine/plugins/_statements.py,sha256=wHCl0GFGsJH70tkElAV_YPBZocmc7bsEqiK4oE-ALw8,14274
|
|
64
|
+
tree_engine/plugins/contract.py,sha256=-ympgnFSXvXqvhA8-cDP688EAcyDWFgCRCM0HLBJkJY,14614
|
|
65
|
+
tree_engine/plugins/csv_format.py,sha256=xPtlPozE-HAsWcn5yyHnbW7XuafxNe7BHAGqSNN7Y9w,29411
|
|
66
|
+
tree_engine/plugins/detachable.py,sha256=0MWXHzCViPmW6D15BKidUJ9jsNHZr8MhZyxxRvq0a_0,9248
|
|
67
|
+
tree_engine/plugins/fallback.py,sha256=9IS83CBANCQ5dtftS4-q97dzBcqEtAWDkDHNnXlUB8I,18044
|
|
68
|
+
tree_engine/plugins/ini_format.py,sha256=D9BXjnXHE9BWIcKoiOPtX0JZJLKFNKAburt_bLWh3EU,12420
|
|
69
|
+
tree_engine/plugins/json_format.py,sha256=HRi2PWXMqiqhSzRXAzRHmfAXinlfHFLNGwlFqIm5Tqo,41978
|
|
70
|
+
tree_engine/plugins/json_pointer.py,sha256=oXHcab0_BT2cDtJwmIrEvPa6CUoSFx-0vR3lTDggQBw,8185
|
|
71
|
+
tree_engine/plugins/jsonl_format.py,sha256=w7N8CH3VIJORcM50FeX1YCYznVJF9nshYdTIWK2JqrQ,15643
|
|
72
|
+
tree_engine/plugins/markdown_format.py,sha256=66YtSuByhwAdxjONhHKSj6n0CAZX_FfZypZyEX1rQtU,29859
|
|
73
|
+
tree_engine/plugins/onec_query_format.py,sha256=WsLtfphfzH7DWhmJrWSKOcRUwkLXODx1hxAf6JZ_kW8,2181
|
|
74
|
+
tree_engine/plugins/parse_position.py,sha256=l12B9yApaCfGIT3I9HfeSFdaSjykrg74fdqBDnfg73g,2298
|
|
75
|
+
tree_engine/plugins/plain_text.py,sha256=E5C-0mHydzENKiVw0pm_nlzHMTYXIsjlOTBkCDd_dRM,77049
|
|
76
|
+
tree_engine/plugins/registry.py,sha256=8dZOabYr6OkfP1CyYXai-bdNIXPgRmsvYLOjyBvL7v0,21456
|
|
77
|
+
tree_engine/plugins/scan.py,sha256=kjxyhMuj2LVjoil23lcUxt7N1hpqv9h9yplOlE-eubQ,3877
|
|
78
|
+
tree_engine/plugins/selection.py,sha256=aHNjt2jcDLc6cuCABfgNn3yFoTvY2tEmLqzeesVhNSY,9692
|
|
79
|
+
tree_engine/plugins/sql_format.py,sha256=usTOLvSdqz9Ui6gZoag7Sxe3wprYRRDZr8qzp02i8dY,2166
|
|
80
|
+
tree_engine/plugins/toml_format.py,sha256=n6HjDghHEx2t1ndYUIYfT4g6Fs4dCjqZ5nW5vTVYq30,54671
|
|
81
|
+
tree_engine/plugins/xml_format.py,sha256=XNJgM88vtC-J85MYnUfLNh839jEA0FaEAvB8qcp4Ty0,36893
|
|
82
|
+
tree_engine/plugins/bsl/block_edit.py,sha256=EiU76einSpN4eIaWYJuFYx7br9-4vftpcfhTy8OlqgI,18807
|
|
83
|
+
tree_engine/plugins/bsl/blocks.py,sha256=2a6gf4iBwvUsSzDNmL_98pz3-TmF7VsjSDKsXb6mJiM,4187
|
|
84
|
+
tree_engine/plugins/bsl/checker.py,sha256=1P1z-xjWYeBZ20sqi9Hdsl269A0oKqmj6KcHQo-sBL8,11999
|
|
85
|
+
tree_engine/plugins/bsl/dialects.py,sha256=sv5nJdb2DVyZisqmh-CgVHQ9I6AHG1oy-VxxVjxgGa4,11856
|
|
86
|
+
tree_engine/plugins/bsl/generator.py,sha256=JxoK7_xhiQkoF6FIE-656LnCXn_08U_fxF9ZnuqJuWo,21899
|
|
87
|
+
tree_engine/plugins/bsl/import_map.py,sha256=tjHd8LXGT1pesBAr-FAnE-MD2K77piFc5dDj3JP9HjA,47562
|
|
88
|
+
tree_engine/plugins/bsl/plugin.py,sha256=HurHwSXJV8yLuJOTix1beQJsr1uO0_bEXO_AjtaBF80,21405
|
|
89
|
+
tree_engine/plugins/cpp/import_map.py,sha256=Q09juhj2VOcmhuNtW1KhKVAJ7T2fkKnQ0cesU-Ky8a4,28181
|
|
90
|
+
tree_engine/plugins/cpp/languages.py,sha256=FrkPFATW1zA1vlrpnAxWkd-kB6_k3KLT8CLMTrU5fHA,4213
|
|
91
|
+
tree_engine/plugins/cpp/plugin.py,sha256=xYL_XYJHnV1hQJSgO2i7y857v_Y0mxbqxF7B6D9OUEY,26249
|
|
92
|
+
tree_engine/plugins/python/export_map.py,sha256=ZM0IWskuUogSgJLspmlLEH03577cWBaawXR0k7yQa2Q,14089
|
|
93
|
+
tree_engine/plugins/python/import_map.py,sha256=xIlNaVVDjQWO7AOPmtTmNGXWl5oQ0dj9lFSrvd6-V2Q,22046
|
|
94
|
+
tree_engine/plugins/python/plugin.py,sha256=2jmnhS9dG9f1U1CFAdgjcnD6JX_oj6tAd9-FEK1bK2o,89541
|
|
95
|
+
tree_engine/plugins/yaml/builder.py,sha256=xbCU0fAGJeL38D9BWv-K8ihlThZPLxhWw9mPMGg6F9E,1972
|
|
96
|
+
tree_engine/plugins/yaml/emitter.py,sha256=TtfAAoaUakuQM7X9FNNUHYGspiKOCHTieymO8xVcwLU,10716
|
|
97
|
+
tree_engine/plugins/yaml/flow.py,sha256=_Y7yWqJTRzm7kv27dYNKvGZ46efk41hseg6jgvZoY34,10084
|
|
98
|
+
tree_engine/plugins/yaml/plugin.py,sha256=SzDeU9Jry7ZJgiWLDTyZhTB9Z4XEHDPsn1yJJqQKE9c,22745
|
|
99
|
+
tree_engine/plugins/yaml/ranges.py,sha256=kjBx43dJEJdJeDAnweKhN7eWhYQIePnI75kTjT0birs,1974
|
|
100
|
+
tree_engine/plugins/yaml/reader.py,sha256=-GvuFgOx-SV5hl2WLe_kWaub2SZlY1ZPY_GmbFJ6TkI,16994
|
|
101
|
+
tree_engine/plugins/yaml/scanner.py,sha256=icNux2I5FMAUsBQvBOTWXMwsqurkCDObSbyBTOFABwo,12506
|
|
102
|
+
tree_engine/query/adapter.py,sha256=JOWZIEylOjWE2F7wh0YAF3PPLnaVVcRQun6Z5TbUvdU,12945
|
|
103
|
+
tree_engine/query/engine.py,sha256=cx-pRnFq6E1MGq1h_5ZRuHMGlrF1RVJYltZg_oyGD0o,39142
|
|
104
|
+
tree_engine/query/inspection.py,sha256=6BiEe0XhDowfyjLsMBdKnPQCnLEbs0ahoE8R6h7td9c,23940
|
|
105
|
+
tree_engine/query/outline.py,sha256=aWcPP3Oz0CtJfk3ywBDVibD-POGNpcmkgbSiTILAfp4,12116
|
|
106
|
+
tree_engine/query/predicates.py,sha256=1ObUrXi0ZXimC0q_eE0QQma24zbU3Lt8cmcnIIE43Ow,10928
|
|
107
|
+
tree_engine/query/rendered_lines.py,sha256=WvAxV5_xkWd7CZSK6Vpfb5RyAPiMKNFjQHErWNixqRU,1811
|
|
108
|
+
tree_engine/query/results.py,sha256=QJsF4tPxICJi8N2S1npz5QRl2fLFB0keMZQmaEwHLrg,9010
|
|
109
|
+
tree_engine/query/selector.py,sha256=AqqrHVg1DfbwjXASTzRMCor1zj-2lQkjrN3gMM9afUg,13616
|
|
110
|
+
tree_engine/query/xml_query.py,sha256=7M_0cujU3iccI54blEMb-JjDk1o6KEWJBiJvuXHszMM,28859
|
|
111
|
+
tree_engine/storage/codec.py,sha256=AAXEw2sdIVeqeexRuUsUFjXL0Ku5QmMsh2mMnN1GLOA,20421
|
|
112
|
+
tree_engine/storage/document_bridge.py,sha256=hazCNxBXvBTfPIxAwfnJN7aqrf-YT8_6xv7aaV3ygoU,35405
|
|
113
|
+
tree_engine/storage/file_txn.py,sha256=7KDzozTSw5fyBqJBUMJTkVuNZiu4FmK5T86oH17qw2o,17896
|
|
114
|
+
tree_engine/storage/history.py,sha256=8ymE2EC1GxWd-yUshFlDKmtt9x5QmzKSUSvp1H-81u4,5373
|
|
115
|
+
tree_engine/storage/lifecycle.py,sha256=HYjDiqNOCUcyGmEW-dz6atjbbOIe75Qyg-99AITdicQ,35097
|
|
116
|
+
tree_engine/storage/schema.py,sha256=j-y1dcLTRk_YK3loO7fKUe9XwNzhJZwzBeKQ1aVaG2A,16908
|
|
117
|
+
tree_engine/storage/session_guard.py,sha256=Ohj5F5_-KVIGnjIbJpSN2wbGTQMJlZL_3MwPS2IMzVc,17947
|
|
118
|
+
ai_editor_tree_engine_dev-1.0.176.dist-info/METADATA,sha256=ppgdOvxsuDye9GDFXeSAW19lVwrP98u_SA-Y8w6dVx8,1612
|
|
119
|
+
ai_editor_tree_engine_dev-1.0.176.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
120
|
+
ai_editor_tree_engine_dev-1.0.176.dist-info/top_level.txt,sha256=cWBMqIrMERXRH2Fh8V7A8SpvVXvZUQLDp2gDSpJlT1A,12
|
|
121
|
+
ai_editor_tree_engine_dev-1.0.176.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Vasiliy Zdanovskiy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tree_engine
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# `tree_engine` public API
|
|
2
|
+
|
|
3
|
+
Everything below is importable directly off the top-level package -- `from tree_engine import X` --
|
|
4
|
+
because `tree_engine/__init__.py` re-exports it. Nothing outside this list, and outside
|
|
5
|
+
`tree_engine.errors`/`tree_engine.exceptions`/`tree_engine.facade` (the three modules it is
|
|
6
|
+
re-exported from), is a supported import path; anything under `tree_engine.core.*` or
|
|
7
|
+
`tree_engine.plugins.*` is an internal implementation detail and may change without notice.
|
|
8
|
+
|
|
9
|
+
`tree_engine.__version__` is the checkout's own `src/VERSION` file (resolved next to this
|
|
10
|
+
package), when a checkout marker -- `src/pyproject.toml` -- sits right beside it (so a stray,
|
|
11
|
+
unrelated `VERSION` file that happens to sit at the top of `site-packages` is never misread as
|
|
12
|
+
this distribution's own) -- a real checkout wins over a possibly-stale installed build in the same
|
|
13
|
+
venv -- falling back to the installed `ai-editor-tree-engine` distribution version
|
|
14
|
+
(`importlib.metadata.version`) for a package installed from a built wheel, which ships neither a
|
|
15
|
+
`VERSION` file nor a `pyproject.toml`.
|
|
16
|
+
|
|
17
|
+
`tree_engine.query` is the real `tree_engine.query` SUBPACKAGE (`tree_engine.query.inspection`
|
|
18
|
+
and friends stay importable as such); the facade's `query()` function is exported here under a
|
|
19
|
+
different name, `run_query`, precisely so it never shadows that subpackage.
|
|
20
|
+
|
|
21
|
+
## Entry points and document operations (`tree_engine.facade`)
|
|
22
|
+
|
|
23
|
+
- `TreeDocument` -- the mutable in-memory handle every read/mutate call above the plugin layer operates on.
|
|
24
|
+
- `Address` -- the union type every address-taking command accepts: `UUID | int | str | NodeAddress`.
|
|
25
|
+
- `load` -- open a document from a file path.
|
|
26
|
+
- `save` -- write a document's current tree back to its file.
|
|
27
|
+
- `node_source_text` -- render one node's own source text back out.
|
|
28
|
+
- `reparse` -- rebuild a document's tree from its current source, keeping node identity where possible.
|
|
29
|
+
- `replace_source` -- swap a document's underlying source text wholesale and reparse it.
|
|
30
|
+
- `identity_by_path_snapshot` -- capture a document's current node_ids keyed by structural path (root `()`, each child at its parent's path plus its own index), in the exact shape `replace_source`'s `identity_by_path` parameter expects -- for a caller that needs a later `replace_source` rebuild (an external-modification recovery, a batch-rollback reparse) to preserve the SAME node identities its already-recorded state (an undo journal, a caller-held UUID) still addresses by.
|
|
31
|
+
- `loads` -- open a document from an in-memory string/bytes payload instead of a file. With `allow_plain_text_fallback=True` (the default) a `file_path` whose extension (or whole name, e.g. `.gitignore`) no plugin claims opens as the `plain_text` tree (`format_id == source_format_id == 'plain_text'`, `fallback_diagnostic is None`, byte-exact round trip); with `False` it raises `FORMAT_UNKNOWN_EXTENSION`. An explicit unknown `format_id` is still `FORMAT_PLUGIN_NOT_FOUND`, an extension two plugins claim `FORMAT_EXTENSION_CONFLICT`; `list_extensions()` does not list unknown extensions.
|
|
32
|
+
- `dumps` -- render a document's tree back to a string/bytes payload.
|
|
33
|
+
- `run_query` -- run a selector query over a document's tree (an alias for `tree_engine.facade.query`; NOT exported as `tree_engine.query`, which is the real `tree_engine.query` subpackage -- `tree_engine.query.inspection` and friends stay importable).
|
|
34
|
+
- `drill_down` -- resolve an address to progressively deeper node detail.
|
|
35
|
+
- `insert` -- insert a new node/fragment at a position.
|
|
36
|
+
- `count_fragment_nodes` -- count how many nodes a fragment would add before inserting it.
|
|
37
|
+
- `delete` -- delete a node (and its subtree).
|
|
38
|
+
- `replace` -- replace a node (or a source range) with new content.
|
|
39
|
+
- `move` -- move a node, possibly across two open documents.
|
|
40
|
+
- `copy_subtree` -- copy a subtree into a new detached document.
|
|
41
|
+
- `apply_subtree` -- apply a previously copied/edited subtree back into a document.
|
|
42
|
+
- `set_attribute` -- set one attribute on a node.
|
|
43
|
+
- `set_body` -- replace a node's body content.
|
|
44
|
+
- `set_root_trailing_separator` -- set the root node's trailing separator (plain_text format only; used during undo replay).
|
|
45
|
+
- `replace_node_id` -- reassign a node's identity while preserving its position.
|
|
46
|
+
- `resolve_address` -- resolve any accepted `Address` form to a canonical node reference.
|
|
47
|
+
- `register_format_plugin` -- register an additional format plugin at runtime.
|
|
48
|
+
- `list_formats` -- list every format plugin currently registered or discoverable.
|
|
49
|
+
- `list_extensions` -- extension (with dot) -> format_id for every resolvable format, entry-point plugins included.
|
|
50
|
+
- `format_capabilities` -- report what one registered format plugin supports.
|
|
51
|
+
- `open_bytes` -- open a document from raw bytes with explicit format selection.
|
|
52
|
+
- `open_file` -- open a document from a file path with explicit format selection.
|
|
53
|
+
- `write` -- write a document's tree to an arbitrary destination.
|
|
54
|
+
- `SOURCE_NONE`, `SOURCE_PREVIEW`, `SOURCE_FULL` -- the three source-retention levels a document can be opened with.
|
|
55
|
+
- `PLAIN_TEXT_FORMAT_ID` -- the format id of the built-in plain-text fallback plugin.
|
|
56
|
+
- `AddressRemap` -- the address-translation result returned after a structural mutation.
|
|
57
|
+
- `ApplySubtreeResult` -- the outcome of `apply_subtree`.
|
|
58
|
+
- `Checkpoint`, `CheckpointKind` -- a document history checkpoint and its kind.
|
|
59
|
+
- `CopiedDocument` -- the detached-document result of `copy_subtree`.
|
|
60
|
+
- `HistoryPort` -- the interface a caller implements to receive checkpoint/history events.
|
|
61
|
+
- `MoveResult` -- the outcome of `move`.
|
|
62
|
+
- `MutationResult` -- the common outcome shape shared by the mutating operations.
|
|
63
|
+
- `NodeAddress` -- the engine's own canonical node-address type.
|
|
64
|
+
- `OpenBranch` -- one branch of an opened document tree.
|
|
65
|
+
- `OpenedTree` -- the full result of opening a document.
|
|
66
|
+
- `OutlineResponse` -- a document's outline (structural summary) response type.
|
|
67
|
+
- `QueryMatch` -- one match returned by `query`.
|
|
68
|
+
- `StorageFacade` -- the storage-layer entry point `load`/`save`/`open_file`/`write` are built on.
|
|
69
|
+
Optional constructor parameters:
|
|
70
|
+
- `sidecar_adopter(tree_bytes, source_bytes) -> Optional[Mapping[Tuple[int, ...], Tuple[UUID, Optional[int]]]]`
|
|
71
|
+
(default `None`): consulted once, only when the tree file exists and does not decode as an engine tree
|
|
72
|
+
(a foreign sidecar). The mapping is keyed by structural path (root `()`, child = parent path + index) and
|
|
73
|
+
gives `(node_id, short_id or None)`. Mapped nodes take the supplied identity, others keep fresh identity,
|
|
74
|
+
entries without a node are ignored and counted. The open reports branch `OpenBranch.FOREIGN_TREE_ADOPTED`
|
|
75
|
+
(`"foreign_tree_adopted"`), `OpenedTree.adopted_node_count`, `OpenedTree.unmatched_legacy_count`;
|
|
76
|
+
`identity_preserved` is True iff every node was adopted; `tree_write_intent` is `REPLACE`. Returning `None`
|
|
77
|
+
behaves as no adopter (`NO_SIDECAR`); an exception reaches the caller and nothing is written. A duplicate
|
|
78
|
+
node_id raises `NODE_ID_CONFLICT`, a duplicate or non-positive short_id `SHORT_ID_CONFLICT`, a node_id that
|
|
79
|
+
is not a `UUID` `TREE_PAYLOAD_INVALID`, all before anything is written. `open_bytes` decides the same way
|
|
80
|
+
from bytes and writes nothing.
|
|
81
|
+
- `tree_publish_hook(staged_path, reference_path) -> None` (default `None`): called for each staged file
|
|
82
|
+
(source, then tree) after its bytes are complete and before the publishing rename. `reference_path` is the
|
|
83
|
+
pair's existing source file, or the parent directory when there is none. A hook exception aborts the
|
|
84
|
+
publication (`STORAGE_IO_ERROR`, original exception chained, previous files intact, no residue).
|
|
85
|
+
- `cross_process_lock` (default `True`): publication of one pair (`write`, and an `open_file` that must write
|
|
86
|
+
the tree file) holds a non-blocking advisory OS lock keyed by the pair, valid across processes. A second
|
|
87
|
+
process fails at once with `CONCURRENT_TREE_MODIFICATION`; `open_file` still returns the document with
|
|
88
|
+
`written_paths == ()`. A crashed holder never blocks later calls; no lock file stays in the pair's
|
|
89
|
+
directory (the lock file lives in the temp directory and is removed on release). `False` restores the
|
|
90
|
+
previous in-process-only behaviour.
|
|
91
|
+
- `inherit_ownership(staged_path, reference_path)` -- a ready `tree_publish_hook`: chown the staged file to the
|
|
92
|
+
reference's uid/gid (a `PermissionError` propagates) and chmod it to the reference mode `& 0o666` when the
|
|
93
|
+
reference is a regular file. A missing `staged_path` raises `FileNotFoundError` naming it.
|
|
94
|
+
- `TreeWriteIntent` -- the declared intent passed to a write operation.
|
|
95
|
+
- `WrittenPair` -- the (source, tree) pair a write operation reports back.
|
|
96
|
+
- `IdentifierMap`, `IdentifierStyle`, `NodeIdentifiers` -- node-identifier lookup tables and styles.
|
|
97
|
+
- `identifier_map` -- build an `IdentifierMap` for a document.
|
|
98
|
+
- `identifiers` -- list every identifier form for one node.
|
|
99
|
+
- `node_identifier` -- resolve one node's canonical identifier.
|
|
100
|
+
- `node_ref` -- format a node reference in a given identifier style.
|
|
101
|
+
- `reference_notation` -- the format-native reference notation for a document's format, if any.
|
|
102
|
+
|
|
103
|
+
## Built-in format plugins added for Markdown and JSON Lines
|
|
104
|
+
|
|
105
|
+
- `markdown` (`.md`, `.markdown`) -- tree of `document`, `front_matter`, `section`, `heading`, `paragraph`, `list`/`list_item`, `code_block`, `block_quote`, `table`, `thematic_break`, `html_block`; byte-identical round trip; never a parse failure and never the plain-text fallback.
|
|
106
|
+
- `jsonl` (`.jsonl`, `.ndjson`) -- `document` with one `record` (the json plugin's own value subtree), `blank` or `invalid_record` (raw text plus `line` and `message`) child per line; per-line terminators kept; byte-identical round trip; an invalid line never fails the file. An explicit `format_id="plain_text"` still gives the paragraph/line tree for either extension.
|
|
107
|
+
|
|
108
|
+
## Error codes and layers (`tree_engine.errors`)
|
|
109
|
+
|
|
110
|
+
- `ErrorCode` -- the stable, frozen enum of every error code the engine can raise.
|
|
111
|
+
- `ErrorLayer` -- the three layers an `ErrorCode` is attributed to: `CORE`, `PLUGIN`, `STORAGE`.
|
|
112
|
+
- `ERROR_CODE_LAYER` -- the total mapping from every `ErrorCode` to its `ErrorLayer`.
|
|
113
|
+
- `error_layer` -- look up the `ErrorLayer` for a given `ErrorCode`.
|
|
114
|
+
|
|
115
|
+
## Typed exception hierarchy (`tree_engine.exceptions`)
|
|
116
|
+
|
|
117
|
+
- `TreeEngineException` -- the root of every typed exception this package raises.
|
|
118
|
+
- `CoreLayerException`, `PluginLayerException`, `StorageLayerException` -- the three per-layer bases.
|
|
119
|
+
- `NodeNotFound` -- an address did not resolve to any node.
|
|
120
|
+
- `NodeIdConflict` -- a node id collided with an existing one.
|
|
121
|
+
- `ShortIdConflict` -- a short id collided with an existing one.
|
|
122
|
+
- `DocumentVersionConflict` -- a mutating call's `expected_version` did not match the document's current version.
|
|
123
|
+
- `InvalidSelector` -- a query selector was malformed or unsupported.
|
|
124
|
+
- `InvalidPosition` -- an insert/move position was invalid for its target.
|
|
125
|
+
- `InvalidParentType` -- a node was placed under a parent type that cannot hold it.
|
|
126
|
+
- `CycleDetected` -- a move/insert would have created a cycle in the tree.
|
|
127
|
+
- `UnresolvedReference` -- a reference could not be resolved to a concrete node.
|
|
128
|
+
- `ConcurrentTreeModification` -- two in-memory mutations raced on the same tree.
|
|
129
|
+
- `FormatUnknownExtension` -- a file extension matched no registered format plugin.
|
|
130
|
+
- `FormatExtensionConflict` -- two registered format plugins claimed the same extension.
|
|
131
|
+
- `FormatPluginNotFound` -- a format id named explicitly was not registered.
|
|
132
|
+
- `PluginCapabilityNotSupported` -- a requested operation is not supported by the target format plugin.
|
|
133
|
+
- `FormatContentParseFailed` -- a format plugin failed to parse content; `details` carries `line` (int >= 1), `column` (int >= 1) and `message` (str) for python, json, yaml, toml, ini and xml (yaml and ini report column 1 until their scanners track columns); the one exception permitted to carry the plain-text fallback flag.
|
|
134
|
+
- `FormatFragmentParseFailed` -- a format plugin failed to parse a fragment for insertion.
|
|
135
|
+
- `FormatPluginContractError` -- a format plugin violated its own contract.
|
|
136
|
+
- `UnsupportedTranslation` -- a cross-format translation was requested that no plugin supports.
|
|
137
|
+
- `TreePayloadInvalid` -- a stored tree payload failed schema/shape validation.
|
|
138
|
+
- `TreeSchemaUnsupported` -- a stored tree payload declared a schema version this engine does not support.
|
|
139
|
+
- `ChecksumMismatch` -- a document's dual checksums disagreed on open or write.
|
|
140
|
+
- `ConcurrentSourceModification` -- the on-disk source changed underneath an open document.
|
|
141
|
+
- `StorageIOError` -- a storage-layer I/O operation failed.
|
|
142
|
+
- `CheckToolCrashed`, `CheckToolTimeout`, `CheckToolMissing`, `CheckConfigInvalid` -- file-check run failures (`tree_engine.checks`, PLUGIN layer); constructed as `(message, details_mapping)`.
|
|
143
|
+
- `CODE_TO_EXCEPTION` -- the total mapping from every `ErrorCode` to its exception class, a read-only `types.MappingProxyType` (same as `ERROR_CODE_LAYER`); prefer `exception_for_code` for the common lookup.
|
|
144
|
+
- `exception_for_code` -- construct the right typed exception instance for a given `ErrorCode`.
|
|
145
|
+
|
|
146
|
+
## File checks (`tree_engine.checks`)
|
|
147
|
+
|
|
148
|
+
Library only: no database, project root, worktree or server configuration. Landed so far (TODO 15a86bcb, groups G1-G4):
|
|
149
|
+
|
|
150
|
+
- `Severity` (`error`, `warning`, `info`, `hint`), `Diagnostic` (frozen, eight fields; `to_dict()` yields exactly `tool, path, line, column, code, severity, message`), `CheckOutcome` (five fields).
|
|
151
|
+
- `CheckerMetadata`, `CheckRequest`, `CheckerPlugin`; `register_checker_plugin(plugin, *, replace=False)`, `list_checkers()`, `checker_capabilities(python_executable=None)` (per id: `kind`, `file_extensions`, `format_ids`, `requires`, `available`, `version`, `default_timeout_s`), `skipped_checkers()`; entry-point group `tree_engine.checkers` (lazy; a broken entry point is skipped and reported by `skipped_checkers()` as a `CHECK_CONFIG_INVALID` record naming the entry point). Shipped checker ids, including the checkers of the format plugins this package ships (`csv_syntax`), are never replaceable; an extension or format id claimed by another third-party plugin is always a registration error (the shipped checkers share `.py`, so they hold no exclusive claim).
|
|
152
|
+
- `check_syntax(content, format_id=None, file_path=None)`: one `SYNTAX-<FORMAT>` diagnostic per failure for python, json, yaml, toml, ini, xml, plus the checkers the format plugins declare (csv, sql, onec_query, bsl, and `jsonl_syntax`: one `SYNTAX-JSONL` error per invalid record line, 1-based `line`, `column` 1, non-UTF-8 bytes one diagnostic at line 1); `[]` for markdown and plain_text; no plain-text fallback, no retained tree.
|
|
153
|
+
- Checker ids (15, in registration order): builtin `syntax`, `xml_wellformed` (`XML<n>` codes), `compile`, `docstrings`, `encoding`, `placeholders`, `stubs`, `empty_implementations`, `file_length`; external `flake8`, `mypy`, `black`, `isort`, `bandit`, `ruff`. Options of a builtin checker are `name=value` tokens in `CheckRequest.args` or `ChainElement.args` (an unknown option is `CheckConfigInvalid`).
|
|
154
|
+
- `docstrings`: policy B, codes `DOC000` (syntax error), `DOC001`, `DOC010`, `DOC011`, `DOC020`, `DOC021`, `DOC030`, `DOC031`, `DOC040`, sorted by `(line, column, code)`, severity `error`; all five parameter kinds are checked, a bare `Args:` header does not document `args`, `-> None` needs no return description; option `exempt_properties=true` (default off) exempts `@property` accessors from `DOC010`.
|
|
155
|
+
- `encoding`: only bytes that are not valid UTF-8, one `ENC-UTF8` error at the first invalid byte (a `str` source gives `[]`).
|
|
156
|
+
- Fleet rules (the Code Analysis Server definitions, severity `warning`): `placeholders` (words TODO, FIXME, XXX, HACK, NOTE, BUG, OPTIMIZE, PLACEHOLDER, STUB, NOT IMPLEMENTED in comments, docstrings and string literals; option `patterns=A,B`), `stubs` (body only `pass`, `...`, `raise NotImplementedError` or `return None`), `empty_implementations` (class methods with an empty, `pass`, `...` or docstring-only body; option `ignore_abstract=false`), `file_length` (default limit 400 lines; option `max_lines=N`).
|
|
157
|
+
- External checkers run as `<python_executable> -m <tool>` in their own process group with `CheckRequest.cwd` and exactly the `CheckRequest.env` mapping (`None` inherits); the tool checks the file at `CheckRequest.path`. A request without `python_executable` runs the tool under the interpreter that runs the package (`sys.executable`); a supplied `python_executable` wins. Default timeouts: `mypy` 60 s, the others 30 s (`CheckerMetadata.default_timeout_s`); `ruff` runs `ruff check` only. A tool not installed for the interpreter is listed in `CheckOutcome.missing_blocking` / `missing_nonblocking`; a timeout raises `CheckToolTimeout` after the whole group is killed; an unexpected exit code or unreadable output raises `CheckToolCrashed`.
|
|
158
|
+
- `ChainElement(tool, blocking, config_source="auto", args=())`; `validate_chain_mapping(mapping)` (`{extension: [element dicts]}` to `{extension: tuple[ChainElement]}`, `CheckConfigInvalid` with `section`, `extension`, `reason`); `CheckChainRegistry.from_mapping(mapping).resolve(extension, overrides=None)` (a registry from the caller's own mapping, no defaults); `default_chain_table()` (a NEW `{extension: tuple[ChainElement]}` per call, derived from `list_extensions()` and the registered checkers: every checker whose `format_ids` holds the extension's format id or whose `file_extensions` holds the extension, the checkers the format plugin declares first, every element `blocking=True`; an extension with no checker has no entry; `.bsl` is `bsl_syntax`) and `CheckChainRegistry.from_defaults(additions=None)` (the default table, then each extension of `additions` REPLACES that extension's whole chain, an empty list included; no merge; `CheckConfigInvalid` for a bad mapping); `run_chain(chain, request, timeout_s=None, process_hook=None, cancel=None)` and `run_chain_async(...)` (same outcome, event loop stays free). Every element runs (no short-circuit); findings are sorted per element; `Diagnostic.blocking` is the element flag; a blocking element fails the run on an error (builtin), on any finding (external) or when its tool is missing; a set `cancel` token (any object with `is_set()`) kills the running tool and returns what was collected.
|
|
159
|
+
- The six tools are mandatory dependencies of the package; the extra `tree-engine-checks` stays as an empty alias (flake8 >=7,<8; mypy >=1.8,<2; black >=24,<26; isort >=5.13,<7; bandit >=1.7,<2; ruff >=0.6,<1). Runnable examples: `src/examples/checks_*.py`.
|
|
160
|
+
|
|
161
|
+
Format plugins may declare their own checker: an optional `checker_plugin` member (a builtin `CheckerPlugin`, or a zero-argument callable returning one) whose `metadata.format_ids` contains the plugin's `format_id`. The checks registry registers it by itself, for loaded formats and discoverable `tree_engine.format_plugins` entry points alike, and `check_syntax` returns its diagnostics for that format. `checker_capabilities()[id]` has seven keys: `kind`, `file_extensions`, `format_ids`, `requires`, `default_timeout_s`, `available`, `version`.
|