@crowdedkingdoms/crowdy-dsh 0.2.0-dev.1 → 0.2.0-dev.2

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 (105) hide show
  1. package/THIRD_PARTY_NOTICES.md +226 -0
  2. package/dist/dsh-web/BUILD.json +3 -3
  3. package/dist/dsh-web/preview/vfs-image.tar.gz +0 -0
  4. package/lib/attachments/crowdy-attachment-store.js +200 -0
  5. package/lib/attachments/crowdy-attachment-store.js.map +1 -0
  6. package/lib/bridge/client.js +161 -0
  7. package/lib/bridge/client.js.map +1 -0
  8. package/lib/bridge/index.js +155 -0
  9. package/lib/bridge/index.js.map +1 -0
  10. package/lib/bridge/protocol.js +30 -0
  11. package/lib/bridge/protocol.js.map +1 -0
  12. package/lib/crowdy/client.js +247 -0
  13. package/lib/crowdy/client.js.map +1 -0
  14. package/lib/crowdy/config.js +95 -0
  15. package/lib/crowdy/config.js.map +1 -0
  16. package/lib/crowdy/github-layout.js +97 -0
  17. package/lib/crowdy/github-layout.js.map +1 -0
  18. package/lib/crowdy/paths.js +145 -0
  19. package/lib/crowdy/paths.js.map +1 -0
  20. package/lib/crowdy/project-store.js +223 -0
  21. package/lib/crowdy/project-store.js.map +1 -0
  22. package/lib/fs/crowdy-file-system.js +621 -0
  23. package/lib/fs/crowdy-file-system.js.map +1 -0
  24. package/lib/fs/scratch-store.js +61 -0
  25. package/lib/fs/scratch-store.js.map +1 -0
  26. package/lib/index.js +15 -0
  27. package/lib/index.js.map +1 -0
  28. package/lib/persist/index.js +199 -0
  29. package/lib/persist/index.js.map +1 -0
  30. package/lib/scripts/probe.js +59 -0
  31. package/lib/scripts/probe.js.map +1 -0
  32. package/lib/sdk-index/catalog.js +237 -0
  33. package/lib/sdk-index/catalog.js.map +1 -0
  34. package/lib/sdk-index/index.js +10 -0
  35. package/lib/sdk-index/index.js.map +1 -0
  36. package/lib/sdk-index/parse-sdk.js +131 -0
  37. package/lib/sdk-index/parse-sdk.js.map +1 -0
  38. package/lib/sdk-index/plugin.js +90 -0
  39. package/lib/sdk-index/plugin.js.map +1 -0
  40. package/lib/sdk-index/snapshot.js +215 -0
  41. package/lib/sdk-index/snapshot.js.map +1 -0
  42. package/lib/search/glob-match.js +114 -0
  43. package/lib/search/glob-match.js.map +1 -0
  44. package/lib/search/search-tools.js +414 -0
  45. package/lib/search/search-tools.js.map +1 -0
  46. package/lib/tools/index.js +344 -0
  47. package/lib/tools/index.js.map +1 -0
  48. package/lib/types/attachments/crowdy-attachment-store.d.ts +45 -0
  49. package/lib/types/attachments/crowdy-attachment-store.d.ts.map +1 -0
  50. package/lib/types/attachments/crowdy-attachment-store.test.d.ts.map +1 -0
  51. package/lib/types/bridge/client.d.ts +57 -0
  52. package/lib/types/bridge/client.d.ts.map +1 -0
  53. package/lib/types/bridge/client.test.d.ts.map +1 -0
  54. package/lib/types/bridge/index.d.ts +66 -0
  55. package/lib/types/bridge/index.d.ts.map +1 -0
  56. package/lib/types/bridge/protocol.d.ts +242 -0
  57. package/lib/types/bridge/protocol.d.ts.map +1 -0
  58. package/lib/types/crowdy/client.d.ts +126 -0
  59. package/lib/types/crowdy/client.d.ts.map +1 -0
  60. package/lib/types/crowdy/client.test.d.ts.map +1 -0
  61. package/lib/types/crowdy/config.d.ts +60 -0
  62. package/lib/types/crowdy/config.d.ts.map +1 -0
  63. package/lib/types/crowdy/github-layout.d.ts +36 -0
  64. package/lib/types/crowdy/github-layout.d.ts.map +1 -0
  65. package/lib/types/crowdy/paths.d.ts +89 -0
  66. package/lib/types/crowdy/paths.d.ts.map +1 -0
  67. package/lib/types/crowdy/project-store.d.ts +84 -0
  68. package/lib/types/crowdy/project-store.d.ts.map +1 -0
  69. package/lib/types/crowdy/project-store.test.d.ts.map +1 -0
  70. package/lib/types/fs/crowdy-file-system.d.ts +173 -0
  71. package/lib/types/fs/crowdy-file-system.d.ts.map +1 -0
  72. package/lib/types/fs/crowdy-file-system.test.d.ts.map +1 -0
  73. package/lib/types/fs/scratch-store.d.ts +31 -0
  74. package/lib/types/fs/scratch-store.d.ts.map +1 -0
  75. package/lib/types/index.d.ts +19 -0
  76. package/lib/types/index.d.ts.map +1 -0
  77. package/lib/types/persist/index.d.ts +85 -0
  78. package/lib/types/persist/index.d.ts.map +1 -0
  79. package/lib/types/scripts/probe.d.ts +9 -0
  80. package/lib/types/scripts/probe.d.ts.map +1 -0
  81. package/lib/types/sdk-index/catalog.d.ts +39 -0
  82. package/lib/types/sdk-index/catalog.d.ts.map +1 -0
  83. package/lib/types/sdk-index/catalog.test.d.ts.map +1 -0
  84. package/lib/types/sdk-index/index.d.ts +13 -0
  85. package/lib/types/sdk-index/index.d.ts.map +1 -0
  86. package/lib/types/sdk-index/parse-sdk.d.ts +25 -0
  87. package/lib/types/sdk-index/parse-sdk.d.ts.map +1 -0
  88. package/lib/types/sdk-index/plugin.d.ts +26 -0
  89. package/lib/types/sdk-index/plugin.d.ts.map +1 -0
  90. package/lib/types/sdk-index/snapshot.d.ts +11 -0
  91. package/lib/types/sdk-index/snapshot.d.ts.map +1 -0
  92. package/lib/types/search/glob-match.d.ts +31 -0
  93. package/lib/types/search/glob-match.d.ts.map +1 -0
  94. package/lib/types/search/glob-match.test.d.ts.map +1 -0
  95. package/lib/types/search/search-tools.d.ts +81 -0
  96. package/lib/types/search/search-tools.d.ts.map +1 -0
  97. package/lib/types/search/search-tools.test.d.ts.map +1 -0
  98. package/lib/types/tools/index.d.ts +27 -0
  99. package/lib/types/tools/index.d.ts.map +1 -0
  100. package/lib/types/vendor/crowdyjs-sdk.d.ts +17 -0
  101. package/lib/types/vendor/crowdyjs-sdk.d.ts.map +1 -0
  102. package/lib/vendor/crowdyjs-sdk.js +18338 -0
  103. package/lib/vendor/crowdyjs-sdk.js.map +1 -0
  104. package/lib/vendor/crowdyjs-sdk.version.json +5 -0
  105. package/package.json +151 -38
