npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

code-context-llm

v1.3.0

Published

Generates a Markdown representation of a project's file structure for LLM context.

Downloads

14

Readme

Code Context LLM visualization

Code Context LLM

npm version License: MIT Downloads Cross-Platform

Generate a Markdown representation of your project's file structure to provide valuable context for Large Language Models (LLMs) like ChatGPT, enhancing code analysis, prompt engineering, and AI-driven development.

Screenshot

Interactive CLI Screenshot

Quick start: npx code-context-llm

Table of Contents

Introduction

Code Context LLM bridges the gap between your codebase and Large Language Models (LLMs). Without proper context, LLMs might hallucinate file structures or offer irrelevant suggestions, impacting developer productivity and code quality.

By generating a comprehensive Markdown outline of your project's directory tree, this tool empowers developers to enhance prompt engineering, improve AI-assisted code navigation, and facilitate code understanding for AI models. Ensure AI interactions are accurate, relevant, and aligned with your project's architecture.

Features

  • 🔒 Secure Content Redaction: Automatically redacts sensitive information like API keys, passwords, and credentials, allowing safe sharing of project structures. Learn more about our security measures.
  • 🧠 LLM Context Generation: Provides accurate project context for improved LLM prompts, enhancing AI responses.
  • 📂 Respects .gitignore: Excludes files and directories specified in your .gitignore, keeping your context clean.
  • 🖥️ Interactive React Ink UI: A keyboard-driven terminal UI for selecting folders and reviewing exclusions.
  • 🎯 Override Exclusions: Review items excluded by .gitignore or defaults and include them selectively.
  • 📝 Markdown Output: Produces a readable and structured Markdown file for easy sharing and documentation.

Installation

Quick Start with npx

Get started instantly without installing:

npx code-context-llm

Global Installation

Install the package globally to use it anytime:

npm install -g code-context-llm

Usage

Interactive Mode (React Ink)

Run:

npx code-context-llm

You'll be guided through:

  • Selecting which top-level folders to include.
  • Reviewing excluded items (from .gitignore and default skips) and choosing any to include.
  • Confirming to generate the Markdown file (default: ProjectStructure.md).

Keyboard controls:

  • ↑/↓: Move cursor
  • ←/→: Collapse/Expand directories
  • Space: Toggle selection
  • a: Toggle select all
  • Enter: Continue/confirm
  • q or Esc: Quit

Notes:

  • Dot-prefixed files and directories are excluded by default, but you can include them during the review step.

Command-Line Options

  • [root] (positional): Root directory to process (default: .). Examples:
    • npx code-context-llm .
    • npx code-context-llm ./some-folder
  • -o, --output-file <filename>: Name of the output Markdown file (default: ProjectStructure.md).
  • -p, --project-path <path>: Deprecated; use the positional [root] argument instead.
  • -h, --help: Display help information.
  • -V, --version: Display the version number.

Use Cases

  • LLM Prompt Engineering: Enhance code summaries and refactoring tasks by providing LLMs with accurate project context, potentially saving up to 50% of development time.
  • Codebase Documentation: Automatically generate a Markdown outline of your project's architecture, reducing documentation effort by up to 70%.
  • AI-Assisted Development: Improve the accuracy of AI-powered code suggestions and bug detection by offering context about file relationships.
  • Team Collaboration: Share project structures with team members to improve onboarding and facilitate code reviews.
  • Codebase Summarization: Create summaries of large codebases for reviews or audits, helping you quickly understand unfamiliar projects.

Example Output

Here's a snippet of the generated Markdown:

# Project Structure for /path/to/your/project

- **src/**
  - **components/**
    - Header.js (1.2 KB)
      - Content preview:
        ```javascript
        import React from "react";
        // Header component
        const Header = () => {
          return <header>Welcome to My Project</header>;
        };
        export default Header;
        ```
    - Footer.js (800 bytes)
  - **utils/**
    - helpers.js (2.5 KB)
- **package.json** (1.1 KB)
  - Content preview:
    ```json
    {
      "name": "my-project",
      "version": "1.0.0",
      "dependencies": {
        "react": "^17.0.2"
      }
    }
    ```

This structured overview helps LLMs understand your project's architecture, improving code analysis and AI interactions.

Security

Your project's security is our priority. Code Context LLM automatically redacts sensitive information such as API keys, passwords, credentials, and other secrets from code previews. We use pattern matching to identify and replace sensitive data with [REDACTED]. However, we strongly recommend that you review the generated Markdown file yourself to ensure that no sensitive information is included before sharing it.

Contributing

Contributions are welcome! If you have suggestions or find issues, please:

  • Open an issue.
  • Submit a pull request.
  • Share your ideas in the discussions section.

Please see our contribution guidelines for more details.

License

This project is licensed under the MIT License.

Support

If you find this project helpful:

  • Star this repository on GitHub!
  • 🗣 Spread the word by sharing with your colleagues and friends.
  • 💬 Share your feedback and experiences.

Keywords: LLM context, Code Understanding for AI, Prompt Engineering Tools, Codebase Documentation for LLMs, AI-Assisted Code Navigation, Improve LLM Prompts, Code Context, Markdown, Project Structure, Codebase Summarization, AI, Machine Learning, Code Analysis, Documentation Generator, CLI Tool, Developer Tools.