I am a Data Engineer, and I am currently assigned a task to refactor an outdated code and rectify any bugs present. However, I am unable to comprehend the code written in the existing codebase. Furthermore, the developers who worked on this codebase did not provide any documentation. Consequently, I am inquiring if there is a feasible method to convert the entire codebase into an extensive text document. Subsequently, I would like to utilize ChatGPT to translate the codebase into a comprehensive document(very long text, with folder structure tree and code inside src) that I can use to embedding. I do not require an in-depth explanation of the code; rather, I am seeking a more abstract-level understanding, such as the purpose of specific files, the functionality of particular folders, etc.
Sure, many people have done that.
You can also ask it to add comments or try to find bugs.
Just take into account that LLMs are known for generating bullshit, so the explanations could be mere fabrications and the generated code may not work (in evident or subtle ways).
I myself have tried chatGPT for generating code, but I had to iterate a few times until I got it working. I suggest you prepare some unit tests and integration tests to ensure that everything is working as before chatGPT's suggested changes.
Take into account that the amount of text/code an LLM can use as context is not that large, so you may need to ask multiple times regarding different parts of the code base.
There may also be privacy concerns regarding the fact that you are basically sending the source code of your company to a third party, which is something many employers would frown upon.