Skip to main content

Crate alp_core

Crate alp_core 

Source
Expand description

§alp-core

crates.io docs.rs license

Pure, I/O-free domain logic for the ALP SDK embedded toolchain — the shared engine behind the alp CLI.

This crate is the Rust home of the board.yaml model, parsing, and validation, plus the build-plan / system-manifest contracts, the SoM/SKU catalogue, and the debug/doctor reports. It contains no terminal, filesystem-walking, or process logic — only deterministic, serde-based transforms — so the same logic can be reused by the CLI today and bridged to the TypeScript extension/LSP (via napi-rs or WASM) later.

§What’s inside

ModuleResponsibility
modelThe board.yaml data model + normalize_board_model.
validateSchema + semantic validation; outcome classification.
loaderGeneration-target planning (Zephyr conf / DTS overlay / CMake args / Yocto conf).
build_planParse + summarize the SDK’s build-plan contract.
system_manifestThe post-build system-manifest v1 contract (per-core slices, ipc, helper MCUs).
build_readinessPer-OS build-toolchain readiness reports.
presets, sdk_catalogueSoM/SKU catalogue, chip/board presets, topology.
projectWorkspace / project / board.yaml resolution.
sdkSDK release listing + active-SDK resolution + readiness.
debug, debug_launchDebug-doctor reports + launch.json drafting.
diff, previewModel-vs-normalized diff; effective-config preview.
wizardProject / module scaffolding plans.
clockDeterministic ISO-8601 UTC timestamps (SOURCE_DATE_EPOCH-aware).

§Usage

[dependencies]
alp-core = "0.1"

The full API reference is on docs.rs/alp-core.

Stability. alp-core is published primarily as the implementation crate for the alp CLI. It is pre-1.0 — the public API may change between minor versions. If you depend on it directly, pin a minor range.

§License

Apache-2.0.

Re-exports§

pub use build_plan::BUILD_PLAN_SCHEMA_VERSION;
pub use build_plan::Backend;
pub use build_plan::BuildPlan;
pub use build_plan::BuildPlanError;
pub use build_plan::BuildSlice;
pub use build_plan::GeneratedFile;
pub use build_plan::PlanWarning;
pub use build_plan::ToolStep;
pub use build_plan::parse_build_plan;
pub use build_plan::summarize_plan;
pub use build_readiness::BuildOs;
pub use build_readiness::BuildReadinessReport;
pub use build_readiness::BuildToolProbe;
pub use build_readiness::board_os_set;
pub use build_readiness::build_readiness_report;
pub use clock::format_iso8601_utc;
pub use debug::DebugGenerationTraceDecision;
pub use debug::DebugResolvedValue;
pub use debug::DebugRuntimeCapabilities;
pub use debug::DebugServerKind;
pub use debug::DebugTargetKind;
pub use debug::DebugTraceOutcome;
pub use debug::DebugValueSource;
pub use debug::DebugWorkspaceContext;
pub use debug::DebuggerExtensionsState;
pub use debug::DoctorCheck;
pub use debug::DoctorReport;
pub use debug::DoctorStatus;
pub use debug::DoctorSummary;
pub use debug::build_doctor_report;
pub use debug::collect_resolved_values;
pub use debug::collect_runtime_capabilities_from_commands;
pub use debug::create_debug_workspace_context;
pub use debug::is_server_supported_for_target;
pub use debug::parse_server_kind;
pub use debug::parse_target_kind;
pub use debug::server_choices_for_target;
pub use debug_launch::LaunchJsonWritePlan;
pub use debug_launch::create_launch_draft;
pub use debug_launch::create_launch_json_write_plan;
pub use debug_launch::launch_preview_document;
pub use debug_launch::launch_preview_notes;
pub use diff::DiffEntry;
pub use diff::DiffKind;
pub use diff::collect_diff_entries;
pub use diff::prune_nulls;
pub use loader::ALL_EMIT_MODES;
pub use loader::GenerationTargetSupport;
pub use loader::LoaderPlan;
pub use loader::create_loader_plan;
pub use loader::generation_target_support;
pub use loader::list_generation_target_support;
pub use model::BoardModel;
pub use model::normalize_board_model;
pub use presets::PresetCatalogueDefaults;
pub use presets::empty_preset_catalogue;
pub use preview::EffectiveConfigPreviewPayload;
pub use preview::create_effective_config_preview_payload;
pub use project::ProjectContext;
pub use project::ProjectResolutionInput;
pub use project::ProjectSettings;
pub use project::resolve_project_context;
pub use sdk::GITHUB_RELEASES_URL;
pub use sdk::SdkReadinessReport;
pub use sdk::SdkReadinessState;
pub use sdk::SdkRelease;
pub use sdk::check_sdk_readiness;
pub use sdk::parse_remote_sdk_releases;
pub use sdk::resolve_active_sdk;
pub use sdk_catalogue::AcceleratorAvail;
pub use sdk_catalogue::BoardPreset;
pub use sdk_catalogue::ChipChoice;
pub use sdk_catalogue::ChipDef;
pub use sdk_catalogue::ChipKconfig;
pub use sdk_catalogue::I2cDevice;
pub use sdk_catalogue::MemorySpec;
pub use sdk_catalogue::PadRoute;
pub use sdk_catalogue::SdkCatalogue;
pub use sdk_catalogue::SocCore;
pub use sdk_catalogue::SocSpec;
pub use sdk_catalogue::SomPreset;
pub use sdk_catalogue::TopologyCore;
pub use sdk_catalogue::accelerator_availability;
pub use sdk_catalogue::boards_for_som;
pub use sdk_catalogue::chip_defaults;
pub use sdk_catalogue::chip_family_for_sku;
pub use sdk_catalogue::chips_for_som;
pub use sdk_catalogue::core_ids_for_som;
pub use sdk_catalogue::effective_chip_choices;
pub use sdk_catalogue::effective_populated;
pub use sdk_catalogue::parse_board_preset;
pub use sdk_catalogue::parse_chip_def;
pub use sdk_catalogue::parse_soc_spec;
pub use sdk_catalogue::parse_som_preset;
pub use validate::Outcome;
pub use validate::ParseError;
pub use validate::Severity;
pub use validate::ValidationIssue;
pub use validate::ValidationResult;
pub use validate::ValidatorExecution;
pub use validate::analyze_validation_result;
pub use validate::classify_validation_outcome;
pub use validate::parse_board_model;
pub use validate::validate_board_yaml_local;

