fsmap-cli
v1.0.2
Published
π CLI to visualize and export the file structure of any folder or GitHub repo
Maintainers
Readme
ποΈ fsmap β Visualize Folder Structures from Local or GitHub Repos
fsmap is a powerful CLI tool that scans any directory (local or remote GitHub repo) and visualizes its folder structure in a clean, tree-like format.
Supports output as text, markdown, JSON, and even integrates file size, modified dates, and Git status.
π¦ Features
- π Visualize any local folder structure
- π Fetch and display GitHub repo structure via
--repo - π§Ή Smart one-repo caching system (reuse if same repo, delete if not)
- πΎ Show file sizes (
--show-size) - π Show last modified dates (
--show-date) - π§βπ» Show Git status (
--show-git) - π Output as: text (default), markdown, JSON, or HTML
- π Save output to a file
- π Works recursively with depth control
π οΈ Installation
(Global)
npm install -g fsmap-cli(Local)
npm install -D fsmap-cliπ Usage
(Global)
fsmap [path] [options](Local)
npx fsmap [path] [options]By default, it scans the current directory (.).
π Scan a local folder
fsmap . --depth 2 --show-size --show-dateπ Scan a remote GitHub repo
fsmap --repo user/repoπΎ Export as markdown
fsmap . -o markdown > structure.mdπ Save output to a file
fsmap . --output-format json --output-file structure.jsonπ Example Output (Text)
fsmap . --depth 1 --show-size --show-datefsmap
βββ dist (4.2 KB) [2025-05-23]
βββ package.json (894 B) [2025-05-23]
βββ src (7 files)π§ Available Options
| Option | Description |
|---------------------------|-----------------------------------------------------------|
| -d, --depth <n> | Limit recursion depth |
| -e, --exclude <names> | Comma-separated list of folders/files to exclude |
| --show-size | Display file sizes |
| --show-date | Display last modified date |
| --show-hidden | Include hidden files and folders |
| --show-git | Display Git status (modified, untracked, ignored) |
| -o, --output-format | Output format: text (default), markdown, json |
| --output-file <path> | Save the output to a file instead of printing to console |
| --repo <user/repo> | Clone and scan a GitHub repository |
| --dry-run | Show scan result without writing anything |
| -v, --version | Show version info |
| -h, --help | Show help info |
π§ Repo Caching Behavior
- β If you scan the same repo again β uses cached clone
- π If you scan a different repo β deletes old repo, clones fresh
- π‘ Only one repo is ever cached at a time for performance and clarity
βοΈ Config
Add a fsmap.config.json file in your project root to override the default options.
Example:
{
"$schema": "https://raw.githubusercontent.com/SwasthK/fsmap/main/fsmap.schema.config.json",
"exclude": [
"node_modules",
".git",
"dist"
]
}_NOTE: Cli written options override the config rules.
π Plugin Support
Add a fsmap.config.ts file in your project root to transform or extend the file tree output.
Example:
module.exports = {
Β Β transform(entry: FsMapEntry) {
Β Β Β Β if (entry.name.endsWith("git.ts")) {
Β Β Β Β Β Β entry.name = "π§ͺ " + entry.name;
Β Β Β Β }
Β Β Β Β return entry;
Β Β }
}π€ Contributing
Found a bug? Have a feature idea? PRs are welcome β open an issue first!
π License
β¨ Author
Made with β€οΈ by Swasthik
