Skip to content

Commit 308b0cf

Browse files
authored
Merge pull request #1 from cld2labs/feat/initial-project-setup
feat: initial project setup
2 parents 9dab07f + a48f559 commit 308b0cf

36 files changed

Lines changed: 2715 additions & 0 deletions

.env.example

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# ============================================================
2+
# CodeTrans — Environment Configuration
3+
# ============================================================
4+
5+
# Backend port
6+
BACKEND_PORT=5001
7+
8+
# ============================================================
9+
# Inference Provider
10+
# ============================================================
11+
# "remote" — Cloud or enterprise OpenAI-compatible API (e.g. CodeLlama via gateway)
12+
# "ollama" — Local Ollama running natively on the host machine (recommended for Mac)
13+
INFERENCE_PROVIDER=remote
14+
15+
# ============================================================
16+
# Option A: Remote OpenAI-compatible API (INFERENCE_PROVIDER=remote)
17+
# ============================================================
18+
# INFERENCE_API_ENDPOINT: Base URL of your inference service (no /v1 suffix)
19+
# - GenAI Gateway: https://genai-gateway.example.com
20+
# - APISIX Gateway: https://apisix-gateway.example.com/CodeLlama-34b-Instruct-hf
21+
INFERENCE_API_ENDPOINT=https://your-api-endpoint.com/deployment
22+
INFERENCE_API_TOKEN=your-pre-generated-token-here
23+
INFERENCE_MODEL_NAME=codellama/CodeLlama-34b-Instruct-hf
24+
25+
# ============================================================
26+
# Option B: Ollama — native host inference (INFERENCE_PROVIDER=ollama)
27+
# ============================================================
28+
#
29+
# IMPORTANT — Why Ollama runs on the host, NOT in Docker:
30+
# On macOS (Apple Silicon / M-series), running Ollama as a Docker container
31+
# bypasses Metal GPU acceleration. The model falls back to CPU-only inference
32+
# which is dramatically slower. Ollama must be installed natively so the Metal
33+
# Performance Shaders (MPS) backend is used for hardware-accelerated inference.
34+
#
35+
# Setup:
36+
# 1. Install Ollama: https://ollama.com/download
37+
# 2. Pull your model (see options below)
38+
# 3. Ollama starts automatically; confirm it is running:
39+
# curl http://localhost:11434/api/tags
40+
# 4. Set the variables below in your .env
41+
#
42+
# The backend container reaches host-side Ollama via the special DNS name
43+
# `host.docker.internal` which Docker Desktop resolves to the Mac host.
44+
# (On Linux with Docker Engine this requires the extra_hosts entry in docker-compose.yaml,
45+
# which is already configured.)
46+
#
47+
# --- Production / high-quality translation ---
48+
# INFERENCE_PROVIDER=ollama
49+
# INFERENCE_API_ENDPOINT=http://host.docker.internal:11434
50+
# INFERENCE_MODEL_NAME=codellama:34b
51+
# ollama pull codellama:34b # ~20 GB, best quality
52+
#
53+
# --- Testing / SLM performance benchmarking ---
54+
# INFERENCE_PROVIDER=ollama
55+
# INFERENCE_API_ENDPOINT=http://host.docker.internal:11434
56+
# INFERENCE_MODEL_NAME=codellama:7b
57+
# ollama pull codellama:7b # ~4 GB, fast — use this for gauging SLM perf
58+
#
59+
# --- Other recommended code models ---
60+
# ollama pull deepseek-coder:6.7b # ~4 GB, strong at code tasks
61+
# ollama pull qwen2.5-coder:7b # ~4 GB, excellent multilingual code
62+
# ollama pull codellama:13b # ~8 GB, good balance of speed vs quality
63+
#
64+
# Note: INFERENCE_API_TOKEN is not required when using Ollama.
65+
66+
# ============================================================
67+
# LLM Settings
68+
# ============================================================
69+
LLM_TEMPERATURE=0.2
70+
LLM_MAX_TOKENS=4096
71+
72+
# ============================================================
73+
# Code Translation Settings
74+
# ============================================================
75+
MAX_CODE_LENGTH=8000
76+
MAX_FILE_SIZE=10485760
77+
78+
# ============================================================
79+
# CORS Configuration
80+
# ============================================================
81+
CORS_ALLOW_ORIGINS=["http://localhost:5173", "http://localhost:3000"]
82+
83+
# ============================================================
84+
# Local URL Endpoint
85+
# ============================================================
86+
# Only needed if your remote API endpoint is a private domain mapped in /etc/hosts.
87+
# Otherwise leave as "not-needed".
88+
LOCAL_URL_ENDPOINT=not-needed
89+
90+
# ============================================================
91+
# SSL Verification
92+
# ============================================================
93+
# Set to false only for development with self-signed certificates.
94+
VERIFY_SSL=true

