Skip to content

Commit 8acf170

Browse files
committed
chore: ????????
0 parents  commit 8acf170

796 files changed

Lines changed: 87319 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Database
2+
MYSQL_DATABASE=codeforge_ai
3+
MYSQL_ROOT_PASSWORD=please_change_me
4+
MYSQL_USER=codeforge
5+
MYSQL_PASSWORD=please_change_me
6+
MYSQL_PORT=3306
7+
DB_HOST=localhost
8+
DB_PORT=3306
9+
DB_NAME=codeforge_ai
10+
DB_USERNAME=codeforge_ai_user
11+
DB_PASSWORD=please_change_me
12+
13+
# Redis
14+
REDIS_PORT=6379
15+
REDIS_HOST=localhost
16+
REDIS_DATABASE=0
17+
REDIS_PASSWORD=
18+
19+
# Application
20+
SPRING_PROFILES_ACTIVE=local
21+
SERVER_PORT=8080
22+
23+
# Security
24+
JWT_SECRET=please_change_me
25+
26+
# Model Provider
27+
OPENAI_BASE_URL=https://api.openai.com/v1
28+
OPENAI_API_KEY=please_change_me
29+
OPENAI_MODEL_NAME=gpt-4.1-mini
30+
# Model Provider routing
31+
# auto = use all ACTIVE + configured AI providers ordered by DB priority
32+
# deepseek/openai/qwen = PIN mode, only that provider when configured
33+
AI_PROVIDER=auto
34+
AI_MODEL=gpt-4.1-mini
35+
AI_BASE_URL=https://api.openai.com/v1
36+
AI_API_KEY=please_change_me
37+
# 测试/演示强制规则生成(true 时不调用真实模型)
38+
CODEFORGE_FORCE_RULE_ONLY=false
39+
40+
# 本地真实 AI_DIRECT 验收(不在 git 中保存真实 Key):
41+
# $env:OPENAI_API_KEY="your-key"
42+
# $env:CODEFORGE_FORCE_RULE_ONLY="false"
43+
# powershell -ExecutionPolicy Bypass -File scripts/dev-start-ai.ps1
44+
# 默认 dev-start.ps1 仍使用 test profile + RULE_ONLY,行为不变。

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/mvnw text eol=lf
2+
*.cmd text eol=crlf

.github/workflows/backend-ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: backend-ci
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
services:
13+
mysql:
14+
image: mysql:8.0
15+
env:
16+
MYSQL_DATABASE: codeforge_ai
17+
MYSQL_ROOT_PASSWORD: root
18+
MYSQL_USER: codeforge
19+
MYSQL_PASSWORD: codeforge123
20+
ports:
21+
- 3306:3306
22+
options: >-
23+
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot"
24+
--health-interval=10s
25+
--health-timeout=5s
26+
--health-retries=10
27+
28+
redis:
29+
image: redis:7-alpine
30+
ports:
31+
- 6379:6379
32+
options: >-
33+
--health-cmd="redis-cli ping"
34+
--health-interval=10s
35+
--health-timeout=5s
36+
--health-retries=10
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Setup Java
43+
uses: actions/setup-java@v4
44+
with:
45+
distribution: temurin
46+
java-version: 21
47+
48+
- name: Setup Maven Cache
49+
uses: actions/cache@v4
50+
with:
51+
path: ~/.m2/repository
52+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
53+
restore-keys: |
54+
${{ runner.os }}-m2-
55+
56+
- name: Run Backend Tests
57+
run: ./mvnw -B test

.github/workflows/frontend-ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: frontend-ci
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
defaults:
13+
run:
14+
working-directory: frontend
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: npm
25+
cache-dependency-path: frontend/package-lock.json
26+
27+
- name: Install Dependencies
28+
run: npm ci
29+
30+
- name: Build Frontend
31+
run: npm run build

.gitignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
### CUSTOM ###
2+
application-local.yml
3+
application-prod.yml
4+
tmp
5+
.local-data/
6+
generated-exports/
7+
frontend/test-results/
8+
frontend/dist/
9+
frontend/playwright-report/
10+
playwright-report/
11+
test-results/
12+
13+
HELP.md
14+
target/
15+
.mvn/wrapper/maven-wrapper.jar
16+
!**/src/main/**/target/
17+
!**/src/test/**/target/
18+
19+
### STS ###
20+
.apt_generated
21+
.classpath
22+
.factorypath
23+
.project
24+
.settings
25+
.springBeans
26+
.sts4-cache
27+
28+
### IntelliJ IDEA ###
29+
.idea
30+
*.iws
31+
*.iml
32+
*.ipr
33+
34+
### NetBeans ###
35+
/nbproject/private/
36+
/nbbuild/
37+
/dist/
38+
/nbdist/
39+
/.nb-gradle/
40+
build/
41+
!**/src/main/**/build/
42+
!**/src/test/**/build/
43+
44+
### VS Code ###
45+
.vscode/
46+
.env
47+
.env.*
48+
!.env.example
49+
logs/
50+
*.log
51+
coverage/
52+
.tools/
53+
.run/
54+
.local-storage/
55+
.claude/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 18307519324az
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.

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# CodeForge AI
2+
3+
CodeForge AI 是一个面向应用生成、产物管理和发布流转的全栈平台。项目提供从账号权限、提示词模板、模型调用、生成任务、静态预览、源码导出到市场发布的完整闭环,适合用于构建可审计、可追溯、可私有化部署的 AI 应用生成系统。
4+
5+
## 核心能力
6+
7+
- 多角色账号体系:支持普通用户与平台管理员,并提供应用、版本、包和市场发布的权限边界。
8+
- 提示词模板版本:生成请求显式绑定模板版本,任务、调用日志和指纹保留版本身份。
9+
- 模型调用治理:支持模型供应商配置、调用日志、错误脱敏、调用预算与审计追踪。
10+
- 应用生成任务:支持异步任务、事件流恢复、生成记录、文件列表和静态预览。
11+
- 产物修复与版本化:生成文件可进行安全修复,历史版本保持不可变,新版本独立追踪。
12+
- 导出与市场发布:导出包绑定应用版本,市场条目固定发布版本,下载入口执行权限校验。
13+
- 数据库迁移:提供 MySQL 正式迁移与全新库基线迁移,支持本地和部署环境一致启动。
14+
15+
## 技术栈
16+
17+
- 后端:Java 21、Spring Boot、Spring Security、MyBatis、Flyway、MySQL、Redis。
18+
- 前端:Vue 3、Vite、TypeScript、Pinia、Ant Design Vue、Vitest、Playwright。
19+
- 工程:Maven、npm、Docker Compose、PowerShell 启动脚本。
20+
21+
## 本地启动
22+
23+
请先准备 MySQL、Redis、JDK 21、Node.js 和 npm。复制 `.env.example` 后按本地环境填写数据库、Redis 与模型供应商配置。不要把真实密钥提交到仓库。
24+
25+
```powershell
26+
cd CodeForge-AI
27+
powershell -File .\scripts\db\check-local-schema.ps1
28+
powershell -File .\scripts\dev-start.ps1 -Profile local -BackendPort 8150 -FrontendPort 5182
29+
```
30+
31+
后端默认监听 `http://127.0.0.1:8150`,前端默认监听 `http://127.0.0.1:5182`
32+
33+
## 常用验证
34+
35+
```powershell
36+
mvn test
37+
cd frontend
38+
npm run type-check
39+
npm run build
40+
npm run test
41+
```
42+
43+
## 安全说明
44+
45+
- 不要在源码、日志、截图或提交信息中写入真实 API Key、访问令牌、数据库密码或用户密码。
46+
- 普通 API 不应返回系统提示词、完整 Prompt、存储路径、对象键或本机绝对路径。
47+
- 生成产物、导出包和市场下载均应通过应用归属、版本绑定、路径边界和发布状态校验。
48+
- 发布前应重新运行测试、密钥扫描、迁移校验和浏览器验收。
49+
50+
## 目录概览
51+
52+
```text
53+
src/ 后端业务代码
54+
frontend/ 前端应用
55+
sql/ 数据库迁移脚本
56+
scripts/ 本地启动、数据库检查和发布验证脚本
57+
backend/ 后端辅助说明
58+
docker/ 容器化配置
59+
```
60+
61+
## 许可证
62+
63+
本项目使用 MIT License。详见 `LICENSE`

backend/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# backend 目录说明
2+
3+
## 1. 当前状态
4+
5+
1. 当前仓库的后端主代码仍位于根目录 `src/``pom.xml``mvnw*`
6+
2. 本目录用于满足统一目录口径,作为后续后端整理入口。
7+
8+
## 2. 当前后端实际入口
9+
10+
1. 应用主类:`src/main/java/com/codeforge/ai/CodeForgeAiApplication.java`
11+
2. Maven 构建入口:`pom.xml`
12+
3. 启动命令:`./mvnw spring-boot:run`
13+
14+
## 3. 后续整理建议
15+
16+
1. 如后续进入真正目录迁移,可把根后端整体迁入 `backend/`
17+
2. 在未迁移前,所有后端构建与运行仍以仓库根目录为准。

docker-compose.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: "3.9"
2+
3+
services:
4+
mysql:
5+
image: mysql:8.0
6+
container_name: codeforge-ai-mysql
7+
restart: unless-stopped
8+
environment:
9+
MYSQL_DATABASE: ${MYSQL_DATABASE:-codeforge_ai}
10+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-please_change_me}
11+
MYSQL_USER: ${MYSQL_USER:-codeforge}
12+
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-please_change_me}
13+
ports:
14+
- "${MYSQL_PORT:-3306}:3306"
15+
command:
16+
- --character-set-server=utf8mb4
17+
- --collation-server=utf8mb4_unicode_ci
18+
volumes:
19+
- mysql_data:/var/lib/mysql
20+
21+
redis:
22+
image: redis:7-alpine
23+
container_name: codeforge-ai-redis
24+
restart: unless-stopped
25+
ports:
26+
- "${REDIS_PORT:-6379}:6379"
27+
volumes:
28+
- redis_data:/data
29+
30+
volumes:
31+
mysql_data:
32+
redis_data:

0 commit comments

Comments
 (0)