Refactor view modules for improved readability and consistency

- Updated markdown rendering logic to use more concise methods for obtaining vector lengths.
- Changed review status display to use the correct flag from settings.
- Cleaned up sidebar rendering code for better formatting and readability.
- Enhanced status bar rendering with improved string formatting and consistent style application.
- Refined workflow panel rendering, ensuring consistent style usage and improved readability.
- Added architecture overview and detailed documentation for backend, data, dependencies, and frontend structures.
This commit is contained in:
asepharyana
2026-07-16 07:56:11 +07:00
parent 7d99cd6618
commit a00aa9bec8
141 changed files with 3420 additions and 2172 deletions
+28 -16
View File
@@ -6,11 +6,10 @@
//! choice, so this step is plain Rust — not an LLM call, not a cycle the
//! Core Intelligence can omit or reshape — and always runs after any
//! hive-mind convergence completes.
use std::path::{Path, PathBuf};
use std::fmt::Write as _;
use crate::app::workflow::hive_mind::NodeReport;
use crate::model::memory::Memory;
use std::fmt::Write as _;
use std::path::{Path, PathBuf};
/// Write a markdown report of one hive-mind convergence to
/// `<workspace_root>/docs/runs/<timestamp>-<slug>.md`.
@@ -42,22 +41,31 @@ pub fn write_hive_mind_convergence(
}
/// Render a hive-mind convergence as a markdown document.
fn render_report(user_request: &str, ts_millis: i64, reports: &[NodeReport], consensus: &str) -> String {
fn render_report(
user_request: &str,
ts_millis: i64,
reports: &[NodeReport],
consensus: &str,
) -> String {
let mut out = String::new();
writeln!(out, "# The Hive converges: {user_request}").unwrap();
writeln!(out, "\nTimestamp (ms): {ts_millis}\n").unwrap();
let _ = writeln!(out, "# The Hive converges: {user_request}");
let _ = writeln!(out, "\nTimestamp (ms): {ts_millis}\n");
let cycle_count = reports.iter().map(|r| r.cycle_index).max().map_or(0, |m| m + 1);
let cycle_count = reports
.iter()
.map(|r| r.cycle_index)
.max()
.map_or(0, |m| m + 1);
for cycle_index in 0..cycle_count {
writeln!(out, "## Cycle {cycle_index}\n").unwrap();
let _ = writeln!(out, "## Cycle {cycle_index}\n");
for r in reports.iter().filter(|r| r.cycle_index == cycle_index) {
writeln!(out, "### {}\n", r.node_id).unwrap();
writeln!(out, "{}\n", r.output).unwrap();
let _ = writeln!(out, "### {}\n", r.node_id);
let _ = writeln!(out, "{}\n", r.output);
}
}
writeln!(out, "## The Hive's Verdict\n").unwrap();
writeln!(out, "{consensus}\n").unwrap();
let _ = writeln!(out, "## The Hive's Verdict\n");
let _ = writeln!(out, "{consensus}\n");
out
}
@@ -70,10 +78,14 @@ mod tests {
let tmp = std::env::temp_dir().join(format!("zesdex-docs-test-{}", uuid::Uuid::new_v4()));
std::fs::create_dir_all(&tmp).unwrap();
let reports = vec![
NodeReport { node_id: "Node-0-0".to_string(), cycle_index: 0, output: "found the bug".to_string() },
];
let path = write_hive_mind_convergence(&tmp, "fix the bug", &reports, "the bug is a null check").unwrap();
let reports = vec![NodeReport {
node_id: "Node-0-0".to_string(),
cycle_index: 0,
output: "found the bug".to_string(),
}];
let path =
write_hive_mind_convergence(&tmp, "fix the bug", &reports, "the bug is a null check")
.unwrap();
assert!(path.starts_with(tmp.join("docs").join("runs")));
let content = std::fs::read_to_string(&path).unwrap();