Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
401 changes: 392 additions & 9 deletions cli/Cargo.lock

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ anyhow = "1"
semver = "1"
flate2 = "1"
tar = "0.4"
ratatui = { version = "0.29", optional = true, default-features = false, features = ["crossterm"] }
crossterm = { version = "0.28", optional = true }
pulldown-cmark = { version = "0.12", optional = true }

[features]
default = ["tui"]
tui = ["ratatui", "crossterm", "pulldown-cmark"]

[dev-dependencies]
assert_cmd = "2"
Expand Down
23 changes: 23 additions & 0 deletions cli/src/commands/explore.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use anyhow::{bail, Result};
use std::path::PathBuf;

use crate::utils;

pub fn run(path: &str) -> Result<()> {
let target = PathBuf::from(path)
.canonicalize()
.unwrap_or_else(|_| PathBuf::from(path));

let devtrail_dir = target.join(".devtrail");

if !devtrail_dir.exists() {
utils::warn(&format!(
"DevTrail is not initialized in {}",
target.display()
));
utils::info("Run 'devtrail init' to initialize DevTrail in this directory.");
bail!("No DevTrail installation found");
}

crate::tui::run(&target)
}
2 changes: 2 additions & 0 deletions cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pub mod about;
#[cfg(feature = "tui")]
pub mod explore;
pub mod init;
pub mod remove;
pub mod status;
Expand Down
11 changes: 11 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ mod inject;
mod manifest;
mod platform;
mod self_update;
#[cfg(feature = "tui")]
mod tui;
mod utils;

/// DevTrail CLI - Documentation Governance for AI-Assisted Development
Expand Down Expand Up @@ -47,6 +49,13 @@ enum Commands {
},
/// Show version, author, and license information
About,
/// Explore DevTrail documentation interactively
#[cfg(feature = "tui")]
Explore {
/// Target directory (default: current directory)
#[arg(default_value = ".")]
path: String,
},
}

fn main() {
Expand All @@ -63,6 +72,8 @@ fn main() {
Commands::Remove { full } => commands::remove::run(full),
Commands::Status { path } => commands::status::run(&path),
Commands::About => commands::about::run(),
#[cfg(feature = "tui")]
Commands::Explore { path } => commands::explore::run(&path),
};

if let Err(e) = result {
Expand Down
Loading