Modules§

build_plan
Build-plan contract (Wave C) — the consumed shape of the SDK’s alp_orchestrate.py --emit build-plan JSON, locked as ADR 0014 (alp-sdk docs/adr/0014-build-plan-emit-cli-contract.md, 2026-06-04).
build_readiness
Build-readiness preflight — the toolchains a build (and the Yocto .wic flash) needs, keyed off the OSes the active board.yaml declares. Used by alp doctor --build (and, later, as alp build’s preflight).
clock
Pure timestamp formatting. The clock read lives in the CLI; this module only turns an epoch into an ISO-8601 string, so it stays IO-free and deterministic (and therefore unit-testable).
debug
Debug doctor domain — a port of the TypeScript @alp-sdk/core/debug doctor logic (buildDoctorReport, serverChoicesForTarget, and the runtime-capability/workspace-context adapters).
debug_launch
Debug launch-config generation — a port of TS createDebugProfile + debugProfileToLaunchDraft + createLaunchPreview and the launchJsonCore merge plan. Produces VS Code launch.json drafts for alp debug-config.
diff
Structural diff between two JSON values — a port of the TS diff command’s collectDiffEntries / collectRecursiveDiff. Used to surface what normalize_board_model changed relative to the parsed board.yaml.
loader
Generation-target catalog — a port of the TS loader GENERATION_TARGET_CATALOG / listGenerationTargetSupport. Static metadata describing the four emit targets (used by explain, and later generate).
model
Board configuration model — Rust mirror of the TypeScript @alp-sdk/core board/configurator model.
presets
Built-in preset catalogue defaults — a port of TS createEmptyPresetCatalogue. SKUs/carriers come from the SDK metadata tree (read by the CLI); the lists below are the SDK-independent defaults.
preview
Effective-config preview helpers (Rust mirror of LSP preview payload).
project
Workspace/project resolution — a port of the TypeScript resolveProjectContext. Filesystem access is injected as a path_exists predicate so the resolution logic stays pure and unit-testable; the CLI supplies the real Path::exists probe.
sdk
SDK release catalogue + local readiness — a port of the IO-free parts of TS @alp-sdk/core/sdk/service. Network (GitHub) and filesystem effects stay in the CLI; this module parses the releases payload and inspects a local SDK path through injected predicates.
sdk_catalogue
Rust mirror of packages/alp-core/src/sdkCatalogue/{parse,derive}.ts.
system_manifest
The ALP system manifest (build/system-manifest.yaml) — the single derived projection of a board.yaml that west alp-build emits, and the IDE/tool CONTRACT for a (possibly multi-image) project. Tools read THIS for folder layout + build/flash wiring instead of re-deriving from board.yaml + the SoM presets.
validate
Local (offline) board.yaml validation.
wizard
Wizard and module-scaffold domain logic.

Constants§

DEFAULT_SOM_SKU
Default SoM SKU written into a scaffolded board.yaml when none is supplied (alp init without --som). Single source of truth for the literal, shared by the wizard (wizard::service) and the CLI’s app-core guard.