refactor(hooks): rename ultrawork-mode to keyword-detector with multi-keyword support

- Detect ultrawork, search, analyze keywords (EN/KO/JP/CN/VN)
- Add session-based injection tracking (once per session)
- Remove unnecessary state management

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-14 11:38:33 +09:00
parent 609a7b0ea6
commit 690c4ce36e
7 changed files with 151 additions and 179 deletions
+25
View File
@@ -0,0 +1,25 @@
import {
KEYWORD_DETECTORS,
CODE_BLOCK_PATTERN,
INLINE_CODE_PATTERN,
} from "./constants"
export function removeCodeBlocks(text: string): string {
return text.replace(CODE_BLOCK_PATTERN, "").replace(INLINE_CODE_PATTERN, "")
}
export function detectKeywords(text: string): string[] {
const textWithoutCode = removeCodeBlocks(text)
return KEYWORD_DETECTORS.filter(({ pattern }) =>
pattern.test(textWithoutCode)
).map(({ message }) => message)
}
export function extractPromptText(
parts: Array<{ type: string; text?: string }>
): string {
return parts
.filter((p) => p.type === "text")
.map((p) => p.text || "")
.join(" ")
}