Jesús Pérez 3faf7a5fc9
Some checks failed
Build - Verify Code & Build Binaries / Check Code Format (push) Has been cancelled
Build - Verify Code & Build Binaries / Lint with Clippy (push) Has been cancelled
Build - Verify Code & Build Binaries / Test Suite (push) Has been cancelled
Build - Verify Code & Build Binaries / Cargo Check (push) Has been cancelled
Build - Verify Code & Build Binaries / Security Audit (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Debug) - macos-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Debug) - ubuntu-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Debug) - windows-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Release) - macos-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Release) - ubuntu-latest (push) Has been cancelled
Build - Verify Code & Build Binaries / Build (Release) - windows-latest (push) Has been cancelled
CI/CD with Staging Preset / Validate Installation with Staging Preset (macos-latest) (push) Has been cancelled
CI/CD with Staging Preset / Validate Installation with Staging Preset (ubuntu-latest) (push) Has been cancelled
CI/CD with Staging Preset / Validate Documentation (push) Has been cancelled
Build - Verify Code & Build Binaries / All Checks Passed (push) Has been cancelled
CI/CD with Staging Preset / Build and Test with Staging Preset (push) Has been cancelled
CI/CD with Staging Preset / Integration Test with Docker Compose (push) Has been cancelled
CI/CD with Staging Preset / Test Summary (push) Has been cancelled
feat: integrate stratum orchestration, kogral bridge, and NATS
platform

  - Add orchestration.rs and kogral_bridge.rs to syntaxis-vapora
  - Replace async-nats with platform-nats (NKey auth support)
  - Wire stratum-orchestrator, stratum-graph, stratum-state deps
  - Upgrade surrealdb 2.3 → 3 with kv-surrealkv and rustls features
  - Consolidate core/Cargo.toml into root workspace (remove virtual manifest)
  - Add shared/rust/nickel.rs for Nickel config integration
  - Rename CLI binary from syntaxis-cli to syntaxis
2026-02-22 22:01:02 +00:00

111 lines
3.2 KiB
Rust

//! Tools Shared Utilities
//!
//! Provides common functionality for all Tools ecosystem CLIs:
//! - Configuration discovery across multiple locations
//! - Manifest management for resource tracking
//! - Database path resolution
//! - XDG Base Directory support
//! - Project auto-detection and interactive selection
//!
//! # Configuration Discovery
//!
//! All Tools CLIs search for configuration in this order (uses first found):
//! 1. `.project/{name}` - External projects using Tools
//! 2. `.vapora/{name}` - VAPORA platform projects
//! 3. `.coder/{name}` - Documentation tracking
//! 4. Current directory - Fallback
//!
//! # Project Auto-Detection
//!
//! Tools can automatically detect projects by searching for `.project/` or `.vapora/`
//! configuration files in the current working directory and parent directories:
//!
//! ```no_run
//! use tools_shared::detect_project_from_cwd;
//!
//! if let Some(project) = detect_project_from_cwd("config.toml") {
//! println!("Working on project: {}", project.name);
//! }
//! ```
//!
//! # Global Database Support
//!
//! Tools can use a single global database to manage multiple projects:
//!
//! ```no_run
//! use tools_shared::find_global_db_path;
//!
//! let db_path = find_global_db_path("my-tool");
//! // Returns: ~/.local/share/tools/my-tool/my-tool.db
//! ```
//!
//! # Database Migrations
//!
//! Tools can execute SQL migrations from files:
//!
//! ```no_run
//! use tools_shared::run_migration_file;
//!
//! # fn example() -> anyhow::Result<()> {
//! run_migration_file("migrations/001_initial.sql")?;
//! # Ok(()) }
//! ```
//!
//! # Examples
//!
//! ```no_run
//! use tools_shared::find_config_path;
//! use std::path::Path;
//!
//! // Find a configuration file
//! let config = find_config_path("tracking.toml")
//! .unwrap_or_else(|| std::path::PathBuf::from("tracking.toml"));
//! println!("Using config: {}", config.display());
//! ```
pub mod config_finder;
pub mod db_migration;
pub mod global_db;
pub mod project_detection;
pub mod project_selector;
pub mod xdg;
#[cfg(feature = "manifest")]
pub mod manifest_manager;
#[cfg(feature = "nickel")]
pub mod nickel;
// Re-export commonly used items from config_finder
pub use config_finder::{
find_config_path, find_config_path_or, find_config_path_warn_conflicts,
get_global_syntaxis_config_dir, get_global_vapora_config_dir, get_local_syntaxis_config_dir,
get_local_vapora_config_dir,
};
// Re-export XDG utilities
pub use xdg::{ensure_dir, tool_cache_dir, tool_config_dir, tool_data_dir};
// Re-export global database utilities
pub use global_db::{find_global_db_path, find_global_db_path_custom, global_db_exists};
// Re-export project detection
pub use project_detection::{
detect_project_from_cwd, detect_project_from_path, load_last_project, save_last_project,
DetectedProject,
};
// Re-export project selector
#[cfg(feature = "interactive")]
pub use project_selector::select_project;
pub use project_selector::{format_project_option, SelectableProject};
// Re-export database migration utilities
pub use db_migration::{
find_migration_files, has_migration_directory, list_migration_files, migration_directory,
run_migration_file,
};
#[cfg(feature = "manifest")]
pub use manifest_manager::{ConfigEntry, Manifest, ResourceType};