docs: fix setup command paths

This commit is contained in:
2026-07-21 21:37:03 +08:00
parent fff6cdcba7
commit e5dd26719b
2 changed files with 43 additions and 21 deletions

View File

@@ -51,9 +51,11 @@ Web 客户端桌面优先,同时保留移动浏览器可用性;登录页允
### 2. 启动 PostgreSQL ### 2. 启动 PostgreSQL
在仓库目录运行: 任意仓库目录运行:
```powershell ```powershell
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location $repoRoot
docker compose -f infra/docker-compose.yml up -d docker compose -f infra/docker-compose.yml up -d
``` ```
@@ -62,7 +64,8 @@ Compose 只用于本地开发,创建 PostgreSQL 16 服务并监听 `localhost:
### 3. 初始化演示数据 ### 3. 初始化演示数据
```powershell ```powershell
Set-Location backend $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go run ./cmd/seed go run ./cmd/seed
``` ```
@@ -73,7 +76,8 @@ go run ./cmd/seed
在新的终端中运行: 在新的终端中运行:
```powershell ```powershell
Set-Location backend $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go run ./cmd/api go run ./cmd/api
``` ```
@@ -84,12 +88,13 @@ go run ./cmd/api
在新的终端中运行: 在新的终端中运行:
```powershell ```powershell
Set-Location apps/web_v1 $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/web_v1')
npm ci npm ci
npm run dev npm run dev
``` ```
Vite 默认地址为 `http://localhost:5173`。登录服务器地址填写 `http://localhost:9150`也可以通过 `VITE_API_BASE_URL` 指定 Web 的初始 API 地址。 Vite 默认地址为 `http://localhost:5173`。登录页的服务器地址默认是 `http://localhost:9150`用户可以改为私有部署服务器的 IP 地址或域名,登录及后续 API 请求会使用用户填写的地址。
## 配置 ## 配置
@@ -144,14 +149,16 @@ Vite 默认地址为 `http://localhost:5173`。登录时服务器地址填写 `h
后端: 后端:
```powershell ```powershell
Set-Location backend $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go test ./... go test ./...
``` ```
Web Web
```powershell ```powershell
Set-Location apps/web_v1 $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/web_v1')
node scripts/visual-check.mjs node scripts/visual-check.mjs
npm run build npm run build
npm run lint npm run lint
@@ -160,7 +167,8 @@ npm run lint
如果设置了指向隔离测试库的 `DATABASE_URL`,再运行 PostgreSQL 集成检查: 如果设置了指向隔离测试库的 `DATABASE_URL`,再运行 PostgreSQL 集成检查:
```powershell ```powershell
Set-Location backend $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go test -tags integration ./internal/models -run TestPostgresPing -v go test -tags integration ./internal/models -run TestPostgresPing -v
``` ```
@@ -171,7 +179,8 @@ go test -tags integration ./internal/models -run TestPostgresPing -v
先完成 Web 依赖安装,再构建 Tauri 可执行文件: 先完成 Web 依赖安装,再构建 Tauri 可执行文件:
```powershell ```powershell
Set-Location apps/desktop $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/desktop')
npm ci npm ci
npm run build npm run build
``` ```
@@ -181,7 +190,8 @@ npm run build
需要安装包时运行: 需要安装包时运行:
```powershell ```powershell
Set-Location apps/desktop $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/desktop')
npm run bundle npm run bundle
``` ```

View File

@@ -37,9 +37,11 @@
### PostgreSQL ### PostgreSQL
需要 Docker Desktop。仓库目录的预期命令是 需要 Docker Desktop。可在任意仓库目录运行
```powershell ```powershell
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location $repoRoot
docker compose -f infra/docker-compose.yml up -d docker compose -f infra/docker-compose.yml up -d
docker compose -f infra/docker-compose.yml ps docker compose -f infra/docker-compose.yml ps
``` ```
@@ -51,12 +53,14 @@ docker compose -f infra/docker-compose.yml ps
数据库可用后,在两个独立终端中运行: 数据库可用后,在两个独立终端中运行:
```powershell ```powershell
Set-Location backend $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go run ./cmd/seed go run ./cmd/seed
``` ```
```powershell ```powershell
Set-Location backend $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go run ./cmd/api go run ./cmd/api
``` ```
@@ -72,7 +76,8 @@ Invoke-RestMethod http://localhost:9150/api/v1/status
### Web 开发服务器 ### Web 开发服务器
```powershell ```powershell
Set-Location apps/web_v1 $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/web_v1')
npm ci npm ci
npm run dev npm run dev
``` ```
@@ -84,13 +89,16 @@ npm run dev
### 后端 ### 后端
```powershell ```powershell
Set-Location backend $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go test ./... go test ./...
``` ```
本次退出 `0`。为排除 Go 测试缓存影响,还执行了: 本次退出 `0`。为排除 Go 测试缓存影响,还执行了:
```powershell ```powershell
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
go test -count=1 ./... go test -count=1 ./...
``` ```
@@ -101,8 +109,9 @@ go test -count=1 ./...
仅在准备了隔离的实时测试数据库时运行: 仅在准备了隔离的实时测试数据库时运行:
```powershell ```powershell
$repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'backend')
$env:DATABASE_URL = '<隔离测试库连接串>' $env:DATABASE_URL = '<隔离测试库连接串>'
Set-Location backend
go test -tags integration ./internal/models -run TestPostgresPing -v go test -tags integration ./internal/models -run TestPostgresPing -v
``` ```
@@ -111,7 +120,8 @@ go test -tags integration ./internal/models -run TestPostgresPing -v
### Web ### Web
```powershell ```powershell
Set-Location apps/web_v1 $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/web_v1')
node scripts/visual-check.mjs node scripts/visual-check.mjs
npm run build npm run build
npm run lint npm run lint
@@ -144,7 +154,8 @@ node scripts/structure-check.mjs
### 桌面端 ### 桌面端
```powershell ```powershell
Set-Location apps/desktop $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/desktop')
npm ci npm ci
npm run build npm run build
``` ```
@@ -160,7 +171,8 @@ apps/desktop/src-tauri/target/release/senlinai_workbench.exe
安装包是独立验证项: 安装包是独立验证项:
```powershell ```powershell
Set-Location apps/desktop $repoRoot = (git rev-parse --show-toplevel).Trim()
Set-Location (Join-Path $repoRoot 'apps/desktop')
npm run bundle npm run bundle
``` ```
@@ -210,4 +222,4 @@ npm run bundle
## 文档一致性检查 ## 文档一致性检查
两份文档执行旧品牌、旧 API 前缀、旧前端目录和旧技术栈关键词扫描,结果无匹配。还应抽查 Markdown 相对链接存在,所有命令的工作目录与仓库实际脚本一致。 完成以下一致性检查:两份文档中的旧品牌、旧 API 前缀、旧前端目录和旧技术栈关键词扫描无匹配;Markdown 相对链接均指向现有文件;命令使用的工作目录、入口和脚本均与仓库实际路径一致。