ftreeview 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +235 -0
- package/dist/cli.js +1619 -0
- package/package.json +58 -0
- package/src/App.jsx +243 -0
- package/src/cli.js +228 -0
- package/src/components/StatusBar.jsx +270 -0
- package/src/components/TreeLine.jsx +190 -0
- package/src/components/TreeView.jsx +129 -0
- package/src/hooks/useChangedFiles.js +82 -0
- package/src/hooks/useGitStatus.js +347 -0
- package/src/hooks/useIgnore.js +182 -0
- package/src/hooks/useNavigation.js +247 -0
- package/src/hooks/useTree.js +508 -0
- package/src/hooks/useWatcher.js +129 -0
- package/src/index.js +22 -0
- package/src/lib/changeStatus.js +79 -0
- package/src/lib/connectors.js +233 -0
- package/src/lib/constants.js +64 -0
- package/src/lib/icons.js +658 -0
- package/src/lib/theme.js +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ftree contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# ftree
|
|
2
|
+
|
|
3
|
+
A lightweight, interactive CLI file explorer with live monitoring and git awareness.
|
|
4
|
+
|
|
5
|
+
**Open source**: MIT licensed (see [LICENSE](LICENSE)). Contributions welcome.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Interactive Tree Navigation** - Browse directories with vim-style keybindings
|
|
10
|
+
- **Live File Watching** - Automatically updates when files change
|
|
11
|
+
- **Git Status Integration** - See modified, added, and untracked files at a glance
|
|
12
|
+
- **Added/Modified Indicators** - File and folder lines show quick A/M change icons (folder status is inherited from changed children)
|
|
13
|
+
- **Colored File Types** - Syntax-highlighted file extensions (JS, TS, Python, Go, Rust, etc.)
|
|
14
|
+
- **Smart Icons** - Nerd Font devicons (optional) with emoji fallback; ASCII mode supported
|
|
15
|
+
- **Keyboard Navigation** - Full keyboard control with arrow keys or vim bindings
|
|
16
|
+
- **Handles Large Directories** - Efficient traversal with viewport scrolling
|
|
17
|
+
- **Terminal Resize Support** - Adapts to terminal window size changes
|
|
18
|
+
- **Clean Exit** - Graceful shutdown with proper terminal state restoration
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### Global Install (Recommended)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g ftreeview
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then run from anywhere:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
ftree
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### npx (No Install Required)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx ftree
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Local Development
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/chaitanyame/watchout.git
|
|
44
|
+
cd watchout
|
|
45
|
+
npm install
|
|
46
|
+
npm run build
|
|
47
|
+
node dist/cli.js
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
ftree [path] [options]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Arguments
|
|
57
|
+
|
|
58
|
+
| Argument | Description |
|
|
59
|
+
|----------|-------------|
|
|
60
|
+
| `[path]` | Path to directory to explore (default: current directory) |
|
|
61
|
+
|
|
62
|
+
### Options
|
|
63
|
+
|
|
64
|
+
| Flag | Description |
|
|
65
|
+
|------|-------------|
|
|
66
|
+
| `-h, --help` | Print help message |
|
|
67
|
+
| `-v, --version` | Print version information |
|
|
68
|
+
| `--no-git` | Disable git integration |
|
|
69
|
+
| `--no-icons` | Use ASCII icons (disable emoji/nerd icons) |
|
|
70
|
+
| `--icon-set <emoji\|nerd\|ascii>` | Choose icon set (default: emoji). You can also set `FTREE_ICON_SET`. |
|
|
71
|
+
| `--theme <vscode>` | UI theme (default: vscode). You can also set `FTREE_THEME`. |
|
|
72
|
+
| `--no-watch` | Disable file watching for static view |
|
|
73
|
+
|
|
74
|
+
### Examples
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Explore current directory
|
|
78
|
+
ftree
|
|
79
|
+
|
|
80
|
+
# Explore specific directory
|
|
81
|
+
ftree ~/projects
|
|
82
|
+
|
|
83
|
+
# Explore with git disabled
|
|
84
|
+
ftree --no-git
|
|
85
|
+
|
|
86
|
+
# Explore without icons (ASCII mode)
|
|
87
|
+
ftree --no-icons
|
|
88
|
+
|
|
89
|
+
# Use Nerd Font icons (requires Nerd Font)
|
|
90
|
+
ftree --icon-set nerd
|
|
91
|
+
|
|
92
|
+
# WSL / network drive troubleshooting (force polling watcher)
|
|
93
|
+
FTREE_USE_POLLING=1 ftree
|
|
94
|
+
|
|
95
|
+
# Static view (no live watching)
|
|
96
|
+
ftree --no-watch
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Environment Variables
|
|
100
|
+
|
|
101
|
+
| Variable | Description |
|
|
102
|
+
|---------|-------------|
|
|
103
|
+
| `FTREE_ICON_SET` | Default icon set (`emoji`, `nerd`, `ascii`) |
|
|
104
|
+
| `FTREE_THEME` | Theme name (currently `vscode`) |
|
|
105
|
+
| `FTREE_USE_POLLING` | Force chokidar polling watcher (`1`/`true` to enable, `0`/`false` to disable) |
|
|
106
|
+
|
|
107
|
+
## Keybindings
|
|
108
|
+
|
|
109
|
+
| Key | Action |
|
|
110
|
+
|-----|--------|
|
|
111
|
+
| `↑` / `k` | Move cursor up |
|
|
112
|
+
| `↓` / `j` | Move cursor down |
|
|
113
|
+
| `→` / `l` / `Enter` | Expand directory or enter |
|
|
114
|
+
| `←` / `h` | Collapse directory or jump to parent |
|
|
115
|
+
| `Space` | Toggle expand/collapse |
|
|
116
|
+
| `g` | Jump to first item |
|
|
117
|
+
| `G` | Jump to last item |
|
|
118
|
+
| `r` | Refresh tree |
|
|
119
|
+
| `q` / `Ctrl+C` | Quit |
|
|
120
|
+
|
|
121
|
+
## Screenshots
|
|
122
|
+
|
|
123
|
+
### Main View
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
ftree v0.1.0 │ ./projects/myapp │ 42 files, 12 dirs │ Watching... │ Git: clean
|
|
127
|
+
q:quit ↑↓:nav ←→:expand/collapse r:refresh ?:help
|
|
128
|
+
|
|
129
|
+
📁 src
|
|
130
|
+
📁 components
|
|
131
|
+
📜 App.jsx
|
|
132
|
+
📜 Header.jsx
|
|
133
|
+
📁 hooks
|
|
134
|
+
📜 useAuth.js
|
|
135
|
+
📁 utils
|
|
136
|
+
📜 helpers.js
|
|
137
|
+
📄 package.json
|
|
138
|
+
📄 README.md
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Git Status View
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
ftree v0.1.0 │ ./projects/myapp │ 42 files, 12 dirs │ Watching... │ Git: 2M 1A
|
|
145
|
+
q:quit ↑↓:nav ←→:expand/collapse r:refresh ?:help
|
|
146
|
+
|
|
147
|
+
📁 src
|
|
148
|
+
📁 components
|
|
149
|
+
📜 App.jsx [M] ← Modified file
|
|
150
|
+
📜 Header.jsx
|
|
151
|
+
📁 hooks
|
|
152
|
+
📜 useAuth.js [A] ← Newly added file
|
|
153
|
+
📄 package.json [M] ← Modified file
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Development
|
|
157
|
+
|
|
158
|
+
### Prerequisites
|
|
159
|
+
|
|
160
|
+
- Node.js 18 or higher
|
|
161
|
+
- npm or yarn
|
|
162
|
+
|
|
163
|
+
### Setup
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Clone the repository
|
|
167
|
+
git clone https://github.com/yourusername/ftree.git
|
|
168
|
+
cd ftree
|
|
169
|
+
|
|
170
|
+
# Install dependencies
|
|
171
|
+
npm install
|
|
172
|
+
|
|
173
|
+
# Build the project
|
|
174
|
+
npm run build
|
|
175
|
+
|
|
176
|
+
# Run from project root
|
|
177
|
+
node dist/cli.js /path/to/explore
|
|
178
|
+
|
|
179
|
+
# Link globally for testing
|
|
180
|
+
npm link
|
|
181
|
+
ftree
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Project Structure
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
ftree/
|
|
188
|
+
├── src/
|
|
189
|
+
│ ├── cli.js # CLI entry point
|
|
190
|
+
│ ├── App.jsx # Root React component
|
|
191
|
+
│ ├── components/
|
|
192
|
+
│ │ ├── TreeView.jsx # Main tree renderer
|
|
193
|
+
│ │ ├── TreeLine.jsx # Individual line renderer
|
|
194
|
+
│ │ └── StatusBar.jsx# Status bar component
|
|
195
|
+
│ ├── hooks/
|
|
196
|
+
│ │ ├── useTree.js # Tree building and management
|
|
197
|
+
│ │ ├── useNavigation.js # Keyboard navigation
|
|
198
|
+
│ │ ├── useGitStatus.js # Git status polling
|
|
199
|
+
│ │ ├── useWatcher.js # File system watcher
|
|
200
|
+
│ │ └── useIgnore.js # Gitignore filtering
|
|
201
|
+
│ └── lib/
|
|
202
|
+
│ ├── icons.js # Icon and color mappings
|
|
203
|
+
│ ├── constants.js # Configuration constants
|
|
204
|
+
│ └── connectors.js# Tree line connectors
|
|
205
|
+
├── package.json
|
|
206
|
+
└── README.md
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Tech Stack
|
|
210
|
+
|
|
211
|
+
- **Node.js** (>=18.0.0) - Runtime environment
|
|
212
|
+
- **React** - UI component framework
|
|
213
|
+
- **Ink** - React for CLIs
|
|
214
|
+
- **chokidar** - File system watcher
|
|
215
|
+
- **chalk** - Terminal colors
|
|
216
|
+
- **ignore** - Gitignore pattern matching
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
MIT License - see LICENSE file for details
|
|
221
|
+
|
|
222
|
+
## Contributing
|
|
223
|
+
|
|
224
|
+
Contributions are welcome!
|
|
225
|
+
|
|
226
|
+
- Bug reports / feature requests: open an issue at https://github.com/chaitanyame/watchout/issues
|
|
227
|
+
- Pull requests: keep changes focused, include a clear description, and run `npm run build` before submitting.
|
|
228
|
+
|
|
229
|
+
## Security
|
|
230
|
+
|
|
231
|
+
If you believe you’ve found a security issue, please open a GitHub issue with the `security` label (or contact the maintainers privately if you prefer).
|
|
232
|
+
|
|
233
|
+
## Author
|
|
234
|
+
|
|
235
|
+
Created with passion for better CLI tools.
|