@liendev/parser 0.39.0 → 0.40.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.
Files changed (2) hide show
  1. package/README.md +73 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # @liendev/parser
2
+
3
+ AST parsing, complexity analysis, and semantic chunking for [Lien](https://lien.dev).
4
+
5
+ This package provides the core parsing and analysis capabilities used by Lien's semantic code search. It is extracted from `@liendev/core` to enable lightweight consumers (like `@liendev/review`) that need parsing without embeddings or vector DB dependencies.
6
+
7
+ ## Features
8
+
9
+ - **AST Parsing** — Tree-sitter-based parsing for TypeScript, JavaScript, Python, PHP, and Rust
10
+ - **Semantic Chunking** — Split code into meaningful chunks respecting function/class boundaries
11
+ - **Complexity Analysis** — Cyclomatic, cognitive, and Halstead complexity metrics
12
+ - **Dependency Analysis** — Import/export tracking with transitive dependent resolution
13
+ - **Symbol Extraction** — Extract functions, classes, interfaces, and call sites from AST
14
+ - **Test Association Detection** — Convention-based and import-based test file detection
15
+ - **Codebase Scanning** — File discovery with gitignore support and ecosystem presets
16
+
17
+ ## Supported Languages
18
+
19
+ | Language | AST Parsing | Complexity Metrics | Import/Export Tracking |
20
+ |----------|:-----------:|:------------------:|:---------------------:|
21
+ | TypeScript | Yes | Yes | Yes |
22
+ | JavaScript | Yes | Yes | Yes |
23
+ | Python | Yes | Yes | Yes |
24
+ | PHP | Yes | Yes | Yes |
25
+ | Rust | Yes | Yes | Yes |
26
+
27
+ Line-based chunking and symbol extraction are available for additional languages including Go, Java, C#, Ruby, and Vue.
28
+
29
+ ## Usage
30
+
31
+ ```typescript
32
+ import {
33
+ parseAST,
34
+ chunkByAST,
35
+ detectLanguage,
36
+ analyzeComplexityFromChunks,
37
+ scanCodebase,
38
+ chunkFile,
39
+ } from '@liendev/parser';
40
+
41
+ // Parse a file into an AST
42
+ const language = detectLanguage('example.ts');
43
+ const result = parseAST(sourceCode, language);
44
+
45
+ // Chunk a file using AST-aware boundaries
46
+ const chunks = await chunkByAST('src/auth.ts', sourceCode, {
47
+ chunkSize: 75,
48
+ chunkOverlap: 10,
49
+ });
50
+
51
+ // Analyze complexity from chunks
52
+ const report = analyzeComplexityFromChunks(chunks, files, {
53
+ cyclomatic: 15,
54
+ cognitive: 15,
55
+ halstead_effort: 60,
56
+ halstead_bugs: 1.5,
57
+ });
58
+ ```
59
+
60
+ ## Architecture
61
+
62
+ This package is part of the [Lien](https://github.com/getlien/lien) monorepo:
63
+
64
+ ```
65
+ @liendev/parser ← AST, complexity, chunking, scanning (this package)
66
+ @liendev/core ← embeddings, vector DB, search (depends on parser)
67
+ @liendev/lien ← CLI and MCP server (depends on both)
68
+ @liendev/review ← PR review (depends on parser only)
69
+ ```
70
+
71
+ ## License
72
+
73
+ AGPL-3.0 — see [LICENSE](https://github.com/getlien/lien/blob/main/LICENSE) for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liendev/parser",
3
- "version": "0.39.0",
3
+ "version": "0.40.0",
4
4
  "description": "AST parsing, complexity analysis, and semantic chunking for Lien",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",