@crewx/search 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/SKILL.md +131 -0
  2. package/package.json +4 -3
package/SKILL.md ADDED
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: search-bm25
3
+ description: BM25 기반 문서/코드 검색 스킬. grep보다 똑똑한 검색 - 복합 키워드, 점수 정렬, 의미 기반 매칭.
4
+ version: 0.1.0
5
+ ---
6
+
7
+ # Search BM25 Skill
8
+
9
+ grep보다 똑똑한 BM25 기반 검색. 복합 키워드를 이해하고 관련성 점수로 정렬.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - 문서에서 특정 주제 찾을 때
14
+ - 코드베이스에서 관련 파일 찾을 때
15
+ - grep으로 정확히 못 찾을 때
16
+ - 여러 키워드 조합 검색할 때
17
+
18
+ ## Setup
19
+
20
+ ```bash
21
+ cd skills/search-bm25
22
+ npm install
23
+ ```
24
+
25
+ **Dependencies:**
26
+ - wink-bm25-text-search (BM25 검색 엔진)
27
+ - wink-nlp-utils (토크나이저, 스테밍)
28
+ - gray-matter (마크다운 frontmatter 파싱)
29
+ - glob (파일 패턴 매칭)
30
+
31
+ ## Quick Start
32
+
33
+ ```bash
34
+ # 마크다운 검색 (기본)
35
+ npx search "런처 아키텍처" .
36
+
37
+ # 특정 디렉토리
38
+ npx search "API endpoint" ./docs
39
+
40
+ # JS/TS 파일 검색
41
+ npx search "authentication" ./src --glob="**/*.{js,ts}"
42
+
43
+ # 결과 개수 제한
44
+ npx search "error handling" . --limit=10
45
+
46
+ # JSON 출력
47
+ npx search "database" . --json
48
+ ```
49
+
50
+ ## Options
51
+
52
+ | 옵션 | 설명 | 기본값 |
53
+ |------|------|--------|
54
+ | `--glob=<pattern>` | 파일 패턴 | `**/*.md` |
55
+ | `--limit=<n>` | 결과 개수 제한 | 20 |
56
+ | `--json` | JSON 형식 출력 | false |
57
+
58
+ ## grep vs search
59
+
60
+ | | grep | search |
61
+ |--|------|--------|
62
+ | 정확한 문자열 | ✅ | ✅ |
63
+ | 복합 키워드 | ❌ | ✅ |
64
+ | 점수 정렬 | ❌ | ✅ |
65
+ | 의미 유사 | ❌ | △ (BM25) |
66
+ | 한글 검색 | ✅ | ✅ |
67
+
68
+ ## Examples
69
+
70
+ ### 문서 검색
71
+ ```bash
72
+ # CrewX 런처 관련 문서 찾기
73
+ npx search "CrewX launcher electron architecture" ./docs
74
+
75
+ # 결과:
76
+ # [17.5점] docs/launcher/architecture.md
77
+ # [12.3점] docs/decisions/2025-12-24-launcher.md
78
+ ```
79
+
80
+ ### 코드 검색
81
+ ```bash
82
+ # API 인증 관련 코드 찾기
83
+ npx search "authentication JWT token" ./src --glob="**/*.ts"
84
+
85
+ # 결과:
86
+ # [15.2점] src/auth/jwt.service.ts
87
+ # [10.8점] src/middleware/auth.middleware.ts
88
+ ```
89
+
90
+ ### 한글 검색
91
+ ```bash
92
+ # 에러 처리 관련 찾기
93
+ npx search "에러 처리 예외" . --glob="**/*.md"
94
+
95
+ # 결과:
96
+ # [3점] docs/troubleshooting.md
97
+ # [2점] docs/error-handling.md
98
+ ```
99
+
100
+ ## How It Works
101
+
102
+ 1. **파일 수집**: glob 패턴으로 대상 파일 찾기
103
+ 2. **인덱싱**: 각 파일 내용을 BM25 엔진에 등록
104
+ 3. **검색**: 쿼리를 토큰화하고 점수 계산
105
+ 4. **정렬**: 관련성 점수 높은 순으로 출력
106
+
107
+ ### 점수 계산 (BM25)
108
+ - **TF (Term Frequency)**: 단어 빈도
109
+ - **IDF (Inverse Document Frequency)**: 희귀 단어일수록 높은 점수
110
+ - **문서 길이 보정**: 짧은 문서에서 매칭되면 더 의미있음
111
+
112
+ ## Tips
113
+
114
+ 1. **키워드 많이 넣기**: BM25는 부분 매칭도 점수화
115
+ ```bash
116
+ # 좋음: 관련 키워드 여러 개
117
+ search "API authentication JWT refresh token"
118
+
119
+ # 나쁨: 단어 하나만
120
+ search "API"
121
+ ```
122
+
123
+ 2. **한글+영어 혼합 가능**
124
+ ```bash
125
+ search "런처 Electron Tauri 아키텍처"
126
+ ```
127
+
128
+ 3. **결과 많으면 limit 조절**
129
+ ```bash
130
+ search "config" . --limit=5
131
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/search",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "BM25 full-text search engine for CrewX documents and code",
5
5
  "type": "commonjs",
6
6
  "main": "dist/src/engine.js",
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "bin": { "search": "./dist/cli.js" },
15
- "files": ["dist"],
15
+ "files": ["dist", "SKILL.md"],
16
16
  "scripts": {
17
17
  "build": "tsc",
18
18
  "dev": "ts-node cli.ts",
@@ -21,7 +21,8 @@
21
21
  "keywords": ["crewx", "search", "bm25", "full-text"],
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@crewx/knowledge-core": "^0.1.2",
24
+ "@crewx/shared": "0.0.3",
25
+ "@crewx/knowledge-core": "^0.1.3",
25
26
  "glob": "^10.0.0"
26
27
  },
27
28
  "devDependencies": {