Skip to content

Commit 1e193a0

Browse files
committed
Fix issue #107: Skip acknowledgment prompt in non-interactive mode
- Add non_interactive parameter to run_onboard_wizard function - Skip safety acknowledgment prompt when --non-interactive flag is set - Update all call sites to pass the non_interactive flag - Fixes issue where 'rustyclaw onboard --non-interactive' still prompted for acknowledgment
1 parent d39657f commit 1e193a0

File tree

3 files changed

+159
-42
lines changed

3 files changed

+159
-42
lines changed

crates/rustyclaw-cli/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ async fn main() -> Result<()> {
604604
#[cfg(feature = "tui")]
605605
{
606606
let mut secrets = open_secrets(&config)?;
607-
run_onboard_wizard(&mut config, &mut secrets, false)?;
607+
run_onboard_wizard(&mut config, &mut secrets, false, args.non_interactive)?;
608608
// Optional agent setup step
609609
let ws_dir = config.workspace_dir();
610610
match rustyclaw_core::tools::agent_setup::exec_agent_setup(
@@ -659,7 +659,7 @@ async fn main() -> Result<()> {
659659
#[cfg(feature = "tui")]
660660
{
661661
let mut secrets = open_secrets(&config)?;
662-
run_onboard_wizard(&mut config, &mut secrets, _args.reset)?;
662+
run_onboard_wizard(&mut config, &mut secrets, _args.reset, _args.non_interactive)?;
663663
// Optional agent setup step
664664
let ws_dir = config.workspace_dir();
665665
match rustyclaw_core::tools::agent_setup::exec_agent_setup(
@@ -709,7 +709,7 @@ async fn main() -> Result<()> {
709709
#[cfg(feature = "tui")]
710710
{
711711
let mut secrets = open_secrets(&config)?;
712-
run_onboard_wizard(&mut config, &mut secrets, false)?;
712+
run_onboard_wizard(&mut config, &mut secrets, false, false)?;
713713
}
714714
#[cfg(not(feature = "tui"))]
715715
{

crates/rustyclaw-tui/src/onboard.rs

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub fn run_onboard_wizard(
2323
config: &mut Config,
2424
secrets: &mut SecretsManager,
2525
reset: bool,
26+
non_interactive: bool,
2627
) -> Result<bool> {
2728
let stdin = io::stdin();
2829
let mut reader = stdin.lock();
@@ -38,48 +39,50 @@ pub fn run_onboard_wizard(
3839
}
3940

4041
// ── 0. Safety acknowledgment ───────────────────────────────────
41-
println!(
42-
"{}",
43-
t::warn("⚠ Important: Please read before continuing.")
44-
);
45-
println!();
46-
println!(
47-
" RustyClaw is an {}, meaning it can",
48-
t::accent_bright("agentic coding tool")
49-
);
50-
println!(" read, write, and execute code on your machine on your");
51-
println!(" behalf. Like any powerful tool, it should be used with");
52-
println!(" care and awareness.");
53-
println!();
54-
println!(
55-
" • {} and modify files in your project",
56-
t::bold("It can create")
57-
);
58-
println!(" • {} commands in your terminal", t::bold("It can run"));
59-
println!(
60-
" • {} with external APIs using your credentials",
61-
t::bold("It can interact")
62-
);
63-
println!();
64-
println!(" Always review actions before approving them, especially");
65-
println!(" in production environments. You are responsible for any");
66-
println!(" changes made by the tool.");
67-
println!();
68-
69-
let ack = prompt_line(
70-
&mut reader,
71-
&format!(
72-
"{} ",
73-
t::accent("Do you acknowledge and wish to continue? [y/N]:")
74-
),
75-
)?;
76-
if !ack.trim().eq_ignore_ascii_case("y") {
42+
if !non_interactive {
43+
println!(
44+
"{}",
45+
t::warn("⚠ Important: Please read before continuing.")
46+
);
7747
println!();
78-
println!(" {}", t::muted("Onboarding cancelled."));
48+
println!(
49+
" RustyClaw is an {}, meaning it can",
50+
t::accent_bright("agentic coding tool")
51+
);
52+
println!(" read, write, and execute code on your machine on your");
53+
println!(" behalf. Like any powerful tool, it should be used with");
54+
println!(" care and awareness.");
55+
println!();
56+
println!(
57+
" • {} and modify files in your project",
58+
t::bold("It can create")
59+
);
60+
println!(" • {} commands in your terminal", t::bold("It can run"));
61+
println!(
62+
" • {} with external APIs using your credentials",
63+
t::bold("It can interact")
64+
);
65+
println!();
66+
println!(" Always review actions before approving them, especially");
67+
println!(" in production environments. You are responsible for any");
68+
println!(" changes made by the tool.");
69+
println!();
70+
71+
let ack = prompt_line(
72+
&mut reader,
73+
&format!(
74+
"{} ",
75+
t::accent("Do you acknowledge and wish to continue? [y/N]:")
76+
),
77+
)?;
78+
if !ack.trim().eq_ignore_ascii_case("y") {
79+
println!();
80+
println!(" {}", t::muted("Onboarding cancelled."));
81+
println!();
82+
return Ok(false);
83+
}
7984
println!();
80-
return Ok(false);
8185
}
82-
println!();
8386

8487
// ── 0b. Name your agent ────────────────────────────────────────
8588
println!("{}", t::heading("Name your agent:"));

pr-description.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Add Signal messenger support via signal-cli
2+
3+
Fixes #115
4+
5+
## Summary
6+
7+
This PR implements Signal Private Messenger integration for RustyClaw using the `signal-cli` external tool. This follows the CLI-based messenger approach outlined in the issue, providing a clean integration without requiring complex native Signal protocol libraries.
8+
9+
## Changes Made
10+
11+
### Core Implementation
12+
- **`crates/rustyclaw-core/src/messengers/signal_cli.rs`**: Complete SignalCliMessenger implementation
13+
- **`crates/rustyclaw-core/Cargo.toml`**: Added `signal-cli` feature flag
14+
- **`crates/rustyclaw-core/src/messengers/mod.rs`**: Exported SignalCliMessenger with feature gating
15+
16+
### Documentation
17+
- **`docs/signal-cli-setup.md`**: Comprehensive setup and configuration guide
18+
19+
## Features
20+
21+
**Send messages** to individual phone numbers
22+
**Receive messages** with JSON parsing
23+
**Phone number normalization** to E.164 format
24+
**Media attachment support** via signal-cli
25+
**Group messaging** support (requires group IDs)
26+
**Proper error handling** with descriptive messages
27+
**Connection management** and health checks
28+
**Integration tests** for core functionality
29+
30+
## Prerequisites
31+
32+
This implementation requires:
33+
34+
1. **signal-cli**: Must be installed separately from https://github.com/AsamK/signal-cli
35+
2. **Signal registration**: Phone number must be registered with Signal
36+
3. **Configuration**: Proper setup in RustyClaw config.toml
37+
38+
## Configuration Example
39+
40+
```toml
41+
[messengers.signal]
42+
type = "signal-cli"
43+
phone_number = "+1234567890"
44+
signal_cli_path = "/usr/local/bin/signal-cli" # Optional
45+
enabled = true
46+
```
47+
48+
## Usage Example
49+
50+
```rust
51+
use rustyclaw_core::messengers::{SignalCliMessenger, Messenger};
52+
53+
let mut messenger = SignalCliMessenger::new(
54+
"my_signal".to_string(),
55+
"+1234567890".to_string(),
56+
);
57+
58+
messenger.initialize().await?;
59+
let message_id = messenger.send_message("+19876543210", "Hello!").await?;
60+
```
61+
62+
## Testing
63+
64+
Build with Signal support:
65+
```bash
66+
cargo build --features signal-cli
67+
```
68+
69+
Run tests:
70+
```bash
71+
cargo test signal_cli --features signal-cli
72+
```
73+
74+
## Architecture
75+
76+
This implementation follows the existing RustyClaw messenger pattern:
77+
- Implements the `Messenger` trait
78+
- Uses external process execution via `tokio::process::Command`
79+
- Provides proper async/await support
80+
- Includes comprehensive error handling
81+
- Follows the feature-gated compilation model
82+
83+
## Limitations
84+
85+
- **External dependency**: Requires signal-cli installation
86+
- **Process overhead**: Each operation spawns a signal-cli process
87+
- **Limited native features**: Some Signal features may not be available
88+
- **Rate limiting**: Subject to Signal's rate limits
89+
90+
## Backward Compatibility
91+
92+
This change is fully backward compatible:
93+
- New feature is behind a feature flag (`signal-cli`)
94+
- No changes to existing messenger APIs
95+
- No breaking changes to configuration format
96+
- Existing messengers remain unaffected
97+
98+
## Future Improvements
99+
100+
Potential enhancements for follow-up PRs:
101+
- Process pooling for better performance
102+
- Enhanced group chat management
103+
- Better media handling and validation
104+
- Signal sticker support
105+
- Message reaction support
106+
107+
## Related Issues
108+
109+
- Closes #115: Messenger support with CLI-based approach
110+
- Part of the two-tier messenger strategy discussed in #115
111+
112+
---
113+
114+
**Review Notes**: This implementation provides a solid foundation for Signal messaging in RustyClaw while maintaining the project's architectural principles. The CLI-based approach ensures reliability and easier maintenance compared to native protocol implementations.

0 commit comments

Comments
 (0)