Skip to main content

actr_cli/commands/initialize/
traits.rs

1use crate::template::EchoRole;
2use crate::{error::Result, template::ProjectTemplateName};
3use async_trait::async_trait;
4use std::path::PathBuf;
5
6/// Context for project initialization.
7#[derive(Debug, Clone)]
8pub struct InitContext {
9    pub project_dir: PathBuf,
10    pub project_name: String,
11    pub signaling_url: String,
12    pub manufacturer: String,
13    pub template: ProjectTemplateName,
14    pub is_current_dir: bool,
15    /// Role for echo template: service or app. Ignored for other templates.
16    pub echo_role: Option<EchoRole>,
17    /// True when this project is being generated as part of a `role=both` pair.
18    /// Causes the app to depend on the locally-generated echo-service rather than
19    /// the public echo-echo-server registry package.
20    pub is_both: bool,
21}
22
23/// Interface for language-specific project initialization.
24#[async_trait]
25pub trait ProjectInitializer: Send + Sync {
26    async fn generate_project_structure(&self, context: &InitContext) -> Result<()>;
27    fn print_next_steps(&self, context: &InitContext);
28}