mcp-code-context 2.2.0 → 2.4.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 (132) hide show
  1. package/.io/RULES.md +12 -0
  2. package/CHANGELOG.md +114 -1
  3. package/README.md +28 -1
  4. package/dist/src/ast/writers/safeRename.d.ts +14 -0
  5. package/dist/src/ast/writers/safeRename.js +258 -0
  6. package/dist/src/ast/writers/safeRename.js.map +1 -0
  7. package/dist/src/ast/writers/symbolWriter.d.ts +2 -0
  8. package/dist/src/ast/writers/symbolWriter.js +9 -14
  9. package/dist/src/ast/writers/symbolWriter.js.map +1 -1
  10. package/dist/src/cache/astCache.d.ts +33 -0
  11. package/dist/src/cache/astCache.js +113 -0
  12. package/dist/src/cache/astCache.js.map +1 -0
  13. package/dist/src/handlers/readHandlers.d.ts +70 -0
  14. package/dist/src/handlers/readHandlers.js +431 -0
  15. package/dist/src/handlers/readHandlers.js.map +1 -0
  16. package/dist/src/handlers/utilHandlers.d.ts +31 -0
  17. package/dist/src/handlers/utilHandlers.js +69 -0
  18. package/dist/src/handlers/utilHandlers.js.map +1 -0
  19. package/dist/src/handlers/writeHandlers.d.ts +57 -0
  20. package/dist/src/handlers/writeHandlers.js +475 -0
  21. package/dist/src/handlers/writeHandlers.js.map +1 -0
  22. package/dist/src/index.d.ts +6 -143
  23. package/dist/src/index.js +77 -1091
  24. package/dist/src/index.js.map +1 -1
  25. package/dist/src/tools/searchCodePattern.d.ts +7 -2
  26. package/dist/src/tools/searchCodePattern.js +68 -4
  27. package/dist/src/tools/searchCodePattern.js.map +1 -1
  28. package/dist/src/utils/arrayUtils.d.ts +12 -0
  29. package/dist/src/utils/arrayUtils.js +27 -0
  30. package/dist/src/utils/arrayUtils.js.map +1 -0
  31. package/dist/src/utils/constants.d.ts +46 -0
  32. package/dist/src/utils/constants.js +112 -0
  33. package/dist/src/utils/constants.js.map +1 -0
  34. package/dist/src/utils/ignoreManager.d.ts +8 -0
  35. package/dist/src/utils/ignoreManager.js +49 -0
  36. package/dist/src/utils/ignoreManager.js.map +1 -1
  37. package/dist/src/utils/normalization.d.ts +49 -0
  38. package/dist/src/utils/normalization.js +173 -0
  39. package/dist/src/utils/normalization.js.map +1 -0
  40. package/dist/src/utils/projectRoot.d.ts +12 -5
  41. package/dist/src/utils/projectRoot.js +22 -20
  42. package/dist/src/utils/projectRoot.js.map +1 -1
  43. package/dist/src/utils/secureValidation.d.ts +15 -0
  44. package/dist/src/utils/secureValidation.js +41 -0
  45. package/dist/src/utils/secureValidation.js.map +1 -0
  46. package/dist/src/utils/transactionManager.d.ts +45 -0
  47. package/dist/src/utils/transactionManager.js +102 -0
  48. package/dist/src/utils/transactionManager.js.map +1 -0
  49. package/dist/src/utils/validation.d.ts +87 -0
  50. package/dist/src/utils/validation.js +231 -0
  51. package/dist/src/utils/validation.js.map +1 -0
  52. package/docs/ARCHITECTURE.md +300 -0
  53. package/docs/architecture/ADR-001-modular-handlers.md +119 -0
  54. package/llms.txt +10 -1
  55. package/package.json +5 -5
  56. package/AGENT_INSTRUCTIONS.md +0 -135
  57. package/DEPLOYMENT_INSTRUCTIONS.md +0 -110
  58. package/MEJORAS_PROPUESTAS.md +0 -324
  59. package/RELEASE_NOTES_v2.1.3.md +0 -78
  60. package/RELEASE_NOTES_v2.2.0.md +0 -286
  61. package/dist/src/tests/test-confirmation-flow.d.ts +0 -1
  62. package/dist/src/tests/test-confirmation-flow.js +0 -43
  63. package/dist/src/tests/test-confirmation-flow.js.map +0 -1
  64. package/dist/tests/debug-replace.d.ts +0 -1
  65. package/dist/tests/debug-replace.js +0 -17
  66. package/dist/tests/debug-replace.js.map +0 -1
  67. package/dist/tests/test-backup-system.d.ts +0 -7
  68. package/dist/tests/test-backup-system.js +0 -152
  69. package/dist/tests/test-backup-system.js.map +0 -1
  70. package/dist/tests/test-confirmation-flow.d.ts +0 -1
  71. package/dist/tests/test-confirmation-flow.js +0 -43
  72. package/dist/tests/test-confirmation-flow.js.map +0 -1
  73. package/dist/tests/test-dart.d.ts +0 -1
  74. package/dist/tests/test-dart.js +0 -242
  75. package/dist/tests/test-dart.js.map +0 -1
  76. package/dist/tests/test-new-tools.d.ts +0 -4
  77. package/dist/tests/test-new-tools.js +0 -147
  78. package/dist/tests/test-new-tools.js.map +0 -1
  79. package/dist/tests/test-php-ast.d.ts +0 -1
  80. package/dist/tests/test-php-ast.js +0 -152
  81. package/dist/tests/test-php-ast.js.map +0 -1
  82. package/dist/tests/test-php.d.ts +0 -1
  83. package/dist/tests/test-php.js +0 -234
  84. package/dist/tests/test-php.js.map +0 -1
  85. package/dist/tests/test-smoke.d.ts +0 -5
  86. package/dist/tests/test-smoke.js +0 -83
  87. package/dist/tests/test-smoke.js.map +0 -1
  88. package/dist/tests/writers/test-crlf-handling.d.ts +0 -4
  89. package/dist/tests/writers/test-crlf-handling.js +0 -73
  90. package/dist/tests/writers/test-crlf-handling.js.map +0 -1
  91. package/dist/tests/writers/test-write-smoke.d.ts +0 -9
  92. package/dist/tests/writers/test-write-smoke.js +0 -346
  93. package/dist/tests/writers/test-write-smoke.js.map +0 -1
  94. package/src/ast/dartCompressor.ts +0 -1013
  95. package/src/ast/phpCompressor.ts +0 -814
  96. package/src/ast/semanticCompressor.ts +0 -808
  97. package/src/ast/writers/dartWriter.ts +0 -648
  98. package/src/ast/writers/phpWriter.ts +0 -508
  99. package/src/ast/writers/pyWriter.ts +0 -446
  100. package/src/ast/writers/symbolWriter.ts +0 -277
  101. package/src/ast/writers/tsWriter.ts +0 -418
  102. package/src/index.ts +0 -1784
  103. package/src/tools/readFileLines.ts +0 -104
  104. package/src/tools/searchCodePattern.ts +0 -129
  105. package/src/utils/backupManager.ts +0 -141
  106. package/src/utils/confirmationCache.ts +0 -61
  107. package/src/utils/diffEngine.ts +0 -223
  108. package/src/utils/fuzzyMatch.ts +0 -86
  109. package/src/utils/ignoreManager.ts +0 -144
  110. package/src/utils/projectRoot.ts +0 -44
  111. package/tests/test-backup-system.ts +0 -174
  112. package/tests/test-confirmation-flow.ts +0 -49
  113. package/tests/test-dart.d.ts +0 -1
  114. package/tests/test-dart.js +0 -209
  115. package/tests/test-dart.js.map +0 -1
  116. package/tests/test-dart.ts +0 -265
  117. package/tests/test-new-tools.ts +0 -165
  118. package/tests/test-php-ast.d.ts +0 -1
  119. package/tests/test-php-ast.js +0 -152
  120. package/tests/test-php-ast.js.map +0 -1
  121. package/tests/test-php-ast.ts +0 -155
  122. package/tests/test-php.d.ts +0 -1
  123. package/tests/test-php.js +0 -234
  124. package/tests/test-php.js.map +0 -1
  125. package/tests/test-php.ts +0 -261
  126. package/tests/test-smoke.d.ts +0 -5
  127. package/tests/test-smoke.js +0 -83
  128. package/tests/test-smoke.js.map +0 -1
  129. package/tests/test-smoke.ts +0 -93
  130. package/tests/writers/test-crlf-handling.ts +0 -100
  131. package/tests/writers/test-write-smoke.ts +0 -568
  132. package/tsconfig.json +0 -19
