@rdmind/rdmind 0.0.21-alpha.0 → 0.0.21-alpha.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/cli.js +192 -194
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -183747,7 +183747,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
183747
183747
|
};
|
|
183748
183748
|
}
|
|
183749
183749
|
async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
183750
|
-
const version2 = "0.0.21-alpha.
|
|
183750
|
+
const version2 = "0.0.21-alpha.2";
|
|
183751
183751
|
const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
183752
183752
|
const baseHeaders = {
|
|
183753
183753
|
"User-Agent": userAgent2
|
|
@@ -185643,7 +185643,7 @@ var init_tool_names = __esm({
|
|
|
185643
185643
|
WRITE_FILE: "write_file",
|
|
185644
185644
|
READ_FILE: "read_file",
|
|
185645
185645
|
READ_MANY_FILES: "read_many_files",
|
|
185646
|
-
GREP: "
|
|
185646
|
+
GREP: "grep_search",
|
|
185647
185647
|
GLOB: "glob",
|
|
185648
185648
|
SHELL: "run_shell_command",
|
|
185649
185649
|
TODO_WRITE: "todo_write",
|
|
@@ -233968,10 +233968,20 @@ function getRipgrepPath() {
|
|
|
233968
233968
|
);
|
|
233969
233969
|
return vendorPath;
|
|
233970
233970
|
}
|
|
233971
|
-
async function canUseRipgrep() {
|
|
233971
|
+
async function canUseRipgrep(useBuiltin = true) {
|
|
233972
233972
|
try {
|
|
233973
|
-
|
|
233974
|
-
|
|
233973
|
+
if (useBuiltin) {
|
|
233974
|
+
const rgPath = getRipgrepPath();
|
|
233975
|
+
if (await fileExists(rgPath)) {
|
|
233976
|
+
return true;
|
|
233977
|
+
}
|
|
233978
|
+
}
|
|
233979
|
+
const { spawn: spawn13 } = await import("node:child_process");
|
|
233980
|
+
return await new Promise((resolve25) => {
|
|
233981
|
+
const proc2 = spawn13("rg", ["--version"]);
|
|
233982
|
+
proc2.on("error", () => resolve25(false));
|
|
233983
|
+
proc2.on("exit", (code2) => resolve25(code2 === 0));
|
|
233984
|
+
});
|
|
233975
233985
|
} catch (_error) {
|
|
233976
233986
|
return false;
|
|
233977
233987
|
}
|
|
@@ -234006,17 +234016,19 @@ import fs36 from "node:fs";
|
|
|
234006
234016
|
import path40 from "node:path";
|
|
234007
234017
|
import { EOL as EOL3 } from "node:os";
|
|
234008
234018
|
import { spawn as spawn6 } from "node:child_process";
|
|
234009
|
-
var
|
|
234019
|
+
var MAX_LLM_CONTENT_LENGTH, GrepToolInvocation2, RipGrepTool;
|
|
234010
234020
|
var init_ripGrep = __esm({
|
|
234011
234021
|
"packages/core/src/tools/ripGrep.ts"() {
|
|
234012
234022
|
"use strict";
|
|
234013
234023
|
init_esbuild_shims();
|
|
234014
234024
|
init_tools();
|
|
234015
|
-
|
|
234025
|
+
init_tool_names();
|
|
234016
234026
|
init_paths();
|
|
234017
234027
|
init_errors();
|
|
234018
234028
|
init_ripgrepUtils();
|
|
234019
|
-
|
|
234029
|
+
init_schemaValidator();
|
|
234030
|
+
init_constants3();
|
|
234031
|
+
MAX_LLM_CONTENT_LENGTH = 2e4;
|
|
234020
234032
|
GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
234021
234033
|
constructor(config, params) {
|
|
234022
234034
|
super(params);
|
|
@@ -234028,14 +234040,12 @@ var init_ripGrep = __esm({
|
|
|
234028
234040
|
/**
|
|
234029
234041
|
* Checks if a path is within the root directory and resolves it.
|
|
234030
234042
|
* @param relativePath Path relative to the root directory (or undefined for root).
|
|
234031
|
-
* @returns The absolute path
|
|
234043
|
+
* @returns The absolute path to search within.
|
|
234032
234044
|
* @throws {Error} If path is outside root, doesn't exist, or isn't a directory.
|
|
234033
234045
|
*/
|
|
234034
234046
|
resolveAndValidatePath(relativePath) {
|
|
234035
|
-
|
|
234036
|
-
|
|
234037
|
-
}
|
|
234038
|
-
const targetPath = path40.resolve(this.config.getTargetDir(), relativePath);
|
|
234047
|
+
const targetDir = this.config.getTargetDir();
|
|
234048
|
+
const targetPath = relativePath ? path40.resolve(targetDir, relativePath) : targetDir;
|
|
234039
234049
|
const workspaceContext = this.config.getWorkspaceContext();
|
|
234040
234050
|
if (!workspaceContext.isPathWithinWorkspace(targetPath)) {
|
|
234041
234051
|
const directories = workspaceContext.getDirectories();
|
|
@@ -234043,6 +234053,9 @@ var init_ripGrep = __esm({
|
|
|
234043
234053
|
`Path validation failed: Attempted path "${relativePath}" resolves outside the allowed workspace directories: ${directories.join(", ")}`
|
|
234044
234054
|
);
|
|
234045
234055
|
}
|
|
234056
|
+
return this.ensureDirectory(targetPath);
|
|
234057
|
+
}
|
|
234058
|
+
ensureDirectory(targetPath) {
|
|
234046
234059
|
try {
|
|
234047
234060
|
const stats = fs36.statSync(targetPath);
|
|
234048
234061
|
if (!stats.isDirectory()) {
|
|
@@ -234060,85 +234073,50 @@ var init_ripGrep = __esm({
|
|
|
234060
234073
|
}
|
|
234061
234074
|
async execute(signal) {
|
|
234062
234075
|
try {
|
|
234063
|
-
const workspaceContext = this.config.getWorkspaceContext();
|
|
234064
234076
|
const searchDirAbs = this.resolveAndValidatePath(this.params.path);
|
|
234065
234077
|
const searchDirDisplay = this.params.path || ".";
|
|
234066
|
-
|
|
234067
|
-
|
|
234068
|
-
|
|
234069
|
-
|
|
234070
|
-
|
|
234071
|
-
}
|
|
234072
|
-
|
|
234073
|
-
const
|
|
234074
|
-
if (
|
|
234075
|
-
|
|
234076
|
-
}
|
|
234077
|
-
for (const searchDir of searchDirectories) {
|
|
234078
|
-
const searchResult = await this.performRipgrepSearch({
|
|
234079
|
-
pattern: this.params.pattern,
|
|
234080
|
-
path: searchDir,
|
|
234081
|
-
include: this.params.include,
|
|
234082
|
-
signal
|
|
234083
|
-
});
|
|
234084
|
-
if (searchDirectories.length > 1) {
|
|
234085
|
-
const dirName = path40.basename(searchDir);
|
|
234086
|
-
searchResult.forEach((match2) => {
|
|
234087
|
-
match2.filePath = path40.join(dirName, match2.filePath);
|
|
234088
|
-
});
|
|
234089
|
-
}
|
|
234090
|
-
allMatches = allMatches.concat(searchResult);
|
|
234091
|
-
if (allMatches.length >= totalMaxMatches) {
|
|
234092
|
-
allMatches = allMatches.slice(0, totalMaxMatches);
|
|
234093
|
-
break;
|
|
234094
|
-
}
|
|
234095
|
-
}
|
|
234096
|
-
let searchLocationDescription;
|
|
234097
|
-
if (searchDirAbs === null) {
|
|
234098
|
-
const numDirs = workspaceContext.getDirectories().length;
|
|
234099
|
-
searchLocationDescription = numDirs > 1 ? `across ${numDirs} workspace directories` : `in the workspace directory`;
|
|
234100
|
-
} else {
|
|
234101
|
-
searchLocationDescription = `in path "${searchDirDisplay}"`;
|
|
234102
|
-
}
|
|
234103
|
-
if (allMatches.length === 0) {
|
|
234104
|
-
const noMatchMsg = `No matches found for pattern "${this.params.pattern}" ${searchLocationDescription}${this.params.include ? ` (filter: "${this.params.include}")` : ""}.`;
|
|
234078
|
+
const rawOutput = await this.performRipgrepSearch({
|
|
234079
|
+
pattern: this.params.pattern,
|
|
234080
|
+
path: searchDirAbs,
|
|
234081
|
+
glob: this.params.glob,
|
|
234082
|
+
signal
|
|
234083
|
+
});
|
|
234084
|
+
const searchLocationDescription = this.params.path ? `in path "${searchDirDisplay}"` : `in the workspace directory`;
|
|
234085
|
+
const filterDescription = this.params.glob ? ` (filter: "${this.params.glob}")` : "";
|
|
234086
|
+
if (!rawOutput.trim()) {
|
|
234087
|
+
const noMatchMsg = `No matches found for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}.`;
|
|
234105
234088
|
return { llmContent: noMatchMsg, returnDisplay: `No matches found` };
|
|
234106
234089
|
}
|
|
234107
|
-
const
|
|
234108
|
-
const
|
|
234109
|
-
|
|
234110
|
-
|
|
234111
|
-
if (!acc[fileKey]) {
|
|
234112
|
-
acc[fileKey] = [];
|
|
234113
|
-
}
|
|
234114
|
-
acc[fileKey].push(match2);
|
|
234115
|
-
acc[fileKey].sort((a, b) => a.lineNumber - b.lineNumber);
|
|
234116
|
-
return acc;
|
|
234117
|
-
},
|
|
234118
|
-
{}
|
|
234119
|
-
);
|
|
234120
|
-
const matchCount = allMatches.length;
|
|
234121
|
-
const matchTerm = matchCount === 1 ? "match" : "matches";
|
|
234122
|
-
let llmContent = `Found ${matchCount} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${this.params.include ? ` (filter: "${this.params.include}")` : ""}`;
|
|
234123
|
-
if (wasTruncated) {
|
|
234124
|
-
llmContent += ` (results limited to ${totalMaxMatches} matches for performance)`;
|
|
234125
|
-
}
|
|
234126
|
-
llmContent += `:
|
|
234090
|
+
const allLines = rawOutput.split(EOL3).filter((line) => line.trim());
|
|
234091
|
+
const totalMatches = allLines.length;
|
|
234092
|
+
const matchTerm = totalMatches === 1 ? "match" : "matches";
|
|
234093
|
+
const header = `Found ${totalMatches} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}:
|
|
234127
234094
|
---
|
|
234128
234095
|
`;
|
|
234129
|
-
|
|
234130
|
-
|
|
234131
|
-
|
|
234132
|
-
|
|
234133
|
-
|
|
234134
|
-
|
|
234135
|
-
|
|
234136
|
-
|
|
234137
|
-
|
|
234138
|
-
|
|
234139
|
-
|
|
234140
|
-
|
|
234141
|
-
|
|
234096
|
+
const maxTruncationNoticeLength = 100;
|
|
234097
|
+
const maxGrepOutputLength = MAX_LLM_CONTENT_LENGTH - header.length - maxTruncationNoticeLength;
|
|
234098
|
+
let truncatedByLineLimit = false;
|
|
234099
|
+
let linesToInclude = allLines;
|
|
234100
|
+
if (this.params.limit !== void 0 && allLines.length > this.params.limit) {
|
|
234101
|
+
linesToInclude = allLines.slice(0, this.params.limit);
|
|
234102
|
+
truncatedByLineLimit = true;
|
|
234103
|
+
}
|
|
234104
|
+
let grepOutput = linesToInclude.join(EOL3);
|
|
234105
|
+
let truncatedByCharLimit = false;
|
|
234106
|
+
if (grepOutput.length > maxGrepOutputLength) {
|
|
234107
|
+
grepOutput = grepOutput.slice(0, maxGrepOutputLength) + "...";
|
|
234108
|
+
truncatedByCharLimit = true;
|
|
234109
|
+
}
|
|
234110
|
+
const finalLines = grepOutput.split(EOL3).filter((line) => line.trim());
|
|
234111
|
+
const includedLines = finalLines.length;
|
|
234112
|
+
let llmContent = header + grepOutput;
|
|
234113
|
+
if (truncatedByLineLimit || truncatedByCharLimit) {
|
|
234114
|
+
const omittedMatches = totalMatches - includedLines;
|
|
234115
|
+
llmContent += ` [${omittedMatches} ${omittedMatches === 1 ? "line" : "lines"} truncated] ...`;
|
|
234116
|
+
}
|
|
234117
|
+
let displayMessage = `Found ${totalMatches} ${matchTerm}`;
|
|
234118
|
+
if (truncatedByLineLimit || truncatedByCharLimit) {
|
|
234119
|
+
displayMessage += ` (truncated)`;
|
|
234142
234120
|
}
|
|
234143
234121
|
return {
|
|
234144
234122
|
llmContent: llmContent.trim(),
|
|
@@ -234153,37 +234131,8 @@ var init_ripGrep = __esm({
|
|
|
234153
234131
|
};
|
|
234154
234132
|
}
|
|
234155
234133
|
}
|
|
234156
|
-
parseRipgrepOutput(output, basePath) {
|
|
234157
|
-
const results = [];
|
|
234158
|
-
if (!output) return results;
|
|
234159
|
-
const lines = output.split(EOL3);
|
|
234160
|
-
for (const line of lines) {
|
|
234161
|
-
if (!line.trim()) continue;
|
|
234162
|
-
const firstColonIndex = line.indexOf(":");
|
|
234163
|
-
if (firstColonIndex === -1) continue;
|
|
234164
|
-
const secondColonIndex = line.indexOf(":", firstColonIndex + 1);
|
|
234165
|
-
if (secondColonIndex === -1) continue;
|
|
234166
|
-
const filePathRaw = line.substring(0, firstColonIndex);
|
|
234167
|
-
const lineNumberStr = line.substring(
|
|
234168
|
-
firstColonIndex + 1,
|
|
234169
|
-
secondColonIndex
|
|
234170
|
-
);
|
|
234171
|
-
const lineContent = line.substring(secondColonIndex + 1);
|
|
234172
|
-
const lineNumber = parseInt(lineNumberStr, 10);
|
|
234173
|
-
if (!isNaN(lineNumber)) {
|
|
234174
|
-
const absoluteFilePath = path40.resolve(basePath, filePathRaw);
|
|
234175
|
-
const relativeFilePath = path40.relative(basePath, absoluteFilePath);
|
|
234176
|
-
results.push({
|
|
234177
|
-
filePath: relativeFilePath || path40.basename(absoluteFilePath),
|
|
234178
|
-
lineNumber,
|
|
234179
|
-
line: lineContent
|
|
234180
|
-
});
|
|
234181
|
-
}
|
|
234182
|
-
}
|
|
234183
|
-
return results;
|
|
234184
|
-
}
|
|
234185
234134
|
async performRipgrepSearch(options2) {
|
|
234186
|
-
const { pattern, path: absolutePath,
|
|
234135
|
+
const { pattern, path: absolutePath, glob: glob2 } = options2;
|
|
234187
234136
|
const rgArgs = [
|
|
234188
234137
|
"--line-number",
|
|
234189
234138
|
"--no-heading",
|
|
@@ -234192,26 +234141,26 @@ var init_ripGrep = __esm({
|
|
|
234192
234141
|
"--regexp",
|
|
234193
234142
|
pattern
|
|
234194
234143
|
];
|
|
234195
|
-
|
|
234196
|
-
|
|
234197
|
-
|
|
234198
|
-
|
|
234199
|
-
|
|
234200
|
-
|
|
234201
|
-
|
|
234202
|
-
|
|
234203
|
-
|
|
234204
|
-
|
|
234205
|
-
|
|
234206
|
-
|
|
234207
|
-
|
|
234208
|
-
|
|
234209
|
-
rgArgs.push("--glob",
|
|
234210
|
-
}
|
|
234144
|
+
const filteringOptions = this.getFileFilteringOptions();
|
|
234145
|
+
if (!filteringOptions.respectGitIgnore) {
|
|
234146
|
+
rgArgs.push("--no-ignore-vcs");
|
|
234147
|
+
}
|
|
234148
|
+
if (filteringOptions.respectQwenIgnore) {
|
|
234149
|
+
const qwenIgnorePath = path40.join(
|
|
234150
|
+
this.config.getTargetDir(),
|
|
234151
|
+
".qwenignore"
|
|
234152
|
+
);
|
|
234153
|
+
if (fs36.existsSync(qwenIgnorePath)) {
|
|
234154
|
+
rgArgs.push("--ignore-file", qwenIgnorePath);
|
|
234155
|
+
}
|
|
234156
|
+
}
|
|
234157
|
+
if (glob2) {
|
|
234158
|
+
rgArgs.push("--glob", glob2);
|
|
234159
|
+
}
|
|
234211
234160
|
rgArgs.push("--threads", "4");
|
|
234212
234161
|
rgArgs.push(absolutePath);
|
|
234213
234162
|
try {
|
|
234214
|
-
const rgPath = await ensureRipgrepPath();
|
|
234163
|
+
const rgPath = this.config.getUseBuiltinRipgrep() ? await ensureRipgrepPath() : "rg";
|
|
234215
234164
|
const output = await new Promise((resolve25, reject) => {
|
|
234216
234165
|
const child = spawn6(rgPath, rgArgs, {
|
|
234217
234166
|
windowsHide: true
|
|
@@ -234245,21 +234194,27 @@ var init_ripGrep = __esm({
|
|
|
234245
234194
|
}
|
|
234246
234195
|
});
|
|
234247
234196
|
});
|
|
234248
|
-
return
|
|
234197
|
+
return output;
|
|
234249
234198
|
} catch (error) {
|
|
234250
234199
|
console.error(`GrepLogic: ripgrep failed: ${getErrorMessage(error)}`);
|
|
234251
234200
|
throw error;
|
|
234252
234201
|
}
|
|
234253
234202
|
}
|
|
234203
|
+
getFileFilteringOptions() {
|
|
234204
|
+
const options2 = this.config.getFileFilteringOptions?.();
|
|
234205
|
+
return {
|
|
234206
|
+
respectGitIgnore: options2?.respectGitIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectGitIgnore,
|
|
234207
|
+
respectQwenIgnore: options2?.respectQwenIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectQwenIgnore
|
|
234208
|
+
};
|
|
234209
|
+
}
|
|
234254
234210
|
/**
|
|
234255
234211
|
* Gets a description of the grep operation
|
|
234256
|
-
* @param params Parameters for the grep operation
|
|
234257
234212
|
* @returns A string describing the grep
|
|
234258
234213
|
*/
|
|
234259
234214
|
getDescription() {
|
|
234260
234215
|
let description = `'${this.params.pattern}'`;
|
|
234261
|
-
if (this.params.
|
|
234262
|
-
description += ` in ${this.params.
|
|
234216
|
+
if (this.params.glob) {
|
|
234217
|
+
description += ` in ${this.params.glob}`;
|
|
234263
234218
|
}
|
|
234264
234219
|
if (this.params.path) {
|
|
234265
234220
|
const resolvedPath = path40.resolve(
|
|
@@ -234289,22 +234244,26 @@ var init_ripGrep = __esm({
|
|
|
234289
234244
|
constructor(config) {
|
|
234290
234245
|
super(
|
|
234291
234246
|
_RipGrepTool.Name,
|
|
234292
|
-
"
|
|
234293
|
-
|
|
234247
|
+
"Grep",
|
|
234248
|
+
'A powerful search tool built on ripgrep\n\n Usage:\n - ALWAYS use Grep for search tasks. NEVER invoke `grep` or `rg` as a Bash command. The Grep tool has been optimized for correct permissions and access.\n - Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")\n - Filter files with glob parameter (e.g., "*.js", "**/*.tsx")\n - Use Task tool for open-ended searches requiring multiple rounds\n - Pattern syntax: Uses ripgrep (not grep) - special regex characters need escaping (use `interface\\{\\}` to find `interface{}` in Go code)\n',
|
|
234294
234249
|
"search" /* Search */,
|
|
234295
234250
|
{
|
|
234296
234251
|
properties: {
|
|
234297
234252
|
pattern: {
|
|
234298
|
-
|
|
234299
|
-
|
|
234253
|
+
type: "string",
|
|
234254
|
+
description: "The regular expression pattern to search for in file contents"
|
|
234255
|
+
},
|
|
234256
|
+
glob: {
|
|
234257
|
+
type: "string",
|
|
234258
|
+
description: 'Glob pattern to filter files (e.g. "*.js", "*.{ts,tsx}") - maps to rg --glob'
|
|
234300
234259
|
},
|
|
234301
234260
|
path: {
|
|
234302
|
-
|
|
234303
|
-
|
|
234261
|
+
type: "string",
|
|
234262
|
+
description: "File or directory to search in (rg PATH). Defaults to current working directory."
|
|
234304
234263
|
},
|
|
234305
|
-
|
|
234306
|
-
|
|
234307
|
-
|
|
234264
|
+
limit: {
|
|
234265
|
+
type: "number",
|
|
234266
|
+
description: "Limit output to first N lines/entries. Optional - shows all matches if not specified."
|
|
234308
234267
|
}
|
|
234309
234268
|
},
|
|
234310
234269
|
required: ["pattern"],
|
|
@@ -234316,16 +234275,16 @@ var init_ripGrep = __esm({
|
|
|
234316
234275
|
static {
|
|
234317
234276
|
__name(this, "RipGrepTool");
|
|
234318
234277
|
}
|
|
234319
|
-
static Name =
|
|
234278
|
+
static Name = ToolNames.GREP;
|
|
234320
234279
|
/**
|
|
234321
234280
|
* Checks if a path is within the root directory and resolves it.
|
|
234322
234281
|
* @param relativePath Path relative to the root directory (or undefined for root).
|
|
234323
|
-
* @returns The absolute path
|
|
234282
|
+
* @returns The absolute path to search within.
|
|
234324
234283
|
* @throws {Error} If path is outside root, doesn't exist, or isn't a directory.
|
|
234325
234284
|
*/
|
|
234326
234285
|
resolveAndValidatePath(relativePath) {
|
|
234327
234286
|
if (!relativePath) {
|
|
234328
|
-
return
|
|
234287
|
+
return this.config.getTargetDir();
|
|
234329
234288
|
}
|
|
234330
234289
|
const targetPath = path40.resolve(this.config.getTargetDir(), relativePath);
|
|
234331
234290
|
const workspaceContext = this.config.getWorkspaceContext();
|
|
@@ -234355,7 +234314,7 @@ var init_ripGrep = __esm({
|
|
|
234355
234314
|
* @param params Parameters to validate
|
|
234356
234315
|
* @returns An error message string if invalid, null otherwise
|
|
234357
234316
|
*/
|
|
234358
|
-
|
|
234317
|
+
validateToolParamValues(params) {
|
|
234359
234318
|
const errors = SchemaValidator.validate(
|
|
234360
234319
|
this.schema.parametersJsonSchema,
|
|
234361
234320
|
params
|
|
@@ -234363,6 +234322,11 @@ var init_ripGrep = __esm({
|
|
|
234363
234322
|
if (errors) {
|
|
234364
234323
|
return errors;
|
|
234365
234324
|
}
|
|
234325
|
+
try {
|
|
234326
|
+
new RegExp(params.pattern);
|
|
234327
|
+
} catch (error) {
|
|
234328
|
+
return `Invalid regular expression pattern: ${params.pattern}. Error: ${getErrorMessage(error)}`;
|
|
234329
|
+
}
|
|
234366
234330
|
if (params.path) {
|
|
234367
234331
|
try {
|
|
234368
234332
|
this.resolveAndValidatePath(params.path);
|
|
@@ -247285,6 +247249,7 @@ var init_config3 = __esm({
|
|
|
247285
247249
|
interactive;
|
|
247286
247250
|
trustedFolder;
|
|
247287
247251
|
useRipgrep;
|
|
247252
|
+
useBuiltinRipgrep;
|
|
247288
247253
|
shouldUseNodePtyShell;
|
|
247289
247254
|
skipNextSpeakerCheck;
|
|
247290
247255
|
shellExecutionConfig;
|
|
@@ -247375,11 +247340,10 @@ var init_config3 = __esm({
|
|
|
247375
247340
|
this.chatCompression = params.chatCompression;
|
|
247376
247341
|
this.interactive = params.interactive ?? false;
|
|
247377
247342
|
this.trustedFolder = params.trustedFolder;
|
|
247378
|
-
this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ?? false;
|
|
247379
|
-
this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? false;
|
|
247380
247343
|
this.skipLoopDetection = params.skipLoopDetection ?? false;
|
|
247381
247344
|
this.tavilyApiKey = params.tavilyApiKey;
|
|
247382
247345
|
this.useRipgrep = params.useRipgrep ?? true;
|
|
247346
|
+
this.useBuiltinRipgrep = params.useBuiltinRipgrep ?? true;
|
|
247383
247347
|
this.shouldUseNodePtyShell = params.shouldUseNodePtyShell ?? false;
|
|
247384
247348
|
this.skipNextSpeakerCheck = params.skipNextSpeakerCheck ?? true;
|
|
247385
247349
|
this.shellExecutionConfig = {
|
|
@@ -247762,6 +247726,9 @@ var init_config3 = __esm({
|
|
|
247762
247726
|
getUseRipgrep() {
|
|
247763
247727
|
return this.useRipgrep;
|
|
247764
247728
|
}
|
|
247729
|
+
getUseBuiltinRipgrep() {
|
|
247730
|
+
return this.useBuiltinRipgrep;
|
|
247731
|
+
}
|
|
247765
247732
|
getShouldUseNodePtyShell() {
|
|
247766
247733
|
return this.shouldUseNodePtyShell;
|
|
247767
247734
|
}
|
|
@@ -247854,13 +247821,14 @@ var init_config3 = __esm({
|
|
|
247854
247821
|
let useRipgrep = false;
|
|
247855
247822
|
let errorString = void 0;
|
|
247856
247823
|
try {
|
|
247857
|
-
useRipgrep = await canUseRipgrep();
|
|
247824
|
+
useRipgrep = await canUseRipgrep(this.getUseBuiltinRipgrep());
|
|
247858
247825
|
} catch (error) {
|
|
247859
247826
|
errorString = String(error);
|
|
247860
247827
|
}
|
|
247861
247828
|
if (useRipgrep) {
|
|
247862
247829
|
registerCoreTool(RipGrepTool, this);
|
|
247863
247830
|
} else {
|
|
247831
|
+
errorString = errorString || "Ripgrep is not available. Please install ripgrep globally.";
|
|
247864
247832
|
logRipgrepFallback(this, new RipgrepFallbackEvent(errorString));
|
|
247865
247833
|
registerCoreTool(GrepTool, this);
|
|
247866
247834
|
}
|
|
@@ -255591,6 +255559,7 @@ var init_src = __esm({
|
|
|
255591
255559
|
init_textUtils();
|
|
255592
255560
|
init_formatters();
|
|
255593
255561
|
init_generateContentResponseUtilities();
|
|
255562
|
+
init_ripgrepUtils();
|
|
255594
255563
|
init_fileSearch();
|
|
255595
255564
|
init_errorParsing();
|
|
255596
255565
|
init_workspaceContext();
|
|
@@ -319943,7 +319912,7 @@ init_esbuild_shims();
|
|
|
319943
319912
|
|
|
319944
319913
|
// packages/cli/src/generated/git-commit.ts
|
|
319945
319914
|
init_esbuild_shims();
|
|
319946
|
-
var GIT_COMMIT_INFO2 = "
|
|
319915
|
+
var GIT_COMMIT_INFO2 = "9f074b0b";
|
|
319947
319916
|
|
|
319948
319917
|
// packages/cli/src/ui/components/AboutBox.tsx
|
|
319949
319918
|
var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -322790,6 +322759,15 @@ var SETTINGS_SCHEMA = {
|
|
|
322790
322759
|
description: "Use ripgrep for file content search instead of the fallback implementation. Provides faster search performance.",
|
|
322791
322760
|
showInDialog: true
|
|
322792
322761
|
},
|
|
322762
|
+
useBuiltinRipgrep: {
|
|
322763
|
+
type: "boolean",
|
|
322764
|
+
label: "Use Builtin Ripgrep",
|
|
322765
|
+
category: "Tools",
|
|
322766
|
+
requiresRestart: false,
|
|
322767
|
+
default: true,
|
|
322768
|
+
description: 'Use the bundled ripgrep binary. When set to false, the system-level "rg" command will be used instead. This setting is only effective when useRipgrep is true.',
|
|
322769
|
+
showInDialog: true
|
|
322770
|
+
},
|
|
322793
322771
|
enableToolOutputTruncation: {
|
|
322794
322772
|
type: "boolean",
|
|
322795
322773
|
label: "Enable Tool Output Truncation",
|
|
@@ -342045,7 +342023,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
342045
342023
|
// packages/cli/src/utils/version.ts
|
|
342046
342024
|
async function getCliVersion() {
|
|
342047
342025
|
const pkgJson = await getPackageJson();
|
|
342048
|
-
return "0.0.21-alpha.
|
|
342026
|
+
return "0.0.21-alpha.2";
|
|
342049
342027
|
}
|
|
342050
342028
|
__name(getCliVersion, "getCliVersion");
|
|
342051
342029
|
|
|
@@ -342498,24 +342476,24 @@ async function parseArguments(settings) {
|
|
|
342498
342476
|
"\u4F7F\u7528\u65B9\u6CD5: rdmind [options] [command]\n\nRDMind - \u542F\u52A8\u4EA4\u4E92\u5F0F CLI\uFF0C\u4F7F\u7528 -p/--prompt \u8FDB\u5165\u975E\u4EA4\u4E92\u6A21\u5F0F"
|
|
342499
342477
|
).option("telemetry", {
|
|
342500
342478
|
type: "boolean",
|
|
342501
|
-
description: "
|
|
342479
|
+
description: "Enable telemetry? This flag specifically controls if telemetry is sent. Other --telemetry-* flags set specific values but do not enable telemetry on their own."
|
|
342502
342480
|
}).option("telemetry-target", {
|
|
342503
342481
|
type: "string",
|
|
342504
342482
|
choices: ["local", "gcp"],
|
|
342505
|
-
description: "
|
|
342483
|
+
description: "Set the telemetry target (local or gcp). Overrides settings files."
|
|
342506
342484
|
}).option("telemetry-otlp-endpoint", {
|
|
342507
342485
|
type: "string",
|
|
342508
|
-
description: "
|
|
342486
|
+
description: "Set the OTLP endpoint for telemetry. Overrides environment variables and settings files."
|
|
342509
342487
|
}).option("telemetry-otlp-protocol", {
|
|
342510
342488
|
type: "string",
|
|
342511
342489
|
choices: ["grpc", "http"],
|
|
342512
|
-
description: "
|
|
342490
|
+
description: "Set the OTLP protocol for telemetry (grpc or http). Overrides settings files."
|
|
342513
342491
|
}).option("telemetry-log-prompts", {
|
|
342514
342492
|
type: "boolean",
|
|
342515
|
-
description: "
|
|
342493
|
+
description: "Enable or disable logging of user prompts for telemetry. Overrides settings files."
|
|
342516
342494
|
}).option("telemetry-outfile", {
|
|
342517
342495
|
type: "string",
|
|
342518
|
-
description: "
|
|
342496
|
+
description: "Redirect all telemetry output to the specified file."
|
|
342519
342497
|
}).deprecateOption(
|
|
342520
342498
|
"telemetry",
|
|
342521
342499
|
'Use the "telemetry.enabled" setting in settings.json instead. This flag will be removed in a future version.'
|
|
@@ -342553,52 +342531,52 @@ async function parseArguments(settings) {
|
|
|
342553
342531
|
}).option("model", {
|
|
342554
342532
|
alias: "m",
|
|
342555
342533
|
type: "string",
|
|
342556
|
-
description:
|
|
342534
|
+
description: `Model`
|
|
342557
342535
|
}).option("prompt", {
|
|
342558
342536
|
alias: "p",
|
|
342559
342537
|
type: "string",
|
|
342560
|
-
description: "
|
|
342538
|
+
description: "Prompt. Appended to input on stdin (if any)."
|
|
342561
342539
|
}).option("prompt-interactive", {
|
|
342562
342540
|
alias: "i",
|
|
342563
342541
|
type: "string",
|
|
342564
|
-
description: "
|
|
342542
|
+
description: "Execute the provided prompt and continue in interactive mode"
|
|
342565
342543
|
}).option("sandbox", {
|
|
342566
342544
|
alias: "s",
|
|
342567
342545
|
type: "boolean",
|
|
342568
|
-
description: "
|
|
342546
|
+
description: "Run in sandbox?"
|
|
342569
342547
|
}).option("sandbox-image", {
|
|
342570
342548
|
type: "string",
|
|
342571
|
-
description: "
|
|
342549
|
+
description: "Sandbox image URI."
|
|
342572
342550
|
}).option("all-files", {
|
|
342573
342551
|
alias: ["a"],
|
|
342574
342552
|
type: "boolean",
|
|
342575
|
-
description: "
|
|
342553
|
+
description: "Include ALL files in context?",
|
|
342576
342554
|
default: false
|
|
342577
342555
|
}).option("show-memory-usage", {
|
|
342578
342556
|
type: "boolean",
|
|
342579
|
-
description: "
|
|
342557
|
+
description: "Show memory usage in status bar",
|
|
342580
342558
|
default: false
|
|
342581
342559
|
}).option("yolo", {
|
|
342582
342560
|
alias: "y",
|
|
342583
342561
|
type: "boolean",
|
|
342584
|
-
description: "
|
|
342562
|
+
description: "Automatically accept all actions (aka YOLO mode, see https://www.youtube.com/watch?v=xvFZjo5PgG0 for more details)?",
|
|
342585
342563
|
default: false
|
|
342586
342564
|
}).option("approval-mode", {
|
|
342587
342565
|
type: "string",
|
|
342588
342566
|
choices: ["plan", "default", "auto-edit", "yolo"],
|
|
342589
|
-
description: "
|
|
342567
|
+
description: "Set the approval mode: plan (plan only), default (prompt for approval), auto-edit (auto-approve edit tools), yolo (auto-approve all tools)"
|
|
342590
342568
|
}).option("checkpointing", {
|
|
342591
342569
|
alias: "c",
|
|
342592
342570
|
type: "boolean",
|
|
342593
|
-
description: "
|
|
342571
|
+
description: "Enables checkpointing of file edits",
|
|
342594
342572
|
default: false
|
|
342595
342573
|
}).option("experimental-acp", {
|
|
342596
342574
|
type: "boolean",
|
|
342597
|
-
description: "
|
|
342575
|
+
description: "Starts the agent in ACP mode"
|
|
342598
342576
|
}).option("allowed-mcp-server-names", {
|
|
342599
342577
|
type: "array",
|
|
342600
342578
|
string: true,
|
|
342601
|
-
description: "
|
|
342579
|
+
description: "Allowed MCP server names",
|
|
342602
342580
|
coerce: /* @__PURE__ */ __name((mcpServerNames) => (
|
|
342603
342581
|
// Handle comma-separated values
|
|
342604
342582
|
mcpServerNames.flatMap(
|
|
@@ -342608,7 +342586,7 @@ async function parseArguments(settings) {
|
|
|
342608
342586
|
}).option("allowed-tools", {
|
|
342609
342587
|
type: "array",
|
|
342610
342588
|
string: true,
|
|
342611
|
-
description: "
|
|
342589
|
+
description: "Tools that are allowed to run without confirmation",
|
|
342612
342590
|
coerce: /* @__PURE__ */ __name((tools) => (
|
|
342613
342591
|
// Handle comma-separated values
|
|
342614
342592
|
tools.flatMap((tool) => tool.split(",").map((t2) => t2.trim()))
|
|
@@ -342617,7 +342595,7 @@ async function parseArguments(settings) {
|
|
|
342617
342595
|
alias: "e",
|
|
342618
342596
|
type: "array",
|
|
342619
342597
|
string: true,
|
|
342620
|
-
description: "
|
|
342598
|
+
description: "A list of extensions to use. If not provided, all extensions are used.",
|
|
342621
342599
|
coerce: /* @__PURE__ */ __name((extensions) => (
|
|
342622
342600
|
// Handle comma-separated values
|
|
342623
342601
|
extensions.flatMap(
|
|
@@ -342627,34 +342605,34 @@ async function parseArguments(settings) {
|
|
|
342627
342605
|
}).option("list-extensions", {
|
|
342628
342606
|
alias: "l",
|
|
342629
342607
|
type: "boolean",
|
|
342630
|
-
description: "
|
|
342608
|
+
description: "List all available extensions and exit."
|
|
342631
342609
|
}).option("include-directories", {
|
|
342632
342610
|
type: "array",
|
|
342633
342611
|
string: true,
|
|
342634
|
-
description: "
|
|
342612
|
+
description: "Additional directories to include in the workspace (comma-separated or multiple --include-directories)",
|
|
342635
342613
|
coerce: /* @__PURE__ */ __name((dirs) => (
|
|
342636
342614
|
// Handle comma-separated values
|
|
342637
342615
|
dirs.flatMap((dir) => dir.split(",").map((d) => d.trim()))
|
|
342638
342616
|
), "coerce")
|
|
342639
342617
|
}).option("openai-logging", {
|
|
342640
342618
|
type: "boolean",
|
|
342641
|
-
description: "
|
|
342619
|
+
description: "Enable logging of OpenAI API calls for debugging and analysis"
|
|
342642
342620
|
}).option("openai-api-key", {
|
|
342643
342621
|
type: "string",
|
|
342644
|
-
description: "
|
|
342622
|
+
description: "OpenAI API key to use for authentication"
|
|
342645
342623
|
}).option("openai-base-url", {
|
|
342646
342624
|
type: "string",
|
|
342647
|
-
description: "OpenAI base URL"
|
|
342625
|
+
description: "OpenAI base URL (for custom endpoints)"
|
|
342648
342626
|
}).option("tavily-api-key", {
|
|
342649
342627
|
type: "string",
|
|
342650
|
-
description: "Tavily API
|
|
342628
|
+
description: "Tavily API key for web search functionality"
|
|
342651
342629
|
}).option("screen-reader", {
|
|
342652
342630
|
type: "boolean",
|
|
342653
|
-
description: "
|
|
342631
|
+
description: "Enable screen reader mode for accessibility."
|
|
342654
342632
|
}).option("vlm-switch-mode", {
|
|
342655
342633
|
type: "string",
|
|
342656
342634
|
choices: ["once", "session", "persist"],
|
|
342657
|
-
description: "
|
|
342635
|
+
description: "Default behavior when images are detected in input. Values: once (one-time switch), session (switch for entire session), persist (continue with current model). Overrides settings files.",
|
|
342658
342636
|
default: process.env["VLM_SWITCH_MODE"]
|
|
342659
342637
|
}).option("output-format", {
|
|
342660
342638
|
alias: "o",
|
|
@@ -342684,13 +342662,13 @@ async function parseArguments(settings) {
|
|
|
342684
342662
|
const query = argv["query"];
|
|
342685
342663
|
const hasPositionalQuery = Array.isArray(query) ? query.length > 0 : !!query;
|
|
342686
342664
|
if (argv["prompt"] && hasPositionalQuery) {
|
|
342687
|
-
return "
|
|
342665
|
+
return "Cannot use both a positional prompt and the --prompt (-p) flag together";
|
|
342688
342666
|
}
|
|
342689
342667
|
if (argv["prompt"] && argv["promptInteractive"]) {
|
|
342690
|
-
return "
|
|
342668
|
+
return "Cannot use both --prompt (-p) and --prompt-interactive (-i) together";
|
|
342691
342669
|
}
|
|
342692
342670
|
if (argv["yolo"] && argv["approvalMode"]) {
|
|
342693
|
-
return "
|
|
342671
|
+
return "Cannot use both --yolo (-y) and --approval-mode together. Use --approval-mode=yolo instead.";
|
|
342694
342672
|
}
|
|
342695
342673
|
return true;
|
|
342696
342674
|
})
|
|
@@ -342930,6 +342908,7 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, s
|
|
|
342930
342908
|
interactive,
|
|
342931
342909
|
trustedFolder,
|
|
342932
342910
|
useRipgrep: settings.tools?.useRipgrep,
|
|
342911
|
+
useBuiltinRipgrep: settings.tools?.useBuiltinRipgrep,
|
|
342933
342912
|
shouldUseNodePtyShell: settings.tools?.shell?.enableInteractiveShell,
|
|
342934
342913
|
skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck,
|
|
342935
342914
|
enablePromptCompletion: settings.general?.enablePromptCompletion ?? false,
|
|
@@ -359032,15 +359011,16 @@ __name(getStartupWarnings, "getStartupWarnings");
|
|
|
359032
359011
|
|
|
359033
359012
|
// packages/cli/src/utils/userStartupWarnings.ts
|
|
359034
359013
|
init_esbuild_shims();
|
|
359014
|
+
init_core2();
|
|
359035
359015
|
import fs95 from "node:fs/promises";
|
|
359036
359016
|
import * as os38 from "node:os";
|
|
359037
359017
|
import path107 from "node:path";
|
|
359038
359018
|
var homeDirectoryCheck = {
|
|
359039
359019
|
id: "home-directory",
|
|
359040
|
-
check: /* @__PURE__ */ __name(async (
|
|
359020
|
+
check: /* @__PURE__ */ __name(async (options2) => {
|
|
359041
359021
|
try {
|
|
359042
359022
|
const [workspaceRealPath, homeRealPath] = await Promise.all([
|
|
359043
|
-
fs95.realpath(workspaceRoot),
|
|
359023
|
+
fs95.realpath(options2.workspaceRoot),
|
|
359044
359024
|
fs95.realpath(os38.homedir())
|
|
359045
359025
|
]);
|
|
359046
359026
|
if (workspaceRealPath === homeRealPath) {
|
|
@@ -359054,9 +359034,9 @@ var homeDirectoryCheck = {
|
|
|
359054
359034
|
};
|
|
359055
359035
|
var rootDirectoryCheck = {
|
|
359056
359036
|
id: "root-directory",
|
|
359057
|
-
check: /* @__PURE__ */ __name(async (
|
|
359037
|
+
check: /* @__PURE__ */ __name(async (options2) => {
|
|
359058
359038
|
try {
|
|
359059
|
-
const workspaceRealPath = await fs95.realpath(workspaceRoot);
|
|
359039
|
+
const workspaceRealPath = await fs95.realpath(options2.workspaceRoot);
|
|
359060
359040
|
const errorMessage = "Warning: You are running RDMind in the root directory. Your entire folder structure will be used for context. It is strongly recommended to run in a project-specific directory.";
|
|
359061
359041
|
if (path107.dirname(workspaceRealPath) === workspaceRealPath) {
|
|
359062
359042
|
return errorMessage;
|
|
@@ -359067,13 +359047,27 @@ var rootDirectoryCheck = {
|
|
|
359067
359047
|
}
|
|
359068
359048
|
}, "check")
|
|
359069
359049
|
};
|
|
359050
|
+
var ripgrepAvailabilityCheck = {
|
|
359051
|
+
id: "ripgrep-availability",
|
|
359052
|
+
check: /* @__PURE__ */ __name(async (options2) => {
|
|
359053
|
+
if (!options2.useRipgrep) {
|
|
359054
|
+
return null;
|
|
359055
|
+
}
|
|
359056
|
+
const isAvailable = await canUseRipgrep(options2.useBuiltinRipgrep);
|
|
359057
|
+
if (!isAvailable) {
|
|
359058
|
+
return "Ripgrep not available: Please install ripgrep globally to enable faster file content search. Falling back to built-in grep.";
|
|
359059
|
+
}
|
|
359060
|
+
return null;
|
|
359061
|
+
}, "check")
|
|
359062
|
+
};
|
|
359070
359063
|
var WARNING_CHECKS = [
|
|
359071
359064
|
homeDirectoryCheck,
|
|
359072
|
-
rootDirectoryCheck
|
|
359065
|
+
rootDirectoryCheck,
|
|
359066
|
+
ripgrepAvailabilityCheck
|
|
359073
359067
|
];
|
|
359074
|
-
async function getUserStartupWarnings(
|
|
359068
|
+
async function getUserStartupWarnings(options2) {
|
|
359075
359069
|
const results = await Promise.all(
|
|
359076
|
-
WARNING_CHECKS.map((check) => check.check(
|
|
359070
|
+
WARNING_CHECKS.map((check) => check.check(options2))
|
|
359077
359071
|
);
|
|
359078
359072
|
return results.filter((msg) => msg !== null);
|
|
359079
359073
|
}
|
|
@@ -361007,7 +361001,11 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
361007
361001
|
let input = config.getQuestion();
|
|
361008
361002
|
const startupWarnings = [
|
|
361009
361003
|
...await getStartupWarnings(),
|
|
361010
|
-
...await getUserStartupWarnings(
|
|
361004
|
+
...await getUserStartupWarnings({
|
|
361005
|
+
workspaceRoot: process.cwd(),
|
|
361006
|
+
useRipgrep: settings.merged.tools?.useRipgrep ?? true,
|
|
361007
|
+
useBuiltinRipgrep: settings.merged.tools?.useBuiltinRipgrep ?? true
|
|
361008
|
+
})
|
|
361011
361009
|
];
|
|
361012
361010
|
if (config.isInteractive()) {
|
|
361013
361011
|
await kittyProtocolDetectionComplete;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rdmind/rdmind",
|
|
3
|
-
"version": "0.0.21-alpha.
|
|
3
|
+
"version": "0.0.21-alpha.2",
|
|
4
4
|
"description": "RDMind - AI-powered coding assistant",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "cli.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
21
|
"config": {
|
|
22
|
-
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.21-alpha.
|
|
22
|
+
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.21-alpha.2"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|