@liendev/lien 0.17.0 → 0.19.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.
@@ -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 > 5)`
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