API Reference¶
Before diving into the raw interface signatures, it is helpful to visualize the architectural boundaries of Protostar.
The engine strictly isolates state definition from imperative execution. Rather than executing disjointed setup scripts, the Orchestrator evaluates a polymorphic array of module objects. These modules—whether core foundational layers (BootstrapModule) or domain-specific macros (PresetModule)—interact exclusively with a centralized state object, the EnvironmentManifest.
Think of the EnvironmentManifest as the nucleus of the scaffolding process. All modules revolve around this singular state object, mutating its properties and injecting AST payloads during their respective build() phases. Because modules never execute their own side-effects, the manifest safely aggregates the net declarative intent before the executor flushes it to disk.
classDiagram
direction BT
class EnvironmentManifest {
+list[str] dependencies
+set[str] directories
+dict[str, str] file_injections
+dict[str, list] file_appends
+add_dependency(package: str)
+add_file_append(path: str, content: str)
+add_system_task(command: list)
}
class BootstrapModule {
<<Abstract>>
+tuple cli_flags
+tuple required_languages
+pre_flight()*
+build(manifest: EnvironmentManifest)*
}
class PresetModule {
<<Abstract>>
+list default_dependencies
+list default_directories
+list default_ignores
+build(manifest: EnvironmentManifest)*
}
BootstrapModule ..> EnvironmentManifest : Mutates state via build()
PresetModule ..> EnvironmentManifest : Mutates state via build()
Class Definitions¶
Core Interface: Define the foundational environment footprint (languages, core tooling). Evaluated during protostar init.
protostar.modules.base.BootstrapModule ¶
Bases: ABC
Appends module-specific requirements to the environment manifest.
Source code in src/protostar/modules/base.py
cli_flags
class-attribute
¶
The CLI flags to trigger this module (e.g., ('-p', '--python')).
config_key
class-attribute
¶
The global configuration key used to evaluate if this module is active.
aliases
property
¶
Returns a list of configuration aliases that map to this module.
Used for dynamic resolution from the global configuration file.
collision_markers
property
¶
Returns a list of critical filesystem paths to evaluate for collisions during pre-flight.
Returns:
| Type | Description |
|---|---|
list[Path]
|
A list of Path objects representing critical configuration files or directories |
list[Path]
|
managed by this module. Defaults to an empty list. |
pre_flight ¶
Verifies system prerequisites before manifest building begins.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If a critical dependency (e.g., 'uv', 'cargo') is missing. |
build
abstractmethod
¶
Appends module-specific requirements to the environment manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
EnvironmentManifest
|
The centralized state object. |
required |
Domain-Specific Dependencies: PresetModule
Lighter wrappers that inject domain-specific dependencies and directories onto a bootstrap foundation.
protostar.presets.base.PresetModule ¶
Bases: ABC
Appends module-specific requirements to the environment manifest.
Source code in src/protostar/presets/base.py
cli_flags
class-attribute
¶
The CLI flags to trigger this preset (e.g., ('-a', '--astro')).
default_dependencies
property
¶
Returns a list of default packages to inject for this preset.
default_directories
property
¶
Returns a list of default directories to scaffold for this preset.
default_ignores
property
¶
Returns a list of default VCS ignore patterns for this preset.
build ¶
Appends preset-specific dependencies and directories to the manifest.
Automatically applies configuration overrides if present. Otherwise, injects the default packages, directories, and ignores defined by the preset subclass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
EnvironmentManifest
|
The centralized state object. |
required |