xb-init 2.6.2__tar.gz → 2.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xb_init-2.6.2 → xb_init-2.9.0}/PKG-INFO +38 -8
- {xb_init-2.6.2 → xb_init-2.9.0}/README.md +37 -7
- {xb_init-2.6.2 → xb_init-2.9.0}/pyproject.toml +1 -1
- {xb_init-2.6.2 → xb_init-2.9.0}/tests/test_cli.py +7 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/tests/test_config_form.py +9 -0
- xb_init-2.9.0/tests/test_template_render.py +487 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/commands/init.py +35 -4
- xb_init-2.9.0/xb/templates/backend/api/factory_test/routes.py.j2 +161 -0
- xb_init-2.9.0/xb/templates/backend/api/logs.py.j2 +84 -0
- xb_init-2.9.0/xb/templates/backend/api/settings.py.j2 +259 -0
- xb_init-2.9.0/xb/templates/backend/api/terminal/__init__.py.j2 +3 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/backend_build.py.j2 +5 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/main.py.j2 +28 -3
- xb_init-2.9.0/xb/templates/backend/managers/__init__.py.j2 +5 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/managers/path_manager.py.j2 +5 -4
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/managers/secret_obfuscator.py.j2 +5 -2
- xb_init-2.9.0/xb/templates/backend/managers/yaml_comments.py.j2 +127 -0
- xb_init-2.9.0/xb/templates/backend/schemas/__init__.py.j2 +0 -0
- xb_init-2.9.0/xb/templates/backend/schemas/factory_test.py.j2 +89 -0
- xb_init-2.9.0/xb/templates/backend/services/factory_test/__init__.py.j2 +13 -0
- xb_init-2.9.0/xb/templates/backend/services/factory_test/command_executor.py.j2 +42 -0
- xb_init-2.9.0/xb/templates/backend/services/factory_test/commands.py.j2 +36 -0
- xb_init-2.9.0/xb/templates/backend/services/factory_test/definition.py.j2 +124 -0
- xb_init-2.9.0/xb/templates/backend/services/factory_test/report.py.j2 +182 -0
- xb_init-2.9.0/xb/templates/backend/services/factory_test/result_compare.py.j2 +72 -0
- xb_init-2.9.0/xb/templates/backend/services/factory_test/runner.py.j2 +351 -0
- xb_init-2.9.0/xb/templates/backend/services/factory_test/test_control.py.j2 +95 -0
- xb_init-2.9.0/xb/templates/backend/services/factory_test/test_data.py.j2 +106 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/services/updater.py.j2 +4 -2
- xb_init-2.9.0/xb/templates/configs/global_config.yaml.j2 +3 -0
- xb_init-2.9.0/xb/templates/configs/secrets.yaml.example.j2 +8 -0
- xb_init-2.9.0/xb/templates/configs/test_plan.csv.j2 +6 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/main.js.j2 +5 -1
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/package.json.j2 +0 -2
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/resources/polkit/privileged-helper.sh.j2 +8 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/resources/postinst.py.j2 +1 -3
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/resources/postrm.py.j2 +1 -3
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/App.vue.j2 +21 -3
- xb_init-2.9.0/xb/templates/frontend/src/components/LogViewer.vue.j2 +330 -0
- xb_init-2.9.0/xb/templates/frontend/src/components/SettingsView.vue.j2 +293 -0
- xb_init-2.9.0/xb/templates/frontend/src/components/factory_test/CsvEditor.vue.j2 +290 -0
- xb_init-2.9.0/xb/templates/frontend/src/components/factory_test/ManualConfirmBanner.vue.j2 +324 -0
- xb_init-2.9.0/xb/templates/frontend/src/components/factory_test/TestDataViewer.vue.j2 +337 -0
- xb_init-2.9.0/xb/templates/frontend/src/components/factory_test/TestGroupTable.vue.j2 +166 -0
- xb_init-2.9.0/xb/templates/frontend/src/components/factory_test/TestLogPanel.vue.j2 +169 -0
- xb_init-2.9.0/xb/templates/frontend/src/services/factoryTestApi.js.j2 +33 -0
- xb_init-2.9.0/xb/templates/frontend/src/views/FactoryTestView.vue.j2 +329 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/AGENTS.md.j2 +30 -13
- xb_init-2.9.0/xb/templates/root/README.md.j2 +174 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/dev.py.j2 +2 -4
- xb_init-2.9.0/xb/templates/root/docs/csv/346/265/213/350/257/225/345/274/225/346/223/216/350/257/264/346/230/216.md +127 -0
- xb_init-2.9.0/xb/templates/root/docs/polkit/345/205/215/345/257/206/346/217/220/346/235/203/350/257/264/346/230/216.md +244 -0
- xb_init-2.9.0/xb/templates/root/docs//346/211/223/345/214/205/344/270/216/350/277/220/350/241/214/350/267/257/345/276/204/350/257/264/346/230/216.md +166 -0
- xb_init-2.9.0/xb/templates/root/docs//347/211/210/346/234/254/347/256/241/347/220/206/350/257/264/346/230/216.md +121 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/docs//350/207/252/345/212/250/346/233/264/346/226/260/350/257/264/346/230/216.md +15 -4
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/utils/config_form.py +19 -1
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/utils/template_engine.py +172 -41
- xb_init-2.6.2/tests/test_template_render.py +0 -239
- xb_init-2.6.2/xb/templates/backend/managers/__init__.py.j2 +0 -7
- xb_init-2.6.2/xb/templates/configs/global_config.yaml.j2 +0 -3
- xb_init-2.6.2/xb/templates/configs/secrets.yaml.example.j2 +0 -6
- xb_init-2.6.2/xb/templates/frontend/src/components/FileManager.vue.j2 +0 -357
- xb_init-2.6.2/xb/templates/root/README.md.j2 +0 -465
- {xb_init-2.6.2 → xb_init-2.9.0}/.github/workflows/ci.yml +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/.gitignore +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/docs/screenshot.png +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/tests/test_doctor.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/tests/test_update_templates.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/tests/test_upgrade.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/__init__.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/cli.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/commands/__init__.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/commands/build.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/commands/dev.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/commands/doctor.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/commands/upgrade.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/commands/version.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/api/__init__.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/api/config.py.j2 +0 -0
- {xb_init-2.6.2/xb/templates/backend/api/terminal → xb_init-2.9.0/xb/templates/backend/api/factory_test}/__init__.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/api/ports.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/api/terminal/routes.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/api/update/__init__.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/app_version.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/managers/logger_manager.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/managers/privileged_manager.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/requirements.txt.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/services/__init__.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/backend/services/feishu_client.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/configs/config_changes.json.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/launcher.js.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/port_diagnostics.js.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/preload.js.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/prepare.js.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/resources/polkit/privileged.policy.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/resources/polkit/privileged.rules.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/electron/resources/uninstaller.nsh.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/index.html.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/package.json.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/components/DashboardHome.vue.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/components/GitVersionBadge.vue.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/components/RefreshButton.vue.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/components/TerminalPanel.vue.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/components/TerminalView.vue.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/components/ThemeToggle.vue.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/components/version/CommitHistoryPanel.vue.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/components/version/UpdatePanel.vue.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/composables/useTerminalSessions.js.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/composables/useUpdate.js.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/main.js.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/src/style.css.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/frontend/vite.config.js.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/.gitignore.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/LICENSE.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/build.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/docs/images/feishu-folder.png +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/docs/images/feishu-permission.png +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/docs/images/release-upload.png +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/docs/images/update-dialog.png +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/root/pyproject.toml.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/scripts/example.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/scripts/feishu_upload.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/version/hooks/pre-commit.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/version/scripts/gui_version_manager.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/version/scripts/install_hooks.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/version/scripts/version_manager.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/templates/version/scripts/web_version_manager.py.j2 +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/utils/__init__.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/utils/click_helpers.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/utils/project.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/utils/validators.py +0 -0
- {xb_init-2.6.2 → xb_init-2.9.0}/xb/utils/version_check.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: xb-init
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.0
|
|
4
4
|
Summary: Project management tool for UV + FastAPI + Vue3 + Electron desktop applications
|
|
5
5
|
Project-URL: Homepage, https://github.com/xuebli/xb
|
|
6
6
|
Project-URL: Documentation, https://github.com/xuebli/xb#readme
|
|
@@ -42,7 +42,11 @@ Description-Content-Type: text/markdown
|
|
|
42
42
|
- 自动生成 `AGENTS.md`(AI 编码助手协作约定)
|
|
43
43
|
- 内置全局亮色/暗色主题切换
|
|
44
44
|
- 可选内置终端(`--terminal`)
|
|
45
|
+
- 可选日志中心(`--logs`,后端日志实时推送到界面,排障不用登机器)
|
|
46
|
+
- 通用设置页(yaml 加一行"值 + 行尾 `# 显示名`"即自动出表单,注释回填不丢失;secrets.yaml 的 key 自动渲染为密码框)
|
|
45
47
|
- 可选应用内自动更新(`--update`,飞书云盘发布 + 版本检查 + 下载校验 + 自动安装)
|
|
48
|
+
- 可选 CSV 测试引擎(`--csv-test`,产测专用:CSV 定义测试项、人工确认、PASS 判定、HTML 报告归档与历史查看)
|
|
49
|
+
- 特权操作免密提权标配(Linux polkit,管理员组无感、无密码落盘;helper 白名单执行器)
|
|
46
50
|
- 可选自定义应用图标(`--icon`)
|
|
47
51
|
- 内置开发、构建、版本管理命令
|
|
48
52
|
- 自动版本检查与一键升级(`xb --upgrade`)
|
|
@@ -77,14 +81,20 @@ xb init demo
|
|
|
77
81
|
# 带内置终端
|
|
78
82
|
xb init demo --terminal
|
|
79
83
|
|
|
80
|
-
#
|
|
84
|
+
# 带日志中心
|
|
85
|
+
xb init demo --logs
|
|
86
|
+
|
|
87
|
+
# 启用应用内自动更新(Ubuntu 更新安装走 polkit 免密提权,管理员组无感)
|
|
81
88
|
xb init demo --update
|
|
82
89
|
|
|
90
|
+
# 启用 CSV 测试引擎(产测:测试项 CSV + 人工确认 + HTML 报告)
|
|
91
|
+
xb init demo --csv-test
|
|
92
|
+
|
|
83
93
|
# 带自定义图标
|
|
84
94
|
xb init demo --icon ~/icons/app.png
|
|
85
95
|
|
|
86
96
|
cd demo
|
|
87
|
-
#
|
|
97
|
+
# 启动开发环境(自动完成:依赖同步、Git hooks 安装、polkit 特权入口部署)
|
|
88
98
|
xb dev
|
|
89
99
|
|
|
90
100
|
# 查看状态
|
|
@@ -105,12 +115,14 @@ xb dev stop
|
|
|
105
115
|
❯ [ ] 应用显示名 : Demo
|
|
106
116
|
[ ] 端口(后端/前端) : 8000 / 8001
|
|
107
117
|
[ ] 内置终端 ✘ (Web 终端组件)
|
|
108
|
-
[ ] 应用内更新 ✘ (
|
|
118
|
+
[ ] 应用内更新 ✘ (Ubuntu 更新安装走 polkit 免密提权)
|
|
119
|
+
[ ] 日志中心 ✘ (实时查看后端日志,排障刚需)
|
|
120
|
+
[ ] CSV 测试引擎 ✘ (产测专用:测试项 CSV + HTML 报告)
|
|
109
121
|
[ ] 应用图标 : 使用默认
|
|
110
122
|
[ ] 跳过依赖安装 ✘ (离线环境可跳过)
|
|
111
123
|
```
|
|
112
124
|
|
|
113
|
-
- `--name/--port/--terminal/--update/--icon/--skip-install` 传了的参数
|
|
125
|
+
- `--name/--port/--terminal/--update/--logs/--csv-test/--icon/--skip-install` 传了的参数
|
|
114
126
|
直接预填进表单并勾上,回车即确认,老用法不受影响
|
|
115
127
|
- 文本行(显示名/端口/图标)勾选时若仍是默认值则自动清空,直接输入即可
|
|
116
128
|
- stdin 非终端时(脚本/CI 管道调用)自动跳过表单,沿用 CLI 参数
|
|
@@ -152,7 +164,7 @@ Electron 二进制镜像通过 `ELECTRON_MIRROR` 环境变量注入。
|
|
|
152
164
|
|
|
153
165
|
| 命令 | 说明 |
|
|
154
166
|
|------|------|
|
|
155
|
-
| `xb init <name> [--name 显示名] [--port 9000] [--terminal] [--update] [--icon PATH] [--skip-install]` | 初始化项目 |
|
|
167
|
+
| `xb init <name> [--name 显示名] [--port 9000] [--terminal] [--update] [--logs] [--icon PATH] [--skip-install]` | 初始化项目 |
|
|
156
168
|
| `xb dev [start\|stop\|status]` | 启动/停止/查看开发环境 |
|
|
157
169
|
| `xb build [all\|frontend\|backend\|electron]` | 构建项目 |
|
|
158
170
|
| `xb build -f / -b / -e / -a` | 构建快捷 flag |
|
|
@@ -175,7 +187,9 @@ xb init demo --icon ./my-icon.png
|
|
|
175
187
|
|
|
176
188
|
> 详细原理与 AI 开发者注意事项见模板内
|
|
177
189
|
> **[xb/templates/root/docs/自动更新说明.md](xb/templates/root/docs/自动更新说明.md)**
|
|
178
|
-
> (生成的项目会自带 `docs/自动更新说明.md`
|
|
190
|
+
> (生成的项目会自带 `docs/自动更新说明.md` 与配图);
|
|
191
|
+
> Ubuntu polkit 免密提权的授权机制与调试方法见
|
|
192
|
+
> **[xb/templates/root/docs/polkit免密提权说明.md](xb/templates/root/docs/polkit免密提权说明.md)**。
|
|
179
193
|
|
|
180
194
|
`xb init demo --update` 会让生成的项目内置自动更新能力,
|
|
181
195
|
以飞书云盘的一个文件夹作为发布"货架":
|
|
@@ -188,8 +202,11 @@ xb init demo --icon ./my-icon.png
|
|
|
188
202
|
| `backend/services/updater.py` | 版本比较、信息拉取、下载校验、配置备份迁移、安装 |
|
|
189
203
|
| `backend/services/feishu_client.py` | 飞书接口封装(文件夹列举、并发下载) |
|
|
190
204
|
| `backend/managers/secret_obfuscator.py` | 敏感值混淆(`obf1:`,防围观级别) |
|
|
205
|
+
| `backend/managers/privileged_manager.py` | polkit 特权客户端(pkexec 调 root 白名单执行器) |
|
|
191
206
|
| `backend/app_version.py` | 后端版本号(version_manager 提交时自动同步) |
|
|
192
|
-
| `frontend/src/components/
|
|
207
|
+
| `frontend/src/components/version/UpdatePanel.vue` | 更新弹窗(版本信息 / 更新说明 / 迁移明细 / 进度条) |
|
|
208
|
+
| `frontend/src/components/version/CommitHistoryPanel.vue` | 版本弹窗里的提交历史 |
|
|
209
|
+
| `frontend/src/components/GitVersionBadge.vue` | 顶栏版本号徽章 = 更新入口 |
|
|
193
210
|
| `frontend/src/composables/useUpdate.js` | 定时检查 / 下载进度轮询 |
|
|
194
211
|
| `scripts/feishu_upload.py` | 发版端:安装包与版本信息上传飞书 |
|
|
195
212
|
| `configs/config_changes.json` | 配置迁移清单(顶层 key 是版本号) |
|
|
@@ -208,6 +225,18 @@ postinst 预部署,管理员组无感、无密码落盘),Windows 等退出
|
|
|
208
225
|
建云盘文件夹,完整链接填入 `update_folder_url`。开发模式(源码运行)不支持
|
|
209
226
|
应用内更新,检查接口返回 `packaged: false`。
|
|
210
227
|
|
|
228
|
+
## 深入文档
|
|
229
|
+
|
|
230
|
+
生成的项目自带 `docs/` 说明文档,模板源文件在 `xb/templates/root/docs/`:
|
|
231
|
+
|
|
232
|
+
| 文档 | 内容 |
|
|
233
|
+
|------|------|
|
|
234
|
+
| [自动更新说明.md](xb/templates/root/docs/自动更新说明.md) | 应用内自动更新:发版流程、配置迁移清单、AI 开发者纪律 |
|
|
235
|
+
| [polkit免密提权说明.md](xb/templates/root/docs/polkit免密提权说明.md) | Linux polkit 免密提权:安全模型、三件套部署、新增特权操作、排障 |
|
|
236
|
+
| [打包与运行路径说明.md](xb/templates/root/docs/打包与运行路径说明.md) | 构建产物、DEB/NSIS 安装布局、运行时数据目录、三种运行形态判定 |
|
|
237
|
+
| [csv测试引擎说明.md](xb/templates/root/docs/csv测试引擎说明.md) | 产测 CSV 引擎:测试项格式、指令键注册、HTML 报告、纪律(`--csv-test` 项目) |
|
|
238
|
+
| [版本管理说明.md](xb/templates/root/docs/版本管理说明.md) | 版本号 single source of truth、三模态 bump 弹窗、手动 bump、hook 纪律 |
|
|
239
|
+
|
|
211
240
|
## 生成的项目结构
|
|
212
241
|
|
|
213
242
|
```
|
|
@@ -235,6 +264,7 @@ demo/
|
|
|
235
264
|
├── version/ # 版本管理(pre-commit hook)
|
|
236
265
|
├── configs/ # 配置文件
|
|
237
266
|
├── datas/ # 运行时数据(gitignore)
|
|
267
|
+
├── docs/ # 说明文档(打包路径/自动更新/polkit 提权)
|
|
238
268
|
├── dev.py # 开发脚本(Windows/Linux)
|
|
239
269
|
├── build.py # 打包脚本(Windows/Linux)
|
|
240
270
|
└── .venv # Python 虚拟环境
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
- 自动生成 `AGENTS.md`(AI 编码助手协作约定)
|
|
14
14
|
- 内置全局亮色/暗色主题切换
|
|
15
15
|
- 可选内置终端(`--terminal`)
|
|
16
|
+
- 可选日志中心(`--logs`,后端日志实时推送到界面,排障不用登机器)
|
|
17
|
+
- 通用设置页(yaml 加一行"值 + 行尾 `# 显示名`"即自动出表单,注释回填不丢失;secrets.yaml 的 key 自动渲染为密码框)
|
|
16
18
|
- 可选应用内自动更新(`--update`,飞书云盘发布 + 版本检查 + 下载校验 + 自动安装)
|
|
19
|
+
- 可选 CSV 测试引擎(`--csv-test`,产测专用:CSV 定义测试项、人工确认、PASS 判定、HTML 报告归档与历史查看)
|
|
20
|
+
- 特权操作免密提权标配(Linux polkit,管理员组无感、无密码落盘;helper 白名单执行器)
|
|
17
21
|
- 可选自定义应用图标(`--icon`)
|
|
18
22
|
- 内置开发、构建、版本管理命令
|
|
19
23
|
- 自动版本检查与一键升级(`xb --upgrade`)
|
|
@@ -48,14 +52,20 @@ xb init demo
|
|
|
48
52
|
# 带内置终端
|
|
49
53
|
xb init demo --terminal
|
|
50
54
|
|
|
51
|
-
#
|
|
55
|
+
# 带日志中心
|
|
56
|
+
xb init demo --logs
|
|
57
|
+
|
|
58
|
+
# 启用应用内自动更新(Ubuntu 更新安装走 polkit 免密提权,管理员组无感)
|
|
52
59
|
xb init demo --update
|
|
53
60
|
|
|
61
|
+
# 启用 CSV 测试引擎(产测:测试项 CSV + 人工确认 + HTML 报告)
|
|
62
|
+
xb init demo --csv-test
|
|
63
|
+
|
|
54
64
|
# 带自定义图标
|
|
55
65
|
xb init demo --icon ~/icons/app.png
|
|
56
66
|
|
|
57
67
|
cd demo
|
|
58
|
-
#
|
|
68
|
+
# 启动开发环境(自动完成:依赖同步、Git hooks 安装、polkit 特权入口部署)
|
|
59
69
|
xb dev
|
|
60
70
|
|
|
61
71
|
# 查看状态
|
|
@@ -76,12 +86,14 @@ xb dev stop
|
|
|
76
86
|
❯ [ ] 应用显示名 : Demo
|
|
77
87
|
[ ] 端口(后端/前端) : 8000 / 8001
|
|
78
88
|
[ ] 内置终端 ✘ (Web 终端组件)
|
|
79
|
-
[ ] 应用内更新 ✘ (
|
|
89
|
+
[ ] 应用内更新 ✘ (Ubuntu 更新安装走 polkit 免密提权)
|
|
90
|
+
[ ] 日志中心 ✘ (实时查看后端日志,排障刚需)
|
|
91
|
+
[ ] CSV 测试引擎 ✘ (产测专用:测试项 CSV + HTML 报告)
|
|
80
92
|
[ ] 应用图标 : 使用默认
|
|
81
93
|
[ ] 跳过依赖安装 ✘ (离线环境可跳过)
|
|
82
94
|
```
|
|
83
95
|
|
|
84
|
-
- `--name/--port/--terminal/--update/--icon/--skip-install` 传了的参数
|
|
96
|
+
- `--name/--port/--terminal/--update/--logs/--csv-test/--icon/--skip-install` 传了的参数
|
|
85
97
|
直接预填进表单并勾上,回车即确认,老用法不受影响
|
|
86
98
|
- 文本行(显示名/端口/图标)勾选时若仍是默认值则自动清空,直接输入即可
|
|
87
99
|
- stdin 非终端时(脚本/CI 管道调用)自动跳过表单,沿用 CLI 参数
|
|
@@ -123,7 +135,7 @@ Electron 二进制镜像通过 `ELECTRON_MIRROR` 环境变量注入。
|
|
|
123
135
|
|
|
124
136
|
| 命令 | 说明 |
|
|
125
137
|
|------|------|
|
|
126
|
-
| `xb init <name> [--name 显示名] [--port 9000] [--terminal] [--update] [--icon PATH] [--skip-install]` | 初始化项目 |
|
|
138
|
+
| `xb init <name> [--name 显示名] [--port 9000] [--terminal] [--update] [--logs] [--icon PATH] [--skip-install]` | 初始化项目 |
|
|
127
139
|
| `xb dev [start\|stop\|status]` | 启动/停止/查看开发环境 |
|
|
128
140
|
| `xb build [all\|frontend\|backend\|electron]` | 构建项目 |
|
|
129
141
|
| `xb build -f / -b / -e / -a` | 构建快捷 flag |
|
|
@@ -146,7 +158,9 @@ xb init demo --icon ./my-icon.png
|
|
|
146
158
|
|
|
147
159
|
> 详细原理与 AI 开发者注意事项见模板内
|
|
148
160
|
> **[xb/templates/root/docs/自动更新说明.md](xb/templates/root/docs/自动更新说明.md)**
|
|
149
|
-
> (生成的项目会自带 `docs/自动更新说明.md`
|
|
161
|
+
> (生成的项目会自带 `docs/自动更新说明.md` 与配图);
|
|
162
|
+
> Ubuntu polkit 免密提权的授权机制与调试方法见
|
|
163
|
+
> **[xb/templates/root/docs/polkit免密提权说明.md](xb/templates/root/docs/polkit免密提权说明.md)**。
|
|
150
164
|
|
|
151
165
|
`xb init demo --update` 会让生成的项目内置自动更新能力,
|
|
152
166
|
以飞书云盘的一个文件夹作为发布"货架":
|
|
@@ -159,8 +173,11 @@ xb init demo --icon ./my-icon.png
|
|
|
159
173
|
| `backend/services/updater.py` | 版本比较、信息拉取、下载校验、配置备份迁移、安装 |
|
|
160
174
|
| `backend/services/feishu_client.py` | 飞书接口封装(文件夹列举、并发下载) |
|
|
161
175
|
| `backend/managers/secret_obfuscator.py` | 敏感值混淆(`obf1:`,防围观级别) |
|
|
176
|
+
| `backend/managers/privileged_manager.py` | polkit 特权客户端(pkexec 调 root 白名单执行器) |
|
|
162
177
|
| `backend/app_version.py` | 后端版本号(version_manager 提交时自动同步) |
|
|
163
|
-
| `frontend/src/components/
|
|
178
|
+
| `frontend/src/components/version/UpdatePanel.vue` | 更新弹窗(版本信息 / 更新说明 / 迁移明细 / 进度条) |
|
|
179
|
+
| `frontend/src/components/version/CommitHistoryPanel.vue` | 版本弹窗里的提交历史 |
|
|
180
|
+
| `frontend/src/components/GitVersionBadge.vue` | 顶栏版本号徽章 = 更新入口 |
|
|
164
181
|
| `frontend/src/composables/useUpdate.js` | 定时检查 / 下载进度轮询 |
|
|
165
182
|
| `scripts/feishu_upload.py` | 发版端:安装包与版本信息上传飞书 |
|
|
166
183
|
| `configs/config_changes.json` | 配置迁移清单(顶层 key 是版本号) |
|
|
@@ -179,6 +196,18 @@ postinst 预部署,管理员组无感、无密码落盘),Windows 等退出
|
|
|
179
196
|
建云盘文件夹,完整链接填入 `update_folder_url`。开发模式(源码运行)不支持
|
|
180
197
|
应用内更新,检查接口返回 `packaged: false`。
|
|
181
198
|
|
|
199
|
+
## 深入文档
|
|
200
|
+
|
|
201
|
+
生成的项目自带 `docs/` 说明文档,模板源文件在 `xb/templates/root/docs/`:
|
|
202
|
+
|
|
203
|
+
| 文档 | 内容 |
|
|
204
|
+
|------|------|
|
|
205
|
+
| [自动更新说明.md](xb/templates/root/docs/自动更新说明.md) | 应用内自动更新:发版流程、配置迁移清单、AI 开发者纪律 |
|
|
206
|
+
| [polkit免密提权说明.md](xb/templates/root/docs/polkit免密提权说明.md) | Linux polkit 免密提权:安全模型、三件套部署、新增特权操作、排障 |
|
|
207
|
+
| [打包与运行路径说明.md](xb/templates/root/docs/打包与运行路径说明.md) | 构建产物、DEB/NSIS 安装布局、运行时数据目录、三种运行形态判定 |
|
|
208
|
+
| [csv测试引擎说明.md](xb/templates/root/docs/csv测试引擎说明.md) | 产测 CSV 引擎:测试项格式、指令键注册、HTML 报告、纪律(`--csv-test` 项目) |
|
|
209
|
+
| [版本管理说明.md](xb/templates/root/docs/版本管理说明.md) | 版本号 single source of truth、三模态 bump 弹窗、手动 bump、hook 纪律 |
|
|
210
|
+
|
|
182
211
|
## 生成的项目结构
|
|
183
212
|
|
|
184
213
|
```
|
|
@@ -206,6 +235,7 @@ demo/
|
|
|
206
235
|
├── version/ # 版本管理(pre-commit hook)
|
|
207
236
|
├── configs/ # 配置文件
|
|
208
237
|
├── datas/ # 运行时数据(gitignore)
|
|
238
|
+
├── docs/ # 说明文档(打包路径/自动更新/polkit 提权)
|
|
209
239
|
├── dev.py # 开发脚本(Windows/Linux)
|
|
210
240
|
├── build.py # 打包脚本(Windows/Linux)
|
|
211
241
|
└── .venv # Python 虚拟环境
|
|
@@ -52,11 +52,18 @@ def test_update_hint_suppressed_on_windows(monkeypatch, tmp_path):
|
|
|
52
52
|
assert "polkit" not in output
|
|
53
53
|
|
|
54
54
|
|
|
55
|
+
def test_logs_passed_through(monkeypatch, tmp_path):
|
|
56
|
+
captured, _ = _invoke_init(monkeypatch, tmp_path, ["--logs"])
|
|
57
|
+
|
|
58
|
+
assert captured["enable_logs"] is True
|
|
59
|
+
|
|
60
|
+
|
|
55
61
|
def test_plain_init_has_no_update(monkeypatch, tmp_path):
|
|
56
62
|
captured, _ = _invoke_init(monkeypatch, tmp_path, [])
|
|
57
63
|
|
|
58
64
|
assert captured["enable_update"] is False
|
|
59
65
|
assert captured["enable_terminal"] is False
|
|
66
|
+
assert captured["enable_logs"] is False
|
|
60
67
|
|
|
61
68
|
|
|
62
69
|
def test_display_name_passed_through(monkeypatch, tmp_path):
|
|
@@ -58,10 +58,17 @@ def test_collect_unchecked_items_are_none():
|
|
|
58
58
|
assert result["port"] is None
|
|
59
59
|
assert result["terminal"] is False
|
|
60
60
|
assert result["update"] is False
|
|
61
|
+
assert result["logs"] is False
|
|
61
62
|
assert result["icon"] is None
|
|
62
63
|
assert result["skip_install"] is False
|
|
63
64
|
|
|
64
65
|
|
|
66
|
+
def test_collect_logs_toggled():
|
|
67
|
+
form = make_form({"logs": True})
|
|
68
|
+
result = form.collect()
|
|
69
|
+
assert result["logs"] is True
|
|
70
|
+
|
|
71
|
+
|
|
65
72
|
def test_collect_valid_port():
|
|
66
73
|
form = make_form()
|
|
67
74
|
_cursor_key(form, "port")
|
|
@@ -99,6 +106,7 @@ def test_run_config_form_skipped_when_not_tty():
|
|
|
99
106
|
"port": 9100,
|
|
100
107
|
"terminal": True,
|
|
101
108
|
"update": True,
|
|
109
|
+
"logs": True,
|
|
102
110
|
"icon": None,
|
|
103
111
|
"skip_install": False,
|
|
104
112
|
})
|
|
@@ -106,4 +114,5 @@ def test_run_config_form_skipped_when_not_tty():
|
|
|
106
114
|
assert result["port"] == 9100
|
|
107
115
|
assert result["terminal"] is True
|
|
108
116
|
assert result["update"] is True
|
|
117
|
+
assert result["logs"] is True
|
|
109
118
|
assert result["display_name"] is None
|