{"id":28154192,"url":"https://github.com/mgks/githubtree","last_synced_at":"2026-01-04T15:13:39.187Z","repository":{"id":279381773,"uuid":"938505608","full_name":"mgks/GitHubTree","owner":"mgks","description":"Visualize folder structure of any public GitHub repository.","archived":false,"fork":false,"pushed_at":"2025-04-16T19:34:12.000Z","size":621,"stargazers_count":41,"open_issues_count":0,"forks_count":12,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-11T09:17:51.894Z","etag":null,"topics":["api","github","structured-data","visualization"],"latest_commit_sha":null,"homepage":"https://githubtree.mgks.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"mgks","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2025-02-25T04:09:09.000Z","updated_at":"2025-05-06T16:28:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"52ace271-87e2-4977-ac64-9ba26628de6d","html_url":"https://github.com/mgks/GitHubTree","commit_stats":null,"previous_names":["mgks/githubtree"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgks%2FGitHubTree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgks%2FGitHubTree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgks%2FGitHubTree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgks%2FGitHubTree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgks","download_url":"https://codeload.github.com/mgks/GitHubTree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254283271,"owners_count":22045141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","github","structured-data","visualization"],"created_at":"2025-05-15T06:12:59.830Z","updated_at":"2026-01-04T15:13:39.181Z","avatar_url":"https://github.com/mgks.png","language":"JavaScript","funding_links":["https://github.com/sponsors/mgks"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n  \u003c!-- PROJECT TITLE --\u003e\n  \u003ch1\u003eGitHubTree\u003c/h1\u003e\n  \n  \u003c!-- ONE LINE SUMMARY --\u003e\n  \u003cp\u003e\n    \u003cb\u003eGitHubTree is a high-performance repository visualiser.\u003c/b\u003e\n  \u003c/p\u003e\n  \n  \u003c!-- BADGES --\u003e\n  \u003cp\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/mgks/githubtree?style=flat-square\u0026color=38bd24\" alt=\"release version\"\u003e\n    \u003c!--\u003cimg src=\"https://img.shields.io/npm/v/gh-tree.svg?style=flat-square\u0026color=fc3b53\" alt=\"npm version\"\u003e--\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dt/gh-tree.svg?style=flat-square\u0026color=38bd24\" alt=\"npm downloads\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/mgks/githubtree?style=flat-square\u0026logo=github\u0026color=blue\" alt=\"stars\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/mgks/githubtree.svg?style=flat-square\u0026color=blue\" alt=\"license\"\u003e\n  \u003c/p\u003e\n\n  \u003c!-- MENU --\u003e\n  \u003cp\u003e\n    \u003ch4\u003e\n      \u003ca href=\"https://githubtree.mgks.dev\"\u003e🚀 Open Web App\u003c/a\u003e\n    \u003c/h4\u003e\n  \u003c/p\u003e\n\n  \u003c!-- PREVIEW --\u003e\n  \u003cp\u003e\n    \u003cimg width=\"1000\" alt=\"image\" src=\"https://github.com/user-attachments/assets/c1de6006-02e5-4ff1-bda1-3f079e350021\" /\u003e\n  \u003c/p\u003e\n\n\u003c/div\u003e\n\nGitHubTree allows you to explore, navigate, and generate ASCII directory trees for any GitHub repository without cloning. Available as **Web App**, **CLI Tool**, and **Node.js Library**.\n\n## Features\n*   **Instant Search:** Visualize any public repository (e.g., `facebook/react`).\n*   **Smart Branch Detection:** Automatically detects if a branch exists (e.g., `main` vs `master`) and switches to the default branch if needed.\n*   **Private Repo Access:** Securely access your private repositories using a Personal Access Token (saved locally to your browser).\n*   **Smart Copy:** Copy the entire directory tree as text, or copy specific file paths.\n*   **Visual Styles:** Toggle between Classic (└──), Slashed (/src), Minimal, and ASCII (+--).\n*   **Deep Linking:** Share links to specific repositories and branches (e.g., `/repo/mgks/dhwani/main`).\n\n## For Developers: The CLI\n\nGenerate directory trees directly in your terminal. Perfect for documentation and quick checks.\n\n### Usage (No Install)\nRun via `npx` to fetch a tree instantly:\n\n```bash\nnpx gh-tree user/repo\n```\n\n### Installation (Global)\n```bash\nnpm install -g gh-tree\n```\n\n### Commands \u0026 Flags\n```bash\ngh-tree \u003cuser/repo\u003e [flags]\n\nFlags:\n  --branch, -b \u003cname\u003e   Specify branch (default: main)\n  --icons               Show file/folder icons in output\n  --token, -t \u003ckey\u003e     Use a specific GitHub Token\n  --save-token \u003ckey\u003e    Save a token globally for future use\n  --help                Show help\n```\n\n**Example:**\n```bash\ngh-tree facebook/react --icons --branch main\n```\n\n## For Builders: The NPM Package\n\nUse the core engine to fetch trees and generate ASCII structures in your own applications.\n\n### Installation\n```bash\nnpm install gh-tree\n```\n\n### Usage\n\n```javascript\nimport { GitHubTree } from 'gh-tree';\n\n// 1. Initialize (Token optional, but recommended for higher rate limits)\nconst gt = new GitHubTree(process.env.GITHUB_TOKEN);\n\n// 2. Fetch Tree\ntry {\n    const { tree } = await gt.getTree('mgks/githubtree', 'main');\n    \n    // 3. Sort \u0026 Generate ASCII\n    const sorted = gt.sortTree(tree, 'folder-az');\n    const output = gt.generateAsciiTree(sorted, { icons: true });\n    \n    console.log(output);\n} catch (err) {\n    console.error(err);\n}\n```\n\n### API Reference\n\n#### `new GitHubTree(token?)`\nCreates a new instance.\n*   `token` (string, optional): GitHub Personal Access Token.\n\n#### `getTree(repo, branch?)`\nFetches the raw recursive tree from GitHub API.\n*   Returns: `{ tree: Array, truncated: Boolean }`\n\n#### `sortTree(tree, method?)`\nSorts the tree array.\n*   `method`: `'folder-az'` (default), `'folder-za'`, `'alpha-az'`, `'alpha-za'`.\n\n#### `generateAsciiTree(tree, options?)`\nConverts the tree array into a formatted string.\n*   `options.icons`: Boolean. If true, adds emojis (📁/📄).\n\n## Development (Monorepo)\n\nThis repository is organized as a Monorepo.\n\n*   `packages/core`: The logic, API fetcher, and CLI tool.\n*   `packages/web`: The Vite-based Web Application.\n*   `tools/`: Scripts for generating SEO static pages.\n\n### Local Setup\n\n1.  **Clone:**\n    ```bash\n    git clone https://github.com/mgks/GitHubTree.git\n    cd GitHubTree\n    ```\n\n2.  **Install:**\n    ```bash\n    npm install\n    ```\n\n3.  **Run Web App:**\n    ```bash\n    npm run dev\n    ```\n\n4.  **Build \u0026 Generate SEO Pages:**\n    ```bash\n    npm run deploy\n    ```\n\n## License\n\nMIT\n\n\u003e **{ github.com/mgks }**\n\u003e \n\u003e ![Website Badge](https://img.shields.io/badge/Visit-mgks.dev-blue?style=flat\u0026link=https%3A%2F%2Fmgks.dev) ![Sponsor Badge](https://img.shields.io/badge/%20%20Become%20a%20Sponsor%20%20-red?style=flat\u0026logo=github\u0026link=https%3A%2F%2Fgithub.com%2Fsponsors%2Fmgks)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgks%2Fgithubtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgks%2Fgithubtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgks%2Fgithubtree/lists"}