Skip to content

Commit ded2b52

Browse files
committed
ft: added license
1 parent a90aa24 commit ded2b52

25 files changed

+652
-232
lines changed

.github/workflows/biome-check.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Biome Lint and Format Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
biome_check:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: ⬇️ Checkout Repository
17+
uses: actions/checkout@v4
18+
19+
- name: ⚙️ Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
24+
- name: 📦 Install Dependencies
25+
run: npm install
26+
27+
- name: 📝 Run Biome Lint Check
28+
run: npm run biome:lint
29+
30+
- name: 📏 Run Biome Format Check
31+
run: npm run biome:format

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2026 [Samuel Egbajie/CodePapi] <oshiesam@gmail.com>
4+
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
```markdown
2+
# CodePapi AI ⚡
3+
4+
**CodePapi AI** is a professional, privacy-focused developer utility that brings the power of LLMs to your local workflow. Translate code from any language to another, migrate frameworks, reviews codes, and debug logic—all without your data ever leaving your machine.
5+
6+
![License](https://img.shields.io/badge/license-MIT-blue.svg)
7+
![Ollama](https://img.shields.io/badge/AI-Ollama-orange.svg)
8+
![React](https://img.shields.io/badge/Frontend-React-61DAFB.svg)
9+
![NestJS](https://img.shields.io/badge/Backend-NestJS-E0234E.svg)
10+
![Biome](https://img.shields.io/badge/Linter-Biome-60a5fa.svg)
11+
12+
---
13+
14+
## 📺 Demo
15+
16+
https://github.com/user-attachments/assets/00000000-0000-0000-0000-000000000000
17+
18+
---
19+
20+
## ✨ Features
21+
22+
- 🔄 **Smart Translation**: Seamlessly convert code between 10+ languages (Go, Rust, Python, TS, etc., flexible enough to support more languages).
23+
- 🚀 **Migration Engine**: Expert-level presets for:
24+
- React Class Components ➡️ Functional Components
25+
- JavaScript ➡️ TypeScript
26+
- CSS ➡️ Tailwind CSS
27+
- React ➡️ Vue
28+
- 🔍 **Deep Code Review**: AI-driven analysis of performance, security, and best practices.
29+
- 🐞 **Interactive Bug Fixer**: Side-by-side **Diff View** highlighting exactly what the AI changed to fix your logic.
30+
- 🔒 **Air-Gapped Privacy**: Powered by `phi3:mini` running locally via **Ollama**.
31+
32+
---
33+
34+
## 🚀 Quick Start
35+
36+
### 1. Prerequisites
37+
- [Docker & Docker Compose](https://docs.docker.com/get-docker/)
38+
39+
### 2. Setup & Installation
40+
```bash
41+
# Clone the repository
42+
git clone [https://github.com/yourusername/codepapi-ai.git](https://github.com/yourusername/codepapi-ai.git)
43+
cd codepapi-ai
44+
45+
# Start the entire stack (AI + Backend + Frontend)
46+
docker-compose up -d
47+
48+
```
49+
50+
### 3. Usage
51+
52+
* **Frontend**: Open [http://localhost](https://www.google.com/search?q=http://localhost)
53+
* **API**: Accessible at [http://localhost:3000](https://www.google.com/search?q=http://localhost:3000)
54+
55+
*Note: The first startup pulls the Phi-3 Mini model (approx 2.3GB). Please ensure you have a stable internet connection.*
56+
57+
---
58+
59+
## 🛠 Tech Stack
60+
61+
| Component | Technology |
62+
| --- | --- |
63+
| **AI Engine** | [Ollama](https://ollama.ai/) (phi3:mini) |
64+
| **Orchestration** | LangChain.js |
65+
| **Backend** | NestJS (Node.js) |
66+
| **Frontend** | React, TailwindCSS, Lucide |
67+
| **Editor** | Monaco Editor (VS Code Engine) |
68+
| **Tooling** | Biome (Linting & Formatting) |
69+
70+
---
71+
72+
## 🤝 Contributing
73+
74+
We use **Biome** for lightning-fast linting and formatting. Please run the following before submitting a Pull Request:
75+
76+
```bash
77+
# Check and apply fixes
78+
npx @biomejs/biome check --apply .
79+
80+
```
81+
82+
**Adding Languages:** To add new programming languages or migration presets used by the UI, see the frontend documentation: `frontend/README.md` (section "Adding More Languages"). Edit `frontend/src/constants/languages.ts` to add entries.
83+
84+
## 📜 License
85+
86+
Distributed under the MIT License. See `LICENSE` for more information.
87+
88+
---
89+
90+
Created with ❤️ by [Your Name]
91+
92+
```
93+
94+
---
95+
96+
### 🔧 Step 4: The Biome Configuration (`biome.json`)
97+
Run `npx @biomejs/biome init` in your project root. It will create this file. Here is a solid configuration for your project:
98+
99+
```json
100+
{
101+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
102+
"organizeImports": {
103+
"enabled": true
104+
},
105+
"linter": {
106+
"enabled": true,
107+
"rules": {
108+
"recommended": true,
109+
"complexity": {
110+
"noForeach": "off"
111+
}
112+
}
113+
},
114+
"formatter": {
115+
"enabled": true,
116+
"indentStyle": "space",
117+
"indentWidth": 2,
118+
"lineWidth": 100
119+
}
120+
}
121+
122+
```

backend/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "backend",
2+
"name": "codepapi-ai-backend",
3+
"description": "A backend for the CodePapi AI tool",
4+
"author": "Samuel Egbajie",
35
"version": "0.0.1",
4-
"description": "",
5-
"author": "",
66
"private": true,
77
"license": "UNLICENSED",
88
"scripts": {

backend/src/converter/converter.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Controller, Post, Body } from '@nestjs/common';
1+
import { Body, Controller, Post } from '@nestjs/common';
22
import { ConverterService } from './converter.service';
33

44
@Controller('converter')
@@ -19,4 +19,4 @@ export class ConverterController {
1919
async fix(@Body() data: { code: string; lang: string }) {
2020
return this.converterService.fixBugs(data.code, data.lang);
2121
}
22-
}
22+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Module } from '@nestjs/common';
2-
import { ConverterService } from './converter.service';
32
import { ConverterController } from './converter.controller';
3+
import { ConverterService } from './converter.service';
44

