ContextStrategies
CLI tool for flattening code repositories to markdown, AI-assisted code focusing, patching, and static analysis.
Executive Summary
Challenge: Prepare massive codebases for LLM consumption—raw repos overwhelm context windows with noise (node_modules, build artifacts, redundant code). Approach: Built comprehensive analysis toolkit with Clean Architecture—Domain layer handles scanning/flattening with gitignore intelligence, Application layer orchestrates processing pipelines, Infrastructure abstracts AI clients and storage. Content cleaning pipeline strips comments, normalizes whitespace, deduplicates code blocks. AI-powered scope selection uses pydantic_ai to intelligently focus on relevant files for specific queries. AST-based patching workflow extracts target scopes, generates modifications via LLM, applies changes safely. Multi-faceted analysis includes architecture validation (layer violations), code smell detection, cyclomatic complexity metrics, duplicate code identification, security pattern scanning, and dependency mapping. Golden testing framework captures AI responses for regression validation. Interfaces: Unified Typer CLI with server fallback, Textual TUI with split panes, Streamlit dashboard for history visualization, FastAPI HTTP server for remote access. DuckDB analytics backend. Innovation: BaseAnalyzer with caching prevents redundant processing; unified interface abstracts deployment modes (local/server/TUI).
The Challenge
Automating codebase flattening, analysis, and AI-assisted refinement for large repositories.
The Solution
Content cleaners, BaseAnalyzer caching, golden AI tests. Domain layer independent of infra. Unified CLI with Server Fallback.
System Architecture
Key Features
Repository Flattening
AI Scope Selection & Focusing
Code Patching
Static Code Analysis
Duplicate Code Detection
Dependency Mapping
History Dashboard
TUI Interface
Technical Skills Matrix
Technologies
Business Value
- Automates manual workflows
- Improves consistency & quality
- Scalable architecture design
See Also
Stageflow
Stageflow is a full-stack portfolio application featuring a Next.js frontend and multiple Go microservices for automated website scanning and accessibility auditing with Axe. It targets developers showcasing advanced engineering skills in distributed systems.
Clear11y
Clear11y is a Python-based tool for scanning websites or ZIP archives of static sites to detect accessibility violations via Axe rules and custom keyboard navigation checks. It generates consolidated HTML reports with Jinja templates.