code-assembler-pro 4.2.1__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.
- code_assembler_pro-4.2.1/PKG-INFO +263 -0
- code_assembler_pro-4.2.1/README.md +236 -0
- code_assembler_pro-4.2.1/pyproject.toml +60 -0
- code_assembler_pro-4.2.1/setup.cfg +4 -0
- code_assembler_pro-4.2.1/src/code_assembler/__init__.py +16 -0
- code_assembler_pro-4.2.1/src/code_assembler/__main__.py +23 -0
- code_assembler_pro-4.2.1/src/code_assembler/analyzers.py +152 -0
- code_assembler_pro-4.2.1/src/code_assembler/cli.py +148 -0
- code_assembler_pro-4.2.1/src/code_assembler/config.py +136 -0
- code_assembler_pro-4.2.1/src/code_assembler/constants.py +203 -0
- code_assembler_pro-4.2.1/src/code_assembler/core.py +278 -0
- code_assembler_pro-4.2.1/src/code_assembler/file_io.py +83 -0
- code_assembler_pro-4.2.1/src/code_assembler/formatters.py +136 -0
- code_assembler_pro-4.2.1/src/code_assembler/interactive.py +433 -0
- code_assembler_pro-4.2.1/src/code_assembler/templates/components/architecture.md.j2 +23 -0
- code_assembler_pro-4.2.1/src/code_assembler/templates/components/file_block.md.j2 +8 -0
- code_assembler_pro-4.2.1/src/code_assembler/templates/components/readme_context.md.j2 +5 -0
- code_assembler_pro-4.2.1/src/code_assembler/templates/components/stats_table.md.j2 +26 -0
- code_assembler_pro-4.2.1/src/code_assembler/templates/components/toc.md.j2 +5 -0
- code_assembler_pro-4.2.1/src/code_assembler/templates/main_header.md.j2 +100 -0
- code_assembler_pro-4.2.1/src/code_assembler/utils.py +110 -0
- code_assembler_pro-4.2.1/src/code_assembler_pro.egg-info/PKG-INFO +263 -0
- code_assembler_pro-4.2.1/src/code_assembler_pro.egg-info/SOURCES.txt +29 -0
- code_assembler_pro-4.2.1/src/code_assembler_pro.egg-info/dependency_links.txt +1 -0
- code_assembler_pro-4.2.1/src/code_assembler_pro.egg-info/entry_points.txt +2 -0
- code_assembler_pro-4.2.1/src/code_assembler_pro.egg-info/requires.txt +2 -0
- code_assembler_pro-4.2.1/src/code_assembler_pro.egg-info/top_level.txt +1 -0
- code_assembler_pro-4.2.1/tests/test_core.py +110 -0
- code_assembler_pro-4.2.1/tests/test_file_io.py +41 -0
- code_assembler_pro-4.2.1/tests/test_interactive.py +164 -0
- code_assembler_pro-4.2.1/tests/test_utils.py +59 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code-assembler-pro
|
|
3
|
+
Version: 4.2.1
|
|
4
|
+
Summary: Consolidate your codebase into structured Markdown context for LLMs (Claude, GPT, Gemini).
|
|
5
|
+
Author-email: Xavier Mehaut <xavier.mehaut@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/xmehaut/code-assembler-pro
|
|
8
|
+
Project-URL: Documentation, https://github.com/xmehaut/code-assembler-pro#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/xmehaut/code-assembler-pro
|
|
10
|
+
Project-URL: Issues, https://github.com/xmehaut/code-assembler-pro/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/xmehaut/code-assembler-pro/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: llm,context,codebase,markdown,ai-engineering,prompt-engineering
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
20
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
21
|
+
Classifier: Intended Audience :: Developers
|
|
22
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: chardet>=5.0.0
|
|
26
|
+
Requires-Dist: jinja2>=3.1.0
|
|
27
|
+
|
|
28
|
+
# 🏛️ Code Assembler Pro
|
|
29
|
+
|
|
30
|
+
> **Turn your codebase into structured, LLM-ready context with one command.**
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+

