@exaudeus/memory-mcp 0.1.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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +264 -0
  3. package/dist/__tests__/clock-and-validators.test.d.ts +1 -0
  4. package/dist/__tests__/clock-and-validators.test.js +237 -0
  5. package/dist/__tests__/config-manager.test.d.ts +1 -0
  6. package/dist/__tests__/config-manager.test.js +142 -0
  7. package/dist/__tests__/config.test.d.ts +1 -0
  8. package/dist/__tests__/config.test.js +236 -0
  9. package/dist/__tests__/crash-journal.test.d.ts +1 -0
  10. package/dist/__tests__/crash-journal.test.js +203 -0
  11. package/dist/__tests__/e2e.test.d.ts +1 -0
  12. package/dist/__tests__/e2e.test.js +788 -0
  13. package/dist/__tests__/ephemeral-benchmark.test.d.ts +1 -0
  14. package/dist/__tests__/ephemeral-benchmark.test.js +651 -0
  15. package/dist/__tests__/ephemeral.test.d.ts +1 -0
  16. package/dist/__tests__/ephemeral.test.js +435 -0
  17. package/dist/__tests__/git-service.test.d.ts +1 -0
  18. package/dist/__tests__/git-service.test.js +43 -0
  19. package/dist/__tests__/normalize.test.d.ts +1 -0
  20. package/dist/__tests__/normalize.test.js +161 -0
  21. package/dist/__tests__/store.test.d.ts +1 -0
  22. package/dist/__tests__/store.test.js +1153 -0
  23. package/dist/config-manager.d.ts +49 -0
  24. package/dist/config-manager.js +126 -0
  25. package/dist/config.d.ts +32 -0
  26. package/dist/config.js +162 -0
  27. package/dist/crash-journal.d.ts +38 -0
  28. package/dist/crash-journal.js +198 -0
  29. package/dist/ephemeral-weights.json +1847 -0
  30. package/dist/ephemeral.d.ts +20 -0
  31. package/dist/ephemeral.js +516 -0
  32. package/dist/formatters.d.ts +10 -0
  33. package/dist/formatters.js +92 -0
  34. package/dist/git-service.d.ts +5 -0
  35. package/dist/git-service.js +39 -0
  36. package/dist/index.d.ts +2 -0
  37. package/dist/index.js +1197 -0
  38. package/dist/normalize.d.ts +2 -0
  39. package/dist/normalize.js +69 -0
  40. package/dist/store.d.ts +84 -0
  41. package/dist/store.js +813 -0
  42. package/dist/text-analyzer.d.ts +32 -0
  43. package/dist/text-analyzer.js +190 -0
  44. package/dist/thresholds.d.ts +39 -0
  45. package/dist/thresholds.js +75 -0
  46. package/dist/types.d.ts +186 -0
  47. package/dist/types.js +33 -0
  48. package/package.json +57 -0
