89 lines
2.4 KiB
Rust
89 lines
2.4 KiB
Rust
|
|
//! Doc-lifecycle plugin for VAPORA
|
||
|
|
|
||
|
|
use crate::config::PluginConfig;
|
||
|
|
use crate::Result;
|
||
|
|
use doc_lifecycle_core::prelude::*;
|
||
|
|
use std::path::PathBuf;
|
||
|
|
|
||
|
|
/// Main plugin interface for doc-lifecycle integration
|
||
|
|
#[derive(Debug)]
|
||
|
|
pub struct DocLifecyclePlugin {
|
||
|
|
config: PluginConfig,
|
||
|
|
classifier: Classifier,
|
||
|
|
consolidator: Consolidator,
|
||
|
|
rag_indexer: RagIndexer,
|
||
|
|
mdbook_generator: Option<MdBookGenerator>,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl DocLifecyclePlugin {
|
||
|
|
/// Create a new doc-lifecycle plugin
|
||
|
|
pub fn new(config: PluginConfig) -> Result<Self> {
|
||
|
|
let mdbook_generator = if config.generate_mdbook {
|
||
|
|
let mdbook_config = doc_lifecycle_core::mdbook_generator::MdBookConfig::new(
|
||
|
|
PathBuf::from("book"),
|
||
|
|
"VAPORA Project".to_string(),
|
||
|
|
);
|
||
|
|
Some(MdBookGenerator::new(mdbook_config))
|
||
|
|
} else {
|
||
|
|
None
|
||
|
|
};
|
||
|
|
|
||
|
|
Ok(Self {
|
||
|
|
config,
|
||
|
|
classifier: Classifier::new(),
|
||
|
|
consolidator: Consolidator::new(),
|
||
|
|
rag_indexer: RagIndexer::new(),
|
||
|
|
mdbook_generator,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
/// Process documentation for a completed task
|
||
|
|
pub async fn process_task_docs(&mut self, task_id: &str) -> Result<()> {
|
||
|
|
tracing::info!("Processing task docs for task {}", task_id);
|
||
|
|
|
||
|
|
// 1. Classify documents
|
||
|
|
if self.config.auto_classify {
|
||
|
|
self.classify_session_docs(task_id).await?;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 2. Consolidate duplicates
|
||
|
|
if self.config.auto_consolidate {
|
||
|
|
self.consolidate_docs().await?;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 3. Generate RAG index
|
||
|
|
if self.config.generate_rag_index {
|
||
|
|
self.update_rag_index().await?;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 4. Generate mdBook
|
||
|
|
if self.config.generate_mdbook {
|
||
|
|
self.generate_mdbook().await?;
|
||
|
|
}
|
||
|
|
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
|
||
|
|
async fn classify_session_docs(&self, _task_id: &str) -> Result<()> {
|
||
|
|
// TODO: Implement session doc classification
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
|
||
|
|
async fn consolidate_docs(&self) -> Result<()> {
|
||
|
|
// TODO: Implement consolidation
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
|
||
|
|
async fn update_rag_index(&self) -> Result<()> {
|
||
|
|
// TODO: Implement RAG index update
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
|
||
|
|
async fn generate_mdbook(&self) -> Result<()> {
|
||
|
|
if let Some(generator) = &self.mdbook_generator {
|
||
|
|
generator.generate()?;
|
||
|
|
}
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
}
|