anatomize 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. anatomize-0.1.0/.gitattributes +1 -0
  2. anatomize-0.1.0/.github/workflows/ci.yml +84 -0
  3. anatomize-0.1.0/.github/workflows/publish-pypi.yml +30 -0
  4. anatomize-0.1.0/.github/workflows/publish-testpypi.yml +30 -0
  5. anatomize-0.1.0/.gitignore +23 -0
  6. anatomize-0.1.0/CHANGELOG.md +18 -0
  7. anatomize-0.1.0/CONTRIBUTING.md +19 -0
  8. anatomize-0.1.0/LICENSE +21 -0
  9. anatomize-0.1.0/PKG-INFO +307 -0
  10. anatomize-0.1.0/README.md +268 -0
  11. anatomize-0.1.0/SKILL.md +202 -0
  12. anatomize-0.1.0/docs/GUIDE.md +305 -0
  13. anatomize-0.1.0/docs/REPOMIX_VS_ANATOMIZE.md +97 -0
  14. anatomize-0.1.0/pyproject.toml +88 -0
  15. anatomize-0.1.0/scripts/bench_pack.py +58 -0
  16. anatomize-0.1.0/src/anatomize/__init__.py +43 -0
  17. anatomize-0.1.0/src/anatomize/cli.py +740 -0
  18. anatomize-0.1.0/src/anatomize/config.py +219 -0
  19. anatomize-0.1.0/src/anatomize/core/__init__.py +21 -0
  20. anatomize-0.1.0/src/anatomize/core/discovery.py +207 -0
  21. anatomize-0.1.0/src/anatomize/core/exclude.py +224 -0
  22. anatomize-0.1.0/src/anatomize/core/extractor.py +610 -0
  23. anatomize-0.1.0/src/anatomize/core/parser.py +473 -0
  24. anatomize-0.1.0/src/anatomize/core/policy.py +15 -0
  25. anatomize-0.1.0/src/anatomize/core/types.py +339 -0
  26. anatomize-0.1.0/src/anatomize/formats/__init__.py +157 -0
  27. anatomize-0.1.0/src/anatomize/formats/json_fmt.py +128 -0
  28. anatomize-0.1.0/src/anatomize/formats/markdown_fmt.py +292 -0
  29. anatomize-0.1.0/src/anatomize/formats/payloads.py +131 -0
  30. anatomize-0.1.0/src/anatomize/formats/yaml_fmt.py +139 -0
  31. anatomize-0.1.0/src/anatomize/generators/__init__.py +5 -0
  32. anatomize-0.1.0/src/anatomize/generators/main.py +230 -0
  33. anatomize-0.1.0/src/anatomize/pack/__init__.py +12 -0
  34. anatomize-0.1.0/src/anatomize/pack/compress.py +86 -0
  35. anatomize-0.1.0/src/anatomize/pack/deps.py +233 -0
  36. anatomize-0.1.0/src/anatomize/pack/discovery.py +127 -0
  37. anatomize-0.1.0/src/anatomize/pack/formats.py +316 -0
  38. anatomize-0.1.0/src/anatomize/pack/ignore.py +61 -0
  39. anatomize-0.1.0/src/anatomize/pack/jsonl.py +113 -0
  40. anatomize-0.1.0/src/anatomize/pack/limit.py +70 -0
  41. anatomize-0.1.0/src/anatomize/pack/match.py +115 -0
  42. anatomize-0.1.0/src/anatomize/pack/mode.py +11 -0
  43. anatomize-0.1.0/src/anatomize/pack/overview.py +134 -0
  44. anatomize-0.1.0/src/anatomize/pack/pyright_lsp.py +326 -0
  45. anatomize-0.1.0/src/anatomize/pack/representations.py +132 -0
  46. anatomize-0.1.0/src/anatomize/pack/runner.py +1474 -0
  47. anatomize-0.1.0/src/anatomize/pack/slicing.py +11 -0
  48. anatomize-0.1.0/src/anatomize/pack/summaries.py +125 -0
  49. anatomize-0.1.0/src/anatomize/pack/tokens.py +34 -0
  50. anatomize-0.1.0/src/anatomize/pack/tree.py +82 -0
  51. anatomize-0.1.0/src/anatomize/pack/uses.py +84 -0
  52. anatomize-0.1.0/src/anatomize/py.typed +1 -0
  53. anatomize-0.1.0/src/anatomize/schemas/__init__.py +1 -0
  54. anatomize-0.1.0/src/anatomize/schemas/hierarchy.schema.json +39 -0
  55. anatomize-0.1.0/src/anatomize/schemas/module.schema.json +86 -0
  56. anatomize-0.1.0/src/anatomize/validation.py +150 -0
  57. anatomize-0.1.0/src/anatomize/version.py +4 -0
  58. anatomize-0.1.0/tests/README.md +23 -0
  59. anatomize-0.1.0/tests/__init__.py +1 -0
  60. anatomize-0.1.0/tests/e2e/test_cli.py +95 -0
  61. anatomize-0.1.0/tests/e2e/test_pack_cli.py +81 -0
  62. anatomize-0.1.0/tests/e2e/test_pack_hybrid_cli.py +51 -0
  63. anatomize-0.1.0/tests/e2e/test_pack_pyright_uses.py +136 -0
  64. anatomize-0.1.0/tests/e2e/test_pack_removed_flags.py +28 -0
  65. anatomize-0.1.0/tests/fixtures/project_src/src/excluded/skip.py +2 -0
  66. anatomize-0.1.0/tests/fixtures/project_src/src/ns_pkg/sub/mod.py +6 -0
  67. anatomize-0.1.0/tests/fixtures/project_src/src/pkg/__init__.py +2 -0
  68. anatomize-0.1.0/tests/fixtures/project_src/src/pkg/mod.py +12 -0
  69. anatomize-0.1.0/tests/fixtures/project_src/src/top_level.py +5 -0
  70. anatomize-0.1.0/tests/fixtures/sample_package/__init__.py +1 -0
  71. anatomize-0.1.0/tests/fixtures/sample_package/models.py +114 -0
  72. anatomize-0.1.0/tests/integration/__init__.py +1 -0
  73. anatomize-0.1.0/tests/unit/__init__.py +1 -0
  74. anatomize-0.1.0/tests/unit/test_config.py +87 -0
  75. anatomize-0.1.0/tests/unit/test_discovery.py +76 -0
  76. anatomize-0.1.0/tests/unit/test_exclude.py +45 -0
  77. anatomize-0.1.0/tests/unit/test_extractor.py +183 -0
  78. anatomize-0.1.0/tests/unit/test_formats.py +38 -0
  79. anatomize-0.1.0/tests/unit/test_generator.py +155 -0
  80. anatomize-0.1.0/tests/unit/test_pack_deps.py +139 -0
  81. anatomize-0.1.0/tests/unit/test_pack_discovery.py +70 -0
  82. anatomize-0.1.0/tests/unit/test_pack_hybrid.py +231 -0
  83. anatomize-0.1.0/tests/unit/test_pack_limit.py +13 -0
  84. anatomize-0.1.0/tests/unit/test_pack_output_safety.py +436 -0
  85. anatomize-0.1.0/tests/unit/test_pack_overview.py +118 -0
  86. anatomize-0.1.0/tests/unit/test_parser.py +186 -0
  87. anatomize-0.1.0/tests/unit/test_pyright_lsp_uri.py +24 -0
  88. anatomize-0.1.0/tests/unit/test_uses_symbol_positions.py +52 -0
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,84 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ python-version: ["3.10", "3.11", "3.12"]
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+
23
+ - name: Install
24
+ run: |
25
+ python -m pip install -U pip
26
+ python -m pip install -e ".[dev]"
27
+
28
+ - name: Lint
29
+ run: |
30
+ python -m ruff check .
31
+
32
+ - name: Typecheck
33
+ run: |
34
+ python -m mypy --strict src
35
+
36
+ - name: Test
37
+ run: |
38
+ python -m pytest
39
+
40
+ - name: Build
41
+ run: |
42
+ python -m pip install build
43
+ python -m build
44
+
45
+ - name: Install wheel smoke test
46
+ run: |
47
+ python -m venv .venv-smoke
48
+ . .venv-smoke/bin/activate
49
+ python -m pip install -U pip
50
+ python -m pip install dist/*.whl
51
+ anatomize generate tests/fixtures/project_src/src --output .skeleton-smoke -f json
52
+ anatomize validate .skeleton-smoke --source tests/fixtures/project_src/src
53
+
54
+ pyright-e2e:
55
+ runs-on: ubuntu-latest
56
+ steps:
57
+ - uses: actions/checkout@v4
58
+
59
+ - name: Set up Python
60
+ uses: actions/setup-python@v5
61
+ with:
62
+ python-version: "3.12"
63
+
64
+ - name: Set up Node
65
+ uses: actions/setup-node@v4
66
+ with:
67
+ node-version: "20"
68
+
69
+ - name: Install Pyright
70
+ run: |
71
+ npm i -g pyright
72
+ pyright --version
73
+ command -v pyright-langserver
74
+
75
+ - name: Install
76
+ run: |
77
+ python -m pip install -U pip
78
+ python -m pip install -e ".[dev]"
79
+
80
+ - name: Pyright-backed e2e
81
+ env:
82
+ ANATOMIZE_RUN_PYRIGHT_E2E: "1"
83
+ run: |
84
+ python -m pytest tests/e2e/test_pack_pyright_uses.py
@@ -0,0 +1,30 @@
1
+ name: Publish (PyPI)
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment: pypi
12
+ permissions:
13
+ id-token: write
14
+ contents: read
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.12"
22
+
23
+ - name: Build
24
+ run: |
25
+ python -m pip install -U pip build
26
+ python -m build
27
+
28
+ - name: Publish to PyPI (trusted publishing)
29
+ uses: pypa/gh-action-pypi-publish@release/v1
30
+
@@ -0,0 +1,30 @@
1
+ name: Publish (TestPyPI)
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ publish:
8
+ runs-on: ubuntu-latest
9
+ environment: testpypi
10
+ permissions:
11
+ id-token: write
12
+ contents: read
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+
21
+ - name: Build
22
+ run: |
23
+ python -m pip install -U pip build
24
+ python -m build
25
+
26
+ - name: Publish to TestPyPI (trusted publishing)
27
+ uses: pypa/gh-action-pypi-publish@release/v1
28
+ with:
29
+ repository-url: https://test.pypi.org/legacy/
30
+
@@ -0,0 +1,23 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.so
4
+
5
+ .venv/
6
+ .python-version
7
+
8
+ .pytest_cache/
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ .coverage
12
+ coverage.xml
13
+ htmlcov/
14
+
15
+ dist/
16
+ build/
17
+ *.egg-info/
18
+
19
+ .skeleton/
20
+ .skeleton-*/
21
+
22
+ .DS_Store
23
+ Thumbs.db
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## 0.1.0 - 2026-01-31
6
+
7
+ ### Added
8
+ - `anatomize generate`: deterministic skeleton maps (hierarchy/modules/signatures) with YAML/JSON/Markdown outputs and embedded schemas.
9
+ - `anatomize validate`: strict validation of skeleton outputs with optional `--fix`.
10
+ - `anatomize estimate`: token estimation for skeleton outputs.
11
+ - `anatomize pack`: deterministic review bundles with include/ignore filtering, dependency slicing, compression, and token diagnostics.
12
+ - Pack output formats: Markdown, plain text, JSON, XML, and JSONL (stream-friendly).
13
+ - Pack safety/limits: `--content-encoding`, `--max-output`, and `--split-output`.
14
+ - Pack slicing: forward dependency closure (`--entry --deps`), reverse import closure (`--reverse-deps`), and optional Pyright-backed `--uses` slicing.
15
+ - Pack hybrid mode: JSONL bundles with per-file `meta|summary|content` representations and deterministic `--fit-to-max-output` selection tracing.
16
+
17
+ ### Infrastructure
18
+ - CI for linting, typechecking, tests, builds, and optional Pyright e2e verification.
@@ -0,0 +1,19 @@
1
+ # Contributing
2
+
3
+ ## Setup
4
+
5
+ ```bash
6
+ python -m venv .venv
7
+ . .venv/bin/activate
8
+ python -m pip install -U pip
9
+ python -m pip install -e ".[dev]"
10
+ ```
11
+
12
+ ## Quality gates
13
+
14
+ ```bash
15
+ python -m ruff check .
16
+ python -m mypy --strict src
17
+ python -m pytest
18
+ ```
19
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ariadne Team
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,307 @@
1
+ Metadata-Version: 2.4
2
+ Name: anatomize
3
+ Version: 0.1.0
4
+ Summary: Deterministic, token-efficient codebase packs and skeleton maps for AI review (Python)
5
+ Project-URL: Homepage, https://github.com/BradSegal/anatomize
6
+ Project-URL: Documentation, https://github.com/BradSegal/anatomize#readme
7
+ Project-URL: Repository, https://github.com/BradSegal/anatomize
8
+ Author-email: Bradley Max Segal <bradleymaxsegal@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai,ast,bundle,code-analysis,llm,pack,skeleton,tree-sitter
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Code Generators
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: pydantic>=2.0
23
+ Requires-Dist: pyyaml>=6.0
24
+ Requires-Dist: tiktoken>=0.5
25
+ Requires-Dist: tomli>=2.0
26
+ Requires-Dist: tree-sitter-python<0.22,>=0.21
27
+ Requires-Dist: tree-sitter<0.22,>=0.21
28
+ Requires-Dist: typer>=0.9
29
+ Provides-Extra: dev
30
+ Requires-Dist: black>=23.0; extra == 'dev'
31
+ Requires-Dist: build; extra == 'dev'
32
+ Requires-Dist: mypy>=1.0; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
34
+ Requires-Dist: pytest>=7.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.1; extra == 'dev'
36
+ Requires-Dist: twine; extra == 'dev'
37
+ Requires-Dist: types-pyyaml; extra == 'dev'
38
+ Description-Content-Type: text/markdown
39
+
40
+ # anatomize
41
+
42
+ [![CI](https://github.com/BradSegal/anatomize/actions/workflows/ci.yml/badge.svg)](https://github.com/BradSegal/anatomize/actions/workflows/ci.yml)
43
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
44
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
45
+
46
+ Generate deterministic, token-efficient maps and review bundles for Python repositories.
47
+
48
+ `anatomize` has two complementary workflows:
49
+
50
+ 1) **Skeletons**: structure-only “code maps” for navigation and architecture understanding.
51
+ 2) **Packs**: single-file bundles (repomix-style) for external review, with filtering and slicing.
52
+
53
+ If you want the full guide (modes, slicing, config, determinism guarantees), see `docs/GUIDE.md`.
54
+
55
+ ---
56
+
57
+ ## Installation
58
+
59
+ ```bash
60
+ pip install anatomize
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Quick Start (CLI)
66
+
67
+ ### Generate skeletons
68
+
69
+ ```bash
70
+ # Generate skeleton output to .skeleton/ (default format: yaml)
71
+ anatomize generate ./src
72
+
73
+ # Choose resolution level
74
+ anatomize generate ./src --level hierarchy
75
+ anatomize generate ./src --level modules
76
+ anatomize generate ./src --level signatures
77
+
78
+ # Write multiple formats
79
+ anatomize generate ./src --format yaml --format json --format markdown --output .skeleton
80
+ ```
81
+
82
+ ### Estimate tokens
83
+
84
+ ```bash
85
+ anatomize estimate ./src --level modules
86
+ ```
87
+
88
+ ### Validate (and fix) skeleton output
89
+
90
+ ```bash
91
+ # Validate existing output directory against sources
92
+ anatomize validate .skeleton --source ./src
93
+
94
+ # Rewrite the skeleton output to match regenerated content (strict, atomic-ish replacement)
95
+ anatomize validate .skeleton --source ./src --fix
96
+ ```
97
+
98
+ ### Pack a repository into an AI-friendly bundle
99
+
100
+ ```bash
101
+ # If --format is omitted, it is inferred from --output when the extension is known
102
+ anatomize pack . --output codebase.jsonl
103
+ anatomize pack . --output codebase.md
104
+
105
+ # Full bundle
106
+ anatomize pack . --format markdown --output codebase.md
107
+
108
+ # Filter by globs
109
+ anatomize pack . --include "src/**" --ignore "**/__pycache__/**" --output src-only.md
110
+
111
+ # Forward dependency closure (entrypoint + everything it imports)
112
+ anatomize pack . --entry src/anatomize/cli.py --deps --output slice.md
113
+
114
+ # Reverse dependency closure (module + everything that imports it)
115
+ anatomize pack . --target src/anatomize/cli.py --reverse-deps --output importers.md
116
+
117
+ # Reverse + forward (importers plus what they import)
118
+ anatomize pack . --target src/anatomize/cli.py --reverse-deps --deps --output importers-and-deps.md
119
+
120
+ # Token-efficient Python compression (signatures/imports/constants)
121
+ anatomize pack . --compress --output compressed.md
122
+
123
+ # Make markdown robust to embedded ``` fences (default)
124
+ anatomize pack . --content-encoding fence-safe --output safe.md
125
+
126
+ # Maximum robustness (content is base64-encoded UTF-8)
127
+ anatomize pack . --content-encoding base64 --output safe.base64.md
128
+
129
+ # Split output into multiple files (markdown/plain only)
130
+ anatomize pack . --split-output 500kb --output codebase.md
131
+
132
+ # Hard cap output (bytes or tokens)
133
+ anatomize pack . --max-output 20_000t --output codebase.md
134
+
135
+ # Print a per-file content token tree to stdout
136
+ anatomize pack . --token-count-tree --output codebase.md
137
+
138
+ # JSONL (stream-friendly)
139
+ anatomize pack . --format jsonl --output codebase.jsonl
140
+
141
+ # Hybrid mode (skeleton-style summaries + selective fill)
142
+ # - defaults to JSONL when --mode hybrid is set
143
+ # - Python files default to summary; non-Python defaults to metadata-only
144
+ anatomize pack . --mode hybrid --output hybrid.jsonl
145
+
146
+ # Hybrid: include full content for a slice and fit within a hard token budget
147
+ anatomize pack . --mode hybrid --max-output 50_000t --fit-to-max-output \
148
+ --content "src/pkg/**" --output hybrid.slice.jsonl
149
+ ```
150
+
151
+ Reference-based usage slicing (requires Pyright language server):
152
+
153
+ ```bash
154
+ anatomize pack . --target src/anatomize/cli.py --uses --slice-backend pyright --output uses.md
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Python API
160
+
161
+ ### Generate skeletons in code
162
+
163
+ ```python
164
+ from anatomize import SkeletonGenerator
165
+ from anatomize.formats import OutputFormat, write_skeleton
166
+
167
+ gen = SkeletonGenerator(sources=["./src"])
168
+ skeleton = gen.generate(level="modules")
169
+
170
+ print("Modules:", skeleton.metadata.total_modules)
171
+ print("Classes:", skeleton.metadata.total_classes)
172
+ print("Functions:", skeleton.metadata.total_functions)
173
+ print("Estimated tokens:", skeleton.metadata.token_estimate)
174
+
175
+ write_skeleton(skeleton, ".skeleton", formats=[OutputFormat.YAML, OutputFormat.JSON])
176
+ ```
177
+
178
+ ### Key exported objects
179
+
180
+ - `anatomize.SkeletonGenerator`: orchestrates discovery + extraction.
181
+ - `anatomize.formats.write_skeleton`: writes YAML/JSON/Markdown plus schemas and `manifest.json`.
182
+ - `anatomize.validation.validate_skeleton_dir`: strict validator with optional `fix`.
183
+
184
+ ---
185
+
186
+ ## Configuration (`.anatomize.yaml`)
187
+
188
+ The CLI can auto-discover `.anatomize.yaml`. Generation commands use config from the current working directory (or explicit `--config`). `pack` discovers config relative to the chosen `ROOT` when `--config` is not provided.
189
+
190
+ Minimal config:
191
+
192
+ ```yaml
193
+ sources:
194
+ - src
195
+ output: .skeleton
196
+ level: modules
197
+ formats: [yaml, json, markdown]
198
+ exclude:
199
+ - __pycache__/
200
+ - "*.pyc"
201
+ symlinks: forbid # forbid|files|dirs|all
202
+ workers: 0 # 0 = auto
203
+
204
+ pack:
205
+ format: markdown # markdown|plain|json|xml|jsonl
206
+ mode: bundle # bundle|hybrid
207
+ output: anatomize-pack.md # if the extension is known, it must match `format`
208
+ include: []
209
+ ignore: []
210
+ ignore_files: []
211
+ respect_standard_ignores: true
212
+ symlinks: forbid # forbid|files|dirs|all
213
+ max_file_bytes: 1000000
214
+ workers: 0 # 0 = auto
215
+ token_encoding: cl100k_base
216
+ compress: false
217
+ content_encoding: fence-safe # verbatim|fence-safe|base64 (markdown disallows verbatim)
218
+ line_numbers: false
219
+ no_structure: false
220
+ no_files: false
221
+ max_output: null # e.g. "500kb" or "20_000t"
222
+ split_output: null # e.g. "500kb" or "20_000t"
223
+ fit_to_max_output: false
224
+ # Hybrid representation rules (repeatable patterns). Precedence: meta < summary < content.
225
+ meta: []
226
+ summary: []
227
+ content: []
228
+ summary_config:
229
+ max_depth: 3
230
+ max_keys: 200
231
+ max_items: 200
232
+ max_headings: 200
233
+ python_roots: [] # defaults to ["src"] if present, else ["."]
234
+ slice_backend: imports # imports|pyright
235
+ uses_include_private: false
236
+ pyright_langserver_cmd: "pyright-langserver --stdio"
237
+ ```
238
+
239
+ Exclude patterns use gitignore-like semantics and are applied relative to each configured root.
240
+
241
+ ---
242
+
243
+ ## Output artifacts
244
+
245
+ ### Skeleton output directory
246
+
247
+ `write_skeleton(...)` and `anatomize generate ... --output DIR` create:
248
+ - `hierarchy.yaml|json|md` / `modules.*` / `signatures.*` depending on selected formats and level
249
+ - `schemas/*.json` embedded with the package
250
+ - `manifest.json` (SHA-256 per output file and metadata for validation)
251
+
252
+ ### Pack output file(s)
253
+
254
+ `anatomize pack` writes one or more files depending on splitting:
255
+ - `anatomize-pack.md` (or `.txt|.json|.xml`)
256
+ - if split: `anatomize-pack.1.md`, `anatomize-pack.2.md`, …
257
+
258
+ Each pack artifact starts with a lightweight, deterministic overview (and, if enabled, a structure tree) before file blocks/records.
259
+
260
+ Token reporting:
261
+ - **Artifact tokens**: exact tokens of the written output file(s).
262
+ - **Content tokens**: tokens of file contents only (useful for budgeting and “what’s expensive”).
263
+
264
+ ---
265
+
266
+ ## Determinism and strictness
267
+
268
+ - Deterministic ordering (paths and symbols sorted).
269
+ - No timestamps in outputs.
270
+ - Parse failures are hard failures (no partial output).
271
+ - Validation is strict; `--fix` replaces output with regenerated content.
272
+
273
+ ---
274
+
275
+ ## Development
276
+
277
+ ```bash
278
+ python -m venv .venv
279
+ . .venv/bin/activate
280
+ python -m pip install -U pip
281
+ python -m pip install -e ".[dev]"
282
+
283
+ python -m ruff check .
284
+ python -m mypy -p anatomize
285
+ python -m pytest
286
+ ```
287
+
288
+ Optional local benchmark:
289
+
290
+ ```bash
291
+ .venv/bin/python scripts/bench_pack.py . --compress --workers 0
292
+ ```
293
+
294
+ ---
295
+
296
+ ## Tests
297
+
298
+ Tests are indexed via pytest markers in `pyproject.toml` and documented in `tests/README.md`:
299
+ - `unit`: fast, isolated tests
300
+ - `integration`: filesystem-level tests
301
+ - `e2e`: CLI-level tests
302
+
303
+ ---
304
+
305
+ ## License
306
+
307
+ MIT