@liendev/lien 0.18.0 → 0.19.1
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/CURSOR_RULES_TEMPLATE.md +17 -2
- package/README.md +27 -3
- package/dist/index.js +2863 -1182
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/CURSOR_RULES_TEMPLATE.md
CHANGED
|
@@ -18,6 +18,7 @@ You have access to Lien semantic search tools. USE THEM INSTEAD OF grep/ripgrep/
|
|
|
18
18
|
| Edit a file | `get_files_context` FIRST | direct edit |
|
|
19
19
|
| Find similar code | `find_similar` | manual search |
|
|
20
20
|
| "What depends on this file?" | `get_dependents` | manual grep |
|
|
21
|
+
| "What's complex?" / "Tech debt?" | `get_complexity` | manual analysis |
|
|
21
22
|
|
|
22
23
|
## Before ANY Code Change
|
|
23
24
|
|
|
@@ -59,6 +60,18 @@ REQUIRED sequence:
|
|
|
59
60
|
- Complexity metrics (how complex the dependent code is)
|
|
60
61
|
- Highlights top 5 most complex dependents when complexity data available
|
|
61
62
|
|
|
63
|
+
**`get_complexity({ top: 10 })`**
|
|
64
|
+
- Find most complex functions in the codebase
|
|
65
|
+
- Analyzes multiple complexity metrics:
|
|
66
|
+
- **Test paths**: Number of test cases needed for full coverage (cyclomatic)
|
|
67
|
+
- **Mental load**: How hard to follow - penalizes nesting (cognitive)
|
|
68
|
+
- **Time to understand**: Estimated reading time (Halstead effort)
|
|
69
|
+
- **Estimated bugs**: Predicted bug count (Halstead volume / 3000)
|
|
70
|
+
- Use for tech debt analysis and refactoring prioritization
|
|
71
|
+
- Returns `metricType` ('cyclomatic', 'cognitive', 'halstead_effort', or 'halstead_bugs')
|
|
72
|
+
- Human-readable output: "23 (needs ~23 tests)", "🧠 45", "~2h 30m", "2.27 bugs"
|
|
73
|
+
- Optional: `files` to filter specific files, `threshold` to set minimum complexity
|
|
74
|
+
|
|
62
75
|
## Test Associations
|
|
63
76
|
|
|
64
77
|
`get_files_context` returns `testAssociations` showing which tests import/cover the file.
|
|
@@ -122,10 +135,12 @@ get_files_context({ filepaths: ["src/auth.ts", "src/user.ts"] })
|
|
|
122
135
|
|
|
123
136
|
## AST Metadata
|
|
124
137
|
|
|
125
|
-
Results include rich metadata: `symbolName`, `symbolType`, `complexity`, `parameters`, `signature`.
|
|
138
|
+
Results include rich metadata: `symbolName`, `symbolType`, `complexity`, `cognitiveComplexity`, `halsteadVolume`, `halsteadDifficulty`, `halsteadEffort`, `halsteadBugs`, `parameters`, `signature`.
|
|
126
139
|
|
|
127
140
|
Use for filtering:
|
|
128
|
-
- Complex functions: `results.filter(r => r.metadata.complexity >
|
|
141
|
+
- Complex functions (cyclomatic): `results.filter(r => r.metadata.complexity > 10)`
|
|
142
|
+
- Complex functions (cognitive): `results.filter(r => r.metadata.cognitiveComplexity > 15)`
|
|
143
|
+
- Long to understand (>1 hour): `results.filter(r => r.metadata.halsteadEffort > 64800)`
|
|
129
144
|
- Methods only: `results.filter(r => r.metadata.symbolType === 'method')`
|
|
130
145
|
|
|
131
146
|
## When to Use grep Instead
|
package/README.md
CHANGED
|
@@ -17,8 +17,10 @@ Lien connects AI coding assistants like Cursor to your codebase through the Mode
|
|
|
17
17
|
- 🎯 **MCP Integration** - Works seamlessly with Cursor and other MCP-compatible tools
|
|
18
18
|
- ⚡ **Fast** - Sub-500ms queries, minutes to index large codebases
|
|
19
19
|
- 🆓 **Free Forever** - No API costs, no subscriptions, no usage limits
|
|
20
|
-
- 📦 **Framework-Aware** - Auto-detects Node.js, Laravel; supports 15+ languages
|
|
20
|
+
- 📦 **Framework-Aware** - Auto-detects Node.js, Laravel, Shopify; supports 15+ languages
|
|
21
21
|
- 🏗️ **Monorepo Support** - Index multiple frameworks in one repository
|
|
22
|
+
- 📊 **Complexity Analysis** - Human-friendly metrics: test paths, mental load, time to understand
|
|
23
|
+
- 🔍 **Impact Analysis** - Find all dependents before refactoring with risk assessment
|
|
22
24
|
|
|
23
25
|
## Quick Start
|
|
24
26
|
|
|
@@ -46,13 +48,35 @@ lien index
|
|
|
46
48
|
|
|
47
49
|
**👉 [Full installation guide](https://lien.dev/guide/installation)**
|
|
48
50
|
|
|
51
|
+
## MCP Tools
|
|
52
|
+
|
|
53
|
+
Lien exposes **6 powerful tools** via Model Context Protocol:
|
|
54
|
+
|
|
55
|
+
| Tool | Description |
|
|
56
|
+
|------|-------------|
|
|
57
|
+
| `semantic_search` | Natural language code search |
|
|
58
|
+
| `find_similar` | Find similar code patterns |
|
|
59
|
+
| `get_files_context` | Get file context with test associations |
|
|
60
|
+
| `list_functions` | List symbols by pattern |
|
|
61
|
+
| `get_dependents` | Impact analysis (what depends on this?) |
|
|
62
|
+
| `get_complexity` | Tech debt analysis with human-friendly metrics |
|
|
63
|
+
|
|
64
|
+
### Complexity Metrics
|
|
65
|
+
|
|
66
|
+
Lien tracks code complexity with intuitive outputs:
|
|
67
|
+
|
|
68
|
+
- 🔀 **Test paths** - Cyclomatic complexity as "needs ~X tests for full coverage"
|
|
69
|
+
- 🧠 **Mental load** - Cognitive complexity with nesting penalty
|
|
70
|
+
- ⏱️ **Time to understand** - Halstead effort as readable duration (~2h 30m)
|
|
71
|
+
- 🐛 **Estimated bugs** - Halstead prediction (Volume / 3000)
|
|
72
|
+
|
|
49
73
|
## Documentation
|
|
50
74
|
|
|
51
75
|
- **[Installation](https://lien.dev/guide/installation)** - npm, npx, or local setup
|
|
52
76
|
- **[Getting Started](https://lien.dev/guide/getting-started)** - Step-by-step configuration for Cursor
|
|
53
|
-
- **[Configuration](https://lien.dev/guide/configuration)** - Customize indexing, performance
|
|
77
|
+
- **[Configuration](https://lien.dev/guide/configuration)** - Customize indexing, thresholds, performance
|
|
54
78
|
- **[CLI Commands](https://lien.dev/guide/cli-commands)** - Full command reference
|
|
55
|
-
- **[MCP Tools](https://lien.dev/guide/mcp-tools)** - API for
|
|
79
|
+
- **[MCP Tools](https://lien.dev/guide/mcp-tools)** - Complete API reference for all 6 tools
|
|
56
80
|
- **[How It Works](https://lien.dev/how-it-works)** - Architecture overview
|
|
57
81
|
|
|
58
82
|
## Supported Languages
|