You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update README for Phase 7: code replacement, architecture section
Add Code actions table documenting all four buttons, Replace Code
explanation, Architecture section showing module layout, and update
test count/status to reflect current state.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+37-8Lines changed: 37 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,19 @@ Every piece of code becomes a **block** that shows:
20
20
21
21
Blocks are **nested** — directories contain files, files contain classes, classes contain functions. Click to drill down. Breadcrumbs to navigate back up. Color-coded by language.
22
22
23
+
### Code actions
24
+
25
+
Every analyzed block gets a toolbar with one-click actions:
26
+
27
+
| Button | What it does |
28
+
|--------|-------------|
29
+
|**Show Code**| Expand/collapse the source code inline |
30
+
|**Export Code**| Copy raw source to clipboard |
31
+
|**Copy for AI**| Copy source wrapped in a markdown code fence with context (block name, file path) — ready to paste into an AI assistant |
32
+
|**Replace Code**| Open an editor to paste modified code back into the source file |
33
+
34
+
**Replace Code** (available on functions, methods, and classes) lets you paste fixed or improved code — from an AI assistant, a code review, or your own edits — directly back into the original file. A `.bak` backup is created automatically before any write. The UI shows a confirmation step with success/error feedback, and all cached analysis is cleared so the block can be re-analyzed with the new code.
35
+
23
36
## Who it's for
24
37
25
38
You understand systems. You can read a schematic. You just can't read Python.
@@ -114,16 +127,32 @@ Each block shows a quality badge based on static analysis, with warnings that ex
114
127
115
128
Warnings roll up through the tree: a file inherits the worst quality of its functions, and a directory inherits the worst quality of its files. Each level shows a count of problematic children (e.g., "Contains 2 high-risk functions"). Quality scoring works for all supported languages — Python files also get [radon](https://radon.readthedocs.io/) cyclomatic complexity analysis.
116
129
130
+
## Architecture
131
+
132
+
```
133
+
codedocent/
134
+
├── cli.py Command-line interface and entry point
135
+
├── scanner.py File discovery with .gitignore support
136
+
├── parser.py AST parsing via tree-sitter
137
+
├── analyzer.py AI summaries, quality scoring, caching
138
+
├── editor.py Code replacement with backup safety
139
+
├── renderer.py HTML generation (static + interactive)
140
+
├── server.py Local server for interactive mode
141
+
└── templates/
142
+
└── interactive.html Single-page app UI
143
+
```
144
+
117
145
## Current status
118
146
119
-
- ✅ Scanner, parser, renderer, analyzer, server, CLI — all built and tested
120
-
- ✅ Interactive navigation with lazy AI analysis
121
-
- ✅ Static HTML full-analysis mode with parallel workers
122
-
- ✅ Code export — Show Code, Export Code, Copy for AI
123
-
- ✅ Quality scoring with two-tier thresholds and warning rollup across the tree
124
-
- ✅ pip-installable package with `codedocent` CLI entry point
125
-
- ✅ 65 tests passing
126
-
- ✅ Code quality: pylint 10/10, bandit/flake8/mypy all clean
147
+
- Scanner, parser, renderer, analyzer, editor, server, CLI — all built and tested
148
+
- Interactive navigation with lazy AI analysis
149
+
- Static HTML full-analysis mode with parallel workers
150
+
- Code actions — Show Code, Export Code, Copy for AI, Replace Code
151
+
- Code replacement with `.bak` backup and cache invalidation
152
+
- Quality scoring with two-tier thresholds and warning rollup across the tree
153
+
- pip-installable package with `codedocent` CLI entry point
154
+
- 75 tests passing
155
+
- Code quality: pylint 10/10, bandit/flake8/mypy all clean
0 commit comments