Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

P2M Logo

⚡ Project2Markdown

The two-way bridge between your codebase and AI.

Compress an entire repository into one AI-ready file. Let the AI edit it. Restore it back into real code.


License: MIT Go Version Zero Dependency Version


Quick Start · GUI Mode · CLI Mode · Restore Mode · Features



🤔 The Problem

You want an LLM to understand your entire codebase. Today that means manually copy-pasting files, fighting token limits, and losing structure. And once the AI hands back new code — you're pasting it back in, file by file.

P2M turns that into one command in, one command out.

project/         ──▶  p2m --cli  ──▶  context.md  ──▶  🤖 paste into Claude / GPT / Gemini
   ├─ src/                                                        │
   ├─ config/                                                     ▼
   └─ ...        ◀──  p2m --restore  ◀──  ai_output.xml  ◀──  AI rewrites your project

🚀 Quick Start

No cloning, no building — run it instantly from anywhere.

🍎 macOS / Linux

curl -fsSL https://raw.githubusercontent.com/nematollahshojaei/project2markdown/main/install.sh | bash

🪟 Windows (PowerShell)

irm https://raw.githubusercontent.com/nematollahshojaei/project2markdown/main/install.ps1 | iex

🐹 Go installed (cross-platform)

go run github.com/nematollahshojaei/project2markdown/v2/cmd/p2m@latest --cli

Once installed, type p2m to launch the Web UI, or p2m --cli to generate context directly in your terminal. That's it.


🖥️ GUI Mode

GUI preview

Run p2m with no flags and a local Glassmorphism dashboard opens in your browser automatically. Built for people who'd rather click than type.

  • 📊 Live metrics — tokens/sec, elapsed time, file count, all updating in real time
  • 🗂️ Smart file explorer — browse local drives or drop in a remote GitHub URL
  • 🎛️ One-click toggles — strip comments, strip empty lines, custom AI prompts, and Allow Sensitive Files
  • 📂 Smart Output & Open Folder — Auto-routes read-only paths to Documents/Project2Markdown and highlights the generated file in your OS natively.

💻 CLI Mode

For terminal-first developers. Every example below is copy-paste ready.

💡 Tip: Run p2m --help at any time to see the full list of available flags, options, and examples directly in your terminal.

Basic generation (Markdown output)
p2m --cli
Advanced minification — XML, comments & empty lines stripped
p2m --cli --format=xml --remove-comments --remove-empty-lines
Process a remote GitHub repo — no git clone needed
p2m --cli --remote=yamadashy/repomix --format=json
Include only specific files or folders
p2m --cli --include="*.go, src/, config.json"
Specify output directory & allow sensitive files (.env, keys)
p2m --cli --output="./my_exports" --allow-secrets

🔄 Restore Mode

Got a full project back from an AI as one Markdown/XML/JSON file? Rebuild every file and folder in one shot.

p2m --restore=my_project_context.xml

🛡️ Bulletproof Path Traversal Protection — Malicious or hallucinated paths (../../etc/passwd, C:\Windows, etc.) are mathematically blocked (LFI/RFI safe) before a single file is written, even on Root directories.


✨ Why P2M

Concurrency Engine Uses every CPU core via a worker pool — thousands of files processed in milliseconds
🧠 Built-in Tokenizer Zero-dependency heuristic tokenizer — accurate AI token counts, no heavy ML libs
🌐 Remote Fetching Point it at any public GitHub URL — no local clone required
🤖 AI-Optimized Formats Export as Markdown, XML (best for Claude), or JSON (best for APIs)
🛡️ Universal Ignore Engine Auto-respects .gitignore, .p4ignore, and .p2mignore. Safely redacts .env and private keys by default.
🔒 Enterprise Security Hardened against SSRF, ZipSlip, LFI/RFI, and Memory/Goroutine Leaks.
📂 Smart Output Routing Automatically redirects outputs from Read-Only directories to a safe Documents/Project2Markdown workspace.
🎮 UE5-Native Parsing Understands .uproject, .uplugin, .t3d, .usf, .ush — skips Saved, Intermediate, Binaries, DerivedDataCache

🛠️ Building from Source

Manual build instructions (for contributors)

1. Clone the repository

git clone https://github.com/nematollahshojaei/project2markdown.git
cd project2markdown

2. Build the CLI edition

go build -ldflags="-s -w" -o p2m-cli ./cmd/p2m

3. Build the GUI edition (Windows, hides the console window)

go build -ldflags="-s -w -H=windowsgui" -o p2m-gui.exe ./cmd/p2m


📄 License

Released under the MIT License — free for personal and commercial use.


Developed with 💙 by Nematollah Shojaei Unreal Engine Technical Specialist & Software Engineer

🌐 Website · ✉️ Email · 💼 LinkedIn


If P2M saves you time, consider starring the repo — it genuinely helps.

About

A high-performance, two-way Go CLI that packs massive codebases and Unreal Engine projects into AI-ready context (Markdown/XML/JSON), and automatically restores AI-generated code back to your local file system.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages