deb04c9315
Sprint 0 completo del producto VMS-Sailor (Vessel Management System integrado para buques 30-40m). Brief de referencia en VMS_Sailor_v2_Parte_*.md (intacto). Core (vmssailor.core, 95.17% coverage, 99 tests verde): - ShipCoord: sistema naval x_pp/y_cl/z_bl frozen - Vessel, Deck, Bulkhead - Equipment, EquipmentModel, Sensor, EquipmentSpec - Tag, AlarmConfig, TagBinding, Scaling - CardInstance, Bus, Topology con validacion 21 puntos I/O AR-NMEA-IO-v1.0 - Alarm, PermissiveRule, Condition - Project agregado raiz con validacion cross-entity - Persistencia portable .vmsproj (SQLite) con roundtrip verificable Biblioteca curada seed (vmssailor.library): - systems_catalog.json completo (catalogo maestro Parte 1 sec 7) - 2 vessels: Sunseeker 76, Ferretti 850 - 2 motores: MTU 12V 2000 M96, Volvo D13-900 - 1 genset: Northern Lights M65C13 - yacht_motor_planeo.yaml (reglas heuristicas) - TODO marcado data_source=seed_estimate - requiere validacion datasheets Tools: - vms-validate-library: CLI valida biblioteca completa - vms-generate-test-project: CLI demo + verificacion roundtrip persistencia Design System + 8 mockups HTML estaticos: - docs/design_system.md (paleta Deep Ocean, gradientes, typography, motion) - docs/brand/ (logo + variantes SVG) - docs/mockups/splash, studio_main, runtime_overview, runtime_mimic_fuel (P&ID animado), runtime_alarms, runtime_trim (panel estrella con horizonte artificial), mobile_overview, mobile_trim - docs/mockups/index.html (galeria) Firmware (Sprint 12+ implementacion): - firmware/ar_nmea_io_v1/src/config/pinout.h con macros GPIO Decisiones autonomas documentadas en docs/decisions_sprint0.md. Stack: Python 3.11 + uv + Pydantic v2 + SQLite stdlib + hatchling + pytest 9 + ruff + mypy. Sin PySide6, FastAPI, Flutter ni firmware funcional (entran en sprints siguientes). Criterio de aceptacion Sprint 0: cumplido. - uv sync: OK - pytest: 99/99 verde - cov vmssailor.core: 95.17% (objetivo >=80%) - ruff: clean - vms-validate-library: OK - vms-generate-test-project: INTEGRIDAD OK Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
75 lines
1.9 KiB
Python
75 lines
1.9 KiB
Python
"""CLI para validar la biblioteca curada del Sprint 0.
|
|
|
|
Uso:
|
|
|
|
uv run vms-validate-library
|
|
|
|
# equivalente:
|
|
python -m vmssailor.tools.validate_library
|
|
|
|
Salida:
|
|
- Exit code 0 si no hay errores (warnings/info no bloquean).
|
|
- Exit code 1 si hay errores estructurales.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from vmssailor.library import load_library
|
|
from vmssailor.shared.logging_setup import setup_logging
|
|
|
|
|
|
def main(argv: list[str] | None = None) -> int:
|
|
parser = argparse.ArgumentParser(
|
|
prog="vms-validate-library",
|
|
description="Valida la biblioteca curada de VMS-Sailor.",
|
|
)
|
|
parser.add_argument(
|
|
"--root",
|
|
type=Path,
|
|
default=None,
|
|
help="Ruta raíz de la biblioteca (defecto: vmssailor/library/).",
|
|
)
|
|
parser.add_argument(
|
|
"--verbose",
|
|
action="store_true",
|
|
help="Logging DEBUG.",
|
|
)
|
|
parser.add_argument(
|
|
"--strict-warnings",
|
|
action="store_true",
|
|
help="Salir con error si hay warnings.",
|
|
)
|
|
args = parser.parse_args(argv)
|
|
|
|
setup_logging(verbose=args.verbose)
|
|
|
|
print("VMS-Sailor — Validador de biblioteca curada")
|
|
print("=" * 60)
|
|
result = load_library(args.root)
|
|
print(result.format())
|
|
print()
|
|
|
|
if not result.ok():
|
|
print(f"\nFAIL: {len(result.errors)} errores en la biblioteca.")
|
|
return 1
|
|
|
|
if args.strict_warnings and result.warnings:
|
|
print(f"\nFAIL (strict): {len(result.warnings)} warnings.")
|
|
return 1
|
|
|
|
info_count = len([i for i in result.issues if i.severity == "info"])
|
|
print(
|
|
f"\nOK: biblioteca válida "
|
|
f"({len(result.vessels)} vessels, {len(result.equipment_models)} equipment, "
|
|
f"{len(result.rules)} rules, {info_count} info)."
|
|
)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|