CLI: Dependencies & Maintainers
Relevant source files
The following files were used as context for generating this wiki page:
The regxa CLI provides specialized subcommands for inspecting package relationships and ownership. The deps and maintainers commands allow users to query normalized dependency trees and contributor lists across multiple ecosystems—including npm, PyPI, crates.io, RubyGems, Packagist, and Arch Linux—using a single interface. Sources: README.md:25-31, src/cli.ts:10-15
These commands are built on top of the regxa core library, utilizing PURL (Package URL) identifiers to resolve registry-specific data into a unified format. They support both human-readable terminal output and machine-readable JSON output for automation. Sources: src/commands/deps.ts:41-45, src/commands/maintainers.ts:24-27
Command Architecture and Shared Logic
All CLI commands in regxa utilize a shared orchestration layer to ensure consistent argument handling and error reporting. Commands are defined using the citty framework and leverage common utilities for PURL resolution and cache management. Sources: src/commands/deps.ts:1-5, src/commands/maintainers.ts:1-3
Dependency and Maintainer Flow
The following diagram illustrates how a CLI request for dependencies or maintainers is processed:
The workflow begins at src/cli.ts, which routes the request to the appropriate command file. The resolvePURL helper then extracts the registry, package name, and version to initiate the fetch. Sources: src/cli.ts:12-16, src/commands/deps.ts:21-25
Shared Configuration
Commands share a common set of arguments defined in sharedArgs. Sources: src/commands/deps.ts:12-13, src/commands/maintainers.ts:10-11
| Argument | Type | Description |
|---|---|---|
purl | Positional | The Package URL identifying the target (e.g., pkg:npm/lodash). |
--json | Boolean | Enables raw JSON output instead of formatted text. |
--no-cache | Boolean | Bypasses the local storage-backed cache to force a fresh fetch. |
Sources: src/commands/deps.ts:14-20, README.md:162-167
The deps Command
The deps command retrieves the dependency list for a specific package version. If no version is provided in the PURL, the command attempts to resolve the latestVersion from the package metadata before fetching dependencies. Sources: src/commands/deps.ts:23-33
Logic and Scoping
Dependencies are categorized by their scope (e.g., runtime, development, build). The CLI uses a color-coded mapping to distinguish these scopes in the terminal. Sources: src/commands/deps.ts:55-68
Data Structures
The deps command consumes the Dependency interface from the core library. Sources: src/commands/deps.ts:39-40
| Field | Type | Description |
|---|---|---|
name | string | Name of the dependency package. |
requirements | string | Version constraint (e.g., ^1.0.0 or >=2.0). |
scope | string | The functional category (runtime, test, etc.). |
optional | boolean | Indicates if the dependency is non-mandatory. |
Sources: README.md:204-209
The maintainers Command
The maintainers command lists individuals or entities responsible for a package. It normalizes disparate registry roles (such as "author," "contributor," or "owner") into a standard list. Sources: src/commands/maintainers.ts:1-7, README.md:211-218
Maintainer Information Flow
When executing maintainers, the system fetches a list of Maintainer objects. The CLI then formats these by prioritizing names and logins. Sources: src/commands/maintainers.ts:33-40
Maintainer Data Model
The output is based on the normalized Maintainer type. Sources: src/commands/maintainers.ts:31-41
| Field | Description | Terminal Formatting |
|---|---|---|
name | Legal or display name. | Bold text. |
login | Registry-specific username. | Enclosed in parentheses. |
email | Contact email address. | Enclosed in angle brackets. |
role | Responsibility (e.g., author). | Enclosed in cyan brackets. |
url | Profile or website link. | Displayed on a sub-line in gray. |
Sources: src/commands/maintainers.ts:33-42, README.md:211-218
Summary
The Dependencies and Maintainers modules provide a critical window into the supply chain and community metadata of software packages. By abstracting ecosystem-specific APIs behind the PURL standard, regxa allows developers to audit package requirements and ownership without learning the unique schemas of every registry. Sources: README.md:12-18, src/commands/deps.ts:41-45, src/commands/maintainers.ts:24-27