Skip to content

Commit 1eaff95

Browse files
feat(cli): add interactive install TUI wizard
- Add inquire, indicatif, console crates for interactive prompts - Create tui module with custom theme, banner, and UI helpers - Implement wizard flow with project detection and multi-select - Add -y/--yes flag to skip interactive mode - Maintain backward compatibility with existing flag-based usage
1 parent e35a30e commit 1eaff95

File tree

8 files changed

+464
-6
lines changed

8 files changed

+464
-6
lines changed

Cargo.lock

Lines changed: 144 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ schemars = "1.2"
4747
tiktoken-rs = "0.9"
4848
uuid = { version = "1", features = ["v4"] }
4949

50+
# Interactive TUI
51+
inquire = "0.7"
52+
indicatif = "0.17"
53+
console = "0.15"
54+
5055
[dev-dependencies]
5156
tempfile = "3"
5257
assert_cmd = "2"

src/cli/args.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ pub enum Command {
2727
/// Generate AI tool templates (cursor, claude, opencode, or all)
2828
#[arg(long, value_name = "TOOLS")]
2929
templates: Option<Option<String>>,
30+
/// Skip interactive mode, use defaults
31+
#[arg(long, short = 'y')]
32+
yes: bool,
3033
},
3134
/// Start MCP server for AI tool integration
3235
Serve {

src/cli/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ mod hooks;
44
mod serve;
55
mod telemetry;
66
mod templates;
7+
pub mod tui;
78
mod update;
89
mod watch;
910

@@ -13,5 +14,6 @@ pub use hooks::{install_hooks, install_hooks_with_manager, remove_hooks};
1314
pub use serve::{run_mcp_http_server, run_mcp_server};
1415
pub use telemetry::{run_telemetry_all_modules, run_telemetry_module, run_telemetry_summary};
1516
pub use templates::run_templates;
17+
pub use tui::{execute_setup, is_interactive, run_interactive_init, InitOptions};
1618
pub use update::run_update;
1719
pub use watch::run_watch;

src/cli/tui/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mod theme;
2+
mod wizard;
3+
4+
pub use theme::agentlens_theme;
5+
pub use wizard::{
6+
execute_setup, is_interactive, run_interactive_init, InitOptions, TemplateChoice,
7+
};

src/cli/tui/theme.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
use console::style;
2+
use inquire::ui::{Attributes, Color, RenderConfig, StyleSheet, Styled};
3+
4+
pub fn agentlens_theme() -> RenderConfig<'static> {
5+
let mut config = RenderConfig::default();
6+
7+
config.prompt_prefix = Styled::new("?").with_fg(Color::LightCyan);
8+
config.highlighted_option_prefix = Styled::new("❯").with_fg(Color::LightCyan);
9+
config.selected_checkbox = Styled::new("◉").with_fg(Color::LightGreen);
10+
config.unselected_checkbox = Styled::new("○").with_fg(Color::DarkGrey);
11+
config.answer = StyleSheet::new().with_fg(Color::LightCyan);
12+
config.help_message = StyleSheet::new()
13+
.with_fg(Color::DarkGrey)
14+
.with_attr(Attributes::ITALIC);
15+
16+
config
17+
}
18+
19+
pub fn print_banner() {
20+
println!();
21+
println!(
22+
" {} {}",
23+
style("🔍").cyan(),
24+
style("agentlens").cyan().bold()
25+
);
26+
println!(" {}", style("Interactive Setup").dim());
27+
println!();
28+
}
29+
30+
pub fn print_success(message: &str) {
31+
println!(" {} {}", style("✓").green(), message);
32+
}
33+
34+
pub fn print_error(message: &str) {
35+
println!(" {} {}", style("✗").red(), message);
36+
}
37+
38+
pub fn print_summary() {
39+
println!();
40+
println!("{}", style("─".repeat(50)).dim());
41+
println!();
42+
println!(
43+
" {} {}",
44+
style("✅").green(),
45+
style("Setup complete!").green().bold()
46+
);
47+
println!();
48+
println!(" {}", style("Next steps:").bold());
49+
println!(
50+
" {} Run {} to generate documentation",
51+
style("1.").dim(),
52+
style("agentlens").cyan()
53+
);
54+
println!(
55+
" {} Add {} to .gitignore (or commit for team)",
56+
style("2.").dim(),
57+
style(".agentlens/").cyan()
58+
);
59+
println!(
60+
" {} Read {} for AI navigation",
61+
style("3.").dim(),
62+
style(".agentlens/INDEX.md").cyan()
63+
);
64+
println!();
65+
println!(" {} 🚀", style("Happy coding!").dim());
66+
println!();
67+
}

0 commit comments

Comments
 (0)