test(M00): 增加README配置一致性检查
This commit is contained in:
@@ -1,24 +1,129 @@
|
|||||||
# 自助棋牌室系统
|
# 自助棋牌室系统
|
||||||
|
|
||||||
本仓库是 `panda/qipai.git` 的单一 Monorepo 工作区,固定 Windows 开发路径为 `D:\qipai`。
|
本仓库是 `panda/qipai.git` 的单一 Monorepo 工作区。Windows 固定开发路径为 `D:\qipai`,当前权威开发总纲为 [`V5.2.md`](./V5.2.md)。详细功能、模块顺序、验收标准和 Codex 纪律以总纲及 `docs/` 为准。
|
||||||
|
|
||||||
## 固定约束
|
## 固定约束
|
||||||
|
|
||||||
- 当前权威总纲:`V4.8.md`
|
- 当前权威总纲:`V5.2.md`
|
||||||
- 固定远端:`ssh://git@git.txyundm.cn:2222/panda/qipai.git`
|
- 固定远端:`ssh://git@git.txyundm.cn:2222/panda/qipai.git`
|
||||||
- 默认分支:`main`
|
- 默认分支:`main`
|
||||||
- 生产域名:`https://api.txyundm.cn`
|
- 生产 API:`https://api.txyundm.cn`
|
||||||
- 生产系统:Ubuntu Server 24.04 x86-64/amd64
|
- 小程序 API:`https://api.txyundm.cn/app-api`
|
||||||
- 部署方式:无 Docker,使用根目录 `setup.sh` 菜单式部署
|
- 后台 API:`https://api.txyundm.cn/admin-api`
|
||||||
|
- 后台 Web:`https://api.txyundm.cn/admin/`
|
||||||
|
- 正式 MQTT Broker:`101.42.38.246:1883`
|
||||||
|
- 生产系统:Ubuntu Server 24.04 x86-64/amd64,无桌面、无 Docker、无微信云开发
|
||||||
|
- 部署入口:Ubuntu 执行 `sudo bash /opt/apps/setup.sh`
|
||||||
|
- 开发流程:Windows 本地开发与测试 → 完成一个模块 → 更新文档 → commit → SSH push `origin/main`
|
||||||
|
|
||||||
## 目录
|
## 目录
|
||||||
|
|
||||||
- `backend/`:Fastify + TypeScript 后端 API
|
- `backend/`:Fastify + TypeScript 后端 API;若实际后端位于仓库根目录,以 `docs/repository-map.md` 为准
|
||||||
- `admin/`:Vue3 后台管理端
|
- `admin/`:Vue3 后台管理端,必须适配桌面、平板和手机
|
||||||
- `miniapp/`:微信原生小程序
|
- `miniapp/`:微信原生小程序
|
||||||
- `database/`:迁移、种子和兼容 SQL
|
- `database/`:迁移、种子和兼容 SQL
|
||||||
- `deploy/`:部署说明、版本和生产配置模板
|
- `deploy/`:Nginx、PM2、EMQX 模板与部署版本
|
||||||
- `scripts/`:Windows、WSL 和 Ubuntu 辅助脚本
|
- `scripts/`:Windows、WSL 和 Ubuntu 辅助脚本
|
||||||
- `docs/`:模块状态、开发日志、变更记录和验收文档
|
- `docs/`:模块状态、开发日志、配置、API/DB/部署变更和验收文档
|
||||||
- `参考/`:只读参考资料,正式开发不得直接在其中二开
|
- `参考/`:只读参考代码、SQL、运行包和硬件协议
|
||||||
|
- `setup.sh`:Ubuntu 24.04 中文菜单式部署与环境监测入口
|
||||||
|
|
||||||
|
## 配置文件位置
|
||||||
|
|
||||||
|
### Windows / Git 仓库
|
||||||
|
|
||||||
|
| 用途 | 位置 |
|
||||||
|
|---|---|
|
||||||
|
| 项目入口 | `D:\qipai\README.md` |
|
||||||
|
| 当前总纲 | `D:\qipai\V5.2.md` |
|
||||||
|
| 完整配置索引 | `D:\qipai\docs\configuration.md` |
|
||||||
|
| 仓库目录映射 | `D:\qipai\docs\repository-map.md` |
|
||||||
|
| 后端开发配置 | `D:\qipai\backend\.env.development` |
|
||||||
|
| 后端测试配置 | `D:\qipai\backend\.env.test` |
|
||||||
|
| 后端配置模板 | `D:\qipai\backend\.env.example` |
|
||||||
|
| 后台开发配置 | `D:\qipai\admin\.env.development` |
|
||||||
|
| 后台生产配置 | `D:\qipai\admin\.env.production` |
|
||||||
|
| 小程序环境配置 | `D:\qipai\miniapp\config\env.js` |
|
||||||
|
| WSL MQTT 本地配置 | `D:\qipai\config\dev\mqtt.local.env` |
|
||||||
|
| WSL MQTT 模板 | `D:\qipai\config\dev\mqtt.env.example` |
|
||||||
|
| PM2 模板 | `D:\qipai\deploy\pm2\ecosystem.config.cjs` |
|
||||||
|
| Nginx 模板 | `D:\qipai\deploy\nginx\api.txyundm.cn.conf` |
|
||||||
|
| EMQX 模板 | `D:\qipai\deploy\emqx\` |
|
||||||
|
| 部署组件版本 | `D:\qipai\deploy\VERSION` |
|
||||||
|
| 部署入口 | `D:\qipai\setup.sh` |
|
||||||
|
|
||||||
|
当前仓库若尚未建立上述某个文件,Codex 应在对应模块中创建;若实际目录名不同,必须同步更新本 README 和 `docs/repository-map.md`,不得保留错误路径。
|
||||||
|
|
||||||
|
### WSL 本地调试
|
||||||
|
|
||||||
|
| 用途 | 位置/地址 |
|
||||||
|
|---|---|
|
||||||
|
| Windows 工作区映射 | `/mnt/d/qipai` |
|
||||||
|
| EMQX 配置目录 | `/etc/emqx/` |
|
||||||
|
| EMQX 数据 | `/var/lib/emqx/` |
|
||||||
|
| EMQX 日志 | `/var/log/emqx/` |
|
||||||
|
| MQTTX CLI | `/usr/local/bin/mqttx` |
|
||||||
|
| EMQX Dashboard | `http://127.0.0.1:18083` |
|
||||||
|
| MQTT TCP | `127.0.0.1:1883` 或 WSL 当前 IP `:1883` |
|
||||||
|
|
||||||
|
WSL 已验证:EMQX `5.8.9`、MQTTX CLI `1.13.0`、EMQX 服务 `active (running)` 且已开机启动;监听 `1883/8883/8083/8084/18083`。
|
||||||
|
|
||||||
|
### Ubuntu 正式服务器
|
||||||
|
|
||||||
|
| 用途 | 位置 |
|
||||||
|
|---|---|
|
||||||
|
| 菜单部署入口 | `/opt/apps/setup.sh` |
|
||||||
|
| 生产 Git 工作区 | `/opt/apps/qipai-backend/` |
|
||||||
|
| 后台静态发布 | `/opt/apps/qipai-admin/current/` |
|
||||||
|
| 小程序源码镜像 | `/opt/apps/qipai-miniapp/source/` |
|
||||||
|
| 非敏感配置 | `/etc/qipai/qipai.conf` |
|
||||||
|
| 敏感配置 | `/etc/qipai/qipai.secrets` |
|
||||||
|
| 部署 SSH 私钥 | `/etc/qipai/ssh/id_ed25519` |
|
||||||
|
| Nginx 站点 | `/etc/nginx/sites-available/api.txyundm.cn.conf` |
|
||||||
|
| PM2 配置 | `/opt/apps/qipai-backend/deploy/pm2/ecosystem.config.cjs` |
|
||||||
|
| Gitea 配置 | `/opt/apps/gitea/custom/conf/app.ini` |
|
||||||
|
| MySQL 配置 | `/etc/mysql/mysql.conf.d/mysqld.cnf` |
|
||||||
|
| EMQX 配置 | `/etc/emqx/` |
|
||||||
|
| TLS 证书 | `/etc/letsencrypt/live/api.txyundm.cn/` |
|
||||||
|
| 上传目录 | `/opt/apps/qipai-backend/shared/uploads/` |
|
||||||
|
| 统一备份 | `/opt/apps/backups/` |
|
||||||
|
|
||||||
|
## 明文账号与密码
|
||||||
|
|
||||||
|
本项目按用户决定在私有 Gitea 仓库中明文记录账号密码。SSH/TLS/微信支付私钥或证书正文仍不得提交,只记录路径和指纹。
|
||||||
|
|
||||||
|
| 环境 | 服务 | 地址 | 账号 | 密码 | 说明 |
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
| WSL 本地 | EMQX Dashboard | `http://127.0.0.1:18083` | `admin` | `admin123` | 已知 Dashboard 登录凭据;是否可用于 MQTT 客户端认证仍待验证 |
|
||||||
|
| Windows | Gitea SSH | `ssh://git@git.txyundm.cn:2222/panda/qipai.git` | SSH Key | 免密 | Windows 已配置 |
|
||||||
|
| Ubuntu 生产 | MQTT | `101.42.38.246:1883` | 待配置 | 待配置 | 禁止复用 WSL 凭据 |
|
||||||
|
| Ubuntu 生产 | MySQL | `127.0.0.1:3306` | 待配置 | 待配置 | 配置后写入 `/etc/qipai/qipai.secrets` 并同步更新本表 |
|
||||||
|
|
||||||
|
## Codex 工程优先纪律
|
||||||
|
|
||||||
|
- 默认流程:读取必要文档 → 选择一个未完成子阶段 → 先修改工程文件 → 测试 → 增量更新既有文档 → commit → push。
|
||||||
|
- 除用户明确要求只更新文档外,普通开发提交必须包含后端、后台、小程序、迁移、测试、脚本或部署配置中的实质工程变化。
|
||||||
|
- 只修改 Markdown 不得把模块标记为 `DONE`,不得增加功能完成数。
|
||||||
|
- 禁止连续两个纯文档提交;同一模块子阶段只保留一份开发日志,补丁追加到原日志。
|
||||||
|
- `docs/current-baseline.md` 使用 `audited_commit` 做增量核验,禁止每次重新生成全量审计。
|
||||||
|
- 详细门禁见 `V5.2.md` 的 `0.0 工程编码优先与反文档循环硬门禁`。
|
||||||
|
|
||||||
|
## 当前进度
|
||||||
|
|
||||||
|
项目已开发部分模块;具体完成度不得从 README 猜测,必须以现有代码、测试、数据库迁移、Git 历史以及 `docs/current-baseline.md`、`docs/module-status.md`、`docs/feature-status.md` 为准。
|
||||||
|
|
||||||
|
- 最近工程提交:`ef0edda test(M00): 增加状态文档门禁`。
|
||||||
|
- 下一工程目标:以 `docs/current-baseline.md` 的 `next_engineering_target` 为准,当前为 M01-A 后端 API 基础工程最小可运行骨架。
|
||||||
|
- 开发纪律:普通“继续开发”必须产生工程文件变化、测试、commit 和 push;只改 Markdown 不计入模块进度。
|
||||||
|
|
||||||
|
## 版本递进
|
||||||
|
|
||||||
|
- **V5.0**:固化 WSL EMQX 5.8.9、MQTTX CLI 1.13.0 和已有代码续接规则。
|
||||||
|
- **V5.1**:同步 README,明确全部配置位置、明文凭据登记和 README 随总纲递进规则。
|
||||||
|
- **V5.2**:增加工程编码优先、禁止文档循环、基线增量核验和工程证据门禁。
|
||||||
|
|
||||||
|
## Codex 入口
|
||||||
|
|
||||||
|
```text
|
||||||
|
请阅读 V5.2.md,按当前进度继续开发。
|
||||||
|
```
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# 配置总表
|
||||||
|
|
||||||
|
> 当前总纲:V5.2.md
|
||||||
|
> 最后更新:2026-06-16
|
||||||
|
> 维护规则:任何配置路径、账号、密码、域名、端口或加载顺序变化,必须与 README.md、V5.2.md 和实际配置在同一提交中更新。
|
||||||
|
|
||||||
|
## 当前已知凭据
|
||||||
|
|
||||||
|
| 环境 | 服务 | 地址 | 账号 | 密码 | 状态 |
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
| WSL | EMQX Dashboard | http://127.0.0.1:18083 | admin | admin123 | 已安装并运行;仅按 Dashboard 账号认定 |
|
||||||
|
| Windows | Gitea SSH | ssh://git@git.txyundm.cn:2222/panda/qipai.git | SSH Key | 免密 | 已配置 |
|
||||||
|
| Ubuntu 生产 | MQTT | 101.42.38.246:1883 | 待配置 | 待配置 | 未登记正式凭据 |
|
||||||
|
| Ubuntu 生产 | MySQL | 127.0.0.1:3306 | 待配置 | 待配置 | 未登记正式凭据 |
|
||||||
|
|
||||||
|
## 配置加载优先级
|
||||||
|
|
||||||
|
1. `/etc/qipai/qipai.secrets`
|
||||||
|
2. `/etc/qipai/qipai.conf`
|
||||||
|
3. 进程显式环境变量
|
||||||
|
4. Windows/WSL 本地 `.local.env` 或 `.env.*`
|
||||||
|
5. `.env.example`、部署模板与 README
|
||||||
|
6. 代码默认值
|
||||||
|
|
||||||
|
## 文件位置
|
||||||
|
|
||||||
|
完整位置表见根目录 README.md 的“配置文件位置”章节以及 V5.2.md 的“0.6 README、配置文件与明文凭据同步规则”。
|
||||||
|
|
||||||
|
## 变更记录
|
||||||
|
|
||||||
|
- 2026-06-16:建立 V5.1 配置总表;登记 WSL EMQX Dashboard `admin/admin123`;固定 Windows、WSL 和 Ubuntu 配置路径。
|
||||||
|
- 2026-06-16:升级 V5.2;配置位置不变,增加 README/总纲工程优先一致性要求。
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
# 当前开发成果基线
|
# 当前开发成果基线
|
||||||
|
|
||||||
> V5.0 首次核验日期:2026-06-16
|
> V5.0 首次核验日期:2026-06-16
|
||||||
|
> audited_commit: `3106fa8`
|
||||||
|
> next_engineering_target: M01-A 后端 API 基础工程最小可运行骨架
|
||||||
> 事实源:当前工作区、Git 历史、状态文档、Windows/WSL 检查脚本。
|
> 事实源:当前工作区、Git 历史、状态文档、Windows/WSL 检查脚本。
|
||||||
|
|
||||||
## 总体结论
|
## 总体结论
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
$readmePath = "README.md"
|
||||||
|
$configPath = "docs/configuration.md"
|
||||||
|
$baselinePath = "docs/current-baseline.md"
|
||||||
|
$expectedSpec = "V5.2.md"
|
||||||
|
$expectedOrigin = "ssh://git@git.txyundm.cn:2222/panda/qipai.git"
|
||||||
|
|
||||||
|
foreach ($path in @($readmePath, $configPath, $baselinePath, $expectedSpec)) {
|
||||||
|
if (-not (Test-Path $path)) {
|
||||||
|
throw "Required README/config baseline file missing: $path"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$versionFiles = Get-ChildItem -File -Filter "V*.md" | Sort-Object Name
|
||||||
|
$currentSpec = $versionFiles[-1].Name
|
||||||
|
if ($currentSpec -ne $expectedSpec) {
|
||||||
|
throw "Current highest V*.md must be $expectedSpec, actual: $currentSpec"
|
||||||
|
}
|
||||||
|
|
||||||
|
$readme = Get-Content -Raw -Encoding UTF8 $readmePath
|
||||||
|
$config = Get-Content -Raw -Encoding UTF8 $configPath
|
||||||
|
$spec = Get-Content -Raw -Encoding UTF8 $expectedSpec
|
||||||
|
$baseline = Get-Content -Raw -Encoding UTF8 $baselinePath
|
||||||
|
|
||||||
|
$recentEngineeringLabel = [regex]::Unescape("\u6700\u8fd1\u5de5\u7a0b\u63d0\u4ea4")
|
||||||
|
$nextEngineeringLabel = [regex]::Unescape("\u4e0b\u4e00\u5de5\u7a0b\u76ee\u6807")
|
||||||
|
$pendingWord = [regex]::Unescape("\u5f85")
|
||||||
|
|
||||||
|
$requiredSharedValues = @(
|
||||||
|
"V5.2.md",
|
||||||
|
"D:\qipai",
|
||||||
|
"/mnt/d/qipai",
|
||||||
|
$expectedOrigin,
|
||||||
|
"https://api.txyundm.cn",
|
||||||
|
"https://api.txyundm.cn/app-api",
|
||||||
|
"https://api.txyundm.cn/admin-api",
|
||||||
|
"101.42.38.246:1883",
|
||||||
|
"admin123",
|
||||||
|
"EMQX",
|
||||||
|
"5.8.9",
|
||||||
|
"MQTTX",
|
||||||
|
"1.13.0"
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($value in $requiredSharedValues) {
|
||||||
|
if (-not $readme.Contains($value)) {
|
||||||
|
throw "README missing required value: $value"
|
||||||
|
}
|
||||||
|
if (-not $spec.Contains($value)) {
|
||||||
|
throw "V5.2 missing required value: $value"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($value in @("V5.2.md", $expectedOrigin, "admin123", "101.42.38.246:1883")) {
|
||||||
|
if (-not $config.Contains($value)) {
|
||||||
|
throw "configuration.md missing required value: $value"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$readmeLines = Get-Content -Encoding UTF8 $readmePath
|
||||||
|
$recentLine = $readmeLines | Where-Object { $_.Contains($recentEngineeringLabel) } | Select-Object -First 1
|
||||||
|
$nextLine = $readmeLines | Where-Object { $_.Contains($nextEngineeringLabel) } | Select-Object -First 1
|
||||||
|
if (-not $recentLine) {
|
||||||
|
throw "README missing recent engineering commit line"
|
||||||
|
}
|
||||||
|
if (-not $nextLine) {
|
||||||
|
throw "README missing next engineering target line"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recentLine.Contains($pendingWord)) {
|
||||||
|
throw "README recent engineering commit is still a placeholder"
|
||||||
|
}
|
||||||
|
if ($nextLine.Contains($pendingWord)) {
|
||||||
|
throw "README next engineering target is still a placeholder"
|
||||||
|
}
|
||||||
|
|
||||||
|
$latestEngineeringCommit = $null
|
||||||
|
$logLines = & git log --format="%h %s" -40
|
||||||
|
foreach ($line in $logLines) {
|
||||||
|
if ($line -notmatch "^[0-9a-f]+ docs\(") {
|
||||||
|
$latestEngineeringCommit = ($line -split "\s+", 2)[0]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-not $latestEngineeringCommit) {
|
||||||
|
throw "Could not find a recent engineering commit"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($readme -notmatch [regex]::Escape($latestEngineeringCommit)) {
|
||||||
|
throw "README recent engineering commit must reference latest engineering commit $latestEngineeringCommit"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($baseline -notmatch '(?m)^>\s*audited_commit:\s*`?[0-9a-f]{7,40}`?') {
|
||||||
|
throw "current-baseline.md must record audited_commit"
|
||||||
|
}
|
||||||
|
if ($baseline -notmatch '(?m)^>\s*next_engineering_target:\s*\S') {
|
||||||
|
throw "current-baseline.md must record next_engineering_target"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "PASS: README, V5.2 and configuration index are consistent."
|
||||||
@@ -10,6 +10,10 @@ $requiredPaths = @(
|
|||||||
"deploy/README.md",
|
"deploy/README.md",
|
||||||
"deploy/VERSION",
|
"deploy/VERSION",
|
||||||
"docs/current-baseline.md",
|
"docs/current-baseline.md",
|
||||||
|
"README.md",
|
||||||
|
"V5.1.md",
|
||||||
|
"V5.2.md",
|
||||||
|
"docs/configuration.md",
|
||||||
"docs/module-status.md",
|
"docs/module-status.md",
|
||||||
"docs/feature-status.md",
|
"docs/feature-status.md",
|
||||||
"docs/workspace-status.md",
|
"docs/workspace-status.md",
|
||||||
@@ -23,6 +27,7 @@ $requiredPaths = @(
|
|||||||
"scripts/dev/windows/check-large-files.ps1",
|
"scripts/dev/windows/check-large-files.ps1",
|
||||||
"scripts/dev/windows/check-line-endings.ps1",
|
"scripts/dev/windows/check-line-endings.ps1",
|
||||||
"scripts/dev/windows/check-release-manifest.ps1",
|
"scripts/dev/windows/check-release-manifest.ps1",
|
||||||
|
"scripts/dev/windows/check-readme-config.ps1",
|
||||||
"scripts/dev/windows/check-status-docs.ps1",
|
"scripts/dev/windows/check-status-docs.ps1",
|
||||||
"scripts/dev/wsl/check-env.sh",
|
"scripts/dev/wsl/check-env.sh",
|
||||||
"scripts/dev/wsl/check-emqx.sh",
|
"scripts/dev/wsl/check-emqx.sh",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ $ErrorActionPreference = "Stop"
|
|||||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-repo-completeness.ps1
|
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-repo-completeness.ps1
|
||||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-release-manifest.ps1
|
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-release-manifest.ps1
|
||||||
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-status-docs.ps1
|
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-status-docs.ps1
|
||||||
|
& powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-readme-config.ps1
|
||||||
|
|
||||||
if (Test-Path "package.json") {
|
if (Test-Path "package.json") {
|
||||||
npm run lint --if-present
|
npm run lint --if-present
|
||||||
|
|||||||
Reference in New Issue
Block a user