
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@buger/probe
Advanced tools
A Node.js wrapper for the probe code search tool.
npm install @buger/probe
npm install -g @buger/probe
During installation, the package will automatically download the appropriate probe binary for your platform.
import { search, query, extract } from '@buger/probe';
// Search for code
const searchResults = await search({
path: '/path/to/your/project',
query: 'function',
maxResults: 10
});
// Query for specific code structures
const queryResults = await query({
path: '/path/to/your/project',
pattern: 'function $NAME($$$PARAMS) $$$BODY',
language: 'javascript'
});
// Extract code blocks
const extractResults = await extract({
files: ['/path/to/your/project/src/main.js:42']
});
When installed globally, the probe command will be available directly from the command line:
# Search for code
probe search "function" /path/to/your/project
# Query for specific code structures
probe query "function $NAME($$$PARAMS) $$$BODY" /path/to/your/project
# Extract code blocks
probe extract /path/to/your/project/src/main.js:42
# Run MCP server for AI assistant integration
probe mcp
The package installs the actual probe binary, not a JavaScript wrapper, so you get the full native performance and all features of the original probe CLI.
Probe includes a built-in MCP (Model Context Protocol) server for integration with AI assistants:
# Start the MCP server
probe mcp
# With custom timeout
probe mcp --timeout 60
Add to your AI assistant's MCP configuration:
{
"mcpServers": {
"probe": {
"command": "npx",
"args": ["-y", "@buger/probe", "mcp"]
}
}
}
import { search } from '@buger/probe';
const results = await search({
path: '/path/to/your/project',
query: 'function',
// Optional parameters
filesOnly: false,
ignore: ['node_modules', 'dist'],
excludeFilenames: false,
reranker: 'hybrid',
frequencySearch: true,
maxResults: 10,
maxBytes: 1000000,
maxTokens: 40000,
allowTests: false,
noMerge: false,
mergeThreshold: 5,
json: false,
binaryOptions: {
forceDownload: false,
version: '1.0.0'
}
});
path (required): Path to search inquery (required): Search query or queries (string or array of strings)filesOnly: Only output file pathsignore: Patterns to ignore (array of strings)excludeFilenames: Exclude filenames from searchreranker: Reranking method ('hybrid', 'hybrid2', 'bm25', 'tfidf')frequencySearch: Use frequency-based searchmaxResults: Maximum number of resultsmaxBytes: Maximum bytes to returnmaxTokens: Maximum tokens to returnallowTests: Include test filesnoMerge: Don't merge adjacent blocksmergeThreshold: Merge thresholdjson: Return results as parsed JSON instead of stringbinaryOptions: Options for getting the binary
forceDownload: Force download even if binary existsversion: Specific version to downloadimport { query } from '@buger/probe';
const results = await query({
path: '/path/to/your/project',
pattern: 'function $NAME($$$PARAMS) $$$BODY',
// Optional parameters
language: 'javascript',
ignore: ['node_modules', 'dist'],
allowTests: false,
maxResults: 10,
format: 'markdown',
json: false,
binaryOptions: {
forceDownload: false,
version: '1.0.0'
}
});
path (required): Path to search inpattern (required): The ast-grep pattern to search forlanguage: Programming language to search inignore: Patterns to ignore (array of strings)allowTests: Include test filesmaxResults: Maximum number of resultsformat: Output format ('markdown', 'plain', 'json', 'color')json: Return results as parsed JSON instead of stringbinaryOptions: Options for getting the binary
forceDownload: Force download even if binary existsversion: Specific version to downloadimport { extract } from '@buger/probe';
const results = await extract({
files: [
'/path/to/your/project/src/main.js',
'/path/to/your/project/src/utils.js:42' // Extract from line 42
],
// Optional parameters
allowTests: false,
contextLines: 2,
format: 'markdown',
json: false,
binaryOptions: {
forceDownload: false,
version: '1.0.0'
}
});
files (required): Files to extract from (can include line numbers with colon, e.g., "/path/to/file.rs:10")allowTests: Include test filescontextLines: Number of context lines to includeformat: Output format ('markdown', 'plain', 'json')json: Return results as parsed JSON instead of stringbinaryOptions: Options for getting the binary
forceDownload: Force download even if binary existsversion: Specific version to downloadimport { getBinaryPath, setBinaryPath } from '@buger/probe';
// Get the path to the probe binary
const binaryPath = await getBinaryPath({
forceDownload: false,
version: '1.0.0'
});
// Manually set the path to the probe binary
setBinaryPath('/path/to/probe/binary');
import { tools } from '@buger/probe';
// Vercel AI SDK tools
const { searchTool, queryTool, extractTool } = tools;
// LangChain tools
const searchLangChainTool = tools.createSearchTool();
const queryLangChainTool = tools.createQueryTool();
const extractLangChainTool = tools.createExtractTool();
// Access schemas
const { searchSchema, querySchema, extractSchema } = tools;
// Access default system message
const systemMessage = tools.DEFAULT_SYSTEM_MESSAGE;
searchTool: Tool for searching code using Elasticsearch-like query syntaxqueryTool: Tool for searching code using tree-sitter patternsextractTool: Tool for extracting code blocks from filescreateSearchTool(): Creates a tool for searching code using Elasticsearch-like query syntaxcreateQueryTool(): Creates a tool for searching code using tree-sitter patternscreateExtractTool(): Creates a tool for extracting code blocks from filessearchSchema: Zod schema for search tool parametersquerySchema: Zod schema for query tool parametersextractSchema: Zod schema for extract tool parametersDEFAULT_SYSTEM_MESSAGE: Default system message for AI assistants with instructions on how to use the probe toolsextractSchema: Zod schema for extract tool parametersimport { search } from '@buger/probe';
async function basicSearchExample() {
try {
const results = await search({
path: '/path/to/your/project',
query: 'function',
maxResults: 5
});
console.log('Search results:');
console.log(results);
} catch (error) {
console.error('Search error:', error);
}
}
import { search } from '@buger/probe';
async function advancedSearchExample() {
try {
const results = await search({
path: '/path/to/your/project',
query: 'config AND (parse OR tokenize)',
ignore: ['node_modules', 'dist'],
reranker: 'hybrid',
frequencySearch: true,
maxResults: 10,
maxTokens: 20000,
allowTests: false
});
console.log('Advanced search results:');
console.log(results);
} catch (error) {
console.error('Advanced search error:', error);
}
}
import { query } from '@buger/probe';
async function queryExample() {
try {
// Find all JavaScript functions
const jsResults = await query({
path: '/path/to/your/project',
pattern: 'function $NAME($$$PARAMS) $$$BODY',
language: 'javascript',
maxResults: 5
});
console.log('JavaScript functions:');
console.log(jsResults);
// Find all Rust structs
const rustResults = await query({
path: '/path/to/your/project',
pattern: 'struct $NAME $$$BODY',
language: 'rust',
maxResults: 5
});
console.log('Rust structs:');
console.log(rustResults);
} catch (error) {
console.error('Query error:', error);
}
}
import { extract } from '@buger/probe';
async function extractExample() {
try {
const results = await extract({
files: [
'/path/to/your/project/src/main.js',
'/path/to/your/project/src/utils.js:42' // Extract from line 42
],
contextLines: 2,
format: 'markdown'
});
console.log('Extracted code:');
console.log(results);
} catch (error) {
console.error('Extract error:', error);
}
}
When you install this package:
This approach ensures that you get the actual native binary, not a JavaScript wrapper, providing full performance and all features of the original probe CLI.
The package provides built-in tools for integrating with AI SDKs like Vercel AI SDK and LangChain, allowing you to use probe's powerful code search capabilities in AI applications.
import { generateText } from 'ai';
import { tools } from '@buger/probe';
// Use the pre-built tools with Vercel AI SDK
async function chatWithAI(userMessage) {
const result = await generateText({
model: provider(modelName),
messages: [{ role: 'user', content: userMessage }],
system: "You are a code intelligence assistant. Use the provided tools to search and analyze code.",
tools: {
search: tools.searchTool,
query: tools.queryTool,
extract: tools.extractTool
},
maxSteps: 15,
temperature: 0.7
});
return result.text;
}
import { ChatOpenAI } from '@langchain/openai';
import { tools } from '@buger/probe';
// Create the LangChain tools
const searchTool = tools.createSearchTool();
const queryTool = tools.createQueryTool();
const extractTool = tools.createExtractTool();
// Create a ChatOpenAI instance with tools
const model = new ChatOpenAI({
modelName: "gpt-4o",
temperature: 0.7
}).withTools([searchTool, queryTool, extractTool]);
// Use the model with tools
async function chatWithAI(userMessage) {
const result = await model.invoke([
{ role: "system", content: "You are a code intelligence assistant. Use the provided tools to search and analyze code." },
{ role: "user", content: userMessage }
]);
return result.content;
}
The package provides a default system message that you can use with your AI assistants:
import { tools } from '@buger/probe';
// Use the default system message in your AI application
const systemMessage = tools.DEFAULT_SYSTEM_MESSAGE;
// Example with Vercel AI SDK
const result = await generateText({
model: provider(modelName),
messages: [{ role: 'user', content: userMessage }],
system: tools.DEFAULT_SYSTEM_MESSAGE,
tools: {
search: tools.searchTool,
query: tools.queryTool,
extract: tools.extractTool
}
});
The default system message provides instructions for AI assistants on how to use the probe tools effectively, including search query formatting, tool execution sequence, and best practices.
ISC
If you're migrating from the standalone @buger/probe-mcp package, probe mcp is a drop-in replacement:
Old usage:
npx @buger/probe-mcp
# or
probe-mcp --timeout 60
New usage (drop-in replacement):
probe mcp
# or
probe mcp --timeout 60
MCP Configuration:
// Old configuration
{
"mcpServers": {
"probe": {
"command": "npx",
"args": ["-y", "@buger/probe-mcp"]
}
}
}
// New configuration (drop-in replacement)
{
"mcpServers": {
"probe": {
"command": "npx",
"args": ["-y", "@buger/probe", "mcp"]
}
}
}
FAQs
Node.js wrapper for the probe code search tool
We found that @buger/probe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.