codeledger 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 (82) hide show
  1. codeledger-0.1.0/.github/workflows/ci.yml +58 -0
  2. codeledger-0.1.0/.github/workflows/docs.yml +39 -0
  3. codeledger-0.1.0/.github/workflows/release.yml +55 -0
  4. codeledger-0.1.0/.gitignore +48 -0
  5. codeledger-0.1.0/CHANGELOG.md +28 -0
  6. codeledger-0.1.0/CodeLedger/.gitattributes +2 -0
  7. codeledger-0.1.0/CodeLedger/.gitignore +181 -0
  8. codeledger-0.1.0/CodeLedger/LICENSE +21 -0
  9. codeledger-0.1.0/LICENSE +21 -0
  10. codeledger-0.1.0/PKG-INFO +296 -0
  11. codeledger-0.1.0/README.md +251 -0
  12. codeledger-0.1.0/docs/configuration.md +0 -0
  13. codeledger-0.1.0/docs/contributing.md +0 -0
  14. codeledger-0.1.0/docs/getting-started.md +0 -0
  15. codeledger-0.1.0/docs/how-it-works.md +0 -0
  16. codeledger-0.1.0/docs/index.md +0 -0
  17. codeledger-0.1.0/docs/mkdocs.yml +0 -0
  18. codeledger-0.1.0/pyproject.toml +81 -0
  19. codeledger-0.1.0/src/codeledger/__init__.py +4 -0
  20. codeledger-0.1.0/src/codeledger/__main__.py +6 -0
  21. codeledger-0.1.0/src/codeledger/classifier/__init__.py +21 -0
  22. codeledger-0.1.0/src/codeledger/classifier/deferred.py +143 -0
  23. codeledger-0.1.0/src/codeledger/classifier/rules.py +116 -0
  24. codeledger-0.1.0/src/codeledger/classifier/session.py +60 -0
  25. codeledger-0.1.0/src/codeledger/classifier/slm.py +19 -0
  26. codeledger-0.1.0/src/codeledger/cli.py +510 -0
  27. codeledger-0.1.0/src/codeledger/compressor/__init__.py +15 -0
  28. codeledger-0.1.0/src/codeledger/compressor/scope_engine.py +73 -0
  29. codeledger-0.1.0/src/codeledger/compressor/token_compressor.py +138 -0
  30. codeledger-0.1.0/src/codeledger/config/__init__.py +19 -0
  31. codeledger-0.1.0/src/codeledger/config/loader.py +141 -0
  32. codeledger-0.1.0/src/codeledger/config/presets/cli_tool.yaml +62 -0
  33. codeledger-0.1.0/src/codeledger/config/presets/data_pipeline.yaml +67 -0
  34. codeledger-0.1.0/src/codeledger/config/presets/fullstack.yaml +80 -0
  35. codeledger-0.1.0/src/codeledger/config/presets/minimal.yaml +48 -0
  36. codeledger-0.1.0/src/codeledger/config/presets/ml_research.yaml +73 -0
  37. codeledger-0.1.0/src/codeledger/config/presets/python_api.yaml +86 -0
  38. codeledger-0.1.0/src/codeledger/config/presets/react_frontend.yaml +70 -0
  39. codeledger-0.1.0/src/codeledger/config/schema.py +212 -0
  40. codeledger-0.1.0/src/codeledger/generator/__init__.py +15 -0
  41. codeledger-0.1.0/src/codeledger/generator/api_client.py +104 -0
  42. codeledger-0.1.0/src/codeledger/generator/local_client.py +72 -0
  43. codeledger-0.1.0/src/codeledger/generator/model_router.py +61 -0
  44. codeledger-0.1.0/src/codeledger/generator/prompt_builder.py +125 -0
  45. codeledger-0.1.0/src/codeledger/merge/__init__.py +15 -0
  46. codeledger-0.1.0/src/codeledger/merge/deduplicator.py +100 -0
  47. codeledger-0.1.0/src/codeledger/merge/extractor.py +131 -0
  48. codeledger-0.1.0/src/codeledger/merge/merge_engine.py +127 -0
  49. codeledger-0.1.0/src/codeledger/models/__init__.py +3 -0
  50. codeledger-0.1.0/src/codeledger/models/inference.py +0 -0
  51. codeledger-0.1.0/src/codeledger/parser/__init__.py +39 -0
  52. codeledger-0.1.0/src/codeledger/parser/base.py +136 -0
  53. codeledger-0.1.0/src/codeledger/parser/fallback.py +122 -0
  54. codeledger-0.1.0/src/codeledger/parser/java_parser.py +10 -0
  55. codeledger-0.1.0/src/codeledger/parser/js_parser.py +10 -0
  56. codeledger-0.1.0/src/codeledger/parser/python_parser.py +239 -0
  57. codeledger-0.1.0/src/codeledger/postprocess/__init__.py +23 -0
  58. codeledger-0.1.0/src/codeledger/postprocess/file_manager.py +183 -0
  59. codeledger-0.1.0/src/codeledger/postprocess/formatter.py +114 -0
  60. codeledger-0.1.0/src/codeledger/postprocess/validator.py +130 -0
  61. codeledger-0.1.0/src/codeledger/scanner/__init__.py +30 -0
  62. codeledger-0.1.0/src/codeledger/scanner/change_dag.py +228 -0
  63. codeledger-0.1.0/src/codeledger/scanner/dependency.py +124 -0
  64. codeledger-0.1.0/src/codeledger/scanner/file_scanner.py +207 -0
  65. codeledger-0.1.0/src/codeledger/scanner/snapshot.py +278 -0
  66. codeledger-0.1.0/src/codeledger/templates/doc_template.md.j2 +23 -0
  67. codeledger-0.1.0/src/codeledger/templates/merge_template.md.j2 +17 -0
  68. codeledger-0.1.0/src/codeledger/templates/prompt_templates/merge.txt +35 -0
  69. codeledger-0.1.0/src/codeledger/templates/prompt_templates/micro.txt +20 -0
  70. codeledger-0.1.0/src/codeledger/templates/prompt_templates/refactor.txt +30 -0
  71. codeledger-0.1.0/src/codeledger/templates/prompt_templates/standard.txt +19 -0
  72. codeledger-0.1.0/tests/conftest.py +122 -0
  73. codeledger-0.1.0/tests/fixtures/small_python/main.py +12 -0
  74. codeledger-0.1.0/tests/fixtures/small_python/utils.py +10 -0
  75. codeledger-0.1.0/tests/test_classifier/test_classifier.py +97 -0
  76. codeledger-0.1.0/tests/test_compressor/test_compressor.py +100 -0
  77. codeledger-0.1.0/tests/test_generator/test_generator.py +52 -0
  78. codeledger-0.1.0/tests/test_integration/test_integration.py +106 -0
  79. codeledger-0.1.0/tests/test_merge/test_merge.py +125 -0
  80. codeledger-0.1.0/tests/test_parser/test_parser.py +108 -0
  81. codeledger-0.1.0/tests/test_postprocess/test_postprocess.py +108 -0
  82. codeledger-0.1.0/tests/test_scanner/test_scanner.py +116 -0
