raggrep 0.12.3 → 0.13.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/README.md CHANGED
@@ -223,33 +223,77 @@ The index is stored in a system temp directory, keeping your project clean.
223
223
 
224
224
  `node_modules`, `dist`, `build`, `.git`, `.next`, `.cache`, `__pycache__`, `target`, and other common build/dependency directories
225
225
 
226
- ## Opencode Integration
226
+ ## OpenCode Integration
227
227
 
228
- RAGgrep can be integrated with [opencode](https://opencode.ai) to provide semantic code search capabilities within the AI coding assistant.
228
+ RAGgrep can be integrated with [OpenCode](https://opencode.ai) to provide semantic code search capabilities within the AI coding assistant.
229
229
 
230
230
  ### Installation
231
231
 
232
- Install the raggrep tool for opencode:
232
+ RAGgrep supports two installation types for OpenCode:
233
233
 
234
+ #### Default Installation (Recommended)
234
235
  ```bash
235
236
  raggrep opencode install
236
237
  ```
237
238
 
238
- This creates the tool file at `~/.config/opencode/tool/raggrep.ts`.
239
+ This installs RAGgrep as a **tool** by default, which provides the best activation rates in OpenCode.
239
240
 
240
- ### Usage in Opencode
241
+ #### Explicit Installation Types
241
242
 
242
- Once installed, you can search your codebase directly within opencode:
243
+ **Force Tool Installation:**
244
+ ```bash
245
+ raggrep opencode install --tool
246
+ ```
247
+ - Installs to: `~/.config/opencode/tool/raggrep.ts`
248
+ - Direct tool execution with full raggrep functionality
249
+
250
+ **Force Skill Installation:**
251
+ ```bash
252
+ raggrep opencode install --skill
253
+ ```
254
+ - Installs to: `~/.config/opencode/skill/raggrep/SKILL.md`
255
+ - Skill-based integration for modern OpenCode versions
256
+
257
+ #### Mutual Exclusivity
258
+
259
+ Installing one type will prompt to remove the other (default: yes):
260
+
261
+ ```bash
262
+ # Installing skill will prompt to remove existing tool
263
+ raggrep opencode install --skill
264
+
265
+ # Installing tool will prompt to remove existing skill
266
+ raggrep opencode install --tool
267
+ ```
268
+
269
+ ### Usage in OpenCode
270
+
271
+ #### Tool Usage
272
+ Once installed as a tool, RAGgrep provides direct search functionality:
273
+ - Natural language queries: "user authentication flow"
274
+ - All CLI options: `--top`, `--min-score`, `--type`, `--filter`
275
+ - Context-aware results with scores and file locations
276
+
277
+ #### Skill Usage
278
+ Load the skill in your OpenCode conversation:
279
+ ```bash
280
+ skill({ name: "raggrep" })
281
+ ```
282
+
283
+ Then follow the skill's guidance to:
284
+ 1. Install RAGgrep: `npm install -g raggrep`
285
+ 2. Index your codebase: `raggrep index`
286
+ 3. Use semantic search: `raggrep query "your search term"`
287
+
288
+ ### Why Tool by Default?
243
289
 
244
- - Search for code using natural language: "user authentication flow"
245
- - Filter by file types and paths
246
- - Get context-aware results with scores and locations
290
+ The tool installation is the default because it:
291
+ - Has higher activation rates in OpenCode agents
292
+ - Provides immediate search capabilities
293
+ - Works consistently across all OpenCode versions
294
+ - Offers direct integration without skill loading steps
247
295
 
248
- The tool supports all the same search options as the CLI:
249
- - Number of results (`top`)
250
- - Minimum similarity score (`minScore`)
251
- - File type filtering (`type`)
252
- - Path filtering (`filter`)
296
+ The skill installation is available for users who prefer the modern skill-based approach or need specific skill integration features.
253
297
 
254
298
  ## Documentation
255
299
 
@@ -0,0 +1,10 @@
1
+ /**
2
+ * OpenCode Integration Module
3
+ *
4
+ * This module provides version-aware installation of raggrep for OpenCode,
5
+ * supporting both legacy tool-based installation (OpenCode < v1.0.186) and
6
+ * modern skill-based installation (OpenCode >= v1.0.186).
7
+ */
8
+ export * from "./version-check";
9
+ export * from "./install-tool";
10
+ export * from "./install-skill";
@@ -0,0 +1,30 @@
1
+ /**
2
+ * OpenCode Skill Installation (Modern)
3
+ *
4
+ * Version Compatibility: OpenCode versions >= v1.0.186
5
+ *
6
+ * This module installs raggrep as an OpenCode skill for newer versions of OpenCode
7
+ * that support the skill system. Skills are markdown files with YAML frontmatter
8
+ * placed in ~/.opencode/skill/ that provide reusable behavior definitions.
9
+ *
10
+ * Benefits of Skills over Tools:
11
+ * - Better integration with OpenCode's agent system
12
+ * - More flexible and educational for agents
13
+ * - Follows OpenCode's modern architecture patterns
14
+ * - Provides comprehensive usage documentation
15
+ */
16
+ import type { Logger } from "../../../domain/ports";
17
+ export interface SkillInstallOptions {
18
+ logger?: Logger;
19
+ checkForOldTool?: boolean;
20
+ }
21
+ export interface SkillInstallResult {
22
+ success: boolean;
23
+ skillPath?: string;
24
+ message: string;
25
+ removedOldTool?: boolean;
26
+ }
27
+ /**
28
+ * Install raggrep as an OpenCode skill for modern versions
29
+ */
30
+ export declare function installSkill(options?: SkillInstallOptions): Promise<SkillInstallResult>;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * OpenCode Tool Installation (Legacy)
3
+ *
4
+ * Version Compatibility: OpenCode versions < v1.0.186
5
+ *
6
+ * This module installs raggrep as an OpenCode tool for older versions of OpenCode
7
+ * that do not support the skill system. Tools are TypeScript files placed in
8
+ * ~/.config/opencode/tool/ that provide direct execution capabilities.
9
+ *
10
+ * Migration Note:
11
+ * - Users should upgrade to OpenCode v1.0.186+ to use the newer skill-based approach
12
+ * - This tool-based approach will be deprecated in future versions
13
+ */
14
+ import type { Logger } from "../../../domain/ports";
15
+ export interface ToolInstallOptions {
16
+ logger?: Logger;
17
+ checkForOldSkill?: boolean;
18
+ }
19
+ export interface ToolInstallResult {
20
+ success: boolean;
21
+ toolPath?: string;
22
+ message: string;
23
+ removedOldSkill?: boolean;
24
+ }
25
+ /**
26
+ * Install raggrep as an OpenCode tool for older versions
27
+ */
28
+ export declare function installTool(options?: ToolInstallOptions): Promise<ToolInstallResult>;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * OpenCode Version Checker
3
+ *
4
+ * Determines whether to use tool or skill installation based on OpenCode version.
5
+ *
6
+ * Version Compatibility:
7
+ * - OpenCode versions < v1.0.186: Use tool-based installation
8
+ * - OpenCode versions >= v1.0.186: Use skill-based installation
9
+ */
10
+ export interface OpenCodeVersion {
11
+ major: number;
12
+ minor: number;
13
+ patch: number;
14
+ }
15
+ /**
16
+ * Parse OpenCode version string into comparable components
17
+ */
18
+ export declare function parseOpenCodeVersion(version: string): OpenCodeVersion | null;
19
+ /**
20
+ * Check if OpenCode version supports skills (v1.0.186+)
21
+ */
22
+ export declare function supportsSkills(version: string): boolean;
23
+ /**
24
+ * Get installation method recommendation based on OpenCode version
25
+ */
26
+ export declare function getInstallationMethod(openCodeVersion?: string): 'tool' | 'skill';
27
+ /**
28
+ * Detect OpenCode version by checking common installation locations
29
+ */
30
+ export declare function detectOpenCodeVersion(): Promise<string | null>;