Bootstrap
Bash-based bootstrap engine reference documentation
Loading...
Searching...
No Matches
Functions
bootstrap.bash File Reference

Provides the bootstrap engine source entry point. More...

Functions

int bootstrap_print_help ()
 Prints the currently supported command-line usage summary.
 
int bootstrap_print_usage_error (String message)
 Prints a human-readable command-line usage error.
 
int bootstrap_parse_arguments (String arguments)
 Parses supported long-form command-line options.
 
int bootstrap_run_placeholder ()
 Runs the placeholder operation when no manifest was supplied.
 
int bootstrap_print_action_record (String action, String package, String operator, String version)
 Prints one human-readable dry-run line for an Action Record.
 
int bootstrap_print_action_explanation (String action, String package, String operator, String version, String source, String line_number)
 Prints provenance and architectural context for one Action Record.
 
int bootstrap_print_resolved_action (String action, String manager, String package, String operator, String version)
 Prints one human-readable dry-run line for a Resolved Action.
 
int bootstrap_print_resolved_action_explanation (String action, String manager, String package, String operator, String version, String source, String line_number)
 Prints explanatory context for one Resolved Action.
 
int bootstrap_print_manifest_scope (String heading)
 Prints the ordered manifests included in the current invocation.
 
int bootstrap_print_dry_run_plan (String action_file, String resolved_file)
 Renders a planned and resolved dry-run action list for all manifests.
 
int bootstrap_preflight_manifests (String action_file, String resolved_file)
 Parses, plans, and resolves every supplied manifest before execution.
 
int bootstrap_run_dry_run_plan ()
 Preflights all manifests and prints one read-only invocation plan.
 
int bootstrap_print_execution_result (String status, String exit_code, String action, String manager, String package, String message)
 Prints one human-readable execution result line.
 
int bootstrap_print_execution_results (String result_file)
 Prints a human-readable execution summary from Execution Result records.
 
int bootstrap_run_execution_plan ()
 Preflights all manifests before executing the complete resolved plan.
 
int main (String arguments)
 Runs the bootstrap command-line entry point.
 

Detailed Description

Provides the bootstrap engine source entry point.

This file contains the public command-line entry point that is assembled into dist/bootstrap.bash. The entry point owns user-facing option handling, dry-run rendering, execution-result rendering, and the final choice between planning and execution.

The command model is intentionally a single primary operation modified by explicit long options. That keeps the bootstrap experience compact while still making user intent visible through flags such as –dry-run, –explain, –verbose, and –quiet.

This source file is assembled into the distribution artifact together with the runtime, manifest, planner, resolver, backend, and executor modules. It should therefore avoid duplicating lower-level package-manager policy.

Examples
bootstrap.bash --help
bootstrap.bash --dry-run --explain packages.txt
bootstrap.bash --package-manager apt packages.txt

Function Documentation

◆ bootstrap_parse_arguments()

int bootstrap_parse_arguments ( String  arguments)

Parses supported long-form command-line options.

The parser intentionally accepts only explicit long options. Short aliases are not added yet because the ADRs prefer clarity and compatibility over a broad convenience surface.

The parser records option state in runtime context for later phases. Manifest planning and execution happen after parsing so argument validation remains separate from pipeline orchestration.

Parameters
argumentsCommand-line arguments supplied by the user.
Return values
0All arguments were parsed successfully.
64The user supplied unsupported, unexpected, or contradictory input.
Examples
bootstrap_parse_arguments --dry-run --package-manager apt packages.txt
bootstrap_parse_arguments --verbose packages.txt
int bootstrap_parse_arguments(String arguments)
Parses supported long-form command-line options.

◆ bootstrap_preflight_manifests()

int bootstrap_preflight_manifests ( String  action_file,
String  resolved_file 
)

Parses, plans, and resolves every supplied manifest before execution.

Each manifest is planned into a private temporary file first. Its Action Records are appended to the invocation plan only after that manifest succeeds, preventing partial records from a failed manifest from entering the executable plan. Resolution runs only after every manifest has parsed and planned successfully. This establishes the ADR-049 global preflight barrier.

Parameters
action_fileDestination for the complete ordered Action Record stream.
resolved_fileDestination for the complete ordered Resolved Action stream.
Return values
0Every manifest parsed, planned, and resolved successfully.
65A manifest could not be read, parsed, or planned.
69At least one planned action could not be resolved.

◆ bootstrap_print_action_explanation()

int bootstrap_print_action_explanation ( String  action,
String  package,
String  operator,
String  version,
String  source,
String  line_number 
)

Prints provenance and architectural context for one Action Record.

Explain output should make the plan easier to inspect without pretending that executor work has already happened. This helper reports the manifest line that produced the action and restates the planner boundary.

