@liendev/lien 0.13.0 → 0.14.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.
@@ -79,7 +79,7 @@ find_similar({
79
79
  - Consistency: ensure new code matches existing patterns
80
80
  - Duplication detection
81
81
 
82
- ### `list_functions` ⚡ NEW in v0.5.0
82
+ ### `list_functions` ⚡
83
83
  **Fast symbol-based search for functions, classes, and interfaces by name.**
84
84
 
85
85
  ```typescript
@@ -104,7 +104,6 @@ list_functions({
104
104
  **Best practices:**
105
105
  - Use regex patterns that match naming conventions: `.*Controller.*`, `handle.*`, `get.*`
106
106
  - Combine with language filter for large codebases: `language: "typescript"`
107
- - For best results: run `lien reindex` after upgrading to v0.5.0
108
107
 
109
108
  **When to use `list_functions` vs `semantic_search`:**
110
109
  - ✅ Use `list_functions` when you know the naming pattern (e.g., "all Controllers")
@@ -187,6 +186,7 @@ const simpleValidators = functions.filter(r => (r.metadata.parameters?.length ||
187
186
  **Currently supported:**
188
187
  - ✅ TypeScript (`.ts`, `.tsx`)
189
188
  - ✅ JavaScript (`.js`, `.jsx`, `.mjs`, `.cjs`)
189
+ - ✅ Shopify Liquid (`.liquid`) - **Special regex-based chunking**
190
190
 
191
191
  **Coming soon:**
192
192
  - 🔜 Python, Go, Rust, Java, PHP, and more
@@ -195,6 +195,72 @@ const simpleValidators = functions.filter(r => (r.metadata.parameters?.length ||
195
195
  - For unsupported languages, Lien automatically falls back to line-based chunking
196
196
  - No disruption to existing workflows
197
197
 
198
+ ### Shopify Liquid Support ⚡ NEW
199
+
200
+ Lien provides specialized chunking for Shopify themes with **complete dependency tracking**:
201
+
202
+ **Liquid template handling:**
203
+ - `{% schema %}` blocks - Kept as single chunks, section names extracted
204
+ - `{% style %}` blocks - Preserved together for scoped CSS
205
+ - `{% javascript %}` blocks - Kept intact
206
+ - Oversized blocks (>225 lines) - Intelligently split to prevent token limits
207
+
208
+ **JSON template handling (Shopify 2.0+):**
209
+ - `templates/**/*.json` - Template definition files
210
+ - Section references extracted from JSON structure
211
+ - Template names extracted from filepath
212
+
213
+ **Complete dependency tracking (tracked in `metadata.imports`):**
214
+ - `{% render 'snippet-name' %}` - Snippet dependencies
215
+ - `{% include 'snippet-name' %}` - Legacy includes
216
+ - `{% section 'section-name' %}` - Section usage in layouts
217
+ - JSON template sections - Section type references
218
+
219
+ **Example metadata:**
220
+ ```typescript
221
+ // JSON Template
222
+ {
223
+ content: "{\"sections\": {\"main\": {\"type\": \"main-product\"}}}",
224
+ metadata: {
225
+ file: "templates/product.json",
226
+ type: "template",
227
+ language: "json",
228
+ symbolName: "product", // Template name
229
+ symbolType: "template",
230
+ imports: ["main-product"] // Sections used by this template
231
+ }
232
+ }
233
+
234
+ // Liquid Section Schema
235
+ {
236
+ content: "{% schema %}\n{\"name\": \"Hero Section\", ...}\n{% endschema %}",
237
+ metadata: {
238
+ file: "sections/hero.liquid",
239
+ type: "block",
240
+ language: "liquid",
241
+ symbolName: "Hero Section", // Extracted from schema JSON
242
+ symbolType: "schema",
243
+ imports: undefined // No render/include/section tags found in this block
244
+ }
245
+ }
246
+
247
+ // Liquid Template Content
248
+ {
249
+ content: "<div>{% render 'logo' %}{% render 'nav' %}</div>",
250
+ metadata: {
251
+ file: "sections/header.liquid",
252
+ type: "template",
253
+ language: "liquid",
254
+ imports: ["logo", "nav"] // Tracked dependencies
255
+ }
256
+ }
257
+ ```
258
+
259
+ **Benefits:**
260
+ - **Complete dependency graph** - JSON templates → sections → snippets
261
+ - **Schema preservation** - Never splits section configuration across chunks
262
+ - **Better context** - AI knows full theme structure and all dependencies
263
+
198
264
  ### Known Limitations
199
265
 
200
266
  **Very large files (1000+ lines):**
@@ -277,7 +343,7 @@ Lien uses structured error codes for programmatic error handling:
277
343
  - `INVALID_INPUT` - Parameter validation failed
278
344
  - `FILE_NOT_FOUND` - Requested file doesn't exist in index
279
345
  - `INDEX_NOT_FOUND` - No index found (run `lien index`)
280
- - `INDEX_CORRUPTED` - Index is corrupted (run `lien reindex`)
346
+ - `INDEX_CORRUPTED` - Index is corrupted (run `lien index` to rebuild)
281
347
  - `EMBEDDING_GENERATION_FAILED` - Embedding model failed (retryable)
282
348
  - `INTERNAL_ERROR` - Unexpected internal error
283
349
 
@@ -341,7 +407,7 @@ Lien uses structured error codes for programmatic error handling:
341
407
  4. Analyze and suggest improvements
342
408
  ```
343
409
 
344
- ### Pattern 7: Finding All Classes/Functions by Name Pattern ⚡ NEW
410
+ ### Pattern 7: Finding All Classes/Functions by Name Pattern ⚡
345
411
  ```
346
412
  1. list_functions({ pattern: ".*Controller.*", language: "php" })
347
413
  2. Review the list of matching classes
@@ -354,6 +420,39 @@ Lien uses structured error codes for programmatic error handling:
354
420
  - "What Services exist?" → `list_functions({ pattern: ".*Service.*" })`
355
421
  - "Find all API handlers" → `list_functions({ pattern: "handle.*" })`
356
422
 
423
+ ### Pattern 8: Working with Shopify Themes (Liquid + JSON) ⚡
424
+ ```
425
+ 1. semantic_search({ query: "product template configuration" })
426
+ → Finds JSON template with section references
427
+ 2. Check metadata.imports to see which sections are used
428
+ 3. semantic_search({ query: "main-product section schema" })
429
+ → Find section definition
430
+ 4. Review section's metadata.imports to see which snippets it renders
431
+ → Complete dependency chain visible!
432
+ ```
433
+
434
+ **Example queries:**
435
+ - "Find the product template sections" → Returns `templates/product.json` with section imports
436
+ - "Which sections are on the collection page?" → Check JSON template imports
437
+ - "What sections use the product-card snippet?" → Reverse lookup via imports
438
+ - "Show the hero section schema" → Returns complete `{% schema %}` block with name
439
+ - "What snippets does the footer render?" → See `metadata.imports: ["logo", "nav", ...]`
440
+
441
+ **Complete dependency graph:**
442
+ ```
443
+ templates/product.json
444
+ → imports: ["main-product", "recommendations"]
445
+ → sections/main-product.liquid
446
+ → imports: ["product-card", "price-tag"]
447
+ → snippets/product-card.liquid
448
+ → snippets/price-tag.liquid
449
+ ```
450
+
451
+ **Dependency tracking:**
452
+ - **JSON templates** - `metadata.imports` contains section type references
453
+ - **Liquid templates** - `metadata.imports` contains `{% render %}`, `{% include %}`, `{% section %}` references
454
+ - Full theme architecture visible through imports metadata
455
+
357
456
  ---
358
457
 
359
458
  ## Decision Tree: Lien vs Other Tools
@@ -365,7 +464,7 @@ Lien uses structured error codes for programmatic error handling:
365
464
  ✅ Exploring unfamiliar parts of codebase
366
465
  ✅ Searching by what code **does** (behavior, functionality)
367
466
 
368
- ### Use `list_functions` when: ⚡ NEW
467
+ ### Use `list_functions` when: ⚡
369
468
  ✅ User asks "show me all Controllers" or similar structural queries
370
469
  ✅ Looking for classes/functions matching a **naming pattern**
371
470
  ✅ Getting architectural overview (all Services, all Handlers, etc.)
@@ -406,6 +505,9 @@ Lien uses structured error codes for programmatic error handling:
406
505
  - "React components with form state"
407
506
  - "database migration scripts"
408
507
  - "API endpoints for user data"
508
+ - "Shopify section schema for hero banner" (Liquid)
509
+ - "files that render product-card snippet" (Liquid)
510
+ - "layout file with header and footer sections" (Liquid)
409
511
 
410
512
  ### Bad Queries (DON'T DO THIS):
411
513
  - "auth" (too vague)
@@ -426,9 +528,10 @@ Lien uses structured error codes for programmatic error handling:
426
528
  - First query loads embeddings (~1-2s), subsequent queries are fast (<500ms)
427
529
  - Increase `limit` to 10-15 for broad exploration
428
530
  - Results are ranked by semantic relevance (trust the ranking)
429
- - User can re-index with `lien reindex` if results seem stale
531
+ - User can re-index with `lien index` if results seem stale
430
532
  - **Relevance categories**: All search results include a `relevance` field (`highly_relevant`, `relevant`, `loosely_related`, `not_relevant`) to help interpret search quality at a glance
431
533
  - **Test associations**: Lien automatically detects test-source relationships across 12 languages using convention-based patterns and import analysis
534
+ - **Shopify Liquid themes**: Semantic chunking reduces chunk count by ~60% (schema/style/javascript blocks preserved), improving search quality and performance
432
535
 
433
536
  ---
434
537
 
@@ -450,10 +553,12 @@ Create a `lien.mdc` file in your `.cursor/rules/` directory:
450
553
  ```bash
451
554
  # From your project directory
452
555
  mkdir -p .cursor/rules
453
- cp /path/to/lien/CURSOR_RULES_TEMPLATE.md .cursor/rules/lien.mdc
556
+ cp node_modules/@liendev/lien/CURSOR_RULES_TEMPLATE.md .cursor/rules/lien.mdc
454
557
  ```
455
558
 
456
559
  The `alwaysApply: true` frontmatter ensures Cursor uses Lien for all files in your project.
457
560
 
458
561
  This approach allows you to have multiple rule files in `.cursor/rules/` without conflicts.
459
562
 
563
+ **Note:** The template is automatically copied during `lien init` to `.cursor/rules/lien.mdc`.
564
+
package/README.md CHANGED
@@ -72,7 +72,15 @@ Contributions welcome! See **[CONTRIBUTING.md](./CONTRIBUTING.md)** for guidelin
72
72
 
73
73
  ## License
74
74
 
75
- MIT © [Alf Henderson](https://github.com/alfhen)
75
+ AGPL-3.0 © [Alf Henderson](https://github.com/alfhen)
76
+
77
+ **Lien is free forever for local use.** The AGPL license ensures that:
78
+ - ✅ You can use Lien locally without restrictions
79
+ - ✅ You can modify and distribute Lien freely
80
+ - ✅ Improvements get contributed back to the community
81
+ - ✅ We can sustain long-term development
82
+
83
+ For questions about licensing, contact us at alf@lien.dev
76
84
 
77
85
  ---
78
86