|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
**Code Assembler Pro** is a high-grade engineering utility designed to bridge the gap between your source code and Large Language Models (Claude 3.5, GPT-4o, Gemini 1.5).
|
|
37
|
+
|
|
38
|
+
It doesn't just concatenate files; it generates a **contextual technical document** optimized for LLM ingestion, preserving project structure, identifying architectural patterns, and managing token limits through intelligent truncation.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 🎯 Why Code Assembler Pro?
|
|
43
|
+
|
|
44
|
+
Copy-pasting raw files into a chat window leads to context loss (who calls what? where is this file located?).
|
|
45
|
+
|
|
46
|
+
**Code Assembler Pro solves this by:**
|
|
47
|
+
1. **🗺️ Project Mapping:** Automatically generates a clickable Table of Contents and architectural overview.
|
|
48
|
+
2. **✂️ Smart Token Management:** Estimates token costs and **intelligently truncates** large files (keeping imports and class definitions) instead of ignoring them.
|
|
49
|
+
3. **🛡️ Noise Filtering:** Automatically excludes binaries, build artifacts (`node_modules`, `venv`), and sensitive secrets.
|
|
50
|
+
4. **🎨 Jinja2 Templating:** Uses a clean separation between data and presentation for perfectly formatted Markdown.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## ✨ Key Features
|
|
55
|
+
|
|
56
|
+
- **🧠 Architecture Analysis:** Detects design patterns (MVC, API, Testing structures) and provides file distribution stats.
|
|
57
|
+
- **📊 Token Metrics:** Real-time estimation of token count to stay within model limits.
|
|
58
|
+
- **🔌 Dual Interface:** Use it as a powerful CLI tool or integrate it as a Python library.
|
|
59
|
+
- **📝 Multi-Language Support:** Syntax highlighting for 50+ extensions (.py, .rs, .ts, .go, .toml, etc.).
|
|
60
|
+
- **ℹ️ README Integration:** Automatically injects local READMEs into the flow to provide folder-level context to the AI.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🚀 Installation
|
|
65
|
+
|
|
66
|
+
Clone the repository and install in editable mode:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/yourusername/code-assembler-pro.git
|
|
70
|
+
cd code-assembler-pro
|
|
71
|
+
pip install -e .
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
*Dependencies: `chardet`, `jinja2`.*
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 💻 Quick Start (CLI)
|
|
79
|
+
|
|
80
|
+
Once installed, the `code-assembler` command is available globally in your environment.
|
|
81
|
+
|
|
82
|
+
### 1. Basic Usage
|
|
83
|
+
Consolidate all Python and Markdown files in the current directory:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
code-assembler . --ext py md
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 2. Targeted Usage
|
|
90
|
+
Exclude tests, target a specific source folder, and define a custom output:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
code-assembler ./src \
|
|
94
|
+
--ext py js ts \
|
|
95
|
+
--exclude tests legacy \
|
|
96
|
+
--output project_context.md
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## ⚙️ Advanced Configuration (JSON)
|
|
102
|
+
|
|
103
|
+
For complex projects, use a JSON configuration file (`assembler_config.json`) for full control:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"paths": ["./src", "./docs"],
|
|
108
|
+
"extensions": [".py", ".ts", ".tsx", ".sql"],
|
|
109
|
+
"exclude_patterns": [
|
|
110
|
+
"migrations",
|
|
111
|
+
"__pycache__",
|
|
112
|
+
"*.test.ts"
|
|
113
|
+
],
|
|
114
|
+
"output": "full_stack_context.md",
|
|
115
|
+
"recursive": true,
|
|
116
|
+
"include_readmes": true,
|
|
117
|
+
"max_file_size_mb": 2.0,
|
|
118
|
+
"truncate_large_files": true,
|
|
119
|
+
"truncation_limit_lines": 500
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Run it using:
|
|
124
|
+
```bash
|
|
125
|
+
code-assembler --config assembler_config.json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 📖 Configuration Options Reference
|
|
129
|
+
|
|
130
|
+
| Option | Type | Description | Default |
|
|
131
|
+
|--------|------|-------------|---------|
|
|
132
|
+
| **`paths`** | `List` | Root directories or files to analyze. | **Required** |
|
|
133
|
+
| **`extensions`** | `List` | File extensions to include (e.g., `[".py", ".js"]`). | **Required** |
|
|
134
|
+
| **`output`** | `str` | Name of the generated Markdown file. | `"codebase.md"` |
|
|
135
|
+
| **`exclude_patterns`** | `List` | Patterns to ignore (e.g., `"tests"`, `"build/"`). | `[]` |
|
|
136
|
+
| **`recursive`** | `bool` | Whether to traverse subdirectories. | `true` |
|
|
137
|
+
| **`include_readmes`** | `bool` | Automatically include `README.md` for folder context. | `true` |
|
|
138
|
+
| **`max_file_size_mb`** | `float` | Size limit before a file is truncated or skipped. | `10.0` |
|
|
139
|
+
| **`truncate_large_files`** | `bool` | **(v4.1)** If true, cuts large files instead of skipping them. | `true` |
|
|
140
|
+
| **`truncation_limit_lines`** | `int` | **(v4.1)** Number of lines to keep when truncating. | `500` |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 📦 Python Library Usage
|
|
145
|
+
|
|
146
|
+
Integrate the assembler directly into your automation scripts or CI/CD pipelines:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from code_assembler import assemble_codebase
|
|
150
|
+
|
|
151
|
+
# Configure and execute
|
|
152
|
+
markdown_content = assemble_codebase(
|
|
153
|
+
paths=["./src"],
|
|
154
|
+
extensions=[".py"],
|
|
155
|
+
output="ai_docs.md",
|
|
156
|
+
truncate_large_files=True,
|
|
157
|
+
truncation_limit_lines=200,
|
|
158
|
+
show_progress=True
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
print(f"Generated context: {len(markdown_content)} characters.")
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 🧙♂️ Interactive Mode (New!)
|
|
167
|
+
|
|
168
|
+
**Don't want to remember CLI arguments?** Use the interactive wizard!
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
code-assembler --interactive
|
|
172
|
+
# or
|
|
173
|
+
code-assembler -i
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The wizard will guide you through:
|
|
177
|
+
1. 📂 **Path selection** - Choose directories or specific files
|
|
178
|
+
2. 📝 **Extension presets** - Python, JS/TS, Rust, Go, Java, C/C++, or custom
|
|
179
|
+
3. 🚫 **Smart exclusions** - Use defaults or add custom patterns
|
|
180
|
+
4. 💾 **Output config** - Name your file, auto-detect conflicts
|
|
181
|
+
5. ⚙️ **Advanced options** - Truncation, recursion, README inclusion
|
|
182
|
+
|
|
183
|
+
**Example session:**
|
|
184
|
+
```
|
|
185
|
+
🚀 Code Assembler Pro - Interactive Mode
|
|
186
|
+
═════════════════════════════════════════════════════
|
|
187
|
+
|
|
188
|
+
🎯 Step 1: Select Paths to Analyze
|
|
189
|
+
──────────────────────────────────────────────────────
|
|
190
|
+
You can analyze:
|
|
191
|
+
1. Current directory (.)
|
|
192
|
+
2. Specific directory/directories
|
|
193
|
+
3. Specific files
|
|
194
|
+
|
|
195
|
+
Your choice [1-3]: 1
|
|
196
|
+
✅ Selected: current directory
|
|
197
|
+
|
|
198
|
+
🎯 Step 2: Select File Extensions
|
|
199
|
+
──────────────────────────────────────────────────────
|
|
200
|
+
Common presets:
|
|
201
|
+
1. Python projects (.py)
|
|
202
|
+
2. Python + Config + Docs (.py, .md, .toml, .yaml)
|
|
203
|
+
3. JavaScript/TypeScript (.js, .ts, .jsx, .tsx)
|
|
204
|
+
...
|
|
205
|
+
|
|
206
|
+
Your choice [1-8]: 2
|
|
207
|
+
✅ Selected: Python + Config + Docs
|
|
208
|
+
|
|
209
|
+
... [wizard continues]
|
|
210
|
+
|
|
211
|
+
🎯 Configuration Summary
|
|
212
|
+
──────────────────────────────────────────────────────
|
|
213
|
+
📂 Paths: .
|
|
214
|
+
📝 Extensions: .py, .md, .toml, .yaml
|
|
215
|
+
💾 Output: codebase.md
|
|
216
|
+
🔧 Recursive: True
|
|
217
|
+
✂️ Truncate large files: True (keep first 500 lines)
|
|
218
|
+
|
|
219
|
+
🚀 Start assembly? [Y/n]: y
|
|
220
|
+
|
|
221
|
+
💾 Save this configuration for future use? [y/N]: y
|
|
222
|
+
✅ Configuration saved to: assembler_config.json
|
|
223
|
+
Reuse it with: code-assembler --config assembler_config.json
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
👉 **[Full Interactive Mode Guide](INTERACTIVE_MODE.md)**
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## 💡 Recommended Use Cases
|
|
231
|
+
|
|
232
|
+
### 1. Onboarding & Audit
|
|
233
|
+
> *"Analyze this codebase and summarize the architecture, then list potential technical debt."*
|
|
234
|
+
👉 Provide the generated `codebase.md` to Claude/GPT-4.
|
|
235
|
+
|
|
236
|
+
### 2. Massive Refactoring
|
|
237
|
+
> *"I want to migrate this module from `requests` to `httpx`. Here is the relevant code. Propose a migration plan."*
|
|
238
|
+
👉 Target specific folders to reduce noise and stay within token limits.
|
|
239
|
+
|
|
240
|
+
### 3. Complex Debugging
|
|
241
|
+
> *"I have a circular import error between these three files. Find the root cause and fix it."*
|
|
242
|
+
👉 The tool preserves import structures, making it easy for the AI to trace dependencies.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## 🤝 Contributing
|
|
247
|
+
|
|
248
|
+
Contributions are welcome!
|
|
249
|
+
1. Fork the Project.
|
|
250
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`).
|
|
251
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`).
|
|
252
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`).
|
|
253
|
+
5. Open a Pull Request.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## 📄 License
|
|
258
|
+
|
|
259
|
+
Distributed under the MIT License. See `LICENSE` for more information.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
**Code Assembler Pro** — *Give your AI the context it deserves.*
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# 🏛️ Code Assembler Pro
|
|
2
|
+
|
|
3
|
+
> **Turn your codebase into structured, LLM-ready context with one command.**
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
**Code Assembler Pro** is a high-grade engineering utility designed to bridge the gap between your source code and Large Language Models (Claude 3.5, GPT-4o, Gemini 1.5).
|
|
10
|
+
|
|
11
|
+
It doesn't just concatenate files; it generates a **contextual technical document** optimized for LLM ingestion, preserving project structure, identifying architectural patterns, and managing token limits through intelligent truncation.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 🎯 Why Code Assembler Pro?
|
|
16
|
+
|
|
17
|
+
Copy-pasting raw files into a chat window leads to context loss (who calls what? where is this file located?).
|
|
18
|
+
|
|
19
|
+
**Code Assembler Pro solves this by:**
|
|
20
|
+
1. **🗺️ Project Mapping:** Automatically generates a clickable Table of Contents and architectural overview.
|
|
21
|
+
2. **✂️ Smart Token Management:** Estimates token costs and **intelligently truncates** large files (keeping imports and class definitions) instead of ignoring them.
|
|
22
|
+
3. **🛡️ Noise Filtering:** Automatically excludes binaries, build artifacts (`node_modules`, `venv`), and sensitive secrets.
|
|
23
|
+
4. **🎨 Jinja2 Templating:** Uses a clean separation between data and presentation for perfectly formatted Markdown.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## ✨ Key Features
|
|
28
|
+
|
|
29
|
+
- **🧠 Architecture Analysis:** Detects design patterns (MVC, API, Testing structures) and provides file distribution stats.
|
|
30
|
+
- **📊 Token Metrics:** Real-time estimation of token count to stay within model limits.
|
|
31
|
+
- **🔌 Dual Interface:** Use it as a powerful CLI tool or integrate it as a Python library.
|
|
32
|
+
- **📝 Multi-Language Support:** Syntax highlighting for 50+ extensions (.py, .rs, .ts, .go, .toml, etc.).
|
|
33
|
+
- **ℹ️ README Integration:** Automatically injects local READMEs into the flow to provide folder-level context to the AI.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 🚀 Installation
|
|
38
|
+
|
|
39
|
+
Clone the repository and install in editable mode:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/yourusername/code-assembler-pro.git
|
|
43
|
+
cd code-assembler-pro
|
|
44
|
+
pip install -e .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
*Dependencies: `chardet`, `jinja2`.*
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 💻 Quick Start (CLI)
|
|
52
|
+
|
|
53
|
+
Once installed, the `code-assembler` command is available globally in your environment.
|
|
54
|
+
|
|
55
|
+
### 1. Basic Usage
|
|
56
|
+
Consolidate all Python and Markdown files in the current directory:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
code-assembler . --ext py md
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 2. Targeted Usage
|
|
63
|
+
Exclude tests, target a specific source folder, and define a custom output:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
code-assembler ./src \
|
|
67
|
+
--ext py js ts \
|
|
68
|
+
--exclude tests legacy \
|
|
69
|
+
--output project_context.md
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## ⚙️ Advanced Configuration (JSON)
|
|
75
|
+
|
|
76
|
+
For complex projects, use a JSON configuration file (`assembler_config.json`) for full control:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"paths": ["./src", "./docs"],
|
|
81
|
+
"extensions": [".py", ".ts", ".tsx", ".sql"],
|
|
82
|
+
"exclude_patterns": [
|
|
83
|
+
"migrations",
|
|
84
|
+
"__pycache__",
|
|
85
|
+
"*.test.ts"
|
|
86
|
+
],
|
|
87
|
+
"output": "full_stack_context.md",
|
|
88
|
+
"recursive": true,
|
|
89
|
+
"include_readmes": true,
|
|
90
|
+
"max_file_size_mb": 2.0,
|
|
91
|
+
"truncate_large_files": true,
|
|
92
|
+
"truncation_limit_lines": 500
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Run it using:
|
|
97
|
+
```bash
|
|
98
|
+
code-assembler --config assembler_config.json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 📖 Configuration Options Reference
|
|
102
|
+
|
|
103
|
+
| Option | Type | Description | Default |
|
|
104
|
+
|--------|------|-------------|---------|
|
|
105
|
+
| **`paths`** | `List` | Root directories or files to analyze. | **Required** |
|
|
106
|
+
| **`extensions`** | `List` | File extensions to include (e.g., `[".py", ".js"]`). | **Required** |
|
|
107
|
+
| **`output`** | `str` | Name of the generated Markdown file. | `"codebase.md"` |
|
|
108
|
+
| **`exclude_patterns`** | `List` | Patterns to ignore (e.g., `"tests"`, `"build/"`). | `[]` |
|
|
109
|
+
| **`recursive`** | `bool` | Whether to traverse subdirectories. | `true` |
|
|
110
|
+
| **`include_readmes`** | `bool` | Automatically include `README.md` for folder context. | `true` |
|
|
111
|
+
| **`max_file_size_mb`** | `float` | Size limit before a file is truncated or skipped. | `10.0` |
|
|
112
|
+
| **`truncate_large_files`** | `bool` | **(v4.1)** If true, cuts large files instead of skipping them. | `true` |
|
|
113
|
+
| **`truncation_limit_lines`** | `int` | **(v4.1)** Number of lines to keep when truncating. | `500` |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 📦 Python Library Usage
|
|
118
|
+
|
|
119
|
+
Integrate the assembler directly into your automation scripts or CI/CD pipelines:
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from code_assembler import assemble_codebase
|
|
123
|
+
|
|
124
|
+
# Configure and execute
|
|
125
|
+
markdown_content = assemble_codebase(
|
|
126
|
+
paths=["./src"],
|
|
127
|
+
extensions=[".py"],
|
|
128
|
+
output="ai_docs.md",
|
|
129
|
+
truncate_large_files=True,
|
|
130
|
+
truncation_limit_lines=200,
|
|
131
|
+
show_progress=True
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
print(f"Generated context: {len(markdown_content)} characters.")
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## 🧙♂️ Interactive Mode (New!)
|
|
140
|
+
|
|
141
|
+
**Don't want to remember CLI arguments?** Use the interactive wizard!
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
code-assembler --interactive
|
|
145
|
+
# or
|
|
146
|
+
code-assembler -i
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The wizard will guide you through:
|
|
150
|
+
1. 📂 **Path selection** - Choose directories or specific files
|
|
151
|
+
2. 📝 **Extension presets** - Python, JS/TS, Rust, Go, Java, C/C++, or custom
|
|
152
|
+
3. 🚫 **Smart exclusions** - Use defaults or add custom patterns
|
|
153
|
+
4. 💾 **Output config** - Name your file, auto-detect conflicts
|
|
154
|
+
5. ⚙️ **Advanced options** - Truncation, recursion, README inclusion
|
|
155
|
+
|
|
156
|
+
**Example session:**
|
|
157
|
+
```
|
|
158
|
+
🚀 Code Assembler Pro - Interactive Mode
|
|
159
|
+
═════════════════════════════════════════════════════
|
|
160
|
+
|
|
161
|
+
🎯 Step 1: Select Paths to Analyze
|
|
162
|
+
──────────────────────────────────────────────────────
|
|
163
|
+
You can analyze:
|
|
164
|
+
1. Current directory (.)
|
|
165
|
+
2. Specific directory/directories
|
|
166
|
+
3. Specific files
|
|
167
|
+
|
|
168
|
+
Your choice [1-3]: 1
|
|
169
|
+
✅ Selected: current directory
|
|
170
|
+
|
|
171
|
+
🎯 Step 2: Select File Extensions
|
|
172
|
+
──────────────────────────────────────────────────────
|
|
173
|
+
Common presets:
|
|
174
|
+
1. Python projects (.py)
|
|
175
|
+
2. Python + Config + Docs (.py, .md, .toml, .yaml)
|
|
176
|
+
3. JavaScript/TypeScript (.js, .ts, .jsx, .tsx)
|
|
177
|
+
...
|
|
178
|
+
|
|
179
|
+
Your choice [1-8]: 2
|
|
180
|
+
✅ Selected: Python + Config + Docs
|
|
181
|
+
|
|
182
|
+
... [wizard continues]
|
|
183
|
+
|
|
184
|
+
🎯 Configuration Summary
|
|
185
|
+
──────────────────────────────────────────────────────
|
|
186
|
+
📂 Paths: .
|
|
187
|
+
📝 Extensions: .py, .md, .toml, .yaml
|
|
188
|
+
💾 Output: codebase.md
|
|
189
|
+
🔧 Recursive: True
|
|
190
|
+
✂️ Truncate large files: True (keep first 500 lines)
|
|
191
|
+
|
|
192
|
+
🚀 Start assembly? [Y/n]: y
|
|
193
|
+
|
|
194
|
+
💾 Save this configuration for future use? [y/N]: y
|
|
195
|
+
✅ Configuration saved to: assembler_config.json
|
|
196
|
+
Reuse it with: code-assembler --config assembler_config.json
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
👉 **[Full Interactive Mode Guide](INTERACTIVE_MODE.md)**
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 💡 Recommended Use Cases
|
|
204
|
+
|
|
205
|
+
### 1. Onboarding & Audit
|
|
206
|
+
> *"Analyze this codebase and summarize the architecture, then list potential technical debt."*
|
|
207
|
+
👉 Provide the generated `codebase.md` to Claude/GPT-4.
|
|
208
|
+
|
|
209
|
+
### 2. Massive Refactoring
|
|
210
|
+
> *"I want to migrate this module from `requests` to `httpx`. Here is the relevant code. Propose a migration plan."*
|
|
211
|
+
👉 Target specific folders to reduce noise and stay within token limits.
|
|
212
|
+
|
|
213
|
+
### 3. Complex Debugging
|
|
214
|
+
> *"I have a circular import error between these three files. Find the root cause and fix it."*
|
|
215
|
+
👉 The tool preserves import structures, making it easy for the AI to trace dependencies.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## 🤝 Contributing
|
|
220
|
+
|
|
221
|
+
Contributions are welcome!
|
|
222
|
+
1. Fork the Project.
|
|
223
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`).
|
|
224
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`).
|
|
225
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`).
|
|
226
|
+
5. Open a Pull Request.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## 📄 License
|
|
231
|
+
|
|
232
|
+
Distributed under the MIT License. See `LICENSE` for more information.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
**Code Assembler Pro** — *Give your AI the context it deserves.*
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "code-assembler-pro"
|
|
3
|
+
version = "4.2.1"
|
|
4
|
+
description = "Consolidate your codebase into structured Markdown context for LLMs (Claude, GPT, Gemini)."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.9"
|
|
7
|
+
|
|
8
|
+
# On revient au format "table" pour forcer la compatibilité Metadata 2.1
|
|
9
|
+
license = {text = "MIT"}
|
|
10
|
+
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Xavier Mehaut", email = "xavier.mehaut@gmail.com"}
|
|
13
|
+
]
|
|
14
|
+
keywords = ["llm", "context", "codebase", "markdown", "ai-engineering", "prompt-engineering"]
|
|
15
|
+
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
# SUPPRIMÉ : "License :: OSI Approved :: MIT License" (déprécié ici)
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Topic :: Software Development :: Documentation",
|
|
25
|
+
"Topic :: Text Processing :: Markup :: Markdown",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"Development Status :: 5 - Production/Stable",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
dependencies = [
|
|
31
|
+
"chardet>=5.0.0",
|
|
32
|
+
"jinja2>=3.1.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/xmehaut/code-assembler-pro"
|
|
37
|
+
Documentation = "https://github.com/xmehaut/code-assembler-pro#readme"
|
|
38
|
+
Repository = "https://github.com/xmehaut/code-assembler-pro"
|
|
39
|
+
Issues = "https://github.com/xmehaut/code-assembler-pro/issues"
|
|
40
|
+
Changelog = "https://github.com/xmehaut/code-assembler-pro/blob/main/CHANGELOG.md"
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
# This creates the 'code-assembler' command in the terminal after installation
|
|
44
|
+
code-assembler = "code_assembler.cli:main"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools]
|
|
47
|
+
package-dir = {"" = "src"}
|
|
48
|
+
# On désactive la détection automatique des fichiers de licence
|
|
49
|
+
# pour éviter que setuptools n'ajoute le champ 'license-file' qui bugue
|
|
50
|
+
license-files = []
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["src"]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.package-data]
|
|
56
|
+
code_assembler = ["templates/*.j2", "templates/components/*.j2"]
|
|
57
|
+
|
|
58
|
+
[tool.pytest.ini_options]
|
|
59
|
+
testpaths = ["tests"]
|
|
60
|
+
python_files = "test_*.py"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Code Assembler Pro - A tool for consolidating source code for LLM analysis.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .core import assemble_codebase, assemble_from_config
|
|
6
|
+
from .config import AssemblerConfig
|
|
7
|
+
from .constants import __version__
|
|
8
|
+
from .interactive import run_interactive_mode
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"assemble_codebase",
|
|
12
|
+
"assemble_from_config",
|
|
13
|
+
"AssemblerConfig",
|
|
14
|
+
"run_interactive_mode",
|
|
15
|
+
"__version__",
|
|
16
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Entry point for the code_assembler package execution.
|
|
3
|
+
"""
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
# Calculate the 'src' directory path (one level above this file)
|
|
8
|
+
src_path = str(Path(__file__).resolve().parent.parent)
|
|
9
|
+
|
|
10
|
+
# Add it to the Python search path if it's not already there
|
|
11
|
+
if src_path not in sys.path:
|
|
12
|
+
sys.path.insert(0, src_path)
|
|
13
|
+
|
|
14
|
+
# Now perform an ABSOLUTE import (without the dot)
|
|
15
|
+
# This works because 'src' is in the path, making 'code_assembler' visible
|
|
16
|
+
try:
|
|
17
|
+
from code_assembler.cli import main
|
|
18
|
+
except ImportError:
|
|
19
|
+
# Fallback for when the package is already properly installed via pip
|
|
20
|
+
from .cli import main
|
|
21
|
+
|
|
22
|
+
if __name__ == "__main__":
|
|
23
|
+
main()
|