Parameters
actionAction Record type.
packagePackage name associated with the action.
operatorOptional version constraint operator.
versionOptional version constraint value.
sourceManifest source path preserved by the parser and planner.
line_numberManifest line number preserved by the parser and planner.
Return values
0The explanation was printed successfully.
65The Action Record type was unsupported by this renderer.
Examples
bootstrap_print_action_explanation install-package shellcheck "" "" packages.txt 3
bootstrap_print_action_explanation install-package bash ">=" 5.0 packages.txt 4
int bootstrap_print_action_explanation(String action, String package, String operator, String version, String source, String line_number)
Prints provenance and architectural context for one Action Record.

◆ bootstrap_print_action_record()

int bootstrap_print_action_record ( String  action,
String  package,
String  operator,
String  version 
)

Prints one human-readable dry-run line for an Action Record.

The planner emits abstract Action Records. This function renders the current install-package action model without resolving package managers or command lines. Unknown action types are reported as manifest errors.

Parameters
actionAction Record type.
packagePackage name associated with the action.
operatorOptional version constraint operator.
versionOptional version constraint value.
Return values
0The Action Record was rendered successfully.
65The Action Record type was unsupported by this renderer.
Examples
bootstrap_print_action_record install-package shellcheck
bootstrap_print_action_record install-package bash ">=" 5.0
int bootstrap_print_action_record(String action, String package, String operator, String version)
Prints one human-readable dry-run line for an Action Record.

◆ bootstrap_print_dry_run_plan()

int bootstrap_print_dry_run_plan ( String  action_file,
String  resolved_file 
)

Renders a planned and resolved dry-run action list for all manifests.

Dry-run output is deliberately generated from Action Records and Resolved Actions rather than parser records. This keeps user-facing output aligned with the same pipeline that later executor phases consume while guaranteeing that dry-run mode performs no system changes.

Parameters
action_fileFile containing pipe-delimited Action Records.
resolved_fileFile containing pipe-delimited Resolved Actions.
Standard Output
Human-readable dry-run output.
Return values
0The dry-run plan was printed successfully.
65An Action Record could not be rendered.
69A Resolved Action could not be rendered.
Examples
bootstrap_print_dry_run_plan /tmp/bootstrap-plan.txt /tmp/bootstrap-resolved.txt
int bootstrap_print_dry_run_plan(String action_file, String resolved_file)
Renders a planned and resolved dry-run action list for all manifests.

◆ bootstrap_print_execution_result()

int bootstrap_print_execution_result ( String  status,
String  exit_code,
String  action,
String  manager,
String  package,
String  message 
)

Prints one human-readable execution result line.

Execution Results are the final records in the pipeline. This renderer keeps user-facing reporting separate from executor behavior so executor tests can focus on record contracts.

Parameters
statusExecution Result status such as success, already-satisfied, or failed.
exit_codeProcess-style exit code attached to the result.
actionResolved Action type that was executed.
managerBackend or package manager that handled the action.
packagePackage name associated with the result.
messageHuman-readable execution result message.
Standard Output
Human-readable execution output.
Return values
0The Execution Result was printed successfully.
Examples
bootstrap_print_execution_result success 0 install-package apt shellcheck installed
bootstrap_print_execution_result already-satisfied 0 install-package apt bash "already installed"
int bootstrap_print_execution_result(String status, String exit_code, String action, String manager, String package, String message)
Prints one human-readable execution result line.

◆ bootstrap_print_execution_results()

int bootstrap_print_execution_results ( String  result_file)

Prints a human-readable execution summary from Execution Result records.

This helper renders the structured records emitted by the executor. It keeps output formatting outside the executor so executor tests can focus on record contracts while CLI tests focus on user-visible behavior.

Parameters
result_fileFile containing pipe-delimited Execution Result records.
Standard Output
Human-readable execution output.
Return values
0Execution Results were printed successfully.
Examples
bootstrap_print_execution_results /tmp/bootstrap-results.txt
int bootstrap_print_execution_results(String result_file)
Prints a human-readable execution summary from Execution Result records.

◆ bootstrap_print_help()

int bootstrap_print_help ( )

Prints the currently supported command-line usage summary.

The help output documents behavior that is implemented and tested. Operational options are listed because the parser recognizes them and records their state before planning or execution begins.

Standard Output
Help text.
Return values
0Help text was printed successfully.
Examples
int bootstrap_print_help()
Prints the currently supported command-line usage summary.

◆ bootstrap_print_manifest_scope()

int bootstrap_print_manifest_scope ( String  heading)

Prints the ordered manifests included in the current invocation.

Single-manifest output retains the established wording for compatibility. Multi-manifest output lists every path explicitly so users can verify the preflight scope and correlate later provenance-bearing diagnostics.

Parameters
headingSingular heading prefix used before the manifest description.
Return values
0The manifest scope was printed successfully.

◆ bootstrap_print_resolved_action()