@@ -0,0 +1,58 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ lint:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+ - name: Install dependencies
21
+ run: pip install -e ".[dev]"
22
+ - name: Ruff check
23
+ run: ruff check src/ tests/
24
+ - name: Ruff format check
25
+ run: ruff format --check src/ tests/
26
+
27
+ test:
28
+ runs-on: ubuntu-latest
29
+ strategy:
30
+ matrix:
31
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: actions/setup-python@v5
35
+ with:
36
+ python-version: ${{ matrix.python-version }}
37
+ - name: Install dependencies
38
+ run: pip install -e ".[dev]"
39
+ - name: Run tests
40
+ run: pytest --cov=codeledger --cov-report=xml -v
41
+ - name: Upload coverage
42
+ if: matrix.python-version == '3.12'
43
+ uses: codecov/codecov-action@v4
44
+ with:
45
+ file: coverage.xml
46
+ fail_ci_if_error: false
47
+
48
+ typecheck:
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+ - uses: actions/setup-python@v5
53
+ with:
54
+ python-version: "3.12"
55
+ - name: Install dependencies
56
+ run: pip install -e ".[dev]"
57
+ - name: Mypy
58
+ run: mypy src/codeledger/ --ignore-missing-imports
@@ -0,0 +1,39 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "docs/**"
8
+ - "README.md"
9
+
10
+ permissions:
11
+ contents: read
12
+ pages: write
13
+ id-token: write
14
+
15
+ jobs:
16
+ build:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.12"
23
+ - name: Install mkdocs
24
+ run: pip install mkdocs mkdocs-material
25
+ - name: Build docs
26
+ run: mkdocs build --strict
27
+ - uses: actions/upload-pages-artifact@v3
28
+ with:
29
+ path: site/
30
+
31
+ deploy:
32
+ needs: build
33
+ runs-on: ubuntu-latest
34
+ environment:
35
+ name: github-pages
36
+ url: ${{ steps.deployment.outputs.page_url }}
37
+ steps:
38
+ - id: deployment
39
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,55 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: write
10
+ id-token: write
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+ - name: Install build tools
21
+ run: pip install build
22
+ - name: Build package
23
+ run: python -m build
24
+ - name: Upload dist
25
+ uses: actions/upload-artifact@v4
26
+ with:
27
+ name: dist
28
+ path: dist/
29
+
30
+ publish:
31
+ needs: build
32
+ runs-on: ubuntu-latest
33
+ environment: pypi
34
+ steps:
35
+ - uses: actions/download-artifact@v4
36
+ with:
37
+ name: dist
38
+ path: dist/
39
+ - name: Publish to PyPI
40
+ uses: pypa/gh-action-pypi-publish@release/v1
41
+
42
+ github-release:
43
+ needs: build
44
+ runs-on: ubuntu-latest
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ - uses: actions/download-artifact@v4
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+ - name: Create GitHub Release
52
+ uses: softprops/action-gh-release@v2
53
+ with:
54
+ files: dist/*
55
+ generate_release_notes: true
@@ -0,0 +1,48 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ *.egg
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # Environment variables / secrets
18
+ .env
19
+ .env.*
20
+ *.pem
21
+ *.key
22
+
23
+ # IDE / editor
24
+ .vscode/
25
+ .idea/
26
+ *.swp
27
+ *.swo
28
+ *~
29
+
30
+ # Testing / coverage
31
+ .pytest_cache/
32
+ .coverage
33
+ htmlcov/
34
+ .mypy_cache/
35
+
36
+ # OS files
37
+ Thumbs.db
38
+ Desktop.ini
39
+ .DS_Store
40
+
41
+ # Ruff
42
+ .ruff_cache/
43
+
44
+ # Docs build
45
+ site/
46
+
47
+ # Jupyter
48
+ .ipynb_checkpoints/
@@ -0,0 +1,28 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2025-06-29
9
+
10
+ ### Added
11
+
12
+ - Initial release
13
+ - CLI commands: `init`, `generate`, `merge`, `status`, `diff`, `explain`, `version`
14
+ - File scanner with gitignore-aware traversal
15
+ - Snapshot engine for hash-based change detection (no git required)
16
+ - Dependency resolver and Change DAG for propagation-aware scoping
17
+ - Python AST parser with complexity estimation
18
+ - Regex-based fallback parser for JS/TS, Java, Go, Rust
19
+ - Rule-based session classifier (trivial/minor/standard/major/refactor)
20
+ - Deferred session accumulator for batching trivial changes
21
+ - Token compressor with scope engine for budget-aware payload trimming
22
+ - Prompt builder with 4 template tiers (micro, standard, refactor, merge)
23
+ - Model router supporting Anthropic, OpenAI, and Ollama backends
24
+ - Output validator with hallucination detection and section checking
25
+ - Jinja2-based markdown formatter with metadata injection
26
+ - File manager with manifest tracking and content hashing
27
+ - Merge engine with local deduplication and LLM-powered conceptualization
28
+ - 7 configuration presets (python_api, react_frontend, fullstack, data_pipeline, ml_research, cli_tool, minimal)
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,181 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ # Cursor
177
+ # Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
178
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
179
+ # refer to https://docs.cursor.com/context/ignore-files
180
+ .cursorignore
181
+ .cursorindexingignore
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Parth-Vyas000
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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 PromptDoc Contributors
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.