codeshift 0.3.5__tar.gz → 0.3.6__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 (118) hide show
  1. codeshift-0.3.6/PKG-INFO +473 -0
  2. codeshift-0.3.6/README.md +417 -0
  3. codeshift-0.3.6/codeshift.egg-info/PKG-INFO +473 -0
  4. {codeshift-0.3.5 → codeshift-0.3.6}/pyproject.toml +4 -4
  5. codeshift-0.3.5/PKG-INFO +0 -368
  6. codeshift-0.3.5/README.md +0 -312
  7. codeshift-0.3.5/codeshift.egg-info/PKG-INFO +0 -368
  8. {codeshift-0.3.5 → codeshift-0.3.6}/LICENSE +0 -0
  9. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/__init__.py +0 -0
  10. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/analyzer/__init__.py +0 -0
  11. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/analyzer/risk_assessor.py +0 -0
  12. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/__init__.py +0 -0
  13. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/auth.py +0 -0
  14. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/config.py +0 -0
  15. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/database.py +0 -0
  16. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/main.py +0 -0
  17. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/models/__init__.py +0 -0
  18. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/models/auth.py +0 -0
  19. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/models/billing.py +0 -0
  20. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/models/migrate.py +0 -0
  21. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/models/usage.py +0 -0
  22. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/routers/__init__.py +0 -0
  23. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/routers/auth.py +0 -0
  24. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/routers/billing.py +0 -0
  25. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/routers/migrate.py +0 -0
  26. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/routers/usage.py +0 -0
  27. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/api/routers/webhooks.py +0 -0
  28. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/__init__.py +0 -0
  29. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/commands/__init__.py +0 -0
  30. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/commands/apply.py +0 -0
  31. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/commands/auth.py +0 -0
  32. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/commands/diff.py +0 -0
  33. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/commands/scan.py +0 -0
  34. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/commands/upgrade.py +0 -0
  35. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/commands/upgrade_all.py +0 -0
  36. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/main.py +0 -0
  37. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/package_manager.py +0 -0
  38. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/cli/quota.py +0 -0
  39. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge/__init__.py +0 -0
  40. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge/cache.py +0 -0
  41. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge/generator.py +0 -0
  42. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge/models.py +0 -0
  43. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge/parser.py +0 -0
  44. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge/sources.py +0 -0
  45. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/__init__.py +0 -0
  46. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/aiohttp.yaml +0 -0
  47. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/attrs.yaml +0 -0
  48. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/celery.yaml +0 -0
  49. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/click.yaml +0 -0
  50. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/django.yaml +0 -0
  51. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/fastapi.yaml +0 -0
  52. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/flask.yaml +0 -0
  53. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/httpx.yaml +0 -0
  54. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/marshmallow.yaml +0 -0
  55. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/numpy.yaml +0 -0
  56. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/pandas.yaml +0 -0
  57. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/pydantic.yaml +0 -0
  58. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/pytest.yaml +0 -0
  59. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/requests.yaml +0 -0
  60. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/libraries/sqlalchemy.yaml +0 -0
  61. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/loader.py +0 -0
  62. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/knowledge_base/models.py +0 -0
  63. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/__init__.py +0 -0
  64. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/ast_transforms.py +0 -0
  65. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/engine.py +0 -0
  66. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/llm_migrator.py +0 -0
  67. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/__init__.py +0 -0
  68. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/aiohttp_transformer.py +0 -0
  69. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/attrs_transformer.py +0 -0
  70. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/celery_transformer.py +0 -0
  71. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/click_transformer.py +0 -0
  72. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/django_transformer.py +0 -0
  73. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/fastapi_transformer.py +0 -0
  74. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/flask_transformer.py +0 -0
  75. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/httpx_transformer.py +0 -0
  76. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/marshmallow_transformer.py +0 -0
  77. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/numpy_transformer.py +0 -0
  78. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/pandas_transformer.py +0 -0
  79. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/pydantic_v1_to_v2.py +0 -0
  80. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/pytest_transformer.py +0 -0
  81. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/requests_transformer.py +0 -0
  82. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/migrator/transforms/sqlalchemy_transformer.py +0 -0
  83. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/scanner/__init__.py +0 -0
  84. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/scanner/code_scanner.py +0 -0
  85. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/scanner/dependency_parser.py +0 -0
  86. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/utils/__init__.py +0 -0
  87. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/utils/api_client.py +0 -0
  88. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/utils/cache.py +0 -0
  89. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/utils/config.py +0 -0
  90. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/utils/llm_client.py +0 -0
  91. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/validator/__init__.py +0 -0
  92. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/validator/syntax_checker.py +0 -0
  93. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift/validator/test_runner.py +0 -0
  94. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift.egg-info/SOURCES.txt +0 -0
  95. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift.egg-info/dependency_links.txt +0 -0
  96. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift.egg-info/entry_points.txt +0 -0
  97. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift.egg-info/requires.txt +0 -0
  98. {codeshift-0.3.5 → codeshift-0.3.6}/codeshift.egg-info/top_level.txt +0 -0
  99. {codeshift-0.3.5 → codeshift-0.3.6}/setup.cfg +0 -0
  100. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_aiohttp_transforms.py +0 -0
  101. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_attrs_transforms.py +0 -0
  102. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_celery_transforms.py +0 -0
  103. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_click_transforms.py +0 -0
  104. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_code_scanner.py +0 -0
  105. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_django_transforms.py +0 -0
  106. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_fastapi_transforms.py +0 -0
  107. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_flask_transforms.py +0 -0
  108. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_httpx_transforms.py +0 -0
  109. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_knowledge_base.py +0 -0
  110. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_marshmallow_transforms.py +0 -0
  111. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_numpy_transforms.py +0 -0
  112. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_pandas_transforms.py +0 -0
  113. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_pydantic_transforms.py +0 -0
  114. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_pytest_transforms.py +0 -0
  115. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_requests_transforms.py +0 -0
  116. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_risk_assessor.py +0 -0
  117. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_sqlalchemy_transforms.py +0 -0
  118. {codeshift-0.3.5 → codeshift-0.3.6}/tests/test_syntax_checker.py +0 -0
