lightning-code-index 0.0.0__tar.gz

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.
@@ -0,0 +1,93 @@
1
+ # Build artifacts
2
+ /lci
3
+ /lci-*
4
+ /lci-binary
5
+ cmd/lci/lci
6
+ cmd/lci/lci-*
7
+ debug_treesitter
8
+ *.log
9
+ /debug*.go
10
+ !internal/debug/
11
+ *.exe
12
+ *.dll
13
+ *.so
14
+ *.dylib
15
+
16
+ # Go build cache
17
+ .cache/
18
+
19
+ # Test coverage
20
+ coverage.out
21
+ *.test
22
+
23
+ # Profiling files
24
+ *.prof
25
+ /profile_*
26
+ !cmd/profile_*/
27
+
28
+ # IDE files
29
+ .vscode/
30
+ .idea/
31
+ *.swp
32
+ *.swo
33
+ *~
34
+
35
+ # OS files
36
+ .DS_Store
37
+ Thumbs.db
38
+
39
+ # Local development
40
+ .env
41
+ .env.local
42
+
43
+ # Go-specific patterns
44
+ vendor/
45
+ *.out
46
+ # *.mod and *.sum should NOT be ignored - they are required for Go modules
47
+ # Remove these lines if they were added incorrectly
48
+
49
+ # Go test artifacts
50
+ *.cover
51
+ coverage.html
52
+ coverage-mcp-*.html
53
+
54
+ # Test helper artifacts
55
+ testhelpers/test-logs/
56
+ testhelpers/*_report.json
57
+ testdata/perf-*.json
58
+ testdata/bench-*.json
59
+
60
+ # Go workspace files
61
+ go.work
62
+ go.work.sum
63
+
64
+ # Air live reload
65
+ .air.toml
66
+ tmp/
67
+
68
+ # Temporary files
69
+ *.tmp
70
+ *.temp
71
+ *.bak
72
+ *.backup
73
+
74
+ # Large test fixture projects (323MB total - causes indexing stalls)
75
+ **/workflow_testdata/
76
+
77
+ # Real-world test projects (cloned via scripts/setup_test_projects.sh)
78
+ # These are pinned to specific commits for reproducible testing
79
+ real_projects/go/
80
+ real_projects/python/
81
+ real_projects/typescript/
82
+
83
+ # Only exclude actual build artifact documentation, not general docs
84
+ # docs/*_ANALYSIS_BUILD.md
85
+ # docs/*_OPTIMIZATION_BUILD.md
86
+ # Remove overly broad patterns - they exclude valid documentation!
87
+ testing/qualitative/output/
88
+
89
+ # npm distribution artifacts
90
+ *.tgz
91
+ dist/
92
+ node_modules/
93
+ build-report.txt
@@ -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.
@@ -0,0 +1,229 @@
1
+ Metadata-Version: 2.4
2
+ Name: lightning-code-index
3
+ Version: 0.0.0
4
+ Summary: Lightning Code Index - Sub-millisecond semantic code search and analysis
5
+ Project-URL: Homepage, https://github.com/standardbeagle/lci
6
+ Project-URL: Repository, https://github.com/standardbeagle/lci
7
+ Project-URL: Issues, https://github.com/standardbeagle/lci/issues
8
+ Author: Standard Beagle
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: code-analysis,code-search,indexing,mcp,semantic-search
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Topic :: Software Development
27
+ Classifier: Topic :: Software Development :: Code Generators
28
+ Classifier: Topic :: Text Processing :: Indexing
29
+ Requires-Python: >=3.8
30
+ Description-Content-Type: text/markdown
31
+
32
+ # LCI - Lightning Code Index
33
+
34
+ Lightning-fast code indexing and search for AI assistants.
35
+
36
+ [![CI](https://github.com/standardbeagle/lci/actions/workflows/ci.yml/badge.svg)](https://github.com/standardbeagle/lci/actions/workflows/ci.yml)
37
+ [![Go Report Card](https://goreportcard.com/badge/github.com/standardbeagle/lci)](https://goreportcard.com/report/github.com/standardbeagle/lci)
38
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
39
+
40
+ ## Features
41
+
42
+ - **Sub-millisecond search**: Trigram-based indexing with <5ms search guarantee
43
+ - **Multi-language support**: Go, TypeScript, JavaScript, Python, Rust, C#, PHP, and more
44
+ - **MCP integration**: Model Context Protocol server for AI assistant integration
45
+ - **Semantic search**: Natural language queries with intelligent matching
46
+ - **Call graph analysis**: Track function calls, references, and dependencies
47
+ - **Semantic annotations**: `@lci:` vocabulary for marking up code with metadata
48
+
49
+ ## Installation
50
+
51
+ ### npm (recommended)
52
+
53
+ ```bash
54
+ npm install -g @standardbeagle/lci
55
+ ```
56
+
57
+ ### pip
58
+
59
+ ```bash
60
+ pip install lightning-code-index
61
+ ```
62
+
63
+ ### Homebrew (coming soon)
64
+
65
+ ```bash
66
+ brew install standardbeagle/tap/lci
67
+ ```
68
+
69
+ ### From Source
70
+
71
+ ```bash
72
+ go install github.com/standardbeagle/lci/cmd/lci@latest
73
+ ```
74
+
75
+ ### From Releases
76
+
77
+ Download pre-built binaries from [GitHub Releases](https://github.com/standardbeagle/lci/releases).
78
+
79
+ ## Quick Start
80
+
81
+ ### CLI Usage
82
+
83
+ ```bash
84
+ # Index and search in current directory
85
+ lci search "handleRequest"
86
+
87
+ # Find symbol definitions
88
+ lci def UserService
89
+
90
+ # Find all references to a symbol
91
+ lci refs CreateUser
92
+
93
+ # Display function call hierarchy
94
+ lci tree main
95
+
96
+ # Fast grep-style search
97
+ lci grep "TODO|FIXME"
98
+
99
+ # List files that would be indexed
100
+ lci list
101
+ ```
102
+
103
+ ### MCP Server
104
+
105
+ Start the MCP server for AI assistant integration:
106
+
107
+ ```bash
108
+ lci mcp
109
+ ```
110
+
111
+ #### Claude Code Integration
112
+
113
+ Add to your `.mcp.json`:
114
+
115
+ ```json
116
+ {
117
+ "lci": {
118
+ "command": "lci",
119
+ "args": ["mcp"],
120
+ "env": {}
121
+ }
122
+ }
123
+ ```
124
+
125
+ ## Configuration
126
+
127
+ Create `.lci.kdl` in your project root:
128
+
129
+ ```kdl
130
+ project {
131
+ name "my-project"
132
+ root "."
133
+ }
134
+
135
+ index {
136
+ include "**/*.go" "**/*.ts" "**/*.py"
137
+ exclude "**/node_modules/**" "**/vendor/**"
138
+ }
139
+
140
+ search {
141
+ max-results 100
142
+ context-lines 3
143
+ }
144
+ ```
145
+
146
+ ## MCP Tools
147
+
148
+ When running as an MCP server, LCI exposes these tools:
149
+
150
+ | Tool | Description |
151
+ |------|-------------|
152
+ | `search` | Semantic code search with fuzzy matching |
153
+ | `get_context` | Get detailed context for a code symbol |
154
+ | `find_files` | Fast file path search with glob patterns |
155
+ | `code_insight` | Codebase intelligence and analysis |
156
+ | `context` | Save/load code context manifests |
157
+ | `semantic_annotations` | Query @lci: semantic labels |
158
+ | `side_effects` | Analyze function purity and side effects |
159
+
160
+ ## Semantic Annotations
161
+
162
+ Mark up your code with `@lci:` annotations for enhanced AI understanding:
163
+
164
+ ```go
165
+ // @lci:risk[high] @lci:public-api
166
+ // @lci:requires[env:DATABASE_URL]
167
+ func HandleUserLogin(w http.ResponseWriter, r *http.Request) {
168
+ // ...
169
+ }
170
+
171
+ // @lci:purpose[Validate user credentials against database]
172
+ // @lci:must[Return error for invalid credentials]
173
+ func ValidateCredentials(username, password string) error {
174
+ // ...
175
+ }
176
+ ```
177
+
178
+ ### Annotation Categories
179
+
180
+ - **Risk & Safety**: `@lci:risk[low|medium|high|critical]`, `@lci:safe-zone`, `@lci:stability`
181
+ - **Dependencies**: `@lci:requires[env:VAR]`, `@lci:requires[db:table]`, `@lci:requires[service:name]`
182
+ - **Conventions**: `@lci:convention[pattern]`, `@lci:idiom[name]`, `@lci:template[name]`
183
+ - **Contracts**: `@lci:must[behavior]`, `@lci:must-not[behavior]`, `@lci:invariant[condition]`
184
+ - **Purpose**: `@lci:purpose[description]`, `@lci:domain[area]`, `@lci:owner[team]`
185
+
186
+ ## Architecture
187
+
188
+ ```
189
+ lci/
190
+ ├── cmd/lci/ # CLI entry point
191
+ ├── internal/
192
+ │ ├── core/ # Trigram index, symbol store, reference tracker
193
+ │ ├── parser/ # Tree-sitter based multi-language parsing
194
+ │ ├── search/ # Search engine and scoring
195
+ │ ├── indexing/ # Master index and pipeline
196
+ │ ├── mcp/ # MCP server and tools
197
+ │ └── analysis/ # Code analysis and metrics
198
+ └── pkg/ # Public API
199
+ ```
200
+
201
+ ## Performance
202
+
203
+ LCI is designed for speed:
204
+
205
+ - **Indexing**: <5s for typical projects (<10k files)
206
+ - **Search**: <5ms for most queries
207
+ - **Memory**: <100MB for typical web projects
208
+ - **Startup**: Near-instant with persistent index
209
+
210
+ ## Development
211
+
212
+ ```bash
213
+ # Run tests
214
+ go test ./...
215
+
216
+ # Build
217
+ go build ./cmd/lci
218
+
219
+ # Run with race detector
220
+ go test -race ./...
221
+ ```
222
+
223
+ ## License
224
+
225
+ MIT License - see [LICENSE](LICENSE) for details.
226
+
227
+ ## Contributing
228
+
229
+ Contributions are welcome! Please read the contributing guidelines before submitting PRs.
@@ -0,0 +1,198 @@
1
+ # LCI - Lightning Code Index
2
+
3
+ Lightning-fast code indexing and search for AI assistants.
4
+
5
+ [![CI](https://github.com/standardbeagle/lci/actions/workflows/ci.yml/badge.svg)](https://github.com/standardbeagle/lci/actions/workflows/ci.yml)
6
+ [![Go Report Card](https://goreportcard.com/badge/github.com/standardbeagle/lci)](https://goreportcard.com/report/github.com/standardbeagle/lci)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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.
@@ -0,0 +1,55 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "lightning-code-index"
7
+ dynamic = ["version"]
8
+ description = "Lightning Code Index - Sub-millisecond semantic code search and analysis"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.8"
12
+ authors = [
13
+ { name = "Standard Beagle" }
14
+ ]
15
+ keywords = ["code-search", "semantic-search", "code-analysis", "mcp", "indexing"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: MacOS",
22
+ "Operating System :: Microsoft :: Windows",
23
+ "Operating System :: POSIX :: Linux",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.8",
26
+ "Programming Language :: Python :: 3.9",
27
+ "Programming Language :: Python :: 3.10",
28
+ "Programming Language :: Python :: 3.11",
29
+ "Programming Language :: Python :: 3.12",
30
+ "Programming Language :: Python :: 3.13",
31
+ "Topic :: Software Development",
32
+ "Topic :: Software Development :: Code Generators",
33
+ "Topic :: Text Processing :: Indexing",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/standardbeagle/lci"
38
+ Repository = "https://github.com/standardbeagle/lci"
39
+ Issues = "https://github.com/standardbeagle/lci/issues"
40
+
41
+ [project.scripts]
42
+ lci = "lci:main"
43
+
44
+ [tool.hatch.version]
45
+ path = "python/lci/__init__.py"
46
+
47
+ [tool.hatch.build.targets.wheel]
48
+ packages = ["python/lci"]
49
+
50
+ [tool.hatch.build.targets.sdist]
51
+ include = [
52
+ "/python",
53
+ "/README.md",
54
+ "/LICENSE",
55
+ ]
@@ -0,0 +1,76 @@
1
+ """Lightning Code Index - Sub-millisecond semantic code search and analysis."""
2
+
3
+ __version__ = "0.0.0" # Replaced during release
4
+
5
+ import os
6
+ import platform
7
+ import subprocess
8
+ import sys
9
+ from pathlib import Path
10
+
11
+
12
+ def _get_binary_path() -> Path:
13
+ """Get the path to the lci binary."""
14
+ # Binary is bundled in the package
15
+ package_dir = Path(__file__).parent
16
+
17
+ system = platform.system().lower()
18
+ machine = platform.machine().lower()
19
+
20
+ # Normalize architecture names
21
+ if machine in ("x86_64", "amd64"):
22
+ arch = "amd64"
23
+ elif machine in ("arm64", "aarch64"):
24
+ arch = "arm64"
25
+ else:
26
+ raise RuntimeError(f"Unsupported architecture: {machine}")
27
+
28
+ # Normalize OS names and get binary name
29
+ if system == "darwin":
30
+ binary_name = f"lci_darwin_{arch}"
31
+ elif system == "linux":
32
+ binary_name = f"lci_linux_{arch}"
33
+ elif system == "windows":
34
+ if arch != "amd64":
35
+ raise RuntimeError(f"Windows only supports amd64, got: {arch}")
36
+ binary_name = "lci_windows_amd64.exe"
37
+ else:
38
+ raise RuntimeError(f"Unsupported operating system: {system}")
39
+
40
+ binary_path = package_dir / "bin" / binary_name
41
+
42
+ if not binary_path.exists():
43
+ raise RuntimeError(
44
+ f"Binary not found at {binary_path}. "
45
+ "This may be a source installation. "
46
+ "Please install from PyPI: pip install lci"
47
+ )
48
+
49
+ return binary_path
50
+
51
+
52
+ def main() -> int:
53
+ """Run the lci binary with the given arguments."""
54
+ try:
55
+ binary_path = _get_binary_path()
56
+ except RuntimeError as e:
57
+ print(f"Error: {e}", file=sys.stderr)
58
+ return 1
59
+
60
+ # Make sure binary is executable on Unix
61
+ if platform.system() != "Windows":
62
+ os.chmod(binary_path, 0o755)
63
+
64
+ # Run the binary with all arguments
65
+ result = subprocess.run(
66
+ [str(binary_path)] + sys.argv[1:],
67
+ stdin=sys.stdin,
68
+ stdout=sys.stdout,
69
+ stderr=sys.stderr,
70
+ )
71
+
72
+ return result.returncode
73
+
74
+
75
+ if __name__ == "__main__":
76
+ sys.exit(main())