dev module detect-dependencies

Automatically detect runtime dependencies from source code

Command version
0.0.0
Command configuration
dev-tool:dev.module.detect-dependencies@0.0.0

Arguments

ArgumentTypeRequiredDefaultDescription
--validate, --no-validatebooleanNofalseValidate detected dependencies against declared dependencies (dependencies + devDependencies + testDependencies)
--outstringNoOptional path for detected dependency graph output. Relative paths are resolved from --repo-root.
--formatstring one of dotNo"dot"Detected dependency graph output format (default: dot)
--group-bystring one of type, moduleNo"type"Group the dependency listing by dependency type or by module (default: type)
--exclude-tests, --no-exclude-testsbooleanNofalseExclude test-only dependency analysis/output (detectedTestDependencies and test dependency validation)
--hide-submodule-dependencies, --no-hide-submodule-dependenciesbooleanNofalseHide dependencies that target descendant submodules of the same module in response output and DOT export
--recurse, --no-recursebooleanNofalseValidate every repository this one pins as well, each in its own checkout by its own manifest and what it vendored -- what its own gate reads standing alone -- and the adapter checkout a tracked adapter catalog pins among them. A run from a tree's root otherwise reads the root's manifest, and can pass a manifest the repository holding it would refuse. Refused without --validate

It also takes the global arguments.

Output

It answers with a detect_dependencies.detectedDependenciesResult.

Types

detect_dependencies.detectedDependenciesResult

FieldTypeRequiredDefaultDescription
isCompletebooleanYesWhether every module was analysed; false where skippedModules names any, which fails the run as DETECTED_DEPENDENCY_DISCOVERY_FAILED
moduleCountintegerYesHow many modules there were to analyse: those of the manifest and of every repository in the tree that declares its own packages
analyzedModuleCountintegerYesHow many of those modules were analysed
detectedDependencieslist[detect_dependencies.DetectedDependencyEntry]No[]The runtime dependencies found in each module's source, one entry per analysed module
detectedBuildDependencieslist[detect_dependencies.DetectedDependencyEntry]No[]The build dependencies found for each module: what its schema documents and other documents reference a schema of
detectedDevDependencieslist[detect_dependencies.DetectedDependencyEntry]No[]What each module's source reaches for development alone, such as an import made only for type checking, and does not reach at runtime
detectedTestDependencieslist[detect_dependencies.DetectedDependencyEntry]No[]What each module's test files reach and the rest of its source does not. Empty under --exclude-tests
skippedModuleslist[detect_dependencies.SkippedModuleEntry]No[]Each module that could not be analysed, and why
crossModulePathReferenceslist[detect_dependencies.CrossModulePathReference]No[]Each schema reference written as a path that reaches a module outside the referencing document's own module tree. Such a reference is to be written by coordinate, and any entry here fails --validate
dependencyDeliverylist[detect_dependencies.DependencyDeliveryEntry]No[]How the repository declaring each coordinate edge obtains the package it names: vendored from a build catalog, vendored as a schema, taken from a path by the language's package manager, or delivered by none of its own declarations. A path is build and deployment coupling a vendored package does not have. Reported, never validated.
validatedbooleanYesWhether --validate was given, so that what was detected was compared with what the modules declare
excludeTestsbooleanYesWhether --exclude-tests was given, which leaves test dependencies out of the detection and of the validation
hideSubmoduleDependenciesbooleanYesWhether --hide-submodule-dependencies was given, which leaves out each edge between a module and one nested under it or enclosing it
groupByenum one of type, moduleNo"type"How the human-readable listing is grouped, as --group-by gave it: by kind of dependency or by module
outputPathstringNoThe graph file the run wrote, as an absolute path; absent where --out was not given
outputFormatstringNoThe format of the file outputPath names, as --format gave it; absent where --out was not given
isValidbooleanNoWhether --validate found nothing to refuse: no module skipped, no edge undeclared or unused, no path reference across modules, and every coordinate edge delivered as it may be. Absent where --validate was not given
undeclaredDependencieslist[detect_dependencies.ValidationIssue]NoEach detected edge the module does not declare under that kind. Absent where --validate was not given
unusedDeclaredDependencieslist[detect_dependencies.ValidationIssue]NoEach declared edge nothing in the module was detected to use. A declared coordinate whose publisher is no manifest in the tree is not reported, since nothing could have detected it. Absent where --validate was not given
detectedTestLibraryDependencieslist[detect_dependencies.ValidationIssue]NoEach runtime edge detected onto a test-library module, which test files alone may reach. Absent where --validate was not given

detect_dependencies.DetectedDependencyEntry

FieldTypeRequiredDefaultDescription
modulestringYesThe module's name
dependencieslist[string]No[]What was detected for the module, each a module name or a coordinate

detect_dependencies.SkippedModuleEntry

FieldTypeRequiredDefaultDescription
modulestringYesThe module that was not analysed
reasonstringNo""Why it could not be analysed, as the failure was reported

detect_dependencies.CrossModulePathReference

FieldTypeRequiredDefaultDescription
modulestringYesThe module that holds the referencing document
dependencystringYesThe module the referenced path lies in
documentstringYesThe referencing document, relative to the repository root
aliasstringNo""The name the document gives the reference among its externalSchemas

detect_dependencies.DependencyDeliveryEntry

FieldTypeRequiredDefaultDescription
repositorystringYesWhose declarations answered, as a path from the tree's root. One edge can have two answers: the tree taking a package from a path so its edits are live, and the checkout holding the module vendoring it.
modulestringYesThe module that declares the edge.
dependencystringYesThe coordinate the edge names.
typestringYesThe kind of edge -- runtime, build, dev or test.
deliveryenum one of vendored, vendored-schema, path, undeliveredYesHow that repository obtains the package: vendored from a build catalog, vendored-schema as a schema, path through the language's package manager, or undelivered where none of its declarations delivers it.
viastringNo""What delivers it: the vendored library or schema coordinate, or the path as the package manager's declaration writes it. Empty when nothing does.

detect_dependencies.ValidationIssue

FieldTypeRequiredDefaultDescription
modulestringNo""The module whose edge the finding is about
dependencystringNo""The module name or coordinate at the other end of the edge
typestringNo""The kind of edge: runtime, build, dev or test