count_files – Project Structure Intelligence
Comprehensive project structure analysis with architectural insights and intelligent file discovery patterns
Perfect For
New Project Onboarding
Rapidly understand unfamiliar codebases with detailed directory structure analysis and technology stack identification.
Architecture Documentation
Generate professional project documentation with file organisation patterns and development workflow insights.
Technical Debt Assessment
Identify organisational issues, oversized directories, and structural improvements with detailed metrics analysis.
Team Onboarding Documentation
Create clear project overviews for new developers with file counts, technology identification, and navigation guidance.
Project Health Monitoring
Track project growth patterns, identify bloat, and monitor file organisation quality over time.
Quick Start
local-llm:count_files with:
- projectPath: "C:/my-react-app"
- maxDepth: 3
- analysisType: "comprehensive"
Focused directory analysis:
local-llm:count_files with:
- projectPath: "C:/project/src"
- maxDepth: 4
- analysisDepth: "detailed"
Analysis Output
Project Structure Visualisation
- Interactive Directory Tree: Beautiful markdown tree structure with emoji indicators and file counts
- File Type Classification: Automatic categorisation of JavaScript, TypeScript, CSS, configuration, and documentation files
- Size Analysis: Directory size metrics with largest file identification and bloat detection
Architectural Intelligence
- Technology Stack Detection: Framework identification through package.json, configuration files, and import patterns
- Development Pattern Analysis: Component architecture, module organisation, and development workflow insights
- Configuration Assessment: Build tool detection, environment configuration, and deployment setup analysis
Project Health Metrics
- Organisation Quality Score: Directory structure assessment with improvement recommendations
- Complexity Indicators: Nested directory depth analysis and structural complexity metrics
- Growth Pattern Analysis: File distribution patterns and potential scalability concerns
Example Output
Project Structure
📁 my-react-app/
├── 📁 src/ (45 files)
│ ├── 📁 components/ (12 files)
│ │ ├── 📄 Header.tsx
│ │ ├── 📄 UserCard.tsx
│ │ └── 📄 Navigation.tsx
│ ├── 📁 hooks/ (5 files)
│ ├── 📁 utils/ (8 files)
│ └── 📄 App.tsx
├── 📁 public/ (3 files)
├── 📁 tests/ (15 files)
└── 📄 package.json
Statistics: 63 files, 15 directories
Technologies: React 18, TypeScript, Tailwind CSS
Build Tools: Vite, ESLint, Prettier
Architectural Analysis
- Framework Pattern: Modern React with hooks architecture
- Organisation Quality: Excellent – clear separation of concerns
- Scalability Indicators: Well-structured for team development
- Potential Improvements: Consider feature-based organisation for components over 20 files
Parameters
Parameter | Type | Description | Example |
---|---|---|---|
projectPath | string | Absolute path to project root directory | “C:/my-project” |
maxDepth | number | Maximum directory traversal depth (1-5) | 3 |
analysisDepth | enum | Analysis detail level | “basic” | “detailed” | “comprehensive” |
analysisType | enum | Focus area for analysis | “structure” | “counts” | “comprehensive” |
Depth Configuration Strategy
- maxDepth: 3 – Recommended for most projects, captures main structure without overwhelming detail
- maxDepth: 4-5 – Deep analysis for complex enterprise projects with nested module structures
- maxDepth: 2 – High-level overview for initial project assessment or large monorepos
Advanced Configuration
Large Project Analysis: For monorepos or enterprise codebases, use strategic depth management to avoid overwhelming output.
// Monorepo overview
local-llm:count_files with:
- projectPath: "C:/enterprise-monorepo"
- maxDepth: 2
- analysisType: "structure"
// Detailed module analysis
local-llm:count_files with:
- projectPath: "C:/monorepo/packages/api"
- maxDepth: 4
- analysisType: "comprehensive"
Documentation Workflow:
- Run count_files for architectural overview
- Use analyze_project_structure for detailed architectural analysis
- Generate comprehensive documentation with generate_project_documentation
- Identify cleanup opportunities with find_unused_files
Pro Tips
Performance Optimisation: Start with maxDepth 3 for initial analysis, then increase depth for specific subdirectories that require detailed examination.
Team Documentation: Use count_files output as executive summary in project README files, providing immediate project understanding for new team members.
Continuous Monitoring: Run monthly count_files analysis to track project growth patterns and identify structural drift before it becomes technical debt.
Related Functions
- analyze_project_structure – Deep architectural analysis with component relationship mapping
- find_unused_files – Dead code detection with safe removal recommendations
- generate_project_documentation – Comprehensive project documentation generation
- analyze_dependencies – Dependency analysis and circular reference detection