feat: add stella-callgraph-node for JavaScript/TypeScript call graph extraction

- Implemented a new tool `stella-callgraph-node` that extracts call graphs from JavaScript/TypeScript projects using Babel AST.
- Added command-line interface with options for JSON output and help.
- Included functionality to analyze project structure, detect functions, and build call graphs.
- Created a package.json file for dependency management.

feat: introduce stella-callgraph-python for Python call graph extraction

- Developed `stella-callgraph-python` to extract call graphs from Python projects using AST analysis.
- Implemented command-line interface with options for JSON output and verbose logging.
- Added framework detection to identify popular web frameworks and their entry points.
- Created an AST analyzer to traverse Python code and extract function definitions and calls.
- Included requirements.txt for project dependencies.

chore: add framework detection for Python projects

- Implemented framework detection logic to identify frameworks like Flask, FastAPI, Django, and others based on project files and import patterns.
- Enhanced the AST analyzer to recognize entry points based on decorators and function definitions.
This commit is contained in:
master
2025-12-19 18:11:59 +02:00
parent 951a38d561
commit 8779e9226f
130 changed files with 19011 additions and 422 deletions

View File

@@ -1,4 +1,5 @@
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using StellaOps.Router.Common.Models;
namespace StellaOps.Microservice;
@@ -10,16 +11,21 @@ public sealed class ReflectionEndpointDiscoveryProvider : IEndpointDiscoveryProv
{
private readonly StellaMicroserviceOptions _options;
private readonly IEnumerable<Assembly> _assemblies;
private readonly IServiceProviderIsService? _serviceProviderIsService;
/// <summary>
/// Initializes a new instance of the <see cref="ReflectionEndpointDiscoveryProvider"/> class.
/// </summary>
/// <param name="options">The microservice options.</param>
/// <param name="assemblies">The assemblies to scan for endpoints.</param>
public ReflectionEndpointDiscoveryProvider(StellaMicroserviceOptions options, IEnumerable<Assembly>? assemblies = null)
public ReflectionEndpointDiscoveryProvider(
StellaMicroserviceOptions options,
IEnumerable<Assembly>? assemblies = null,
IServiceProviderIsService? serviceProviderIsService = null)
{
_options = options;
_assemblies = assemblies ?? AppDomain.CurrentDomain.GetAssemblies();
_serviceProviderIsService = serviceProviderIsService;
}
/// <inheritdoc />
@@ -42,6 +48,11 @@ public sealed class ReflectionEndpointDiscoveryProvider : IEndpointDiscoveryProv
$"Type {type.FullName} has [StellaEndpoint] but does not implement IStellaEndpoint.");
}
if (_serviceProviderIsService is not null && !_serviceProviderIsService.IsService(type))
{
continue;
}
var claims = attribute.RequiredClaims
.Select(c => new ClaimRequirement { Type = c })
.ToList();
@@ -54,7 +65,8 @@ public sealed class ReflectionEndpointDiscoveryProvider : IEndpointDiscoveryProv
Path = attribute.Path,
DefaultTimeout = TimeSpan.FromSeconds(attribute.TimeoutSeconds),
SupportsStreaming = attribute.SupportsStreaming,
RequiringClaims = claims
RequiringClaims = claims,
HandlerType = type
};
endpoints.Add(descriptor);