@@ -1,153 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * mcp-code-context — Semantic Code Context Server
3
+ * mcp-code-context — Semantic Code Context Server (v2.3.1 - Refactored)
4
4
  *
5
5
  * A Model Context Protocol (MCP) server that compresses any code repository
6
6
  * into LLM-ready semantic context and provides surgical code editing.
7
7
  *
8
- * Read Tools:
9
- * 1. get_semantic_repo_map — Compressed structural map of a repo
10
- * 2. read_file_surgical — Full file or specific symbol extraction
11
- * 3. analyze_impact — Find all dependents of a modified file
12
- *
13
- * Write Tools:
14
- * 4. write_file_surgical — Replace a symbol's code in-place
15
- * 5. insert_symbol — Insert code at precise AST positions
16
- * 6. rename_symbol — Rename across entire repository
17
- * 7. remove_symbol — Safely delete symbols with dep checking
8
+ * Architecture: Modular handlers with centralized utilities
9
+ * - Read handlers: get_semantic_repo_map, read_file_surgical, analyze_impact, etc.
10
+ * - Write handlers: write_file_surgical, insert_symbol, rename_symbol, remove_symbol
11
+ * - Util handlers: rollback_file, clean_backups
18
12
  *
19
13
  * Transport: stdio (JSON-RPC over stdin/stdout)
