From 6f389fc1a96157ed46fbdb2f98e88590c2023263 Mon Sep 17 00:00:00 2001 From: jeffusion Date: Tue, 3 Mar 2026 17:03:14 +0800 Subject: [PATCH] chore: remove obsolete files - Remove check-engine.js (debug script) - Remove kubernetes.yaml.template and Makefile (internal deployment) - Remove auto-ver.sh (only used by Makefile) - Remove test-webhook.json (manual test fixture) - Remove tslint.json (deprecated, replaced by Biome) - Remove frontend/README.md (Vite template boilerplate) --- Makefile | 40 ---------------- auto-ver.sh | 46 ------------------- check-engine.js | 5 -- frontend/README.md | 69 ---------------------------- kubernetes.yaml.template | 99 ---------------------------------------- test-webhook.json | 25 ---------- tslint.json | 3 -- 7 files changed, 287 deletions(-) delete mode 100644 Makefile delete mode 100755 auto-ver.sh delete mode 100644 check-engine.js delete mode 100644 frontend/README.md delete mode 100644 kubernetes.yaml.template delete mode 100644 test-webhook.json delete mode 100644 tslint.json diff --git a/Makefile b/Makefile deleted file mode 100644 index b00c216..0000000 --- a/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -NAME = gitea-assistant -REGISTRY = docker-hosted.nexus.satfabric.com -SHA1 = $(shell git rev-parse HEAD) -REVISION = $(shell git rev-list --count HEAD) -LABELS = --label SHA1=${SHA1} --label REVISION=${REVISION} -VERSION = $(shell ./auto-ver.sh).${REVISION} - -OS ?= linux -ARCH ?= amd64 - -.PHONY: build -build: - npm run build - -.PHONY: container.build -container.build: - make build - docker buildx build --platform=${OS}/${ARCH} -t ${REGISTRY}/${NAME}:v${VERSION} ${LABELS} -f Dockerfile . - -.PHONY: container.push -container.push: - make build - docker buildx build --platform=${OS}/${ARCH} -t ${REGISTRY}/${NAME}:v${VERSION} ${LABELS} -f Dockerfile . --push - -.PHONY: k8s.yaml -k8s.yaml: - cp ./kubernetes.yaml.template ./kubernetes.yaml - sed -i.bak 's@<%= IMAGE_FROM %>@registry.kuiper.com/${NAME}:v${VERSION}@g' ./kubernetes.yaml - sed -i.bak 's@<%= APP_NAME %>@${NAME}@g' ./kubernetes.yaml - sed -i.bak 's@<%= VERSION %>@${VERSION}@g' ./kubernetes.yaml - rm -f ./kubernetes.yaml.bak - -.PHONY: help -help: - @echo 'Usage: make [target]' - - @echo 'Available targets:' - @printf " %-25s %s\n" "container." "本地构建(或构建加推送)容器镜像,若不执行TAG参数,则自动生成VERSION字段" - @printf " %-25s %s\n" "k8s.yaml" "生成kubernetes.yaml文件" - @printf " %-25s %s\n" "help" "显示此帮助信息" diff --git a/auto-ver.sh b/auto-ver.sh deleted file mode 100755 index fc48252..0000000 --- a/auto-ver.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -# 生成基于日期的版本号函数 -generate_date_version() { - date +"%Y.%-m.%-d" -} - -# 由于可能允许在detached状态下执行脚本,因此我们允许外部指定HEAD的REF -HEAD_REF_NAME=$1 -if [ -z "$HEAD_REF_NAME" ]; then - HEAD_REF_NAME=$(git rev-parse --abbrev-ref HEAD) -fi -if [ "$HEAD_REF_NAME" = "main" ]; then - # 对于main分支,使用日期格式的版本号 - generate_date_version - exit 0 -fi -TAG_RECENT=$(git describe --tags --abbrev=0 --match "v*" 2>/dev/null) -if [ -z "$TAG_RECENT" ]; then - # 无法获取到符合semver格式的tag时,使用日期格式的版本号 - generate_date_version - exit 0 -fi -TAG_COMMIT=$(git log $TAG_RECENT --oneline -1 | awk '{print $1}') -TAG_VERSION=$(echo $TAG_RECENT | tr -d "v") - -sub_version_by_type() -{ - type=$1 - field=3 - if [ "$type" = "major" ]; then - field=1 - elif [ "$type" = "minor" ]; then - field=2 - else - field=3 - fi - echo $TAG_VERSION | awk -F '.' -v field=$field '{print $field}' -} - -MAJOR=$(sub_version_by_type major) -MINOR=$(sub_version_by_type minor) -PATCH=$(sub_version_by_type patch) -REVISION_TO_HEAD=$(git rev-list --count $TAG_COMMIT...HEAD) - -echo "$MAJOR.$MINOR.$(($PATCH+$REVISION_TO_HEAD))" diff --git a/check-engine.js b/check-engine.js deleted file mode 100644 index e531dbb..0000000 --- a/check-engine.js +++ /dev/null @@ -1,5 +0,0 @@ -const a = require('./dist/review/engine'); -const b = require('@/review/engine'); -console.log('same?', a.reviewEngine === b.reviewEngine); -console.log('a file', require.resolve('./dist/review/engine')); -console.log('b file', require.resolve('@/review/engine')); diff --git a/frontend/README.md b/frontend/README.md deleted file mode 100644 index d5e3c12..0000000 --- a/frontend/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: - -```js -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - - // Remove tseslint.configs.recommended and replace with this - tseslint.configs.recommendedTypeChecked, - // Alternatively, use this for stricter rules - tseslint.configs.strictTypeChecked, - // Optionally, add this for stylistic rules - tseslint.configs.stylisticTypeChecked, - - // Other configs... - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` - -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: - -```js -// eslint.config.js -import reactX from 'eslint-plugin-react-x' -import reactDom from 'eslint-plugin-react-dom' - -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - // Enable lint rules for React - reactX.configs['recommended-typescript'], - // Enable lint rules for React DOM - reactDom.configs.recommended, - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` diff --git a/kubernetes.yaml.template b/kubernetes.yaml.template deleted file mode 100644 index 37510f6..0000000 --- a/kubernetes.yaml.template +++ /dev/null @@ -1,99 +0,0 @@ -# ConfigMap 用于存储非敏感配置 -apiVersion: v1 -kind: ConfigMap -metadata: - name: <%= APP_NAME %>-config -data: - GITEA_API_URL: "http://your-gitea-addr/api/v1" - OPENAI_BASE_URL: "{{OPENAI_COMPATIBILITY_URL}}" - OPENAI_MODEL: "gpt-4o-mini" - PORT: "3000" - FEISHU_WEBHOOK_URL: "{{FEISHU_WEBHOOK_URL}}" - ---- -# Secret 用于存储敏感信息 -apiVersion: v1 -kind: Secret -metadata: - name: <%= APP_NAME %>-secrets -type: Opaque -data: - # base64 编码的敏感数据 - GITEA_ACCESS_TOKEN: "{{GITEA_ACCESS_TOKEN}}" - OPENAI_API_KEY: "{{OPENAI_API_KEY}}" - WEBHOOK_SECRET: "{{WEBHOOK_SECRET}}" - FEISHU_WEBHOOK_SECRET: "{{FEISHU_WEBHOOK_SECRET}}" - ---- -# Deployment 定义应用程序部署 -apiVersion: apps/v1 -kind: Deployment -metadata: - name: <%= APP_NAME %> - labels: - app: <%= APP_NAME %> -spec: - replicas: 1 - selector: - matchLabels: - app: <%= APP_NAME %> - template: - metadata: - labels: - app: <%= APP_NAME %> - spec: - containers: - - name: <%= APP_NAME %> - image: <%= IMAGE_FROM %> - imagePullPolicy: Always - ports: - - containerPort: 3000 - name: http - resources: - limits: - memory: "512Mi" - cpu: "500m" - requests: - memory: "256Mi" - cpu: "100m" - livenessProbe: - httpGet: - path: / - port: 3000 - initialDelaySeconds: 5 - periodSeconds: 30 - timeoutSeconds: 5 - failureThreshold: 3 - readinessProbe: - httpGet: - path: / - port: 3000 - initialDelaySeconds: 5 - periodSeconds: 10 - securityContext: - runAsUser: 1001 - runAsGroup: 1001 - allowPrivilegeEscalation: false - envFrom: - - configMapRef: - name: <%= APP_NAME %>-config - - secretRef: - name: <%= APP_NAME %>-secrets - ---- -# Service 暴露应用程序 -apiVersion: v1 -kind: Service -metadata: - name: <%= APP_NAME %> - labels: - app: <%= APP_NAME %> -spec: - selector: - app: <%= APP_NAME %> - ports: - - port: 3000 - targetPort: 3000 - nodePort: 30300 - name: http - type: NodePort diff --git a/test-webhook.json b/test-webhook.json deleted file mode 100644 index 538e598..0000000 --- a/test-webhook.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "action": "opened", - "pull_request": { - "id": 1, - "number": 1, - "title": "测试PR", - "head": { - "sha": "abcd1234abcd1234abcd1234abcd1234abcd1234" - }, - "base": { - "repo": { - "owner": { - "login": "test-owner" - }, - "name": "test-repo" - } - } - }, - "repository": { - "owner": { - "login": "test-owner" - }, - "name": "test-repo" - } -} diff --git a/tslint.json b/tslint.json deleted file mode 100644 index dfe4c4a..0000000 --- a/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "tslint:latest" -}