codebase-context 1.6.2 → 1.7.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 (137) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +358 -282
  3. package/dist/analyzers/angular/index.d.ts.map +1 -1
  4. package/dist/analyzers/angular/index.js +7 -2
  5. package/dist/analyzers/angular/index.js.map +1 -1
  6. package/dist/analyzers/generic/index.d.ts +1 -0
  7. package/dist/analyzers/generic/index.d.ts.map +1 -1
  8. package/dist/analyzers/generic/index.js +89 -10
  9. package/dist/analyzers/generic/index.js.map +1 -1
  10. package/dist/cli.d.ts +2 -0
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +240 -1
  13. package/dist/cli.js.map +1 -1
  14. package/dist/constants/codebase-context.d.ts +13 -0
  15. package/dist/constants/codebase-context.d.ts.map +1 -1
  16. package/dist/constants/codebase-context.js +13 -0
  17. package/dist/constants/codebase-context.js.map +1 -1
  18. package/dist/core/index-meta.d.ts +24 -0
  19. package/dist/core/index-meta.d.ts.map +1 -0
  20. package/dist/core/index-meta.js +204 -0
  21. package/dist/core/index-meta.js.map +1 -0
  22. package/dist/core/indexer.d.ts.map +1 -1
  23. package/dist/core/indexer.js +253 -14
  24. package/dist/core/indexer.js.map +1 -1
  25. package/dist/core/search.d.ts +1 -0
  26. package/dist/core/search.d.ts.map +1 -1
  27. package/dist/core/search.js +60 -5
  28. package/dist/core/search.js.map +1 -1
  29. package/dist/core/symbol-references.d.ts +21 -0
  30. package/dist/core/symbol-references.d.ts.map +1 -0
  31. package/dist/core/symbol-references.js +91 -0
  32. package/dist/core/symbol-references.js.map +1 -0
  33. package/dist/eval/harness.d.ts +5 -0
  34. package/dist/eval/harness.d.ts.map +1 -0
  35. package/dist/eval/harness.js +153 -0
  36. package/dist/eval/harness.js.map +1 -0
  37. package/dist/eval/types.d.ts +59 -0
  38. package/dist/eval/types.d.ts.map +1 -0
  39. package/dist/eval/types.js +2 -0
  40. package/dist/eval/types.js.map +1 -0
  41. package/dist/grammars/manifest.d.ts +26 -0
  42. package/dist/grammars/manifest.d.ts.map +1 -0
  43. package/dist/grammars/manifest.js +63 -0
  44. package/dist/grammars/manifest.js.map +1 -0
  45. package/dist/index.d.ts +12 -2
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +136 -1298
  48. package/dist/index.js.map +1 -1
  49. package/dist/preflight/evidence-lock.d.ts +6 -0
  50. package/dist/preflight/evidence-lock.d.ts.map +1 -1
  51. package/dist/preflight/evidence-lock.js +33 -1
  52. package/dist/preflight/evidence-lock.js.map +1 -1
  53. package/dist/storage/lancedb.d.ts +9 -1
  54. package/dist/storage/lancedb.d.ts.map +1 -1
  55. package/dist/storage/lancedb.js +26 -8
  56. package/dist/storage/lancedb.js.map +1 -1
  57. package/dist/tools/detect-circular-dependencies.d.ts +5 -0
  58. package/dist/tools/detect-circular-dependencies.d.ts.map +1 -0
  59. package/dist/tools/detect-circular-dependencies.js +117 -0
  60. package/dist/tools/detect-circular-dependencies.js.map +1 -0
  61. package/dist/tools/get-codebase-metadata.d.ts +5 -0
  62. package/dist/tools/get-codebase-metadata.d.ts.map +1 -0
  63. package/dist/tools/get-codebase-metadata.js +53 -0
  64. package/dist/tools/get-codebase-metadata.js.map +1 -0
  65. package/dist/tools/get-component-usage.d.ts +5 -0
  66. package/dist/tools/get-component-usage.d.ts.map +1 -0
  67. package/dist/tools/get-component-usage.js +83 -0
  68. package/dist/tools/get-component-usage.js.map +1 -0
  69. package/dist/tools/get-indexing-status.d.ts +5 -0
  70. package/dist/tools/get-indexing-status.d.ts.map +1 -0
  71. package/dist/tools/get-indexing-status.js +44 -0
  72. package/dist/tools/get-indexing-status.js.map +1 -0
  73. package/dist/tools/get-memory.d.ts +5 -0
  74. package/dist/tools/get-memory.d.ts.map +1 -0
  75. package/dist/tools/get-memory.js +89 -0
  76. package/dist/tools/get-memory.js.map +1 -0
  77. package/dist/tools/get-style-guide.d.ts +5 -0
  78. package/dist/tools/get-style-guide.d.ts.map +1 -0
  79. package/dist/tools/get-style-guide.js +151 -0
  80. package/dist/tools/get-style-guide.js.map +1 -0
  81. package/dist/tools/get-symbol-references.d.ts +5 -0
  82. package/dist/tools/get-symbol-references.d.ts.map +1 -0
  83. package/dist/tools/get-symbol-references.js +70 -0
  84. package/dist/tools/get-symbol-references.js.map +1 -0
  85. package/dist/tools/get-team-patterns.d.ts +5 -0
  86. package/dist/tools/get-team-patterns.d.ts.map +1 -0
  87. package/dist/tools/get-team-patterns.js +131 -0
  88. package/dist/tools/get-team-patterns.js.map +1 -0
  89. package/dist/tools/index.d.ts +6 -0
  90. package/dist/tools/index.d.ts.map +1 -0
  91. package/dist/tools/index.js +41 -0
  92. package/dist/tools/index.js.map +1 -0
  93. package/dist/tools/refresh-index.d.ts +5 -0
  94. package/dist/tools/refresh-index.d.ts.map +1 -0
  95. package/dist/tools/refresh-index.js +40 -0
  96. package/dist/tools/refresh-index.js.map +1 -0
  97. package/dist/tools/remember.d.ts +5 -0
  98. package/dist/tools/remember.d.ts.map +1 -0
  99. package/dist/tools/remember.js +101 -0
  100. package/dist/tools/remember.js.map +1 -0
  101. package/dist/tools/search-codebase.d.ts +5 -0
  102. package/dist/tools/search-codebase.d.ts.map +1 -0
  103. package/dist/tools/search-codebase.js +638 -0
  104. package/dist/tools/search-codebase.js.map +1 -0
  105. package/dist/tools/types.d.ts +31 -0
  106. package/dist/tools/types.d.ts.map +1 -0
  107. package/dist/tools/types.js +2 -0
  108. package/dist/tools/types.js.map +1 -0
  109. package/dist/types/index.d.ts +6 -0
  110. package/dist/types/index.d.ts.map +1 -1
  111. package/dist/utils/ast-chunker.d.ts +71 -0
  112. package/dist/utils/ast-chunker.d.ts.map +1 -0
  113. package/dist/utils/ast-chunker.js +453 -0
  114. package/dist/utils/ast-chunker.js.map +1 -0
  115. package/dist/utils/chunking.d.ts.map +1 -1
  116. package/dist/utils/chunking.js +10 -3
  117. package/dist/utils/chunking.js.map +1 -1
  118. package/dist/utils/language-detection.d.ts.map +1 -1
  119. package/dist/utils/language-detection.js +20 -0
  120. package/dist/utils/language-detection.js.map +1 -1
  121. package/dist/utils/tree-sitter.d.ts +17 -0
  122. package/dist/utils/tree-sitter.d.ts.map +1 -0
  123. package/dist/utils/tree-sitter.js +311 -0
  124. package/dist/utils/tree-sitter.js.map +1 -0
  125. package/docs/capabilities.md +169 -92
  126. package/grammars/.gitkeep +0 -0
  127. package/grammars/tree-sitter-c.wasm +0 -0
  128. package/grammars/tree-sitter-c_sharp.wasm +0 -0
  129. package/grammars/tree-sitter-cpp.wasm +0 -0
  130. package/grammars/tree-sitter-go.wasm +0 -0
  131. package/grammars/tree-sitter-java.wasm +0 -0
  132. package/grammars/tree-sitter-javascript.wasm +0 -0
  133. package/grammars/tree-sitter-python.wasm +0 -0
  134. package/grammars/tree-sitter-rust.wasm +0 -0
  135. package/grammars/tree-sitter-tsx.wasm +0 -0
  136. package/grammars/tree-sitter-typescript.wasm +0 -0
  137. package/package.json +151 -157