@@ -0,0 +1,161 @@
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert';
3
+ import { normalizeArgs } from '../normalize.js';
4
+ describe('normalizeArgs', () => {
5
+ const singleLobe = ['my-repo'];
6
+ const multiLobe = ['repo-a', 'repo-b'];
7
+ describe('param alias resolution', () => {
8
+ it('resolves "key" to "title"', () => {
9
+ const result = normalizeArgs('memory_store', { key: 'Test' }, singleLobe);
10
+ assert.strictEqual(result['title'], 'Test');
11
+ assert.strictEqual(result['key'], undefined);
12
+ });
13
+ it('resolves "name" to "title"', () => {
14
+ const result = normalizeArgs('memory_store', { name: 'Test' }, singleLobe);
15
+ assert.strictEqual(result['title'], 'Test');
16
+ });
17
+ it('resolves "value" to "content"', () => {
18
+ const result = normalizeArgs('memory_store', { value: 'some text' }, singleLobe);
19
+ assert.strictEqual(result['content'], 'some text');
20
+ });
21
+ it('resolves "body" to "content"', () => {
22
+ const result = normalizeArgs('memory_store', { body: 'data' }, singleLobe);
23
+ assert.strictEqual(result['content'], 'data');
24
+ });
25
+ it('resolves "text" to "content"', () => {
26
+ const result = normalizeArgs('memory_store', { text: 'hello' }, singleLobe);
27
+ assert.strictEqual(result['content'], 'hello');
28
+ });
29
+ it('resolves "query" to "filter"', () => {
30
+ const result = normalizeArgs('memory_query', { query: 'MVI' }, singleLobe);
31
+ assert.strictEqual(result['filter'], 'MVI');
32
+ });
33
+ it('resolves "search" to "filter"', () => {
34
+ const result = normalizeArgs('memory_query', { search: 'reducer' }, singleLobe);
35
+ assert.strictEqual(result['filter'], 'reducer');
36
+ });
37
+ it('resolves "workspace" to "lobe"', () => {
38
+ const result = normalizeArgs('memory_store', { workspace: 'my-repo' }, singleLobe);
39
+ assert.strictEqual(result['lobe'], 'my-repo');
40
+ });
41
+ it('resolves "repo" to "lobe"', () => {
42
+ const result = normalizeArgs('memory_store', { repo: 'my-repo' }, singleLobe);
43
+ assert.strictEqual(result['lobe'], 'my-repo');
44
+ });
45
+ it('resolves "description" to "context"', () => {
46
+ const result = normalizeArgs('memory_context', { description: 'writing code' }, singleLobe);
47
+ assert.strictEqual(result['context'], 'writing code');
48
+ });
49
+ it('resolves "task" to "context"', () => {
50
+ const result = normalizeArgs('memory_context', { task: 'refactoring' }, singleLobe);
51
+ assert.strictEqual(result['context'], 'refactoring');
52
+ });
53
+ it('does not overwrite existing canonical param', () => {
54
+ const result = normalizeArgs('memory_store', { key: 'aliased', title: 'canonical' }, singleLobe);
55
+ assert.strictEqual(result['title'], 'canonical');
56
+ });
57
+ });
58
+ describe('scope alias for memory_store', () => {
59
+ it('resolves "scope" to "topic" for memory_store', () => {
60
+ const result = normalizeArgs('memory_store', { scope: 'architecture' }, singleLobe);
61
+ assert.strictEqual(result['topic'], 'architecture');
62
+ assert.strictEqual(result['scope'], undefined);
63
+ });
64
+ it('does not resolve "scope" to "topic" for other tools', () => {
65
+ const result = normalizeArgs('memory_query', { scope: 'architecture' }, singleLobe);
66
+ assert.strictEqual(result['scope'], 'architecture');
67
+ assert.strictEqual(result['topic'], undefined);
68
+ });
69
+ it('does not overwrite existing "topic"', () => {
70
+ const result = normalizeArgs('memory_store', { scope: 'gotchas', topic: 'architecture' }, singleLobe);
71
+ assert.strictEqual(result['topic'], 'architecture');
72
+ });
73
+ });
74
+ describe('lobe defaulting', () => {
75
+ it('defaults lobe to single available lobe when omitted', () => {
76
+ const result = normalizeArgs('memory_store', { topic: 'architecture' }, singleLobe);
77
+ assert.strictEqual(result['lobe'], 'my-repo');
78
+ });
79
+ it('defaults lobe when empty string', () => {
80
+ const result = normalizeArgs('memory_store', { lobe: '' }, singleLobe);
81
+ assert.strictEqual(result['lobe'], 'my-repo');
82
+ });
83
+ it('defaults lobe when undefined', () => {
84
+ const result = normalizeArgs('memory_store', { lobe: undefined }, singleLobe);
85
+ assert.strictEqual(result['lobe'], 'my-repo');
86
+ });
87
+ it('does not default lobe when multiple lobes available', () => {
88
+ const result = normalizeArgs('memory_store', {}, multiLobe);
89
+ assert.strictEqual(result['lobe'], undefined);
90
+ });
91
+ it('preserves explicit lobe', () => {
92
+ const result = normalizeArgs('memory_store', { lobe: 'repo-b' }, multiLobe);
93
+ assert.strictEqual(result['lobe'], 'repo-b');
94
+ });
95
+ });
96
+ describe('wildcard scope normalization', () => {
97
+ it('normalizes "all" to "*"', () => {
98
+ const result = normalizeArgs('memory_query', { scope: 'all' }, singleLobe);
99
+ assert.strictEqual(result['scope'], '*');
100
+ });
101
+ it('normalizes "everything" to "*"', () => {
102
+ const result = normalizeArgs('memory_query', { scope: 'everything' }, singleLobe);
103
+ assert.strictEqual(result['scope'], '*');
104
+ });
105
+ it('normalizes "global" to "*"', () => {
106
+ const result = normalizeArgs('memory_query', { scope: 'global' }, singleLobe);
107
+ assert.strictEqual(result['scope'], '*');
108
+ });
109
+ it('normalizes "project" to "*"', () => {
110
+ const result = normalizeArgs('memory_query', { scope: 'project' }, singleLobe);
111
+ assert.strictEqual(result['scope'], '*');
112
+ });
113
+ it('is case-insensitive', () => {
114
+ const result = normalizeArgs('memory_query', { scope: 'ALL' }, singleLobe);
115
+ assert.strictEqual(result['scope'], '*');
116
+ });
117
+ it('does not touch valid scopes', () => {
118
+ const result = normalizeArgs('memory_query', { scope: 'architecture' }, singleLobe);
119
+ assert.strictEqual(result['scope'], 'architecture');
120
+ });
121
+ it('passes through "*" unchanged', () => {
122
+ const result = normalizeArgs('memory_query', { scope: '*' }, singleLobe);
123
+ assert.strictEqual(result['scope'], '*');
124
+ });
125
+ });
126
+ describe('query scope defaulting', () => {
127
+ it('defaults scope to "*" when filter is present but scope is missing', () => {
128
+ const result = normalizeArgs('memory_query', { filter: 'MVI' }, singleLobe);
129
+ assert.strictEqual(result['scope'], '*');
130
+ });
131
+ it('does not default scope when scope is already present', () => {
132
+ const result = normalizeArgs('memory_query', { filter: 'MVI', scope: 'architecture' }, singleLobe);
133
+ assert.strictEqual(result['scope'], 'architecture');
134
+ });
135
+ it('does not default scope for non-query tools', () => {
136
+ const result = normalizeArgs('memory_store', { filter: 'MVI' }, singleLobe);
137
+ assert.strictEqual(result['scope'], undefined);
138
+ });
139
+ });
140
+ describe('branch wildcard normalization', () => {
141
+ it('normalizes "all" branch to "*"', () => {
142
+ const result = normalizeArgs('memory_query', { scope: '*', branch: 'all' }, singleLobe);
143
+ assert.strictEqual(result['branch'], '*');
144
+ });
145
+ it('normalizes "everything" branch to "*"', () => {
146
+ const result = normalizeArgs('memory_query', { scope: '*', branch: 'everything' }, singleLobe);
147
+ assert.strictEqual(result['branch'], '*');
148
+ });
149
+ it('does not touch real branch names', () => {
150
+ const result = normalizeArgs('memory_query', { scope: '*', branch: 'feature/auth' }, singleLobe);
151
+ assert.strictEqual(result['branch'], 'feature/auth');
152
+ });
153
+ });
154
+ describe('handles undefined/null input', () => {
155
+ it('handles undefined raw args', () => {
156
+ const result = normalizeArgs('memory_store', undefined, singleLobe);
157
+ assert.ok(result);
158
+ assert.strictEqual(result['lobe'], 'my-repo');
159
+ });
160
+ });
161
+ });
@@ -0,0 +1 @@
1
+ export {};