
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
code-preview
Advanced tools
A universal CLI tool to preview uncommitted code changes with rich syntax highlighting β before you commit them.
A universal CLI tool to preview uncommitted code changes with rich syntax highlighting β before you commit them.
It works with any language and any Git repository.
Quickly visualize what your next commit will look like β right in your terminal.
Here is a preview of what changed in a Java file:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
a/src/main/java/com/example/App.java β b/src/main/java/com/example/App.java
@@ -14,6 +14,8 @@
public class App {
public static void main(String[] args) {
- System.out.println("Hello, world!");
+ System.out.println("Hello, Aryant!");
+ System.out.println("Code preview is working");
}
}
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
You can install code-preview using pip:
pip install code-preview
If you want to install it from your local folder for development:
git clone https://github.com/Aryant-Tripathi/code-preview.git
cd code-preview
pip install -e .
Simply run the command in the root of your Git repository:
code-preview
You can limit the preview to a specific directory or file:
code-preview src/
You can also run the tool directly as a Python module:
python -m code_preview.cli
.java, .py, .js, etc.)--html mode for browser-based diff preview--watch mode for real-time change trackingInterested in contributing? Here's how to set up your environment.
python3 -m venv venv
source venv/bin/activate
Install the project in "editable" mode:
pip install -e .
Run the tool using the development entry point:
python -m code_preview.cli
code-preview/
βββ src/
β βββ code_preview/
β βββ __init__.py # Package initializer
β βββ cli.py # Main CLI entry point (argparse)
β βββ git_utils.py # Git interaction logic
β βββ diff_renderer.py # Logic for rendering diffs with Rich
β βββ file_utils.py # File reading utilities
βββ pyproject.toml # Build configuration (PEP 621)
βββ setup.cfg # Package metadata
βββ README.md
βββ LICENSE
Build:
python3 -m build
Upload to TestPyPI:
python3 -m twine upload --repository testpypi dist/*
Test Install:
pip install -i https://test.pypi.org/simple/ code-preview
Publish to PyPI:
python3 -m twine upload dist/*
Contributions are welcome! If you find this project useful:
git diff previews for all developersAryant Tripathi
This project is licensed under the Apache-2.0 License β see the LICENSE file for details.
FAQs
A universal CLI tool to preview uncommitted code changes with rich syntax highlighting β before you commit them.
We found that code-preview demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: whatβs affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.