Show HN: Transform your codebase into a single Markdown doc for feeding into AI (tesserato.web.app)
CodeWeaver is a command-line tool designed to weave your codebase into a single, easy-to-navigate Markdown document. It recursively scans a directory, generating a structured representation of your project's file hierarchy and embedding the content of each file within code blocks. This tool simplifies codebase sharing, documentation, and integration with AI/ML code analysis tools by providing a consolidated and readable Markdown output.
171 comments
[ 2.6 ms ] story [ 218 ms ] threadNot a replacement for full 4M lines but it might work for some tasks/prompts
Use better tools people!
1. https://github.com/BandarLabs/cveingest
I’ve been getting complete working code with this strategy but I’m creating projects that are relatively simple.
I also notice that I have to give a little deeper context about “how” it should work, which I normally wouldn’t do.
It's not mentioned on the page but is it using [0] in the background? Edit -> It's a Go program so I guess not.
[0] https://github.com/microsoft/markitdown
I wrote this library [1] and hope to add the fine-grained "reference resolution" utility to it at some point, which could make implementing such a tool a lot simpler.
[1]: https://github.com/aleclarson/ts-module-graph
[1] https://www.codeweavers.com/
I prefer the idea of the other comment reply where you use AI as a tool to explore a codebase and assist you, not something you instruct to do the work. It can accelerate you building that experience and intuition at a level we've never been able to do before.
Regarding testing, I’ve had an interaction with windsurf where I told it there was a bug in the application it generated. It replied “I’ve added some log statements, can you run it and tell me what you see, then I’ll know what to fix”… The llm was instructing me…
In Emacs I’ve had good experience with gptel as well but I prefer aider for the coding workflow
Pretty big flag that this isn't ready for primetime.
https://github.com/franzenzenhofer/thisismy
supports files, resursive directories, .gitignor and .thisismyignore and online ressources / URLs + tree commands
also available as a chrome extension https://thisismy.franzai.com/
It's actually pretty straightforward if you're in a language with lexical scoping, and it simplifies some things, like includes / cyclical, no modules, no hunting through files, etc.
I feel like this set up could integrate really well w/ AI models.
I've found that the only real limitation, at least in my experiment, was a lack of decent editor support. I use vim so this wasn't really much of an issue for me with many great ways to navigate a file, and a combination of vertical and horizontal splits on a large screen, but when I opened it up in other "modern" editors the ergonomics fell apart quite a bit.
I think the biggest downside was re-using variable names between large scopes occasionally made it hard to find the reference I wanted (E.g. i, x, key, val), but again, better editor support allowing you to limit your search to within the current scope would help. Also easily mitigated with more verbose throwaway variable naming.
I’m thinking the same approach would also work well in F#, Haskell, OCaml.
It’s easy to switch to files by name with a few keystrokes. Files are names to group things I’m looking for.
I would much rather do that than try to search through a 7,000 line file for what I need.
> I feel like this set up could integrate really well w/ AI models.
Massive files or too many files break AI models. Grouping functionality into smaller files and including only relevant files is key. The file and folder names can be hints about where to find the right files to include.
I mean I'm not arguing for it as a best practice. I did it as an experiment (as I stated), and discovered it's actually really easy, and snappy for me to navigate in Vim. Mileage may vary with other editors. Have you tried it?
> Massive files or too many files break AI models
It's growing faster than I code! With the latest Gemeni at least it's much larger at 1-2 mil tokens. I'm sure we'll hit a ceiling though, but I also think we may find some context caching / rag type optimizations eventually.
Then `| pbcopy` to copy to clipboard and paste it into ChatGPT or similar.
Filename: demo.py
```python
```https://github.com/jzombie/globcat.sh
Nothing fancy, but gets the job done.
You should use Aider/Cursor for proper indexing/intelligent codebase referencing
any tips?
found the problem
Certainly, I do that several times a day.
The best results come from feeding precisely targeted context directly into the prompt, where you know exactly what the model sees and how it processes it. The prompt receives the most accurate use of attention—whereas god knows what the pipeline is for cursor or what extra layers and context restrictions they add on top of base Claude.
Giving the model a clean project hierarchy accomplishes a lot efficiently in terms of context tokens. The key is ensuring it only sees what's relevant, without diluting its attention.
Tools like reopmix and OP's version, feeding targeted context straight into models like Claude or Google's offerings, outperform Copilot and Cursor in my experience, even though they use the same base models. Use the highest-quality attention (the prompt context) directly, rather than layers of uncertainty and "proper indexing".
https://github.com/bodo-run/yek
Can I call this c++ code “machine code” now?
The challenge is maintaining it... But you'd maybe ask the model to do that incrementally on every commit, or just throw it away and regenerate from scratch occasionally.
(unless the reason you're giving AI the code is that you don't have any docs for either humans or machines)
Now no one will need something that can handle all of the edge cases, but whatever edge cases they need to be handled will already be handled. The overall time and frustration saved this way can be huge.
https://aider.chat/docs/usage/copypaste.html
and with /paste you can apply the changes.
To add some more detail, aider has a mode/UX that is optimized for "copy and paste" coding with LLM web chats. The "big brain" LLM in the web chat does the hard work, and a cheap/local LLM works with aider to apply edits to your local files.
There's a little demo video in the link above that should give you the gist.