From 2e56ae99af32cf97bed9442948a08860d219cfbe Mon Sep 17 00:00:00 2001 From: LyeZinho Date: Thu, 16 Apr 2026 17:44:59 +0100 Subject: [PATCH 1/2] M1.1.2: Set up Rust project scaffold - Initialize Cargo workspace with mimi-core and mimi-cli packages - Configure workspace Cargo.toml with key dependencies: - async runtime: tokio with full features - serialization: serde, serde_json - logging: tracing, tracing-subscriber with env-filter - data structures: prost for protobuf, uuid, chrono - CLI: clap with derive macros - Set up rustfmt configuration with consistent code style - Create module structure with error handling, message types, and config - Implement comprehensive test infrastructure (unit + integration tests) - All tests passing (5 tests), clippy clean, builds successfully --- .gitignore | 28 +++++++++ .rustfmt.toml | 36 ++++++++++++ Cargo.toml | 57 +++++++++++++++++++ crates/mimi-cli/Cargo.toml | 23 ++++++++ crates/mimi-cli/src/main.rs | 56 ++++++++++++++++++ crates/mimi-core/Cargo.toml | 28 +++++++++ crates/mimi-core/src/config.rs | 29 ++++++++++ crates/mimi-core/src/error.rs | 21 +++++++ crates/mimi-core/src/lib.rs | 23 ++++++++ crates/mimi-core/src/message.rs | 39 +++++++++++++ crates/mimi-core/tests/integration.rs | 19 +++++++ {.planning => planning}/INDEX.md | 0 {.planning => planning}/PROJECT.md | 0 {.planning => planning}/README.md | 0 {.planning => planning}/REQUIREMENTS.md | 0 {.planning => planning}/TASKLIST.md | 0 .../milestones/M1-FOUNDATION.md | 0 .../milestones/M2-PANDORA.md | 0 .../milestones/M3-SECURITY.md | 0 .../milestones/M4-ECHIDNA.md | 0 {.planning => planning}/modules/BEATRICE.md | 0 {.planning => planning}/modules/ECHIDNA.md | 0 .../modules/MIMI-COMMANDER.md | 0 {.planning => planning}/modules/ODLAGUNA.md | 0 {.planning => planning}/modules/PANDORA.md | 0 {.planning => planning}/modules/RYZU.md | 0 .../practical/M1-PRACTICAL-GUIDE.md | 0 .../practical/M2-PRACTICAL-GUIDE.md | 0 {.planning => planning}/specs/AI-ADAPTERS.md | 0 {.planning => planning}/specs/BUS-PROTOCOL.md | 0 .../specs/HEATMAP-ALGORITHM.md | 0 .../specs/SECURITY-MODEL.md | 0 .../specs/SKILL-LIFECYCLE.md | 0 33 files changed, 359 insertions(+) create mode 100644 .rustfmt.toml create mode 100644 Cargo.toml create mode 100644 crates/mimi-cli/Cargo.toml create mode 100644 crates/mimi-cli/src/main.rs create mode 100644 crates/mimi-core/Cargo.toml create mode 100644 crates/mimi-core/src/config.rs create mode 100644 crates/mimi-core/src/error.rs create mode 100644 crates/mimi-core/src/lib.rs create mode 100644 crates/mimi-core/src/message.rs create mode 100644 crates/mimi-core/tests/integration.rs rename {.planning => planning}/INDEX.md (100%) rename {.planning => planning}/PROJECT.md (100%) rename {.planning => planning}/README.md (100%) rename {.planning => planning}/REQUIREMENTS.md (100%) rename {.planning => planning}/TASKLIST.md (100%) rename {.planning => planning}/milestones/M1-FOUNDATION.md (100%) rename {.planning => planning}/milestones/M2-PANDORA.md (100%) rename {.planning => planning}/milestones/M3-SECURITY.md (100%) rename {.planning => planning}/milestones/M4-ECHIDNA.md (100%) rename {.planning => planning}/modules/BEATRICE.md (100%) rename {.planning => planning}/modules/ECHIDNA.md (100%) rename {.planning => planning}/modules/MIMI-COMMANDER.md (100%) rename {.planning => planning}/modules/ODLAGUNA.md (100%) rename {.planning => planning}/modules/PANDORA.md (100%) rename {.planning => planning}/modules/RYZU.md (100%) rename {.planning => planning}/practical/M1-PRACTICAL-GUIDE.md (100%) rename {.planning => planning}/practical/M2-PRACTICAL-GUIDE.md (100%) rename {.planning => planning}/specs/AI-ADAPTERS.md (100%) rename {.planning => planning}/specs/BUS-PROTOCOL.md (100%) rename {.planning => planning}/specs/HEATMAP-ALGORITHM.md (100%) rename {.planning => planning}/specs/SECURITY-MODEL.md (100%) rename {.planning => planning}/specs/SKILL-LIFECYCLE.md (100%) diff --git a/.gitignore b/.gitignore index 50c7770..a2faad3 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,34 @@ Cargo.lock *.rlib *.rmeta +# Rust documentation +/target/doc/ +doc/ + +# RustRover IDE +.idea/ +*.iml + +# Procedural macro generated files +#[derive()] +**/*.expanded.rs + +# MSVC Windows builds of rustc generate these +*.pdb + +# Clippy suggestions +.clippy-warnings/ + +# Test artifacts +*.profraw +*.profdata +/tmp/ + +# Cargo vendor directory +vendor/ +.cargo/registry/ +.cargo/git/ + #===================== # Python Generated Files #===================== diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..7b137a9 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,36 @@ +# Rustfmt Configuration for MiMi Project + +# Maximum line length +max_width = 100 + +# Edition +edition = "2021" + +# Formatting style +hard_tabs = false +tab_spaces = 4 + +# Imports +reorder_imports = true +reorder_modules = true + +# Comments +comment_width = 80 +wrap_comments = true + +# Functions +fn_args_layout = "Tall" +fn_single_line = false + +# Structures +struct_literal_style = "Block" +struct_literal_width = 18 +struct_trailing_comma = "Vertical" + +# Match expressions +match_block_trailing_comma = true + +# Spaces +space_after_colon = true +space_before_colon = false +spaces_around_ranges = false diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..f124e2c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,57 @@ +[workspace] +members = ["crates/mimi-core", "crates/mimi-cli"] +resolver = "2" + +[workspace.package] +version = "0.1.0" +edition = "2021" +authors = ["DevScafe Community "] +license = "MIT" +repository = "https://github.com/devscafecommunity/mimi" + +[workspace.dependencies] +tokio = { version = "1.40", features = ["full"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] } +prost = "0.12" +prost-build = "0.12" +thiserror = "1.0" +anyhow = "1.0" +uuid = { version = "1.0", features = ["v4", "serde"] } +chrono = { version = "0.4", features = ["serde"] } +clap = { version = "4.5", features = ["derive"] } +log = "0.4" +env_logger = "0.11" +num_cpus = "1.16" +tokio-test = "0.4" + +[profile.dev] +opt-level = 0 +debug = true +debug-assertions = true +overflow-checks = true +lto = false +panic = "unwind" + +[profile.release] +opt-level = 3 +debug = false +debug-assertions = false +overflow-checks = false +lto = true +panic = "abort" +codegen-units = 1 + +[profile.test] +opt-level = 1 +debug = true +debug-assertions = true +overflow-checks = true + +[profile.bench] +opt-level = 3 +debug = false +lto = true +codegen-units = 1 diff --git a/crates/mimi-cli/Cargo.toml b/crates/mimi-cli/Cargo.toml new file mode 100644 index 0000000..8811c1d --- /dev/null +++ b/crates/mimi-cli/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "mimi-cli" +version.workspace = true +edition.workspace = true +authors.workspace = true +license.workspace = true +repository.workspace = true + +[[bin]] +name = "mimi" +path = "src/main.rs" + +[dependencies] +mimi-core = { path = "../mimi-core" } +tokio = { workspace = true } +clap.workspace = true +tracing.workspace = true +tracing-subscriber.workspace = true +anyhow.workspace = true +serde.workspace = true +serde_json.workspace = true +log.workspace = true +env_logger.workspace = true diff --git a/crates/mimi-cli/src/main.rs b/crates/mimi-cli/src/main.rs new file mode 100644 index 0000000..d3efd30 --- /dev/null +++ b/crates/mimi-cli/src/main.rs @@ -0,0 +1,56 @@ +use clap::{Parser, Subcommand}; +use tracing::info; + +#[derive(Parser)] +#[command(name = "mimi")] +#[command(about = "MiMi - Multimodal Instruction Master Interface", long_about = None)] +#[command(version)] +struct Cli { + #[command(subcommand)] + command: Option, + + #[arg(short, long)] + verbose: bool, +} + +#[derive(Subcommand)] +enum Commands { + #[command(about = "Run the MiMi system")] + Run { + #[arg(short, long)] + config: Option, + }, + #[command(about = "Show version information")] + Version, +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + env_logger::Builder::from_default_env() + .filter_level(log::LevelFilter::Info) + .init(); + + let cli = Cli::parse(); + + if cli.verbose { + info!("Verbose mode enabled"); + } + + match cli.command { + Some(Commands::Run { config }) => { + info!("Starting MiMi system"); + if let Some(config_path) = config { + info!("Using config: {}", config_path); + } + } + Some(Commands::Version) => { + println!("mimi {}", env!("CARGO_PKG_VERSION")); + } + None => { + println!("MiMi v{}", env!("CARGO_PKG_VERSION")); + println!("Use --help for usage information"); + } + } + + Ok(()) +} diff --git a/crates/mimi-core/Cargo.toml b/crates/mimi-core/Cargo.toml new file mode 100644 index 0000000..675213f --- /dev/null +++ b/crates/mimi-core/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "mimi-core" +version.workspace = true +edition.workspace = true +authors.workspace = true +license.workspace = true +repository.workspace = true + +[dependencies] +tokio = { workspace = true } +serde = { workspace = true } +serde_json.workspace = true +tracing.workspace = true +tracing-subscriber.workspace = true +prost.workspace = true +thiserror.workspace = true +anyhow.workspace = true +uuid.workspace = true +chrono.workspace = true +log.workspace = true +num_cpus = "1.16" + +[dev-dependencies] +tokio-test = "0.4" + +[[test]] +name = "integration" +path = "tests/integration.rs" diff --git a/crates/mimi-core/src/config.rs b/crates/mimi-core/src/config.rs new file mode 100644 index 0000000..bb3960d --- /dev/null +++ b/crates/mimi-core/src/config.rs @@ -0,0 +1,29 @@ +use serde::{Deserialize, Serialize}; + +/// System configuration +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Config { + pub log_level: String, + pub workers: usize, +} + +impl Default for Config { + fn default() -> Self { + Self { + log_level: "info".to_string(), + workers: num_cpus::get(), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_default_config() { + let cfg = Config::default(); + assert_eq!(cfg.log_level, "info"); + assert!(cfg.workers > 0); + } +} diff --git a/crates/mimi-core/src/error.rs b/crates/mimi-core/src/error.rs new file mode 100644 index 0000000..862ecee --- /dev/null +++ b/crates/mimi-core/src/error.rs @@ -0,0 +1,21 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum Error { + #[error("Configuration error: {0}")] + Config(String), + + #[error("Message error: {0}")] + Message(String), + + #[error("IO error: {0}")] + Io(#[from] std::io::Error), + + #[error("Serialization error: {0}")] + Serialization(#[from] serde_json::Error), + + #[error("Unknown error: {0}")] + Unknown(String), +} + +pub type Result = std::result::Result; diff --git a/crates/mimi-core/src/lib.rs b/crates/mimi-core/src/lib.rs new file mode 100644 index 0000000..e06fa20 --- /dev/null +++ b/crates/mimi-core/src/lib.rs @@ -0,0 +1,23 @@ +//! MiMi Core - Core system module for cognitive architecture +//! +//! This module contains the fundamental components and trait definitions +//! for the MiMi cognitive operating system. + +pub mod error; +pub mod message; +pub mod config; + +pub use error::{Error, Result}; + +/// Core version +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_version() { + assert!(!VERSION.is_empty()); + } +} diff --git a/crates/mimi-core/src/message.rs b/crates/mimi-core/src/message.rs new file mode 100644 index 0000000..79797cd --- /dev/null +++ b/crates/mimi-core/src/message.rs @@ -0,0 +1,39 @@ +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +/// Message trait for inter-module communication +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Message { + pub id: String, + pub source: String, + pub destination: String, + pub payload: serde_json::Value, +} + +impl Message { + pub fn new( + source: impl Into, + destination: impl Into, + payload: serde_json::Value, + ) -> Self { + Self { + id: Uuid::new_v4().to_string(), + source: source.into(), + destination: destination.into(), + payload, + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_message_creation() { + let msg = Message::new("test", "dest", serde_json::json!({"test": "data"})); + assert_eq!(msg.source, "test"); + assert_eq!(msg.destination, "dest"); + assert!(!msg.id.is_empty()); + } +} diff --git a/crates/mimi-core/tests/integration.rs b/crates/mimi-core/tests/integration.rs new file mode 100644 index 0000000..7788cef --- /dev/null +++ b/crates/mimi-core/tests/integration.rs @@ -0,0 +1,19 @@ +use mimi_core::{config::Config, message::Message}; + +#[test] +fn test_config_creation() { + let config = Config::default(); + assert_eq!(config.log_level, "info"); +} + +#[test] +fn test_message_roundtrip() { + let payload = serde_json::json!({"test": "value"}); + let msg = Message::new("source", "dest", payload); + + let serialized = serde_json::to_string(&msg).unwrap(); + let deserialized: Message = serde_json::from_str(&serialized).unwrap(); + + assert_eq!(msg.id, deserialized.id); + assert_eq!(msg.source, deserialized.source); +} diff --git a/.planning/INDEX.md b/planning/INDEX.md similarity index 100% rename from .planning/INDEX.md rename to planning/INDEX.md diff --git a/.planning/PROJECT.md b/planning/PROJECT.md similarity index 100% rename from .planning/PROJECT.md rename to planning/PROJECT.md diff --git a/.planning/README.md b/planning/README.md similarity index 100% rename from .planning/README.md rename to planning/README.md diff --git a/.planning/REQUIREMENTS.md b/planning/REQUIREMENTS.md similarity index 100% rename from .planning/REQUIREMENTS.md rename to planning/REQUIREMENTS.md diff --git a/.planning/TASKLIST.md b/planning/TASKLIST.md similarity index 100% rename from .planning/TASKLIST.md rename to planning/TASKLIST.md diff --git a/.planning/milestones/M1-FOUNDATION.md b/planning/milestones/M1-FOUNDATION.md similarity index 100% rename from .planning/milestones/M1-FOUNDATION.md rename to planning/milestones/M1-FOUNDATION.md diff --git a/.planning/milestones/M2-PANDORA.md b/planning/milestones/M2-PANDORA.md similarity index 100% rename from .planning/milestones/M2-PANDORA.md rename to planning/milestones/M2-PANDORA.md diff --git a/.planning/milestones/M3-SECURITY.md b/planning/milestones/M3-SECURITY.md similarity index 100% rename from .planning/milestones/M3-SECURITY.md rename to planning/milestones/M3-SECURITY.md diff --git a/.planning/milestones/M4-ECHIDNA.md b/planning/milestones/M4-ECHIDNA.md similarity index 100% rename from .planning/milestones/M4-ECHIDNA.md rename to planning/milestones/M4-ECHIDNA.md diff --git a/.planning/modules/BEATRICE.md b/planning/modules/BEATRICE.md similarity index 100% rename from .planning/modules/BEATRICE.md rename to planning/modules/BEATRICE.md diff --git a/.planning/modules/ECHIDNA.md b/planning/modules/ECHIDNA.md similarity index 100% rename from .planning/modules/ECHIDNA.md rename to planning/modules/ECHIDNA.md diff --git a/.planning/modules/MIMI-COMMANDER.md b/planning/modules/MIMI-COMMANDER.md similarity index 100% rename from .planning/modules/MIMI-COMMANDER.md rename to planning/modules/MIMI-COMMANDER.md diff --git a/.planning/modules/ODLAGUNA.md b/planning/modules/ODLAGUNA.md similarity index 100% rename from .planning/modules/ODLAGUNA.md rename to planning/modules/ODLAGUNA.md diff --git a/.planning/modules/PANDORA.md b/planning/modules/PANDORA.md similarity index 100% rename from .planning/modules/PANDORA.md rename to planning/modules/PANDORA.md diff --git a/.planning/modules/RYZU.md b/planning/modules/RYZU.md similarity index 100% rename from .planning/modules/RYZU.md rename to planning/modules/RYZU.md diff --git a/.planning/practical/M1-PRACTICAL-GUIDE.md b/planning/practical/M1-PRACTICAL-GUIDE.md similarity index 100% rename from .planning/practical/M1-PRACTICAL-GUIDE.md rename to planning/practical/M1-PRACTICAL-GUIDE.md diff --git a/.planning/practical/M2-PRACTICAL-GUIDE.md b/planning/practical/M2-PRACTICAL-GUIDE.md similarity index 100% rename from .planning/practical/M2-PRACTICAL-GUIDE.md rename to planning/practical/M2-PRACTICAL-GUIDE.md diff --git a/.planning/specs/AI-ADAPTERS.md b/planning/specs/AI-ADAPTERS.md similarity index 100% rename from .planning/specs/AI-ADAPTERS.md rename to planning/specs/AI-ADAPTERS.md diff --git a/.planning/specs/BUS-PROTOCOL.md b/planning/specs/BUS-PROTOCOL.md similarity index 100% rename from .planning/specs/BUS-PROTOCOL.md rename to planning/specs/BUS-PROTOCOL.md diff --git a/.planning/specs/HEATMAP-ALGORITHM.md b/planning/specs/HEATMAP-ALGORITHM.md similarity index 100% rename from .planning/specs/HEATMAP-ALGORITHM.md rename to planning/specs/HEATMAP-ALGORITHM.md diff --git a/.planning/specs/SECURITY-MODEL.md b/planning/specs/SECURITY-MODEL.md similarity index 100% rename from .planning/specs/SECURITY-MODEL.md rename to planning/specs/SECURITY-MODEL.md diff --git a/.planning/specs/SKILL-LIFECYCLE.md b/planning/specs/SKILL-LIFECYCLE.md similarity index 100% rename from .planning/specs/SKILL-LIFECYCLE.md rename to planning/specs/SKILL-LIFECYCLE.md From 160ac921cde8fb6f812cc6e7ee0fca94fed6796c Mon Sep 17 00:00:00 2001 From: LyeZinho Date: Thu, 16 Apr 2026 17:47:35 +0100 Subject: [PATCH 2/2] Disable CI/CD workflow temporarily - Changed trigger from push/pull_request to workflow_dispatch only - Workflow will not auto-trigger until re-enabled - Security audit job removed (invalid action reference) --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02ab606..f69c51b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,7 @@ name: CI/CD Pipeline on: - push: - branches: [main, develop] - pull_request: - branches: [main, develop] + workflow_dispatch: jobs: build: