From 1fb3e75b913ee19e0cdcf6a27b98bb4ad6bb9a0f Mon Sep 17 00:00:00 2001 From: "Samuel Egbajie (MAJ0R)" <49847624+CodePapi@users.noreply.github.com> Date: Sun, 8 Feb 2026 06:00:03 +0100 Subject: [PATCH 1/2] fix: updated read me --- README.md | 165 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 85 insertions(+), 80 deletions(-) diff --git a/README.md b/README.md index 15a0382..a4ee708 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,49 @@ # CodePapi AI ⚡ -> **Transform your code instantly with local AI power.** No cloud, no data leaks—just blazing-fast code translation, migration, and debugging on your machine. +> **A local AI-powered code companion.** Keep your code on your machine while exploring code translation, reviews, and debugging with LLMs. A learning project exploring local AI integration in developer workflows.  +    - --- ## What is CodePapi AI? -CodePapi AI is a professional, privacy-focused developer tool that brings the power of Large Language Models (LLMs) directly to your local development workflow. Whether you're translating code between languages, migrating frameworks, reviewing for security issues, or debugging complex logic—all your code stays on your machine. +CodePapi AI is an experimental, open-source project that brings Large Language Models (LLMs) to your local development environment. Translate code between languages, get AI-powered code reviews, and explore debugging workflows—all without sending your code to external services. + +**Note:** This is a hobby/learning project. While functional, it's not optimized for production use. Performance depends heavily on your hardware and model choice. Expect AI responses to take 10-60+ seconds depending on code size and hardware. ### Why CodePapi AI? -✅ **100% Private** — Your code never leaves your machine -✅ **Lightning Fast** — Runs locally on your hardware -✅ **Free** — MIT licensed, fully open-source -✅ **Extensible** — Add languages, frameworks, and custom prompts easily +✅ **Private** — Your code stays on your machine (no cloud uploads) +✅ **Open-Source** — Inspect the full codebase +✅ **Free** — MIT licensed, no subscriptions +✅ **Learning Tool** — Explore local LLM integration in practice --- -## ✨ Core Features +## ✨ Features -#### 🔄 Smart Code Translation -Effortlessly convert code between 10+ languages including JavaScript, TypeScript, Python, Go, Rust, Java, and more. The system is flexible enough to support any language you add. +#### 🔄 Code Translation +Convert code between supported languages: JavaScript, TypeScript, Python, Go, Rust, Java, C++, PHP, Ruby, Swift, and C#. Quality depends on model accuracy and code complexity. -#### 🚀 Framework Migration Engine -Pre-built, expert-level migration presets for common transformations: -- React Class Components → React Functional Components (with Hooks) -- JavaScript → TypeScript -- CSS → Tailwind CSS -- React → Vue.js +#### 🔍 Code Review +Get AI-generated feedback on: +- Performance optimization ideas +- Potential security issues +- Code quality observations +- Best practice suggestions -#### 🔍 Deep Code Review -Get AI-driven analysis of your code covering: -- Performance optimization opportunities -- Security vulnerabilities -- Best practice violations -- Code quality improvements +**Note:** AI suggestions should be reviewed carefully and aren't a substitute for human code review. -#### 🐞 Interactive Bug Fixer -Fix bugs with confidence. The **Diff View** shows exactly what the AI changed, side-by-side comparison so you understand every modification before accepting. +#### 🐞 Bug Detection +The **Diff View** shows AI-suggested fixes side-by-side with original code. Always test fixes before committing. -#### 🔒 Air-Gapped Privacy -Powered by **Qwen2.5-Coder** (1.5GB model) running locally through **Ollama**. Your code never touches the internet. +#### 🔒 Local Privacy +Code processing happens locally using Qwen2.5-Coder via Ollama—nothing leaves your machine. --- @@ -71,18 +68,20 @@ docker-compose up -d ### First Launch Setup -> ⚠️ **Important:** The first startup requires downloading AI models. Ensure you have a stable internet connection. +> ⚠️ **First Run:** The first startup downloads the AI model (~1.5GB). Ensure stable internet and available disk space. -After starting the containers, pull the required models: +After starting the containers, pull the required model: ```bash -# Pull Qwen2.5 Coder (primary model, ~1.5GB) docker exec ollama ollama pull qwen2.5-coder:1.5b - -# Pull Phi-3 Mini (optional, ~2.3GB alternative model) -docker exec ollama ollama pull phi3:mini ``` +**Initial Request Times:** Expect 10-90 seconds for initial responses depending on: +- Your CPU/GPU specs +- Code size +- Available system memory +- Background processes + Once the models are downloaded and containers are running: - **🖥️ Frontend:** Open http://localhost in your browser - **🔌 API:** Backend runs at http://localhost:3000 @@ -92,14 +91,19 @@ Once the models are downloaded and containers are running: ## 💻 How to Use -1. **Paste or type your code** into the left editor -2. **Select a source language/framework** from the dropdown -3. **Choose your action:** +1. Paste or type code into the left editor +2. Select a source language +3. Choose an action: - **Translate:** Pick a target language - - **Review:** Get AI analysis (no target needed) - - **Check Bugs:** See a diff view of fixes -4. **Click "Run AI"** and watch the magic happen -5. **Copy the result** or download your transformed code + - **Review:** Get feedback on code + - **Check Bugs:** See suggested fixes +4. Click "Run AI" and wait for results +5. Copy or review the output + +**Tips:** +- Smaller code snippets get faster responses +- Review AI suggestions before using them in production +- Results vary based on code complexity and quality --- @@ -120,13 +124,13 @@ Once the models are downloaded and containers are running: ### Adding New Languages -Want to support more programming languages or migration presets? It's easy! +Want to support more programming languages? It's easy! See the **[Frontend Documentation](./frontend/README.md)** for detailed instructions on adding languages to `frontend/src/constants/languages.ts`. ### Code Quality -We use **Biome** for lightning-fast linting and formatting. Before submitting a PR, run: +We use **Biome** for linting and formatting. Before submitting a PR, run: ```bash npm run biome:lint # Check for issues @@ -140,7 +144,7 @@ codepapi-ai/ ├── backend/ # NestJS API server │ └── src/converter/ # Code conversion logic ├── frontend/ # React UI application -│ └── src/constants/ # Language & migration definitions +│ └── src/constants/ # Language definitions ├── docker-compose.yml # Full stack orchestration └── README.md # This file ``` @@ -162,7 +166,13 @@ Violations will not be tolerated and may result in removal from the project. ## 🤝 Contributing Guidelines -We welcome contributions from the community! Whether it's bug fixes, features, documentation, or translations, your help makes CodePapi AI better. +We welcome contributions! This is a learning/hobby project, so contributions can range from bug fixes and feature ideas to documentation and testing. + +### Important Notes + +- **This is experimental code.** Don't expect production-grade stability +- **Limitations are intentional** — helps us learn and improve +- **AI suggestions need review** — this tool augments, not replaces, human developers ### Getting Started @@ -259,7 +269,7 @@ Before submitting a PR, ensure: While formal unit tests are encouraged: - **Manual testing** is acceptable for UI changes - **Test in Docker** to ensure consistency across environments -- **Test with the Qwen2.5-Coder model** (not a different LLM) +- **Test with the Qwen2.5-Coder model** - **Document test steps** in your PR ### Review Process @@ -276,10 +286,10 @@ While formal unit tests are encouraged: - 🧪 **Testing:** Test coverage and edge cases - 📚 **Documentation:** Guides, tutorials, examples - 🐛 **Bug fixes:** Active issues on GitHub -- ✨ **Features:** Language support, migration presets, new modes +- ✨ **Features:** Language support, new modes - 🎨 **UI/UX:** Design improvements, accessibility -See the [Issues page](https://github.com/yourusername/codepapi-ai/issues) for tasks labeled `good first issue` and `help wanted`. +See the [Issues page](https://github.com/codepapi/codepapi-ai/issues) for tasks labeled `good first issue` and `help wanted`. ### Recognition @@ -291,42 +301,37 @@ See the [Issues page](https://github.com/yourusername/codepapi-ai/issues) for ta ## 🤖 Responsible AI Ethics -As an AI-powered tool, CodePapi AI follows these ethical principles: +As an experimental AI project, CodePapi AI follows responsible practices: -### Privacy First -- **No telemetry:** We don't track usage or collect analytics -- **Local processing:** All code processing happens on your machine -- **No training data:** Your code is never used to train or improve models -- **GDPR compliant:** Full control over your data +### Privacy +- **No telemetry:** We don't collect usage analytics +- **Local processing:** All code stays on your machine +- **No training:** Your code never trains models ### Transparency -- **Open source:** Full code transparency — inspect everything -- **Model disclosure:** We explicitly state which LLM is used (Phi-3 Mini) -- **Limitations:** We're honest about what the AI can and cannot do -- **Attribution:** AI improvements are documented and credited - -### Responsible Use Guidelines - -**Do:** -- ✅ Use CodePapi AI for legitimate code improvement -- ✅ Review AI suggestions before implementing -- ✅ Report security issues responsibly -- ✅ Contribute improvements back to the community - -**Don't:** -- ❌ Use for malicious code generation -- ❌ Bypass security reviews using AI -- ❌ Rely solely on AI without code review -- ❌ Claim AI-generated code as entirely your own without attribution - -### Security Considerations -- Always review code generated by AI before committing -- Run security scanners on translated/migrated code -- Test thoroughly in safe environments first -- Report any security concerns to [security@example.com] +- **Open source:** Full code inspection available +- **Clear limitations:** We're honest about what works and what doesn't +- **No magic:** It's an AI assistant, not a replacement for human judgment + +### Use Responsibly +- Review all AI suggestions before implementing +- Don't rely solely on AI output for security-critical code +- Test thoroughly in your environment +- Report security issues privately --- +## 🚨 Limitations & Known Issues + +This is an experimental project with real limitations: + +- **Speed:** Not fast. Responses take 10-90+ seconds per request +- **Quality:** AI output varies. Some translations work well, others need manual fixes +- **Hardware-dependent:** Performance heavily depends on your CPU/GPU and available RAM +- **Model limitations:** Qwen2.5-Coder is a smaller model; results aren't comparable to larger proprietary models +- **Error handling:** Limited error checking and validation +- **Production use:** Not suitable for mission-critical workflows without thorough testing + ## 🚨 Reporting Issues & Security ### Bug Reports @@ -371,16 +376,16 @@ Distributed under the **MIT License**. See [LICENSE](./LICENSE) for details. ## 💬 Support -- **Issues:** Report bugs on [GitHub Issues](https://github.com/yourusername/codepapi-ai/issues) -- **Discussions:** Ask questions in [GitHub Discussions](https://github.com/yourusername/codepapi-ai/discussions) +- **Issues:** Report bugs on [GitHub Issues](https://github.com/codepapi/codepapi-ai/issues) +- **Discussions:** Ask questions in [GitHub Discussions](https://github.com/codepapi/codepapi-ai/discussions) - **Docs:** Full documentation in [README files](./frontend/README.md) ---
A progressive Node.js framework for building efficient and scalable server-side applications.
- - - -## Description - -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. - -## Project setup +# CodePapi Backend -```bash -$ pnpm install -``` - -## Compile and run the project +## Overview -```bash -# development -$ pnpm run start - -# watch mode -$ pnpm run start:dev +NestJS API server that orchestrates local LLM inference via Ollama and LangChain. Provides endpoints for code translation, review, and bug detection. -# production mode -$ pnpm run start:prod -``` +**Note:** This is part of an experimental hobby project. Code quality and performance optimizations are secondary to learning and experimentation. -## Run tests +## Project Setup ```bash -# unit tests -$ pnpm run test - -# e2e tests -$ pnpm run test:e2e - -# test coverage -$ pnpm run test:cov +npm install ``` -## Deployment - -When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information. - -If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps: +## Running the Application ```bash -$ pnpm install -g @nestjs/mau -$ mau deploy +# Development mode +npm run start:dev + +# Production mode +npm run start ``` -With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure. +The API runs on `http://localhost:3000` -## Resources +## Endpoints -Check out a few resources that may come in handy when working with NestJS: +- `POST /converter/translate` — Translate code between languages +- `POST /converter/review` — Get AI feedback on code +- `POST /converter/fix` — Get AI bug fixes with diff -- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework. -- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy). -- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/). -- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks. -- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com). -- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com). -- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs). -- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com). +All requests expect JSON bodies with `code` and language parameters. -## Support +## Architecture -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). +- **Controller:** `converter.controller.ts` — HTTP request handling +- **Service:** `converter.service.ts` — AI prompt orchestration via LangChain +- **Module:** `converter.module.ts` — Dependency injection setup -## Stay in touch +## Key Dependencies -- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) +- `@langchain/ollama` — LLM integration with Ollama +- `@nestjs/core` — Framework +- `@nestjs/common` — Common utilities -## License +## Performance Notes -Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE). +- AI responses take 10-90+ seconds depending on code size and hardware +- Requests are blocking (no queue system) +- Suitable for local development, not production use +- Single model instance (Qwen2.5-Coder) diff --git a/frontend/README.md b/frontend/README.md index 847906c..0c515ab 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,12 +1,11 @@ ## Adding More Languages -If you'd like to add new programming languages or framework migration presets to the UI, edit `frontend/src/constants/languages.ts`. The file exports two arrays: `LANGUAGES` (regular languages/options) and `MIGRATIONS` (framework-specific migration presets). Follow these guidelines: +To add new programming languages to the UI, edit `frontend/src/constants/languages.ts`. The file exports a `LANGUAGES` array with supported languages. - File location: `frontend/src/constants/languages.ts` -- Each language entry should include at least `id` and `name`. -- Migration presets may include `id`, `name`, and any additional metadata your application uses. +- Each language entry should include `id` and `name` -Example entries: +Example: ```ts // frontend/src/constants/languages.ts @@ -16,20 +15,13 @@ export const LANGUAGES = [ { id: 'python', name: 'Python' }, // Add more languages here ]; - -export const MIGRATIONS = [ - { id: 'react-ts', name: 'React (Class) → React (TS)' }, - { id: 'react-vue', name: 'React → Vue' }, - // Add more migration presets here -]; ``` Tips: -- Keep `id` values unique and use kebab-case (e.g. `react-ts`, `node-express`). -- If you add new migration presets, ensure the backend conversion logic (if any) recognizes the `id` and maps it to the proper prompt behavior. -- After editing `languages.ts`, the `LanguageSelector` and other UI components will automatically include your new items. -- You can add additional metadata (for example `editorMode`, `fileExtension`, or `isMigration`) if you want the UI or backend to handle the language differently — just update the consuming code accordingly. +- Keep `id` values unique and use lowercase (e.g., `javascript`, `python`) +- After editing `languages.ts`, the `LanguageSelector` component automatically includes your new items +- The backend `converter.service.ts` handles the translation prompt for each language -If you want help wiring up a more complex metadata format, tell me which fields you'd like and I can update the types and components for you. +For more complex metadata or customization, check the component prop types in `LanguageSelector.tsx`.