Skip to main content

Module init

Module init 

Source
Expand description

Project initialization scaffolding for Spikard

This module provides the foundation for the spikard init command, enabling users to bootstrap new Spikard projects with language-specific structure, configuration, and example handlers.

§Architecture

The initialization system follows a layered design:

  • ProjectScaffolder: Language-agnostic trait defining what files and structure are needed for a new project.
  • InitEngine: Orchestrates the scaffolding process, validates inputs, and manages file creation.
  • ScaffoldedFile: Represents a file to be written with path and content.

§Example

use spikard_cli::init::{InitRequest, InitEngine};
use spikard_cli::codegen::TargetLanguage;
use std::path::PathBuf;

let request = InitRequest {
    project_name: "my_api".to_string(),
    language: TargetLanguage::Python,
    project_dir: PathBuf::from("."),
    schema_path: None,
};

let response = InitEngine::execute(request)?;
println!("Created {} files", response.files_created.len());
for step in response.next_steps {
    println!("  - {}", step);
}

Re-exports§

pub use elixir::ElixirScaffolder;
pub use engine::InitEngine;
pub use engine::InitError;
pub use engine::InitRequest;
pub use engine::InitResponse;
pub use php::PhpScaffolder;
pub use python::PythonScaffolder;
pub use ruby::RubyScaffolder;
pub use rust_lang::RustScaffolder;
pub use scaffolder::ProjectScaffolder;
pub use scaffolder::ScaffoldedFile;
pub use typescript::TypeScriptScaffolder;

Modules§

elixir
Elixir project scaffolder for Spikard applications.
engine
Orchestration engine for project initialization.
php
PHP Project Scaffolder
python
Python project scaffolder for Spikard applications.
ruby
Ruby Project Scaffolder
rust_lang
Rust Project Scaffolder
scaffolder
Project scaffolding traits and structures for language-specific setup.
typescript
TypeScript Project Scaffolder