Revert "feat(hooks): disable redundant inject hooks by default in Claude Code compatibility layer"
This reverts commit 8e0a4fedbffebdd67d02a52612b5315fd406b036.
This commit is contained in:
@@ -21,15 +21,6 @@ function getProjectConfigPath(): string {
|
|||||||
return join(process.cwd(), ".opencode", "opencode-cc-plugin.json")
|
return join(process.cwd(), ".opencode", "opencode-cc-plugin.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_DISABLED_HOOKS: DisabledHooksConfig = {
|
|
||||||
PostToolUse: [
|
|
||||||
"inject_rules\\.py$",
|
|
||||||
"inject_readme\\.py$",
|
|
||||||
"inject_knowledge\\.py$",
|
|
||||||
"remind.*rules.*\\.py$",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadConfigFromPath(path: string): Promise<PluginExtendedConfig | null> {
|
async function loadConfigFromPath(path: string): Promise<PluginExtendedConfig | null> {
|
||||||
if (!existsSync(path)) {
|
if (!existsSync(path)) {
|
||||||
return null
|
return null
|
||||||
@@ -52,10 +43,10 @@ function mergeDisabledHooks(
|
|||||||
if (!base) return override
|
if (!base) return override
|
||||||
|
|
||||||
return {
|
return {
|
||||||
Stop: [...(base.Stop ?? []), ...(override.Stop ?? [])],
|
Stop: override.Stop ?? base.Stop,
|
||||||
PreToolUse: [...(base.PreToolUse ?? []), ...(override.PreToolUse ?? [])],
|
PreToolUse: override.PreToolUse ?? base.PreToolUse,
|
||||||
PostToolUse: [...(base.PostToolUse ?? []), ...(override.PostToolUse ?? [])],
|
PostToolUse: override.PostToolUse ?? base.PostToolUse,
|
||||||
UserPromptSubmit: [...(base.UserPromptSubmit ?? []), ...(override.UserPromptSubmit ?? [])],
|
UserPromptSubmit: override.UserPromptSubmit ?? base.UserPromptSubmit,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,11 +56,8 @@ export async function loadPluginExtendedConfig(): Promise<PluginExtendedConfig>
|
|||||||
|
|
||||||
const merged: PluginExtendedConfig = {
|
const merged: PluginExtendedConfig = {
|
||||||
disabledHooks: mergeDisabledHooks(
|
disabledHooks: mergeDisabledHooks(
|
||||||
DEFAULT_DISABLED_HOOKS,
|
|
||||||
mergeDisabledHooks(
|
|
||||||
userConfig?.disabledHooks,
|
userConfig?.disabledHooks,
|
||||||
projectConfig?.disabledHooks
|
projectConfig?.disabledHooks
|
||||||
)
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user