Skip to content

Commit 174bb7f

Browse files
author
Lukas Geiger
committed
feat: add codecommander structural python tools
1 parent 8bb6aba commit 174bb7f

17 files changed

Lines changed: 2276 additions & 52 deletions

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## Unreleased
5+
## [1.3.13] - 2026-06-22
66

77
### Added
88
- Add BACH-derived `cc_check_indentation` for Python indentation diagnostics.
99
- Add BACH-derived `cc_generate_python_code` for template-based Python code snippets.
10+
- Extend `cc_extract_classes` with optional pycutter-style inline class/helper content for LLM context packaging.
11+
- Extend `cc_analyze_methods` with BACH-derived guardrails for missing signal callbacks, self-attributes used before definition, and underscore method mismatches.
12+
- Add BACH-derived `cc_runtime_import_diagnose` for isolated Python runtime import checks, `__init__.py` analysis, and circular-import hints.
13+
- Add BACH-derived `cc_python_structural_edit` for structural Python edits with preview, test-file, syntax-check and backup safety modes.
1014
- Replace Spanish, Simplified Chinese, Japanese, and Russian i18n fallbacks with maintained CodeCommander translations.
11-
- Update README, README_de, llms.txt, server metadata, i18n and security notes for 19 developer tools.
12-
- Extend the local Vitest suite to 154 tests.
15+
- Update README, README_de, llms.txt, server metadata, i18n and security notes for 21 developer tools.
16+
- Extend the local Vitest suite to 167 tests.
1317

