UNPKG

@stackmemoryai/stackmemory

Version:

Lossless, project-scoped memory for AI coding tools. Durable context across sessions with 56 MCP tools, FTS5 search, conductor orchestrator, loop/watch monitoring, snapshot capture, pre-flight overlap checks, Claude/Codex/OpenCode wrappers, Linear sync, a

64 lines (63 loc) 1.07 kB
import { fileURLToPath as __fileURLToPath } from 'url'; import { dirname as __pathDirname } from 'path'; const __filename = __fileURLToPath(import.meta.url); const __dirname = __pathDirname(__filename); const DEFAULT_STOP_WORDS = /* @__PURE__ */ new Set([ "the", "a", "an", "is", "are", "was", "were", "be", "been", "to", "of", "in", "for", "on", "with", "at", "by", "from", "and", "or", "but", "not", "this", "that", "it", "its", "all", "any", "add", "update", "fix", "change", "make", "create", "new", "use", "get", "set", "has", "have", "had", "will", "would", "should", "could", "can", "may", "might" ]); function extractKeywords(text, opts) { const minLength = opts?.minLength ?? 3; const maxCount = opts?.maxCount ?? 5; const stopWords = opts?.stopWords ?? DEFAULT_STOP_WORDS; return text.toLowerCase().replace(/[^a-z0-9\s\-_]/g, " ").split(/\s+/).filter((w) => w.length >= minLength && !stopWords.has(w)).slice(0, maxCount); } export { extractKeywords };