pi-lens 1.3.0 → 1.3.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.
- package/index.ts +9 -7
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -263,11 +263,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
263
263
|
pi.registerTool({
|
|
264
264
|
name: "ast_grep_search",
|
|
265
265
|
label: "AST Search",
|
|
266
|
-
description: "Search code
|
|
266
|
+
description: "Search code using AST-aware pattern matching. IMPORTANT: Use specific AST patterns, NOT text search. Examples:\n- Find function: 'function $NAME() { $$$BODY }'\n- Find call: 'fetchMetrics($ARGS)'\n- Find import: 'import { $NAMES } from \"$PATH\"'\n- Generic identifier (broad): 'fetchMetrics'\n\nAlways prefer specific patterns with context over bare identifiers. Use 'paths' to scope to specific files/folders.",
|
|
267
|
+
promptSnippet: "Use ast_grep_search for AST-aware code search",
|
|
267
268
|
parameters: Type.Object({
|
|
268
|
-
pattern: Type.String({ description: "AST pattern
|
|
269
|
+
pattern: Type.String({ description: "AST pattern (use function/class/call context, not text)" }),
|
|
269
270
|
lang: Type.Union(LANGUAGES.map((l) => Type.Literal(l)), { description: "Target language" }),
|
|
270
|
-
paths: Type.Optional(Type.Array(Type.String(), { description: "
|
|
271
|
+
paths: Type.Optional(Type.Array(Type.String(), { description: "Specific files/folders to search" })),
|
|
271
272
|
}),
|
|
272
273
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
273
274
|
if (!astGrepClient.isAvailable()) {
|
|
@@ -290,12 +291,13 @@ export default function (pi: ExtensionAPI) {
|
|
|
290
291
|
pi.registerTool({
|
|
291
292
|
name: "ast_grep_replace",
|
|
292
293
|
label: "AST Replace",
|
|
293
|
-
description: "Replace code
|
|
294
|
+
description: "Replace code using AST-aware pattern matching. IMPORTANT: Use specific AST patterns, not text. Dry-run by default (use apply=true to apply).\n\nExamples:\n- pattern='console.log($MSG)' rewrite='logger.info($MSG)'\n- pattern='var $X' rewrite='let $X'\n- pattern='function $NAME() { }' rewrite='' (delete)\n\nAlways use 'paths' to scope to specific files/folders. Dry-run first to preview changes.",
|
|
295
|
+
promptSnippet: "Use ast_grep_replace for AST-aware find-and-replace",
|
|
294
296
|
parameters: Type.Object({
|
|
295
|
-
pattern: Type.String({ description: "AST pattern to match" }),
|
|
296
|
-
rewrite: Type.String({ description: "Replacement pattern" }),
|
|
297
|
+
pattern: Type.String({ description: "AST pattern to match (be specific with context)" }),
|
|
298
|
+
rewrite: Type.String({ description: "Replacement using meta-variables from pattern" }),
|
|
297
299
|
lang: Type.Union(LANGUAGES.map((l) => Type.Literal(l)), { description: "Target language" }),
|
|
298
|
-
paths: Type.Optional(Type.Array(Type.String(), { description: "
|
|
300
|
+
paths: Type.Optional(Type.Array(Type.String(), { description: "Specific files/folders" })),
|
|
299
301
|
apply: Type.Optional(Type.Boolean({ description: "Apply changes (default: false)" })),
|
|
300
302
|
}),
|
|
301
303
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
package/package.json
CHANGED