@wild-framework/graph
v0.2.9
Published
Machine-readable project graph (introspection) for Wild Framework apps — for visual builders and AI agents.
Maintainers
Readme
@wild-framework/graph
Machine-readable Project Graph for Wild Framework apps.
A single JSON-serializable model of a running application — providers, routes, resources, request schemas, DI bindings, and migrations. It is the source of truth that visual builders (Wild Studio) and AI agents render and manipulate.
Install
pnpm add @wild-framework/graphUsage
Register GraphProvider last (after all feature providers):
import { GraphProvider } from "@wild-framework/graph";
GraphProvider.appName = "Shop API";
GraphProvider.appVersion = "1.0.0";
app.register(GraphProvider); // after feature providers, before/after OpenApiThen fetch the graph:
curl http://localhost:3000/graph.jsonOr build it programmatically:
import { buildProjectGraph } from "@wild-framework/graph";
const graph = buildProjectGraph(app, router, { name: "Shop API", version: "1.0.0" });Graph shape
{
"name": "Shop API",
"version": "1.0.0",
"providers": [{ "name": "ProductProvider", "index": 8 }],
"routes": [{ "method": "get", "path": "/products", "controller": "ProductController", "action": "index", "validator": "CreateProductRequest" }],
"resources": [{ "name": "Product", "segment": "products", "routes": [] }],
"schemas": [{ "name": "CreateProductRequest", "fields": { "name": "string", "price": "number" } }],
"bindings": [{ "token": "ProductService" }],
"migrations": [{ "name": "20261010_add_order_index", "applied": true }]
}Design
- Derived from the live app (never hand-maintained) via
Application.getRegisteredProviders(),Router.getRegisteredRoutes(), andContainer.listBindings(). - Resources are grouped by first path segment (
/products/:id→products). - The graph is read-only introspection — the visual builder renders it and maps user actions back to CLI/engine operations (the GUI holds no logic).
License
MIT
