Live data from Hacker News

Show HN: Transform your codebase into a single Markdown doc for feeding into AI

tesserato.web.app

131–140 of 172 posts

Re: Show HN: Transform your codebase into a single Markdown doc for feeding into AI

#131
post #66

I use the following for feeding into AI find . -print -exec cat {} \; -exec echo \; Which will return for each file (and subfolders) the filename and then the content of the file. Then `| pbcopy` to copy to clipboard and paste it into ChatGPT or similar.

That's very nice and compact. I do the same with a short bash script, but wrap each file in triple-backticks and attempt to put the correct language label on each eg: Filename: demo.py ```python ...python code here... ```

Seconded because just having something autowrapped like that and putting the clipboard would save me time: release the snyder cut, er, bash script!

Re: Show HN: Transform your codebase into a single Markdown doc for feeding into AI

#133
post #123

Earlier quoted context omitted.

Correct, but it's the same as what OP shared. You should use Aider/Cursor for proper indexing/intelligent codebase referencing

I'm still puzzled how come people are convinced by Cursor, while my experience was meh at best. Can it index your stuff? okay it can. Can it refactor a simple function? No it cannot, it can't even rename a damn Java class. How can I trust it to generate then code based on my codebase? So, what is your use case then? Or can anybody point me to some blog/articles/videos showing some real use cases for Cursor? Real as i…

Correct. It's Web 3.0 2.0. You're supposed to play along to make the stock prices go up and to the right.

Re: Show HN: Transform your codebase into a single Markdown doc for feeding into AI

#135

I use aider /copy-context command for that https://aider.chat/docs/usage/copypaste.html and with /paste you can apply the changes.

Thanks for letting folks know about aider's /copy-context command.

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.

Re: Show HN: Transform your codebase into a single Markdown doc for feeding into AI

#136
If it's useful to anyone, I made a VS Code/Cursor extension that combines all open files into one big text document.

I use it with ChatGPT's o1 pro (which can handle around 100,000 tokens).

1. Open all of the files I think are relevant

2. Use the extension to combine them

3. Copy and paste into ChatGPT

https://marketplace.visualstudio.com/items?itemName=DVYIO.co...

Re: Show HN: Transform your codebase into a single Markdown doc for feeding into AI

#137
Following the /llms.txt standard proposition, I create a MkDocs plugin that generates an /llms.txt file at the root of your site. So, same thing, but generates the Markdown document from your docs (possibly containing API reference) instead of your code.

Re: Show HN: Transform your codebase into a single Markdown doc for feeding into AI

#138

This is like a rediscovery of an org-mode capability that has existed for decades, and doesn't do as much.

Is it? I use org-babel regularly but wasn't aware of it - what's the function called? As great as org-mode / org-babel is, the user base is too small to not be overlooked.

Well in general I've put entire projects into org docs, and ran the code blocks, essentially using it like a Jupyter notebook (although honestly it wasn't always as smooth as I'd like). And I haven't done this myself, but there's a neat literate programming talk from the last EmacsConf[0] in which the presenter showed some custom capabilities which improved the experience even more for him.

[0] https://emacsconf.org/2024/talks/literate/

Re: Show HN: Transform your codebase into a single Markdown doc for feeding into AI

#139

Wouldn't it be wonderful to have a tool where you interact with AI interactively through the codebase via IDE / vim / emacs tree? Say, you open your codebase and start with prompts and AI+tool navigates to a function or a place where it needs to and modifies stuff while chatting to you about it? Or you jump to somewhere, highlight where you are to scope down the focus of it (while it still retains all of the code in…

I think you’re describing Aider.chat. There are 2 Emacs packages for it, one official and a very recent fork. Aider is a cli so it works great with vim as well. In Emacs I’ve had good experience with gptel as well but I prefer aider for the coding workflow

Yep, I've particularly been enjoying the recent "watchfiles" feature where a comment can be added to the source file, and ending it with "ai?" or "ai!" triggers use of said comment as a prompt to ask about or change that section upon save.
Post reply on HN