codestrate 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 (120) hide show
  1. package/README.md +154 -0
  2. package/dist/constants.d.ts +40 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +145 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +134 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/schemas/index.d.ts +260 -0
  11. package/dist/schemas/index.d.ts.map +1 -0
  12. package/dist/schemas/index.js +173 -0
  13. package/dist/schemas/index.js.map +1 -0
  14. package/dist/security/guard.d.ts +18 -0
  15. package/dist/security/guard.d.ts.map +1 -0
  16. package/dist/security/guard.js +39 -0
  17. package/dist/security/guard.js.map +1 -0
  18. package/dist/services/code-searcher.d.ts +22 -0
  19. package/dist/services/code-searcher.d.ts.map +1 -0
  20. package/dist/services/code-searcher.js +171 -0
  21. package/dist/services/code-searcher.js.map +1 -0
  22. package/dist/services/context-builder.d.ts +22 -0
  23. package/dist/services/context-builder.d.ts.map +1 -0
  24. package/dist/services/context-builder.js +232 -0
  25. package/dist/services/context-builder.js.map +1 -0
  26. package/dist/services/memory-store.d.ts +31 -0
  27. package/dist/services/memory-store.d.ts.map +1 -0
  28. package/dist/services/memory-store.js +27 -0
  29. package/dist/services/memory-store.js.map +1 -0
  30. package/dist/services/repository-parser.d.ts +8 -0
  31. package/dist/services/repository-parser.d.ts.map +1 -0
  32. package/dist/services/repository-parser.js +255 -0
  33. package/dist/services/repository-parser.js.map +1 -0
  34. package/dist/services/symbol-indexer.d.ts +16 -0
  35. package/dist/services/symbol-indexer.d.ts.map +1 -0
  36. package/dist/services/symbol-indexer.js +417 -0
  37. package/dist/services/symbol-indexer.js.map +1 -0
  38. package/dist/services/tree-sitter.d.ts +22 -0
  39. package/dist/services/tree-sitter.d.ts.map +1 -0
  40. package/dist/services/tree-sitter.js +269 -0
  41. package/dist/services/tree-sitter.js.map +1 -0
  42. package/dist/services/validation-runner.d.ts +30 -0
  43. package/dist/services/validation-runner.d.ts.map +1 -0
  44. package/dist/services/validation-runner.js +159 -0
  45. package/dist/services/validation-runner.js.map +1 -0
  46. package/dist/store/index.d.ts +23 -0
  47. package/dist/store/index.d.ts.map +1 -0
  48. package/dist/store/index.js +93 -0
  49. package/dist/store/index.js.map +1 -0
  50. package/dist/store/interface.d.ts +73 -0
  51. package/dist/store/interface.d.ts.map +1 -0
  52. package/dist/store/interface.js +9 -0
  53. package/dist/store/interface.js.map +1 -0
  54. package/dist/store/memory.d.ts +21 -0
  55. package/dist/store/memory.d.ts.map +1 -0
  56. package/dist/store/memory.js +157 -0
  57. package/dist/store/memory.js.map +1 -0
  58. package/dist/store/sqlite.d.ts +95 -0
  59. package/dist/store/sqlite.d.ts.map +1 -0
  60. package/dist/store/sqlite.js +1018 -0
  61. package/dist/store/sqlite.js.map +1 -0
  62. package/dist/tools/analyze-impact.d.ts +3 -0
  63. package/dist/tools/analyze-impact.d.ts.map +1 -0
  64. package/dist/tools/analyze-impact.js +110 -0
  65. package/dist/tools/analyze-impact.js.map +1 -0
  66. package/dist/tools/explore.d.ts +3 -0
  67. package/dist/tools/explore.d.ts.map +1 -0
  68. package/dist/tools/explore.js +96 -0
  69. package/dist/tools/explore.js.map +1 -0
  70. package/dist/tools/get-context.d.ts +3 -0
  71. package/dist/tools/get-context.d.ts.map +1 -0
  72. package/dist/tools/get-context.js +82 -0
  73. package/dist/tools/get-context.js.map +1 -0
  74. package/dist/tools/inspect-symbol.d.ts +3 -0
  75. package/dist/tools/inspect-symbol.d.ts.map +1 -0
  76. package/dist/tools/inspect-symbol.js +146 -0
  77. package/dist/tools/inspect-symbol.js.map +1 -0
  78. package/dist/tools/recall-experience.d.ts +3 -0
  79. package/dist/tools/recall-experience.d.ts.map +1 -0
  80. package/dist/tools/recall-experience.js +141 -0
  81. package/dist/tools/recall-experience.js.map +1 -0
  82. package/dist/tools/record-experience.d.ts +6 -0
  83. package/dist/tools/record-experience.d.ts.map +1 -0
  84. package/dist/tools/record-experience.js +68 -0
  85. package/dist/tools/record-experience.js.map +1 -0
  86. package/dist/tools/reindex.d.ts +8 -0
  87. package/dist/tools/reindex.d.ts.map +1 -0
  88. package/dist/tools/reindex.js +74 -0
  89. package/dist/tools/reindex.js.map +1 -0
  90. package/dist/tools/repo-overview.d.ts +7 -0
  91. package/dist/tools/repo-overview.d.ts.map +1 -0
  92. package/dist/tools/repo-overview.js +102 -0
  93. package/dist/tools/repo-overview.js.map +1 -0
  94. package/dist/tools/run-validation.d.ts +6 -0
  95. package/dist/tools/run-validation.d.ts.map +1 -0
  96. package/dist/tools/run-validation.js +115 -0
  97. package/dist/tools/run-validation.js.map +1 -0
  98. package/dist/tools/search-code.d.ts +3 -0
  99. package/dist/tools/search-code.d.ts.map +1 -0
  100. package/dist/tools/search-code.js +98 -0
  101. package/dist/tools/search-code.js.map +1 -0
  102. package/dist/tools/search-history.d.ts +6 -0
  103. package/dist/tools/search-history.d.ts.map +1 -0
  104. package/dist/tools/search-history.js +69 -0
  105. package/dist/tools/search-history.js.map +1 -0
  106. package/dist/tools/status.d.ts +7 -0
  107. package/dist/tools/status.d.ts.map +1 -0
  108. package/dist/tools/status.js +98 -0
  109. package/dist/tools/status.js.map +1 -0
  110. package/dist/tools/trace-flow.d.ts +3 -0
  111. package/dist/tools/trace-flow.d.ts.map +1 -0
  112. package/dist/tools/trace-flow.js +155 -0
  113. package/dist/tools/trace-flow.js.map +1 -0
  114. package/dist/types.d.ts +182 -0
  115. package/dist/types.d.ts.map +1 -0
  116. package/dist/types.js +17 -0
  117. package/dist/types.js.map +1 -0
  118. package/grammars/tree-sitter-python.wasm +0 -0
  119. package/grammars/tree-sitter-typescript.wasm +0 -0
  120. package/package.json +48 -0
