91 lines
2.9 KiB
Markdown
91 lines
2.9 KiB
Markdown
# Improvements for AnchorCli
|
|
|
|
This document contains criticisms and suggestions for improving the AnchorCli project.
|
|
|
|
## Architecture
|
|
|
|
1. **Program.cs is too large (433 lines)** - Split into smaller classes: ChatSession, ReplLoop, ResponseStreamer
|
|
2. **No dependency injection** - Use Microsoft.Extensions.DependencyInjection for testability
|
|
3. **Static tool classes with global Log delegates** - Convert to instance classes with injected ILogger
|
|
|
|
## Testing
|
|
|
|
4. **No unit tests** - Add xUnit project, test HashlineEncoder/Validator, tools, and ContextCompactor
|
|
5. **No integration tests** - Use Spectre.Console.Testing for TUI workflows
|
|
6. **No CI/CD** - Add GitHub Actions for test runs on push/PR
|
|
|
|
## Documentation
|
|
|
|
7. **Missing XML docs** - Add summary docs to public APIs
|
|
8. **Incomplete README** - Add contributing, development, troubleshooting sections
|
|
9. **No CHANGELOG.md** - Track releases and changes
|
|
|
|
## Security & Safety
|
|
|
|
10. **Command execution unsandboxed** - Add allowlist/denylist, time limits, output size limits
|
|
11. **No mutation rate limiting** - Track edits per turn, add configurable limits
|
|
12. **API key in plain text** - Use OS keychain or env var, set restrictive file permissions
|
|
|
|
## Performance
|
|
|
|
13. **No file read caching** - Cache file content per-turn with invalidation on write
|
|
14. **Regex not static** - Make compiled regexes static readonly
|
|
|
|
## User Experience
|
|
|
|
15. **No undo** - Store edit history, add /undo command
|
|
16. **No session persistence** - Add /save and /load commands
|
|
17. **Limited error recovery** - Better error messages, /debug mode
|
|
|
|
## Developer Experience
|
|
|
|
18. **No .editorconfig** - Add code style enforcement
|
|
19. **No solution file** - Create AnchorCli.sln
|
|
20. **Hardcoded model list** - Fetch from OpenRouter API dynamically
|
|
21. **No version info** - Add <Version> to .csproj, display in /help
|
|
|
|
## Code Quality
|
|
|
|
22. **Inconsistent error handling** - Standardize on error strings, avoid empty catch blocks
|
|
23. **Magic numbers** - Extract to named constants (150_000, 300, KeepRecentTurns=2)
|
|
24. **Commented-out debug code** - Remove or use #if DEBUG
|
|
25. **Weak hash algorithm** - Adler-8 XOR only has 256 values; consider 4-char hex
|
|
|
|
## Build & Dependencies
|
|
|
|
26. **No LICENSE file** - Add MIT LICENSE file
|
|
|
|
## Priority
|
|
|
|
### High
|
|
- [ ] Add unit tests
|
|
- [ ] Implement undo functionality
|
|
- [ ] Add mutation rate limiting
|
|
- [x] Refactor Program.cs
|
|
- [x] Add LICENSE file
|
|
|
|
### Medium
|
|
- [ ] Session persistence
|
|
- [ ] XML documentation
|
|
- [ ] Error handling consistency
|
|
- [x] .editorconfig
|
|
- [ ] Dynamic model list
|
|
|
|
### Low
|
|
- [ ] CHANGELOG.md
|
|
- [ ] CI/CD pipeline
|
|
- [ ] Stronger hash algorithm
|
|
- [ ] Code coverage reporting
|
|
|
|
## Quick Wins (<1 hour each)
|
|
|
|
- [x] Add <Version> to .csproj
|
|
- [x] Create LICENSE file
|
|
- [x] Add .editorconfig
|
|
- [x] Remove commented code
|
|
- [x] Extract magic numbers to constants
|
|
- [x] Add XML docs to Hashline classes
|
|
- [x] Make regexes static readonly
|
|
|
|
*Prioritize based on goals: safety, testability, or user experience.*
|