55
@Module({
66
providers: [ConverterService],
7-
controllers: [ConverterController]
7+
controllers: [ConverterController],
88
})
99
export class ConverterModule {}

backend/src/converter/converter.service.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Injectable, InternalServerErrorException } from '@nestjs/common';
21
import { ChatOllama } from '@langchain/ollama';
2+
import { Injectable, InternalServerErrorException } from '@nestjs/common';
33

44
@Injectable()
55
export class ConverterService {
@@ -8,25 +8,29 @@ export class ConverterService {
88
constructor() {
99
this.model = new ChatOllama({
1010
baseUrl: process.env.OLLAMA_URL || 'http://localhost:11434',
11-
model: 'qwen2.5-coder:1.5b',
11+
model: 'phi3:mini',
1212
});
1313
}
1414

1515
// --- 1. CODE TRANSLATION ---
16-
async convertCode(code: string, from: string, to: string) {
17-
// Check if "to" is a migration preset
18-
const isMigration = to.includes('-') || from.includes('-');
19-
20-
const prompt = `
16+
async convertCode(code: string, from: string, to: string) {
17+
// Check if "to" is a migration preset
18+
const isMigration = to.includes('-') || from.includes('-');
19+
20+
const prompt = `
2121
You are an expert software architect specializing in ${isMigration ? 'code migration' : 'code translation'}.
2222
Task: Convert the input from ${from} to ${to}.
2323
24-
${isMigration ? `
24+
${
25+
isMigration
26+
? `
2527
SPECIFIC INSTRUCTIONS FOR MIGRATION:
2628
- If moving from Class to Functional components, use React Hooks (useState, useEffect).
2729
- If moving to TypeScript, add proper interfaces and types.
2830
- If moving between frameworks (e.g., React to Vue), map lifecycle methods and state management accurately.
29-
` : ''}
31+
`
32+
: ''
33+
}
3034
3135
RULES:
3236
- Return ONLY raw code.
@@ -72,13 +76,13 @@ async convertCode(code: string, from: string, to: string) {
7276
private async executeInvoke(prompt: string, key: string) {
7377
try {
7478
const response = await this.model.invoke(prompt);
75-
return {
76-
success: true,
77-
[key]: response.content
79+
return {
80+
success: true,
81+
[key]: response.content,
7882
};
7983
} catch (error) {
80-
console.error(`AI Service Error:`, error);
84+
console.error('AI Service Error:', error);
8185
throw new InternalServerErrorException('Failed to connect to AI engine');
8286
}
8387
}
84-
}
88+
}

backend/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { AppModule } from './app.module';
33

44
async function bootstrap() {
55
const app = await NestFactory.create(AppModule);
6-
app.enableCors();
6+
app.enableCors();
77
await app.listen(process.env.PORT ?? 3000);
88
}
99
bootstrap();

backend/test/app.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Test, TestingModule } from '@nestjs/testing';
21
import { INestApplication } from '@nestjs/common';
2+
import { Test, TestingModule } from '@nestjs/testing';
33
import * as request from 'supertest';
44
import { App } from 'supertest/types';
55
import { AppModule } from './../src/app.module';

biome.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4+
"files": {
5+
"include": ["src", "test"],
6+
"ignoreUnknown": false,
7+
"ignore": [
8+
"**/node_modules",
9+
"dist/**"
10+
]
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"useEditorconfig": true,
15+
"formatWithErrors": false,
16+
"indentStyle": "space",
17+
"indentWidth": 2,
18+
"lineEnding": "lf",
19+
"lineWidth": 80,
20+
"attributePosition": "auto",
21+
"bracketSpacing": true
22+
},
23+
"organizeImports": {
24+
"enabled": true
25+
},
26+
"linter": {
27+
"enabled": true,
28+
"rules": {
29+
"recommended": true,
30+
"style": {
31+
"useImportType": "off"
32+
},
33+
"complexity": {
34+
"noStaticOnlyClass": "off"
35+
}
36+
}
37+
},
38+
"javascript": {
39+
"parser": {
40+
"unsafeParameterDecoratorsEnabled": true
41+
},
42+
"formatter": {
43+
"jsxQuoteStyle": "double",
44+
"quoteProperties": "asNeeded",
45+
"trailingCommas": "all",
46+
"semicolons": "always",
47+
"arrowParentheses": "always",
48+
"bracketSameLine": false,
49+
"quoteStyle": "single",
50+
"attributePosition": "auto",
51+
"bracketSpacing": true
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)