opencode-context 1.0.0
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 +95 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8489 -0
- package/dist/install.d.ts +3 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +53 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +18138 -0
- package/dist/search.d.ts +10 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/types.d.ts +75 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# opencode-context
|
|
2
|
+
|
|
3
|
+
Smart file finder for codebases with relevance scoring. Includes an OpenCode plugin.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### OpenCode Plugin
|
|
8
|
+
|
|
9
|
+
Add to `~/.config/opencode/opencode.json`:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"plugin": ["opencode-context"]
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or run:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bunx opencode-context install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
OpenCode will auto-install the plugin from npm on next startup.
|
|
24
|
+
|
|
25
|
+
### CLI
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g opencode-context
|
|
29
|
+
# or
|
|
30
|
+
bun install -g opencode-context
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## OpenCode Plugin Usage
|
|
34
|
+
|
|
35
|
+
The plugin registers the `find_files` tool.
|
|
36
|
+
|
|
37
|
+
**Tool: `find_files`**
|
|
38
|
+
|
|
39
|
+
| Argument | Type | Default | Description |
|
|
40
|
+
|----------|------|---------|-------------|
|
|
41
|
+
| `query` | string | required | Search query |
|
|
42
|
+
| `maxFiles` | number | 5 | Maximum results |
|
|
43
|
+
| `minScore` | number | 15 | Minimum relevance score (0-100) |
|
|
44
|
+
| `includeTests` | boolean | false | Include test files |
|
|
45
|
+
| `includeConfigs` | boolean | false | Include config files |
|
|
46
|
+
| `includeDocs` | boolean | false | Include documentation |
|
|
47
|
+
|
|
48
|
+
**Example:**
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
find_files query="auth middleware" maxFiles=5
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Scoring algorithm considers:**
|
|
55
|
+
- Filename matches (exact, partial)
|
|
56
|
+
- Filepath directory names
|
|
57
|
+
- Content (function names, class names, imports, exports)
|
|
58
|
+
- File type (tests, configs, docs)
|
|
59
|
+
|
|
60
|
+
## CLI Usage
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
opencontext --query "auth" --max-files 5
|
|
64
|
+
opencontext --interactive
|
|
65
|
+
opencontext -q "database" --json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Options
|
|
69
|
+
|
|
70
|
+
| Flag | Description | Default |
|
|
71
|
+
|------|-------------|---------|
|
|
72
|
+
| `-q, --query` | Search query | required |
|
|
73
|
+
| `-n, --max-files` | Maximum results | 5 |
|
|
74
|
+
| `--min-score` | Minimum relevance | 15 |
|
|
75
|
+
| `-p, --path` | Root path | cwd |
|
|
76
|
+
| `--include-tests` | Include test files | false |
|
|
77
|
+
| `--include-configs` | Include config files | false |
|
|
78
|
+
| `--include-docs` | Include docs | false |
|
|
79
|
+
| `--no-content` | Skip content search | false |
|
|
80
|
+
| `-j, --json` | JSON output | false |
|
|
81
|
+
| `-d, --detailed` | Show match reasons | false |
|
|
82
|
+
| `-i, --interactive` | Interactive mode | false |
|
|
83
|
+
|
|
84
|
+
## How It Works
|
|
85
|
+
|
|
86
|
+
1. Scans directory with fast-glob
|
|
87
|
+
2. Extracts metadata (size, language, exports, imports)
|
|
88
|
+
3. Scores each file against query
|
|
89
|
+
4. Returns ranked results
|
|
90
|
+
|
|
91
|
+
No index persistence - scans fresh on each query.
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|