@liendev/lien 0.16.0 → 0.18.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/CURSOR_RULES_TEMPLATE.md +35 -4
- package/dist/index.js +560 -138
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CURSOR_RULES_TEMPLATE.md
CHANGED
|
@@ -17,6 +17,7 @@ You have access to Lien semantic search tools. USE THEM INSTEAD OF grep/ripgrep/
|
|
|
17
17
|
| "Find all Controllers" | `list_functions` | grep |
|
|
18
18
|
| Edit a file | `get_files_context` FIRST | direct edit |
|
|
19
19
|
| Find similar code | `find_similar` | manual search |
|
|
20
|
+
| "What depends on this file?" | `get_dependents` | manual grep |
|
|
20
21
|
|
|
21
22
|
## Before ANY Code Change
|
|
22
23
|
|
|
@@ -35,9 +36,11 @@ REQUIRED sequence:
|
|
|
35
36
|
|
|
36
37
|
**`get_files_context({ filepaths: "path/to/file.ts" })`** or **`get_files_context({ filepaths: ["file1.ts", "file2.ts"] })`**
|
|
37
38
|
- MANDATORY before editing any file
|
|
38
|
-
- Returns `testAssociations`: which tests cover this file
|
|
39
|
+
- Returns `testAssociations`: which tests import/cover this file (reverse dependency lookup)
|
|
39
40
|
- Shows file dependencies and relationships
|
|
40
41
|
- Accepts single filepath or array of filepaths for batch operations
|
|
42
|
+
- Single file returns: `{ file: string, chunks: [], testAssociations: [] }`
|
|
43
|
+
- Multiple files returns: `{ files: { [path]: { chunks: [], testAssociations: [] } } }`
|
|
41
44
|
|
|
42
45
|
**`list_functions({ pattern: ".*Controller.*" })`**
|
|
43
46
|
- Fast symbol lookup by naming pattern
|
|
@@ -48,11 +51,30 @@ REQUIRED sequence:
|
|
|
48
51
|
- Find similar implementations for consistency
|
|
49
52
|
- Use when refactoring or detecting duplication
|
|
50
53
|
|
|
54
|
+
**`get_dependents({ filepath: "path/to/file.ts", depth: 1 })`**
|
|
55
|
+
- Find all files that import/depend on a target file
|
|
56
|
+
- Use for impact analysis: "What breaks if I change this?"
|
|
57
|
+
- Returns risk level (low/medium/high/critical) based on:
|
|
58
|
+
- Dependency count (how many files import it)
|
|
59
|
+
- Complexity metrics (how complex the dependent code is)
|
|
60
|
+
- Highlights top 5 most complex dependents when complexity data available
|
|
61
|
+
|
|
51
62
|
## Test Associations
|
|
52
63
|
|
|
53
|
-
`get_files_context` returns `testAssociations` showing which tests cover the file.
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
`get_files_context` returns `testAssociations` showing which tests import/cover the file.
|
|
65
|
+
- Uses reverse dependency lookup to find test files that import the source file
|
|
66
|
+
- Returns array of test file paths for each requested file
|
|
67
|
+
- ALWAYS check this before modifying source code
|
|
68
|
+
- After changes, remind the user: "This file is covered by [test files] - run these to verify."
|
|
69
|
+
|
|
70
|
+
Example:
|
|
71
|
+
```typescript
|
|
72
|
+
get_files_context({ filepaths: "src/auth.ts" })
|
|
73
|
+
// Returns: { file: "src/auth.ts", chunks: [...], testAssociations: ["src/__tests__/auth.test.ts"] }
|
|
74
|
+
|
|
75
|
+
get_files_context({ filepaths: ["src/auth.ts", "src/user.ts"] })
|
|
76
|
+
// Returns: { files: { "src/auth.ts": { chunks: [...], testAssociations: [...] }, ... } }
|
|
77
|
+
```
|
|
56
78
|
|
|
57
79
|
## Workflow Patterns
|
|
58
80
|
|
|
@@ -73,6 +95,15 @@ After changes, remind the user: "This file is covered by [test files] - run thes
|
|
|
73
95
|
5. Tell user which tests to run
|
|
74
96
|
```
|
|
75
97
|
|
|
98
|
+
### Pattern 3: Impact Analysis Before Refactoring
|
|
99
|
+
```
|
|
100
|
+
1. get_dependents({ filepath: "target/file.ts" })
|
|
101
|
+
2. Review risk level and dependent count
|
|
102
|
+
3. Check highComplexityDependents (if any)
|
|
103
|
+
4. Use get_files_context on high-risk dependents
|
|
104
|
+
5. Plan refactoring strategy based on impact
|
|
105
|
+
```
|
|
106
|
+
|
|
76
107
|
## Query Construction
|
|
77
108
|
|
|
78
109
|
### Good Queries (DO THIS)
|