Report whether the manifest is well-formed and references resolve.
(
path: Path = typer.Option(
None, "--path", help="Bundle directory or bundle.yml (default: cwd)"
),
offline: bool = typer.Option(
False,
"--offline",
help="Do not access catalogs; verify references against bundled/installed only",
),
)
| 470 | |
| 471 | @bundle_app.command("validate") |
| 472 | def bundle_validate( |
| 473 | path: Path = typer.Option( |
| 474 | None, "--path", help="Bundle directory or bundle.yml (default: cwd)" |
| 475 | ), |
| 476 | offline: bool = typer.Option( |
| 477 | False, |
| 478 | "--offline", |
| 479 | help="Do not access catalogs; verify references against bundled/installed only", |
| 480 | ), |
| 481 | ) -> None: |
| 482 | """Report whether the manifest is well-formed and references resolve.""" |
| 483 | try: |
| 484 | manifest_path = _resolve_manifest_path(path) |
| 485 | from ...bundler.lib.project import find_project_root |
| 486 | from ...bundler.models.manifest import BundleManifest |
| 487 | from ...bundler.services.references import make_reference_checker |
| 488 | from ...bundler.services.validator import validate_manifest |
| 489 | |
| 490 | manifest = BundleManifest.from_file(manifest_path) |
| 491 | ref_root = find_project_root(manifest_path.parent) or Path.cwd() |
| 492 | ref_warnings: list[str] = [] |
| 493 | checker = make_reference_checker( |
| 494 | ref_root, allow_network=not offline, warnings=ref_warnings |
| 495 | ) |
| 496 | report = validate_manifest(manifest, reference_checker=checker) |
| 497 | report.warnings.extend(ref_warnings) |
| 498 | except BundlerError as exc: |
| 499 | _fail(str(exc)) |
| 500 | return |
| 501 | |
| 502 | for warning in report.warnings: |
| 503 | console.print(f"[yellow]![/yellow] {warning}") |
| 504 | if not report.ok: |
| 505 | console.print("[red]Manifest is invalid:[/red]") |
| 506 | for error in report.errors: |
| 507 | console.print(f" [red]-[/red] {error}") |
| 508 | raise typer.Exit(code=1) |
| 509 | console.print(f"[green]✓[/green] {manifest.bundle.id} is well-formed and valid.") |
| 510 | |
| 511 | |
| 512 | @bundle_app.command("build") |
nothing calls this directly
no test coverage detected