@@ -1,60 +0,0 @@ |
| 1 | | -# CLAUDE.md |
| 2 | | - |
| 3 | | -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | | - |
| 5 | | -## Build Commands |
| 6 | | - |
| 7 | | -```bash |
| 8 | | -fpm build # Debug build |
| 9 | | -fpm build --flag "-O2" # Release build with optimization |
| 10 | | -fpm build --flag "-g -Wall -Wextra" # Build with debug flags and warnings |
| 11 | | -fpm run # Build and run |
| 12 | | -fpm test # Run test suite |
| 13 | | -``` |
| 14 | | - |
| 15 | | -**Dependencies**: gfortran 10+ (or ifort), fpm, ncurses library |
| 16 | | - |
| 17 | | -## Architecture |
| 18 | | - |
| 19 | | -FORTRESS is a CLI file manager written in modern Fortran (2008+) with dual-pane navigation, git integration, and fuzzy search. |
| 20 | | - |
| 21 | | -### Module Structure |
| 22 | | - |
| 23 | | -``` |
| 24 | | -app/main.f90 # Main event loop, state management, user input (~1100 LOC) |
| 25 | | -src/ |
| 26 | | -├── filesystem/fs_ops.f90 # Directory reading, path manipulation, fzf search, file ops |
| 27 | | -├── ui/display.f90 # Dual-pane rendering (30% parent | 70% current), color output |
| 28 | | -├── ui/preview.f90 # File preview functionality |
| 29 | | -├── terminal/term_control.f90 # Raw mode, ANSI codes, terminal size, key reading |
| 30 | | -├── git/git_ops.f90 # Git status, staging, commits, push/pull, diff display |
| 31 | | -└── version/version.f90 # Version info (auto-generated by stamp-version.sh) |
| 32 | | -``` |
| 33 | | - |
| 34 | | -### Key Patterns |
| 35 | | - |
| 36 | | -**State Management**: The main event loop in `main.f90` manages: |
| 37 | | -- Navigation state (`current_dir`, `parent_dir`, `selected`, `scroll_offset`) |
| 38 | | -- Mode flags (`move_mode`, `in_rename_mode`, `in_selection_mode`) |
| 39 | | -- Clipboard (`has_clipboard`, `clipboard_paths[]`, copy vs cut) |
| 40 | | -- Multi-select tracking (`is_selected[]`, `selection_count`) |
| 41 | | -- Favorites stored in `~/.fortress_favorites` |
| 42 | | - |
| 43 | | -**Terminal Control**: |
| 44 | | -- Uses alternate screen buffer (`ESC[?1049h/l`) to prevent scroll artifacts |
| 45 | | -- Raw mode via `stty` for non-blocking, character-by-character input |
| 46 | | -- Terminal size caching (refreshes every 100 calls) |
| 47 | | - |
| 48 | | -**External Commands**: All shell commands use `execute_command_line()` - ensure proper escaping for paths with special characters. |
| 49 | | - |
| 50 | | -**Git Integration**: Uses git CLI directly; status is cached with 500ms TTL. Directories show recursive status indicators. |
| 51 | | - |
| 52 | | -**Shell Integration**: `~/.fortress_cd` file enables cd-on-exit feature; wrapper scripts in `fortress.sh`/`fortress.fish` read this file. |
| 53 | | - |
| 54 | | -### Constants |
| 55 | | - |
| 56 | | -Defined across modules: `MAX_PATH=512`, `MAX_FILES=500` |
| 57 | | - |
| 58 | | -### Color Scheme |
| 59 | | - |
| 60 | | -Blue=directories, Green=executables, Grey=dotfiles, Red=cut files/staged, Yellow=warnings/incoming changes |