1418
## [1.3.12] - 2026-06-17
1519

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
[![CodeCommander tests](https://github.com/ellmos-ai/ellmos-codecommander-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/ellmos-ai/ellmos-codecommander-mcp/actions/workflows/tests.yml)
1313
[![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg)](https://nodejs.org/)
1414

15-
A developer-focused **Model Context Protocol (MCP) server** that gives AI assistants code analysis, JSON repair, encoding fix, import organization, format conversion, file diff, and regex testing capabilities.
15+
A developer-focused **Model Context Protocol (MCP) server** that gives AI assistants code analysis, structural Python editing, JSON repair, encoding fix, import organization, format conversion, file diff, and regex testing capabilities.
1616

17-
**19 tools** optimized for developers - the coding companion to [FileCommander](https://github.com/ellmos-ai/ellmos-filecommander-mcp).
17+
**21 tools** optimized for developers - the coding companion to [FileCommander](https://github.com/ellmos-ai/ellmos-filecommander-mcp).
1818

1919
**Discoverability:** Published on [npm](https://www.npmjs.com/package/ellmos-codecommander-mcp) as `ellmos-codecommander-mcp`, visible on [Glama](https://glama.ai/mcp/servers/b9kjs4uaav), and prepared for the official MCP Registry with [`server.json`](server.json) under `io.github.ellmos-ai/ellmos-codecommander-mcp`.
2020

@@ -25,7 +25,7 @@ A developer-focused **Model Context Protocol (MCP) server** that gives AI assist
2525
While FileCommander handles filesystem operations, CodeCommander focuses on **code intelligence**:
2626

2727
- **Python Code Analysis** - AST-based class/method extraction, complexity metrics, import analysis
28-
- **BACH-derived Python Helpers** - indentation diagnostics and template-based code generation
28+
- **BACH-derived Python Helpers** - runtime import diagnostics, structural edits, indentation checks, and template-based code generation
2929
- **JSON Repair** - Fix broken JSON automatically (trailing commas, single quotes, BOM, comments)
3030
- **Import Organization** - Sort and deduplicate Python imports per PEP 8
3131
- **Encoding Fix** - Repair Mojibake and double-encoded UTF-8 (27+ patterns)
@@ -121,15 +121,16 @@ FileCommander and CodeCommander are designed to work side by side:
121121
| Tool | Description |
122122
|------|-------------|
123123
| `cc_analyze_code` | Full code analysis: classes, functions, imports, LOC, complexity |
124-
| `cc_analyze_methods` | Detailed method analysis: params, decorators, visibility, data flow |
125-
| `cc_extract_classes` | Extract Python classes/functions as separate text blocks |
124+
| `cc_analyze_methods` | Detailed method analysis: params, decorators, visibility, data flow, BACH guardrails |
125+
| `cc_extract_classes` | Extract Python classes/functions as separate text blocks, optionally including pycutter-style inline content |
126126

127-
### Import Management (2 tools)
127+
### Import Management (3 tools)
128128

129129
| Tool | Description |
130130
|------|-------------|
131131
| `cc_organize_imports` | Sort & deduplicate Python imports per PEP 8 |
132132
| `cc_diagnose_imports` | Detect unused imports, duplicates, circular import risks |
133+
| `cc_runtime_import_diagnose` | Run isolated Python runtime imports with timeouts, __init__.py analysis, and circular-import hints |
133134

134135
### JSON Tools (2 tools)
135136

@@ -166,12 +167,13 @@ FileCommander and CodeCommander are designed to work side by side:
166167
| `cc_diff_files` | Compare two files with unified diff output (configurable context lines) |
167168
| `cc_regex_test` | Test regex patterns against text/files with match details, groups, and replace preview |
168169

169-
### Python Assistance (2 tools)
170+
### Python Assistance (3 tools)
170171

171172
| Tool | Description |
172173
|------|-------------|
173174
| `cc_check_indentation` | Detect missing colons, unindented return/yield statements, and mixed tab/space indentation |
174175
| `cc_generate_python_code` | Generate Python functions, classes, dataclasses, CLI stubs, tests, exceptions, and modules from templates |
176+
| `cc_python_structural_edit` | Inspect and apply structural Python edits with preview, test-file, syntax-check and backup modes |
175177

176178
### Export (2 tools)
177179

@@ -180,7 +182,7 @@ FileCommander and CodeCommander are designed to work side by side:
180182
| `cc_md_to_html` | Markdown to standalone HTML with CSS styling (headers, code blocks, tables, nested lists, blockquotes, images, checkboxes) |
181183
| `cc_md_to_pdf` | Markdown to PDF via headless browser (Edge/Chrome). Falls back to HTML if no browser is available |
182184

183-
**Total: 19 developer tools** (`cc_set_language` is also available for runtime language switching)
185+
**Total: 21 developer tools** (`cc_set_language` is also available for runtime language switching)
184186

185187
---
186188

@@ -211,7 +213,7 @@ All tools use the `cc_` prefix (CodeCommander) to avoid conflicts with FileComma
211213
See [SECURITY.md](SECURITY.md) for detailed security information.
212214

213215
Key points:
214-
- All file-modifying tools support `dry_run` mode
216+
- File-modifying tools support preview/dry-run modes where applicable
215217
- Backup creation is enabled by default for destructive operations
216218
- No built-in sandboxing - security is delegated to the MCP client
217219
- Designed for local development use via stdio transport
@@ -230,7 +232,7 @@ npm test # Run test suite (vitest)
230232

231233
### Testing
232234

233-
The project includes a comprehensive test suite with **154 tests** covering all 19 developer tools and i18n behavior.
235+
The project includes a comprehensive test suite covering all 21 developer tools and i18n behavior.
234236

235237
```bash
236238
npm test # Run all tests

README_de.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
[![CodeCommander tests](https://github.com/ellmos-ai/ellmos-codecommander-mcp/actions/workflows/tests.yml/badge.svg)](https://github.com/ellmos-ai/ellmos-codecommander-mcp/actions/workflows/tests.yml)
1414
[![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg)](https://nodejs.org/)
1515

16-
Ein entwicklerfokussierter **Model Context Protocol (MCP) Server**, der KI-Assistenten Fähigkeiten für Code-Analyse, JSON-Reparatur, Encoding-Korrektur, Import-Organisation, Formatkonvertierung, Datei-Vergleich und Regex-Tests verleiht.
16+
Ein entwicklerfokussierter **Model Context Protocol (MCP) Server**, der KI-Assistenten Fähigkeiten für Code-Analyse, strukturelles Python-Editing, JSON-Reparatur, Encoding-Korrektur, Import-Organisation, Formatkonvertierung, Datei-Vergleich und Regex-Tests verleiht.
1717

18-
**19 Tools** optimiert für Entwickler – das Coding-Gegenstück zu [FileCommander](https://github.com/ellmos-ai/ellmos-filecommander-mcp).
18+
**21 Tools** optimiert für Entwickler – das Coding-Gegenstück zu [FileCommander](https://github.com/ellmos-ai/ellmos-filecommander-mcp).
1919

2020
**Auffindbarkeit:** Veröffentlicht auf [npm](https://www.npmjs.com/package/ellmos-codecommander-mcp) als `ellmos-codecommander-mcp`, auf [Glama](https://glama.ai/mcp/servers/b9kjs4uaav) sichtbar und mit [`server.json`](server.json) für die offizielle MCP Registry unter `io.github.ellmos-ai/ellmos-codecommander-mcp` vorbereitet.
2121

@@ -26,7 +26,7 @@ Ein entwicklerfokussierter **Model Context Protocol (MCP) Server**, der KI-Assis
2626
Während FileCommander Dateisystem-Operationen übernimmt, konzentriert sich CodeCommander auf **Code-Intelligenz**:
2727

2828
- **Python Code-Analyse** – AST-basierte Klassen-/Methodenextraktion, Komplexitätsmetriken, Import-Analyse
29-
- **BACH-abgeleitete Python-Helfer**Einrückungsdiagnose und Template-basierte Codegenerierung
29+
- **BACH-abgeleitete Python-Helfer**Runtime-Importdiagnose, strukturelle Edits, Einrückungsprüfung und Template-basierte Codegenerierung
3030
- **JSON-Reparatur** – Automatische Korrektur von fehlerhaftem JSON (Trailing Commas, einfache Anführungszeichen, BOM, Kommentare)
3131
- **Import-Organisation** – Python-Imports sortieren und deduplizieren gemäß PEP 8
3232
- **Encoding-Korrektur** – Reparatur von Mojibake und doppelt kodiertem UTF-8 (27+ Muster)
@@ -122,15 +122,16 @@ FileCommander und CodeCommander sind für den parallelen Einsatz konzipiert:
122122
| Tool | Beschreibung |
123123
|------|-------------|
124124
| `cc_analyze_code` | Vollständige Code-Analyse: Klassen, Funktionen, Imports, LOC, Komplexität |
125-
| `cc_analyze_methods` | Detaillierte Methodenanalyse: Parameter, Decorators, Sichtbarkeit, Datenfluss |
126-
| `cc_extract_classes` | Python-Klassen/-Funktionen als separate Textblöcke extrahieren |
125+
| `cc_analyze_methods` | Detaillierte Methodenanalyse: Parameter, Decorators, Sichtbarkeit, Datenfluss, BACH-Prüfungen |
126+
| `cc_extract_classes` | Python-Klassen/-Funktionen als separate Textblöcke extrahieren, optional mit pycutter-artigem Inline-Inhalt |
127127

128-
### Import-Verwaltung (2 Tools)
128+
### Import-Verwaltung (3 Tools)
129129

130130
| Tool | Beschreibung |
131131
|------|-------------|
132132
| `cc_organize_imports` | Python-Imports sortieren & deduplizieren gemäß PEP 8 |
133133
| `cc_diagnose_imports` | Ungenutzte Imports, Duplikate und zirkuläre Import-Risiken erkennen |
134+
| `cc_runtime_import_diagnose` | Python-Runtime-Imports isoliert mit Timeouts, __init__.py-Analyse und Zirkularitäts-Hinweisen prüfen |
134135

135136
### JSON-Tools (2 Tools)
136137

@@ -167,12 +168,13 @@ FileCommander und CodeCommander sind für den parallelen Einsatz konzipiert:
167168
| `cc_diff_files` | Zwei Dateien vergleichen mit Unified-Diff-Ausgabe (konfigurierbare Kontextzeilen) |
168169
| `cc_regex_test` | Regex-Muster gegen Text/Dateien testen mit Match-Details, Gruppen und Ersetzungsvorschau |
169170

170-
### Python-Assistenz (2 Tools)
171+
### Python-Assistenz (3 Tools)
171172

172173
| Tool | Beschreibung |
173174
|------|-------------|
174175
| `cc_check_indentation` | Fehlende Doppelpunkte, unindentierte return/yield-Zeilen und gemischte Tab-/Leerzeichen-Einrückung erkennen |
175176
| `cc_generate_python_code` | Python-Funktionen, Klassen, Dataclasses, CLI-Stubs, Tests, Exceptions und Module aus Templates erzeugen |
177+
| `cc_python_structural_edit` | Strukturelle Python-Edits mit Vorschau, Testdatei, Syntaxprüfung und Backup-Modus prüfen und anwenden |
176178

177179
### Export (2 Tools)
178180

@@ -181,7 +183,7 @@ FileCommander und CodeCommander sind für den parallelen Einsatz konzipiert:
181183
| `cc_md_to_html` | Markdown zu eigenständigem HTML mit CSS-Styling (Überschriften, Code-Blöcke, Tabellen, verschachtelte Listen, Zitate, Bilder, Checkboxen) |
182184
| `cc_md_to_pdf` | Markdown zu PDF über Headless-Browser (Edge/Chrome). Fallback auf HTML wenn kein Browser verfügbar |
183185

184-
**Gesamt: 19 Entwickler-Tools** (`cc_set_language` ist zusätzlich für Sprachumschaltung verfügbar)
186+
**Gesamt: 21 Entwickler-Tools** (`cc_set_language` ist zusätzlich für Sprachumschaltung verfügbar)
185187

186188
---
187189

@@ -212,7 +214,7 @@ Alle Tools verwenden das Präfix `cc_` (CodeCommander), um Konflikte mit dem `fc
212214
Siehe [SECURITY.md](SECURITY.md) für detaillierte Sicherheitsinformationen.
213215

214216
Wichtige Punkte:
215-
- Alle dateiverändernden Tools unterstützen den `dry_run`-Modus
217+
- Dateiverändernde Tools unterstützen Vorschau-/Dry-run-Modi, wo anwendbar
216218
- Backup-Erstellung ist standardmäßig bei destruktiven Operationen aktiviert
217219
- Kein integriertes Sandboxing – die Sicherheit wird an den MCP-Client delegiert
218220
- Konzipiert für die lokale Entwicklungsnutzung über stdio-Transport
@@ -231,7 +233,7 @@ npm test # Tests ausführen (vitest)
231233

232234
### Tests
233235

234-
Das Projekt enthält eine umfassende Test-Suite mit **154 Tests** für alle 19 Entwickler-Tools und i18n-Verhalten.
236+
Das Projekt enthält eine umfassende Test-Suite für alle 21 Entwickler-Tools und i18n-Verhalten.
235237

236238
```bash
237239
npm test # Alle Tests ausführen

SECURITY.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ ellmos CodeCommander MCP Server is a developer tool that analyzes and modifies s
1717
| `cc_convert_format` | Creates files | Converts between formats |
1818
| `cc_md_to_html` | Creates files | Generates HTML output |
1919
| `cc_md_to_pdf` | Creates files | Generates PDF output |
20+
| `cc_python_structural_edit` | Modifies Python source when `mode=apply` | Defaults to preview; supports syntax checks, test-file output and backups |
21+
22+
### Runtime Diagnostic Tools
23+
| Tool | Risk | Description |
24+
|------|------|-------------|
25+
| `cc_runtime_import_diagnose` | Executes target-project imports in isolated Python subprocesses | CodeCommander writes no files, but imported Python modules may run top-level side effects; use explicit `modules`, short timeouts and trusted project paths |
2026

2127
### Low Risk Tools (Read-Only)
2228
| Tool | Description |
2329
|------|-------------|
2430
| `cc_analyze_code` | Reads and analyzes code |
25-
| `cc_analyze_methods` | Reads and analyzes methods |
26-
| `cc_extract_classes` | Reads and extracts class info |
31+
| `cc_analyze_methods` | Reads and analyzes methods, callbacks and self-attribute order |
32+
| `cc_extract_classes` | Reads and extracts class info; creates files only when `output_dir` is set |
2733
| `cc_diagnose_imports` | Reads and diagnoses imports |
2834
| `cc_check_indentation` | Reads and checks Python indentation |
2935
| `cc_generate_python_code` | Generates text output only |
@@ -36,8 +42,9 @@ ellmos CodeCommander MCP Server is a developer tool that analyzes and modifies s
3642

3743
## Recommendations
3844

39-
- All file-modifying tools support `dry_run` and/or `create_backup` options
40-
- Use `dry_run=true` to preview changes before applying
45+
- File-modifying tools support `dry_run`, `mode=preview` and/or `create_backup` options
46+
- Preview changes before applying (`dry_run=true` or `mode=preview`)
47+
- Treat runtime import diagnostics as code execution of the inspected project
4148
- Review changes before deploying to production
4249
- This server is designed for local development use via stdio transport
4350

llms.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# ellmos-codecommander-mcp - MCP Server for Code Intelligence
22

3-
> CodeCommander is a developer-focused MCP (Model Context Protocol) server that gives AI assistants code analysis, JSON repair, encoding fix, import organization, Python indentation checks, code generation, format conversion, file diff, and regex testing capabilities. 19 tools optimized for developers -- the coding companion to FileCommander in the ellmos MCP family.
3+
> CodeCommander is a developer-focused MCP (Model Context Protocol) server that gives AI assistants code analysis, pycutter-style Python context extraction, JSON repair, encoding fix, import organization, Python runtime import diagnostics, structural Python editing, indentation checks, code generation, format conversion, file diff, and regex testing capabilities. 21 tools optimized for developers -- the coding companion to FileCommander in the ellmos MCP family.
44

5-
Core capabilities: Python AST-based class/method extraction with complexity metrics and import analysis, BACH-derived indentation diagnostics and Python code generation templates, JSON repair (trailing commas, single quotes, BOM, comments), PEP 8 import sorting and deduplication, Mojibake/double-encoded UTF-8 repair (27+ patterns), German umlaut repair (70+ patterns), format conversion across JSON / CSV / INI / YAML / TOML / XML / TOON, unified diff output (LCS algorithm), regex tester with match details and replace preview, Markdown-to-HTML/PDF export with code blocks, tables, nested lists, and blockquotes. Cross-platform: Windows, macOS, Linux.
5+
Core capabilities: Python AST-based class/method extraction with complexity metrics, BACH-derived method guardrails, import analysis, runtime import diagnostics in isolated Python subprocesses, structural Python edits with preview/test/apply modes, optional inline class/helper blocks for LLM context packaging, BACH-derived indentation diagnostics and Python code generation templates, JSON repair (trailing commas, single quotes, BOM, comments), PEP 8 import sorting and deduplication, Mojibake/double-encoded UTF-8 repair (27+ patterns), German umlaut repair (70+ patterns), format conversion across JSON / CSV / INI / YAML / TOML / XML / TOON, unified diff output (LCS algorithm), regex tester with match details and replace preview, Markdown-to-HTML/PDF export with code blocks, tables, nested lists, and blockquotes. Cross-platform: Windows, macOS, Linux.
66

77
Node.js >= 18, MIT. Published as `ellmos-codecommander-mcp` on npm. Visible on Glama at `https://glama.ai/mcp/servers/b9kjs4uaav`. MCP Registry metadata is provided in `server.json` for the namespace `io.github.ellmos-ai/ellmos-codecommander-mcp`.
88

@@ -46,7 +46,7 @@ Python AST class method extraction MCP
4646
JSON repair encoding fix MCP server
4747
ellmos-ai MCP developer tools
4848
Claude Code MCP code analysis import organization
49-
BACH Python indentation checker code generator MCP
49+
BACH Python runtime import diagnose structural edit indentation checker code generator MCP
5050
regex tester format conversion markdown PDF MCP
5151
```
5252

0 commit comments

Comments
 (0)