int bootstrap_print_resolved_action ( String  action,
String  manager,
String  package,
String  operator,
String  version 
)

Prints one human-readable dry-run line for a Resolved Action.

Resolved Actions bind abstract planner output to the current platform without executing anything. This renderer names the selected package manager while avoiding command-line syntax that could be mistaken for completed work.

Parameters
actionResolved Action type.
managerPackage manager selected by the resolver.
packagePackage name associated with the action.
operatorOptional version constraint operator.
versionOptional version constraint value.
Return values
0The Resolved Action was rendered successfully.
69The Resolved Action type was unsupported by this renderer.
Examples
bootstrap_print_resolved_action install-package apt shellcheck
bootstrap_print_resolved_action install-package apt bash ">=" 5.0
int bootstrap_print_resolved_action(String action, String manager, String package, String operator, String version)
Prints one human-readable dry-run line for a Resolved Action.

◆ bootstrap_print_resolved_action_explanation()

int bootstrap_print_resolved_action_explanation ( String  action,
String  manager,
String  package,
String  operator,
String  version,
String  source,
String  line_number 
)

Prints explanatory context for one Resolved Action.

This helper describes how the current environment resolved a planned action. It is deliberately phrased as future intent rather than completed work because dry-run mode must never mutate the system.

Parameters
actionResolved Action type.
managerPackage manager selected by the resolver.
packagePackage name associated with the resolved action.
operatorOptional version constraint operator.
versionOptional version constraint value.
sourceManifest source path preserved for provenance.
line_numberManifest line number preserved for provenance.
Return values
0The explanation was printed successfully.
69The Resolved Action type was unsupported by this renderer.
Examples
bootstrap_print_resolved_action_explanation install-package apt shellcheck "" "" packages.txt 3
bootstrap_print_resolved_action_explanation install-package apt bash ">=" 5.0 packages.txt 4
int bootstrap_print_resolved_action_explanation(String action, String manager, String package, String operator, String version, String source, String line_number)
Prints explanatory context for one Resolved Action.

◆ bootstrap_print_usage_error()

int bootstrap_print_usage_error ( String  message)

Prints a human-readable command-line usage error.

Unsupported or contradictory options fail conservatively instead of being ignored. This keeps misspelled flags visible and avoids implying that the engine accepted an instruction that it cannot safely honor.

Parameters
messageThe specific usage problem to show to the user.
Standard Error
Diagnostic text.
Return values
0The diagnostic was printed successfully.
Examples
bootstrap_print_usage_error "unsupported option: --force"
int bootstrap_print_usage_error(String message)
Prints a human-readable command-line usage error.

◆ bootstrap_run_dry_run_plan()

int bootstrap_run_dry_run_plan ( )

Preflights all manifests and prints one read-only invocation plan.

Dry-run uses the same complete Action Record and Resolved Action streams that execution would consume. No output plan is rendered until every manifest has crossed the global preflight barrier successfully.

Return values
0All manifests were preflighted and displayed successfully.
65A manifest could not be parsed or planned.
69The complete action set could not be resolved on this system.

◆ bootstrap_run_execution_plan()

int bootstrap_run_execution_plan ( )

Preflights all manifests before executing the complete resolved plan.

No executor is invoked until every supplied manifest has parsed, planned, and resolved successfully. The resulting Resolved Action stream preserves manifest argument order and source provenance, satisfying ADR-049 without concatenating source files or losing filename and line-number diagnostics.

Return values
0The complete manifest set executed successfully or required no work.
65At least one manifest could not be parsed or planned.
69At least one planned action could not be resolved.
70At least one resolved action failed during execution.

◆ bootstrap_run_placeholder()

int bootstrap_run_placeholder ( )

Runs the placeholder operation when no manifest was supplied.

This function preserves the established no-manifest behavior while respecting –quiet as the only flag whose behavior is meaningful without manifest input.

Standard Output
A placeholder status message unless quiet mode is enabled.
Return values
0The placeholder operation completed successfully.
Examples
int bootstrap_run_placeholder()
Runs the placeholder operation when no manifest was supplied.

◆ main()

int main ( String  arguments)

Runs the bootstrap command-line entry point.

Discovery commands such as –help and –version return immediately and must be used by themselves. Operational flags are parsed, configuration is validated, and a supplied manifest is then either dry-run planned or executed.

Parameters
argumentsCommand-line arguments supplied by the user.
Output Streams
Command output on standard output, or diagnostics on standard error.
Return values
0The command completed successfully.
64The user supplied unsupported or invalid command-line arguments.
65Manifest parsing or planning failed.
69Resolution failed for the current system.
70Execution failed for at least one resolved action.
Examples
main --help
main --dry-run --explain packages.txt
main --package-manager apt packages.txt
int main(String arguments)
Runs the bootstrap command-line entry point.