agpm_cli/cli/validate/
mod.rs

1//! Validate AGPM project configuration and dependencies.
2//!
3//! This module provides the `validate` command which performs comprehensive
4//! validation of a AGPM project's manifest file, dependencies, sources, and
5//! overall configuration. The command can check various aspects of the project
6//! setup and report issues or warnings.
7//!
8//! # Features
9//!
10//! - **Manifest Validation**: Checks `agpm.toml` syntax and structure
11//! - **Dependency Resolution**: Verifies all dependencies can be resolved
12//! - **Source Accessibility**: Tests if source repositories are reachable
13//! - **Path Validation**: Checks if local file dependencies exist
14//! - **Lockfile Consistency**: Compares manifest and lockfile for consistency
15//! - **Multiple Output Formats**: Text and JSON output formats
16//! - **Strict Mode**: Treats warnings as errors for CI environments
17//!
18//! # Examples
19//!
20//! Basic validation:
21//! ```bash
22//! agpm validate
23//! ```
24//!
25//! Comprehensive validation with all checks:
26//! ```bash
27//! agpm validate --resolve --sources --paths --check-lock
28//! ```
29//!
30//! JSON output for automation:
31//! ```bash
32//! agpm validate --format json
33//! ```
34//!
35//! Strict mode for CI:
36//! ```bash
37//! agpm validate --strict --quiet
38//! ```
39//!
40//! Validate specific manifest file:
41//! ```bash
42//! agpm validate ./projects/my-project/agpm.toml
43//! ```
44//!
45//! # Validation Levels
46//!
47//! ## Basic Validation (Default)
48//! - Manifest file syntax and structure
49//! - Required field presence
50//! - Basic consistency checks
51//!
52//! ## Extended Validation (Flags Required)
53//! - `--resolve`: Dependency resolution verification
54//! - `--sources`: Source repository accessibility
55//! - `--paths`: Local file path existence
56//! - `--check-lock`: Lockfile consistency with manifest
57//!
58//! # Output Formats
59//!
60//! ## Text Format (Default)
61//! ```text
62//! ✓ Valid agpm.toml
63//! ✓ Dependencies resolvable
64//! ⚠ Warning: No dependencies defined
65//! ```
66//!
67//! ## JSON Format
68//! ```json
69//! {
70//!   "valid": true,
71//!   "manifest_valid": true,
72//!   "dependencies_resolvable": true,
73//!   "sources_accessible": false,
74//!   "errors": [],
75//!   "warnings": ["No dependencies defined"]
76//! }
77//! ```
78//!
79//! # Error Categories
80//!
81//! - **Syntax Errors**: Invalid TOML format or structure
82//! - **Semantic Errors**: Missing required fields, invalid references
83//! - **Resolution Errors**: Dependencies cannot be found or resolved
84//! - **Network Errors**: Sources are not accessible
85//! - **File System Errors**: Local paths do not exist
86//! - **Consistency Errors**: Manifest and lockfile are out of sync
87
88mod command;
89mod executor;
90mod results;
91mod validators;
92
93#[cfg(test)]
94mod tests;
95
96// Re-export public API
97pub use command::{OutputFormat, ValidateCommand};
98pub use results::ValidationResults;