20
14
  * Compatible with: Claude Desktop, Cursor, Windsurf, Copilot, Amazon Q, and any MCP client.
21
15
  */
22
- export declare function handleGetSemanticRepoMap(args: Record<string, unknown>): Promise<{
23
- content: {
24
- type: "text";
25
- text: string;
26
- }[];
27
- isError: boolean;
28
- } | {
29
- content: {
30
- type: "text";
31
- text: string;
32
- }[];
33
- }>;
34
- export declare function handleReadFileSurgical(args: Record<string, unknown>): Promise<{
35
- content: {
36
- type: "text";
37
- text: string;
38
- }[];
39
- isError: boolean;
40
- } | {
41
- content: {
42
- type: "text";
43
- text: string;
44
- }[];
45
- }>;
46
- export declare function handleAnalyzeImpact(args: Record<string, unknown>): Promise<{
47
- content: {
48
- type: "text";
49
- text: string;
50
- }[];
51
- isError: boolean;
52
- } | {
53
- content: {
54
- type: "text";
55
- text: string;
56
- }[];
57
- }>;
58
- export declare function handleWriteFileSurgical(args: Record<string, unknown>): Promise<{
59
- content: {
60
- type: "text";
61
- text: string;
62
- }[];
63
- isError: boolean;
64
- } | {
65
- content: {
66
- type: "text";
67
- text: string;
68
- }[];
69
- }>;
70
- export declare function handleInsertSymbol(args: Record<string, unknown>): Promise<{
71
- content: {
72
- type: "text";
73
- text: string;
74
- }[];
75
- isError: boolean;
76
- } | {
77
- content: {
78
- type: "text";
79
- text: string;
80
- }[];
81
- }>;
82
- export declare function handleRenameSymbol(args: Record<string, unknown>): Promise<{
83
- content: {
84
- type: "text";
85
- text: string;
86
- }[];
87
- isError: boolean;
88
- } | {
89
- content: {
90
- type: "text";
91
- text: string;
92
- }[];
93
- }>;
94
- export declare function handleRemoveSymbol(args: Record<string, unknown>): Promise<{
95
- content: {
96
- type: "text";
97
- text: string;
98
- }[];
99
- isError: boolean;
100
- } | {
101
- content: {
102
- type: "text";
103
- text: string;
104
- }[];
105
- }>;
106
- export declare function handleRollbackFile(args: Record<string, unknown>): Promise<{
107
- content: {
108
- type: "text";
109
- text: string;
110
- }[];
111
- isError: boolean;
112
- } | {
113
- content: {
114
- type: "text";
115
- text: string;
116
- }[];
117
- }>;
118
- export declare function handleCleanBackups(args: Record<string, unknown>): Promise<{
119
- content: {
120
- type: "text";
121
- text: string;
122
- }[];
123
- isError: boolean;
124
- } | {
125
- content: {
126
- type: "text";
127
- text: string;
128
- }[];
129
- }>;
130
- export declare function handleReadFileLines(args: Record<string, unknown>): Promise<{
131
- content: {
132
- type: "text";
133
- text: string;
134
- }[];
135
- isError: boolean;
136
- } | {
137
- content: {
138
- type: "text";
139
- text: string;
140
- }[];
141
- }>;
142
- export declare function handleSearchCodePattern(args: Record<string, unknown>): Promise<{
143
- content: {
144
- type: "text";
145
- text: string;
146
- }[];
147
- isError: boolean;
148
- } | {
149
- content: {
150
- type: "text";
151
- text: string;
152
- }[];
153
- }>;
16
+ export {};