@aakrit512/gatekeep 1.0.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.
- package/README.md +91 -0
- package/dist/ai/chat.js +33 -0
- package/dist/ai/contextUtils.js +79 -0
- package/dist/ai/openAiClient.js +72 -0
- package/dist/ai/summarizer.js +65 -0
- package/dist/cli/configStore.js +68 -0
- package/dist/cli/validation.js +45 -0
- package/dist/cli.js +74 -0
- package/dist/config.js +36 -0
- package/dist/functions/toolCallHandler.js +25 -0
- package/dist/functions/toolDefinitions.js +422 -0
- package/dist/functions/toolExecutor.js +1044 -0
- package/dist/prompts/initializationPrompt.js +46 -0
- package/dist/prompts/systemPrompt.js +72 -0
- package/dist/ui/projectDb.js +220 -0
- package/dist/ui/server.js +523 -0
- package/dist/ui/webAgent.js +170 -0
- package/package.json +47 -0
- package/ui/app.html +952 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
export const tools = [
|
|
2
|
+
{
|
|
3
|
+
type: 'function',
|
|
4
|
+
function: {
|
|
5
|
+
name: 'list_directory',
|
|
6
|
+
description: 'List contents of a directory to understand project layout.',
|
|
7
|
+
parameters: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
dir_path: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'Path to list, e.g., "./src"',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
required: ['dir_path'],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'function',
|
|
21
|
+
function: {
|
|
22
|
+
name: 'read_file',
|
|
23
|
+
description: 'Read the contents of a local file.',
|
|
24
|
+
parameters: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
file_path: { type: 'string' },
|
|
28
|
+
},
|
|
29
|
+
required: ['file_path'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: 'function',
|
|
35
|
+
function: {
|
|
36
|
+
name: 'read_file_chunk',
|
|
37
|
+
description: 'Read a targeted excerpt from a local file by start/end line or by zero-based offset and limit. Useful for long files where full reads are wasteful.',
|
|
38
|
+
parameters: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {
|
|
41
|
+
file_path: { type: 'string' },
|
|
42
|
+
start_line: {
|
|
43
|
+
type: 'number',
|
|
44
|
+
description: '1-based line number to start reading from.',
|
|
45
|
+
},
|
|
46
|
+
end_line: {
|
|
47
|
+
type: 'number',
|
|
48
|
+
description: '1-based inclusive line number to stop reading at.',
|
|
49
|
+
},
|
|
50
|
+
offset: {
|
|
51
|
+
type: 'number',
|
|
52
|
+
description: 'Zero-based line offset. Used when start_line is omitted.',
|
|
53
|
+
},
|
|
54
|
+
limit: {
|
|
55
|
+
type: 'number',
|
|
56
|
+
description: 'Maximum number of lines to return. Defaults to 200.',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
required: ['file_path'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: 'function',
|
|
65
|
+
function: {
|
|
66
|
+
name: 'search_files',
|
|
67
|
+
description: 'Search filenames by glob, partial name, or extension. Useful for finding config, route, env, auth, test, and build files quickly.',
|
|
68
|
+
parameters: {
|
|
69
|
+
type: 'object',
|
|
70
|
+
properties: {
|
|
71
|
+
query: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
description: 'Partial filename, extension such as ".ts", or glob such as "**/*.config.ts".',
|
|
74
|
+
},
|
|
75
|
+
dir_path: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'Directory to search from. Defaults to the workspace root.',
|
|
78
|
+
},
|
|
79
|
+
max_results: {
|
|
80
|
+
type: 'number',
|
|
81
|
+
description: 'Maximum number of paths to return. Defaults to 100.',
|
|
82
|
+
},
|
|
83
|
+
include_hidden: {
|
|
84
|
+
type: 'boolean',
|
|
85
|
+
description: 'Whether to include dotfiles and hidden directories. Defaults to false.',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
required: ['query'],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: 'function',
|
|
94
|
+
function: {
|
|
95
|
+
name: 'grep_code',
|
|
96
|
+
description: 'Full-text or regex search across files, with optional include/exclude globs. Use for finding usages, env vars, API routes, imports, and symbols.',
|
|
97
|
+
parameters: {
|
|
98
|
+
type: 'object',
|
|
99
|
+
properties: {
|
|
100
|
+
pattern: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
description: 'Text or regular expression to search for.',
|
|
103
|
+
},
|
|
104
|
+
dir_path: {
|
|
105
|
+
type: 'string',
|
|
106
|
+
description: 'Directory to search from. Defaults to the workspace root.',
|
|
107
|
+
},
|
|
108
|
+
regex: {
|
|
109
|
+
type: 'boolean',
|
|
110
|
+
description: 'Treat pattern as a JavaScript regular expression. Defaults to false.',
|
|
111
|
+
},
|
|
112
|
+
case_sensitive: {
|
|
113
|
+
type: 'boolean',
|
|
114
|
+
description: 'Case-sensitive matching. Defaults to true.',
|
|
115
|
+
},
|
|
116
|
+
include_globs: {
|
|
117
|
+
type: 'array',
|
|
118
|
+
items: { type: 'string' },
|
|
119
|
+
description: 'Only search files matching any of these globs, e.g. ["src/**/*.ts"].',
|
|
120
|
+
},
|
|
121
|
+
exclude_globs: {
|
|
122
|
+
type: 'array',
|
|
123
|
+
items: { type: 'string' },
|
|
124
|
+
description: 'Skip files matching any of these globs.',
|
|
125
|
+
},
|
|
126
|
+
max_results: {
|
|
127
|
+
type: 'number',
|
|
128
|
+
description: 'Maximum matching lines to return. Defaults to 100.',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
required: ['pattern'],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'function',
|
|
137
|
+
function: {
|
|
138
|
+
name: 'get_file_metadata',
|
|
139
|
+
description: 'Return size, modified time, line count, language, and checksum for a file so the agent can decide whether it is worth opening.',
|
|
140
|
+
parameters: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
properties: {
|
|
143
|
+
file_path: { type: 'string' },
|
|
144
|
+
},
|
|
145
|
+
required: ['file_path'],
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: 'function',
|
|
151
|
+
function: {
|
|
152
|
+
name: 'get_project_tree',
|
|
153
|
+
description: 'Return a recursive tree view with depth and ignore support to understand project architecture better than a flat directory listing.',
|
|
154
|
+
parameters: {
|
|
155
|
+
type: 'object',
|
|
156
|
+
properties: {
|
|
157
|
+
dir_path: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
description: 'Directory to start from. Defaults to the workspace root.',
|
|
160
|
+
},
|
|
161
|
+
depth: {
|
|
162
|
+
type: 'number',
|
|
163
|
+
description: 'Maximum directory depth to include. Defaults to 3.',
|
|
164
|
+
},
|
|
165
|
+
ignore: {
|
|
166
|
+
type: 'array',
|
|
167
|
+
items: { type: 'string' },
|
|
168
|
+
description: 'Glob or partial path patterns to ignore.',
|
|
169
|
+
},
|
|
170
|
+
include_hidden: {
|
|
171
|
+
type: 'boolean',
|
|
172
|
+
description: 'Whether to include dotfiles and hidden directories. Defaults to false.',
|
|
173
|
+
},
|
|
174
|
+
max_entries: {
|
|
175
|
+
type: 'number',
|
|
176
|
+
description: 'Maximum number of entries to return. Defaults to 500.',
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
type: 'function',
|
|
184
|
+
function: {
|
|
185
|
+
name: 'find_symbol',
|
|
186
|
+
description: 'Find class, function, type, interface, enum, const, let, or var definitions by name. Faster than generic grep for "where is this implemented?" questions.',
|
|
187
|
+
parameters: {
|
|
188
|
+
type: 'object',
|
|
189
|
+
properties: {
|
|
190
|
+
symbol: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
description: 'Symbol name to find.',
|
|
193
|
+
},
|
|
194
|
+
kind: {
|
|
195
|
+
type: 'string',
|
|
196
|
+
description: 'Optional definition kind: class, function, type, interface, enum, const, let, or var.',
|
|
197
|
+
},
|
|
198
|
+
dir_path: {
|
|
199
|
+
type: 'string',
|
|
200
|
+
description: 'Directory to search from. Defaults to the workspace root.',
|
|
201
|
+
},
|
|
202
|
+
max_results: {
|
|
203
|
+
type: 'number',
|
|
204
|
+
description: 'Maximum definitions to return. Defaults to 50.',
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
required: ['symbol'],
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
type: 'function',
|
|
213
|
+
function: {
|
|
214
|
+
name: 'find_references',
|
|
215
|
+
description: 'Return call sites or usages of a symbol across source files. Useful for tracing feature flow safely in read-only mode.',
|
|
216
|
+
parameters: {
|
|
217
|
+
type: 'object',
|
|
218
|
+
properties: {
|
|
219
|
+
symbol: {
|
|
220
|
+
type: 'string',
|
|
221
|
+
description: 'Symbol name to search for.',
|
|
222
|
+
},
|
|
223
|
+
dir_path: {
|
|
224
|
+
type: 'string',
|
|
225
|
+
description: 'Directory to search from. Defaults to the workspace root.',
|
|
226
|
+
},
|
|
227
|
+
include_definitions: {
|
|
228
|
+
type: 'boolean',
|
|
229
|
+
description: 'Whether to include definition lines. Defaults to false.',
|
|
230
|
+
},
|
|
231
|
+
max_results: {
|
|
232
|
+
type: 'number',
|
|
233
|
+
description: 'Maximum references to return. Defaults to 100.',
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
required: ['symbol'],
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
type: 'function',
|
|
242
|
+
function: {
|
|
243
|
+
name: 'get_imports_exports',
|
|
244
|
+
description: 'Return a quick snapshot of module imports and exports for a file to show module boundaries and dependency direction.',
|
|
245
|
+
parameters: {
|
|
246
|
+
type: 'object',
|
|
247
|
+
properties: {
|
|
248
|
+
file_path: { type: 'string' },
|
|
249
|
+
},
|
|
250
|
+
required: ['file_path'],
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
type: 'function',
|
|
256
|
+
function: {
|
|
257
|
+
name: 'summarize_file',
|
|
258
|
+
description: 'Produce a compact machine-readable summary of a file: purpose hint, symbols, dependencies, exports, and likely side effects.',
|
|
259
|
+
parameters: {
|
|
260
|
+
type: 'object',
|
|
261
|
+
properties: {
|
|
262
|
+
file_path: { type: 'string' },
|
|
263
|
+
max_symbols: {
|
|
264
|
+
type: 'number',
|
|
265
|
+
description: 'Maximum symbols to include. Defaults to 30.',
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
required: ['file_path'],
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
type: 'function',
|
|
274
|
+
function: {
|
|
275
|
+
name: 'list_dependencies',
|
|
276
|
+
description: 'Read package.json, lockfiles, Dockerfiles, and build files to identify runtime and tooling dependencies for stack analysis.',
|
|
277
|
+
parameters: {
|
|
278
|
+
type: 'object',
|
|
279
|
+
properties: {
|
|
280
|
+
dir_path: {
|
|
281
|
+
type: 'string',
|
|
282
|
+
description: 'Project directory to inspect. Defaults to the workspace root.',
|
|
283
|
+
},
|
|
284
|
+
include_dev: {
|
|
285
|
+
type: 'boolean',
|
|
286
|
+
description: 'Whether to include development dependencies. Defaults to true.',
|
|
287
|
+
},
|
|
288
|
+
max_files: {
|
|
289
|
+
type: 'number',
|
|
290
|
+
description: 'Maximum dependency-related files to inspect. Defaults to 50.',
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
type: 'function',
|
|
298
|
+
function: {
|
|
299
|
+
name: 'read_manifest_files',
|
|
300
|
+
description: 'Auto-detect and read key repo manifests such as package.json, pnpm-workspace.yaml, turbo.json, tsconfig.json, docker-compose.yml, .github/workflows/*, and README*.',
|
|
301
|
+
parameters: {
|
|
302
|
+
type: 'object',
|
|
303
|
+
properties: {
|
|
304
|
+
dir_path: {
|
|
305
|
+
type: 'string',
|
|
306
|
+
description: 'Project directory to inspect. Defaults to the workspace root.',
|
|
307
|
+
},
|
|
308
|
+
max_files: {
|
|
309
|
+
type: 'number',
|
|
310
|
+
description: 'Maximum manifest files to read. Defaults to 40.',
|
|
311
|
+
},
|
|
312
|
+
max_bytes_per_file: {
|
|
313
|
+
type: 'number',
|
|
314
|
+
description: 'Maximum bytes to return per manifest. Defaults to 20000.',
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
type: 'function',
|
|
322
|
+
function: {
|
|
323
|
+
name: 'list_git_status',
|
|
324
|
+
description: 'Return staged, unstaged, and untracked file lists for quick situational awareness without the full diff.',
|
|
325
|
+
parameters: {
|
|
326
|
+
type: 'object',
|
|
327
|
+
properties: {},
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
type: 'function',
|
|
333
|
+
function: {
|
|
334
|
+
name: 'blame_file_range',
|
|
335
|
+
description: 'Run git blame for a targeted file range to understand historical intent behind unusual code.',
|
|
336
|
+
parameters: {
|
|
337
|
+
type: 'object',
|
|
338
|
+
properties: {
|
|
339
|
+
file_path: { type: 'string' },
|
|
340
|
+
start_line: {
|
|
341
|
+
type: 'number',
|
|
342
|
+
description: '1-based start line.',
|
|
343
|
+
},
|
|
344
|
+
end_line: {
|
|
345
|
+
type: 'number',
|
|
346
|
+
description: '1-based inclusive end line.',
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
required: ['file_path', 'start_line', 'end_line'],
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
type: 'function',
|
|
355
|
+
function: {
|
|
356
|
+
name: 'find_entrypoints',
|
|
357
|
+
description: 'Detect likely app entry files, route roots, workers, CLIs, and server bootstrap files to shorten execution-flow discovery.',
|
|
358
|
+
parameters: {
|
|
359
|
+
type: 'object',
|
|
360
|
+
properties: {
|
|
361
|
+
dir_path: {
|
|
362
|
+
type: 'string',
|
|
363
|
+
description: 'Directory to search from. Defaults to the workspace root.',
|
|
364
|
+
},
|
|
365
|
+
max_results: {
|
|
366
|
+
type: 'number',
|
|
367
|
+
description: 'Maximum entrypoints to return. Defaults to 100.',
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
type: 'function',
|
|
375
|
+
function: {
|
|
376
|
+
name: 'list_routes',
|
|
377
|
+
description: 'Extract known web routes or route files from conventions and common backend frameworks such as Next.js, Express, Nest, and Fastify.',
|
|
378
|
+
parameters: {
|
|
379
|
+
type: 'object',
|
|
380
|
+
properties: {
|
|
381
|
+
dir_path: {
|
|
382
|
+
type: 'string',
|
|
383
|
+
description: 'Directory to search from. Defaults to the workspace root.',
|
|
384
|
+
},
|
|
385
|
+
max_results: {
|
|
386
|
+
type: 'number',
|
|
387
|
+
description: 'Maximum routes to return. Defaults to 200.',
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
type: 'function',
|
|
395
|
+
function: {
|
|
396
|
+
name: 'write_file',
|
|
397
|
+
description: 'Write content to a file. Creates directories if they do not exist.',
|
|
398
|
+
parameters: {
|
|
399
|
+
type: 'object',
|
|
400
|
+
properties: {
|
|
401
|
+
file_path: { type: 'string' },
|
|
402
|
+
content: {
|
|
403
|
+
type: 'string',
|
|
404
|
+
description: 'Markdown or code content',
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
required: ['file_path', 'content'],
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
type: 'function',
|
|
413
|
+
function: {
|
|
414
|
+
name: 'get_git_diff',
|
|
415
|
+
description: 'Returns three sections: (1) uncommitted working-tree changes, (2) staged changes, (3) last 10 commits with file stats. Use this to understand what has changed recently — but an empty diff does NOT mean nothing to review.',
|
|
416
|
+
parameters: {
|
|
417
|
+
type: 'object',
|
|
418
|
+
properties: {},
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
];
|