Urgent.News

What's breaking now, across thousands of outlets.

AI

How to give ChatGPT your whole codebase in one file with Repomix

ChatGPT is good at reviewing code, explaining an unfamiliar project and writing tests. It is bad at guessing what is in the 40 files you did not paste. Copying files one by one is slow, you lose the folder structure, and you never know how close you are to the context limit. Repomix packs an entire repository into a single AI-friendly file with one command. It respects your .gitignore , counts…

ChatGPT excels at reviewing code, explaining unfamiliar projects, and generating tests. However, it struggles to infer the contents of 40+ files not included in the input. Copying files individually is time-consuming, removes folder structure, and risks exceeding the context limit. Repomix addresses this by compressing an entire repository into a single AI-friendly file with one command, respecting .gitignore, tokenizing per file and the whole repo, scanning for secrets with Secretlint, and compressing code down to its structure using Tree-sitter.

Users can then upload this one file to ChatGPT, Claude, Gemini or any other model. The guide covers the end-to-end workflow as follows:

1. Pack the repository: No installation required. In the project folder, run `npx repomix@latest`. Install globally for frequent use using Homebrew, npm, Yarn, or Bun. Running `repomix` writes `repomix-output.xml` containing a file summary, directory structure, and file contents to the current folder. The terminal output shows token count and the five largest files, helping determine if the upload will fit.

2. Hand it to ChatGPT: Upload `repomix-output.xml` to a ChatGPT chat or paste it if it's small. Start with a prompt like the one in the README, asking the model to review the code first.

3. Handle large repositories: Repomix offers four levers for managing context window constraints. Pack only what's necessary using glob patterns to include or ignore paths. Compress with `--compress` using Tree-sitter, strip noise with `--remove-comments` and `--remove-empty-lines`, split into numbered files with `--split-output`, or view file tree with token counts using `--token-count-tree`.

4. Choose a model-friendly format: The default is XML. Other options include Markdown, JSON, or plain text. Markdown aids skimming, while JSON is useful for querying with jq. Repomix can also pack GitHub repos without cloning using `--remote`.

Additional features include security enhancements, adding git context, and pre-defined prompts for code review, documentation, and testing. Repomix can be configured via `repomix.config.json` or run via command line, website, browser extensions, or VS Code extension.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

How to stop Cursor and Claude Code from writing outdated API code with Context7

You ask your coding agent for a Next.js route, a Supabase sign-up form or a Cloudflare Worker, and it confidently writes code against an API that changed a year ago.

  • Context7 fetches current API documentation and code examples
  • One-command setup available for Cursor, Claude Code, VS Code, Codex
  • Prevent outdated API code with a simple rule at end of prompts

Anthropic Study Shows Hidden AI Advice Sways Experts 86% Of Time

Researchers at Anthropic , the AI company behind Claude, found experts follow an AI tool's hidden advice 86% of the time, raising worries for medicine, finance and national security.

  • Experts follow AI's hidden advice 86% of the time.
  • Study published on Anthropic's website examines influence.
  • Concern arises for sectors like medicine and finance.

More from Thursday 29 October →