← All procedures

lib.graph

The dependency graph of the workspace packages: nodes, workspace: edges, cycles and build levels

MCPCLI
Package
@procedures/lib · README
Path
["lib","graph"]
CLI
mark lib graph
MCP tool
lib.graph on the dev-tools server
As data
{"$proc":["lib","graph"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/lib/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["lib","graph"], {});
console.log(JSON.stringify(result));

From the command line

$ mark lib graph

As data, in a program

{ "$proc": ["lib", "graph"], "input": {} }

Input

FieldTypeRequiredDefaultDescription
rootPathstringnoThe workspace root (default: the pnpm workspace that contains client-lib)

Output

FieldTypeRequiredDefaultDescription
rootstringyesThe workspace root
nodesobject[]yesThe workspace packages, in name order
edgesobject[]yesThe workspace: dependencies between the packages
acyclicbooleanyesTrue when the graph has no cycle
cyclesstring[][]yesEach cycle: the packages of a strongly connected component, in name order
levelsstring[][]noWithout a cycle: the packages in levels. Level 0 depends on no workspace package.
warningsobject[]yesThe folders that the procedure could not read
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "rootPath": {
        "description": "The workspace root (default: the pnpm workspace that contains client-lib)",
        "type": "string"
      }
    }
  },
  "output": {
    "type": "object",
    "properties": {
      "root": {
        "type": "string",
        "description": "The workspace root"
      },
      "nodes": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The name in package.json"
            },
            "folder": {
              "type": "string",
              "description": "The folder in packages/"
            },
            "version": {
              "description": "The version in package.json",
              "type": "string"
            },
            "private": {
              "description": "True for a private package",
              "type": "boolean"
            }
          },
          "required": [
            "name",
            "folder"
          ],
          "additionalProperties": {}
        },
        "description": "The workspace packages, in name order"
      },
      "edges": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "from": {
              "type": "string",
              "description": "The package that depends"
            },
            "to": {
              "type": "string",
              "description": "The package that it depends on"
            },
            "kind": {
              "type": "string",
              "enum": [
                "dependencies",
                "devDependencies",
                "peerDependencies",
                "optionalDependencies"
              ],
              "description": "The field of package.json"
            },
            "spec": {
              "type": "string",
              "description": "The specifier, for example workspace:*"
            }
          },
          "required": [
            "from",
            "to",
            "kind",
            "spec"
          ],
          "additionalProperties": {}
        },
        "description": "The workspace: dependencies between the packages"
      },
      "acyclic": {
        "type": "boolean",
        "description": "True when the graph has no cycle"
      },
      "cycles": {
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "description": "Each cycle: the packages of a strongly connected component, in name order"
      },
      "levels": {
        "description": "Without a cycle: the packages in levels. Level 0 depends on no workspace package.",
        "type": "array",
        "items": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "warnings": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string",
              "description": "The folder"
            },
            "issue": {
              "type": "string",
              "description": "The problem"
            }
          },
          "required": [
            "path",
            "issue"
          ],
          "additionalProperties": {}
        },
        "description": "The folders that the procedure could not read"
      }
    },
    "required": [
      "root",
      "nodes",
      "edges",
      "acyclic",
      "cycles",
      "warnings"
    ],
    "additionalProperties": {}
  }
}