@@ -0,0 +1,131 @@
1
+ import { promises as fs } from 'fs';
2
+ import { readMemoriesFile } from '../memory/store.js';
3
+ import { isComplementaryPatternConflict, shouldSkipLegacyTestingFrameworkCategory } from '../patterns/semantics.js';
4
+ export const definition = {
5
+ name: 'get_team_patterns',
6
+ description: 'Get actionable team pattern recommendations based on codebase analysis. ' +
7
+ 'Returns consensus patterns for DI, state management, testing, library wrappers, etc.',
8
+ inputSchema: {
9
+ type: 'object',
10
+ properties: {
11
+ category: {
12
+ type: 'string',
13
+ description: 'Pattern category to retrieve',
14
+ enum: ['all', 'di', 'state', 'testing', 'libraries']
15
+ }
16
+ }
17
+ }
18
+ };
19
+ export async function handle(args, ctx) {
20
+ const { category } = args;
21
+ try {
22
+ const intelligencePath = ctx.paths.intelligence;
23
+ const content = await fs.readFile(intelligencePath, 'utf-8');
24
+ const intelligence = JSON.parse(content);
25
+ const result = { status: 'success' };
26
+ if (category === 'all' || !category) {
27
+ result.patterns = intelligence.patterns || {};
28
+ result.goldenFiles = intelligence.goldenFiles || [];
29
+ if (intelligence.tsconfigPaths) {
30
+ result.tsconfigPaths = intelligence.tsconfigPaths;
31
+ }
32
+ }
33
+ else if (category === 'di') {
34
+ result.dependencyInjection = intelligence.patterns?.dependencyInjection;
35
+ }
36
+ else if (category === 'state') {
37
+ result.stateManagement = intelligence.patterns?.stateManagement;
38
+ }
39
+ else if (category === 'testing') {
40
+ result.unitTestFramework = intelligence.patterns?.unitTestFramework;
41
+ result.e2eFramework = intelligence.patterns?.e2eFramework;
42
+ result.testingFramework = intelligence.patterns?.testingFramework;
43
+ result.testMocking = intelligence.patterns?.testMocking;
44
+ }
45
+ else if (category === 'libraries') {
46
+ result.topUsed = intelligence.importGraph?.topUsed || [];
47
+ if (intelligence.tsconfigPaths) {
48
+ result.tsconfigPaths = intelligence.tsconfigPaths;
49
+ }
50
+ }
51
+ // Load and append matching memories
52
+ try {
53
+ const allMemories = await readMemoriesFile(ctx.paths.memory);
54
+ // Map pattern categories to decision categories
55
+ const categoryMap = {
56
+ all: ['tooling', 'architecture', 'testing', 'dependencies', 'conventions'],
57
+ di: ['architecture', 'conventions'],
58
+ state: ['architecture', 'conventions'],
59
+ testing: ['testing'],
60
+ libraries: ['dependencies']
61
+ };
62
+ const relevantCategories = categoryMap[category || 'all'] || [];
63
+ const matchingMemories = allMemories.filter((m) => relevantCategories.includes(m.category));
64
+ if (matchingMemories.length > 0) {
65
+ result.memories = matchingMemories;
66
+ }
67
+ }
68
+ catch (_error) {
69
+ // No memory file yet, that's fine - don't fail the whole request
70
+ }
71
+ // Detect pattern conflicts: primary < 80% and any alternative > 20%
72
+ const conflicts = [];
73
+ const patternsData = intelligence.patterns || {};
74
+ const hasUnitTestFramework = Boolean(patternsData.unitTestFramework?.primary);
75
+ for (const [cat, data] of Object.entries(patternsData)) {
76
+ if (shouldSkipLegacyTestingFrameworkCategory(cat, patternsData))
77
+ continue;
78
+ if (category && category !== 'all' && cat !== category)
79
+ continue;
80
+ if (!data.primary || !data.alsoDetected?.length)
81
+ continue;
82
+ const primaryFreq = parseFloat(data.primary.frequency) || 100;
83
+ if (primaryFreq >= 80)
84
+ continue;
85
+ for (const alt of data.alsoDetected) {
86
+ const altFreq = parseFloat(alt.frequency) || 0;
87
+ if (altFreq < 20)
88
+ continue;
89
+ if (isComplementaryPatternConflict(cat, data.primary.name, alt.name))
90
+ continue;
91
+ if (hasUnitTestFramework && cat === 'testingFramework')
92
+ continue;
93
+ conflicts.push({
94
+ category: cat,
95
+ primary: {
96
+ name: data.primary.name,
97
+ adoption: data.primary.frequency,
98
+ trend: data.primary.trend
99
+ },
100
+ alternative: {
101
+ name: alt.name,
102
+ adoption: alt.frequency,
103
+ trend: alt.trend
104
+ },
105
+ note: `Split decision: ${data.primary.frequency} ${data.primary.name} (${data.primary.trend || 'unknown'}) vs ${alt.frequency} ${alt.name} (${alt.trend || 'unknown'})`
106
+ });
107
+ }
108
+ }
109
+ if (conflicts.length > 0) {
110
+ result.conflicts = conflicts;
111
+ }
112
+ return {
113
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
114
+ };
115
+ }
116
+ catch (error) {
117
+ return {
118
+ content: [
119
+ {
120
+ type: 'text',
121
+ text: JSON.stringify({
122
+ status: 'error',
123
+ message: 'Failed to load team patterns',
124
+ error: error instanceof Error ? error.message : String(error)
125
+ }, null, 2)
126
+ }
127
+ ]
128
+ };
129
+ }
130
+ }
131
+ //# sourceMappingURL=get-team-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-team-patterns.js","sourceRoot":"","sources":["../../src/tools/get-team-patterns.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,8BAA8B,EAC9B,wCAAwC,EACzC,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,MAAM,UAAU,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AK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAC9D,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type { ToolContext, ToolResponse, ToolPaths } from './types.js';
2
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ import type { ToolContext, ToolResponse } from './types.js';
4
+ export declare const TOOLS: Tool[];
5
+ export declare function dispatchTool(name: string, args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAa/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,eAAO,MAAM,KAAK,EAAE,IAAI,EAA8C,CAAC;AAEvE,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CA4BvB"}
@@ -0,0 +1,41 @@
1
+ import { definition as d1, handle as h1 } from './search-codebase.js';
2
+ import { definition as d2, handle as h2 } from './get-codebase-metadata.js';
3
+ import { definition as d3, handle as h3 } from './get-indexing-status.js';
4
+ import { definition as d4, handle as h4 } from './refresh-index.js';
5
+ import { definition as d5, handle as h5 } from './get-style-guide.js';
6
+ import { definition as d6, handle as h6 } from './get-team-patterns.js';
7
+ import { definition as d7, handle as h7 } from './get-symbol-references.js';
8
+ import { definition as d8, handle as h8 } from './detect-circular-dependencies.js';
9
+ import { definition as d9, handle as h9 } from './remember.js';
10
+ import { definition as d10, handle as h10 } from './get-memory.js';
11
+ export const TOOLS = [d1, d2, d3, d4, d5, d6, d7, d8, d9, d10];
12
+ export async function dispatchTool(name, args, ctx) {
13
+ switch (name) {
14
+ case 'search_codebase':
15
+ return h1(args, ctx);
16
+ case 'get_codebase_metadata':
17
+ return h2(args, ctx);
18
+ case 'get_indexing_status':
19
+ return h3(args, ctx);
20
+ case 'refresh_index':
21
+ return h4(args, ctx);
22
+ case 'get_style_guide':
23
+ return h5(args, ctx);
24
+ case 'get_team_patterns':
25
+ return h6(args, ctx);
26
+ case 'get_symbol_references':
27
+ return h7(args, ctx);
28
+ case 'detect_circular_dependencies':
29
+ return h8(args, ctx);
30
+ case 'remember':
31
+ return h9(args, ctx);
32
+ case 'get_memory':
33
+ return h10(args, ctx);
34
+ default:
35
+ return {
36
+ content: [{ type: 'text', text: JSON.stringify({ error: `Unknown tool: ${name}` }) }],
37
+ isError: true
38
+ };
39
+ }
40
+ }
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,IAAI,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,UAAU,IAAI,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,UAAU,IAAI,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,UAAU,IAAI,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,IAAI,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,UAAU,IAAI,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,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C;QACvB,KAAK,UAAU;YACb,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACvB,KAAK,YAAY;YACf,OAAO,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACxB;YACE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,iBAAiB,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;gBACrF,OAAO,EAAE,IAAI;aACd,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { ToolContext, ToolResponse } from './types.js';
3
+ export declare const definition: Tool;
4
+ export declare function handle(args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
5
+ //# sourceMappingURL=refresh-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-index.d.ts","sourceRoot":"","sources":["../../src/tools/refresh-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,eAAO,MAAM,UAAU,EAAE,IAmBxB,CAAC;AAEF,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CA2BvB"}
@@ -0,0 +1,40 @@
1
+ export const definition = {
2
+ name: 'refresh_index',
3
+ description: 'Re-index the codebase. Supports full re-index or incremental mode. ' +
4
+ 'Use incrementalOnly=true to only process files changed since last index.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ reason: {
9
+ type: 'string',
10
+ description: 'Reason for refreshing the index (for logging)'
11
+ },
12
+ incrementalOnly: {
13
+ type: 'boolean',
14
+ description: 'If true, only re-index files changed since last full index (faster). Default: false (full re-index)'
15
+ }
16
+ }
17
+ }
18
+ };
19
+ export async function handle(args, ctx) {
20
+ const { reason, incrementalOnly } = args;
21
+ const mode = incrementalOnly ? 'incremental' : 'full';
22
+ console.error(`Refresh requested (${mode}): ${reason || 'Manual trigger'}`);
23
+ ctx.performIndexing(incrementalOnly);
24
+ return {
25
+ content: [
26
+ {
27
+ type: 'text',
28
+ text: JSON.stringify({
29
+ status: 'started',
30
+ mode,
31
+ message: incrementalOnly
32
+ ? 'Incremental re-indexing started. Only changed files will be re-embedded.'
33
+ : 'Full re-indexing started. Check status with get_indexing_status.',
34
+ reason
35
+ }, null, 2)
36
+ }
37
+ ]
38
+ };
39
+ }
40
+ //# sourceMappingURL=refresh-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-index.js","sourceRoot":"","sources":["../../src/tools/refresh-index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,qEAAqE;QACrE,0EAA0E;IAC5E,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+CAA+C;aAC7D;YACD,eAAe,EAAE;gBACf,IAAI,EAAE,SAAS;gBACf,WAAW,EACT,qGAAqG;aACxG;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,IAA6B,EAC7B,GAAgB;IAEhB,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,IAAsD,CAAC;IAE3F,MAAM,IAAI,GAAG,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;IACtD,OAAO,CAAC,KAAK,CAAC,sBAAsB,IAAI,MAAM,MAAM,IAAI,gBAAgB,EAAE,CAAC,CAAC;IAE5E,GAAG,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;IAErC,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oBACE,MAAM,EAAE,SAAS;oBACjB,IAAI;oBACJ,OAAO,EAAE,eAAe;wBACtB,CAAC,CAAC,0EAA0E;wBAC5E,CAAC,CAAC,kEAAkE;oBACtE,MAAM;iBACP,EACD,IAAI,EACJ,CAAC,CACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { ToolContext, ToolResponse } from './types.js';
3
+ export declare const definition: Tool;
4
+ export declare function handle(args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
5
+ //# sourceMappingURL=remember.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember.d.ts","sourceRoot":"","sources":["../../src/tools/remember.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI5D,eAAO,MAAM,UAAU,EAAE,IAwCxB,CAAC;AAEF,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CAkFvB"}
@@ -0,0 +1,101 @@
1
+ import { appendMemoryFile } from '../memory/store.js';
2
+ export const definition = {
3
+ name: 'remember',
4
+ description: 'CALL IMMEDIATELY when user explicitly asks to remember/record something.\n\n' +
5
+ 'USER TRIGGERS:\n' +
6
+ '- "Remember this: [X]"\n' +
7
+ '- "Record this: [Y]"\n' +
8
+ '- "Save this for next time: [Z]"\n\n' +
9
+ 'DO NOT call unless user explicitly requests it.\n\n' +
10
+ 'HOW TO WRITE:\n' +
11
+ '- ONE convention per memory (if user lists 5 things, call this 5 times)\n' +
12
+ '- memory: 5-10 words (the specific rule)\n' +
13
+ '- reason: 1 sentence (why it matters)\n' +
14
+ '- Skip: one-time features, code examples, essays',
15
+ inputSchema: {
16
+ type: 'object',
17
+ properties: {
18
+ type: {
19
+ type: 'string',
20
+ enum: ['convention', 'decision', 'gotcha', 'failure'],
21
+ description: 'Type of memory being recorded. Use "failure" for things that were tried and failed - ' +
22
+ 'prevents repeating the same mistakes.'
23
+ },
24
+ category: {
25
+ type: 'string',
26
+ description: 'Broader category for filtering',
27
+ enum: ['tooling', 'architecture', 'testing', 'dependencies', 'conventions']
28
+ },
29
+ memory: {
30
+ type: 'string',
31
+ description: 'What to remember (concise)'
32
+ },
33
+ reason: {
34
+ type: 'string',
35
+ description: 'Why this matters or what breaks otherwise'
36
+ }
37
+ },
38
+ required: ['type', 'category', 'memory', 'reason']
39
+ }
40
+ };
41
+ export async function handle(args, ctx) {
42
+ const args_typed = args;
43
+ const { type = 'decision', category, memory, reason } = args_typed;
44
+ try {
45
+ const crypto = await import('crypto');
46
+ const memoryPath = ctx.paths.memory;
47
+ const hashContent = `${type}:${category}:${memory}:${reason}`;
48
+ const hash = crypto.createHash('sha256').update(hashContent).digest('hex');
49
+ const id = hash.substring(0, 12);
50
+ const newMemory = {
51
+ id,
52
+ type,
53
+ category,
54
+ memory,
55
+ reason,
56
+ date: new Date().toISOString()
57
+ };
58
+ const result = await appendMemoryFile(memoryPath, newMemory);
59
+ if (result.status === 'duplicate') {
60
+ return {
61
+ content: [
62
+ {
63
+ type: 'text',
64
+ text: JSON.stringify({
65
+ status: 'info',
66
+ message: 'This memory was already recorded.',
67
+ memory: result.memory
68
+ }, null, 2)
69
+ }
70
+ ]
71
+ };
72
+ }
73
+ return {
74
+ content: [
75
+ {
76
+ type: 'text',
77
+ text: JSON.stringify({
78
+ status: 'success',
79
+ message: 'Memory recorded successfully.',
80
+ memory: result.memory
81
+ }, null, 2)
82
+ }
83
+ ]
84
+ };
85
+ }
86
+ catch (error) {
87
+ return {
88
+ content: [
89
+ {
90
+ type: 'text',
91
+ text: JSON.stringify({
92
+ status: 'error',
93
+ message: 'Failed to record memory.',
94
+ error: error instanceof Error ? error.message : String(error)
95
+ }, null, 2)
96
+ }
97
+ ]
98
+ };
99
+ }
100
+ }
101
+ //# sourceMappingURL=remember.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remember.js","sourceRoot":"","sources":["../../src/tools/remember.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,8EAA8E;QAC9E,kBAAkB;QAClB,0BAA0B;QAC1B,wBAAwB;QACxB,sCAAsC;QACtC,qDAAqD;QACrD,iBAAiB;QACjB,2EAA2E;QAC3E,4CAA4C;QAC5C,yCAAyC;QACzC,kDAAkD;IACpD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC;gBACrD,WAAW,EACT,uFAAuF;oBACvF,uCAAuC;aAC1C;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gCAAgC;gBAC7C,IAAI,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,CAAC;aAC5E;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4BAA4B;aAC1C;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;KACnD;CACF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AE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,MAAM,EAAE,SAAS;wBACjB,OAAO,EAAE,+BAA+B;wBACxC,MAAM,EAAE,MAAM,CAAC,MAAM;qBACtB,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,MAAM,EAAE,OAAO;wBACf,OAAO,EAAE,0BAA0B;wBACnC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAC9D,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import type { ToolContext, ToolResponse } from './types.js';
3
+ export declare const definition: Tool;
4
+ export declare function handle(args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
5
+ //# sourceMappingURL=search-codebase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-codebase.d.ts","sourceRoot":"","sources":["../../src/tools/search-codebase.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAG/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAe5D,eAAO,MAAM,UAAU,EAAE,IA4DxB,CAAC;AAEF,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CAsqBvB"}