@@ -0,0 +1,414 @@
1
+ /**
2
+ * The model-facing `glob` / `grep` discovery tools for a Crowdy Studio
3
+ * project.
4
+ *
5
+ * The stock `tool-fs-search` spawns ripgrep on this machine's disk, which is
6
+ * exactly the world the crowdy preset removes: the project lives behind the
7
+ * game API, not in the launch directory. This plugin registers tools with the
8
+ * SAME names and near-identical schemas, but matching happens in memory over
9
+ * the Crowdy filesystem backend's project snapshot (`ctx.fs` must be
10
+ * {@link CrowdyFileSystem}), so search, read, and write always describe the
11
+ * same files.
12
+ *
13
+ * A Crowdy project is small (two targets, a handful of files, 64 KiB per
14
+ * file), so there is no subprocess, no spill store, and no pagination beyond
15
+ * a defensive inline cap. Returned paths are relative to the project mount,
16
+ * which is the same base the `read` tool resolves against, so every result
17
+ * is follow-up-readable.
18
+ *
19
+ * @module @crowdy/dsh-cockpit/search
20
+ */
21
+ import z from '@deepseek-ai/schemastery';
22
+ import { defineTool } from '@deepseek-ai/dsh-tools';
23
+ import { CrowdyFileSystem } from '../fs/crowdy-file-system.js';
24
+ import { normalizeAbsolute, resolveAgainst } from '../crowdy/paths.js';
25
+ import { globMatches, GlobSyntaxError } from './glob-match.js';
26
+ /** Cordis plugin name used by loader diagnostics. */
27
+ export const name = 'tool-fs-search-crowdy';
28
+ /** Services required by the Crowdy search tool suite. */
29
+ export const inject = ['tools', 'systemPrompt', 'fs'];
30
+ export const Config = z.object({
31
+ globMaxResults: z.number().default(100),
32
+ grepMaxMatches: z.number().default(250),
33
+ grepMaxLineBytes: z.number().default(2000),
34
+ });
35
+ // ── pure core ─────────────────────────────────────────────────────────────────
36
+ /**
37
+ * Resolve the optional `path` argument against the mount root, rejecting a
38
+ * target outside the mount so the model gets a precise message instead of a
39
+ * silent empty result.
40
+ */
41
+ export function resolveSearchRoot(mountRoot, pathArg) {
42
+ const root = normalizeAbsolute(mountRoot);
43
+ if (pathArg === undefined)
44
+ return root;
45
+ if (pathArg.trim().length === 0)
46
+ throw new Error('path must be a non-empty string when given');
47
+ const absolute = resolveAgainst(root, pathArg);
48
+ if (absolute !== root && !absolute.startsWith(`${root}/`)) {
49
+ throw new Error(`path resolves to ${absolute}, outside the project mount at ${root}`);
50
+ }
51
+ return absolute;
52
+ }
53
+ /** A file's path relative to `base`, or undefined when it lies outside. */
54
+ function relativeTo(virtualPath, base) {
55
+ if (virtualPath === base)
56
+ return '';
57
+ return virtualPath.startsWith(`${base}/`) ? virtualPath.slice(base.length + 1) : undefined;
58
+ }
59
+ /** Rethrow a glob syntax failure as a plain argument error the registry renders. */
60
+ function compileGlob(pattern, label) {
61
+ try {
62
+ globMatches('probe', pattern);
63
+ }
64
+ catch (error) {
65
+ if (error instanceof GlobSyntaxError)
66
+ throw new Error(`${label}: ${error.message}`);
67
+ throw error;
68
+ }
69
+ }
70
+ /**
71
+ * Discover project files matching one glob, scoped to `searchRoot`. Matching
72
+ * follows the stock tool's rule (no `/` in the pattern = basename at any
73
+ * depth); display paths are mount-relative and returned in path order,
74
+ * because Crowdy files have no modification times.
75
+ */
76
+ export function globProjectPaths(files, mountRoot, searchRoot, pattern) {
77
+ if (pattern.trim().length === 0)
78
+ throw new Error('pattern must be a non-empty string');
79
+ compileGlob(pattern, 'pattern rejected');
80
+ const out = [];
81
+ for (const file of files) {
82
+ const scoped = relativeTo(file.virtualPath, searchRoot);
83
+ if (scoped === undefined || scoped === '')
84
+ continue;
85
+ if (!globMatches(scoped, pattern))
86
+ continue;
87
+ out.push(relativeTo(file.virtualPath, normalizeAbsolute(mountRoot)) ?? file.virtualPath);
88
+ }
89
+ return out.sort();
90
+ }
91
+ /** Bound one matched-line preview to `maxBytes`, preserving UTF-8 boundaries. */
92
+ export function previewLine(line, maxBytes) {
93
+ if (Buffer.byteLength(line, 'utf8') <= maxBytes)
94
+ return line;
95
+ let kept = line;
96
+ while (kept.length > 0 && Buffer.byteLength(kept, 'utf8') > maxBytes) {
97
+ kept = kept.slice(0, -1);
98
+ }
99
+ return `${kept} (line truncated)`;
100
+ }
101
+ /**
102
+ * Search project file contents with a regular expression, scoped to
103
+ * `searchRoot` (a directory or a single file) and optionally filtered by one
104
+ * `include` glob. Lines are 1-based; a file's trailing newline does not
105
+ * produce a phantom empty line.
106
+ */
107
+ export function grepProjectFiles(files, mountRoot, searchRoot, pattern, include, maxLineBytes) {
108
+ if (pattern.length === 0)
109
+ throw new Error('pattern must be a non-empty string');
110
+ if (include !== undefined) {
111
+ if (include.trim().length === 0)
112
+ throw new Error('include must be a non-empty glob when given');
113
+ if (include.startsWith('!')) {
114
+ throw new Error('include must be a positive glob filter; negated patterns ("!…") are not supported');
115
+ }
116
+ compileGlob(include, 'include rejected');
117
+ }
118
+ let regex;
119
+ try {
120
+ regex = new RegExp(pattern);
121
+ }
122
+ catch (error) {
123
+ throw new Error(`pattern is not a valid regular expression: ${error.message}`);
124
+ }
125
+ const root = normalizeAbsolute(mountRoot);
126
+ const matches = [];
127
+ for (const file of files) {
128
+ const scoped = relativeTo(file.virtualPath, searchRoot);
129
+ if (scoped === undefined)
130
+ continue;
131
+ // `scoped === ''` means searchRoot IS this file; include filters still
132
+ // apply to a directory search only.
133
+ if (scoped !== '' && include !== undefined && !globMatches(scoped, include))
134
+ continue;
135
+ const display = relativeTo(file.virtualPath, root) ?? file.virtualPath;
136
+ const lines = file.content.split('\n');
137
+ if (lines.length > 0 && lines[lines.length - 1] === '')
138
+ lines.pop();
139
+ for (let i = 0; i < lines.length; i += 1) {
140
+ const line = (lines[i] ?? '').replace(/\r$/, '');
141
+ if (!regex.test(line))
142
+ continue;
143
+ matches.push({ path: display, lineNumber: i + 1, line: previewLine(line, maxLineBytes) });
144
+ }
145
+ }
146
+ return matches;
147
+ }
148
+ /** `match` / `matches` for a count. */
149
+ function matchNoun(count) {
150
+ return count === 1 ? 'match' : 'matches';
151
+ }
152
+ /** Group flat matches by file into the model-facing body. */
153
+ export function formatGrepMatches(matches) {
154
+ const byFile = new Map();
155
+ for (const match of matches) {
156
+ const group = byFile.get(match.path);
157
+ if (group)
158
+ group.push(match);
159
+ else
160
+ byFile.set(match.path, [match]);
161
+ }
162
+ const sections = [];
163
+ for (const [path, group] of byFile) {
164
+ sections.push(`${path}\n${group.map((m) => `Line ${m.lineNumber}: ${m.line}`).join('\n')}`);
165
+ }
166
+ return sections.join('\n\n');
167
+ }
168
+ /** Format the model-facing `grep` result, with the inline cap applied. */
169
+ export function renderGrepResult(matches, maxMatches) {
170
+ if (matches.length === 0)
171
+ return 'No matches found';
172
+ if (matches.length <= maxMatches) {
173
+ return `Found ${matches.length} ${matchNoun(matches.length)}\n\n${formatGrepMatches(matches)}`;
174
+ }
175
+ const kept = matches.slice(0, maxMatches);
176
+ return (`Found ${kept.length} of ${matches.length} matches\n\n${formatGrepMatches(kept)}` +
177
+ `\n\n(Narrow pattern, path, or include to see the rest.)`);
178
+ }
179
+ /** Format the model-facing `glob` result, with the inline cap applied. */
180
+ export function renderGlobResult(paths, maxResults) {
181
+ if (paths.length === 0)
182
+ return 'No files found';
183
+ if (paths.length <= maxResults)
184
+ return paths.join('\n');
185
+ return (`${paths.slice(0, maxResults).join('\n')}` +
186
+ `\n\n(Showing ${maxResults} of ${paths.length} paths; narrow pattern or path to see the rest.)`);
187
+ }
188
+ // ── presentation ──────────────────────────────────────────────────────────────
189
+ /** Narrow opaque result meta back to a search card view; malformed meta falls back. */
190
+ function searchViewFromMeta(meta) {
191
+ if (typeof meta !== 'object' || meta === null || Array.isArray(meta))
192
+ return undefined;
193
+ const record = meta;
194
+ const { truncated, total } = record;
195
+ if (typeof truncated !== 'boolean' || typeof total !== 'number')
196
+ return undefined;
197
+ if (record.shape === 'paths') {
198
+ const paths = record.paths;
199
+ if (!Array.isArray(paths) || !paths.every((p) => typeof p === 'string'))
200
+ return undefined;
201
+ return { card: 'search', shape: 'paths', paths, truncated, total };
202
+ }
203
+ if (record.shape === 'matches') {
204
+ const files = record.files;
205
+ if (!Array.isArray(files) || !files.every(isFileMatches))
206
+ return undefined;
207
+ return { card: 'search', shape: 'matches', files, truncated, total };
208
+ }
209
+ return undefined;
210
+ }
211
+ /** Whether `value` is one valid by-file match group (defensive meta narrowing). */
212
+ function isFileMatches(value) {
213
+ if (typeof value !== 'object' || value === null)
214
+ return false;
215
+ const { path, matches } = value;
216
+ if (typeof path !== 'string' || !Array.isArray(matches))
217
+ return false;
218
+ return matches.every((match) => {
219
+ if (typeof match !== 'object' || match === null)
220
+ return false;
221
+ const { lineNumber, line } = match;
222
+ return typeof lineNumber === 'number' && typeof line === 'string';
223
+ });
224
+ }
225
+ /** Group retained matches by file for the search card's `meta`. */
226
+ function grepMeta(matches, maxMatches) {
227
+ const kept = matches.slice(0, maxMatches);
228
+ const byFile = new Map();
229
+ for (const match of kept) {
230
+ const entry = { lineNumber: match.lineNumber, line: match.line };
231
+ const group = byFile.get(match.path);
232
+ if (group)
233
+ group.push(entry);
234
+ else
235
+ byFile.set(match.path, [entry]);
236
+ }
237
+ return {
238
+ shape: 'matches',
239
+ files: Array.from(byFile, ([path, fileMatches]) => ({ path, matches: fileMatches })),
240
+ truncated: matches.length > maxMatches,
241
+ total: matches.length,
242
+ };
243
+ }
244
+ /** The mounted Crowdy filesystem backend, or a clear miscomposition error. */
245
+ function requireCrowdyFs(ctx) {
246
+ const fs = ctx.fs;
247
+ if (fs instanceof CrowdyFileSystem)
248
+ return fs;
249
+ throw new Error('the Crowdy search tools require the Crowdy Studio filesystem backend ' +
250
+ '(@crowdy/dsh-cockpit) mounted as ctx.fs');
251
+ }
252
+ /**
253
+ * Register the Crowdy-backed `glob` / `grep` tool suite and its system-prompt
254
+ * guidance.
255
+ */
256
+ export async function apply(ctx, config) {
257
+ const globMaxResults = config.globMaxResults ?? 100;
258
+ const grepMaxMatches = config.grepMaxMatches ?? 250;
259
+ const grepMaxLineBytes = config.grepMaxLineBytes ?? 2000;
260
+ for (const [key, value] of Object.entries({ globMaxResults, grepMaxMatches, grepMaxLineBytes })) {
261
+ if (!Number.isInteger(value) || value < 1) {
262
+ throw new Error(`tool-fs-search-crowdy: ${key} must be a positive integer`);
263
+ }
264
+ }
265
+ const systemPrompt = ctx.systemPrompt;
266
+ systemPrompt.section({
267
+ name: 'tool:glob',
268
+ order: 103,
269
+ text: 'Use the glob tool to discover project files by path pattern. A pattern ' +
270
+ 'with no "/" matches basenames at any depth, so "*.rs" finds every Rust ' +
271
+ 'file in both targets. Paths come back relative to the project mount, in ' +
272
+ 'path order, and are directly readable with the read tool.',
273
+ });
274
+ systemPrompt.section({
275
+ name: 'tool:grep',
276
+ order: 104,
277
+ text: 'Use the grep tool to search project file contents with a regular ' +
278
+ 'expression. It searches the live Crowdy Studio project, the same files ' +
279
+ 'read and write operate on. Use read on a matched file when you need ' +
280
+ 'surrounding context.',
281
+ });
282
+ const glob = defineTool({
283
+ name: 'glob',
284
+ description: 'Find Crowdy Studio project files whose paths match a glob pattern. ' +
285
+ 'Returns matching file paths relative to the project mount, in path ' +
286
+ `order, up to ${globMaxResults} inline. A pattern with no "/" matches ` +
287
+ 'the basename at any depth. This searches the live project, not this ' +
288
+ "machine's disk.",
289
+ parameters: {
290
+ pattern: {
291
+ type: 'string',
292
+ required: true,
293
+ description: 'Glob pattern to match file paths against (e.g. "**/*.rs", ' +
294
+ '"server/src/*.rs", "*.{rs,toml}"). A pattern with no "/" matches ' +
295
+ 'the basename at any depth.',
296
+ },
297
+ path: {
298
+ type: 'string',
299
+ description: 'Directory to search in, relative to the project mount (e.g. ' +
300
+ '"server" or "client/src"). Defaults to the whole project.',
301
+ },
302
+ },
303
+ output: {
304
+ schema: {
305
+ type: 'object',
306
+ additionalProperties: false,
307
+ properties: {
308
+ root: { type: 'string', required: true },
309
+ paths: { type: 'array', required: true, items: { type: 'string' } },
310
+ },
311
+ },
312
+ render: (_args, value) => [
313
+ { type: 'text', text: renderGlobResult(value.paths, globMaxResults) },
314
+ ],
315
+ presentationMeta: (_args, value) => ({
316
+ shape: 'paths',
317
+ paths: value.paths.slice(0, globMaxResults),
318
+ truncated: value.paths.length > globMaxResults,
319
+ total: value.paths.length,
320
+ }),
321
+ },
322
+ async execute(args) {
323
+ const snapshot = await requireCrowdyFs(ctx).searchSnapshot();
324
+ const searchRoot = resolveSearchRoot(snapshot.root, args.path);
325
+ const paths = globProjectPaths(snapshot.files, snapshot.root, searchRoot, args.pattern);
326
+ return { root: args.path === undefined ? '.' : args.path, paths };
327
+ },
328
+ presentCall: (args) => ({
329
+ card: 'generic',
330
+ title: `Glob ${args.pattern}${args.path !== undefined ? ` in ${args.path}` : ''}`,
331
+ kind: 'search',
332
+ rawInput: args.pattern,
333
+ }),
334
+ presentResult: (_args, result) => {
335
+ if (result.isError)
336
+ return undefined;
337
+ const view = searchViewFromMeta(result.meta);
338
+ return view !== undefined && view.shape === 'paths' ? view : undefined;
339
+ },
340
+ });
341
+ ctx.tools.register(glob);
342
+ const grep = defineTool({
343
+ name: 'grep',
344
+ description: 'Search Crowdy Studio project file contents with a regular expression ' +
345
+ '(JavaScript syntax, matched per line). Returns matching lines with ' +
346
+ `line numbers, grouped by file, up to ${grepMaxMatches} inline. This ` +
347
+ "searches the live project, not this machine's disk. Use read on a " +
348
+ 'matched file for surrounding context.',
349
+ parameters: {
350
+ pattern: {
351
+ type: 'string',
352
+ required: true,
353
+ description: 'Regular expression to search for, matched against each line.',
354
+ },
355
+ path: {
356
+ type: 'string',
357
+ description: 'File or directory to search, relative to the project mount (e.g. ' +
358
+ '"server/src" or "client/Cargo.toml"). Defaults to the whole project.',
359
+ },
360
+ include: {
361
+ type: 'string',
362
+ description: 'One glob filter for which files to search (e.g. "*.rs", ' +
363
+ '"*.{rs,toml}"). Not a list; negation is not supported.',
364
+ },
365
+ },
366
+ output: {
367
+ schema: {
368
+ type: 'object',
369
+ additionalProperties: false,
370
+ properties: {
371
+ matches: {
372
+ type: 'array',
373
+ required: true,
374
+ items: {
375
+ type: 'object',
376
+ additionalProperties: false,
377
+ properties: {
378
+ path: { type: 'string', required: true },
379
+ lineNumber: { type: 'integer', required: true },
380
+ line: { type: 'string', required: true },
381
+ },
382
+ },
383
+ },
384
+ },
385
+ },
386
+ render: (_args, value) => [
387
+ { type: 'text', text: renderGrepResult(value.matches, grepMaxMatches) },
388
+ ],
389
+ presentationMeta: (_args, value) => grepMeta(value.matches, grepMaxMatches),
390
+ },
391
+ async execute(args) {
392
+ const snapshot = await requireCrowdyFs(ctx).searchSnapshot();
393
+ const searchRoot = resolveSearchRoot(snapshot.root, args.path);
394
+ const matches = grepProjectFiles(snapshot.files, snapshot.root, searchRoot, args.pattern, args.include, grepMaxLineBytes);
395
+ return { matches };
396
+ },
397
+ presentCall: (args) => ({
398
+ card: 'generic',
399
+ title: `Grep ${args.pattern}` +
400
+ (args.path !== undefined ? ` in ${args.path}` : '') +
401
+ (args.include !== undefined ? ` (${args.include})` : ''),
402
+ kind: 'search',
403
+ rawInput: args.pattern,
404
+ }),
405
+ presentResult: (_args, result) => {
406
+ if (result.isError)
407
+ return undefined;
408
+ const view = searchViewFromMeta(result.meta);
409
+ return view !== undefined && view.shape === 'matches' ? view : undefined;
410
+ },
411
+ });
412
+ ctx.tools.register(grep);
413
+ }
414
+ //# sourceMappingURL=search-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-tools.js","sourceRoot":"","sources":["../../src/search/search-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAQnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAW9D,qDAAqD;AACrD,MAAM,CAAC,MAAM,IAAI,GAAG,uBAAuB,CAAA;AAE3C,yDAAyD;AACzD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,CAAA;AAErD,MAAM,CAAC,MAAM,MAAM,GAAc,CAAC,CAAC,MAAM,CAAC;IACx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