ai-editor-tree-engine-dev 1.0.176__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.
- ai_editor_tree_engine_dev-1.0.176/LICENSE +21 -0
- ai_editor_tree_engine_dev-1.0.176/MANIFEST.in +4 -0
- ai_editor_tree_engine_dev-1.0.176/PKG-INFO +35 -0
- ai_editor_tree_engine_dev-1.0.176/VERSION +1 -0
- ai_editor_tree_engine_dev-1.0.176/ai_editor_tree_engine_dev.egg-info/PKG-INFO +35 -0
- ai_editor_tree_engine_dev-1.0.176/ai_editor_tree_engine_dev.egg-info/SOURCES.txt +125 -0
- ai_editor_tree_engine_dev-1.0.176/ai_editor_tree_engine_dev.egg-info/dependency_links.txt +1 -0
- ai_editor_tree_engine_dev-1.0.176/ai_editor_tree_engine_dev.egg-info/requires.txt +33 -0
- ai_editor_tree_engine_dev-1.0.176/ai_editor_tree_engine_dev.egg-info/top_level.txt +1 -0
- ai_editor_tree_engine_dev-1.0.176/pyproject.toml +149 -0
- ai_editor_tree_engine_dev-1.0.176/setup.cfg +4 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/PUBLIC_API.md +161 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/__init__.py +327 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/__init__.py +60 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/__init__.py +5 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/compile_check.py +53 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/csv_syntax.py +51 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/docstrings.py +211 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/encoding.py +55 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/fleet_rules.py +227 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/format_syntax.py +82 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/jsonl_syntax.py +49 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/shipped.py +52 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/syntax.py +118 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/builtin/xml_wellformed.py +51 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/chain.py +332 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/external/__init__.py +5 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/external/_base.py +61 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/external/bandit.py +53 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/external/black.py +48 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/external/flake8.py +38 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/external/isort.py +38 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/external/mypy.py +45 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/external/ruff.py +45 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/external/runner.py +197 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/model.py +110 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/options.py +73 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/plugin.py +171 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/checks/registry.py +349 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/address.py +376 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/identifier_map.py +266 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/identity.py +226 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/instrumentation.py +399 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/integrity.py +341 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/integrity_full.py +382 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/journal.py +260 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/journal_compose.py +571 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/live_tree.py +785 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/locking.py +188 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/move.py +585 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/move_references.py +323 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/node_types.py +408 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/nodes.py +348 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/offsets.py +24 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/operations.py +825 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/plugin_boundary.py +160 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/position_map.py +263 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/position_transfer.py +512 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/range_refresh.py +366 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/reference_cache.py +360 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/references.py +223 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/reparse.py +378 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/short_id.py +296 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/subtree_apply.py +397 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/subtree_copy.py +399 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/transactions.py +397 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/trivia.py +396 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/updates.py +398 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/core/validation.py +377 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/errors.py +104 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/exceptions.py +376 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/facade.py +4524 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/_statements.py +369 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/bsl/block_edit.py +449 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/bsl/blocks.py +127 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/bsl/checker.py +297 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/bsl/dialects.py +303 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/bsl/generator.py +481 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/bsl/import_map.py +995 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/bsl/plugin.py +452 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/contract.py +355 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/cpp/import_map.py +505 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/cpp/languages.py +99 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/cpp/plugin.py +501 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/csv_format.py +676 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/detachable.py +156 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/fallback.py +421 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/ini_format.py +330 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/json_format.py +813 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/json_pointer.py +203 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/jsonl_format.py +392 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/markdown_format.py +748 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/onec_query_format.py +61 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/parse_position.py +54 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/plain_text.py +1543 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/python/export_map.py +306 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/python/import_map.py +429 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/python/plugin.py +1710 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/registry.py +497 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/scan.py +87 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/selection.py +228 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/sql_format.py +61 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/toml_format.py +1072 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/xml_format.py +911 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/yaml/builder.py +49 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/yaml/emitter.py +225 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/yaml/flow.py +227 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/yaml/plugin.py +458 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/yaml/ranges.py +52 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/yaml/reader.py +359 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/plugins/yaml/scanner.py +298 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/query/adapter.py +283 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/query/engine.py +853 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/query/inspection.py +498 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/query/outline.py +288 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/query/predicates.py +263 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/query/rendered_lines.py +46 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/query/results.py +206 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/query/selector.py +400 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/query/xml_query.py +747 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/storage/codec.py +400 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/storage/document_bridge.py +579 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/storage/file_txn.py +459 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/storage/history.py +106 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/storage/lifecycle.py +622 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/storage/schema.py +403 -0
- ai_editor_tree_engine_dev-1.0.176/tree_engine/storage/session_guard.py +398 -0
|
@@ -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,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 @@
|
|
|
1
|
+
1.0.176
|
|
@@ -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,125 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
VERSION
|
|
4
|
+
pyproject.toml
|
|
5
|
+
ai_editor_tree_engine_dev.egg-info/PKG-INFO
|
|
6
|
+
ai_editor_tree_engine_dev.egg-info/SOURCES.txt
|
|
7
|
+
ai_editor_tree_engine_dev.egg-info/dependency_links.txt
|
|
8
|
+
ai_editor_tree_engine_dev.egg-info/requires.txt
|
|
9
|
+
ai_editor_tree_engine_dev.egg-info/top_level.txt
|
|
10
|
+
tree_engine/PUBLIC_API.md
|
|
11
|
+
tree_engine/__init__.py
|
|
12
|
+
tree_engine/errors.py
|
|
13
|
+
tree_engine/exceptions.py
|
|
14
|
+
tree_engine/facade.py
|
|
15
|
+
tree_engine/checks/__init__.py
|
|
16
|
+
tree_engine/checks/chain.py
|
|
17
|
+
tree_engine/checks/model.py
|
|
18
|
+
tree_engine/checks/options.py
|
|
19
|
+
tree_engine/checks/plugin.py
|
|
20
|
+
tree_engine/checks/registry.py
|
|
21
|
+
tree_engine/checks/builtin/__init__.py
|
|
22
|
+
tree_engine/checks/builtin/compile_check.py
|
|
23
|
+
tree_engine/checks/builtin/csv_syntax.py
|
|
24
|
+
tree_engine/checks/builtin/docstrings.py
|
|
25
|
+
tree_engine/checks/builtin/encoding.py
|
|
26
|
+
tree_engine/checks/builtin/fleet_rules.py
|
|
27
|
+
tree_engine/checks/builtin/format_syntax.py
|
|
28
|
+
tree_engine/checks/builtin/jsonl_syntax.py
|
|
29
|
+
tree_engine/checks/builtin/shipped.py
|
|
30
|
+
tree_engine/checks/builtin/syntax.py
|
|
31
|
+
tree_engine/checks/builtin/xml_wellformed.py
|
|
32
|
+
tree_engine/checks/external/__init__.py
|
|
33
|
+
tree_engine/checks/external/_base.py
|
|
34
|
+
tree_engine/checks/external/bandit.py
|
|
35
|
+
tree_engine/checks/external/black.py
|
|
36
|
+
tree_engine/checks/external/flake8.py
|
|
37
|
+
tree_engine/checks/external/isort.py
|
|
38
|
+
tree_engine/checks/external/mypy.py
|
|
39
|
+
tree_engine/checks/external/ruff.py
|
|
40
|
+
tree_engine/checks/external/runner.py
|
|
41
|
+
tree_engine/core/address.py
|
|
42
|
+
tree_engine/core/identifier_map.py
|
|
43
|
+
tree_engine/core/identity.py
|
|
44
|
+
tree_engine/core/instrumentation.py
|
|
45
|
+
tree_engine/core/integrity.py
|
|
46
|
+
tree_engine/core/integrity_full.py
|
|
47
|
+
tree_engine/core/journal.py
|
|
48
|
+
tree_engine/core/journal_compose.py
|
|
49
|
+
tree_engine/core/live_tree.py
|
|
50
|
+
tree_engine/core/locking.py
|
|
51
|
+
tree_engine/core/move.py
|
|
52
|
+
tree_engine/core/move_references.py
|
|
53
|
+
tree_engine/core/node_types.py
|
|
54
|
+
tree_engine/core/nodes.py
|
|
55
|
+
tree_engine/core/offsets.py
|
|
56
|
+
tree_engine/core/operations.py
|
|
57
|
+
tree_engine/core/plugin_boundary.py
|
|
58
|
+
tree_engine/core/position_map.py
|
|
59
|
+
tree_engine/core/position_transfer.py
|
|
60
|
+
tree_engine/core/range_refresh.py
|
|
61
|
+
tree_engine/core/reference_cache.py
|
|
62
|
+
tree_engine/core/references.py
|
|
63
|
+
tree_engine/core/reparse.py
|
|
64
|
+
tree_engine/core/short_id.py
|
|
65
|
+
tree_engine/core/subtree_apply.py
|
|
66
|
+
tree_engine/core/subtree_copy.py
|
|
67
|
+
tree_engine/core/transactions.py
|
|
68
|
+
tree_engine/core/trivia.py
|
|
69
|
+
tree_engine/core/updates.py
|
|
70
|
+
tree_engine/core/validation.py
|
|
71
|
+
tree_engine/plugins/_statements.py
|
|
72
|
+
tree_engine/plugins/contract.py
|
|
73
|
+
tree_engine/plugins/csv_format.py
|
|
74
|
+
tree_engine/plugins/detachable.py
|
|
75
|
+
tree_engine/plugins/fallback.py
|
|
76
|
+
tree_engine/plugins/ini_format.py
|
|
77
|
+
tree_engine/plugins/json_format.py
|
|
78
|
+
tree_engine/plugins/json_pointer.py
|
|
79
|
+
tree_engine/plugins/jsonl_format.py
|
|
80
|
+
tree_engine/plugins/markdown_format.py
|
|
81
|
+
tree_engine/plugins/onec_query_format.py
|
|
82
|
+
tree_engine/plugins/parse_position.py
|
|
83
|
+
tree_engine/plugins/plain_text.py
|
|
84
|
+
tree_engine/plugins/registry.py
|
|
85
|
+
tree_engine/plugins/scan.py
|
|
86
|
+
tree_engine/plugins/selection.py
|
|
87
|
+
tree_engine/plugins/sql_format.py
|
|
88
|
+
tree_engine/plugins/toml_format.py
|
|
89
|
+
tree_engine/plugins/xml_format.py
|
|
90
|
+
tree_engine/plugins/bsl/block_edit.py
|
|
91
|
+
tree_engine/plugins/bsl/blocks.py
|
|
92
|
+
tree_engine/plugins/bsl/checker.py
|
|
93
|
+
tree_engine/plugins/bsl/dialects.py
|
|
94
|
+
tree_engine/plugins/bsl/generator.py
|
|
95
|
+
tree_engine/plugins/bsl/import_map.py
|
|
96
|
+
tree_engine/plugins/bsl/plugin.py
|
|
97
|
+
tree_engine/plugins/cpp/import_map.py
|
|
98
|
+
tree_engine/plugins/cpp/languages.py
|
|
99
|
+
tree_engine/plugins/cpp/plugin.py
|
|
100
|
+
tree_engine/plugins/python/export_map.py
|
|
101
|
+
tree_engine/plugins/python/import_map.py
|
|
102
|
+
tree_engine/plugins/python/plugin.py
|
|
103
|
+
tree_engine/plugins/yaml/builder.py
|
|
104
|
+
tree_engine/plugins/yaml/emitter.py
|
|
105
|
+
tree_engine/plugins/yaml/flow.py
|
|
106
|
+
tree_engine/plugins/yaml/plugin.py
|
|
107
|
+
tree_engine/plugins/yaml/ranges.py
|
|
108
|
+
tree_engine/plugins/yaml/reader.py
|
|
109
|
+
tree_engine/plugins/yaml/scanner.py
|
|
110
|
+
tree_engine/query/adapter.py
|
|
111
|
+
tree_engine/query/engine.py
|
|
112
|
+
tree_engine/query/inspection.py
|
|
113
|
+
tree_engine/query/outline.py
|
|
114
|
+
tree_engine/query/predicates.py
|
|
115
|
+
tree_engine/query/rendered_lines.py
|
|
116
|
+
tree_engine/query/results.py
|
|
117
|
+
tree_engine/query/selector.py
|
|
118
|
+
tree_engine/query/xml_query.py
|
|
119
|
+
tree_engine/storage/codec.py
|
|
120
|
+
tree_engine/storage/document_bridge.py
|
|
121
|
+
tree_engine/storage/file_txn.py
|
|
122
|
+
tree_engine/storage/history.py
|
|
123
|
+
tree_engine/storage/lifecycle.py
|
|
124
|
+
tree_engine/storage/schema.py
|
|
125
|
+
tree_engine/storage/session_guard.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
lark<2.0,>=1.3.1
|
|
2
|
+
flake8<8,>=7
|
|
3
|
+
mypy<2,>=1.8
|
|
4
|
+
black<26,>=24
|
|
5
|
+
isort<7,>=5.13
|
|
6
|
+
bandit<2,>=1.7
|
|
7
|
+
ruff<1,>=0.6
|
|
8
|
+
|
|
9
|
+
[:python_version < "3.11"]
|
|
10
|
+
tomli>=2.0
|
|
11
|
+
|
|
12
|
+
[tree-engine]
|
|
13
|
+
libcst<2.0,>=1.8.6
|
|
14
|
+
tree-sitter==0.25.2
|
|
15
|
+
ai-editor-tree-sitter-bsl-dev<0.1.8,>=0.1.7.2
|
|
16
|
+
tree-sitter-c==0.24.2
|
|
17
|
+
tree-sitter-cpp==0.23.4
|
|
18
|
+
tree-sitter-cuda==0.21.1
|
|
19
|
+
|
|
20
|
+
[tree-engine-bsl]
|
|
21
|
+
tree-sitter<0.26,>=0.25
|
|
22
|
+
ai-editor-tree-sitter-bsl-dev<0.1.8,>=0.1.7.2
|
|
23
|
+
|
|
24
|
+
[tree-engine-checks]
|
|
25
|
+
|
|
26
|
+
[tree-engine-cpp]
|
|
27
|
+
tree-sitter==0.25.2
|
|
28
|
+
tree-sitter-c==0.24.2
|
|
29
|
+
tree-sitter-cpp==0.23.4
|
|
30
|
+
tree-sitter-cuda==0.21.1
|
|
31
|
+
|
|
32
|
+
[tree-engine-python]
|
|
33
|
+
libcst<2.0,>=1.8.6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
tree_engine
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
# setuptools>=77 is required for PEP 639 (`license = "MIT"` as an SPDX string
|
|
3
|
+
# plus `license-files`); the root distribution still builds on setuptools>=69.
|
|
4
|
+
requires = ["setuptools>=77", "wheel"]
|
|
5
|
+
build-backend = "setuptools.build_meta"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "ai-editor-tree-engine-dev"
|
|
9
|
+
dynamic = ["version"]
|
|
10
|
+
description = "Format-independent parse/tree/identity/render engine used as the ai-editor server's internals"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
authors = [
|
|
15
|
+
{ name = "Vasiliy Zdanovskiy", email = "vasilyvz@gmail.com" },
|
|
16
|
+
]
|
|
17
|
+
# One base dependency, and it is not a format backend. `lark` backs
|
|
18
|
+
# `tree_engine.facade.query`: `facade.py` imports `tree_engine.query.engine`
|
|
19
|
+
# unconditionally at module scope, which reaches
|
|
20
|
+
# `tree_engine/query/selector.py -> from lark import ...`, so WITHOUT lark
|
|
21
|
+
# `import tree_engine.facade` fails outright and the whole engine is
|
|
22
|
+
# unimportable. It was declared as the optional extra `tree-engine-query` until
|
|
23
|
+
# this release; that extra was a fiction, measured and removed rather than
|
|
24
|
+
# papered over. The alternative -- detaching the query engine the way the
|
|
25
|
+
# python and bsl FORMAT plugins are detached (see below) -- was rejected by the
|
|
26
|
+
# owner: `query` is part of the engine's declared API surface, not a format, so
|
|
27
|
+
# detaching it would shrink the API to satisfy a packaging label. lark is small,
|
|
28
|
+
# pure-Python and stable, unlike the two backends that churn.
|
|
29
|
+
#
|
|
30
|
+
# Everything else the core, the storage layer and the plain_text /
|
|
31
|
+
# json_format / toml_format / yaml plugins need is stdlib. Every FORMAT backend
|
|
32
|
+
# lives in the extras below.
|
|
33
|
+
dependencies = [
|
|
34
|
+
"lark>=1.3.1,<2.0",
|
|
35
|
+
"tomli>=2.0; python_version < \"3.11\"",
|
|
36
|
+
"flake8>=7,<8",
|
|
37
|
+
"mypy>=1.8,<2",
|
|
38
|
+
"black>=24,<26",
|
|
39
|
+
"isort>=5.13,<7",
|
|
40
|
+
"bandit>=1.7,<2",
|
|
41
|
+
"ruff>=0.6,<1",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
# --- tree_engine backend extras -------------------------------------------
|
|
46
|
+
# src/tree_engine/ is format-independent by construction: pipeline/checks/
|
|
47
|
+
# check_boundary.py statically rejects any import of libcst / ast / tree_sitter /
|
|
48
|
+
# tree_sitter_bsl outside src/tree_engine/plugins/. The backends below are
|
|
49
|
+
# therefore genuinely optional -- the core, the storage layer and the
|
|
50
|
+
# plain_text / json_format / toml_format plugins are stdlib-only and need none
|
|
51
|
+
# of them. Install only the translator(s) you use.
|
|
52
|
+
#
|
|
53
|
+
# Version lines below are the MEASURED, round-trip-verified ones in this
|
|
54
|
+
# checkout, not copied from the plan text; see docs/release_identity.md §7 and
|
|
55
|
+
# docs/release_manifest.md ("Installed third-party versions").
|
|
56
|
+
#
|
|
57
|
+
# BACKEND MAJOR-UPGRADE RE-GATE RULE ({p032}): a MAJOR-version change of any
|
|
58
|
+
# third-party dependency pinned by this distribution -- the backends below
|
|
59
|
+
# (libcst, tree-sitter, tree-sitter-bsl) AND the base `lark` above -- REQUIRES
|
|
60
|
+
# re-running the contract and round-trip gate before publication. The upper
|
|
61
|
+
# bounds are what makes that rule mechanical: crossing one is an explicit,
|
|
62
|
+
# reviewed edit of this file, never an accidental resolver upgrade.
|
|
63
|
+
#
|
|
64
|
+
# libcst: verified on 1.9.0; pin allows >=1.8.6,<2.0 (byte-identical round-trip of a
|
|
65
|
+
# real module through tree_engine.plugins.python.plugin.PythonFormatPlugin).
|
|
66
|
+
tree-engine-python = ["libcst>=1.8.6,<2.0"]
|
|
67
|
+
# tree-sitter: DELIBERATE DIVERGENCE from the plan's "0.24.x" pin. The BSL
|
|
68
|
+
# grammar shipped by ai-editor-tree-sitter-bsl 0.1.7.2 reports ABI version 15
|
|
69
|
+
# (tree_sitter.Language(tree_sitter_bsl.language()).abi_version == 15). The
|
|
70
|
+
# installed tree-sitter 0.25.2 declares LANGUAGE_VERSION == 15 with
|
|
71
|
+
# MIN_COMPATIBLE_LANGUAGE_VERSION == 13; the 0.24 line tops out below 15 and
|
|
72
|
+
# cannot load this grammar. Verified by execution: BSLFormatPlugin parses a real
|
|
73
|
+
# 1C module on 0.25.2 and renders it back byte-identically.
|
|
74
|
+
tree-engine-bsl = [
|
|
75
|
+
"tree-sitter>=0.25,<0.26",
|
|
76
|
+
"ai-editor-tree-sitter-bsl-dev>=0.1.7.2,<0.1.8",
|
|
77
|
+
]
|
|
78
|
+
# tree-sitter-c / tree-sitter-cpp / tree-sitter-cuda: wish 2a977287 stage i (navigable-only MVP).
|
|
79
|
+
# One aggregate extra for all three grammars -- `tree_engine.plugins.cpp` is one plugin package
|
|
80
|
+
# serving three format ids (c/cpp/cuda) from one shared import pipeline, so there is no meaningful
|
|
81
|
+
# way to install "just c" without also getting the cpp/cuda grammar modules the same package
|
|
82
|
+
# imports lazily per format id (see `tree_engine.plugins.cpp.languages`). Versions pinned exactly
|
|
83
|
+
# as measured/verified in this checkout (byte-identical round trip of the project's own
|
|
84
|
+
# tests/plugins/cpp/corpus fixtures through tree_engine.plugins.cpp.plugin.CppFamilyFormatPlugin),
|
|
85
|
+
# mirroring the BACKEND MAJOR-UPGRADE RE-GATE RULE ({p032}) already documented above for the other
|
|
86
|
+
# backends. `tree-sitter` itself is pinned EXACTLY here (0.25.2), not as the ">=0.25,<0.26" range
|
|
87
|
+
# `tree-engine-bsl` above uses: this list must be byte-for-byte identical to the root
|
|
88
|
+
# `pyproject.toml`'s own `tree-engine-cpp` extra --
|
|
89
|
+
# tests/unit/test_version_pinning.py::test_backend_extras_agree_between_server_and_engine asserts
|
|
90
|
+
# exact list equality between the two files for every backend extra key, so an exact pin here (a
|
|
91
|
+
# range would still satisfy 0.25.2, but the two files' TEXT would then have to be typed identically
|
|
92
|
+
# anyway) is the least error-prone way to keep them from drifting.
|
|
93
|
+
tree-engine-cpp = [
|
|
94
|
+
"tree-sitter==0.25.2",
|
|
95
|
+
"tree-sitter-c==0.24.2",
|
|
96
|
+
"tree-sitter-cpp==0.23.4",
|
|
97
|
+
"tree-sitter-cuda==0.21.1",
|
|
98
|
+
]
|
|
99
|
+
# There is deliberately NO `tree-engine-query` extra any more: lark is a BASE
|
|
100
|
+
# dependency above, because the facade cannot be imported without it. An extra
|
|
101
|
+
# naming a dependency the distribution installs unconditionally would say the
|
|
102
|
+
# opposite of what is true.
|
|
103
|
+
# Aggregate: every tree_engine FORMAT backend at once. `tree-sitter` is named by both
|
|
104
|
+
# `tree-engine-bsl` (a range) and `tree-engine-cpp` (an exact pin) -- this aggregate carries the
|
|
105
|
+
# EXACT pin, not the wider range, because the delivery/build path installs THIS extra, not the
|
|
106
|
+
# per-format ones, so an exact pin declared only on `tree-engine-cpp` is otherwise never actually
|
|
107
|
+
# enforced (wish 2a977287 stage i verifier residue). 0.25.2 satisfies `tree-engine-bsl`'s own
|
|
108
|
+
# ">=0.25,<0.26" too, so no format loses coverage.
|
|
109
|
+
tree-engine = [
|
|
110
|
+
"libcst>=1.8.6,<2.0",
|
|
111
|
+
"tree-sitter==0.25.2",
|
|
112
|
+
"ai-editor-tree-sitter-bsl-dev>=0.1.7.2,<0.1.8",
|
|
113
|
+
"tree-sitter-c==0.24.2",
|
|
114
|
+
"tree-sitter-cpp==0.23.4",
|
|
115
|
+
"tree-sitter-cuda==0.21.1",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
# --- tree_engine.checks external tools (TODO 15a86bcb; D-CM.9 of 57e6f511 made them mandatory) ----
|
|
119
|
+
# The six tools (flake8, mypy, black, isort, bandit, ruff) are BASE dependencies now (owner 2026-11-04): the engine
|
|
120
|
+
# runs them itself, under the interpreter that runs the package unless the caller supplies another. The extra name
|
|
121
|
+
# stays as an EMPTY compatibility alias so install lines that name `tree-engine-checks` keep working.
|
|
122
|
+
tree-engine-checks = []
|
|
123
|
+
|
|
124
|
+
[tool.setuptools.dynamic]
|
|
125
|
+
# OWNER DECISION 2026-09-03: "the engine lives its own life" -- the engine
|
|
126
|
+
# versions INDEPENDENTLY of the editor. `VERSION` here is this distribution's
|
|
127
|
+
# OWN real file (not a symlink into the repository root any more): the
|
|
128
|
+
# engine's release number, bumped on the engine's own schedule. Only the
|
|
129
|
+
# server (`ai-editor`) and the client (`ai-editor-client`) stay version-locked
|
|
130
|
+
# to the repository-root VERSION file; this engine distribution does not. The
|
|
131
|
+
# root `pyproject.toml` pins `ai-editor-tree-engine==<this file's content>`
|
|
132
|
+
# exactly, so the two numbers can (and, over time, will) differ -- the server
|
|
133
|
+
# tracks whichever engine release it has verified against, not "the same
|
|
134
|
+
# number". See tests/unit/test_version_pinning.py and
|
|
135
|
+
# docs/release_identity.md ("Ratified 2026-09-03") for the enforced law.
|
|
136
|
+
version = { file = "VERSION" }
|
|
137
|
+
|
|
138
|
+
# `namespaces = true` is load-bearing, not decoration: tree_engine/ has no
|
|
139
|
+
# __init__.py anywhere, so every subpackage is an implicit namespace package
|
|
140
|
+
# (PEP 420) and a regular-package finder would ship an empty wheel.
|
|
141
|
+
[tool.setuptools.packages.find]
|
|
142
|
+
where = ["."]
|
|
143
|
+
include = ["tree_engine*"]
|
|
144
|
+
namespaces = true
|
|
145
|
+
|
|
146
|
+
# Ship the public-surface doc alongside the code it documents (source of truth for
|
|
147
|
+
# `from tree_engine import X`, see tree_engine/__init__.py).
|
|
148
|
+
[tool.setuptools.package-data]
|
|
149
|
+
tree_engine = ["PUBLIC_API.md"]
|
|
@@ -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`.
|