Skip to content

Commit 601c569

Browse files
clanker-loverclaude
andcommitted
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>
1 parent 84a467e commit 601c569

1 file changed

Lines changed: 37 additions & 8 deletions

File tree

README.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ Every piece of code becomes a **block** that shows:
2020

2121
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.
2222

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+
2336
## Who it's for
2437

2538
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
114127

115128
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.
116129

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+
117145
## Current status
118146

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
127156

128157
## License
129158

0 commit comments

Comments
 (0)