raggrep 0.8.2 → 0.8.4
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 +15 -0
- package/dist/cli/main.js +122 -6
- package/dist/cli/main.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,6 +130,21 @@ raggrep query "mock setup" --filter "*.test.ts"
|
|
|
130
130
|
raggrep query "api handler" --filter "src/**/*.ts"
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
+
### Multiple Filters (OR Logic)
|
|
134
|
+
|
|
135
|
+
Use multiple `--filter` flags to match files that match **any** of the patterns:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Search TypeScript OR TSX files
|
|
139
|
+
raggrep query "component" --filter "*.ts" --filter "*.tsx"
|
|
140
|
+
|
|
141
|
+
# Search in multiple directories
|
|
142
|
+
raggrep query "api" --filter src/api --filter src/routes
|
|
143
|
+
|
|
144
|
+
# Mix glob patterns and path prefixes
|
|
145
|
+
raggrep query "config" --filter "*.json" --filter "*.yaml" --filter config/
|
|
146
|
+
```
|
|
147
|
+
|
|
133
148
|
This is useful when you know whether you're looking for code or documentation.
|
|
134
149
|
|
|
135
150
|
### Index Options
|
package/dist/cli/main.js
CHANGED
|
@@ -7674,7 +7674,7 @@ init_logger();
|
|
|
7674
7674
|
// package.json
|
|
7675
7675
|
var package_default = {
|
|
7676
7676
|
name: "raggrep",
|
|
7677
|
-
version: "0.8.
|
|
7677
|
+
version: "0.8.4",
|
|
7678
7678
|
description: "Local filesystem-based RAG system for codebases - semantic search using local embeddings",
|
|
7679
7679
|
type: "module",
|
|
7680
7680
|
main: "./dist/index.js",
|
|
@@ -7953,6 +7953,11 @@ Filter Patterns:
|
|
|
7953
7953
|
Glob pattern: --filter "*.md" (matches all .md files)
|
|
7954
7954
|
Glob pattern: --filter "src/**/*.test.ts" (matches test files in src/)
|
|
7955
7955
|
|
|
7956
|
+
Multiple Filters (OR logic):
|
|
7957
|
+
Use multiple --filter flags to match files that match ANY of the patterns.
|
|
7958
|
+
raggrep query "api" --filter "*.ts" --filter "*.tsx" (matches .ts OR .tsx)
|
|
7959
|
+
raggrep query "docs" --filter "*.md" --filter docs/ (matches .md OR docs/)
|
|
7960
|
+
|
|
7956
7961
|
Examples:
|
|
7957
7962
|
raggrep query "user authentication"
|
|
7958
7963
|
raggrep query "handle errors" --top 5
|
|
@@ -8118,6 +8123,115 @@ Examples:
|
|
|
8118
8123
|
}
|
|
8119
8124
|
break;
|
|
8120
8125
|
}
|
|
8126
|
+
case "opencode": {
|
|
8127
|
+
const subcommand = flags.remaining[0];
|
|
8128
|
+
if (flags.help || !subcommand) {
|
|
8129
|
+
console.log(`
|
|
8130
|
+
raggrep opencode - Manage opencode integration
|
|
8131
|
+
|
|
8132
|
+
Usage:
|
|
8133
|
+
raggrep opencode <subcommand>
|
|
8134
|
+
|
|
8135
|
+
Subcommands:
|
|
8136
|
+
install Install or update the raggrep tool for opencode
|
|
8137
|
+
|
|
8138
|
+
Description:
|
|
8139
|
+
Installs the raggrep tool to ~/.config/opencode/tool/raggrep.ts
|
|
8140
|
+
This allows opencode to use raggrep for semantic code search.
|
|
8141
|
+
|
|
8142
|
+
Examples:
|
|
8143
|
+
raggrep opencode install
|
|
8144
|
+
`);
|
|
8145
|
+
process.exit(0);
|
|
8146
|
+
}
|
|
8147
|
+
if (subcommand === "install") {
|
|
8148
|
+
const os4 = await import("os");
|
|
8149
|
+
const fs9 = await import("fs/promises");
|
|
8150
|
+
const path19 = await import("path");
|
|
8151
|
+
const homeDir = os4.homedir();
|
|
8152
|
+
const toolDir = path19.join(homeDir, ".config", "opencode", "tool");
|
|
8153
|
+
const toolPath = path19.join(toolDir, "raggrep.ts");
|
|
8154
|
+
const toolContent = `import { tool } from "@opencode-ai/plugin";
|
|
8155
|
+
|
|
8156
|
+
export default tool({
|
|
8157
|
+
description:
|
|
8158
|
+
"Search the codebase using semantic RAG (Retrieval-Augmented Generation). Uses raggrep to find relevant code snippets based on natural language queries. The index is managed automatically - first query creates it, changed files are re-indexed, and unchanged files use cached index.",
|
|
8159
|
+
args: {
|
|
8160
|
+
query: tool.schema
|
|
8161
|
+
.string()
|
|
8162
|
+
.describe(
|
|
8163
|
+
"Natural language search query (e.g., 'user authentication', 'handle errors')"
|
|
8164
|
+
),
|
|
8165
|
+
top: tool.schema
|
|
8166
|
+
.number()
|
|
8167
|
+
.optional()
|
|
8168
|
+
.describe("Number of results to return (default: 10)"),
|
|
8169
|
+
minScore: tool.schema
|
|
8170
|
+
.number()
|
|
8171
|
+
.optional()
|
|
8172
|
+
.describe("Minimum similarity score 0-1 (default: 0.15)"),
|
|
8173
|
+
type: tool.schema
|
|
8174
|
+
.string()
|
|
8175
|
+
.optional()
|
|
8176
|
+
.describe("Filter by file extension (e.g., ts, tsx, js)"),
|
|
8177
|
+
filter: tool.schema
|
|
8178
|
+
.array(tool.schema.string())
|
|
8179
|
+
.optional()
|
|
8180
|
+
.describe(
|
|
8181
|
+
"Filter by path prefix or glob pattern. Multiple filters use OR logic. Examples: 'src/auth', '*.ts', '*.md', 'src/**/*.test.ts'"
|
|
8182
|
+
),
|
|
8183
|
+
},
|
|
8184
|
+
async execute(args) {
|
|
8185
|
+
const cmdArgs = [args.query];
|
|
8186
|
+
|
|
8187
|
+
if (args.top !== undefined) {
|
|
8188
|
+
cmdArgs.push("--top", String(args.top));
|
|
8189
|
+
}
|
|
8190
|
+
if (args.minScore !== undefined) {
|
|
8191
|
+
cmdArgs.push("--min-score", String(args.minScore));
|
|
8192
|
+
}
|
|
8193
|
+
if (args.type !== undefined) {
|
|
8194
|
+
cmdArgs.push("--type", args.type);
|
|
8195
|
+
}
|
|
8196
|
+
if (args.filter !== undefined && args.filter.length > 0) {
|
|
8197
|
+
for (const f of args.filter) {
|
|
8198
|
+
cmdArgs.push("--filter", f);
|
|
8199
|
+
}
|
|
8200
|
+
}
|
|
8201
|
+
|
|
8202
|
+
const result = await Bun.$\`raggrep query \${cmdArgs}\`.text();
|
|
8203
|
+
return result.trim();
|
|
8204
|
+
},
|
|
8205
|
+
});
|
|
8206
|
+
`;
|
|
8207
|
+
try {
|
|
8208
|
+
await fs9.mkdir(toolDir, { recursive: true });
|
|
8209
|
+
let action = "Installed";
|
|
8210
|
+
const backupPath = toolPath + ".backup";
|
|
8211
|
+
try {
|
|
8212
|
+
await fs9.access(toolPath);
|
|
8213
|
+
await fs9.copyFile(toolPath, backupPath);
|
|
8214
|
+
action = "Updated";
|
|
8215
|
+
} catch {}
|
|
8216
|
+
await fs9.writeFile(toolPath, toolContent, "utf-8");
|
|
8217
|
+
console.log(`${action} raggrep tool for opencode.`);
|
|
8218
|
+
console.log(` Location: ${toolPath}`);
|
|
8219
|
+
if (action === "Updated") {
|
|
8220
|
+
console.log(` Backup: ${backupPath}`);
|
|
8221
|
+
}
|
|
8222
|
+
console.log(`
|
|
8223
|
+
The raggrep tool is now available in opencode.`);
|
|
8224
|
+
} catch (error) {
|
|
8225
|
+
console.error("Error installing opencode tool:", error);
|
|
8226
|
+
process.exit(1);
|
|
8227
|
+
}
|
|
8228
|
+
} else {
|
|
8229
|
+
console.error(`Unknown subcommand: ${subcommand}`);
|
|
8230
|
+
console.error('Run "raggrep opencode --help" for usage.');
|
|
8231
|
+
process.exit(1);
|
|
8232
|
+
}
|
|
8233
|
+
break;
|
|
8234
|
+
}
|
|
8121
8235
|
default:
|
|
8122
8236
|
console.log(`
|
|
8123
8237
|
raggrep v${VERSION} - Local filesystem-based RAG system for codebases
|
|
@@ -8126,10 +8240,11 @@ Usage:
|
|
|
8126
8240
|
raggrep <command> [options]
|
|
8127
8241
|
|
|
8128
8242
|
Commands:
|
|
8129
|
-
index
|
|
8130
|
-
query
|
|
8131
|
-
status
|
|
8132
|
-
reset
|
|
8243
|
+
index Index the current directory
|
|
8244
|
+
query Search the indexed codebase
|
|
8245
|
+
status Show the current state of the index
|
|
8246
|
+
reset Clear the index for the current directory
|
|
8247
|
+
opencode Manage opencode integration
|
|
8133
8248
|
|
|
8134
8249
|
Options:
|
|
8135
8250
|
-h, --help Show help for a command
|
|
@@ -8140,6 +8255,7 @@ Examples:
|
|
|
8140
8255
|
raggrep query "user login"
|
|
8141
8256
|
raggrep status
|
|
8142
8257
|
raggrep reset
|
|
8258
|
+
raggrep opencode install
|
|
8143
8259
|
|
|
8144
8260
|
Run 'raggrep <command> --help' for more information.
|
|
8145
8261
|
`);
|
|
@@ -8151,4 +8267,4 @@ Run 'raggrep <command> --help' for more information.
|
|
|
8151
8267
|
}
|
|
8152
8268
|
main();
|
|
8153
8269
|
|
|
8154
|
-
//# debugId=
|
|
8270
|
+
//# debugId=96F7EF5714B8338A64756E2164756E21
|