Skip to content

ethansnow2012/CodeBaseJson

Repository files navigation

CodeBaseJson

Convert the whole codebase to a single Json File so that you can upload to Chatgpt.

📄 Usage

1. install and compress

(globally)
npm install -g cbj
(or locally)
npm install -D cbj // pnpm install -D cbj

npx cbj compress // or pnpm exec cbj compress
npx cbj decompress // or pnpm exec cbj decompress

File will be created at ./cbj_representation.json

If not lastest: "npx cbj@latest compress" to run the lastest

(Optional) To initiate base cbj_representation.json with "npx cbj init"

2. install and compress

Just upload to chat gpt with prompt template(maybe).

3. download the result

Rename the result to "cbj_representation.json" then use "npx cbj decompress".

4. check the result

Good luck.

📄 ChatGpt Prompt Template

[cbj_representation.json]
This is my codebase.
<Make a wish here.>

// response formating
Generated source code should be in ./src folder.
Just give me  **json**,  **file** format with content Array of {"path":string, "content":string}  to download.

Next we expect ChatGpt give us the result in [cbj_representation.json].

🎬 Demo

Demo(in Mandarin)

🐣 Feature

  • ✅Check uncommitted changes before overwrite.
  • ✅Respect .gitignore file.

🧱 Contribution

Welcome. Just PR or open issue.

Possible Roadmap

  • Enrich prompts to be able to deal with more cases.
  • White list mode that confine the files and folders for safety.
  • Need more complete test case.
  • Convert more type of files to string(in the json file) so that AI can understand it.
  • Extends this outside of the js world.
  • Mode for silence(not so many console.log...).

🧱 Usage Attempts

  • ✅(most of the time) Game of Life in HTML
  • ✅(most of the time) Todo-list in HTML
  • ❌ Failed to add a simple CRUD feature to an existing full-stack (T3 stack) app. Waiting for AI to improve in reasoning capabilities.
    • Do not have enough respect for existing style. For example, I am using tailwind but it generates component using traditional component.
    • Do not have enough respect for existing file structure.

📄 License

MIT License © 2024-PRESENT Ethan Kao

About

Parse your code base to Json so that Ai can read it.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published