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:
@@ -6,6 +6,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using StellaOps.Microservice;
|
||||
using StellaOps.Router.Common.Abstractions;
|
||||
using StellaOps.Router.Common.Enums;
|
||||
using StellaOps.Router.Transport.InMemory;
|
||||
using Xunit;
|
||||
@@ -94,8 +95,7 @@ public sealed class GatewayFixture : IAsyncLifetime
|
||||
_inventoryHost = inventoryBuilder.Build();
|
||||
await _inventoryHost.StartAsync();
|
||||
|
||||
// Allow services to register
|
||||
await Task.Delay(100);
|
||||
await WaitForGatewayReadyAsync(TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
||||
public async Task DisposeAsync()
|
||||
@@ -116,4 +116,32 @@ public sealed class GatewayFixture : IAsyncLifetime
|
||||
|
||||
_gatewayFactory?.Dispose();
|
||||
}
|
||||
|
||||
private async Task WaitForGatewayReadyAsync(TimeSpan timeout)
|
||||
{
|
||||
if (_gatewayFactory is null)
|
||||
{
|
||||
throw new InvalidOperationException("Gateway factory not initialized.");
|
||||
}
|
||||
|
||||
var routingState = _gatewayFactory.Services.GetRequiredService<IGlobalRoutingState>();
|
||||
var deadline = DateTimeOffset.UtcNow.Add(timeout);
|
||||
|
||||
while (DateTimeOffset.UtcNow < deadline)
|
||||
{
|
||||
var connections = routingState.GetAllConnections();
|
||||
if (connections.Count >= 2 &&
|
||||
routingState.ResolveEndpoint("GET", "/items") is not null &&
|
||||
routingState.ResolveEndpoint("POST", "/invoices") is not null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await Task.Delay(50);
|
||||
}
|
||||
|
||||
var currentConnections = routingState.GetAllConnections();
|
||||
throw new TimeoutException(
|
||||
$"Gateway routing state not ready after {timeout}. Connections={currentConnections.Count}.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user