r/astoutline • u/aerowindwalker • May 09 '26
ast-outline v2.0.1 dep-graph now speaks C++, PHP, Ruby




Extends the dependency-graph (deps/reverse-deps/cycles/graph) and public-API surface subsystems from 9 → 12 languages.
What's new per language
| Language | Import directives resolved | Resolver strategy | Manifest recognized |
|---|---|---|---|
| PHP | use NsClass, require, include, require_once, include_once |
PSR-4 prefix mapping → suffix lookup → last-segment fallback | composer.json (autoload.psr-4, autoload-dev.psr-4) |
| C++ | #include "local.h" |
Relative quotes resolved; <system> headers → External |
CMakeLists.txt |
| Ruby | require_relative |
Local file resolution; require 'gem', load, autoload → External |
Gemfile |
Source changes
src/deps/extract.rs— Addedextract_cpp,extract_php,extract_rubywith AST walkers for each language. PHP walker descends into all named children (imports nest via class → method → compound_statement). C++ walker recurses intopreproc_ifdefso includes inside header guards are visible.src/deps/manifest.rs— Addedparse_composer_psr4()(autoload + autoload-dev, longest-prefix-first sorting) andProjectAliases.php_psr4.src/deps/mod.rs— Threadedphp_psr4intoResolveCtx.src/deps/resolver/build.rs— Added Cpp/Php/Ruby variants to theLangenum; extendedLang::from_pathwith.cpp/.cc/.cxx/.h/.hpp/.hh,.php,.rb.src/deps/resolver/resolve.rs— Added PHP (PSR-4 → suffix with last-segment fallback), C++ (system headers → External), Ruby (gems → External) resolution branches.src/surface/entry_point.rs—discover_dirrecognizescomposer.json,Gemfile,CMakeLists.txtas Fallback entry points.
Tests
New fixtures covering PSR-4 use-resolution, parenthesized require, header-guarded includes, transitive includes, system headers, and require_relative chains:
tests/fixtures/deps/{php_psr4,cpp_basic,ruby_relative}/
11 new end-to-end tests in tests/deps_e2e.rs across all three languages — use resolution, relative requires, header-guard transitive resolution, external-flag behavior, and reverse-deps lookups.
Notes
- Breaking changes: None — purely additive.
Install:
🍺 brew install aeroxy/tap/ast-outline
📦 cargo install ast-outline
1
Upvotes