diff --git a/CHANGELOG.md b/CHANGELOG.md index 54d912c..26e7e48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- +## [1.7.72] - 2026-03-09 + +### ๐Ÿ”„ ๅ˜ๆ›ด + +- **ๅ…จๅฑ€ๆ็คบ่ฏ่ฟ็งป่‡ณ rules/**๏ผšgrok-search ๆœ็ดขๆ็คบ่ฏไปŽ่ฟฝๅŠ ๅˆฐ `~/.claude/CLAUDE.md` ๆ”นไธบๅ†™ๅ…ฅ `~/.claude/rules/ccg-grok-search.md`๏ผŒ้ฟๅ… CLAUDE.md ่ถ… 200 ่กŒๅฏผ่‡ดๆ‰ง่กŒๅŠ›ไธ‹้™ +- **ๆ—ง็‰ˆ่‡ชๅŠจๆธ…็†**๏ผšๅ‡็บงๆ—ถ่‡ชๅŠจๆธ…้™ค CLAUDE.md ไธญๆฎ‹็•™็š„ `CCG-GROK-SEARCH-PROMPT` ๆณจๅ…ฅๅ†…ๅฎน + +--- + ## [1.7.71] - 2026-03-09 ### โœจ ๆ–ฐๅŠŸ่ƒฝ diff --git a/CLAUDE.md b/CLAUDE.md index 5cd8c01..cff7eda 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,7 +2,7 @@ > [ๆ น็›ฎๅฝ•](../CLAUDE.md) > **skills-v2** -**Last Updated**: 2026-03-09 (v1.7.71) +**Last Updated**: 2026-03-09 (v1.7.72) --- diff --git a/README.md b/README.md index d7d5f99..4a086c9 100644 --- a/README.md +++ b/README.md @@ -288,4 +288,4 @@ MIT --- -v1.7.71 | [Issues](https://github.com/fengshao1227/ccg-workflow/issues) +v1.7.72 | [Issues](https://github.com/fengshao1227/ccg-workflow/issues) diff --git a/README.zh-CN.md b/README.zh-CN.md index 97cb1f5..a770fa9 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -290,4 +290,4 @@ MIT --- -v1.7.71 | [Issues](https://github.com/fengshao1227/ccg-workflow/issues) +v1.7.72 | [Issues](https://github.com/fengshao1227/ccg-workflow/issues) diff --git a/package.json b/package.json index a1b6700..7df1208 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccg-workflow", - "version": "1.7.71", + "version": "1.7.72", "description": "Claude + Codex + Gemini multi-model collaboration system - smart routing development workflow", "type": "module", "packageManager": "pnpm@10.17.1", diff --git a/src/commands/config-mcp.ts b/src/commands/config-mcp.ts index da839ee..67f5f3e 100644 --- a/src/commands/config-mcp.ts +++ b/src/commands/config-mcp.ts @@ -140,10 +140,7 @@ async function handleInstallContextWeaver(): Promise { // Grok Search MCP (web search) // โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• -const GROK_SEARCH_PROMPT = ` - - -## 0. Language and Format Standards +const GROK_SEARCH_PROMPT = `## 0. Language and Format Standards - **Interaction Language**: Tools and models must interact exclusively in **English**; user outputs must be in **Chinese**. - MUST ULRTA Thinking in ENGLISH! @@ -155,11 +152,11 @@ Typically, the results of web searches only constitute third-party suggestions a ### Search Trigger Conditions Strictly distinguish between internal and external knowledge. Avoid speculation based on general internal knowledge. When uncertain, explicitly inform the user. -For example, when using the \`fastapi\` library to encapsulate an API endpoint, despite possessing common-sense knowledge internally, you must still rely on the latest search results or official documentation for reliable implementation. +For example, when using the \\\`fastapi\\\` library to encapsulate an API endpoint, despite possessing common-sense knowledge internally, you must still rely on the latest search results or official documentation for reliable implementation. ### Search Execution Guidelines -- Use the \`mcp__grok-search\` tool for web searches +- Use the \\\`mcp__grok-search\\\` tool for web searches - Execute independent search requests in parallel; sequential execution applies only when dependencies exist - Evaluate search results for quality: analyze relevance, source credibility, cross-source consistency, and completeness. Conduct supplementary searches if gaps exist @@ -177,23 +174,24 @@ For example, when using the \`fastapi\` library to encapsulate an API endpoint, - All conclusions must specify: Applicable conditions, scope boundaries, and known limitations - Avoid greetings, pleasantries, filler adjectives, and emotional expressions - When uncertain: State unknowns and reasons before presenting confirmed facts - ` -async function appendGrokPromptToClaudeMd(): Promise { +async function writeGrokPromptToRules(): Promise { + const rulesDir = join(homedir(), '.claude', 'rules') + const rulePath = join(rulesDir, 'ccg-grok-search.md') + + // Clean up legacy CLAUDE.md injection if present const claudeMdPath = join(homedir(), '.claude', 'CLAUDE.md') - - let content = '' if (await fs.pathExists(claudeMdPath)) { - content = await fs.readFile(claudeMdPath, 'utf-8') + const content = await fs.readFile(claudeMdPath, 'utf-8') + if (content.includes('CCG-GROK-SEARCH-PROMPT')) { + const cleaned = content.replace(/\n*[\s\S]*?\n*/g, '') + await fs.writeFile(claudeMdPath, cleaned, 'utf-8') + } } - if (content.includes('CCG-GROK-SEARCH-PROMPT')) { - return - } - - await fs.ensureDir(join(homedir(), '.claude')) - await fs.appendFile(claudeMdPath, GROK_SEARCH_PROMPT, 'utf-8') + await fs.ensureDir(rulesDir) + await fs.writeFile(rulePath, GROK_SEARCH_PROMPT, 'utf-8') } async function handleGrokSearch(): Promise { @@ -238,9 +236,9 @@ async function handleGrokSearch(): Promise { console.log() if (result.success) { - await appendGrokPromptToClaudeMd() + await writeGrokPromptToRules() console.log(ansis.green('โœ“ grok-search MCP ้…็ฝฎๆˆๅŠŸ๏ผ')) - console.log(ansis.green('โœ“ ๅ…จๅฑ€ๆœ็ดขๆ็คบ่ฏๅทฒ่ฟฝๅŠ ๅˆฐ ~/.claude/CLAUDE.md')) + console.log(ansis.green('โœ“ ๅ…จๅฑ€ๆœ็ดขๆ็คบ่ฏๅทฒๅ†™ๅ…ฅ ~/.claude/rules/ccg-grok-search.md')) console.log(ansis.gray(' ้‡ๅฏ Claude Code CLI ไฝฟ้…็ฝฎ็”Ÿๆ•ˆ')) } else { diff --git a/src/commands/init.ts b/src/commands/init.ts index d2e6eef..ea923de 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -60,25 +60,24 @@ async function installHook(settingsPath: string): Promise { } /** - * Append grok-search global prompt to ~/.claude/CLAUDE.md (never replaces existing content) + * Write grok-search global prompt to ~/.claude/rules/ccg-grok-search.md + * Uses rules/ directory for modularity โ€” avoids bloating CLAUDE.md */ async function appendGrokSearchPrompt(): Promise { + const rulesDir = join(homedir(), '.claude', 'rules') + const rulePath = join(rulesDir, 'ccg-grok-search.md') + + // Also clean up legacy CLAUDE.md injection if present const claudeMdPath = join(homedir(), '.claude', 'CLAUDE.md') - - let content = '' if (await fs.pathExists(claudeMdPath)) { - content = await fs.readFile(claudeMdPath, 'utf-8') + const content = await fs.readFile(claudeMdPath, 'utf-8') + if (content.includes('CCG-GROK-SEARCH-PROMPT')) { + const cleaned = content.replace(/\n*[\s\S]*?\n*/g, '') + await fs.writeFile(claudeMdPath, cleaned, 'utf-8') + } } - // Already appended โ€” skip - if (content.includes('CCG-GROK-SEARCH-PROMPT')) { - return - } - - const prompt = ` - - -## 0. Language and Format Standards + const prompt = `## 0. Language and Format Standards - **Interaction Language**: Tools and models must interact exclusively in **English**; user outputs must be in **Chinese**. - MUST ULRTA Thinking in ENGLISH! @@ -112,11 +111,10 @@ For example, when using the \`fastapi\` library to encapsulate an API endpoint, - All conclusions must specify: Applicable conditions, scope boundaries, and known limitations - Avoid greetings, pleasantries, filler adjectives, and emotional expressions - When uncertain: State unknowns and reasons before presenting confirmed facts - ` - await fs.ensureDir(join(homedir(), '.claude')) - await fs.appendFile(claudeMdPath, prompt, 'utf-8') + await fs.ensureDir(rulesDir) + await fs.writeFile(rulePath, prompt, 'utf-8') } /** @@ -668,11 +666,11 @@ export async function init(options: InitOptions = {}): Promise { }) if (grokResult.success) { - // Append global prompt to ~/.claude/CLAUDE.md + // Write global prompt to ~/.claude/rules/ccg-grok-search.md await appendGrokSearchPrompt() console.log() console.log(` ${ansis.green('โœ“')} grok-search MCP ${ansis.gray('โ†’ ~/.claude.json')}`) - console.log(` ${ansis.green('โœ“')} ${i18n.t('init:grok.promptAppended')} ${ansis.gray('โ†’ ~/.claude/CLAUDE.md')}`) + console.log(` ${ansis.green('โœ“')} ${i18n.t('init:grok.promptAppended')} ${ansis.gray('โ†’ ~/.claude/rules/ccg-grok-search.md')}`) } else { console.log()