@@ -0,0 +1,473 @@
1
+ Metadata-Version: 2.4
2
+ Name: codeshift
3
+ Version: 0.3.6
4
+ Summary: AI-powered CLI tool that migrates Python code to handle breaking dependency changes
5
+ Author: PyResolve Team
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Ragab-Technologies/Codeshift
8
+ Project-URL: Repository, https://github.com/Ragab-Technologies/Codeshift
9
+ Project-URL: Issues, https://github.com/Ragab-Technologies/Codeshift/issues
10
+ Keywords: migration,dependencies,ast,refactoring,pydantic
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: click>=8.0
23
+ Requires-Dist: libcst>=1.0
24
+ Requires-Dist: anthropic>=0.20
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: rich>=13.0
27
+ Requires-Dist: toml>=0.10
28
+ Requires-Dist: packaging>=23.0
29
+ Requires-Dist: httpx>=0.25
30
+ Requires-Dist: pytest>=8.4.2
31
+ Requires-Dist: nox>=2025.11.12
32
+ Requires-Dist: black>=24.10.0
33
+ Requires-Dist: mypy>=1.19.1
34
+ Requires-Dist: supabase>=2.27.2
35
+ Requires-Dist: pre-commit>=4.5.1
36
+ Provides-Extra: api
37
+ Requires-Dist: fastapi>=0.109.0; extra == "api"
38
+ Requires-Dist: uvicorn>=0.27.0; extra == "api"
39
+ Requires-Dist: supabase>=2.3.0; extra == "api"
40
+ Requires-Dist: stripe>=7.0.0; extra == "api"
41
+ Requires-Dist: pydantic-settings>=2.1.0; extra == "api"
42
+ Requires-Dist: email-validator>=2.0.0; extra == "api"
43
+ Provides-Extra: dev
44
+ Requires-Dist: pytest>=7.0; extra == "dev"
45
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
46
+ Requires-Dist: black<25.0,>=24.0; extra == "dev"
47
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
48
+ Requires-Dist: mypy>=1.0; extra == "dev"
49
+ Requires-Dist: nox>=2024.0; extra == "dev"
50
+ Requires-Dist: pre-commit>=3.6.0; extra == "dev"
51
+ Requires-Dist: types-toml>=0.10; extra == "dev"
52
+ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
53
+ Provides-Extra: all
54
+ Requires-Dist: codeshift[api,dev]; extra == "all"
55
+ Dynamic: license-file
56
+
57
+ # Codeshift
58
+
59
+ [![CI](https://github.com/Ragab-Technologies/Codeshift/actions/workflows/ci.yml/badge.svg)](https://github.com/Ragab-Technologies/Codeshift/actions/workflows/ci.yml)
60
+ [![PyPI version](https://badge.fury.io/py/codeshift.svg)](https://pypi.org/project/codeshift/)
61
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
62
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
63
+
64
+ **Don't just flag the update. Fix the break.**
65
+
66
+ Codeshift is an AI-powered CLI tool that migrates Python code when dependencies are upgraded. Unlike Dependabot or Renovate which only bump version numbers, Codeshift rewrites your code to be compatible with new library APIs.
67
+
68
+ ## Why Codeshift?
69
+
70
+ Upgrading a dependency often means updating dozens of call sites to match a new API. Codeshift automates that:
71
+
72
+ - **Scans** your project for outdated dependencies
73
+ - **Detects** breaking changes from changelogs and migration guides
74
+ - **Rewrites** your code using deterministic AST transforms or LLM assistance
75
+ - **Shows** a detailed diff with explanations before touching any file
76
+
77
+ ## Features
78
+
79
+ - **Deterministic AST transforms** for 15 popular libraries (no LLM required)
80
+ - **Auto-generated knowledge bases** - fetches changelogs and migration guides from GitHub, parses them with an LLM to detect breaking changes
81
+ - **Tiered migration engine** - deterministic transforms first, KB-guided LLM second, pure LLM fallback last
82
+ - **Confidence-based change detection** - shows HIGH/MEDIUM/LOW confidence breaking changes before migration
83
+ - **Beautiful diff output** with per-change explanations
84
+ - **Backup and restore** so you can safely revert
85
+ - **Batch upgrades** - migrate all outdated dependencies in one command
86
+
87
+ ## Supported Libraries
88
+
89
+ ### Tier 1 (Deterministic AST Transforms - Free, No LLM Required)
90
+
91
+ | Library | Migration Path | Status |
92
+ |---------|---------------|--------|
93
+ | Pydantic | v1 → v2 | Supported |
94
+ | FastAPI | 0.x → 0.100+ | Supported |
95
+ | SQLAlchemy | 1.4 → 2.0 | Supported |
96
+ | Pandas | 1.x → 2.x | Supported |
97
+ | Requests | Various | Supported |
98
+ | Django | 3.x → 4.x/5.x | Supported |
99
+ | Flask | 1.x → 2.x/3.x | Supported |
100
+ | NumPy | 1.x → 2.x | Supported |
101
+ | attrs | attr → attrs | Supported |
102
+ | Celery | 4.x → 5.x | Supported |
103
+ | Click | 7.x → 8.x | Supported |
104
+ | aiohttp | 2.x → 3.x | Supported |
105
+ | httpx | 0.x → 0.24+ | Supported |
106
+ | Marshmallow | 2.x → 3.x | Supported |
107
+ | pytest | 6.x → 7.x/8.x | Supported |
108
+
109
+ ### Any Library (Auto-Generated Knowledge Base)
110
+
111
+ Codeshift can migrate **any Python library** by automatically fetching changelogs from GitHub and detecting breaking changes. For libraries not in Tier 1, it uses KB-guided or pure LLM migration.
112
+
113
+ ## Installation
114
+
115
+ ```bash
116
+ pip install codeshift
117
+ ```
118
+
119
+ For development:
120
+
121
+ ```bash
122
+ pip install codeshift[dev]
123
+ ```
124
+
125
+ Verify the installation:
126
+
127
+ ```bash
128
+ codeshift --help
129
+ ```
130
+
131
+ ## Quick Start
132
+
133
+ ```bash
134
+ # 1. Scan your project for outdated dependencies
135
+ codeshift scan
136
+
137
+ # 2. Upgrade a specific library
138
+ codeshift upgrade pydantic --target 2.5.0
139
+
140
+ # 3. Review the proposed changes
141
+ codeshift diff
142
+
143
+ # 4. Apply the changes
144
+ codeshift apply
145
+
146
+ # 5. Run your tests to verify
147
+ pytest
148
+ ```
149
+
150
+ Or upgrade everything at once:
151
+
152
+ ```bash
153
+ codeshift upgrade-all
154
+ ```
155
+
156
+ ### Example Output
157
+
158
+ ```
159
+ $ codeshift upgrade pydantic --target 2.5.0
160
+
161
+ ╭──────────────────────── Codeshift Migration ─────────────────────────╮
162
+ │ Upgrading Pydantic to version 2.5.0 │
163
+ │ Migration guide: https://docs.pydantic.dev/latest/migration/ │
164
+ ╰──────────────────────────────────────────────────────────────────────╯
165
+
166
+ Fetching knowledge sources...
167
+ ✓ GitHub: CHANGELOG.md
168
+ ✓ GitHub: docs/migration.md
169
+
170
+ Breaking changes detected:
171
+
172
+ HIGH CONFIDENCE:
173
+ ├── .dict() → .model_dump()
174
+ ├── @validator → @field_validator
175
+ └── class Config → model_config = ConfigDict()
176
+
177
+ MEDIUM CONFIDENCE:
178
+ ├── .json() → .model_dump_json()
179
+ └── parse_obj() → model_validate()
180
+
181
+ Scanning for library usage...
182
+ Found 12 imports from pydantic
183
+ Found 45 usages of pydantic symbols
184
+
185
+ ┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┓
186
+ ┃ File ┃ Changes ┃ Status ┃
187
+ ┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━┩
188
+ │ src/models/user.py │ 5 │ Ready │
189
+ │ src/api/schemas.py │ 3 │ Ready │
190
+ └────────────────────┴─────────┴────────┘
191
+
192
+ Total: 8 changes across 2 files
193
+ ```
194
+
195
+ ## Commands
196
+
197
+ ### `codeshift scan`
198
+
199
+ Scan your project for outdated dependencies and available migrations.
200
+
201
+ ```bash
202
+ codeshift scan [OPTIONS]
203
+
204
+ Options:
205
+ --path, -p PATH Path to scan (default: current directory)
206
+ --fetch-changes Fetch changelogs and detect breaking changes
207
+ --major-only Only show major version upgrades
208
+ --json-output Output results as JSON
209
+ --verbose, -v Show detailed output
210
+ ```
211
+
212
+ Example:
213
+
214
+ ```
215
+ $ codeshift scan
216
+
217
+ Found 13 dependencies
218
+
219
+ Outdated Dependencies (5)
220
+ ┏━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━━┓
221
+ ┃ Package ┃ Current ┃ Latest ┃ Type ┃ Tier ┃
222
+ ┡━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━━┩
223
+ │ pydantic │ 1.0 │ 2.5.0 │ Major │ Tier 1 │
224
+ │ rich │ 13.0 │ 14.0.0 │ Major │ Tier 2/3 │
225
+ └────────────┴─────────┴────────┴───────┴──────────┘
226
+
227
+ Suggested Migrations (2)
228
+ pydantic 1.0 → 2.5.0 (Tier 1 - deterministic)
229
+ rich 13.0 → 14.0.0 (Tier 2/3 - LLM-assisted)
230
+
231
+ Quick commands:
232
+ codeshift upgrade pydantic --target 2.5.0
233
+ codeshift upgrade rich --target 14.0.0
234
+ ```
235
+
236
+ ### `codeshift upgrade`
237
+
238
+ Analyze your codebase and propose changes for a specific library upgrade.
239
+
240
+ ```bash
241
+ codeshift upgrade <library> --target <version> [OPTIONS]
242
+
243
+ Arguments:
244
+ LIBRARY Library name to upgrade (required)
245
+
246
+ Options:
247
+ --target, -t VERSION Target version to upgrade to (required)
248
+ --path, -p PATH Path to analyze (default: current directory)
249
+ --file, -f PATH Analyze a single file instead of the entire project
250
+ --dry-run Show what would be changed without saving state
251
+ --verbose, -v Show detailed output
252
+ ```
253
+
254
+ ### `codeshift upgrade-all`
255
+
256
+ Upgrade all outdated packages to their latest versions in one go.
257
+
258
+ ```bash
259
+ codeshift upgrade-all [OPTIONS]
260
+
261
+ Options:
262
+ --path, -p PATH Path to analyze (default: current directory)
263
+ --all Include all outdated packages (not just Tier 1)
264
+ --tier1-only Only upgrade Tier 1 libraries (deterministic transforms)
265
+ --major-only Only perform major version upgrades
266
+ --include, -i LIB Only include specific libraries (repeatable)
267
+ --exclude, -e LIB Exclude specific libraries (repeatable)
268
+ --update-deps Update dependency files with new versions (default: yes)
269
+ --no-update-deps Skip updating dependency files
270
+ --dry-run Show what would be changed without saving state
271
+ --verbose, -v Show detailed output
272
+ ```
273
+
274
+ ### `codeshift diff`
275
+
276
+ View the detailed diff of proposed changes.
277
+
278
+ ```bash
279
+ codeshift diff [OPTIONS]
280
+
281
+ Options:
282
+ --path, -p PATH Path to the project (default: current directory)
283
+ --file, -f FILE Show diff for a specific file only
284
+ --no-color Disable colored output
285
+ --context, -c INT Number of context lines (default: 3)
286
+ --summary Show only a summary without the full diff
287
+ ```
288
+
289
+ ### `codeshift show`
290
+
291
+ Show the full transformed or original code for a file.
292
+
293
+ ```bash
294
+ codeshift show <file_path> [OPTIONS]
295
+
296
+ Arguments:
297
+ FILE_PATH File to display (required)
298
+
299
+ Options:
300
+ --path, -p PATH Path to the project (default: current directory)
301
+ --original Show the original code instead of the transformed version
302
+ ```
303
+
304
+ ### `codeshift apply`
305
+
306
+ Apply the proposed changes to your files.
307
+
308
+ ```bash
309
+ codeshift apply [OPTIONS]
310
+
311
+ Options:
312
+ --path, -p PATH Path to the project (default: current directory)
313
+ --file, -f FILE Apply changes to a specific file only
314
+ --backup Create .bak backup files before applying changes
315
+ --yes, -y Skip confirmation prompt
316
+ --validate Validate syntax after applying (default: yes)
317
+ --no-validate Skip syntax validation
318
+ ```
319
+
320
+ ### `codeshift reset`
321
+
322
+ Cancel the current migration and clear all pending changes.
323
+
324
+ ```bash
325
+ codeshift reset [OPTIONS]
326
+
327
+ Options:
328
+ --path, -p PATH Path to the project (default: current directory)
329
+ --yes, -y Skip confirmation prompt
330
+ ```
331
+
332
+ ### `codeshift restore`
333
+
334
+ Restore files from a backup created by `apply --backup`.
335
+
336
+ ```bash
337
+ codeshift restore <backup_dir> [OPTIONS]
338
+
339
+ Arguments:
340
+ BACKUP_DIR Path to backup directory (required)
341
+
342
+ Options:
343
+ --path, -p PATH Path to the project (default: current directory)
344
+ --yes, -y Skip confirmation prompt
345
+ ```
346
+
347
+ ### `codeshift libraries`
348
+
349
+ List all supported libraries and their migration paths.
350
+
351
+ ```bash
352
+ codeshift libraries
353
+ ```
354
+
355
+ ### `codeshift status`
356
+
357
+ Show current migration status, pending changes, and quota info.
358
+
359
+ ```bash
360
+ codeshift status [OPTIONS]
361
+
362
+ Options:
363
+ --path, -p PATH Path to the project (default: current directory)
364
+ ```
365
+
366
+ ### Account Commands
367
+
368
+ ```bash
369
+ codeshift login # Login to enable cloud features
370
+ codeshift register # Create a new account
371
+ codeshift logout # Logout and remove credentials
372
+ codeshift whoami # Show current user info
373
+ codeshift quota # Show usage and limits
374
+ codeshift upgrade-plan # View or upgrade your plan
375
+ codeshift billing # Open billing portal
376
+ ```
377
+
378
+ ## How It Works
379
+
380
+ ```
381
+ ┌─────────────────────────────────────────────────────────────────────┐
382
+ │ Knowledge Acquisition Pipeline │
383
+ │ ┌─────────────┐ ┌──────────────────┐ ┌─────────────────────┐ │
384
+ │ │ Local Cache │──▶│ On-Demand Gen │──▶│ LLM Parser │ │
385
+ │ │ (instant) │ │ (fetches sources)│ │ (breaking changes) │ │
386
+ │ └─────────────┘ └──────────────────┘ └─────────────────────┘ │
387
+ │ │ │
388
+ │ ┌───────────────┴───────────────┐ │
389
+ │ │ Source Fetchers │ │
390
+ │ │ ├── GitHub (CHANGELOG.md) │ │
391
+ │ │ ├── Docs (migration guides) │ │
392
+ │ │ └── Release notes │ │
393
+ │ └───────────────────────────────┘ │
394
+ └─────────────────────────────────────────────────────────────────────┘
395
+
396
+
397
+ ┌─────────────────────────────────────────────────────────────────────┐
398
+ │ Migration Engine (Tiered) │
399
+ │ Tier 1: AST Transforms │ Tier 2: KB-Guided │ Tier 3: LLM │
400
+ │ (deterministic) │ (context + LLM) │ (fallback) │
401
+ └─────────────────────────────────────────────────────────────────────┘
402
+ ```
403
+
404
+ 1. **Fetch Knowledge** - discovers and fetches changelogs, migration guides from GitHub/PyPI
405
+ 2. **Parse Changes** - uses an LLM to extract breaking changes with confidence levels (HIGH/MEDIUM/LOW)
406
+ 3. **Scan Codebase** - finds imports and usage of the target library using libcst
407
+ 4. **Tiered Migration**:
408
+ - **Tier 1**: deterministic AST transforms for 15 supported libraries - no LLM needed
409
+ - **Tier 2**: knowledge base guided migration with LLM assistance
410
+ - **Tier 3**: pure LLM migration for unknown patterns
411
+ 5. **Validate** - runs syntax checks on the transformed code
412
+ 6. **Report** - shows a detailed diff with explanations for each change
413
+
414
+ ## Pydantic v1 → v2 Example
415
+
416
+ Codeshift handles the following Pydantic migrations automatically:
417
+
418
+ | v1 Pattern | v2 Replacement |
419
+ |---|---|
420
+ | `Config` class | `model_config = ConfigDict(...)` |
421
+ | `@validator` | `@field_validator` with `@classmethod` |
422
+ | `@root_validator` | `@model_validator` |
423
+ | `.dict()` | `.model_dump()` |
424
+ | `.json()` | `.model_dump_json()` |
425
+ | `.schema()` | `.model_json_schema()` |
426
+ | `.parse_obj()` | `.model_validate()` |
427
+ | `orm_mode = True` | `from_attributes = True` |
428
+ | `Field(regex=...)` | `Field(pattern=...)` |
429
+
430
+ ## Configuration
431
+
432
+ Codeshift can be configured via `pyproject.toml`:
433
+
434
+ ```toml
435
+ [tool.codeshift]
436
+ # Path patterns to exclude from scanning
437
+ exclude = ["tests/*", "migrations/*"]
438
+
439
+ # Enable/disable LLM fallback
440
+ use_llm = true
441
+
442
+ # Anthropic API key (can also use ANTHROPIC_API_KEY env var)
443
+ # anthropic_api_key = "sk-..."
444
+ ```
445
+
446
+ ## Environment Variables
447
+
448
+ | Variable | Required | Description |
449
+ |---|---|---|
450
+ | `ANTHROPIC_API_KEY` | For Tier 2/3 | Enables LLM-powered migrations |
451
+ | `GITHUB_TOKEN` | No | Higher GitHub API rate limits |
452
+
453
+ ## Pricing
454
+
455
+ | Tier | Price | What You Get |
456
+ |------|-------|--------------|
457
+ | **Free** | $0/month | Tier 1 deterministic transforms for all 15 supported libraries. Runs entirely locally. |
458
+ | **Pro** | $19/month | Tier 2 KB-guided LLM migrations for any library |
459
+ | **Unlimited** | $49/month | Tier 3 pure LLM migrations + priority support |
460
+
461
+ ```bash
462
+ # Login to access Pro/Unlimited features
463
+ codeshift login
464
+
465
+ # Check your current plan and usage
466
+ codeshift quota
467
+ ```
468
+
469
+ ## License
470
+
471
+ This software is licensed under the [MIT License](LICENSE).
472
+
473
+ You are free to use, modify, and distribute this software. The CLI tool and all transforms are fully open source.