feat: 添加钩子命令,简化 Claude Code 钩子操作接口,支持会话上下文加载和通知功能

This commit is contained in:
catlog22
2025-12-21 23:28:19 +08:00
parent 6d3f10d1d7
commit 210f0f1012
7 changed files with 432 additions and 11 deletions

View File

@@ -165,14 +165,23 @@ export class SessionClusteringService {
keywords.add(match[1]);
}
// 3. Technical terms (common frameworks/libraries)
// 3. Technical terms (common frameworks/libraries/concepts)
const techTerms = [
// Frameworks
'react', 'vue', 'angular', 'typescript', 'javascript', 'node', 'express',
// Auth
'auth', 'authentication', 'jwt', 'oauth', 'session', 'token',
// Data
'api', 'rest', 'graphql', 'database', 'sql', 'mongodb', 'redis',
// Testing
'test', 'testing', 'jest', 'mocha', 'vitest',
// Development
'refactor', 'refactoring', 'optimization', 'performance',
'bug', 'fix', 'error', 'issue', 'debug'
'bug', 'fix', 'error', 'issue', 'debug',
// CCW-specific terms
'cluster', 'clustering', 'memory', 'hook', 'service', 'context',
'workflow', 'skill', 'prompt', 'embedding', 'vector', 'semantic',
'dashboard', 'view', 'route', 'command', 'cli', 'mcp'
];
const lowerContent = content.toLowerCase();
@@ -182,6 +191,23 @@ export class SessionClusteringService {
}
}
// 4. Generic word extraction (words >= 4 chars, not stopwords)
const stopwords = new Set([
'the', 'and', 'for', 'that', 'this', 'with', 'from', 'have', 'will',
'are', 'was', 'were', 'been', 'being', 'what', 'when', 'where', 'which',
'there', 'their', 'they', 'them', 'then', 'than', 'into', 'some', 'such',
'only', 'also', 'just', 'more', 'most', 'other', 'after', 'before'
]);
const wordRegex = /\b([a-z]{4,})\b/g;
let wordMatch;
while ((wordMatch = wordRegex.exec(lowerContent)) !== null) {
const word = wordMatch[1];
if (!stopwords.has(word)) {
keywords.add(word);
}
}
// Return top 20 keywords
return Array.from(keywords).slice(0, 20);
}