@@ -0,0 +1,260 @@
1
+ import { z } from "zod";
2
+ export declare enum ResponseFormat {
3
+ MARKDOWN = "markdown",
4
+ JSON = "json"
5
+ }
6
+ export declare const RepoOverviewSchema: z.ZodObject<{
7
+ path: z.ZodString;
8
+ depth: z.ZodDefault<z.ZodNumber>;
9
+ includeArchitecture: z.ZodDefault<z.ZodBoolean>;
10
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
11
+ }, "strict", z.ZodTypeAny, {
12
+ path: string;
13
+ depth: number;
14
+ includeArchitecture: boolean;
15
+ responseFormat: ResponseFormat;
16
+ }, {
17
+ path: string;
18
+ depth?: number | undefined;
19
+ includeArchitecture?: boolean | undefined;
20
+ responseFormat?: ResponseFormat | undefined;
21
+ }>;
22
+ export type RepoOverviewInput = z.infer<typeof RepoOverviewSchema>;
23
+ export declare const SearchCodeSchema: z.ZodObject<{
24
+ query: z.ZodString;
25
+ languages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
26
+ scope: z.ZodOptional<z.ZodString>;
27
+ maxResults: z.ZodDefault<z.ZodNumber>;
28
+ offset: z.ZodDefault<z.ZodNumber>;
29
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
30
+ }, "strict", z.ZodTypeAny, {
31
+ responseFormat: ResponseFormat;
32
+ query: string;
33
+ maxResults: number;
34
+ offset: number;
35
+ languages?: string[] | undefined;
36
+ scope?: string | undefined;
37
+ }, {
38
+ query: string;
39
+ responseFormat?: ResponseFormat | undefined;
40
+ languages?: string[] | undefined;
41
+ scope?: string | undefined;
42
+ maxResults?: number | undefined;
43
+ offset?: number | undefined;
44
+ }>;
45
+ export type SearchCodeInput = z.infer<typeof SearchCodeSchema>;
46
+ export declare const InspectSymbolSchema: z.ZodObject<{
47
+ symbol: z.ZodString;
48
+ includeCallers: z.ZodDefault<z.ZodBoolean>;
49
+ includeCallees: z.ZodDefault<z.ZodBoolean>;
50
+ includeTests: z.ZodDefault<z.ZodBoolean>;
51
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
52
+ }, "strict", z.ZodTypeAny, {
53
+ symbol: string;
54
+ responseFormat: ResponseFormat;
55
+ includeCallers: boolean;
56
+ includeCallees: boolean;
57
+ includeTests: boolean;
58
+ }, {
59
+ symbol: string;
60
+ responseFormat?: ResponseFormat | undefined;
61
+ includeCallers?: boolean | undefined;
62
+ includeCallees?: boolean | undefined;
63
+ includeTests?: boolean | undefined;
64
+ }>;
65
+ export type InspectSymbolInput = z.infer<typeof InspectSymbolSchema>;
66
+ export declare const GetContextSchema: z.ZodObject<{
67
+ task: z.ZodString;
68
+ tokenBudget: z.ZodDefault<z.ZodNumber>;
69
+ includeHistory: z.ZodDefault<z.ZodBoolean>;
70
+ includeMemory: z.ZodDefault<z.ZodBoolean>;
71
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
72
+ }, "strict", z.ZodTypeAny, {
73
+ responseFormat: ResponseFormat;
74
+ task: string;
75
+ tokenBudget: number;
76
+ includeHistory: boolean;
77
+ includeMemory: boolean;
78
+ }, {
79
+ task: string;
80
+ responseFormat?: ResponseFormat | undefined;
81
+ tokenBudget?: number | undefined;
82
+ includeHistory?: boolean | undefined;
83
+ includeMemory?: boolean | undefined;
84
+ }>;
85
+ export type GetContextInput = z.infer<typeof GetContextSchema>;
86
+ export declare const SearchHistorySchema: z.ZodObject<{
87
+ query: z.ZodString;
88
+ maxResults: z.ZodDefault<z.ZodNumber>;
89
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
90
+ }, "strict", z.ZodTypeAny, {
91
+ responseFormat: ResponseFormat;
92
+ query: string;
93
+ maxResults: number;
94
+ }, {
95
+ query: string;
96
+ responseFormat?: ResponseFormat | undefined;
97
+ maxResults?: number | undefined;
98
+ }>;
99
+ export type SearchHistoryInput = z.infer<typeof SearchHistorySchema>;
100
+ export declare const RecallExperienceSchema: z.ZodObject<{
101
+ task: z.ZodString;
102
+ topK: z.ZodDefault<z.ZodNumber>;
103
+ memoryTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["episodic", "semantic", "procedural", "negative"]>, "many">>;
104
+ repo: z.ZodOptional<z.ZodString>;
105
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
106
+ }, "strict", z.ZodTypeAny, {
107
+ responseFormat: ResponseFormat;
108
+ task: string;
109
+ topK: number;
110
+ repo?: string | undefined;
111
+ memoryTypes?: ("semantic" | "episodic" | "procedural" | "negative")[] | undefined;
112
+ }, {
113
+ task: string;
114
+ repo?: string | undefined;
115
+ responseFormat?: ResponseFormat | undefined;
116
+ topK?: number | undefined;
117
+ memoryTypes?: ("semantic" | "episodic" | "procedural" | "negative")[] | undefined;
118
+ }>;
119
+ export type RecallExperienceInput = z.infer<typeof RecallExperienceSchema>;
120
+ export declare const RunValidationSchema: z.ZodObject<{
121
+ targets: z.ZodArray<z.ZodEnum<["build", "test", "lint", "all"]>, "many">;
122
+ changedFilesOnly: z.ZodDefault<z.ZodBoolean>;
123
+ timeout: z.ZodOptional<z.ZodNumber>;
124
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
125
+ }, "strict", z.ZodTypeAny, {
126
+ responseFormat: ResponseFormat;
127
+ targets: ("build" | "test" | "lint" | "all")[];
128
+ changedFilesOnly: boolean;
129
+ timeout?: number | undefined;
130
+ }, {
131
+ targets: ("build" | "test" | "lint" | "all")[];
132
+ responseFormat?: ResponseFormat | undefined;
133
+ changedFilesOnly?: boolean | undefined;
134
+ timeout?: number | undefined;
135
+ }>;
136
+ export type RunValidationInput = z.infer<typeof RunValidationSchema>;
137
+ export declare const RecordExperienceSchema: z.ZodObject<{
138
+ task: z.ZodString;
139
+ diagnosis: z.ZodString;
140
+ solution: z.ZodString;
141
+ changedFiles: z.ZodArray<z.ZodString, "many">;
142
+ commit: z.ZodString;
143
+ buildPassed: z.ZodBoolean;
144
+ testsPassed: z.ZodBoolean;
145
+ validationCommand: z.ZodString;
146
+ failedAttempts: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
147
+ }, "strict", z.ZodTypeAny, {
148
+ commit: string;
149
+ task: string;
150
+ diagnosis: string;
151
+ solution: string;
152
+ changedFiles: string[];
153
+ buildPassed: boolean;
154
+ testsPassed: boolean;
155
+ validationCommand: string;
156
+ failedAttempts: string[];
157
+ }, {
158
+ commit: string;
159
+ task: string;
160
+ diagnosis: string;
161
+ solution: string;
162
+ changedFiles: string[];
163
+ buildPassed: boolean;
164
+ testsPassed: boolean;
165
+ validationCommand: string;
166
+ failedAttempts?: string[] | undefined;
167
+ }>;
168
+ export type RecordExperienceInput = z.infer<typeof RecordExperienceSchema>;
169
+ export declare const TraceFlowSchema: z.ZodObject<{
170
+ symbol: z.ZodString;
171
+ depth: z.ZodDefault<z.ZodNumber>;
172
+ direction: z.ZodDefault<z.ZodEnum<["both", "forward", "backward"]>>;
173
+ includeImports: z.ZodDefault<z.ZodBoolean>;
174
+ maxResults: z.ZodDefault<z.ZodNumber>;
175
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
176
+ }, "strict", z.ZodTypeAny, {
177
+ symbol: string;
178
+ depth: number;
179
+ responseFormat: ResponseFormat;
180
+ maxResults: number;
181
+ direction: "both" | "forward" | "backward";
182
+ includeImports: boolean;
183
+ }, {
184
+ symbol: string;
185
+ depth?: number | undefined;
186
+ responseFormat?: ResponseFormat | undefined;
187
+ maxResults?: number | undefined;
188
+ direction?: "both" | "forward" | "backward" | undefined;
189
+ includeImports?: boolean | undefined;
190
+ }>;
191
+ export type TraceFlowInput = z.infer<typeof TraceFlowSchema>;
192
+ export declare const AnalyzeImpactSchema: z.ZodObject<{
193
+ files: z.ZodArray<z.ZodString, "many">;
194
+ includeDependents: z.ZodDefault<z.ZodBoolean>;
195
+ includeTests: z.ZodDefault<z.ZodBoolean>;
196
+ maxAffected: z.ZodDefault<z.ZodNumber>;
197
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
198
+ }, "strict", z.ZodTypeAny, {
199
+ files: string[];
200
+ responseFormat: ResponseFormat;
201
+ includeTests: boolean;
202
+ includeDependents: boolean;
203
+ maxAffected: number;
204
+ }, {
205
+ files: string[];
206
+ responseFormat?: ResponseFormat | undefined;
207
+ includeTests?: boolean | undefined;
208
+ includeDependents?: boolean | undefined;
209
+ maxAffected?: number | undefined;
210
+ }>;
211
+ export type AnalyzeImpactInput = z.infer<typeof AnalyzeImpactSchema>;
212
+ export declare const ReindexSchema: z.ZodObject<{
213
+ path: z.ZodString;
214
+ incremental: z.ZodDefault<z.ZodBoolean>;
215
+ force: z.ZodDefault<z.ZodBoolean>;
216
+ depth: z.ZodDefault<z.ZodNumber>;
217
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
218
+ }, "strict", z.ZodTypeAny, {
219
+ path: string;
220
+ depth: number;
221
+ responseFormat: ResponseFormat;
222
+ incremental: boolean;
223
+ force: boolean;
224
+ }, {
225
+ path: string;
226
+ depth?: number | undefined;
227
+ responseFormat?: ResponseFormat | undefined;
228
+ incremental?: boolean | undefined;
229
+ force?: boolean | undefined;
230
+ }>;
231
+ export type ReindexInput = z.infer<typeof ReindexSchema>;
232
+ export declare const StatusSchema: z.ZodObject<{
233
+ path: z.ZodOptional<z.ZodString>;
234
+ checkStaleness: z.ZodDefault<z.ZodBoolean>;
235
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
236
+ }, "strict", z.ZodTypeAny, {
237
+ responseFormat: ResponseFormat;
238
+ checkStaleness: boolean;
239
+ path?: string | undefined;
240
+ }, {
241
+ path?: string | undefined;
242
+ responseFormat?: ResponseFormat | undefined;
243
+ checkStaleness?: boolean | undefined;
244
+ }>;
245
+ export type StatusInput = z.infer<typeof StatusSchema>;
246
+ export declare const ExploreSchema: z.ZodObject<{
247
+ query: z.ZodString;
248
+ maxResults: z.ZodDefault<z.ZodNumber>;
249
+ responseFormat: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
250
+ }, "strict", z.ZodTypeAny, {
251
+ responseFormat: ResponseFormat;
252
+ query: string;
253
+ maxResults: number;
254
+ }, {
255
+ query: string;
256
+ responseFormat?: ResponseFormat | undefined;
257
+ maxResults?: number | undefined;
258
+ }>;
259
+ export type ExploreInput = z.infer<typeof ExploreSchema>;
260
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oBAAY,cAAc;IACxB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAID,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAWpB,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAInE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAclB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI/D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EASrB,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIrE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAWlB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI/D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAQrB,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIrE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;EAYxB,CAAC;AACZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAI3E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAUrB,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIrE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBxB,CAAC;AACZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAG3E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;EAajB,CAAC;AACZ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAI7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAWrB,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIrE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAWf,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAIzD,eAAO,MAAM,YAAY;;;;;;;;;;;;EAOd,CAAC;AACZ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAIvD,eAAO,MAAM,aAAa;;;;;;;;;;;;EAIf,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,173 @@
1
+ import { z } from "zod";
2
+ export var ResponseFormat;
3
+ (function (ResponseFormat) {
4
+ ResponseFormat["MARKDOWN"] = "markdown";
5
+ ResponseFormat["JSON"] = "json";
6
+ })(ResponseFormat || (ResponseFormat = {}));
7
+ // ─── ci_repo_overview ─────────────────────────────────────
8
+ export const RepoOverviewSchema = z.object({
9
+ path: z.string()
10
+ .min(1, "Path is required")
11
+ .describe("Absolute or relative path to the repository root"),
12
+ depth: z.number().int().min(1).max(10).default(3)
13
+ .describe("Depth of directory tree (1-10, default 3)"),
14
+ includeArchitecture: z.boolean().default(true)
15
+ .describe("Attempt architecture inference from project structure"),
16
+ responseFormat: z.nativeEnum(ResponseFormat)
17
+ .default(ResponseFormat.MARKDOWN)
18
+ .describe("Output format: 'markdown' or 'json'"),
19
+ }).strict();
20
+ // ─── ci_search_code ───────────────────────────────────────
21
+ export const SearchCodeSchema = z.object({
22
+ query: z.string().min(1).max(500)
23
+ .describe("Search query — plain text or basic regex"),
24
+ languages: z.array(z.string()).max(20).optional()
25
+ .describe("Filter by language (e.g. ['typescript', 'python'])"),
26
+ scope: z.string().optional()
27
+ .describe("Subdirectory scope (e.g. 'src/'). Relative to repo root."),
28
+ maxResults: z.number().int().min(1).max(50).default(20)
29
+ .describe("Maximum results (1-50, default 20)"),
30
+ offset: z.number().int().min(0).default(0)
31
+ .describe("Result offset for pagination"),
32
+ responseFormat: z.nativeEnum(ResponseFormat)
33
+ .default(ResponseFormat.MARKDOWN)
34
+ .describe("Output format: 'markdown' or 'json'"),
35
+ }).strict();
36
+ // ─── ci_inspect_symbol ────────────────────────────────────
37
+ export const InspectSymbolSchema = z.object({
38
+ symbol: z.string().min(1).max(300)
39
+ .describe("Symbol name (e.g. 'UserService', 'auth.login.validate')"),
40
+ includeCallers: z.boolean().default(true).describe("Include callers"),
41
+ includeCallees: z.boolean().default(true).describe("Include callees"),
42
+ includeTests: z.boolean().default(true).describe("Include linked tests"),
43
+ responseFormat: z.nativeEnum(ResponseFormat)
44
+ .default(ResponseFormat.MARKDOWN)
45
+ .describe("Output format: 'markdown' or 'json'"),
46
+ }).strict();
47
+ // ─── ci_get_context ───────────────────────────────────────
48
+ export const GetContextSchema = z.object({
49
+ task: z.string().min(3).max(2000)
50
+ .describe("Natural language task. Auto-finds relevant symbols, files, tests, history, and memories. " +
51
+ "Example: 'Fix race condition in FileBasedCache concurrent writes'"),
52
+ tokenBudget: z.number().int().min(1000).max(16000).default(12000)
53
+ .describe("Token budget for the context bundle (1000-16000, default 12000)"),
54
+ includeHistory: z.boolean().default(true).describe("Include relevant git history"),
55
+ includeMemory: z.boolean().default(true).describe("Include relevant past experiences"),
56
+ responseFormat: z.nativeEnum(ResponseFormat)
57
+ .default(ResponseFormat.MARKDOWN)
58
+ .describe("Output format: 'markdown' or 'json'"),
59
+ }).strict();
60
+ // ─── ci_search_history ────────────────────────────────────
61
+ export const SearchHistorySchema = z.object({
62
+ query: z.string().min(1).max(500)
63
+ .describe("Search query for git log, commit messages, and issues"),
64
+ maxResults: z.number().int().min(1).max(50).default(20)
65
+ .describe("Maximum results (1-50, default 20)"),
66
+ responseFormat: z.nativeEnum(ResponseFormat)
67
+ .default(ResponseFormat.MARKDOWN)
68
+ .describe("Output format: 'markdown' or 'json'"),
69
+ }).strict();
70
+ // ─── ci_recall_experience ─────────────────────────────────
71
+ export const RecallExperienceSchema = z.object({
72
+ task: z.string().min(3).max(1000)
73
+ .describe("Description of current task to find similar past experiences"),
74
+ topK: z.number().int().min(1).max(10).default(5)
75
+ .describe("Number of experiences to retrieve (1-10, default 5)"),
76
+ memoryTypes: z.array(z.enum(["episodic", "semantic", "procedural", "negative"])).optional()
77
+ .describe("Filter by memory type"),
78
+ repo: z.string().optional()
79
+ .describe("Repository fingerprint to scope search"),
80
+ responseFormat: z.nativeEnum(ResponseFormat)
81
+ .default(ResponseFormat.MARKDOWN)
82
+ .describe("Output format: 'markdown' or 'json'"),
83
+ }).strict();
84
+ // ─── ci_run_validation ────────────────────────────────────
85
+ export const RunValidationSchema = z.object({
86
+ targets: z.array(z.enum(["build", "test", "lint", "all"])).min(1)
87
+ .describe("Validation targets. 'all' runs build → test → lint."),
88
+ changedFilesOnly: z.boolean().default(true)
89
+ .describe("Only run tests/build related to changed files"),
90
+ timeout: z.number().int().min(10).max(600).optional()
91
+ .describe("Timeout per command in seconds (default from config: 300)"),
92
+ responseFormat: z.nativeEnum(ResponseFormat)
93
+ .default(ResponseFormat.MARKDOWN)
94
+ .describe("Output format: 'markdown' or 'json'"),
95
+ }).strict();
96
+ // ─── ci_record_experience ─────────────────────────────────
97
+ export const RecordExperienceSchema = z.object({
98
+ task: z.string().min(3).max(2000)
99
+ .describe("Description of what was accomplished"),
100
+ diagnosis: z.string().min(3).max(5000)
101
+ .describe("Root cause analysis of the issue"),
102
+ solution: z.string().min(3).max(10000)
103
+ .describe("Description of the fix applied"),
104
+ changedFiles: z.array(z.string()).min(1).max(200)
105
+ .describe("Files that were changed"),
106
+ commit: z.string().min(1)
107
+ .describe("Git commit SHA of the fix (required for evidence)"),
108
+ buildPassed: z.boolean()
109
+ .describe("Whether the build passed after the fix (required evidence)"),
110
+ testsPassed: z.boolean()
111
+ .describe("Whether tests passed after the fix (required evidence)"),
112
+ validationCommand: z.string().min(1)
113
+ .describe("The validation command that was run (e.g. 'npm test', 'mvn verify')"),
114
+ failedAttempts: z.array(z.string()).max(50).optional().default([])
115
+ .describe("Descriptions of approaches that failed"),
116
+ }).strict();
117
+ // ─── ci_trace_flow ────────────────────────────────────────
118
+ export const TraceFlowSchema = z.object({
119
+ symbol: z.string().min(1).max(300)
120
+ .describe("Symbol name to trace (e.g. 'UserService.login')"),
121
+ depth: z.number().int().min(1).max(5).default(2)
122
+ .describe("Max depth of call/import chain (1-5, default 2)"),
123
+ direction: z.enum(["both", "forward", "backward"]).default("both")
124
+ .describe("Trace direction: callers (backward), callees (forward), or both"),
125
+ includeImports: z.boolean().default(true)
126
+ .describe("Resolve import/require chains"),
127
+ maxResults: z.number().int().min(1).max(100).default(30)
128
+ .describe("Maximum nodes in the flow graph"),
129
+ responseFormat: z.nativeEnum(ResponseFormat).default(ResponseFormat.MARKDOWN)
130
+ .describe("Output format: 'markdown' or 'json'"),
131
+ }).strict();
132
+ // ─── ci_analyze_impact ────────────────────────────────────
133
+ export const AnalyzeImpactSchema = z.object({
134
+ files: z.array(z.string()).min(1).max(50)
135
+ .describe("Changed files to analyze for impact"),
136
+ includeDependents: z.boolean().default(true)
137
+ .describe("Include files that depend on the changed files"),
138
+ includeTests: z.boolean().default(true)
139
+ .describe("Include related test files"),
140
+ maxAffected: z.number().int().min(1).max(200).default(50)
141
+ .describe("Maximum affected files to report"),
142
+ responseFormat: z.nativeEnum(ResponseFormat).default(ResponseFormat.MARKDOWN)
143
+ .describe("Output format: 'markdown' or 'json'"),
144
+ }).strict();
145
+ // ─── ci_reindex ───────────────────────────────────────────
146
+ export const ReindexSchema = z.object({
147
+ path: z.string().min(1)
148
+ .describe("Repository path to re-index"),
149
+ incremental: z.boolean().default(true)
150
+ .describe("Only re-index changed files since last index (uses git diff)"),
151
+ force: z.boolean().default(false)
152
+ .describe("Force full re-index regardless of index age"),
153
+ depth: z.number().int().min(1).max(10).default(3)
154
+ .describe("Directory scanning depth (1-10, default 3)"),
155
+ responseFormat: z.nativeEnum(ResponseFormat).default(ResponseFormat.MARKDOWN)
156
+ .describe("Output format: 'markdown' or 'json'"),
157
+ }).strict();
158
+ // ─── ci_status ────────────────────────────────────────────
159
+ export const StatusSchema = z.object({
160
+ path: z.string().optional()
161
+ .describe("Repository path. Uses default repo if omitted"),
162
+ checkStaleness: z.boolean().default(true)
163
+ .describe("Check if index is stale (based on git HEAD)"),
164
+ responseFormat: z.nativeEnum(ResponseFormat).default(ResponseFormat.MARKDOWN)
165
+ .describe("Output format: 'markdown' or 'json'"),
166
+ }).strict();
167
+ // ─── ci_explore ─────────────────────────────────────────
168
+ export const ExploreSchema = z.object({
169
+ query: z.string().min(1).describe("Truy vấn tìm kiếm symbol, file, hoặc pattern"),
170
+ maxResults: z.number().min(1).max(100).default(20).describe("Số kết quả tối đa"),
171
+ responseFormat: z.nativeEnum(ResponseFormat).default(ResponseFormat.MARKDOWN).describe("ResponseFormat"),
172
+ }).strict();
173
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources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IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8CAA8C,CAAC;IACjF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAChF,cAAc,EAAE,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;CACzG,CAAC,CAAC,MAAM,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Security Guard — path traversal, symlink escape, and command validation.
3
+ */
4
+ /**
5
+ * Validate that a path is within the allowed repository root.
6
+ * Prevents path traversal attacks (../ outside repo).
7
+ */
8
+ export declare function validateRepoPath(requestedPath: string, repoRoot: string): string;
9
+ /**
10
+ * Validate that a command is in the allowlist.
11
+ */
12
+ export declare function validateCommand(command: string, allowlist: string[]): string;
13
+ /**
14
+ * Redact secrets from command output.
15
+ * Replaces known patterns (API keys, tokens, passwords) with [REDACTED].
16
+ */
17
+ export declare function redactSecrets(output: string): string;
18
+ //# sourceMappingURL=guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/security/guard.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAShF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAO5E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAYpD"}
@@ -0,0 +1,39 @@
1
+ import { normalize, resolve } from "path";
2
+ /**
3
+ * Security Guard — path traversal, symlink escape, and command validation.
4
+ */
5
+ /**
6
+ * Validate that a path is within the allowed repository root.
7
+ * Prevents path traversal attacks (../ outside repo).
8
+ */
9
+ export function validateRepoPath(requestedPath, repoRoot) {
10
+ const resolved = resolve(repoRoot, requestedPath);
11
+ const normalized = normalize(resolved);
12
+ if (!normalized.startsWith(resolve(repoRoot))) {
13
+ throw new Error(`Path traversal detected: ${requestedPath} resolves outside ${repoRoot}`);
14
+ }
15
+ return normalized;
16
+ }
17
+ /**
18
+ * Validate that a command is in the allowlist.
19
+ */
20
+ export function validateCommand(command, allowlist) {
21
+ if (!allowlist.includes(command)) {
22
+ throw new Error(`Command '${command}' is not in allowlist. Allowed: ${allowlist.join(", ")}`);
23
+ }
24
+ return command;
25
+ }
26
+ /**
27
+ * Redact secrets from command output.
28
+ * Replaces known patterns (API keys, tokens, passwords) with [REDACTED].
29
+ */
30
+ export function redactSecrets(output) {
31
+ const patterns = [
32
+ /(api[_-]?key|apikey|token|secret|password|passwd)[:=]\s*['"]?[^\s'",}]+/gi,
33
+ /(ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}/g,
34
+ /sk-[A-Za-z0-9]{32,}/g,
35
+ /[A-Za-z0-9+/=]{40,}/g,
36
+ ];
37
+ return patterns.reduce((acc, p) => acc.replace(p, (match) => match.replace(/[^:=]/g, "*")), output);
38
+ }
39
+ //# sourceMappingURL=guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.js","sourceRoot":"","sources":["../../src/security/guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE1C;;GAEG;AAEH;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,aAAqB,EAAE,QAAgB;IACtE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,4BAA4B,aAAa,qBAAqB,QAAQ,EAAE,CACzE,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,SAAmB;IAClE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,mCAAmC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7E,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,MAAM,QAAQ,GAAG;QACf,2EAA2E;QAC3E,0CAA0C;QAC1C,sBAAsB;QACtB,sBAAsB;KACvB,CAAC;IACF,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CACT,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,EACzD,MAAM,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { SearchResult } from "../types.js";
2
+ interface SearchOptions {
3
+ query: string;
4
+ languages?: string[];
5
+ scope?: string;
6
+ maxResults: number;
7
+ offset: number;
8
+ repoPath: string;
9
+ }
10
+ /**
11
+ * Execute hybrid search: ripgrep text search BM25-scored, with symbol matching boost.
12
+ */
13
+ export declare function searchCode(opts: SearchOptions): Promise<{
14
+ results: SearchResult[];
15
+ total: number;
16
+ }>;
17
+ /**
18
+ * Simple BM25 text search without ripgrep (fallback for repos without rg).
19
+ */
20
+ export declare function simpleTextSearch(text: string, query: string): number;
21
+ export {};
22
+ //# sourceMappingURL=code-searcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-searcher.d.ts","sourceRoot":"","sources":["../../src/services/code-searcher.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAyB,MAAM,aAAa,CAAC;AAEvE,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAaD;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC;IAC7D,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAiDD;AAwHD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,MAAM,CAWR"}