{"_id":"@amirafa/treeer","_rev":"5-6104ab5ede422e2b2f34a33da014ac54","name":"@amirafa/treeer","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@amirafa/treeer","version":"1.0.0","keywords":["tree","ai","llm","codebase","repository","context"],"_id":"@amirafa/treeer@1.0.0","maintainers":[{"name":"amirafa","email":"amir.h.rafati@gmail.com"}],"bin":{"treeer":"dist/cli.js"},"dist":{"shasum":"2b81557d182540706c30891453306d827be4a29e","tarball":"https://registry.npmjs.org/@amirafa/treeer/-/treeer-1.0.0.tgz","fileCount":34,"integrity":"sha512-O9V3xzMHYlLLKDSrC4j3dhzbalMy14CvwC6ls5B8S4lvJ4dNuBcTGp3ibyHGuqdHJ6rr3veGg6HjW9fbYUWYog==","signatures":[{"sig":"MEUCIDmgKVgCegz19Tp9A/oItG/aQrd/Cu/xm92jRRgkI4PjAiEA55+7rSj5L49IulzfH6R6K6jvZahbnOu9d0S5z5EAPc4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32530},"type":"module","exports":{".":"./dist/index.js"},"gitHead":"ae5a68caadf9094ca0d456d8feacc2038dba1c9d","scripts":{"dev":"tsx src/cli.ts","build":"tsc","start":"node dist/cli.js"},"_npmUser":{"name":"amirafa","email":"amir.h.rafati@gmail.com"},"_npmVersion":"11.4.0","description":"AI-optimized project tree generator","directories":{},"_nodeVersion":"22.15.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/treeer_1.0.0_1786214085905_0.5374937550759256","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@amirafa/treeer","version":"1.0.1","keywords":["tree","ai","llm","codebase","repository","context"],"_id":"@amirafa/treeer@1.0.1","maintainers":[{"name":"amirafa","email":"amir.h.rafati@gmail.com"}],"bin":{"treeer":"dist/cli.js"},"dist":{"shasum":"ce9c4b212d07803fcb19abaafbc6cc076000b7fe","tarball":"https://registry.npmjs.org/@amirafa/treeer/-/treeer-1.0.1.tgz","fileCount":34,"integrity":"sha512-greGJE/u6Hv3Rwu7X5rttcVdXL59oM/hpXMIFvuZMvHvVc4VDZ2X4Je35wkLWYUgWHJ2JS/gf9wxMd8XJ5ZfkA==","signatures":[{"sig":"MEYCIQCl5GL3OWFp6zBpjO+tx34AQvFThOZ7GZDtpQx1r9p58gIhAJrl2FSZnlOWtOJ4VhhJhNs+2q3f/TB0L63oF/SsgiSG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32615},"type":"module","exports":{".":"./dist/index.js"},"gitHead":"df3fad0bec6447b5951b8affb0d1ebea4797717e","scripts":{"dev":"tsx src/cli.ts","build":"tsc","start":"node dist/cli.js"},"_npmUser":{"name":"amirafa","email":"amir.h.rafati@gmail.com"},"_npmVersion":"11.4.0","description":"AI-optimized project tree generator","directories":{},"_nodeVersion":"22.15.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/treeer_1.0.1_1786214755171_0.3008677231388379","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@amirafa/treeer","version":"1.0.2","keywords":["tree","ai","llm","codebase","repository","context"],"_id":"@amirafa/treeer@1.0.2","maintainers":[{"name":"amirafa","email":"amir.h.rafati@gmail.com"}],"bin":{"treeer":"dist/cli.js"},"dist":{"shasum":"7ce9e749ac160c8f40311780e55a2ff07229efcc","tarball":"https://registry.npmjs.org/@amirafa/treeer/-/treeer-1.0.2.tgz","fileCount":34,"integrity":"sha512-77iTgbV1mk2ux45I5ZqqVJS2ew9fElNLRKtmXmKZYM4AVdCop9Csdriyo9BWEbr8rJKirFDlImTjKBk7uZqV2g==","signatures":[{"sig":"MEQCIDUhZWaN//CmjJL8TiQi/ACIMNP/CWxLUDcgqLtP8UHrAiBNHvQ83Tbu0+Fc+G8JxfCQvazZBoeS0dbirqP8Yq2S0g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33244},"type":"module","exports":{".":"./dist/index.js"},"gitHead":"1042ff6db0fa5dd83b8b2f5416163b7426f5b882","scripts":{"dev":"tsx src/cli.ts","build":"tsc","start":"node dist/cli.js"},"_npmUser":{"name":"amirafa","email":"amir.h.rafati@gmail.com"},"_npmVersion":"10.9.4","description":"AI-optimized project tree generator","directories":{},"_nodeVersion":"22.21.1","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.7.0","@types/node":"^22.20.1"},"_npmOperationalInternal":{"tmp":"tmp/treeer_1.0.2_1786259778067_0.8980096535259054","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@amirafa/treeer","version":"1.0.3","keywords":["tree","ai","llm","codebase","repository","context"],"_id":"@amirafa/treeer@1.0.3","maintainers":[{"name":"amirafa","email":"amir.h.rafati@gmail.com"}],"bin":{"treeer":"dist/cli/cli.js","treeer-mcp":"dist/mcp/server.js"},"dist":{"shasum":"f416b196e9c69caf5730d8d9d6094103c49be9a4","tarball":"https://registry.npmjs.org/@amirafa/treeer/-/treeer-1.0.3.tgz","fileCount":102,"integrity":"sha512-v8s8zZp3sDh0VZdseuDo5FbsvhftPhAd438VfVP1gVzdxD9nwuydCB9yAYyHXX2MHgf2F9RGG3+CDqXWKwuSyw==","signatures":[{"sig":"MEYCIQCpCEBMdD9585Q/TJjX8xyt0NZksoqMlsxrhaP/mO+4dwIhANf6h+KS92Ji2TA2J0Exj7soq1qP46x/EPaxH3uEjK2P","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":97861},"type":"module","exports":{".":"./dist/core/index.js"},"gitHead":"3a462cd494bb683eadca969834e5fd70f32d55b7","scripts":{"dev":"tsx cli/cli.ts","mcp":"node dist/mcp/server.js","build":"tsc","start":"node dist/cli/cli.js","mcp:dev":"tsx mcp/server.ts"},"_npmUser":{"name":"amirafa","email":"amir.h.rafati@gmail.com"},"_npmVersion":"10.9.4","description":"AI-optimized project tree generator","directories":{},"_nodeVersion":"22.21.1","dependencies":{"zod":"^4.4.3","@modelcontextprotocol/sdk":"^1.30.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.0","typescript":"^5.7.0","@types/node":"^22.20.1"},"_npmOperationalInternal":{"tmp":"tmp/treeer_1.0.3_1786861562848_0.9814178646335776","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@amirafa/treeer","version":"1.0.4","description":"AI-optimized project tree generator","type":"module","bin":{"treeer":"dist/cli/cli.js","treeer-mcp":"dist/mcp/server.js"},"exports":{".":"./dist/core/index.js"},"keywords":["tree","ai","llm","codebase","repository","context"],"scripts":{"build":"tsc","dev":"tsx cli/cli.ts","start":"node dist/cli/cli.js","mcp":"node dist/mcp/server.js","mcp:dev":"tsx mcp/server.ts"},"dependencies":{"@modelcontextprotocol/sdk":"^1.30.0","zod":"^4.4.3"},"devDependencies":{"@types/node":"^22.20.1","tsx":"^4.19.0","typescript":"^5.7.0"},"_id":"@amirafa/treeer@1.0.4","gitHead":"c51f13235d27c5cb2d81f4deff711aa32e67c7cd","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-0eFcLsvKL+sDXcZzkqV/TF3mnz9HW122Sl37zB8v1v8/M82czKCErxuqB5/An0+1hJLHRRrzeiqwQW9UNQSRyQ==","shasum":"1bea90dc4e559fe11174d0b0e56585bfb6e2441e","tarball":"https://registry.npmjs.org/@amirafa/treeer/-/treeer-1.0.4.tgz","fileCount":102,"unpackedSize":100428,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDnJhGxH0czsy+zkGNy2Dj84O+6RX5X0U93uPIhDnYl0AIhAO3UtK7Niebd9E3vz08VvLdVTyrheaBAZg9P9CPlBbQb"}]},"_npmUser":{"name":"amirafa","email":"amir.h.rafati@gmail.com"},"directories":{},"maintainers":[{"name":"amirafa","email":"amir.h.rafati@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/treeer_1.0.4_1787036149904_0.9638121382180345"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-08T18:34:45.783Z","modified":"2026-08-18T06:55:50.193Z","1.0.0":"2026-08-08T18:34:46.058Z","1.0.1":"2026-08-08T18:45:55.306Z","1.0.2":"2026-08-09T07:16:18.259Z","1.0.3":"2026-08-16T06:26:03.005Z","1.0.4":"2026-08-18T06:55:50.040Z"},"keywords":["tree","ai","llm","codebase","repository","context"],"description":"AI-optimized project tree generator","maintainers":[{"name":"amirafa","email":"amir.h.rafati@gmail.com"}],"readme":"# treeer\n\n> An AI-friendly project tree generator.\n\n`treeer` converts a directory, file, or existing tree output into a representation of your project structure.\n\nIt reduces repetitive filenames while preserving important files and directory structure, making the result easier and cheaper for AI agents to process.\n\n## Features\n\n* 📁 Directory and file input\n* 🌳 Existing tree-file input\n* 🤖 AI-friendly tree transformation\n* 📦 Groups repetitive files by type\n* 🔑 Preserves important files\n* 🚫 Configurable ignored directories\n* 🎯 Focus on a specific path\n* 📊 Token/reduction estimates\n* 🧾 JSON output\n* 💾 Output to a file\n* 📚 TypeScript/JavaScript API\n* 🔌 MCP server for AI clients\n\n## Installation\n\n### Global\n\n```bash\nnpm install -g @amirafa/treeer\n```\n\n### npx\n\n```bash\nnpx @amirafa/treeer .\n```\n\n### Library\n\n```bash\nnpm install @amirafa/treeer\n```\n\n### MCP server\n\nRun the published MCP server without installing it globally:\n\n```bash\nnpx --yes --package=@amirafa/treeer treeer-mcp\n```\n\nOr install the package globally:\n\n```bash\nnpm install -g @amirafa/treeer\ntreeer-mcp\n```\n\nThe package includes the MCP SDK and `zod` as runtime dependencies.\n\n## Usage\n\n```bash\ntreeer .\n```\n\nDirectory:\n\n```bash\ntreeer ./src\n```\n\nSingle file:\n\n```bash\ntreeer ./src/file.ts\n```\n\nExisting tree file:\n\n```bash\ntreeer tree.txt\n```\n\n## Example\n\nBefore:\n\n```text\n.\n├── src\n│   ├── components\n│   │   ├── Button.ext\n│   │   ├── Card.ext\n│   │   ├── Modal.ext\n│   │   └── Input.ext\n│   ├── utils\n│   │   ├── format.ext\n│   │   └── validate.ext\n│   └── index.ext\n└── config.ext\n```\n\nAfter:\n\n```text\n.\n├── src\n│   ├── components\n│   │   └── *.ext (4 files)\n│   ├── utils\n│   │   └── *.ext (2 files)\n│   └── index.ext\n└── config.ext\n```\n\nThis keeps the project structure while removing repetitive filenames.\n\n## Important Files\n\n`treeer` preserves files that are likely to provide useful architectural context.\n\nCommon patterns include:\n\n```text\nindex.*\napp.*\nmain.*\nrouter.*\nlayout.*\nmiddleware.*\n```\n\nIt also preserves common configuration and project metadata files.\n\n## Ignoring Directories\n\nCommon generated and dependency directories are ignored automatically.\n\nAdd your own directories with:\n\n```bash\ntreeer . --ignore tests,docs,mocks\n```\n\nor:\n\n```bash\ntreeer . -i tests,docs,mocks\n```\n\n## Focus\n\nProcess only a specific part of a project:\n\n```bash\ntreeer . --focus src/components\n```\n\nor:\n\n```bash\ntreeer . -f src/components\n```\n\n## Depth\n\nLimit output to a number of levels below the selected root. Depth `1` shows its\nimmediate contents; this is applied after `--focus`, if provided.\n\n```bash\ntreeer . -l 2\ntreeer . --level 2 --focus src\n```\n\n## Output\n\nWrite the result to a file:\n\n```bash\ntreeer . --output tree.txt\n```\n\nor:\n\n```bash\ntreeer . -o tree.txt\n```\n\n## JSON\n\nGenerate structured output:\n\n```bash\ntreeer . --json\n```\n\nSave it:\n\n```bash\ntreeer . --json -o tree.json\n```\n\n## Statistics\n\nShow estimated context reduction:\n\n```bash\ntreeer . --stats\n```\n\nExample:\n\n```text\nAI Stats\n────────\nFiles:              184\nDirectories:         31\nOriginal tokens:  ~18,400\nOutput tokens:     ~1,200\nReduction:           93.5%\n```\n\nToken counts are estimates and may vary depending on the AI model.\n\n## CLI Options\n\n```text\ntreeer <file|directory|tree.txt> [options]\n\n-o, --output <file>     Write output to a file\n-f, --focus <path>      Focus on a specific path\n-i, --ignore <dirs>     Ignore comma-separated directories\n-l, --level <depth>     Limit the tree to this depth\n-j, --json              Output JSON\n-s, --stats             Show statistics\n    --no-stats          Hide statistics\n-v, --version           Show version\n-h, --help              Show help\n```\n\nOptions can be combined:\n\n```bash\ntreeer . -i tests,docs -f src -l 2 -s -o tree.txt\n```\n\n## MCP\n\nConfigure an MCP client to launch the server with:\n\n```json\n{\n  \"mcpServers\": {\n    \"treeer\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"--yes\",\n        \"--package=@amirafa/treeer\",\n        \"treeer-mcp\"\n      ]\n    }\n  }\n}\n```\n\nThe server exposes a `treeer` tool with these inputs:\n\n```json\n{\n  \"input\": \".\",\n  \"focus\": \"src\",\n  \"ignore\": [\"tests\", \"docs\"],\n  \"level\": 2,\n  \"json\": false,\n  \"stats\": true\n}\n```\n\n`input` can be a file path, directory path, or tree text. Paths are resolved from the MCP client's working directory.\n\n### Use in a project\n\nCreate `.vscode/mcp.json` in the project where you want your agent to use treeer:\n\n```json\n{\n  \"servers\": {\n    \"treeer\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"--yes\",\n        \"--package=@amirafa/treeer\",\n        \"treeer-mcp\"\n      ],\n      \"cwd\": \"${workspaceFolder}\"\n    }\n  }\n}\n```\n\nAfter opening the project in VS Code, start the `treeer` server from the MCP server list. Your agent can then use the `treeer` tool with the project as its working directory:\n\n```text\nUse the treeer MCP tool to analyze this project with JSON output and statistics.\n```\n\n## Library\n\n`treeer` can also be used programmatically:\n\n```ts\nimport {\n  scanFileSystem,\n  transform,\n  printTree,\n} from \"@amirafa/treeer\";\n\nconst tree = scanFileSystem(\"./src\");\n\ntransform(tree);\n\nconsole.log(printTree(tree).join(\"\\n\"));\n```\n\n## Why treeer?\n\nLarge repositories can contain thousands of files, while AI agents often only need to understand the project's structure.\n\nInstead of:\n\n```text\ndirectory/\n├── file-a.ext\n├── file-b.ext\n├── file-c.ext\n├── file-d.ext\n├── file-e.ext\n└── ...\n```\n\n`treeer` can represent it as:\n\n```text\ndirectory/\n└── *.ext (many files)\n```\n\nImportant files and directories remain visible while repetitive information is reduced.\n\nThe result uses less context and is easier for AI agents to process.\n\n## Roadmap\n\n* `.gitignore` support\n* Configuration file\n* Custom grouping rules\n* Custom important-file patterns\n* Additional output formats\n* Git-aware mode\n* Changed-files-only mode\n* Improved token estimation\n\n## Changelog\n\n### 1.0.4 — 2026-08-18\n\n- Add `-l` / `--level <depth>` to limit CLI tree output depth.\n- Add the optional `level` input to the MCP `treeer` tool.\n\n### 1.0.3 — 2026-08-15\n\n- Add an MCP server powered by the treeer core functions.\n- Add the published `treeer-mcp` executable for MCP clients.\n- Document project-local VS Code MCP configuration and usage.\n\n### 1.0.2 — 2026-08-09\n\n- Fix: Handle missing filesystem targets during scanning to avoid crashing on ENOENT (broken symlinks or removed files).\n","readmeFilename":"README.md"}