opencode-codeindex 0.1.5 → 0.1.6
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/LICENSE +21 -0
- package/README.md +148 -0
- package/dist/lib/tree-builder.d.ts.map +1 -1
- package/dist/lib/tree-builder.js +1 -7
- package/dist/lib/tree-builder.js.map +1 -1
- package/package.json +4 -4
- package/src/lib/tree-builder.ts +2 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hung319
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# OpenCode CodeIndex Plugin
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/opencode-codeindex)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
> OpenCode plugin that indexes directories with root file contents. Provides a tool to generate directory tree structures with root file contents for AI context.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- 📁 Generate directory tree structures with root file contents
|
|
11
|
+
- 🔍 Intelligently handle binary files and respect `.gitignore` patterns
|
|
12
|
+
- 📦 Configurable max file size for content inclusion
|
|
13
|
+
- 🛠️ Exposes `tree_indexer` tool for OpenCode
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### From npm
|
|
18
|
+
|
|
19
|
+
Add to your OpenCode configuration file (`opencode.json`):
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"$schema": "https://opencode.ai/config.json",
|
|
24
|
+
"plugin": ["opencode-codeindex"]
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
OpenCode will automatically install the plugin using Bun at startup.
|
|
29
|
+
|
|
30
|
+
### From local files
|
|
31
|
+
|
|
32
|
+
Place the plugin file in your OpenCode plugins directory:
|
|
33
|
+
|
|
34
|
+
- `.opencode/plugins/` - Project-level plugins
|
|
35
|
+
- `~/.config/opencode/plugins/` - Global plugins
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
Once installed, the plugin exposes a `tree_indexer` tool that can be used in your OpenCode sessions:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// The tree_indexer tool is automatically available
|
|
43
|
+
await ctx.tools.tree_indexer({
|
|
44
|
+
path: './src',
|
|
45
|
+
maxFileSize: 50000,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Available Commands
|
|
50
|
+
|
|
51
|
+
The plugin also provides custom commands defined in Markdown frontmatter. Create `.md` files in `src/commands/`:
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
---
|
|
55
|
+
description: Analyze code structure
|
|
56
|
+
agent: architect
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
Analyze the following directory structure and provide insights...
|
|
60
|
+
|
|
61
|
+
{{ tree_indexer path="./src" }}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Programmatic API
|
|
65
|
+
|
|
66
|
+
You can also use this package programmatically in your own projects:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { indexDirectory } from 'opencode-codeindex';
|
|
70
|
+
|
|
71
|
+
// Index current directory
|
|
72
|
+
const output = await indexDirectory();
|
|
73
|
+
|
|
74
|
+
// Index specific path with max file size
|
|
75
|
+
const output = await indexDirectory({
|
|
76
|
+
path: './my-project',
|
|
77
|
+
maxFileSize: 102400, // 100KB
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
console.log(output);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### API Reference
|
|
84
|
+
|
|
85
|
+
#### `indexDirectory(args?: IndexArgs)`
|
|
86
|
+
|
|
87
|
+
Generates a formatted directory tree with root file contents.
|
|
88
|
+
|
|
89
|
+
**Parameters:**
|
|
90
|
+
- `args.path` (string, optional): Root path to index (defaults to current directory)
|
|
91
|
+
- `args.maxFileSize` (number, optional): Maximum file size in bytes to include content
|
|
92
|
+
|
|
93
|
+
**Returns:** Promise<string> - Formatted tree output
|
|
94
|
+
|
|
95
|
+
## Plugin Structure
|
|
96
|
+
|
|
97
|
+
This plugin follows the [OpenCode plugin specification](https://opencode.ai/docs/plugins/):
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import type { Plugin } from '@opencode-ai/plugin';
|
|
101
|
+
|
|
102
|
+
export const CodeIndexPlugin: Plugin = async (ctx) => {
|
|
103
|
+
return {
|
|
104
|
+
tool: {
|
|
105
|
+
tree_indexer: treeIndexerTool,
|
|
106
|
+
},
|
|
107
|
+
async config(config) {
|
|
108
|
+
// Add custom commands
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Install dependencies
|
|
118
|
+
npm install
|
|
119
|
+
|
|
120
|
+
# Build
|
|
121
|
+
npm run build
|
|
122
|
+
|
|
123
|
+
# Run tests
|
|
124
|
+
npm test
|
|
125
|
+
|
|
126
|
+
# Lint
|
|
127
|
+
npm run lint
|
|
128
|
+
|
|
129
|
+
# Format
|
|
130
|
+
npm run format
|
|
131
|
+
|
|
132
|
+
# Type check
|
|
133
|
+
npm run typecheck
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT © [OpenCode](https://github.com/hung319/opencode-codeindex)
|
|
139
|
+
|
|
140
|
+
## Contributing
|
|
141
|
+
|
|
142
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
143
|
+
|
|
144
|
+
## Links
|
|
145
|
+
|
|
146
|
+
- [GitHub Repository](https://github.com/hung319/opencode-codeindex)
|
|
147
|
+
- [npm Package](https://www.npmjs.com/package/opencode-codeindex)
|
|
148
|
+
- [OpenCode Documentation](https://opencode.ai/docs/plugins/)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-builder.d.ts","sourceRoot":"","sources":["../../src/lib/tree-builder.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"tree-builder.d.ts","sourceRoot":"","sources":["../../src/lib/tree-builder.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,aAAkE,CAAC;AAkIlG,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,QAAQ,CAAC,CA6BnB"}
|
package/dist/lib/tree-builder.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import ignore from 'ignore';
|
|
4
|
-
export const DEFAULT_SKIP_NAMES = new Set([
|
|
5
|
-
'.git',
|
|
6
|
-
'node_modules',
|
|
7
|
-
'.opencode',
|
|
8
|
-
'dist',
|
|
9
|
-
'build',
|
|
10
|
-
]);
|
|
4
|
+
export const DEFAULT_SKIP_NAMES = new Set(['.git', 'node_modules', '.opencode', 'dist', 'build']);
|
|
11
5
|
const DEFAULT_SKIP_EXTENSIONS = new Set(['.log']);
|
|
12
6
|
function normalizeGitignorePath(relativePath) {
|
|
13
7
|
return relativePath.split(path.sep).join('/');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-builder.js","sourceRoot":"","sources":["../../src/lib/tree-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAuB,MAAM,QAAQ,CAAC;AAmB7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"tree-builder.js","sourceRoot":"","sources":["../../src/lib/tree-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAuB,MAAM,QAAQ,CAAC;AAmB7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAElG,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAElD,SAAS,sBAAsB,CAAC,YAAoB;IAClD,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,WAAW,CAAC,GAAY,EAAE,QAAgB;IACjD,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,MAAM,CAAE,GAAyB,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QAC3D,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,OAAO;YAAE,OAAO,mBAAmB,CA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O,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,4BAA4B,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAAC;IAC1F,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC/E,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAC9F,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,CAAC,YAAY,CAAC,CAAC,CAAC;IAEhD,MAAM,QAAQ,GAAG,MAAM,aAAa,CAClC,YAAY,EACZ,EAAE,EACF,CAAC,EACD,WAAW,EACX,SAAS,EACT,cAAc,EACd,OAAO,CACR,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,YAAY;QACjD,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,CAAC,CAAC;QACT,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-codeindex",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "OpenCode plugin that indexes directories with root file contents.",
|
|
5
5
|
"author": {
|
|
6
|
-
"name": "
|
|
7
|
-
"email": "
|
|
6
|
+
"name": "hung319",
|
|
7
|
+
"email": "Hungh6122@gmail.com"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "https://github.com/
|
|
21
|
+
"url": "https://github.com/hung319/opencode-codeindex"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public",
|
package/src/lib/tree-builder.ts
CHANGED
|
@@ -20,13 +20,7 @@ export interface TreeBuilderOptions {
|
|
|
20
20
|
respectGitignore?: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export const DEFAULT_SKIP_NAMES = new Set([
|
|
24
|
-
'.git',
|
|
25
|
-
'node_modules',
|
|
26
|
-
'.opencode',
|
|
27
|
-
'dist',
|
|
28
|
-
'build',
|
|
29
|
-
]);
|
|
23
|
+
export const DEFAULT_SKIP_NAMES = new Set(['.git', 'node_modules', '.opencode', 'dist', 'build']);
|
|
30
24
|
|
|
31
25
|
const DEFAULT_SKIP_EXTENSIONS = new Set(['.log']);
|
|
32
26
|
|
|
@@ -55,11 +49,7 @@ async function loadGitignore(rootPath: string, enabled: boolean): Promise<Ignore
|
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
51
|
|
|
58
|
-
function shouldSkip(
|
|
59
|
-
name: string,
|
|
60
|
-
skipNames: Set<string>,
|
|
61
|
-
skipExtensions: Set<string>
|
|
62
|
-
): boolean {
|
|
52
|
+
function shouldSkip(name: string, skipNames: Set<string>, skipExtensions: Set<string>): boolean {
|
|
63
53
|
if (skipNames.has(name)) return true;
|
|
64
54
|
for (const ext of skipExtensions) {
|
|
65
55
|
if (name.endsWith(ext)) return true;
|