diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index dcac458..4a293a7 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -44,8 +44,6 @@ jobs: - uses: actions/setup-node@v4 with: node-version: "22" - cache: npm - - run: npm ci --ignore-scripts - name: Check Go formatting shell: bash run: | @@ -54,7 +52,7 @@ jobs: printf '%s\n' "$unformatted" exit 1 fi - - run: npm run format:check - - run: npm run check:web + - name: Check WebUI syntax + run: node --check webui/app.js - name: Check container entrypoint syntax run: sh -n docker-entrypoint.sh diff --git a/.gitignore b/.gitignore index 6c84134..78920c6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ opencode/ .tmp/ .gocache/ *.models.catalog.json -node_modules/ coverage.out *.test *.test.exe diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 0a2013a..0000000 --- a/.prettierignore +++ /dev/null @@ -1,15 +0,0 @@ -node_modules/ -dist/ -build/ -.tmp/ -.gocache/ -config.json -config.json.bak -*.models.dev.json -*.models.catalog.json -coverage.out -package-lock.json - -.local/ -*.rotation.json -*.availability.json diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index f329927..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "printWidth": 100, - "tabWidth": 2, - "useTabs": false, - "singleQuote": false, - "trailingComma": "all", - "proseWrap": "preserve", - "endOfLine": "lf" -} diff --git a/README.md b/README.md index ddfabbe..c8658d8 100644 --- a/README.md +++ b/README.md @@ -458,16 +458,13 @@ go build -o opencode2api ./cmd/opencode2api For local development, start the service with `go run ./cmd/opencode2api -config config.json`. Release builds still inject the version with `-ldflags "-X main.version=vX.Y.Z"`. -Node.js is only needed for development formatting and JavaScript syntax checks: +Node.js is only needed for the WebUI JavaScript syntax check: ```bash -npm ci --ignore-scripts -npm run format -npm run format:check -npm run check:web +node --check webui/app.js ``` -`.editorconfig`, `.gitattributes`, Go formatting, and pinned Prettier settings standardize the source. CI runs `go vet` and builds with Go 1.24 and stable Go on Linux/Windows, plus formatting, WebUI syntax, and entrypoint shell syntax checks. Release archives include both READMEs. +`.editorconfig`, `.gitattributes`, and Go formatting standardize the source. CI runs `go vet` and builds with Go 1.24 and stable Go on Linux/Windows, plus Go formatting, WebUI syntax, and entrypoint shell syntax checks. Release archives include both READMEs. ## Troubleshooting diff --git a/README.zh-CN.md b/README.zh-CN.md index c99a954..3cf2d6a 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -453,16 +453,13 @@ go build -o opencode2api ./cmd/opencode2api 开发时可以直接运行 `go run ./cmd/opencode2api -config config.json`。发布构建仍通过 `-ldflags "-X main.version=vX.Y.Z"` 注入版本号。 -Node.js 仅用于开发时的格式化和 JavaScript 语法检查: +Node.js 仅用于 WebUI 的 JavaScript 语法检查: ```bash -npm ci --ignore-scripts -npm run format -npm run format:check -npm run check:web +node --check webui/app.js ``` -项目通过 `.editorconfig`、`.gitattributes`、Go 格式化和固定版本的 Prettier 统一格式。CI 覆盖 Linux / Windows 上的 Go 1.24 与稳定版 Go 的 `go vet` 和构建,以及格式、WebUI 语法和容器入口脚本语法检查。发布压缩包包含中英文两份 README。 +项目通过 `.editorconfig`、`.gitattributes` 和 Go 格式化统一格式。CI 覆盖 Linux / Windows 上的 Go 1.24 与稳定版 Go 的 `go vet` 和构建,以及 Go 格式、WebUI 语法和容器入口脚本语法检查。发布压缩包包含中英文两份 README。 ## 常见问题 diff --git a/docs/management.zh-CN.md b/docs/management.zh-CN.md index a4c5ff5..af9bdd2 100644 --- a/docs/management.zh-CN.md +++ b/docs/management.zh-CN.md @@ -32,8 +32,7 @@ go test ./... go test -race ./... go vet ./... -npm run check:web -npx prettier --check webui/index.html webui/app.js webui/styles.css +node --check webui/app.js go build -trimpath -o opencode2api ./cmd/opencode2api ``` @@ -81,7 +80,7 @@ Messages,以及这三种协议的流式输出。真实模型 ID 的原有调 - `POST /api/rotation/current`:`{"group":"sota","model":"glm-5.3"}`;立即 修改当前模型并解除该模型的临时暂停。 -验证:`go test -race ./...`、`go vet ./...`、`npm run check:web`。 +验证:`go test -race ./...`、`go vet ./...`、`node --check webui/app.js`。 模拟上游测试覆盖 9 次普通错误上限、超过 3 个额度跳过、混合错误预算、 Retry-After、单个模型故障不影响 Key、三种入口协议的跨协议转换、成功保持、 别名发现与用量归属、畸形响应、输出前错误、首个输出超时、输出后故障、 diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 1792dd0..0000000 --- a/package-lock.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "opencode2api-dev", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "opencode2api-dev", - "devDependencies": { - "prettier": "3.9.6" - } - }, - "node_modules/prettier": { - "version": "3.9.6", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.6.tgz", - "integrity": "sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g==", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index c603cde..0000000 --- a/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "opencode2api-dev", - "private": true, - "scripts": { - "format": "prettier --write .", - "format:check": "prettier --check .", - "check:web": "node --check webui/app.js" - }, - "devDependencies": { - "prettier": "3.9.6" - } -}