@contextmirror/claude-memory 0.4.1 → 0.4.3

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Nathan / Context Mirror
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,48 +1,64 @@
1
1
  # claude-memory
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@contextmirror/claude-memory.svg)](https://www.npmjs.com/package/@contextmirror/claude-memory)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
6
+ [![Discord](https://img.shields.io/discord/1454173469242822669?color=5865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/JBpsSFB7EQ)
7
+
3
8
  Cross-project memory for Claude Code. Give Claude awareness of ALL your projects, not just the one you're in.
4
9
 
5
10
  ## The Problem
6
11
 
7
- Every Claude Code session starts fresh. Switch to a different project folder and Claude has no idea about your other work. You end up re-explaining your codebase, your patterns, your other projects.
12
+ Every Claude Code session starts fresh. Switch to a different project folder and Claude has no idea about your other work. You end up re-explaining your codebase, your patterns, your architecture.
13
+
14
+ **Without claude-memory:**
15
+ - "I have an API server in another folder that uses the same auth pattern..."
16
+ - "My component library has a Button I want to reuse..."
17
+ - "How did I handle this in my other project again?"
18
+
19
+ Claude doesn't know. It can't see outside the current directory.
8
20
 
9
21
  ## The Solution
10
22
 
11
23
  ```bash
12
24
  npm install -g @contextmirror/claude-memory
13
- claude-memory scan ~/Projects
25
+ claude-memory setup
14
26
  ```
15
27
 
16
- Now Claude knows about all your projects. Ask "What other projects do I have?" or "Generate a CLAUDE.md for this project" and Claude just knows.
17
-
18
- ## Features
19
-
20
- - **Cross-project awareness** - Claude knows about all your projects
21
- - **Staleness detection** - Automatically detects when projects need rescanning
22
- - **Quick scans** - Only rescan projects that have changed
23
- - **Update notifications** - Get notified when new versions are available
24
- - **CLAUDE.md generation** - Auto-generate project documentation
25
- - **MCP integration** - Works seamlessly with Claude Code
28
+ Now Claude knows about all your projects. Ask "What other projects do I have?" or "How do I handle auth in my API?" and Claude just knows.
26
29
 
27
30
  ## Quick Start
28
31
 
29
- ### 1. Install
32
+ ### 1. Install globally
30
33
 
31
34
  ```bash
32
35
  npm install -g @contextmirror/claude-memory
33
36
  ```
34
37
 
35
- ### 2. Scan your projects
38
+ ### 2. Run the setup wizard
36
39
 
37
40
  ```bash
38
- claude-memory scan ~/Projects # or wherever your code lives
41
+ claude-memory setup
39
42
  ```
40
43
 
41
- ### 3. Add MCP to Claude Code
44
+ This will:
45
+ - Scan your projects directory
46
+ - Configure MCP for Claude Code
47
+ - Optionally generate CLAUDE.md files
42
48
 
43
- Create `.mcp.json` in your home directory or project:
49
+ ### 3. Restart Claude Code
44
50
 
45
- ```json
51
+ That's it. Claude now has access to your project memory.
52
+
53
+ ---
54
+
55
+ **Alternative: Manual setup**
56
+
57
+ ```bash
58
+ # Scan your projects
59
+ claude-memory scan ~/Projects
60
+
61
+ # Add MCP to Claude Code (create ~/.mcp.json)
46
62
  {
47
63
  "mcpServers": {
48
64
  "claude-memory": {
@@ -53,16 +69,37 @@ Create `.mcp.json` in your home directory or project:
53
69
  }
54
70
  ```
55
71
 
56
- ### 4. Restart Claude Code
72
+ ## What Can You Ask?
57
73
 
58
- Now Claude has access to your project memory!
74
+ Once set up, try asking Claude:
75
+
76
+ | Question | What Claude Does |
77
+ |----------|------------------|
78
+ | "What projects do I have?" | Lists all your projects with tech stacks |
79
+ | "Tell me about my API server" | Shows project details, branch, recent activity |
80
+ | "Which projects use React?" | Searches across all projects |
81
+ | "Generate a CLAUDE.md for this project" | Creates context documentation |
82
+ | "Is my project data up to date?" | Checks for stale data |
83
+ | "How do I handle auth in my other projects?" | Cross-project pattern lookup |
84
+
85
+ ## Features
86
+
87
+ | Feature | Description |
88
+ |---------|-------------|
89
+ | **Cross-project awareness** | Claude knows about all your projects |
90
+ | **Staleness detection** | Automatically detects when projects need rescanning |
91
+ | **Quick scans** | Only rescan projects that have changed |
92
+ | **Update notifications** | Get notified when new versions are available |
93
+ | **CLAUDE.md generation** | Auto-generate project documentation |
94
+ | **MCP integration** | Works seamlessly with Claude Code |
59
95
 
60
96
  ## Commands
61
97
 
62
98
  | Command | Description |
63
99
  |---------|-------------|
100
+ | `claude-memory setup` | Interactive setup wizard (recommended) |
64
101
  | `claude-memory scan [dir]` | Scan directory for projects |
65
- | `claude-memory scan --quick` | Only rescan stale projects (faster) |
102
+ | `claude-memory scan --quick` | Only rescan stale projects |
66
103
  | `claude-memory scan --check` | Check what's stale without scanning |
67
104
  | `claude-memory list` | List known projects |
68
105
  | `claude-memory show <project>` | Show project details |
@@ -71,14 +108,12 @@ Now Claude has access to your project memory!
71
108
  | `claude-memory exclude <project>` | Exclude project from future scans |
72
109
  | `claude-memory include <project>` | Re-include an excluded project |
73
110
  | `claude-memory mcp` | Start MCP server |
74
- | `claude-memory setup` | Interactive setup wizard |
75
111
 
76
112
  ## Staleness Detection
77
113
 
78
- claude-memory automatically detects when your projects need rescanning:
114
+ claude-memory tracks when your projects change:
79
115
 
80
116
  ```bash
81
- # Check what's stale
82
117
  claude-memory scan --check
83
118
 
84
119
  # Output:
@@ -86,7 +121,7 @@ claude-memory scan --check
86
121
  #
87
122
  # ⚠️ 2 project(s) need updating:
88
123
  # 📝 my-project (New commits since last scan)
89
- # 📄 another-project (Key files modified since last scan)
124
+ # 📄 another-project (Key files modified)
90
125
  #
91
126
  # Run `claude-memory scan --quick` to refresh only stale projects.
92
127
  ```
@@ -98,64 +133,139 @@ claude-memory scan --check
98
133
 
99
134
  ## MCP Tools
100
135
 
101
- When connected, Claude Code gets these tools:
136
+ When connected, Claude Code gets access to these tools:
102
137
 
103
138
  | Tool | Purpose |
104
139
  |------|---------|
105
- | `get_global_context` | Overview of all your projects + staleness info |
140
+ | `get_global_context` | Overview of all projects + staleness info |
106
141
  | `get_project_summary` | Details about a specific project |
107
142
  | `get_project_analysis` | Deep analysis for CLAUDE.md generation |
108
143
  | `search_projects` | Search across all projects |
109
144
  | `record_insight` | Save cross-project patterns |
110
145
  | `search_code` | **[Pro]** Search code across all projects |
111
146
 
112
- ## Update Notifications
147
+ ### Example Interactions
113
148
 
114
- claude-memory checks for updates automatically (once per day, cached). When a new version is available, Claude will see:
149
+ **Ask about all projects:**
150
+ > "What projects do I have?"
115
151
 
116
- ```
117
- ⬆️ Update available: v0.3.0 v0.4.0
152
+ Claude uses `get_global_context` and responds:
153
+ > "You have 5 projects: dashboard-app (React/Next.js), api-server (Node/Express), component-library (React/Storybook), cli-tool (TypeScript), and landing-site (Vite)."
118
154
 
119
- Run to update:
120
- npm update -g @contextmirror/claude-memory
155
+ **Get details about a specific project:**
156
+ > "Tell me about the api-server"
121
157
 
122
- After updating, restart Claude Code to use the new version.
123
- ```
158
+ Claude uses `get_project_summary` and responds:
159
+ > "api-server is a Node.js/Express API with JWT authentication. It's on the `feature/auth` branch with uncommitted changes. Last activity was 2 days ago."
160
+
161
+ **Search across projects:**
162
+ > "Which of my projects use Tailwind?"
163
+
164
+ Claude uses `search_projects` and responds:
165
+ > "2 projects use Tailwind CSS: dashboard-app and landing-site."
166
+
167
+ **Generate documentation:**
168
+ > "Create a CLAUDE.md for this project"
169
+
170
+ Claude uses `get_project_analysis` to gather deep context, then writes a comprehensive CLAUDE.md file.
124
171
 
125
172
  ## How It Works
126
173
 
127
- 1. **Scan** - Finds projects by looking for package.json, Cargo.toml, pyproject.toml, .git
174
+ ```
175
+ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
176
+ │ Project A │ │ Claude Memory │ │ Claude Code │
177
+ │ (React App) │────>│ MCP Server │<────│ │
178
+ ├─────────────────┤ │ │ │ "What projects │
179
+ │ Project B │────>│ ~/.claude- │ │ use React?" │
180
+ │ (API Server) │ │ memory/ │ │ │
181
+ ├─────────────────┤ │ context.json │ └─────────────────┘
182
+ │ Project C │────>│ │
183
+ │ (CLI Tool) │ └─────────────────┘
184
+ └─────────────────┘
185
+ ```
186
+
187
+ 1. **Scan** - Finds projects by looking for package.json, Cargo.toml, pyproject.toml, go.mod, .git
128
188
  2. **Extract** - Pulls name, description, tech stack, git info, CLAUDE.md content
129
189
  3. **Store** - Saves to `~/.claude-memory/context.json`
130
190
  4. **Serve** - MCP server exposes context to Claude Code
131
191
  5. **Detect** - Monitors for staleness on each session start
132
192
 
133
- ## Example Usage
134
-
135
- Once set up, you can ask Claude:
136
-
137
- - "What other projects do I have?"
138
- - "Tell me about my project X"
139
- - "Generate a CLAUDE.md for this project"
140
- - "Which of my projects use React?"
141
- - "Is my project data up to date?"
142
-
143
- Claude will query your project memory and respond with real context.
144
-
145
193
  ## Data Storage
146
194
 
147
- All data stays local:
195
+ All data stays local on your machine:
148
196
 
149
197
  ```
150
198
  ~/.claude-memory/
151
- ├── context.json # Project metadata
152
- ├── context.json.bak # Backup
199
+ ├── context.json # Project metadata (machine-readable)
200
+ ├── context.json.bak # Automatic backup
153
201
  ├── global-context.md # Human-readable overview
154
202
  ├── config.json # User configuration
155
- ├── update-check.json # Update check cache
203
+ ├── update-check.json # Update check cache (1/day)
156
204
  └── license.json # Pro license (if activated)
157
205
  ```
158
206
 
207
+ ## Troubleshooting
208
+
209
+ ### "No projects found"
210
+
211
+ Make sure you're pointing to the right directory:
212
+ ```bash
213
+ # Check what directory you're scanning
214
+ claude-memory scan ~/Projects --check
215
+
216
+ # Common locations to try:
217
+ claude-memory scan ~/Code
218
+ claude-memory scan ~/dev
219
+ claude-memory scan ~/projects
220
+ ```
221
+
222
+ Projects are detected by these files: `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, or `.git`
223
+
224
+ ### "MCP tools not showing up in Claude Code"
225
+
226
+ 1. Make sure `.mcp.json` exists in your home directory or project
227
+ 2. Restart Claude Code completely (not just the conversation)
228
+ 3. Check the MCP config is valid JSON:
229
+ ```json
230
+ {
231
+ "mcpServers": {
232
+ "claude-memory": {
233
+ "command": "claude-memory",
234
+ "args": ["mcp"]
235
+ }
236
+ }
237
+ }
238
+ ```
239
+
240
+ ### "Data seems outdated"
241
+
242
+ Run a quick scan to refresh stale projects:
243
+ ```bash
244
+ claude-memory scan --quick
245
+ ```
246
+
247
+ Or do a full rescan:
248
+ ```bash
249
+ claude-memory scan ~/Projects
250
+ ```
251
+
252
+ ### "Git operations are slow"
253
+
254
+ If you have large repos, git operations may timeout (10s limit). This is normal - the project will still be scanned, just without git info.
255
+
256
+ ### "Want to exclude a project"
257
+
258
+ ```bash
259
+ # Exclude a project from future scans
260
+ claude-memory exclude my-secret-project
261
+
262
+ # See what's excluded
263
+ claude-memory excluded
264
+
265
+ # Re-include it later
266
+ claude-memory include my-secret-project
267
+ ```
268
+
159
269
  ## Pro Features
160
270
 
161
271
  Activate with `claude-memory activate <key>`. Get a license at https://claude-memory.dev
@@ -165,6 +275,40 @@ Activate with `claude-memory activate <key>`. Get a license at https://claude-me
165
275
  | Cross-project code search | Search code patterns across all your projects |
166
276
  | Semantic search | Search by meaning, not just keywords (coming soon) |
167
277
 
278
+ ## Update Notifications
279
+
280
+ claude-memory checks for updates automatically (once per day). When a new version is available:
281
+
282
+ ```
283
+ ⬆️ Update available: v0.4.0 → v0.5.0
284
+
285
+ Run to update:
286
+ npm update -g @contextmirror/claude-memory
287
+ ```
288
+
289
+ ## FAQ
290
+
291
+ **Does this use Claude API tokens?**
292
+ No. claude-memory only stores metadata locally. It uses MCP to expose that data to Claude Code - no additional API calls.
293
+
294
+ **Does it work with Claude Pro/Team?**
295
+ Yes. It works with any Claude Code subscription.
296
+
297
+ **What languages are supported?**
298
+ Any language. Tech stack detection works best for: JavaScript/TypeScript, Python, Rust, Go. Others show as "other" but still work.
299
+
300
+ **How often should I rescan?**
301
+ Run `claude-memory scan --quick` when you've made changes to multiple projects. The `--quick` flag only rescans stale projects.
302
+
303
+ **Is my code uploaded anywhere?**
304
+ No. All data stays in `~/.claude-memory/` on your machine. Nothing is sent to any server.
305
+
306
+ ## Community
307
+
308
+ Join our Discord for feedback, feature requests, and support:
309
+
310
+ [![Discord](https://img.shields.io/discord/1454173469242822669?color=5865F2&label=Discord&logo=discord&logoColor=white)](https://discord.gg/JBpsSFB7EQ)
311
+
168
312
  ## License
169
313
 
170
314
  MIT
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,65 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { formatSearchResults } from '../utils/codeSearch.js';
3
+ describe('Code Search', () => {
4
+ describe('formatSearchResults', () => {
5
+ it('should format empty results correctly', () => {
6
+ const result = formatSearchResults([], 'test');
7
+ expect(result).toBe('No results found for "test".');
8
+ });
9
+ it('should format single result correctly', () => {
10
+ const results = [{
11
+ project: 'my-project',
12
+ projectPath: '/home/user/my-project',
13
+ file: '/home/user/my-project/src/index.ts',
14
+ relativePath: 'src/index.ts',
15
+ line: 10,
16
+ content: 'const test = "hello";',
17
+ context: {
18
+ before: 'import { something } from "./lib";',
19
+ after: 'export default test;',
20
+ },
21
+ }];
22
+ const result = formatSearchResults(results, 'test');
23
+ expect(result).toContain('# Code Search Results for "test"');
24
+ expect(result).toContain('Found 1 result');
25
+ expect(result).toContain('## my-project');
26
+ expect(result).toContain('src/index.ts:10');
27
+ expect(result).toContain('const test = "hello";');
28
+ });
29
+ it('should group results by project', () => {
30
+ const results = [
31
+ {
32
+ project: 'project-a',
33
+ projectPath: '/path/a',
34
+ file: '/path/a/file1.ts',
35
+ relativePath: 'file1.ts',
36
+ line: 1,
37
+ content: 'line 1',
38
+ context: { before: '', after: '' },
39
+ },
40
+ {
41
+ project: 'project-b',
42
+ projectPath: '/path/b',
43
+ file: '/path/b/file2.ts',
44
+ relativePath: 'file2.ts',
45
+ line: 2,
46
+ content: 'line 2',
47
+ context: { before: '', after: '' },
48
+ },
49
+ {
50
+ project: 'project-a',
51
+ projectPath: '/path/a',
52
+ file: '/path/a/file3.ts',
53
+ relativePath: 'file3.ts',
54
+ line: 3,
55
+ content: 'line 3',
56
+ context: { before: '', after: '' },
57
+ },
58
+ ];
59
+ const result = formatSearchResults(results, 'query');
60
+ expect(result).toContain('Found 3 results');
61
+ expect(result).toContain('## project-a');
62
+ expect(result).toContain('## project-b');
63
+ });
64
+ });
65
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { validateKeyFormat, isLemonSqueezyKey } from '../license/index.js';
3
+ describe('License Key Validation', () => {
4
+ describe('validateKeyFormat', () => {
5
+ it('should accept valid LemonSqueezy UUID keys', () => {
6
+ expect(validateKeyFormat('A1B2C3D4-E5F6-7890-ABCD-EF1234567890')).toBe(true);
7
+ expect(validateKeyFormat('a1b2c3d4-e5f6-7890-abcd-ef1234567890')).toBe(true);
8
+ });
9
+ it('should accept valid legacy CM- keys', () => {
10
+ expect(validateKeyFormat('CM-ABCD-1234-WXYZ')).toBe(true);
11
+ expect(validateKeyFormat('cm-abcd-1234-wxyz')).toBe(true);
12
+ });
13
+ it('should reject invalid key formats', () => {
14
+ expect(validateKeyFormat('')).toBe(false);
15
+ expect(validateKeyFormat('invalid-key')).toBe(false);
16
+ expect(validateKeyFormat('CM-ABC-1234-WXYZ')).toBe(false); // Wrong segment length
17
+ expect(validateKeyFormat('12345678-1234-1234-1234-123456789')).toBe(false); // Too short
18
+ });
19
+ });
20
+ describe('isLemonSqueezyKey', () => {
21
+ it('should identify LemonSqueezy UUID keys', () => {
22
+ expect(isLemonSqueezyKey('A1B2C3D4-E5F6-7890-ABCD-EF1234567890')).toBe(true);
23
+ });
24
+ it('should not identify legacy keys as LemonSqueezy', () => {
25
+ expect(isLemonSqueezyKey('CM-ABCD-1234-WXYZ')).toBe(false);
26
+ });
27
+ });
28
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,60 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { detectStaleProjects } from '../scanner/stalenessDetector.js';
3
+ function createMockProject(overrides = {}) {
4
+ return {
5
+ name: 'test-project',
6
+ path: '/home/user/projects/test-project',
7
+ description: 'A test project',
8
+ language: 'typescript',
9
+ techStack: ['Node.js', 'TypeScript'],
10
+ currentBranch: 'main',
11
+ isDirty: false,
12
+ lastActivity: new Date().toISOString(),
13
+ hasFiles: {
14
+ readme: true,
15
+ claudeMd: false,
16
+ packageJson: true,
17
+ gitignore: true,
18
+ },
19
+ insights: [],
20
+ lastScanned: new Date().toISOString(),
21
+ ...overrides,
22
+ };
23
+ }
24
+ function createMockContext(projects = [], hoursAgo = 0) {
25
+ const lastUpdated = new Date(Date.now() - hoursAgo * 60 * 60 * 1000).toISOString();
26
+ return {
27
+ schemaVersion: 1,
28
+ lastUpdated,
29
+ projects,
30
+ insights: [],
31
+ userPatterns: [],
32
+ };
33
+ }
34
+ describe('Staleness Detection', () => {
35
+ describe('detectStaleProjects', () => {
36
+ it('should return no stale projects for fresh data', () => {
37
+ const context = createMockContext([createMockProject()], 0);
38
+ const report = detectStaleProjects(context);
39
+ expect(report.staleProjects).toHaveLength(0);
40
+ expect(report.dataAgeHours).toBeLessThan(1);
41
+ });
42
+ it('should mark data as stale after 24 hours', () => {
43
+ const context = createMockContext([createMockProject()], 25);
44
+ const report = detectStaleProjects(context);
45
+ expect(report.dataAgeHours).toBeGreaterThan(24);
46
+ });
47
+ it('should detect projects scanned more than 7 days ago', () => {
48
+ const oldScanDate = new Date(Date.now() - 8 * 24 * 60 * 60 * 1000).toISOString();
49
+ const project = createMockProject({ lastScanned: oldScanDate });
50
+ const context = createMockContext([project], 0);
51
+ const report = detectStaleProjects(context);
52
+ expect(report.staleProjects.length).toBeGreaterThanOrEqual(0);
53
+ });
54
+ it('should handle empty projects list', () => {
55
+ const context = createMockContext([], 0);
56
+ const report = detectStaleProjects(context);
57
+ expect(report.staleProjects).toHaveLength(0);
58
+ });
59
+ });
60
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ // Test version comparison logic
3
+ function isNewerVersion(current, latest) {
4
+ const currentParts = current.split('.').map(Number);
5
+ const latestParts = latest.split('.').map(Number);
6
+ for (let i = 0; i < 3; i++) {
7
+ const curr = currentParts[i] || 0;
8
+ const lat = latestParts[i] || 0;
9
+ if (lat > curr)
10
+ return true;
11
+ if (lat < curr)
12
+ return false;
13
+ }
14
+ return false;
15
+ }
16
+ describe('Update Checker', () => {
17
+ describe('version comparison', () => {
18
+ it('should detect newer major versions', () => {
19
+ expect(isNewerVersion('0.4.2', '1.0.0')).toBe(true);
20
+ expect(isNewerVersion('1.0.0', '2.0.0')).toBe(true);
21
+ });
22
+ it('should detect newer minor versions', () => {
23
+ expect(isNewerVersion('0.4.2', '0.5.0')).toBe(true);
24
+ expect(isNewerVersion('0.4.2', '0.5.1')).toBe(true);
25
+ });
26
+ it('should detect newer patch versions', () => {
27
+ expect(isNewerVersion('0.4.2', '0.4.3')).toBe(true);
28
+ expect(isNewerVersion('0.4.2', '0.4.10')).toBe(true);
29
+ });
30
+ it('should return false for same version', () => {
31
+ expect(isNewerVersion('0.4.2', '0.4.2')).toBe(false);
32
+ });
33
+ it('should return false for older versions', () => {
34
+ expect(isNewerVersion('0.4.2', '0.4.1')).toBe(false);
35
+ expect(isNewerVersion('0.4.2', '0.3.9')).toBe(false);
36
+ expect(isNewerVersion('1.0.0', '0.9.9')).toBe(false);
37
+ });
38
+ it('should handle missing patch version', () => {
39
+ expect(isNewerVersion('0.4', '0.4.1')).toBe(true);
40
+ expect(isNewerVersion('0.4.1', '0.5')).toBe(true);
41
+ });
42
+ });
43
+ });