.github/workflows/code-scans.yaml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: SDLE Scans
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
PR_number:
7+
description: 'Pull request number'
8+
required: true
9+
push:
10+
branches: [ main ]
11+
pull_request:
12+
types: [opened, synchronize, reopened, ready_for_review]
13+
14+
concurrency:
15+
group: sdle-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
20+
# -----------------------------
21+
# 1) Trivy Scan
22+
# -----------------------------
23+
trivy_scan:
24+
name: Trivy Vulnerability Scan
25+
runs-on: ubuntu-latest
26+
env:
27+
TRIVY_REPORT_FORMAT: table
28+
TRIVY_SCAN_TYPE: fs
29+
TRIVY_SCAN_PATH: .
30+
TRIVY_EXIT_CODE: '1'
31+
TRIVY_VULN_TYPE: os,library
32+
TRIVY_SEVERITY: CRITICAL,HIGH
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Create report directory
37+
run: mkdir -p trivy-reports
38+
39+
- name: Run Trivy FS Scan
40+
uses: aquasecurity/trivy-action@0.24.0
41+
with:
42+
scan-type: 'fs'
43+
scan-ref: '.'
44+
scanners: 'vuln,misconfig,secret,license'
45+
ignore-unfixed: true
46+
format: 'table'
47+
exit-code: '1'
48+
output: 'trivy-reports/trivy_scan_report.txt'
49+
vuln-type: 'os,library'
50+
severity: 'CRITICAL,HIGH'
51+
52+
- name: Upload Trivy Report
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: trivy-report
56+
path: trivy-reports/trivy_scan_report.txt
57+
58+
- name: Show Trivy Report in Logs
59+
if: failure()
60+
run: |
61+
echo "========= TRIVY FINDINGS ========="
62+
cat trivy-reports/trivy_scan_report.txt
63+
echo "================================="
64+
65+
# -----------------------------
66+
# 2) Bandit Scan
67+
# -----------------------------
68+
bandit_scan:
69+
name: Bandit security scan
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v4
74+
with:
75+
submodules: 'recursive'
76+
fetch-depth: 0
77+
78+
- uses: actions/setup-python@v5
79+
with:
80+
python-version: "3.x"
81+
82+
- name: Install Bandit
83+
run: pip install bandit
84+
85+
- name: Create Bandit configuration
86+
shell: bash
87+
run: |
88+
cat > .bandit << 'EOF'
89+
[bandit]
90+
exclude_dirs = tests,test,venv,.venv,node_modules
91+
skips = B101
92+
EOF
93+
94+
- name: Run Bandit scan
95+
run: |
96+
bandit -r . -ll -iii -f screen
97+
bandit -r . -ll -iii -f html -o bandit-report.html
98+
99+
- name: Upload Bandit Report
100+
uses: actions/upload-artifact@v4
101+
with:
102+
name: bandit-report
103+
path: bandit-report.html
104+
retention-days: 30

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,24 @@ temp/
6363
# Python type checker cache
6464
.mypy_cache/
6565

66+
# Testing
67+
.pytest_cache/
68+
.coverage
69+
htmlcov/
70+
.tox/
71+
.cache/
72+
6673
# Security scan outputs
6774
bandit-*.html
6875
bandit-*.txt
6976

77+
# Local project references (not part of this repo)
78+
Audify/
79+
80+
# Langfuse observability stack (local testing only, never commit)
81+
langfuse/
82+
api/services/observability.py
83+
7084
# Reference documents (local working files, not part of this repo)
7185
*.docx
7286
*.docx.pdf

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing to CodeTrans
2+
3+
Thank you for your interest in contributing to **CodeTrans — AI-Powered Code Translation** by Cloud2 Labs.
4+
5+
## Scope of Contributions
6+
7+
Appropriate contributions include:
8+
9+
- Documentation improvements
10+
- Bug fixes
11+
- Reference architecture enhancements
12+
- Additional LLM provider configurations
13+
- Educational clarity and examples
14+
15+
Major feature additions or architectural changes (e.g., new inference backends,
16+
new supported languages, UI framework changes) require prior discussion with the
17+
Cloud2 Labs maintainers.
18+
19+
## Contribution Guidelines
20+
21+
- Follow existing coding and documentation standards
22+
- Avoid production-specific assumptions
23+
- Do not introduce sensitive, proprietary, or regulated data into examples or tests
24+
- Ensure any new environment variables are documented in `.env.example` and the README
25+
26+
By submitting a contribution, you agree that your work may be used, modified,
27+
and redistributed by Cloud2 Labs under the terms of the project license.

DISCLAIMER.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Disclaimer
2+
3+
This blueprint is provided by Cloud2 Labs "as is" and "as available" for
4+
educational and demonstration purposes only.
5+
6+
The **CodeTrans — AI-Powered Code Translation** blueprint is a reference
7+
implementation and does not constitute a production-ready system or
8+
regulatory-compliant solution.
9+
10+
This software is not designed to provide professional software engineering,
11+
legal, or compliance advice. All code translations generated by this blueprint
12+
require independent human review and validation before use in any production
13+
system.
14+
15+
Cloud2 Labs does not assume responsibility or liability for any data loss,
16+
security incident, service disruption, regulatory non-compliance, or adverse
17+
outcome resulting from the use or modification of this blueprint.
18+
19+
Do not submit confidential, proprietary, or sensitive source code to third-party
20+
inference API providers (OpenAI, Groq, OpenRouter, etc.) without first reviewing
21+
their data handling, privacy, and retention policies.

LICENSE.md

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

0 commit comments

Comments
 (0)