fix(help): 补加 installHelpHookWithPatterns export (merge 后 main 跑不起来)
来源: 2026-07-20 合并 p1-8-browser-auto-login 到 main 后, 跑 dacli form info 报
'installHelpHookWithPatterns is not exported'
根因: merge 时 help.ts 没冲突 (main 没有这个 export) 所以保留 main 原状态,
但 create.ts / info.ts 在 p1-8 上改用 installHelpHookWithPatterns (d659fa2 加的)
合并后 import 找不到对应 export
修复: 在 help.ts 加 import { enrichHelp } from '../commands/_anti_patterns'
+ 加 installHelpHookWithPatterns 函数 (单函数, 调用 enrichHelp 增强 help)
验证: dacli form info <formId> --summary 跑通
Co-Authored-By: Claude <[email protected]>
This commit is contained in:
1 parent
ef1bb0a137
commit
4f30cf35ad
1 file changed
+19
@@ -12,6 +12,7 @@
|
||||
* - AI_FLAGS / getMeta / maybeInterceptAiHelp / renderAiHelp 是遗留代码
|
||||
*/
|
||||
import type { Command } from 'commander'
|
||||
import { enrichHelp } from '../commands/_anti_patterns'
|
||||
|
||||
export interface DacliHelp {
|
||||
purpose: string
|
||||
@@ -150,6 +151,24 @@ export function installHelpHook(command: Command, help: DacliHelp): void {
|
||||
/** Backward-compat alias during migration */
|
||||
export const installAiHelpHook = installHelpHook
|
||||
|
||||
/**
|
||||
* 增强版 installHelpHook: 自动从 ANTI_PATTERNS 注入反模式.
|
||||
* 在所有 migrate 完成的命令中使用, 以启用 Pitfalls / Best Practices / Decision Tree / Related Refs.
|
||||
*
|
||||
* v0.22+ (2026-07-20 main merge): 补加 — 原 main help.ts 只有 installHelpHook,
|
||||
* 但 p1-8 上 create.ts/info.ts 用 installHelpHookWithPatterns. merge 时 help.ts
|
||||
* 没冲突所以保留 main 原状态, 但这条函数没引入 → 跑 dacli form info 报
|
||||
* "installHelpHookWithPatterns is not exported". 修复: 在 main help.ts 加它.
|
||||
*/
|
||||
export function installHelpHookWithPatterns(
|
||||
command: Command,
|
||||
fullCmd: string,
|
||||
help: DacliHelp,
|
||||
): void {
|
||||
const enriched = enrichHelp(fullCmd, help)
|
||||
installHelpHook(command, enriched)
|
||||
}
|
||||
|
||||
function getMeta(cmd: Command): DacliHelp | undefined {
|
||||
return (cmd as unknown as { _aiMeta?: DacliHelp })._aiMeta
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user