aurora-lsp 0.1.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,99 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ pip-wheel-metadata/
20
+ share/python-wheels/
21
+ *.egg-info/
22
+ .installed.cfg
23
+ *.egg
24
+ MANIFEST
25
+
26
+ # Virtual environments
27
+ venv/
28
+ ENV/
29
+ env/
30
+ .venv
31
+
32
+ # IDEs
33
+ .vscode/
34
+ .idea/
35
+ *.swp
36
+ *.swo
37
+ *~
38
+ .DS_Store
39
+
40
+ # Testing
41
+ .pytest_cache/
42
+ .coverage
43
+ .coverage.*
44
+ htmlcov/
45
+ .tox/
46
+ .mypy_cache/
47
+ .ruff_cache/
48
+
49
+ # Jupyter Notebook
50
+ .ipynb_checkpoints
51
+
52
+ # Database
53
+ *.db
54
+ *.sqlite
55
+ *.sqlite3
56
+
57
+ # Logs
58
+ *.log
59
+
60
+ # Environment variables
61
+ .env
62
+ .env.local
63
+
64
+ # PyPI credentials
65
+ .pypirc
66
+
67
+ # Claude Code specific
68
+ .claude/
69
+
70
+ # Session checkpoints (personal, not shared)
71
+ .aurora/session.md
72
+
73
+ # Friction analysis outputs (experimental, project-local)
74
+ .aurora/friction/
75
+
76
+ # Build artifacts
77
+ *.whl
78
+ *.tar.gz
79
+ .coverage
80
+ coverage.xml
81
+ htmlcov/
82
+ cli_full_test.txt
83
+ openspec-source/
84
+
85
+ # Temporary reports and profiling results
86
+ *_report.json
87
+ *_report.txt
88
+ profiling_results.json
89
+ bandit-report.json
90
+ coverage.json
91
+ baseline_failures.txt
92
+ misclassified-files.txt
93
+ saas_summary.json
94
+
95
+ # Test artifacts that should use tmp directories
96
+ MagicMock/
97
+ test_plans/
98
+ fixtures/
99
+ /.aurora/
@@ -0,0 +1,195 @@
1
+ Metadata-Version: 2.4
2
+ Name: aurora-lsp
3
+ Version: 0.1.0
4
+ Summary: LSP integration for Aurora - code intelligence, dead code detection, and impact analysis
5
+ License: MIT
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: mcp>=1.0.0
8
+ Requires-Dist: multilspy>=0.0.15
9
+ Provides-Extra: dev
10
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
11
+ Requires-Dist: pytest>=7.0; extra == 'dev'
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Aurora LSP
15
+
16
+ LSP integration for Aurora - code intelligence, dead code detection, and impact analysis.
17
+
18
+ Built on [multilspy](https://github.com/microsoft/multilspy) (Microsoft) with custom layers for import filtering and code analysis.
19
+
20
+ ## Features
21
+
22
+ - **Find Usages (excluding imports)** - Distinguish actual code usage from import statements
23
+ - **Dead Code Detection** - Find functions/classes with 0 usages
24
+ - **Linting** - Get errors, warnings, hints via LSP diagnostics
25
+ - **Call Hierarchy** - Find callers of a function (where supported)
26
+
27
+ ## Supported Languages
28
+
29
+ | Language | LSP Server | Import Filtering | Call Hierarchy |
30
+ |----------|------------|------------------|----------------|
31
+ | Python | Pyright | ✓ | Limited |
32
+ | TypeScript | tsserver | ✓ | ✓ |
33
+ | JavaScript | tsserver | ✓ | ✓ |
34
+ | Rust | rust-analyzer | ✓ | ✓ |
35
+ | Go | gopls | ✓ | ✓ |
36
+ | Java | Eclipse JDT | ✓ | ✓ |
37
+ | Ruby | Solargraph | ✓ | Limited |
38
+ | C# | OmniSharp | ✓ | ✓ |
39
+ | Dart | Dart Analysis | ✓ | ✓ |
40
+ | Kotlin | kotlin-lsp | ✓ | Limited |
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install aurora-lsp
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ### Basic Usage
51
+
52
+ ```python
53
+ from aurora_lsp import AuroraLSP
54
+
55
+ # Initialize with workspace path
56
+ lsp = AuroraLSP("/path/to/project")
57
+
58
+ # Find usages of a symbol (excluding imports)
59
+ result = lsp.find_usages("src/main.py", line=10, col=5)
60
+ print(f"Found {result['total_usages']} usages ({result['total_imports']} imports filtered)")
61
+
62
+ # Get usage summary with impact assessment
63
+ summary = lsp.get_usage_summary("src/main.py", line=10, col=5, symbol_name="MyClass")
64
+ print(f"Impact: {summary['impact']} ({summary['files_affected']} files affected)")
65
+
66
+ # Find dead code
67
+ dead = lsp.find_dead_code()
68
+ for item in dead:
69
+ print(f"Unused: {item['name']} ({item['kind']}) in {item['file']}:{item['line']}")
70
+
71
+ # Lint a directory
72
+ diags = lsp.lint("src/")
73
+ print(f"{diags['total_errors']} errors, {diags['total_warnings']} warnings")
74
+
75
+ # Find callers of a function
76
+ callers = lsp.get_callers("src/utils.py", line=25, col=0)
77
+ for caller in callers:
78
+ print(f"Called by: {caller['name']} in {caller['file']}")
79
+
80
+ # Clean up
81
+ lsp.close()
82
+ ```
83
+
84
+ ### Context Manager
85
+
86
+ ```python
87
+ from aurora_lsp import AuroraLSP
88
+
89
+ with AuroraLSP("/path/to/project") as lsp:
90
+ dead = lsp.find_dead_code()
91
+ print(f"Found {len(dead)} dead code items")
92
+ # Server connections closed automatically
93
+ ```
94
+
95
+ ### Convenience Functions
96
+
97
+ ```python
98
+ from aurora_lsp import find_usages, find_dead_code, lint
99
+
100
+ # One-off operations (creates temporary LSP instance)
101
+ result = find_usages("src/main.py", line=10, col=5)
102
+ dead = find_dead_code("src/")
103
+ diags = lint("src/")
104
+ ```
105
+
106
+ ## API Reference
107
+
108
+ ### AuroraLSP
109
+
110
+ Main facade class providing synchronous API.
111
+
112
+ #### `find_usages(file_path, line, col, include_imports=False) -> dict`
113
+
114
+ Find usages of a symbol.
115
+
116
+ **Returns:**
117
+ - `usages`: List of usage locations with context
118
+ - `imports`: List of import locations
119
+ - `total_usages`: Count of actual usages
120
+ - `total_imports`: Count of import statements
121
+
122
+ #### `get_usage_summary(file_path, line, col, symbol_name=None) -> dict`
123
+
124
+ Get comprehensive usage summary.
125
+
126
+ **Returns:**
127
+ - `symbol`: Symbol name
128
+ - `total_usages`: Usage count
129
+ - `total_imports`: Import count
130
+ - `impact`: 'low' (<3), 'medium' (3-10), 'high' (>10)
131
+ - `files_affected`: Number of files with usages
132
+ - `usages_by_file`: Usages grouped by file
133
+
134
+ #### `find_dead_code(path=None, include_private=False) -> list[dict]`
135
+
136
+ Find functions/classes with 0 usages.
137
+
138
+ **Returns:** List of items with:
139
+ - `file`: File path
140
+ - `line`: Line number
141
+ - `name`: Symbol name
142
+ - `kind`: 'function', 'class', or 'method'
143
+ - `imports`: Number of times imported but never used
144
+
145
+ #### `lint(path=None, severity_filter=None) -> dict`
146
+
147
+ Get linting diagnostics.
148
+
149
+ **Returns:**
150
+ - `errors`: List of errors
151
+ - `warnings`: List of warnings
152
+ - `hints`: List of hints
153
+ - `total_errors`, `total_warnings`, `total_hints`: Counts
154
+
155
+ #### `get_callers(file_path, line, col) -> list[dict]`
156
+
157
+ Find functions that call this symbol.
158
+
159
+ **Returns:** List of items with:
160
+ - `file`: File path
161
+ - `line`: Line number
162
+ - `name`: Function name
163
+
164
+ ## Architecture
165
+
166
+ ```
167
+ ┌─────────────────────────────────────────┐
168
+ │ AuroraLSP (facade.py) │ High-level sync API
169
+ ├─────────────────────────────────────────┤
170
+ │ CodeAnalyzer (analysis.py) │ Dead code, usage summary
171
+ │ DiagnosticsFormatter (diagnostics.py) │ Linting
172
+ │ ImportFilter (filters.py) │ Import vs usage
173
+ ├─────────────────────────────────────────┤
174
+ │ AuroraLSPClient (client.py) │ Async LSP operations
175
+ ├─────────────────────────────────────────┤
176
+ │ multilspy (Microsoft) │ LSP server management
177
+ └─────────────────────────────────────────┘
178
+ ```
179
+
180
+ ## Development
181
+
182
+ ```bash
183
+ # Install dev dependencies
184
+ pip install -e ".[dev]"
185
+
186
+ # Run tests
187
+ pytest tests/
188
+
189
+ # Type checking
190
+ mypy src/
191
+ ```
192
+
193
+ ## License
194
+
195
+ MIT
@@ -0,0 +1,85 @@
1
+ # Aurora LSP MCP POC
2
+
3
+ Proof-of-concept MCP server to test Claude invocation of Aurora LSP tools.
4
+
5
+ ## Quick Test (Local)
6
+
7
+ ```bash
8
+ cd /home/hamr/PycharmProjects/aurora
9
+ python packages/lsp/test_poc_mcp.py
10
+ ```
11
+
12
+ ## Test with Claude Code
13
+
14
+ Add to `.mcp.json` in your project root:
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "aurora-lsp-poc": {
20
+ "command": "python",
21
+ "args": ["/home/hamr/PycharmProjects/aurora/packages/lsp/poc_mcp_server.py"]
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ Then restart Claude Code. Tools will appear as:
28
+ - `mcp__aurora-lsp-poc__lsp`
29
+ - `mcp__aurora-lsp-poc__mem_search`
30
+
31
+ ## Tools
32
+
33
+ ### `lsp` - Code Intelligence
34
+
35
+ Use BEFORE modifying/deleting code to understand impact.
36
+
37
+ | Action | Purpose | Required Params |
38
+ |--------|---------|-----------------|
39
+ | `check` | Quick pre-edit check | path, line |
40
+ | `impact` | Full impact analysis | path, line |
41
+ | `deadcode` | Find unused code | path |
42
+
43
+ **Test prompts:**
44
+ - "Check usage of line 42 in src/main.py before I delete it"
45
+ - "Find dead code in packages/core/"
46
+ - "Show impact of changing SQLiteStore"
47
+
48
+ ### `mem_search` - Search Code Memory
49
+
50
+ Search indexed code and knowledge base with LSP enrichment.
51
+
52
+ **Test prompts:**
53
+ - "Search for SOAR orchestrator"
54
+ - "Find code related to memory storage"
55
+
56
+ **To get full content:** Claude uses `Read` tool with file + lines from search results.
57
+
58
+ ## What POC Returns
59
+
60
+ All responses include `"_poc": true` - mock data:
61
+
62
+ ```json
63
+ {
64
+ "action": "check",
65
+ "symbol": "symbol_at_line_42",
66
+ "used_by": 7,
67
+ "risk": "medium",
68
+ "_poc": true
69
+ }
70
+ ```
71
+
72
+ ## Files
73
+
74
+ ```
75
+ packages/lsp/
76
+ ├── poc_mcp_server.py # MCP server (lsp, mem_search)
77
+ ├── test_poc_mcp.py # Local test
78
+ └── POC_README.md # This file
79
+ ```
80
+
81
+ ## Next Steps
82
+
83
+ Wire POC to real implementations:
84
+ - `lsp` → `AuroraLSP` facade
85
+ - `mem_search` → `memory_store.search()` + LSP enrichment
@@ -0,0 +1,182 @@
1
+ # Aurora LSP
2
+
3
+ LSP integration for Aurora - code intelligence, dead code detection, and impact analysis.
4
+
5
+ Built on [multilspy](https://github.com/microsoft/multilspy) (Microsoft) with custom layers for import filtering and code analysis.
6
+
7
+ ## Features
8
+
9
+ - **Find Usages (excluding imports)** - Distinguish actual code usage from import statements
10
+ - **Dead Code Detection** - Find functions/classes with 0 usages
11
+ - **Linting** - Get errors, warnings, hints via LSP diagnostics
12
+ - **Call Hierarchy** - Find callers of a function (where supported)
13
+
14
+ ## Supported Languages
15
+
16
+ | Language | LSP Server | Import Filtering | Call Hierarchy |
17
+ |----------|------------|------------------|----------------|
18
+ | Python | Pyright | ✓ | Limited |
19
+ | TypeScript | tsserver | ✓ | ✓ |
20
+ | JavaScript | tsserver | ✓ | ✓ |
21
+ | Rust | rust-analyzer | ✓ | ✓ |
22
+ | Go | gopls | ✓ | ✓ |
23
+ | Java | Eclipse JDT | ✓ | ✓ |
24
+ | Ruby | Solargraph | ✓ | Limited |
25
+ | C# | OmniSharp | ✓ | ✓ |
26
+ | Dart | Dart Analysis | ✓ | ✓ |
27
+ | Kotlin | kotlin-lsp | ✓ | Limited |
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install aurora-lsp
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ### Basic Usage
38
+
39
+ ```python
40
+ from aurora_lsp import AuroraLSP
41
+
42
+ # Initialize with workspace path
43
+ lsp = AuroraLSP("/path/to/project")
44
+
45
+ # Find usages of a symbol (excluding imports)
46
+ result = lsp.find_usages("src/main.py", line=10, col=5)
47
+ print(f"Found {result['total_usages']} usages ({result['total_imports']} imports filtered)")
48
+
49
+ # Get usage summary with impact assessment
50
+ summary = lsp.get_usage_summary("src/main.py", line=10, col=5, symbol_name="MyClass")
51
+ print(f"Impact: {summary['impact']} ({summary['files_affected']} files affected)")
52
+
53
+ # Find dead code
54
+ dead = lsp.find_dead_code()
55
+ for item in dead:
56
+ print(f"Unused: {item['name']} ({item['kind']}) in {item['file']}:{item['line']}")
57
+
58
+ # Lint a directory
59
+ diags = lsp.lint("src/")
60
+ print(f"{diags['total_errors']} errors, {diags['total_warnings']} warnings")
61
+
62
+ # Find callers of a function
63
+ callers = lsp.get_callers("src/utils.py", line=25, col=0)
64
+ for caller in callers:
65
+ print(f"Called by: {caller['name']} in {caller['file']}")
66
+
67
+ # Clean up
68
+ lsp.close()
69
+ ```
70
+
71
+ ### Context Manager
72
+
73
+ ```python
74
+ from aurora_lsp import AuroraLSP
75
+
76
+ with AuroraLSP("/path/to/project") as lsp:
77
+ dead = lsp.find_dead_code()
78
+ print(f"Found {len(dead)} dead code items")
79
+ # Server connections closed automatically
80
+ ```
81
+
82
+ ### Convenience Functions
83
+
84
+ ```python
85
+ from aurora_lsp import find_usages, find_dead_code, lint
86
+
87
+ # One-off operations (creates temporary LSP instance)
88
+ result = find_usages("src/main.py", line=10, col=5)
89
+ dead = find_dead_code("src/")
90
+ diags = lint("src/")
91
+ ```
92
+
93
+ ## API Reference
94
+
95
+ ### AuroraLSP
96
+
97
+ Main facade class providing synchronous API.
98
+
99
+ #### `find_usages(file_path, line, col, include_imports=False) -> dict`
100
+
101
+ Find usages of a symbol.
102
+
103
+ **Returns:**
104
+ - `usages`: List of usage locations with context
105
+ - `imports`: List of import locations
106
+ - `total_usages`: Count of actual usages
107
+ - `total_imports`: Count of import statements
108
+
109
+ #### `get_usage_summary(file_path, line, col, symbol_name=None) -> dict`
110
+
111
+ Get comprehensive usage summary.
112
+
113
+ **Returns:**
114
+ - `symbol`: Symbol name
115
+ - `total_usages`: Usage count
116
+ - `total_imports`: Import count
117
+ - `impact`: 'low' (<3), 'medium' (3-10), 'high' (>10)
118
+ - `files_affected`: Number of files with usages
119
+ - `usages_by_file`: Usages grouped by file
120
+
121
+ #### `find_dead_code(path=None, include_private=False) -> list[dict]`
122
+
123
+ Find functions/classes with 0 usages.
124
+
125
+ **Returns:** List of items with:
126
+ - `file`: File path
127
+ - `line`: Line number
128
+ - `name`: Symbol name
129
+ - `kind`: 'function', 'class', or 'method'
130
+ - `imports`: Number of times imported but never used
131
+
132
+ #### `lint(path=None, severity_filter=None) -> dict`
133
+
134
+ Get linting diagnostics.
135
+
136
+ **Returns:**
137
+ - `errors`: List of errors
138
+ - `warnings`: List of warnings
139
+ - `hints`: List of hints
140
+ - `total_errors`, `total_warnings`, `total_hints`: Counts
141
+
142
+ #### `get_callers(file_path, line, col) -> list[dict]`
143
+
144
+ Find functions that call this symbol.
145
+
146
+ **Returns:** List of items with:
147
+ - `file`: File path
148
+ - `line`: Line number
149
+ - `name`: Function name
150
+
151
+ ## Architecture
152
+
153
+ ```
154
+ ┌─────────────────────────────────────────┐
155
+ │ AuroraLSP (facade.py) │ High-level sync API
156
+ ├─────────────────────────────────────────┤
157
+ │ CodeAnalyzer (analysis.py) │ Dead code, usage summary
158
+ │ DiagnosticsFormatter (diagnostics.py) │ Linting
159
+ │ ImportFilter (filters.py) │ Import vs usage
160
+ ├─────────────────────────────────────────┤
161
+ │ AuroraLSPClient (client.py) │ Async LSP operations
162
+ ├─────────────────────────────────────────┤
163
+ │ multilspy (Microsoft) │ LSP server management
164
+ └─────────────────────────────────────────┘
165
+ ```
166
+
167
+ ## Development
168
+
169
+ ```bash
170
+ # Install dev dependencies
171
+ pip install -e ".[dev]"
172
+
173
+ # Run tests
174
+ pytest tests/
175
+
176
+ # Type checking
177
+ mypy src/
178
+ ```
179
+
180
+ ## License
181
+
182
+ MIT