@comfanion/workflow 4.36.16 → 4.36.17
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 +7 -4
- package/package.json +1 -1
- package/src/build-info.json +1 -1
- package/src/opencode/commands/search.md +100 -0
package/README.md
CHANGED
|
@@ -23,10 +23,13 @@ npx @comfanion/workflow init
|
|
|
23
23
|
Search your codebase by **meaning**, not just text matching:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
#
|
|
27
|
-
/search "
|
|
28
|
-
/search "
|
|
29
|
-
/search "
|
|
26
|
+
# Terminal CLI:
|
|
27
|
+
npx @comfanion/workflow search "authentication logic"
|
|
28
|
+
npx @comfanion/workflow search "how to deploy" --index docs
|
|
29
|
+
npx @comfanion/workflow search "database config" --all
|
|
30
|
+
|
|
31
|
+
# AI agents use MCP tool automatically:
|
|
32
|
+
# search({ query: "authentication", index: "code" })
|
|
30
33
|
```
|
|
31
34
|
|
|
32
35
|
### How It Works
|
package/package.json
CHANGED
package/src/build-info.json
CHANGED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Semantic code search - find code by meaning, not just text
|
|
3
|
+
agent: crawler
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Search Command
|
|
7
|
+
|
|
8
|
+
Semantic search across the codebase using vectorizer.
|
|
9
|
+
|
|
10
|
+
## Arguments
|
|
11
|
+
$ARGUMENTS
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/search authentication middleware
|
|
17
|
+
/search how users are stored
|
|
18
|
+
/search error handling patterns
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Your Task
|
|
22
|
+
|
|
23
|
+
Perform **multiple semantic searches** to find the best results for user's query.
|
|
24
|
+
|
|
25
|
+
### Step 1: Generate Search Variations
|
|
26
|
+
|
|
27
|
+
From user query "$ARGUMENTS", create 2-3 search variations:
|
|
28
|
+
|
|
29
|
+
1. **Original query** - as provided
|
|
30
|
+
2. **Technical variation** - rephrase with technical terms
|
|
31
|
+
3. **Conceptual variation** - broader concept search
|
|
32
|
+
|
|
33
|
+
Example for "how users are stored":
|
|
34
|
+
- "how users are stored" (original)
|
|
35
|
+
- "user repository database entity" (technical)
|
|
36
|
+
- "user persistence storage" (conceptual)
|
|
37
|
+
|
|
38
|
+
### Step 2: Execute Multiple Searches
|
|
39
|
+
|
|
40
|
+
Run searches in parallel across relevant indexes:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// Search code with variations
|
|
44
|
+
search({ query: "original query", index: "code", limit: 3 })
|
|
45
|
+
search({ query: "technical variation", index: "code", limit: 3 })
|
|
46
|
+
|
|
47
|
+
// Also check docs if relevant
|
|
48
|
+
search({ query: "original query", index: "docs", limit: 2 })
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Step 3: Deduplicate & Rank Results
|
|
52
|
+
|
|
53
|
+
1. Merge all results
|
|
54
|
+
2. Remove duplicates (same file + chunk)
|
|
55
|
+
3. Sort by relevance score
|
|
56
|
+
4. Take top 5-7 unique results
|
|
57
|
+
|
|
58
|
+
### Step 4: Present Results
|
|
59
|
+
|
|
60
|
+
```markdown
|
|
61
|
+
## 🔍 Search: "{user query}"
|
|
62
|
+
|
|
63
|
+
Found {N} relevant results:
|
|
64
|
+
|
|
65
|
+
### 1. `path/to/file.ts` ⭐ (best match)
|
|
66
|
+
```typescript
|
|
67
|
+
// most relevant code snippet
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. `path/to/another.ts`
|
|
71
|
+
```typescript
|
|
72
|
+
// another snippet
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
**Search variations used:**
|
|
78
|
+
- "{variation 1}" → {N} results
|
|
79
|
+
- "{variation 2}" → {N} results
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### If No Results
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
## 🔍 No results for "{query}"
|
|
86
|
+
|
|
87
|
+
**Tried:**
|
|
88
|
+
- "{variation 1}" - no matches
|
|
89
|
+
- "{variation 2}" - no matches
|
|
90
|
+
|
|
91
|
+
**Suggestions:**
|
|
92
|
+
- Check indexes: `codeindex({ action: "list" })`
|
|
93
|
+
- Reindex: `npx @comfanion/workflow index`
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Notes
|
|
97
|
+
|
|
98
|
+
- Always run at least 2 different search queries
|
|
99
|
+
- Prefer code index, add docs if query seems documentation-related
|
|
100
|
+
- Show the search variations used so user understands coverage
|