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 拿全字段,