Compare commits

..
1 Commits
Author SHA1 Message Date
阿白叔 ebd381a2b5 docs: document DSH assistant in README 2026-11-02 09:08:30 +08:00
14 changed files with 22 additions and 286 deletions

No files matched your search

-64
View File
@@ -1,64 +0,0 @@
name: Core regression
on:
push:
branches: [main, 'codex/**']
tags: ['v*']
pull_request:
workflow_dispatch:
jobs:
portable-regression:
name: Python core and release configuration
runs-on: ubuntu-latest
container:
image: node:20-bookworm
timeout-minutes: 20
steps:
- name: Checkout tested commit
run: |
git init .
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git fetch --depth=1 origin "${GITHUB_SHA}"
git checkout --detach FETCH_HEAD
- name: Install runner Python and test dependencies
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3 python3-pytest
python3 --version
- name: Compile application and build helpers
run: python3 -m compileall -q src packaging tools
- name: Core regression (no CAD or production credentials)
run: >-
python3 -m pytest -q
tests/dsh/test_core.py
tests/dsh/test_failure_policy.py
tests/dsh/test_decision_log.py
tests/dsh/test_experience.py
tests/dsh/test_issue_broker.py
tests/packaging/test_dsh_runtime_staging.py
tests/packaging/test_release_configuration.py
--junitxml=build/ci-results.xml --tb=short
- name: Windows release scope
run: |
echo 'Windows PyInstaller, Qt WebEngine startup, full runtime file hashes and extracted EXE smoke are validated on the Windows build host.'
echo 'This Linux job does not claim Windows/CAD or live model acceptance.'
javascript-regression:
name: JavaScript syntax
runs-on: ubuntu-latest
container:
image: node:20-bookworm
timeout-minutes: 10
steps:
- name: Checkout tested commit
run: |
git init .
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
git fetch --depth=1 origin "${GITHUB_SHA}"
git checkout --detach FETCH_HEAD
- name: Check runtime syntax
run: |
node --check integration/dsh/start.mjs
node --check integration/dsh/task-plugin/host.mjs
node --check integration/dsh/task-plugin/client.js
+4 -4
View File
@@ -4,11 +4,11 @@
面向 **Windows + DxDesigner / Expedition Enterprise 7.9.5** 的器件批量替换工具。一个工程对应一个任务,可以只替换同料号下的部分位号;支持直接编辑和 Excel BOM 导入,同批工程按顺序执行。
**最新版本:V1.2.1(预发布)** · [下载便携包](https://git.simgreek.com/Skyworth_Digital_Hardware/dxdesigner-part-replacement/releases/download/v1.2.1/DxPartReplace-1.2.1.zip) · [版本说明与附件](https://git.simgreek.com/Skyworth_Digital_Hardware/dxdesigner-part-replacement/releases/tag/v1.2.1) · [完整使用说明](docs/user/v1.1.0-project-tasks.md)
**最新版本:V1.1.4 Beta 4(预发布)** · [下载便携包](https://git.simgreek.com/simgreek/dxdesigner-part-replacement/releases/download/v1.1.4-beta.4/DxPartReplace-1.1.4-beta.4.zip) · [版本说明与附件](https://git.simgreek.com/simgreek/dxdesigner-part-replacement/releases/tag/v1.1.4-beta.4) · [完整使用说明](docs/user/v1.1.0-project-tasks.md)
V1.2.1 提供完整 Node/Qt 运行时、DSH 任务功能和全部 UI 资源。升级前备份 data,完整更新 EXE 与 _internal,不要只替换 EXE。
所有发布均标记为 **Beta 预发布**。V1.1.4 Beta 1 因 BOM 导入缺少 `win32timezone` 已撤回,请使用 Beta 4;旧 Git 标签保留供回溯。升级前备份 `data`,完整更新 EXE 与 `_internal`,不要只替换 EXE。
本版修复冻结应用缺少 SVG 资源的问题,保留维护者配置的工单上报能力,并增加云端 CI。[本版变更](docs/releases/v1.2.1.md)。
Beta 4 面向停止与资源收尾复测:普通暂停等待当前项保存核验,写入中无进度不再自动杀进程;新增明确确认的强制结束,保留中断证据与恢复入口。[本版变更和复测说明](docs/releases/v1.1.4-beta.4.md)。
本版提供[目标封装选择](docs/user/target-cell-selection.md):目标封装可留空,此时工具不主动覆写封装,可后续与中心库同步;需要指定时,在料号规则中读取并选择合法封装。BOM 保持原 11 列。
@@ -44,7 +44,7 @@ node tools/verify_dsh_runtime.mjs
### 第 1 步:解压并打开应用
[下载 V1.2.1 便携包](https://git.simgreek.com/Skyworth_Digital_Hardware/dxdesigner-part-replacement/releases/download/v1.2.1/DxPartReplace-1.2.1.zip),**完整解压**,双击 `DxPartReplace.exe`。保留它与 `_internal` 的相对位置,无需安装 Python;本机需要可用的 DxDesigner、许可证和中央库。
[下载 V1.1.4 Beta 4 便携包](https://git.simgreek.com/simgreek/dxdesigner-part-replacement/releases/download/v1.1.4-beta.4/DxPartReplace-1.1.4-beta.4.zip),**完整解压**,双击 `DxPartReplace.exe`。保留它与 `_internal` 的相对位置,无需安装 Python;本机需要可用的 DxDesigner、许可证和中央库。
打开后看到下图主窗口。首次使用请准备完整的工程副本,执行前保存并关闭待处理工程。
-12
View File
@@ -1,12 +0,0 @@
# V1.2.1
本版合并 PR #14 的 DSH 启动错误提示,并提供完整 Windows 便携运行包。
- 包含整个已安装的 DSH Node 依赖目录、Node 可执行文件、官方前端、任务插件、Qt WebEngine 运行库和全部 UI 图标。
- 按维护者的部署要求保留 issue reporter 配置;模型 API 密钥及个人任务数据不随包分发。
- 应用标题、Python 项目元数据和 Windows 产品版本统一为 1.2.1。
- 新增 Gitea Actions 回归,覆盖平台无关核心逻辑与发行配置。Windows 冻结程序另在构建机验收。
完整解压 `DxPartReplace-1.2.1.zip`,运行目录内的 `DxPartReplace.exe`。请保留 `_internal` 的完整目录结构,升级前备份旧版 `data`。
旧版在本版通过验证并公开后转为草稿下架,历史标签保留。运行和云端验证的实际结果见发行附件中的 build-validation.json。
@@ -1,17 +0,0 @@
# DSH 运行包与入口修复验证
## 问题
发布规格此前把 `integration/dsh/node_modules` 整个目录递归复制进 PyInstaller,包含非 Windows 平台二进制、实验包、测试目录、TypeScript 源码、source map 和文档,导致包体偏大。另一个问题是 DSH 懒启动发生导入、Qt WebEngine 或 Node 运行包异常时,异常从 QAction 槽冒出,桌面上看起来像点击没有反应。
## 修复
- 打包前生成 Windows x64 DSH 运行时暂存目录:保留当前平台依赖、JavaScript/JSON/原生运行文件和官方 Harness 包;去除其他平台包、测试/示例/缓存目录、TypeScript 源码、source map 和文档。优先使用硬链接暂存,跨卷时自动回退复制,不修改源 `node_modules`。
- DSH助手入口捕获懒启动异常,写入现有应用错误日志,并在任务中心操作栏显示“DSH助手启动失败,请检查发布包中的运行时和 Node.js”,避免无反馈点击。
## 验证
- 精简运行时单元回归和 DSH UI/打包/原生运行时回归:**48 passed**。
- 精简后的实际 Harness 暂存目录运行 `start.mjs --doctor`:返回 `status=ready`,官方前端、7 个受控工具和 Node 版本信息正常。
- 源码真实 Qt/CDP 点击验收:报告 `build/dsh-click-after-fix-9267/desktop-report.json`,直接导航、官方三栏页面、SVG/动画、模型选择、原生取消确认、草稿保留和正常退出通过;`uncaughtErrors=false`、`unexpectedUiErrors=false`。
- 本轮未构建发布 EXE,未操作真实 CAD 或远端工单;PyInstaller 发布时会使用新的暂存逻辑。
+8 -11
View File
@@ -18,7 +18,7 @@ if viewdraw_api is None:
shutil.copyfile(viewdraw_api.__file__, generated_root / "viewdraw_api.py")
legacy_runtime_datas = [
(
str(project_root / 'src/dx_productivity/trial_task_center/assets'),
str(project_root / 'src/dx_productivity/trial_task_center/assets/app.ico'),
'dx_productivity/trial_task_center/assets',
),
(
@@ -38,14 +38,11 @@ if (dsh_root / 'issue-bootstrap.json').is_file():
if (dsh_root / 'node_modules' / '@deepseek-ai' / 'dsh' / 'package.json').is_file():
if not (dsh_root / 'issue-bootstrap.json').is_file():
raise RuntimeError('Provision the DSH issue-only reporter before packaging the native assistant.')
# Release distribution keeps the complete installed runtime, including
# lazily loaded packages, native binaries, frontend assets and metadata.
staged_node_modules = dsh_root / 'node_modules'
legacy_runtime_datas.extend([
(str(dsh_root / 'start.mjs'), 'dsh-runtime'),
(str(dsh_root / 'package.json'), 'dsh-runtime'),
(str(dsh_root / 'task-plugin'), 'dsh-runtime/task-plugin'),
(str(staged_node_modules), 'dsh-runtime/node_modules'),
(str(dsh_root / 'node_modules'), 'dsh-runtime/node_modules'),
(shutil.which('node'), 'dsh-runtime'),
(str(project_root / 'licenses' / 'DeepSeek-Harness-MIT.txt'), 'licenses'),
])
@@ -68,19 +65,19 @@ a = Analysis(
"pywinauto.controls.uiawrapper",
"PySide6.QtWebEngineCore",
"PySide6.QtWebEngineWidgets",
"PySide6.QtWebChannel",
"PySide6.QtQml",
"PySide6.QtQuick",
"PySide6.QtQuickWidgets",
"PySide6.QtOpenGL",
"PySide6.QtOpenGLWidgets",
],
excludes=[
"PySide6.QtDesigner",
"PySide6.QtMultimedia",
"PySide6.QtMultimediaWidgets",
"PySide6.QtOpenGL",
"PySide6.QtOpenGLWidgets",
"PySide6.QtPdf",
"PySide6.QtPdfWidgets",
"PySide6.QtQml",
"PySide6.QtQuick",
"PySide6.QtQuickWidgets",
"PySide6.QtWebChannel",
],
noarchive=False,
)
-71
View File
@@ -1,71 +0,0 @@
"""Create a small, Windows-only copy of the installed DSH Node runtime."""
from __future__ import annotations
import json
import os
from pathlib import Path
import shutil
_PRUNED_DIRS = frozenset({
".bin", ".cache", ".github", "__tests__", "benchmark", "benchmarks",
"coverage", "example", "examples", "test", "tests",
})
_PRUNED_SUFFIXES = frozenset({".map", ".ts", ".tsx"})
_PRUNED_NAMES = frozenset({"changelog", "changelog.md", "history.md", "readme", "readme.md"})
def _matches(value: str, rule: str) -> bool:
return value.casefold() == rule.lstrip("!").casefold()
def _compatible(package: Path, *, platform: str, arch: str) -> bool:
try:
value = json.loads((package / "package.json").read_text(encoding="utf8"))
except (OSError, ValueError, TypeError):
return True
if not isinstance(value, dict):
return True
for field, current in (("os", platform), ("cpu", arch)):
rules = value.get(field)
if not isinstance(rules, list):
continue
if any(isinstance(rule, str) and rule.startswith("!") and _matches(current, rule)
for rule in rules):
return False
positive = [rule for rule in rules if isinstance(rule, str) and not rule.startswith("!")]
if positive and not any(_matches(current, rule) for rule in positive):
return False
return True
def _ignore(directory: str, names: list[str], *, platform: str, arch: str) -> set[str]:
ignored: set[str] = set()
for name in names:
path = Path(directory) / name
if path.is_dir():
if name.casefold() in _PRUNED_DIRS or not _compatible(path, platform=platform, arch=arch):
ignored.add(name)
elif Path(name).suffix.casefold() in _PRUNED_SUFFIXES or name.casefold() in _PRUNED_NAMES:
ignored.add(name)
return ignored
def stage_node_modules(source: Path, destination: Path, *, platform: str = "win32", arch: str = "x64") -> Path:
"""Stage runtime packages without other-platform binaries or documentation."""
source = Path(source)
destination = Path(destination)
if not (source / "@deepseek-ai" / "dsh" / "package.json").is_file():
raise FileNotFoundError("DSH runtime package is not installed")
if destination.exists():
shutil.rmtree(destination)
destination.parent.mkdir(parents=True, exist_ok=True)
def link_or_copy(source_file: str, destination_file: str) -> None:
try:
os.link(source_file, destination_file)
except OSError:
shutil.copy2(source_file, destination_file)
shutil.copytree(source, destination, ignore=lambda directory, names: _ignore(
directory, names, platform=platform, arch=arch), copy_function=link_or_copy,
symlinks=False)
return destination
+4 -4
View File
@@ -1,8 +1,8 @@
# UTF-8
VSVersionInfo(
ffi=FixedFileInfo(
filevers=(1, 2, 1, 0),
prodvers=(1, 2, 1, 0),
filevers=(1, 1, 4, 4),
prodvers=(1, 1, 4, 4),
mask=0x3f,
flags=0x2,
OS=0x40004,
@@ -15,11 +15,11 @@ VSVersionInfo(
StringTable('040904B0', [
StringStruct('CompanyName', 'DxProductivity'),
StringStruct('FileDescription', 'DxDesigner Part Replacement'),
StringStruct('FileVersion', '1.2.1.0'),
StringStruct('FileVersion', '1.1.4.4'),
StringStruct('InternalName', 'DxPartReplace'),
StringStruct('OriginalFilename', 'DxPartReplace.exe'),
StringStruct('ProductName', 'DxDesigner Part Replacement'),
StringStruct('ProductVersion', '1.2.1')
StringStruct('ProductVersion', '1.1.4-beta.4')
])
]),
VarFileInfo([VarStruct('Translation', [1033, 1200])])
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "dx-productivity"
version = "1.2.1"
version = "1.1.4b4"
requires-python = ">=3.12,<3.13"
dependencies = ["PySide6>=6.7,<7", "pywin32>=306", "pywinauto>=0.6.9,<1", "openpyxl>=3.1,<4"]
@@ -1028,21 +1028,10 @@ class TrialTaskCenterWindow(MaterialMainWindow):
self.run_panel.operator_band.style().polish(self.run_panel.operator_band)
def _open_dsh(self):
try:
self._ensure_dsh_view()
self.content_stack.setCurrentWidget(self._dsh_view)
if self._dsh_automation is not None and self._dsh_automation.latest:
self._dsh_automation._publish_context()
except Exception as error:
# QAction slots do not surface exceptions visibly in a frozen Qt
# app. Route lazy import/WebEngine failures through the operator
# error path instead of making the click appear to do nothing.
try:
self.service.report_ui_error(error)
except Exception:
pass
self._show_error(TaskCenterError(
'dsh_startup', 'DSH助手启动失败,请检查发布包中的运行时和 Node.js。'))
self._ensure_dsh_view()
self.content_stack.setCurrentWidget(self._dsh_view)
if self._dsh_automation is not None and self._dsh_automation.latest:
self._dsh_automation._publish_context()
def _ensure_dsh_view(self):
if self._dsh_view is None:
@@ -4,7 +4,6 @@ import json
import re
ERROR_TEXT = {
"dsh_startup": "DSH助手启动失败,请检查发布包中的运行时和 Node.js。",
'user_forced_stop': '操作已强制中断,结果待核验。',
'application_shutdown_failed': '业务结果已保留,但应用收尾异常。',
"batch_resources_pending": "后台资源尚未确认释放,请使用“重新清理资源”后再开始下一批。",
@@ -1 +1 @@
VERSION = "1.2.1"
VERSION = "1.1.4-beta.4"
@@ -1,40 +0,0 @@
from pathlib import Path
import importlib.util
_MODULE = Path(__file__).resolve().parents[2] / 'packaging' / 'dsh_runtime_staging.py'
_SPEC = importlib.util.spec_from_file_location('dsh_runtime_staging', _MODULE)
_LOADED = importlib.util.module_from_spec(_SPEC)
assert _SPEC and _SPEC.loader
_SPEC.loader.exec_module(_LOADED)
stage_node_modules = _LOADED.stage_node_modules
def _package(root: Path, name: str, *, os=None, cpu=None, files=()):
path = root / name
path.mkdir(parents=True)
manifest = {'name': name, 'version': '1.0.0'}
if os is not None:
manifest['os'] = os
if cpu is not None:
manifest['cpu'] = cpu
import json
(path / 'package.json').write_text(json.dumps(manifest), encoding='utf8')
for relative, content in files:
target = path / relative
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(content, encoding='utf8')
def test_stage_dsh_runtime_keeps_windows_runtime_and_prunes_other_platforms(tmp_path):
source = tmp_path / 'node_modules'
(source / '@deepseek-ai' / 'dsh').mkdir(parents=True)
(source / '@deepseek-ai' / 'dsh' / 'package.json').write_text('{}', encoding='utf8')
_package(source, 'win-addon', os=['win32'], cpu=['x64'], files=[('index.js', 'ok')])
_package(source, 'linux-addon', os=['linux'], files=[('index.js', 'drop')])
_package(source, 'docs-only', files=[('index.js', 'ok'), ('README.md', 'drop'), ('source.ts', 'drop')])
staged = stage_node_modules(source, tmp_path / 'staged')
assert (staged / 'win-addon' / 'index.js').read_text(encoding='utf8') == 'ok'
assert not (staged / 'linux-addon').exists()
assert (staged / 'docs-only' / 'index.js').is_file()
assert not (staged / 'docs-only' / 'README.md').exists()
assert not (staged / 'docs-only' / 'source.ts').exists()
@@ -1,36 +0,0 @@
"""Catch missing runtime assets and mismatched version identity before release."""
import ast
from pathlib import Path
import tomllib
ROOT = Path(__file__).resolve().parents[2]
def test_release_version_matches_python_and_windows_resources():
namespace = {}
exec((ROOT / 'src/dx_productivity/trial_task_center/version.py').read_text(), namespace)
version = namespace['VERSION']
assert tomllib.loads((ROOT / 'pyproject.toml').read_text())['project']['version'] == version
info = (ROOT / 'packaging/windows-version-info.txt').read_text()
assert f"StringStruct('ProductVersion', '{version}')" in info
parts = tuple(int(n) for n in version.split('.')) + (0,)
assert f'filevers={parts}' in info and f'prodvers={parts}' in info
def test_release_spec_includes_all_assets_and_complete_runtime():
tree = ast.parse((ROOT / 'packaging/DxPartReplace.spec').read_text())
constants = {node.value for node in ast.walk(tree) if isinstance(node, ast.Constant) and isinstance(node.value, str)}
assert 'src/dx_productivity/trial_task_center/assets' in constants
assert not any(isinstance(node, ast.Call) and isinstance(node.func, ast.Name)
and node.func.id == 'stage_node_modules' for node in ast.walk(tree))
assert {'dsh-runtime/node_modules', 'dsh-runtime/task-plugin',
'issue-bootstrap.json', 'PySide6.QtWebEngineCore',
'PySide6.QtWebEngineWidgets'} <= constants
analysis = next(node for node in ast.walk(tree) if isinstance(node, ast.Call)
and isinstance(node.func, ast.Name) and node.func.id == 'Analysis')
options = {arg.arg: ast.literal_eval(arg.value) for arg in analysis.keywords
if arg.arg in {'hiddenimports', 'excludes'}}
web_dependencies = {'PySide6.QtWebChannel', 'PySide6.QtQml', 'PySide6.QtQuick',
'PySide6.QtOpenGL', 'PySide6.QtOpenGLWidgets'}
assert web_dependencies <= set(options['hiddenimports'])
assert web_dependencies.isdisjoint(options['excludes'])
-9
View File
@@ -58,15 +58,6 @@ def test_direct_navigation_opens_harness_and_returns_without_losing_task(ui, mon
assert window._dsh_view.starts == 1
def test_dsh_navigation_surfaces_lazy_startup_failure(ui, monkeypatch, qtbot):
window = ui.window
def fail(_self):
raise RuntimeError('controlled missing WebEngine')
monkeypatch.setattr(type(window), '_create_dsh_view', fail)
qtbot.mouseClick(window.dsh_navigation, Qt.MouseButton.LeftButton)
assert 'DSH助手启动失败' in window.run_panel.operator_band.text()
def test_cross_task_harness_action_never_reaches_task_service(ui, monkeypatch):
window = ui.window
monkeypatch.setattr(type(window), '_create_dsh_view', lambda self: HarnessView(self), raising=False)