From 40674cc3ce2d172e1f386dfb753960ecba22b887 Mon Sep 17 00:00:00 2001 From: ssw Date: Thu, 2 Jul 2026 12:35:57 +0800 Subject: [PATCH] =?UTF-8?q?P2-2=20=E4=BA=8C=E6=AC=A1=E4=BF=AE=E5=A4=8D:=20?= =?UTF-8?q?report=20release=20--cells=20JSON=20=E9=A2=84=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=20(2026-07-02)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第一次 commit 漏了 release.ts (用 releaseType 不是 type) 补 release.ts: step 2 type 校验后, opts.cells try JSON.parse 预校验 --- src/commands/report/release.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/commands/report/release.ts b/src/commands/report/release.ts index a56a20c..d2a1cd5 100644 --- a/src/commands/report/release.ts +++ b/src/commands/report/release.ts @@ -97,6 +97,16 @@ export function buildReportReleaseCommand(): Command { log.error('提示: --type=0 (仅保存设计) 不强制 cells, 但仍建议提供') process.exit(1) } + // v0.15+ (P2-2): --cells JSON 预校验, 防止双重 stringify 导致设计器反序列化失败 + if (opts.cells) { + try { + JSON.parse(opts.cells) + } catch (e) { + log.error(`--cells 不是合法 JSON 字符串: ${(e as Error).message?.slice(0, 100)}`) + log.error('提示: 后端 ReportCrForm.cells 是 String, 期望前端传 JSON.stringify 后的结果') + process.exit(1) + } + } // === step 3: 构造 saveVersion body (镜像 web 端 Form.vue handleSubmit) === // 后端 ReportUpForm 要求几乎所有字段都在, 跟 update 一样先 getReportInfo 拿全字段,