Compare commits

...
Author SHA1 Message Date
Patrick szymkowiak 7dbef2ce00 fix(init): remove telemetry info lines from init output
Telemetry details are already documented in the README privacy section.
No need to print them during init.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-03 13:37:52 +02:00
aesoft 5bd35a33ad Merge pull request #952 from rtk-ai/fix/pr-934-review
fix(review): PR #934
2026-03-31 20:45:44 +02:00
aesoft bae7930119 fix(review): PR #934 2026-03-31 20:43:59 +02:00
5 changed files with 56 additions and 61 deletions

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ To apply, you should have:
### ✍️ How to Apply
1. Open a discussion in [rtk-ai/rtk Maintainers Applications · Discussions · GitHub]() titled **Maintainer Application: [Your GitHub Handle]**
1. Open a discussion in [rtk-ai/rtk Maintainers Applications · Discussions · GitHub](https://github.com/rtk-ai/rtk/discussions/categories/maintainers-applications) titled **Maintainer Application: [Your GitHub Handle]**
2. In your application, include:
- The ecosystem(s) you're interested in
- Your experience with those ecosystems
+2 -2
View File
@@ -77,8 +77,8 @@ where
// On failure, skip filtering and return early (e.g. psql error messages
// containing '|' would be misinterpreted by the table parser)
if opts.skip_filter_on_failure && exit_code != 0 {
if !stderr.is_empty() {
eprint!("{}", stderr);
if !stderr.trim().is_empty() {
eprintln!("{}", stderr.trim());
}
timer.track(
&format!("{} {}", tool_name, args_display),
+24 -49
View File
@@ -70,11 +70,11 @@ pub fn tokenize(input: &str) -> Vec<ParsedToken> {
.is_some_and(|&nc| nc.is_ascii_alphabetic() || nc == '_')
{
let mut name = String::from("$");
while chars
.peek()
.is_some_and(|&nc| nc.is_ascii_alphanumeric() || nc == '_')
{
let nc = chars.next().unwrap();
while let Some(&nc) = chars.peek() {
if !nc.is_ascii_alphanumeric() && nc != '_' {
break;
}
chars.next();
byte_pos += nc.len_utf8();
name.push(nc);
}
@@ -107,7 +107,8 @@ pub fn tokenize(input: &str) -> Vec<ParsedToken> {
let start = byte_pos;
byte_pos += char_len;
if chars.peek() == Some(&'|') {
byte_pos += chars.next().unwrap().len_utf8();
chars.next();
byte_pos += 1;
tokens.push(ParsedToken {
kind: TokenKind::Operator,
value: "||".into(),
@@ -137,18 +138,21 @@ pub fn tokenize(input: &str) -> Vec<ParsedToken> {
let start = byte_pos;
byte_pos += char_len;
if chars.peek() == Some(&'&') {
byte_pos += chars.next().unwrap().len_utf8();
chars.next();
byte_pos += 1;
tokens.push(ParsedToken {
kind: TokenKind::Operator,
value: "&&".into(),
offset: start,
});
} else if chars.peek() == Some(&'>') {
byte_pos += chars.next().unwrap().len_utf8();
chars.next();
byte_pos += 1;
let mut val = String::from("&>");
if chars.peek() == Some(&'>') {
chars.next();
byte_pos += 1;
val.push('>');
byte_pos += chars.next().unwrap().len_utf8();
}
tokens.push(ParsedToken {
kind: TokenKind::Redirect,
@@ -181,17 +185,19 @@ pub fn tokenize(input: &str) -> Vec<ParsedToken> {
val.push('>');
byte_pos += char_len;
if chars.peek() == Some(&'>') {
chars.next();
byte_pos += 1;
val.push('>');
byte_pos += chars.next().unwrap().len_utf8();
}
if chars.peek() == Some(&'&') {
chars.next();
byte_pos += 1;
val.push('&');
byte_pos += chars.next().unwrap().len_utf8();
while chars
.peek()
.is_some_and(|&c| c.is_ascii_digit() || c == '-')
{
let nc = chars.next().unwrap();
while let Some(&nc) = chars.peek() {
if !nc.is_ascii_digit() && nc != '-' {
break;
}
chars.next();
val.push(nc);
byte_pos += nc.len_utf8();
}
@@ -209,8 +215,9 @@ pub fn tokenize(input: &str) -> Vec<ParsedToken> {
let mut val = String::from("<");
byte_pos += char_len;
if chars.peek() == Some(&'<') {
chars.next();
byte_pos += 1;
val.push('<');
byte_pos += chars.next().unwrap().len_utf8();
}
tokens.push(ParsedToken {
kind: TokenKind::Redirect,
@@ -251,18 +258,6 @@ fn flush_arg(tokens: &mut Vec<ParsedToken>, current: &mut String, offset: usize)
}
}
#[allow(dead_code)]
pub fn strip_quotes(s: &str) -> String {
let chars: Vec<char> = s.chars().collect();
if chars.len() >= 2
&& ((chars[0] == '"' && chars[chars.len() - 1] == '"')
|| (chars[0] == '\'' && chars[chars.len() - 1] == '\''))
{
return chars[1..chars.len() - 1].iter().collect();
}
s.to_string()
}
pub fn shell_split(input: &str) -> Vec<String> {
let mut tokens = Vec::new();
let mut current = String::new();
@@ -860,26 +855,6 @@ mod tests {
.any(|t| t.kind == TokenKind::Arg && t.value == "file"));
}
#[test]
fn test_strip_quotes_double() {
assert_eq!(strip_quotes("\"hello\""), "hello");
}
#[test]
fn test_strip_quotes_single() {
assert_eq!(strip_quotes("'hello'"), "hello");
}
#[test]
fn test_strip_quotes_none() {
assert_eq!(strip_quotes("hello"), "hello");
}
#[test]
fn test_strip_quotes_mismatched() {
assert_eq!(strip_quotes("\"hello'"), "\"hello'");
}
#[test]
fn test_shell_split_simple() {
assert_eq!(
+29
View File
@@ -2370,4 +2370,33 @@ mod tests {
Some("rtk wc src/*.rs".into())
);
}
#[test]
fn test_classify_command_substitution_passthrough() {
assert_eq!(
classify_command("git log $(git rev-parse HEAD~1)"),
Classification::Supported {
rtk_equivalent: "rtk git",
category: "Git",
estimated_savings_pct: 70.0,
status: RtkStatus::Existing,
}
);
}
#[test]
fn test_rewrite_command_substitution_passthrough() {
assert_eq!(
rewrite_command("git log $(git rev-parse HEAD~1)", &[]),
Some("rtk git log $(git rev-parse HEAD~1)".into())
);
}
#[test]
fn test_split_command_substitution_no_split() {
assert_eq!(
split_command_chain("git log $(git rev-parse HEAD~1)"),
vec!["git log $(git rev-parse HEAD~1)"]
);
}
}
-9
View File
@@ -11,7 +11,6 @@ use super::constants::{
REWRITE_HOOK_FILE, SETTINGS_JSON,
};
use super::integrity;
use crate::core::config;
// Embedded hook script (guards before set -euo pipefail)
const REWRITE_HOOK: &str = include_str!("../../hooks/claude/rtk-rewrite.sh");
@@ -293,14 +292,6 @@ pub fn run(
}
println!();
let env_disabled = std::env::var("RTK_TELEMETRY_DISABLED").unwrap_or_default() == "1";
let config_disabled = matches!(config::telemetry_enabled(), Some(false));
if env_disabled || config_disabled {
println!(" [info] Anonymous telemetry is disabled");
} else {
println!(" [info] Anonymous telemetry is enabled by default (opt-out: RTK_TELEMETRY_DISABLED=1)");
}
println!(" [info] See: https://github.com/rtk-ai/rtk#privacy--telemetry");
Ok(())
}