Expand description
Core data models for Limitless CLI.
Every type defined here is fully serde-compatible so environment
state and player progress can be persisted to JSON, exchanged between
commands (check, dev, fix, orbit, arcade), and rehydrated on
the next run without losing type safety.
§Usage example
use limitless_cli::models::{
ArcadeState, CheckStatus, DiagnosticResult, EnvironmentState, HealthScore,
MentorMessage, ProjectStack, Severity,
};
let deps_ok = DiagnosticResult::new(
"Dependency Audit",
CheckStatus::Pass,
"All packages resolved",
);
let audit_fail = DiagnosticResult::new(
"Env Audit",
CheckStatus::Fail,
".env is missing",
).with_remediation("Copy .env.example to .env and fill in secrets");
let health = HealthScore::from_results(&[deps_ok.clone(), audit_fail.clone()]);
let env = EnvironmentState {
detected_stack: ProjectStack::Node {
version: "22.9.0".into(),
package_manager: "npm".into(),
},
runtime_version: Some("v22.9.0".into()),
env_file_exists: false,
env_example_exists: true,
dependencies_healthy: true,
blocked_ports: vec![(8080, 4321)],
diagnostics: vec![deps_ok, audit_fail],
health_score: health,
};
// Serialize the whole environment to JSON and back.
let json = serde_json::to_string_pretty(&env).unwrap();
let env_back: EnvironmentState = serde_json::from_str(&json).unwrap();
assert_eq!(env, env_back);
assert!(env.dependencies_healthy);
// Mentor-style feedback built from a failing check.
let mentor = MentorMessage {
severity: Severity::Critical,
plain_english: "Your project can't find its environment variables.".into(),
technical_detail: "Missing .env file: 4 required vars unresolved.".into(),
suggested_action: "Copy .env.example to .env and restart `limit dev`.".into(),
};
assert_eq!(mentor.suggested_action, "Copy .env.example to .env and restart `limit dev`.");
// Arcade progress is serializable too.
let mut arcade = ArcadeState::default();
arcade.record_game(1400);
arcade.unlock_achievement("first-clear");
let json = serde_json::to_string(&arcade).unwrap();
let back: ArcadeState = serde_json::from_str(&json).unwrap();
assert_eq!(back.high_score, 1400);Structs§
- Arcade
State - Serializable progress state for Arcade mode.
- Diagnostic
Result - One named diagnostic result with an optional suggested fix.
- Environment
State - A full snapshot of the detected development environment.
- Health
Score - A quantitative summary of environment health.
- Mentor
Message - A beginner-friendly explanation of a detected issue.
Enums§
- Check
Status - Outcome of a single diagnostic check.
- Health
Status - Aggregate health classification derived from a
HealthScore. - Project
Stack - The detected application stack for a project.
- Severity
- How urgent a
MentorMessageis.