You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 43f0dca
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: TODO.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,14 @@ Track progress of implementing Linux `tree` options in tree-node-cli.
56
56
- CLI: `-J, --json`
57
57
- API: `json: boolean`
58
58
59
+
## Code Improvements
60
+
61
+
-[x]**Filter before stat** — `statEntries` stats all entries including hidden files that will be filtered out when `allFiles: false`. Filter hidden files before stat'ing to avoid unnecessary syscalls.
62
+
-[ ]**Match Linux `tree -s` size behavior** — `computeSizes` recursively sums file sizes into parent directories, but Linux `tree -s` shows each entry's own `stat.size` (inode size for directories, not recursive sum). Remove `computeSizes` and use `stat.size` directly.
63
+
-[x]**Merge `EXCLUDED_PATTERNS` into exclude** — The hardcoded `.DS_Store` pattern is checked in a separate loop for every entry. Merge it into the user's `exclude` array at initialization to simplify `isExcluded`.
64
+
-[x]**Clarify `dirsOnly` filtering** — `dirsOnly` is checked in both `isExcluded` (skips files early) and `filterAndOrderContents` (filters file entries). The `isExcluded` check is a performance optimization that avoids stat'ing files, but the dual responsibility could be clearer.
65
+
-[x]**Avoid mutating input arrays** — `sortContents` calls `contents.sort()` which mutates the caller's array in place. Using `[...contents].sort(...)` would be safer, though not currently a bug since callers don't reuse the array.
66
+
59
67
## Notes
60
68
61
69
- Each feature should include: implementation in `src/index.ts`, CLI flag in `src/cli.ts`, tests in `src/index.test.ts` and `src/cli.test.ts`, and README docs
0 commit comments