cc-dejavu 0.2.0 → 0.3.0

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/README.md +15 -11
  2. package/package.json +14 -19
package/README.md CHANGED
@@ -36,19 +36,19 @@ Every bash command Claude Code runs is logged in session files. `deja` indexes t
36
36
 
37
37
  ## Features
38
38
 
39
- - **Frecency-based sorting** - Commands are ranked by a combination of frequency and recency, so your most useful commands appear first
39
+ - **Smart ranking** - Combines BM25 relevance with frecency (frequency + recency) so the most useful commands appear first
40
+ - **Full-text search** - Uses SQLite FTS5 for fast, typo-tolerant searching
40
41
  - **Match highlighting** - Search patterns are highlighted in yellow in the output
41
42
  - **Automatic sync** - History is automatically synced before each search
42
43
 
43
44
  ## Install
44
45
 
46
+ Requires [Bun](https://bun.sh).
47
+
45
48
  ```bash
46
- # With Bun (recommended)
49
+ # Install globally
47
50
  bun add -g cc-dejavu
48
51
 
49
- # With npm
50
- npm install -g cc-dejavu
51
-
52
52
  # Or build from source
53
53
  git clone https://github.com/Michaelliv/cc-dejavu
54
54
  cd cc-dejavu
@@ -146,16 +146,20 @@ Index new commands from Claude Code sessions.
146
146
  |------|-------------|
147
147
  | `--force`, `-f` | Re-index all sessions from scratch |
148
148
 
149
- ## Frecency Algorithm
149
+ ## Ranking Algorithm
150
+
151
+ Results are ranked by combining **BM25 relevance** with **frecency** (frequency + recency):
150
152
 
151
- Results are sorted by "frecency" - a combination of frequency and recency:
153
+ ```
154
+ score = frecency × (0.5 + normalized_bm25)
155
+ ```
152
156
 
153
- - **Recency weights**: Commands run in the last 4 hours score highest, with decreasing weights for last day, week, month, and older
154
- - **Frequency**: Uses logarithmic scaling to prevent very frequent commands from dominating
157
+ - **BM25**: Search terms that are more prominent in a command score higher. "build" in `bun run build` ranks higher than "build" buried in a long command.
158
+ - **Frecency**: Commands you run often and recently score higher. Uses logarithmic scaling for frequency and time-decay weights for recency.
155
159
 
156
- This means recently-used commands you run often appear at the top, while one-off commands from months ago sink to the bottom.
160
+ This means a command that closely matches your search AND you use frequently will appear at the top.
157
161
 
158
- Use `--sort time` to revert to simple timestamp ordering.
162
+ Use `--sort time` to revert to simple timestamp ordering (ignores BM25 and frecency).
159
163
 
160
164
  ## How It Works
161
165
 
package/package.json CHANGED
@@ -1,13 +1,21 @@
1
1
  {
2
2
  "name": "cc-dejavu",
3
- "version": "0.2.0",
4
- "description": "CLI tool to search and browse Claude Code bash command history",
5
- "license": "MIT",
6
- "type": "module",
3
+ "version": "0.3.0",
4
+ "author": "Michaelliv",
7
5
  "repository": {
8
6
  "type": "git",
9
7
  "url": "git+https://github.com/Michaelliv/cc-dejavu.git"
10
8
  },
9
+ "devDependencies": {
10
+ "@types/bun": "latest"
11
+ },
12
+ "bin": {
13
+ "deja": "./dist/index.js"
14
+ },
15
+ "description": "CLI tool to search and browse Claude Code bash command history",
16
+ "files": [
17
+ "dist"
18
+ ],
11
19
  "keywords": [
12
20
  "claude",
13
21
  "claude-code",
@@ -17,25 +25,12 @@
17
25
  "search",
18
26
  "dejavu"
19
27
  ],
20
- "author": "Michaelliv",
21
- "bin": {
22
- "deja": "./dist/index.js"
23
- },
24
- "files": [
25
- "dist"
26
- ],
28
+ "license": "MIT",
27
29
  "scripts": {
28
30
  "dev": "bun run src/index.ts",
29
31
  "build": "bun build --compile --outfile=deja ./src/index.ts",
30
- "build:npm": "bun build ./src/index.ts --outdir ./dist --target node",
31
32
  "test": "bun test",
32
- "prepublishOnly": "bun run build:npm",
33
33
  "postinstall": "echo '\n Run \"deja onboard\" to add deja to ~/.claude/CLAUDE.md\n'"
34
34
  },
35
- "dependencies": {
36
- "sql.js": "^1.13.0"
37
- },
38
- "devDependencies": {
39
- "@types/bun": "latest"
40
- }
35
+ "type": "module"
41
36
  }