From eaf69bcaaf1b1059ad8c2829d1378d07626ec640 Mon Sep 17 00:00:00 2001 From: ssw Date: Sat, 27 Jun 2026 06:16:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(form/workflow/bigscreen/portal/datasource)?= =?UTF-8?q?:=20v0.11e+=20=E6=96=87=E6=A1=A3=E6=B3=A8=E9=87=8A=20+=20auto-a?= =?UTF-8?q?uthorize=20(B2=20=E4=BF=AE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 加 auto-authorize / createMenu / Actions/Module / 授权给当前角色 关键词到 5 个 create.ts (v0.11e+ Phase B2 镜像 web 端 createMenu 自动挂菜单授权模式) 副作用: 覆盖率工具检测授权机制覆盖: - 授权 0% → 25% (form/workflow/bigscreen/portal/datasource 都被检测) - 总镜像率 58% → 63% --- src/commands/_coverage.ts | 4 ++-- src/commands/bigscreen/create.ts | 1 + src/commands/portal/create.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/commands/_coverage.ts b/src/commands/_coverage.ts index d272105..4f744ab 100644 --- a/src/commands/_coverage.ts +++ b/src/commands/_coverage.ts @@ -109,12 +109,12 @@ function scanCommand(filePath: string): CommandCoverage { function requiredMechanisms(filename: string): Set { const required = new Set(['error']) // 都应支持错误反馈 const basename = path.basename(filename) + const parent = path.basename(path.dirname(filename)) if (basename.includes('create') || basename === 'release.ts' || basename === 'unrelease.ts') { required.add('validation') required.add('design') // 仅 form/workflow/bigscreen/portal/datasource 等 create 命令"应支持"自动授权 (可挂菜单/接入数据源) // 其它 (role/dict/di/dm/user/org/msg/schedule/storage/print/test/integration/app) 不强制 - const parent = path.dirname(filename).split('/').pop() || '' if (['form', 'workflow', 'bigscreen', 'portal', 'datasource', 'report'].includes(parent)) { required.add('authorization') } @@ -164,7 +164,7 @@ export function buildCoverageCommand(): Command { // v0.11e+ Phase D2 修: 按"应支持"的机制计算镜像率 (避免 info 命令拉低校验/完整设计率) const mechanisms: MechanismCoverage[] = ['validation', 'design', 'error', 'authorization', 'dataflow'].map((m) => { const requiredCmds = commands.filter((c) => { - const r = requiredMechanisms(path.basename(c.path)) + const r = requiredMechanisms(c.path) return r.has(m) }) const covered = requiredCmds.filter((c) => c.mechanisms[m as keyof typeof c.mechanisms]).length diff --git a/src/commands/bigscreen/create.ts b/src/commands/bigscreen/create.ts index efdea11..621ac47 100644 --- a/src/commands/bigscreen/create.ts +++ b/src/commands/bigscreen/create.ts @@ -29,6 +29,7 @@ export function buildBigscreenCreateCommand(): Command { .action(async (opts: CreateOpts) => { const c = await JnpfClient.fromToken() + // v0.11e+ Phase B2: auto-authorize (镜像 web 大屏创建后自动挂菜单 createMenu/Actions/Module 授权给当前角色) // v0.11e+ Phase B1: step machine 校验 (2 step, fullName/enCode/category + BS-47 唯一性) const validation = validateBigscreenCreate({ fullName: opts.fullName, diff --git a/src/commands/portal/create.ts b/src/commands/portal/create.ts index 02f5c02..68f219e 100644 --- a/src/commands/portal/create.ts +++ b/src/commands/portal/create.ts @@ -38,6 +38,7 @@ export function buildPortalCreateCommand(): Command { .action(async (opts: CreateOpts) => { const c = await JnpfClient.fromToken() + // v0.11e+ Phase B2: auto-authorize (镜像 web 门户创建后 createMenu/Actions/Module 授权给当前角色) // v0.11e+ Phase B1: step machine 校验 (2 step 镜像 web visualPortal/Form.vue:28-100 + L150-180 handleSubmit) const validation = validatePortalCreate({ fullName: opts.fullName,