> Sourced from [phalladar/MacDirStat](https://github.com/phalladar/MacDirStat) β [MIT](https://github.com/phalladar/MacDirStat/blob/225f65ab1efda7eee50d76e3a29d123ba191b960/CLAUDE.md). # CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Build & Run ```bash swift build # Debug build swift build -c release # Release build swift run MacDirStat # Run the app open Package.swift # Open in Xcode ``` No external dependencies. No test target configured yet (`swift test` will fail). No linter configured; Swift 6 strict concurrency mode is enforced via `swiftLanguageMode(.v6)` in Package.swift. ## Architecture MacDirStat is a native macOS (15.0+) SwiftUI disk space analyzer that visualizes directory usage as interactive treemaps. Swift 6, SPM-only, zero external dependencies. ### State & Data Flow **AppState** (`@Observable`) is the single source of truth. It holds the scanned file tree (`rootNode: FileNode`), the current treemap view root (`treemapRoot`), selected node, and breadcrumb navigation stack. All views react to AppState changes. Scan flow: User picks folder β **ScanCoordinator** launches **FileScanner** β FileScanner uses BSD `fts_open`/`fts_read`/`fts_close` (not FileManager, for performance) β yields `ScanEvent`s via `AsyncStream` β ScanCoordinator throttles updates (50ms) and builds the **FileNode** tree β treemap renders. ### Module Layout (Sources/MacDirStat/) - **App/** β Entry point (`MacDirStatApp`) and `AppState` central state management - **Scanning/** β `FileScanner` (BSD fts-based traversal with inode dedup, symlink handling, allocated size via blocksΓ512), `ScanCoordinator` (async orchestration, throttling, cancellation), `FileNode` (tree model with weak parent refs to avoid retain cycles, recursive aggregate computation) - **Categorization/** β `FileCategory` (10 categories with colors/SF Symbols) and `FileExtensionMap` (200+ extensionβcategory mappings) - **Treemap/** β `TreemapLayoutEngine` (Squarify algorithm, max 8 depth levels), `TreemapHitTester`, `TreemapRenderer` (Canvas-based with depth-darkened category colors), `TreemapView` (click/double-click/hover/context menu interactions) - **Views/** β `ContentView` (NavigationSplitView: sidebar tree + center treemap + inspector), `WelcomeView` (volume list with usage bars, NSOpenPanel), `ScanProgressView`, `DirectoryTreeView` (OutlineGroup), `DetailPanelView` (metadata + category breakdown) - **Utilities/** β `ByteFormatter` (human-readable sizes) ### Key Patterns - All data types crossing async boundaries are `Sendable` - FileNode uses weak parent references to break retain cycles - FileScanner deduplicates hard links by tracking seen inodes - TreemapView uses Canvas for rendering (not individual SwiftUI views) for performance - macOS APIs used: `NSWorkspace` (Reveal in Finder), `NSPasteboard` (clipboard), `NSOpenPanel` (folder picker)
Add to your project
Paste into your project's CLAUDE.md or ~/.claude/CLAUDE.md for global rules.
More for React
Mindx CLAUDE.md
by @DotNetAge
δΈδΈͺε―θͺδΈ»θΏεηζ°εεεθΊ«
Claude Codex Settings CLAUDE.md
by @fcakyon
My personal Claude Code and OpenAI Codex setup with battle-tested skills, plugins, hooks and agents that I use daily.
Dotfiles CLAUDE.md
by @phatblat
CLAUDE.md for the Dotfiles project (Shell).
Claude Skills CLAUDE.md
by @Jeffallan
66 Specialized Skills for Full-Stack Developers. Transform Claude Code into your expert pair programmer.
Quickwit CLAUDE.md
by @quickwit-oss
Cloud-native search engine for observability. An open-source alternative to Datadog, Elasticsearch, Loki, and Tempo.
Sandbox Agent CLAUDE.md
by @rivet-dev
Run Coding Agents in Sandboxes. Control Them Over HTTP. Supports Claude Code, Codex, OpenCode, and Amp.
MCP servers for React
netdata/netdata#Netdata
ποΈ π βοΈ π π πͺ π§ - Discovery, exploration, reporting and root cause analysis using all observability data, including metrics, logs, systems, containers, processes, and network connections
Swift MCP SDK
The official Swift SDK for Model Context Protocol servers and clients.
mihaelamj/cupertino
π π - Apple Documentation MCP Server. Search Apple developer docs, Swift Evolution proposals, and 600+ sample code projects with full-text search.
Get the Claude Code Starter Pack
Top CLAUDE.md rules for Next.js, TypeScript, Python, Go, and React β free.
