auto(14b5ea1b9bd9): session end @ 2026-07-21T22:04:07 (+20f)

This commit is contained in:
ssw committed 2026-07-21 22:04:07 +08:00
1 parent c584e9f4c1
commit e2b1381c50
20 files changed
+222 -32

No files matched your search

+34 -3
View File
@@ -1,11 +1,42 @@
/**
* commands/_blindspot_guards.ts — 高频运行时 guard (精简后 16 条)
* 设计: 从历史 ~52 条盲点中取高频 16 条, 从文档 → 代码.
* commands/_blindspot_guards.ts — 高频运行时 guard (精简后 22 条)
*
* 三重处理架构 (dacli v2.3+, 2026-07-21 固化) — 「三重提醒」第 1 重 (pre-execution):
*
* ┌────────────────────────────────────────────────────────────────┐
* │ 第 1 重 (PRE-execution 提醒 — 本文件) │
* │ ───────────────────────────────────────────────────────────── │
* │ ERROR: 阻塞执行 + print ✗ + 必须修复 (BS-新117 / BS-60) │
* │ WARN : 警告放行 + fix 提示 (BS-45 / BS-54) │
* │ INFO : 仅 stdout 一行 (BS-46 load 失败兜底等) │
* └────────────────────────────────────────────────────────────────┘
* │
* ▼
* ┌────────────────────────────────────────────────────────────────┐
* │ 第 2 重 (POST-execution 提醒 — _post_reminders.ts) │
* │ ───────────────────────────────────────────────────────────── │
* │ remindAiLoginExpired / remindAiEnCodeDiverge / │
* │ remindMenuMissingRequired / remindScheduleListBug / │
* │ remindBigscreenVisualEmpty / remindDirtyCheckSkip │
* └────────────────────────────────────────────────────────────────┘
* │
* ▼
* ┌────────────────────────────────────────────────────────────────┐
* │ 第 3 重 (三轮 修复 — _auto_fix.ts) │
* │ ───────────────────────────────────────────────────────────── │
* │ silent : 100% 静默, 不通知 (S4/S5/S10/S-X1/S-X2) │
* │ assertive: 自动修 + 回滚 (A1/A2/A3/A4/A5/BS-DC-SKIP) │
* │ suggest : 不修, 给候选 (G-X1 重名 / 重名 _v2) │
* └────────────────────────────────────────────────────────────────┘
*
* 调用方: form/dm/menu create, form release, dict typeCreate 等所有 create 命令.
* cleanup: 删除 6 类 form-related guard (webapi 镜像 + buildFormData 自动保证 schema 完整性).
* Why: AI 不需要"记住盲点", dacli 自己在执行时检查.
* 每个 guard 包含 id/trigger/check/fix 字段, 失败时输出 [ERROR]/[WARN] + 修复建议.
* 性能: 单次 runGuards() 跑完全部 guard < 1ms (无 IO, 纯函数)
*
* 查询历史:
* - 守卫触发记录: CommandLog 写 `assertive_fixes` 段 (dacli log last --level=fix)
* - 修复应用记录: CommandLog 写 `silent_fixes` + `suggestions` (同上)
*/
import type { AppContext } from '../core/types.ts'
import { log } from '../core/log.ts'
+47
View File
@@ -19,6 +19,9 @@
* (因为内容 hash 复杂 + 用户难生成, AI 友好性差)
*/
import type { FixEntry } from '../core/logfile.ts'
import { log } from '../core/log.ts'
export interface DirtyCheckOpts {
/** --expected-enCode 传值, undefined 表示不校验 */
expectedEnCode?: string
@@ -130,4 +133,48 @@ export class DirtyCheckError extends Error {
this.entityType = entityType
this.entityId = entityId
}
}
// ============================================================
// L3 归档 helper (三重提醒三重修复 第 2 重, v2.3+ 2026-07-21)
// 取代 9 处 inline `log.info(\`⚠ dirty check 已 --force 跳过\`)` 重复字符串
// 设计: 日志 (L1) + FixEntry (L3) 一并产生, caller 把 FixEntry push 到 ctx.addFix()
// 见 _output_filter.ts:wrapCommand ctx.addFix / ctx.addSuggestion 方法
// ============================================================
/**
* 统一 dirty-check skip 输出 (L1).
*
* 旧实现 9 处 update 命令各自写 log.info(`⚠ dirty check 已 --force 跳过`),
* 消息格式不统一 + 落不到 L3. 现在统一调用, 以后改文案改 1 处.
*/
export function logDirtyCheckSkip(
type: 'form' | 'workflow' | 'dict' | 'role' | 'di' | 'menu' | 'msg' | 'user' | 'schedule' | 'bigscreen',
id: string,
expectedEnCode?: string,
expectedState?: string,
): void {
const parts = [`type=${type}`, `id=${id}`]
if (expectedEnCode) parts.push(`expected enCode=${expectedEnCode}`)
if (expectedState) parts.push(`expected state=${expectedState}`)
log.warn(`⚠ dirty check --force 跳过 (${parts.join(', ')})`)
}
/**
* 统一 dirty-check skip 落 L3 (FixEntry, assertive 级别, 含回滚命令).
*
* 返回值 push 进 wrapCommand.ctx.addFix(...) 让 `dacli log last --level=fix` 可见.
* 三重修复第 2 重 (assertive): 见 README.md:149 「错误修正三重处理」.
*/
export function buildDirtyCheckSkipFix(
type: 'form' | 'workflow' | 'dict' | 'role' | 'di' | 'menu' | 'msg' | 'user' | 'schedule' | 'bigscreen',
id: string,
): FixEntry {
return {
id: 'BS-DC-SKIP',
level: 'assertive',
field: `${type}.id`,
summary: `dirty check --force 跳过 (${type} ${id})`,
rollback: `dacli ${type} update ${id} ... (重新跑, 不带 --force + 传 --expected-enCode/--expected-state 一致)`,
}
}
+19 -1
View File
@@ -161,12 +161,24 @@ export interface WrapCommandContext {
partial(error: string, summary?: Record<string, unknown>): void
/** 失败路径: 落 CommandLog (failure) + 打印 error + process.exit(1) (never) */
fail(error: string, summary?: Record<string, unknown>): never
/**
* v2.3+ (2026-07-21): 迟 push 一条 assertive FixEntry 进 L3 CommandLog
* 用例: handler 里发现 dirty check --force 跳过 / AI Login expired 等
* 迟发生的提示, 让 dacli log last --level=fix 能查询到.
* 见 _dirty_check.ts:buildDirtyCheckSkipFix 配套使用.
*/
addFix(fix: FixEntry): void
/** v2.3+ (2026-07-21): 同上, 但落 suggestions 数组 (而非 assertive_fixes) */
addSuggestion(suggestion: FixEntry): void
}
export async function wrapCommand(
args: WrapCommandArgs,
handler: (ctx: WrapCommandContext) => Promise<void> | void,
): Promise<void> {
// v2.3+: 用局部可变数组收集 fixes (含 handler 迟 push 的)
const allFixes: FixEntry[] = [...(args.fixes || [])]
const buildArgs = (
result: 'success' | 'failure' | 'partial',
summary?: Record<string, unknown>,
@@ -177,7 +189,7 @@ export async function wrapCommand(
result,
summary,
error,
fixes: args.fixes,
fixes: allFixes,
duration_ms: Date.now() - args.startTime,
verbose: args.verbose,
json: args.json,
@@ -194,6 +206,12 @@ export async function wrapCommand(
printCommandEnd(buildArgs('failure', summary, error))
process.exit(1)
},
addFix(fix) {
allFixes.push(fix)
},
addSuggestion(suggestion) {
allFixes.push(suggestion)
},
}
try {
+14 -2
View File
@@ -38,6 +38,8 @@ import { initWebapi, loadVisualData } from '../../webapi/visualdata.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
import { DacliError } from '../../core/types.ts' // P5 (2026-07-21): 提升 L2 catch 分类
import { runCommandAutoFix, fetchExistingLists } from '../_auto_fix.ts' // v2.1+ (2026-07-21): 跨命令 auto-fix pipeline
import type { FixEntry } from '../../core/logfile.ts'
import { remindBigscreenVisualEmpty } from '../_post_reminders.ts' // v2.3+ (2026-07-21): 大屏 visual 空落 L3
import {
getBaseConfig,
listComponentProps,
@@ -138,6 +140,12 @@ export function buildBigscreenConstructCommand(): Command {
}, async (ctx) => {
try {
const summary = await runConstruct(opts)
// v2.3+: runConstruct 收集的运行后提醒 (visual 空 / 字段超长等) 统一 push 到 L3
if (summary?.suggestions) {
for (const s of summary.suggestions) {
ctx.addSuggestion(s)
}
}
ctx.success({
id: summary?.id,
enCode: summary?.enCode || opts.enCode,
@@ -196,7 +204,9 @@ export function buildBigscreenConstructCommand(): Command {
return cmd
}
async function runConstruct(opts: ConstructOpts): Promise<{ id?: string; enCode: string; validateOnly?: boolean } | undefined> {
async function runConstruct(opts: ConstructOpts): Promise<{ id?: string; enCode: string; validateOnly?: boolean; suggestions?: FixEntry[] } | undefined> {
// v2.3+: 收集运行后提醒 (publish 跳过 / visual 空等), 由 wrapCommand 落 L3
const suggestions: FixEntry[] = [];
// === step 1: 构造 baseConfig ===
let baseConfig = getBaseConfig()
if (opts.width) baseConfig.width = opts.width
@@ -340,6 +350,7 @@ async function runConstruct(opts: ConstructOpts): Promise<{ id?: string; enCode:
log.ok(`✓ 大屏已发布 (status=1)`)
} else {
log.warn(`⚠ 发布跳过: getObj 后端未返 visual`)
suggestions.push(remindBigscreenVisualEmpty(id))
}
}
@@ -350,5 +361,6 @@ async function runConstruct(opts: ConstructOpts): Promise<{ id?: string; enCode:
log.info(`✓ 大屏构造完成 id=${id} 名称=${opts.fullName} 编码=${opts.enCode} 组件数=${nav.length}`)
}
// v2.1+ (2026-07-21): 返回成功 summary (供 .action 落 CommandLog)
return { id, enCode: opts.enCode }
// v2.3+: 带 suggestions 让 wrapCommand 收口后落 L3
return { id, enCode: opts.enCode, suggestions: suggestions.length > 0 ? suggestions : undefined }
}
+4 -2
View File
@@ -10,7 +10,7 @@ import { JnpfClient } from '../../core/client.ts'
import { installHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadVisualData } from '../../webapi/visualdata.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
@@ -20,6 +20,7 @@ interface Opts {
enCode?: string
category?: string
expectedEnCode?: string
expectedState?: string
force?: boolean
json?: boolean
/** v2.1+ (2026-07-21): --verbose, addOutputOptions 注入 */
@@ -83,7 +84,8 @@ export function buildBigscreenUpdateCommand(): Command {
throw e
}
} else if (dirtyResult.skipped) {
log.info(`⚠ dirty check 已 --force 跳过`)
logDirtyCheckSkip('bigscreen', opts.id, opts.expectedEnCode, opts.expectedState)
ctx.addFix(buildDirtyCheckSkipFix('bigscreen', opts.id))
}
// === step 2 PUT 后端API (loadVisualData.updateObj) ===
+3 -2
View File
@@ -10,7 +10,7 @@ import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadDataInterface, getDataInterfaceList } from '../../webapi/di.ts' // v0.15+ (P0-8): getDataInterfaceList 替代 c.get
import { validateDiUpdate, type DiOpts } from './_validate.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
interface Opts {
@@ -88,7 +88,8 @@ export function buildDiUpdateCommand(): Command {
throw e
}
} else if (dirtyResult.skipped) {
log.info(`⚠ dirty check 已 --force 跳过`)
logDirtyCheckSkip('di', opts.id, opts.expectedEnCode, opts.expectedState)
ctx.addFix(buildDirtyCheckSkipFix('di', opts.id))
}
// Phase di: step machine 校验 (镜像 web dataInterface/Form.vue + 后端 DataInterfaceController.update)
+4 -2
View File
@@ -9,7 +9,7 @@ import { JnpfClient } from '../../core/client.ts'
import { installHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadDict } from '../../webapi/dict.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
@@ -20,6 +20,7 @@ interface Opts {
sortCode?: string
enabledMark?: string
expectedEnCode?: string
expectedState?: string
force?: boolean
json?: boolean
/** v2.1+ (2026-07-21): --verbose, addOutputOptions 注入 */
@@ -85,7 +86,8 @@ export function buildDictDataUpdateCommand(): Command {
throw e
}
} else if (dirtyResult.skipped) {
log.info(`⚠ dirty check 已 --force 跳过`)
logDirtyCheckSkip('dict', opts.id, opts.expectedEnCode, opts.expectedState)
ctx.addFix(buildDirtyCheckSkipFix('dict', opts.id))
}
// === step 2 (PUT (loadDict.updateDictionaryData, 后端API) ===
const body: Record<string, unknown> = { ...orig, id: opts.id }
+3 -2
View File
@@ -10,7 +10,7 @@ import { installHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadDict } from '../../webapi/dict.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
interface Opts {
@@ -88,7 +88,8 @@ export function buildDictTypeUpdateCommand(): Command {
throw e
}
} else if (dirtyResult.skipped) {
log.info(`⚠ dirty check 已 --force 跳过`)
logDirtyCheckSkip('dict', opts.id, opts.expectedEnCode, opts.expectedState)
ctx.addFix(buildDirtyCheckSkipFix('dict', opts.id))
}
// === step 2 (PUT (loadDict.updateDictionaryType, 后端API) ===
+5
View File
@@ -30,6 +30,7 @@ import { applyNamingConvention, type NamingConvention } from './_naming_conventi
import { autoStripEnCode, autoStripFullName } from '../_encode_validator.ts'
import { runAutoFix, type FixContext } from '../_auto_fix.ts'
import { saveCommandLog, formatOneLineSummary, type CommandLog } from '../../core/logfile.ts'
import { remindAiLoginExpired, remindAiEnCodeDiverge } from '../_post_reminders.ts' // v2.3+ (2026-07-21): 5 高频 inline ⚠ 固化到 L3
import { wrapCommand } from '../_output_filter.ts' // v2.2+ (2026-07-21): wrapCommand 收口 5c (承接 precheck/guard throw + 11 process.exit)
interface CreateOpts {
@@ -351,6 +352,8 @@ export function buildFormCreateCommand(): Command {
if (data._aiChain) {
for (const step of data._aiChain) log.warn(` ${step}`)
}
// v2.3+: 落 L3 (供 dacli log last --level=fix 查询)
ctx.addSuggestion(remindAiLoginExpired(opts.enCode))
// 关键: 把 user 输入注入 data, 后续代码走空 aiModelList 路径
data.enCode = opts.enCode
data.fullName = opts.fullName
@@ -378,6 +381,8 @@ export function buildFormCreateCommand(): Command {
if (!data.loginExpired && originalUserEnCode && data.enCode && originalUserEnCode !== data.enCode) {
log.warn(`⚠ AI 建议 enCode 与用户输入不一致: ${originalUserEnCode} (用户) vs ${data.enCode} (AI)`)
log.warn(` 最终用 opts.enCode=${opts.enCode} (优先用户输入, BS-新56 强化)`)
// v2.3+: 落 L3 (suggest AI 应尊重 user enCode)
ctx.addSuggestion(remindAiEnCodeDiverge(originalUserEnCode, data.enCode))
}
// 删 dead code (aiModelList[0].fields 手动映射 formData.fields)
// 之前会把所有字段强制设 jnpfKey='input', 丢失 datePicker/select/relationForm 等
+5 -2
View File
@@ -10,7 +10,7 @@ import { JnpfClient } from '../../core/client.ts'
import { installHelpHookWithPatterns } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadVisualDev } from '../../webapi/visualDev.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
@@ -123,7 +123,10 @@ export function buildFormUpdateCommand(): Command {
}
throw e
}
if (dirtyResult.skipped) log.warn('⚠️ --force 已跳过 dirty check (强制覆盖)')
if (dirtyResult.skipped) {
logDirtyCheckSkip('form', opts.id, opts.expectedEnCode, opts.expectedState)
ctx.addFix(buildDirtyCheckSkipFix('form', opts.id))
}
// 防御: enCode 冲突检测 (全平台唯一)
if (opts.enCode && opts.enCode !== orig.enCode) {
+45 -2
View File
@@ -5,18 +5,47 @@
* dacli log last # 摘要
* dacli log last --detail # 含回滚命令、原始请求
* dacli log last --level=fix # 只看修正记录
*
* v2.3+ (2026-07-21): 加 --kind 选项让 stdout ⚠ 也能落 L3 后被查到
* dacli log last --kind=skip-force # 三重提醒第 2 重, BS-DC-SKIP 类 (dirty check 跳过)
* dacli log last --kind=warn # 三重修复第 2 重, assertive 全集 (回滚命令)
* dacli log last --kind=ai-login # P1-7 (AI Login expired) 类
* dacli log last --kind=<id-prefix> # 按 FixEntry.id 前缀过滤
*/
import { Command } from 'commander'
import { readLatestLog, formatLogSummary, formatFixForDisplay, type CommandLog } from '../../core/logfile.ts'
import { readLatestLog, formatLogSummary, formatFixForDisplay, type CommandLog, type FixEntry } from '../../core/logfile.ts'
import { log } from '../../core/log.ts'
import { loadToken } from '../../core/config.ts'
/**
* 按 --kind 过滤 fixes. 支持:
* - 'warn' → 全部 assertive (三重修复第 2 重)
* - 'skip-force' → BS-DC-SKIP (三重提醒第 2 重, dirty check 跳过专项)
* - 'ai-login' → P1-7 (AI Login expired 专项)
* - '<prefix>' → id 前缀匹配 (例: BS-DC / P1-7 / BS-AI)
*/
function filterByKind(cmdLog: CommandLog, kind: string): FixEntry[] {
const all = [...cmdLog.silent_fixes, ...cmdLog.assertive_fixes, ...cmdLog.suggestions]
switch (kind) {
case 'warn':
return cmdLog.assertive_fixes
case 'skip-force':
return all.filter(f => f.id === 'BS-DC-SKIP')
case 'ai-login':
return all.filter(f => f.id === 'P1-7' || f.id === 'BS-AI-ENCODE-DIVERGE')
default:
// 通用: id 前缀
return all.filter(f => f.id.startsWith(kind))
}
}
export function buildLogLastCommand(): Command {
const cmd = new Command('last')
.description('查看最近一次 dacli 命令日志 (v2.0+)')
.description('查看最近一次 dacli 命令日志 (v2.0+, v2.3+ 加 --kind)')
.option('--detail', '显示完整详情 (含回滚命令、原始请求/响应)')
.option('--level <l>', '只看特定级别: silent / fix (assertive) / suggest')
.option('--kind <k>', '按 kind 过滤 (v2.3+): warn / skip-force / ai-login / <id 前缀如 BS-DC P1-7>')
.option('--raw', '输出原始 JSON')
.action(async (opts) => {
const token = loadToken()
@@ -36,6 +65,20 @@ export function buildLogLastCommand(): Command {
process.exit(0)
}
// v2.3+: --kind 优先 (新, 跟 --level 平行)
if (opts.kind) {
const fixes = filterByKind(cmdLog, opts.kind)
if (fixes.length === 0) {
log.info(`无 --kind=${opts.kind} 记录`)
} else {
log.info(`━━ --kind=${opts.kind} (${fixes.length} 条):`)
for (const f of fixes) {
log.info(formatFixForDisplay(f))
}
}
process.exit(0)
}
if (opts.level === 'fix') {
const fixes = [...cmdLog.silent_fixes, ...cmdLog.assertive_fixes]
if (fixes.length === 0) {
+5 -2
View File
@@ -9,6 +9,7 @@ import { JnpfClient } from '../../core/client.ts'
import { installHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadMenu } from '../../webapi/menu.ts'
import { remindMenuMissingRequired } from '../_post_reminders.ts' // v2.3+ (2026-07-21): 标准化提醒 (L1 文本, L3 待迁移到 wrapCommand)
interface Opts {
id: string
@@ -54,8 +55,10 @@ export function buildMenuInfoCommand(): Command {
if (m[f] === undefined || m[f] === null) missing.push(f)
}
if (missing.length) {
log.warn(`⚠ 缺必填字段 (会导致菜单不显示): ${missing.join(', ')}`)
log.info('修: 走 dacli menu create 重建 (会带 7 字段兜底), 或 dacli menu update --fixDisplay')
// v2.3+: 用 _post_reminders.ts factory 统一文案 (三重提醒 4-1)
const r = remindMenuMissingRequired(missing, opts.id)
log.warn(`⚠ ${r.summary}`)
log.info(` 修: ${r.fix}`)
} else {
log.ok('7 必填字段完整')
}
+4 -1
View File
@@ -19,6 +19,7 @@ import { installHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadMenu } from '../../webapi/menu.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts' // v2.3+ (2026-07-21): 菜单 dirty check 跳过渡公共化
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
interface Opts {
@@ -106,7 +107,9 @@ export function buildMenuUpdateCommand(): Command {
log.error(`BS-49: --expected-enCode=${opts.expectedEnCode} 但当前 enCode=${orig.enCode}, 用 --force 强制覆盖`)
return ctx.fail(`BS-49: --expected-enCode 不匹配`, { menuId, expected: opts.expectedEnCode, actual: orig.enCode })
}
log.warn(` ⚠ --force 跳过 dirty check (enCode ${opts.expectedEnCode} → 实际 ${orig.enCode})`)
// v2.3+: 用公共 helper (三重提醒三重修复 4-2)
logDirtyCheckSkip('menu', menuId, opts.expectedEnCode)
ctx.addFix(buildDirtyCheckSkipFix('menu', menuId))
}
// 4. 合并更新 (PUT 语义, 未传字段保留)
+4 -2
View File
@@ -11,7 +11,7 @@ import { JnpfClient } from '../../core/client.ts'
import { installHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadNotice } from '../../webapi/message.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
@@ -22,6 +22,7 @@ interface Opts {
body?: string
category?: string
expectedEnCode?: string
expectedState?: string
force?: boolean
json?: boolean
/** v2.1+ (2026-07-21): --verbose, addOutputOptions 注入 */
@@ -84,7 +85,8 @@ export function buildMsgNoticeUpdateCommand(): Command {
throw e
}
} else if (dirtyResult.skipped) {
log.info(`⚠ dirty check 已 --force 跳过`)
logDirtyCheckSkip('msg', opts.id, opts.expectedEnCode, opts.expectedState)
ctx.addFix(buildDirtyCheckSkipFix('msg', opts.id))
}
const body: Record<string, unknown> = { ...orig, id: opts.id }
+3 -2
View File
@@ -10,7 +10,7 @@ import { installHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadRole } from '../../webapi/role.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
import { validateBasicInfo as validateRoleBasicInfo } from './_validate.ts' // v0.15+ (R3.4)
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
@@ -85,7 +85,8 @@ export function buildRoleUpdateCommand(): Command {
throw e
}
} else if (dirtyResult.skipped) {
log.info(`⚠ dirty check 已 --force 跳过`)
logDirtyCheckSkip('role', opts.id, opts.expectedEnCode, opts.expectedState)
ctx.addFix(buildDirtyCheckSkipFix('role', opts.id))
}
// v0.15+ (R3.4): 校验用户传入的字段 (fullName/enCode) 走 _validate.ts 防 BS-56
+5 -1
View File
@@ -21,6 +21,7 @@ import { JnpfClient } from '../../core/client.ts'
import { installHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadSchedule } from '../../webapi/schedule.ts'
import { remindScheduleListBug } from '../_post_reminders.ts' // v2.3+ (2026-07-21): schedule list bug 标准化
interface ListOpts {
json?: boolean
@@ -37,7 +38,10 @@ export function buildScheduleListCommand(): Command {
// JNPF 6.2 端点 bug: GET 返 Content-Length:0, POST 是 create 端点
// 兜底: 提示用户用 info/log/trigger 配合 web 端拿到的 id
const r = (await loadSchedule.getTaskList({ currentPage: 1, pageSize: 50 })) as { list?: unknown[] }
log.warn('⚠ JNPF 6.2 schedule list 端点已知 bug (GET 返空 body, POST 是 create)')
// v2.3+: 用 _post_reminders.ts factory 统一文案
const remindR = remindScheduleListBug()
log.warn(`⚠ ${remindR.summary}`)
log.info(` 兜底: ${remindR.fix}`)
log.info(' 兜底方案:')
log.info(' 1. dacli schedule info --id=<id> 单点查 (从 web 端 任务调度 拿 id)')
log.info(' 2. dacli schedule log --id=<id> 查执行日志')
+4 -2
View File
@@ -11,7 +11,7 @@ import { JnpfClient } from '../../core/client.ts'
import { installHelpHook } from '../../core/help.ts'
import { log, printJson } from '../../core/log.ts'
import { initWebapi, loadSchedule } from '../../webapi/schedule.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
import { validateScheduleUpdate } from './_validate.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
@@ -26,6 +26,7 @@ interface Opts {
executeContent?: string
enabledMark?: string
expectedEnCode?: string
expectedState?: string
force?: boolean
json?: boolean
/** v2.1+ (2026-07-21): --verbose, addOutputOptions 注入 */
@@ -92,7 +93,8 @@ export function buildScheduleUpdateCommand(): Command {
throw e
}
} else if (dirtyResult.skipped) {
log.info(`⚠ dirty check 已 --force 跳过`)
logDirtyCheckSkip('schedule', opts.id, opts.expectedEnCode, opts.expectedState)
ctx.addFix(buildDirtyCheckSkipFix('schedule', opts.id))
}
// v0.11e+ Phase C1: step machine 校验 (cron 格式 + SYS131)
+3 -2
View File
@@ -9,7 +9,7 @@ import { Command } from 'commander'
import { JnpfClient } from '../../core/client.ts'
import { installHelpHook } from '../../core/help.ts'
import { log } from '../../core/log.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
@@ -74,7 +74,8 @@ export function buildUserUpdateCommand(): Command {
throw e
}
} else if (dirtyResult.skipped) {
log.info(`⚠ dirty check 已 --force 跳过`)
logDirtyCheckSkip('user', opts.id, opts.expectedAccount, undefined)
ctx.addFix(buildDirtyCheckSkipFix('user', opts.id))
}
// === step 2 PUT 后端API ===
+5 -2
View File
@@ -11,7 +11,7 @@ import { log, printJson } from '../../core/log.ts'
import { setupOutputFilter, addOutputOptions, wrapCommand } from '../_output_filter.ts' // v2.1+ 输出过滤; v2.2+ wrapCommand 收口 5c
import { initWebapi, loadWorkflow } from '../../webapi/workflow.ts'
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError } from '../_dirty_check.ts'
import { dirtyCheck, dirtyCheckFailAndExit, DirtyCheckError, logDirtyCheckSkip, buildDirtyCheckSkipFix } from '../_dirty_check.ts'
interface Opts {
id: string
@@ -91,7 +91,10 @@ export function buildWorkflowUpdateCommand(): Command {
}
throw e
}
if (dirtyResult.skipped) log.info(`⚠ dirty check 已 --force 跳过`)
if (dirtyResult.skipped) {
logDirtyCheckSkip('workflow', opts.id, opts.expectedEnCode, opts.expectedState)
ctx.addFix(buildDirtyCheckSkipFix('workflow', opts.id))
}
// === step 2 --enabledMark=1 走 saveFlow (type=1) 发布流 ===
if (opts.enabledMark !== undefined && parseInt(opts.enabledMark, 10) === 1) {
+6
View File
@@ -28,6 +28,12 @@ export interface FixEntry {
rollback?: string
candidates?: string[]
confidence?: 'extremely_high' | 'high' | 'medium'
/**
* v2.3+ (2026-07-21): 通用修复说明 (跟 rollback 区别: rollback 是可执行回滚命令,
* fix 是文字描述如何修复). 用例: schedule list bug / bigscreen visual 空 等
* "绕开" 类提示 (无回滚命令, 只是告诉 AI 怎么办). _post_reminders.ts factory 主要用这字段.
*/
fix?: string
}
export interface CommandLog {