@standardbeagle/lci 0.1.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/LICENSE +21 -0
- package/README.md +198 -0
- package/bin/lci.js +68 -0
- package/binaries/lci_darwin_amd64 +0 -0
- package/binaries/lci_darwin_arm64 +0 -0
- package/binaries/lci_linux_amd64 +0 -0
- package/binaries/lci_linux_arm64 +0 -0
- package/binaries/lci_windows_amd64.exe +0 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Standard Beagle
|
|
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,198 @@
|
|
|
1
|
+
# LCI - Lightning Code Index
|
|
2
|
+
|
|
3
|
+
Lightning-fast code indexing and search for AI assistants.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/standardbeagle/lci/actions/workflows/ci.yml)
|
|
6
|
+
[](https://goreportcard.com/report/github.com/standardbeagle/lci)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Sub-millisecond search**: Trigram-based indexing with <5ms search guarantee
|
|
12
|
+
- **Multi-language support**: Go, TypeScript, JavaScript, Python, Rust, C#, PHP, and more
|
|
13
|
+
- **MCP integration**: Model Context Protocol server for AI assistant integration
|
|
14
|
+
- **Semantic search**: Natural language queries with intelligent matching
|
|
15
|
+
- **Call graph analysis**: Track function calls, references, and dependencies
|
|
16
|
+
- **Semantic annotations**: `@lci:` vocabulary for marking up code with metadata
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
### npm (recommended)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g @standardbeagle/lci
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### pip
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install lightning-code-index
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Homebrew (coming soon)
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
brew install standardbeagle/tap/lci
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### From Source
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
go install github.com/standardbeagle/lci/cmd/lci@latest
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### From Releases
|
|
45
|
+
|
|
46
|
+
Download pre-built binaries from [GitHub Releases](https://github.com/standardbeagle/lci/releases).
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### CLI Usage
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Index and search in current directory
|
|
54
|
+
lci search "handleRequest"
|
|
55
|
+
|
|
56
|
+
# Find symbol definitions
|
|
57
|
+
lci def UserService
|
|
58
|
+
|
|
59
|
+
# Find all references to a symbol
|
|
60
|
+
lci refs CreateUser
|
|
61
|
+
|
|
62
|
+
# Display function call hierarchy
|
|
63
|
+
lci tree main
|
|
64
|
+
|
|
65
|
+
# Fast grep-style search
|
|
66
|
+
lci grep "TODO|FIXME"
|
|
67
|
+
|
|
68
|
+
# List files that would be indexed
|
|
69
|
+
lci list
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### MCP Server
|
|
73
|
+
|
|
74
|
+
Start the MCP server for AI assistant integration:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
lci mcp
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### Claude Code Integration
|
|
81
|
+
|
|
82
|
+
Add to your `.mcp.json`:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"lci": {
|
|
87
|
+
"command": "lci",
|
|
88
|
+
"args": ["mcp"],
|
|
89
|
+
"env": {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Configuration
|
|
95
|
+
|
|
96
|
+
Create `.lci.kdl` in your project root:
|
|
97
|
+
|
|
98
|
+
```kdl
|
|
99
|
+
project {
|
|
100
|
+
name "my-project"
|
|
101
|
+
root "."
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
index {
|
|
105
|
+
include "**/*.go" "**/*.ts" "**/*.py"
|
|
106
|
+
exclude "**/node_modules/**" "**/vendor/**"
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
search {
|
|
110
|
+
max-results 100
|
|
111
|
+
context-lines 3
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## MCP Tools
|
|
116
|
+
|
|
117
|
+
When running as an MCP server, LCI exposes these tools:
|
|
118
|
+
|
|
119
|
+
| Tool | Description |
|
|
120
|
+
|------|-------------|
|
|
121
|
+
| `search` | Semantic code search with fuzzy matching |
|
|
122
|
+
| `get_context` | Get detailed context for a code symbol |
|
|
123
|
+
| `find_files` | Fast file path search with glob patterns |
|
|
124
|
+
| `code_insight` | Codebase intelligence and analysis |
|
|
125
|
+
| `context` | Save/load code context manifests |
|
|
126
|
+
| `semantic_annotations` | Query @lci: semantic labels |
|
|
127
|
+
| `side_effects` | Analyze function purity and side effects |
|
|
128
|
+
|
|
129
|
+
## Semantic Annotations
|
|
130
|
+
|
|
131
|
+
Mark up your code with `@lci:` annotations for enhanced AI understanding:
|
|
132
|
+
|
|
133
|
+
```go
|
|
134
|
+
// @lci:risk[high] @lci:public-api
|
|
135
|
+
// @lci:requires[env:DATABASE_URL]
|
|
136
|
+
func HandleUserLogin(w http.ResponseWriter, r *http.Request) {
|
|
137
|
+
// ...
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// @lci:purpose[Validate user credentials against database]
|
|
141
|
+
// @lci:must[Return error for invalid credentials]
|
|
142
|
+
func ValidateCredentials(username, password string) error {
|
|
143
|
+
// ...
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Annotation Categories
|
|
148
|
+
|
|
149
|
+
- **Risk & Safety**: `@lci:risk[low|medium|high|critical]`, `@lci:safe-zone`, `@lci:stability`
|
|
150
|
+
- **Dependencies**: `@lci:requires[env:VAR]`, `@lci:requires[db:table]`, `@lci:requires[service:name]`
|
|
151
|
+
- **Conventions**: `@lci:convention[pattern]`, `@lci:idiom[name]`, `@lci:template[name]`
|
|
152
|
+
- **Contracts**: `@lci:must[behavior]`, `@lci:must-not[behavior]`, `@lci:invariant[condition]`
|
|
153
|
+
- **Purpose**: `@lci:purpose[description]`, `@lci:domain[area]`, `@lci:owner[team]`
|
|
154
|
+
|
|
155
|
+
## Architecture
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
lci/
|
|
159
|
+
├── cmd/lci/ # CLI entry point
|
|
160
|
+
├── internal/
|
|
161
|
+
│ ├── core/ # Trigram index, symbol store, reference tracker
|
|
162
|
+
│ ├── parser/ # Tree-sitter based multi-language parsing
|
|
163
|
+
│ ├── search/ # Search engine and scoring
|
|
164
|
+
│ ├── indexing/ # Master index and pipeline
|
|
165
|
+
│ ├── mcp/ # MCP server and tools
|
|
166
|
+
│ └── analysis/ # Code analysis and metrics
|
|
167
|
+
└── pkg/ # Public API
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Performance
|
|
171
|
+
|
|
172
|
+
LCI is designed for speed:
|
|
173
|
+
|
|
174
|
+
- **Indexing**: <5s for typical projects (<10k files)
|
|
175
|
+
- **Search**: <5ms for most queries
|
|
176
|
+
- **Memory**: <100MB for typical web projects
|
|
177
|
+
- **Startup**: Near-instant with persistent index
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Run tests
|
|
183
|
+
go test ./...
|
|
184
|
+
|
|
185
|
+
# Build
|
|
186
|
+
go build ./cmd/lci
|
|
187
|
+
|
|
188
|
+
# Run with race detector
|
|
189
|
+
go test -race ./...
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
195
|
+
|
|
196
|
+
## Contributing
|
|
197
|
+
|
|
198
|
+
Contributions are welcome! Please read the contributing guidelines before submitting PRs.
|
package/bin/lci.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
|
|
8
|
+
function getBinaryPath() {
|
|
9
|
+
const platform = os.platform();
|
|
10
|
+
const arch = os.arch();
|
|
11
|
+
|
|
12
|
+
let binaryName;
|
|
13
|
+
|
|
14
|
+
if (platform === "darwin") {
|
|
15
|
+
if (arch === "x64") {
|
|
16
|
+
binaryName = "lci_darwin_amd64";
|
|
17
|
+
} else if (arch === "arm64") {
|
|
18
|
+
binaryName = "lci_darwin_arm64";
|
|
19
|
+
}
|
|
20
|
+
} else if (platform === "linux") {
|
|
21
|
+
if (arch === "x64") {
|
|
22
|
+
binaryName = "lci_linux_amd64";
|
|
23
|
+
} else if (arch === "arm64") {
|
|
24
|
+
binaryName = "lci_linux_arm64";
|
|
25
|
+
}
|
|
26
|
+
} else if (platform === "win32") {
|
|
27
|
+
if (arch === "x64") {
|
|
28
|
+
binaryName = "lci_windows_amd64.exe";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!binaryName) {
|
|
33
|
+
console.error(`Unsupported platform: ${platform} ${arch}`);
|
|
34
|
+
console.error("Supported platforms: darwin (x64, arm64), linux (x64, arm64), win32 (x64)");
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const binaryPath = path.join(__dirname, "..", "binaries", binaryName);
|
|
39
|
+
|
|
40
|
+
if (!fs.existsSync(binaryPath)) {
|
|
41
|
+
console.error(`Binary not found: ${binaryPath}`);
|
|
42
|
+
console.error("This may be a development installation.");
|
|
43
|
+
console.error("Please install from npm: npm install -g @standardbeagle/lci");
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return binaryPath;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function main() {
|
|
51
|
+
const binaryPath = getBinaryPath();
|
|
52
|
+
const args = process.argv.slice(2);
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
execFileSync(binaryPath, args, {
|
|
56
|
+
stdio: "inherit",
|
|
57
|
+
env: process.env,
|
|
58
|
+
});
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (error.status !== undefined) {
|
|
61
|
+
process.exit(error.status);
|
|
62
|
+
}
|
|
63
|
+
console.error(`Failed to execute binary: ${error.message}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@standardbeagle/lci",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lightning Code Index - Sub-millisecond semantic code search and analysis",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"code-search",
|
|
7
|
+
"semantic-search",
|
|
8
|
+
"code-analysis",
|
|
9
|
+
"mcp",
|
|
10
|
+
"indexing",
|
|
11
|
+
"cli"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/standardbeagle/lci",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/standardbeagle/lci/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/standardbeagle/lci.git"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Standard Beagle",
|
|
23
|
+
"bin": {
|
|
24
|
+
"lci": "bin/lci.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin/",
|
|
28
|
+
"binaries/",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=14"
|
|
34
|
+
},
|
|
35
|
+
"os": [
|
|
36
|
+
"darwin",
|
|
37
|
+
"linux",
|
|
38
|
+
"win32"
|
|
39
|
+
],
|
|
40
|
+
"cpu": [
|
|
41
|
+
"x64",
|
|
42
|
+
"arm64"
|
|
43
|
+
]
|
|
44
|
+
}
|