universal-ast-mapper 1.22.0 → 1.22.1

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 (3) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +59 -12
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ since 1.0.0, guarantees a stable MCP tool / CLI surface across the 1.x line.
6
6
 
7
7
  ---
8
8
 
9
+ ## [1.22.1] — 2026-06-10 · Docs
10
+ - README refreshed to match v1.20–1.22: 28 tools / 30 commands, PHP+Ruby capability
11
+ columns, `cache`/`check` CLI + config + env-var docs, `check_quality_gate` reference,
12
+ Action `mode: check` example, new Performance section. No code changes.
13
+
9
14
  ## [1.22.0] — 2026-06-10 · PHP & Ruby support
10
15
  - **PHP** (`.php`): classes/interfaces/traits/enums, methods with visibility modifiers,
11
16
  class consts + properties, namespaces; imports from `use` (incl. grouped `use A\{B, C}`
package/README.md CHANGED
@@ -4,20 +4,20 @@ An **MCP server + CLI tool** that turns source code into structured, machine-rea
4
4
 
5
5
  Built on [tree-sitter](https://tree-sitter.github.io/) WASM grammars. Zero regex guessing — real AST parsing.
6
6
 
7
- **27 MCP tools / 28 CLI commands / 5 MCP prompts** spanning skeletons, dependency graphs, and deep analysis — dead code, cycles, change-impact, complexity, duplicates, unused params, type-flow, decorators — plus monorepo support, an interactive **graph explorer** (`ast-map explore`), **watch mode**, and a one-page **health dashboard** (`ast-map report`).
7
+ **28 MCP tools / 30 CLI commands / 5 MCP prompts** spanning skeletons, dependency graphs, and deep analysis — dead code, cycles, change-impact, complexity, duplicates, unused params, type-flow, decorators — plus monorepo support, an interactive **graph explorer** (`ast-map explore`), **watch mode**, a one-page **health dashboard** (`ast-map report`), a **persistent parse cache + parallel parsing** (warm re-scans skip parsing entirely), and a **CI quality gate** (`ast-map check`, baseline ratchet).
8
8
 
9
9
  **Supported languages:** TypeScript · TSX · JavaScript (ESM/CJS) · Python · Go · Rust · Java · C# · C · C++ · Kotlin · Swift · Vue · Svelte (SFC `<script>`) · **PHP** · **Ruby**
10
10
 
11
- | Capability | TS/JS | Python | Go | Rust | Java | C# | C | C++ | Kt | Swift |
12
- |--------------------------|:-----:|:------:|:---:|:----:|:----:|:---:|:---:|:---:|:---:|:-----:|
13
- | Symbol extraction | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
14
- | Imports parsing | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
15
- | Graph `imports` edges | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
16
- | `resolve_imports` enrich | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
17
- | Call graph callee origin | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | — | ✅ | — |
18
- | Reverse `calledBy` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | — | ✅ | — |
11
+ | Capability | TS/JS | Python | Go | Rust | Java | C# | C | C++ | Kt | Swift | PHP | Ruby |
12
+ |--------------------------|:-----:|:------:|:---:|:----:|:----:|:---:|:---:|:---:|:---:|:-----:|:---:|:----:|
13
+ | Symbol extraction | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
14
+ | Imports parsing | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
15
+ | Graph `imports` edges | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | — |
16
+ | `resolve_imports` enrich | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | — |
17
+ | Call graph callee origin | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | — | ✅ | — | — | — |
18
+ | Reverse `calledBy` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | — | ✅ | — | — | — |
19
19
 
20
- > As of v0.8.2, all four v0.8.0 languages have **cross-file graph + resolver** wiring: Kotlin (FQCN/package index), C/C++ (`#include` with header↔impl pairing), and Swift (module = directory under `Sources/`). Call-graph callee origin is resolved for Kotlin; for C/C++/Swift it stays limited because their imports don't name individual symbols. (Ruby was unblocked in v1.22.0 by upgrading `web-tree-sitter` to 0.21.0.)
20
+ > As of v0.8.2, all four v0.8.0 languages have **cross-file graph + resolver** wiring: Kotlin (FQCN/package index), C/C++ (`#include` with header↔impl pairing), and Swift (module = directory under `Sources/`). Call-graph callee origin is resolved for Kotlin; for C/C++/Swift it stays limited because their imports don't name individual symbols. (PHP & Ruby landed in v1.22.0 — symbol extraction + imports; cross-file graph wiring for them is the next step. Ruby was unblocked by upgrading `web-tree-sitter` to 0.21.0.)
21
21
 
22
22
  Each language uses the resolution strategy that fits it:
23
23
  - **TS/JS/Python** — relative paths (`./foo`, `..mod`) resolved against the importing file's directory, with TS-ESM `.js` → `.ts` rewriting.
@@ -110,6 +110,8 @@ ast-map pack <file> [symbol] [--scan <d>] # minimal context pack
110
110
  ast-map coupling [dir] [-n N] # Ca / Ce / instability per file
111
111
  ast-map layers [dir] [-g gap] # SDP: stable→volatile violations
112
112
  ast-map modules [dir] # directory-level coupling + edges
113
+ ast-map cache [stats|clear] # persistent parse cache (.ast-map/cache)
114
+ ast-map check [dir] [--update-baseline] [--min-score N] [--max-cycles N] ...
113
115
  ast-map search <pattern> [dir] [-m contains|exact|regex] [-k kind] [-e]
114
116
  ast-map deps <file> [--scan <dir>]
115
117
  ast-map top <dir> [-n 10]
@@ -524,6 +526,13 @@ Thresholds can be set per-call or in `.ast-map.config.json`.
524
526
 
525
527
  ---
526
528
 
529
+ ### `check_quality_gate`
530
+ Run the CI quality gate: **absolute thresholds** (from `.ast-map.config.json` → `"check"`) plus a **baseline ratchet** against `.ast-map.baseline.json` — fails when cycles, dead exports, SDP violations, very-high-complexity functions rise, or the health score drops. Set `updateBaseline` to re-anchor at the current metrics. Same engine as `ast-map check`.
531
+
532
+ **Params:** `path`, `baseline`, `updateBaseline`
533
+
534
+ ---
535
+
527
536
  ### `get_top_symbols`
528
537
  Return the N most-imported symbols — your codebase's "God Nodes" where a breaking change has maximum blast radius.
529
538
 
@@ -540,18 +549,44 @@ Place in your project root. All fields optional.
540
549
  "ignore": ["dist", "coverage", ".turbo"],
541
550
  "maxFileBytes": 500000,
542
551
  "outputDir": ".ast-map",
552
+ "cache": true,
543
553
  "rules": {
544
554
  "large-file": { "maxLines": 400 },
545
555
  "too-many-imports": { "maxImports": 20 },
546
556
  "god-export": { "maxExports": 15 }
557
+ },
558
+ "check": {
559
+ "maxCycles": 0,
560
+ "maxSdpViolations": 10,
561
+ "minScore": 70
547
562
  }
548
563
  }
549
564
  ```
550
565
 
566
+ - `cache` — persistent parse cache in `<root>/.ast-map/cache` (default `true`; also disabled by `AST_MAP_NO_CACHE=1`). Inspect/clear with `ast-map cache [stats|clear]`.
567
+ - `check` — default thresholds for `ast-map check` / `check_quality_gate`; CLI flags override per run.
568
+
551
569
  The config is read live — changes take effect on the next call without restarting the MCP server.
552
570
 
553
571
  ---
554
572
 
573
+ ## Performance — cache & parallel parsing
574
+
575
+ Since **v1.20.0**, bulk scans are fast twice over:
576
+
577
+ - **Persistent parse cache** — every parsed file's skeleton is stored under `<root>/.ast-map/cache`, keyed by a SHA-1 of its content + detail + schema/grammar versions. A changed file hashes to a new key, so entries are **never stale by construction**, and the cache survives across processes — a re-run on an unchanged repo skips parsing entirely (warm hits on large files ≈ 60× faster).
578
+ - **Worker-thread parallel parsing** — batches of ≥ 64 files are distributed over a pool sized from your CPU count (max 8); smaller batches stay sequential so there's no startup-cost penalty. Any worker failure falls back to sequential parsing.
579
+
580
+ | Env var | Effect |
581
+ |---------|--------|
582
+ | `AST_MAP_NO_CACHE=1` | disable the disk cache for this run |
583
+ | `AST_MAP_WORKERS=0` | force sequential parsing |
584
+ | `AST_MAP_WORKERS=N` | force a pool of N workers (bypasses the batch-size gate) |
585
+
586
+ `ast-map cache` shows entry count + size; `ast-map cache clear` wipes it. `.ast-map/` is already in the default ignore list — add it to `.gitignore` if it isn't.
587
+
588
+ ---
589
+
555
590
  ## Power Prompts
556
591
 
557
592
  ### Full Architecture Audit
@@ -712,7 +747,7 @@ jobs:
712
747
  - uses: actions/checkout@v4
713
748
  - uses: actions/setup-node@v4
714
749
  with: { node-version: "20" }
715
- - uses: 6ixthxense/AST-MCP@v1.0.0
750
+ - uses: 6ixthxense/AST-MCP@v1
716
751
  with:
717
752
  path: src
718
753
  max-lines: "400"
@@ -720,7 +755,19 @@ jobs:
720
755
  max-exports: "15"
721
756
  ```
722
757
 
723
- The action runs `ast-map validate` and fails the job on threshold violations. You can also call any CLI command directly with `npx -p universal-ast-mapper ast-map <command>`.
758
+ The action runs `ast-map validate` and fails the job on threshold violations.
759
+
760
+ Since **v1.21.0** the action can also run the **quality gate** (baseline ratchet + thresholds). Commit a baseline once (`ast-map check src --update-baseline`), then:
761
+
762
+ ```yaml
763
+ - uses: 6ixthxense/AST-MCP@v1
764
+ with:
765
+ path: src
766
+ mode: check # validate | check | both
767
+ check-args: "--min-score 70 --max-cycles 0"
768
+ ```
769
+
770
+ The job fails whenever cycles, dead exports, SDP violations, or complexity regress past the committed `.ast-map.baseline.json`. You can also call any CLI command directly with `npx -p universal-ast-mapper ast-map <command>`.
724
771
 
725
772
  ---
726
773
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-ast-mapper",
3
- "version": "1.22.0",
3
+ "version": "1.22.1",
4
4
  "description": "MCP server that maps source files into a normalized code skeleton (JSON + HTML) using tree-sitter.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",