Skip to content

ci: add spell check #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2025
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
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ jobs:

- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings

spelling:
name: spell check with typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Spell Check Repo
uses: crate-ci/typos@master

test:
name: Run Tests
Expand Down
14 changes: 7 additions & 7 deletions crates/rmcp-macros/src/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu
// let mut fommated_fn_args: Punctuated<FnArg, Comma> = Punctuated::new();
let mut unextractable_args_indexes = HashSet::new();
for (index, mut fn_arg) in input_fn.sig.inputs.iter_mut().enumerate() {
enum Catched {
enum Caught {
Param(ToolFnParamAttrs),
Aggregated(PatType),
}
let mut catched = None;
let mut caught = None;
match &mut fn_arg {
FnArg::Receiver(_) => {
continue;
Expand All @@ -244,15 +244,15 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu
"input param must have an ident as name",
));
};
catched.replace(Catched::Param(ToolFnParamAttrs {
caught.replace(Caught::Param(ToolFnParamAttrs {
serde_meta: Vec::new(),
schemars_meta: Vec::new(),
ident: arg_ident,
rust_type: pat_type.ty.clone(),
}));
}
ParamMarker::Aggregated => {
catched.replace(Catched::Aggregated(pat_type.clone()));
caught.replace(Caught::Aggregated(pat_type.clone()));
}
}
} else if meta_list.path.is_ident(SERDE_IDENT) {
Expand All @@ -268,8 +268,8 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu
}
}
}
match catched {
Some(Catched::Param(mut param)) => {
match caught {
Some(Caught::Param(mut param)) => {
param.serde_meta = serde_metas;
param.schemars_meta = schemars_metas;
match &mut tool_macro_attrs.params {
Expand All @@ -282,7 +282,7 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu
}
unextractable_args_indexes.insert(index);
}
Some(Catched::Aggregated(rust_type)) => {
Some(Caught::Aggregated(rust_type)) => {
tool_macro_attrs.params = ToolParams::Aggregated { rust_type };
unextractable_args_indexes.insert(index);
}
Expand Down
20 changes: 17 additions & 3 deletions examples/rig-integration/src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,24 @@ pub async fn output_error(
e: impl std::fmt::Display,
output: &mut BufWriter<tokio::io::Stdout>,
) -> std::io::Result<()> {
output.write_all(b"\x1b[31mERROR: \x1b[0m").await?;
output
.write_all(b"\x1b[1;31m\xE2\x9D\x8C ERROR: \x1b[0m")
.await?;
output.write_all(e.to_string().as_bytes()).await?;
output.write_all(b"\n").await?;
output.flush().await?;
Ok(())
}

pub async fn output_agent(
content: impl std::fmt::Display,
output: &mut BufWriter<tokio::io::Stdout>,
) -> std::io::Result<()> {
output
.write_all(b"\x1b[1;34m\xF0\x9F\xA4\x96 Agent: \x1b[0m")
.await?;
output.write_all(content.to_string().as_bytes()).await?;
output.write_all(b"\n").await?;
output.flush().await?;
Ok(())
}
Expand All @@ -93,22 +100,29 @@ pub async fn stream_output_toolcall(
content: impl std::fmt::Display,
output: &mut BufWriter<tokio::io::Stdout>,
) -> std::io::Result<()> {
output.write_all(b"\x1b[33mtool>\x1b[0m ").await?;
output
.write_all(b"\x1b[1;33m\xF0\x9F\x9B\xA0 Tool Call: \x1b[0m")
.await?;
output.write_all(content.to_string().as_bytes()).await?;
output.write_all(b"\n").await?;
output.flush().await?;
Ok(())
}

pub async fn stream_output_agent_start(
output: &mut BufWriter<tokio::io::Stdout>,
) -> std::io::Result<()> {
output.write_all(b"\x1b[34magent>\x1b[0m ").await?;
output
.write_all(b"\x1b[1;34m\xF0\x9F\xA4\x96 Agent: \x1b[0m")
.await?;
output.flush().await?;
Ok(())
}

pub async fn stream_output_agent_finished(
output: &mut BufWriter<tokio::io::Stdout>,
) -> std::io::Result<()> {
output.write_all(b"\n").await?;
output.flush().await?;
Ok(())
}
Loading