cc-dejavu 0.2.0 → 0.4.1

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 (3) hide show
  1. package/README.md +30 -13
  2. package/dist/index.js +135 -2445
  3. package/package.json +14 -19
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="assets/hero.gif" alt="deja">
3
+ </p>
4
+
1
5
  # deja
2
6
 
3
7
  [![CI](https://github.com/Michaelliv/cc-dejavu/actions/workflows/ci.yml/badge.svg)](https://github.com/Michaelliv/cc-dejavu/actions/workflows/ci.yml)
@@ -36,25 +40,34 @@ Every bash command Claude Code runs is logged in session files. `deja` indexes t
36
40
 
37
41
  ## Features
38
42
 
39
- - **Frecency-based sorting** - Commands are ranked by a combination of frequency and recency, so your most useful commands appear first
43
+ - **Smart ranking** - Combines BM25 relevance with frecency (frequency + recency) so the most useful commands appear first
44
+ - **Full-text search** - Uses SQLite FTS5 for fast, typo-tolerant searching
40
45
  - **Match highlighting** - Search patterns are highlighted in yellow in the output
41
46
  - **Automatic sync** - History is automatically synced before each search
42
47
 
43
48
  ## Install
44
49
 
45
50
  ```bash
46
- # With Bun (recommended)
51
+ curl -fsSL https://raw.githubusercontent.com/Michaelliv/cc-dejavu/main/install.sh | bash
52
+ ```
53
+
54
+ Or with Bun:
55
+ ```bash
47
56
  bun add -g cc-dejavu
57
+ ```
58
+
59
+ <details>
60
+ <summary>Other options</summary>
48
61
 
49
- # With npm
50
- npm install -g cc-dejavu
62
+ **Manual download**: Get binaries from [releases](https://github.com/Michaelliv/cc-dejavu/releases)
51
63
 
52
- # Or build from source
64
+ **From source**:
65
+ ```bash
53
66
  git clone https://github.com/Michaelliv/cc-dejavu
54
67
  cd cc-dejavu
55
- bun install
56
- bun run build # Creates ./deja binary
68
+ bun install && bun run build
57
69
  ```
70
+ </details>
58
71
 
59
72
  ## Usage
60
73
 
@@ -146,16 +159,20 @@ Index new commands from Claude Code sessions.
146
159
  |------|-------------|
147
160
  | `--force`, `-f` | Re-index all sessions from scratch |
148
161
 
149
- ## Frecency Algorithm
162
+ ## Ranking Algorithm
163
+
164
+ Results are ranked by combining **BM25 relevance** with **frecency** (frequency + recency):
150
165
 
151
- Results are sorted by "frecency" - a combination of frequency and recency:
166
+ ```
167
+ score = frecency × (0.5 + normalized_bm25)
168
+ ```
152
169
 
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
170
+ - **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.
171
+ - **Frecency**: Commands you run often and recently score higher. Uses logarithmic scaling for frequency and time-decay weights for recency.
155
172
 
156
- This means recently-used commands you run often appear at the top, while one-off commands from months ago sink to the bottom.
173
+ This means a command that closely matches your search AND you use frequently will appear at the top.
157
174
 
158
- Use `--sort time` to revert to simple timestamp ordering.
175
+ Use `--sort time` to revert to simple timestamp ordering (ignores BM25 and frecency).
159
176
 
160
177
  ## How It Works
161
178