@liendev/lien 0.10.0 → 0.12.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 +67 -0
- package/dist/index.js +1672 -773
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/CURSOR_RULES_TEMPLATE.md
CHANGED
|
@@ -114,6 +114,73 @@ list_functions({
|
|
|
114
114
|
|
|
115
115
|
---
|
|
116
116
|
|
|
117
|
+
## Input Validation & Error Handling
|
|
118
|
+
|
|
119
|
+
Lien uses Zod schemas for runtime type-safe validation of all tool inputs. This provides:
|
|
120
|
+
- **Automatic validation** of all parameters before tool execution
|
|
121
|
+
- **Rich error messages** with field-level feedback
|
|
122
|
+
- **Type safety** with full TypeScript inference
|
|
123
|
+
- **Consistent error structure** across all tools
|
|
124
|
+
|
|
125
|
+
### Understanding Validation Errors
|
|
126
|
+
|
|
127
|
+
When you provide invalid parameters, you'll receive a structured error response:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"error": "Invalid parameters",
|
|
132
|
+
"code": "INVALID_INPUT",
|
|
133
|
+
"details": [
|
|
134
|
+
{
|
|
135
|
+
"field": "query",
|
|
136
|
+
"message": "Query must be at least 3 characters"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"field": "limit",
|
|
140
|
+
"message": "Limit cannot exceed 50"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Common Validation Rules
|
|
147
|
+
|
|
148
|
+
**semantic_search:**
|
|
149
|
+
- `query`: 3-500 characters (required)
|
|
150
|
+
- `limit`: 1-50 (default: 5)
|
|
151
|
+
|
|
152
|
+
**find_similar:**
|
|
153
|
+
- `code`: minimum 10 characters (required)
|
|
154
|
+
- `limit`: 1-20 (default: 5)
|
|
155
|
+
|
|
156
|
+
**get_file_context:**
|
|
157
|
+
- `filepath`: cannot be empty (required)
|
|
158
|
+
- `includeRelated`: boolean (default: true)
|
|
159
|
+
|
|
160
|
+
**list_functions:**
|
|
161
|
+
- `pattern`: optional regex string
|
|
162
|
+
- `language`: optional language filter
|
|
163
|
+
|
|
164
|
+
### Error Codes
|
|
165
|
+
|
|
166
|
+
Lien uses structured error codes for programmatic error handling:
|
|
167
|
+
|
|
168
|
+
- `INVALID_INPUT` - Parameter validation failed
|
|
169
|
+
- `FILE_NOT_FOUND` - Requested file doesn't exist in index
|
|
170
|
+
- `INDEX_NOT_FOUND` - No index found (run `lien index`)
|
|
171
|
+
- `INDEX_CORRUPTED` - Index is corrupted (run `lien reindex`)
|
|
172
|
+
- `EMBEDDING_GENERATION_FAILED` - Embedding model failed (retryable)
|
|
173
|
+
- `INTERNAL_ERROR` - Unexpected internal error
|
|
174
|
+
|
|
175
|
+
### Best Practices
|
|
176
|
+
|
|
177
|
+
1. **Always provide required fields**: Check tool schemas for required parameters
|
|
178
|
+
2. **Respect validation limits**: Don't exceed max values for `limit` parameters
|
|
179
|
+
3. **Use descriptive queries**: Avoid very short or vague queries
|
|
180
|
+
4. **Handle validation errors gracefully**: Parse error details to understand what went wrong
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
117
184
|
## Workflow Patterns (FOLLOW THESE)
|
|
118
185
|
|
|
119
186
|
### Pattern 1: User Asks "Where is X?"
|