Skip to content

Commit 4004e36

Browse files
committed
docs: update READMEs with real search examples and usage
- Add practical Quick Start with npm link instructions - Include real search output from testing - Document threshold recommendations (0.7=precise, 0.25=exploratory) - Add explore command documentation - Show actual semantic search scores and results - Include pro tips for scripting and workflows Makes documentation reflect actual working functionality.
1 parent 1f2f0ea commit 4004e36

File tree

2 files changed

+131
-29
lines changed

2 files changed

+131
-29
lines changed

README.md

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -156,40 +156,65 @@ pnpm build
156156

157157
### Quick Start
158158

159+
**For Local Development:**
160+
159161
```bash
160-
# Index your repository
161-
dev-agent index
162+
# Link the CLI globally for local testing
163+
cd packages/cli
164+
npm link
165+
166+
# Now you can use 'dev' anywhere
167+
cd ~/your-project
168+
dev init
169+
dev index .
170+
```
162171

163-
# Search with beautiful output
164-
dev-agent search "authentication logic"
172+
**Basic Commands:**
165173

166-
# Get AI help planning work
167-
dev-agent plan --issue 42
174+
```bash
175+
# Index your repository
176+
dev index .
168177

169-
# Discover patterns in your codebase
170-
dev-agent explore "error handling patterns"
178+
# Semantic search (natural language queries work!)
179+
dev search "how do agents communicate"
180+
dev search "vector embeddings"
181+
dev search "error handling" --threshold 0.3
171182

172-
# Create PR with AI-generated description
173-
dev-agent pr create
183+
# Explore code patterns
184+
dev explore pattern "test coverage utilities" --limit 5
185+
dev explore similar path/to/file.ts
174186

175-
# JSON output for scripting
176-
dev-agent search "auth" --json | jq '.results[].file'
187+
# View statistics
188+
dev stats
177189
```
178190

179-
**Example output:**
180-
```
181-
🔍 Searching for "authentication"...
191+
**Real Example Output:**
182192

183-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
184-
📄 auth/oauth.ts:45-67 (score: 0.92)
185-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
186-
export class OAuth2Service {
187-
authenticate(code: string) { ... }
188-
}
193+
```bash
194+
$ dev search "vector embeddings" --threshold 0.3 --limit 3
195+
196+
1. EmbeddingProvider (58.5% match)
197+
File: packages/core/src/vector/types.ts:36-54
198+
Signature: interface EmbeddingProvider
199+
Doc: Generates vector embeddings from text
200+
201+
2. EmbeddingDocument (51.0% match)
202+
File: packages/core/src/vector/types.ts:8-12
203+
Signature: interface EmbeddingDocument
189204

190-
✨ Found 5 results in 42ms
205+
3. VectorStore (47.9% match)
206+
File: packages/core/src/vector/types.ts:60-97
207+
Signature: interface VectorStore
208+
Doc: Stores and retrieves vector embeddings
209+
210+
✔ Found 3 result(s)
191211
```
192212

213+
**Tips for Better Results:**
214+
- **Use natural language**: "how do agents communicate" works better than "agent message"
215+
- **Adjust thresholds**: Default is 0.7 (precise), use 0.25-0.4 for exploration
216+
- **Exact matches score 70-90%**: Semantic matches score 25-60%
217+
193218
### Current Status
194219

195220
**In Progress:** Building core intelligence layer (scanner, vectors, indexer)

packages/cli/README.md

Lines changed: 84 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ Options:
4545
- `-t, --threshold <number>` - Minimum similarity score 0-1 (default: 0.7)
4646
- `--json` - Output as JSON
4747

48+
**Understanding Thresholds:**
49+
- `0.7` (default): Precise matches only
50+
- `0.4-0.6`: Balanced - good for most searches
51+
- `0.25-0.3`: Exploratory - finds related concepts
52+
- `0.0`: Return everything (useful for debugging)
53+
54+
### Explore
55+
56+
Explore code patterns and relationships:
57+
58+
```bash
59+
# Find patterns using semantic search
60+
dev explore pattern "error handling" --limit 5
61+
62+
# Find code similar to a file
63+
dev explore similar path/to/file.ts --limit 5
64+
```
65+
66+
Options:
67+
- `-l, --limit <number>` - Maximum results (default: 10)
68+
- `-t, --threshold <number>` - Minimum similarity score (default: 0.7)
69+
4870
### Update
4971

5072
Incrementally update the index with changed files:
@@ -107,22 +129,77 @@ The `.dev-agent.json` file configures the indexer:
107129

108130
## Examples
109131

132+
### Basic Workflow
133+
110134
```bash
111135
# Initialize and index
112136
dev init
113137
dev index .
114138

115-
# Search for code
116-
dev search "user authentication flow"
117-
dev search "database connection pool" --limit 5
139+
# View statistics
140+
dev stats
141+
# 📊 Files Indexed: 54, Vectors Stored: 566
142+
```
143+
144+
### Semantic Search Examples
145+
146+
```bash
147+
# Natural language queries work great!
148+
dev search "how do agents communicate" --threshold 0.3
149+
150+
# Results:
151+
# 1. Message-Based Architecture (51.9% match)
152+
# 2. AgentContext (43.1% match)
153+
# 3. SubagentCoordinator.broadcastMessage (41.8% match)
154+
155+
# Technical concept search
156+
dev search "vector embeddings" --threshold 0.3 --limit 3
157+
158+
# Results:
159+
# 1. EmbeddingProvider (58.5% match)
160+
# 2. EmbeddingDocument (51.0% match)
161+
# 3. VectorStore (47.9% match)
162+
163+
# Exact term matching (high scores!)
164+
dev search "RepositoryIndexer" --threshold 0.4
165+
166+
# Results:
167+
# 1. RepositoryIndexer.index (85.7% match)
168+
# 2. RepositoryIndexer (75.4% match)
169+
```
170+
171+
### Pattern Exploration
172+
173+
```bash
174+
# Find patterns in your codebase
175+
dev explore pattern "test coverage utilities" --threshold 0.25
176+
177+
# Results:
178+
# 1. Coverage Targets (56.0% match)
179+
# 2. 100% Coverage on Utilities (50.8% match)
180+
# 3. Testing (42.3% match)
181+
182+
# Discover error handling patterns
183+
dev explore pattern "error handling" --threshold 0.3
184+
185+
# Results:
186+
# 1. Handle Errors Gracefully (39.3% match)
187+
# 2. createErrorResponse (35.9% match)
188+
```
189+
190+
### Pro Tips
191+
192+
```bash
193+
# JSON output for scripting
194+
dev search "coordinator" --json | jq '.[].metadata.path' | sort -u
195+
196+
# Lower threshold for exploration
197+
dev search "architectural patterns" --threshold 0.25 --limit 10
118198

119199
# Keep index up to date
120200
dev update
121201

122-
# View statistics
123-
dev stats
124-
125-
# Clean and re-index
202+
# Clean and re-index if needed
126203
dev clean --force
127204
dev index . --force
128205
```

0 commit comments

Comments
 (0)